1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616 |
- /*!
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
- * v1.0.0-beta.97
- */
- 'use strict';
- Object.defineProperty(exports, '__esModule', { value: true });
- /*!
- Stencil Mock Doc v2.18.1 | MIT Licensed | https://stenciljs.com
- */
- const CONTENT_REF_ID = 'r';
- const ORG_LOCATION_ID = 'o';
- const SLOT_NODE_ID = 's';
- const TEXT_NODE_ID = 't';
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
- const attrHandler = {
- get(obj, prop) {
- if (prop in obj) {
- return obj[prop];
- }
- if (typeof prop !== 'symbol' && !isNaN(prop)) {
- return obj.__items[prop];
- }
- return undefined;
- },
- };
- const createAttributeProxy = (caseInsensitive) => new Proxy(new MockAttributeMap(caseInsensitive), attrHandler);
- class MockAttributeMap {
- constructor(caseInsensitive = false) {
- this.caseInsensitive = caseInsensitive;
- this.__items = [];
- }
- get length() {
- return this.__items.length;
- }
- item(index) {
- return this.__items[index] || null;
- }
- setNamedItem(attr) {
- attr.namespaceURI = null;
- this.setNamedItemNS(attr);
- }
- setNamedItemNS(attr) {
- if (attr != null && attr.value != null) {
- attr.value = String(attr.value);
- }
- const existingAttr = this.__items.find((a) => a.name === attr.name && a.namespaceURI === attr.namespaceURI);
- if (existingAttr != null) {
- existingAttr.value = attr.value;
- }
- else {
- this.__items.push(attr);
- }
- }
- getNamedItem(attrName) {
- if (this.caseInsensitive) {
- attrName = attrName.toLowerCase();
- }
- return this.getNamedItemNS(null, attrName);
- }
- getNamedItemNS(namespaceURI, attrName) {
- namespaceURI = getNamespaceURI(namespaceURI);
- return (this.__items.find((attr) => attr.name === attrName && getNamespaceURI(attr.namespaceURI) === namespaceURI) || null);
- }
- removeNamedItem(attr) {
- this.removeNamedItemNS(attr);
- }
- removeNamedItemNS(attr) {
- for (let i = 0, ii = this.__items.length; i < ii; i++) {
- if (this.__items[i].name === attr.name && this.__items[i].namespaceURI === attr.namespaceURI) {
- this.__items.splice(i, 1);
- break;
- }
- }
- }
- [Symbol.iterator]() {
- let i = 0;
- return {
- next: () => ({
- done: i === this.length,
- value: this.item(i++),
- }),
- };
- }
- get [Symbol.toStringTag]() {
- return 'MockAttributeMap';
- }
- }
- function getNamespaceURI(namespaceURI) {
- return namespaceURI === XLINK_NS ? null : namespaceURI;
- }
- function cloneAttributes(srcAttrs, sortByName = false) {
- const dstAttrs = new MockAttributeMap(srcAttrs.caseInsensitive);
- if (srcAttrs != null) {
- const attrLen = srcAttrs.length;
- if (sortByName && attrLen > 1) {
- const sortedAttrs = [];
- for (let i = 0; i < attrLen; i++) {
- const srcAttr = srcAttrs.item(i);
- const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
- sortedAttrs.push(dstAttr);
- }
- sortedAttrs.sort(sortAttributes).forEach((attr) => {
- dstAttrs.setNamedItemNS(attr);
- });
- }
- else {
- for (let i = 0; i < attrLen; i++) {
- const srcAttr = srcAttrs.item(i);
- const dstAttr = new MockAttr(srcAttr.name, srcAttr.value, srcAttr.namespaceURI);
- dstAttrs.setNamedItemNS(dstAttr);
- }
- }
- }
- return dstAttrs;
- }
- function sortAttributes(a, b) {
- if (a.name < b.name)
- return -1;
- if (a.name > b.name)
- return 1;
- return 0;
- }
- class MockAttr {
- constructor(attrName, attrValue, namespaceURI = null) {
- this._name = attrName;
- this._value = String(attrValue);
- this._namespaceURI = namespaceURI;
- }
- get name() {
- return this._name;
- }
- set name(value) {
- this._name = value;
- }
- get value() {
- return this._value;
- }
- set value(value) {
- this._value = String(value);
- }
- get nodeName() {
- return this._name;
- }
- set nodeName(value) {
- this._name = value;
- }
- get nodeValue() {
- return this._value;
- }
- set nodeValue(value) {
- this._value = String(value);
- }
- get namespaceURI() {
- return this._namespaceURI;
- }
- set namespaceURI(namespaceURI) {
- this._namespaceURI = namespaceURI;
- }
- }
- class MockClassList {
- constructor(elm) {
- this.elm = elm;
- }
- add(...classNames) {
- const clsNames = getItems(this.elm);
- let updated = false;
- classNames.forEach((className) => {
- className = String(className);
- validateClass(className);
- if (clsNames.includes(className) === false) {
- clsNames.push(className);
- updated = true;
- }
- });
- if (updated) {
- this.elm.setAttributeNS(null, 'class', clsNames.join(' '));
- }
- }
- remove(...classNames) {
- const clsNames = getItems(this.elm);
- let updated = false;
- classNames.forEach((className) => {
- className = String(className);
- validateClass(className);
- const index = clsNames.indexOf(className);
- if (index > -1) {
- clsNames.splice(index, 1);
- updated = true;
- }
- });
- if (updated) {
- this.elm.setAttributeNS(null, 'class', clsNames.filter((c) => c.length > 0).join(' '));
- }
- }
- contains(className) {
- className = String(className);
- return getItems(this.elm).includes(className);
- }
- toggle(className) {
- className = String(className);
- if (this.contains(className) === true) {
- this.remove(className);
- }
- else {
- this.add(className);
- }
- }
- get length() {
- return getItems(this.elm).length;
- }
- item(index) {
- return getItems(this.elm)[index];
- }
- toString() {
- return getItems(this.elm).join(' ');
- }
- }
- function validateClass(className) {
- if (className === '') {
- throw new Error('The token provided must not be empty.');
- }
- if (/\s/.test(className)) {
- throw new Error(`The token provided ('${className}') contains HTML space characters, which are not valid in tokens.`);
- }
- }
- function getItems(elm) {
- const className = elm.getAttribute('class');
- if (typeof className === 'string' && className.length > 0) {
- return className
- .trim()
- .split(' ')
- .filter((c) => c.length > 0);
- }
- return [];
- }
- class MockCSSStyleDeclaration {
- constructor() {
- this._styles = new Map();
- }
- setProperty(prop, value) {
- prop = jsCaseToCssCase(prop);
- if (value == null || value === '') {
- this._styles.delete(prop);
- }
- else {
- this._styles.set(prop, String(value));
- }
- }
- getPropertyValue(prop) {
- prop = jsCaseToCssCase(prop);
- return String(this._styles.get(prop) || '');
- }
- removeProperty(prop) {
- prop = jsCaseToCssCase(prop);
- this._styles.delete(prop);
- }
- get length() {
- return this._styles.size;
- }
- get cssText() {
- const cssText = [];
- this._styles.forEach((value, prop) => {
- cssText.push(`${prop}: ${value};`);
- });
- return cssText.join(' ').trim();
- }
- set cssText(cssText) {
- if (cssText == null || cssText === '') {
- this._styles.clear();
- return;
- }
- cssText.split(';').forEach((rule) => {
- rule = rule.trim();
- if (rule.length > 0) {
- const splt = rule.split(':');
- if (splt.length > 1) {
- const prop = splt[0].trim();
- const value = splt.slice(1).join(':').trim();
- if (prop !== '' && value !== '') {
- this._styles.set(jsCaseToCssCase(prop), value);
- }
- }
- }
- });
- }
- }
- function createCSSStyleDeclaration() {
- return new Proxy(new MockCSSStyleDeclaration(), cssProxyHandler);
- }
- const cssProxyHandler = {
- get(cssStyle, prop) {
- if (prop in cssStyle) {
- return cssStyle[prop];
- }
- prop = cssCaseToJsCase(prop);
- return cssStyle.getPropertyValue(prop);
- },
- set(cssStyle, prop, value) {
- if (prop in cssStyle) {
- cssStyle[prop] = value;
- }
- else {
- cssStyle.setProperty(prop, value);
- }
- return true;
- },
- };
- function cssCaseToJsCase(str) {
- // font-size to fontSize
- if (str.length > 1 && str.includes('-') === true) {
- str = str
- .toLowerCase()
- .split('-')
- .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
- .join('');
- str = str.slice(0, 1).toLowerCase() + str.slice(1);
- }
- return str;
- }
- function jsCaseToCssCase(str) {
- // fontSize to font-size
- if (str.length > 1 && str.includes('-') === false && /[A-Z]/.test(str) === true) {
- str = str
- .replace(/([A-Z])/g, (g) => ' ' + g[0])
- .trim()
- .replace(/ /g, '-')
- .toLowerCase();
- }
- return str;
- }
- class MockCustomElementRegistry {
- constructor(win) {
- this.win = win;
- }
- define(tagName, cstr, options) {
- if (tagName.toLowerCase() !== tagName) {
- throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': "${tagName}" is not a valid custom element name`);
- }
- if (this.__registry == null) {
- this.__registry = new Map();
- }
- this.__registry.set(tagName, { cstr, options });
- if (this.__whenDefined != null) {
- const whenDefinedResolveFns = this.__whenDefined.get(tagName);
- if (whenDefinedResolveFns != null) {
- whenDefinedResolveFns.forEach((whenDefinedResolveFn) => {
- whenDefinedResolveFn();
- });
- whenDefinedResolveFns.length = 0;
- this.__whenDefined.delete(tagName);
- }
- }
- const doc = this.win.document;
- if (doc != null) {
- const hosts = doc.querySelectorAll(tagName);
- hosts.forEach((host) => {
- if (upgradedElements.has(host) === false) {
- tempDisableCallbacks.add(doc);
- const upgradedCmp = createCustomElement(this, doc, tagName);
- for (let i = 0; i < host.childNodes.length; i++) {
- const childNode = host.childNodes[i];
- childNode.remove();
- upgradedCmp.appendChild(childNode);
- }
- tempDisableCallbacks.delete(doc);
- if (proxyElements.has(host)) {
- proxyElements.set(host, upgradedCmp);
- }
- }
- fireConnectedCallback(host);
- });
- }
- }
- get(tagName) {
- if (this.__registry != null) {
- const def = this.__registry.get(tagName.toLowerCase());
- if (def != null) {
- return def.cstr;
- }
- }
- return undefined;
- }
- upgrade(_rootNode) {
- //
- }
- clear() {
- if (this.__registry != null) {
- this.__registry.clear();
- }
- if (this.__whenDefined != null) {
- this.__whenDefined.clear();
- }
- }
- whenDefined(tagName) {
- tagName = tagName.toLowerCase();
- if (this.__registry != null && this.__registry.has(tagName) === true) {
- return Promise.resolve(this.__registry.get(tagName).cstr);
- }
- return new Promise((resolve) => {
- if (this.__whenDefined == null) {
- this.__whenDefined = new Map();
- }
- let whenDefinedResolveFns = this.__whenDefined.get(tagName);
- if (whenDefinedResolveFns == null) {
- whenDefinedResolveFns = [];
- this.__whenDefined.set(tagName, whenDefinedResolveFns);
- }
- whenDefinedResolveFns.push(resolve);
- });
- }
- }
- function createCustomElement(customElements, ownerDocument, tagName) {
- const Cstr = customElements.get(tagName);
- if (Cstr != null) {
- const cmp = new Cstr(ownerDocument);
- cmp.nodeName = tagName.toUpperCase();
- upgradedElements.add(cmp);
- return cmp;
- }
- const host = new Proxy({}, {
- get(obj, prop) {
- const elm = proxyElements.get(host);
- if (elm != null) {
- return elm[prop];
- }
- return obj[prop];
- },
- set(obj, prop, val) {
- const elm = proxyElements.get(host);
- if (elm != null) {
- elm[prop] = val;
- }
- else {
- obj[prop] = val;
- }
- return true;
- },
- has(obj, prop) {
- const elm = proxyElements.get(host);
- if (prop in elm) {
- return true;
- }
- if (prop in obj) {
- return true;
- }
- return false;
- },
- });
- const elm = new MockHTMLElement(ownerDocument, tagName);
- proxyElements.set(host, elm);
- return host;
- }
- const proxyElements = new WeakMap();
- const upgradedElements = new WeakSet();
- function connectNode(ownerDocument, node) {
- node.ownerDocument = ownerDocument;
- if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
- if (ownerDocument != null && node.nodeName.includes('-')) {
- const win = ownerDocument.defaultView;
- if (win != null && typeof node.connectedCallback === 'function' && node.isConnected) {
- fireConnectedCallback(node);
- }
- const shadowRoot = node.shadowRoot;
- if (shadowRoot != null) {
- shadowRoot.childNodes.forEach((childNode) => {
- connectNode(ownerDocument, childNode);
- });
- }
- }
- node.childNodes.forEach((childNode) => {
- connectNode(ownerDocument, childNode);
- });
- }
- else {
- node.childNodes.forEach((childNode) => {
- childNode.ownerDocument = ownerDocument;
- });
- }
- }
- function fireConnectedCallback(node) {
- if (typeof node.connectedCallback === 'function') {
- if (tempDisableCallbacks.has(node.ownerDocument) === false) {
- try {
- node.connectedCallback();
- }
- catch (e) {
- console.error(e);
- }
- }
- }
- }
- function disconnectNode(node) {
- if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
- if (node.nodeName.includes('-') === true && typeof node.disconnectedCallback === 'function') {
- if (tempDisableCallbacks.has(node.ownerDocument) === false) {
- try {
- node.disconnectedCallback();
- }
- catch (e) {
- console.error(e);
- }
- }
- }
- node.childNodes.forEach(disconnectNode);
- }
- }
- function attributeChanged(node, attrName, oldValue, newValue) {
- attrName = attrName.toLowerCase();
- const observedAttributes = node.constructor.observedAttributes;
- if (Array.isArray(observedAttributes) === true &&
- observedAttributes.some((obs) => obs.toLowerCase() === attrName) === true) {
- try {
- node.attributeChangedCallback(attrName, oldValue, newValue);
- }
- catch (e) {
- console.error(e);
- }
- }
- }
- function checkAttributeChanged(node) {
- return node.nodeName.includes('-') === true && typeof node.attributeChangedCallback === 'function';
- }
- const tempDisableCallbacks = new Set();
- function dataset(elm) {
- const ds = {};
- const attributes = elm.attributes;
- const attrLen = attributes.length;
- for (let i = 0; i < attrLen; i++) {
- const attr = attributes.item(i);
- const nodeName = attr.nodeName;
- if (nodeName.startsWith('data-')) {
- ds[dashToPascalCase(nodeName)] = attr.nodeValue;
- }
- }
- return new Proxy(ds, {
- get(_obj, camelCaseProp) {
- return ds[camelCaseProp];
- },
- set(_obj, camelCaseProp, value) {
- const dataAttr = toDataAttribute(camelCaseProp);
- elm.setAttribute(dataAttr, value);
- return true;
- },
- });
- }
- function toDataAttribute(str) {
- return ('data-' +
- String(str)
- .replace(/([A-Z0-9])/g, (g) => ' ' + g[0])
- .trim()
- .replace(/ /g, '-')
- .toLowerCase());
- }
- function dashToPascalCase(str) {
- str = String(str).slice(5);
- return str
- .split('-')
- .map((segment, index) => {
- if (index === 0) {
- return segment.charAt(0).toLowerCase() + segment.slice(1);
- }
- return segment.charAt(0).toUpperCase() + segment.slice(1);
- })
- .join('');
- }
- class MockEvent {
- constructor(type, eventInitDict) {
- this.bubbles = false;
- this.cancelBubble = false;
- this.cancelable = false;
- this.composed = false;
- this.currentTarget = null;
- this.defaultPrevented = false;
- this.srcElement = null;
- this.target = null;
- if (typeof type !== 'string') {
- throw new Error(`Event type required`);
- }
- this.type = type;
- this.timeStamp = Date.now();
- if (eventInitDict != null) {
- Object.assign(this, eventInitDict);
- }
- }
- preventDefault() {
- this.defaultPrevented = true;
- }
- stopPropagation() {
- this.cancelBubble = true;
- }
- stopImmediatePropagation() {
- this.cancelBubble = true;
- }
- composedPath() {
- const composedPath = [];
- let currentElement = this.target;
- while (currentElement) {
- composedPath.push(currentElement);
- if (!currentElement.parentElement && currentElement.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
- // the current element doesn't have a parent, but we've detected it's our root document node. push the window
- // object associated with the document onto the path
- composedPath.push(currentElement.defaultView);
- break;
- }
- currentElement = currentElement.parentElement;
- }
- return composedPath;
- }
- }
- class MockCustomEvent extends MockEvent {
- constructor(type, customEventInitDic) {
- super(type);
- this.detail = null;
- if (customEventInitDic != null) {
- Object.assign(this, customEventInitDic);
- }
- }
- }
- class MockKeyboardEvent extends MockEvent {
- constructor(type, keyboardEventInitDic) {
- super(type);
- this.code = '';
- this.key = '';
- this.altKey = false;
- this.ctrlKey = false;
- this.metaKey = false;
- this.shiftKey = false;
- this.location = 0;
- this.repeat = false;
- if (keyboardEventInitDic != null) {
- Object.assign(this, keyboardEventInitDic);
- }
- }
- }
- class MockMouseEvent extends MockEvent {
- constructor(type, mouseEventInitDic) {
- super(type);
- this.screenX = 0;
- this.screenY = 0;
- this.clientX = 0;
- this.clientY = 0;
- this.ctrlKey = false;
- this.shiftKey = false;
- this.altKey = false;
- this.metaKey = false;
- this.button = 0;
- this.buttons = 0;
- this.relatedTarget = null;
- if (mouseEventInitDic != null) {
- Object.assign(this, mouseEventInitDic);
- }
- }
- }
- class MockUIEvent extends MockEvent {
- constructor(type, uiEventInitDic) {
- super(type);
- this.detail = null;
- this.view = null;
- if (uiEventInitDic != null) {
- Object.assign(this, uiEventInitDic);
- }
- }
- }
- class MockFocusEvent extends MockUIEvent {
- constructor(type, focusEventInitDic) {
- super(type);
- this.relatedTarget = null;
- if (focusEventInitDic != null) {
- Object.assign(this, focusEventInitDic);
- }
- }
- }
- class MockEventListener {
- constructor(type, handler) {
- this.type = type;
- this.handler = handler;
- }
- }
- function addEventListener(elm, type, handler) {
- const target = elm;
- if (target.__listeners == null) {
- target.__listeners = [];
- }
- target.__listeners.push(new MockEventListener(type, handler));
- }
- function removeEventListener(elm, type, handler) {
- const target = elm;
- if (target != null && Array.isArray(target.__listeners) === true) {
- const elmListener = target.__listeners.find((e) => e.type === type && e.handler === handler);
- if (elmListener != null) {
- const index = target.__listeners.indexOf(elmListener);
- target.__listeners.splice(index, 1);
- }
- }
- }
- function resetEventListeners(target) {
- if (target != null && target.__listeners != null) {
- target.__listeners = null;
- }
- }
- function triggerEventListener(elm, ev) {
- if (elm == null || ev.cancelBubble === true) {
- return;
- }
- const target = elm;
- ev.currentTarget = elm;
- if (Array.isArray(target.__listeners) === true) {
- const listeners = target.__listeners.filter((e) => e.type === ev.type);
- listeners.forEach((listener) => {
- try {
- listener.handler.call(target, ev);
- }
- catch (err) {
- console.error(err);
- }
- });
- }
- if (ev.bubbles === false) {
- return;
- }
- if (elm.nodeName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
- triggerEventListener(elm.defaultView, ev);
- }
- else {
- triggerEventListener(elm.parentElement, ev);
- }
- }
- function dispatchEvent(currentTarget, ev) {
- ev.target = currentTarget;
- triggerEventListener(currentTarget, ev);
- return true;
- }
- // Parse5 6.0.1
- 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&>.install(this,Ut),this.options.onParseError&>.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;
- const docParser = new WeakMap();
- function parseDocumentUtil(ownerDocument, html) {
- const doc = parse(html.trim(), getParser(ownerDocument));
- doc.documentElement = doc.firstElementChild;
- doc.head = doc.documentElement.firstElementChild;
- doc.body = doc.head.nextElementSibling;
- return doc;
- }
- function parseFragmentUtil(ownerDocument, html) {
- if (typeof html === 'string') {
- html = html.trim();
- }
- else {
- html = '';
- }
- const frag = parseFragment(html, getParser(ownerDocument));
- return frag;
- }
- function getParser(ownerDocument) {
- let parseOptions = docParser.get(ownerDocument);
- if (parseOptions != null) {
- return parseOptions;
- }
- const treeAdapter = {
- createDocument() {
- const doc = ownerDocument.createElement("#document" /* NODE_NAMES.DOCUMENT_NODE */);
- doc['x-mode'] = 'no-quirks';
- return doc;
- },
- setNodeSourceCodeLocation(node, location) {
- node.sourceCodeLocation = location;
- },
- getNodeSourceCodeLocation(node) {
- return node.sourceCodeLocation;
- },
- createDocumentFragment() {
- return ownerDocument.createDocumentFragment();
- },
- createElement(tagName, namespaceURI, attrs) {
- const elm = ownerDocument.createElementNS(namespaceURI, tagName);
- for (let i = 0; i < attrs.length; i++) {
- const attr = attrs[i];
- if (attr.namespace == null || attr.namespace === 'http://www.w3.org/1999/xhtml') {
- elm.setAttribute(attr.name, attr.value);
- }
- else {
- elm.setAttributeNS(attr.namespace, attr.name, attr.value);
- }
- }
- return elm;
- },
- createCommentNode(data) {
- return ownerDocument.createComment(data);
- },
- appendChild(parentNode, newNode) {
- parentNode.appendChild(newNode);
- },
- insertBefore(parentNode, newNode, referenceNode) {
- parentNode.insertBefore(newNode, referenceNode);
- },
- setTemplateContent(templateElement, contentElement) {
- templateElement.content = contentElement;
- },
- getTemplateContent(templateElement) {
- return templateElement.content;
- },
- setDocumentType(doc, name, publicId, systemId) {
- let doctypeNode = doc.childNodes.find((n) => n.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */);
- if (doctypeNode == null) {
- doctypeNode = ownerDocument.createDocumentTypeNode();
- doc.insertBefore(doctypeNode, doc.firstChild);
- }
- doctypeNode.nodeValue = '!DOCTYPE';
- doctypeNode['x-name'] = name;
- doctypeNode['x-publicId'] = publicId;
- doctypeNode['x-systemId'] = systemId;
- },
- setDocumentMode(doc, mode) {
- doc['x-mode'] = mode;
- },
- getDocumentMode(doc) {
- return doc['x-mode'];
- },
- detachNode(node) {
- node.remove();
- },
- insertText(parentNode, text) {
- const lastChild = parentNode.lastChild;
- if (lastChild != null && lastChild.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
- lastChild.nodeValue += text;
- }
- else {
- parentNode.appendChild(ownerDocument.createTextNode(text));
- }
- },
- insertTextBefore(parentNode, text, referenceNode) {
- const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
- if (prevNode != null && prevNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
- prevNode.nodeValue += text;
- }
- else {
- parentNode.insertBefore(ownerDocument.createTextNode(text), referenceNode);
- }
- },
- adoptAttributes(recipient, attrs) {
- for (let i = 0; i < attrs.length; i++) {
- const attr = attrs[i];
- if (recipient.hasAttributeNS(attr.namespace, attr.name) === false) {
- recipient.setAttributeNS(attr.namespace, attr.name, attr.value);
- }
- }
- },
- getFirstChild(node) {
- return node.childNodes[0];
- },
- getChildNodes(node) {
- return node.childNodes;
- },
- getParentNode(node) {
- return node.parentNode;
- },
- getAttrList(element) {
- const attrs = element.attributes.__items.map((attr) => {
- return {
- name: attr.name,
- value: attr.value,
- namespace: attr.namespaceURI,
- prefix: null,
- };
- });
- return attrs;
- },
- getTagName(element) {
- if (element.namespaceURI === 'http://www.w3.org/1999/xhtml') {
- return element.nodeName.toLowerCase();
- }
- else {
- return element.nodeName;
- }
- },
- getNamespaceURI(element) {
- return element.namespaceURI;
- },
- getTextNodeContent(textNode) {
- return textNode.nodeValue;
- },
- getCommentNodeContent(commentNode) {
- return commentNode.nodeValue;
- },
- getDocumentTypeNodeName(doctypeNode) {
- return doctypeNode['x-name'];
- },
- getDocumentTypeNodePublicId(doctypeNode) {
- return doctypeNode['x-publicId'];
- },
- getDocumentTypeNodeSystemId(doctypeNode) {
- return doctypeNode['x-systemId'];
- },
- isTextNode(node) {
- return node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */;
- },
- isCommentNode(node) {
- return node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */;
- },
- isDocumentTypeNode(node) {
- return node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
- },
- isElementNode(node) {
- return node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */;
- },
- };
- parseOptions = {
- treeAdapter: treeAdapter,
- };
- docParser.set(ownerDocument, parseOptions);
- return parseOptions;
- }
- // Sizzle 2.3.6
- const Sizzle = (function() {
- const window = {
- document: {
- createElement() {
- return {};
- },
- nodeType: 9,
- documentElement: {
- nodeType: 1,
- nodeName: 'HTML'
- }
- }
- };
- const module = { exports: {} };
- /*! Sizzle v2.3.6 | (c) JS Foundation and other contributors | js.foundation */
- !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);
- //# sourceMappingURL=sizzle.min.map
- return module.exports;
- })();
- function matches(selector, elm) {
- const r = Sizzle.matches(selector, [elm]);
- return r.length > 0;
- }
- function selectOne(selector, elm) {
- const r = Sizzle(selector, elm);
- return r[0] || null;
- }
- function selectAll(selector, elm) {
- return Sizzle(selector, elm);
- }
- function serializeNodeToHtml(elm, opts = {}) {
- const output = {
- currentLineWidth: 0,
- indent: 0,
- isWithinBody: false,
- text: [],
- };
- if (opts.prettyHtml) {
- if (typeof opts.indentSpaces !== 'number') {
- opts.indentSpaces = 2;
- }
- if (typeof opts.newLines !== 'boolean') {
- opts.newLines = true;
- }
- opts.approximateLineWidth = -1;
- }
- else {
- opts.prettyHtml = false;
- if (typeof opts.newLines !== 'boolean') {
- opts.newLines = false;
- }
- if (typeof opts.indentSpaces !== 'number') {
- opts.indentSpaces = 0;
- }
- }
- if (typeof opts.approximateLineWidth !== 'number') {
- opts.approximateLineWidth = -1;
- }
- if (typeof opts.removeEmptyAttributes !== 'boolean') {
- opts.removeEmptyAttributes = true;
- }
- if (typeof opts.removeAttributeQuotes !== 'boolean') {
- opts.removeAttributeQuotes = false;
- }
- if (typeof opts.removeBooleanAttributeQuotes !== 'boolean') {
- opts.removeBooleanAttributeQuotes = false;
- }
- if (typeof opts.removeHtmlComments !== 'boolean') {
- opts.removeHtmlComments = false;
- }
- if (typeof opts.serializeShadowRoot !== 'boolean') {
- opts.serializeShadowRoot = false;
- }
- if (opts.outerHtml) {
- serializeToHtml(elm, opts, output, false);
- }
- else {
- for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
- serializeToHtml(elm.childNodes[i], opts, output, false);
- }
- }
- if (output.text[0] === '\n') {
- output.text.shift();
- }
- if (output.text[output.text.length - 1] === '\n') {
- output.text.pop();
- }
- return output.text.join('');
- }
- function serializeToHtml(node, opts, output, isShadowRoot) {
- if (node.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ || isShadowRoot) {
- const tagName = isShadowRoot ? 'mock:shadow-root' : getTagName(node);
- if (tagName === 'body') {
- output.isWithinBody = true;
- }
- const ignoreTag = opts.excludeTags != null && opts.excludeTags.includes(tagName);
- if (ignoreTag === false) {
- const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
- if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
- output.text.push('\n');
- output.currentLineWidth = 0;
- }
- if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
- for (let i = 0; i < output.indent; i++) {
- output.text.push(' ');
- }
- output.currentLineWidth += output.indent;
- }
- output.text.push('<' + tagName);
- output.currentLineWidth += tagName.length + 1;
- const attrsLength = node.attributes.length;
- const attributes = opts.prettyHtml && attrsLength > 1
- ? cloneAttributes(node.attributes, true)
- : node.attributes;
- for (let i = 0; i < attrsLength; i++) {
- const attr = attributes.item(i);
- const attrName = attr.name;
- if (attrName === 'style') {
- continue;
- }
- let attrValue = attr.value;
- if (opts.removeEmptyAttributes && attrValue === '' && REMOVE_EMPTY_ATTR.has(attrName)) {
- continue;
- }
- const attrNamespaceURI = attr.namespaceURI;
- if (attrNamespaceURI == null) {
- output.currentLineWidth += attrName.length + 1;
- if (opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
- output.text.push('\n' + attrName);
- output.currentLineWidth = 0;
- }
- else {
- output.text.push(' ' + attrName);
- }
- }
- else if (attrNamespaceURI === 'http://www.w3.org/XML/1998/namespace') {
- output.text.push(' xml:' + attrName);
- output.currentLineWidth += attrName.length + 5;
- }
- else if (attrNamespaceURI === 'http://www.w3.org/2000/xmlns/') {
- if (attrName !== 'xmlns') {
- output.text.push(' xmlns:' + attrName);
- output.currentLineWidth += attrName.length + 7;
- }
- else {
- output.text.push(' ' + attrName);
- output.currentLineWidth += attrName.length + 1;
- }
- }
- else if (attrNamespaceURI === XLINK_NS) {
- output.text.push(' xlink:' + attrName);
- output.currentLineWidth += attrName.length + 7;
- }
- else {
- output.text.push(' ' + attrNamespaceURI + ':' + attrName);
- output.currentLineWidth += attrNamespaceURI.length + attrName.length + 2;
- }
- if (opts.prettyHtml && attrName === 'class') {
- attrValue = attr.value = attrValue
- .split(' ')
- .filter((t) => t !== '')
- .sort()
- .join(' ')
- .trim();
- }
- if (attrValue === '') {
- if (opts.removeBooleanAttributeQuotes && BOOLEAN_ATTR.has(attrName)) {
- continue;
- }
- if (opts.removeEmptyAttributes && attrName.startsWith('data-')) {
- continue;
- }
- }
- if (opts.removeAttributeQuotes && CAN_REMOVE_ATTR_QUOTES.test(attrValue)) {
- output.text.push('=' + escapeString(attrValue, true));
- output.currentLineWidth += attrValue.length + 1;
- }
- else {
- output.text.push('="' + escapeString(attrValue, true) + '"');
- output.currentLineWidth += attrValue.length + 3;
- }
- }
- if (node.hasAttribute('style')) {
- const cssText = node.style.cssText;
- if (opts.approximateLineWidth > 0 &&
- output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
- output.text.push(`\nstyle="${cssText}">`);
- output.currentLineWidth = 0;
- }
- else {
- output.text.push(` style="${cssText}">`);
- output.currentLineWidth += cssText.length + 10;
- }
- }
- else {
- output.text.push('>');
- output.currentLineWidth += 1;
- }
- }
- if (EMPTY_ELEMENTS.has(tagName) === false) {
- if (opts.serializeShadowRoot && node.shadowRoot != null) {
- output.indent = output.indent + opts.indentSpaces;
- serializeToHtml(node.shadowRoot, opts, output, true);
- output.indent = output.indent - opts.indentSpaces;
- if (opts.newLines &&
- (node.childNodes.length === 0 ||
- (node.childNodes.length === 1 &&
- node.childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
- node.childNodes[0].nodeValue.trim() === ''))) {
- output.text.push('\n');
- output.currentLineWidth = 0;
- for (let i = 0; i < output.indent; i++) {
- output.text.push(' ');
- }
- output.currentLineWidth += output.indent;
- }
- }
- if (opts.excludeTagContent == null || opts.excludeTagContent.includes(tagName) === false) {
- const childNodes = tagName === 'template' ? node.content.childNodes : node.childNodes;
- const childNodeLength = childNodes.length;
- if (childNodeLength > 0) {
- if (childNodeLength === 1 &&
- childNodes[0].nodeType === 3 /* NODE_TYPES.TEXT_NODE */ &&
- (typeof childNodes[0].nodeValue !== 'string' || childNodes[0].nodeValue.trim() === '')) ;
- else {
- const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
- if (!isWithinWhitespaceSensitiveNode && opts.indentSpaces > 0 && ignoreTag === false) {
- output.indent = output.indent + opts.indentSpaces;
- }
- for (let i = 0; i < childNodeLength; i++) {
- serializeToHtml(childNodes[i], opts, output, false);
- }
- if (ignoreTag === false) {
- if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
- output.text.push('\n');
- output.currentLineWidth = 0;
- }
- if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
- output.indent = output.indent - opts.indentSpaces;
- for (let i = 0; i < output.indent; i++) {
- output.text.push(' ');
- }
- output.currentLineWidth += output.indent;
- }
- }
- }
- }
- if (ignoreTag === false) {
- output.text.push('</' + tagName + '>');
- output.currentLineWidth += tagName.length + 3;
- }
- }
- }
- if (opts.approximateLineWidth > 0 && STRUCTURE_ELEMENTS.has(tagName)) {
- output.text.push('\n');
- output.currentLineWidth = 0;
- }
- if (tagName === 'body') {
- output.isWithinBody = false;
- }
- }
- else if (node.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
- let textContent = node.nodeValue;
- if (typeof textContent === 'string') {
- const trimmedTextContent = textContent.trim();
- if (trimmedTextContent === '') {
- // this text node is whitespace only
- if (isWithinWhitespaceSensitive(node)) {
- // whitespace matters within this element
- // just add the exact text we were given
- output.text.push(textContent);
- output.currentLineWidth += textContent.length;
- }
- else if (opts.approximateLineWidth > 0 && !output.isWithinBody) ;
- else if (!opts.prettyHtml) {
- // this text node is only whitespace, and it's not
- // within a whitespace sensitive element like <pre> or <code>
- // so replace the entire white space with a single new line
- output.currentLineWidth += 1;
- if (opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
- // good enough for a new line
- // for perf these are all just estimates
- // we don't care to ensure exact line lengths
- output.text.push('\n');
- output.currentLineWidth = 0;
- }
- else {
- // let's keep it all on the same line yet
- output.text.push(' ');
- }
- }
- }
- else {
- // this text node has text content
- const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 || opts.prettyHtml ? isWithinWhitespaceSensitive(node) : false;
- if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
- output.text.push('\n');
- output.currentLineWidth = 0;
- }
- if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
- for (let i = 0; i < output.indent; i++) {
- output.text.push(' ');
- }
- output.currentLineWidth += output.indent;
- }
- let textContentLength = textContent.length;
- if (textContentLength > 0) {
- // this text node has text content
- const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */
- ? node.parentNode.nodeName
- : null;
- if (NON_ESCAPABLE_CONTENT.has(parentTagName)) {
- // this text node cannot have its content escaped since it's going
- // into an element like <style> or <script>
- if (isWithinWhitespaceSensitive(node)) {
- output.text.push(textContent);
- }
- else {
- output.text.push(trimmedTextContent);
- textContentLength = trimmedTextContent.length;
- }
- output.currentLineWidth += textContentLength;
- }
- else {
- // this text node is going into a normal element and html can be escaped
- if (opts.prettyHtml && !isWithinWhitespaceSensitiveNode) {
- // pretty print the text node
- output.text.push(escapeString(textContent.replace(/\s\s+/g, ' ').trim(), false));
- output.currentLineWidth += textContentLength;
- }
- else {
- // not pretty printing the text node
- if (isWithinWhitespaceSensitive(node)) {
- output.currentLineWidth += textContentLength;
- }
- else {
- // this element is not a whitespace sensitive one, like <pre> or <code> so
- // any whitespace at the start and end can be cleaned up to just be one space
- if (/\s/.test(textContent.charAt(0))) {
- textContent = ' ' + textContent.trimLeft();
- }
- textContentLength = textContent.length;
- if (textContentLength > 1) {
- if (/\s/.test(textContent.charAt(textContentLength - 1))) {
- if (opts.approximateLineWidth > 0 &&
- output.currentLineWidth + textContentLength > opts.approximateLineWidth) {
- textContent = textContent.trimRight() + '\n';
- output.currentLineWidth = 0;
- }
- else {
- textContent = textContent.trimRight() + ' ';
- }
- }
- }
- output.currentLineWidth += textContentLength;
- }
- output.text.push(escapeString(textContent, false));
- }
- }
- }
- }
- }
- }
- else if (node.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
- const nodeValue = node.nodeValue;
- if (opts.removeHtmlComments) {
- const isHydrateAnnotation = nodeValue.startsWith(CONTENT_REF_ID + '.') ||
- nodeValue.startsWith(ORG_LOCATION_ID + '.') ||
- nodeValue.startsWith(SLOT_NODE_ID + '.') ||
- nodeValue.startsWith(TEXT_NODE_ID + '.');
- if (!isHydrateAnnotation) {
- return;
- }
- }
- const isWithinWhitespaceSensitiveNode = opts.newLines || opts.indentSpaces > 0 ? isWithinWhitespaceSensitive(node) : false;
- if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
- output.text.push('\n');
- output.currentLineWidth = 0;
- }
- if (opts.indentSpaces > 0 && !isWithinWhitespaceSensitiveNode) {
- for (let i = 0; i < output.indent; i++) {
- output.text.push(' ');
- }
- output.currentLineWidth += output.indent;
- }
- output.text.push('<!--' + nodeValue + '-->');
- output.currentLineWidth += nodeValue.length + 7;
- }
- else if (node.nodeType === 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
- output.text.push('<!doctype html>');
- }
- }
- const AMP_REGEX = /&/g;
- const NBSP_REGEX = /\u00a0/g;
- const DOUBLE_QUOTE_REGEX = /"/g;
- const LT_REGEX = /</g;
- const GT_REGEX = />/g;
- const CAN_REMOVE_ATTR_QUOTES = /^[^ \t\n\f\r"'`=<>\/\\-]+$/;
- function getTagName(element) {
- if (element.namespaceURI === 'http://www.w3.org/1999/xhtml') {
- return element.nodeName.toLowerCase();
- }
- else {
- return element.nodeName;
- }
- }
- function escapeString(str, attrMode) {
- str = str.replace(AMP_REGEX, '&').replace(NBSP_REGEX, ' ');
- if (attrMode) {
- return str.replace(DOUBLE_QUOTE_REGEX, '"');
- }
- return str.replace(LT_REGEX, '<').replace(GT_REGEX, '>');
- }
- function isWithinWhitespaceSensitive(node) {
- while (node != null) {
- if (WHITESPACE_SENSITIVE.has(node.nodeName)) {
- return true;
- }
- node = node.parentNode;
- }
- return false;
- }
- /*@__PURE__*/ const NON_ESCAPABLE_CONTENT = new Set([
- 'STYLE',
- 'SCRIPT',
- 'IFRAME',
- 'NOSCRIPT',
- 'XMP',
- 'NOEMBED',
- 'NOFRAMES',
- 'PLAINTEXT',
- ]);
- /*@__PURE__*/ const WHITESPACE_SENSITIVE = new Set([
- 'CODE',
- 'OUTPUT',
- 'PLAINTEXT',
- 'PRE',
- 'SCRIPT',
- 'TEMPLATE',
- 'TEXTAREA',
- ]);
- /*@__PURE__*/ const EMPTY_ELEMENTS = new Set([
- 'area',
- 'base',
- 'basefont',
- 'bgsound',
- 'br',
- 'col',
- 'embed',
- 'frame',
- 'hr',
- 'img',
- 'input',
- 'keygen',
- 'link',
- 'meta',
- 'param',
- 'source',
- 'trace',
- 'wbr',
- ]);
- /*@__PURE__*/ const REMOVE_EMPTY_ATTR = new Set(['class', 'dir', 'id', 'lang', 'name', 'title']);
- /*@__PURE__*/ const BOOLEAN_ATTR = new Set([
- 'allowfullscreen',
- 'async',
- 'autofocus',
- 'autoplay',
- 'checked',
- 'compact',
- 'controls',
- 'declare',
- 'default',
- 'defaultchecked',
- 'defaultmuted',
- 'defaultselected',
- 'defer',
- 'disabled',
- 'enabled',
- 'formnovalidate',
- 'hidden',
- 'indeterminate',
- 'inert',
- 'ismap',
- 'itemscope',
- 'loop',
- 'multiple',
- 'muted',
- 'nohref',
- 'nomodule',
- 'noresize',
- 'noshade',
- 'novalidate',
- 'nowrap',
- 'open',
- 'pauseonexit',
- 'readonly',
- 'required',
- 'reversed',
- 'scoped',
- 'seamless',
- 'selected',
- 'sortable',
- 'truespeed',
- 'typemustmatch',
- 'visible',
- ]);
- /*@__PURE__*/ const STRUCTURE_ELEMENTS = new Set([
- 'html',
- 'body',
- 'head',
- 'iframe',
- 'meta',
- 'link',
- 'base',
- 'title',
- 'script',
- 'style',
- ]);
- class MockNode {
- constructor(ownerDocument, nodeType, nodeName, nodeValue) {
- this.ownerDocument = ownerDocument;
- this.nodeType = nodeType;
- this.nodeName = nodeName;
- this._nodeValue = nodeValue;
- this.parentNode = null;
- this.childNodes = [];
- }
- appendChild(newNode) {
- if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
- const nodes = newNode.childNodes.slice();
- for (const child of nodes) {
- this.appendChild(child);
- }
- }
- else {
- newNode.remove();
- newNode.parentNode = this;
- this.childNodes.push(newNode);
- connectNode(this.ownerDocument, newNode);
- }
- return newNode;
- }
- append(...items) {
- items.forEach((item) => {
- const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
- this.appendChild(isNode ? item : this.ownerDocument.createTextNode(String(item)));
- });
- }
- prepend(...items) {
- const firstChild = this.firstChild;
- items.forEach((item) => {
- const isNode = typeof item === 'object' && item !== null && 'nodeType' in item;
- if (firstChild) {
- this.insertBefore(isNode ? item : this.ownerDocument.createTextNode(String(item)), firstChild);
- }
- });
- }
- cloneNode(deep) {
- throw new Error(`invalid node type to clone: ${this.nodeType}, deep: ${deep}`);
- }
- compareDocumentPosition(_other) {
- // unimplemented
- // https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
- return -1;
- }
- get firstChild() {
- return this.childNodes[0] || null;
- }
- insertBefore(newNode, referenceNode) {
- if (newNode.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
- for (let i = 0, ii = newNode.childNodes.length; i < ii; i++) {
- insertBefore(this, newNode.childNodes[i], referenceNode);
- }
- }
- else {
- insertBefore(this, newNode, referenceNode);
- }
- return newNode;
- }
- get isConnected() {
- let node = this;
- while (node != null) {
- if (node.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */) {
- return true;
- }
- node = node.parentNode;
- if (node != null && node.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */) {
- node = node.host;
- }
- }
- return false;
- }
- isSameNode(node) {
- return this === node;
- }
- get lastChild() {
- return this.childNodes[this.childNodes.length - 1] || null;
- }
- get nextSibling() {
- if (this.parentNode != null) {
- const index = this.parentNode.childNodes.indexOf(this) + 1;
- return this.parentNode.childNodes[index] || null;
- }
- return null;
- }
- get nodeValue() {
- var _a;
- return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
- }
- set nodeValue(value) {
- this._nodeValue = value;
- }
- get parentElement() {
- return this.parentNode || null;
- }
- set parentElement(value) {
- this.parentNode = value;
- }
- get previousSibling() {
- if (this.parentNode != null) {
- const index = this.parentNode.childNodes.indexOf(this) - 1;
- return this.parentNode.childNodes[index] || null;
- }
- return null;
- }
- contains(otherNode) {
- if (otherNode === this) {
- return true;
- }
- const childNodes = Array.from(this.childNodes);
- if (childNodes.includes(otherNode)) {
- return true;
- }
- return childNodes.some((node) => this.contains.bind(node)(otherNode));
- }
- removeChild(childNode) {
- const index = this.childNodes.indexOf(childNode);
- if (index > -1) {
- this.childNodes.splice(index, 1);
- if (this.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
- const wasConnected = this.isConnected;
- childNode.parentNode = null;
- if (wasConnected === true) {
- disconnectNode(childNode);
- }
- }
- else {
- childNode.parentNode = null;
- }
- }
- else {
- throw new Error(`node not found within childNodes during removeChild`);
- }
- return childNode;
- }
- remove() {
- if (this.parentNode != null) {
- this.parentNode.removeChild(this);
- }
- }
- replaceChild(newChild, oldChild) {
- if (oldChild.parentNode === this) {
- this.insertBefore(newChild, oldChild);
- oldChild.remove();
- return newChild;
- }
- return null;
- }
- get textContent() {
- var _a;
- return (_a = this._nodeValue) !== null && _a !== void 0 ? _a : '';
- }
- set textContent(value) {
- this._nodeValue = String(value);
- }
- }
- MockNode.ELEMENT_NODE = 1;
- MockNode.TEXT_NODE = 3;
- MockNode.PROCESSING_INSTRUCTION_NODE = 7;
- MockNode.COMMENT_NODE = 8;
- MockNode.DOCUMENT_NODE = 9;
- MockNode.DOCUMENT_TYPE_NODE = 10;
- MockNode.DOCUMENT_FRAGMENT_NODE = 11;
- class MockNodeList {
- constructor(ownerDocument, childNodes, length) {
- this.ownerDocument = ownerDocument;
- this.childNodes = childNodes;
- this.length = length;
- }
- }
- class MockElement extends MockNode {
- constructor(ownerDocument, nodeName) {
- super(ownerDocument, 1 /* NODE_TYPES.ELEMENT_NODE */, typeof nodeName === 'string' ? nodeName : null, null);
- this.namespaceURI = null;
- this.__shadowRoot = null;
- this.__attributeMap = null;
- }
- addEventListener(type, handler) {
- addEventListener(this, type, handler);
- }
- attachShadow(_opts) {
- const shadowRoot = this.ownerDocument.createDocumentFragment();
- this.shadowRoot = shadowRoot;
- return shadowRoot;
- }
- blur() {
- dispatchEvent(this, new MockFocusEvent('blur', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }));
- }
- get shadowRoot() {
- return this.__shadowRoot || null;
- }
- set shadowRoot(shadowRoot) {
- if (shadowRoot != null) {
- shadowRoot.host = this;
- this.__shadowRoot = shadowRoot;
- }
- else {
- delete this.__shadowRoot;
- }
- }
- get attributes() {
- if (this.__attributeMap == null) {
- const attrMap = createAttributeProxy(false);
- this.__attributeMap = attrMap;
- return attrMap;
- }
- return this.__attributeMap;
- }
- set attributes(attrs) {
- this.__attributeMap = attrs;
- }
- get children() {
- return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */);
- }
- get childElementCount() {
- return this.childNodes.filter((n) => n.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */).length;
- }
- get className() {
- return this.getAttributeNS(null, 'class') || '';
- }
- set className(value) {
- this.setAttributeNS(null, 'class', value);
- }
- get classList() {
- return new MockClassList(this);
- }
- click() {
- dispatchEvent(this, new MockEvent('click', { bubbles: true, cancelable: true, composed: true }));
- }
- cloneNode(_deep) {
- // implemented on MockElement.prototype from within element.ts
- // @ts-ignore - implemented on MockElement.prototype from within element.ts
- return null;
- }
- closest(selector) {
- let elm = this;
- while (elm != null) {
- if (elm.matches(selector)) {
- return elm;
- }
- elm = elm.parentNode;
- }
- return null;
- }
- get dataset() {
- return dataset(this);
- }
- get dir() {
- return this.getAttributeNS(null, 'dir') || '';
- }
- set dir(value) {
- this.setAttributeNS(null, 'dir', value);
- }
- dispatchEvent(ev) {
- return dispatchEvent(this, ev);
- }
- get firstElementChild() {
- return this.children[0] || null;
- }
- focus(_options) {
- dispatchEvent(this, new MockFocusEvent('focus', { relatedTarget: null, bubbles: true, cancelable: true, composed: true }));
- }
- getAttribute(attrName) {
- if (attrName === 'style') {
- if (this.__style != null && this.__style.length > 0) {
- return this.style.cssText;
- }
- return null;
- }
- const attr = this.attributes.getNamedItem(attrName);
- if (attr != null) {
- return attr.value;
- }
- return null;
- }
- getAttributeNS(namespaceURI, attrName) {
- const attr = this.attributes.getNamedItemNS(namespaceURI, attrName);
- if (attr != null) {
- return attr.value;
- }
- return null;
- }
- getBoundingClientRect() {
- return { bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 };
- }
- getRootNode(opts) {
- const isComposed = opts != null && opts.composed === true;
- let node = this;
- while (node.parentNode != null) {
- node = node.parentNode;
- if (isComposed === true && node.parentNode == null && node.host != null) {
- node = node.host;
- }
- }
- return node;
- }
- get draggable() {
- return this.getAttributeNS(null, 'draggable') === 'true';
- }
- set draggable(value) {
- this.setAttributeNS(null, 'draggable', value);
- }
- hasChildNodes() {
- return this.childNodes.length > 0;
- }
- get id() {
- return this.getAttributeNS(null, 'id') || '';
- }
- set id(value) {
- this.setAttributeNS(null, 'id', value);
- }
- get innerHTML() {
- if (this.childNodes.length === 0) {
- return '';
- }
- return serializeNodeToHtml(this, {
- newLines: false,
- indentSpaces: 0,
- });
- }
- set innerHTML(html) {
- var _a;
- if (NON_ESCAPABLE_CONTENT.has((_a = this.nodeName) !== null && _a !== void 0 ? _a : '') === true) {
- setTextContent(this, html);
- }
- else {
- for (let i = this.childNodes.length - 1; i >= 0; i--) {
- this.removeChild(this.childNodes[i]);
- }
- if (typeof html === 'string') {
- const frag = parseFragmentUtil(this.ownerDocument, html);
- while (frag.childNodes.length > 0) {
- this.appendChild(frag.childNodes[0]);
- }
- }
- }
- }
- get innerText() {
- const text = [];
- getTextContent(this.childNodes, text);
- return text.join('');
- }
- set innerText(value) {
- setTextContent(this, value);
- }
- insertAdjacentElement(position, elm) {
- if (position === 'beforebegin') {
- insertBefore(this.parentNode, elm, this);
- }
- else if (position === 'afterbegin') {
- this.prepend(elm);
- }
- else if (position === 'beforeend') {
- this.appendChild(elm);
- }
- else if (position === 'afterend') {
- insertBefore(this.parentNode, elm, this.nextSibling);
- }
- return elm;
- }
- insertAdjacentHTML(position, html) {
- const frag = parseFragmentUtil(this.ownerDocument, html);
- if (position === 'beforebegin') {
- while (frag.childNodes.length > 0) {
- insertBefore(this.parentNode, frag.childNodes[0], this);
- }
- }
- else if (position === 'afterbegin') {
- while (frag.childNodes.length > 0) {
- this.prepend(frag.childNodes[frag.childNodes.length - 1]);
- }
- }
- else if (position === 'beforeend') {
- while (frag.childNodes.length > 0) {
- this.appendChild(frag.childNodes[0]);
- }
- }
- else if (position === 'afterend') {
- while (frag.childNodes.length > 0) {
- insertBefore(this.parentNode, frag.childNodes[frag.childNodes.length - 1], this.nextSibling);
- }
- }
- }
- insertAdjacentText(position, text) {
- const elm = this.ownerDocument.createTextNode(text);
- if (position === 'beforebegin') {
- insertBefore(this.parentNode, elm, this);
- }
- else if (position === 'afterbegin') {
- this.prepend(elm);
- }
- else if (position === 'beforeend') {
- this.appendChild(elm);
- }
- else if (position === 'afterend') {
- insertBefore(this.parentNode, elm, this.nextSibling);
- }
- }
- hasAttribute(attrName) {
- if (attrName === 'style') {
- return this.__style != null && this.__style.length > 0;
- }
- return this.getAttribute(attrName) !== null;
- }
- hasAttributeNS(namespaceURI, name) {
- return this.getAttributeNS(namespaceURI, name) !== null;
- }
- get hidden() {
- return this.hasAttributeNS(null, 'hidden');
- }
- set hidden(isHidden) {
- if (isHidden === true) {
- this.setAttributeNS(null, 'hidden', '');
- }
- else {
- this.removeAttributeNS(null, 'hidden');
- }
- }
- get lang() {
- return this.getAttributeNS(null, 'lang') || '';
- }
- set lang(value) {
- this.setAttributeNS(null, 'lang', value);
- }
- get lastElementChild() {
- const children = this.children;
- return children[children.length - 1] || null;
- }
- matches(selector) {
- return matches(selector, this);
- }
- get nextElementSibling() {
- const parentElement = this.parentElement;
- if (parentElement != null &&
- (parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
- parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
- parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
- const children = parentElement.children;
- const index = children.indexOf(this) + 1;
- return parentElement.children[index] || null;
- }
- return null;
- }
- get outerHTML() {
- return serializeNodeToHtml(this, {
- newLines: false,
- outerHtml: true,
- indentSpaces: 0,
- });
- }
- get previousElementSibling() {
- const parentElement = this.parentElement;
- if (parentElement != null &&
- (parentElement.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
- parentElement.nodeType === 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */ ||
- parentElement.nodeType === 9 /* NODE_TYPES.DOCUMENT_NODE */)) {
- const children = parentElement.children;
- const index = children.indexOf(this) - 1;
- return parentElement.children[index] || null;
- }
- return null;
- }
- getElementsByClassName(classNames) {
- const classes = classNames
- .trim()
- .split(' ')
- .filter((c) => c.length > 0);
- const results = [];
- getElementsByClassName(this, classes, results);
- return results;
- }
- getElementsByTagName(tagName) {
- const results = [];
- getElementsByTagName(this, tagName.toLowerCase(), results);
- return results;
- }
- querySelector(selector) {
- return selectOne(selector, this);
- }
- querySelectorAll(selector) {
- return selectAll(selector, this);
- }
- removeAttribute(attrName) {
- if (attrName === 'style') {
- delete this.__style;
- }
- else {
- const attr = this.attributes.getNamedItem(attrName);
- if (attr != null) {
- this.attributes.removeNamedItemNS(attr);
- if (checkAttributeChanged(this) === true) {
- attributeChanged(this, attrName, attr.value, null);
- }
- }
- }
- }
- removeAttributeNS(namespaceURI, attrName) {
- const attr = this.attributes.getNamedItemNS(namespaceURI, attrName);
- if (attr != null) {
- this.attributes.removeNamedItemNS(attr);
- if (checkAttributeChanged(this) === true) {
- attributeChanged(this, attrName, attr.value, null);
- }
- }
- }
- removeEventListener(type, handler) {
- removeEventListener(this, type, handler);
- }
- setAttribute(attrName, value) {
- if (attrName === 'style') {
- this.style = value;
- }
- else {
- const attributes = this.attributes;
- let attr = attributes.getNamedItem(attrName);
- const checkAttrChanged = checkAttributeChanged(this);
- if (attr != null) {
- if (checkAttrChanged === true) {
- const oldValue = attr.value;
- attr.value = value;
- if (oldValue !== attr.value) {
- attributeChanged(this, attr.name, oldValue, attr.value);
- }
- }
- else {
- attr.value = value;
- }
- }
- else {
- if (attributes.caseInsensitive) {
- attrName = attrName.toLowerCase();
- }
- attr = new MockAttr(attrName, value);
- attributes.__items.push(attr);
- if (checkAttrChanged === true) {
- attributeChanged(this, attrName, null, attr.value);
- }
- }
- }
- }
- setAttributeNS(namespaceURI, attrName, value) {
- const attributes = this.attributes;
- let attr = attributes.getNamedItemNS(namespaceURI, attrName);
- const checkAttrChanged = checkAttributeChanged(this);
- if (attr != null) {
- if (checkAttrChanged === true) {
- const oldValue = attr.value;
- attr.value = value;
- if (oldValue !== attr.value) {
- attributeChanged(this, attr.name, oldValue, attr.value);
- }
- }
- else {
- attr.value = value;
- }
- }
- else {
- attr = new MockAttr(attrName, value, namespaceURI);
- attributes.__items.push(attr);
- if (checkAttrChanged === true) {
- attributeChanged(this, attrName, null, attr.value);
- }
- }
- }
- get style() {
- if (this.__style == null) {
- this.__style = createCSSStyleDeclaration();
- }
- return this.__style;
- }
- set style(val) {
- if (typeof val === 'string') {
- if (this.__style == null) {
- this.__style = createCSSStyleDeclaration();
- }
- this.__style.cssText = val;
- }
- else {
- this.__style = val;
- }
- }
- get tabIndex() {
- return parseInt(this.getAttributeNS(null, 'tabindex') || '-1', 10);
- }
- set tabIndex(value) {
- this.setAttributeNS(null, 'tabindex', value);
- }
- get tagName() {
- var _a;
- return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
- }
- set tagName(value) {
- this.nodeName = value;
- }
- get textContent() {
- const text = [];
- getTextContent(this.childNodes, text);
- return text.join('');
- }
- set textContent(value) {
- setTextContent(this, value);
- }
- get title() {
- return this.getAttributeNS(null, 'title') || '';
- }
- set title(value) {
- this.setAttributeNS(null, 'title', value);
- }
- animate() {
- /**/
- }
- onanimationstart() {
- /**/
- }
- onanimationend() {
- /**/
- }
- onanimationiteration() {
- /**/
- }
- onabort() {
- /**/
- }
- onauxclick() {
- /**/
- }
- onbeforecopy() {
- /**/
- }
- onbeforecut() {
- /**/
- }
- onbeforepaste() {
- /**/
- }
- onblur() {
- /**/
- }
- oncancel() {
- /**/
- }
- oncanplay() {
- /**/
- }
- oncanplaythrough() {
- /**/
- }
- onchange() {
- /**/
- }
- onclick() {
- /**/
- }
- onclose() {
- /**/
- }
- oncontextmenu() {
- /**/
- }
- oncopy() {
- /**/
- }
- oncuechange() {
- /**/
- }
- oncut() {
- /**/
- }
- ondblclick() {
- /**/
- }
- ondrag() {
- /**/
- }
- ondragend() {
- /**/
- }
- ondragenter() {
- /**/
- }
- ondragleave() {
- /**/
- }
- ondragover() {
- /**/
- }
- ondragstart() {
- /**/
- }
- ondrop() {
- /**/
- }
- ondurationchange() {
- /**/
- }
- onemptied() {
- /**/
- }
- onended() {
- /**/
- }
- onerror() {
- /**/
- }
- onfocus() {
- /**/
- }
- onfocusin() {
- /**/
- }
- onfocusout() {
- /**/
- }
- onformdata() {
- /**/
- }
- onfullscreenchange() {
- /**/
- }
- onfullscreenerror() {
- /**/
- }
- ongotpointercapture() {
- /**/
- }
- oninput() {
- /**/
- }
- oninvalid() {
- /**/
- }
- onkeydown() {
- /**/
- }
- onkeypress() {
- /**/
- }
- onkeyup() {
- /**/
- }
- onload() {
- /**/
- }
- onloadeddata() {
- /**/
- }
- onloadedmetadata() {
- /**/
- }
- onloadstart() {
- /**/
- }
- onlostpointercapture() {
- /**/
- }
- onmousedown() {
- /**/
- }
- onmouseenter() {
- /**/
- }
- onmouseleave() {
- /**/
- }
- onmousemove() {
- /**/
- }
- onmouseout() {
- /**/
- }
- onmouseover() {
- /**/
- }
- onmouseup() {
- /**/
- }
- onmousewheel() {
- /**/
- }
- onpaste() {
- /**/
- }
- onpause() {
- /**/
- }
- onplay() {
- /**/
- }
- onplaying() {
- /**/
- }
- onpointercancel() {
- /**/
- }
- onpointerdown() {
- /**/
- }
- onpointerenter() {
- /**/
- }
- onpointerleave() {
- /**/
- }
- onpointermove() {
- /**/
- }
- onpointerout() {
- /**/
- }
- onpointerover() {
- /**/
- }
- onpointerup() {
- /**/
- }
- onprogress() {
- /**/
- }
- onratechange() {
- /**/
- }
- onreset() {
- /**/
- }
- onresize() {
- /**/
- }
- onscroll() {
- /**/
- }
- onsearch() {
- /**/
- }
- onseeked() {
- /**/
- }
- onseeking() {
- /**/
- }
- onselect() {
- /**/
- }
- onselectstart() {
- /**/
- }
- onstalled() {
- /**/
- }
- onsubmit() {
- /**/
- }
- onsuspend() {
- /**/
- }
- ontimeupdate() {
- /**/
- }
- ontoggle() {
- /**/
- }
- onvolumechange() {
- /**/
- }
- onwaiting() {
- /**/
- }
- onwebkitfullscreenchange() {
- /**/
- }
- onwebkitfullscreenerror() {
- /**/
- }
- onwheel() {
- /**/
- }
- requestFullscreen() {
- /**/
- }
- scrollBy() {
- /**/
- }
- scrollTo() {
- /**/
- }
- scrollIntoView() {
- /**/
- }
- toString(opts) {
- return serializeNodeToHtml(this, opts);
- }
- }
- function getElementsByClassName(elm, classNames, foundElms) {
- const children = elm.children;
- for (let i = 0, ii = children.length; i < ii; i++) {
- const childElm = children[i];
- for (let j = 0, jj = classNames.length; j < jj; j++) {
- if (childElm.classList.contains(classNames[j])) {
- foundElms.push(childElm);
- }
- }
- getElementsByClassName(childElm, classNames, foundElms);
- }
- }
- function getElementsByTagName(elm, tagName, foundElms) {
- var _a;
- const children = elm.children;
- for (let i = 0, ii = children.length; i < ii; i++) {
- const childElm = children[i];
- if (tagName === '*' || ((_a = childElm.nodeName) !== null && _a !== void 0 ? _a : '').toLowerCase() === tagName) {
- foundElms.push(childElm);
- }
- getElementsByTagName(childElm, tagName, foundElms);
- }
- }
- function resetElement(elm) {
- resetEventListeners(elm);
- delete elm.__attributeMap;
- delete elm.__shadowRoot;
- delete elm.__style;
- }
- function insertBefore(parentNode, newNode, referenceNode) {
- if (newNode !== referenceNode) {
- newNode.remove();
- newNode.parentNode = parentNode;
- newNode.ownerDocument = parentNode.ownerDocument;
- if (referenceNode != null) {
- const index = parentNode.childNodes.indexOf(referenceNode);
- if (index > -1) {
- parentNode.childNodes.splice(index, 0, newNode);
- }
- else {
- throw new Error(`referenceNode not found in parentNode.childNodes`);
- }
- }
- else {
- parentNode.childNodes.push(newNode);
- }
- connectNode(parentNode.ownerDocument, newNode);
- }
- return newNode;
- }
- class MockHTMLElement extends MockElement {
- constructor(ownerDocument, nodeName) {
- super(ownerDocument, typeof nodeName === 'string' ? nodeName.toUpperCase() : null);
- this.namespaceURI = 'http://www.w3.org/1999/xhtml';
- }
- get tagName() {
- var _a;
- return (_a = this.nodeName) !== null && _a !== void 0 ? _a : '';
- }
- set tagName(value) {
- this.nodeName = value;
- }
- get attributes() {
- if (this.__attributeMap == null) {
- const attrMap = createAttributeProxy(true);
- this.__attributeMap = attrMap;
- return attrMap;
- }
- return this.__attributeMap;
- }
- set attributes(attrs) {
- this.__attributeMap = attrs;
- }
- }
- class MockTextNode extends MockNode {
- constructor(ownerDocument, text) {
- super(ownerDocument, 3 /* NODE_TYPES.TEXT_NODE */, "#text" /* NODE_NAMES.TEXT_NODE */, text);
- }
- cloneNode(_deep) {
- return new MockTextNode(null, this.nodeValue);
- }
- get textContent() {
- return this.nodeValue;
- }
- set textContent(text) {
- this.nodeValue = text;
- }
- get data() {
- return this.nodeValue;
- }
- set data(text) {
- this.nodeValue = text;
- }
- get wholeText() {
- if (this.parentNode != null) {
- const text = [];
- for (let i = 0, ii = this.parentNode.childNodes.length; i < ii; i++) {
- const childNode = this.parentNode.childNodes[i];
- if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
- text.push(childNode.nodeValue);
- }
- }
- return text.join('');
- }
- return this.nodeValue;
- }
- }
- function getTextContent(childNodes, text) {
- for (let i = 0, ii = childNodes.length; i < ii; i++) {
- const childNode = childNodes[i];
- if (childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */) {
- text.push(childNode.nodeValue);
- }
- else if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
- getTextContent(childNode.childNodes, text);
- }
- }
- }
- function setTextContent(elm, text) {
- for (let i = elm.childNodes.length - 1; i >= 0; i--) {
- elm.removeChild(elm.childNodes[i]);
- }
- const textNode = new MockTextNode(elm.ownerDocument, text);
- elm.appendChild(textNode);
- }
- class MockComment extends MockNode {
- constructor(ownerDocument, data) {
- super(ownerDocument, 8 /* NODE_TYPES.COMMENT_NODE */, "#comment" /* NODE_NAMES.COMMENT_NODE */, data);
- }
- cloneNode(_deep) {
- return new MockComment(null, this.nodeValue);
- }
- get textContent() {
- return this.nodeValue;
- }
- set textContent(text) {
- this.nodeValue = text;
- }
- }
- class MockDocumentFragment extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, null);
- this.nodeName = "#document-fragment" /* NODE_NAMES.DOCUMENT_FRAGMENT_NODE */;
- this.nodeType = 11 /* NODE_TYPES.DOCUMENT_FRAGMENT_NODE */;
- }
- getElementById(id) {
- return getElementById(this, id);
- }
- cloneNode(deep) {
- const cloned = new MockDocumentFragment(null);
- if (deep) {
- for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
- const childNode = this.childNodes[i];
- if (childNode.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */ ||
- childNode.nodeType === 3 /* NODE_TYPES.TEXT_NODE */ ||
- childNode.nodeType === 8 /* NODE_TYPES.COMMENT_NODE */) {
- const clonedChildNode = this.childNodes[i].cloneNode(true);
- cloned.appendChild(clonedChildNode);
- }
- }
- }
- return cloned;
- }
- }
- class MockDocumentTypeNode extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, '!DOCTYPE');
- this.nodeType = 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */;
- this.setAttribute('html', '');
- }
- }
- class MockCSSRule {
- constructor(parentStyleSheet) {
- this.parentStyleSheet = parentStyleSheet;
- this.cssText = '';
- this.type = 0;
- }
- }
- class MockCSSStyleSheet {
- constructor(ownerNode) {
- this.type = 'text/css';
- this.parentStyleSheet = null;
- this.cssRules = [];
- this.ownerNode = ownerNode;
- }
- get rules() {
- return this.cssRules;
- }
- set rules(rules) {
- this.cssRules = rules;
- }
- deleteRule(index) {
- if (index >= 0 && index < this.cssRules.length) {
- this.cssRules.splice(index, 1);
- updateStyleTextNode(this.ownerNode);
- }
- }
- insertRule(rule, index = 0) {
- if (typeof index !== 'number') {
- index = 0;
- }
- if (index < 0) {
- index = 0;
- }
- if (index > this.cssRules.length) {
- index = this.cssRules.length;
- }
- const cssRule = new MockCSSRule(this);
- cssRule.cssText = rule;
- this.cssRules.splice(index, 0, cssRule);
- updateStyleTextNode(this.ownerNode);
- return index;
- }
- }
- function getStyleElementText(styleElm) {
- const output = [];
- for (let i = 0; i < styleElm.childNodes.length; i++) {
- output.push(styleElm.childNodes[i].nodeValue);
- }
- return output.join('');
- }
- function setStyleElementText(styleElm, text) {
- // keeping the innerHTML and the sheet.cssRules connected
- // is not technically correct, but since we're doing
- // SSR we'll need to turn any assigned cssRules into
- // real text, not just properties that aren't rendered
- const sheet = styleElm.sheet;
- sheet.cssRules.length = 0;
- sheet.insertRule(text);
- updateStyleTextNode(styleElm);
- }
- function updateStyleTextNode(styleElm) {
- const childNodeLen = styleElm.childNodes.length;
- if (childNodeLen > 1) {
- for (let i = childNodeLen - 1; i >= 1; i--) {
- styleElm.removeChild(styleElm.childNodes[i]);
- }
- }
- else if (childNodeLen < 1) {
- styleElm.appendChild(styleElm.ownerDocument.createTextNode(''));
- }
- const textNode = styleElm.childNodes[0];
- textNode.nodeValue = styleElm.sheet.cssRules.map((r) => r.cssText).join('\n');
- }
- function createElement(ownerDocument, tagName) {
- if (typeof tagName !== 'string' || tagName === '' || !/^[a-z0-9-_:]+$/i.test(tagName)) {
- throw new Error(`The tag name provided (${tagName}) is not a valid name.`);
- }
- tagName = tagName.toLowerCase();
- switch (tagName) {
- case 'a':
- return new MockAnchorElement(ownerDocument);
- case 'base':
- return new MockBaseElement(ownerDocument);
- case 'button':
- return new MockButtonElement(ownerDocument);
- case 'canvas':
- return new MockCanvasElement(ownerDocument);
- case 'form':
- return new MockFormElement(ownerDocument);
- case 'img':
- return new MockImageElement(ownerDocument);
- case 'input':
- return new MockInputElement(ownerDocument);
- case 'link':
- return new MockLinkElement(ownerDocument);
- case 'meta':
- return new MockMetaElement(ownerDocument);
- case 'script':
- return new MockScriptElement(ownerDocument);
- case 'style':
- return new MockStyleElement(ownerDocument);
- case 'template':
- return new MockTemplateElement(ownerDocument);
- case 'title':
- return new MockTitleElement(ownerDocument);
- }
- if (ownerDocument != null && tagName.includes('-')) {
- const win = ownerDocument.defaultView;
- if (win != null && win.customElements != null) {
- return createCustomElement(win.customElements, ownerDocument, tagName);
- }
- }
- return new MockHTMLElement(ownerDocument, tagName);
- }
- function createElementNS(ownerDocument, namespaceURI, tagName) {
- if (namespaceURI === 'http://www.w3.org/1999/xhtml') {
- return createElement(ownerDocument, tagName);
- }
- else if (namespaceURI === 'http://www.w3.org/2000/svg') {
- switch (tagName.toLowerCase()) {
- case 'text':
- case 'tspan':
- case 'tref':
- case 'altglyph':
- case 'textpath':
- return new MockSVGTextContentElement(ownerDocument, tagName);
- case 'circle':
- case 'ellipse':
- case 'image':
- case 'line':
- case 'path':
- case 'polygon':
- case 'polyline':
- case 'rect':
- case 'use':
- return new MockSVGGraphicsElement(ownerDocument, tagName);
- case 'svg':
- return new MockSVGSVGElement(ownerDocument, tagName);
- default:
- return new MockSVGElement(ownerDocument, tagName);
- }
- }
- else {
- return new MockElement(ownerDocument, tagName);
- }
- }
- class MockAnchorElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'a');
- }
- get href() {
- return fullUrl(this, 'href');
- }
- set href(value) {
- this.setAttribute('href', value);
- }
- get pathname() {
- return new URL(this.href).pathname;
- }
- }
- class MockButtonElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'button');
- }
- }
- patchPropAttributes(MockButtonElement.prototype, {
- type: String,
- }, {
- type: 'submit',
- });
- class MockImageElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'img');
- }
- get draggable() {
- return this.getAttributeNS(null, 'draggable') !== 'false';
- }
- set draggable(value) {
- this.setAttributeNS(null, 'draggable', value);
- }
- get src() {
- return fullUrl(this, 'src');
- }
- set src(value) {
- this.setAttribute('src', value);
- }
- }
- patchPropAttributes(MockImageElement.prototype, {
- height: Number,
- width: Number,
- });
- class MockInputElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'input');
- }
- get list() {
- const listId = this.getAttribute('list');
- if (listId) {
- return this.ownerDocument.getElementById(listId);
- }
- return null;
- }
- }
- patchPropAttributes(MockInputElement.prototype, {
- accept: String,
- autocomplete: String,
- autofocus: Boolean,
- capture: String,
- checked: Boolean,
- disabled: Boolean,
- form: String,
- formaction: String,
- formenctype: String,
- formmethod: String,
- formnovalidate: String,
- formtarget: String,
- height: Number,
- inputmode: String,
- max: String,
- maxLength: Number,
- min: String,
- minLength: Number,
- multiple: Boolean,
- name: String,
- pattern: String,
- placeholder: String,
- required: Boolean,
- readOnly: Boolean,
- size: Number,
- spellCheck: Boolean,
- src: String,
- step: String,
- type: String,
- value: String,
- width: Number,
- }, {
- type: 'text',
- });
- class MockFormElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'form');
- }
- }
- patchPropAttributes(MockFormElement.prototype, {
- name: String,
- });
- class MockLinkElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'link');
- }
- get href() {
- return fullUrl(this, 'href');
- }
- set href(value) {
- this.setAttribute('href', value);
- }
- }
- patchPropAttributes(MockLinkElement.prototype, {
- crossorigin: String,
- media: String,
- rel: String,
- type: String,
- });
- class MockMetaElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'meta');
- }
- }
- patchPropAttributes(MockMetaElement.prototype, {
- charset: String,
- content: String,
- name: String,
- });
- class MockScriptElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'script');
- }
- get src() {
- return fullUrl(this, 'src');
- }
- set src(value) {
- this.setAttribute('src', value);
- }
- }
- patchPropAttributes(MockScriptElement.prototype, {
- type: String,
- });
- class MockDOMMatrix {
- constructor() {
- this.a = 1;
- this.b = 0;
- this.c = 0;
- this.d = 1;
- this.e = 0;
- this.f = 0;
- this.m11 = 1;
- this.m12 = 0;
- this.m13 = 0;
- this.m14 = 0;
- this.m21 = 0;
- this.m22 = 1;
- this.m23 = 0;
- this.m24 = 0;
- this.m31 = 0;
- this.m32 = 0;
- this.m33 = 1;
- this.m34 = 0;
- this.m41 = 0;
- this.m42 = 0;
- this.m43 = 0;
- this.m44 = 1;
- this.is2D = true;
- this.isIdentity = true;
- }
- static fromMatrix() {
- return new MockDOMMatrix();
- }
- inverse() {
- return new MockDOMMatrix();
- }
- flipX() {
- return new MockDOMMatrix();
- }
- flipY() {
- return new MockDOMMatrix();
- }
- multiply() {
- return new MockDOMMatrix();
- }
- rotate() {
- return new MockDOMMatrix();
- }
- rotateAxisAngle() {
- return new MockDOMMatrix();
- }
- rotateFromVector() {
- return new MockDOMMatrix();
- }
- scale() {
- return new MockDOMMatrix();
- }
- scaleNonUniform() {
- return new MockDOMMatrix();
- }
- skewX() {
- return new MockDOMMatrix();
- }
- skewY() {
- return new MockDOMMatrix();
- }
- toJSON() { }
- toString() { }
- transformPoint() {
- return new MockDOMPoint();
- }
- translate() {
- return new MockDOMMatrix();
- }
- }
- class MockDOMPoint {
- constructor() {
- this.w = 1;
- this.x = 0;
- this.y = 0;
- this.z = 0;
- }
- toJSON() { }
- matrixTransform() {
- return new MockDOMMatrix();
- }
- }
- class MockSVGRect {
- constructor() {
- this.height = 10;
- this.width = 10;
- this.x = 0;
- this.y = 0;
- }
- }
- class MockStyleElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'style');
- this.sheet = new MockCSSStyleSheet(this);
- }
- get innerHTML() {
- return getStyleElementText(this);
- }
- set innerHTML(value) {
- setStyleElementText(this, value);
- }
- get innerText() {
- return getStyleElementText(this);
- }
- set innerText(value) {
- setStyleElementText(this, value);
- }
- get textContent() {
- return getStyleElementText(this);
- }
- set textContent(value) {
- setStyleElementText(this, value);
- }
- }
- class MockSVGElement extends MockElement {
- // SVGElement properties and methods
- get ownerSVGElement() {
- return null;
- }
- get viewportElement() {
- return null;
- }
- onunload() {
- /**/
- }
- // SVGGeometryElement properties and methods
- get pathLength() {
- return 0;
- }
- isPointInFill(_pt) {
- return false;
- }
- isPointInStroke(_pt) {
- return false;
- }
- getTotalLength() {
- return 0;
- }
- }
- class MockSVGGraphicsElement extends MockSVGElement {
- getBBox(_options) {
- return new MockSVGRect();
- }
- getCTM() {
- return new MockDOMMatrix();
- }
- getScreenCTM() {
- return new MockDOMMatrix();
- }
- }
- class MockSVGSVGElement extends MockSVGGraphicsElement {
- createSVGPoint() {
- return new MockDOMPoint();
- }
- }
- class MockSVGTextContentElement extends MockSVGGraphicsElement {
- getComputedTextLength() {
- return 0;
- }
- }
- class MockBaseElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'base');
- }
- get href() {
- return fullUrl(this, 'href');
- }
- set href(value) {
- this.setAttribute('href', value);
- }
- }
- class MockTemplateElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'template');
- this.content = new MockDocumentFragment(ownerDocument);
- }
- get innerHTML() {
- return this.content.innerHTML;
- }
- set innerHTML(html) {
- this.content.innerHTML = html;
- }
- cloneNode(deep) {
- const cloned = new MockTemplateElement(null);
- cloned.attributes = cloneAttributes(this.attributes);
- const styleCssText = this.getAttribute('style');
- if (styleCssText != null && styleCssText.length > 0) {
- cloned.setAttribute('style', styleCssText);
- }
- cloned.content = this.content.cloneNode(deep);
- if (deep) {
- for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
- const clonedChildNode = this.childNodes[i].cloneNode(true);
- cloned.appendChild(clonedChildNode);
- }
- }
- return cloned;
- }
- }
- class MockTitleElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'title');
- }
- get text() {
- return this.textContent;
- }
- set text(value) {
- this.textContent = value;
- }
- }
- class MockCanvasElement extends MockHTMLElement {
- constructor(ownerDocument) {
- super(ownerDocument, 'canvas');
- }
- getContext() {
- return {
- fillRect() {
- return;
- },
- clearRect() { },
- getImageData: function (_, __, w, h) {
- return {
- data: new Array(w * h * 4),
- };
- },
- putImageData() { },
- createImageData: function () {
- return [];
- },
- setTransform() { },
- drawImage() { },
- save() { },
- fillText() { },
- restore() { },
- beginPath() { },
- moveTo() { },
- lineTo() { },
- closePath() { },
- stroke() { },
- translate() { },
- scale() { },
- rotate() { },
- arc() { },
- fill() { },
- measureText() {
- return { width: 0 };
- },
- transform() { },
- rect() { },
- clip() { },
- };
- }
- }
- function fullUrl(elm, attrName) {
- const val = elm.getAttribute(attrName) || '';
- if (elm.ownerDocument != null) {
- const win = elm.ownerDocument.defaultView;
- if (win != null) {
- const loc = win.location;
- if (loc != null) {
- try {
- const url = new URL(val, loc.href);
- return url.href;
- }
- catch (e) { }
- }
- }
- }
- return val.replace(/\'|\"/g, '').trim();
- }
- function patchPropAttributes(prototype, attrs, defaults = {}) {
- Object.keys(attrs).forEach((propName) => {
- const attr = attrs[propName];
- const defaultValue = defaults[propName];
- if (attr === Boolean) {
- Object.defineProperty(prototype, propName, {
- get() {
- return this.hasAttribute(propName);
- },
- set(value) {
- if (value) {
- this.setAttribute(propName, '');
- }
- else {
- this.removeAttribute(propName);
- }
- },
- });
- }
- else if (attr === Number) {
- Object.defineProperty(prototype, propName, {
- get() {
- const value = this.getAttribute(propName);
- return value ? parseInt(value, 10) : defaultValue === undefined ? 0 : defaultValue;
- },
- set(value) {
- this.setAttribute(propName, value);
- },
- });
- }
- else {
- Object.defineProperty(prototype, propName, {
- get() {
- return this.hasAttribute(propName) ? this.getAttribute(propName) : defaultValue || '';
- },
- set(value) {
- this.setAttribute(propName, value);
- },
- });
- }
- });
- }
- MockElement.prototype.cloneNode = function (deep) {
- // because we're creating elements, which extending specific HTML base classes there
- // is a MockElement circular reference that bundling has trouble dealing with so
- // the fix is to add cloneNode() to MockElement's prototype after the HTML classes
- const cloned = createElement(this.ownerDocument, this.nodeName);
- cloned.attributes = cloneAttributes(this.attributes);
- const styleCssText = this.getAttribute('style');
- if (styleCssText != null && styleCssText.length > 0) {
- cloned.setAttribute('style', styleCssText);
- }
- if (deep) {
- for (let i = 0, ii = this.childNodes.length; i < ii; i++) {
- const clonedChildNode = this.childNodes[i].cloneNode(true);
- cloned.appendChild(clonedChildNode);
- }
- }
- return cloned;
- };
- let sharedDocument;
- function parseHtmlToDocument(html, ownerDocument = null) {
- if (ownerDocument == null) {
- if (sharedDocument == null) {
- sharedDocument = new MockDocument();
- }
- ownerDocument = sharedDocument;
- }
- return parseDocumentUtil(ownerDocument, html);
- }
- function parseHtmlToFragment(html, ownerDocument = null) {
- if (ownerDocument == null) {
- if (sharedDocument == null) {
- sharedDocument = new MockDocument();
- }
- ownerDocument = sharedDocument;
- }
- return parseFragmentUtil(ownerDocument, html);
- }
- const consoleNoop = () => {
- /**/
- };
- function createConsole() {
- return {
- debug: consoleNoop,
- error: consoleNoop,
- info: consoleNoop,
- log: consoleNoop,
- warn: consoleNoop,
- dir: consoleNoop,
- dirxml: consoleNoop,
- table: consoleNoop,
- trace: consoleNoop,
- group: consoleNoop,
- groupCollapsed: consoleNoop,
- groupEnd: consoleNoop,
- clear: consoleNoop,
- count: consoleNoop,
- countReset: consoleNoop,
- assert: consoleNoop,
- profile: consoleNoop,
- profileEnd: consoleNoop,
- time: consoleNoop,
- timeLog: consoleNoop,
- timeEnd: consoleNoop,
- timeStamp: consoleNoop,
- context: consoleNoop,
- memory: consoleNoop,
- };
- }
- class MockHeaders {
- constructor(init) {
- this._values = [];
- if (typeof init === 'object') {
- if (typeof init[Symbol.iterator] === 'function') {
- const kvs = [];
- for (const kv of init) {
- if (typeof kv[Symbol.iterator] === 'function') {
- kvs.push([...kv]);
- }
- }
- for (const kv of kvs) {
- this.append(kv[0], kv[1]);
- }
- }
- else {
- for (const key in init) {
- this.append(key, init[key]);
- }
- }
- }
- }
- append(key, value) {
- this._values.push([key, value + '']);
- }
- delete(key) {
- key = key.toLowerCase();
- for (let i = this._values.length - 1; i >= 0; i--) {
- if (this._values[i][0].toLowerCase() === key) {
- this._values.splice(i, 1);
- }
- }
- }
- entries() {
- const entries = [];
- for (const kv of this.keys()) {
- entries.push([kv, this.get(kv)]);
- }
- let index = -1;
- return {
- next() {
- index++;
- return {
- value: entries[index],
- done: !entries[index],
- };
- },
- [Symbol.iterator]() {
- return this;
- },
- };
- }
- forEach(cb) {
- for (const kv of this.entries()) {
- cb(kv[1], kv[0]);
- }
- }
- get(key) {
- const rtn = [];
- key = key.toLowerCase();
- for (const kv of this._values) {
- if (kv[0].toLowerCase() === key) {
- rtn.push(kv[1]);
- }
- }
- return rtn.length > 0 ? rtn.join(', ') : null;
- }
- has(key) {
- key = key.toLowerCase();
- for (const kv of this._values) {
- if (kv[0].toLowerCase() === key) {
- return true;
- }
- }
- return false;
- }
- keys() {
- const keys = [];
- for (const kv of this._values) {
- const key = kv[0].toLowerCase();
- if (!keys.includes(key)) {
- keys.push(key);
- }
- }
- let index = -1;
- return {
- next() {
- index++;
- return {
- value: keys[index],
- done: !keys[index],
- };
- },
- [Symbol.iterator]() {
- return this;
- },
- };
- }
- set(key, value) {
- for (const kv of this._values) {
- if (kv[0].toLowerCase() === key.toLowerCase()) {
- kv[1] = value + '';
- return;
- }
- }
- this.append(key, value);
- }
- values() {
- const values = this._values;
- let index = -1;
- return {
- next() {
- index++;
- const done = !values[index];
- return {
- value: done ? undefined : values[index][1],
- done,
- };
- },
- [Symbol.iterator]() {
- return this;
- },
- };
- }
- [Symbol.iterator]() {
- return this.entries();
- }
- }
- class MockDOMParser {
- parseFromString(htmlToParse, mimeType) {
- if (mimeType !== 'text/html') {
- console.error('XML parsing not implemented yet, continuing as html');
- }
- return parseHtmlToDocument(htmlToParse);
- }
- }
- class MockRequest {
- constructor(input, init = {}) {
- this._method = 'GET';
- this._url = '/';
- this.bodyUsed = false;
- this.cache = 'default';
- this.credentials = 'same-origin';
- this.integrity = '';
- this.keepalive = false;
- this.mode = 'cors';
- this.redirect = 'follow';
- this.referrer = 'about:client';
- this.referrerPolicy = '';
- if (typeof input === 'string') {
- this.url = input;
- }
- else if (input) {
- Object.assign(this, input);
- this.headers = new MockHeaders(input.headers);
- }
- Object.assign(this, init);
- if (init.headers) {
- this.headers = new MockHeaders(init.headers);
- }
- if (!this.headers) {
- this.headers = new MockHeaders();
- }
- }
- get url() {
- if (typeof this._url === 'string') {
- return new URL(this._url, location.href).href;
- }
- return new URL('/', location.href).href;
- }
- set url(value) {
- this._url = value;
- }
- get method() {
- if (typeof this._method === 'string') {
- return this._method.toUpperCase();
- }
- return 'GET';
- }
- set method(value) {
- this._method = value;
- }
- clone() {
- const clone = { ...this };
- clone.headers = new MockHeaders(this.headers);
- return new MockRequest(clone);
- }
- }
- class MockResponse {
- constructor(body, init = {}) {
- this.ok = true;
- this.status = 200;
- this.statusText = '';
- this.type = 'default';
- this.url = '';
- this._body = body;
- if (init) {
- Object.assign(this, init);
- }
- this.headers = new MockHeaders(init.headers);
- }
- async json() {
- return JSON.parse(this._body);
- }
- async text() {
- return this._body;
- }
- clone() {
- const initClone = { ...this };
- initClone.headers = new MockHeaders(this.headers);
- return new MockResponse(this._body, initClone);
- }
- }
- function setupGlobal(gbl) {
- if (gbl.window == null) {
- const win = (gbl.window = new MockWindow());
- WINDOW_FUNCTIONS.forEach((fnName) => {
- if (!(fnName in gbl)) {
- gbl[fnName] = win[fnName].bind(win);
- }
- });
- WINDOW_PROPS.forEach((propName) => {
- if (!(propName in gbl)) {
- Object.defineProperty(gbl, propName, {
- get() {
- return win[propName];
- },
- set(val) {
- win[propName] = val;
- },
- configurable: true,
- enumerable: true,
- });
- }
- });
- GLOBAL_CONSTRUCTORS.forEach(([cstrName]) => {
- gbl[cstrName] = win[cstrName];
- });
- }
- return gbl.window;
- }
- function teardownGlobal(gbl) {
- const win = gbl.window;
- if (win && typeof win.close === 'function') {
- win.close();
- }
- }
- function patchWindow(winToBePatched) {
- const mockWin = new MockWindow(false);
- WINDOW_FUNCTIONS.forEach((fnName) => {
- if (typeof winToBePatched[fnName] !== 'function') {
- winToBePatched[fnName] = mockWin[fnName].bind(mockWin);
- }
- });
- WINDOW_PROPS.forEach((propName) => {
- if (winToBePatched === undefined) {
- Object.defineProperty(winToBePatched, propName, {
- get() {
- return mockWin[propName];
- },
- set(val) {
- mockWin[propName] = val;
- },
- configurable: true,
- enumerable: true,
- });
- }
- });
- }
- function addGlobalsToWindowPrototype(mockWinPrototype) {
- GLOBAL_CONSTRUCTORS.forEach(([cstrName, Cstr]) => {
- Object.defineProperty(mockWinPrototype, cstrName, {
- get() {
- return this['__' + cstrName] || Cstr;
- },
- set(cstr) {
- this['__' + cstrName] = cstr;
- },
- configurable: true,
- enumerable: true,
- });
- });
- }
- const WINDOW_FUNCTIONS = [
- 'addEventListener',
- 'alert',
- 'blur',
- 'cancelAnimationFrame',
- 'cancelIdleCallback',
- 'clearInterval',
- 'clearTimeout',
- 'close',
- 'confirm',
- 'dispatchEvent',
- 'focus',
- 'getComputedStyle',
- 'matchMedia',
- 'open',
- 'prompt',
- 'removeEventListener',
- 'requestAnimationFrame',
- 'requestIdleCallback',
- 'URL',
- ];
- const WINDOW_PROPS = [
- 'customElements',
- 'devicePixelRatio',
- 'document',
- 'history',
- 'innerHeight',
- 'innerWidth',
- 'localStorage',
- 'location',
- 'navigator',
- 'pageXOffset',
- 'pageYOffset',
- 'performance',
- 'screenLeft',
- 'screenTop',
- 'screenX',
- 'screenY',
- 'scrollX',
- 'scrollY',
- 'sessionStorage',
- 'CSS',
- 'CustomEvent',
- 'Event',
- 'Element',
- 'HTMLElement',
- 'Node',
- 'NodeList',
- 'FocusEvent',
- 'KeyboardEvent',
- 'MouseEvent',
- ];
- const GLOBAL_CONSTRUCTORS = [
- ['CustomEvent', MockCustomEvent],
- ['Event', MockEvent],
- ['Headers', MockHeaders],
- ['FocusEvent', MockFocusEvent],
- ['KeyboardEvent', MockKeyboardEvent],
- ['MouseEvent', MockMouseEvent],
- ['Request', MockRequest],
- ['Response', MockResponse],
- ['DOMParser', MockDOMParser],
- ['HTMLAnchorElement', MockAnchorElement],
- ['HTMLBaseElement', MockBaseElement],
- ['HTMLButtonElement', MockButtonElement],
- ['HTMLCanvasElement', MockCanvasElement],
- ['HTMLFormElement', MockFormElement],
- ['HTMLImageElement', MockImageElement],
- ['HTMLInputElement', MockInputElement],
- ['HTMLLinkElement', MockLinkElement],
- ['HTMLMetaElement', MockMetaElement],
- ['HTMLScriptElement', MockScriptElement],
- ['HTMLStyleElement', MockStyleElement],
- ['HTMLTemplateElement', MockTemplateElement],
- ['HTMLTitleElement', MockTitleElement],
- ];
- class MockHistory {
- constructor() {
- this.items = [];
- }
- get length() {
- return this.items.length;
- }
- back() {
- this.go(-1);
- }
- forward() {
- this.go(1);
- }
- go(_value) {
- //
- }
- pushState(_state, _title, _url) {
- //
- }
- replaceState(_state, _title, _url) {
- //
- }
- }
- class MockIntersectionObserver {
- constructor() {
- /**/
- }
- disconnect() {
- /**/
- }
- observe() {
- /**/
- }
- takeRecords() {
- return [];
- }
- unobserve() {
- /**/
- }
- }
- class MockLocation {
- constructor() {
- this.ancestorOrigins = null;
- this.protocol = '';
- this.host = '';
- this.hostname = '';
- this.port = '';
- this.pathname = '';
- this.search = '';
- this.hash = '';
- this.username = '';
- this.password = '';
- this.origin = '';
- this._href = '';
- }
- get href() {
- return this._href;
- }
- set href(value) {
- const url = new URL(value, 'http://mockdoc.stenciljs.com');
- this._href = url.href;
- this.protocol = url.protocol;
- this.host = url.host;
- this.hostname = url.hostname;
- this.port = url.port;
- this.pathname = url.pathname;
- this.search = url.search;
- this.hash = url.hash;
- this.username = url.username;
- this.password = url.password;
- this.origin = url.origin;
- }
- assign(_url) {
- //
- }
- reload(_forcedReload) {
- //
- }
- replace(_url) {
- //
- }
- toString() {
- return this.href;
- }
- }
- class MockNavigator {
- constructor() {
- this.appCodeName = 'MockNavigator';
- this.appName = 'MockNavigator';
- this.appVersion = 'MockNavigator';
- this.platform = 'MockNavigator';
- this.userAgent = 'MockNavigator';
- }
- }
- /**
- * https://developer.mozilla.org/en-US/docs/Web/API/Performance
- */
- class MockPerformance {
- constructor() {
- this.timeOrigin = Date.now();
- this.eventCounts = new Map();
- }
- addEventListener() {
- //
- }
- clearMarks() {
- //
- }
- clearMeasures() {
- //
- }
- clearResourceTimings() {
- //
- }
- dispatchEvent() {
- return true;
- }
- getEntries() {
- return [];
- }
- getEntriesByName() {
- return [];
- }
- getEntriesByType() {
- return [];
- }
- // Stencil's implementation of `mark` is non-compliant with the `Performance` interface. Because Stencil will
- // instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
- // type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
- // associated errors returned by the type checker)
- // @ts-ignore
- mark() {
- //
- }
- // Stencil's implementation of `measure` is non-compliant with the `Performance` interface. Because Stencil will
- // instantiate an instance of this class and may attempt to assign it to a variable of type `Performance`, the return
- // type must match the `Performance` interface (rather than typing this function as returning `void` and ignoring the
- // associated errors returned by the type checker)
- // @ts-ignore
- measure() {
- //
- }
- get navigation() {
- return {};
- }
- now() {
- return Date.now() - this.timeOrigin;
- }
- get onresourcetimingbufferfull() {
- return null;
- }
- removeEventListener() {
- //
- }
- setResourceTimingBufferSize() {
- //
- }
- get timing() {
- return {};
- }
- toJSON() {
- //
- }
- }
- function resetPerformance(perf) {
- if (perf != null) {
- try {
- perf.timeOrigin = Date.now();
- }
- catch (e) { }
- }
- }
- class MockStorage {
- constructor() {
- this.items = new Map();
- }
- key(_value) {
- //
- }
- getItem(key) {
- key = String(key);
- if (this.items.has(key)) {
- return this.items.get(key);
- }
- return null;
- }
- setItem(key, value) {
- if (value == null) {
- value = 'null';
- }
- this.items.set(String(key), String(value));
- }
- removeItem(key) {
- this.items.delete(String(key));
- }
- clear() {
- this.items.clear();
- }
- }
- const nativeClearInterval = clearInterval;
- const nativeClearTimeout = clearTimeout;
- const nativeSetInterval = setInterval;
- const nativeSetTimeout = setTimeout;
- const nativeURL = URL;
- class MockWindow {
- constructor(html = null) {
- if (html !== false) {
- this.document = new MockDocument(html, this);
- }
- else {
- this.document = null;
- }
- this.performance = new MockPerformance();
- this.customElements = new MockCustomElementRegistry(this);
- this.console = createConsole();
- resetWindowDefaults(this);
- resetWindowDimensions(this);
- }
- addEventListener(type, handler) {
- addEventListener(this, type, handler);
- }
- alert(msg) {
- if (this.console) {
- this.console.debug(msg);
- }
- else {
- console.debug(msg);
- }
- }
- blur() {
- /**/
- }
- cancelAnimationFrame(id) {
- this.__clearTimeout(id);
- }
- cancelIdleCallback(id) {
- this.__clearTimeout(id);
- }
- get CharacterData() {
- if (this.__charDataCstr == null) {
- const ownerDocument = this.document;
- this.__charDataCstr = class extends MockNode {
- constructor() {
- super(ownerDocument, 0, 'test', '');
- throw new Error('Illegal constructor: cannot construct CharacterData');
- }
- };
- }
- return this.__charDataCstr;
- }
- set CharacterData(charDataCstr) {
- this.__charDataCstr = charDataCstr;
- }
- clearInterval(id) {
- this.__clearInterval(id);
- }
- clearTimeout(id) {
- this.__clearTimeout(id);
- }
- close() {
- resetWindow(this);
- }
- confirm() {
- return false;
- }
- get CSS() {
- return {
- supports: () => true,
- };
- }
- get Document() {
- if (this.__docCstr == null) {
- const win = this;
- this.__docCstr = class extends MockDocument {
- constructor() {
- super(false, win);
- throw new Error('Illegal constructor: cannot construct Document');
- }
- };
- }
- return this.__docCstr;
- }
- set Document(docCstr) {
- this.__docCstr = docCstr;
- }
- get DocumentFragment() {
- if (this.__docFragCstr == null) {
- const ownerDocument = this.document;
- this.__docFragCstr = class extends MockDocumentFragment {
- constructor() {
- super(ownerDocument);
- throw new Error('Illegal constructor: cannot construct DocumentFragment');
- }
- };
- }
- return this.__docFragCstr;
- }
- set DocumentFragment(docFragCstr) {
- this.__docFragCstr = docFragCstr;
- }
- get DocumentType() {
- if (this.__docTypeCstr == null) {
- const ownerDocument = this.document;
- this.__docTypeCstr = class extends MockNode {
- constructor() {
- super(ownerDocument, 0, 'test', '');
- throw new Error('Illegal constructor: cannot construct DocumentType');
- }
- };
- }
- return this.__docTypeCstr;
- }
- set DocumentType(docTypeCstr) {
- this.__docTypeCstr = docTypeCstr;
- }
- get DOMTokenList() {
- if (this.__domTokenListCstr == null) {
- this.__domTokenListCstr = class MockDOMTokenList {
- };
- }
- return this.__domTokenListCstr;
- }
- set DOMTokenList(domTokenListCstr) {
- this.__domTokenListCstr = domTokenListCstr;
- }
- dispatchEvent(ev) {
- return dispatchEvent(this, ev);
- }
- get Element() {
- if (this.__elementCstr == null) {
- const ownerDocument = this.document;
- this.__elementCstr = class extends MockElement {
- constructor() {
- super(ownerDocument, '');
- throw new Error('Illegal constructor: cannot construct Element');
- }
- };
- }
- return this.__elementCstr;
- }
- fetch(input, init) {
- if (typeof fetch === 'function') {
- return fetch(input, init);
- }
- throw new Error(`fetch() not implemented`);
- }
- focus() {
- /**/
- }
- getComputedStyle(_) {
- return {
- cssText: '',
- length: 0,
- parentRule: null,
- getPropertyPriority() {
- return null;
- },
- getPropertyValue() {
- return '';
- },
- item() {
- return null;
- },
- removeProperty() {
- return null;
- },
- setProperty() {
- return null;
- },
- };
- }
- get globalThis() {
- return this;
- }
- get history() {
- if (this.__history == null) {
- this.__history = new MockHistory();
- }
- return this.__history;
- }
- set history(hsty) {
- this.__history = hsty;
- }
- get JSON() {
- return JSON;
- }
- get HTMLElement() {
- if (this.__htmlElementCstr == null) {
- const ownerDocument = this.document;
- this.__htmlElementCstr = class extends MockHTMLElement {
- constructor() {
- super(ownerDocument, '');
- const observedAttributes = this.constructor.observedAttributes;
- if (Array.isArray(observedAttributes) && typeof this.attributeChangedCallback === 'function') {
- observedAttributes.forEach((attrName) => {
- const attrValue = this.getAttribute(attrName);
- if (attrValue != null) {
- this.attributeChangedCallback(attrName, null, attrValue);
- }
- });
- }
- }
- };
- }
- return this.__htmlElementCstr;
- }
- set HTMLElement(htmlElementCstr) {
- this.__htmlElementCstr = htmlElementCstr;
- }
- get IntersectionObserver() {
- return MockIntersectionObserver;
- }
- get localStorage() {
- if (this.__localStorage == null) {
- this.__localStorage = new MockStorage();
- }
- return this.__localStorage;
- }
- set localStorage(locStorage) {
- this.__localStorage = locStorage;
- }
- get location() {
- if (this.__location == null) {
- this.__location = new MockLocation();
- }
- return this.__location;
- }
- set location(val) {
- if (typeof val === 'string') {
- if (this.__location == null) {
- this.__location = new MockLocation();
- }
- this.__location.href = val;
- }
- else {
- this.__location = val;
- }
- }
- matchMedia() {
- return {
- matches: false,
- };
- }
- get Node() {
- if (this.__nodeCstr == null) {
- const ownerDocument = this.document;
- this.__nodeCstr = class extends MockNode {
- constructor() {
- super(ownerDocument, 0, 'test', '');
- throw new Error('Illegal constructor: cannot construct Node');
- }
- };
- }
- return this.__nodeCstr;
- }
- get NodeList() {
- if (this.__nodeListCstr == null) {
- const ownerDocument = this.document;
- this.__nodeListCstr = class extends MockNodeList {
- constructor() {
- super(ownerDocument, [], 0);
- throw new Error('Illegal constructor: cannot construct NodeList');
- }
- };
- }
- return this.__nodeListCstr;
- }
- get navigator() {
- if (this.__navigator == null) {
- this.__navigator = new MockNavigator();
- }
- return this.__navigator;
- }
- set navigator(nav) {
- this.__navigator = nav;
- }
- get parent() {
- return null;
- }
- prompt() {
- return '';
- }
- open() {
- return null;
- }
- get origin() {
- return this.location.origin;
- }
- removeEventListener(type, handler) {
- removeEventListener(this, type, handler);
- }
- requestAnimationFrame(callback) {
- return this.setTimeout(() => {
- callback(Date.now());
- }, 0);
- }
- requestIdleCallback(callback) {
- return this.setTimeout(() => {
- callback({
- didTimeout: false,
- timeRemaining: () => 0,
- });
- }, 0);
- }
- scroll(_x, _y) {
- /**/
- }
- scrollBy(_x, _y) {
- /**/
- }
- scrollTo(_x, _y) {
- /**/
- }
- get self() {
- return this;
- }
- get sessionStorage() {
- if (this.__sessionStorage == null) {
- this.__sessionStorage = new MockStorage();
- }
- return this.__sessionStorage;
- }
- set sessionStorage(locStorage) {
- this.__sessionStorage = locStorage;
- }
- setInterval(callback, ms, ...args) {
- if (this.__timeouts == null) {
- this.__timeouts = new Set();
- }
- ms = Math.min(ms, this.__maxTimeout);
- if (this.__allowInterval) {
- const intervalId = this.__setInterval(() => {
- if (this.__timeouts) {
- this.__timeouts.delete(intervalId);
- try {
- callback(...args);
- }
- catch (e) {
- if (this.console) {
- this.console.error(e);
- }
- else {
- console.error(e);
- }
- }
- }
- }, ms);
- if (this.__timeouts) {
- this.__timeouts.add(intervalId);
- }
- return intervalId;
- }
- const timeoutId = this.__setTimeout(() => {
- if (this.__timeouts) {
- this.__timeouts.delete(timeoutId);
- try {
- callback(...args);
- }
- catch (e) {
- if (this.console) {
- this.console.error(e);
- }
- else {
- console.error(e);
- }
- }
- }
- }, ms);
- if (this.__timeouts) {
- this.__timeouts.add(timeoutId);
- }
- return timeoutId;
- }
- setTimeout(callback, ms, ...args) {
- if (this.__timeouts == null) {
- this.__timeouts = new Set();
- }
- ms = Math.min(ms, this.__maxTimeout);
- const timeoutId = this.__setTimeout(() => {
- if (this.__timeouts) {
- this.__timeouts.delete(timeoutId);
- try {
- callback(...args);
- }
- catch (e) {
- if (this.console) {
- this.console.error(e);
- }
- else {
- console.error(e);
- }
- }
- }
- }, ms);
- if (this.__timeouts) {
- this.__timeouts.add(timeoutId);
- }
- return timeoutId;
- }
- get top() {
- return this;
- }
- get window() {
- return this;
- }
- onanimationstart() {
- /**/
- }
- onanimationend() {
- /**/
- }
- onanimationiteration() {
- /**/
- }
- onabort() {
- /**/
- }
- onauxclick() {
- /**/
- }
- onbeforecopy() {
- /**/
- }
- onbeforecut() {
- /**/
- }
- onbeforepaste() {
- /**/
- }
- onblur() {
- /**/
- }
- oncancel() {
- /**/
- }
- oncanplay() {
- /**/
- }
- oncanplaythrough() {
- /**/
- }
- onchange() {
- /**/
- }
- onclick() {
- /**/
- }
- onclose() {
- /**/
- }
- oncontextmenu() {
- /**/
- }
- oncopy() {
- /**/
- }
- oncuechange() {
- /**/
- }
- oncut() {
- /**/
- }
- ondblclick() {
- /**/
- }
- ondrag() {
- /**/
- }
- ondragend() {
- /**/
- }
- ondragenter() {
- /**/
- }
- ondragleave() {
- /**/
- }
- ondragover() {
- /**/
- }
- ondragstart() {
- /**/
- }
- ondrop() {
- /**/
- }
- ondurationchange() {
- /**/
- }
- onemptied() {
- /**/
- }
- onended() {
- /**/
- }
- onerror() {
- /**/
- }
- onfocus() {
- /**/
- }
- onfocusin() {
- /**/
- }
- onfocusout() {
- /**/
- }
- onformdata() {
- /**/
- }
- onfullscreenchange() {
- /**/
- }
- onfullscreenerror() {
- /**/
- }
- ongotpointercapture() {
- /**/
- }
- oninput() {
- /**/
- }
- oninvalid() {
- /**/
- }
- onkeydown() {
- /**/
- }
- onkeypress() {
- /**/
- }
- onkeyup() {
- /**/
- }
- onload() {
- /**/
- }
- onloadeddata() {
- /**/
- }
- onloadedmetadata() {
- /**/
- }
- onloadstart() {
- /**/
- }
- onlostpointercapture() {
- /**/
- }
- onmousedown() {
- /**/
- }
- onmouseenter() {
- /**/
- }
- onmouseleave() {
- /**/
- }
- onmousemove() {
- /**/
- }
- onmouseout() {
- /**/
- }
- onmouseover() {
- /**/
- }
- onmouseup() {
- /**/
- }
- onmousewheel() {
- /**/
- }
- onpaste() {
- /**/
- }
- onpause() {
- /**/
- }
- onplay() {
- /**/
- }
- onplaying() {
- /**/
- }
- onpointercancel() {
- /**/
- }
- onpointerdown() {
- /**/
- }
- onpointerenter() {
- /**/
- }
- onpointerleave() {
- /**/
- }
- onpointermove() {
- /**/
- }
- onpointerout() {
- /**/
- }
- onpointerover() {
- /**/
- }
- onpointerup() {
- /**/
- }
- onprogress() {
- /**/
- }
- onratechange() {
- /**/
- }
- onreset() {
- /**/
- }
- onresize() {
- /**/
- }
- onscroll() {
- /**/
- }
- onsearch() {
- /**/
- }
- onseeked() {
- /**/
- }
- onseeking() {
- /**/
- }
- onselect() {
- /**/
- }
- onselectstart() {
- /**/
- }
- onstalled() {
- /**/
- }
- onsubmit() {
- /**/
- }
- onsuspend() {
- /**/
- }
- ontimeupdate() {
- /**/
- }
- ontoggle() {
- /**/
- }
- onvolumechange() {
- /**/
- }
- onwaiting() {
- /**/
- }
- onwebkitfullscreenchange() {
- /**/
- }
- onwebkitfullscreenerror() {
- /**/
- }
- onwheel() {
- /**/
- }
- }
- addGlobalsToWindowPrototype(MockWindow.prototype);
- function resetWindowDefaults(win) {
- win.__clearInterval = nativeClearInterval;
- win.__clearTimeout = nativeClearTimeout;
- win.__setInterval = nativeSetInterval;
- win.__setTimeout = nativeSetTimeout;
- win.__maxTimeout = 30000;
- win.__allowInterval = true;
- win.URL = nativeURL;
- }
- function cloneWindow(srcWin, opts = {}) {
- if (srcWin == null) {
- return null;
- }
- const clonedWin = new MockWindow(false);
- if (!opts.customElementProxy) {
- // TODO(STENCIL-345) - Evaluate reconciling MockWindow, Window differences
- // @ts-ignore
- srcWin.customElements = null;
- }
- if (srcWin.document != null) {
- const clonedDoc = new MockDocument(false, clonedWin);
- clonedWin.document = clonedDoc;
- clonedDoc.documentElement = srcWin.document.documentElement.cloneNode(true);
- }
- else {
- clonedWin.document = new MockDocument(null, clonedWin);
- }
- return clonedWin;
- }
- function cloneDocument(srcDoc) {
- if (srcDoc == null) {
- return null;
- }
- const dstWin = cloneWindow(srcDoc.defaultView);
- return dstWin.document;
- }
- // TODO(STENCIL-345) - Evaluate reconciling MockWindow, Window differences
- /**
- * Constrain setTimeout() to 1ms, but still async. Also
- * only allow setInterval() to fire once, also constrained to 1ms.
- * @param win the mock window instance to update
- */
- function constrainTimeouts(win) {
- win.__allowInterval = false;
- win.__maxTimeout = 0;
- }
- function resetWindow(win) {
- if (win != null) {
- if (win.__timeouts) {
- win.__timeouts.forEach((timeoutId) => {
- nativeClearInterval(timeoutId);
- nativeClearTimeout(timeoutId);
- });
- win.__timeouts.clear();
- }
- if (win.customElements && win.customElements.clear) {
- win.customElements.clear();
- }
- resetDocument(win.document);
- resetPerformance(win.performance);
- for (const key in win) {
- if (win.hasOwnProperty(key) && key !== 'document' && key !== 'performance' && key !== 'customElements') {
- delete win[key];
- }
- }
- resetWindowDefaults(win);
- resetWindowDimensions(win);
- resetEventListeners(win);
- if (win.document != null) {
- try {
- win.document.defaultView = win;
- }
- catch (e) { }
- }
- // ensure we don't hold onto nodeFetch values
- win.fetch = null;
- win.Headers = null;
- win.Request = null;
- win.Response = null;
- win.FetchError = null;
- }
- }
- function resetWindowDimensions(win) {
- try {
- win.devicePixelRatio = 1;
- win.innerHeight = 768;
- win.innerWidth = 1366;
- win.pageXOffset = 0;
- win.pageYOffset = 0;
- win.screenLeft = 0;
- win.screenTop = 0;
- win.screenX = 0;
- win.screenY = 0;
- win.scrollX = 0;
- win.scrollY = 0;
- win.screen = {
- availHeight: win.innerHeight,
- availLeft: 0,
- availTop: 0,
- availWidth: win.innerWidth,
- colorDepth: 24,
- height: win.innerHeight,
- keepAwake: false,
- orientation: {
- angle: 0,
- type: 'portrait-primary',
- },
- pixelDepth: 24,
- width: win.innerWidth,
- };
- }
- catch (e) { }
- }
- class MockDocument extends MockHTMLElement {
- constructor(html = null, win = null) {
- super(null, null);
- this.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
- this.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
- this.defaultView = win;
- this.cookie = '';
- this.referrer = '';
- this.appendChild(this.createDocumentTypeNode());
- if (typeof html === 'string') {
- const parsedDoc = parseDocumentUtil(this, html);
- const documentElement = parsedDoc.children.find((elm) => elm.nodeName === 'HTML');
- if (documentElement != null) {
- this.appendChild(documentElement);
- setOwnerDocument(documentElement, this);
- }
- }
- else if (html !== false) {
- const documentElement = new MockHTMLElement(this, 'html');
- this.appendChild(documentElement);
- documentElement.appendChild(new MockHTMLElement(this, 'head'));
- documentElement.appendChild(new MockHTMLElement(this, 'body'));
- }
- }
- get dir() {
- return this.documentElement.dir;
- }
- set dir(value) {
- this.documentElement.dir = value;
- }
- get location() {
- if (this.defaultView != null) {
- return this.defaultView.location;
- }
- return null;
- }
- set location(val) {
- if (this.defaultView != null) {
- this.defaultView.location = val;
- }
- }
- get baseURI() {
- const baseNode = this.head.childNodes.find((node) => node.nodeName === 'BASE');
- if (baseNode) {
- return baseNode.href;
- }
- return this.URL;
- }
- get URL() {
- return this.location.href;
- }
- get styleSheets() {
- return this.querySelectorAll('style');
- }
- get scripts() {
- return this.querySelectorAll('script');
- }
- get forms() {
- return this.querySelectorAll('form');
- }
- get images() {
- return this.querySelectorAll('img');
- }
- get scrollingElement() {
- return this.documentElement;
- }
- get documentElement() {
- for (let i = this.childNodes.length - 1; i >= 0; i--) {
- if (this.childNodes[i].nodeName === 'HTML') {
- return this.childNodes[i];
- }
- }
- const documentElement = new MockHTMLElement(this, 'html');
- this.appendChild(documentElement);
- return documentElement;
- }
- set documentElement(documentElement) {
- for (let i = this.childNodes.length - 1; i >= 0; i--) {
- if (this.childNodes[i].nodeType !== 10 /* NODE_TYPES.DOCUMENT_TYPE_NODE */) {
- this.childNodes[i].remove();
- }
- }
- if (documentElement != null) {
- this.appendChild(documentElement);
- setOwnerDocument(documentElement, this);
- }
- }
- get head() {
- const documentElement = this.documentElement;
- for (let i = 0; i < documentElement.childNodes.length; i++) {
- if (documentElement.childNodes[i].nodeName === 'HEAD') {
- return documentElement.childNodes[i];
- }
- }
- const head = new MockHTMLElement(this, 'head');
- documentElement.insertBefore(head, documentElement.firstChild);
- return head;
- }
- set head(head) {
- const documentElement = this.documentElement;
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
- if (documentElement.childNodes[i].nodeName === 'HEAD') {
- documentElement.childNodes[i].remove();
- }
- }
- if (head != null) {
- documentElement.insertBefore(head, documentElement.firstChild);
- setOwnerDocument(head, this);
- }
- }
- get body() {
- const documentElement = this.documentElement;
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
- if (documentElement.childNodes[i].nodeName === 'BODY') {
- return documentElement.childNodes[i];
- }
- }
- const body = new MockHTMLElement(this, 'body');
- documentElement.appendChild(body);
- return body;
- }
- set body(body) {
- const documentElement = this.documentElement;
- for (let i = documentElement.childNodes.length - 1; i >= 0; i--) {
- if (documentElement.childNodes[i].nodeName === 'BODY') {
- documentElement.childNodes[i].remove();
- }
- }
- if (body != null) {
- documentElement.appendChild(body);
- setOwnerDocument(body, this);
- }
- }
- appendChild(newNode) {
- newNode.remove();
- newNode.parentNode = this;
- this.childNodes.push(newNode);
- return newNode;
- }
- createComment(data) {
- return new MockComment(this, data);
- }
- createAttribute(attrName) {
- return new MockAttr(attrName.toLowerCase(), '');
- }
- createAttributeNS(namespaceURI, attrName) {
- return new MockAttr(attrName, '', namespaceURI);
- }
- createElement(tagName) {
- if (tagName === "#document" /* NODE_NAMES.DOCUMENT_NODE */) {
- const doc = new MockDocument(false);
- doc.nodeName = tagName;
- doc.parentNode = null;
- return doc;
- }
- return createElement(this, tagName);
- }
- createElementNS(namespaceURI, tagName) {
- const elmNs = createElementNS(this, namespaceURI, tagName);
- elmNs.namespaceURI = namespaceURI;
- return elmNs;
- }
- createTextNode(text) {
- return new MockTextNode(this, text);
- }
- createDocumentFragment() {
- return new MockDocumentFragment(this);
- }
- createDocumentTypeNode() {
- return new MockDocumentTypeNode(this);
- }
- getElementById(id) {
- return getElementById(this, id);
- }
- getElementsByName(elmName) {
- return getElementsByName(this, elmName.toLowerCase());
- }
- get title() {
- const title = this.head.childNodes.find((elm) => elm.nodeName === 'TITLE');
- if (title != null && typeof title.textContent === 'string') {
- return title.textContent.trim();
- }
- return '';
- }
- set title(value) {
- const head = this.head;
- let title = head.childNodes.find((elm) => elm.nodeName === 'TITLE');
- if (title == null) {
- title = this.createElement('title');
- head.appendChild(title);
- }
- title.textContent = value;
- }
- }
- function createDocument(html = null) {
- return new MockWindow(html).document;
- }
- function createFragment(html) {
- return parseHtmlToFragment(html, null);
- }
- function resetDocument(doc) {
- if (doc != null) {
- resetEventListeners(doc);
- const documentElement = doc.documentElement;
- if (documentElement != null) {
- resetElement(documentElement);
- for (let i = 0, ii = documentElement.childNodes.length; i < ii; i++) {
- const childNode = documentElement.childNodes[i];
- resetElement(childNode);
- childNode.childNodes.length = 0;
- }
- }
- for (const key in doc) {
- if (doc.hasOwnProperty(key) && !DOC_KEY_KEEPERS.has(key)) {
- delete doc[key];
- }
- }
- try {
- doc.nodeName = "#document" /* NODE_NAMES.DOCUMENT_NODE */;
- }
- catch (e) { }
- try {
- doc.nodeType = 9 /* NODE_TYPES.DOCUMENT_NODE */;
- }
- catch (e) { }
- try {
- doc.cookie = '';
- }
- catch (e) { }
- try {
- doc.referrer = '';
- }
- catch (e) { }
- }
- }
- const DOC_KEY_KEEPERS = new Set([
- 'nodeName',
- 'nodeType',
- 'nodeValue',
- 'ownerDocument',
- 'parentNode',
- 'childNodes',
- '_shadowRoot',
- ]);
- function getElementById(elm, id) {
- const children = elm.children;
- for (let i = 0, ii = children.length; i < ii; i++) {
- const childElm = children[i];
- if (childElm.id === id) {
- return childElm;
- }
- const childElmFound = getElementById(childElm, id);
- if (childElmFound != null) {
- return childElmFound;
- }
- }
- return null;
- }
- function getElementsByName(elm, elmName, foundElms = []) {
- const children = elm.children;
- for (let i = 0, ii = children.length; i < ii; i++) {
- const childElm = children[i];
- if (childElm.name && childElm.name.toLowerCase() === elmName) {
- foundElms.push(childElm);
- }
- getElementsByName(childElm, elmName, foundElms);
- }
- return foundElms;
- }
- function setOwnerDocument(elm, ownerDocument) {
- for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
- elm.childNodes[i].ownerDocument = ownerDocument;
- if (elm.childNodes[i].nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
- setOwnerDocument(elm.childNodes[i], ownerDocument);
- }
- }
- }
- function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve) {
- var globalThis = $stencilWindow;
- var self = $stencilWindow;
- var top = $stencilWindow;
- var parent = $stencilWindow;
- var addEventListener = $stencilWindow.addEventListener.bind($stencilWindow);
- var alert = $stencilWindow.alert.bind($stencilWindow);
- var blur = $stencilWindow.blur.bind($stencilWindow);
- var cancelAnimationFrame = $stencilWindow.cancelAnimationFrame.bind($stencilWindow);
- var cancelIdleCallback = $stencilWindow.cancelIdleCallback.bind($stencilWindow);
- var clearInterval = $stencilWindow.clearInterval.bind($stencilWindow);
- var clearTimeout = $stencilWindow.clearTimeout.bind($stencilWindow);
- var close = () => {};
- var confirm = $stencilWindow.confirm.bind($stencilWindow);
- var dispatchEvent = $stencilWindow.dispatchEvent.bind($stencilWindow);
- var focus = $stencilWindow.focus.bind($stencilWindow);
- var getComputedStyle = $stencilWindow.getComputedStyle.bind($stencilWindow);
- var matchMedia = $stencilWindow.matchMedia.bind($stencilWindow);
- var open = $stencilWindow.open.bind($stencilWindow);
- var prompt = $stencilWindow.prompt.bind($stencilWindow);
- var removeEventListener = $stencilWindow.removeEventListener.bind($stencilWindow);
- var requestAnimationFrame = $stencilWindow.requestAnimationFrame.bind($stencilWindow);
- var requestIdleCallback = $stencilWindow.requestIdleCallback.bind($stencilWindow);
- var setInterval = $stencilWindow.setInterval.bind($stencilWindow);
- var setTimeout = $stencilWindow.setTimeout.bind($stencilWindow);
- var CharacterData = $stencilWindow.CharacterData;
- var CSS = $stencilWindow.CSS;
- var CustomEvent = $stencilWindow.CustomEvent;
- var Document = $stencilWindow.Document;
- var DocumentFragment = $stencilWindow.DocumentFragment;
- var DocumentType = $stencilWindow.DocumentType;
- var DOMTokenList = $stencilWindow.DOMTokenList;
- var Element = $stencilWindow.Element;
- var Event = $stencilWindow.Event;
- var HTMLAnchorElement = $stencilWindow.HTMLAnchorElement;
- var HTMLBaseElement = $stencilWindow.HTMLBaseElement;
- var HTMLButtonElement = $stencilWindow.HTMLButtonElement;
- var HTMLCanvasElement = $stencilWindow.HTMLCanvasElement;
- var HTMLElement = $stencilWindow.HTMLElement;
- var HTMLFormElement = $stencilWindow.HTMLFormElement;
- var HTMLImageElement = $stencilWindow.HTMLImageElement;
- var HTMLInputElement = $stencilWindow.HTMLInputElement;
- var HTMLLinkElement = $stencilWindow.HTMLLinkElement;
- var HTMLMetaElement = $stencilWindow.HTMLMetaElement;
- var HTMLScriptElement = $stencilWindow.HTMLScriptElement;
- var HTMLStyleElement = $stencilWindow.HTMLStyleElement;
- var HTMLTemplateElement = $stencilWindow.HTMLTemplateElement;
- var HTMLTitleElement = $stencilWindow.HTMLTitleElement;
- var IntersectionObserver = $stencilWindow.IntersectionObserver;
- var KeyboardEvent = $stencilWindow.KeyboardEvent;
- var MouseEvent = $stencilWindow.MouseEvent;
- var Node = $stencilWindow.Node;
- var NodeList = $stencilWindow.NodeList;
- var URL = $stencilWindow.URL;
- var console = $stencilWindow.console;
- var customElements = $stencilWindow.customElements;
- var history = $stencilWindow.history;
- var localStorage = $stencilWindow.localStorage;
- var location = $stencilWindow.location;
- var navigator = $stencilWindow.navigator;
- var performance = $stencilWindow.performance;
- var sessionStorage = $stencilWindow.sessionStorage;
- var devicePixelRatio = $stencilWindow.devicePixelRatio;
- var innerHeight = $stencilWindow.innerHeight;
- var innerWidth = $stencilWindow.innerWidth;
- var origin = $stencilWindow.origin;
- var pageXOffset = $stencilWindow.pageXOffset;
- var pageYOffset = $stencilWindow.pageYOffset;
- var screen = $stencilWindow.screen;
- var screenLeft = $stencilWindow.screenLeft;
- var screenTop = $stencilWindow.screenTop;
- var screenX = $stencilWindow.screenX;
- var screenY = $stencilWindow.screenY;
- var scrollX = $stencilWindow.scrollX;
- var scrollY = $stencilWindow.scrollY;
- var exports = {};
- var fetch, FetchError, Headers, Request, Response;
- if (typeof $stencilWindow.fetch === 'function') {
- fetch = $stencilWindow.fetch;
- } else {
- fetch = $stencilWindow.fetch = function() { throw new Error('fetch() is not implemented'); };
- }
- if (typeof $stencilWindow.FetchError === 'function') {
- FetchError = $stencilWindow.FetchError;
- } else {
- FetchError = $stencilWindow.FetchError = class FetchError { constructor() { throw new Error('FetchError is not implemented'); } };
- }
- if (typeof $stencilWindow.Headers === 'function') {
- Headers = $stencilWindow.Headers;
- } else {
- Headers = $stencilWindow.Headers = class Headers { constructor() { throw new Error('Headers is not implemented'); } };
- }
- if (typeof $stencilWindow.Request === 'function') {
- Request = $stencilWindow.Request;
- } else {
- Request = $stencilWindow.Request = class Request { constructor() { throw new Error('Request is not implemented'); } };
- }
- if (typeof $stencilWindow.Response === 'function') {
- Response = $stencilWindow.Response;
- } else {
- Response = $stencilWindow.Response = class Response { constructor() { throw new Error('Response is not implemented'); } };
- }
- function hydrateAppClosure($stencilWindow) {
- const window = $stencilWindow;
- const document = $stencilWindow.document;
- /*hydrateAppClosure start*/
- const NAMESPACE = 'calcite';
- 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 };
- const autoTheme = "calcite-theme-auto";
- const darkTheme = "calcite-theme-dark";
- const lightTheme = "calcite-theme-light";
- const CSS_UTILITY = {
- autoTheme,
- darkTheme,
- lightTheme,
- rtl: "calcite--rtl"
- };
- const TEXT$v = {
- loading: "Loading"
- };
- /**
- * Emits when the theme is dynamically toggled between light and dark on <body> or in OS preferences.
- */
- function initThemeChangeEvent() {
- const { classList } = document.body;
- const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
- const getTheme = () => classList.contains(darkTheme) || (classList.contains(autoTheme) && prefersDark) ? "dark" : "light";
- const emitThemeChange = (theme) => document.body.dispatchEvent(new CustomEvent("calciteThemeChange", { bubbles: true, detail: { theme } }));
- const themeChangeHandler = (newTheme) => {
- currentTheme !== newTheme && emitThemeChange(newTheme);
- currentTheme = newTheme;
- };
- let currentTheme = getTheme();
- // emits event on page load
- emitThemeChange(currentTheme);
- // emits event when changing OS theme preferences
- window
- .matchMedia("(prefers-color-scheme: dark)")
- .addEventListener("change", (event) => themeChangeHandler(event.matches ? "dark" : "light"));
- // emits event when toggling between theme classes on <body>
- new MutationObserver(() => themeChangeHandler(getTheme())).observe(document.body, {
- attributes: true,
- attributeFilter: ["class"]
- });
- }
- /**
- * This file is imported in Stencil's `globalScript` config option.
- *
- * @see {@link https://stenciljs.com/docs/config#globalscript}
- */
- function appGlobalScript () {
- const isBrowser = typeof window !== "undefined" &&
- typeof location !== "undefined" &&
- typeof document !== "undefined" &&
- window.location === location &&
- window.document === document;
- if (isBrowser) {
- if (document.readyState === "interactive") {
- initThemeChangeEvent();
- }
- else {
- document.addEventListener("DOMContentLoaded", () => initThemeChangeEvent(), { once: true });
- }
- }
- }
- const globalScripts = appGlobalScript;
- function componentOnReady() {
- return getHostRef(this).$onReadyPromise$;
- }
- function forceUpdate() {}
- function hydrateApp(e, t, o, n, s) {
- function l() {
- if (global.clearTimeout(p), i.clear(), r.clear(), !h) {
- h = !0;
- try {
- t.clientHydrateAnnotations && insertVdomAnnotations(e.document, t.staticComponents),
- e.dispatchEvent(new e.Event("DOMContentLoaded")), e.document.createElement = c,
- e.document.createElementNS = $;
- } catch (e) {
- renderCatchError(t, o, e);
- }
- }
- n(e, t, o, s);
- }
- function a(e) {
- renderCatchError(t, o, e), l();
- }
- const r = new Set, i = new Set, d = new Set, c = e.document.createElement, $ = e.document.createElementNS, m = Promise.resolve();
- let p, h = !1;
- try {
- function u() {
- return g(this);
- }
- function f(e) {
- if (isValidComponent(e, t) && !getHostRef(e)) {
- const t = loadModule({
- $tagName$: e.nodeName.toLowerCase(),
- $flags$: null
- });
- null != t && null != t.cmpMeta && (i.add(e), e.connectedCallback = u, registerHost(e, t.cmpMeta),
- function o(e, t) {
- if ("function" != typeof e.componentOnReady && (e.componentOnReady = componentOnReady),
- "function" != typeof e.forceUpdate && (e.forceUpdate = forceUpdate), 1 & t.$flags$ && (e.shadowRoot = e),
- null != t.$members$) {
- const o = getHostRef(e);
- Object.entries(t.$members$).forEach((([n, s]) => {
- const l = s[0];
- if (31 & l) {
- const a = s[1] || n, r = e.getAttribute(a);
- if (null != r) {
- const e = parsePropertyValue(r, l);
- o.$instanceValues$.set(n, e);
- }
- const i = e[n];
- void 0 !== i && (o.$instanceValues$.set(n, i), delete e[n]), Object.defineProperty(e, n, {
- get() {
- return getValue(this, n);
- },
- set(e) {
- setValue(this, n, e, t);
- },
- configurable: !0,
- enumerable: !0
- });
- } else 64 & l && Object.defineProperty(e, n, {
- value(...e) {
- const t = getHostRef(this);
- return t.$onInstancePromise$.then((() => t.$lazyInstance$[n](...e))).catch(consoleError);
- }
- });
- }));
- }
- }(e, t.cmpMeta));
- }
- }
- function g(n) {
- return i.delete(n), isValidComponent(n, t) && o.hydratedCount < t.maxHydrateCount && !r.has(n) && shouldHydrate(n) ? (r.add(n),
- async function s(e, t, o, n, l) {
- o = o.toLowerCase();
- const a = loadModule({
- $tagName$: o,
- $flags$: null
- });
- if (null != a && null != a.cmpMeta) {
- l.add(n);
- try {
- connectedCallback(n), await n.componentOnReady(), t.hydratedCount++;
- const e = getHostRef(n), s = e.$modeName$ ? e.$modeName$ : "$";
- t.components.some((e => e.tag === o && e.mode === s)) || t.components.push({
- tag: o,
- mode: s,
- count: 0,
- depth: -1
- });
- } catch (t) {
- e.console.error(t);
- }
- l.delete(n);
- }
- }(e, o, n.nodeName, n, d)) : m;
- }
- e.document.createElement = function t(o) {
- const n = c.call(e.document, o);
- return f(n), n;
- }, e.document.createElementNS = function t(o, n) {
- const s = $.call(e.document, o, n);
- return f(s), s;
- }, p = global.setTimeout((function L() {
- a(`Hydrate exceeded timeout${function e(t) {
- return Array.from(t).map(waitingOnElementMsg);
- }(d)}`);
- }), t.timeout), plt.$resourcesUrl$ = new URL(t.resourcesUrl || "./", doc.baseURI).href,
- globalScripts(), function e(t) {
- if (null != t && 1 === t.nodeType) {
- f(t);
- const o = t.children;
- for (let t = 0, n = o.length; t < n; t++) e(o[t]);
- }
- }(e.document.body), function e() {
- const t = Array.from(i).filter((e => e.parentElement));
- return t.length > 0 ? Promise.all(t.map(g)).then(e) : m;
- }().then(l).catch(a);
- } catch (e) {
- a(e);
- }
- }
- function isValidComponent(e, t) {
- if (null != e && 1 === e.nodeType) {
- const o = e.nodeName;
- if ("string" == typeof o && o.includes("-")) return !t.excludeComponents.includes(o.toLowerCase());
- }
- return !1;
- }
- function shouldHydrate(e) {
- if (9 === e.nodeType) return !0;
- if (NO_HYDRATE_TAGS.has(e.nodeName)) return !1;
- if (e.hasAttribute("no-prerender")) return !1;
- const t = e.parentNode;
- return null == t || shouldHydrate(t);
- }
- function renderCatchError(e, t, o) {
- const n = {
- level: "error",
- type: "build",
- header: "Hydrate Error",
- messageText: "",
- relFilePath: null,
- absFilePath: null,
- lines: []
- };
- if (e.url) try {
- const t = new URL(e.url);
- "/" !== t.pathname && (n.header += ": " + t.pathname);
- } catch (e) {}
- null != o && (null != o.stack ? n.messageText = o.stack.toString() : null != o.message ? n.messageText = o.message.toString() : n.messageText = o.toString()),
- t.diagnostics.push(n);
- }
- function printTag(e) {
- let t = `<${e.nodeName.toLowerCase()}`;
- if (Array.isArray(e.attributes)) for (let o = 0; o < e.attributes.length; o++) {
- const n = e.attributes[o];
- t += ` ${n.name}`, "" !== n.value && (t += `="${n.value}"`);
- }
- return t += ">", t;
- }
- function waitingOnElementMsg(e) {
- let t = "";
- if (e) {
- const o = [];
- t = " - waiting on:";
- let n = e;
- for (;n && 9 !== n.nodeType && "BODY" !== n.nodeName; ) o.unshift(printTag(n)),
- n = n.parentElement;
- let s = "";
- for (const e of o) s += " ", t += `\n${s}${e}`;
- }
- return t;
- }
- const createTime = (e, t = "") => {
- return () => {};
- }, XLINK_NS = "http://www.w3.org/1999/xlink", 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) => {
- let n = null, s = null, l = null, a = !1, r = !1;
- const i = [], d = t => {
- 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 ,
- a && r ? i[i.length - 1].$text$ += n : i.push(a ? newVNode(null, n) : n), r = a);
- };
- if (d(o), t && (t.key && (s = t.key),
- t.name && (l = t.name), BUILD.vdomClass)) {
- const e = t.className || t.class;
- e && (t.class = "object" != typeof e ? e : Object.keys(e).filter((t => e[t])).join(" "));
- }
- if ("function" == typeof e) return e(null === t ? {} : t, i, vdomFnUtils);
- const c = newVNode(e, null);
- return c.$attrs$ = t, i.length > 0 && (c.$children$ = i), (c.$key$ = s),
- (c.$name$ = l), c;
- }, newVNode = (e, t) => {
- const o = {
- $flags$: 0,
- $tag$: e,
- $text$: t,
- $elm$: null,
- $children$: null
- };
- return (o.$attrs$ = null), (o.$key$ = null),
- (o.$name$ = null), o;
- }, Host = {}, isHost = e => e && e.$tag$ === Host, vdomFnUtils = {
- forEach: (e, t) => e.map(convertToPublic).forEach(t),
- map: (e, t) => e.map(convertToPublic).map(t).map(convertToPrivate)
- }, convertToPublic = e => ({
- vattrs: e.$attrs$,
- vchildren: e.$children$,
- vkey: e.$key$,
- vname: e.$name$,
- vtag: e.$tag$,
- vtext: e.$text$
- }), convertToPrivate = e => {
- if ("function" == typeof e.vtag) {
- const t = {
- ...e.vattrs
- };
- return e.vkey && (t.key = e.vkey), e.vname && (t.name = e.vname), h(e.vtag, t, ...e.vchildren || []);
- }
- const t = newVNode(e.vtag, e.vtext);
- return t.$attrs$ = e.vattrs, t.$children$ = e.vchildren, t.$key$ = e.vkey, t.$name$ = e.vname,
- t;
- }, clientHydrate = (e, t, o, n, s, l, a) => {
- let r, i, d, c;
- if (1 === l.nodeType) {
- for (r = l.getAttribute("c-id"), r && (i = r.split("."), i[0] !== a && "0" !== i[0] || (d = {
- $flags$: 0,
- $hostId$: i[0],
- $nodeId$: i[1],
- $depth$: i[2],
- $index$: i[3],
- $tag$: l.tagName.toLowerCase(),
- $elm$: l,
- $attrs$: null,
- $children$: null,
- $key$: null,
- $name$: null,
- $text$: null
- }, t.push(d), l.removeAttribute("c-id"), e.$children$ || (e.$children$ = []), e.$children$[d.$index$] = d,
- 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);
- if (l.shadowRoot) for (c = l.shadowRoot.childNodes.length - 1; c >= 0; c--) clientHydrate(e, t, o, n, s, l.shadowRoot.childNodes[c], a);
- } else if (8 === l.nodeType) i = l.nodeValue.split("."), i[1] !== a && "0" !== i[1] || (r = i[0],
- d = {
- $flags$: 0,
- $hostId$: i[1],
- $nodeId$: i[2],
- $depth$: i[3],
- $index$: i[4],
- $elm$: l,
- $attrs$: null,
- $children$: null,
- $key$: null,
- $name$: null,
- $tag$: null,
- $text$: null
- }, "t" === r ? (d.$elm$ = l.nextSibling, d.$elm$ && 3 === d.$elm$.nodeType && (d.$text$ = d.$elm$.textContent,
- t.push(d), l.remove(), e.$children$ || (e.$children$ = []), e.$children$[d.$index$] = d,
- n && "0" === d.$depth$ && (n[d.$index$] = d.$elm$))) : d.$hostId$ === a && ("s" === r ? (d.$tag$ = "slot",
- i[5] ? l["s-sn"] = d.$name$ = i[5] : l["s-sn"] = "", l["s-sr"] = !0, n && (d.$elm$ = doc.createElement(d.$tag$),
- d.$name$ && d.$elm$.setAttribute("name", d.$name$), l.parentNode.insertBefore(d.$elm$, l),
- l.remove(), "0" === d.$depth$ && (n[d.$index$] = d.$elm$)), o.push(d), e.$children$ || (e.$children$ = []),
- e.$children$[d.$index$] = d) : "r" === r && (n ? l.remove() : (s["s-cr"] = l,
- l["s-cn"] = !0)))); else if (e && "style" === e.$tag$) {
- const t = newVNode(null, l.textContent);
- t.$elm$ = l, t.$index$ = "0", e.$children$ = [ t ];
- }
- }, initializeDocumentHydrate = (e, t) => {
- if (1 === e.nodeType) {
- let o = 0;
- for (;o < e.childNodes.length; o++) initializeDocumentHydrate(e.childNodes[o], t);
- if (e.shadowRoot) for (o = 0; o < e.shadowRoot.childNodes.length; o++) initializeDocumentHydrate(e.shadowRoot.childNodes[o], t);
- } else if (8 === e.nodeType) {
- const o = e.nodeValue.split(".");
- "o" === o[0] && (t.set(o[1] + "." + o[2], e), e.nodeValue = "", e["s-en"] = o[3]);
- }
- }, parsePropertyValue = (e, t) => null == e || isComplexType(e) ? e : 4 & t ? "false" !== e && ("" === e || !!e) : 2 & t ? parseFloat(e) : 1 & t ? String(e) : e, getElement = e => getHostRef(e).$hostElement$ , createEvent = (e, t, o) => {
- const n = getElement(e);
- return {
- emit: e => (emitEvent(n, t, {
- bubbles: !!(4 & o),
- composed: !!(2 & o),
- cancelable: !!(1 & o),
- detail: e
- }))
- };
- }, emitEvent = (e, t, o) => {
- const n = plt.ce(t, o);
- return e.dispatchEvent(n), n;
- }, rootAppliedStyles = new WeakMap, registerStyle = (e, t, o) => {
- let n = styles.get(e);
- n = t, styles.set(e, n);
- }, addStyle = (e, t, o, n) => {
- let s = getScopeId(t);
- const l = styles.get(s);
- if (e = 11 === e.nodeType ? e : doc, l) if ("string" == typeof l) {
- e = e.head || e;
- let o, a = rootAppliedStyles.get(e);
- if (a || rootAppliedStyles.set(e, a = new Set), !a.has(s)) {
- if (e.host && (o = e.querySelector(`[sty-id="${s}"]`))) o.innerHTML = l; else {
- o = doc.createElement("style"), o.innerHTML = l;
- o.setAttribute("sty-id", s),
- e.insertBefore(o, e.querySelector("link"));
- }
- a && a.add(s);
- }
- }
- return s;
- }, attachStyles = e => {
- const t = e.$cmpMeta$, o = e.$hostElement$, n = t.$flags$, s = createTime("attachStyles", t.$tagName$), l = addStyle(o.getRootNode(), t);
- 10 & n && (o["s-sc"] = l,
- o.classList.add(l + "-h"), BUILD.scoped ),
- s();
- }, getScopeId = (e, t) => "sc-" + (e.$tagName$), setAccessor = (e, t, o, n, s, l) => {
- if (o !== n) {
- let a = isMemberInElement(e, t), r = t.toLowerCase();
- if ("class" === t) {
- const t = e.classList, s = parseClassList(o), l = parseClassList(n);
- t.remove(...s.filter((e => e && !l.includes(e)))), t.add(...l.filter((e => e && !s.includes(e))));
- } else if ("style" === t) {
- for (const t in o) n && null != n[t] || (e.style[t] = "");
- for (const t in n) o && n[t] === o[t] || (e.style[t] = n[t]);
- } else if ("key" === t) ; else if ("ref" === t) n && n(e); else if ((a ) || "o" !== t[0] || "n" !== t[1]) {
- {
- const i = isComplexType(n);
- if ((a || i && null !== n) && !s) try {
- if (e.tagName.includes("-")) e[t] = n; else {
- const s = null == n ? "" : n;
- "list" === t ? a = !1 : null != o && e[t] == s || (e[t] = s);
- }
- } catch (e) {}
- let d = !1;
- 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,
- d ? e.setAttributeNS(XLINK_NS, t, n) : e.setAttribute(t, n));
- }
- } else t = "-" === t[2] ? t.slice(3) : isMemberInElement(win, r) ? r.slice(2) : r[2] + t.slice(3),
- o && plt.rel(e, t, o, !1), n && plt.ael(e, t, n, !1);
- }
- }, parseClassListRegex = /\s/, parseClassList = e => e ? e.split(parseClassListRegex) : [], updateElement = (e, t, o, n) => {
- 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;
- for (n in l) n in a || setAccessor(s, n, l[n], void 0, o, t.$flags$);
- for (n in a) setAccessor(s, n, l[n], a[n], o, t.$flags$);
- };
- let scopeId, contentRef, hostTagName, useNativeShadowDom = !1, checkSlotFallbackVisibility = !1, checkSlotRelocate = !1, isSvgMode = !1;
- const createElm = (e, t, o, n) => {
- const s = t.$children$[o];
- let l, a, r, i = 0;
- if (!useNativeShadowDom && (checkSlotRelocate = !0, "slot" === s.$tag$ && (scopeId && n.classList.add(scopeId + "-s"),
- s.$flags$ |= s.$children$ ? 2 : 1)), null !== s.$text$) l = s.$elm$ = doc.createTextNode(s.$text$); else if (1 & s.$flags$) l = s.$elm$ = slotReferenceDebugNode(s) ; else {
- if (!isSvgMode && (isSvgMode = "svg" === s.$tag$), l = s.$elm$ = doc.createElementNS(isSvgMode ? "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml", 2 & s.$flags$ ? "slot-fb" : s.$tag$) ,
- isSvgMode && "foreignObject" === s.$tag$ && (isSvgMode = !1), updateElement(null, s, isSvgMode),
- null != scopeId && l["s-si"] !== scopeId && l.classList.add(l["s-si"] = scopeId),
- s.$children$) for (i = 0; i < s.$children$.length; ++i) a = createElm(e, s, i, l),
- a && l.appendChild(a);
- ("svg" === s.$tag$ ? isSvgMode = !1 : "foreignObject" === l.tagName && (isSvgMode = !0));
- }
- return (l["s-hn"] = hostTagName, 3 & s.$flags$ && (l["s-sr"] = !0,
- l["s-cr"] = contentRef, l["s-sn"] = s.$name$ || "", r = e && e.$children$ && e.$children$[o],
- r && r.$tag$ === s.$tag$ && e.$elm$ && putBackInOriginalLocation(e.$elm$, !1))),
- l;
- }, putBackInOriginalLocation = (e, t) => {
- plt.$flags$ |= 1;
- const o = e.childNodes;
- for (let e = o.length - 1; e >= 0; e--) {
- const n = o[e];
- n["s-hn"] !== hostTagName && n["s-ol"] && (parentReferenceNode(n).insertBefore(n, referenceNode(n)),
- n["s-ol"].remove(), n["s-ol"] = void 0, checkSlotRelocate = !0), t && putBackInOriginalLocation(n, t);
- }
- plt.$flags$ &= -2;
- }, addVnodes = (e, t, o, n, s, l) => {
- let a, r = e["s-cr"] && e["s-cr"].parentNode || e;
- for (r.shadowRoot && r.tagName === hostTagName && (r = r.shadowRoot); s <= l; ++s) n[s] && (a = createElm(null, o, s, e),
- a && (n[s].$elm$ = a, r.insertBefore(a, referenceNode(t) )));
- }, removeVnodes = (e, t, o, n, s) => {
- for (;t <= o; ++t) (n = e[t]) && (s = n.$elm$, callNodeRefs(n), (checkSlotFallbackVisibility = !0,
- s["s-ol"] ? s["s-ol"].remove() : putBackInOriginalLocation(s, !0)), s.remove());
- }, 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) => {
- const o = t.$elm$ = e.$elm$, n = e.$children$, s = t.$children$, l = t.$tag$, a = t.$text$;
- let r;
- null !== a ? (r = o["s-cr"]) ? r.parentNode.textContent = a : e.$text$ !== a && (o.data = a) : ((isSvgMode = "svg" === l || "foreignObject" !== l && isSvgMode),
- ("slot" === l || updateElement(e, t, isSvgMode)),
- null !== n && null !== s ? ((e, t, o, n) => {
- 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];
- 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),
- $ = 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),
- 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),
- patch(m, h), e.insertBefore(m.$elm$, $.$elm$), m = t[--c], h = n[++r]; else {
- if (i = -1, BUILD.vdomKey) for (d = a; d <= c; ++d) if (t[d] && null !== t[d].$key$ && t[d].$key$ === h.$key$) {
- i = d;
- break;
- }
- i >= 0 ? (l = t[i], l.$tag$ !== h.$tag$ ? s = createElm(t && t[r], o, i, e) : (patch(l, h),
- t[i] = void 0, s = l.$elm$), h = n[++r]) : (s = createElm(t && t[r], o, r, e), h = n[++r]),
- s && (parentReferenceNode($.$elm$).insertBefore(s, referenceNode($.$elm$)) );
- }
- a > c ? addVnodes(e, null == n[p + 1] ? null : n[p + 1].$elm$, o, n, r, p) : r > p && removeVnodes(t, a, c);
- })(o, n, t, s) : null !== s ? (null !== e.$text$ && (o.textContent = ""),
- addVnodes(o, null, t, s, 0, s.length - 1)) : null !== n && removeVnodes(n, 0, n.length - 1),
- isSvgMode && "svg" === l && (isSvgMode = !1));
- }, updateFallbackSlotVisibility = e => {
- const t = e.childNodes;
- let o, n, s, l, a, r;
- for (n = 0, s = t.length; n < s; n++) if (o = t[n], 1 === o.nodeType) {
- if (o["s-sr"]) for (a = o["s-sn"], o.hidden = !1, l = 0; l < s; l++) if (r = t[l].nodeType,
- t[l]["s-hn"] !== o["s-hn"] || "" !== a) {
- if (1 === r && a === t[l].getAttribute("slot")) {
- o.hidden = !0;
- break;
- }
- } else if (1 === r || 3 === r && "" !== t[l].textContent.trim()) {
- o.hidden = !0;
- break;
- }
- updateFallbackSlotVisibility(o);
- }
- }, relocateNodes = [], relocateSlotContent = e => {
- let t, o, n, s, l, a, r = 0;
- const i = e.childNodes, d = i.length;
- for (;r < d; r++) {
- if (t = i[r], t["s-sr"] && (o = t["s-cr"]) && o.parentNode) for (n = o.parentNode.childNodes,
- 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)),
- checkSlotFallbackVisibility = !0, o["s-sn"] = o["s-sn"] || s, l ? l.$slotRefNode$ = t : relocateNodes.push({
- $slotRefNode$: t,
- $nodeToRelocate$: o
- }), o["s-sr"] && relocateNodes.map((e => {
- isNodeLocatedInSlot(e.$nodeToRelocate$, o["s-sn"]) && (l = relocateNodes.find((e => e.$nodeToRelocate$ === o)),
- l && !e.$slotRefNode$ && (e.$slotRefNode$ = l.$slotRefNode$));
- }))) : relocateNodes.some((e => e.$nodeToRelocate$ === o)) || relocateNodes.push({
- $nodeToRelocate$: o
- }));
- 1 === t.nodeType && relocateSlotContent(t);
- }
- }, isNodeLocatedInSlot = (e, t) => 1 === e.nodeType ? null === e.getAttribute("slot") && "" === t || e.getAttribute("slot") === t : e["s-sn"] === t || "" === t, callNodeRefs = e => {
- (e.$attrs$ && e.$attrs$.ref && e.$attrs$.ref(null), e.$children$ && e.$children$.map(callNodeRefs));
- }, renderVdom = (e, t) => {
- const o = e.$hostElement$, n = e.$cmpMeta$, s = e.$vnode$ || newVNode(null, null), l = isHost(t) ? t : h(null, null, t);
- if (hostTagName = o.tagName, BUILD.isDev ) ;
- if (n.$attrsToReflect$ && (l.$attrs$ = l.$attrs$ || {}, n.$attrsToReflect$.map((([e, t]) => l.$attrs$[t] = o[e]))),
- l.$tag$ = null, l.$flags$ |= 4, e.$vnode$ = l, l.$elm$ = s.$elm$ = o.shadowRoot || o,
- (scopeId = o["s-sc"]), (contentRef = o["s-cr"],
- useNativeShadowDom = supportsShadow, checkSlotFallbackVisibility = !1), patch(s, l),
- BUILD.slotRelocation) {
- if (plt.$flags$ |= 1, checkSlotRelocate) {
- let e, t, o, n, s, a;
- relocateSlotContent(l.$elm$);
- let r = 0;
- for (;r < relocateNodes.length; r++) e = relocateNodes[r], t = e.$nodeToRelocate$,
- t["s-ol"] || (o = originalLocationDebugNode(t) ,
- o["s-nr"] = t, t.parentNode.insertBefore(t["s-ol"] = o, t));
- for (r = 0; r < relocateNodes.length; r++) if (e = relocateNodes[r], t = e.$nodeToRelocate$,
- e.$slotRefNode$) {
- for (n = e.$slotRefNode$.parentNode, s = e.$slotRefNode$.nextSibling, o = t["s-ol"]; o = o.previousSibling; ) if (a = o["s-nr"],
- a && a["s-sn"] === t["s-sn"] && n === a.parentNode && (a = a.nextSibling, !a || !a["s-nr"])) {
- s = a;
- break;
- }
- (!s && n !== t.parentNode || t.nextSibling !== s) && t !== s && (!t["s-hn"] && t["s-ol"] && (t["s-hn"] = t["s-ol"].parentNode.nodeName),
- n.insertBefore(t, s));
- } else 1 === t.nodeType && (t.hidden = !0);
- }
- checkSlotFallbackVisibility && updateFallbackSlotVisibility(l.$elm$), plt.$flags$ &= -2,
- relocateNodes.length = 0;
- }
- }, 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}]`)), attachToAncestor = (e, t) => {
- t && !e.$onRenderResolve$ && t["s-p"] && t["s-p"].push(new Promise((t => e.$onRenderResolve$ = t)));
- }, scheduleUpdate = (e, t) => {
- if ((e.$flags$ |= 16), 4 & e.$flags$) return void (e.$flags$ |= 512);
- attachToAncestor(e, e.$ancestorComponent$);
- const o = () => dispatchHooks(e, t);
- return writeTask(o) ;
- }, dispatchHooks = (e, t) => {
- const n = createTime("scheduleUpdate", e.$cmpMeta$.$tagName$), s = e.$lazyInstance$ ;
- let l;
- return t ? ((e.$flags$ |= 256, e.$queuedListeners$ && (e.$queuedListeners$.map((([e, t]) => safeCall(s, e, t))),
- e.$queuedListeners$ = null)), (l = safeCall(s, "componentWillLoad"))) : (BUILD.cmpWillUpdate ), (l = then(l, (() => safeCall(s, "componentWillRender")))),
- n(), then(l, (() => updateComponent(e, s, t)));
- }, updateComponent = async (e, t, o) => {
- const n = e.$hostElement$, s = createTime("update", e.$cmpMeta$.$tagName$), l = n["s-rc"];
- o && attachStyles(e);
- const a = createTime("render", e.$cmpMeta$.$tagName$);
- if (await callRender(e, t) ,
- BUILD.hydrateServerSide) try {
- serverSideConnected(n), o && (1 & e.$cmpMeta$.$flags$ ? n["s-en"] = "" : 2 & e.$cmpMeta$.$flags$ && (n["s-en"] = "c"));
- } catch (e) {
- consoleError(e, n);
- }
- if (l && (l.map((e => e())), n["s-rc"] = void 0), a(), s(),
- BUILD.asyncLoading) {
- const t = n["s-p"], o = () => postUpdateComponent(e);
- 0 === t.length ? o() : (Promise.all(t).then(o), e.$flags$ |= 4, t.length = 0);
- }
- };
- const callRender = (e, t, o) => {
- try {
- if (t = t.render(), (e.$flags$ &= -17),
- (e.$flags$ |= 2), BUILD.hasRenderFn ) {
- return Promise.resolve(t).then((t => renderVdom(e, t)));
- }
- } catch (t) {
- consoleError(t, e.$hostElement$);
- }
- return null;
- }, postUpdateComponent = e => {
- const t = e.$cmpMeta$.$tagName$, o = e.$hostElement$, n = createTime("postUpdate", t), s = e.$lazyInstance$ , l = e.$ancestorComponent$;
- (safeCall(s, "componentDidRender"),
- BUILD.isDev ), 64 & e.$flags$ ? (n()) : (e.$flags$ |= 64, addHydratedFlag(o),
- (safeCall(s, "componentDidLoad"),
- BUILD.isDev ), n(), (e.$onReadyResolve$(o), l || appDidLoad())), e.$onInstanceResolve$(o), (e.$onRenderResolve$ && (e.$onRenderResolve$(),
- e.$onRenderResolve$ = void 0), 512 & e.$flags$ && nextTick((() => scheduleUpdate(e, !1))),
- e.$flags$ &= -517);
- }, forceUpdate$1 = e => {
- {
- const t = getHostRef(e), o = t.$hostElement$.isConnected;
- return o && 2 == (18 & t.$flags$) && scheduleUpdate(t, !1), o;
- }
- }, appDidLoad = e => {
- addHydratedFlag(doc.documentElement), nextTick((() => emitEvent(win, "appload", {
- detail: {
- namespace: NAMESPACE
- }
- }))), BUILD.profile ;
- }, safeCall = (e, t, o) => {
- if (e && e[t]) try {
- return e[t](o);
- } catch (e) {
- consoleError(e);
- }
- }, then = (e, t) => e && e.then ? e.then(t) : t(), addHydratedFlag = e => e.classList.add("calcite-hydrated") , serverSideConnected = e => {
- const t = e.children;
- if (null != t) for (let e = 0, o = t.length; e < o; e++) {
- const o = t[e];
- "function" == typeof o.connectedCallback && o.connectedCallback(), serverSideConnected(o);
- }
- }, getValue = (e, t) => getHostRef(e).$instanceValues$.get(t), setValue = (e, t, o, n) => {
- const s = getHostRef(e), l = s.$hostElement$ , a = s.$instanceValues$.get(t), r = s.$flags$, i = s.$lazyInstance$ ;
- o = parsePropertyValue(o, n.$members$[t][0]);
- const d = Number.isNaN(a) && Number.isNaN(o), c = o !== a && !d;
- if ((!(8 & r) || void 0 === a) && c && (s.$instanceValues$.set(t, o),
- i)) {
- if (n.$watchers$ && 128 & r) {
- const e = n.$watchers$[t];
- e && e.map((e => {
- try {
- i[e](o, a, t);
- } catch (e) {
- consoleError(e, l);
- }
- }));
- }
- if (2 == (18 & r)) {
- if (i.componentShouldUpdate && !1 === i.componentShouldUpdate(o, a, t)) return;
- scheduleUpdate(s, !1);
- }
- }
- }, proxyComponent = (e, t, o) => {
- if (t.$members$) {
- e.watchers && (t.$watchers$ = e.watchers);
- const n = Object.entries(t.$members$), s = e.prototype;
- if (n.map((([e, [n]]) => {
- (31 & n || (2 & o) && 32 & n) ? Object.defineProperty(s, e, {
- get() {
- return getValue(this, e);
- },
- set(s) {
- setValue(this, e, s, t);
- },
- configurable: !0,
- enumerable: !0
- }) : 1 & o && 64 & n && Object.defineProperty(s, e, {
- value(...t) {
- const o = getHostRef(this);
- return o.$onInstancePromise$.then((() => o.$lazyInstance$[e](...t)));
- }
- });
- })), (1 & o)) {
- const o = new Map;
- s.attributeChangedCallback = function(e, t, n) {
- plt.jmp((() => {
- const t = o.get(e);
- if (this.hasOwnProperty(t)) n = this[t], delete this[t]; else if (s.hasOwnProperty(t) && "number" == typeof this[t] && this[t] == n) return;
- this[t] = (null !== n || "boolean" != typeof this[t]) && n;
- }));
- }, e.observedAttributes = n.filter((([e, t]) => 15 & t[0])).map((([e, n]) => {
- const s = n[1] || e;
- return o.set(s, e), 512 & n[0] && t.$attrsToReflect$.push([ e, s ]),
- s;
- }));
- }
- }
- return e;
- }, initializeComponent = async (e, t, o, n, s) => {
- if (0 == (32 & t.$flags$)) {
- {
- if (t.$flags$ |= 32, (s = loadModule(o)).then) {
- const e = (() => {});
- s = await s, e();
- }
- !s.isProxied && ((o.$watchers$ = s.watchers),
- proxyComponent(s, o, 2), s.isProxied = !0);
- const e = createTime("createInstance", o.$tagName$);
- (t.$flags$ |= 8);
- try {
- new s(t);
- } catch (e) {
- consoleError(e);
- }
- (t.$flags$ &= -9), (t.$flags$ |= 128), e(),
- fireConnectedCallback(t.$lazyInstance$);
- }
- if (s.style) {
- let n = s.style;
- const l = getScopeId(o);
- if (!styles.has(l)) {
- const e = createTime("registerStyles", o.$tagName$);
- registerStyle(l, n), e();
- }
- }
- }
- const r = t.$ancestorComponent$, i = () => scheduleUpdate(t, !0);
- r && r["s-rc"] ? r["s-rc"].push(i) : i();
- }, fireConnectedCallback = e => {
- safeCall(e, "connectedCallback");
- }, connectedCallback = e => {
- if (0 == (1 & plt.$flags$)) {
- const t = getHostRef(e), o = t.$cmpMeta$, n = createTime("connectedCallback", o.$tagName$);
- if (1 & t.$flags$) addHostEventListeners(e, t, o.$listeners$), fireConnectedCallback(t.$lazyInstance$); else {
- let n;
- if (t.$flags$ |= 1, (n = e.getAttribute("s-id"), n)) {
- ((e, t, o, n) => {
- const s = createTime("hydrateClient", t), l = e.shadowRoot, a = [], r = l ? [] : null, i = n.$vnode$ = newVNode(t, null);
- plt.$orgLocNodes$ || initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = new Map),
- e["s-id"] = o, e.removeAttribute("s-id"), clientHydrate(i, a, [], r, e, e, o), a.map((e => {
- const o = e.$hostId$ + "." + e.$nodeId$, n = plt.$orgLocNodes$.get(o), s = e.$elm$;
- n && supportsShadow && "" === n["s-en"] && n.parentNode.insertBefore(s, n.nextSibling),
- l || (s["s-hn"] = t, n && (s["s-ol"] = n, s["s-ol"]["s-nr"] = s)), plt.$orgLocNodes$.delete(o);
- })), l && r.map((e => {
- e && l.appendChild(e);
- })), s();
- })(e, o.$tagName$, n, t);
- }
- if (!n && (BUILD.hydrateServerSide ) && setContentReference(e),
- BUILD.asyncLoading) {
- let o = e;
- for (;o = o.parentNode || o.host; ) if (1 === o.nodeType && o.hasAttribute("s-id") && o["s-p"] || o["s-p"]) {
- attachToAncestor(t, t.$ancestorComponent$ = o);
- break;
- }
- }
- initializeComponent(e, t, o);
- }
- n();
- }
- }, setContentReference = e => {
- const t = e["s-cr"] = doc.createComment("");
- t["s-cn"] = !0, e.insertBefore(t, e.firstChild);
- }, Fragment = (e, t) => t, addHostEventListeners = (e, t, o, n) => {
- o && (o.map((([o, n, s]) => {
- const l = getHostListenerTarget(e, o) , a = hostListenerProxy(t, s), r = hostListenerOpts(o);
- plt.ael(l, n, a, r), (t.$rmListeners$ = t.$rmListeners$ || []).push((() => plt.rel(l, n, a, r)));
- })));
- }, hostListenerProxy = (e, t) => o => {
- try {
- 256 & e.$flags$ ? e.$lazyInstance$[t](o) : (e.$queuedListeners$ = e.$queuedListeners$ || []).push([ t, o ]) ;
- } catch (e) {
- consoleError(e);
- }
- }, getHostListenerTarget = (e, t) => 4 & t ? doc : 8 & t ? win : 16 & t ? doc.body : e, hostListenerOpts = e => 0 != (2 & e), insertVdomAnnotations = (e, t) => {
- if (null != e) {
- const o = {
- hostIds: 0,
- rootLevelIds: 0,
- staticComponents: new Set(t)
- }, n = [];
- parseVNodeAnnotations(e, e.body, o, n), n.forEach((t => {
- if (null != t) {
- const n = t["s-nr"];
- let s = n["s-host-id"], l = n["s-node-id"], a = `${s}.${l}`;
- if (null == s) if (s = 0, o.rootLevelIds++, l = o.rootLevelIds, a = `${s}.${l}`,
- 1 === n.nodeType) n.setAttribute("c-id", a); else if (3 === n.nodeType) {
- if (0 === s && "" === n.nodeValue.trim()) return void t.remove();
- const o = e.createComment(a);
- o.nodeValue = `t.${a}`, n.parentNode.insertBefore(o, n);
- }
- let r = `o.${a}`;
- const i = t.parentElement;
- i && ("" === i["s-en"] ? r += "." : "c" === i["s-en"] && (r += ".c")), t.nodeValue = r;
- }
- }));
- }
- }, parseVNodeAnnotations = (e, t, o, n) => {
- null != t && (null != t["s-nr"] && n.push(t), 1 === t.nodeType && t.childNodes.forEach((t => {
- const s = getHostRef(t);
- if (null != s && !o.staticComponents.has(t.nodeName.toLowerCase())) {
- const n = {
- nodeIds: 0
- };
- insertVNodeAnnotations(e, t, s.$vnode$, o, n);
- }
- parseVNodeAnnotations(e, t, o, n);
- })));
- }, insertVNodeAnnotations = (e, t, o, n, s) => {
- if (null != o) {
- const l = ++n.hostIds;
- if (t.setAttribute("s-id", l), null != t["s-cr"] && (t["s-cr"].nodeValue = `r.${l}`),
- null != o.$children$) {
- const t = 0;
- o.$children$.forEach(((o, n) => {
- insertChildVNodeAnnotations(e, o, s, l, t, n);
- }));
- }
- if (t && o && o.$elm$ && !t.hasAttribute("c-id")) {
- const e = t.parentElement;
- if (e && e.childNodes) {
- const n = Array.from(e.childNodes), s = n.find((e => 8 === e.nodeType && e["s-sr"]));
- if (s) {
- const e = n.indexOf(t) - 1;
- o.$elm$.setAttribute("c-id", `${s["s-host-id"]}.${s["s-node-id"]}.0.${e}`);
- }
- }
- }
- }
- }, insertChildVNodeAnnotations = (e, t, o, n, s, l) => {
- const a = t.$elm$;
- if (null == a) return;
- const r = o.nodeIds++, i = `${n}.${r}.${s}.${l}`;
- if (a["s-host-id"] = n, a["s-node-id"] = r, 1 === a.nodeType) a.setAttribute("c-id", i); else if (3 === a.nodeType) {
- const t = a.parentNode, o = t.nodeName;
- if ("STYLE" !== o && "SCRIPT" !== o) {
- const o = `t.${i}`, n = e.createComment(o);
- t.insertBefore(n, a);
- }
- } else if (8 === a.nodeType && a["s-sr"]) {
- const e = `s.${i}.${a["s-sn"] || ""}`;
- a.nodeValue = e;
- }
- if (null != t.$children$) {
- const l = s + 1;
- t.$children$.forEach(((t, s) => {
- insertChildVNodeAnnotations(e, t, o, n, l, s);
- }));
- }
- }, hAsync = (e, t, ...o) => {
- if (Array.isArray(o) && o.length > 0) {
- const n = o.flat(1 / 0);
- return n.some(isPromise) ? Promise.all(n).then((o => h(e, t, ...o))).catch((o => h(e, t))) : h(e, t, ...o);
- }
- return h(e, t);
- }, NO_HYDRATE_TAGS = new Set([ "CODE", "HEAD", "IFRAME", "INPUT", "OBJECT", "OUTPUT", "NOSCRIPT", "PRE", "SCRIPT", "SELECT", "STYLE", "TEMPLATE", "TEXTAREA" ]);
- const cmpModules = new Map, getModule = e => {
- if ("string" == typeof e) {
- e = e.toLowerCase();
- const t = cmpModules.get(e);
- if (null != t) return t[e];
- }
- return null;
- }, loadModule = (e, t, o) => getModule(e.$tagName$), isMemberInElement = (e, t) => {
- if (null != e) {
- if (t in e) return !0;
- const o = getModule(e.nodeName);
- if (null != o) {
- const e = o;
- if (null != e && null != e.cmpMeta && null != e.cmpMeta.$members$) return t in e.cmpMeta.$members$;
- }
- }
- return !1;
- }, registerComponents = e => {
- for (const t of e) {
- const e = t.cmpMeta.$tagName$;
- cmpModules.set(e, {
- [e]: t
- });
- }
- }, win = window, doc = win.document, writeTask = e => {
- process.nextTick((() => {
- try {
- e();
- } catch (e) {
- consoleError(e);
- }
- }));
- }, resolved = Promise.resolve(), nextTick = e => resolved.then(e), defaultConsoleError = e => {
- null != e && console.error(e.stack || e.message || e);
- }, consoleError = (e, t) => (defaultConsoleError)(e, t), plt = {
- $flags$: 0,
- $resourcesUrl$: "",
- jmp: e => e(),
- raf: e => requestAnimationFrame(e),
- ael: (e, t, o, n) => e.addEventListener(t, o, n),
- rel: (e, t, o, n) => e.removeEventListener(t, o, n),
- ce: (e, t) => new win.CustomEvent(e, t)
- }, supportsShadow = !1, hostRefs = new WeakMap, getHostRef = e => hostRefs.get(e), registerInstance = (e, t) => hostRefs.set(t.$lazyInstance$ = e, t), registerHost = (e, t) => {
- const o = {
- $flags$: 0,
- $cmpMeta$: t,
- $hostElement$: e,
- $instanceValues$: new Map,
- $renderCount$: 0
- };
- return o.$onInstancePromise$ = new Promise((e => o.$onInstanceResolve$ = e)), o.$onReadyPromise$ = new Promise((e => o.$onReadyResolve$ = e)),
- e["s-p"] = [], e["s-rc"] = [], addHostEventListeners(e, o, t.$listeners$), hostRefs.set(e, o);
- }, styles = new Map;
- const accordionCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-accordion{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-accordion{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-accordion{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-accordion{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-accordion:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-accordion:root{--calcite-floating-ui-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-inline-size: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-block-end-width:0px;border-style:solid;border-color:var(--calcite-ui-border-2)}";
- /**
- * @slot - A slot for adding `calcite-accordion-item`s. `calcite-accordion` cannot be nested, however `calcite-accordion-item`s can.
- */
- class Accordion {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalAccordionChange = createEvent(this, "calciteInternalAccordionChange", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /** Specifies the appearance of the component. */
- this.appearance = "solid";
- /** Specifies the placement of the icon in the header. */
- this.iconPosition = "end";
- /** Specifies the type of the icon in the header. */
- this.iconType = "chevron";
- /** Specifies the size of the component. */
- this.scale = "m";
- /**
- * Specifies the selection mode - `"multi"` (allow any number of open items), `"single"` (allow one open item),
- * or `"single-persist"` (allow and require one open item).
- */
- this.selectionMode = "multi";
- //--------------------------------------------------------------------------
- //
- // Private State/Props
- //
- //--------------------------------------------------------------------------
- /** created list of Accordion items */
- this.items = [];
- /** keep track of whether the items have been sorted so we don't re-sort */
- this.sorted = false;
- this.sortItems = (items) => items.sort((a, b) => a.position - b.position).map((a) => a.item);
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidLoad() {
- if (!this.sorted) {
- this.items = this.sortItems(this.items);
- this.sorted = true;
- }
- }
- render() {
- const transparent = this.appearance === "transparent";
- const minimal = this.appearance === "minimal";
- return (hAsync("div", { class: {
- "accordion--transparent": transparent,
- "accordion--minimal": minimal,
- accordion: !transparent && !minimal
- } }, hAsync("slot", null)));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- calciteInternalAccordionItemKeyEvent(event) {
- const item = event.detail.item;
- const parent = event.detail.parent;
- if (this.el === parent) {
- const { key } = item;
- const itemToFocus = event.target;
- const isFirstItem = this.itemIndex(itemToFocus) === 0;
- const isLastItem = this.itemIndex(itemToFocus) === this.items.length - 1;
- switch (key) {
- case "ArrowDown":
- if (isLastItem) {
- this.focusFirstItem();
- }
- else {
- this.focusNextItem(itemToFocus);
- }
- break;
- case "ArrowUp":
- if (isFirstItem) {
- this.focusLastItem();
- }
- else {
- this.focusPrevItem(itemToFocus);
- }
- break;
- case "Home":
- this.focusFirstItem();
- break;
- case "End":
- this.focusLastItem();
- break;
- }
- }
- event.stopPropagation();
- }
- registerCalciteAccordionItem(event) {
- const item = {
- item: event.target,
- parent: event.detail.parent,
- position: event.detail.position
- };
- if (this.el === item.parent) {
- this.items.push(item);
- }
- event.stopPropagation();
- }
- updateActiveItemOnChange(event) {
- this.requestedAccordionItem = event.detail.requestedAccordionItem;
- this.calciteInternalAccordionChange.emit({
- requestedAccordionItem: this.requestedAccordionItem
- });
- event.stopPropagation();
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- focusFirstItem() {
- const firstItem = this.items[0];
- this.focusElement(firstItem);
- }
- focusLastItem() {
- const lastItem = this.items[this.items.length - 1];
- this.focusElement(lastItem);
- }
- focusNextItem(el) {
- const index = this.itemIndex(el);
- const nextItem = this.items[index + 1] || this.items[0];
- this.focusElement(nextItem);
- }
- focusPrevItem(el) {
- const index = this.itemIndex(el);
- const prevItem = this.items[index - 1] || this.items[this.items.length - 1];
- this.focusElement(prevItem);
- }
- itemIndex(el) {
- return this.items.indexOf(el);
- }
- focusElement(item) {
- const target = item;
- target === null || target === void 0 ? void 0 : target.focus();
- }
- get el() { return getElement(this); }
- static get style() { return accordionCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-accordion",
- "$members$": {
- "appearance": [513],
- "iconPosition": [513, "icon-position"],
- "iconType": [513, "icon-type"],
- "scale": [513],
- "selectionMode": [513, "selection-mode"]
- },
- "$listeners$": [[0, "calciteInternalAccordionItemKeyEvent", "calciteInternalAccordionItemKeyEvent"], [0, "calciteInternalAccordionItemRegister", "registerCalciteAccordionItem"], [0, "calciteInternalAccordionItemSelect", "updateActiveItemOnChange"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["appearance", "appearance"], ["iconPosition", "icon-position"], ["iconType", "icon-type"], ["scale", "scale"], ["selectionMode", "selection-mode"]]
- }; }
- }
- function gen(counts) {
- return counts
- .map((count) => {
- let out = "";
- for (let i = 0; i < count; i++) {
- out += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
- }
- return out;
- })
- .join("-");
- }
- const guid = () => gen([2, 1, 1, 1, 3]);
- /**
- * This helper will guarantee an ID on the provided element.
- *
- * If it already has an ID, it will be preserved, otherwise a unique one will be generated and assigned.
- *
- * @param el
- * @returns {string} The element's ID.
- */
- function ensureId(el) {
- if (!el) {
- return "";
- }
- return (el.id = el.id || `${el.tagName.toLowerCase()}-${guid()}`);
- }
- function nodeListToArray(nodeList) {
- return Array.isArray(nodeList) ? nodeList : Array.from(nodeList);
- }
- function getThemeName(el) {
- const closestElWithTheme = closestElementCrossShadowBoundary(el, `.${CSS_UTILITY.darkTheme}, .${CSS_UTILITY.lightTheme}`);
- return (closestElWithTheme === null || closestElWithTheme === void 0 ? void 0 : closestElWithTheme.classList.contains("calcite-theme-dark")) ? "dark" : "light";
- }
- function getElementDir(el) {
- const prop = "dir";
- const selector = `[${prop}]`;
- const closest = closestElementCrossShadowBoundary(el, selector);
- return closest ? closest.getAttribute(prop) : "ltr";
- }
- function getElementProp(el, prop, fallbackValue) {
- const selector = `[${prop}]`;
- const closest = el.closest(selector);
- return closest ? closest.getAttribute(prop) : fallbackValue;
- }
- function getRootNode(el) {
- return el.getRootNode();
- }
- function getHost(root) {
- return root.host || null;
- }
- /**
- * This helper queries an element's rootNode and any ancestor rootNodes.
- *
- * If both an 'id' and 'selector' are supplied, 'id' will take precedence over 'selector'.
- *
- * @param element
- * @param root0
- * @param root0.selector
- * @param root0.id
- * @returns {Element} The element.
- */
- function queryElementRoots(element, { selector, id }) {
- // Gets the rootNode and any ancestor rootNodes (shadowRoot or document) of an element and queries them for a selector.
- // Based on: https://stackoverflow.com/q/54520554/194216
- function queryFrom(el) {
- if (!el) {
- return null;
- }
- if (el.assignedSlot) {
- el = el.assignedSlot;
- }
- const rootNode = getRootNode(el);
- const found = id
- ? "getElementById" in rootNode
- ? /*
- Check to make sure 'getElementById' exists in cases where element is no longer connected to the DOM and getRootNode() returns the element.
- https://github.com/Esri/calcite-components/pull/4280
- */
- rootNode.getElementById(id)
- : null
- : selector
- ? rootNode.querySelector(selector)
- : null;
- const host = getHost(rootNode);
- return found ? found : host ? queryFrom(host) : null;
- }
- return queryFrom(element);
- }
- function closestElementCrossShadowBoundary(element, selector) {
- // based on https://stackoverflow.com/q/54520554/194216
- function closestFrom(el) {
- return el ? el.closest(selector) || closestFrom(getHost(getRootNode(el))) : null;
- }
- return closestFrom(element);
- }
- function isCalciteFocusable(el) {
- return typeof (el === null || el === void 0 ? void 0 : el.setFocus) === "function";
- }
- async function focusElement(el) {
- if (!el) {
- return;
- }
- return isCalciteFocusable(el) ? el.setFocus() : el.focus();
- }
- const defaultSlotSelector = ":not([slot])";
- function getSlotted(element, slotName, options) {
- if (slotName && !Array.isArray(slotName) && typeof slotName !== "string") {
- options = slotName;
- slotName = null;
- }
- const slotSelector = slotName
- ? Array.isArray(slotName)
- ? slotName.map((name) => `[slot="${name}"]`).join(",")
- : `[slot="${slotName}"]`
- : defaultSlotSelector;
- if (options === null || options === void 0 ? void 0 : options.all) {
- return queryMultiple(element, slotSelector, options);
- }
- return querySingle(element, slotSelector, options);
- }
- function getDirectChildren(el, selector) {
- return el ? Array.from(el.children || []).filter((child) => child === null || child === void 0 ? void 0 : child.matches(selector)) : [];
- }
- function queryMultiple(element, slotSelector, options) {
- let matches = slotSelector === defaultSlotSelector
- ? getDirectChildren(element, defaultSlotSelector)
- : Array.from(element.querySelectorAll(slotSelector));
- matches = options && options.direct === false ? matches : matches.filter((el) => el.parentElement === element);
- 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;
- const selector = options === null || options === void 0 ? void 0 : options.selector;
- return selector
- ? matches
- .map((item) => Array.from(item.querySelectorAll(selector)))
- .reduce((previousValue, currentValue) => [...previousValue, ...currentValue], [])
- .filter((match) => !!match)
- : matches;
- }
- function querySingle(element, slotSelector, options) {
- let match = slotSelector === defaultSlotSelector
- ? getDirectChildren(element, defaultSlotSelector)[0] || null
- : element.querySelector(slotSelector);
- match = options && options.direct === false ? match : (match === null || match === void 0 ? void 0 : match.parentElement) === element ? match : null;
- match = (options === null || options === void 0 ? void 0 : options.matches) ? ((match === null || match === void 0 ? void 0 : match.matches(options.matches)) ? match : null) : match;
- const selector = options === null || options === void 0 ? void 0 : options.selector;
- return selector ? match === null || match === void 0 ? void 0 : match.querySelector(selector) : match;
- }
- function filterDirectChildren(el, selector) {
- return Array.from(el.children).filter((child) => child.matches(selector));
- }
- // set a default icon from a defined set or allow an override with an icon name string
- function setRequestedIcon(iconObject, iconValue, matchedValue) {
- if (typeof iconValue === "string" && iconValue !== "") {
- return iconValue;
- }
- else if (iconValue === "") {
- return iconObject[matchedValue];
- }
- }
- function intersects(rect1, rect2) {
- return !(rect2.left > rect1.right ||
- rect2.right < rect1.left ||
- rect2.top > rect1.bottom ||
- rect2.bottom < rect1.top);
- }
- /**
- * This helper makes sure that boolean aria attributes are properly converted to a string.
- *
- * It should only be used for aria attributes that require a string value of "true" or "false".
- *
- * @param value
- * @returns {string} The string conversion of a boolean value ("true" | "false").
- */
- function toAriaBoolean(value) {
- return Boolean(value).toString();
- }
- /**
- * This helper returns true if the pointer event fired from the primary button of the device.
- *
- * See https://www.w3.org/TR/pointerevents/#the-button-property.
- *
- * @param event
- * @returns {boolean}
- */
- function isPrimaryPointerButton(event) {
- return !!(event.isPrimary && event.button === 0);
- }
- /**
- * This utility ensures observers are created only for browser contexts.
- *
- * @param type - the type of observer to create
- * @param callback - the observer callback
- * @param options - the observer options
- */
- function createObserver(type, callback, options) {
- {
- return undefined;
- }
- }
- const observed = new Set();
- let mutationObserver$1;
- const observerOptions = { childList: true };
- /**
- * Helper to set up a conditional slot component on connectedCallback.
- *
- * @param component
- */
- function connectConditionalSlotComponent(component) {
- if (!mutationObserver$1) {
- mutationObserver$1 = createObserver();
- }
- mutationObserver$1.observe(component.el, observerOptions);
- }
- /**
- * Helper to tear down a conditional slot component on disconnectedCallback.
- *
- * @param component
- */
- function disconnectConditionalSlotComponent(component) {
- observed.delete(component.el);
- // we explicitly process queued mutations and disconnect and reconnect
- // the observer until MutationObserver gets an `unobserve` method
- // see https://github.com/whatwg/dom/issues/126
- processMutations(mutationObserver$1.takeRecords());
- mutationObserver$1.disconnect();
- for (const [element] of observed.entries()) {
- mutationObserver$1.observe(element, observerOptions);
- }
- }
- function processMutations(mutations) {
- mutations.forEach(({ target }) => {
- forceUpdate$1(target);
- });
- }
- const SLOTS$u = {
- actionsStart: "actions-start",
- actionsEnd: "actions-end"
- };
- const CSS$U = {
- icon: "icon",
- header: "header",
- headerContent: "header-content",
- actionsStart: "actions-start",
- actionsEnd: "actions-end",
- headerText: "header-text",
- heading: "heading",
- description: "description",
- expandIcon: "expand-icon",
- content: "content",
- iconStart: "icon--start",
- iconEnd: "icon--end",
- headerContainer: "header-container"
- };
- const accordionItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-accordion-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-accordion-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-accordion-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-accordion-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-accordion-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-accordion-item:root{--calcite-floating-ui-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:flex;flex-direction:column;color:var(--calcite-ui-text-3);text-decoration-line:none;background-color:var(--calcite-accordion-item-background, var(--calcite-ui-foreground-1))}/*!@:host .header-content*/.sc-calcite-accordion-item-h .header-content.sc-calcite-accordion-item{outline-color:transparent}/*!@:host(:focus) .header-content*/.sc-calcite-accordion-item-h:focus .header-content.sc-calcite-accordion-item{outline:2px solid transparent;outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([expanded])*/[expanded].sc-calcite-accordion-item-h{color:var(--calcite-ui-text-1)}/*!@:host([expanded]) .content*/[expanded].sc-calcite-accordion-item-h .content.sc-calcite-accordion-item{display:block;color:var(--calcite-ui-text-1)}/*!@:host([expanded]) .header*/[expanded].sc-calcite-accordion-item-h .header.sc-calcite-accordion-item{border-block-end-color:transparent}/*!@:host .header*/.sc-calcite-accordion-item-h .header.sc-calcite-accordion-item{display:flex;align-items:stretch}/*!@:host .icon*/.sc-calcite-accordion-item-h .icon.sc-calcite-accordion-item{position:relative;margin:0px;display:inline-flex;color:var(--calcite-ui-text-3);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);margin-inline-end:var(--calcite-accordion-item-icon-spacing-start);margin-inline-start:var(--calcite-accordion-item-icon-spacing-end)}/*!@.icon--start*/.icon--start.sc-calcite-accordion-item{display:flex;align-items:center;margin-inline-end:var(--calcite-accordion-icon-margin)}/*!@.icon--end*/.icon--end.sc-calcite-accordion-item{display:flex;align-items:center;margin-inline-end:var(--calcite-accordion-icon-margin);margin-inline-start:var(--calcite-accordion-icon-margin)}/*!@.header-container*/.header-container.sc-calcite-accordion-item{inline-size:100%}/*!@.content*/.content.sc-calcite-accordion-item{padding:var(--calcite-accordion-item-padding)}/*!@:host .content,\n:host .header*/.sc-calcite-accordion-item-h .content.sc-calcite-accordion-item,.sc-calcite-accordion-item-h .header.sc-calcite-accordion-item{border-block-end:1px solid var(--calcite-accordion-item-border, var(--calcite-ui-border-2))}/*!@:host .header **/.sc-calcite-accordion-item-h .header.sc-calcite-accordion-item *.sc-calcite-accordion-item{display:inline-flex;align-items:center;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .content*/.sc-calcite-accordion-item-h .content.sc-calcite-accordion-item{display:none;padding-block-start:0px;color:var(--calcite-ui-text-3);text-align:initial}/*!@:host .expand-icon*/.sc-calcite-accordion-item-h .expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-3);margin-inline-start:var(--calcite-accordion-item-icon-spacing-start);margin-inline-end:var(--calcite-accordion-item-icon-spacing-end);transform:rotate(var(--calcite-accordion-item-icon-rotation))}/*!@.calcite--rtl .expand-icon*/.calcite--rtl.sc-calcite-accordion-item .expand-icon.sc-calcite-accordion-item{transform:rotate(var(--calcite-accordion-item-icon-rotation-rtl))}/*!@:host([expanded]) .expand-icon*/[expanded].sc-calcite-accordion-item-h .expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1);transform:rotate(var(--calcite-accordion-item-active-icon-rotation))}/*!@:host([expanded]) .calcite--rtl .expand-icon*/[expanded].sc-calcite-accordion-item-h .calcite--rtl.sc-calcite-accordion-item .expand-icon.sc-calcite-accordion-item{transform:rotate(var(--calcite-accordion-item-active-icon-rotation-rtl))}/*!@:host .header-text*/.sc-calcite-accordion-item-h .header-text.sc-calcite-accordion-item{margin-block:0px;flex-grow:1;flex-direction:column;padding-block:0px;text-align:initial;margin-inline-end:auto}/*!@:host .heading, \n:host .description*/.sc-calcite-accordion-item-h .heading.sc-calcite-accordion-item,.sc-calcite-accordion-item-h .description.sc-calcite-accordion-item{display:flex;inline-size:100%}/*!@:host .heading*/.sc-calcite-accordion-item-h .heading.sc-calcite-accordion-item{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}/*!@:host .description*/.sc-calcite-accordion-item-h .description.sc-calcite-accordion-item{margin-block-start:0.25rem;color:var(--calcite-ui-text-3)}/*!@:host(:focus) .heading, \n:host(:hover) .heading*/.sc-calcite-accordion-item-h:focus .heading.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .heading.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .icon, \n:host(:hover) .icon*/.sc-calcite-accordion-item-h:focus .icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .expand-icon, \n:host(:hover) .expand-icon*/.sc-calcite-accordion-item-h:focus .expand-icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .description, \n:host(:hover) .description*/.sc-calcite-accordion-item-h:focus .description.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:hover .description.sc-calcite-accordion-item{color:var(--calcite-ui-text-2)}/*!@:host(:focus) .heading, \n:host(:active) .heading, \n:host([expanded]) .heading*/.sc-calcite-accordion-item-h:focus .heading.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .heading.sc-calcite-accordion-item,[expanded].sc-calcite-accordion-item-h .heading.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .icon, \n:host(:active) .icon, \n:host([expanded]) .icon*/.sc-calcite-accordion-item-h:focus .icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .icon.sc-calcite-accordion-item,[expanded].sc-calcite-accordion-item-h .icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .expand-icon, \n:host(:active) .expand-icon, \n:host([expanded]) .expand-icon*/.sc-calcite-accordion-item-h:focus .expand-icon.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .expand-icon.sc-calcite-accordion-item,[expanded].sc-calcite-accordion-item-h .expand-icon.sc-calcite-accordion-item{color:var(--calcite-ui-text-1)}/*!@:host(:focus) .description, \n:host(:active) .description, \n:host([expanded]) .description*/.sc-calcite-accordion-item-h:focus .description.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:active .description.sc-calcite-accordion-item,[expanded].sc-calcite-accordion-item-h .description.sc-calcite-accordion-item{color:var(--calcite-ui-text-2)}/*!@.header-content*/.header-content.sc-calcite-accordion-item{flex-grow:1;cursor:pointer;padding:var(--calcite-accordion-item-padding);flex-direction:var(--calcite-accordion-item-flex-direction)}/*!@.actions-start, \n.actions-end*/.actions-start.sc-calcite-accordion-item,.actions-end.sc-calcite-accordion-item{display:flex;align-items:center}@media (forced-colors: active){/*!@:host([expanded]) .header*/[expanded].sc-calcite-accordion-item-h .header.sc-calcite-accordion-item{border-block-end:none}/*!@:host([expanded]) .heading*/[expanded].sc-calcite-accordion-item-h .heading.sc-calcite-accordion-item{font-weight:bolder}/*!@:host(:hover) .heading,\n:host(:focus) .heading*/.sc-calcite-accordion-item-h:hover .heading.sc-calcite-accordion-item,.sc-calcite-accordion-item-h:focus .heading.sc-calcite-accordion-item{text-decoration:underline}}";
- /**
- * @slot - A slot for adding custom content, including nested `calcite-accordion-item`s.
- */
- class AccordionItem {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalAccordionItemKeyEvent = createEvent(this, "calciteInternalAccordionItemKeyEvent", 6);
- this.calciteInternalAccordionItemSelect = createEvent(this, "calciteInternalAccordionItemSelect", 6);
- this.calciteInternalAccordionItemClose = createEvent(this, "calciteInternalAccordionItemClose", 6);
- this.calciteInternalAccordionItemRegister = createEvent(this, "calciteInternalAccordionItemRegister", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, the component is active.
- *
- * @deprecated use `expanded` instead.
- */
- this.active = false;
- /** When `true`, the component is expanded. */
- this.expanded = false;
- /** what icon position does the parent accordion specify */
- this.iconPosition = "end";
- /** handle clicks on item header */
- this.itemHeaderClickHandler = () => this.emitRequestedItem();
- }
- activeHandler(value) {
- this.expanded = value;
- }
- expandedHandler(value) {
- this.active = value;
- }
- iconHandler(value) {
- this.iconStart = value;
- }
- iconStartHandler(value) {
- this.icon = value;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- this.parent = this.el.parentElement;
- this.selectionMode = getElementProp(this.el, "selection-mode", "multi");
- this.iconType = getElementProp(this.el, "icon-type", "chevron");
- this.iconPosition = getElementProp(this.el, "icon-position", this.iconPosition);
- const isExpanded = this.active || this.expanded;
- if (isExpanded) {
- this.activeHandler(isExpanded);
- this.expandedHandler(isExpanded);
- }
- if (this.iconStart) {
- this.icon = this.iconStart;
- }
- else if (this.icon) {
- this.iconStart = this.icon;
- }
- connectConditionalSlotComponent(this);
- }
- componentDidLoad() {
- this.itemPosition = this.getItemPosition();
- this.calciteInternalAccordionItemRegister.emit({
- parent: this.parent,
- position: this.itemPosition
- });
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderActionsStart() {
- const { el } = this;
- return getSlotted(el, SLOTS$u.actionsStart) ? (hAsync("div", { class: CSS$U.actionsStart }, hAsync("slot", { name: SLOTS$u.actionsStart }))) : null;
- }
- renderActionsEnd() {
- const { el } = this;
- return getSlotted(el, SLOTS$u.actionsEnd) ? (hAsync("div", { class: CSS$U.actionsEnd }, hAsync("slot", { name: SLOTS$u.actionsEnd }))) : null;
- }
- render() {
- const dir = getElementDir(this.el);
- const iconStartEl = this.iconStart ? (hAsync("calcite-icon", { class: CSS$U.iconStart, icon: this.iconStart, key: "icon-start", scale: "s" })) : null;
- const iconEndEl = this.iconEnd ? (hAsync("calcite-icon", { class: CSS$U.iconEnd, icon: this.iconEnd, key: "icon-end", scale: "s" })) : null;
- const description = this.description || this.itemSubtitle;
- return (hAsync(Host, null, hAsync("div", { class: {
- [`icon-position--${this.iconPosition}`]: true,
- [`icon-type--${this.iconType}`]: true
- } }, hAsync("div", { class: { [CSS$U.header]: true, [CSS_UTILITY.rtl]: dir === "rtl" } }, this.renderActionsStart(), hAsync("div", { "aria-expanded": toAriaBoolean(this.active || this.expanded), class: CSS$U.headerContent, onClick: this.itemHeaderClickHandler, role: "button", tabindex: "0" }, hAsync("div", { class: CSS$U.headerContainer }, iconStartEl, hAsync("div", { class: CSS$U.headerText }, hAsync("span", { class: CSS$U.heading }, this.heading || this.itemTitle), description ? hAsync("span", { class: CSS$U.description }, description) : null), iconEndEl), hAsync("calcite-icon", { class: CSS$U.expandIcon, icon: this.iconType === "chevron"
- ? "chevronDown"
- : this.iconType === "caret"
- ? "caretDown"
- : this.expanded || this.active
- ? "minus"
- : "plus", scale: "s" })), this.renderActionsEnd()), hAsync("div", { class: CSS$U.content }, hAsync("slot", null)))));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- keyDownHandler(event) {
- if (event.target === this.el) {
- switch (event.key) {
- case " ":
- case "Enter":
- this.emitRequestedItem();
- event.preventDefault();
- break;
- case "ArrowUp":
- case "ArrowDown":
- case "Home":
- case "End":
- this.calciteInternalAccordionItemKeyEvent.emit({
- parent: this.parent,
- item: event
- });
- event.preventDefault();
- break;
- }
- }
- }
- updateActiveItemOnChange(event) {
- this.requestedAccordionItem = event.detail
- .requestedAccordionItem;
- if (this.el.parentNode !== this.requestedAccordionItem.parentNode) {
- return;
- }
- this.determineActiveItem();
- event.stopPropagation();
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- determineActiveItem() {
- switch (this.selectionMode) {
- case "multi":
- if (this.el === this.requestedAccordionItem) {
- this.expanded = !this.expanded;
- }
- break;
- case "single":
- this.expanded = this.el === this.requestedAccordionItem ? !this.expanded : false;
- break;
- case "single-persist":
- this.expanded = this.el === this.requestedAccordionItem;
- break;
- }
- }
- emitRequestedItem() {
- this.calciteInternalAccordionItemSelect.emit({
- requestedAccordionItem: this.el
- });
- }
- getItemPosition() {
- return Array.prototype.indexOf.call(this.parent.querySelectorAll("calcite-accordion-item"), this.el);
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "expanded": ["expandedHandler"],
- "icon": ["iconHandler"],
- "iconStart": ["iconStartHandler"]
- }; }
- static get style() { return accordionItemCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-accordion-item",
- "$members$": {
- "active": [1540],
- "expanded": [1540],
- "itemTitle": [1, "item-title"],
- "itemSubtitle": [1, "item-subtitle"],
- "heading": [1],
- "description": [1],
- "icon": [1537],
- "iconStart": [513, "icon-start"],
- "iconEnd": [513, "icon-end"]
- },
- "$listeners$": [[0, "keydown", "keyDownHandler"], [16, "calciteInternalAccordionChange", "updateActiveItemOnChange"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["expanded", "expanded"], ["icon", "icon"], ["iconStart", "icon-start"], ["iconEnd", "icon-end"]]
- }; }
- }
- const CSS$T = {
- button: "button",
- buttonTextVisible: "button--text-visible",
- buttonCompact: "button--compact",
- iconContainer: "icon-container",
- slotContainer: "slot-container",
- slotContainerHidden: "slot-container--hidden",
- textContainer: "text-container",
- textContainerVisible: "text-container--visible"
- };
- const TEXT$u = {
- loading: "Loading"
- };
- const SLOTS$t = {
- tooltip: "tooltip"
- };
- function noopClick() {
- /** noop */
- }
- /**
- * This helper updates the host element to prevent keyboard interaction on its subtree and sets the appropriate aria attribute for accessibility.
- *
- * This should be used in the `componentDidRender` lifecycle hook.
- *
- * **Notes**
- *
- * 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.
- * technically, users can override `tabindex` and restore keyboard navigation, but this will be considered user error
- *
- * @param component
- * @param hostIsTabbable
- */
- function updateHostInteraction(component, hostIsTabbable = false) {
- if (component.disabled) {
- component.el.setAttribute("tabindex", "-1");
- component.el.setAttribute("aria-disabled", "true");
- if (component.el.contains(document.activeElement)) {
- document.activeElement.blur();
- }
- component.el.click = noopClick;
- return;
- }
- component.el.click = HTMLElement.prototype.click;
- if (typeof hostIsTabbable === "function") {
- component.el.setAttribute("tabindex", hostIsTabbable.call(component) ? "0" : "-1");
- }
- else if (hostIsTabbable === true) {
- component.el.setAttribute("tabindex", "0");
- }
- else if (hostIsTabbable === false) {
- component.el.removeAttribute("tabindex");
- }
- else ;
- component.el.removeAttribute("aria-disabled");
- }
- const actionCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-action:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-action-h{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{box-sizing:border-box}/*!@:root*/.sc-calcite-action:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-action-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-action-h{display:flex;background-color:transparent;--calcite-action-indicator-color:var(--calcite-ui-brand)}/*!@: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:flex;inline-size:auto;cursor:pointer;align-items:center;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-color:transparent;text-align:unset;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:flex;align-items:center;justify-content:center;min-inline-size:1rem;min-block-size:1rem}/*!@.button .text-container*/.button.sc-calcite-action .text-container.sc-calcite-action{margin:0px;inline-size:0px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.5rem;opacity:0;transition-property:opacity;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-property:margin;transition-property:inline-size}/*!@.button .text-container--visible*/.button.sc-calcite-action .text-container--visible.sc-calcite-action{inline-size:auto;flex:1 1 auto;opacity:1}/*!@:host([scale=s]) .button*/[scale=s].sc-calcite-action-h .button.sc-calcite-action{padding-inline:0.5rem;padding-block:0.25rem;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{margin-inline-end:0.5rem}/*!@:host([scale=m]) .button*/[scale=m].sc-calcite-action-h .button.sc-calcite-action{padding-inline:1rem;padding-block:0.75rem;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{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{margin-inline-end:1rem}/*!@:host([alignment=center]) .button*/[alignment=center].sc-calcite-action-h .button.sc-calcite-action{justify-content:center}/*!@:host([alignment=end]) .button*/[alignment=end].sc-calcite-action-h .button.sc-calcite-action{justify-content:flex-end}/*!@:host([alignment=center]) .button .text-container--visible, \n: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{flex:0 1 auto}/*!@:host([scale=s][compact]) .button, \n:host([scale=m][compact]) .button, \n: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-inline:0px}/*!@.slot-container*/.slot-container.sc-calcite-action{display:flex}/*!@.slot-container--hidden*/.slot-container--hidden.sc-calcite-action{display:none}/*!@.button--text-visible*/.button--text-visible.sc-calcite-action{inline-size:100%}/*!@:host([active]) .button, \n:host([active]) .button:hover, \n:host([active]) .button:focus, \n: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, \n:host([appearance=transparent]) .button*/[appearance=clear].sc-calcite-action-h .button.sc-calcite-action,[appearance=transparent].sc-calcite-action-h .button.sc-calcite-action{background-color:transparent;transition-property:box-shadow;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host([appearance=clear]) .button:hover, \n:host([appearance=clear]) .button:focus, \n:host([appearance=transparent]) .button:hover, \n:host([appearance=transparent]) .button:focus*/[appearance=clear].sc-calcite-action-h .button.sc-calcite-action:hover,[appearance=clear].sc-calcite-action-h .button.sc-calcite-action:focus,[appearance=transparent].sc-calcite-action-h .button.sc-calcite-action:hover,[appearance=transparent].sc-calcite-action-h .button.sc-calcite-action:focus{background-color:transparent;box-shadow:0 0 0 2px var(--calcite-ui-border-1) inset}/*!@:host([active][appearance=clear]) .button, \n:host([active][appearance=clear]) .button:hover, \n:host([active][appearance=clear]) .button:focus, \n:host([active][appearance=transparent]) .button, \n:host([active][appearance=transparent]) .button:hover, \n:host([active][appearance=transparent]) .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,[active][appearance=transparent].sc-calcite-action-h .button.sc-calcite-action,[active][appearance=transparent].sc-calcite-action-h .button.sc-calcite-action:hover,[active][appearance=transparent].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, \n:host([appearance=clear][disabled]) .button, \n:host([appearance=transparent][loading]) .button, \n:host([appearance=transparent][disabled]) .button*/[appearance=clear][loading].sc-calcite-action-h .button.sc-calcite-action,[appearance=clear][disabled].sc-calcite-action-h .button.sc-calcite-action,[appearance=transparent][loading].sc-calcite-action-h .button.sc-calcite-action,[appearance=transparent][disabled].sc-calcite-action-h .button.sc-calcite-action{background-color:transparent}/*!@:host([loading]) .button, \n:host([loading]) .button:hover, \n: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, \n:host([loading]) .button:hover .text-container, \n: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{color:var(--calcite-ui-text-3);margin-inline-end:0px}/*!@:host([disabled]) .button, \n:host([disabled]) .button:hover, \n: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, \n:host([disabled][active]) .button:hover, \n: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;block-size:0.5rem;inline-size:0.5rem;border-radius:9999px;border-width:2px;background-color:var(--calcite-action-indicator-color);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{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)}";
- /**
- * @slot - A slot for adding a `calcite-icon`.
- */
- class Action {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteActionClick = createEvent(this, "calciteActionClick", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, the component is highlighted.
- */
- this.active = false;
- /** Specifies the appearance of the component. */
- this.appearance = "solid";
- /**
- * When `true`, the side padding of the component is reduced. Compact mode is used internally by components, e.g. `calcite-block-section`.
- */
- this.compact = false;
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * When `true`, indicates unread changes.
- */
- this.indicator = false;
- /**
- * Specifies the text label to display while loading.
- *
- * @default "Loading"
- */
- this.intlLoading = TEXT$u.loading;
- /**
- * When `true`, a busy indicator is displayed.
- */
- this.loading = false;
- /**
- * Specifies the size of the component.
- */
- this.scale = "m";
- /**
- * Indicates whether the text is displayed.
- */
- this.textEnabled = false;
- this.mutationObserver = createObserver();
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.handleTooltipSlotChange = (event) => {
- const tooltips = event.target
- .assignedElements({
- flatten: true
- })
- .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-tooltip"));
- const tooltip = tooltips[0];
- if (tooltip) {
- tooltip.referenceElement = this.buttonEl;
- }
- };
- this.calciteActionClickHandler = () => {
- if (!this.disabled) {
- this.calciteActionClick.emit();
- }
- };
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- }
- disconnectedCallback() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Methods
- //
- // --------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.buttonEl) === null || _a === void 0 ? void 0 : _a.focus();
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderTextContainer() {
- const { text, textEnabled } = this;
- const textContainerClasses = {
- [CSS$T.textContainer]: true,
- [CSS$T.textContainerVisible]: textEnabled
- };
- return text ? (hAsync("div", { class: textContainerClasses, key: "text-container" }, text)) : null;
- }
- renderIconContainer() {
- var _a;
- const { loading, icon, scale, el, intlLoading } = this;
- const iconScale = scale === "l" ? "m" : "s";
- const loaderScale = scale === "l" ? "l" : "m";
- const calciteLoaderNode = loading ? (hAsync("calcite-loader", { active: true, inline: true, label: intlLoading, scale: loaderScale })) : null;
- const calciteIconNode = icon ? hAsync("calcite-icon", { icon: icon, scale: iconScale }) : null;
- const iconNode = calciteLoaderNode || calciteIconNode;
- const hasIconToDisplay = iconNode || ((_a = el.children) === null || _a === void 0 ? void 0 : _a.length);
- const slotContainerNode = (hAsync("div", { class: {
- [CSS$T.slotContainer]: true,
- [CSS$T.slotContainerHidden]: loading
- } }, hAsync("slot", null)));
- return hasIconToDisplay ? (hAsync("div", { "aria-hidden": "true", class: CSS$T.iconContainer, key: "icon-container" }, iconNode, slotContainerNode)) : null;
- }
- render() {
- const { compact, disabled, loading, textEnabled, label, text } = this;
- const ariaLabel = label || text;
- const buttonClasses = {
- [CSS$T.button]: true,
- [CSS$T.buttonTextVisible]: textEnabled,
- [CSS$T.buttonCompact]: compact
- };
- 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()), hAsync("slot", { name: SLOTS$t.tooltip, onSlotchange: this.handleTooltipSlotChange })));
- }
- get el() { return getElement(this); }
- static get style() { return actionCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-action",
- "$members$": {
- "active": [516],
- "alignment": [513],
- "appearance": [513],
- "compact": [516],
- "disabled": [516],
- "icon": [1],
- "indicator": [516],
- "intlLoading": [1, "intl-loading"],
- "label": [1],
- "loading": [516],
- "scale": [513],
- "text": [1],
- "textEnabled": [516, "text-enabled"],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["alignment", "alignment"], ["appearance", "appearance"], ["compact", "compact"], ["disabled", "disabled"], ["indicator", "indicator"], ["loading", "loading"], ["scale", "scale"], ["textEnabled", "text-enabled"]]
- }; }
- }
- const CSS$S = {
- menu: "menu",
- defaultTrigger: "default-trigger"
- };
- const SLOTS$s = {
- tooltip: "tooltip",
- trigger: "trigger"
- };
- const ICONS$g = {
- menu: "ellipsis"
- };
- const SLOTS$r = {
- menuActions: "menu-actions",
- menuTooltip: "menu-tooltip"
- };
- const TEXT$t = {
- more: "More"
- };
- const ICONS$f = {
- menu: "ellipsis"
- };
- const overflowActionsDebounceInMs = 150;
- const groupBufferPx = 2;
- const getAverage = (arr) => arr.reduce((p, c) => p + c, 0) / arr.length;
- const geActionDimensions = (actions) => {
- const actionLen = actions === null || actions === void 0 ? void 0 : actions.length;
- return {
- actionWidth: actionLen ? getAverage(actions.map((action) => action.clientWidth || 0)) : 0,
- actionHeight: actionLen ? getAverage(actions.map((action) => action.clientHeight || 0)) : 0
- };
- };
- const getMaxActionCount = ({ width, actionWidth, layout, height, actionHeight, groupCount }) => {
- const maxContainerPx = layout === "horizontal" ? width : height;
- const avgItemPx = layout === "horizontal" ? actionWidth : actionHeight;
- return Math.floor((maxContainerPx - groupCount * groupBufferPx) / avgItemPx);
- };
- const getOverflowCount = ({ layout, actionCount, actionWidth, width, actionHeight, height, groupCount }) => {
- return Math.max(actionCount - getMaxActionCount({ width, actionWidth, layout, height, actionHeight, groupCount }), 0);
- };
- const queryActions = (el) => {
- return Array.from(el.querySelectorAll("calcite-action")).filter((action) => action.closest("calcite-action-menu") ? action.slot === SLOTS$s.trigger : true);
- };
- const overflowActions = ({ actionGroups, expanded, overflowCount }) => {
- let needToSlotCount = overflowCount;
- actionGroups.reverse().forEach((group) => {
- let slottedWithinGroupCount = 0;
- const groupActions = queryActions(group).reverse();
- groupActions.forEach((groupAction) => {
- if (groupAction.slot === SLOTS$r.menuActions) {
- groupAction.removeAttribute("slot");
- groupAction.textEnabled = expanded;
- }
- });
- if (needToSlotCount > 0) {
- groupActions.some((groupAction) => {
- const unslottedActions = groupActions.filter((action) => !action.slot);
- if (unslottedActions.length > 1 && groupActions.length > 2 && !groupAction.closest("calcite-action-menu")) {
- groupAction.textEnabled = true;
- groupAction.setAttribute("slot", SLOTS$r.menuActions);
- slottedWithinGroupCount++;
- if (slottedWithinGroupCount > 1) {
- needToSlotCount--;
- }
- }
- return needToSlotCount < 1;
- });
- }
- forceUpdate$1(group);
- });
- };
- const ICONS$e = {
- chevronsLeft: "chevrons-left",
- chevronsRight: "chevrons-right"
- };
- function getCalcitePosition(position, el) {
- var _a;
- return position || ((_a = el.closest("calcite-shell-panel")) === null || _a === void 0 ? void 0 : _a.position) || "start";
- }
- function toggleChildActionText({ parent, expanded }) {
- queryActions(parent)
- .filter((el) => el.slot !== SLOTS$r.menuActions)
- .forEach((action) => (action.textEnabled = expanded));
- parent
- .querySelectorAll("calcite-action-group, calcite-action-menu")
- .forEach((el) => (el.expanded = expanded));
- }
- const setTooltipReference = ({ tooltip, referenceElement, expanded, ref }) => {
- if (tooltip) {
- tooltip.referenceElement = !expanded && referenceElement ? referenceElement : null;
- }
- if (ref) {
- ref(referenceElement);
- }
- return referenceElement;
- };
- const ExpandToggle = ({ expanded, intlExpand, intlCollapse, toggle, el, position, tooltip, ref, scale }) => {
- const rtl = getElementDir(el) === "rtl";
- const expandText = expanded ? intlCollapse : intlExpand;
- const icons = [ICONS$e.chevronsLeft, ICONS$e.chevronsRight];
- if (rtl) {
- icons.reverse();
- }
- const end = getCalcitePosition(position, el) === "end";
- const expandIcon = end ? icons[1] : icons[0];
- const collapseIcon = end ? icons[0] : icons[1];
- const actionNode = (hAsync("calcite-action", { icon: expanded ? expandIcon : collapseIcon, onClick: toggle, ref: (referenceElement) => setTooltipReference({ tooltip, referenceElement, expanded, ref }), scale: scale, text: expandText, textEnabled: expanded }));
- return actionNode;
- };
- const CSS$R = {
- actionGroupBottom: "action-group--bottom"
- };
- const SLOTS$q = {
- bottomActions: "bottom-actions",
- expandTooltip: "expand-tooltip"
- };
- const TEXT$s = {
- expand: "Expand",
- collapse: "Collapse"
- };
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
- /** Detect free variable `self`. */
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root = freeGlobal || freeSelf || Function('return this')();
- /** Built-in value references. */
- var Symbol$1 = root.Symbol;
- /** Used for built-in method references. */
- var objectProto$5 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var nativeObjectToString$1 = objectProto$5.toString;
- /** Built-in value references. */
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
- /**
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the raw `toStringTag`.
- */
- function getRawTag(value) {
- var isOwn = hasOwnProperty$3.call(value, symToStringTag$1),
- tag = value[symToStringTag$1];
- try {
- value[symToStringTag$1] = undefined;
- var unmasked = true;
- } catch (e) {}
- var result = nativeObjectToString$1.call(value);
- if (unmasked) {
- if (isOwn) {
- value[symToStringTag$1] = tag;
- } else {
- delete value[symToStringTag$1];
- }
- }
- return result;
- }
- /** Used for built-in method references. */
- var objectProto$4 = Object.prototype;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var nativeObjectToString = objectProto$4.toString;
- /**
- * Converts `value` to a string using `Object.prototype.toString`.
- *
- * @private
- * @param {*} value The value to convert.
- * @returns {string} Returns the converted string.
- */
- function objectToString(value) {
- return nativeObjectToString.call(value);
- }
- /** `Object#toString` result references. */
- var nullTag = '[object Null]',
- undefinedTag = '[object Undefined]';
- /** Built-in value references. */
- var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
- /**
- * The base implementation of `getTag` without fallbacks for buggy environments.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- function baseGetTag(value) {
- if (value == null) {
- return value === undefined ? undefinedTag : nullTag;
- }
- return (symToStringTag && symToStringTag in Object(value))
- ? getRawTag(value)
- : objectToString(value);
- }
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike(value) {
- return value != null && typeof value == 'object';
- }
- /** `Object#toString` result references. */
- var symbolTag = '[object Symbol]';
- /**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */
- function isSymbol(value) {
- return typeof value == 'symbol' ||
- (isObjectLike(value) && baseGetTag(value) == symbolTag);
- }
- /**
- * A specialized version of `_.map` for arrays without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- */
- function arrayMap(array, iteratee) {
- var index = -1,
- length = array == null ? 0 : array.length,
- result = Array(length);
- while (++index < length) {
- result[index] = iteratee(array[index], index, array);
- }
- return result;
- }
- /**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */
- var isArray = Array.isArray;
- /** Used as references for various `Number` constants. */
- var INFINITY = 1 / 0;
- /** Used to convert symbols to primitives and strings. */
- var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
- symbolToString = symbolProto ? symbolProto.toString : undefined;
- /**
- * The base implementation of `_.toString` which doesn't convert nullish
- * values to empty strings.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- */
- function baseToString(value) {
- // Exit early for strings to avoid a performance hit in some environments.
- if (typeof value == 'string') {
- return value;
- }
- if (isArray(value)) {
- // Recursively convert values (susceptible to call stack limits).
- return arrayMap(value, baseToString) + '';
- }
- if (isSymbol(value)) {
- return symbolToString ? symbolToString.call(value) : '';
- }
- var result = (value + '');
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
- }
- /** Used to match a single whitespace character. */
- var reWhitespace = /\s/;
- /**
- * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
- * character of `string`.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {number} Returns the index of the last non-whitespace character.
- */
- function trimmedEndIndex(string) {
- var index = string.length;
- while (index-- && reWhitespace.test(string.charAt(index))) {}
- return index;
- }
- /** Used to match leading whitespace. */
- var reTrimStart = /^\s+/;
- /**
- * The base implementation of `_.trim`.
- *
- * @private
- * @param {string} string The string to trim.
- * @returns {string} Returns the trimmed string.
- */
- function baseTrim(string) {
- return string
- ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
- : string;
- }
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject(value) {
- var type = typeof value;
- return value != null && (type == 'object' || type == 'function');
- }
- /** Used as references for various `Number` constants. */
- var NAN = 0 / 0;
- /** Used to detect bad signed hexadecimal string values. */
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
- /** Used to detect binary string values. */
- var reIsBinary = /^0b[01]+$/i;
- /** Used to detect octal string values. */
- var reIsOctal = /^0o[0-7]+$/i;
- /** Built-in method references without a dependency on `root`. */
- var freeParseInt = parseInt;
- /**
- * Converts `value` to a number.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
- * @example
- *
- * _.toNumber(3.2);
- * // => 3.2
- *
- * _.toNumber(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toNumber(Infinity);
- * // => Infinity
- *
- * _.toNumber('3.2');
- * // => 3.2
- */
- function toNumber(value) {
- if (typeof value == 'number') {
- return value;
- }
- if (isSymbol(value)) {
- return NAN;
- }
- if (isObject(value)) {
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
- value = isObject(other) ? (other + '') : other;
- }
- if (typeof value != 'string') {
- return value === 0 ? value : +value;
- }
- value = baseTrim(value);
- var isBinary = reIsBinary.test(value);
- return (isBinary || reIsOctal.test(value))
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
- : (reIsBadHex.test(value) ? NAN : +value);
- }
- /**
- * This method returns the first argument it receives.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'a': 1 };
- *
- * console.log(_.identity(object) === object);
- * // => true
- */
- function identity(value) {
- return value;
- }
- /** `Object#toString` result references. */
- var asyncTag = '[object AsyncFunction]',
- funcTag$1 = '[object Function]',
- genTag = '[object GeneratorFunction]',
- proxyTag = '[object Proxy]';
- /**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
- function isFunction(value) {
- if (!isObject(value)) {
- return false;
- }
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
- var tag = baseGetTag(value);
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
- }
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
- /** Used to detect unsigned integer values. */
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- /**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex(value, length) {
- var type = typeof value;
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
- return !!length &&
- (type == 'number' ||
- (type != 'symbol' && reIsUint.test(value))) &&
- (value > -1 && value % 1 == 0 && value < length);
- }
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER = 9007199254740991;
- /**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
- function isLength(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
- /**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
- function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
- }
- /** Used for built-in method references. */
- var objectProto$3 = Object.prototype;
- /**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */
- function isPrototype(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
- return value === proto;
- }
- /**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
- function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- /** `Object#toString` result references. */
- var argsTag$1 = '[object Arguments]';
- /**
- * The base implementation of `_.isArguments`.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- */
- function baseIsArguments(value) {
- return isObjectLike(value) && baseGetTag(value) == argsTag$1;
- }
- /** Used for built-in method references. */
- var objectProto$2 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
- /** Built-in value references. */
- var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
- /**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
- return isObjectLike(value) && hasOwnProperty$2.call(value, 'callee') &&
- !propertyIsEnumerable.call(value, 'callee');
- };
- /**
- * This method returns `false`.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {boolean} Returns `false`.
- * @example
- *
- * _.times(2, _.stubFalse);
- * // => [false, false]
- */
- function stubFalse() {
- return false;
- }
- /** Detect free variable `exports`. */
- var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
- /** Detect free variable `module`. */
- var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
- /** Detect the popular CommonJS extension `module.exports`. */
- var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
- /** Built-in value references. */
- var Buffer = moduleExports$1 ? root.Buffer : undefined;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
- /**
- * Checks if `value` is a buffer.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
- * @example
- *
- * _.isBuffer(new Buffer(2));
- * // => true
- *
- * _.isBuffer(new Uint8Array(2));
- * // => false
- */
- var isBuffer = nativeIsBuffer || stubFalse;
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]',
- arrayTag = '[object Array]',
- boolTag = '[object Boolean]',
- dateTag = '[object Date]',
- errorTag = '[object Error]',
- funcTag = '[object Function]',
- mapTag = '[object Map]',
- numberTag = '[object Number]',
- objectTag = '[object Object]',
- regexpTag = '[object RegExp]',
- setTag = '[object Set]',
- stringTag = '[object String]',
- weakMapTag = '[object WeakMap]';
- var arrayBufferTag = '[object ArrayBuffer]',
- dataViewTag = '[object DataView]',
- float32Tag = '[object Float32Array]',
- float64Tag = '[object Float64Array]',
- int8Tag = '[object Int8Array]',
- int16Tag = '[object Int16Array]',
- int32Tag = '[object Int32Array]',
- uint8Tag = '[object Uint8Array]',
- uint8ClampedTag = '[object Uint8ClampedArray]',
- uint16Tag = '[object Uint16Array]',
- uint32Tag = '[object Uint32Array]';
- /** Used to identify `toStringTag` values of typed arrays. */
- var typedArrayTags = {};
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
- typedArrayTags[uint32Tag] = true;
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
- typedArrayTags[mapTag] = typedArrayTags[numberTag] =
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
- typedArrayTags[setTag] = typedArrayTags[stringTag] =
- typedArrayTags[weakMapTag] = false;
- /**
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- */
- function baseIsTypedArray(value) {
- return isObjectLike(value) &&
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
- }
- /**
- * The base implementation of `_.unary` without support for storing metadata.
- *
- * @private
- * @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new capped function.
- */
- function baseUnary(func) {
- return function(value) {
- return func(value);
- };
- }
- /** Detect free variable `exports`. */
- var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
- /** Detect free variable `module`. */
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
- /** Detect the popular CommonJS extension `module.exports`. */
- var moduleExports = freeModule && freeModule.exports === freeExports;
- /** Detect free variable `process` from Node.js. */
- var freeProcess = moduleExports && freeGlobal.process;
- /** Used to access faster Node.js helpers. */
- var nodeUtil = (function() {
- try {
- // Use `util.types` for Node.js 10+.
- var types = freeModule && freeModule.require && freeModule.require('util').types;
- if (types) {
- return types;
- }
- // Legacy `process.binding('util')` for Node.js < 10.
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
- } catch (e) {}
- }());
- /* Node.js helper references. */
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
- /**
- * Checks if `value` is classified as a typed array.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- * @example
- *
- * _.isTypedArray(new Uint8Array);
- * // => true
- *
- * _.isTypedArray([]);
- * // => false
- */
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
- /** Used for built-in method references. */
- var objectProto$1 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
- /**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */
- function arrayLikeKeys(value, inherited) {
- var isArr = isArray(value),
- isArg = !isArr && isArguments(value),
- isBuff = !isArr && !isArg && isBuffer(value),
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
- skipIndexes = isArr || isArg || isBuff || isType,
- result = skipIndexes ? baseTimes(value.length, String) : [],
- length = result.length;
- for (var key in value) {
- if ((inherited || hasOwnProperty$1.call(value, key)) &&
- !(skipIndexes && (
- // Safari 9 has enumerable `arguments.length` in strict mode.
- key == 'length' ||
- // Node.js 0.10 has enumerable non-index properties on buffers.
- (isBuff && (key == 'offset' || key == 'parent')) ||
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
- // Skip index properties.
- isIndex(key, length)
- ))) {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * This function is like
- * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * except that it includes inherited enumerable properties.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function nativeKeysIn(object) {
- var result = [];
- if (object != null) {
- for (var key in Object(object)) {
- result.push(key);
- }
- }
- return result;
- }
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /**
- * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function baseKeysIn(object) {
- if (!isObject(object)) {
- return nativeKeysIn(object);
- }
- var isProto = isPrototype(object),
- result = [];
- for (var key in object) {
- if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * Creates an array of the own and inherited enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keysIn(new Foo);
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
- */
- function keysIn(object) {
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
- }
- /**
- * Converts `value` to a string. An empty string is returned for `null`
- * and `undefined` values. The sign of `-0` is preserved.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {string} Returns the converted string.
- * @example
- *
- * _.toString(null);
- * // => ''
- *
- * _.toString(-0);
- * // => '-0'
- *
- * _.toString([1, 2, 3]);
- * // => '1,2,3'
- */
- function toString(value) {
- return value == null ? '' : baseToString(value);
- }
- /**
- * Creates a base function for methods like `_.forIn` and `_.forOwn`.
- *
- * @private
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */
- function createBaseFor(fromRight) {
- return function(object, iteratee, keysFunc) {
- var index = -1,
- iterable = Object(object),
- props = keysFunc(object),
- length = props.length;
- while (length--) {
- var key = props[fromRight ? length : ++index];
- if (iteratee(iterable[key], key, iterable) === false) {
- break;
- }
- }
- return object;
- };
- }
- /**
- * The base implementation of `baseForOwn` which iterates over `object`
- * properties returned by `keysFunc` and invokes `iteratee` for each property.
- * Iteratee functions may exit iteration early by explicitly returning `false`.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @returns {Object} Returns `object`.
- */
- var baseFor = createBaseFor();
- /**
- * Gets the timestamp of the number of milliseconds that have elapsed since
- * the Unix epoch (1 January 1970 00:00:00 UTC).
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Date
- * @returns {number} Returns the timestamp.
- * @example
- *
- * _.defer(function(stamp) {
- * console.log(_.now() - stamp);
- * }, _.now());
- * // => Logs the number of milliseconds it took for the deferred invocation.
- */
- var now = function() {
- return root.Date.now();
- };
- /** Error message constants. */
- var FUNC_ERROR_TEXT$1 = 'Expected a function';
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeMax = Math.max,
- nativeMin = Math.min;
- /**
- * Creates a debounced function that delays invoking `func` until after `wait`
- * milliseconds have elapsed since the last time the debounced function was
- * invoked. The debounced function comes with a `cancel` method to cancel
- * delayed `func` invocations and a `flush` method to immediately invoke them.
- * Provide `options` to indicate whether `func` should be invoked on the
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
- * with the last arguments provided to the debounced function. Subsequent
- * calls to the debounced function return the result of the last `func`
- * invocation.
- *
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
- * invoked on the trailing edge of the timeout only if the debounced function
- * is invoked more than once during the `wait` timeout.
- *
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
- *
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
- * for details over the differences between `_.debounce` and `_.throttle`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to debounce.
- * @param {number} [wait=0] The number of milliseconds to delay.
- * @param {Object} [options={}] The options object.
- * @param {boolean} [options.leading=false]
- * Specify invoking on the leading edge of the timeout.
- * @param {number} [options.maxWait]
- * The maximum time `func` is allowed to be delayed before it's invoked.
- * @param {boolean} [options.trailing=true]
- * Specify invoking on the trailing edge of the timeout.
- * @returns {Function} Returns the new debounced function.
- * @example
- *
- * // Avoid costly calculations while the window size is in flux.
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
- *
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
- * 'leading': true,
- * 'trailing': false
- * }));
- *
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
- * var source = new EventSource('/stream');
- * jQuery(source).on('message', debounced);
- *
- * // Cancel the trailing debounced invocation.
- * jQuery(window).on('popstate', debounced.cancel);
- */
- function debounce(func, wait, options) {
- var lastArgs,
- lastThis,
- maxWait,
- result,
- timerId,
- lastCallTime,
- lastInvokeTime = 0,
- leading = false,
- maxing = false,
- trailing = true;
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT$1);
- }
- wait = toNumber(wait) || 0;
- if (isObject(options)) {
- leading = !!options.leading;
- maxing = 'maxWait' in options;
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
- trailing = 'trailing' in options ? !!options.trailing : trailing;
- }
- function invokeFunc(time) {
- var args = lastArgs,
- thisArg = lastThis;
- lastArgs = lastThis = undefined;
- lastInvokeTime = time;
- result = func.apply(thisArg, args);
- return result;
- }
- function leadingEdge(time) {
- // Reset any `maxWait` timer.
- lastInvokeTime = time;
- // Start the timer for the trailing edge.
- timerId = setTimeout(timerExpired, wait);
- // Invoke the leading edge.
- return leading ? invokeFunc(time) : result;
- }
- function remainingWait(time) {
- var timeSinceLastCall = time - lastCallTime,
- timeSinceLastInvoke = time - lastInvokeTime,
- timeWaiting = wait - timeSinceLastCall;
- return maxing
- ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
- : timeWaiting;
- }
- function shouldInvoke(time) {
- var timeSinceLastCall = time - lastCallTime,
- timeSinceLastInvoke = time - lastInvokeTime;
- // Either this is the first call, activity has stopped and we're at the
- // trailing edge, the system time has gone backwards and we're treating
- // it as the trailing edge, or we've hit the `maxWait` limit.
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
- }
- function timerExpired() {
- var time = now();
- if (shouldInvoke(time)) {
- return trailingEdge(time);
- }
- // Restart the timer.
- timerId = setTimeout(timerExpired, remainingWait(time));
- }
- function trailingEdge(time) {
- timerId = undefined;
- // Only invoke if we have `lastArgs` which means `func` has been
- // debounced at least once.
- if (trailing && lastArgs) {
- return invokeFunc(time);
- }
- lastArgs = lastThis = undefined;
- return result;
- }
- function cancel() {
- if (timerId !== undefined) {
- clearTimeout(timerId);
- }
- lastInvokeTime = 0;
- lastArgs = lastCallTime = lastThis = timerId = undefined;
- }
- function flush() {
- return timerId === undefined ? result : trailingEdge(now());
- }
- function debounced() {
- var time = now(),
- isInvoking = shouldInvoke(time);
- lastArgs = arguments;
- lastThis = this;
- lastCallTime = time;
- if (isInvoking) {
- if (timerId === undefined) {
- return leadingEdge(lastCallTime);
- }
- if (maxing) {
- // Handle invocations in a tight loop.
- clearTimeout(timerId);
- timerId = setTimeout(timerExpired, wait);
- return invokeFunc(lastCallTime);
- }
- }
- if (timerId === undefined) {
- timerId = setTimeout(timerExpired, wait);
- }
- return result;
- }
- debounced.cancel = cancel;
- debounced.flush = flush;
- return debounced;
- }
- /**
- * Casts `value` to `identity` if it's not a function.
- *
- * @private
- * @param {*} value The value to inspect.
- * @returns {Function} Returns cast function.
- */
- function castFunction(value) {
- return typeof value == 'function' ? value : identity;
- }
- /**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
- reHasRegExpChar = RegExp(reRegExpChar.source);
- /**
- * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
- * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to escape.
- * @returns {string} Returns the escaped string.
- * @example
- *
- * _.escapeRegExp('[lodash](https://lodash.com/)');
- * // => '\[lodash\]\(https://lodash\.com/\)'
- */
- function escapeRegExp(string) {
- string = toString(string);
- return (string && reHasRegExpChar.test(string))
- ? string.replace(reRegExpChar, '\\$&')
- : string;
- }
- /**
- * Iterates over own and inherited enumerable string keyed properties of an
- * object and invokes `iteratee` for each property. The iteratee is invoked
- * with three arguments: (value, key, object). Iteratee functions may exit
- * iteration early by explicitly returning `false`.
- *
- * @static
- * @memberOf _
- * @since 0.3.0
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Object} Returns `object`.
- * @see _.forInRight
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.forIn(new Foo, function(value, key) {
- * console.log(key);
- * });
- * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
- */
- function forIn(object, iteratee) {
- return object == null
- ? object
- : baseFor(object, castFunction(iteratee), keysIn);
- }
- /** Error message constants. */
- var FUNC_ERROR_TEXT = 'Expected a function';
- /**
- * Creates a throttled function that only invokes `func` at most once per
- * every `wait` milliseconds. The throttled function comes with a `cancel`
- * method to cancel delayed `func` invocations and a `flush` method to
- * immediately invoke them. Provide `options` to indicate whether `func`
- * should be invoked on the leading and/or trailing edge of the `wait`
- * timeout. The `func` is invoked with the last arguments provided to the
- * throttled function. Subsequent calls to the throttled function return the
- * result of the last `func` invocation.
- *
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
- * invoked on the trailing edge of the timeout only if the throttled function
- * is invoked more than once during the `wait` timeout.
- *
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
- *
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
- * for details over the differences between `_.throttle` and `_.debounce`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to throttle.
- * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
- * @param {Object} [options={}] The options object.
- * @param {boolean} [options.leading=true]
- * Specify invoking on the leading edge of the timeout.
- * @param {boolean} [options.trailing=true]
- * Specify invoking on the trailing edge of the timeout.
- * @returns {Function} Returns the new throttled function.
- * @example
- *
- * // Avoid excessively updating the position while scrolling.
- * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
- *
- * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
- * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
- * jQuery(element).on('click', throttled);
- *
- * // Cancel the trailing throttled invocation.
- * jQuery(window).on('popstate', throttled.cancel);
- */
- function throttle$1(func, wait, options) {
- var leading = true,
- trailing = true;
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- if (isObject(options)) {
- leading = 'leading' in options ? !!options.leading : leading;
- trailing = 'trailing' in options ? !!options.trailing : trailing;
- }
- return debounce(func, wait, {
- 'leading': leading,
- 'maxWait': wait,
- 'trailing': trailing
- });
- }
- const actionBarCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-bar{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-bar{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-bar{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-bar{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-action-bar:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-action-bar-h{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{box-sizing:border-box}/*!@:root*/.sc-calcite-action-bar:root{--calcite-floating-ui-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:inline-flex;align-self:stretch;background:transparent;--calcite-action-bar-expanded-max-width:auto}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-action-bar-h{flex-direction:column}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-action-bar-h{flex-direction:row}/*!@:host([layout=vertical][overflow-actions-disabled])*/[layout=vertical][overflow-actions-disabled].sc-calcite-action-bar-h{overflow-y:auto}/*!@:host([layout=horizontal][overflow-actions-disabled])*/[layout=horizontal][overflow-actions-disabled].sc-calcite-action-bar-h{overflow-x:auto}/*!@:host([layout=vertical][expanded])*/[layout=vertical][expanded].sc-calcite-action-bar-h{max-inline-size:var(--calcite-action-bar-expanded-max-width)}/*!@::slotted(calcite-action-group)*/.sc-calcite-action-bar-s>calcite-action-group{border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}/*!@:host([layout=horizontal]) ::slotted(calcite-action-group)*/.sc-calcite-action-bar-h[layout=horizontal] .sc-calcite-action-bar-s>calcite-action-group{border-width:0px;border-inline-end-width:1px;border-style:solid}/*!@::slotted(calcite-action-group:last-child)*/.sc-calcite-action-bar-s>calcite-action-group:last-child{border-block-end-width:0px;border-inline-end-width:0px}/*!@.action-group--bottom*/.action-group--bottom.sc-calcite-action-bar{flex-grow:1;justify-content:flex-end;padding-block-end:0px;padding-inline-end:0px}";
- /**
- * @slot - A slot for adding `calcite-action`s that will appear at the top of the action bar.
- * @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.
- * @slot expand-tooltip - Used to set the tooltip for the expand toggle.
- */
- class ActionBar {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteActionBarToggle = createEvent(this, "calciteActionBarToggle", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, the expand-toggling behavior is disabled.
- */
- this.expandDisabled = false;
- /**
- * When `true`, the component is expanded.
- */
- this.expanded = false;
- /**
- * The layout direction of the actions.
- */
- this.layout = "vertical";
- /**
- * Disables automatically overflowing `calcite-action`s that won't fit into menus.
- */
- this.overflowActionsDisabled = false;
- this.mutationObserver = createObserver();
- this.resizeObserver = createObserver();
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.actionMenuOpenChangeHandler = (event) => {
- if (event.detail) {
- const composedPath = event.composedPath();
- Array.from(this.el.querySelectorAll("calcite-action-group")).forEach((group) => {
- if (!composedPath.includes(group)) {
- group.menuOpen = false;
- }
- });
- }
- };
- this.resizeHandlerEntries = (entries) => {
- entries.forEach(this.resizeHandler);
- };
- this.resizeHandler = (entry) => {
- const { width, height } = entry.contentRect;
- this.resize({ width, height });
- };
- this.resize = debounce(({ width, height }) => {
- const { el, expanded, expandDisabled, layout } = this;
- if ((layout === "vertical" && !height) || (layout === "horizontal" && !width)) {
- return;
- }
- const actions = queryActions(el);
- const actionCount = expandDisabled ? actions.length : actions.length + 1;
- const actionGroups = Array.from(el.querySelectorAll("calcite-action-group"));
- const groupCount = getSlotted(el, SLOTS$q.bottomActions) || !expandDisabled
- ? actionGroups.length + 1
- : actionGroups.length;
- const { actionHeight, actionWidth } = geActionDimensions(actions);
- const overflowCount = getOverflowCount({
- layout,
- actionCount,
- actionHeight,
- actionWidth,
- height,
- width,
- groupCount
- });
- overflowActions({
- actionGroups,
- expanded,
- overflowCount
- });
- }, overflowActionsDebounceInMs);
- this.conditionallyOverflowActions = () => {
- if (!this.overflowActionsDisabled) {
- this.overflowActions();
- }
- };
- this.toggleExpand = () => {
- this.expanded = !this.expanded;
- this.calciteActionBarToggle.emit();
- };
- this.setExpandToggleRef = (el) => {
- this.expandToggleEl = el;
- };
- }
- expandHandler() {
- this.conditionallyOverflowActions();
- }
- expandedHandler(expanded) {
- toggleChildActionText({ parent: this.el, expanded });
- this.conditionallyOverflowActions();
- }
- overflowDisabledHandler(overflowActionsDisabled) {
- overflowActionsDisabled
- ? this.resizeObserver.disconnect()
- : this.resizeObserver.observe(this.el);
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- componentDidLoad() {
- this.conditionallyOverflowActions();
- }
- connectedCallback() {
- var _a, _b;
- const { el, expanded } = this;
- toggleChildActionText({ parent: el, expanded });
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(el, { childList: true, subtree: true });
- if (!this.overflowActionsDisabled) {
- (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.observe(el);
- }
- this.conditionallyOverflowActions();
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- var _a, _b;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
- disconnectConditionalSlotComponent(this);
- }
- // --------------------------------------------------------------------------
- //
- // Methods
- //
- // --------------------------------------------------------------------------
- /**
- * Overflows actions that won't fit into menus.
- *
- * @internal
- */
- async overflowActions() {
- this.resize({ width: this.el.clientWidth, height: this.el.clientHeight });
- }
- /**
- * Sets focus on the component.
- *
- * @param focusId
- */
- async setFocus(focusId) {
- var _a;
- if (focusId === "expand-toggle") {
- await focusElement(this.expandToggleEl);
- return;
- }
- (_a = this.el) === null || _a === void 0 ? void 0 : _a.focus();
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderBottomActionGroup() {
- const { expanded, expandDisabled, intlExpand, intlCollapse, el, position, toggleExpand, scale, layout } = this;
- const tooltip = getSlotted(el, SLOTS$q.expandTooltip);
- const expandLabel = intlExpand || TEXT$s.expand;
- const collapseLabel = intlCollapse || TEXT$s.collapse;
- 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;
- return getSlotted(el, SLOTS$q.bottomActions) || expandToggleNode ? (hAsync("calcite-action-group", { class: CSS$R.actionGroupBottom, layout: layout, scale: scale }, hAsync("slot", { name: SLOTS$q.bottomActions }), hAsync("slot", { name: SLOTS$q.expandTooltip }), expandToggleNode)) : null;
- }
- render() {
- return (hAsync(Host, { onCalciteActionMenuOpenChange: this.actionMenuOpenChangeHandler }, hAsync("slot", null), this.renderBottomActionGroup()));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "expandDisabled": ["expandHandler"],
- "expanded": ["expandedHandler"],
- "overflowActionsDisabled": ["overflowDisabledHandler"]
- }; }
- static get style() { return actionBarCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-action-bar",
- "$members$": {
- "expandDisabled": [516, "expand-disabled"],
- "expanded": [1540],
- "intlExpand": [1, "intl-expand"],
- "intlCollapse": [1, "intl-collapse"],
- "layout": [513],
- "overflowActionsDisabled": [516, "overflow-actions-disabled"],
- "position": [513],
- "scale": [513],
- "overflowActions": [64],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["expandDisabled", "expand-disabled"], ["expanded", "expanded"], ["layout", "layout"], ["overflowActionsDisabled", "overflow-actions-disabled"], ["position", "position"], ["scale", "scale"]]
- }; }
- }
- const actionGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-action-group:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-action-group-h{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{box-sizing:border-box}/*!@:root*/.sc-calcite-action-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-group-h{display:none}/*!@:host*/.sc-calcite-action-group-h{display:flex;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-block-start:0px}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-action-group-h{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)}";
- /**
- * @slot - A slot for adding a group of `calcite-action`s.
- * @slot menu-actions - A slot for adding an overflow menu with `calcite-action`s inside a `calcite-dropdown`.
- * @slot menu-tooltip - A slot for adding a `calcite-tooltip` for the menu.
- */
- class ActionGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, the component is expanded.
- */
- this.expanded = false;
- /**
- * Indicates the layout of the component.
- */
- this.layout = "vertical";
- /**
- * When `true`, the `calcite-action-menu` is open.
- */
- this.menuOpen = false;
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.setMenuOpen = (event) => {
- this.menuOpen = !!event.detail;
- };
- }
- expandedHandler() {
- this.menuOpen = false;
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- // --------------------------------------------------------------------------
- //
- // Component Methods
- //
- // --------------------------------------------------------------------------
- renderTooltip() {
- const { el } = this;
- const hasTooltip = getSlotted(el, SLOTS$r.menuTooltip);
- return hasTooltip ? hAsync("slot", { name: SLOTS$r.menuTooltip, slot: SLOTS$s.tooltip }) : null;
- }
- renderMenu() {
- const { el, expanded, intlMore, menuOpen, scale, layout } = this;
- const hasMenuItems = getSlotted(el, SLOTS$r.menuActions);
- return hasMenuItems ? (hAsync("calcite-action-menu", { expanded: expanded, flipPlacements: ["left", "right"], label: intlMore || TEXT$t.more, onCalciteActionMenuOpenChange: this.setMenuOpen, open: menuOpen, placement: layout === "horizontal" ? "bottom-leading" : "leading-start", scale: scale }, hAsync("calcite-action", { icon: ICONS$f.menu, scale: scale, slot: SLOTS$s.trigger, text: intlMore || TEXT$t.more, textEnabled: expanded }), hAsync("slot", { name: SLOTS$r.menuActions }), this.renderTooltip())) : null;
- }
- render() {
- return (hAsync(Fragment, null, hAsync("slot", null), this.renderMenu()));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "expanded": ["expandedHandler"]
- }; }
- static get style() { return actionGroupCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-action-group",
- "$members$": {
- "expanded": [516],
- "layout": [513],
- "columns": [514],
- "intlMore": [1, "intl-more"],
- "menuOpen": [1540, "menu-open"],
- "scale": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["expanded", "expanded"], ["layout", "layout"], ["columns", "columns"], ["menuOpen", "menu-open"], ["scale", "scale"]]
- }; }
- }
- function getRoundRobinIndex(index, total) {
- return (index + total) % total;
- }
- function isActivationKey(key) {
- return key === "Enter" || key === " ";
- }
- const numberKeys = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
- const actionMenuCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-menu{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-menu{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-menu{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-menu{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-action-menu:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-action-menu:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-action-menu-h{display:none}/*!@:host*/.sc-calcite-action-menu-h{box-sizing:border-box;display:flex;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:flex;outline-color:transparent}/*!@.menu ::slotted(calcite-action[active])*/.menu .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;block-size:100%;flex:0 1 auto;align-self:stretch}/*!@slot[name=trigger]::slotted(calcite-action), \ncalcite-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;block-size:100%;flex:0 1 auto;align-self:stretch}/*!@.menu*/.menu.sc-calcite-action-menu{flex-direction:column;flex-wrap:nowrap;outline:2px solid transparent;outline-offset:2px}";
- const SUPPORTED_MENU_NAV_KEYS = ["ArrowUp", "ArrowDown", "End", "Home"];
- /**
- * @slot - A slot for adding `calcite-action`s.
- * @slot trigger - A slot for adding a `calcite-action` to trigger opening the menu.
- * @slot tooltip - A slot for adding an tooltip for the menu.
- */
- class ActionMenu {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteActionMenuOpenChange = createEvent(this, "calciteActionMenuOpenChange", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, the component is expanded.
- */
- this.expanded = false;
- /**
- * When `true`, the component is open.
- */
- this.open = false;
- /**
- * Determines the type of positioning to use for the overlaid content.
- *
- * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
- * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
- *
- */
- this.overlayPositioning = "absolute";
- /**
- * Determines where the component will be positioned relative to the `referenceElement`.
- *
- * @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
- */
- this.placement = "auto";
- this.actionElements = [];
- this.guid = `calcite-action-menu-${guid()}`;
- this.menuId = `${this.guid}-menu`;
- this.menuButtonId = `${this.guid}-menu-button`;
- this.activeMenuItemIndex = -1;
- // --------------------------------------------------------------------------
- //
- // Component Methods
- //
- // --------------------------------------------------------------------------
- this.connectMenuButtonEl = () => {
- const { menuButtonId, menuId, open, label } = this;
- const menuButtonEl = this.slottedMenuButtonEl || this.defaultMenuButtonEl;
- if (this.menuButtonEl === menuButtonEl) {
- return;
- }
- this.disconnectMenuButtonEl();
- this.menuButtonEl = menuButtonEl;
- this.setTooltipReferenceElement();
- if (!menuButtonEl) {
- return;
- }
- menuButtonEl.active = open;
- menuButtonEl.setAttribute("aria-controls", menuId);
- menuButtonEl.setAttribute("aria-expanded", toAriaBoolean(open));
- menuButtonEl.setAttribute("aria-haspopup", "true");
- if (!menuButtonEl.id) {
- menuButtonEl.id = menuButtonId;
- }
- if (!menuButtonEl.label) {
- menuButtonEl.label = label;
- }
- if (!menuButtonEl.text) {
- menuButtonEl.text = label;
- }
- menuButtonEl.addEventListener("pointerdown", this.menuButtonClick);
- menuButtonEl.addEventListener("keydown", this.menuButtonKeyDown);
- };
- this.disconnectMenuButtonEl = () => {
- const { menuButtonEl } = this;
- if (!menuButtonEl) {
- return;
- }
- menuButtonEl.removeEventListener("pointerdown", this.menuButtonClick);
- menuButtonEl.removeEventListener("keydown", this.menuButtonKeyDown);
- };
- this.setMenuButtonEl = (event) => {
- const actions = event.target
- .assignedElements({
- flatten: true
- })
- .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-action"));
- this.slottedMenuButtonEl = actions[0];
- this.connectMenuButtonEl();
- };
- this.setDefaultMenuButtonEl = (el) => {
- this.defaultMenuButtonEl = el;
- this.connectMenuButtonEl();
- };
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.handleCalciteActionClick = () => {
- this.open = false;
- this.setFocus();
- };
- this.menuButtonClick = (event) => {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- this.toggleOpen();
- };
- this.updateTooltip = (event) => {
- const tooltips = event.target
- .assignedElements({
- flatten: true
- })
- .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-tooltip"));
- this.tooltipEl = tooltips[0];
- this.setTooltipReferenceElement();
- };
- this.setTooltipReferenceElement = () => {
- const { tooltipEl, expanded, menuButtonEl, open } = this;
- if (tooltipEl) {
- tooltipEl.referenceElement = !expanded && !open ? menuButtonEl : null;
- }
- };
- this.updateAction = (action, index) => {
- const { guid, activeMenuItemIndex } = this;
- const id = `${guid}-action-${index}`;
- action.tabIndex = -1;
- action.setAttribute("role", "menuitem");
- if (!action.id) {
- action.id = id;
- }
- action.active = index === activeMenuItemIndex;
- };
- this.updateActions = (actions) => {
- actions === null || actions === void 0 ? void 0 : actions.forEach(this.updateAction);
- };
- this.handleDefaultSlotChange = (event) => {
- const actions = event.target
- .assignedElements({
- flatten: true
- })
- .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-action"));
- this.actionElements = actions;
- };
- this.menuButtonKeyDown = (event) => {
- const { key } = event;
- const { actionElements, activeMenuItemIndex, open } = this;
- if (!actionElements.length) {
- return;
- }
- if (isActivationKey(key)) {
- event.preventDefault();
- if (!open) {
- this.toggleOpen();
- return;
- }
- const action = actionElements[activeMenuItemIndex];
- action ? action.click() : this.toggleOpen(false);
- }
- if (key === "Tab") {
- this.open = false;
- return;
- }
- if (key === "Escape") {
- this.toggleOpen(false);
- event.preventDefault();
- return;
- }
- this.handleActionNavigation(event, key, actionElements);
- };
- this.handleActionNavigation = (event, key, actions) => {
- if (!this.isValidKey(key, SUPPORTED_MENU_NAV_KEYS)) {
- return;
- }
- event.preventDefault();
- if (!this.open) {
- this.toggleOpen();
- if (key === "Home" || key === "ArrowDown") {
- this.activeMenuItemIndex = 0;
- }
- if (key === "End" || key === "ArrowUp") {
- this.activeMenuItemIndex = actions.length - 1;
- }
- return;
- }
- if (key === "Home") {
- this.activeMenuItemIndex = 0;
- }
- if (key === "End") {
- this.activeMenuItemIndex = actions.length - 1;
- }
- const currentIndex = this.activeMenuItemIndex;
- if (key === "ArrowUp") {
- this.activeMenuItemIndex = getRoundRobinIndex(Math.max(currentIndex - 1, -1), actions.length);
- }
- if (key === "ArrowDown") {
- this.activeMenuItemIndex = getRoundRobinIndex(currentIndex + 1, actions.length);
- }
- };
- this.toggleOpenEnd = () => {
- this.setFocus();
- this.el.removeEventListener("calcitePopoverOpen", this.toggleOpenEnd);
- };
- this.toggleOpen = (value = !this.open) => {
- this.el.addEventListener("calcitePopoverOpen", this.toggleOpenEnd);
- this.open = value;
- };
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- disconnectedCallback() {
- this.disconnectMenuButtonEl();
- }
- expandedHandler() {
- this.open = false;
- this.setTooltipReferenceElement();
- }
- openHandler(open) {
- this.activeMenuItemIndex = this.open ? 0 : -1;
- if (this.menuButtonEl) {
- this.menuButtonEl.active = open;
- }
- this.calciteActionMenuOpenChange.emit(open);
- this.setTooltipReferenceElement();
- }
- closeCalciteActionMenuOnClick(event) {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- const composedPath = event.composedPath();
- if (composedPath.includes(this.el)) {
- return;
- }
- this.open = false;
- }
- activeMenuItemIndexHandler() {
- this.updateActions(this.actionElements);
- }
- // --------------------------------------------------------------------------
- //
- // Methods
- //
- // --------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- focusElement(this.menuButtonEl);
- }
- renderMenuButton() {
- const { label, scale, expanded } = this;
- const menuButtonSlot = (hAsync("slot", { name: SLOTS$s.trigger, onSlotchange: this.setMenuButtonEl }, hAsync("calcite-action", { class: CSS$S.defaultTrigger, icon: ICONS$g.menu, ref: this.setDefaultMenuButtonEl, scale: scale, text: label, textEnabled: expanded })));
- return menuButtonSlot;
- }
- renderMenuItems() {
- const { actionElements, activeMenuItemIndex, open, menuId, menuButtonEl, label, placement, overlayPositioning, flipPlacements } = this;
- const activeAction = actionElements[activeMenuItemIndex];
- const activeDescendantId = (activeAction === null || activeAction === void 0 ? void 0 : activeAction.id) || null;
- 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$S.menu, id: menuId, onClick: this.handleCalciteActionClick, role: "menu", tabIndex: -1 }, hAsync("slot", { onSlotchange: this.handleDefaultSlotChange }))));
- }
- render() {
- return (hAsync(Fragment, null, this.renderMenuButton(), this.renderMenuItems(), hAsync("slot", { name: SLOTS$s.tooltip, onSlotchange: this.updateTooltip })));
- }
- isValidKey(key, supportedKeys) {
- return !!supportedKeys.find((k) => k === key);
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "expanded": ["expandedHandler"],
- "open": ["openHandler"],
- "activeMenuItemIndex": ["activeMenuItemIndexHandler"]
- }; }
- static get style() { return actionMenuCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-action-menu",
- "$members$": {
- "expanded": [516],
- "flipPlacements": [16],
- "label": [1],
- "open": [1540],
- "overlayPositioning": [513, "overlay-positioning"],
- "placement": [513],
- "scale": [513],
- "menuButtonEl": [32],
- "activeMenuItemIndex": [32],
- "setFocus": [64]
- },
- "$listeners$": [[9, "pointerdown", "closeCalciteActionMenuOnClick"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["expanded", "expanded"], ["open", "open"], ["overlayPositioning", "overlay-positioning"], ["placement", "placement"], ["scale", "scale"]]
- }; }
- }
- const CSS$Q = {
- actionGroupBottom: "action-group--bottom",
- container: "container"
- };
- const TEXT$r = {
- expand: "Expand",
- collapse: "Collapse"
- };
- const SLOTS$p = {
- expandTooltip: "expand-tooltip"
- };
- const actionPadCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-action-pad{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-action-pad{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-action-pad{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-action-pad{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-action-pad:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-action-pad-h{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{box-sizing:border-box}/*!@:root*/.sc-calcite-action-pad:root{--calcite-floating-ui-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{animation:in var(--calcite-internal-animation-timing-slow) ease-in-out;border-radius:0.125rem;--calcite-action-pad-expanded-max-width:auto;background:transparent}/*!@:host([expanded][layout=vertical]) .container*/[expanded][layout=vertical].sc-calcite-action-pad-h .container.sc-calcite-action-pad{max-inline-size:var(--calcite-action-pad-expanded-max-width)}/*!@::slotted(calcite-action-group)*/.sc-calcite-action-pad-s>calcite-action-group{border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-block:0px}/*!@.container*/.container.sc-calcite-action-pad{display:inline-flex;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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@.action-group--bottom*/.action-group--bottom.sc-calcite-action-pad{flex-grow:1;justify-content:flex-end;padding-block-end:0px}/*!@:host([layout=horizontal]) .container*/[layout=horizontal].sc-calcite-action-pad-h .container.sc-calcite-action-pad{flex-direction:row}/*!@: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-block-end-width:0px}";
- /**
- * @slot - A slot for adding `calcite-action`s to the component.
- * @slot expand-tooltip - Used to set the `calcite-tooltip` for the expand toggle.
- */
- class ActionPad {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteActionPadToggle = createEvent(this, "calciteActionPadToggle", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, the expand-toggling behavior is disabled.
- */
- this.expandDisabled = false;
- /**
- * When `true`, the component is expanded.
- */
- this.expanded = false;
- /**
- * Indicates the layout of the component.
- */
- this.layout = "vertical";
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.actionMenuOpenChangeHandler = (event) => {
- if (event.detail) {
- const composedPath = event.composedPath();
- Array.from(this.el.querySelectorAll("calcite-action-group")).forEach((group) => {
- if (!composedPath.includes(group)) {
- group.menuOpen = false;
- }
- });
- }
- };
- this.toggleExpand = () => {
- this.expanded = !this.expanded;
- this.calciteActionPadToggle.emit();
- };
- this.setExpandToggleRef = (el) => {
- this.expandToggleEl = el;
- };
- }
- expandedHandler(expanded) {
- toggleChildActionText({ parent: this.el, expanded });
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- componentWillLoad() {
- const { el, expanded } = this;
- toggleChildActionText({ parent: el, expanded });
- }
- // --------------------------------------------------------------------------
- //
- // Methods
- //
- // --------------------------------------------------------------------------
- /**
- * Sets focus on the component.
- *
- * @param focusId
- */
- async setFocus(focusId) {
- var _a;
- if (focusId === "expand-toggle") {
- await focusElement(this.expandToggleEl);
- return;
- }
- (_a = this.el) === null || _a === void 0 ? void 0 : _a.focus();
- }
- // --------------------------------------------------------------------------
- //
- // Component Methods
- //
- // --------------------------------------------------------------------------
- renderBottomActionGroup() {
- const { expanded, expandDisabled, intlExpand, intlCollapse, el, position, toggleExpand, scale, layout } = this;
- const tooltip = getSlotted(el, SLOTS$p.expandTooltip);
- const expandLabel = intlExpand || TEXT$r.expand;
- const collapseLabel = intlCollapse || TEXT$r.collapse;
- 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;
- return expandToggleNode ? (hAsync("calcite-action-group", { class: CSS$Q.actionGroupBottom, layout: layout, scale: scale }, hAsync("slot", { name: SLOTS$p.expandTooltip }), expandToggleNode)) : null;
- }
- render() {
- return (hAsync(Host, { onCalciteActionMenuOpenChange: this.actionMenuOpenChangeHandler }, hAsync("div", { class: CSS$Q.container }, hAsync("slot", null), this.renderBottomActionGroup())));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "expanded": ["expandedHandler"]
- }; }
- static get style() { return actionPadCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-action-pad",
- "$members$": {
- "expandDisabled": [516, "expand-disabled"],
- "expanded": [1540],
- "layout": [513],
- "intlExpand": [1, "intl-expand"],
- "intlCollapse": [1, "intl-collapse"],
- "position": [513],
- "scale": [513],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["expandDisabled", "expand-disabled"], ["expanded", "expanded"], ["layout", "layout"], ["position", "position"], ["scale", "scale"]]
- }; }
- }
- const TEXT$q = {
- intlClose: "Close"
- };
- const DURATIONS = {
- slow: 14000,
- medium: 10000,
- fast: 6000
- };
- const SLOTS$o = {
- title: "title",
- message: "message",
- link: "link"
- };
- var StatusIcons;
- (function (StatusIcons) {
- StatusIcons["green"] = "checkCircle";
- StatusIcons["yellow"] = "exclamationMarkTriangle";
- StatusIcons["red"] = "exclamationMarkTriangle";
- StatusIcons["blue"] = "lightbulb";
- })(StatusIcons || (StatusIcons = {}));
- const componentToTransitionListeners = new WeakMap();
- function transitionStart(event) {
- if (event.propertyName === this.openTransitionProp && event.target === this.transitionEl) {
- this.open ? this.onBeforeOpen() : this.onBeforeClose();
- }
- }
- function transitionEnd(event) {
- if (event.propertyName === this.openTransitionProp && event.target === this.transitionEl) {
- this.open ? this.onOpen() : this.onClose();
- }
- }
- /**
- * Helper to keep track of transition listeners on setTransitionEl and connectedCallback on OpenCloseComponent components.
- *
- * @param component
- */
- function connectOpenCloseComponent(component) {
- disconnectOpenCloseComponent(component);
- if (component.transitionEl) {
- const boundOnTransitionStart = transitionStart.bind(component);
- const boundOnTransitionEnd = transitionEnd.bind(component);
- componentToTransitionListeners.set(component, [
- component.transitionEl,
- boundOnTransitionStart,
- boundOnTransitionEnd
- ]);
- component.transitionEl.addEventListener("transitionstart", boundOnTransitionStart);
- component.transitionEl.addEventListener("transitionend", boundOnTransitionEnd);
- }
- }
- /**
- * Helper to tear down transition listeners on disconnectedCallback on OpenCloseComponent components.
- *
- * @param component
- */
- function disconnectOpenCloseComponent(component) {
- if (!componentToTransitionListeners.has(component)) {
- return;
- }
- const [transitionEl, start, end] = componentToTransitionListeners.get(component);
- transitionEl.removeEventListener("transitionstart", start);
- transitionEl.removeEventListener("transitionend", end);
- componentToTransitionListeners.delete(component);
- }
- // adopted from https://stackoverflow.com/a/66939244
- class BigDecimal {
- constructor(input) {
- if (input instanceof BigDecimal) {
- return input;
- }
- const [integers, decimals] = String(input).split(".").concat("");
- this.value =
- BigInt(integers + decimals.padEnd(BigDecimal.DECIMALS, "0").slice(0, BigDecimal.DECIMALS)) +
- BigInt(BigDecimal.ROUNDED && decimals[BigDecimal.DECIMALS] >= "5");
- this.isNegative = input.charAt(0) === "-";
- }
- static _divRound(dividend, divisor) {
- return BigDecimal.fromBigInt(dividend / divisor + (BigDecimal.ROUNDED ? ((dividend * BigInt(2)) / divisor) % BigInt(2) : BigInt(0)));
- }
- static fromBigInt(bigint) {
- return Object.assign(Object.create(BigDecimal.prototype), { value: bigint });
- }
- toString() {
- const s = this.value
- .toString()
- .replace(new RegExp("-", "g"), "")
- .padStart(BigDecimal.DECIMALS + 1, "0");
- const i = s.slice(0, -BigDecimal.DECIMALS);
- const d = s.slice(-BigDecimal.DECIMALS).replace(/\.?0+$/, "");
- const value = i.concat(d.length ? "." + d : "");
- return `${this.isNegative ? "-" : ""}${value}`;
- }
- formatToParts(formatter) {
- const s = this.value
- .toString()
- .replace(new RegExp("-", "g"), "")
- .padStart(BigDecimal.DECIMALS + 1, "0");
- const i = s.slice(0, -BigDecimal.DECIMALS);
- const d = s.slice(-BigDecimal.DECIMALS).replace(/\.?0+$/, "");
- const parts = formatter.formatToParts(BigInt(i));
- this.isNegative && parts.unshift({ type: "minusSign", value: numberStringFormatter.minusSign });
- if (d.length) {
- parts.push({ type: "decimal", value: numberStringFormatter.decimal });
- d.split("").forEach((char) => parts.push({ type: "fraction", value: char }));
- }
- return parts;
- }
- format(formatter) {
- const s = this.value
- .toString()
- .replace(new RegExp("-", "g"), "")
- .padStart(BigDecimal.DECIMALS + 1, "0");
- const i = s.slice(0, -BigDecimal.DECIMALS);
- const d = s.slice(-BigDecimal.DECIMALS).replace(/\.?0+$/, "");
- const iFormatted = `${this.isNegative ? numberStringFormatter.minusSign : ""}${formatter.format(BigInt(i))}`;
- const dFormatted = d.length ? `${numberStringFormatter.decimal}${formatter.format(BigInt(d))}` : "";
- return `${iFormatted}${dFormatted}`;
- }
- add(num) {
- return BigDecimal.fromBigInt(this.value + new BigDecimal(num).value);
- }
- subtract(num) {
- return BigDecimal.fromBigInt(this.value - new BigDecimal(num).value);
- }
- multiply(num) {
- return BigDecimal._divRound(this.value * new BigDecimal(num).value, BigDecimal.SHIFT);
- }
- divide(num) {
- return BigDecimal._divRound(this.value * BigDecimal.SHIFT, new BigDecimal(num).value);
- }
- }
- // Configuration: constants
- BigDecimal.DECIMALS = 100; // number of decimals on all instances
- BigDecimal.ROUNDED = true; // numbers are truncated (false) or rounded (true)
- BigDecimal.SHIFT = BigInt("1" + "0".repeat(BigDecimal.DECIMALS)); // derived constant
- function isValidNumber(numberString) {
- return !(!numberString || isNaN(Number(numberString)));
- }
- function parseNumberString(numberString) {
- if (!numberString || !stringContainsNumbers(numberString)) {
- return "";
- }
- return sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
- let containsDecimal = false;
- const result = nonExpoNumString
- .split("")
- .filter((value, i) => {
- if (value.match(/\./g) && !containsDecimal) {
- containsDecimal = true;
- return true;
- }
- if (value.match(/\-/g) && i === 0) {
- return true;
- }
- return numberKeys.includes(value);
- })
- .reduce((string, part) => string + part);
- return isValidNumber(result) ? new BigDecimal(result).toString() : "";
- });
- }
- // regex for number sanitization
- const allLeadingZerosOptionallyNegative = /^([-0])0+(?=\d)/;
- const decimalOnlyAtEndOfString = /(?!^\.)\.$/;
- const allHyphensExceptTheStart = /(?!^-)-/g;
- const isNegativeDecimalOnlyZeros = /^-\b0\b\.?0*$/;
- const sanitizeNumberString = (numberString) => sanitizeExponentialNumberString(numberString, (nonExpoNumString) => {
- const sanitizedValue = nonExpoNumString
- .replace(allHyphensExceptTheStart, "")
- .replace(decimalOnlyAtEndOfString, "")
- .replace(allLeadingZerosOptionallyNegative, "$1");
- return isValidNumber(sanitizedValue)
- ? isNegativeDecimalOnlyZeros.test(sanitizedValue)
- ? sanitizedValue
- : new BigDecimal(sanitizedValue).toString()
- : nonExpoNumString;
- });
- function sanitizeExponentialNumberString(numberString, func) {
- if (!numberString) {
- return numberString;
- }
- const firstE = numberString.toLowerCase().indexOf("e") + 1;
- if (!firstE) {
- return func(numberString);
- }
- return numberString
- .replace(/[eE]*$/g, "")
- .substring(0, firstE)
- .concat(numberString.slice(firstE).replace(/[eE]/g, ""))
- .split(/[eE]/)
- .map((section, i) => (i === 1 ? func(section.replace(/\./g, "")) : func(section)))
- .join("e")
- .replace(/^e/, "1e");
- }
- function stringContainsNumbers(string) {
- return numberKeys.some((number) => string.includes(number));
- }
- const defaultLocale = "en";
- const locales = [
- "ar",
- "bg",
- "bs",
- "ca",
- "cs",
- "da",
- "de",
- "de-CH",
- "el",
- defaultLocale,
- "en-AU",
- "en-CA",
- "en-GB",
- "es",
- "es-MX",
- "et",
- "fi",
- "fr",
- "fr-CH",
- "he",
- "hi",
- "hr",
- "hu",
- "id",
- "it",
- "it-CH",
- "ja",
- "ko",
- "lt",
- "lv",
- "mk",
- "nb",
- "nl",
- "pl",
- "pt",
- "pt-PT",
- "ro",
- "ru",
- "sk",
- "sl",
- "sr",
- "sv",
- "th",
- "tr",
- "uk",
- "vi",
- "zh-CN",
- "zh-HK",
- "zh-TW"
- ];
- const numberingSystems = [
- "arab",
- "arabext",
- "bali",
- "beng",
- "deva",
- "fullwide",
- "gujr",
- "guru",
- "hanidec",
- "khmr",
- "knda",
- "laoo",
- "latn",
- "limb",
- "mlym",
- "mong",
- "mymr",
- "orya",
- "tamldec",
- "telu",
- "thai",
- "tibt"
- ];
- const isNumberingSystemSupported = (numberingSystem) => numberingSystems.includes(numberingSystem);
- const browserNumberingSystem = new Intl.NumberFormat().resolvedOptions().numberingSystem;
- const defaultNumberingSystem = browserNumberingSystem === "arab" || !isNumberingSystemSupported(browserNumberingSystem)
- ? "latn"
- : browserNumberingSystem;
- const getSupportedNumberingSystem = (numberingSystem) => isNumberingSystemSupported(numberingSystem) ? numberingSystem : defaultNumberingSystem;
- function getSupportedLocale(locale) {
- if (locales.indexOf(locale) > -1) {
- return locale;
- }
- if (!locale) {
- return defaultLocale;
- }
- locale = locale.toLowerCase();
- // we support both 'nb' and 'no' (BCP 47) for Norwegian
- if (locale === "nb") {
- return "no";
- }
- if (locale.includes("-")) {
- locale = locale.replace(/(\w+)-(\w+)/, (_match, language, region) => `${language}-${region.toUpperCase()}`);
- if (!locales.includes(locale)) {
- locale = locale.split("-")[0];
- }
- }
- return locales.includes(locale) ? locale : defaultLocale;
- }
- const connectedComponents = new Set();
- /**
- * This utility sets up internals for messages support.
- *
- * It needs to be called in `connectedCallback` before any logic that depends on locale
- *
- * @param component
- */
- function connectLocalized(component) {
- updateEffectiveLocale(component);
- if (connectedComponents.size === 0) {
- mutationObserver.observe(document.documentElement, {
- attributes: true,
- attributeFilter: ["lang"],
- subtree: true
- });
- }
- connectedComponents.add(component);
- }
- /**
- * This is only exported for components that implemented the now deprecated `locale` prop.
- *
- * Do not use this utils for new components.
- *
- * @param component
- */
- function updateEffectiveLocale(component) {
- component.effectiveLocale = getLocale(component);
- }
- /**
- * This utility tears down internals for messages support.
- *
- * It needs to be called in `disconnectedCallback`
- *
- * @param component
- */
- function disconnectLocalized(component) {
- connectedComponents.delete(component);
- if (connectedComponents.size === 0) {
- mutationObserver.disconnect();
- }
- }
- const mutationObserver = createObserver();
- /**
- * This util helps resolve a component's locale.
- * It will also fall back on the deprecated `locale` if a component implemented this previously.
- *
- * @param component
- */
- function getLocale(component) {
- var _a;
- return (component.el.lang ||
- component.locale ||
- ((_a = closestElementCrossShadowBoundary(component.el, "[lang]")) === null || _a === void 0 ? void 0 : _a.lang) ||
- document.documentElement.lang ||
- defaultLocale);
- }
- /**
- * This util formats and parses numbers for localization
- */
- class NumberStringFormat {
- constructor() {
- this.delocalize = (numberString) =>
- // For performance, (de)localization is skipped if the formatter isn't initialized.
- // In order to localize/delocalize, e.g. when lang/numberingSystem props are not default values,
- // `numberFormatOptions` must be set in a component to create and cache the formatter.
- this._numberFormatOptions
- ? sanitizeExponentialNumberString(numberString, (nonExpoNumString) => nonExpoNumString
- .trim()
- .replace(new RegExp(`[${this._minusSign}]`, "g"), "-")
- .replace(new RegExp(`[${this._group}]`, "g"), "")
- .replace(new RegExp(`[${this._decimal}]`, "g"), ".")
- .replace(new RegExp(`[${this._digits.join("")}]`, "g"), this._getDigitIndex))
- : numberString;
- this.localize = (numberString) => this._numberFormatOptions
- ? sanitizeExponentialNumberString(numberString, (nonExpoNumString) => isValidNumber(nonExpoNumString.trim())
- ? new BigDecimal(nonExpoNumString.trim())
- .format(this._numberFormatter)
- .replace(new RegExp(`[${this._actualGroup}]`, "g"), this._group)
- : nonExpoNumString)
- : numberString;
- }
- get group() {
- return this._group;
- }
- get decimal() {
- return this._decimal;
- }
- get minusSign() {
- return this._minusSign;
- }
- get digits() {
- return this._digits;
- }
- get numberFormatter() {
- return this._numberFormatter;
- }
- get numberFormatOptions() {
- return this._numberFormatOptions;
- }
- /**
- * numberFormatOptions needs to be set before localize/delocalize is called to ensure the options are up to date
- */
- set numberFormatOptions(options) {
- options.locale = getSupportedLocale(options === null || options === void 0 ? void 0 : options.locale);
- options.numberingSystem = getSupportedNumberingSystem(options === null || options === void 0 ? void 0 : options.numberingSystem);
- if (
- // No need to create the formatter if `locale` and `numberingSystem`
- // are the default values and `numberFormatOptions` has not been set
- (!this._numberFormatOptions &&
- options.locale === defaultLocale &&
- options.numberingSystem === defaultNumberingSystem &&
- // don't skip initialization if any options besides locale/numberingSystem are set
- Object.keys(options).length === 2) ||
- // cache formatter by only recreating when options change
- JSON.stringify(this._numberFormatOptions) === JSON.stringify(options)) {
- return;
- }
- this._numberFormatOptions = options;
- this._numberFormatter = new Intl.NumberFormat(this._numberFormatOptions.locale, this._numberFormatOptions);
- this._digits = [
- ...new Intl.NumberFormat(this._numberFormatOptions.locale, {
- useGrouping: false,
- numberingSystem: this._numberFormatOptions.numberingSystem
- }).format(9876543210)
- ].reverse();
- const index = new Map(this._digits.map((d, i) => [d, i]));
- const parts = new Intl.NumberFormat(this._numberFormatOptions.locale).formatToParts(-12345678.9);
- this._actualGroup = parts.find((d) => d.type === "group").value;
- // change whitespace group characters that don't render correctly
- this._group = this._actualGroup.trim().length === 0 ? " " : this._actualGroup;
- this._decimal = parts.find((d) => d.type === "decimal").value;
- this._minusSign = parts.find((d) => d.type === "minusSign").value;
- this._getDigitIndex = (d) => index.get(d);
- }
- }
- const numberStringFormatter = new NumberStringFormat();
- const alertCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-alert{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-alert{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-alert{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-alert{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-alert:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-alert:root{--calcite-floating-ui-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(*), \n: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(*), \n: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(*), \n: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-inline: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(*), \n: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(*), \n: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(*), \n: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-inline: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(*), \n: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-block-end:0.25rem;font-size:var(--calcite-font-size-1);line-height:1.375}/*!@:host([scale=l]) slot[name=message]::slotted(*), \n: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(*), \n: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-inline: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;z-index:500;margin-block:0px;margin-inline:auto;display:flex;align-items: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);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-block-start:0px solid transparent;border-inline:1px solid var(--calcite-ui-border-3);border-block-end:1px solid var(--calcite-ui-border-3);min-block-size:var(--calcite-alert-min-height);inline-size:var(--calcite-alert-width);max-inline-size:calc(100% - (var(--calcite-alert-edge-distance) * 2 + 2px));max-block-size:0;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{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{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}/*!@:host([calcite-hydrated-hidden])*/[calcite-hydrated-hidden].sc-calcite-alert-h{visibility:hidden !important;pointer-events:none}/*!@.container*/.container.sc-calcite-alert{display:flex;inline-size:100%;align-items:center;justify-content:center}/*!@.alert-close*/.alert-close.sc-calcite-alert{outline-color:transparent}/*!@.alert-close:focus*/.alert-close.sc-calcite-alert:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([open]) .container:not(.queued)*/[open].sc-calcite-alert-h .container.sc-calcite-alert:not(.queued){max-block-size:100%;border-block-start-width:2px;opacity:1;pointer-events:initial}/*!@:host([open]) .container:not(.queued)[class*=bottom]*/[open].sc-calcite-alert-h .container.sc-calcite-alert:not(.queued)[class*=bottom]{transform:translate3d(0, calc(-1 * var(--calcite-alert-edge-distance)), inherit)}/*!@:host([open]) .container:not(.queued)[class*=top]*/[open].sc-calcite-alert-h .container.sc-calcite-alert:not(.queued)[class*=top]{transform:translate3d(0, var(--calcite-alert-edge-distance), inherit)}/*!@slot[name=title]::slotted(*), \n*::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(*), \n*::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);margin-inline-end:0.5rem}/*!@slot[name=link]::slotted(*), \n*::slotted([slot=link])*/slot[name=link].sc-calcite-alert-s>*,*.sc-calcite-alert-s>[slot=link]{display:inline-flex;color:var(--calcite-ui-text-link)}/*!@.alert-content*/.alert-content.sc-calcite-alert{transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-inline:var(--calcite-alert-spacing-token-large);flex:0 0 auto;overflow-wrap:break-word;background-color:var(--calcite-ui-foreground-1);flex:1 1 auto;min-inline-size:0;padding-block:var(--calcite-alert-spacing-token-small);padding-inline:0 var(--calcite-alert-spacing-token-small);border-end-start-radius:var(--calcite-border-radius);border-end-end-radius:var(--calcite-border-radius)}/*!@.alert-content:first-of-type:not(:only-child)*/.alert-content.sc-calcite-alert:first-of-type:not(:only-child){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{transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-alert-spacing-token-small);padding-inline:var(--calcite-alert-spacing-token-large);flex:0 0 auto;display:flex;align-items:center;align-self:stretch;background-color:var(--calcite-ui-foreground-1);padding-block:0px}/*!@.alert-close*/.alert-close.sc-calcite-alert{transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-alert-spacing-token-small);padding-inline:var(--calcite-alert-spacing-token-large);flex:0 0 auto;cursor:pointer;align-self:stretch;overflow:hidden;border-style:none;background-color:var(--calcite-ui-foreground-1);padding-block: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:open*/.alert-close.sc-calcite-alert:open{background-color:var(--calcite-ui-foreground-3)}/*!@.alert-queue-count*/.alert-queue-count.sc-calcite-alert{visibility:hidden;display:flex;cursor:default;align-items:center;justify-content:space-around;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;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-inline:0px solid transparent;border-start-end-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{border-inline-end:0px solid transparent}/*!@.alert-dismiss-progress*/.alert-dismiss-progress.sc-calcite-alert{position:absolute;display:block;inline-size:100%;overflow:hidden;inset-inline:0;inset-block-start:-2px;block-size:2px;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;inset-block-start:0px;display:block;block-size:2px;content:\"\";background-color:var(--calcite-alert-dismiss-progress-background);inset-inline-end:0}/*!@:host([color=blue]) .container*/[color=blue].sc-calcite-alert-h .container.sc-calcite-alert{border-block-start-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-block-start-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-block-start-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-block-start-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{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{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{animation:dismissProgress 14000ms ease-out}@keyframes dismissProgress{0%{inline-size:0px;opacity:0.75}100%{inline-size:100%;opacity:1}}";
- /**
- * 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
- * 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.
- */
- /**
- * @slot title - A slot for optionally adding a title to the component.
- * @slot message - A slot for adding main text to the component.
- * @slot link - A slot for optionally adding an action to take from the alert (undo, try again, link to page, etc.)
- */
- class Alert {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteAlertBeforeClose = createEvent(this, "calciteAlertBeforeClose", 6);
- this.calciteAlertClose = createEvent(this, "calciteAlertClose", 6);
- this.calciteAlertBeforeOpen = createEvent(this, "calciteAlertBeforeOpen", 6);
- this.calciteAlertOpen = createEvent(this, "calciteAlertOpen", 6);
- this.calciteInternalAlertSync = createEvent(this, "calciteInternalAlertSync", 6);
- this.calciteInternalAlertRegister = createEvent(this, "calciteInternalAlertRegister", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //---------------------------------------------------------------------------
- /**
- * When `true`, displays and positions the component.
- *
- * @deprecated use `open` instead.
- */
- this.active = false;
- /** When `true`, displays and positions the component. */
- this.open = false;
- /** When `true`, the component closes automatically (recommended for passive, non-blocking alerts). */
- this.autoDismiss = false;
- /** Specifies the duration before the component automatically closes (only use with `autoDismiss`). */
- this.autoDismissDuration = this.autoDismiss ? "medium" : null;
- /** Specifies the color for the component (will apply to top border and icon). */
- this.color = "blue";
- /**
- * Specifies the text label for the close button.
- *
- * @default "Close"
- */
- this.intlClose = TEXT$q.intlClose;
- /** Specifies the placement of the component */
- this.placement = "bottom";
- /** Specifies the size of the component. */
- this.scale = "m";
- //--------------------------------------------------------------------------
- //
- // Private State/Props
- //
- //--------------------------------------------------------------------------
- this.effectiveLocale = "";
- /** the list of queued alerts */
- this.queue = [];
- /** the count of queued alerts */
- this.queueLength = 0;
- /** is the alert queued */
- this.queued = false;
- this.autoDismissTimeoutId = null;
- this.trackTimer = Date.now();
- this.openTransitionProp = "opacity";
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.setTransitionEl = (el) => {
- this.transitionEl = el;
- connectOpenCloseComponent(this);
- };
- /** close and emit calciteInternalAlertSync event with the updated queue payload */
- this.closeAlert = () => {
- this.autoDismissTimeoutId = null;
- this.queued = false;
- this.open = false;
- this.queue = this.queue.filter((el) => el !== this.el);
- this.determineActiveAlert();
- this.calciteInternalAlertSync.emit({ queue: this.queue });
- };
- }
- activeHandler(value) {
- this.open = value;
- }
- openHandler(value) {
- if (this.open && !this.queued) {
- this.calciteInternalAlertRegister.emit();
- this.active = value;
- }
- if (!this.open) {
- this.queue = this.queue.filter((el) => el !== this.el);
- this.calciteInternalAlertSync.emit({ queue: this.queue });
- this.active = false;
- }
- }
- updateRequestedIcon() {
- this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
- }
- updateDuration() {
- if (this.autoDismiss && this.autoDismissTimeoutId) {
- window.clearTimeout(this.autoDismissTimeoutId);
- this.autoDismissTimeoutId = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration] - (Date.now() - this.trackTimer));
- }
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- connectLocalized(this);
- const open = this.open || this.active;
- if (open && !this.queued) {
- this.activeHandler(open);
- this.openHandler(open);
- this.calciteInternalAlertRegister.emit();
- }
- connectOpenCloseComponent(this);
- }
- componentWillLoad() {
- this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
- }
- disconnectedCallback() {
- window.clearTimeout(this.autoDismissTimeoutId);
- disconnectOpenCloseComponent(this);
- disconnectLocalized(this);
- }
- render() {
- 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" })));
- numberStringFormatter.numberFormatOptions = {
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- signDisplay: "always"
- };
- const queueNumber = this.queueLength > 2 ? this.queueLength - 1 : 1;
- const queueText = numberStringFormatter.numberFormatter.format(queueNumber);
- const queueCount = (hAsync("div", { class: `${this.queueLength > 1 ? "active " : ""}alert-queue-count` }, hAsync("calcite-chip", { scale: this.scale, value: queueText }, queueText)));
- const { active, autoDismiss, label, placement, queued, requestedIcon } = this;
- const role = autoDismiss ? "alert" : "alertdialog";
- const hidden = !active;
- return (hAsync(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "calcite-hydrated-hidden": hidden, role: role }, hAsync("div", { class: {
- container: true,
- queued,
- [placement]: true
- }, ref: this.setTransitionEl }, 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$o.title }), hAsync("slot", { name: SLOTS$o.message }), hAsync("slot", { name: SLOTS$o.link })), queueCount, !autoDismiss ? closeButton : null, active && !queued && autoDismiss ? hAsync("div", { class: "alert-dismiss-progress" }) : null)));
- }
- // when an alert is opened or closed, update queue and determine active alert
- alertSync(event) {
- if (this.queue !== event.detail.queue) {
- this.queue = event.detail.queue;
- }
- this.queueLength = this.queue.length;
- this.determineActiveAlert();
- event.stopPropagation();
- }
- // when an alert is first registered, trigger a queue sync
- alertRegister() {
- if (this.open && !this.queue.includes(this.el)) {
- this.queued = true;
- this.queue.push(this.el);
- }
- this.calciteInternalAlertSync.emit({ queue: this.queue });
- this.determineActiveAlert();
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- const alertLinkEl = getSlotted(this.el, { selector: "calcite-link" });
- if (!this.closeButton && !alertLinkEl) {
- return;
- }
- else if (alertLinkEl) {
- alertLinkEl.setFocus();
- }
- else if (this.closeButton) {
- this.closeButton.focus();
- }
- }
- /** determine which alert is active */
- determineActiveAlert() {
- var _a;
- if (((_a = this.queue) === null || _a === void 0 ? void 0 : _a[0]) === this.el) {
- this.openAlert();
- if (this.autoDismiss && !this.autoDismissTimeoutId) {
- this.trackTimer = Date.now();
- this.autoDismissTimeoutId = window.setTimeout(() => this.closeAlert(), DURATIONS[this.autoDismissDuration]);
- }
- }
- else {
- return;
- }
- }
- onBeforeOpen() {
- this.calciteAlertBeforeOpen.emit();
- }
- onOpen() {
- this.calciteAlertOpen.emit();
- }
- onBeforeClose() {
- this.calciteAlertBeforeClose.emit();
- }
- onClose() {
- this.calciteAlertClose.emit();
- }
- /** remove queued class after animation completes */
- openAlert() {
- window.clearTimeout(this.queueTimeout);
- this.queueTimeout = window.setTimeout(() => (this.queued = false), 300);
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "open": ["openHandler"],
- "icon": ["updateRequestedIcon"],
- "color": ["updateRequestedIcon"],
- "autoDismissDuration": ["updateDuration"]
- }; }
- static get style() { return alertCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-alert",
- "$members$": {
- "active": [1540],
- "open": [1540],
- "autoDismiss": [516, "auto-dismiss"],
- "autoDismissDuration": [513, "auto-dismiss-duration"],
- "color": [513],
- "icon": [520],
- "intlClose": [1, "intl-close"],
- "label": [1],
- "numberingSystem": [513, "numbering-system"],
- "placement": [513],
- "scale": [513],
- "effectiveLocale": [32],
- "queue": [32],
- "queueLength": [32],
- "queued": [32],
- "requestedIcon": [32],
- "setFocus": [64]
- },
- "$listeners$": [[8, "calciteInternalAlertSync", "alertSync"], [8, "calciteInternalAlertRegister", "alertRegister"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["open", "open"], ["autoDismiss", "auto-dismiss"], ["autoDismissDuration", "auto-dismiss-duration"], ["color", "color"], ["icon", "icon"], ["numberingSystem", "numbering-system"], ["placement", "placement"], ["scale", "scale"]]
- }; }
- }
- function rgbToHex(color) {
- const { r, g, b } = color;
- return `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b
- .toString(16)
- .padStart(2, "0")}`.toLowerCase();
- }
- const hexChar = /^[0-9A-F]$/i;
- const shortHandHex = /^#[0-9A-F]{3}$/i;
- const longhandHex = /^#[0-9A-F]{6}$/i;
- function isValidHex(hex) {
- return isShorthandHex(hex) || isLonghandHex(hex);
- }
- function isShorthandHex(hex) {
- return hex && hex.length === 4 && shortHandHex.test(hex);
- }
- function isLonghandHex(hex) {
- return hex && hex.length === 7 && longhandHex.test(hex);
- }
- function normalizeHex(hex) {
- hex = hex.toLowerCase();
- if (!hex.startsWith("#")) {
- hex = `#${hex}`;
- }
- if (isShorthandHex(hex)) {
- return rgbToHex(hexToRGB(hex));
- }
- return hex;
- }
- function hexToRGB(hex) {
- if (!isValidHex(hex)) {
- return null;
- }
- hex = hex.replace("#", "");
- if (hex.length === 3) {
- const [first, second, third] = hex.split("");
- const r = parseInt(`${first}${first}`, 16);
- const g = parseInt(`${second}${second}`, 16);
- const b = parseInt(`${third}${third}`, 16);
- return { r, g, b };
- }
- const r = parseInt(hex.slice(0, 2), 16);
- const g = parseInt(hex.slice(2, 4), 16);
- const b = parseInt(hex.slice(4, 6), 16);
- return { r, g, b };
- }
- // these utils allow users to pass enum values as strings without having to access the enum
- // based on the approach suggested by https://github.com/microsoft/TypeScript/issues/17690#issuecomment-321365759,
- const enumify = (x) => x;
- const CSSColorMode = enumify({
- HEX: "hex",
- HEXA: "hexa",
- RGB_CSS: "rgb-css",
- RGBA_CSS: "rgba-css",
- HSL_CSS: "hsl-css",
- HSLA_CSS: "hsla-css"
- });
- const ObjectColorMode = enumify({
- RGB: "rgb",
- RGBA: "rgba",
- HSL: "hsl",
- HSLA: "hsla",
- HSV: "hsv",
- HSVA: "hsva"
- });
- function parseMode(colorValue) {
- if (typeof colorValue === "string") {
- if (colorValue.startsWith("#")) {
- const { length } = colorValue;
- if (length === 4 || length === 7) {
- return CSSColorMode.HEX;
- }
- if (length === 5 || length === 9) {
- return CSSColorMode.HEXA;
- }
- }
- if (colorValue.startsWith("rgba(")) {
- return CSSColorMode.RGBA_CSS;
- }
- if (colorValue.startsWith("rgb(")) {
- return CSSColorMode.RGB_CSS;
- }
- if (colorValue.startsWith("hsl(")) {
- return CSSColorMode.HSL_CSS;
- }
- if (colorValue.startsWith("hsla(")) {
- return CSSColorMode.HSLA_CSS;
- }
- }
- if (typeof colorValue === "object") {
- if (hasChannels(colorValue, "r", "g", "b")) {
- return hasChannels(colorValue, "a") ? ObjectColorMode.RGBA : ObjectColorMode.RGB;
- }
- if (hasChannels(colorValue, "h", "s", "l")) {
- return hasChannels(colorValue, "a") ? ObjectColorMode.HSLA : ObjectColorMode.HSL;
- }
- if (hasChannels(colorValue, "h", "s", "v")) {
- return hasChannels(colorValue, "a") ? ObjectColorMode.HSVA : ObjectColorMode.HSV;
- }
- }
- return null;
- }
- function hasChannels(colorObject, ...channels) {
- return channels.every((channel) => channel && colorObject && `${channel}` in colorObject);
- }
- function colorEqual(value1, value2) {
- return (value1 === null || value1 === void 0 ? void 0 : value1.rgbNumber()) === (value2 === null || value2 === void 0 ? void 0 : value2.rgbNumber());
- }
- /**
- * Convert a string to a valid hex by hashing its contents
- * and using the hash as a seed for three distinct color values
- *
- * @param str
- */
- function stringToHex(str) {
- let hash = 0;
- for (let i = 0; i < str.length; i++) {
- hash = str.charCodeAt(i) + ((hash << 5) - hash);
- }
- let hex = "#";
- for (let j = 0; j < 3; j++) {
- const value = (hash >> (j * 8)) & 0xff;
- hex += ("00" + value.toString(16)).substr(-2);
- }
- return hex;
- }
- /**
- * Find the hue of a color given the separate RGB color channels
- *
- * @param rgb
- */
- function rgbToHue(rgb) {
- let { r, g, b } = rgb;
- r /= 255;
- g /= 255;
- b /= 255;
- const max = Math.max(r, g, b);
- const min = Math.min(r, g, b);
- const delta = max - min;
- if (max === min) {
- return 0;
- }
- let hue = (max + min) / 2;
- switch (max) {
- case r:
- hue = (g - b) / delta + (g < b ? 6 : 0);
- break;
- case g:
- hue = (b - r) / delta + 2;
- break;
- case b:
- hue = (r - g) / delta + 4;
- break;
- }
- return Math.round(hue * 60);
- }
- /**
- * For a hex color, find the hue
- *
- * @param hex {string} - form of "#------"
- */
- function hexToHue(hex) {
- return rgbToHue(hexToRGB(hex));
- }
- const avatarCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-avatar{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-avatar{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-avatar{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-avatar{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-avatar:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-avatar:root{--calcite-floating-ui-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{block-size:1.5rem;inline-size:1.5rem;font-size:var(--calcite-font-size--3)}/*!@:host([scale=m])*/[scale=m].sc-calcite-avatar-h{block-size:2rem;inline-size:2rem;font-size:var(--calcite-font-size--2)}/*!@:host([scale=l])*/[scale=l].sc-calcite-avatar-h{block-size:2.75rem;inline-size:2.75rem;font-size:var(--calcite-font-size-0)}/*!@.icon*/.icon.sc-calcite-avatar{display:flex}/*!@.background*/.background.sc-calcite-avatar{display:flex;block-size:100%;inline-size:100%;align-items: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{block-size:100%;inline-size:100%;border-radius:50%}";
- class Avatar {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** Specifies the size of the component. */
- this.scale = "m";
- //--------------------------------------------------------------------------
- //
- // Private State/Props
- //
- //--------------------------------------------------------------------------
- this.thumbnailFailedToLoad = false;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- render() {
- return this.determineContent();
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- determineContent() {
- if (this.thumbnail && !this.thumbnailFailedToLoad) {
- return (hAsync("img", { alt: "", class: "thumbnail", onError: () => (this.thumbnailFailedToLoad = true), src: this.thumbnail }));
- }
- const initials = this.generateInitials();
- const backgroundColor = this.generateFillColor();
- 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 }))));
- }
- /**
- * Generate a valid background color that is consistent and unique to this user
- */
- generateFillColor() {
- const { userId, username, fullName, el } = this;
- const theme = getThemeName(el);
- const id = userId && `#${userId.substr(userId.length - 6)}`;
- const name = username || fullName || "";
- const hex = id && isValidHex(id) ? id : stringToHex(name);
- // if there is not unique information, or an invalid hex is produced, return a default
- if ((!userId && !name) || !isValidHex(hex)) {
- return `var(--calcite-ui-foreground-2)`;
- }
- const hue = hexToHue(hex);
- const l = theme === "dark" ? 20 : 90;
- return `hsl(${hue}, 60%, ${l}%)`;
- }
- /**
- * Use fullname or username to generate initials
- */
- generateInitials() {
- const { fullName, username } = this;
- if (fullName) {
- return fullName
- .trim()
- .split(" ")
- .map((name) => name.substring(0, 1))
- .join("");
- }
- else if (username) {
- return username.substring(0, 2);
- }
- return false;
- }
- get el() { return getElement(this); }
- static get style() { return avatarCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-avatar",
- "$members$": {
- "scale": [513],
- "thumbnail": [513],
- "fullName": [513, "full-name"],
- "username": [513],
- "userId": [513, "user-id"],
- "thumbnailFailedToLoad": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["scale", "scale"], ["thumbnail", "thumbnail"], ["fullName", "full-name"], ["username", "username"], ["userId", "user-id"]]
- }; }
- }
- const CSS$P = {
- container: "container",
- content: "content",
- contentSpaced: "content--spaced",
- headerContainer: "header-container",
- icon: "icon",
- statusIcon: "status-icon",
- toggle: "toggle",
- toggleIcon: "toggle-icon",
- title: "title",
- heading: "heading",
- header: "header",
- button: "button",
- summary: "summary",
- description: "description",
- controlContainer: "control-container",
- valid: "valid",
- invalid: "invalid",
- loading: "loading"
- };
- const TEXT$p = {
- collapse: "Collapse",
- expand: "Expand",
- loading: "Loading",
- options: "Options"
- };
- const SLOTS$n = {
- icon: "icon",
- control: "control",
- headerMenuActions: "header-menu-actions"
- };
- const ICONS$d = {
- opened: "chevron-up",
- closed: "chevron-down",
- valid: "check-circle",
- invalid: "exclamation-mark-triangle",
- refresh: "refresh"
- };
- const HEADING_LEVEL$7 = 4;
- function constrainHeadingLevel(level) {
- return Math.min(Math.max(Math.ceil(level), 1), 6);
- }
- const Heading = (props, children) => {
- const HeadingTag = `h${props.level}`;
- delete props.level;
- return hAsync(HeadingTag, { ...props }, children);
- };
- const blockCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-block{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-block{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-block{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-block{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-block:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-block-h{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{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-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-block-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-block-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-block-h{display:flex;flex-shrink:0;flex-grow:0;flex-direction:column;border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding:0px;transition-property:margin;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;transition-timing-function:cubic-bezier(0.215, 0.440, 0.420, 0.880);flex-basis:auto}/*!@: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:flex;align-content:space-between;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{flex:1 1 auto;padding:0.5rem}/*!@.header*/.header.sc-calcite-block{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;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:flex;cursor:pointer;flex-wrap:nowrap;align-items:center;justify-content:space-between;border-style:none;padding:0px;font-family:inherit;outline-color:transparent;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);transition-property:color;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);word-wrap:break-word;word-break:break-word}/*!@.description*/.description.sc-calcite-block{margin-block-start: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{margin-inline-start:0.75rem;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{animation:spin var(--calcite-internal-animation-timing-medium) linear infinite}@keyframes spin{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}/*!@.toggle-icon*/.toggle-icon.sc-calcite-block{margin-block:0.75rem;align-self:center;justify-self:end;color:var(--calcite-ui-text-3);transition-property:color;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);margin-inline-end:1rem;margin-inline-start:auto}/*!@.toggle:hover .toggle-icon*/.toggle.sc-calcite-block:hover .toggle-icon.sc-calcite-block{color:var(--calcite-ui-text-1)}/*!@.container*/.container.sc-calcite-block{display:flex;block-size:100%;flex-direction:column}/*!@.content*/.content.sc-calcite-block{position:relative;flex:1 1 0%}@keyframes in{0%{opacity:0}100%{opacity:1}}/*!@.content*/.content.sc-calcite-block{animation:in var(--calcite-internal-animation-timing-slow) ease-in-out}/*!@.content--spaced*/.content--spaced.sc-calcite-block{padding-block:var(--calcite-block-padding, 0.5rem);padding-inline:var(--calcite-block-padding, 0.625rem)}/*!@.control-container*/.control-container.sc-calcite-block{margin:0px;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-block: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)}";
- /**
- * @slot - A slot for adding content to the component.
- * @slot icon - A slot for adding a leading header icon with `calcite-icon`.
- * @slot control - A slot for adding a single HTML input element in a header.
- * @slot header-menu-actions - A slot for adding an overflow menu with `calcite-action`s inside a dropdown.
- */
- class Block {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteBlockToggle = createEvent(this, "calciteBlockToggle", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, the component is collapsible.
- */
- this.collapsible = false;
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * When `true`, displays a drag handle in the header.
- */
- this.dragHandle = false;
- /**
- * Accessible name for the component's collapse button.
- *
- * @default "Collapse"
- */
- this.intlCollapse = TEXT$p.collapse;
- /**
- * Accessible name for the component's expand button.
- *
- * @default "Expand"
- */
- this.intlExpand = TEXT$p.expand;
- /**
- * Accessible name when the component is loading.
- *
- * @default "Loading"
- */
- this.intlLoading = TEXT$p.loading;
- /**
- * Accessible name for the component's options button.
- *
- * @default "Options"
- */
- this.intlOptions = TEXT$p.options;
- /**
- * When `true`, a busy indicator is displayed.
- */
- this.loading = false;
- /**
- * When `true`, expands the component and its contents.
- */
- this.open = false;
- /**
- * When `true`, removes padding for the slotted content.
- *
- * @deprecated Use `--calcite-block-padding` CSS variable instead.
- */
- this.disablePadding = false;
- this.guid = guid();
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.onHeaderClick = () => {
- this.open = !this.open;
- this.calciteBlockToggle.emit();
- };
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderScrim() {
- const { loading } = this;
- const defaultSlot = hAsync("slot", null);
- return [loading ? hAsync("calcite-scrim", { loading: loading }) : null, defaultSlot];
- }
- renderIcon() {
- const { el, status } = this;
- const showingLoadingStatus = this.loading && !this.open;
- const statusIcon = showingLoadingStatus ? ICONS$d.refresh : ICONS$d[status];
- const hasIcon = getSlotted(el, SLOTS$n.icon) || statusIcon;
- const iconEl = !statusIcon ? (hAsync("slot", { key: "icon-slot", name: SLOTS$n.icon })) : (hAsync("calcite-icon", { class: {
- [CSS$P.statusIcon]: true,
- [CSS$P.valid]: status == "valid",
- [CSS$P.invalid]: status == "invalid",
- [CSS$P.loading]: showingLoadingStatus
- }, icon: statusIcon, scale: "m" }));
- return hasIcon ? hAsync("div", { class: CSS$P.icon }, iconEl) : null;
- }
- renderTitle() {
- const { heading, headingLevel, summary, description } = this;
- return heading || summary || description ? (hAsync("div", { class: CSS$P.title }, hAsync(Heading, { class: CSS$P.heading, level: headingLevel || HEADING_LEVEL$7 }, heading), summary || description ? (hAsync("div", { class: CSS$P.description }, summary || description)) : null)) : null;
- }
- render() {
- const { collapsible, el, intlCollapse, intlExpand, loading, open, intlLoading } = this;
- const toggleLabel = open ? intlCollapse || TEXT$p.collapse : intlExpand || TEXT$p.expand;
- const headerContent = (hAsync("header", { class: CSS$P.header }, this.renderIcon(), this.renderTitle()));
- const hasControl = !!getSlotted(el, SLOTS$n.control);
- const hasMenuActions = !!getSlotted(el, SLOTS$n.headerMenuActions);
- const collapseIcon = open ? ICONS$d.opened : ICONS$d.closed;
- const { guid } = this;
- const regionId = `${guid}-region`;
- const buttonId = `${guid}-button`;
- const headerNode = (hAsync("div", { class: CSS$P.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$P.toggle, id: buttonId, onClick: this.onHeaderClick, title: toggleLabel }, headerContent, !hasControl && !hasMenuActions ? (hAsync("calcite-icon", { "aria-hidden": "true", class: CSS$P.toggleIcon, icon: collapseIcon, scale: "s" })) : null)) : (headerContent), loading ? (hAsync("calcite-loader", { inline: true, "is-active": true, label: intlLoading })) : hasControl ? (hAsync("div", { class: CSS$P.controlContainer }, hAsync("slot", { name: SLOTS$n.control }))) : null, hasMenuActions ? (hAsync("calcite-action-menu", { label: this.intlOptions || TEXT$p.options }, hAsync("slot", { name: SLOTS$n.headerMenuActions }))) : null));
- return (hAsync(Host, null, hAsync("article", { "aria-busy": toAriaBoolean(loading), class: {
- [CSS$P.container]: true
- } }, headerNode, hAsync("section", { "aria-expanded": toAriaBoolean(open), "aria-labelledby": buttonId, class: {
- [CSS$P.content]: true,
- [CSS$P.contentSpaced]: !this.disablePadding
- }, hidden: !open, id: regionId }, this.renderScrim()))));
- }
- get el() { return getElement(this); }
- static get style() { return blockCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-block",
- "$members$": {
- "collapsible": [516],
- "disabled": [516],
- "dragHandle": [516, "drag-handle"],
- "heading": [1],
- "headingLevel": [514, "heading-level"],
- "intlCollapse": [1, "intl-collapse"],
- "intlExpand": [1, "intl-expand"],
- "intlLoading": [1, "intl-loading"],
- "intlOptions": [1, "intl-options"],
- "loading": [516],
- "open": [1540],
- "status": [513],
- "summary": [1],
- "description": [1],
- "disablePadding": [516, "disable-padding"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["collapsible", "collapsible"], ["disabled", "disabled"], ["dragHandle", "drag-handle"], ["headingLevel", "heading-level"], ["loading", "loading"], ["open", "open"], ["status", "status"], ["disablePadding", "disable-padding"]]
- }; }
- }
- const CSS$O = {
- content: "content",
- invalid: "invalid",
- toggle: "toggle",
- toggleSwitch: "toggle--switch",
- toggleSwitchContent: "toggle--switch__content",
- toggleSwitchText: "toggle--switch__text",
- sectionHeader: "section-header",
- sectionHeaderText: "section-header__text",
- statusIcon: "status-icon",
- valid: "valid"
- };
- const TEXT$o = {
- collapse: "Collapse",
- expand: "Expand"
- };
- const ICONS$c = {
- menuOpen: "chevron-down",
- menuClosedLeft: "chevron-left",
- menuClosedRight: "chevron-right",
- valid: "check-circle",
- invalid: "exclamation-mark-triangle"
- };
- const blockSectionCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-block-section{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-block-section{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-block-section{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-block-section{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-block-section:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-block-section:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-block-section-h{display:none}/*!@:host*/.sc-calcite-block-section-h{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-block-end-width:1px;border-style:solid;border-block-end-color:var(--calcite-ui-border-3)}/*!@:host(:last-child)*/.sc-calcite-block-section-h:last-child{border-block-end-width:0px}/*!@.toggle*/.toggle.sc-calcite-block-section{inline-size: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, \n.section-header*/.toggle--switch.sc-calcite-block-section,.section-header.sc-calcite-block-section{margin-inline:0px;margin-block:0.25rem;display:flex;cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;padding-inline:0px;padding-block:0.5rem;font-size:var(--calcite-font-size--1);outline-color:transparent}/*!@.toggle--switch:focus, \n.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, \n.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{align-self:flex-end}/*!@.section-header__text*/.section-header__text.sc-calcite-block-section{margin-inline:0.75rem;margin-block:0px;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;margin-inline-start:0.25rem}/*!@.toggle--switch .status-icon*/.toggle--switch.sc-calcite-block-section .status-icon.sc-calcite-block-section{margin-inline-start:0.5rem}/*!@.toggle--switch__content*/.toggle--switch__content.sc-calcite-block-section{display:flex;flex:1 1 auto;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)}";
- /**
- * @slot - A slot for adding content to the component.
- */
- class BlockSection {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteBlockSectionToggle = createEvent(this, "calciteBlockSectionToggle", 6);
- /**
- * When `true`, expands the component and its contents.
- */
- this.open = false;
- /**
- * Specifies the component's toggle display -
- *
- * `"button"` (selectable header), or
- *
- * `"switch"` (toggle switch).
- */
- this.toggleDisplay = "button";
- this.guid = guid();
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.handleHeaderKeyDown = (event) => {
- if (isActivationKey(event.key)) {
- this.toggleSection();
- event.preventDefault();
- event.stopPropagation();
- }
- };
- this.toggleSection = () => {
- this.open = !this.open;
- this.calciteBlockSectionToggle.emit();
- };
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderStatusIcon() {
- var _a;
- const { status } = this;
- const statusIcon = (_a = ICONS$c[status]) !== null && _a !== void 0 ? _a : false;
- const statusIconClasses = {
- [CSS$O.statusIcon]: true,
- [CSS$O.valid]: status == "valid",
- [CSS$O.invalid]: status == "invalid"
- };
- return !!statusIcon ? (hAsync("calcite-icon", { class: statusIconClasses, icon: statusIcon, scale: "s" })) : null;
- }
- render() {
- const { el, intlCollapse, intlExpand, open, text, toggleDisplay } = this;
- const dir = getElementDir(el);
- const arrowIcon = open
- ? ICONS$c.menuOpen
- : dir === "rtl"
- ? ICONS$c.menuClosedLeft
- : ICONS$c.menuClosedRight;
- const toggleLabel = open ? intlCollapse || TEXT$o.collapse : intlExpand || TEXT$o.expand;
- const { guid } = this;
- const regionId = `${guid}-region`;
- const buttonId = `${guid}-button`;
- const headerNode = toggleDisplay === "switch" ? (hAsync("div", { "aria-controls": regionId, "aria-label": toggleLabel, class: {
- [CSS$O.toggle]: true,
- [CSS$O.toggleSwitch]: true
- }, id: buttonId, onClick: this.toggleSection, onKeyDown: this.handleHeaderKeyDown, tabIndex: 0, title: toggleLabel }, hAsync("div", { class: CSS$O.toggleSwitchContent }, hAsync("span", { class: CSS$O.toggleSwitchText }, text)), hAsync("calcite-switch", { checked: open, label: toggleLabel, scale: "s", tabIndex: -1 }), this.renderStatusIcon())) : (hAsync("button", { "aria-controls": regionId, "aria-label": toggleLabel, class: {
- [CSS$O.sectionHeader]: true,
- [CSS$O.toggle]: true
- }, id: buttonId, name: toggleLabel, onClick: this.toggleSection }, hAsync("calcite-icon", { icon: arrowIcon, scale: "s" }), hAsync("span", { class: CSS$O.sectionHeaderText }, text), this.renderStatusIcon()));
- return (hAsync(Host, null, headerNode, hAsync("section", { "aria-expanded": toAriaBoolean(open), "aria-labelledby": buttonId, class: CSS$O.content, hidden: !open, id: regionId }, hAsync("slot", null))));
- }
- get el() { return getElement(this); }
- static get style() { return blockSectionCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-block-section",
- "$members$": {
- "intlCollapse": [1, "intl-collapse"],
- "intlExpand": [1, "intl-expand"],
- "open": [1540],
- "status": [513],
- "text": [1],
- "toggleDisplay": [513, "toggle-display"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["open", "open"], ["status", "status"], ["toggleDisplay", "toggle-display"]]
- }; }
- }
- (function(prototype) {
- if (typeof prototype.requestSubmit == "function") return
- prototype.requestSubmit = function(submitter) {
- if (submitter) {
- validateSubmitter(submitter, this);
- submitter.click();
- } else {
- submitter = document.createElement("input");
- submitter.type = "submit";
- submitter.hidden = true;
- this.appendChild(submitter);
- submitter.click();
- this.removeChild(submitter);
- }
- };
- function validateSubmitter(submitter, form) {
- submitter instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'");
- submitter.type == "submit" || raise(TypeError, "The specified element is not a submit button");
- submitter.form == form || raise(DOMException, "The specified element is not owned by this form element", "NotFoundError");
- }
- function raise(errorConstructor, message, name) {
- throw new errorConstructor("Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message + ".", name)
- }
- })(HTMLFormElement.prototype);
- const CSS$N = {
- buttonLoader: "calcite-button--loader",
- content: "content",
- contentSlotted: "content--slotted",
- icon: "icon",
- iconStart: "icon--start",
- iconEnd: "icon--end",
- loadingIn: "loading-in",
- loadingOut: "loading-out",
- iconStartEmpty: "icon-start-empty",
- iconEndEmpty: "icon-end-empty"
- };
- const TEXT$n = {
- loading: "Loading"
- };
- /**
- * Exported for testing purposes only
- *
- * @internal
- */
- const labelClickEvent = "calciteInternalLabelClick";
- const labelConnectedEvent = "calciteInternalLabelConnected";
- const labelDisconnectedEvent = "calciteInternaLabelDisconnected";
- const labelTagName = "calcite-label";
- const onLabelClickMap = new WeakMap();
- const onLabelConnectedMap = new WeakMap();
- const onLabelDisconnectedMap = new WeakMap();
- const unlabeledComponents = new Set();
- const findLabelForComponent = (componentEl) => {
- const { id } = componentEl;
- const forLabel = id && queryElementRoots(componentEl, { selector: `${labelTagName}[for="${id}"]` });
- if (forLabel) {
- return forLabel;
- }
- const parentLabel = closestElementCrossShadowBoundary(componentEl, labelTagName);
- if (!parentLabel ||
- // labelable components within other custom elements are not considered labelable
- hasAncestorCustomElements(parentLabel, componentEl)) {
- return null;
- }
- return parentLabel;
- };
- function hasAncestorCustomElements(label, componentEl) {
- let traversedElements;
- const customElementAncestorCheckEventType = "custom-element-ancestor-check";
- const listener = (event) => {
- event.stopImmediatePropagation();
- const composedPath = event.composedPath();
- traversedElements = composedPath.slice(composedPath.indexOf(componentEl), composedPath.indexOf(label));
- };
- label.addEventListener(customElementAncestorCheckEventType, listener, { once: true });
- componentEl.dispatchEvent(new CustomEvent(customElementAncestorCheckEventType, { composed: true, bubbles: true }));
- label.removeEventListener(customElementAncestorCheckEventType, listener);
- const ancestorCustomElements = traversedElements
- .filter((el) => el !== componentEl && el !== label)
- .filter((el) => { var _a; return (_a = el.tagName) === null || _a === void 0 ? void 0 : _a.includes("-"); });
- return ancestorCustomElements.length > 0;
- }
- /**
- * Helper to set up label interactions on connectedCallback.
- *
- * @param component
- */
- function connectLabel(component) {
- const labelEl = findLabelForComponent(component.el);
- if (onLabelClickMap.has(labelEl) || (!labelEl && unlabeledComponents.has(component))) {
- return;
- }
- const boundOnLabelDisconnected = onLabelDisconnected.bind(component);
- if (labelEl) {
- component.labelEl = labelEl;
- const boundOnLabelClick = onLabelClick.bind(component);
- onLabelClickMap.set(component.labelEl, boundOnLabelClick);
- component.labelEl.addEventListener(labelClickEvent, boundOnLabelClick);
- unlabeledComponents.delete(component);
- document.removeEventListener(labelConnectedEvent, onLabelConnectedMap.get(component));
- onLabelDisconnectedMap.set(component, boundOnLabelDisconnected);
- document.addEventListener(labelDisconnectedEvent, boundOnLabelDisconnected);
- }
- else if (!unlabeledComponents.has(component)) {
- boundOnLabelDisconnected();
- document.removeEventListener(labelDisconnectedEvent, onLabelDisconnectedMap.get(component));
- }
- }
- /**
- * Helper to tear down label interactions on disconnectedCallback on labelable components.
- *
- * @param component
- */
- function disconnectLabel(component) {
- unlabeledComponents.delete(component);
- document.removeEventListener(labelConnectedEvent, onLabelConnectedMap.get(component));
- document.removeEventListener(labelDisconnectedEvent, onLabelDisconnectedMap.get(component));
- onLabelConnectedMap.delete(component);
- onLabelDisconnectedMap.delete(component);
- if (!component.labelEl) {
- return;
- }
- const boundOnLabelClick = onLabelClickMap.get(component.labelEl);
- component.labelEl.removeEventListener(labelClickEvent, boundOnLabelClick);
- onLabelClickMap.delete(component.labelEl);
- }
- /**
- * Helper to get the label text from a component.
- *
- * @param component
- */
- function getLabelText(component) {
- var _a, _b;
- return component.label || ((_b = (_a = component.labelEl) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || "";
- }
- function onLabelClick(event) {
- if (this.disabled) {
- return;
- }
- const containedLabelableChildClicked = this.el.contains(event.detail.sourceEvent.target);
- if (containedLabelableChildClicked) {
- return;
- }
- this.onLabelClick(event);
- }
- function onLabelConnected() {
- if (unlabeledComponents.has(this)) {
- connectLabel(this);
- }
- }
- function onLabelDisconnected() {
- unlabeledComponents.add(this);
- const boundOnLabelConnected = onLabelConnectedMap.get(this) || onLabelConnected.bind(this);
- onLabelConnectedMap.set(this, boundOnLabelConnected);
- document.addEventListener(labelConnectedEvent, boundOnLabelConnected);
- }
- /**
- * Exported for testing purposes.
- */
- const hiddenFormInputSlotName = "hidden-form-input";
- function isCheckable(component) {
- return "checked" in component;
- }
- const onFormResetMap = new WeakMap();
- const formComponentSet = new WeakSet();
- function hasRegisteredFormComponentParent(form, formComponentEl) {
- // we use events as a way to test for nested form-associated components across shadow bounds
- const formComponentRegisterEventName = "calciteInternalFormComponentRegister";
- let hasRegisteredFormComponentParent = false;
- form.addEventListener(formComponentRegisterEventName, (event) => {
- hasRegisteredFormComponentParent = event
- .composedPath()
- .some((element) => formComponentSet.has(element));
- event.stopPropagation();
- }, { once: true });
- formComponentEl.dispatchEvent(new CustomEvent(formComponentRegisterEventName, {
- bubbles: true,
- composed: true
- }));
- return hasRegisteredFormComponentParent;
- }
- /**
- * Helper to submit a form.
- *
- * @param component
- * @returns true if its associated form was submitted, false otherwise.
- */
- function submitForm(component) {
- const { formEl } = component;
- if (!formEl) {
- return false;
- }
- "requestSubmit" in formEl ? formEl.requestSubmit() : formEl.submit();
- return true;
- }
- /**
- * Helper to reset a form.
- *
- * @param component
- */
- function resetForm(component) {
- var _a;
- (_a = component.formEl) === null || _a === void 0 ? void 0 : _a.reset();
- }
- /**
- * Helper to set up form interactions on connectedCallback.
- *
- * @param component
- */
- function connectForm(component) {
- const { el, value } = component;
- const form = closestElementCrossShadowBoundary(el, "form");
- if (!form || hasRegisteredFormComponentParent(form, el)) {
- return;
- }
- component.formEl = form;
- component.defaultValue = value;
- if (isCheckable(component)) {
- component.defaultChecked = component.checked;
- }
- const boundOnFormReset = (component.onFormReset || onFormReset).bind(component);
- form.addEventListener("reset", boundOnFormReset);
- onFormResetMap.set(component.el, boundOnFormReset);
- formComponentSet.add(el);
- }
- function onFormReset() {
- if (isCheckable(this)) {
- this.checked = this.defaultChecked;
- return;
- }
- this.value = this.defaultValue;
- }
- /**
- * Helper to tear down form interactions on disconnectedCallback.
- *
- * @param component
- */
- function disconnectForm(component) {
- const { el, formEl } = component;
- if (!formEl) {
- return;
- }
- const boundOnFormReset = onFormResetMap.get(el);
- formEl.removeEventListener("reset", boundOnFormReset);
- onFormResetMap.delete(el);
- component.formEl = null;
- formComponentSet.delete(el);
- }
- /**
- * Helper for setting the default value on initialization after connectedCallback.
- *
- * Note that this is only needed if the default value cannot be determined on connectedCallback.
- *
- * @param component
- * @param value
- */
- function afterConnectDefaultValueSet(component, value) {
- component.defaultValue = value;
- }
- const hiddenInputChangeHandler = (event) => {
- event.target.dispatchEvent(new CustomEvent("calciteInternalHiddenInputChange", { bubbles: true }));
- };
- const removeHiddenInputChangeEventListener = (input) => input.removeEventListener("change", hiddenInputChangeHandler);
- /**
- * Helper for maintaining a form-associated's hidden input in sync with the component.
- *
- * Based on Ionic's approach: https://github.com/ionic-team/ionic-framework/blob/e4bf052794af9aac07f887013b9250d2a045eba3/core/src/utils/helpers.ts#L198
- *
- * @param component
- */
- function syncHiddenFormInput(component) {
- const { el, formEl, name, value } = component;
- const { ownerDocument } = el;
- const inputs = el.querySelectorAll(`input[slot="${hiddenFormInputSlotName}"]`);
- if (!formEl || !name) {
- inputs.forEach((input) => {
- removeHiddenInputChangeEventListener(input);
- input.remove();
- });
- return;
- }
- const values = Array.isArray(value) ? value : [value];
- const extra = [];
- const seen = new Set();
- inputs.forEach((input) => {
- const valueMatch = values.find((val) =>
- /* intentional non-strict equality check */
- val == input.value);
- if (valueMatch != null) {
- seen.add(valueMatch);
- defaultSyncHiddenFormInput(component, input, valueMatch);
- }
- else {
- extra.push(input);
- }
- });
- let docFrag;
- values.forEach((value) => {
- if (seen.has(value)) {
- return;
- }
- let input = extra.pop();
- if (!input) {
- input = ownerDocument.createElement("input");
- input.slot = hiddenFormInputSlotName;
- }
- if (!docFrag) {
- docFrag = ownerDocument.createDocumentFragment();
- }
- docFrag.append(input);
- // emits when hidden input is autofilled
- input.addEventListener("change", hiddenInputChangeHandler);
- defaultSyncHiddenFormInput(component, input, value);
- });
- if (docFrag) {
- el.append(docFrag);
- }
- extra.forEach((input) => {
- removeHiddenInputChangeEventListener(input);
- input.remove();
- });
- }
- function defaultSyncHiddenFormInput(component, input, value) {
- var _a;
- const { defaultValue, disabled, name, required } = component;
- // keep in sync to prevent losing reset value
- input.defaultValue = defaultValue;
- input.disabled = disabled;
- input.name = name;
- input.required = required;
- input.tabIndex = -1;
- if (isCheckable(component)) {
- // keep in sync to prevent losing reset value
- input.defaultChecked = component.defaultChecked;
- // heuristic to support default/on mode from https://html.spec.whatwg.org/multipage/input.html#dom-input-value-default-on
- input.value = component.checked ? value || "on" : "";
- // we disable the component when not checked to avoid having its value submitted
- if (!disabled && !component.checked) {
- input.disabled = true;
- }
- }
- else {
- input.value = value || "";
- }
- (_a = component.syncHiddenFormInput) === null || _a === void 0 ? void 0 : _a.call(component, input);
- }
- /**
- * Helper to render the slot for form-associated component's hidden input.
- *
- * 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.
- *
- * render(): VNode {
- * <Host>
- * <div class={CSS.container}>
- * // ...
- * <HiddenFormInputSlot component={this} />
- * </div>
- * </Host>
- * }
- *
- * Note that the hidden-form-input Sass mixin must be added to the component's style to apply specific styles.
- *
- * @param root0
- * @param root0.component
- */
- const HiddenFormInputSlot = ({ component }) => {
- syncHiddenFormInput(component);
- return hAsync("slot", { name: hiddenFormInputSlotName });
- };
- const buttonCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-button{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-button{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-button{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-button{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-button:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-button:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-button-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-button-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-button-h{display:inline-block;inline-size: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, \n:host a*/.sc-calcite-button-h button.sc-calcite-button,.sc-calcite-button-h a.sc-calcite-button{outline-color:transparent}/*!@:host button:focus, \n: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-block:var(--calcite-button-padding-y);padding-inline:var(--calcite-button-padding-x);position:relative;box-sizing:border-box;display:flex;block-size:100%;inline-size:100%;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-appearance:none;appearance:none;align-items:center;justify-content:center;border-radius:0px;border-style:none;text-align:center;font-family:inherit;font-weight:var(--calcite-font-weight-normal);text-decoration-line:none;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-color var(--calcite-internal-animation-timing-fast) ease-in-out}/*!@:host button:hover, \n:host a:hover*/.sc-calcite-button-h button.sc-calcite-button:hover,.sc-calcite-button-h a.sc-calcite-button:hover{text-decoration-line:none}/*!@.content*/.content.sc-calcite-button{display:flex;flex-basis:auto;margin-inline:var(--calcite-button-content-margin)}/*!@.icon-start-empty .content*/.icon-start-empty.sc-calcite-button .content.sc-calcite-button{margin-inline-start:unset}/*!@.icon-end-empty .content*/.icon-end-empty.sc-calcite-button .content.sc-calcite-button{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{inline-size:auto}/*!@:host([width=half])*/[width=half].sc-calcite-button-h{inline-size:50%}/*!@:host([width=full])*/[width=full].sc-calcite-button-h{inline-size:100%}/*!@:host([alignment=center]:not([width=auto])) a, \n: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{justify-content:center}/*!@:host([alignment=start]:not([width=auto])) a, \n: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{justify-content:flex-start}/*!@:host([alignment=end]:not([width=auto])) a, \n: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{justify-content:flex-end}/*!@:host([alignment*=space-between]:not([width=auto])) a, \n: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{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{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{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{margin-inline-start:var(--calcite-button-content-margin)}/*!@.icon*/.icon.sc-calcite-button{position:relative;margin:0px;display:inline-flex;font-weight:var(--calcite-font-weight-normal);line-height:inherit}/*!@: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, \n: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)}@keyframes loader-in{0%{inline-size:0;opacity:0;transform:scale(0.5)}100%{inline-size:1em;opacity:1;transform:scale(1)}}@keyframes loader-out{0%{inline-size:1em;opacity:1;transform:scale(1)}100%{inline-size:0;opacity:0;transform:scale(0.5)}}/*!@.calcite-button--loader*/.calcite-button--loader.sc-calcite-button{display:flex}/*!@.calcite-button--loader calcite-loader*/.calcite-button--loader.sc-calcite-button calcite-loader.sc-calcite-button{margin:0px;transition:inline-size 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}/*!@.calcite-button--loader calcite-loader.loading-in*/.calcite-button--loader.sc-calcite-button calcite-loader.loading-in.sc-calcite-button{animation-name:loader-in;animation-duration:var(--calcite-internal-animation-timing-slow)}/*!@.calcite-button--loader calcite-loader.loading-out*/.calcite-button--loader.sc-calcite-button calcite-loader.loading-out.sc-calcite-button{animation-name:loader-out;animation-duration:var(--calcite-internal-animation-timing-slow)}/*!@: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{margin-inline-end:var(--calcite-button-content-margin)}/*!@:host([loading]) button:not(.content--slotted) .icon--start, \n:host([loading]) button:not(.content--slotted) .icon--end, \n:host([loading]) a:not(.content--slotted) .icon--start, \n: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, \n: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([color=blue]) button, \n:host([color=blue]) a*/[color=blue].sc-calcite-button-h button.sc-calcite-button,[color=blue].sc-calcite-button-h a.sc-calcite-button{background-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-inverse)}/*!@:host([color=blue]) button:hover, :host([color=blue]) button:focus, \n:host([color=blue]) a:hover, \n:host([color=blue]) a:focus*/[color=blue].sc-calcite-button-h button.sc-calcite-button:hover,[color=blue].sc-calcite-button-h button.sc-calcite-button:focus,[color=blue].sc-calcite-button-h a.sc-calcite-button:hover,[color=blue].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-brand-hover)}/*!@:host([color=blue]) button:active, \n:host([color=blue]) a:active*/[color=blue].sc-calcite-button-h button.sc-calcite-button:active,[color=blue].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-brand-press)}/*!@:host([color=blue]) button calcite-loader, \n:host([color=blue]) a calcite-loader*/[color=blue].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[color=blue].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-inverse)}/*!@:host([color=red]) button, \n:host([color=red]) a*/[color=red].sc-calcite-button-h button.sc-calcite-button,[color=red].sc-calcite-button-h a.sc-calcite-button{background-color:var(--calcite-ui-danger);color:var(--calcite-ui-text-inverse)}/*!@:host([color=red]) button:hover, :host([color=red]) button:focus, \n:host([color=red]) a:hover, \n:host([color=red]) a:focus*/[color=red].sc-calcite-button-h button.sc-calcite-button:hover,[color=red].sc-calcite-button-h button.sc-calcite-button:focus,[color=red].sc-calcite-button-h a.sc-calcite-button:hover,[color=red].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-danger-hover)}/*!@:host([color=red]) button:active, \n:host([color=red]) a:active*/[color=red].sc-calcite-button-h button.sc-calcite-button:active,[color=red].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-danger-press)}/*!@:host([color=red]) button calcite-loader, \n:host([color=red]) a calcite-loader*/[color=red].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[color=red].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-inverse)}/*!@:host([color=neutral]) button, \n:host([color=neutral]) a*/[color=neutral].sc-calcite-button-h button.sc-calcite-button,[color=neutral].sc-calcite-button-h a.sc-calcite-button{background-color:var(--calcite-ui-foreground-3);color:var(--calcite-ui-text-1)}/*!@:host([color=neutral]) button:hover, :host([color=neutral]) button:focus, \n:host([color=neutral]) a:hover, \n:host([color=neutral]) a:focus*/[color=neutral].sc-calcite-button-h button.sc-calcite-button:hover,[color=neutral].sc-calcite-button-h button.sc-calcite-button:focus,[color=neutral].sc-calcite-button-h a.sc-calcite-button:hover,[color=neutral].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-foreground-2)}/*!@:host([color=neutral]) button:active, \n:host([color=neutral]) a:active*/[color=neutral].sc-calcite-button-h button.sc-calcite-button:active,[color=neutral].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-foreground-1)}/*!@:host([color=neutral]) button calcite-loader, \n:host([color=neutral]) a calcite-loader*/[color=neutral].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[color=neutral].sc-calcite-button-h a.sc-calcite-button calcite-loader.sc-calcite-button{color:var(--calcite-ui-text-1)}/*!@:host([color=inverse]) button, \n:host([color=inverse]) a*/[color=inverse].sc-calcite-button-h button.sc-calcite-button,[color=inverse].sc-calcite-button-h a.sc-calcite-button{color:var(--calcite-ui-text-inverse);background-color:var(--calcite-ui-inverse)}/*!@:host([color=inverse]) button:hover, :host([color=inverse]) button:focus,\n:host([color=inverse]) a:hover,\n:host([color=inverse]) a:focus*/[color=inverse].sc-calcite-button-h button.sc-calcite-button:hover,[color=inverse].sc-calcite-button-h button.sc-calcite-button:focus,[color=inverse].sc-calcite-button-h a.sc-calcite-button:hover,[color=inverse].sc-calcite-button-h a.sc-calcite-button:focus{background-color:var(--calcite-ui-inverse-hover)}/*!@:host([color=inverse]) button:active,\n:host([color=inverse]) a:active*/[color=inverse].sc-calcite-button-h button.sc-calcite-button:active,[color=inverse].sc-calcite-button-h a.sc-calcite-button:active{background-color:var(--calcite-ui-inverse-press)}/*!@:host([color=inverse]) button calcite-loader, \n:host([color=inverse]) a calcite-loader*/[color=inverse].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[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, \n: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);box-shadow:inset 0 0 0 1px transparent}/*!@:host([appearance=outline][color=blue]) button, \n: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);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-brand)}/*!@:host([appearance=outline][color=blue]) button:hover, \n: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);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand-hover)}/*!@:host([appearance=outline][color=blue]) button:focus, \n: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);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@:host([appearance=outline][color=blue]) button:active, \n: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);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, \n: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);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-danger)}/*!@:host([appearance=outline][color=red]) button:hover, \n: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);box-shadow:inset 0 0 0 1px var(--calcite-ui-danger-hover)}/*!@:host([appearance=outline][color=red]) button:focus, \n: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);box-shadow:inset 0 0 0 2px var(--calcite-ui-danger)}/*!@:host([appearance=outline][color=red]) button:active, \n: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);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, \n: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{background-color:var(--calcite-ui-foreground-1);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{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{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{box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3)}/*!@:host([appearance=outline][color=neutral]) button calcite-loader, \n: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, \n: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{background-color:var(--calcite-ui-foreground-1);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);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);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);box-shadow:inset 0 0 0 2px var(--calcite-ui-inverse-press)}/*!@:host([appearance=outline][color=inverse]) button calcite-loader, \n: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, \n:host([appearance=clear]) a, \n:host([appearance=minimal]) button, \n:host([appearance=minimal]) a*/[appearance=clear].sc-calcite-button-h button.sc-calcite-button,[appearance=clear].sc-calcite-button-h a.sc-calcite-button,[appearance=minimal].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal].sc-calcite-button-h a.sc-calcite-button{border-width:1px;border-style:solid;background-color:transparent;box-shadow:inset 0 0 0 1px transparent}/*!@:host([appearance=clear][color=blue]) button, \n:host([appearance=clear][color=blue]) a, \n:host([appearance=minimal][color=blue]) button, \n:host([appearance=minimal][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,[appearance=minimal][color=blue].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal][color=blue].sc-calcite-button-h a.sc-calcite-button{border-color:var(--calcite-ui-brand);background-color:transparent;color:var(--calcite-ui-brand)}/*!@:host([appearance=clear][color=blue]) button:hover, \n:host([appearance=clear][color=blue]) a:hover, \n:host([appearance=minimal][color=blue]) button:hover, \n:host([appearance=minimal][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,[appearance=minimal][color=blue].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=minimal][color=blue].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-brand-hover);color:var(--calcite-ui-brand-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-brand-hover)}/*!@:host([appearance=clear][color=blue]) button:focus, \n:host([appearance=clear][color=blue]) a:focus, \n:host([appearance=minimal][color=blue]) button:focus, \n:host([appearance=minimal][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,[appearance=minimal][color=blue].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=minimal][color=blue].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-brand);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@:host([appearance=clear][color=blue]) button:active, \n:host([appearance=clear][color=blue]) a:active, \n:host([appearance=minimal][color=blue]) button:active, \n:host([appearance=minimal][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,[appearance=minimal][color=blue].sc-calcite-button-h button.sc-calcite-button:active,[appearance=minimal][color=blue].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-brand-press);color: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,\n:host([appearance=minimal][color=blue]) button calcite-loader,\n:host([appearance=minimal][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,[appearance=minimal][color=blue].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][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, \n:host([appearance=clear][color=red]) a, \n:host([appearance=minimal][color=red]) button, \n:host([appearance=minimal][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,[appearance=minimal][color=red].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal][color=red].sc-calcite-button-h a.sc-calcite-button{border-color:var(--calcite-ui-danger);background-color:transparent;color:var(--calcite-ui-danger)}/*!@:host([appearance=clear][color=red]) button:hover, \n:host([appearance=clear][color=red]) a:hover, \n:host([appearance=minimal][color=red]) button:hover, \n:host([appearance=minimal][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,[appearance=minimal][color=red].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=minimal][color=red].sc-calcite-button-h a.sc-calcite-button:hover{border-color:var(--calcite-ui-danger-hover);color:var(--calcite-ui-danger-hover);box-shadow:inset 0 0 0 1px var(--calcite-ui-danger-hover)}/*!@:host([appearance=clear][color=red]) button:focus, \n:host([appearance=clear][color=red]) a:focus, \n:host([appearance=minimal][color=red]) button:focus, \n:host([appearance=minimal][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,[appearance=minimal][color=red].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=minimal][color=red].sc-calcite-button-h a.sc-calcite-button:focus{border-color:var(--calcite-ui-danger);color:var(--calcite-ui-danger);box-shadow:inset 0 0 0 2px var(--calcite-ui-danger)}/*!@:host([appearance=clear][color=red]) button:active, \n:host([appearance=clear][color=red]) a:active, \n:host([appearance=minimal][color=red]) button:active, \n:host([appearance=minimal][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,[appearance=minimal][color=red].sc-calcite-button-h button.sc-calcite-button:active,[appearance=minimal][color=red].sc-calcite-button-h a.sc-calcite-button:active{border-color:var(--calcite-ui-danger-press);color: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,\n:host([appearance=minimal][color=red]) button calcite-loader,\n:host([appearance=minimal][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,[appearance=minimal][color=red].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][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, \n:host([appearance=clear][color=neutral]) a, \n:host([appearance=minimal][color=neutral]) button, \n:host([appearance=minimal][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,[appearance=minimal][color=neutral].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal][color=neutral].sc-calcite-button-h a.sc-calcite-button{background-color:transparent;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,\n:host([appearance=minimal][color=neutral]) button:hover,\n:host([appearance=minimal][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,[appearance=minimal][color=neutral].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=minimal][color=neutral].sc-calcite-button-h a.sc-calcite-button:hover{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,\n:host([appearance=minimal][color=neutral]) button:focus,\n:host([appearance=minimal][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,[appearance=minimal][color=neutral].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=minimal][color=neutral].sc-calcite-button-h a.sc-calcite-button:focus{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,\n:host([appearance=minimal][color=neutral]) button:active,\n:host([appearance=minimal][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,[appearance=minimal][color=neutral].sc-calcite-button-h button.sc-calcite-button:active,[appearance=minimal][color=neutral].sc-calcite-button-h a.sc-calcite-button:active{box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-3)}/*!@:host([appearance=clear][color=neutral]) button calcite-loader, \n:host([appearance=clear][color=neutral]) a calcite-loader, \n:host([appearance=minimal][color=neutral]) button calcite-loader, \n:host([appearance=minimal][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,[appearance=minimal][color=neutral].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][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, \n:host([appearance=clear][color=inverse]) a, \n:host([appearance=minimal][color=inverse]) button, \n:host([appearance=minimal][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,[appearance=minimal][color=inverse].sc-calcite-button-h button.sc-calcite-button,[appearance=minimal][color=inverse].sc-calcite-button-h a.sc-calcite-button{background-color:transparent;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,\n:host([appearance=minimal][color=inverse]) button:hover,\n:host([appearance=minimal][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,[appearance=minimal][color=inverse].sc-calcite-button-h button.sc-calcite-button:hover,[appearance=minimal][color=inverse].sc-calcite-button-h a.sc-calcite-button:hover{border-color: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,\n:host([appearance=minimal][color=inverse]) button:focus,\n:host([appearance=minimal][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,[appearance=minimal][color=inverse].sc-calcite-button-h button.sc-calcite-button:focus,[appearance=minimal][color=inverse].sc-calcite-button-h a.sc-calcite-button:focus{border-color: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,\n:host([appearance=minimal][color=inverse]) button:active,\n:host([appearance=minimal][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,[appearance=minimal][color=inverse].sc-calcite-button-h button.sc-calcite-button:active,[appearance=minimal][color=inverse].sc-calcite-button-h a.sc-calcite-button:active{border-color: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, \n:host([appearance=clear][color=inverse]) a calcite-loader, \n:host([appearance=minimal][color=inverse]) button calcite-loader, \n:host([appearance=minimal][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,[appearance=minimal][color=inverse].sc-calcite-button-h button.sc-calcite-button calcite-loader.sc-calcite-button,[appearance=minimal][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,\n:host([appearance=minimal][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,[appearance=minimal][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,\n:host([appearance=minimal][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,[appearance=minimal][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, \n: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, \n:host([appearance=transparent][color=neutral]:not(.cancel-editing-button)) a, \n: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-block-start-width:1px;border-block-end-width:1px;color:var(--calcite-ui-text-3);border-block-start-color:var(--calcite-ui-border-input);border-block-end-color:var(--calcite-ui-border-input);border-block-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, \n:host([appearance=transparent][color=inverse]) a, \n: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, \n: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;inline-size:1.5rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;min-block-size: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;inline-size:2rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;min-block-size: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;inline-size:2.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;min-block-size: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;block-size: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;block-size: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;block-size: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{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}";
- /** Passing a 'href' will render an anchor link, instead of a button. Role will be set to link, or button, depending on this. */
- /** It is the consumers responsibility to add aria information, rel, target, for links, and any button attributes for form submission */
- /** @slot - A slot for adding text. */
- class Button {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** Specifies the alignment of the component's elements. */
- this.alignment = "center";
- /** Specifies the appearance style of the component. */
- this.appearance = "solid";
- /** Specifies the color of the component. */
- this.color = "blue";
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /**
- * Accessible name when the component is loading.
- *
- * @default "Loading"
- */
- this.intlLoading = TEXT$n.loading;
- /**
- * When `true`, a busy indicator is displayed and interaction is disabled.
- */
- this.loading = false;
- /** When `true`, adds a round style to the component. */
- this.round = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- /** Specifies if the component is a child of a `calcite-split-button`. */
- this.splitChild = false;
- /**
- * Specifies the default behavior of the button.
- *
- * @mdn [type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type)
- */
- this.type = "button";
- /** Specifies the width of the component. */
- this.width = "auto";
- /** watches for changing text content */
- this.mutationObserver = createObserver();
- /** determine if there is slotted content for styling purposes */
- this.hasContent = false;
- /** determine if loader present for styling purposes */
- this.hasLoader = false;
- // act on a requested or nearby form based on type
- this.handleClick = () => {
- const { type } = this;
- if (this.href) {
- return;
- }
- // this.type refers to type attribute, not child element type
- if (type === "submit") {
- submitForm(this);
- }
- else if (type === "reset") {
- resetForm(this);
- }
- };
- }
- loadingChanged(newValue, oldValue) {
- if (!!newValue && !oldValue) {
- this.hasLoader = true;
- }
- if (!newValue && !!oldValue) {
- window.setTimeout(() => {
- this.hasLoader = false;
- }, 300);
- }
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- this.hasLoader = this.loading;
- this.setupTextContentObserver();
- connectLabel(this);
- this.formEl = closestElementCrossShadowBoundary(this.el, this.form ? `#${this.form}` : "form");
- }
- disconnectedCallback() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- disconnectLabel(this);
- this.formEl = null;
- }
- componentWillLoad() {
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- render() {
- const childElType = this.href ? "a" : "button";
- const Tag = childElType;
- const loaderNode = this.hasLoader ? (hAsync("div", { class: CSS$N.buttonLoader }, hAsync("calcite-loader", { active: true, class: this.loading ? CSS$N.loadingIn : CSS$N.loadingOut, inline: true, label: this.intlLoading, scale: this.scale === "l" ? "m" : "s" }))) : null;
- const iconStartEl = (hAsync("calcite-icon", { class: { [CSS$N.icon]: true, [CSS$N.iconStart]: true }, flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: this.scale === "l" ? "m" : "s" }));
- const iconEndEl = (hAsync("calcite-icon", { class: { [CSS$N.icon]: true, [CSS$N.iconEnd]: true }, flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: this.scale === "l" ? "m" : "s" }));
- const contentEl = (hAsync("span", { class: CSS$N.content }, hAsync("slot", null)));
- return (hAsync(Tag, { "aria-label": getLabelText(this), class: {
- [CSS$N.contentSlotted]: this.hasContent,
- [CSS$N.iconStartEmpty]: !this.iconStart,
- [CSS$N.iconEndEmpty]: !this.iconEnd
- }, 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));
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.childEl) === null || _a === void 0 ? void 0 : _a.focus();
- }
- updateHasContent() {
- var _a, _b;
- const slottedContent = this.el.textContent.trim().length > 0 || this.el.childNodes.length > 0;
- this.hasContent =
- this.el.childNodes.length === 1 && ((_a = this.el.childNodes[0]) === null || _a === void 0 ? void 0 : _a.nodeName) === "#text"
- ? ((_b = this.el.textContent) === null || _b === void 0 ? void 0 : _b.trim().length) > 0
- : slottedContent;
- }
- setupTextContentObserver() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- onLabelClick() {
- this.handleClick();
- this.setFocus();
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "loading": ["loadingChanged"]
- }; }
- static get style() { return buttonCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-button",
- "$members$": {
- "alignment": [513],
- "appearance": [513],
- "label": [1],
- "color": [513],
- "disabled": [516],
- "href": [513],
- "iconEnd": [513, "icon-end"],
- "iconFlipRtl": [513, "icon-flip-rtl"],
- "iconStart": [513, "icon-start"],
- "intlLoading": [1, "intl-loading"],
- "loading": [516],
- "name": [513],
- "rel": [513],
- "form": [1],
- "round": [516],
- "scale": [513],
- "splitChild": [520, "split-child"],
- "target": [513],
- "type": [1537],
- "width": [513],
- "hasContent": [32],
- "hasLoader": [32],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["alignment", "alignment"], ["appearance", "appearance"], ["color", "color"], ["disabled", "disabled"], ["href", "href"], ["iconEnd", "icon-end"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"], ["loading", "loading"], ["name", "name"], ["rel", "rel"], ["round", "round"], ["scale", "scale"], ["splitChild", "split-child"], ["target", "target"], ["type", "type"], ["width", "width"]]
- }; }
- }
- const CSS$M = {
- container: "container",
- header: "header",
- footer: "footer",
- title: "title",
- subtitle: "subtitle",
- checkboxWrapper: "checkbox-wrapper",
- thumbnailWrapper: "thumbnail-wrapper"
- };
- const SLOTS$m = {
- thumbnail: "thumbnail",
- title: "title",
- subtitle: "subtitle",
- footerLeading: "footer-leading",
- footerTrailing: "footer-trailing"
- };
- const TEXT$m = {
- select: "Select",
- deselect: "Deselect",
- loading: "Loading"
- };
- const cardCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-card{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-card{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-card{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-card{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-card:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-card:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-card-h{display:none}/*!@:host*/.sc-calcite-card-h{display:block;max-inline-size:100%}/*!@:host .calcite-card-container*/.sc-calcite-card-h .calcite-card-container.sc-calcite-card{position:relative;display:flex;block-size:100%;flex-direction:column;justify-content:space-between;overflow:hidden;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;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);border-radius:var(--calcite-border-radius-base)}/*!@.container*/.container.sc-calcite-card{position:relative;display:flex;flex:1 1 auto;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;inset:0px;display:flex;align-items:center}/*!@.header, \n.footer*/.header.sc-calcite-card,.footer.sc-calcite-card{display:flex;padding-inline:0.75rem;padding-block:0.75rem 0.25rem}/*!@.header*/.header.sc-calcite-card{flex-direction:column}/*!@.footer*/.footer.sc-calcite-card{margin-block-start:auto;flex-direction:row;align-content:space-between;justify-content:space-between;padding-inline:0.75rem;padding-block:0.25rem 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([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(*), \n*::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)}/*!@:host([selectable]) .header*/[selectable].sc-calcite-card-h .header.sc-calcite-card{padding-inline-end:2rem}/*!@slot[name=subtitle]::slotted(*), \n*::slotted([slot=subtitle])*/slot[name=subtitle].sc-calcite-card-s>*,*.sc-calcite-card-s>[slot=subtitle]{margin:0px;margin-block-start: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), \nimg::slotted([slot=thumbnail])*/slot[name=thumbnail].sc-calcite-card-s>img,img.sc-calcite-card-s>[slot=thumbnail]{min-inline-size:100%;max-inline-size:100%}/*!@slot[name=footer-leading]::slotted(*), \n*::slotted([slot=footer-leading])*/slot[name=footer-leading].sc-calcite-card-s>*,*.sc-calcite-card-s>[slot=footer-leading]{align-self:center;font-size:var(--calcite-font-size--2);line-height:1.375;margin-inline-end:auto}/*!@slot[name=footer-trailing]::slotted(*), \n*::slotted([slot=footer-trailing])*/slot[name=footer-trailing].sc-calcite-card-s>*,*.sc-calcite-card-s>[slot=footer-trailing]{align-self:center;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@.checkbox-wrapper*/.checkbox-wrapper.sc-calcite-card{position:absolute;margin:0px;padding:0px;inset-block-start:0.5rem;inset-inline-end:0.5rem}/*!@.thumbnail-wrapper*/.thumbnail-wrapper.sc-calcite-card{display:flex}/*!@.calcite-card-container.inline*/.calcite-card-container.inline.sc-calcite-card{flex-direction:row}/*!@.calcite-card-container.inline > .container*/.calcite-card-container.inline.sc-calcite-card>.container.sc-calcite-card{inline-size:60%}/*!@.calcite-card-container.inline > .thumbnail-wrapper*/.calcite-card-container.inline.sc-calcite-card>.thumbnail-wrapper.sc-calcite-card{inline-size:40%;align-items:flex-start}/*!@.calcite-card-container.inline slot[name=thumbnail]::slotted(img), \n.calcite-card-container.inline img::slotted([slot=thumbnail])*/.calcite-card-container.inline slot[name=thumbnail].sc-calcite-card-s>img,.calcite-card-container.inline img.sc-calcite-card-s>[slot=thumbnail]{inline-size:100%}/*!@slot[name=footer-leading]::slotted(*), \nslot[name=footer-trailing]::slotted(*)*/slot[name=footer-leading].sc-calcite-card-s>*,slot[name=footer-trailing].sc-calcite-card-s>*{display:flex;gap:0.25rem}";
- /**
- * Cards do not include a grid or bounding container
- * - cards will expand to fit the width of their container
- */
- /**
- * @slot - A slot for adding subheader/description content.
- * @slot thumbnail - A slot for adding a thumbnail to the component.
- * @slot title - A slot for adding a title.
- * @slot subtitle - A slot for adding a subtitle or short summary.
- * @slot footer-leading - A slot for adding a leading footer.
- * @slot footer-trailing - A slot for adding a trailing footer.
- */
- class Card {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteCardSelect = createEvent(this, "calciteCardSelect", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, a busy indicator is displayed. */
- this.loading = false;
- /** When `true`, the component is selected. */
- this.selected = false;
- /** When `true`, the component is selectable. */
- this.selectable = false;
- /**
- * Accessible name when the component is loading.
- *
- * @default "Loading"
- */
- this.intlLoading = TEXT$m.loading;
- /**
- * When `selectable` is `true`, the accessible name for the component's checkbox for selection.
- *
- * @default "Select"
- */
- this.intlSelect = TEXT$m.select;
- /**
- * When `selectable` is `true`, the accessible name for the component's checkbox for deselection.
- *
- * @default "Deselect"
- */
- this.intlDeselect = TEXT$m.deselect;
- /** Sets the placement of the thumbnail defined in the `thumbnail` slot. */
- this.thumbnailPosition = "block-start";
- //--------------------------------------------------------------------------
- //
- // Private State/Props
- //
- //--------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.cardSelectClick = () => {
- this.selectCard();
- };
- this.cardSelectKeyDown = (event) => {
- switch (event.key) {
- case " ":
- case "Enter":
- this.selectCard();
- event.preventDefault();
- break;
- }
- };
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disonnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- render() {
- const thumbnailInline = this.thumbnailPosition.startsWith("inline");
- const thumbnailStart = this.thumbnailPosition.endsWith("start");
- return (hAsync("div", { class: { "calcite-card-container": true, inline: thumbnailInline } }, this.loading ? (hAsync("div", { class: "calcite-card-loader-container" }, hAsync("calcite-loader", { active: true, label: this.intlLoading }))) : null, thumbnailStart && this.renderThumbnail(), hAsync("section", { "aria-busy": toAriaBoolean(this.loading), class: { [CSS$M.container]: true } }, this.selectable ? this.renderCheckbox() : null, this.renderHeader(), hAsync("div", { class: "card-content" }, hAsync("slot", null)), this.renderFooter()), !thumbnailStart && this.renderThumbnail()));
- }
- selectCard() {
- this.selected = !this.selected;
- this.calciteCardSelect.emit();
- }
- renderThumbnail() {
- return getSlotted(this.el, SLOTS$m.thumbnail) ? (hAsync("section", { class: CSS$M.thumbnailWrapper }, hAsync("slot", { name: SLOTS$m.thumbnail }))) : null;
- }
- renderCheckbox() {
- const checkboxLabel = this.selected ? this.intlDeselect : this.intlSelect;
- return (hAsync("calcite-label", { class: CSS$M.checkboxWrapper, onClick: this.cardSelectClick, onKeyDown: this.cardSelectKeyDown }, hAsync("calcite-checkbox", { checked: this.selected, label: checkboxLabel })));
- }
- renderHeader() {
- const { el } = this;
- const title = getSlotted(el, SLOTS$m.title);
- const subtitle = getSlotted(el, SLOTS$m.subtitle);
- const hasHeader = title || subtitle;
- return hasHeader ? (hAsync("header", { class: CSS$M.header }, hAsync("slot", { name: SLOTS$m.title }), hAsync("slot", { name: SLOTS$m.subtitle }))) : null;
- }
- renderFooter() {
- const { el } = this;
- const leadingFooter = getSlotted(el, SLOTS$m.footerLeading);
- const trailingFooter = getSlotted(el, SLOTS$m.footerTrailing);
- const hasFooter = leadingFooter || trailingFooter;
- return hasFooter ? (hAsync("footer", { class: CSS$M.footer }, hAsync("slot", { name: SLOTS$m.footerLeading }), hAsync("slot", { name: SLOTS$m.footerTrailing }))) : null;
- }
- get el() { return getElement(this); }
- static get style() { return cardCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-card",
- "$members$": {
- "loading": [516],
- "selected": [1540],
- "selectable": [516],
- "intlLoading": [1, "intl-loading"],
- "intlSelect": [1, "intl-select"],
- "intlDeselect": [1, "intl-deselect"],
- "thumbnailPosition": [513, "thumbnail-position"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["loading", "loading"], ["selected", "selected"], ["selectable", "selectable"], ["thumbnailPosition", "thumbnail-position"]]
- }; }
- }
- const checkboxCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-checkbox{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-checkbox{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-checkbox{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-checkbox{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-checkbox:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-checkbox:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-checkbox-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-checkbox-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@: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:inline-flex;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}/*!@:host .check-svg,\n:host .toggle*/.sc-calcite-checkbox-h .check-svg.sc-calcite-checkbox,.sc-calcite-checkbox-h .toggle.sc-calcite-checkbox{inline-size:var(--calcite-checkbox-size);block-size:var(--calcite-checkbox-size)}/*!@:host .check-svg*/.sc-calcite-checkbox-h .check-svg.sc-calcite-checkbox{pointer-events:none;box-sizing:border-box;display:block;overflow:hidden;background-color:var(--calcite-ui-foreground-1);fill:currentColor;stroke:currentColor;stroke-width:1;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);color:var(--calcite-ui-background)}/*!@:host([checked]) .check-svg, \n: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);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{box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@.toggle*/.toggle.sc-calcite-checkbox{outline-color:transparent}/*!@.toggle:active, .toggle:focus, .toggle:focus-visible*/.toggle.sc-calcite-checkbox:active,.toggle.sc-calcite-checkbox:focus,.toggle.sc-calcite-checkbox:focus-visible{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@: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]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- class Checkbox {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalCheckboxBlur = createEvent(this, "calciteInternalCheckboxBlur", 6);
- this.calciteCheckboxChange = createEvent(this, "calciteCheckboxChange", 6);
- this.calciteInternalCheckboxFocus = createEvent(this, "calciteInternalCheckboxFocus", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, the component is checked. */
- this.checked = false;
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /**
- * The hovered state of the checkbox.
- *
- * @internal
- */
- this.hovered = false;
- /**
- * When `true`, the component is initially indeterminate, which is independent from its `checked` value.
- *
- * The state is visual only, and can look different across browsers.
- *
- * @mdn [indeterminate](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#indeterminate_state_checkboxes)
- */
- this.indeterminate = false;
- /**
- * When `true`, the component must have a value in order for the form to submit.
- *
- * @internal
- */
- this.required = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- //--------------------------------------------------------------------------
- //
- // Private Properties
- //
- //--------------------------------------------------------------------------
- this.checkedPath = "M5.5 12L2 8.689l.637-.636L5.5 10.727l8.022-7.87.637.637z";
- this.indeterminatePath = "M13 8v1H3V8z";
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.getPath = () => this.indeterminate ? this.indeterminatePath : this.checked ? this.checkedPath : "";
- this.toggle = () => {
- if (!this.disabled) {
- this.checked = !this.checked;
- this.setFocus();
- this.indeterminate = false;
- this.calciteCheckboxChange.emit();
- }
- };
- this.keyDownHandler = (event) => {
- if (isActivationKey(event.key)) {
- this.toggle();
- event.preventDefault();
- }
- };
- this.clickHandler = () => {
- this.toggle();
- };
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- this.onToggleBlur = () => {
- this.calciteInternalCheckboxBlur.emit(false);
- };
- this.onToggleFocus = () => {
- this.calciteInternalCheckboxFocus.emit(true);
- };
- this.onLabelClick = () => {
- this.toggle();
- };
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.toggleEl) === null || _a === void 0 ? void 0 : _a.focus();
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- this.guid = this.el.id || `calcite-checkbox-${guid()}`;
- connectLabel(this);
- connectForm(this);
- }
- disconnectedCallback() {
- disconnectLabel(this);
- disconnectForm(this);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- 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", { "aria-hidden": "true", class: "check-svg", viewBox: "0 0 16 16" }, hAsync("path", { d: this.getPath() })), hAsync("slot", null)), hAsync(HiddenFormInputSlot, { component: this })));
- }
- get el() { return getElement(this); }
- static get style() { return checkboxCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-checkbox",
- "$members$": {
- "checked": [1540],
- "disabled": [516],
- "guid": [1537],
- "hovered": [1540],
- "indeterminate": [1540],
- "label": [1],
- "name": [520],
- "required": [516],
- "scale": [513],
- "value": [8],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["checked", "checked"], ["disabled", "disabled"], ["guid", "guid"], ["hovered", "hovered"], ["indeterminate", "indeterminate"], ["name", "name"], ["required", "required"], ["scale", "scale"]]
- }; }
- }
- const CSS$L = {
- title: "title",
- close: "close",
- imageContainer: "image-container",
- chipIcon: "chip-icon",
- closeIcon: "close-icon"
- };
- const TEXT$l = {
- close: "Close"
- };
- const SLOTS$l = {
- image: "image"
- };
- const ICONS$b = {
- close: "x"
- };
- const chipCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-chip{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-chip{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-chip{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-chip{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-chip:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-chip:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-chip-h{display:none}/*!@:host([scale=s])*/[scale=s].sc-calcite-chip-h{block-size: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{block-size:1.25rem;inline-size:1.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-chip-h{block-size: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{block-size:1.5rem;inline-size:1.5rem;padding-inline-start:0.25rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-chip-h{block-size: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{block-size:2rem;inline-size:2rem;padding-inline-start:0.25rem}/*!@:host*/.sc-calcite-chip-h{box-sizing:border-box;display:inline-flex;cursor:default;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:inline-flex;block-size:100%;max-inline-size:100%;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-block:0;padding-inline:var(--calcite-chip-spacing-unit-l)}/*!@:host([closable]) span*/[closable].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([closable])) span*/[icon].sc-calcite-chip-h:not([closable]) span.sc-calcite-chip{padding-block:0;padding-inline:var(--calcite-chip-spacing-unit-l)}/*!@:host button*/.sc-calcite-chip-h button.sc-calcite-chip{margin:0px;display:inline-flex;max-block-size:100%;min-block-size:100%;cursor:pointer;align-items:center;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-1);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 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-block:0;padding-inline: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:inline-flex;overflow:hidden;border-radius:50%}/*!@:host slot[name=image]::slotted(*)*/.sc-calcite-chip-h slot[name=image].sc-calcite-chip-s>*{display:flex;block-size:100%;inline-size:100%;overflow:hidden;border-radius:50%}/*!@.chip-icon*/.chip-icon.sc-calcite-chip{position:relative;margin-block:0px;display:inline-flex;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);margin-inline-end:0;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])*/[color=blue].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-info);color:var(--calcite-ui-text-inverse)}/*!@:host([color=red])*/[color=red].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-danger);color:var(--calcite-ui-text-inverse)}/*!@:host([color=yellow])*/[color=yellow].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-warning);color:#151515}/*!@:host([color=green])*/[color=green].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-success);color:#151515}/*!@:host([color=grey])*/[color=grey].sc-calcite-chip-h{border-color:transparent;background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}/*!@:host([color=grey]) button,\n:host([color=grey]) .close-icon*/[color=grey].sc-calcite-chip-h button.sc-calcite-chip,[color=grey].sc-calcite-chip-h .close-icon.sc-calcite-chip{color:var(--calcite-ui-text-3)}/*!@:host([color=grey]) .chip-icon*/[color=grey].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}/*!@:host([appearance=clear]), \n:host([appearance=transparent])*/[appearance=clear].sc-calcite-chip-h,[appearance=transparent].sc-calcite-chip-h{background-color:transparent;color:var(--calcite-ui-text-1)}/*!@:host([color=blue][appearance=clear]),\n:host([color=blue][appearance=transparent])*/[color=blue][appearance=clear].sc-calcite-chip-h,[color=blue][appearance=transparent].sc-calcite-chip-h{border-color:var(--calcite-ui-info)}/*!@:host([color=blue][appearance=clear]) .chip-icon,\n:host([color=blue][appearance=transparent]) .chip-icon*/[color=blue][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip,[color=blue][appearance=transparent].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-info))}/*!@:host([color=red][appearance=clear]),\n:host([color=red][appearance=transparent])*/[color=red][appearance=clear].sc-calcite-chip-h,[color=red][appearance=transparent].sc-calcite-chip-h{border-color:var(--calcite-ui-danger)}/*!@:host([color=red][appearance=clear]) .chip-icon,\n:host([color=red][appearance=transparent]) .chip-icon*/[color=red][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip,[color=red][appearance=transparent].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-danger))}/*!@:host([color=yellow][appearance=clear]),\n:host([color=yellow][appearance=transparent])*/[color=yellow][appearance=clear].sc-calcite-chip-h,[color=yellow][appearance=transparent].sc-calcite-chip-h{border-color:var(--calcite-ui-warning)}/*!@:host([color=yellow][appearance=clear]) .chip-icon,\n:host([color=yellow][appearance=transparent]) .chip-icon*/[color=yellow][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip,[color=yellow][appearance=transparent].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-warning))}/*!@:host([color=green][appearance=clear]),\n:host([color=green][appearance=transparent])*/[color=green][appearance=clear].sc-calcite-chip-h,[color=green][appearance=transparent].sc-calcite-chip-h{border-color:var(--calcite-ui-success)}/*!@:host([color=green][appearance=clear]) .chip-icon,\n:host([color=green][appearance=transparent]) .chip-icon*/[color=green][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip,[color=green][appearance=transparent].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-success))}/*!@:host([color=grey][appearance=clear]),\n:host([color=grey][appearance=transparent])*/[color=grey][appearance=clear].sc-calcite-chip-h,[color=grey][appearance=transparent].sc-calcite-chip-h{border-color:var(--calcite-ui-border-1)}/*!@:host([color=grey][appearance=clear]) .chip-icon,\n:host([color=grey][appearance=transparent]) .chip-icon*/[color=grey][appearance=clear].sc-calcite-chip-h .chip-icon.sc-calcite-chip,[color=grey][appearance=transparent].sc-calcite-chip-h .chip-icon.sc-calcite-chip{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}/*!@:host([closed])*/[closed].sc-calcite-chip-h{display:none}";
- /**
- * @slot - A slot for adding text.
- * @slot image - A slot for adding an image.
- */
- class Chip {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteChipDismiss = createEvent(this, "calciteChipDismiss", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /** Specifies the appearance style of the component. */
- this.appearance = "solid";
- /** Specifies the color for the component. */
- this.color = "grey";
- /**
- * When `true`, a close button is added to the component.
- *
- * @deprecated use `closable` instead.
- */
- this.dismissible = false;
- /** When `true`, a close button is added to the component. */
- this.closable = false;
- /**
- * Accessible name for the component's close button.
- *
- * @default "Close"
- */
- this.dismissLabel = TEXT$l.close;
- /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
- this.iconFlipRtl = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- /** When `true`, hides the component. */
- this.closed = false;
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.closeClickHandler = (event) => {
- event.preventDefault();
- this.calciteChipDismiss.emit(this.el);
- this.closed = true;
- };
- this.guid = guid();
- }
- handleDismissible(value) {
- this.closable = value;
- }
- handleClosable(value) {
- this.dismissible = value;
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- if (this.dismissible) {
- this.handleDismissible(this.dismissible);
- }
- if (this.closable) {
- this.handleClosable(this.closable);
- }
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.closeButton) === null || _a === void 0 ? void 0 : _a.focus();
- }
- //--------------------------------------------------------------------------
- //
- // Render Methods
- //
- //--------------------------------------------------------------------------
- renderChipImage() {
- const { el } = this;
- const hasChipImage = getSlotted(el, SLOTS$l.image);
- return hasChipImage ? (hAsync("div", { class: CSS$L.imageContainer, key: "image" }, hAsync("slot", { name: SLOTS$l.image }))) : null;
- }
- render() {
- const iconEl = (hAsync("calcite-icon", { class: CSS$L.chipIcon, flipRtl: this.iconFlipRtl, icon: this.icon, scale: "s" }));
- const closeButton = (hAsync("button", { "aria-describedby": this.guid, "aria-label": this.dismissLabel, class: CSS$L.close, onClick: this.closeClickHandler, ref: (el) => (this.closeButton = el) }, hAsync("calcite-icon", { class: CSS$L.closeIcon, icon: ICONS$b.close, scale: "s" })));
- return (hAsync("div", { class: "container" }, this.renderChipImage(), this.icon ? iconEl : null, hAsync("span", { class: CSS$L.title, id: this.guid }, hAsync("slot", null)), this.closable ? closeButton : null));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "dismissible": ["handleDismissible"],
- "closable": ["handleClosable"]
- }; }
- static get style() { return chipCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-chip",
- "$members$": {
- "appearance": [513],
- "color": [513],
- "dismissible": [1540],
- "closable": [1540],
- "dismissLabel": [1, "dismiss-label"],
- "icon": [513],
- "iconFlipRtl": [516, "icon-flip-rtl"],
- "scale": [513],
- "value": [8],
- "closed": [1540],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["appearance", "appearance"], ["color", "color"], ["dismissible", "dismissible"], ["closable", "closable"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["scale", "scale"], ["closed", "closed"]]
- }; }
- }
- function createCommonjsModule(fn, basedir, module) {
- return module = {
- path: basedir,
- exports: {},
- require: function (path, base) {
- return commonjsRequire();
- }
- }, fn(module, module.exports), module.exports;
- }
- function commonjsRequire () {
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
- }
- var colorName$1 = {
- "aliceblue": [240, 248, 255],
- "antiquewhite": [250, 235, 215],
- "aqua": [0, 255, 255],
- "aquamarine": [127, 255, 212],
- "azure": [240, 255, 255],
- "beige": [245, 245, 220],
- "bisque": [255, 228, 196],
- "black": [0, 0, 0],
- "blanchedalmond": [255, 235, 205],
- "blue": [0, 0, 255],
- "blueviolet": [138, 43, 226],
- "brown": [165, 42, 42],
- "burlywood": [222, 184, 135],
- "cadetblue": [95, 158, 160],
- "chartreuse": [127, 255, 0],
- "chocolate": [210, 105, 30],
- "coral": [255, 127, 80],
- "cornflowerblue": [100, 149, 237],
- "cornsilk": [255, 248, 220],
- "crimson": [220, 20, 60],
- "cyan": [0, 255, 255],
- "darkblue": [0, 0, 139],
- "darkcyan": [0, 139, 139],
- "darkgoldenrod": [184, 134, 11],
- "darkgray": [169, 169, 169],
- "darkgreen": [0, 100, 0],
- "darkgrey": [169, 169, 169],
- "darkkhaki": [189, 183, 107],
- "darkmagenta": [139, 0, 139],
- "darkolivegreen": [85, 107, 47],
- "darkorange": [255, 140, 0],
- "darkorchid": [153, 50, 204],
- "darkred": [139, 0, 0],
- "darksalmon": [233, 150, 122],
- "darkseagreen": [143, 188, 143],
- "darkslateblue": [72, 61, 139],
- "darkslategray": [47, 79, 79],
- "darkslategrey": [47, 79, 79],
- "darkturquoise": [0, 206, 209],
- "darkviolet": [148, 0, 211],
- "deeppink": [255, 20, 147],
- "deepskyblue": [0, 191, 255],
- "dimgray": [105, 105, 105],
- "dimgrey": [105, 105, 105],
- "dodgerblue": [30, 144, 255],
- "firebrick": [178, 34, 34],
- "floralwhite": [255, 250, 240],
- "forestgreen": [34, 139, 34],
- "fuchsia": [255, 0, 255],
- "gainsboro": [220, 220, 220],
- "ghostwhite": [248, 248, 255],
- "gold": [255, 215, 0],
- "goldenrod": [218, 165, 32],
- "gray": [128, 128, 128],
- "green": [0, 128, 0],
- "greenyellow": [173, 255, 47],
- "grey": [128, 128, 128],
- "honeydew": [240, 255, 240],
- "hotpink": [255, 105, 180],
- "indianred": [205, 92, 92],
- "indigo": [75, 0, 130],
- "ivory": [255, 255, 240],
- "khaki": [240, 230, 140],
- "lavender": [230, 230, 250],
- "lavenderblush": [255, 240, 245],
- "lawngreen": [124, 252, 0],
- "lemonchiffon": [255, 250, 205],
- "lightblue": [173, 216, 230],
- "lightcoral": [240, 128, 128],
- "lightcyan": [224, 255, 255],
- "lightgoldenrodyellow": [250, 250, 210],
- "lightgray": [211, 211, 211],
- "lightgreen": [144, 238, 144],
- "lightgrey": [211, 211, 211],
- "lightpink": [255, 182, 193],
- "lightsalmon": [255, 160, 122],
- "lightseagreen": [32, 178, 170],
- "lightskyblue": [135, 206, 250],
- "lightslategray": [119, 136, 153],
- "lightslategrey": [119, 136, 153],
- "lightsteelblue": [176, 196, 222],
- "lightyellow": [255, 255, 224],
- "lime": [0, 255, 0],
- "limegreen": [50, 205, 50],
- "linen": [250, 240, 230],
- "magenta": [255, 0, 255],
- "maroon": [128, 0, 0],
- "mediumaquamarine": [102, 205, 170],
- "mediumblue": [0, 0, 205],
- "mediumorchid": [186, 85, 211],
- "mediumpurple": [147, 112, 219],
- "mediumseagreen": [60, 179, 113],
- "mediumslateblue": [123, 104, 238],
- "mediumspringgreen": [0, 250, 154],
- "mediumturquoise": [72, 209, 204],
- "mediumvioletred": [199, 21, 133],
- "midnightblue": [25, 25, 112],
- "mintcream": [245, 255, 250],
- "mistyrose": [255, 228, 225],
- "moccasin": [255, 228, 181],
- "navajowhite": [255, 222, 173],
- "navy": [0, 0, 128],
- "oldlace": [253, 245, 230],
- "olive": [128, 128, 0],
- "olivedrab": [107, 142, 35],
- "orange": [255, 165, 0],
- "orangered": [255, 69, 0],
- "orchid": [218, 112, 214],
- "palegoldenrod": [238, 232, 170],
- "palegreen": [152, 251, 152],
- "paleturquoise": [175, 238, 238],
- "palevioletred": [219, 112, 147],
- "papayawhip": [255, 239, 213],
- "peachpuff": [255, 218, 185],
- "peru": [205, 133, 63],
- "pink": [255, 192, 203],
- "plum": [221, 160, 221],
- "powderblue": [176, 224, 230],
- "purple": [128, 0, 128],
- "rebeccapurple": [102, 51, 153],
- "red": [255, 0, 0],
- "rosybrown": [188, 143, 143],
- "royalblue": [65, 105, 225],
- "saddlebrown": [139, 69, 19],
- "salmon": [250, 128, 114],
- "sandybrown": [244, 164, 96],
- "seagreen": [46, 139, 87],
- "seashell": [255, 245, 238],
- "sienna": [160, 82, 45],
- "silver": [192, 192, 192],
- "skyblue": [135, 206, 235],
- "slateblue": [106, 90, 205],
- "slategray": [112, 128, 144],
- "slategrey": [112, 128, 144],
- "snow": [255, 250, 250],
- "springgreen": [0, 255, 127],
- "steelblue": [70, 130, 180],
- "tan": [210, 180, 140],
- "teal": [0, 128, 128],
- "thistle": [216, 191, 216],
- "tomato": [255, 99, 71],
- "turquoise": [64, 224, 208],
- "violet": [238, 130, 238],
- "wheat": [245, 222, 179],
- "white": [255, 255, 255],
- "whitesmoke": [245, 245, 245],
- "yellow": [255, 255, 0],
- "yellowgreen": [154, 205, 50]
- };
- var isArrayish = function isArrayish(obj) {
- if (!obj || typeof obj === 'string') {
- return false;
- }
- return obj instanceof Array || Array.isArray(obj) ||
- (obj.length >= 0 && (obj.splice instanceof Function ||
- (Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
- };
- var simpleSwizzle = createCommonjsModule(function (module) {
- var concat = Array.prototype.concat;
- var slice = Array.prototype.slice;
- var swizzle = module.exports = function swizzle(args) {
- var results = [];
- for (var i = 0, len = args.length; i < len; i++) {
- var arg = args[i];
- if (isArrayish(arg)) {
- // http://jsperf.com/javascript-array-concat-vs-push/98
- results = concat.call(results, slice.call(arg));
- } else {
- results.push(arg);
- }
- }
- return results;
- };
- swizzle.wrap = function (fn) {
- return function () {
- return fn(swizzle(arguments));
- };
- };
- });
- var colorString = createCommonjsModule(function (module) {
- /* MIT license */
- var hasOwnProperty = Object.hasOwnProperty;
- var reverseNames = {};
- // create a list of reverse color names
- for (var name in colorName$1) {
- if (hasOwnProperty.call(colorName$1, name)) {
- reverseNames[colorName$1[name]] = name;
- }
- }
- var cs = module.exports = {
- to: {},
- get: {}
- };
- cs.get = function (string) {
- var prefix = string.substring(0, 3).toLowerCase();
- var val;
- var model;
- switch (prefix) {
- case 'hsl':
- val = cs.get.hsl(string);
- model = 'hsl';
- break;
- case 'hwb':
- val = cs.get.hwb(string);
- model = 'hwb';
- break;
- default:
- val = cs.get.rgb(string);
- model = 'rgb';
- break;
- }
- if (!val) {
- return null;
- }
- return {model: model, value: val};
- };
- cs.get.rgb = function (string) {
- if (!string) {
- return null;
- }
- var abbr = /^#([a-f0-9]{3,4})$/i;
- var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
- var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
- var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
- var keyword = /^(\w+)$/;
- var rgb = [0, 0, 0, 1];
- var match;
- var i;
- var hexAlpha;
- if (match = string.match(hex)) {
- hexAlpha = match[2];
- match = match[1];
- for (i = 0; i < 3; i++) {
- // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
- var i2 = i * 2;
- rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
- }
- if (hexAlpha) {
- rgb[3] = parseInt(hexAlpha, 16) / 255;
- }
- } else if (match = string.match(abbr)) {
- match = match[1];
- hexAlpha = match[3];
- for (i = 0; i < 3; i++) {
- rgb[i] = parseInt(match[i] + match[i], 16);
- }
- if (hexAlpha) {
- rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
- }
- } else if (match = string.match(rgba)) {
- for (i = 0; i < 3; i++) {
- rgb[i] = parseInt(match[i + 1], 0);
- }
- if (match[4]) {
- if (match[5]) {
- rgb[3] = parseFloat(match[4]) * 0.01;
- } else {
- rgb[3] = parseFloat(match[4]);
- }
- }
- } else if (match = string.match(per)) {
- for (i = 0; i < 3; i++) {
- rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
- }
- if (match[4]) {
- if (match[5]) {
- rgb[3] = parseFloat(match[4]) * 0.01;
- } else {
- rgb[3] = parseFloat(match[4]);
- }
- }
- } else if (match = string.match(keyword)) {
- if (match[1] === 'transparent') {
- return [0, 0, 0, 0];
- }
- if (!hasOwnProperty.call(colorName$1, match[1])) {
- return null;
- }
- rgb = colorName$1[match[1]];
- rgb[3] = 1;
- return rgb;
- } else {
- return null;
- }
- for (i = 0; i < 3; i++) {
- rgb[i] = clamp(rgb[i], 0, 255);
- }
- rgb[3] = clamp(rgb[3], 0, 1);
- return rgb;
- };
- cs.get.hsl = function (string) {
- if (!string) {
- return null;
- }
- 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*)?\)$/;
- var match = string.match(hsl);
- if (match) {
- var alpha = parseFloat(match[4]);
- var h = ((parseFloat(match[1]) % 360) + 360) % 360;
- var s = clamp(parseFloat(match[2]), 0, 100);
- var l = clamp(parseFloat(match[3]), 0, 100);
- var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
- return [h, s, l, a];
- }
- return null;
- };
- cs.get.hwb = function (string) {
- if (!string) {
- return null;
- }
- 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*)?\)$/;
- var match = string.match(hwb);
- if (match) {
- var alpha = parseFloat(match[4]);
- var h = ((parseFloat(match[1]) % 360) + 360) % 360;
- var w = clamp(parseFloat(match[2]), 0, 100);
- var b = clamp(parseFloat(match[3]), 0, 100);
- var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
- return [h, w, b, a];
- }
- return null;
- };
- cs.to.hex = function () {
- var rgba = simpleSwizzle(arguments);
- return (
- '#' +
- hexDouble(rgba[0]) +
- hexDouble(rgba[1]) +
- hexDouble(rgba[2]) +
- (rgba[3] < 1
- ? (hexDouble(Math.round(rgba[3] * 255)))
- : '')
- );
- };
- cs.to.rgb = function () {
- var rgba = simpleSwizzle(arguments);
- return rgba.length < 4 || rgba[3] === 1
- ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'
- : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
- };
- cs.to.rgb.percent = function () {
- var rgba = simpleSwizzle(arguments);
- var r = Math.round(rgba[0] / 255 * 100);
- var g = Math.round(rgba[1] / 255 * 100);
- var b = Math.round(rgba[2] / 255 * 100);
- return rgba.length < 4 || rgba[3] === 1
- ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'
- : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
- };
- cs.to.hsl = function () {
- var hsla = simpleSwizzle(arguments);
- return hsla.length < 4 || hsla[3] === 1
- ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
- : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
- };
- // hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
- // (hwb have alpha optional & 1 is default value)
- cs.to.hwb = function () {
- var hwba = simpleSwizzle(arguments);
- var a = '';
- if (hwba.length >= 4 && hwba[3] !== 1) {
- a = ', ' + hwba[3];
- }
- return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
- };
- cs.to.keyword = function (rgb) {
- return reverseNames[rgb.slice(0, 3)];
- };
- // helpers
- function clamp(num, min, max) {
- return Math.min(Math.max(min, num), max);
- }
- function hexDouble(num) {
- var str = Math.round(num).toString(16).toUpperCase();
- return (str.length < 2) ? '0' + str : str;
- }
- });
- var colorName = {
- "aliceblue": [240, 248, 255],
- "antiquewhite": [250, 235, 215],
- "aqua": [0, 255, 255],
- "aquamarine": [127, 255, 212],
- "azure": [240, 255, 255],
- "beige": [245, 245, 220],
- "bisque": [255, 228, 196],
- "black": [0, 0, 0],
- "blanchedalmond": [255, 235, 205],
- "blue": [0, 0, 255],
- "blueviolet": [138, 43, 226],
- "brown": [165, 42, 42],
- "burlywood": [222, 184, 135],
- "cadetblue": [95, 158, 160],
- "chartreuse": [127, 255, 0],
- "chocolate": [210, 105, 30],
- "coral": [255, 127, 80],
- "cornflowerblue": [100, 149, 237],
- "cornsilk": [255, 248, 220],
- "crimson": [220, 20, 60],
- "cyan": [0, 255, 255],
- "darkblue": [0, 0, 139],
- "darkcyan": [0, 139, 139],
- "darkgoldenrod": [184, 134, 11],
- "darkgray": [169, 169, 169],
- "darkgreen": [0, 100, 0],
- "darkgrey": [169, 169, 169],
- "darkkhaki": [189, 183, 107],
- "darkmagenta": [139, 0, 139],
- "darkolivegreen": [85, 107, 47],
- "darkorange": [255, 140, 0],
- "darkorchid": [153, 50, 204],
- "darkred": [139, 0, 0],
- "darksalmon": [233, 150, 122],
- "darkseagreen": [143, 188, 143],
- "darkslateblue": [72, 61, 139],
- "darkslategray": [47, 79, 79],
- "darkslategrey": [47, 79, 79],
- "darkturquoise": [0, 206, 209],
- "darkviolet": [148, 0, 211],
- "deeppink": [255, 20, 147],
- "deepskyblue": [0, 191, 255],
- "dimgray": [105, 105, 105],
- "dimgrey": [105, 105, 105],
- "dodgerblue": [30, 144, 255],
- "firebrick": [178, 34, 34],
- "floralwhite": [255, 250, 240],
- "forestgreen": [34, 139, 34],
- "fuchsia": [255, 0, 255],
- "gainsboro": [220, 220, 220],
- "ghostwhite": [248, 248, 255],
- "gold": [255, 215, 0],
- "goldenrod": [218, 165, 32],
- "gray": [128, 128, 128],
- "green": [0, 128, 0],
- "greenyellow": [173, 255, 47],
- "grey": [128, 128, 128],
- "honeydew": [240, 255, 240],
- "hotpink": [255, 105, 180],
- "indianred": [205, 92, 92],
- "indigo": [75, 0, 130],
- "ivory": [255, 255, 240],
- "khaki": [240, 230, 140],
- "lavender": [230, 230, 250],
- "lavenderblush": [255, 240, 245],
- "lawngreen": [124, 252, 0],
- "lemonchiffon": [255, 250, 205],
- "lightblue": [173, 216, 230],
- "lightcoral": [240, 128, 128],
- "lightcyan": [224, 255, 255],
- "lightgoldenrodyellow": [250, 250, 210],
- "lightgray": [211, 211, 211],
- "lightgreen": [144, 238, 144],
- "lightgrey": [211, 211, 211],
- "lightpink": [255, 182, 193],
- "lightsalmon": [255, 160, 122],
- "lightseagreen": [32, 178, 170],
- "lightskyblue": [135, 206, 250],
- "lightslategray": [119, 136, 153],
- "lightslategrey": [119, 136, 153],
- "lightsteelblue": [176, 196, 222],
- "lightyellow": [255, 255, 224],
- "lime": [0, 255, 0],
- "limegreen": [50, 205, 50],
- "linen": [250, 240, 230],
- "magenta": [255, 0, 255],
- "maroon": [128, 0, 0],
- "mediumaquamarine": [102, 205, 170],
- "mediumblue": [0, 0, 205],
- "mediumorchid": [186, 85, 211],
- "mediumpurple": [147, 112, 219],
- "mediumseagreen": [60, 179, 113],
- "mediumslateblue": [123, 104, 238],
- "mediumspringgreen": [0, 250, 154],
- "mediumturquoise": [72, 209, 204],
- "mediumvioletred": [199, 21, 133],
- "midnightblue": [25, 25, 112],
- "mintcream": [245, 255, 250],
- "mistyrose": [255, 228, 225],
- "moccasin": [255, 228, 181],
- "navajowhite": [255, 222, 173],
- "navy": [0, 0, 128],
- "oldlace": [253, 245, 230],
- "olive": [128, 128, 0],
- "olivedrab": [107, 142, 35],
- "orange": [255, 165, 0],
- "orangered": [255, 69, 0],
- "orchid": [218, 112, 214],
- "palegoldenrod": [238, 232, 170],
- "palegreen": [152, 251, 152],
- "paleturquoise": [175, 238, 238],
- "palevioletred": [219, 112, 147],
- "papayawhip": [255, 239, 213],
- "peachpuff": [255, 218, 185],
- "peru": [205, 133, 63],
- "pink": [255, 192, 203],
- "plum": [221, 160, 221],
- "powderblue": [176, 224, 230],
- "purple": [128, 0, 128],
- "rebeccapurple": [102, 51, 153],
- "red": [255, 0, 0],
- "rosybrown": [188, 143, 143],
- "royalblue": [65, 105, 225],
- "saddlebrown": [139, 69, 19],
- "salmon": [250, 128, 114],
- "sandybrown": [244, 164, 96],
- "seagreen": [46, 139, 87],
- "seashell": [255, 245, 238],
- "sienna": [160, 82, 45],
- "silver": [192, 192, 192],
- "skyblue": [135, 206, 235],
- "slateblue": [106, 90, 205],
- "slategray": [112, 128, 144],
- "slategrey": [112, 128, 144],
- "snow": [255, 250, 250],
- "springgreen": [0, 255, 127],
- "steelblue": [70, 130, 180],
- "tan": [210, 180, 140],
- "teal": [0, 128, 128],
- "thistle": [216, 191, 216],
- "tomato": [255, 99, 71],
- "turquoise": [64, 224, 208],
- "violet": [238, 130, 238],
- "wheat": [245, 222, 179],
- "white": [255, 255, 255],
- "whitesmoke": [245, 245, 245],
- "yellow": [255, 255, 0],
- "yellowgreen": [154, 205, 50]
- };
- /* MIT license */
- /* eslint-disable no-mixed-operators */
- // NOTE: conversions should only return primitive values (i.e. arrays, or
- // values that give correct `typeof` results).
- // do not use box values types (i.e. Number(), String(), etc.)
- const reverseKeywords = {};
- for (const key of Object.keys(colorName)) {
- reverseKeywords[colorName[key]] = key;
- }
- const convert$1 = {
- rgb: {channels: 3, labels: 'rgb'},
- hsl: {channels: 3, labels: 'hsl'},
- hsv: {channels: 3, labels: 'hsv'},
- hwb: {channels: 3, labels: 'hwb'},
- cmyk: {channels: 4, labels: 'cmyk'},
- xyz: {channels: 3, labels: 'xyz'},
- lab: {channels: 3, labels: 'lab'},
- lch: {channels: 3, labels: 'lch'},
- hex: {channels: 1, labels: ['hex']},
- keyword: {channels: 1, labels: ['keyword']},
- ansi16: {channels: 1, labels: ['ansi16']},
- ansi256: {channels: 1, labels: ['ansi256']},
- hcg: {channels: 3, labels: ['h', 'c', 'g']},
- apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
- gray: {channels: 1, labels: ['gray']}
- };
- var conversions = convert$1;
- // Hide .channels and .labels properties
- for (const model of Object.keys(convert$1)) {
- if (!('channels' in convert$1[model])) {
- throw new Error('missing channels property: ' + model);
- }
- if (!('labels' in convert$1[model])) {
- throw new Error('missing channel labels property: ' + model);
- }
- if (convert$1[model].labels.length !== convert$1[model].channels) {
- throw new Error('channel and label counts mismatch: ' + model);
- }
- const {channels, labels} = convert$1[model];
- delete convert$1[model].channels;
- delete convert$1[model].labels;
- Object.defineProperty(convert$1[model], 'channels', {value: channels});
- Object.defineProperty(convert$1[model], 'labels', {value: labels});
- }
- convert$1.rgb.hsl = function (rgb) {
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
- const min = Math.min(r, g, b);
- const max = Math.max(r, g, b);
- const delta = max - min;
- let h;
- let s;
- if (max === min) {
- h = 0;
- } else if (r === max) {
- h = (g - b) / delta;
- } else if (g === max) {
- h = 2 + (b - r) / delta;
- } else if (b === max) {
- h = 4 + (r - g) / delta;
- }
- h = Math.min(h * 60, 360);
- if (h < 0) {
- h += 360;
- }
- const l = (min + max) / 2;
- if (max === min) {
- s = 0;
- } else if (l <= 0.5) {
- s = delta / (max + min);
- } else {
- s = delta / (2 - max - min);
- }
- return [h, s * 100, l * 100];
- };
- convert$1.rgb.hsv = function (rgb) {
- let rdif;
- let gdif;
- let bdif;
- let h;
- let s;
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
- const v = Math.max(r, g, b);
- const diff = v - Math.min(r, g, b);
- const diffc = function (c) {
- return (v - c) / 6 / diff + 1 / 2;
- };
- if (diff === 0) {
- h = 0;
- s = 0;
- } else {
- s = diff / v;
- rdif = diffc(r);
- gdif = diffc(g);
- bdif = diffc(b);
- if (r === v) {
- h = bdif - gdif;
- } else if (g === v) {
- h = (1 / 3) + rdif - bdif;
- } else if (b === v) {
- h = (2 / 3) + gdif - rdif;
- }
- if (h < 0) {
- h += 1;
- } else if (h > 1) {
- h -= 1;
- }
- }
- return [
- h * 360,
- s * 100,
- v * 100
- ];
- };
- convert$1.rgb.hwb = function (rgb) {
- const r = rgb[0];
- const g = rgb[1];
- let b = rgb[2];
- const h = convert$1.rgb.hsl(rgb)[0];
- const w = 1 / 255 * Math.min(r, Math.min(g, b));
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
- return [h, w * 100, b * 100];
- };
- convert$1.rgb.cmyk = function (rgb) {
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
- const k = Math.min(1 - r, 1 - g, 1 - b);
- const c = (1 - r - k) / (1 - k) || 0;
- const m = (1 - g - k) / (1 - k) || 0;
- const y = (1 - b - k) / (1 - k) || 0;
- return [c * 100, m * 100, y * 100, k * 100];
- };
- function comparativeDistance(x, y) {
- /*
- See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
- */
- return (
- ((x[0] - y[0]) ** 2) +
- ((x[1] - y[1]) ** 2) +
- ((x[2] - y[2]) ** 2)
- );
- }
- convert$1.rgb.keyword = function (rgb) {
- const reversed = reverseKeywords[rgb];
- if (reversed) {
- return reversed;
- }
- let currentClosestDistance = Infinity;
- let currentClosestKeyword;
- for (const keyword of Object.keys(colorName)) {
- const value = colorName[keyword];
- // Compute comparative distance
- const distance = comparativeDistance(rgb, value);
- // Check if its less, if so set as closest
- if (distance < currentClosestDistance) {
- currentClosestDistance = distance;
- currentClosestKeyword = keyword;
- }
- }
- return currentClosestKeyword;
- };
- convert$1.keyword.rgb = function (keyword) {
- return colorName[keyword];
- };
- convert$1.rgb.xyz = function (rgb) {
- let r = rgb[0] / 255;
- let g = rgb[1] / 255;
- let b = rgb[2] / 255;
- // Assume sRGB
- r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
- g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
- b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
- const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
- const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
- const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
- return [x * 100, y * 100, z * 100];
- };
- convert$1.rgb.lab = function (rgb) {
- const xyz = convert$1.rgb.xyz(rgb);
- let x = xyz[0];
- let y = xyz[1];
- let z = xyz[2];
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
- y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
- z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
- const l = (116 * y) - 16;
- const a = 500 * (x - y);
- const b = 200 * (y - z);
- return [l, a, b];
- };
- convert$1.hsl.rgb = function (hsl) {
- const h = hsl[0] / 360;
- const s = hsl[1] / 100;
- const l = hsl[2] / 100;
- let t2;
- let t3;
- let val;
- if (s === 0) {
- val = l * 255;
- return [val, val, val];
- }
- if (l < 0.5) {
- t2 = l * (1 + s);
- } else {
- t2 = l + s - l * s;
- }
- const t1 = 2 * l - t2;
- const rgb = [0, 0, 0];
- for (let i = 0; i < 3; i++) {
- t3 = h + 1 / 3 * -(i - 1);
- if (t3 < 0) {
- t3++;
- }
- if (t3 > 1) {
- t3--;
- }
- if (6 * t3 < 1) {
- val = t1 + (t2 - t1) * 6 * t3;
- } else if (2 * t3 < 1) {
- val = t2;
- } else if (3 * t3 < 2) {
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
- } else {
- val = t1;
- }
- rgb[i] = val * 255;
- }
- return rgb;
- };
- convert$1.hsl.hsv = function (hsl) {
- const h = hsl[0];
- let s = hsl[1] / 100;
- let l = hsl[2] / 100;
- let smin = s;
- const lmin = Math.max(l, 0.01);
- l *= 2;
- s *= (l <= 1) ? l : 2 - l;
- smin *= lmin <= 1 ? lmin : 2 - lmin;
- const v = (l + s) / 2;
- const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
- return [h, sv * 100, v * 100];
- };
- convert$1.hsv.rgb = function (hsv) {
- const h = hsv[0] / 60;
- const s = hsv[1] / 100;
- let v = hsv[2] / 100;
- const hi = Math.floor(h) % 6;
- const f = h - Math.floor(h);
- const p = 255 * v * (1 - s);
- const q = 255 * v * (1 - (s * f));
- const t = 255 * v * (1 - (s * (1 - f)));
- v *= 255;
- switch (hi) {
- case 0:
- return [v, t, p];
- case 1:
- return [q, v, p];
- case 2:
- return [p, v, t];
- case 3:
- return [p, q, v];
- case 4:
- return [t, p, v];
- case 5:
- return [v, p, q];
- }
- };
- convert$1.hsv.hsl = function (hsv) {
- const h = hsv[0];
- const s = hsv[1] / 100;
- const v = hsv[2] / 100;
- const vmin = Math.max(v, 0.01);
- let sl;
- let l;
- l = (2 - s) * v;
- const lmin = (2 - s) * vmin;
- sl = s * vmin;
- sl /= (lmin <= 1) ? lmin : 2 - lmin;
- sl = sl || 0;
- l /= 2;
- return [h, sl * 100, l * 100];
- };
- // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
- convert$1.hwb.rgb = function (hwb) {
- const h = hwb[0] / 360;
- let wh = hwb[1] / 100;
- let bl = hwb[2] / 100;
- const ratio = wh + bl;
- let f;
- // Wh + bl cant be > 1
- if (ratio > 1) {
- wh /= ratio;
- bl /= ratio;
- }
- const i = Math.floor(6 * h);
- const v = 1 - bl;
- f = 6 * h - i;
- if ((i & 0x01) !== 0) {
- f = 1 - f;
- }
- const n = wh + f * (v - wh); // Linear interpolation
- let r;
- let g;
- let b;
- /* eslint-disable max-statements-per-line,no-multi-spaces */
- switch (i) {
- default:
- case 6:
- case 0: r = v; g = n; b = wh; break;
- case 1: r = n; g = v; b = wh; break;
- case 2: r = wh; g = v; b = n; break;
- case 3: r = wh; g = n; b = v; break;
- case 4: r = n; g = wh; b = v; break;
- case 5: r = v; g = wh; b = n; break;
- }
- /* eslint-enable max-statements-per-line,no-multi-spaces */
- return [r * 255, g * 255, b * 255];
- };
- convert$1.cmyk.rgb = function (cmyk) {
- const c = cmyk[0] / 100;
- const m = cmyk[1] / 100;
- const y = cmyk[2] / 100;
- const k = cmyk[3] / 100;
- const r = 1 - Math.min(1, c * (1 - k) + k);
- const g = 1 - Math.min(1, m * (1 - k) + k);
- const b = 1 - Math.min(1, y * (1 - k) + k);
- return [r * 255, g * 255, b * 255];
- };
- convert$1.xyz.rgb = function (xyz) {
- const x = xyz[0] / 100;
- const y = xyz[1] / 100;
- const z = xyz[2] / 100;
- let r;
- let g;
- let b;
- r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
- g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
- b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
- // Assume sRGB
- r = r > 0.0031308
- ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
- : r * 12.92;
- g = g > 0.0031308
- ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
- : g * 12.92;
- b = b > 0.0031308
- ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
- : b * 12.92;
- r = Math.min(Math.max(0, r), 1);
- g = Math.min(Math.max(0, g), 1);
- b = Math.min(Math.max(0, b), 1);
- return [r * 255, g * 255, b * 255];
- };
- convert$1.xyz.lab = function (xyz) {
- let x = xyz[0];
- let y = xyz[1];
- let z = xyz[2];
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
- y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
- z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
- const l = (116 * y) - 16;
- const a = 500 * (x - y);
- const b = 200 * (y - z);
- return [l, a, b];
- };
- convert$1.lab.xyz = function (lab) {
- const l = lab[0];
- const a = lab[1];
- const b = lab[2];
- let x;
- let y;
- let z;
- y = (l + 16) / 116;
- x = a / 500 + y;
- z = y - b / 200;
- const y2 = y ** 3;
- const x2 = x ** 3;
- const z2 = z ** 3;
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
- x *= 95.047;
- y *= 100;
- z *= 108.883;
- return [x, y, z];
- };
- convert$1.lab.lch = function (lab) {
- const l = lab[0];
- const a = lab[1];
- const b = lab[2];
- let h;
- const hr = Math.atan2(b, a);
- h = hr * 360 / 2 / Math.PI;
- if (h < 0) {
- h += 360;
- }
- const c = Math.sqrt(a * a + b * b);
- return [l, c, h];
- };
- convert$1.lch.lab = function (lch) {
- const l = lch[0];
- const c = lch[1];
- const h = lch[2];
- const hr = h / 360 * 2 * Math.PI;
- const a = c * Math.cos(hr);
- const b = c * Math.sin(hr);
- return [l, a, b];
- };
- convert$1.rgb.ansi16 = function (args, saturation = null) {
- const [r, g, b] = args;
- let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
- value = Math.round(value / 50);
- if (value === 0) {
- return 30;
- }
- let ansi = 30
- + ((Math.round(b / 255) << 2)
- | (Math.round(g / 255) << 1)
- | Math.round(r / 255));
- if (value === 2) {
- ansi += 60;
- }
- return ansi;
- };
- convert$1.hsv.ansi16 = function (args) {
- // Optimization here; we already know the value and don't need to get
- // it converted for us.
- return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
- };
- convert$1.rgb.ansi256 = function (args) {
- const r = args[0];
- const g = args[1];
- const b = args[2];
- // We use the extended greyscale palette here, with the exception of
- // black and white. normal palette only has 4 greyscale shades.
- if (r === g && g === b) {
- if (r < 8) {
- return 16;
- }
- if (r > 248) {
- return 231;
- }
- return Math.round(((r - 8) / 247) * 24) + 232;
- }
- const ansi = 16
- + (36 * Math.round(r / 255 * 5))
- + (6 * Math.round(g / 255 * 5))
- + Math.round(b / 255 * 5);
- return ansi;
- };
- convert$1.ansi16.rgb = function (args) {
- let color = args % 10;
- // Handle greyscale
- if (color === 0 || color === 7) {
- if (args > 50) {
- color += 3.5;
- }
- color = color / 10.5 * 255;
- return [color, color, color];
- }
- const mult = (~~(args > 50) + 1) * 0.5;
- const r = ((color & 1) * mult) * 255;
- const g = (((color >> 1) & 1) * mult) * 255;
- const b = (((color >> 2) & 1) * mult) * 255;
- return [r, g, b];
- };
- convert$1.ansi256.rgb = function (args) {
- // Handle greyscale
- if (args >= 232) {
- const c = (args - 232) * 10 + 8;
- return [c, c, c];
- }
- args -= 16;
- let rem;
- const r = Math.floor(args / 36) / 5 * 255;
- const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
- const b = (rem % 6) / 5 * 255;
- return [r, g, b];
- };
- convert$1.rgb.hex = function (args) {
- const integer = ((Math.round(args[0]) & 0xFF) << 16)
- + ((Math.round(args[1]) & 0xFF) << 8)
- + (Math.round(args[2]) & 0xFF);
- const string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
- convert$1.hex.rgb = function (args) {
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
- if (!match) {
- return [0, 0, 0];
- }
- let colorString = match[0];
- if (match[0].length === 3) {
- colorString = colorString.split('').map(char => {
- return char + char;
- }).join('');
- }
- const integer = parseInt(colorString, 16);
- const r = (integer >> 16) & 0xFF;
- const g = (integer >> 8) & 0xFF;
- const b = integer & 0xFF;
- return [r, g, b];
- };
- convert$1.rgb.hcg = function (rgb) {
- const r = rgb[0] / 255;
- const g = rgb[1] / 255;
- const b = rgb[2] / 255;
- const max = Math.max(Math.max(r, g), b);
- const min = Math.min(Math.min(r, g), b);
- const chroma = (max - min);
- let grayscale;
- let hue;
- if (chroma < 1) {
- grayscale = min / (1 - chroma);
- } else {
- grayscale = 0;
- }
- if (chroma <= 0) {
- hue = 0;
- } else
- if (max === r) {
- hue = ((g - b) / chroma) % 6;
- } else
- if (max === g) {
- hue = 2 + (b - r) / chroma;
- } else {
- hue = 4 + (r - g) / chroma;
- }
- hue /= 6;
- hue %= 1;
- return [hue * 360, chroma * 100, grayscale * 100];
- };
- convert$1.hsl.hcg = function (hsl) {
- const s = hsl[1] / 100;
- const l = hsl[2] / 100;
- const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
- let f = 0;
- if (c < 1.0) {
- f = (l - 0.5 * c) / (1.0 - c);
- }
- return [hsl[0], c * 100, f * 100];
- };
- convert$1.hsv.hcg = function (hsv) {
- const s = hsv[1] / 100;
- const v = hsv[2] / 100;
- const c = s * v;
- let f = 0;
- if (c < 1.0) {
- f = (v - c) / (1 - c);
- }
- return [hsv[0], c * 100, f * 100];
- };
- convert$1.hcg.rgb = function (hcg) {
- const h = hcg[0] / 360;
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
- if (c === 0.0) {
- return [g * 255, g * 255, g * 255];
- }
- const pure = [0, 0, 0];
- const hi = (h % 1) * 6;
- const v = hi % 1;
- const w = 1 - v;
- let mg = 0;
- /* eslint-disable max-statements-per-line */
- switch (Math.floor(hi)) {
- case 0:
- pure[0] = 1; pure[1] = v; pure[2] = 0; break;
- case 1:
- pure[0] = w; pure[1] = 1; pure[2] = 0; break;
- case 2:
- pure[0] = 0; pure[1] = 1; pure[2] = v; break;
- case 3:
- pure[0] = 0; pure[1] = w; pure[2] = 1; break;
- case 4:
- pure[0] = v; pure[1] = 0; pure[2] = 1; break;
- default:
- pure[0] = 1; pure[1] = 0; pure[2] = w;
- }
- /* eslint-enable max-statements-per-line */
- mg = (1.0 - c) * g;
- return [
- (c * pure[0] + mg) * 255,
- (c * pure[1] + mg) * 255,
- (c * pure[2] + mg) * 255
- ];
- };
- convert$1.hcg.hsv = function (hcg) {
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
- const v = c + g * (1.0 - c);
- let f = 0;
- if (v > 0.0) {
- f = c / v;
- }
- return [hcg[0], f * 100, v * 100];
- };
- convert$1.hcg.hsl = function (hcg) {
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
- const l = g * (1.0 - c) + 0.5 * c;
- let s = 0;
- if (l > 0.0 && l < 0.5) {
- s = c / (2 * l);
- } else
- if (l >= 0.5 && l < 1.0) {
- s = c / (2 * (1 - l));
- }
- return [hcg[0], s * 100, l * 100];
- };
- convert$1.hcg.hwb = function (hcg) {
- const c = hcg[1] / 100;
- const g = hcg[2] / 100;
- const v = c + g * (1.0 - c);
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
- };
- convert$1.hwb.hcg = function (hwb) {
- const w = hwb[1] / 100;
- const b = hwb[2] / 100;
- const v = 1 - b;
- const c = v - w;
- let g = 0;
- if (c < 1) {
- g = (v - c) / (1 - c);
- }
- return [hwb[0], c * 100, g * 100];
- };
- convert$1.apple.rgb = function (apple) {
- return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
- };
- convert$1.rgb.apple = function (rgb) {
- return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
- };
- convert$1.gray.rgb = function (args) {
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
- };
- convert$1.gray.hsl = function (args) {
- return [0, 0, args[0]];
- };
- convert$1.gray.hsv = convert$1.gray.hsl;
- convert$1.gray.hwb = function (gray) {
- return [0, 100, gray[0]];
- };
- convert$1.gray.cmyk = function (gray) {
- return [0, 0, 0, gray[0]];
- };
- convert$1.gray.lab = function (gray) {
- return [gray[0], 0, 0];
- };
- convert$1.gray.hex = function (gray) {
- const val = Math.round(gray[0] / 100 * 255) & 0xFF;
- const integer = (val << 16) + (val << 8) + val;
- const string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
- convert$1.rgb.gray = function (rgb) {
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
- return [val / 255 * 100];
- };
- /*
- This function routes a model to all other models.
- all functions that are routed have a property `.conversion` attached
- to the returned synthetic function. This property is an array
- of strings, each with the steps in between the 'from' and 'to'
- color models (inclusive).
- conversions that are not possible simply are not included.
- */
- function buildGraph() {
- const graph = {};
- // https://jsperf.com/object-keys-vs-for-in-with-closure/3
- const models = Object.keys(conversions);
- for (let len = models.length, i = 0; i < len; i++) {
- graph[models[i]] = {
- // http://jsperf.com/1-vs-infinity
- // micro-opt, but this is simple.
- distance: -1,
- parent: null
- };
- }
- return graph;
- }
- // https://en.wikipedia.org/wiki/Breadth-first_search
- function deriveBFS(fromModel) {
- const graph = buildGraph();
- const queue = [fromModel]; // Unshift -> queue -> pop
- graph[fromModel].distance = 0;
- while (queue.length) {
- const current = queue.pop();
- const adjacents = Object.keys(conversions[current]);
- for (let len = adjacents.length, i = 0; i < len; i++) {
- const adjacent = adjacents[i];
- const node = graph[adjacent];
- if (node.distance === -1) {
- node.distance = graph[current].distance + 1;
- node.parent = current;
- queue.unshift(adjacent);
- }
- }
- }
- return graph;
- }
- function link(from, to) {
- return function (args) {
- return to(from(args));
- };
- }
- function wrapConversion(toModel, graph) {
- const path = [graph[toModel].parent, toModel];
- let fn = conversions[graph[toModel].parent][toModel];
- let cur = graph[toModel].parent;
- while (graph[cur].parent) {
- path.unshift(graph[cur].parent);
- fn = link(conversions[graph[cur].parent][cur], fn);
- cur = graph[cur].parent;
- }
- fn.conversion = path;
- return fn;
- }
- var route = function (fromModel) {
- const graph = deriveBFS(fromModel);
- const conversion = {};
- const models = Object.keys(graph);
- for (let len = models.length, i = 0; i < len; i++) {
- const toModel = models[i];
- const node = graph[toModel];
- if (node.parent === null) {
- // No possible conversion, or this node is the source model.
- continue;
- }
- conversion[toModel] = wrapConversion(toModel, graph);
- }
- return conversion;
- };
- const convert = {};
- const models = Object.keys(conversions);
- function wrapRaw(fn) {
- const wrappedFn = function (...args) {
- const arg0 = args[0];
- if (arg0 === undefined || arg0 === null) {
- return arg0;
- }
- if (arg0.length > 1) {
- args = arg0;
- }
- return fn(args);
- };
- // Preserve .conversion property if there is one
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
- return wrappedFn;
- }
- function wrapRounded(fn) {
- const wrappedFn = function (...args) {
- const arg0 = args[0];
- if (arg0 === undefined || arg0 === null) {
- return arg0;
- }
- if (arg0.length > 1) {
- args = arg0;
- }
- const result = fn(args);
- // We're assuming the result is an array here.
- // see notice in conversions.js; don't use box types
- // in conversion functions.
- if (typeof result === 'object') {
- for (let len = result.length, i = 0; i < len; i++) {
- result[i] = Math.round(result[i]);
- }
- }
- return result;
- };
- // Preserve .conversion property if there is one
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
- return wrappedFn;
- }
- models.forEach(fromModel => {
- convert[fromModel] = {};
- Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
- Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
- const routes = route(fromModel);
- const routeModels = Object.keys(routes);
- routeModels.forEach(toModel => {
- const fn = routes[toModel];
- convert[fromModel][toModel] = wrapRounded(fn);
- convert[fromModel][toModel].raw = wrapRaw(fn);
- });
- });
- var colorConvert = convert;
- const skippedModels = [
- // To be honest, I don't really feel like keyword belongs in color convert, but eh.
- 'keyword',
- // Gray conflicts with some method names, and has its own method defined.
- 'gray',
- // Shouldn't really be in color-convert either...
- 'hex',
- ];
- const hashedModelKeys = {};
- for (const model of Object.keys(colorConvert)) {
- hashedModelKeys[[...colorConvert[model].labels].sort().join('')] = model;
- }
- const limiters = {};
- function Color(object, model) {
- if (!(this instanceof Color)) {
- return new Color(object, model);
- }
- if (model && model in skippedModels) {
- model = null;
- }
- if (model && !(model in colorConvert)) {
- throw new Error('Unknown model: ' + model);
- }
- let i;
- let channels;
- if (object == null) { // eslint-disable-line no-eq-null,eqeqeq
- this.model = 'rgb';
- this.color = [0, 0, 0];
- this.valpha = 1;
- } else if (object instanceof Color) {
- this.model = object.model;
- this.color = [...object.color];
- this.valpha = object.valpha;
- } else if (typeof object === 'string') {
- const result = colorString.get(object);
- if (result === null) {
- throw new Error('Unable to parse color from string: ' + object);
- }
- this.model = result.model;
- channels = colorConvert[this.model].channels;
- this.color = result.value.slice(0, channels);
- this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
- } else if (object.length > 0) {
- this.model = model || 'rgb';
- channels = colorConvert[this.model].channels;
- const newArray = Array.prototype.slice.call(object, 0, channels);
- this.color = zeroArray(newArray, channels);
- this.valpha = typeof object[channels] === 'number' ? object[channels] : 1;
- } else if (typeof object === 'number') {
- // This is always RGB - can be converted later on.
- this.model = 'rgb';
- this.color = [
- (object >> 16) & 0xFF,
- (object >> 8) & 0xFF,
- object & 0xFF,
- ];
- this.valpha = 1;
- } else {
- this.valpha = 1;
- const keys = Object.keys(object);
- if ('alpha' in object) {
- keys.splice(keys.indexOf('alpha'), 1);
- this.valpha = typeof object.alpha === 'number' ? object.alpha : 0;
- }
- const hashedKeys = keys.sort().join('');
- if (!(hashedKeys in hashedModelKeys)) {
- throw new Error('Unable to parse color from object: ' + JSON.stringify(object));
- }
- this.model = hashedModelKeys[hashedKeys];
- const {labels} = colorConvert[this.model];
- const color = [];
- for (i = 0; i < labels.length; i++) {
- color.push(object[labels[i]]);
- }
- this.color = zeroArray(color);
- }
- // Perform limitations (clamping, etc.)
- if (limiters[this.model]) {
- channels = colorConvert[this.model].channels;
- for (i = 0; i < channels; i++) {
- const limit = limiters[this.model][i];
- if (limit) {
- this.color[i] = limit(this.color[i]);
- }
- }
- }
- this.valpha = Math.max(0, Math.min(1, this.valpha));
- if (Object.freeze) {
- Object.freeze(this);
- }
- }
- Color.prototype = {
- toString() {
- return this.string();
- },
- toJSON() {
- return this[this.model]();
- },
- string(places) {
- let self = this.model in colorString.to ? this : this.rgb();
- self = self.round(typeof places === 'number' ? places : 1);
- const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
- return colorString.to[self.model](args);
- },
- percentString(places) {
- const self = this.rgb().round(typeof places === 'number' ? places : 1);
- const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
- return colorString.to.rgb.percent(args);
- },
- array() {
- return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
- },
- object() {
- const result = {};
- const {channels} = colorConvert[this.model];
- const {labels} = colorConvert[this.model];
- for (let i = 0; i < channels; i++) {
- result[labels[i]] = this.color[i];
- }
- if (this.valpha !== 1) {
- result.alpha = this.valpha;
- }
- return result;
- },
- unitArray() {
- const rgb = this.rgb().color;
- rgb[0] /= 255;
- rgb[1] /= 255;
- rgb[2] /= 255;
- if (this.valpha !== 1) {
- rgb.push(this.valpha);
- }
- return rgb;
- },
- unitObject() {
- const rgb = this.rgb().object();
- rgb.r /= 255;
- rgb.g /= 255;
- rgb.b /= 255;
- if (this.valpha !== 1) {
- rgb.alpha = this.valpha;
- }
- return rgb;
- },
- round(places) {
- places = Math.max(places || 0, 0);
- return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
- },
- alpha(value) {
- if (value !== undefined) {
- return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
- }
- return this.valpha;
- },
- // Rgb
- red: getset('rgb', 0, maxfn(255)),
- green: getset('rgb', 1, maxfn(255)),
- blue: getset('rgb', 2, maxfn(255)),
- hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),
- saturationl: getset('hsl', 1, maxfn(100)),
- lightness: getset('hsl', 2, maxfn(100)),
- saturationv: getset('hsv', 1, maxfn(100)),
- value: getset('hsv', 2, maxfn(100)),
- chroma: getset('hcg', 1, maxfn(100)),
- gray: getset('hcg', 2, maxfn(100)),
- white: getset('hwb', 1, maxfn(100)),
- wblack: getset('hwb', 2, maxfn(100)),
- cyan: getset('cmyk', 0, maxfn(100)),
- magenta: getset('cmyk', 1, maxfn(100)),
- yellow: getset('cmyk', 2, maxfn(100)),
- black: getset('cmyk', 3, maxfn(100)),
- x: getset('xyz', 0, maxfn(95.047)),
- y: getset('xyz', 1, maxfn(100)),
- z: getset('xyz', 2, maxfn(108.833)),
- l: getset('lab', 0, maxfn(100)),
- a: getset('lab', 1),
- b: getset('lab', 2),
- keyword(value) {
- if (value !== undefined) {
- return new Color(value);
- }
- return colorConvert[this.model].keyword(this.color);
- },
- hex(value) {
- if (value !== undefined) {
- return new Color(value);
- }
- return colorString.to.hex(this.rgb().round().color);
- },
- hexa(value) {
- if (value !== undefined) {
- return new Color(value);
- }
- const rgbArray = this.rgb().round().color;
- let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
- if (alphaHex.length === 1) {
- alphaHex = '0' + alphaHex;
- }
- return colorString.to.hex(rgbArray) + alphaHex;
- },
- rgbNumber() {
- const rgb = this.rgb().color;
- return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);
- },
- luminosity() {
- // http://www.w3.org/TR/WCAG20/#relativeluminancedef
- const rgb = this.rgb().color;
- const lum = [];
- for (const [i, element] of rgb.entries()) {
- const chan = element / 255;
- lum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
- }
- return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
- },
- contrast(color2) {
- // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
- const lum1 = this.luminosity();
- const lum2 = color2.luminosity();
- if (lum1 > lum2) {
- return (lum1 + 0.05) / (lum2 + 0.05);
- }
- return (lum2 + 0.05) / (lum1 + 0.05);
- },
- level(color2) {
- // https://www.w3.org/TR/WCAG/#contrast-enhanced
- const contrastRatio = this.contrast(color2);
- if (contrastRatio >= 7) {
- return 'AAA';
- }
- return (contrastRatio >= 4.5) ? 'AA' : '';
- },
- isDark() {
- // YIQ equation from http://24ways.org/2010/calculating-color-contrast
- const rgb = this.rgb().color;
- const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;
- return yiq < 128;
- },
- isLight() {
- return !this.isDark();
- },
- negate() {
- const rgb = this.rgb();
- for (let i = 0; i < 3; i++) {
- rgb.color[i] = 255 - rgb.color[i];
- }
- return rgb;
- },
- lighten(ratio) {
- const hsl = this.hsl();
- hsl.color[2] += hsl.color[2] * ratio;
- return hsl;
- },
- darken(ratio) {
- const hsl = this.hsl();
- hsl.color[2] -= hsl.color[2] * ratio;
- return hsl;
- },
- saturate(ratio) {
- const hsl = this.hsl();
- hsl.color[1] += hsl.color[1] * ratio;
- return hsl;
- },
- desaturate(ratio) {
- const hsl = this.hsl();
- hsl.color[1] -= hsl.color[1] * ratio;
- return hsl;
- },
- whiten(ratio) {
- const hwb = this.hwb();
- hwb.color[1] += hwb.color[1] * ratio;
- return hwb;
- },
- blacken(ratio) {
- const hwb = this.hwb();
- hwb.color[2] += hwb.color[2] * ratio;
- return hwb;
- },
- grayscale() {
- // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
- const rgb = this.rgb().color;
- const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
- return Color.rgb(value, value, value);
- },
- fade(ratio) {
- return this.alpha(this.valpha - (this.valpha * ratio));
- },
- opaquer(ratio) {
- return this.alpha(this.valpha + (this.valpha * ratio));
- },
- rotate(degrees) {
- const hsl = this.hsl();
- let hue = hsl.color[0];
- hue = (hue + degrees) % 360;
- hue = hue < 0 ? 360 + hue : hue;
- hsl.color[0] = hue;
- return hsl;
- },
- mix(mixinColor, weight) {
- // Ported from sass implementation in C
- // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
- if (!mixinColor || !mixinColor.rgb) {
- throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
- }
- const color1 = mixinColor.rgb();
- const color2 = this.rgb();
- const p = weight === undefined ? 0.5 : weight;
- const w = 2 * p - 1;
- const a = color1.alpha() - color2.alpha();
- const w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;
- const w2 = 1 - w1;
- return Color.rgb(
- w1 * color1.red() + w2 * color2.red(),
- w1 * color1.green() + w2 * color2.green(),
- w1 * color1.blue() + w2 * color2.blue(),
- color1.alpha() * p + color2.alpha() * (1 - p));
- },
- };
- // Model conversion methods and static constructors
- for (const model of Object.keys(colorConvert)) {
- if (skippedModels.includes(model)) {
- continue;
- }
- const {channels} = colorConvert[model];
- // Conversion methods
- Color.prototype[model] = function (...args) {
- if (this.model === model) {
- return new Color(this);
- }
- if (args.length > 0) {
- return new Color(args, model);
- }
- return new Color([...assertArray(colorConvert[this.model][model].raw(this.color)), this.valpha], model);
- };
- // 'static' construction methods
- Color[model] = function (...args) {
- let color = args[0];
- if (typeof color === 'number') {
- color = zeroArray(args, channels);
- }
- return new Color(color, model);
- };
- }
- function roundTo(number, places) {
- return Number(number.toFixed(places));
- }
- function roundToPlace(places) {
- return function (number) {
- return roundTo(number, places);
- };
- }
- function getset(model, channel, modifier) {
- model = Array.isArray(model) ? model : [model];
- for (const m of model) {
- (limiters[m] || (limiters[m] = []))[channel] = modifier;
- }
- model = model[0];
- return function (value) {
- let result;
- if (value !== undefined) {
- if (modifier) {
- value = modifier(value);
- }
- result = this[model]();
- result.color[channel] = value;
- return result;
- }
- result = this[model]().color[channel];
- if (modifier) {
- result = modifier(result);
- }
- return result;
- };
- }
- function maxfn(max) {
- return function (v) {
- return Math.max(0, Math.min(max, v));
- };
- }
- function assertArray(value) {
- return Array.isArray(value) ? value : [value];
- }
- function zeroArray(array, length) {
- for (let i = 0; i < length; i++) {
- if (typeof array[i] !== 'number') {
- array[i] = 0;
- }
- }
- return array;
- }
- var color = Color;
- const CSS$K = {
- container: "container",
- controlSection: "control-section",
- hexOptions: "color-hex-options",
- section: "section",
- header: "header",
- control: "control",
- splitSection: "section--split",
- colorModeContainer: "color-mode-container",
- colorMode: "color-mode",
- channels: "channels",
- channel: "channel",
- savedColors: "saved-colors",
- savedColorsSection: "saved-colors-section",
- saveColor: "save-color",
- deleteColor: "delete-color",
- savedColorsButtons: "saved-colors-buttons",
- headerHex: "header--hex",
- colorFieldAndSlider: "color-field-and-slider",
- colorFieldAndSliderInteractive: "color-field-and-slider--interactive",
- colorFieldAndSliderWrap: "color-field-and-slider-wrap",
- scope: "scope",
- hueScope: "scope--hue",
- colorFieldScope: "scope--color-field",
- savedColor: "saved-color"
- };
- const DEFAULT_COLOR$1 = color("#007AC2");
- const DEFAULT_STORAGE_KEY_PREFIX = "calcite-color-";
- const RGB_LIMITS = {
- r: 255,
- g: 255,
- b: 255
- };
- const HSV_LIMITS = {
- h: 360,
- s: 100,
- v: 100
- };
- const TEXT$k = {
- b: "B",
- blue: "Blue",
- deleteColor: "Delete color",
- g: "G",
- green: "Green",
- h: "H",
- hsv: "HSV",
- hex: "Hex",
- hue: "Hue",
- noColor: "No color",
- r: "R",
- red: "Red",
- rgb: "RGB",
- s: "S",
- saturation: "Saturation",
- saveColor: "Save color",
- saved: "Saved",
- v: "V",
- value: "Value"
- };
- const DIMENSIONS = {
- s: {
- slider: {
- height: 10,
- width: 160
- },
- colorField: {
- height: 80,
- width: 160
- },
- thumb: {
- radius: 8
- }
- },
- m: {
- slider: {
- height: 14,
- width: 272
- },
- colorField: {
- height: 150,
- width: 272
- },
- thumb: {
- radius: 10
- }
- },
- l: {
- slider: {
- height: 16,
- width: 464
- },
- colorField: {
- height: 200,
- width: 464
- },
- thumb: {
- radius: 12
- }
- }
- };
- const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
- const decimalPlaces = (value) => {
- const match = ("" + value).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
- if (!match) {
- return 0;
- }
- return Math.max(0,
- // Number of digits right of decimal point.
- (match[1] ? match[1].length : 0) -
- // Adjust for scientific notation.
- (match[2] ? +match[2] : 0));
- };
- const colorPickerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-color-picker{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-color-picker{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-color-picker{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-color-picker{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-color-picker:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-color-picker:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-color-picker-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-color-picker-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@: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]) ::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{inline-size: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{flex-direction:column}/*!@:host([scale=s]) .channel*/[scale=s].sc-calcite-color-picker-h .channel.sc-calcite-color-picker{inline-size:100%;margin-block-end:4px}/*!@:host([scale=s]) .channel:last-child*/[scale=s].sc-calcite-color-picker-h .channel.sc-calcite-color-picker:last-child{margin-block-end:0}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-color-picker-h .container.sc-calcite-color-picker{inline-size:272px}/*!@:host([scale=l]) .header*/[scale=l].sc-calcite-color-picker-h .header.sc-calcite-color-picker{padding-block-end: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{inline-size:464px}/*!@:host([scale=l]) .color-field-and-slider*/[scale=l].sc-calcite-color-picker-h .color-field-and-slider.sc-calcite-color-picker{margin-block-end:-20px}/*!@:host([scale=l]) .section*/[scale=l].sc-calcite-color-picker-h .section.sc-calcite-color-picker{padding-block:0 16px;padding-inline:16px}/*!@:host([scale=l]) .section:first-of-type*/[scale=l].sc-calcite-color-picker-h .section.sc-calcite-color-picker:first-of-type{padding-block-start: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-block-start:16px}/*!@:host([scale=l]) .control-section*/[scale=l].sc-calcite-color-picker-h .control-section.sc-calcite-color-picker{flex-wrap:nowrap;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){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:flex;flex-shrink:1;flex-direction:column;justify-content:space-around;min-block-size:98px;inline-size:160px}/*!@:host([scale=l]) .color-mode-container*/[scale=l].sc-calcite-color-picker-h .color-mode-container.sc-calcite-color-picker{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-color:transparent;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-block-end:-16px;touch-action:none}/*!@.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:flex;flex-direction:row;flex-wrap:wrap}/*!@.section*/.section.sc-calcite-color-picker{padding-block:0 12px;padding-inline:12px}/*!@.section:first-of-type*/.section.sc-calcite-color-picker:first-of-type{padding-block-start:12px}/*!@.color-hex-options,\n.section--split*/.color-hex-options.sc-calcite-color-picker,.section--split.sc-calcite-color-picker{flex-grow:1}/*!@.header*/.header.sc-calcite-color-picker{display:flex;align-items:center;justify-content:space-between;padding-block-end: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-block-start:12px}/*!@.channels*/.channels.sc-calcite-color-picker{display:flex;justify-content:space-between}/*!@.channel*/.channel.sc-calcite-color-picker{inline-size:31%}/*!@.saved-colors*/.saved-colors.sc-calcite-color-picker{padding-block-start:12px;display:grid;grid-template-columns:repeat(auto-fill, minmax(24px, 1fr));grid-gap:8px;inline-size:100%}/*!@.saved-colors-buttons*/.saved-colors-buttons.sc-calcite-color-picker{display:flex}/*!@.saved-color*/.saved-color.sc-calcite-color-picker{outline-offset:0;outline-color:transparent;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{transition:outline-color var(--calcite-internal-animation-timing-fast) ease-in-out;outline:2px solid var(--calcite-ui-border-2);outline-offset:2px}";
- const throttleFor60FpsInMs = 16;
- const defaultValue = normalizeHex(DEFAULT_COLOR$1.hex());
- const defaultFormat = "auto";
- class ColorPicker {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteColorPickerChange = createEvent(this, "calciteColorPickerChange", 6);
- this.calciteColorPickerInput = createEvent(this, "calciteColorPickerInput", 6);
- //--------------------------------------------------------------------------
- //
- // Public properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `false`, an empty color (`null`) will be allowed as a `value`. Otherwise, a color value is enforced on the component.
- *
- * When `true`, a color value is enforced, and clearing the input or blurring will restore the last valid `value`. When `false`, an empty color (`null`) will be allowed as a `value`.
- */
- this.allowEmpty = false;
- /**
- * Specifies the appearance style of the component -
- *
- * `"solid"` (containing border) or `"minimal"` (no containing border).
- */
- this.appearance = "solid";
- /**
- * Internal prop for advanced use-cases.
- *
- * @internal
- */
- this.color = DEFAULT_COLOR$1;
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * The format of `value`.
- *
- * When `"auto"`, the format will be inferred from `value` when set.
- *
- * @default "auto"
- */
- this.format = defaultFormat;
- /** When `true`, hides the Hex input. */
- this.hideHex = false;
- /** When `true`, hides the RGB/HSV channel inputs. */
- this.hideChannels = false;
- /** When `true`, hides the saved colors section. */
- this.hideSaved = false;
- /**
- * Accessible name for the RGB section's blue channel.
- *
- * @default "B"
- */
- this.intlB = TEXT$k.b;
- /**
- * Accessible name for the RGB section's blue channel description.
- *
- * @default "Blue"
- */
- this.intlBlue = TEXT$k.blue;
- /**
- * Accessible name for the delete color button.
- *
- * @default "Delete color"
- */
- this.intlDeleteColor = TEXT$k.deleteColor;
- /**
- * Accessible name for the RGB section's green channel.
- *
- * @default "G"
- */
- this.intlG = TEXT$k.g;
- /**
- * Accessible name for the RGB section's green channel description.
- *
- * @default "Green"
- */
- this.intlGreen = TEXT$k.green;
- /**
- * Accessible name for the HSV section's hue channel.
- *
- * @default "H"
- */
- this.intlH = TEXT$k.h;
- /**
- * Accessible name for the HSV mode.
- *
- * @default "HSV"
- */
- this.intlHsv = TEXT$k.hsv;
- /**
- * Accessible name for the Hex input.
- *
- * @default "Hex"
- */
- this.intlHex = TEXT$k.hex;
- /**
- * Accessible name for the HSV section's hue channel description.
- *
- * @default "Hue"
- */
- this.intlHue = TEXT$k.hue;
- /**
- * Accessible name for the Hex input when there is no color selected.
- *
- * @default "No color"
- */
- this.intlNoColor = TEXT$k.noColor;
- /**
- * Accessible name for the RGB section's red channel.
- *
- * @default "R"
- */
- this.intlR = TEXT$k.r;
- /**
- * Accessible name for the RGB section's red channel description.
- *
- * @default "Red"
- */
- this.intlRed = TEXT$k.red;
- /**
- * Accessible name for the RGB mode.
- *
- * @default "RGB"
- */
- this.intlRgb = TEXT$k.rgb;
- /**
- * Accessible name for the HSV section's saturation channel.
- *
- * @default "S"
- */
- this.intlS = TEXT$k.s;
- /**
- * Accessible name for the HSV section's saturation channel description.
- *
- * @default "Saturation"
- */
- this.intlSaturation = TEXT$k.saturation;
- /**
- * Accessible name for the save color button.
- *
- * @default "Save color"
- */
- this.intlSaveColor = TEXT$k.saveColor;
- /**
- * Accessible name for the saved colors section.
- *
- * @default "Saved"
- */
- this.intlSaved = TEXT$k.saved;
- /**
- * Accessible name for the HSV section's value channel.
- *
- * @default "V"
- */
- this.intlV = TEXT$k.v;
- /**
- * Accessible name for the HSV section's value channel description.
- *
- * @default "Value"
- */
- this.intlValue = TEXT$k.value;
- /** Specifies the size of the component. */
- this.scale = "m";
- /**
- * The component's value, where the value can be a CSS color string, or a RGB, HSL or HSV object.
- *
- * The type will be preserved as the color is updated.
- *
- * @default "#007ac2"
- * @see [CSS Color](https://developer.mozilla.org/en-US/docs/Web/CSS/color)
- * @see [ColorValue](https://github.com/Esri/calcite-components/blob/master/src/components/color-picker/interfaces.ts#L10)
- */
- this.value = defaultValue;
- this.colorFieldAndSliderHovered = false;
- this.hueThumbState = "idle";
- this.internalColorUpdateContext = null;
- this.mode = CSSColorMode.HEX;
- this.shiftKeyChannelAdjustment = 0;
- this.sliderThumbState = "idle";
- this.colorFieldAndSliderInteractive = false;
- this.channelMode = "rgb";
- this.channels = this.toChannels(DEFAULT_COLOR$1);
- this.dimensions = DIMENSIONS.m;
- this.savedColors = [];
- this.handleTabActivate = (event) => {
- this.channelMode = event.currentTarget.getAttribute("data-color-mode");
- this.updateChannelsFromColor(this.color);
- };
- this.handleColorFieldScopeKeyDown = (event) => {
- const { key } = event;
- const arrowKeyToXYOffset = {
- ArrowUp: { x: 0, y: -10 },
- ArrowRight: { x: 10, y: 0 },
- ArrowDown: { x: 0, y: 10 },
- ArrowLeft: { x: -10, y: 0 }
- };
- if (arrowKeyToXYOffset[key]) {
- event.preventDefault();
- this.scopeOrientation = key === "ArrowDown" || key === "ArrowUp" ? "vertical" : "horizontal";
- this.captureColorFieldColor(this.colorFieldScopeLeft + arrowKeyToXYOffset[key].x || 0, this.colorFieldScopeTop + arrowKeyToXYOffset[key].y || 0, false);
- }
- };
- this.handleHueScopeKeyDown = (event) => {
- const modifier = event.shiftKey ? 10 : 1;
- const { key } = event;
- const arrowKeyToXOffset = {
- ArrowUp: 1,
- ArrowRight: 1,
- ArrowDown: -1,
- ArrowLeft: -1
- };
- if (arrowKeyToXOffset[key]) {
- event.preventDefault();
- const delta = arrowKeyToXOffset[key] * modifier;
- const hue = this.baseColorFieldColor.hue();
- const color = this.baseColorFieldColor.hue(hue + delta);
- this.internalColorSet(color, false);
- }
- };
- this.handleHexInputChange = (event) => {
- event.stopPropagation();
- const { allowEmpty, color: color$1 } = this;
- const input = event.target;
- const hex = input.value;
- if (allowEmpty && !hex) {
- this.internalColorSet(null);
- return;
- }
- const normalizedHex = color$1 && normalizeHex(color$1.hex());
- if (hex !== normalizedHex) {
- this.internalColorSet(color(hex));
- }
- };
- this.handleSavedColorSelect = (event) => {
- const swatch = event.currentTarget;
- this.internalColorSet(color(swatch.color));
- };
- this.handleChannelInput = (event) => {
- const input = event.currentTarget;
- const internalInput = event.detail.nativeEvent.target;
- const channelIndex = Number(input.getAttribute("data-channel-index"));
- const limit = this.channelMode === "rgb"
- ? RGB_LIMITS[Object.keys(RGB_LIMITS)[channelIndex]]
- : HSV_LIMITS[Object.keys(HSV_LIMITS)[channelIndex]];
- let inputValue;
- if (this.allowEmpty && !input.value) {
- inputValue = "";
- }
- else {
- const value = Number(input.value) + this.shiftKeyChannelAdjustment;
- const clamped = clamp(value, 0, limit);
- inputValue = clamped.toString();
- }
- input.value = inputValue;
- internalInput.value = inputValue;
- };
- this.handleChannelChange = (event) => {
- const input = event.currentTarget;
- const channelIndex = Number(input.getAttribute("data-channel-index"));
- const channels = [...this.channels];
- const shouldClearChannels = this.allowEmpty && !input.value;
- if (shouldClearChannels) {
- this.channels = [null, null, null];
- this.internalColorSet(null);
- return;
- }
- channels[channelIndex] = Number(input.value);
- this.updateColorFromChannels(channels);
- };
- this.handleSavedColorKeyDown = (event) => {
- if (isActivationKey(event.key)) {
- event.preventDefault();
- this.handleSavedColorSelect(event);
- }
- };
- this.handleColorFieldAndSliderPointerLeave = () => {
- this.colorFieldAndSliderInteractive = false;
- this.colorFieldAndSliderHovered = false;
- if (this.sliderThumbState !== "drag" && this.hueThumbState !== "drag") {
- this.hueThumbState = "idle";
- this.sliderThumbState = "idle";
- this.drawColorFieldAndSlider();
- }
- };
- this.handleColorFieldAndSliderPointerDown = (event) => {
- var _a, _b;
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- const { offsetX, offsetY } = event;
- const region = this.getCanvasRegion(offsetY);
- if (region === "color-field") {
- this.hueThumbState = "drag";
- this.captureColorFieldColor(offsetX, offsetY);
- (_a = this.colorFieldScopeNode) === null || _a === void 0 ? void 0 : _a.focus();
- }
- else if (region === "slider") {
- this.sliderThumbState = "drag";
- this.captureHueSliderColor(offsetX);
- (_b = this.hueScopeNode) === null || _b === void 0 ? void 0 : _b.focus();
- }
- // prevent text selection outside of color field & slider area
- event.preventDefault();
- document.addEventListener("pointermove", this.globalPointerMoveHandler);
- document.addEventListener("pointerup", this.globalPointerUpHandler, { once: true });
- this.activeColorFieldAndSliderRect =
- this.fieldAndSliderRenderingContext.canvas.getBoundingClientRect();
- };
- this.globalPointerUpHandler = (event) => {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- const previouslyDragging = this.sliderThumbState === "drag" || this.hueThumbState === "drag";
- this.hueThumbState = "idle";
- this.sliderThumbState = "idle";
- this.activeColorFieldAndSliderRect = null;
- this.drawColorFieldAndSlider();
- if (previouslyDragging) {
- this.calciteColorPickerChange.emit();
- }
- };
- this.globalPointerMoveHandler = (event) => {
- const { el, dimensions } = this;
- const sliderThumbDragging = this.sliderThumbState === "drag";
- const hueThumbDragging = this.hueThumbState === "drag";
- if (!el.isConnected || (!sliderThumbDragging && !hueThumbDragging)) {
- return;
- }
- let samplingX;
- let samplingY;
- const colorFieldAndSliderRect = this.activeColorFieldAndSliderRect;
- const { clientX, clientY } = event;
- if (this.colorFieldAndSliderHovered) {
- samplingX = clientX - colorFieldAndSliderRect.x;
- samplingY = clientY - colorFieldAndSliderRect.y;
- }
- else {
- const colorFieldWidth = dimensions.colorField.width;
- const colorFieldHeight = dimensions.colorField.height;
- const hueSliderHeight = dimensions.slider.height;
- if (clientX < colorFieldAndSliderRect.x + colorFieldWidth &&
- clientX > colorFieldAndSliderRect.x) {
- samplingX = clientX - colorFieldAndSliderRect.x;
- }
- else if (clientX < colorFieldAndSliderRect.x) {
- samplingX = 0;
- }
- else {
- samplingX = colorFieldWidth - 1;
- }
- if (clientY < colorFieldAndSliderRect.y + colorFieldHeight + hueSliderHeight &&
- clientY > colorFieldAndSliderRect.y) {
- samplingY = clientY - colorFieldAndSliderRect.y;
- }
- else if (clientY < colorFieldAndSliderRect.y) {
- samplingY = 0;
- }
- else {
- samplingY = colorFieldHeight + hueSliderHeight;
- }
- }
- if (hueThumbDragging) {
- this.captureColorFieldColor(samplingX, samplingY, false);
- }
- else {
- this.captureHueSliderColor(samplingX);
- }
- };
- this.handleColorFieldAndSliderPointerEnterOrMove = ({ offsetX, offsetY }) => {
- const { dimensions: { colorField, slider, thumb } } = this;
- this.colorFieldAndSliderInteractive = offsetY <= colorField.height + slider.height;
- this.colorFieldAndSliderHovered = true;
- const region = this.getCanvasRegion(offsetY);
- if (region === "color-field") {
- const prevHueThumbState = this.hueThumbState;
- const color = this.baseColorFieldColor.hsv();
- const centerX = Math.round(color.saturationv() / (HSV_LIMITS.s / colorField.width));
- const centerY = Math.round(colorField.height - color.value() / (HSV_LIMITS.v / colorField.height));
- const hoveringThumb = this.containsPoint(offsetX, offsetY, centerX, centerY, thumb.radius);
- let transitionedBetweenHoverAndIdle = false;
- if (prevHueThumbState === "idle" && hoveringThumb) {
- this.hueThumbState = "hover";
- transitionedBetweenHoverAndIdle = true;
- }
- else if (prevHueThumbState === "hover" && !hoveringThumb) {
- this.hueThumbState = "idle";
- transitionedBetweenHoverAndIdle = true;
- }
- if (this.hueThumbState !== "drag") {
- if (transitionedBetweenHoverAndIdle) {
- // refresh since we won't update color and thus no redraw
- this.drawColorFieldAndSlider();
- }
- }
- }
- else if (region === "slider") {
- const sliderThumbColor = this.baseColorFieldColor.hsv().saturationv(100).value(100);
- const prevSliderThumbState = this.sliderThumbState;
- const sliderThumbCenterX = Math.round(sliderThumbColor.hue() / (360 / slider.width));
- const sliderThumbCenterY = Math.round((slider.height + this.getSliderCapSpacing()) / 2) + colorField.height;
- const hoveringSliderThumb = this.containsPoint(offsetX, offsetY, sliderThumbCenterX, sliderThumbCenterY, thumb.radius);
- let sliderThumbTransitionedBetweenHoverAndIdle = false;
- if (prevSliderThumbState === "idle" && hoveringSliderThumb) {
- this.sliderThumbState = "hover";
- sliderThumbTransitionedBetweenHoverAndIdle = true;
- }
- else if (prevSliderThumbState === "hover" && !hoveringSliderThumb) {
- this.sliderThumbState = "idle";
- sliderThumbTransitionedBetweenHoverAndIdle = true;
- }
- if (this.sliderThumbState !== "drag") {
- if (sliderThumbTransitionedBetweenHoverAndIdle) {
- // refresh since we won't update color and thus no redraw
- this.drawColorFieldAndSlider();
- }
- }
- }
- };
- this.storeColorFieldScope = (node) => {
- this.colorFieldScopeNode = node;
- };
- this.storeHueScope = (node) => {
- this.hueScopeNode = node;
- };
- this.renderChannelsTabTitle = (channelMode) => {
- const { channelMode: activeChannelMode, intlRgb, intlHsv } = this;
- const active = channelMode === activeChannelMode;
- const label = channelMode === "rgb" ? intlRgb : intlHsv;
- return (hAsync("calcite-tab-title", { active: active, class: CSS$K.colorMode, "data-color-mode": channelMode, key: channelMode, onCalciteTabsActivate: this.handleTabActivate }, label));
- };
- this.renderChannelsTab = (channelMode) => {
- const { channelMode: activeChannelMode, channels, intlB, intlBlue, intlG, intlGreen, intlH, intlHue, intlR, intlRed, intlS, intlSaturation, intlV, intlValue } = this;
- const active = channelMode === activeChannelMode;
- const isRgb = channelMode === "rgb";
- const channelLabels = isRgb ? [intlR, intlG, intlB] : [intlH, intlS, intlV];
- const channelAriaLabels = isRgb
- ? [intlRed, intlGreen, intlBlue]
- : [intlHue, intlSaturation, intlValue];
- const direction = getElementDir(this.el);
- return (hAsync("calcite-tab", { active: active, class: CSS$K.control, key: channelMode }, hAsync("div", { class: CSS$K.channels, dir: "ltr" }, channels.map((channel, index) =>
- /* the channel container is ltr, so we apply the host's direction */
- this.renderChannel(channel, index, channelLabels[index], channelAriaLabels[index], direction)))));
- };
- this.renderChannel = (value, index, label, ariaLabel, direction) => (hAsync("calcite-input", { class: CSS$K.channel, "data-channel-index": index, dir: direction, label: ariaLabel, numberButtonType: "none", numberingSystem: this.numberingSystem, 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() }));
- this.deleteColor = () => {
- const colorToDelete = this.color.hex();
- const inStorage = this.savedColors.indexOf(colorToDelete) > -1;
- if (!inStorage) {
- return;
- }
- const savedColors = this.savedColors.filter((color) => color !== colorToDelete);
- this.savedColors = savedColors;
- const storageKey = `${DEFAULT_STORAGE_KEY_PREFIX}${this.storageId}`;
- if (this.storageId) {
- localStorage.setItem(storageKey, JSON.stringify(savedColors));
- }
- };
- this.saveColor = () => {
- const colorToSave = this.color.hex();
- const alreadySaved = this.savedColors.indexOf(colorToSave) > -1;
- if (alreadySaved) {
- return;
- }
- const savedColors = [...this.savedColors, colorToSave];
- this.savedColors = savedColors;
- const storageKey = `${DEFAULT_STORAGE_KEY_PREFIX}${this.storageId}`;
- if (this.storageId) {
- localStorage.setItem(storageKey, JSON.stringify(savedColors));
- }
- };
- this.drawColorFieldAndSlider = throttle$1(() => {
- if (!this.fieldAndSliderRenderingContext) {
- return;
- }
- this.drawColorField();
- this.drawHueSlider();
- }, throttleFor60FpsInMs);
- this.captureColorFieldColor = (x, y, skipEqual = true) => {
- const { dimensions: { colorField: { height, width } } } = this;
- const saturation = Math.round((HSV_LIMITS.s / width) * x);
- const value = Math.round((HSV_LIMITS.v / height) * (height - y));
- this.internalColorSet(this.baseColorFieldColor.hsv().saturationv(saturation).value(value), skipEqual);
- };
- this.initColorFieldAndSlider = (canvas) => {
- this.fieldAndSliderRenderingContext = canvas.getContext("2d");
- this.updateCanvasSize(canvas);
- };
- }
- handleColorChange(color, oldColor) {
- this.drawColorFieldAndSlider();
- this.updateChannelsFromColor(color);
- this.previousColor = oldColor;
- }
- handleFormatChange(format) {
- this.setMode(format);
- this.internalColorSet(this.color, false, "internal");
- }
- handleScaleChange(scale = "m") {
- var _a;
- this.updateDimensions(scale);
- this.updateCanvasSize((_a = this.fieldAndSliderRenderingContext) === null || _a === void 0 ? void 0 : _a.canvas);
- }
- handleValueChange(value, oldValue) {
- const { allowEmpty, format } = this;
- const checkMode = !allowEmpty || value;
- let modeChanged = false;
- if (checkMode) {
- const nextMode = parseMode(value);
- if (!nextMode || (format !== "auto" && nextMode !== format)) {
- this.showIncompatibleColorWarning(value, format);
- this.value = oldValue;
- return;
- }
- modeChanged = this.mode !== nextMode;
- this.setMode(nextMode);
- }
- const dragging = this.sliderThumbState === "drag" || this.hueThumbState === "drag";
- if (this.internalColorUpdateContext === "initial") {
- return;
- }
- if (this.internalColorUpdateContext === "user-interaction") {
- this.calciteColorPickerInput.emit();
- if (!dragging) {
- this.calciteColorPickerChange.emit();
- }
- return;
- }
- const color$1 = allowEmpty && !value ? null : color(value);
- const colorChanged = !colorEqual(color$1, this.color);
- if (modeChanged || colorChanged) {
- this.internalColorSet(color$1, true, "internal");
- }
- }
- //--------------------------------------------------------------------------
- //
- // Internal State/Props
- //
- //--------------------------------------------------------------------------
- get baseColorFieldColor() {
- return this.color || this.previousColor || DEFAULT_COLOR$1;
- }
- // using @Listen as a workaround for VDOM listener not firing
- handleChannelKeyUpOrDown(event) {
- this.shiftKeyChannelAdjustment = 0;
- const { key } = event;
- if ((key !== "ArrowUp" && key !== "ArrowDown") ||
- !event.composedPath().some((node) => { var _a; return (_a = node.classList) === null || _a === void 0 ? void 0 : _a.contains(CSS$K.channel); })) {
- return;
- }
- const { shiftKey } = event;
- event.preventDefault();
- if (!this.color) {
- this.internalColorSet(this.previousColor);
- event.stopPropagation();
- return;
- }
- // this gets applied to the input's up/down arrow increment/decrement
- const complementaryBump = 9;
- this.shiftKeyChannelAdjustment =
- key === "ArrowUp" && shiftKey
- ? complementaryBump
- : key === "ArrowDown" && shiftKey
- ? -complementaryBump
- : 0;
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- return focusElement(this.colorFieldScopeNode);
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentWillLoad() {
- const { allowEmpty, color: color$1, format, value } = this;
- const willSetNoColor = allowEmpty && !value;
- const parsedMode = parseMode(value);
- const valueIsCompatible = willSetNoColor || (format === "auto" && parsedMode) || format === parsedMode;
- const initialColor = willSetNoColor ? null : valueIsCompatible ? color(value) : color$1;
- if (!valueIsCompatible) {
- this.showIncompatibleColorWarning(value, format);
- }
- this.setMode(format);
- this.internalColorSet(initialColor, false, "initial");
- this.updateDimensions(this.scale);
- const storageKey = `${DEFAULT_STORAGE_KEY_PREFIX}${this.storageId}`;
- if (this.storageId && localStorage.getItem(storageKey)) {
- this.savedColors = JSON.parse(localStorage.getItem(storageKey));
- }
- }
- disconnectedCallback() {
- document.removeEventListener("pointermove", this.globalPointerMoveHandler);
- document.removeEventListener("pointerup", this.globalPointerUpHandler);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- //--------------------------------------------------------------------------
- //
- // Render Methods
- //
- //--------------------------------------------------------------------------
- render() {
- const { allowEmpty, color, intlDeleteColor, hideHex, hideChannels, hideSaved, intlHex, intlSaved, intlSaveColor, savedColors, scale } = this;
- const selectedColorInHex = color ? color.hex() : null;
- const hexInputScale = scale === "l" ? "m" : "s";
- const { colorFieldAndSliderInteractive, colorFieldScopeTop, colorFieldScopeLeft, hueScopeLeft, hueScopeTop, scopeOrientation, dimensions: { colorField: { height: colorFieldHeight, width: colorFieldWidth }, slider: { height: sliderHeight } } } = this;
- const hueTop = hueScopeTop !== null && hueScopeTop !== void 0 ? hueScopeTop : sliderHeight / 2 + colorFieldHeight;
- const hueLeft = hueScopeLeft !== null && hueScopeLeft !== void 0 ? hueScopeLeft : (colorFieldWidth * DEFAULT_COLOR$1.hue()) / HSV_LIMITS.h;
- const noColor = color === null;
- const vertical = scopeOrientation === "vertical";
- return (hAsync("div", { class: CSS$K.container }, hAsync("div", { class: CSS$K.colorFieldAndSliderWrap }, hAsync("canvas", { class: {
- [CSS$K.colorFieldAndSlider]: true,
- [CSS$K.colorFieldAndSliderInteractive]: colorFieldAndSliderInteractive
- }, onPointerDown: this.handleColorFieldAndSliderPointerDown, onPointerEnter: this.handleColorFieldAndSliderPointerEnterOrMove, onPointerLeave: this.handleColorFieldAndSliderPointerLeave, onPointerMove: this.handleColorFieldAndSliderPointerEnterOrMove, 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$K.scope]: true, [CSS$K.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$K.scope]: true, [CSS$K.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: {
- [CSS$K.controlSection]: true,
- [CSS$K.section]: true
- } }, hideHex ? null : (hAsync("div", { class: CSS$K.hexOptions }, hAsync("span", { class: {
- [CSS$K.header]: true,
- [CSS$K.headerHex]: true
- } }, intlHex), hAsync("calcite-color-picker-hex-input", { allowEmpty: allowEmpty, class: CSS$K.control, numberingSystem: this.numberingSystem, onCalciteColorPickerHexInputChange: this.handleHexInputChange, scale: hexInputScale, value: selectedColorInHex }))), hideChannels ? null : (hAsync("calcite-tabs", { class: {
- [CSS$K.colorModeContainer]: true,
- [CSS$K.splitSection]: true
- }, 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$K.savedColorsSection]: true, [CSS$K.section]: true } }, hAsync("div", { class: CSS$K.header }, hAsync("label", null, intlSaved), hAsync("div", { class: CSS$K.savedColorsButtons }, hAsync("calcite-button", { appearance: "transparent", class: CSS$K.deleteColor, color: "neutral", disabled: noColor, iconStart: "minus", label: intlDeleteColor, onClick: this.deleteColor, scale: hexInputScale, type: "button" }), hAsync("calcite-button", { appearance: "transparent", class: CSS$K.saveColor, color: "neutral", disabled: noColor, iconStart: "plus", label: intlSaveColor, onClick: this.saveColor, scale: hexInputScale, type: "button" }))), savedColors.length > 0 ? (hAsync("div", { class: CSS$K.savedColors }, [
- ...savedColors.map((color) => (hAsync("calcite-color-picker-swatch", { active: selectedColorInHex === color, class: CSS$K.savedColor, color: color, key: color, onClick: this.handleSavedColorSelect, onKeyDown: this.handleSavedColorKeyDown, scale: scale, tabIndex: 0 })))
- ])) : null))));
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- handleKeyDown(event) {
- if (event.key === "Enter") {
- event.preventDefault();
- }
- }
- showIncompatibleColorWarning(value, format) {
- console.warn(`ignoring color value (${value}) as it is not compatible with the current format (${format})`);
- }
- setMode(format) {
- this.mode = format === "auto" ? this.mode : format;
- }
- captureHueSliderColor(x) {
- const { dimensions: { slider: { width } } } = this;
- const hue = (360 / width) * x;
- this.internalColorSet(this.baseColorFieldColor.hue(hue), false);
- }
- getCanvasRegion(y) {
- const { dimensions: { colorField: { height: colorFieldHeight }, slider: { height: sliderHeight } } } = this;
- if (y <= colorFieldHeight) {
- return "color-field";
- }
- if (y <= colorFieldHeight + sliderHeight) {
- return "slider";
- }
- return "none";
- }
- internalColorSet(color, skipEqual = true, context = "user-interaction") {
- if (skipEqual && colorEqual(color, this.color)) {
- return;
- }
- this.internalColorUpdateContext = context;
- this.color = color;
- this.value = this.toValue(color);
- this.internalColorUpdateContext = null;
- }
- toValue(color, format = this.mode) {
- if (!color) {
- return null;
- }
- const hexMode = "hex";
- if (format.includes(hexMode)) {
- return normalizeHex(color.round()[hexMode]());
- }
- if (format.includes("-css")) {
- return color[format.replace("-css", "").replace("a", "")]().round().string();
- }
- const colorObject = color[format]().round().object();
- if (format.endsWith("a")) {
- // normalize alpha prop
- colorObject.a = colorObject.alpha;
- delete colorObject.alpha;
- }
- return colorObject;
- }
- getSliderCapSpacing() {
- const { dimensions: { slider: { height }, thumb: { radius } } } = this;
- return radius * 2 - height;
- }
- updateDimensions(scale = "m") {
- this.dimensions = DIMENSIONS[scale];
- }
- drawColorField() {
- const context = this.fieldAndSliderRenderingContext;
- const { dimensions: { colorField: { height, width } } } = this;
- context.fillStyle = this.baseColorFieldColor.hsv().saturationv(100).value(100).string();
- context.fillRect(0, 0, width, height);
- const whiteGradient = context.createLinearGradient(0, 0, width, 0);
- whiteGradient.addColorStop(0, "rgba(255,255,255,1)");
- whiteGradient.addColorStop(1, "rgba(255,255,255,0)");
- context.fillStyle = whiteGradient;
- context.fillRect(0, 0, width, height);
- const blackGradient = context.createLinearGradient(0, 0, 0, height);
- blackGradient.addColorStop(0, "rgba(0,0,0,0)");
- blackGradient.addColorStop(1, "rgba(0,0,0,1)");
- context.fillStyle = blackGradient;
- context.fillRect(0, 0, width, height);
- this.drawActiveColorFieldColor();
- }
- setCanvasContextSize(canvas, { height, width }) {
- const devicePixelRatio = window.devicePixelRatio || 1;
- canvas.width = width * devicePixelRatio;
- canvas.height = height * devicePixelRatio;
- canvas.style.height = `${height}px`;
- canvas.style.width = `${width}px`;
- const context = canvas.getContext("2d");
- context.scale(devicePixelRatio, devicePixelRatio);
- }
- updateCanvasSize(canvas) {
- if (!canvas) {
- return;
- }
- this.setCanvasContextSize(canvas, {
- width: this.dimensions.colorField.width,
- height: this.dimensions.colorField.height +
- this.dimensions.slider.height +
- this.getSliderCapSpacing() * 2
- });
- this.drawColorFieldAndSlider();
- }
- containsPoint(testPointX, testPointY, boundsX, boundsY, boundsRadius) {
- return (Math.pow(testPointX - boundsX, 2) + Math.pow(testPointY - boundsY, 2) <=
- Math.pow(boundsRadius, 2));
- }
- drawActiveColorFieldColor() {
- const { color } = this;
- if (!color) {
- return;
- }
- const hsvColor = color.hsv();
- const { dimensions: { colorField: { height, width }, thumb: { radius } } } = this;
- const x = hsvColor.saturationv() / (HSV_LIMITS.s / width);
- const y = height - hsvColor.value() / (HSV_LIMITS.v / height);
- requestAnimationFrame(() => {
- this.colorFieldScopeLeft = x;
- this.colorFieldScopeTop = y;
- });
- this.drawThumb(this.fieldAndSliderRenderingContext, radius, x, y, hsvColor, this.hueThumbState);
- }
- drawThumb(context, radius, x, y, color, state) {
- const startAngle = 0;
- const endAngle = 2 * Math.PI;
- context.beginPath();
- context.arc(x, y, radius, startAngle, endAngle);
- context.shadowBlur = state === "hover" ? 32 : 16;
- context.shadowColor = `rgba(0, 0, 0, ${state === "drag" ? 0.32 : 0.16})`;
- context.fillStyle = "#fff";
- context.fill();
- context.beginPath();
- context.arc(x, y, radius - 3, startAngle, endAngle);
- context.shadowBlur = 0;
- context.shadowColor = "transparent";
- context.fillStyle = color.rgb().string();
- context.fill();
- }
- drawActiveHueSliderColor() {
- const { color } = this;
- if (!color) {
- return;
- }
- const hsvColor = color.hsv().saturationv(100).value(100);
- const { dimensions: { colorField: { height: colorFieldHeight }, slider: { height, width }, thumb: { radius } } } = this;
- const x = hsvColor.hue() / (360 / width);
- const y = height / 2 + colorFieldHeight;
- requestAnimationFrame(() => {
- this.hueScopeLeft = x;
- this.hueScopeTop = y;
- });
- this.drawThumb(this.fieldAndSliderRenderingContext, radius, x, y, hsvColor, this.sliderThumbState);
- }
- drawHueSlider() {
- const context = this.fieldAndSliderRenderingContext;
- const { dimensions: { colorField: { height: colorFieldHeight }, slider: { height, width } } } = this;
- const gradient = context.createLinearGradient(0, 0, width, 0);
- const hueSliderColorStopKeywords = ["red", "yellow", "lime", "cyan", "blue", "magenta", "red"];
- const offset = 1 / (hueSliderColorStopKeywords.length - 1);
- let currentOffset = 0;
- hueSliderColorStopKeywords.forEach((keyword) => {
- gradient.addColorStop(currentOffset, color(keyword).string());
- currentOffset += offset;
- });
- context.fillStyle = gradient;
- context.clearRect(0, colorFieldHeight, width, height + this.getSliderCapSpacing() * 2);
- context.fillRect(0, colorFieldHeight, width, height);
- this.drawActiveHueSliderColor();
- }
- updateColorFromChannels(channels) {
- this.internalColorSet(color(channels, this.channelMode));
- }
- updateChannelsFromColor(color) {
- this.channels = color ? this.toChannels(color) : [null, null, null];
- }
- toChannels(color) {
- const { channelMode } = this;
- return color[channelMode]()
- .array()
- .map((value) => Math.floor(value));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "color": ["handleColorChange"],
- "format": ["handleFormatChange"],
- "scale": ["handleScaleChange"],
- "value": ["handleValueChange"]
- }; }
- static get style() { return colorPickerCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-color-picker",
- "$members$": {
- "allowEmpty": [516, "allow-empty"],
- "appearance": [513],
- "color": [1040],
- "disabled": [516],
- "format": [513],
- "hideHex": [516, "hide-hex"],
- "hideChannels": [516, "hide-channels"],
- "hideSaved": [516, "hide-saved"],
- "intlB": [1, "intl-b"],
- "intlBlue": [1, "intl-blue"],
- "intlDeleteColor": [1, "intl-delete-color"],
- "intlG": [1, "intl-g"],
- "intlGreen": [1, "intl-green"],
- "intlH": [1, "intl-h"],
- "intlHsv": [1, "intl-hsv"],
- "intlHex": [1, "intl-hex"],
- "intlHue": [1, "intl-hue"],
- "intlNoColor": [1, "intl-no-color"],
- "intlR": [1, "intl-r"],
- "intlRed": [1, "intl-red"],
- "intlRgb": [1, "intl-rgb"],
- "intlS": [1, "intl-s"],
- "intlSaturation": [1, "intl-saturation"],
- "intlSaveColor": [1, "intl-save-color"],
- "intlSaved": [1, "intl-saved"],
- "intlV": [1, "intl-v"],
- "intlValue": [1, "intl-value"],
- "scale": [513],
- "storageId": [513, "storage-id"],
- "numberingSystem": [513, "numbering-system"],
- "value": [1025],
- "colorFieldAndSliderInteractive": [32],
- "channelMode": [32],
- "channels": [32],
- "dimensions": [32],
- "savedColors": [32],
- "colorFieldScopeTop": [32],
- "colorFieldScopeLeft": [32],
- "scopeOrientation": [32],
- "hueScopeLeft": [32],
- "hueScopeTop": [32],
- "setFocus": [64]
- },
- "$listeners$": [[2, "keydown", "handleChannelKeyUpOrDown"], [2, "keyup", "handleChannelKeyUpOrDown"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["allowEmpty", "allow-empty"], ["appearance", "appearance"], ["disabled", "disabled"], ["format", "format"], ["hideHex", "hide-hex"], ["hideChannels", "hide-channels"], ["hideSaved", "hide-saved"], ["scale", "scale"], ["storageId", "storage-id"], ["numberingSystem", "numbering-system"]]
- }; }
- }
- const CSS$J = {
- container: "container",
- preview: "preview",
- input: "input"
- };
- const colorPickerHexInputCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-color-picker-hex-input{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-color-picker-hex-input{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-color-picker-hex-input{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-color-picker-hex-input{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-color-picker-hex-input:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-color-picker-hex-input:root{--calcite-floating-ui-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;inline-size:100%;align-items:center;grid-template-columns:1fr auto}/*!@.preview*/.preview.sc-calcite-color-picker-hex-input{grid-column:2/3;pointer-events:none;margin-block:0px;margin-inline:0.25rem;display:flex;align-items:center}/*!@.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;inline-size:100%;text-transform:uppercase}";
- const DEFAULT_COLOR = color();
- class ColorPickerHexInput {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteColorPickerHexInputChange = createEvent(this, "calciteColorPickerHexInputChange", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `false`, an empty color (`null`) will be allowed as a `value`. Otherwise, a color value is enforced on the component.
- *
- * When `true`, a color value is enforced, and clearing the input or blurring will restore the last valid `value`. When `false`, an empty color (`null`) will be allowed as a `value`.
- */
- this.allowEmpty = false;
- /**
- * Accessible name for the Hex input.
- *
- * @default "Hex"
- */
- this.intlHex = TEXT$k.hex;
- /**
- * Accessible name for the Hex input when there is no color selected.
- *
- * @default "No color"
- */
- this.intlNoColor = TEXT$k.noColor;
- /** Specifies the size of the component. */
- this.scale = "m";
- /**
- * The Hex value.
- */
- this.value = normalizeHex(DEFAULT_COLOR.hex());
- this.onCalciteInternalInputBlur = () => {
- const node = this.inputNode;
- const inputValue = node.value;
- const hex = `#${inputValue}`;
- const willClearValue = this.allowEmpty && !inputValue;
- if (willClearValue || (isValidHex(hex) && isLonghandHex(hex))) {
- return;
- }
- // manipulating DOM directly since rerender doesn't update input value
- node.value =
- this.allowEmpty && !this.internalColor
- ? ""
- : this.formatForInternalInput(rgbToHex(this.internalColor.object()));
- };
- this.onInputChange = () => {
- this.internalSetValue(this.inputNode.value, this.value);
- };
- /**
- * The last valid/selected color. Used as a fallback if an invalid hex code is entered.
- */
- this.internalColor = DEFAULT_COLOR;
- this.previousNonNullValue = this.value;
- this.storeInputRef = (node) => {
- this.inputNode = node;
- };
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- const { allowEmpty, value } = this;
- if (value) {
- const normalized = normalizeHex(value);
- if (isValidHex(normalized)) {
- this.internalSetValue(normalized, normalized, false);
- }
- return;
- }
- if (allowEmpty) {
- this.internalSetValue(null, null, false);
- }
- }
- handleValueChange(value, oldValue) {
- this.internalSetValue(value, oldValue, false);
- }
- // using @Listen as a workaround for VDOM listener not firing
- onInputKeyDown(event) {
- const { altKey, ctrlKey, metaKey, shiftKey } = event;
- const { internalColor, value } = this;
- const { key } = event;
- if (key === "Tab" || key === "Enter") {
- this.onInputChange();
- return;
- }
- const isNudgeKey = key === "ArrowDown" || key === "ArrowUp";
- const oldValue = this.value;
- if (isNudgeKey) {
- if (!value) {
- this.internalSetValue(this.previousNonNullValue, oldValue);
- event.preventDefault();
- return;
- }
- const direction = key === "ArrowUp" ? 1 : -1;
- const bump = shiftKey ? 10 : 1;
- this.internalSetValue(normalizeHex(this.nudgeRGBChannels(internalColor, bump * direction).hex()), oldValue);
- event.preventDefault();
- return;
- }
- const withModifiers = altKey || ctrlKey || metaKey;
- const singleChar = key.length === 1;
- const validHexChar = hexChar.test(key);
- if (singleChar && !withModifiers && !validHexChar) {
- event.preventDefault();
- }
- }
- onPaste(event) {
- const hex = event.clipboardData.getData("text");
- if (isValidHex(hex)) {
- event.preventDefault();
- this.inputNode.value = hex.slice(1);
- }
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- render() {
- const { intlHex, value } = this;
- const hexInputValue = this.formatForInternalInput(value);
- return (hAsync("div", { class: CSS$J.container }, hAsync("calcite-input", { class: CSS$J.input, label: intlHex, maxLength: 6, numberingSystem: this.numberingSystem, onCalciteInputChange: this.onInputChange, onCalciteInternalInputBlur: this.onCalciteInternalInputBlur, onKeyDown: this.handleKeyDown, onPaste: this.onPaste, prefixText: "#", ref: this.storeInputRef, scale: this.scale, value: hexInputValue }), hexInputValue ? (hAsync("calcite-color-picker-swatch", { active: true, class: CSS$J.preview, color: `#${hexInputValue}`, scale: this.scale })) : null));
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- focusElement(this.inputNode);
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- internalSetValue(value, oldValue, emit = true) {
- if (value) {
- const normalized = normalizeHex(value);
- if (isValidHex(normalized)) {
- const { internalColor } = this;
- const changed = !internalColor || normalized !== normalizeHex(internalColor.hex());
- this.internalColor = color(normalized);
- this.previousNonNullValue = normalized;
- this.value = normalized;
- if (changed && emit) {
- this.calciteColorPickerHexInputChange.emit();
- }
- return;
- }
- }
- else if (this.allowEmpty) {
- this.internalColor = null;
- this.value = null;
- if (emit) {
- this.calciteColorPickerHexInputChange.emit();
- }
- return;
- }
- this.value = oldValue;
- }
- formatForInternalInput(hex) {
- return hex ? hex.replace("#", "") : "";
- }
- nudgeRGBChannels(color$1, amount) {
- return color.rgb(color$1.array().map((channel) => channel + amount));
- }
- handleKeyDown(event) {
- if (event.key === "Enter") {
- event.preventDefault();
- }
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "value": ["handleValueChange"]
- }; }
- static get style() { return colorPickerHexInputCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-color-picker-hex-input",
- "$members$": {
- "allowEmpty": [4, "allow-empty"],
- "intlHex": [1, "intl-hex"],
- "intlNoColor": [1, "intl-no-color"],
- "scale": [513],
- "value": [1537],
- "numberingSystem": [1, "numbering-system"],
- "internalColor": [32],
- "setFocus": [64]
- },
- "$listeners$": [[2, "keydown", "onInputKeyDown"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["scale", "scale"], ["value", "value"]]
- }; }
- }
- const CSS$I = {
- swatch: "swatch",
- noColorIcon: "no-color-icon"
- };
- const COLORS = {
- borderLight: "rgba(0, 0, 0, 0.3)",
- borderDark: "rgba(255, 255, 255, 0.15)"
- };
- const colorPickerSwatchCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-color-picker-swatch{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-color-picker-swatch{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-color-picker-swatch{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-color-picker-swatch{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-color-picker-swatch:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-color-picker-swatch:root{--calcite-floating-ui-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:inline-flex}/*!@:host([scale=s])*/[scale=s].sc-calcite-color-picker-swatch-h{block-size:1.25rem;inline-size:1.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-color-picker-swatch-h{block-size:1.5rem;inline-size:1.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-color-picker-swatch-h{block-size:2rem;inline-size:2rem}/*!@.swatch*/.swatch.sc-calcite-color-picker-swatch{overflow:visible;block-size:inherit;inline-size:inherit}/*!@.swatch rect*/.swatch.sc-calcite-color-picker-swatch rect.sc-calcite-color-picker-swatch{transition-property:all;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@.no-color-icon*/.no-color-icon.sc-calcite-color-picker-swatch{position:absolute;inset:0px;block-size:100%;inline-size:100%}";
- class ColorPickerSwatch {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, the component is active.
- */
- this.active = false;
- /**
- * Specifies the size of the component.
- */
- this.scale = "m";
- }
- handleColorChange(color$1) {
- this.internalColor = color(color$1);
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentWillLoad() {
- this.handleColorChange(this.color);
- }
- render() {
- const { active, el, internalColor } = this;
- const borderRadius = active ? "100%" : "0";
- const hex = internalColor.hex();
- const theme = getThemeName(el);
- const borderColor = theme === "light" ? COLORS.borderLight : COLORS.borderDark;
- return (hAsync("svg", { class: CSS$I.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%" })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "color": ["handleColorChange"]
- }; }
- static get style() { return colorPickerSwatchCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-color-picker-swatch",
- "$members$": {
- "active": [516],
- "color": [1],
- "scale": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["scale", "scale"]]
- }; }
- }
- const filter = (data, value) => {
- const escapedValue = escapeRegExp(value);
- const regex = new RegExp(escapedValue, "i");
- if (data.length === 0) {
- console.warn(`No data was passed to the filter function.
- The data argument should be an array of objects`);
- }
- const find = (input, RE) => {
- if ((input === null || input === void 0 ? void 0 : input.constant) || (input === null || input === void 0 ? void 0 : input.filterDisabled)) {
- return true;
- }
- let found = false;
- forIn(input, (val) => {
- if (typeof val === "function" || val == null /* intentional == to catch undefined */) {
- return;
- }
- if (Array.isArray(val) || (typeof val === "object" && val !== null)) {
- if (find(val, RE)) {
- found = true;
- }
- }
- else if (RE.test(val)) {
- found = true;
- }
- });
- return found;
- };
- const result = data.filter((item) => {
- return find(item, regex);
- });
- return result;
- };
- function getSide(placement) {
- return placement.split('-')[0];
- }
- function getAlignment(placement) {
- return placement.split('-')[1];
- }
- function getMainAxisFromPlacement(placement) {
- return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
- }
- function getLengthFromAxis(axis) {
- return axis === 'y' ? 'height' : 'width';
- }
- function computeCoordsFromPlacement(_ref, placement, rtl) {
- let {
- reference,
- floating
- } = _ref;
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
- const mainAxis = getMainAxisFromPlacement(placement);
- const length = getLengthFromAxis(mainAxis);
- const commonAlign = reference[length] / 2 - floating[length] / 2;
- const side = getSide(placement);
- const isVertical = mainAxis === 'x';
- let coords;
- switch (side) {
- case 'top':
- coords = {
- x: commonX,
- y: reference.y - floating.height
- };
- break;
- case 'bottom':
- coords = {
- x: commonX,
- y: reference.y + reference.height
- };
- break;
- case 'right':
- coords = {
- x: reference.x + reference.width,
- y: commonY
- };
- break;
- case 'left':
- coords = {
- x: reference.x - floating.width,
- y: commonY
- };
- break;
- default:
- coords = {
- x: reference.x,
- y: reference.y
- };
- }
- switch (getAlignment(placement)) {
- case 'start':
- coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
- break;
- case 'end':
- coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
- break;
- }
- return coords;
- }
- /**
- * Computes the `x` and `y` coordinates that will place the floating element
- * next to a reference element when it is given a certain positioning strategy.
- *
- * This export does not have any `platform` interface logic. You will need to
- * write one for the platform you are using Floating UI with.
- */
- const computePosition$1 = async (reference, floating, config) => {
- const {
- placement = 'bottom',
- strategy = 'absolute',
- middleware = [],
- platform
- } = config;
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
- let rects = await platform.getElementRects({
- reference,
- floating,
- strategy
- });
- let {
- x,
- y
- } = computeCoordsFromPlacement(rects, placement, rtl);
- let statefulPlacement = placement;
- let middlewareData = {};
- let resetCount = 0;
- for (let i = 0; i < middleware.length; i++) {
- const {
- name,
- fn
- } = middleware[i];
- const {
- x: nextX,
- y: nextY,
- data,
- reset
- } = await fn({
- x,
- y,
- initialPlacement: placement,
- placement: statefulPlacement,
- strategy,
- middlewareData,
- rects,
- platform,
- elements: {
- reference,
- floating
- }
- });
- x = nextX != null ? nextX : x;
- y = nextY != null ? nextY : y;
- middlewareData = { ...middlewareData,
- [name]: { ...middlewareData[name],
- ...data
- }
- };
- if (reset && resetCount <= 50) {
- resetCount++;
- if (typeof reset === 'object') {
- if (reset.placement) {
- statefulPlacement = reset.placement;
- }
- if (reset.rects) {
- rects = reset.rects === true ? await platform.getElementRects({
- reference,
- floating,
- strategy
- }) : reset.rects;
- }
- ({
- x,
- y
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
- }
- i = -1;
- continue;
- }
- }
- return {
- x,
- y,
- placement: statefulPlacement,
- strategy,
- middlewareData
- };
- };
- function expandPaddingObject(padding) {
- return {
- top: 0,
- right: 0,
- bottom: 0,
- left: 0,
- ...padding
- };
- }
- function getSideObjectFromPadding(padding) {
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
- top: padding,
- right: padding,
- bottom: padding,
- left: padding
- };
- }
- function rectToClientRect(rect) {
- return { ...rect,
- top: rect.y,
- left: rect.x,
- right: rect.x + rect.width,
- bottom: rect.y + rect.height
- };
- }
- /**
- * Resolves with an object of overflow side offsets that determine how much the
- * element is overflowing a given clipping boundary.
- * - positive = overflowing the boundary by that number of pixels
- * - negative = how many pixels left before it will overflow
- * - 0 = lies flush with the boundary
- * @see https://floating-ui.com/docs/detectOverflow
- */
- async function detectOverflow(middlewareArguments, options) {
- var _await$platform$isEle;
- if (options === void 0) {
- options = {};
- }
- const {
- x,
- y,
- platform,
- rects,
- elements,
- strategy
- } = middlewareArguments;
- const {
- boundary = 'clippingAncestors',
- rootBoundary = 'viewport',
- elementContext = 'floating',
- altBoundary = false,
- padding = 0
- } = options;
- const paddingObject = getSideObjectFromPadding(padding);
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
- const element = elements[altBoundary ? altContext : elementContext];
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
- element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
- boundary,
- rootBoundary,
- strategy
- }));
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
- rect: elementContext === 'floating' ? { ...rects.floating,
- x,
- y
- } : rects.reference,
- offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
- strategy
- }) : rects[elementContext]);
- return {
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
- };
- }
- const min$1 = Math.min;
- const max$1 = Math.max;
- function within(min$1$1, value, max$1$1) {
- return max$1(min$1$1, min$1(value, max$1$1));
- }
- /**
- * Positions an inner element of the floating element such that it is centered
- * to the reference element.
- * @see https://floating-ui.com/docs/arrow
- */
- const arrow = options => ({
- name: 'arrow',
- options,
- async fn(middlewareArguments) {
- // Since `element` is required, we don't Partial<> the type
- const {
- element,
- padding = 0
- } = options != null ? options : {};
- const {
- x,
- y,
- placement,
- rects,
- platform
- } = middlewareArguments;
- if (element == null) {
- return {};
- }
- const paddingObject = getSideObjectFromPadding(padding);
- const coords = {
- x,
- y
- };
- const axis = getMainAxisFromPlacement(placement);
- const alignment = getAlignment(placement);
- const length = getLengthFromAxis(axis);
- const arrowDimensions = await platform.getDimensions(element);
- const minProp = axis === 'y' ? 'top' : 'left';
- const maxProp = axis === 'y' ? 'bottom' : 'right';
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
- const startDiff = coords[axis] - rects.reference[axis];
- const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
- let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
- if (clientSize === 0) {
- clientSize = rects.floating[length];
- }
- const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
- // point is outside the floating element's bounds
- const min = paddingObject[minProp];
- const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
- const offset = within(min, center, max); // Make sure that arrow points at the reference
- const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
- const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
- const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
- return {
- [axis]: coords[axis] - alignmentOffset,
- data: {
- [axis]: offset,
- centerOffset: center - offset
- }
- };
- }
- });
- const hash$1 = {
- left: 'right',
- right: 'left',
- bottom: 'top',
- top: 'bottom'
- };
- function getOppositePlacement(placement) {
- return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
- }
- function getAlignmentSides(placement, rects, rtl) {
- if (rtl === void 0) {
- rtl = false;
- }
- const alignment = getAlignment(placement);
- const mainAxis = getMainAxisFromPlacement(placement);
- const length = getLengthFromAxis(mainAxis);
- let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
- if (rects.reference[length] > rects.floating[length]) {
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
- }
- return {
- main: mainAlignmentSide,
- cross: getOppositePlacement(mainAlignmentSide)
- };
- }
- const hash = {
- start: 'end',
- end: 'start'
- };
- function getOppositeAlignmentPlacement(placement) {
- return placement.replace(/start|end/g, matched => hash[matched]);
- }
- const sides = ['top', 'right', 'bottom', 'left'];
- const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
- function getPlacementList(alignment, autoAlignment, allowedPlacements) {
- const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
- return allowedPlacementsSortedByAlignment.filter(placement => {
- if (alignment) {
- return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
- }
- return true;
- });
- }
- /**
- * Automatically chooses the `placement` which has the most space available.
- * @see https://floating-ui.com/docs/autoPlacement
- */
- const autoPlacement = function (options) {
- if (options === void 0) {
- options = {};
- }
- return {
- name: 'autoPlacement',
- options,
- async fn(middlewareArguments) {
- var _middlewareData$autoP, _middlewareData$autoP2, _middlewareData$autoP3, _middlewareData$autoP4, _placementsSortedByLe;
- const {
- x,
- y,
- rects,
- middlewareData,
- placement,
- platform,
- elements
- } = middlewareArguments;
- const {
- alignment = null,
- allowedPlacements = allPlacements,
- autoAlignment = true,
- ...detectOverflowOptions
- } = options;
- const placements = getPlacementList(alignment, autoAlignment, allowedPlacements);
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
- const currentIndex = (_middlewareData$autoP = (_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.index) != null ? _middlewareData$autoP : 0;
- const currentPlacement = placements[currentIndex];
- if (currentPlacement == null) {
- return {};
- }
- const {
- main,
- cross
- } = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))); // Make `computeCoords` start from the right place
- if (placement !== currentPlacement) {
- return {
- x,
- y,
- reset: {
- placement: placements[0]
- }
- };
- }
- const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main], overflow[cross]];
- const allOverflows = [...((_middlewareData$autoP3 = (_middlewareData$autoP4 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP4.overflows) != null ? _middlewareData$autoP3 : []), {
- placement: currentPlacement,
- overflows: currentOverflows
- }];
- const nextPlacement = placements[currentIndex + 1]; // There are more placements to check
- if (nextPlacement) {
- return {
- data: {
- index: currentIndex + 1,
- overflows: allOverflows
- },
- reset: {
- placement: nextPlacement
- }
- };
- }
- const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);
- const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {
- let {
- overflows
- } = _ref;
- return overflows.every(overflow => overflow <= 0);
- })) == null ? void 0 : _placementsSortedByLe.placement;
- const resetPlacement = placementThatFitsOnAllSides != null ? placementThatFitsOnAllSides : placementsSortedByLeastOverflow[0].placement;
- if (resetPlacement !== placement) {
- return {
- data: {
- index: currentIndex + 1,
- overflows: allOverflows
- },
- reset: {
- placement: resetPlacement
- }
- };
- }
- return {};
- }
- };
- };
- function getExpandedPlacements(placement) {
- const oppositePlacement = getOppositePlacement(placement);
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
- }
- /**
- * Changes the placement of the floating element to one that will fit if the
- * initially specified `placement` does not.
- * @see https://floating-ui.com/docs/flip
- */
- const flip = function (options) {
- if (options === void 0) {
- options = {};
- }
- return {
- name: 'flip',
- options,
- async fn(middlewareArguments) {
- var _middlewareData$flip;
- const {
- placement,
- middlewareData,
- rects,
- initialPlacement,
- platform,
- elements
- } = middlewareArguments;
- const {
- mainAxis: checkMainAxis = true,
- crossAxis: checkCrossAxis = true,
- fallbackPlacements: specifiedFallbackPlacements,
- fallbackStrategy = 'bestFit',
- flipAlignment = true,
- ...detectOverflowOptions
- } = options;
- const side = getSide(placement);
- const isBasePlacement = side === initialPlacement;
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
- const placements = [initialPlacement, ...fallbackPlacements];
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
- const overflows = [];
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
- if (checkMainAxis) {
- overflows.push(overflow[side]);
- }
- if (checkCrossAxis) {
- const {
- main,
- cross
- } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
- overflows.push(overflow[main], overflow[cross]);
- }
- overflowsData = [...overflowsData, {
- placement,
- overflows
- }]; // One or more sides is overflowing
- if (!overflows.every(side => side <= 0)) {
- var _middlewareData$flip$, _middlewareData$flip2;
- const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
- const nextPlacement = placements[nextIndex];
- if (nextPlacement) {
- // Try next placement and re-run the lifecycle
- return {
- data: {
- index: nextIndex,
- overflows: overflowsData
- },
- reset: {
- placement: nextPlacement
- }
- };
- }
- let resetPlacement = 'bottom';
- switch (fallbackStrategy) {
- case 'bestFit':
- {
- var _overflowsData$map$so;
- const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
- if (placement) {
- resetPlacement = placement;
- }
- break;
- }
- case 'initialPlacement':
- resetPlacement = initialPlacement;
- break;
- }
- if (placement !== resetPlacement) {
- return {
- reset: {
- placement: resetPlacement
- }
- };
- }
- }
- return {};
- }
- };
- };
- function getSideOffsets(overflow, rect) {
- return {
- top: overflow.top - rect.height,
- right: overflow.right - rect.width,
- bottom: overflow.bottom - rect.height,
- left: overflow.left - rect.width
- };
- }
- function isAnySideFullyClipped(overflow) {
- return sides.some(side => overflow[side] >= 0);
- }
- /**
- * Provides data to hide the floating element in applicable situations, such as
- * when it is not in the same clipping context as the reference element.
- * @see https://floating-ui.com/docs/hide
- */
- const hide = function (_temp) {
- let {
- strategy = 'referenceHidden',
- ...detectOverflowOptions
- } = _temp === void 0 ? {} : _temp;
- return {
- name: 'hide',
- async fn(middlewareArguments) {
- const {
- rects
- } = middlewareArguments;
- switch (strategy) {
- case 'referenceHidden':
- {
- const overflow = await detectOverflow(middlewareArguments, { ...detectOverflowOptions,
- elementContext: 'reference'
- });
- const offsets = getSideOffsets(overflow, rects.reference);
- return {
- data: {
- referenceHiddenOffsets: offsets,
- referenceHidden: isAnySideFullyClipped(offsets)
- }
- };
- }
- case 'escaped':
- {
- const overflow = await detectOverflow(middlewareArguments, { ...detectOverflowOptions,
- altBoundary: true
- });
- const offsets = getSideOffsets(overflow, rects.floating);
- return {
- data: {
- escapedOffsets: offsets,
- escaped: isAnySideFullyClipped(offsets)
- }
- };
- }
- default:
- {
- return {};
- }
- }
- }
- };
- };
- async function convertValueToCoords(middlewareArguments, value) {
- const {
- placement,
- platform,
- elements
- } = middlewareArguments;
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
- const side = getSide(placement);
- const alignment = getAlignment(placement);
- const isVertical = getMainAxisFromPlacement(placement) === 'x';
- const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
- const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
- let {
- mainAxis,
- crossAxis,
- alignmentAxis
- } = typeof rawValue === 'number' ? {
- mainAxis: rawValue,
- crossAxis: 0,
- alignmentAxis: null
- } : {
- mainAxis: 0,
- crossAxis: 0,
- alignmentAxis: null,
- ...rawValue
- };
- if (alignment && typeof alignmentAxis === 'number') {
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
- }
- return isVertical ? {
- x: crossAxis * crossAxisMulti,
- y: mainAxis * mainAxisMulti
- } : {
- x: mainAxis * mainAxisMulti,
- y: crossAxis * crossAxisMulti
- };
- }
- /**
- * Displaces the floating element from its reference element.
- * @see https://floating-ui.com/docs/offset
- */
- const offset = function (value) {
- if (value === void 0) {
- value = 0;
- }
- return {
- name: 'offset',
- options: value,
- async fn(middlewareArguments) {
- const {
- x,
- y
- } = middlewareArguments;
- const diffCoords = await convertValueToCoords(middlewareArguments, value);
- return {
- x: x + diffCoords.x,
- y: y + diffCoords.y,
- data: diffCoords
- };
- }
- };
- };
- function getCrossAxis(axis) {
- return axis === 'x' ? 'y' : 'x';
- }
- /**
- * Shifts the floating element in order to keep it in view when it will overflow
- * a clipping boundary.
- * @see https://floating-ui.com/docs/shift
- */
- const shift = function (options) {
- if (options === void 0) {
- options = {};
- }
- return {
- name: 'shift',
- options,
- async fn(middlewareArguments) {
- const {
- x,
- y,
- placement
- } = middlewareArguments;
- const {
- mainAxis: checkMainAxis = true,
- crossAxis: checkCrossAxis = false,
- limiter = {
- fn: _ref => {
- let {
- x,
- y
- } = _ref;
- return {
- x,
- y
- };
- }
- },
- ...detectOverflowOptions
- } = options;
- const coords = {
- x,
- y
- };
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
- const mainAxis = getMainAxisFromPlacement(getSide(placement));
- const crossAxis = getCrossAxis(mainAxis);
- let mainAxisCoord = coords[mainAxis];
- let crossAxisCoord = coords[crossAxis];
- if (checkMainAxis) {
- const minSide = mainAxis === 'y' ? 'top' : 'left';
- const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
- const min = mainAxisCoord + overflow[minSide];
- const max = mainAxisCoord - overflow[maxSide];
- mainAxisCoord = within(min, mainAxisCoord, max);
- }
- if (checkCrossAxis) {
- const minSide = crossAxis === 'y' ? 'top' : 'left';
- const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
- const min = crossAxisCoord + overflow[minSide];
- const max = crossAxisCoord - overflow[maxSide];
- crossAxisCoord = within(min, crossAxisCoord, max);
- }
- const limitedCoords = limiter.fn({ ...middlewareArguments,
- [mainAxis]: mainAxisCoord,
- [crossAxis]: crossAxisCoord
- });
- return { ...limitedCoords,
- data: {
- x: limitedCoords.x - x,
- y: limitedCoords.y - y
- }
- };
- }
- };
- };
- function isWindow(value) {
- return value && value.document && value.location && value.alert && value.setInterval;
- }
- function getWindow(node) {
- if (node == null) {
- return window;
- }
- if (!isWindow(node)) {
- const ownerDocument = node.ownerDocument;
- return ownerDocument ? ownerDocument.defaultView || window : window;
- }
- return node;
- }
- function getComputedStyle$1(element) {
- return getWindow(element).getComputedStyle(element);
- }
- function getNodeName(node) {
- return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
- }
- function getUAString() {
- const uaData = navigator.userAgentData;
- if (uaData != null && uaData.brands) {
- return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
- }
- return navigator.userAgent;
- }
- function isHTMLElement(value) {
- return value instanceof getWindow(value).HTMLElement;
- }
- function isElement(value) {
- return value instanceof getWindow(value).Element;
- }
- function isNode(value) {
- return value instanceof getWindow(value).Node;
- }
- function isShadowRoot(node) {
- // Browsers without `ShadowRoot` support
- if (typeof ShadowRoot === 'undefined') {
- return false;
- }
- const OwnElement = getWindow(node).ShadowRoot;
- return node instanceof OwnElement || node instanceof ShadowRoot;
- }
- function isOverflowElement(element) {
- // Firefox wants us to check `-x` and `-y` variations as well
- const {
- overflow,
- overflowX,
- overflowY,
- display
- } = getComputedStyle$1(element);
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
- }
- function isTableElement(element) {
- return ['table', 'td', 'th'].includes(getNodeName(element));
- }
- function isContainingBlock(element) {
- // TODO: Try and use feature detection here instead
- const isFirefox = /firefox/i.test(getUAString());
- const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
- // create a containing block.
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
- return css.transform !== 'none' || css.perspective !== 'none' || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat
- value => {
- const contain = css.contain;
- return contain != null ? contain.includes(value) : false;
- });
- }
- function isLayoutViewport() {
- // Not Safari
- return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
- // • Always-visible scrollbar or not
- // • Width of <html>, etc.
- // const vV = win.visualViewport;
- // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
- }
- function isLastTraversableNode(node) {
- return ['html', 'body', '#document'].includes(getNodeName(node));
- }
- const min = Math.min;
- const max = Math.max;
- const round = Math.round;
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
- var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
- if (includeScale === void 0) {
- includeScale = false;
- }
- if (isFixedStrategy === void 0) {
- isFixedStrategy = false;
- }
- const clientRect = element.getBoundingClientRect();
- let scaleX = 1;
- let scaleY = 1;
- if (includeScale && isHTMLElement(element)) {
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
- }
- const win = isElement(element) ? getWindow(element) : window;
- const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
- const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
- const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
- const width = clientRect.width / scaleX;
- const height = clientRect.height / scaleY;
- return {
- width,
- height,
- top: y,
- right: x + width,
- bottom: y + height,
- left: x,
- x,
- y
- };
- }
- function getDocumentElement(node) {
- return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
- }
- function getNodeScroll(element) {
- if (isElement(element)) {
- return {
- scrollLeft: element.scrollLeft,
- scrollTop: element.scrollTop
- };
- }
- return {
- scrollLeft: element.pageXOffset,
- scrollTop: element.pageYOffset
- };
- }
- function getWindowScrollBarX(element) {
- // If <html> has a CSS width greater than the viewport, then this will be
- // incorrect for RTL.
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
- }
- function isScaled(element) {
- const rect = getBoundingClientRect(element);
- return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
- }
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
- const documentElement = getDocumentElement(offsetParent);
- const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
- isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
- let scroll = {
- scrollLeft: 0,
- scrollTop: 0
- };
- const offsets = {
- x: 0,
- y: 0
- };
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
- scroll = getNodeScroll(offsetParent);
- }
- if (isHTMLElement(offsetParent)) {
- const offsetRect = getBoundingClientRect(offsetParent, true);
- offsets.x = offsetRect.x + offsetParent.clientLeft;
- offsets.y = offsetRect.y + offsetParent.clientTop;
- } else if (documentElement) {
- offsets.x = getWindowScrollBarX(documentElement);
- }
- }
- return {
- x: rect.left + scroll.scrollLeft - offsets.x,
- y: rect.top + scroll.scrollTop - offsets.y,
- width: rect.width,
- height: rect.height
- };
- }
- function getParentNode(node) {
- if (getNodeName(node) === 'html') {
- return node;
- }
- return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
- // @ts-ignore
- node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
- node.parentNode || ( // DOM Element detected
- isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
- getDocumentElement(node) // fallback
- );
- }
- function getTrueOffsetParent(element) {
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
- return null;
- }
- return element.offsetParent;
- }
- function getContainingBlock(element) {
- let currentNode = getParentNode(element);
- if (isShadowRoot(currentNode)) {
- currentNode = currentNode.host;
- }
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
- if (isContainingBlock(currentNode)) {
- return currentNode;
- } else {
- const parent = currentNode.parentNode;
- currentNode = isShadowRoot(parent) ? parent.host : parent;
- }
- }
- return null;
- } // Gets the closest ancestor positioned element. Handles some edge cases,
- // such as table ancestors and cross browser bugs.
- function getOffsetParent(element) {
- const window = getWindow(element);
- let offsetParent = getTrueOffsetParent(element);
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
- offsetParent = getTrueOffsetParent(offsetParent);
- }
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
- return window;
- }
- return offsetParent || getContainingBlock(element) || window;
- }
- function getDimensions(element) {
- if (isHTMLElement(element)) {
- return {
- width: element.offsetWidth,
- height: element.offsetHeight
- };
- }
- const rect = getBoundingClientRect(element);
- return {
- width: rect.width,
- height: rect.height
- };
- }
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
- let {
- rect,
- offsetParent,
- strategy
- } = _ref;
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
- const documentElement = getDocumentElement(offsetParent);
- if (offsetParent === documentElement) {
- return rect;
- }
- let scroll = {
- scrollLeft: 0,
- scrollTop: 0
- };
- const offsets = {
- x: 0,
- y: 0
- };
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
- scroll = getNodeScroll(offsetParent);
- }
- if (isHTMLElement(offsetParent)) {
- const offsetRect = getBoundingClientRect(offsetParent, true);
- offsets.x = offsetRect.x + offsetParent.clientLeft;
- offsets.y = offsetRect.y + offsetParent.clientTop;
- } // This doesn't appear to be need to be negated.
- // else if (documentElement) {
- // offsets.x = getWindowScrollBarX(documentElement);
- // }
- }
- return { ...rect,
- x: rect.x - scroll.scrollLeft + offsets.x,
- y: rect.y - scroll.scrollTop + offsets.y
- };
- }
- function getViewportRect(element, strategy) {
- const win = getWindow(element);
- const html = getDocumentElement(element);
- const visualViewport = win.visualViewport;
- let width = html.clientWidth;
- let height = html.clientHeight;
- let x = 0;
- let y = 0;
- if (visualViewport) {
- width = visualViewport.width;
- height = visualViewport.height;
- const layoutViewport = isLayoutViewport();
- if (layoutViewport || !layoutViewport && strategy === 'fixed') {
- x = visualViewport.offsetLeft;
- y = visualViewport.offsetTop;
- }
- }
- return {
- width,
- height,
- x,
- y
- };
- }
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
- function getDocumentRect(element) {
- var _element$ownerDocumen;
- const html = getDocumentElement(element);
- const scroll = getNodeScroll(element);
- const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
- const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
- const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
- const y = -scroll.scrollTop;
- if (getComputedStyle$1(body || html).direction === 'rtl') {
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
- }
- return {
- width,
- height,
- x,
- y
- };
- }
- function getNearestOverflowAncestor(node) {
- const parentNode = getParentNode(node);
- if (isLastTraversableNode(parentNode)) {
- // @ts-ignore assume body is always available
- return node.ownerDocument.body;
- }
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
- return parentNode;
- }
- return getNearestOverflowAncestor(parentNode);
- }
- function getOverflowAncestors(node, list) {
- var _node$ownerDocument;
- if (list === void 0) {
- list = [];
- }
- const scrollableAncestor = getNearestOverflowAncestor(node);
- const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
- const win = getWindow(scrollableAncestor);
- const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
- const updatedList = list.concat(target);
- return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
- updatedList.concat(getOverflowAncestors(target));
- }
- function contains(parent, child) {
- const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
- if (parent.contains(child)) {
- return true;
- } // then fallback to custom implementation with Shadow DOM support
- else if (rootNode && isShadowRoot(rootNode)) {
- let next = child;
- do {
- // use `===` replace node.isSameNode()
- if (next && parent === next) {
- return true;
- } // @ts-ignore: need a better way to handle this...
- next = next.parentNode || next.host;
- } while (next);
- }
- return false;
- }
- function getNearestParentCapableOfEscapingClipping(element, clippingAncestors) {
- let currentNode = element;
- while (currentNode && !isLastTraversableNode(currentNode) && // @ts-expect-error
- !clippingAncestors.includes(currentNode)) {
- if (isElement(currentNode) && ['absolute', 'fixed'].includes(getComputedStyle$1(currentNode).position)) {
- break;
- }
- const parentNode = getParentNode(currentNode);
- currentNode = isShadowRoot(parentNode) ? parentNode.host : parentNode;
- }
- return currentNode;
- }
- function getInnerBoundingClientRect(element, strategy) {
- const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
- const top = clientRect.top + element.clientTop;
- const left = clientRect.left + element.clientLeft;
- return {
- top,
- left,
- x: left,
- y: top,
- right: left + element.clientWidth,
- bottom: top + element.clientHeight,
- width: element.clientWidth,
- height: element.clientHeight
- };
- }
- function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
- if (clippingParent === 'viewport') {
- return rectToClientRect(getViewportRect(element, strategy));
- }
- if (isElement(clippingParent)) {
- return getInnerBoundingClientRect(clippingParent, strategy);
- }
- return rectToClientRect(getDocumentRect(getDocumentElement(element)));
- } // A "clipping ancestor" is an overflowable container with the characteristic of
- // clipping (or hiding) overflowing elements with a position different from
- // `initial`
- function getClippingAncestors(element) {
- const clippingAncestors = getOverflowAncestors(element);
- const nearestEscapableParent = getNearestParentCapableOfEscapingClipping(element, clippingAncestors);
- let clipperElement = null;
- if (nearestEscapableParent && isHTMLElement(nearestEscapableParent)) {
- const offsetParent = getOffsetParent(nearestEscapableParent);
- if (isOverflowElement(nearestEscapableParent)) {
- clipperElement = nearestEscapableParent;
- } else if (isHTMLElement(offsetParent)) {
- clipperElement = offsetParent;
- }
- }
- if (!isElement(clipperElement)) {
- return [];
- } // @ts-ignore isElement check ensures we return Array<Element>
- return clippingAncestors.filter(clippingAncestors => clipperElement && isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
- } // Gets the maximum area that the element is visible in due to any number of
- // clipping ancestors
- function getClippingRect(_ref) {
- let {
- element,
- boundary,
- rootBoundary,
- strategy
- } = _ref;
- const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
- const clippingAncestors = [...mainClippingAncestors, rootBoundary];
- const firstClippingAncestor = clippingAncestors[0];
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
- accRect.top = max(rect.top, accRect.top);
- accRect.right = min(rect.right, accRect.right);
- accRect.bottom = min(rect.bottom, accRect.bottom);
- accRect.left = max(rect.left, accRect.left);
- return accRect;
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
- return {
- width: clippingRect.right - clippingRect.left,
- height: clippingRect.bottom - clippingRect.top,
- x: clippingRect.left,
- y: clippingRect.top
- };
- }
- const platform = {
- getClippingRect,
- convertOffsetParentRelativeRectToViewportRelativeRect,
- isElement,
- getDimensions,
- getOffsetParent,
- getDocumentElement,
- getElementRects: _ref => {
- let {
- reference,
- floating,
- strategy
- } = _ref;
- return {
- reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
- floating: { ...getDimensions(floating),
- x: 0,
- y: 0
- }
- };
- },
- getClientRects: element => Array.from(element.getClientRects()),
- isRTL: element => getComputedStyle$1(element).direction === 'rtl'
- };
- /**
- * Computes the `x` and `y` coordinates that will place the floating element
- * next to a reference element when it is given a certain CSS positioning
- * strategy.
- */
- const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
- platform,
- ...options
- });
- const floatingUIBrowserCheck = patchFloatingUiForNonChromiumBrowsers();
- async function patchFloatingUiForNonChromiumBrowsers() {
- }
- const placementDataAttribute = "data-placement";
- /**
- * Exported for testing purposes only
- */
- const repositionDebounceTimeout = 100;
- const effectivePlacements = [
- "top",
- "bottom",
- "right",
- "left",
- "top-start",
- "top-end",
- "bottom-start",
- "bottom-end",
- "right-start",
- "right-end",
- "left-start",
- "left-end"
- ];
- const defaultMenuPlacement = "bottom-start";
- const FloatingCSS = {
- animation: "calcite-floating-ui-anim",
- animationActive: "calcite-floating-ui-anim--active"
- };
- function getMiddleware({ placement, disableFlip, flipPlacements, offsetDistance, offsetSkidding, arrowEl, type }) {
- const defaultMiddleware = [shift(), hide()];
- if (type === "menu") {
- return [
- ...defaultMiddleware,
- flip({
- fallbackPlacements: flipPlacements || ["top-start", "top", "top-end", "bottom-start", "bottom", "bottom-end"]
- })
- ];
- }
- if (type === "popover" || type === "tooltip") {
- const middleware = [
- ...defaultMiddleware,
- offset({
- mainAxis: typeof offsetDistance === "number" ? offsetDistance : 0,
- crossAxis: typeof offsetSkidding === "number" ? offsetSkidding : 0
- })
- ];
- if (placement === "auto" || placement === "auto-start" || placement === "auto-end") {
- middleware.push(autoPlacement({ alignment: placement === "auto-start" ? "start" : placement === "auto-end" ? "end" : null }));
- }
- else if (!disableFlip) {
- middleware.push(flip(flipPlacements ? { fallbackPlacements: flipPlacements } : {}));
- }
- if (arrowEl) {
- middleware.push(arrow({
- element: arrowEl
- }));
- }
- return middleware;
- }
- return [];
- }
- function filterComputedPlacements(placements, el) {
- const filteredPlacements = placements.filter((placement) => effectivePlacements.includes(placement));
- if (filteredPlacements.length !== placements.length) {
- console.warn(`${el.tagName}: Invalid value found in: flipPlacements. Try any of these: ${effectivePlacements
- .map((placement) => `"${placement}"`)
- .join(", ")
- .trim()}`, { el });
- }
- return filteredPlacements;
- }
- /*
- In floating-ui, "*-start" and "*-end" are already flipped in RTL.
- There is no need for our "*-leading" and "*-trailing" values anymore.
- https://github.com/floating-ui/floating-ui/issues/1530
- https://github.com/floating-ui/floating-ui/issues/1563
- */
- function getEffectivePlacement(floatingEl, placement) {
- const placements = ["left", "right"];
- if (getElementDir(floatingEl) === "rtl") {
- placements.reverse();
- }
- return placement
- .replace(/-leading/gi, "-start")
- .replace(/-trailing/gi, "-end")
- .replace(/leading/gi, placements[0])
- .replace(/trailing/gi, placements[1]);
- }
- /**
- * Convenience function to manage `reposition` calls for FloatingUIComponents that use `positionFloatingUI.
- *
- * Note: this is not needed for components that use `calcite-popover`.
- *
- * @param component
- * @param options
- * @param options.referenceEl
- * @param options.floatingEl
- * @param options.overlayPositioning
- * @param options.placement
- * @param options.disableFlip
- * @param options.flipPlacements
- * @param options.offsetDistance
- * @param options.offsetSkidding
- * @param options.arrowEl
- * @param options.type
- * @param delayed
- */
- async function reposition(component, options, delayed = false) {
- if (!component.open) {
- return;
- }
- return delayed ? debouncedReposition(options) : positionFloatingUI(options);
- }
- const debouncedReposition = debounce(positionFloatingUI, repositionDebounceTimeout, {
- leading: true,
- maxWait: repositionDebounceTimeout
- });
- /**
- * Positions the floating element relative to the reference element.
- *
- * **Note:** exported for testing purposes only
- *
- * @param root0
- * @param root0.referenceEl
- * @param root0.floatingEl
- * @param root0.overlayPositioning
- * @param root0.placement
- * @param root0.disableFlip
- * @param root0.flipPlacements
- * @param root0.offsetDistance
- * @param root0.offsetSkidding
- * @param root0.arrowEl
- * @param root0.type
- * @param root0.includeArrow
- */
- async function positionFloatingUI({ referenceEl, floatingEl, overlayPositioning = "absolute", placement, disableFlip, flipPlacements, offsetDistance, offsetSkidding, includeArrow = false, arrowEl, type }) {
- var _a;
- if (!referenceEl || !floatingEl || (includeArrow && !arrowEl)) {
- return null;
- }
- await floatingUIBrowserCheck;
- const { x, y, placement: effectivePlacement, strategy: position, middlewareData } = await computePosition(referenceEl, floatingEl, {
- strategy: overlayPositioning,
- placement: placement === "auto" || placement === "auto-start" || placement === "auto-end"
- ? undefined
- : getEffectivePlacement(floatingEl, placement),
- middleware: getMiddleware({
- placement,
- disableFlip,
- flipPlacements,
- offsetDistance,
- offsetSkidding,
- arrowEl,
- type
- })
- });
- if (middlewareData === null || middlewareData === void 0 ? void 0 : middlewareData.arrow) {
- const { x: arrowX, y: arrowY } = middlewareData.arrow;
- Object.assign(arrowEl.style, {
- left: arrowX != null ? `${arrowX}px` : "",
- top: arrowY != null ? `${arrowY}px` : ""
- });
- }
- const referenceHidden = (_a = middlewareData === null || middlewareData === void 0 ? void 0 : middlewareData.hide) === null || _a === void 0 ? void 0 : _a.referenceHidden;
- const visibility = referenceHidden ? "hidden" : null;
- const pointerEvents = visibility ? "none" : null;
- floatingEl.setAttribute(placementDataAttribute, effectivePlacement);
- const transform = `translate(${Math.round(x)}px,${Math.round(y)}px)`;
- Object.assign(floatingEl.style, {
- visibility,
- pointerEvents,
- position,
- top: "0",
- left: "0",
- transform
- });
- }
- /**
- * Exported for testing purposes only
- *
- * @internal
- */
- const cleanupMap = new WeakMap();
- /**
- * Helper to set up floating element interactions on connectedCallback.
- *
- * @param component
- * @param referenceEl
- * @param floatingEl
- */
- function connectFloatingUI(component, referenceEl, floatingEl) {
- if (!floatingEl || !referenceEl) {
- return;
- }
- disconnectFloatingUI(component, referenceEl, floatingEl);
- const position = component.overlayPositioning;
- // ensure position matches for initial positioning
- floatingEl.style.position = position;
- if (position === "absolute") {
- moveOffScreen(floatingEl);
- }
- const runAutoUpdate = (_refEl, _floatingEl, updateCallback) => {
- updateCallback();
- return () => {
- /* noop */
- };
- };
- cleanupMap.set(component, runAutoUpdate(referenceEl, floatingEl, () => component.reposition()));
- }
- /**
- * Helper to tear down floating element interactions on disconnectedCallback.
- *
- * @param component
- * @param referenceEl
- * @param floatingEl
- */
- function disconnectFloatingUI(component, referenceEl, floatingEl) {
- if (!floatingEl || !referenceEl) {
- return;
- }
- getTransitionTarget(floatingEl).removeEventListener("transitionend", handleTransitionElTransitionEnd);
- const cleanup = cleanupMap.get(component);
- if (cleanup) {
- cleanup();
- }
- cleanupMap.delete(component);
- }
- const visiblePointerSize = 4;
- /**
- * Default offset the position of the floating element away from the reference element.
- *
- * @default 6
- */
- const defaultOffsetDistance = Math.ceil(Math.hypot(visiblePointerSize, visiblePointerSize));
- /**
- * This utils applies floating element styles to avoid affecting layout when closed.
- *
- * This should be called when the closing transition will start.
- *
- * @param floatingEl
- */
- function updateAfterClose(floatingEl) {
- if (!floatingEl || floatingEl.style.position !== "absolute") {
- return;
- }
- getTransitionTarget(floatingEl).addEventListener("transitionend", handleTransitionElTransitionEnd);
- }
- function getTransitionTarget(floatingEl) {
- // assumes floatingEl w/ shadowRoot is a FloatingUIComponent
- return floatingEl.shadowRoot || floatingEl;
- }
- function handleTransitionElTransitionEnd(event) {
- const floatingTransitionEl = event.target;
- if (
- // using any prop from floating-ui transition
- event.propertyName === "opacity" &&
- floatingTransitionEl.classList.contains(FloatingCSS.animation)) {
- const floatingEl = getFloatingElFromTransitionTarget(floatingTransitionEl);
- moveOffScreen(floatingEl);
- getTransitionTarget(floatingEl).removeEventListener("transitionend", handleTransitionElTransitionEnd);
- }
- }
- function moveOffScreen(floatingEl) {
- floatingEl.style.transform = "";
- floatingEl.style.top = "-99999px";
- floatingEl.style.left = "-99999px";
- }
- function getFloatingElFromTransitionTarget(floatingTransitionEl) {
- return closestElementCrossShadowBoundary(floatingTransitionEl, `[${placementDataAttribute}]`);
- }
- const ComboboxItem$1 = "CALCITE-COMBOBOX-ITEM";
- const ComboboxItemGroup$1 = "CALCITE-COMBOBOX-ITEM-GROUP";
- const ComboboxChildSelector = `${ComboboxItem$1}, ${ComboboxItemGroup$1}`;
- const TEXT$j = {
- removeTag: "Remove tag"
- };
- function getAncestors(element) {
- var _a, _b;
- const parent = (_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.closest(ComboboxChildSelector);
- const grandparent = (_b = parent === null || parent === void 0 ? void 0 : parent.parentElement) === null || _b === void 0 ? void 0 : _b.closest(ComboboxChildSelector);
- return [parent, grandparent].filter((el) => el);
- }
- function getItemAncestors(item) {
- var _a;
- return (((_a = item.ancestors) === null || _a === void 0 ? void 0 : _a.filter((el) => el.nodeName === "CALCITE-COMBOBOX-ITEM")) || []);
- }
- function getItemChildren(item) {
- return nodeListToArray(item.querySelectorAll("calcite-combobox-item"));
- }
- function hasActiveChildren(node) {
- const items = nodeListToArray(node.querySelectorAll("calcite-combobox-item"));
- return items.filter((item) => item.selected).length > 0;
- }
- function getDepth(element) {
- {
- return 0;
- }
- }
- const comboboxCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-combobox{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-combobox{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-combobox{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-combobox{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-combobox:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-combobox:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-combobox-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-combobox-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-combobox-h{position:relative;display:block}/*!@: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:flex;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1);outline-color:transparent;padding-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);padding-inline:var(--calcite-combobox-item-spacing-unit-l)}/*!@:host(:focus-within) .wrapper, \n.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-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l);cursor:pointer;flex-wrap:nowrap}/*!@.grid-input*/.grid-input.sc-calcite-combobox{display:flex;flex-grow:1;flex-wrap:wrap;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px}/*!@.input*/.input.sc-calcite-combobox{flex-grow:1;-webkit-appearance:none;appearance:none;border-style:none;background-color:transparent;padding:0px;font-family:inherit;color:var(--calcite-ui-text-1);font-size:inherit;block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);min-inline-size:120px;margin-block-end: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-block: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;inline-size:0px;min-inline-size:0px;opacity:0}/*!@.input--icon*/.input--icon.sc-calcite-combobox{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}/*!@.input-wrap*/.input-wrap.sc-calcite-combobox{display:flex;flex-grow:1}/*!@.input-wrap--single*/.input-wrap--single.sc-calcite-combobox{flex:1 1 0%;overflow:hidden}/*!@.label*/.label.sc-calcite-combobox{pointer-events:none;display:flex;max-inline-size:100%;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;font-weight:var(--calcite-font-weight-normal);block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}/*!@.label--icon*/.label--icon.sc-calcite-combobox{padding-inline:var(--calcite-combobox-item-spacing-unit-l)}/*!@.icon-end, \n.icon-start*/.icon-end.sc-calcite-combobox,.icon-start.sc-calcite-combobox{display:flex;inline-size:1rem;cursor:pointer;align-items:center}/*!@.icon-end*/.icon-end.sc-calcite-combobox{flex:none}/*!@.floating-ui-container*/.floating-ui-container.sc-calcite-combobox{display:block;position:absolute;z-index:900;visibility:hidden;pointer-events:none;inline-size:0;block-size:0;overflow:hidden}/*!@.floating-ui-container .calcite-floating-ui-anim*/.floating-ui-container.sc-calcite-combobox .calcite-floating-ui-anim.sc-calcite-combobox{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@.floating-ui-container[data-placement^=bottom] .calcite-floating-ui-anim*/.floating-ui-container[data-placement^=bottom].sc-calcite-combobox .calcite-floating-ui-anim.sc-calcite-combobox{transform:translateY(-5px)}/*!@.floating-ui-container[data-placement^=top] .calcite-floating-ui-anim*/.floating-ui-container[data-placement^=top].sc-calcite-combobox .calcite-floating-ui-anim.sc-calcite-combobox{transform:translateY(5px)}/*!@.floating-ui-container[data-placement^=left] .calcite-floating-ui-anim*/.floating-ui-container[data-placement^=left].sc-calcite-combobox .calcite-floating-ui-anim.sc-calcite-combobox{transform:translateX(5px)}/*!@.floating-ui-container[data-placement^=right] .calcite-floating-ui-anim*/.floating-ui-container[data-placement^=right].sc-calcite-combobox .calcite-floating-ui-anim.sc-calcite-combobox{transform:translateX(-5px)}/*!@.floating-ui-container[data-placement] .calcite-floating-ui-anim--active*/.floating-ui-container[data-placement].sc-calcite-combobox .calcite-floating-ui-anim--active.sc-calcite-combobox{opacity:1;visibility:visible;transform:translate(0)}/*!@.floating-ui-container--active*/.floating-ui-container--active.sc-calcite-combobox{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}@media (forced-colors: active){/*!@.wrapper,\n.floating-ui-container--active*/.wrapper.sc-calcite-combobox,.floating-ui-container--active.sc-calcite-combobox{border:1px solid canvasText}}/*!@.screen-readers-only*/.screen-readers-only.sc-calcite-combobox{position:absolute;inline-size:1px;block-size: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-block-size:45vh;overflow-y:auto;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}/*!@.list*/.list.sc-calcite-combobox{margin:0px;display:block;padding:0px}/*!@.list--hide*/.list--hide.sc-calcite-combobox{block-size: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-inline-size: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]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- const isGroup = (el) => el.tagName === ComboboxItemGroup$1;
- const itemUidPrefix = "combobox-item-";
- const chipUidPrefix = "combobox-chip-";
- const labelUidPrefix = "combobox-label-";
- const listboxUidPrefix = "combobox-listbox-";
- const inputUidPrefix = "combobox-input-";
- /**
- * @slot - A slot for adding `calcite-combobox-item`s.
- */
- class Combobox {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteLookupChange = createEvent(this, "calciteLookupChange", 6);
- this.calciteComboboxChange = createEvent(this, "calciteComboboxChange", 6);
- this.calciteComboboxFilterChange = createEvent(this, "calciteComboboxFilterChange", 6);
- this.calciteComboboxChipDismiss = createEvent(this, "calciteComboboxChipDismiss", 6);
- this.calciteComboboxBeforeClose = createEvent(this, "calciteComboboxBeforeClose", 6);
- this.calciteComboboxClose = createEvent(this, "calciteComboboxClose", 6);
- this.calciteComboboxBeforeOpen = createEvent(this, "calciteComboboxBeforeOpen", 6);
- this.calciteComboboxOpen = createEvent(this, "calciteComboboxOpen", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, displays and positions the component.
- *
- * @deprecated use `open` instead.
- */
- this.active = false;
- /**When `true`, displays and positions the component. */
- this.open = false;
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /** Specifies the maximum number of `calcite-combobox-item`s (including nested children) to display before displaying a scrollbar. */
- this.maxItems = 0;
- /**
- * Determines the type of positioning to use for the overlaid content.
- *
- * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
- *
- * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
- *
- */
- this.overlayPositioning = "absolute";
- /**
- * When `true`, the component must have a value in order for the form to submit.
- *
- * @internal
- */
- this.required = false;
- /**
- * Specifies the selection mode -
- * `"multi"` (allow any number of selected items),
- * `"single"` (allow only one selection), or
- * `"ancestors"` (like `"multi"`, but show ancestors of selected items as selected. Only the deepest children are shown in `calcite-chip`s).
- */
- this.selectionMode = "multi";
- /** Specifies the size of the component. */
- this.scale = "m";
- /** The component's value(s) from the selected `calcite-combobox-item`(s). */
- this.value = null;
- /**
- * Accessible name for the component's remove tag when a `calcite-combobox-item` is selected.
- *
- * @default "Remove tag"
- */
- this.intlRemoveTag = TEXT$j.removeTag;
- //--------------------------------------------------------------------------
- //
- // Private State/Props
- //
- //--------------------------------------------------------------------------
- this.placement = defaultMenuPlacement;
- this.internalValueChangeFlag = false;
- this.items = [];
- this.groupItems = [];
- this.selectedItems = [];
- this.visibleItems = [];
- this.activeItemIndex = -1;
- this.activeChipIndex = -1;
- this.activeDescendant = "";
- this.text = "";
- this.textInput = null;
- this.mutationObserver = createObserver();
- this.resizeObserver = createObserver();
- this.guid = guid();
- this.inputHeight = 0;
- this.ignoreSelectedEventsFlag = false;
- this.openTransitionProp = "opacity";
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.setFilteredPlacements = () => {
- const { el, flipPlacements } = this;
- this.filteredFlipPlacements = flipPlacements
- ? filterComputedPlacements(flipPlacements, el)
- : null;
- };
- this.getValue = () => {
- 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(); });
- return (items === null || items === void 0 ? void 0 : items.length) ? (items.length > 1 ? items : items[0]) : "";
- };
- this.onLabelClick = () => {
- this.setFocus();
- };
- this.keydownHandler = (event) => {
- const { key } = event;
- switch (key) {
- case "Tab":
- this.activeChipIndex = -1;
- this.activeItemIndex = -1;
- if (this.allowCustomValues && this.text) {
- this.addCustomChip(this.text, true);
- event.preventDefault();
- }
- else if (this.open) {
- this.open = false;
- event.preventDefault();
- }
- break;
- case "ArrowLeft":
- this.previousChip();
- event.preventDefault();
- break;
- case "ArrowRight":
- this.nextChip();
- event.preventDefault();
- break;
- case "ArrowUp":
- event.preventDefault();
- this.shiftActiveItemIndex(-1);
- if (!this.comboboxInViewport()) {
- this.el.scrollIntoView();
- }
- break;
- case "ArrowDown":
- event.preventDefault();
- if (!this.open) {
- this.open = true;
- }
- this.shiftActiveItemIndex(1);
- if (!this.comboboxInViewport()) {
- this.el.scrollIntoView();
- }
- break;
- case " ":
- if (!this.textInput.value) {
- event.preventDefault();
- this.open = true;
- this.shiftActiveItemIndex(1);
- }
- break;
- case "Home":
- if (!this.open) {
- return;
- }
- event.preventDefault();
- this.updateActiveItemIndex(0);
- this.scrollToActiveItem();
- if (!this.comboboxInViewport()) {
- this.el.scrollIntoView();
- }
- break;
- case "End":
- if (!this.open) {
- return;
- }
- event.preventDefault();
- this.updateActiveItemIndex(this.visibleItems.length - 1);
- this.scrollToActiveItem();
- if (!this.comboboxInViewport()) {
- this.el.scrollIntoView();
- }
- break;
- case "Escape":
- this.open = false;
- event.preventDefault();
- break;
- case "Enter":
- if (this.activeItemIndex > -1) {
- this.toggleSelection(this.visibleItems[this.activeItemIndex]);
- event.preventDefault();
- }
- else if (this.activeChipIndex > -1) {
- this.removeActiveChip();
- event.preventDefault();
- }
- else if (this.allowCustomValues && this.text) {
- this.addCustomChip(this.text, true);
- event.preventDefault();
- }
- else if (!event.defaultPrevented) {
- if (submitForm(this)) {
- event.preventDefault();
- }
- }
- break;
- case "Delete":
- case "Backspace":
- if (this.activeChipIndex > -1) {
- event.preventDefault();
- this.removeActiveChip();
- }
- else if (!this.text && this.isMulti()) {
- event.preventDefault();
- this.removeLastChip();
- }
- break;
- }
- };
- this.toggleCloseEnd = () => {
- this.open = false;
- this.el.removeEventListener("calciteComboboxClose", this.toggleCloseEnd);
- };
- this.toggleOpenEnd = () => {
- this.open = false;
- this.el.removeEventListener("calciteComboboxOpen", this.toggleOpenEnd);
- };
- this.setMaxScrollerHeight = async () => {
- const { listContainerEl, open, referenceEl } = this;
- if (!listContainerEl || !open) {
- return;
- }
- await this.reposition(true);
- const maxScrollerHeight = this.getMaxScrollerHeight();
- listContainerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
- listContainerEl.style.minWidth = `${referenceEl.clientWidth}px`;
- await this.reposition(true);
- };
- this.calciteChipDismissHandler = (event, comboboxItem) => {
- this.open = false;
- const selection = this.items.find((item) => item === comboboxItem);
- if (selection) {
- this.toggleSelection(selection, false);
- }
- this.calciteComboboxChipDismiss.emit(event.detail);
- };
- this.clickHandler = (event) => {
- if (event.composedPath().some((node) => node.tagName === "CALCITE-CHIP")) {
- return;
- }
- this.open = !this.open;
- this.updateActiveItemIndex(0);
- this.setFocus();
- };
- this.setInactiveIfNotContained = (event) => {
- const composedPath = event.composedPath();
- if (!this.open || composedPath.includes(this.el) || composedPath.includes(this.referenceEl)) {
- return;
- }
- if (this.allowCustomValues && this.text.trim().length) {
- this.addCustomChip(this.text);
- }
- if (this.selectionMode === "single") {
- if (this.textInput) {
- this.textInput.value = "";
- }
- this.text = "";
- this.filterItems("");
- this.updateActiveItemIndex(-1);
- }
- this.open = false;
- };
- this.setFloatingEl = (el) => {
- this.floatingEl = el;
- connectFloatingUI(this, this.referenceEl, this.floatingEl);
- };
- this.setContainerEl = (el) => {
- this.resizeObserver.observe(el);
- this.listContainerEl = el;
- this.transitionEl = el;
- connectOpenCloseComponent(this);
- };
- this.setReferenceEl = (el) => {
- this.referenceEl = el;
- connectFloatingUI(this, this.referenceEl, this.floatingEl);
- };
- this.inputHandler = (event) => {
- const value = event.target.value;
- this.text = value;
- this.filterItems(value);
- if (value) {
- this.activeChipIndex = -1;
- }
- };
- this.filterItems = (() => {
- const find = (item, filteredData) => item &&
- filteredData.some(({ label, value }) => {
- if (isGroup(item)) {
- return value === item.label;
- }
- return (value === item.textLabel ||
- value === item.value ||
- label === item.textLabel ||
- label === item.value);
- });
- return debounce((text) => {
- const filteredData = filter(this.data, text);
- const items = this.getCombinedItems();
- items.forEach((item) => {
- const hidden = !find(item, filteredData);
- item.hidden = hidden;
- const [parent, grandparent] = item.ancestors;
- if (find(parent, filteredData) || find(grandparent, filteredData)) {
- item.hidden = false;
- }
- if (!hidden) {
- item.ancestors.forEach((ancestor) => (ancestor.hidden = false));
- }
- });
- this.visibleItems = this.getVisibleItems();
- this.calciteComboboxFilterChange.emit({ visibleItems: [...this.visibleItems], text: text });
- }, 100);
- })();
- this.internalCalciteLookupChangeEvent = () => {
- this.calciteLookupChange.emit(this.selectedItems);
- };
- this.emitCalciteLookupChange = debounce(this.internalCalciteLookupChangeEvent, 0);
- this.internalComboboxChangeEvent = () => {
- const { selectedItems } = this;
- this.calciteComboboxChange.emit({ selectedItems });
- };
- this.emitComboboxChange = debounce(this.internalComboboxChangeEvent, 0);
- this.updateItems = () => {
- this.items = this.getItems();
- this.groupItems = this.getGroupItems();
- this.data = this.getData();
- this.selectedItems = this.getSelectedItems();
- this.visibleItems = this.getVisibleItems();
- this.needsIcon = this.getNeedsIcon();
- if (!this.allowCustomValues) {
- this.setMaxScrollerHeight();
- }
- };
- this.scrollToActiveItem = () => {
- const activeItem = this.visibleItems[this.activeItemIndex];
- const height = this.calculateSingleItemHeight(activeItem);
- const { offsetHeight, scrollTop } = this.listContainerEl;
- if (offsetHeight + scrollTop < activeItem.offsetTop + height) {
- this.listContainerEl.scrollTop = activeItem.offsetTop - offsetHeight + height;
- }
- else if (activeItem.offsetTop < scrollTop) {
- this.listContainerEl.scrollTop = activeItem.offsetTop;
- }
- };
- this.comboboxFocusHandler = () => {
- var _a;
- (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
- };
- this.comboboxBlurHandler = (event) => {
- this.setInactiveIfNotContained(event);
- };
- }
- activeHandler(value) {
- if (this.disabled) {
- this.active = false;
- this.open = false;
- return;
- }
- this.open = value;
- }
- openHandler(value) {
- if (!value) {
- updateAfterClose(this.floatingEl);
- }
- if (this.disabled) {
- this.active = false;
- this.open = false;
- return;
- }
- this.active = value;
- this.setMaxScrollerHeight();
- }
- handleDisabledChange(value) {
- if (!value) {
- this.active = false;
- this.open = false;
- }
- }
- maxItemsHandler() {
- this.setMaxScrollerHeight();
- }
- overlayPositioningHandler() {
- this.reposition(true);
- }
- valueHandler(value) {
- if (!this.internalValueChangeFlag) {
- const items = this.getItems();
- if (Array.isArray(value)) {
- items.forEach((item) => (item.selected = value.includes(item.value)));
- }
- else if (value) {
- items.forEach((item) => (item.selected = value === item.value));
- }
- else {
- items.forEach((item) => (item.selected = false));
- }
- this.updateItems();
- }
- }
- flipPlacementsHandler() {
- this.setFilteredPlacements();
- this.reposition(true);
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- documentClickHandler(event) {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- this.setInactiveIfNotContained(event);
- }
- calciteComboboxItemChangeHandler(event) {
- if (this.ignoreSelectedEventsFlag) {
- return;
- }
- const target = event.target;
- const newIndex = this.visibleItems.indexOf(target);
- this.updateActiveItemIndex(newIndex);
- this.toggleSelection(target, target.selected);
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /**
- * Updates the position of the component.
- *
- * @param delayed
- */
- async reposition(delayed = false) {
- const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
- return reposition(this, {
- floatingEl,
- referenceEl,
- overlayPositioning,
- placement,
- flipPlacements: filteredFlipPlacements,
- type: "menu"
- }, delayed);
- }
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
- this.activeChipIndex = -1;
- this.activeItemIndex = -1;
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- this.internalValueChangeFlag = true;
- this.value = this.getValue();
- this.internalValueChangeFlag = false;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- connectLabel(this);
- connectForm(this);
- connectOpenCloseComponent(this);
- this.setFilteredPlacements();
- this.reposition(true);
- if (this.active) {
- this.activeHandler(this.active);
- }
- if (this.open) {
- this.openHandler(this.open);
- }
- }
- componentWillLoad() {
- this.updateItems();
- }
- componentDidLoad() {
- afterConnectDefaultValueSet(this, this.getValue());
- this.reposition(true);
- }
- componentDidRender() {
- if (this.el.offsetHeight !== this.inputHeight) {
- this.reposition(true);
- this.inputHeight = this.el.offsetHeight;
- }
- updateHostInteraction(this);
- }
- disconnectedCallback() {
- var _a, _b;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
- disconnectLabel(this);
- disconnectForm(this);
- disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
- disconnectOpenCloseComponent(this);
- }
- selectedItemsHandler() {
- this.internalValueChangeFlag = true;
- this.value = this.getValue();
- this.internalValueChangeFlag = false;
- }
- /** when search text is cleared, reset active to */
- textHandler() {
- this.updateActiveItemIndex(-1);
- }
- comboboxInViewport() {
- const bounding = this.el.getBoundingClientRect();
- return (bounding.top >= 0 &&
- bounding.left >= 0 &&
- bounding.right <= (window.innerWidth || document.documentElement.clientWidth) &&
- bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight));
- }
- onBeforeOpen() {
- this.calciteComboboxBeforeOpen.emit();
- }
- onOpen() {
- this.calciteComboboxOpen.emit();
- }
- onBeforeClose() {
- this.calciteComboboxBeforeClose.emit();
- }
- onClose() {
- this.calciteComboboxClose.emit();
- }
- getMaxScrollerHeight() {
- const items = this.getCombinedItems().filter((item) => !item.hidden);
- const { maxItems } = this;
- let itemsToProcess = 0;
- let maxScrollerHeight = 0;
- if (items.length > maxItems) {
- items.forEach((item) => {
- if (itemsToProcess < maxItems && maxItems > 0) {
- const height = this.calculateSingleItemHeight(item);
- if (height > 0) {
- maxScrollerHeight += height;
- itemsToProcess++;
- }
- }
- });
- }
- return maxScrollerHeight;
- }
- calculateSingleItemHeight(item) {
- let height = item.offsetHeight;
- // if item has children items, don't count their height twice
- const children = Array.from(item.querySelectorAll(ComboboxChildSelector));
- children
- .map((child) => child === null || child === void 0 ? void 0 : child.offsetHeight)
- .forEach((offsetHeight) => {
- height -= offsetHeight;
- });
- return height;
- }
- getCombinedItems() {
- return [...this.groupItems, ...this.items];
- }
- toggleSelection(item, value = !item.selected) {
- if (!item) {
- return;
- }
- if (this.isMulti()) {
- item.selected = value;
- this.updateAncestors(item);
- this.selectedItems = this.getSelectedItems();
- this.emitCalciteLookupChange();
- this.emitComboboxChange();
- this.resetText();
- this.filterItems("");
- }
- else {
- this.ignoreSelectedEventsFlag = true;
- this.items.forEach((el) => (el.selected = el === item ? value : false));
- this.ignoreSelectedEventsFlag = false;
- this.selectedItems = this.getSelectedItems();
- this.emitComboboxChange();
- if (this.textInput) {
- this.textInput.value = item.textLabel;
- }
- this.open = false;
- this.updateActiveItemIndex(-1);
- this.resetText();
- this.filterItems("");
- }
- }
- updateAncestors(item) {
- if (this.selectionMode !== "ancestors") {
- return;
- }
- const ancestors = getItemAncestors(item);
- const children = getItemChildren(item);
- if (item.selected) {
- ancestors.forEach((el) => {
- el.selected = true;
- });
- }
- else {
- children.forEach((el) => (el.selected = false));
- [...ancestors].forEach((el) => {
- if (!hasActiveChildren(el)) {
- el.selected = false;
- }
- });
- }
- }
- getVisibleItems() {
- return this.items.filter((item) => !item.hidden);
- }
- getSelectedItems() {
- if (!this.isMulti()) {
- const match = this.items.find(({ selected }) => selected);
- return match ? [match] : [];
- }
- return (this.items
- .filter((item) => item.selected && (this.selectionMode !== "ancestors" || !hasActiveChildren(item)))
- /** Preserve order of entered tags */
- .sort((a, b) => {
- const aIdx = this.selectedItems.indexOf(a);
- const bIdx = this.selectedItems.indexOf(b);
- if (aIdx > -1 && bIdx > -1) {
- return aIdx - bIdx;
- }
- return bIdx - aIdx;
- }));
- }
- getData() {
- return this.items.map((item) => ({
- constant: item.constant,
- filterDisabled: item.filterDisabled,
- value: item.value,
- label: item.textLabel
- }));
- }
- getNeedsIcon() {
- return this.selectionMode === "single" && this.items.some((item) => item.icon);
- }
- resetText() {
- if (this.textInput) {
- this.textInput.value = "";
- }
- this.text = "";
- }
- getItems() {
- const items = Array.from(this.el.querySelectorAll(ComboboxItem$1));
- return items.filter((item) => !item.disabled);
- }
- getGroupItems() {
- return Array.from(this.el.querySelectorAll(ComboboxItemGroup$1));
- }
- addCustomChip(value, focus) {
- const existingItem = this.items.find((el) => el.textLabel === value);
- if (existingItem) {
- this.toggleSelection(existingItem, true);
- }
- else {
- if (!this.isMulti()) {
- this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
- }
- const item = document.createElement(ComboboxItem$1);
- item.value = value;
- item.textLabel = value;
- item.selected = true;
- this.el.appendChild(item);
- this.resetText();
- if (focus) {
- this.setFocus();
- }
- this.updateItems();
- this.filterItems("");
- this.emitCalciteLookupChange();
- this.emitComboboxChange();
- }
- }
- removeActiveChip() {
- this.toggleSelection(this.selectedItems[this.activeChipIndex], false);
- this.setFocus();
- }
- removeLastChip() {
- this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
- this.setFocus();
- }
- previousChip() {
- if (this.text) {
- return;
- }
- const length = this.selectedItems.length - 1;
- const active = this.activeChipIndex;
- this.activeChipIndex = active === -1 ? length : Math.max(active - 1, 0);
- this.updateActiveItemIndex(-1);
- this.focusChip();
- }
- nextChip() {
- if (this.text || this.activeChipIndex === -1) {
- return;
- }
- const last = this.selectedItems.length - 1;
- const newIndex = this.activeChipIndex + 1;
- if (newIndex > last) {
- this.activeChipIndex = -1;
- this.setFocus();
- }
- else {
- this.activeChipIndex = newIndex;
- this.focusChip();
- }
- this.updateActiveItemIndex(-1);
- }
- focusChip() {
- var _a;
- const guid = (_a = this.selectedItems[this.activeChipIndex]) === null || _a === void 0 ? void 0 : _a.guid;
- const chip = guid
- ? this.referenceEl.querySelector(`#${chipUidPrefix}${guid}`)
- : null;
- chip === null || chip === void 0 ? void 0 : chip.setFocus();
- }
- shiftActiveItemIndex(delta) {
- const { length } = this.visibleItems;
- const newIndex = (this.activeItemIndex + length + delta) % length;
- this.updateActiveItemIndex(newIndex);
- this.scrollToActiveItem();
- }
- updateActiveItemIndex(index) {
- var _a;
- this.activeItemIndex = index;
- let activeDescendant = null;
- this.visibleItems.forEach((el, i) => {
- if (i === index) {
- el.active = true;
- activeDescendant = `${itemUidPrefix}${el.guid}`;
- }
- else {
- el.active = false;
- }
- });
- this.activeDescendant = activeDescendant;
- if (this.activeItemIndex > -1) {
- this.activeChipIndex = -1;
- (_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
- }
- }
- isMulti() {
- return this.selectionMode !== "single";
- }
- //--------------------------------------------------------------------------
- //
- // Render Methods
- //
- //--------------------------------------------------------------------------
- renderChips() {
- const { activeChipIndex, scale, selectionMode, intlRemoveTag } = this;
- return this.selectedItems.map((item, i) => {
- const chipClasses = {
- chip: true,
- "chip--active": activeChipIndex === i
- };
- const ancestors = [...getItemAncestors(item)].reverse();
- const pathLabel = [...ancestors, item].map((el) => el.textLabel);
- const label = selectionMode !== "ancestors" ? item.textLabel : pathLabel.join(" / ");
- 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));
- });
- }
- renderInput() {
- const { guid, active, disabled, placeholder, selectionMode, selectedItems, open } = this;
- const single = selectionMode === "single";
- const selectedItem = selectedItems[0];
- const showLabel = !(open || active) && single && !!selectedItem;
- return (hAsync("span", { class: {
- "input-wrap": true,
- "input-wrap--single": single
- } }, showLabel && (hAsync("span", { class: {
- label: true,
- "label--icon": !!(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon)
- }, key: "label" }, selectedItem.textLabel)), hAsync("input", { "aria-activedescendant": this.activeDescendant, "aria-autocomplete": "list", "aria-controls": `${listboxUidPrefix}${guid}`, "aria-label": getLabelText(this), class: {
- input: true,
- "input--single": true,
- "input--transparent": this.activeChipIndex > -1,
- "input--hidden": showLabel,
- "input--icon": !!this.placeholderIcon
- }, 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" })));
- }
- renderListBoxOptions() {
- 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)));
- }
- renderFloatingUIContainer() {
- const { active, setFloatingEl, setContainerEl, open } = this;
- const classes = {
- "list-container": true,
- [FloatingCSS.animation]: true,
- [FloatingCSS.animationActive]: open || active
- };
- return (hAsync("div", { "aria-hidden": "true", class: {
- "floating-ui-container": true,
- "floating-ui-container--active": open || active
- }, ref: setFloatingEl }, hAsync("div", { class: classes, ref: setContainerEl }, hAsync("ul", { class: { list: true, "list--hide": !(open || active) } }, hAsync("slot", null)))));
- }
- renderIconStart() {
- const { selectedItems, placeholderIcon, selectionMode } = this;
- const selectedItem = selectedItems[0];
- const selectedIcon = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon;
- const singleSelectionMode = selectionMode === "single";
- const iconAtStart = !this.open && selectedItem
- ? !!selectedIcon && singleSelectionMode
- : !!this.placeholderIcon && (!selectedItem || singleSelectionMode);
- return (iconAtStart && (hAsync("span", { class: "icon-start" }, hAsync("calcite-icon", { class: "selected-icon", icon: !this.open && selectedItem ? selectedIcon : placeholderIcon, scale: "s" }))));
- }
- renderIconEnd() {
- const { active, open } = this;
- return (hAsync("span", { class: "icon-end" }, hAsync("calcite-icon", { icon: active || open ? "chevron-up" : "chevron-down", scale: "s" })));
- }
- render() {
- const { active, guid, label, open } = this;
- const single = this.selectionMode === "single";
- return (hAsync(Host, null, hAsync("div", { "aria-autocomplete": "list", "aria-controls": `${listboxUidPrefix}${guid}`, "aria-expanded": toAriaBoolean(open || active), "aria-haspopup": "listbox", "aria-labelledby": `${labelUidPrefix}${guid}`, "aria-live": "polite", "aria-owns": `${listboxUidPrefix}${guid}`, class: {
- wrapper: true,
- "wrapper--single": single || !this.selectedItems.length,
- "wrapper--active": open || active
- }, onClick: this.clickHandler, onKeyDown: this.keydownHandler, 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.renderFloatingUIContainer(), hAsync(HiddenFormInputSlot, { component: this })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "open": ["openHandler"],
- "disabled": ["handleDisabledChange"],
- "maxItems": ["maxItemsHandler"],
- "overlayPositioning": ["overlayPositioningHandler"],
- "value": ["valueHandler"],
- "flipPlacements": ["flipPlacementsHandler"],
- "selectedItems": ["selectedItemsHandler"],
- "text": ["textHandler"]
- }; }
- static get style() { return comboboxCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-combobox",
- "$members$": {
- "active": [1540],
- "open": [1540],
- "disabled": [516],
- "label": [1],
- "placeholder": [1],
- "placeholderIcon": [513, "placeholder-icon"],
- "maxItems": [514, "max-items"],
- "name": [513],
- "allowCustomValues": [516, "allow-custom-values"],
- "overlayPositioning": [513, "overlay-positioning"],
- "required": [516],
- "selectionMode": [513, "selection-mode"],
- "scale": [513],
- "value": [1025],
- "intlRemoveTag": [1, "intl-remove-tag"],
- "flipPlacements": [16],
- "items": [32],
- "groupItems": [32],
- "selectedItems": [32],
- "visibleItems": [32],
- "needsIcon": [32],
- "activeItemIndex": [32],
- "activeChipIndex": [32],
- "activeDescendant": [32],
- "text": [32],
- "reposition": [64],
- "setFocus": [64]
- },
- "$listeners$": [[5, "pointerdown", "documentClickHandler"], [0, "calciteComboboxItemChange", "calciteComboboxItemChangeHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["open", "open"], ["disabled", "disabled"], ["placeholderIcon", "placeholder-icon"], ["maxItems", "max-items"], ["name", "name"], ["allowCustomValues", "allow-custom-values"], ["overlayPositioning", "overlay-positioning"], ["required", "required"], ["selectionMode", "selection-mode"], ["scale", "scale"]]
- }; }
- }
- const CSS$H = {
- icon: "icon",
- iconActive: "icon--active",
- custom: "icon--custom",
- dot: "icon--dot",
- single: "label--single",
- label: "label",
- active: "label--active",
- selected: "label--selected",
- title: "title",
- textContainer: "text-container"
- };
- const comboboxItemCss = "@charset \"UTF-8\";@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-combobox-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-combobox-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-combobox-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-combobox-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-combobox-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-combobox-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-combobox-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-combobox-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@.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;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@: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, \nul*/.sc-calcite-combobox-item-h,ul.sc-calcite-combobox-item{margin:0px;display:flex;flex-direction:column;padding:0px}/*!@:host(:focus), \nul:focus*/.sc-calcite-combobox-item-h:focus,ul.sc-calcite-combobox-item:focus{outline:2px solid transparent;outline-offset:2px}/*!@.label*/.label.sc-calcite-combobox-item{position:relative;box-sizing:border-box;display:flex;inline-size:100%;min-inline-size:100%;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);text-decoration-line:none;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);outline-color:transparent;padding-block:var(--calcite-combobox-item-spacing-unit-s);padding-inline: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, \n.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);text-decoration-line:none;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;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-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}/*!@.icon*/.icon.sc-calcite-combobox-item{display:inline-flex;opacity:0;transition-duration:150ms;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{padding-inline-start:var(--calcite-combobox-item-indent-value)}/*!@.icon--custom*/.icon--custom.sc-calcite-combobox-item{margin-block-start:-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:flex;justify-content:flex-end;min-inline-size: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}";
- /**
- * @slot - A slot for adding nested `calcite-combobox-item`s.
- */
- class ComboboxItem {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteComboboxItemChange = createEvent(this, "calciteComboboxItemChange", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /**
- * When `true`, the component is selected.
- */
- this.selected = false;
- /** When `true`, the component is active. */
- this.active = false;
- /** The `id` attribute of the component. When omitted, a globally unique identifier is used. */
- this.guid = guid();
- this.scale = "m";
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.itemClickHandler = (event) => {
- event.preventDefault();
- if (this.disabled) {
- return;
- }
- this.selected = !this.selected;
- };
- }
- selectedWatchHandler() {
- this.calciteComboboxItemChange.emit(this.el);
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- this.ancestors = getAncestors(this.el);
- this.scale = getElementProp(this.el, "scale", this.scale);
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /**
- * Used to toggle the selection state. By default this won't trigger an event.
- * The first argument allows the value to be coerced, rather than swapping values.
- *
- * @param coerce
- */
- async toggleSelected(coerce) {
- if (this.disabled) {
- return;
- }
- this.selected = typeof coerce === "boolean" ? coerce : !this.selected;
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderIcon(isSingle) {
- const { icon, disabled, selected } = this;
- const level = `${CSS$H.icon}--indent`;
- const defaultIcon = isSingle ? "dot" : "check";
- const iconPath = disabled ? "circle-disallowed" : defaultIcon;
- const showDot = isSingle && !icon && !disabled;
- return showDot ? (hAsync("span", { class: {
- [CSS$H.icon]: true,
- [CSS$H.dot]: true,
- [level]: true
- } })) : (hAsync("calcite-icon", { class: {
- [CSS$H.icon]: !icon,
- [CSS$H.custom]: !!icon,
- [CSS$H.iconActive]: icon && selected,
- [level]: true
- }, icon: icon || iconPath, scale: "s" }));
- }
- renderChildren() {
- if (getSlotted(this.el)) {
- return (hAsync("ul", { key: "default-slot-container" }, hAsync("slot", null)));
- }
- return null;
- }
- render() {
- const isSingleSelect = getElementProp(this.el, "selection-mode", "multi") === "single";
- const classes = {
- [CSS$H.label]: true,
- [CSS$H.selected]: this.selected,
- [CSS$H.active]: this.active,
- [CSS$H.single]: isSingleSelect
- };
- const depth = getDepth();
- 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$H.title }, this.textLabel)), this.renderChildren())));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "selected": ["selectedWatchHandler"]
- }; }
- static get style() { return comboboxItemCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-combobox-item",
- "$members$": {
- "disabled": [516],
- "selected": [1540],
- "active": [516],
- "ancestors": [1040],
- "guid": [513],
- "icon": [513],
- "textLabel": [513, "text-label"],
- "value": [8],
- "constant": [516],
- "filterDisabled": [516, "filter-disabled"],
- "toggleSelected": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["selected", "selected"], ["active", "active"], ["guid", "guid"], ["icon", "icon"], ["textLabel", "text-label"], ["constant", "constant"], ["filterDisabled", "filter-disabled"]]
- }; }
- }
- const CSS$G = {
- list: "list",
- label: "label",
- title: "title"
- };
- const comboboxItemGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-combobox-item-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-combobox-item-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-combobox-item-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-combobox-item-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-combobox-item-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-combobox-item-group:root{--calcite-floating-ui-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, \n.list*/.sc-calcite-combobox-item-group-h,.list.sc-calcite-combobox-item-group{margin:0px;display:flex;flex-direction:column;padding:0px}/*!@:host(:focus), \n.list:focus*/.sc-calcite-combobox-item-group-h:focus,.list.sc-calcite-combobox-item-group:focus{outline:2px solid transparent;outline-offset:2px}/*!@.label*/.label.sc-calcite-combobox-item-group{box-sizing:border-box;display:flex;inline-size:100%;min-inline-size:0px;max-inline-size:100%;color:var(--calcite-ui-text-3)}/*!@.label--indent-1*/.label--indent-1.sc-calcite-combobox-item-group{padding-inline-start:var(--calcite-combobox-item-spacing-indent-1)}/*!@.label--indent-2*/.label--indent-2.sc-calcite-combobox-item-group{padding-inline-start:var(--calcite-combobox-item-spacing-indent-2)}/*!@.title*/.title.sc-calcite-combobox-item-group{border:0 solid;display:block;flex:1 1 0%;border-block-end-width:1px;font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-2);word-wrap:break-word;word-break:break-word;border-block-end-color:var(--calcite-ui-border-3);padding-block:var(--calcite-combobox-item-spacing-unit-l);padding-inline:0;margin-inline:var(--calcite-combobox-item-spacing-unit-s)}";
- /**
- * @slot - A slot for adding `calcite-combobox-item`s.
- */
- class ComboboxItemGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.guid = guid();
- this.scale = "m";
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- this.ancestors = getAncestors(this.el);
- this.scale = getElementProp(this.el, "scale", this.scale);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const { el, scale } = this;
- const indent = `${CSS$G.label}--indent-${getDepth()}`;
- return (hAsync("ul", { "aria-labelledby": this.guid, class: { [CSS$G.list]: true, [`scale--${scale}`]: true }, role: "group" }, hAsync("li", { class: { [CSS$G.label]: true, [indent]: true }, id: this.guid, role: "presentation" }, hAsync("span", { class: CSS$G.title }, this.label)), hAsync("slot", null)));
- }
- get el() { return getElement(this); }
- static get style() { return comboboxItemGroupCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-combobox-item-group",
- "$members$": {
- "ancestors": [1040],
- "label": [1]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- /**
- * Check if date is within a min and max
- *
- * @param date
- * @param min
- * @param max
- */
- function inRange(date, min, max) {
- const time = date.getTime();
- const afterMin = !(min instanceof Date) || time >= min.getTime();
- const beforeMax = !(max instanceof Date) || time <= max.getTime();
- return afterMin && beforeMax;
- }
- /**
- * Ensures date is within range,
- * returns min or max if out of bounds
- *
- * @param date
- * @param min
- * @param max
- */
- function dateFromRange(date, min, max) {
- if (!(date instanceof Date)) {
- return null;
- }
- const time = date.getTime();
- const beforeMin = min instanceof Date && time < min.getTime();
- const afterMax = max instanceof Date && time > max.getTime();
- if (beforeMin) {
- return min;
- }
- if (afterMax) {
- return max;
- }
- return date;
- }
- /**
- * Parse an iso8601 string (YYYY-mm-dd) into a valid date.
- * TODO: handle time when time of day UI is added
- *
- * @param iso8601
- * @param isEndDate
- */
- function dateFromISO(iso8601, isEndDate = false) {
- if (iso8601 instanceof Date) {
- return iso8601;
- }
- if (!iso8601 || typeof iso8601 !== "string") {
- return null;
- }
- const d = iso8601.split(/[: T-]/).map(parseFloat);
- const date = new Date(d[0], (d[1] || 1) - 1, d[2] || 1);
- date.setFullYear(d[0]);
- if (isNaN(date.getTime())) {
- throw new Error(`Invalid ISO 8601 date: "${iso8601}"`);
- }
- if (isEndDate) {
- return setEndOfDay(date);
- }
- return date;
- }
- /**
- * Return first portion of ISO string (YYYY-mm-dd)
- *
- * @param date
- */
- function dateToISO(date) {
- if (typeof date === "string") {
- return date;
- }
- if (date instanceof Date) {
- return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().split("T")[0];
- }
- return "";
- }
- /**
- * Check if two dates are the same day, month, year
- *
- * @param d1
- * @param d2
- */
- function sameDate(d1, d2) {
- return (d1 instanceof Date &&
- d2 instanceof Date &&
- d1.getDate() === d2.getDate() &&
- d1.getMonth() === d2.getMonth() &&
- d1.getFullYear() === d2.getFullYear());
- }
- /**
- * Get a date one month in the past
- *
- * @param date
- */
- function prevMonth(date) {
- const month = date.getMonth();
- const nextDate = new Date(date);
- nextDate.setMonth(month - 1);
- // date doesn't exist in new month, use last day
- if (month === nextDate.getMonth()) {
- return new Date(date.getFullYear(), month, 0);
- }
- return nextDate;
- }
- /**
- * Get a date one month in the future
- *
- * @param date
- */
- function nextMonth(date) {
- const month = date.getMonth();
- const nextDate = new Date(date);
- nextDate.setMonth(month + 1);
- // date doesn't exist in new month, use last day
- if ((month + 2) % 7 === nextDate.getMonth() % 7) {
- return new Date(date.getFullYear(), month + 2, 0);
- }
- return nextDate;
- }
- /**
- * Parse numeric units for day, month, and year from a localized string
- * month starts at 0 (can pass to date constructor)
- *
- * @param str
- * @param localeData
- */
- function parseDateString(str, localeData) {
- const { separator, unitOrder } = localeData;
- const order = getOrder(unitOrder);
- const values = str.split(separator).map((part) => numberStringFormatter.delocalize(part));
- return {
- day: parseInt(values[order.indexOf("d")]),
- month: parseInt(values[order.indexOf("m")]) - 1,
- year: parseInt(values[order.indexOf("y")])
- };
- }
- /**
- * Based on the unitOrder string, find order of month, day, and year for locale
- *
- * @param unitOrder
- */
- function getOrder(unitOrder) {
- const signifiers = ["d", "m", "y"];
- const order = unitOrder.toLowerCase();
- return signifiers.sort((a, b) => order.indexOf(a) - order.indexOf(b));
- }
- /**
- * Get number of days between two dates
- *
- * @param date1
- * @param date2
- */
- function getDaysDiff(date1, date2) {
- const ts1 = date1.getTime();
- const ts2 = date2.getTime();
- return (ts1 - ts2) / (1000 * 3600 * 24);
- }
- /**
- * Set time of the day to the end.
- *
- * @param {Date} date Date.
- * @returns {Date} Date with time set to end of day .
- */
- function setEndOfDay(date) {
- date.setHours(23, 59, 59, 999);
- return date;
- }
- /**
- * Maps value to valueAsDate
- *
- * @param value
- */
- function getValueAsDateRange(value) {
- return value.map((v, index) => dateFromISO(v, index === 1));
- }
- const HEADING_LEVEL$6 = 2;
- const TEXT$i = {
- nextMonth: "Next month",
- prevMonth: "Previous month",
- year: "Year"
- };
- const datePickerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-date-picker:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-date-picker:root{--calcite-floating-ui-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;inline-size: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-inline-size:216px}/*!@:host([scale=m])*/[scale=m].sc-calcite-date-picker-h{max-inline-size:286px}/*!@:host([scale=l])*/[scale=l].sc-calcite-date-picker-h{max-inline-size:398px}";
- class DatePicker {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteDatePickerChange = createEvent(this, "calciteDatePickerChange", 6);
- this.calciteDatePickerRangeChange = createEvent(this, "calciteDatePickerRangeChange", 6);
- /**
- * Localized string for "previous month" (used for aria label)
- *
- * @default "Previous month"
- */
- this.intlPrevMonth = TEXT$i.prevMonth;
- /**
- * Localized string for "next month" (used for aria label)
- *
- * @default "Next month"
- */
- this.intlNextMonth = TEXT$i.nextMonth;
- /**
- * Localized string for "year" (used for aria label)
- *
- * @default "Year"
- */
- this.intlYear = TEXT$i.year;
- /** specify the scale of the date picker */
- this.scale = "m";
- /** Range mode activation */
- this.range = false;
- /** Disables the default behaviour on the third click of narrowing or extending the range and instead starts a new range. */
- this.proximitySelectionDisabled = false;
- this.globalAttributes = {};
- //--------------------------------------------------------------------------
- //
- // Private State/Props
- //
- //--------------------------------------------------------------------------
- this.effectiveLocale = "";
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.keyDownHandler = (event) => {
- if (event.key === "Escape") {
- this.reset();
- }
- };
- this.monthHeaderSelectChange = (event) => {
- const date = new Date(event.detail);
- if (!this.range) {
- this.activeDate = date;
- }
- else {
- if (this.activeRange === "end") {
- this.activeEndDate = date;
- }
- else {
- this.activeStartDate = date;
- }
- this.mostRecentRangeValue = date;
- }
- };
- this.monthActiveDateChange = (event) => {
- const date = new Date(event.detail);
- if (!this.range) {
- this.activeDate = date;
- }
- else {
- if (this.activeRange === "end") {
- this.activeEndDate = date;
- }
- else {
- this.activeStartDate = date;
- }
- this.mostRecentRangeValue = date;
- }
- };
- this.monthHoverChange = (event) => {
- if (!this.startAsDate) {
- this.hoverRange = undefined;
- return;
- }
- const date = new Date(event.detail);
- this.hoverRange = {
- focused: this.activeRange || "start",
- start: this.startAsDate,
- end: this.endAsDate
- };
- if (!this.proximitySelectionDisabled) {
- if (this.endAsDate) {
- const startDiff = getDaysDiff(date, this.startAsDate);
- const endDiff = getDaysDiff(date, this.endAsDate);
- if (endDiff > 0) {
- this.hoverRange.end = date;
- this.hoverRange.focused = "end";
- }
- else if (startDiff < 0) {
- this.hoverRange.start = date;
- this.hoverRange.focused = "start";
- }
- else if (startDiff > endDiff) {
- this.hoverRange.start = date;
- this.hoverRange.focused = "start";
- }
- else {
- this.hoverRange.end = date;
- this.hoverRange.focused = "end";
- }
- }
- else {
- if (date < this.startAsDate) {
- this.hoverRange = {
- focused: "start",
- start: date,
- end: this.startAsDate
- };
- }
- else {
- this.hoverRange.end = date;
- this.hoverRange.focused = "end";
- }
- }
- }
- else {
- if (!this.endAsDate) {
- if (date < this.startAsDate) {
- this.hoverRange = {
- focused: "start",
- start: date,
- end: this.startAsDate
- };
- }
- else {
- this.hoverRange.end = date;
- this.hoverRange.focused = "end";
- }
- }
- else {
- this.hoverRange = undefined;
- }
- }
- event.stopPropagation();
- };
- this.monthMouseOutChange = () => {
- if (this.hoverRange) {
- this.hoverRange = undefined;
- }
- };
- /**
- * Reset active date and close
- */
- this.reset = () => {
- var _a, _b, _c, _d, _e, _f;
- if (!Array.isArray(this.valueAsDate) &&
- this.valueAsDate &&
- ((_a = this.valueAsDate) === null || _a === void 0 ? void 0 : _a.getTime()) !== ((_b = this.activeDate) === null || _b === void 0 ? void 0 : _b.getTime())) {
- this.activeDate = new Date(this.valueAsDate);
- }
- 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())) {
- this.activeStartDate = new Date(this.startAsDate);
- }
- 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())) {
- this.activeEndDate = new Date(this.endAsDate);
- }
- };
- /**
- * Event handler for when the selected date changes
- *
- * @param event
- */
- this.monthDateChange = (event) => {
- const date = new Date(event.detail);
- if (!this.range) {
- this.value = date ? dateToISO(date) : "";
- this.valueAsDate = date || null;
- this.activeDate = date || null;
- this.calciteDatePickerChange.emit(date);
- return;
- }
- if (!this.startAsDate || (!this.endAsDate && date < this.startAsDate)) {
- if (this.startAsDate) {
- this.setEndDate(new Date(this.startAsDate));
- }
- if (this.activeRange == "end") {
- this.setEndDate(date);
- }
- else {
- this.setStartDate(date);
- }
- }
- else if (!this.endAsDate) {
- this.setEndDate(date);
- }
- else {
- if (!this.proximitySelectionDisabled) {
- if (this.activeRange) {
- if (this.activeRange == "end") {
- this.setEndDate(date);
- }
- else {
- this.setStartDate(date);
- }
- }
- else {
- const startDiff = getDaysDiff(date, this.startAsDate);
- const endDiff = getDaysDiff(date, this.endAsDate);
- if (endDiff === 0 || startDiff < 0) {
- this.setStartDate(date);
- }
- else if (startDiff === 0 || endDiff < 0) {
- this.setEndDate(date);
- }
- else if (startDiff < endDiff) {
- this.setStartDate(date);
- }
- else {
- this.setEndDate(date);
- }
- }
- }
- else {
- this.setStartDate(date);
- this.endAsDate = this.activeEndDate = this.end = undefined;
- }
- }
- this.calciteDatePickerChange.emit(date);
- };
- }
- handleValueAsDate(date) {
- if (!Array.isArray(date) && date && date !== this.activeDate) {
- this.activeDate = date;
- }
- }
- handleRangeChange() {
- const { startAsDate: startDate, endAsDate: endDate } = this;
- this.activeEndDate = endDate;
- this.activeStartDate = startDate;
- }
- onMinChanged(min) {
- if (min) {
- this.minAsDate = dateFromISO(min);
- }
- }
- onMaxChanged(max) {
- if (max) {
- this.maxAsDate = dateFromISO(max);
- }
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectLocalized(this);
- if (Array.isArray(this.value)) {
- this.valueAsDate = getValueAsDateRange(this.value);
- this.start = this.value[0];
- this.end = this.value[1];
- }
- else if (this.value) {
- this.valueAsDate = dateFromISO(this.value);
- }
- if (this.start) {
- this.setStartAsDate(dateFromISO(this.start));
- }
- if (this.end) {
- this.setEndAsDate(dateFromISO(this.end));
- }
- if (this.min) {
- this.minAsDate = dateFromISO(this.min);
- }
- if (this.max) {
- this.maxAsDate = dateFromISO(this.max);
- }
- }
- disconnectedCallback() {
- disconnectLocalized(this);
- }
- async componentWillLoad() {
- await this.loadLocaleData();
- this.onMinChanged(this.min);
- this.onMaxChanged(this.max);
- }
- render() {
- var _a;
- const date = dateFromRange(this.range ? this.startAsDate : this.valueAsDate, this.minAsDate, this.maxAsDate);
- const activeStartDate = this.range
- ? this.getActiveStartDate(date, this.minAsDate, this.maxAsDate)
- : this.getActiveDate(date, this.minAsDate, this.maxAsDate);
- let activeDate = activeStartDate;
- const endDate = this.range
- ? dateFromRange(this.endAsDate, this.minAsDate, this.maxAsDate)
- : null;
- const activeEndDate = this.getActiveEndDate(endDate, this.minAsDate, this.maxAsDate);
- if ((this.activeRange === "end" ||
- (((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.focused) === "end" && (!this.proximitySelectionDisabled || endDate))) &&
- activeEndDate) {
- activeDate = activeEndDate;
- }
- if (this.range && this.mostRecentRangeValue) {
- activeDate = this.mostRecentRangeValue;
- }
- const minDate = this.range && this.activeRange
- ? this.activeRange === "start"
- ? this.minAsDate
- : date || this.minAsDate
- : this.minAsDate;
- const maxDate = this.range && this.activeRange
- ? this.activeRange === "start"
- ? endDate || this.maxAsDate
- : this.maxAsDate
- : this.maxAsDate;
- return (hAsync(Host, { onBlur: this.reset, onKeyDown: this.keyDownHandler, role: "application" }, this.renderCalendar(activeDate, maxDate, minDate, date, endDate)));
- }
- valueHandler(value) {
- if (Array.isArray(value)) {
- this.valueAsDate = getValueAsDateRange(value);
- this.start = value[0];
- this.end = value[1];
- }
- else if (value) {
- this.valueAsDate = dateFromISO(value);
- this.start = "";
- this.end = "";
- }
- }
- startWatcher(start) {
- this.setStartAsDate(dateFromISO(start));
- }
- endWatcher(end) {
- this.setEndAsDate(dateFromISO(end));
- }
- async loadLocaleData() {
- {
- return;
- }
- }
- /**
- * Render calcite-date-picker-month-header and calcite-date-picker-month
- *
- * @param activeDate
- * @param maxDate
- * @param minDate
- * @param date
- * @param endDate
- */
- renderCalendar(activeDate, maxDate, minDate, date, endDate) {
- return (this.localeData && [
- 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() }),
- 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, onCalciteDatePickerSelect: this.monthDateChange, onCalciteInternalDatePickerHover: this.monthHoverChange, onCalciteInternalDatePickerMouseOut: this.monthMouseOutChange, scale: this.scale, selectedDate: this.activeRange === "end" ? endDate : date, startDate: this.range ? date : undefined })
- ]);
- }
- /**
- * Update date instance of start if valid
- *
- * @param startDate
- * @param emit
- */
- setStartAsDate(startDate, emit) {
- this.startAsDate = startDate;
- this.mostRecentRangeValue = this.startAsDate;
- if (emit) {
- this.calciteDatePickerRangeChange.emit({
- startDate,
- endDate: this.endAsDate
- });
- }
- }
- /**
- * Update date instance of end if valid
- *
- * @param endDate
- * @param emit
- */
- setEndAsDate(endDate, emit) {
- this.endAsDate = endDate ? setEndOfDay(endDate) : endDate;
- this.mostRecentRangeValue = this.endAsDate;
- if (emit) {
- this.calciteDatePickerRangeChange.emit({
- startDate: this.startAsDate,
- endDate
- });
- }
- }
- setEndDate(date) {
- this.end = date ? dateToISO(date) : "";
- this.setEndAsDate(date, true);
- this.activeEndDate = date || null;
- }
- setStartDate(date) {
- this.start = date ? dateToISO(date) : "";
- this.setStartAsDate(date, true);
- this.activeStartDate = date || null;
- }
- /**
- * Get an active date using the value, or current date as default
- *
- * @param value
- * @param min
- * @param max
- */
- getActiveDate(value, min, max) {
- return dateFromRange(this.activeDate, min, max) || value || dateFromRange(new Date(), min, max);
- }
- getActiveStartDate(value, min, max) {
- return (dateFromRange(this.activeStartDate, min, max) || value || dateFromRange(new Date(), min, max));
- }
- getActiveEndDate(value, min, max) {
- return (dateFromRange(this.activeEndDate, min, max) || value || dateFromRange(new Date(), min, max));
- }
- static get assetsDirs() { return ["assets"]; }
- get el() { return getElement(this); }
- static get watchers() { return {
- "valueAsDate": ["handleValueAsDate"],
- "startAsDate": ["handleRangeChange"],
- "endAsDate": ["handleRangeChange"],
- "min": ["onMinChanged"],
- "max": ["onMaxChanged"],
- "value": ["valueHandler"],
- "start": ["startWatcher"],
- "end": ["endWatcher"],
- "effectiveLocale": ["loadLocaleData"]
- }; }
- static get style() { return datePickerCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-date-picker",
- "$members$": {
- "activeRange": [513, "active-range"],
- "value": [1025],
- "headingLevel": [514, "heading-level"],
- "valueAsDate": [1040],
- "startAsDate": [1040],
- "endAsDate": [1040],
- "minAsDate": [1040],
- "maxAsDate": [1040],
- "min": [1537],
- "max": [1537],
- "intlPrevMonth": [1, "intl-prev-month"],
- "intlNextMonth": [1, "intl-next-month"],
- "intlYear": [1, "intl-year"],
- "locale": [1],
- "numberingSystem": [513, "numbering-system"],
- "scale": [513],
- "range": [516],
- "start": [1537],
- "end": [1537],
- "proximitySelectionDisabled": [516, "proximity-selection-disabled"],
- "activeDate": [32],
- "activeStartDate": [32],
- "activeEndDate": [32],
- "globalAttributes": [32],
- "effectiveLocale": [32],
- "localeData": [32],
- "hoverRange": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["activeRange", "active-range"], ["headingLevel", "heading-level"], ["min", "min"], ["max", "max"], ["numberingSystem", "numbering-system"], ["scale", "scale"], ["range", "range"], ["start", "start"], ["end", "end"], ["proximitySelectionDisabled", "proximity-selection-disabled"]]
- }; }
- }
- const datePickerDayCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker-day{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker-day{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker-day{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker-day{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-date-picker-day:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-date-picker-day:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-date-picker-day-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-date-picker-day-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-date-picker-day-h{display:flex;min-inline-size:0px;cursor:pointer;justify-content:center;color:var(--calcite-ui-text-3);inline-size:14.2857142857%}/*!@: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{flex:1 1 auto}/*!@.day-wrapper*/.day-wrapper.sc-calcite-date-picker-day{display:flex;flex-direction:column;align-items:center}/*!@.day*/.day.sc-calcite-date-picker-day{display:flex;align-items: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);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;background:none;box-shadow:0 0 0 2px transparent}/*!@.text*/.text.sc-calcite-date-picker-day{margin-block:1px 0px;margin-inline-start:0px}/*!@:host([scale=s]) .day-v-wrapper*/[scale=s].sc-calcite-date-picker-day-h .day-v-wrapper.sc-calcite-date-picker-day{padding-block: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{block-size:27px;inline-size: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-block:0.25rem}/*!@:host([scale=m]) .day-wrapper*/[scale=m].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{padding-inline:0.25rem}/*!@:host([scale=m]) .day*/[scale=m].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{block-size:33px;inline-size: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-block:0.25rem}/*!@:host([scale=l]) .day-wrapper*/[scale=l].sc-calcite-date-picker-day-h .day-wrapper.sc-calcite-date-picker-day{padding-inline:0.25rem}/*!@:host([scale=l]) .day*/[scale=l].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{block-size:43px;inline-size: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, \n: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), \n:host([active])*/.sc-calcite-date-picker-day-h:focus,[active].sc-calcite-date-picker-day-h{outline:2px solid transparent;outline-offset:2px}/*!@:host(:focus:not([disabled])) .day*/.sc-calcite-date-picker-day-h:focus:not([disabled]) .day.sc-calcite-date-picker-day{outline:2px solid var(--calcite-ui-brand);outline-offset:2px;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@: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}/*!@: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*/[start-of-range].sc-calcite-date-picker-day-h .sc-calcite-date-picker-day:not(.calcite--rtl) .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset 4px 0 var(--calcite-ui-foreground-1)}/*!@:host([start-of-range]) .calcite--rtl .day-wrapper*/[start-of-range].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset -4px 0 var(--calcite-ui-foreground-1)}/*!@:host([start-of-range]) .day*/[start-of-range].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{opacity:1}/*!@:host([end-of-range]) :not(.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{box-shadow:inset -4px 0 var(--calcite-ui-foreground-1)}/*!@:host([end-of-range]) .calcite--rtl .day-wrapper*/[end-of-range].sc-calcite-date-picker-day-h .calcite--rtl.sc-calcite-date-picker-day .day-wrapper.sc-calcite-date-picker-day{box-shadow:inset 4px 0 var(--calcite-ui-foreground-1)}/*!@:host([end-of-range]) .day*/[end-of-range].sc-calcite-date-picker-day-h .day.sc-calcite-date-picker-day{opacity:1}/*!@:host([start-of-range]:not(:focus)) :not(.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{box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host([start-of-range]:not(:focus)) .calcite--rtl .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{box-shadow:0 0 0 -2px var(--calcite-ui-foreground-1)}/*!@:host([end-of-range]:not(:focus)) :not(.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{box-shadow:0 0 0 -2px var(--calcite-ui-foreground-1)}/*!@:host([end-of-range]:not(:focus)) .calcite--rtl .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{box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host([start-of-range][scale=l]) :not(.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{box-shadow:inset 8px 0 var(--calcite-ui-foreground-1)}/*!@:host([start-of-range][scale=l]) .calcite--rtl .day-wrapper*/[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{box-shadow:inset -8px 0 var(--calcite-ui-foreground-1)}/*!@:host([end-of-range][scale=l]) :not(.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{box-shadow:inset -8px 0 var(--calcite-ui-foreground-1)}/*!@:host([end-of-range][scale=l]) .calcite--rtl .day-wrapper*/[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{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([start-of-range][range-hover]) :not(.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{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;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]) .calcite--rtl .day-wrapper*/[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: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;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([end-of-range][range-hover]) :not(.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{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;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([end-of-range][range-hover]) .calcite--rtl .day-wrapper*/[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: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;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: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;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: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;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--start) :not(.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{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) .calcite--rtl .day-wrapper*/.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: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--start) .day*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--start .day.sc-calcite-date-picker-day{border-radius:9999px;opacity:1;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host(:hover[range-hover]:not([selected]).focused--end) :not(.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{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) .calcite--rtl .day-wrapper*/.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: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--end) .day*/.sc-calcite-date-picker-day-h:hover[range-hover]:not([selected]).focused--end .day.sc-calcite-date-picker-day{border-radius:9999px;opacity: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: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, \n: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;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: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, \n: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;box-shadow:0 0 0 2px var(--calcite-ui-foreground-1)}/*!@:host(:hover[start-of-range].hover--inside-range.focused--end) .day-wrapper, \n: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, \n: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{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{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{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{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{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{box-shadow:inset -6px 0px 0px 0px var(--calcite-ui-foreground-1)}@media (forced-colors: active){/*!@:host(:hover:not([disabled])) .day, \n: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}/*!@: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}}";
- class DatePickerDay {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteDaySelect = createEvent(this, "calciteDaySelect", 6);
- this.calciteInternalDayHover = createEvent(this, "calciteInternalDayHover", 6);
- /** Date is outside of range and can't be selected */
- this.disabled = false;
- /** Date is in the current month. */
- this.currentMonth = false;
- /** Date is the current selected date of the picker */
- this.selected = false;
- /** Date is currently highlighted as part of the range */
- this.highlighted = false;
- /** Showing date range */
- this.range = false;
- /** Date is the start of date range */
- this.startOfRange = false;
- /** Date is the end of date range */
- this.endOfRange = false;
- /** Date is being hovered and within the set range */
- this.rangeHover = false;
- /** Date is actively in focus for keyboard navigation */
- this.active = false;
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- this.onClick = () => {
- !this.disabled && this.calciteDaySelect.emit();
- };
- this.keyDownHandler = (event) => {
- if (isActivationKey(event.key)) {
- !this.disabled && this.calciteDaySelect.emit();
- event.preventDefault();
- }
- };
- }
- mouseoverHandler() {
- this.calciteInternalDayHover.emit();
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentWillLoad() {
- this.parentDatePickerEl = closestElementCrossShadowBoundary(this.el, "calcite-date-picker");
- }
- render() {
- if (this.parentDatePickerEl) {
- const { numberingSystem, lang: locale } = this.parentDatePickerEl;
- numberStringFormatter.numberFormatOptions = {
- useGrouping: false,
- ...(numberingSystem && { numberingSystem }),
- ...(locale && { locale })
- };
- }
- const formattedDay = numberStringFormatter.localize(String(this.day));
- const dir = getElementDir(this.el);
- 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))))));
- }
- componentDidRender() {
- updateHostInteraction(this, this.isTabbable);
- }
- isTabbable() {
- return this.active;
- }
- get el() { return getElement(this); }
- static get style() { return datePickerDayCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-date-picker-day",
- "$members$": {
- "day": [2],
- "disabled": [516],
- "currentMonth": [516, "current-month"],
- "selected": [516],
- "highlighted": [516],
- "range": [516],
- "startOfRange": [516, "start-of-range"],
- "endOfRange": [516, "end-of-range"],
- "rangeHover": [516, "range-hover"],
- "active": [516],
- "scale": [513],
- "value": [16]
- },
- "$listeners$": [[1, "pointerover", "mouseoverHandler"]],
- "$lazyBundleId$": "-",
- "$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"]]
- }; }
- }
- const datePickerMonthCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker-month{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker-month{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker-month{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker-month{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-date-picker-month:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-date-picker-month:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-date-picker-month-h{display:none}/*!@.calender*/.calender.sc-calcite-date-picker-month{margin-block-end:0.25rem}/*!@.week-headers*/.week-headers.sc-calcite-date-picker-month{display:flex;border-width:0px;border-block-start-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-block:0px;padding-inline: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);inline-size:14.2857142857%}/*!@:host([scale=s]) .week-header*/[scale=s].sc-calcite-date-picker-month-h .week-header.sc-calcite-date-picker-month{padding-inline:0px;padding-block:0.5rem 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-inline:0px;padding-block:0.75rem 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-inline:0px;padding-block:1rem 1.25rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@.week-days*/.week-days.sc-calcite-date-picker-month{display:flex;flex-direction:row;padding-block:0px;padding-inline:6px}/*!@.week-days:focus*/.week-days.sc-calcite-date-picker-month:focus{outline:2px solid transparent;outline-offset:2px}";
- class DatePickerMonth {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteDatePickerSelect = createEvent(this, "calciteDatePickerSelect", 6);
- this.calciteInternalDatePickerHover = createEvent(this, "calciteInternalDatePickerHover", 6);
- this.calciteDatePickerActiveDateChange = createEvent(this, "calciteDatePickerActiveDateChange", 6);
- this.calciteInternalDatePickerMouseOut = createEvent(this, "calciteInternalDatePickerMouseOut", 6);
- /** Date currently active.*/
- this.activeDate = new Date();
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- this.keyDownHandler = (event) => {
- if (event.defaultPrevented) {
- return;
- }
- const isRTL = this.el.dir === "rtl";
- switch (event.key) {
- case "ArrowUp":
- event.preventDefault();
- this.addDays(-7);
- break;
- case "ArrowRight":
- event.preventDefault();
- this.addDays(isRTL ? -1 : 1);
- break;
- case "ArrowDown":
- event.preventDefault();
- this.addDays(7);
- break;
- case "ArrowLeft":
- event.preventDefault();
- this.addDays(isRTL ? 1 : -1);
- break;
- case "PageUp":
- event.preventDefault();
- this.addMonths(-1);
- break;
- case "PageDown":
- event.preventDefault();
- this.addMonths(1);
- break;
- case "Home":
- event.preventDefault();
- this.activeDate.setDate(1);
- this.addDays();
- break;
- case "End":
- event.preventDefault();
- this.activeDate.setDate(new Date(this.activeDate.getFullYear(), this.activeDate.getMonth() + 1, 0).getDate());
- this.addDays();
- break;
- case "Enter":
- case " ":
- event.preventDefault();
- break;
- case "Tab":
- this.activeFocus = false;
- }
- };
- /**
- * Once user is not interacting via keyboard,
- * disable auto focusing of active date
- */
- this.disableActiveFocus = () => {
- this.activeFocus = false;
- };
- this.dayHover = (event) => {
- const target = event.target;
- if (target.disabled) {
- this.calciteInternalDatePickerMouseOut.emit();
- }
- else {
- this.calciteInternalDatePickerHover.emit(target.value);
- }
- event.stopPropagation();
- };
- this.daySelect = (event) => {
- const target = event.target;
- this.calciteDatePickerSelect.emit(target.value);
- };
- }
- mouseoutHandler() {
- this.calciteInternalDatePickerMouseOut.emit();
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- render() {
- const month = this.activeDate.getMonth();
- const year = this.activeDate.getFullYear();
- const startOfWeek = this.localeData.weekStart % 7;
- const { abbreviated, short, narrow } = this.localeData.days;
- const weekDays = this.scale === "s" ? narrow || short || abbreviated : short || abbreviated || narrow;
- const adjustedWeekDays = [...weekDays.slice(startOfWeek, 7), ...weekDays.slice(0, startOfWeek)];
- const curMonDays = this.getCurrentMonthDays(month, year);
- const prevMonDays = this.getPrevMonthdays(month, year, startOfWeek);
- const nextMonDays = this.getNextMonthDays(month, year, startOfWeek);
- const days = [
- ...prevMonDays.map((day) => {
- const date = new Date(year, month - 1, day);
- return this.renderDateDay(false, day, date);
- }),
- ...curMonDays.map((day) => {
- const date = new Date(year, month, day);
- const active = sameDate(date, this.activeDate);
- return this.renderDateDay(active, day, date, true, true);
- }),
- ...nextMonDays.map((day) => {
- const date = new Date(year, month + 1, day);
- return this.renderDateDay(false, day, date);
- })
- ];
- const weeks = [];
- for (let i = 0; i < days.length; i += 7) {
- weeks.push(days.slice(i, i + 7));
- }
- 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))))));
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- /**
- * Add n months to the current month
- *
- * @param step
- */
- addMonths(step) {
- const nextDate = new Date(this.activeDate);
- nextDate.setMonth(this.activeDate.getMonth() + step);
- this.calciteDatePickerActiveDateChange.emit(dateFromRange(nextDate, this.min, this.max));
- this.activeFocus = true;
- }
- /**
- * Add n days to the current date
- *
- * @param step
- */
- addDays(step = 0) {
- const nextDate = new Date(this.activeDate);
- nextDate.setDate(this.activeDate.getDate() + step);
- this.calciteDatePickerActiveDateChange.emit(dateFromRange(nextDate, this.min, this.max));
- this.activeFocus = true;
- }
- /**
- * Get dates for last days of the previous month
- *
- * @param month
- * @param year
- * @param startOfWeek
- */
- getPrevMonthdays(month, year, startOfWeek) {
- const lastDate = new Date(year, month, 0);
- const date = lastDate.getDate();
- const day = lastDate.getDay();
- const days = [];
- if (day - 6 === startOfWeek) {
- return days;
- }
- for (let i = lastDate.getDay() - startOfWeek; i >= 0; i--) {
- days.push(date - i);
- }
- return days;
- }
- /**
- * Get dates for the current month
- *
- * @param month
- * @param year
- */
- getCurrentMonthDays(month, year) {
- const num = new Date(year, month + 1, 0).getDate();
- const days = [];
- for (let i = 0; i < num; i++) {
- days.push(i + 1);
- }
- return days;
- }
- /**
- * Get dates for first days of the next month
- *
- * @param month
- * @param year
- * @param startOfWeek
- */
- getNextMonthDays(month, year, startOfWeek) {
- const endDay = new Date(year, month + 1, 0).getDay();
- const days = [];
- if (endDay === (startOfWeek + 6) % 7) {
- return days;
- }
- for (let i = 0; i < (6 - (endDay - startOfWeek)) % 7; i++) {
- days.push(i + 1);
- }
- return days;
- }
- /**
- * Determine if the date is in between the start and end dates
- *
- * @param date
- */
- betweenSelectedRange(date) {
- return !!(this.startDate &&
- this.endDate &&
- date > this.startDate &&
- date < this.endDate &&
- !this.isRangeHover(date));
- }
- /**
- * Determine if the date should be in selected state
- *
- * @param date
- */
- isSelected(date) {
- return !!(sameDate(date, this.selectedDate) ||
- (this.startDate && sameDate(date, this.startDate)) ||
- (this.endDate && sameDate(date, this.endDate)));
- }
- /**
- * Determine if the date is the start of the date range
- *
- * @param date
- */
- isStartOfRange(date) {
- return !!(this.startDate &&
- !sameDate(this.startDate, this.endDate) &&
- sameDate(this.startDate, date) &&
- !this.isEndOfRange(date));
- }
- isEndOfRange(date) {
- return !!((this.endDate && !sameDate(this.startDate, this.endDate) && sameDate(this.endDate, date)) ||
- (!this.endDate &&
- this.hoverRange &&
- sameDate(this.startDate, this.hoverRange.end) &&
- sameDate(date, this.hoverRange.end)));
- }
- /**
- * Render calcite-date-picker-day
- *
- * @param active
- * @param day
- * @param date
- * @param currentMonth
- * @param ref
- */
- renderDateDay(active, day, date, currentMonth, ref) {
- var _a;
- const isFocusedOnStart = this.isFocusedOnStart();
- const isHoverInRange = this.isHoverInRange() ||
- (!this.endDate && this.hoverRange && sameDate((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.end, this.startDate));
- return (hAsync("calcite-date-picker-day", { active: active, class: {
- "hover--inside-range": this.startDate && isHoverInRange,
- "hover--outside-range": this.startDate && !isHoverInRange,
- "focused--start": isFocusedOnStart,
- "focused--end": !isFocusedOnStart
- }, currentMonth: currentMonth, day: day, disabled: !inRange(date, this.min, this.max), endOfRange: this.isEndOfRange(date), highlighted: this.betweenSelectedRange(date), key: date.toDateString(), onCalciteDaySelect: this.daySelect, onCalciteInternalDayHover: this.dayHover, range: !!this.startDate && !!this.endDate && !sameDate(this.startDate, this.endDate), rangeHover: this.isRangeHover(date), ref: (el) => {
- // when moving via keyboard, focus must be updated on active date
- if (ref && active && this.activeFocus) {
- el === null || el === void 0 ? void 0 : el.focus();
- }
- }, scale: this.scale, selected: this.isSelected(date), startOfRange: this.isStartOfRange(date), value: date }));
- }
- isFocusedOnStart() {
- var _a;
- return ((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.focused) === "start";
- }
- isHoverInRange() {
- if (!this.hoverRange) {
- return false;
- }
- const { start, end } = this.hoverRange;
- return !!((!this.isFocusedOnStart() && this.startDate && (!this.endDate || end < this.endDate)) ||
- (this.isFocusedOnStart() && this.startDate && start > this.startDate));
- }
- isRangeHover(date) {
- if (!this.hoverRange) {
- return false;
- }
- const { start, end } = this.hoverRange;
- const isStart = this.isFocusedOnStart();
- const insideRange = this.isHoverInRange();
- const cond1 = insideRange &&
- ((!isStart && date > this.startDate && (date < end || sameDate(date, end))) ||
- (isStart && date < this.endDate && (date > start || sameDate(date, start))));
- const cond2 = !insideRange &&
- ((!isStart && date >= this.endDate && (date < end || sameDate(date, end))) ||
- (isStart &&
- (date < this.startDate || (this.endDate && sameDate(date, this.startDate))) &&
- (date > start || sameDate(date, start))));
- return cond1 || cond2;
- }
- get el() { return getElement(this); }
- static get style() { return datePickerMonthCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-date-picker-month",
- "$members$": {
- "selectedDate": [16],
- "activeDate": [16],
- "startDate": [16],
- "endDate": [16],
- "min": [16],
- "max": [16],
- "scale": [513],
- "localeData": [16],
- "hoverRange": [16]
- },
- "$listeners$": [[1, "pointerout", "mouseoutHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["scale", "scale"]]
- }; }
- }
- const BUDDHIST_CALENDAR_YEAR_OFFSET = 543;
- const datePickerMonthHeaderCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-date-picker-month-header{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-date-picker-month-header{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-date-picker-month-header{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-date-picker-month-header{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-date-picker-month-header:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-date-picker-month-header:root{--calcite-floating-ui-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:flex;justify-content:space-between;padding-block:0px;padding-inline:0.25rem}/*!@:host([scale=s]) .text*/[scale=s].sc-calcite-date-picker-month-header-h .text.sc-calcite-date-picker-month-header{margin-block: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{block-size:2.25rem}/*!@:host([scale=m]) .text*/[scale=m].sc-calcite-date-picker-month-header-h .text.sc-calcite-date-picker-month-header{margin-block: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{block-size:3rem}/*!@:host([scale=l]) .text*/[scale=l].sc-calcite-date-picker-month-header-h .text.sc-calcite-date-picker-month-header{margin-block: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{block-size:3.5rem}/*!@.chevron*/.chevron.sc-calcite-date-picker-month-header{margin-inline:-0.25rem;box-sizing:content-box;display:flex;flex-grow:0;cursor:pointer;align-items:center;justify-content:center;border-style:none;background-color:var(--calcite-ui-foreground-1);padding-inline:0.25rem;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;inline-size: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-block:auto;display:flex;inline-size:100%;flex:1 1 auto;align-items:center;justify-content:center;text-align:center;line-height:1}/*!@.text--reverse*/.text--reverse.sc-calcite-date-picker-month-header{flex-direction:row-reverse}/*!@.month, \n.year, \n.suffix*/.month.sc-calcite-date-picker-month-header,.year.sc-calcite-date-picker-month-header,.suffix.sc-calcite-date-picker-month-header{margin-inline:0.25rem;margin-block: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;inline-size:2.5rem;border-style:none;background-color:transparent;text-align:center;font-family:inherit;outline-color:transparent}/*!@.year:hover*/.year.sc-calcite-date-picker-month-header:hover{transition-duration:100ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);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{text-align:start}/*!@.year-wrap*/.year-wrap.sc-calcite-date-picker-month-header{position:relative}/*!@.suffix*/.suffix.sc-calcite-date-picker-month-header{inset-block-start:0px;white-space:nowrap;text-align:start;inset-inline-start:0}";
- class DatePickerMonthHeader {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteDatePickerSelect = createEvent(this, "calciteDatePickerSelect", 6);
- //--------------------------------------------------------------------------
- //
- // Private State/Props
- //
- //--------------------------------------------------------------------------
- this.globalAttributes = {};
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- /**
- * Increment year on UP/DOWN keys
- *
- * @param event
- */
- this.onYearKey = (event) => {
- const localizedYear = this.parseCalendarYear(event.target.value);
- switch (event.key) {
- case "ArrowDown":
- event.preventDefault();
- this.setYear({ localizedYear, offset: -1 });
- break;
- case "ArrowUp":
- event.preventDefault();
- this.setYear({ localizedYear, offset: 1 });
- break;
- }
- };
- this.onYearChange = (event) => {
- this.setYear({
- localizedYear: this.parseCalendarYear(event.target.value)
- });
- };
- this.onYearInput = (event) => {
- this.setYear({
- localizedYear: this.parseCalendarYear(event.target.value),
- commit: false
- });
- };
- this.prevMonthClick = (event) => {
- this.handleArrowClick(event, this.prevMonthDate);
- };
- this.prevMonthKeydown = (event) => {
- if (isActivationKey(event.key)) {
- this.prevMonthClick(event);
- }
- };
- this.nextMonthClick = (event) => {
- this.handleArrowClick(event, this.nextMonthDate);
- };
- this.nextMonthKeydown = (event) => {
- if (isActivationKey(event.key)) {
- this.nextMonthClick(event);
- }
- };
- /*
- * Update active month on clicks of left/right arrows
- */
- this.handleArrowClick = (event, date) => {
- event.preventDefault();
- this.calciteDatePickerSelect.emit(date);
- };
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentWillLoad() {
- this.parentDatePickerEl = closestElementCrossShadowBoundary(this.el, "calcite-date-picker");
- }
- connectedCallback() {
- this.setNextPrevMonthDates();
- }
- render() {
- return hAsync("div", { class: "header" }, this.renderContent());
- }
- renderContent() {
- var _a;
- if (!this.activeDate || !this.localeData) {
- return null;
- }
- if (this.parentDatePickerEl) {
- const { numberingSystem, lang: locale } = this.parentDatePickerEl;
- numberStringFormatter.numberFormatOptions = {
- useGrouping: false,
- ...(numberingSystem && { numberingSystem }),
- ...(locale && { locale })
- };
- }
- const activeMonth = this.activeDate.getMonth();
- const { months, unitOrder } = this.localeData;
- const localizedMonth = (months.wide || months.narrow || months.abbreviated)[activeMonth];
- const localizedYear = this.formatCalendarYear(this.activeDate.getFullYear());
- const iconScale = this.scale === "l" ? "m" : "s";
- const order = getOrder(unitOrder);
- const reverse = order.indexOf("y") < order.indexOf("m");
- const suffix = (_a = this.localeData.year) === null || _a === void 0 ? void 0 : _a.suffix;
- return (hAsync(Fragment, null, hAsync("a", { "aria-disabled": `${this.prevMonthDate.getMonth() === activeMonth}`, "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: {
- year: true,
- "year--suffix": !!suffix
- }, 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" }, suffix))), hAsync("a", { "aria-disabled": `${this.nextMonthDate.getMonth() === activeMonth}`, "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 }))));
- }
- setNextPrevMonthDates() {
- if (!this.activeDate) {
- return;
- }
- this.nextMonthDate = dateFromRange(nextMonth(this.activeDate), this.min, this.max);
- this.prevMonthDate = dateFromRange(prevMonth(this.activeDate), this.min, this.max);
- }
- formatCalendarYear(year) {
- const { localeData } = this;
- const buddhistCalendar = localeData["default-calendar"] === "buddhist";
- const yearOffset = buddhistCalendar ? BUDDHIST_CALENDAR_YEAR_OFFSET : 0;
- return numberStringFormatter.localize(`${year + yearOffset}`);
- }
- parseCalendarYear(year) {
- const { localeData } = this;
- const buddhistCalendar = localeData["default-calendar"] === "buddhist";
- const yearOffset = buddhistCalendar ? BUDDHIST_CALENDAR_YEAR_OFFSET : 0;
- const parsedYear = Number(numberStringFormatter.delocalize(year)) - yearOffset;
- return numberStringFormatter.localize(`${parsedYear}`);
- }
- getInRangeDate({ localizedYear, offset = 0 }) {
- const { min, max, activeDate } = this;
- const parsedYear = Number(numberStringFormatter.delocalize(localizedYear));
- const length = parsedYear.toString().length;
- const year = isNaN(parsedYear) ? false : parsedYear + offset;
- const inRange = year && (!min || min.getFullYear() <= year) && (!max || max.getFullYear() >= year);
- // if you've supplied a year and it's in range
- if (year && inRange && length === localizedYear.length) {
- const nextDate = new Date(activeDate);
- nextDate.setFullYear(year);
- return dateFromRange(nextDate, min, max);
- }
- }
- /**
- * Parse localized year string from input,
- * set to active if in range
- *
- * @param root0
- * @param root0.localizedYear
- * @param root0.commit
- * @param root0.offset
- */
- setYear({ localizedYear, commit = true, offset = 0 }) {
- const { yearInput, activeDate } = this;
- const inRangeDate = this.getInRangeDate({ localizedYear, offset });
- // if you've supplied a year and it's in range, update active date
- if (inRangeDate) {
- this.calciteDatePickerSelect.emit(inRangeDate);
- }
- if (commit) {
- yearInput.value = this.formatCalendarYear((inRangeDate || activeDate).getFullYear());
- }
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "min": ["setNextPrevMonthDates"],
- "max": ["setNextPrevMonthDates"],
- "activeDate": ["setNextPrevMonthDates"]
- }; }
- static get style() { return datePickerMonthHeaderCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-date-picker-month-header",
- "$members$": {
- "selectedDate": [16],
- "activeDate": [16],
- "headingLevel": [2, "heading-level"],
- "min": [16],
- "max": [16],
- "intlPrevMonth": [1, "intl-prev-month"],
- "intlNextMonth": [1, "intl-next-month"],
- "intlYear": [1, "intl-year"],
- "scale": [513],
- "localeData": [16],
- "globalAttributes": [32],
- "nextMonthDate": [32],
- "prevMonthDate": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["scale", "scale"]]
- }; }
- }
- const SLOTS$k = {
- dropdownTrigger: "dropdown-trigger"
- };
- const dropdownCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-dropdown{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-dropdown{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-dropdown{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-dropdown{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-dropdown:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-dropdown:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-dropdown-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-dropdown-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-dropdown-h{display:inline-flex;flex:0 1 auto}/*!@: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;visibility:hidden;pointer-events:none;inline-size:0;block-size:0;overflow:hidden}/*!@.calcite-dropdown-wrapper .calcite-floating-ui-anim*/.calcite-dropdown-wrapper.sc-calcite-dropdown .calcite-floating-ui-anim.sc-calcite-dropdown{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@.calcite-dropdown-wrapper[data-placement^=bottom] .calcite-floating-ui-anim*/.calcite-dropdown-wrapper[data-placement^=bottom].sc-calcite-dropdown .calcite-floating-ui-anim.sc-calcite-dropdown{transform:translateY(-5px)}/*!@.calcite-dropdown-wrapper[data-placement^=top] .calcite-floating-ui-anim*/.calcite-dropdown-wrapper[data-placement^=top].sc-calcite-dropdown .calcite-floating-ui-anim.sc-calcite-dropdown{transform:translateY(5px)}/*!@.calcite-dropdown-wrapper[data-placement^=left] .calcite-floating-ui-anim*/.calcite-dropdown-wrapper[data-placement^=left].sc-calcite-dropdown .calcite-floating-ui-anim.sc-calcite-dropdown{transform:translateX(5px)}/*!@.calcite-dropdown-wrapper[data-placement^=right] .calcite-floating-ui-anim*/.calcite-dropdown-wrapper[data-placement^=right].sc-calcite-dropdown .calcite-floating-ui-anim.sc-calcite-dropdown{transform:translateX(-5px)}/*!@.calcite-dropdown-wrapper[data-placement] .calcite-floating-ui-anim--active*/.calcite-dropdown-wrapper[data-placement].sc-calcite-dropdown .calcite-floating-ui-anim--active.sc-calcite-dropdown{opacity:1;visibility:visible;transform:translate(0)}/*!@:host([open]) .calcite-dropdown-wrapper*/[open].sc-calcite-dropdown-h .calcite-dropdown-wrapper.sc-calcite-dropdown{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}/*!@:host .calcite-dropdown-content*/.sc-calcite-dropdown-h .calcite-dropdown-content.sc-calcite-dropdown{max-block-size:45vh;inline-size:auto;overflow-y:auto;overflow-x:hidden;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}/*!@.calcite-dropdown-trigger-container*/.calcite-dropdown-trigger-container.sc-calcite-dropdown{position:relative;display:flex;flex:1 1 auto}@media (forced-colors: active){/*!@:host([open]) .calcite-dropdown-wrapper*/[open].sc-calcite-dropdown-h .calcite-dropdown-wrapper.sc-calcite-dropdown{border:1px solid canvasText}}/*!@: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}";
- /**
- * @slot - A slot for adding `calcite-dropdown-group` components. Every `calcite-dropdown-item` must have a parent `calcite-dropdown-group`, even if the `groupTitle` property is not set.
- * @slot dropdown-trigger - A slot for the element that triggers the `calcite-dropdown`.
- */
- class Dropdown {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteDropdownSelect = createEvent(this, "calciteDropdownSelect", 6);
- this.calciteDropdownBeforeClose = createEvent(this, "calciteDropdownBeforeClose", 6);
- this.calciteDropdownClose = createEvent(this, "calciteDropdownClose", 6);
- this.calciteDropdownBeforeOpen = createEvent(this, "calciteDropdownBeforeOpen", 6);
- this.calciteDropdownOpen = createEvent(this, "calciteDropdownOpen", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /**
- * Opens or closes the dropdown
- *
- * @deprecated use open instead.
- */
- this.active = false;
- /** When true, opens the dropdown */
- this.open = false;
- /**
- allow the dropdown to remain open after a selection is made
- if the selection-mode of the selected item's containing group is "none", the dropdown will always close
- */
- this.disableCloseOnSelect = false;
- /** is the dropdown disabled */
- this.disabled = false;
- /**
- specify the maximum number of calcite-dropdown-items to display before showing the scroller, must be greater than 0 -
- this value does not include groupTitles passed to calcite-dropdown-group
- */
- this.maxItems = 0;
- /**
- * Determines the type of positioning to use for the overlaid content.
- *
- * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
- *
- * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
- *
- */
- this.overlayPositioning = "absolute";
- /**
- * Determines where the dropdown will be positioned relative to the button.
- *
- * @default "bottom-start"
- */
- this.placement = defaultMenuPlacement;
- /** specify the scale of dropdown, defaults to m */
- this.scale = "m";
- /**
- * **read-only** The currently selected items
- *
- * @readonly
- */
- this.selectedItems = [];
- /** specify whether the dropdown is opened by hover or click of a trigger element */
- this.type = "click";
- this.items = [];
- this.groups = [];
- this.mutationObserver = createObserver();
- this.resizeObserver = createObserver();
- this.openTransitionProp = "visibility";
- this.guid = `calcite-dropdown-${guid()}`;
- this.defaultAssignedElements = [];
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.slotChangeHandler = (event) => {
- this.defaultAssignedElements = event.target.assignedElements({
- flatten: true
- });
- this.updateItems();
- };
- this.setFilteredPlacements = () => {
- const { el, flipPlacements } = this;
- this.filteredFlipPlacements = flipPlacements
- ? filterComputedPlacements(flipPlacements, el)
- : null;
- };
- this.updateTriggers = (event) => {
- this.triggers = event.target.assignedElements({
- flatten: true
- });
- this.reposition(true);
- };
- this.updateItems = () => {
- this.items = this.groups
- .map((group) => Array.from(group === null || group === void 0 ? void 0 : group.querySelectorAll("calcite-dropdown-item")))
- .reduce((previousValue, currentValue) => [...previousValue, ...currentValue], []);
- this.updateSelectedItems();
- this.reposition(true);
- };
- this.updateGroups = (event) => {
- const groups = event.target
- .assignedElements({ flatten: true })
- .filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-dropdown-group"));
- this.groups = groups;
- this.updateItems();
- };
- this.resizeObserverCallback = (entries) => {
- entries.forEach((entry) => {
- const { target } = entry;
- if (target === this.referenceEl) {
- this.setDropdownWidth();
- }
- else if (target === this.scrollerEl) {
- this.setMaxScrollerHeight();
- }
- });
- };
- this.setDropdownWidth = () => {
- const { referenceEl, scrollerEl } = this;
- const referenceElWidth = referenceEl === null || referenceEl === void 0 ? void 0 : referenceEl.clientWidth;
- if (!referenceElWidth || !scrollerEl) {
- return;
- }
- scrollerEl.style.minWidth = `${referenceElWidth}px`;
- };
- this.setMaxScrollerHeight = () => {
- const { scrollerEl } = this;
- if (!scrollerEl) {
- return;
- }
- this.reposition(true);
- const maxScrollerHeight = this.getMaxScrollerHeight();
- scrollerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
- this.reposition(true);
- };
- this.setScrollerAndTransitionEl = (el) => {
- this.resizeObserver.observe(el);
- this.scrollerEl = el;
- this.transitionEl = el;
- connectOpenCloseComponent(this);
- };
- this.setReferenceEl = (el) => {
- this.referenceEl = el;
- connectFloatingUI(this, this.referenceEl, this.floatingEl);
- this.resizeObserver.observe(el);
- };
- this.setFloatingEl = (el) => {
- this.floatingEl = el;
- connectFloatingUI(this, this.referenceEl, this.floatingEl);
- };
- this.keyDownHandler = (event) => {
- const target = event.target;
- if (target !== this.referenceEl) {
- return;
- }
- const { defaultPrevented, key } = event;
- if (defaultPrevented) {
- return;
- }
- if (this.open) {
- if (key === "Escape") {
- this.closeCalciteDropdown();
- event.preventDefault();
- return;
- }
- else if (event.shiftKey && key === "Tab") {
- this.closeCalciteDropdown();
- event.preventDefault();
- return;
- }
- }
- if (isActivationKey(key)) {
- this.openCalciteDropdown();
- event.preventDefault();
- }
- else if (key === "Escape") {
- this.closeCalciteDropdown();
- event.preventDefault();
- }
- };
- this.focusOnFirstActiveOrFirstItem = () => {
- this.getFocusableElement(this.items.find((item) => item.selected) || this.items[0]);
- };
- this.toggleOpenEnd = () => {
- this.focusOnFirstActiveOrFirstItem();
- this.el.removeEventListener("calciteDropdownOpen", this.toggleOpenEnd);
- };
- this.openCalciteDropdown = () => {
- this.open = !this.open;
- if (this.open) {
- this.el.addEventListener("calciteDropdownOpen", this.toggleOpenEnd);
- }
- };
- }
- activeHandler(value) {
- this.open = value;
- }
- openHandler(value) {
- if (!this.disabled) {
- if (value) {
- this.reposition(true);
- }
- else {
- updateAfterClose(this.floatingEl);
- }
- this.active = value;
- return;
- }
- if (!value) {
- updateAfterClose(this.floatingEl);
- }
- this.open = false;
- }
- handleDisabledChange(value) {
- if (!value) {
- this.open = false;
- }
- }
- flipPlacementsHandler() {
- this.setFilteredPlacements();
- this.reposition(true);
- }
- maxItemsHandler() {
- this.setMaxScrollerHeight();
- }
- overlayPositioningHandler() {
- this.reposition(true);
- }
- placementHandler() {
- this.reposition(true);
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- this.setFilteredPlacements();
- this.reposition(true);
- if (this.open) {
- this.openHandler(this.open);
- }
- if (this.active) {
- this.activeHandler(this.active);
- }
- connectOpenCloseComponent(this);
- }
- componentDidLoad() {
- this.reposition(true);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- disconnectedCallback() {
- var _a, _b;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
- (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
- disconnectOpenCloseComponent(this);
- }
- render() {
- const { open, guid } = this;
- return (hAsync(Host, null, hAsync("div", { class: "calcite-dropdown-trigger-container", id: `${guid}-menubutton`, onClick: this.openCalciteDropdown, onKeyDown: this.keyDownHandler, ref: this.setReferenceEl }, hAsync("slot", { "aria-controls": `${guid}-menu`, "aria-expanded": toAriaBoolean(open), "aria-haspopup": "menu", name: SLOTS$k.dropdownTrigger, onSlotchange: this.updateTriggers })), hAsync("div", { "aria-hidden": toAriaBoolean(!open), class: "calcite-dropdown-wrapper", ref: this.setFloatingEl }, hAsync("div", { "aria-labelledby": `${guid}-menubutton`, class: {
- ["calcite-dropdown-content"]: true,
- [FloatingCSS.animation]: true,
- [FloatingCSS.animationActive]: open
- }, id: `${guid}-menu`, ref: this.setScrollerAndTransitionEl, role: "menu" }, hAsync("slot", { onSlotchange: this.updateGroups })))));
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /**
- * Updates the position of the component.
- *
- * @param delayed
- */
- async reposition(delayed = false) {
- const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
- return reposition(this, {
- floatingEl,
- referenceEl,
- overlayPositioning,
- placement,
- flipPlacements: filteredFlipPlacements,
- type: "menu"
- }, delayed);
- }
- closeCalciteDropdownOnClick(event) {
- if (!isPrimaryPointerButton(event) || !this.open || event.composedPath().includes(this.el)) {
- return;
- }
- this.closeCalciteDropdown(false);
- }
- closeCalciteDropdownOnEvent(event) {
- this.closeCalciteDropdown();
- event.stopPropagation();
- }
- closeCalciteDropdownOnOpenEvent(event) {
- if (event.composedPath().includes(this.el)) {
- return;
- }
- this.open = false;
- }
- mouseEnterHandler() {
- if (this.type === "hover") {
- this.openCalciteDropdown();
- }
- }
- mouseLeaveHandler() {
- if (this.type === "hover") {
- this.closeCalciteDropdown();
- }
- }
- calciteInternalDropdownItemKeyEvent(event) {
- const { keyboardEvent } = event.detail;
- // handle edge
- const target = keyboardEvent.target;
- const itemToFocus = target.nodeName !== "A" ? target : target.parentNode;
- const isFirstItem = this.itemIndex(itemToFocus) === 0;
- const isLastItem = this.itemIndex(itemToFocus) === this.items.length - 1;
- switch (keyboardEvent.key) {
- case "Tab":
- if (isLastItem && !keyboardEvent.shiftKey) {
- this.closeCalciteDropdown();
- }
- else if (isFirstItem && keyboardEvent.shiftKey) {
- this.closeCalciteDropdown();
- }
- else if (keyboardEvent.shiftKey) {
- this.focusPrevItem(itemToFocus);
- }
- else {
- this.focusNextItem(itemToFocus);
- }
- break;
- case "ArrowDown":
- this.focusNextItem(itemToFocus);
- break;
- case "ArrowUp":
- this.focusPrevItem(itemToFocus);
- break;
- case "Home":
- this.focusFirstItem();
- break;
- case "End":
- this.focusLastItem();
- break;
- }
- event.stopPropagation();
- }
- handleItemSelect(event) {
- this.updateSelectedItems();
- event.stopPropagation();
- this.calciteDropdownSelect.emit({
- item: event.detail.requestedDropdownItem
- });
- if (!this.disableCloseOnSelect ||
- event.detail.requestedDropdownGroup.selectionMode === "none") {
- this.closeCalciteDropdown();
- }
- event.stopPropagation();
- }
- onBeforeOpen() {
- this.calciteDropdownBeforeOpen.emit();
- }
- onOpen() {
- this.calciteDropdownOpen.emit();
- }
- onBeforeClose() {
- this.calciteDropdownBeforeClose.emit();
- }
- onClose() {
- this.calciteDropdownClose.emit();
- }
- updateSelectedItems() {
- this.selectedItems = this.items.filter((item) => item.selected);
- }
- getMaxScrollerHeight() {
- const { maxItems, items } = this;
- let itemsToProcess = 0;
- let maxScrollerHeight = 0;
- let groupHeaderHeight;
- this.groups.forEach((group) => {
- if (maxItems > 0 && itemsToProcess < maxItems) {
- Array.from(group.children).forEach((item, index) => {
- if (index === 0) {
- if (isNaN(groupHeaderHeight)) {
- groupHeaderHeight = item.offsetTop;
- }
- maxScrollerHeight += groupHeaderHeight;
- }
- if (itemsToProcess < maxItems) {
- maxScrollerHeight += item.offsetHeight;
- itemsToProcess += 1;
- }
- });
- }
- });
- return items.length > maxItems ? maxScrollerHeight : 0;
- }
- closeCalciteDropdown(focusTrigger = true) {
- this.open = false;
- if (focusTrigger) {
- focusElement(this.triggers[0]);
- }
- }
- focusFirstItem() {
- const firstItem = this.items[0];
- this.getFocusableElement(firstItem);
- }
- focusLastItem() {
- const lastItem = this.items[this.items.length - 1];
- this.getFocusableElement(lastItem);
- }
- focusNextItem(el) {
- const index = this.itemIndex(el);
- const nextItem = this.items[index + 1] || this.items[0];
- this.getFocusableElement(nextItem);
- }
- focusPrevItem(el) {
- const index = this.itemIndex(el);
- const prevItem = this.items[index - 1] || this.items[this.items.length - 1];
- this.getFocusableElement(prevItem);
- }
- itemIndex(el) {
- return this.items.indexOf(el);
- }
- getFocusableElement(item) {
- if (!item) {
- return;
- }
- const target = item.attributes.isLink
- ? item.shadowRoot.querySelector("a")
- : item;
- focusElement(target);
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "open": ["openHandler"],
- "disabled": ["handleDisabledChange"],
- "flipPlacements": ["flipPlacementsHandler"],
- "maxItems": ["maxItemsHandler"],
- "overlayPositioning": ["overlayPositioningHandler"],
- "placement": ["placementHandler"]
- }; }
- static get style() { return dropdownCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-dropdown",
- "$members$": {
- "active": [1540],
- "open": [1540],
- "disableCloseOnSelect": [516, "disable-close-on-select"],
- "disabled": [516],
- "flipPlacements": [16],
- "maxItems": [514, "max-items"],
- "overlayPositioning": [513, "overlay-positioning"],
- "placement": [513],
- "scale": [513],
- "selectedItems": [1040],
- "type": [513],
- "width": [513],
- "reposition": [64]
- },
- "$listeners$": [[9, "pointerdown", "closeCalciteDropdownOnClick"], [0, "calciteInternalDropdownCloseRequest", "closeCalciteDropdownOnEvent"], [8, "calciteDropdownOpen", "closeCalciteDropdownOnOpenEvent"], [1, "pointerenter", "mouseEnterHandler"], [1, "pointerleave", "mouseLeaveHandler"], [0, "calciteInternalDropdownItemKeyEvent", "calciteInternalDropdownItemKeyEvent"], [0, "calciteInternalDropdownItemSelect", "handleItemSelect"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["open", "open"], ["disableCloseOnSelect", "disable-close-on-select"], ["disabled", "disabled"], ["maxItems", "max-items"], ["overlayPositioning", "overlay-positioning"], ["placement", "placement"], ["scale", "scale"], ["type", "type"], ["width", "width"]]
- }; }
- }
- const CSS$F = {
- containerSmall: "container--s",
- containerMedium: "container--m",
- containerLarge: "container--l"
- };
- const dropdownGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-dropdown-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-dropdown-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-dropdown-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-dropdown-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-dropdown-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-dropdown-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-dropdown-group-h{display:none}/*!@:host*/.sc-calcite-dropdown-group-h{display:block}/*!@.container*/.container.sc-calcite-dropdown-group{text-align:start}/*!@.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-block-end:-1px;display:block;cursor:default;overflow-wrap:break-word;border-width:0px;border-block-end-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;block-size:1px;background-color:var(--calcite-ui-border-3)}";
- /**
- * @slot - A slot for adding `calcite-dropdown-item` components.
- */
- class DropdownGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalDropdownItemChange = createEvent(this, "calciteInternalDropdownItemChange", 6);
- /**
- specify the selection mode - multi (allow any number of (or no) active items), single (allow and require one active item),
- none (no active items), defaults to single
- */
- this.selectionMode = "single";
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentWillLoad() {
- this.groupPosition = this.getGroupPosition();
- }
- render() {
- const scale = this.scale || getElementProp(this.el, "scale", "m");
- const groupTitle = this.groupTitle ? (hAsync("span", { "aria-hidden": "true", class: "dropdown-title" }, this.groupTitle)) : null;
- const dropdownSeparator = this.groupPosition > 0 ? hAsync("div", { class: "dropdown-separator", role: "separator" }) : null;
- return (hAsync(Host, { "aria-label": this.groupTitle, role: "group" }, hAsync("div", { class: {
- container: true,
- [CSS$F.containerSmall]: scale === "s",
- [CSS$F.containerMedium]: scale === "m",
- [CSS$F.containerLarge]: scale === "l"
- }, title: this.groupTitle }, dropdownSeparator, groupTitle, hAsync("slot", null))));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- updateActiveItemOnChange(event) {
- this.requestedDropdownGroup = event.detail.requestedDropdownGroup;
- this.requestedDropdownItem = event.detail.requestedDropdownItem;
- this.calciteInternalDropdownItemChange.emit({
- requestedDropdownGroup: this.requestedDropdownGroup,
- requestedDropdownItem: this.requestedDropdownItem
- });
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- getGroupPosition() {
- return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-dropdown-group"), this.el);
- }
- get el() { return getElement(this); }
- static get style() { return dropdownGroupCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-dropdown-group",
- "$members$": {
- "groupTitle": [513, "group-title"],
- "selectionMode": [513, "selection-mode"],
- "scale": [513]
- },
- "$listeners$": [[0, "calciteInternalDropdownItemSelect", "updateActiveItemOnChange"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["groupTitle", "group-title"], ["selectionMode", "selection-mode"], ["scale", "scale"]]
- }; }
- }
- const CSS$E = {
- containerLink: "container--link",
- containerSmall: "container--s",
- containerMedium: "container--m",
- containerLarge: "container--l",
- containerMulti: "container--multi-selection",
- containerSingle: "container--single-selection",
- containerNone: "container--none-selection"
- };
- const dropdownItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-dropdown-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-dropdown-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-dropdown-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-dropdown-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-dropdown-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-dropdown-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-dropdown-item-h{display:none}/*!@.container--s*/.container--s.sc-calcite-dropdown-item{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-inline-end:0.5rem;padding-inline-start:1.5rem}/*!@.container--m*/.container--m.sc-calcite-dropdown-item{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-inline-end:0.75rem;padding-inline-start:2rem}/*!@.container--l*/.container--l.sc-calcite-dropdown-item{padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;padding-inline-end:1rem;padding-inline-start:2.5rem}/*!@.container--s.container--none-selection*/.container--s.container--none-selection.sc-calcite-dropdown-item{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{padding-inline-start:0px}/*!@.container--m.container--none-selection*/.container--m.container--none-selection.sc-calcite-dropdown-item{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{padding-inline-start:0px}/*!@.container--l.container--none-selection*/.container--l.container--none-selection.sc-calcite-dropdown-item{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{padding-inline-start:0px}/*!@:host*/.sc-calcite-dropdown-item-h{position:relative;display:flex;flex-grow:1;align-items:center}/*!@.container*/.container.sc-calcite-dropdown-item{position:relative;display:flex;flex-grow:1;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);text-decoration-line:none;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);text-align:start}/*!@.dropdown-item-content*/.dropdown-item-content.sc-calcite-dropdown-item{flex:1 1 auto;padding-inline-end:auto;padding-inline-start:0.25rem}/*!@:host, \n.container--link a*/.sc-calcite-dropdown-item-h,.container--link.sc-calcite-dropdown-item a.sc-calcite-dropdown-item{outline-color:transparent}/*!@:host(:focus)*/.sc-calcite-dropdown-item-h:focus{outline:2px solid transparent;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:flex;flex-grow:1;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);text-decoration-line:none;transition-duration:150ms;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-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-inline-end:0.5rem;padding-inline-start:1.5rem}/*!@.container--m .dropdown-link*/.container--m.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-inline-end:0.75rem;padding-inline-start:2rem}/*!@.container--l .dropdown-link*/.container--l.sc-calcite-dropdown-item .dropdown-link.sc-calcite-dropdown-item{padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;padding-inline-end:1rem;padding-inline-start:2.5rem}/*!@:host(:hover) .container, \n: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);text-decoration-line:none}/*!@:host(:hover) .container--link .dropdown-link, \n: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);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, \n:host(:active) .container:before, \n: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([selected]) .container:not(.container--none-selection), \n:host([selected]) .container--link .dropdown-link*/[selected].sc-calcite-dropdown-item-h .container.sc-calcite-dropdown-item:not(.container--none-selection),[selected].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([selected]) .container:not(.container--none-selection):before, \n:host([selected]) .container--link .dropdown-link:before*/[selected].sc-calcite-dropdown-item-h .container.sc-calcite-dropdown-item:not(.container--none-selection):before,[selected].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([selected]) .container:not(.container--none-selection) calcite-icon,\n:host([selected]) .container--link .dropdown-link calcite-icon*/[selected].sc-calcite-dropdown-item-h .container.sc-calcite-dropdown-item:not(.container--none-selection) calcite-icon.sc-calcite-dropdown-item,[selected].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, \n.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;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);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{margin-inline-end:0.5rem;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{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{margin-inline-end:0.75rem;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{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{margin-inline-end:1rem;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{margin-inline-start:1rem}";
- /**
- * @slot - A slot for adding text.
- */
- class DropdownItem {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalDropdownItemSelect = createEvent(this, "calciteInternalDropdownItemSelect", 6);
- this.calciteInternalDropdownItemKeyEvent = createEvent(this, "calciteInternalDropdownItemKeyEvent", 6);
- this.calciteInternalDropdownCloseRequest = createEvent(this, "calciteInternalDropdownCloseRequest", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /**
- * Indicates whether the item is active.
- *
- * @deprecated Use selected instead.
- */
- this.active = false;
- /** When true, item is selected */
- this.selected = false;
- }
- activeHandler(value) {
- this.selected = value;
- }
- selectedHandler(value) {
- this.active = value;
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.el) === null || _a === void 0 ? void 0 : _a.focus();
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentWillLoad() {
- this.initialize();
- }
- connectedCallback() {
- const isSelected = this.selected || this.active;
- if (isSelected) {
- this.activeHandler(isSelected);
- this.selectedHandler(isSelected);
- }
- this.initialize();
- }
- render() {
- const scale = getElementProp(this.el, "scale", "m");
- const iconStartEl = (hAsync("calcite-icon", { class: "dropdown-item-icon-start", flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
- const contentNode = (hAsync("span", { class: "dropdown-item-content" }, hAsync("slot", null)));
- const iconEndEl = (hAsync("calcite-icon", { class: "dropdown-item-icon-end", flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
- const slottedContent = this.iconStart && this.iconEnd
- ? [iconStartEl, contentNode, iconEndEl]
- : this.iconStart
- ? [iconStartEl, hAsync("slot", null)]
- : this.iconEnd
- ? [contentNode, iconEndEl]
- : contentNode;
- 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));
- const itemRole = this.href
- ? null
- : this.selectionMode === "single"
- ? "menuitemradio"
- : this.selectionMode === "multi"
- ? "menuitemcheckbox"
- : "menuitem";
- const itemAria = this.selectionMode !== "none" ? toAriaBoolean(this.selected) : null;
- return (hAsync(Host, { "aria-checked": itemAria, role: itemRole, tabindex: "0" }, hAsync("div", { class: {
- container: true,
- [CSS$E.containerLink]: !!this.href,
- [CSS$E.containerSmall]: scale === "s",
- [CSS$E.containerMedium]: scale === "m",
- [CSS$E.containerLarge]: scale === "l",
- [CSS$E.containerMulti]: this.selectionMode === "multi",
- [CSS$E.containerSingle]: this.selectionMode === "single",
- [CSS$E.containerNone]: this.selectionMode === "none"
- } }, this.selectionMode !== "none" ? (hAsync("calcite-icon", { class: "dropdown-item-icon", icon: this.selectionMode === "multi" ? "check" : "bullet-point", scale: "s" })) : null, contentEl)));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- onClick() {
- this.emitRequestedItem();
- }
- keyDownHandler(event) {
- switch (event.key) {
- case " ":
- case "Enter":
- this.emitRequestedItem();
- if (this.href) {
- this.childLink.click();
- }
- event.preventDefault();
- break;
- case "Escape":
- this.calciteInternalDropdownCloseRequest.emit();
- event.preventDefault();
- break;
- case "Tab":
- this.calciteInternalDropdownItemKeyEvent.emit({ keyboardEvent: event });
- break;
- case "ArrowUp":
- case "ArrowDown":
- case "Home":
- case "End":
- event.preventDefault();
- this.calciteInternalDropdownItemKeyEvent.emit({ keyboardEvent: event });
- break;
- }
- }
- updateActiveItemOnChange(event) {
- const parentEmittedChange = event.composedPath().includes(this.parentDropdownGroupEl);
- if (parentEmittedChange) {
- this.requestedDropdownGroup = event.detail.requestedDropdownGroup;
- this.requestedDropdownItem = event.detail.requestedDropdownItem;
- this.determineActiveItem();
- }
- event.stopPropagation();
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- initialize() {
- this.selectionMode = getElementProp(this.el, "selection-mode", "single");
- this.parentDropdownGroupEl = this.el.closest("calcite-dropdown-group");
- if (this.selectionMode === "none") {
- this.selected = false;
- }
- }
- determineActiveItem() {
- switch (this.selectionMode) {
- case "multi":
- if (this.el === this.requestedDropdownItem) {
- this.selected = !this.selected;
- }
- break;
- case "single":
- if (this.el === this.requestedDropdownItem) {
- this.selected = true;
- }
- else if (this.requestedDropdownGroup === this.parentDropdownGroupEl) {
- this.selected = false;
- }
- break;
- case "none":
- this.selected = false;
- break;
- }
- }
- emitRequestedItem() {
- this.calciteInternalDropdownItemSelect.emit({
- requestedDropdownItem: this.el,
- requestedDropdownGroup: this.parentDropdownGroupEl
- });
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "selected": ["selectedHandler"]
- }; }
- static get style() { return dropdownItemCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-dropdown-item",
- "$members$": {
- "active": [1540],
- "selected": [1540],
- "iconFlipRtl": [513, "icon-flip-rtl"],
- "iconStart": [513, "icon-start"],
- "iconEnd": [513, "icon-end"],
- "href": [513],
- "label": [1],
- "rel": [513],
- "target": [513],
- "setFocus": [64]
- },
- "$listeners$": [[0, "click", "onClick"], [0, "keydown", "keyDownHandler"], [16, "calciteInternalDropdownItemChange", "updateActiveItemOnChange"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["selected", "selected"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"], ["iconEnd", "icon-end"], ["href", "href"], ["rel", "rel"], ["target", "target"]]
- }; }
- }
- const CSS$D = {
- button: "button"
- };
- const ICONS$a = {
- plus: "plus"
- };
- const fabCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-fab{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-fab{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-fab{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-fab{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-fab:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-fab:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-fab-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-fab-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-fab-h{display:flex;background-color:transparent}/*!@: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);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);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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}";
- class Fab {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * Used to set the button's appearance. Default is outline.
- */
- this.appearance = "outline";
- /**
- * Used to set the button's color. Default is light.
- */
- this.color = "neutral";
- /**
- * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
- */
- this.disabled = false;
- /**
- * Specifies an icon to display.
- *
- * @default "plus"
- */
- this.icon = ICONS$a.plus;
- /**
- * When true, content is waiting to be loaded. This state shows a busy indicator.
- */
- this.loading = false;
- /**
- * Specifies the size of the fab.
- */
- this.scale = "m";
- /**
- * Indicates whether the text is displayed.
- */
- this.textEnabled = false;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Methods
- //
- // --------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- focusElement(this.buttonEl);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const { appearance, color, disabled, loading, scale, textEnabled, icon, label, text } = this;
- const title = !textEnabled ? label || text || null : null;
- return (hAsync("calcite-button", { appearance: appearance === "solid" ? "solid" : "outline", class: CSS$D.button, color: color, disabled: disabled, iconStart: icon, label: label, loading: loading, ref: (buttonEl) => {
- this.buttonEl = buttonEl;
- }, round: true, scale: scale, title: title, type: "button", width: "auto" }, this.textEnabled ? this.text : null));
- }
- get el() { return getElement(this); }
- static get style() { return fabCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-fab",
- "$members$": {
- "appearance": [513],
- "color": [513],
- "disabled": [516],
- "icon": [513],
- "label": [1],
- "loading": [516],
- "scale": [513],
- "text": [1],
- "textEnabled": [516, "text-enabled"],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["appearance", "appearance"], ["color", "color"], ["disabled", "disabled"], ["icon", "icon"], ["loading", "loading"], ["scale", "scale"], ["textEnabled", "text-enabled"]]
- }; }
- }
- const CSS$C = {
- container: "container",
- searchIcon: "search-icon"
- };
- const TEXT$h = {
- filterLabel: "Filter",
- clear: "Clear filter"
- };
- const ICONS$9 = {
- search: "search",
- close: "x"
- };
- const DEBOUNCE_TIMEOUT = 250;
- const filterCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-filter{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-filter{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-filter{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-filter{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-filter:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-filter-h{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{box-sizing:border-box}/*!@:root*/.sc-calcite-filter:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-filter-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-filter-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-filter-h{display:flex;inline-size:100%}/*!@: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:flex;inline-size:100%;padding:0.5rem}/*!@label*/label.sc-calcite-filter{position:relative;margin-inline:0.25rem;margin-block:0px;display:flex;inline-size:100%;align-items:center;overflow:hidden}/*!@input[type=text]*/input[type=text].sc-calcite-filter{margin-block-end:0.25rem;inline-size:100%;border-style:none;background-color:transparent;padding-block:0.25rem;font-family:inherit;font-size:var(--calcite-font-size--2);line-height:1rem;color:var(--calcite-ui-text-1);padding-inline-end:0.25rem;padding-inline-start:1.5rem;transition:padding var(--calcite-animation-timing), 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{inline-size:100%}/*!@.search-icon*/.search-icon.sc-calcite-filter{position:absolute;display:flex;color:var(--calcite-ui-text-2);inset-inline-start:0;transition:inset-inline-start var(--calcite-animation-timing), inset-inline-end 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:flex;cursor:pointer;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)}";
- class Filter {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteFilterChange = createEvent(this, "calciteFilterChange", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * The items to filter through. The filter uses this as the starting point, and returns items
- * that contain the string entered in the input, using a partial match and recursive search.
- *
- * This property is required.
- */
- this.items = [];
- /**
- * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
- */
- this.disabled = false;
- /**
- * The resulting items after filtering.
- *
- * @readonly
- */
- this.filteredItems = [];
- /** specify the scale of filter, defaults to m */
- this.scale = "m";
- /**
- * Filter value.
- */
- this.value = "";
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.filter = debounce((value, emit = false) => this.updateFiltered(filter(this.items, value), emit), DEBOUNCE_TIMEOUT);
- this.inputHandler = (event) => {
- const target = event.target;
- this.value = target.value;
- this.filter(target.value, true);
- };
- this.keyDownHandler = (event) => {
- if (event.key === "Escape") {
- this.clear();
- event.preventDefault();
- }
- if (event.key === "Enter") {
- event.preventDefault();
- }
- };
- this.clear = () => {
- this.value = "";
- this.filter("", true);
- this.setFocus();
- };
- }
- watchItemsHandler() {
- this.filter(this.value);
- }
- valueHandler(value) {
- this.filter(value);
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidRender() {
- updateHostInteraction(this);
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentWillLoad() {
- this.filter(this.value);
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- focusElement(this.textInput);
- }
- updateFiltered(filtered, emit = false) {
- this.filteredItems.length = 0;
- this.filteredItems = this.filteredItems.concat(filtered);
- if (emit) {
- this.calciteFilterChange.emit();
- }
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const { disabled, scale } = this;
- return (hAsync(Fragment, null, hAsync("div", { class: CSS$C.container }, hAsync("label", null, hAsync("calcite-input", { "aria-label": this.intlLabel || TEXT$h.filterLabel, clearable: true, disabled: disabled, icon: ICONS$9.search, intlClear: this.intlClear || TEXT$h.clear, onCalciteInputInput: this.inputHandler, onKeyDown: this.keyDownHandler, placeholder: this.placeholder, ref: (el) => {
- this.textInput = el;
- }, scale: scale, type: "text", value: this.value })))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "items": ["watchItemsHandler"],
- "value": ["valueHandler"]
- }; }
- static get style() { return filterCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-filter",
- "$members$": {
- "items": [1040],
- "disabled": [516],
- "filteredItems": [1040],
- "intlClear": [1, "intl-clear"],
- "intlLabel": [1, "intl-label"],
- "placeholder": [1],
- "scale": [513],
- "value": [1025],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["scale", "scale"]]
- }; }
- }
- const CSS$B = {
- frame: "frame",
- frameAdvancing: "frame--advancing",
- frameRetreating: "frame--retreating"
- };
- const flowCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-flow{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-flow{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-flow{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-flow{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-flow:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-flow-h{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{box-sizing:border-box}/*!@:root*/.sc-calcite-flow:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-flow-h{display:none}/*!@:host*/.sc-calcite-flow-h{position:relative;display:flex;inline-size:100%;flex:1 1 auto;align-items:stretch;overflow:hidden;background-color:transparent}/*!@:host .frame*/.sc-calcite-flow-h .frame.sc-calcite-flow{position:relative;margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;padding:0px}/*!@:host ::slotted(calcite-flow-item), \n:host ::slotted(calcite-panel)*/.sc-calcite-flow-h .sc-calcite-flow-s>calcite-flow-item,.sc-calcite-flow-h .sc-calcite-flow-s>calcite-panel{block-size:100%}/*!@:host ::slotted(.calcite-match-height:last-child)*/.sc-calcite-flow-h .sc-calcite-flow-s>.calcite-match-height:last-child{display:flex;flex:1 1 auto;overflow:hidden}/*!@:host .frame--advancing*/.sc-calcite-flow-h .frame--advancing.sc-calcite-flow{animation:calcite-frame-advance var(--calcite-animation-timing)}/*!@:host .frame--retreating*/.sc-calcite-flow-h .frame--retreating.sc-calcite-flow{animation:calcite-frame-retreat var(--calcite-animation-timing)}@keyframes calcite-frame-advance{0%{--tw-bg-opacity:0.5;transform:translate3d(50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}@keyframes calcite-frame-retreat{0%{--tw-bg-opacity:0.5;transform:translate3d(-50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}";
- /**
- * @slot - A slot for adding `calcite-flow-item` or `calcite-panel`s (deprecated) to the flow.
- */
- class Flow {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.flowDirection = null;
- this.itemCount = 0;
- this.items = [];
- this.itemMutationObserver = createObserver();
- this.getFlowDirection = (oldFlowItemCount, newFlowItemCount) => {
- const allowRetreatingDirection = oldFlowItemCount > 1;
- const allowAdvancingDirection = oldFlowItemCount && newFlowItemCount > 1;
- if (!allowAdvancingDirection && !allowRetreatingDirection) {
- return null;
- }
- return newFlowItemCount < oldFlowItemCount ? "retreating" : "advancing";
- };
- this.updateFlowProps = () => {
- const { el, items } = this;
- const newItems = Array.from(el.querySelectorAll("calcite-flow-item, calcite-panel")).filter((flowItem) => !flowItem.matches("calcite-flow-item calcite-flow-item, calcite-panel calcite-panel"));
- const oldItemCount = items.length;
- const newItemCount = newItems.length;
- const activeItem = newItems[newItemCount - 1];
- const previousItem = newItems[newItemCount - 2];
- if (newItemCount && activeItem) {
- newItems.forEach((itemNode) => {
- itemNode.showBackButton = itemNode === activeItem && newItemCount > 1;
- itemNode.hidden = itemNode !== activeItem;
- });
- }
- if (previousItem) {
- previousItem.menuOpen = false;
- }
- this.items = newItems;
- if (oldItemCount !== newItemCount) {
- const flowDirection = this.getFlowDirection(oldItemCount, newItemCount);
- this.itemCount = newItemCount;
- this.flowDirection = flowDirection;
- }
- };
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /**
- * Removes the currently active `calcite-flow-item` or `calcite-panel`.
- */
- async back() {
- const { items } = this;
- const lastItem = items[items.length - 1];
- if (!lastItem) {
- return;
- }
- const beforeBack = lastItem.beforeBack
- ? lastItem.beforeBack
- : () => Promise.resolve();
- return beforeBack.call(lastItem).then(() => {
- lastItem.remove();
- return lastItem;
- });
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- (_a = this.itemMutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- this.updateFlowProps();
- }
- disconnectedCallback() {
- var _a;
- (_a = this.itemMutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- handleItemBackClick() {
- this.back();
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const { flowDirection } = this;
- const frameDirectionClasses = {
- [CSS$B.frame]: true,
- [CSS$B.frameAdvancing]: flowDirection === "advancing",
- [CSS$B.frameRetreating]: flowDirection === "retreating"
- };
- return (hAsync("div", { class: frameDirectionClasses }, hAsync("slot", null)));
- }
- get el() { return getElement(this); }
- static get style() { return flowCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-flow",
- "$members$": {
- "flowDirection": [32],
- "itemCount": [32],
- "items": [32],
- "back": [64]
- },
- "$listeners$": [[0, "calciteFlowItemBackClick", "handleItemBackClick"], [0, "calcitePanelBackClick", "handleItemBackClick"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const CSS$A = {
- backButton: "back-button"
- };
- const ICONS$8 = {
- backLeft: "chevron-left",
- backRight: "chevron-right"
- };
- const TEXT$g = {
- back: "Back"
- };
- const SLOTS$j = {
- headerActionsStart: "header-actions-start",
- headerActionsEnd: "header-actions-end",
- headerMenuActions: "header-menu-actions",
- headerContent: "header-content",
- fab: "fab",
- footer: "footer",
- footerActions: "footer-actions"
- };
- const CSS$z = {
- backButton: "back-button",
- container: "container",
- header: "header",
- heading: "heading",
- summary: "summary",
- description: "description",
- headerContent: "header-content",
- headerActions: "header-actions",
- headerActionsEnd: "header-actions--end",
- headerActionsStart: "header-actions--start",
- contentWrapper: "content-wrapper",
- contentContainer: "content-container",
- contentHeight: "content-height",
- fabContainer: "fab-container",
- footer: "footer"
- };
- const ICONS$7 = {
- close: "x",
- menu: "ellipsis",
- backLeft: "chevron-left",
- backRight: "chevron-right"
- };
- const SLOTS$i = {
- headerActionsStart: "header-actions-start",
- headerActionsEnd: "header-actions-end",
- headerMenuActions: "header-menu-actions",
- headerContent: "header-content",
- fab: "fab",
- footer: "footer",
- footerActions: "footer-actions"
- };
- const TEXT$f = {
- back: "Back",
- close: "Close",
- open: "Open",
- options: "Options"
- };
- const HEADING_LEVEL$5 = 3;
- const flowItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-flow-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-flow-item{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-flow-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-flow-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-flow-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-flow-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-flow-item:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-flow-item-h{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-item-h *.sc-calcite-flow-item{box-sizing:border-box}/*!@:root*/.sc-calcite-flow-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-flow-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-flow-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-flow-item-h{position:relative;display:flex;inline-size:100%;flex:1 1 auto;overflow:hidden}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-flow-item-h[disabled] .sc-calcite-flow-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-flow-item-h [calcite-hydrated][disabled].sc-calcite-flow-item{opacity:1}/*!@.back-button*/.back-button.sc-calcite-flow-item{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}";
- /**
- * @slot - A slot for adding custom content.
- * @slot header-actions-start - A slot for adding actions or content to the start side of the header.
- * @slot header-actions-end - A slot for adding actions or content to the end side of the header.
- * @slot header-content - A slot for adding custom content to the header.
- * @slot header-menu-actions - A slot for adding an overflow menu with actions inside a `calcite-dropdown`.
- * @slot fab - A slot for adding a `calcite-fab` (floating action button) to perform an action.
- * @slot footer-actions - A slot for adding buttons to the footer.
- * @slot footer - A slot for adding custom content to the footer.
- */
- class FlowItem {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteFlowItemBack = createEvent(this, "calciteFlowItemBack", 6);
- this.calciteFlowItemBackClick = createEvent(this, "calciteFlowItemBackClick", 6);
- this.calciteFlowItemScroll = createEvent(this, "calciteFlowItemScroll", 6);
- this.calciteFlowItemClose = createEvent(this, "calciteFlowItemClose", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /** When true, displays a close button in the trailing side of the header */
- this.closable = false;
- /** When true, flow-item will be hidden */
- this.closed = false;
- /**
- * When true, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * When true, a busy indicator is displayed.
- */
- this.loading = false;
- /**
- * When true, the action menu items in the `header-menu-actions` slot are open.
- */
- this.menuOpen = false;
- /**
- * When true, displays a back button in the header.
- */
- this.showBackButton = false;
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.handlePanelScroll = (event) => {
- event.stopPropagation();
- this.calciteFlowItemScroll.emit();
- };
- this.handlePanelClose = (event) => {
- event.stopPropagation();
- this.calciteFlowItemClose.emit();
- };
- this.backButtonClick = () => {
- this.calciteFlowItemBackClick.emit();
- this.calciteFlowItemBack.emit();
- };
- this.setBackRef = (node) => {
- this.backButtonEl = node;
- };
- this.setContainerRef = (node) => {
- this.containerEl = node;
- };
- this.getBackLabel = () => {
- return this.intlBack || TEXT$g.back;
- };
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Methods
- //
- // --------------------------------------------------------------------------
- /**
- * Sets focus on the component.
- */
- async setFocus() {
- const { backButtonEl, containerEl } = this;
- if (backButtonEl) {
- backButtonEl.setFocus();
- return;
- }
- containerEl === null || containerEl === void 0 ? void 0 : containerEl.setFocus();
- }
- /**
- * Scrolls the component's content to a specified set of coordinates.
- *
- * @example
- * myCalciteFlowItem.scrollContentTo({
- * left: 0, // Specifies the number of pixels along the X axis to scroll the window or element.
- * top: 0, // Specifies the number of pixels along the Y axis to scroll the window or element
- * behavior: "auto" // Specifies whether the scrolling should animate smoothly (smooth), or happen instantly in a single jump (auto, the default value).
- * });
- * @param options
- */
- async scrollContentTo(options) {
- var _a;
- await ((_a = this.containerEl) === null || _a === void 0 ? void 0 : _a.scrollContentTo(options));
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderBackButton() {
- const { el } = this;
- const rtl = getElementDir(el) === "rtl";
- const { showBackButton, backButtonClick } = this;
- const label = this.getBackLabel();
- const icon = rtl ? ICONS$8.backRight : ICONS$8.backLeft;
- return showBackButton ? (hAsync("calcite-action", { "aria-label": label, class: CSS$A.backButton, icon: icon, key: "flow-back-button", onClick: backButtonClick, ref: this.setBackRef, scale: "s", slot: "header-actions-start", text: label })) : null;
- }
- render() {
- const { closable, closed, description, disabled, heading, headingLevel, heightScale, intlBack, intlClose, intlOptions, loading, menuOpen, widthScale, backButtonEl } = this;
- const label = this.getBackLabel();
- return (hAsync(Host, null, hAsync("calcite-panel", { closable: closable, closed: closed, description: description, disabled: disabled, heading: heading, headingLevel: headingLevel, heightScale: heightScale, intlBack: intlBack, intlClose: intlClose, intlOptions: intlOptions, loading: loading, menuOpen: menuOpen, onCalcitePanelClose: this.handlePanelClose, onCalcitePanelScroll: this.handlePanelScroll, ref: this.setContainerRef, widthScale: widthScale }, this.renderBackButton(), hAsync("slot", { name: SLOTS$j.headerActionsStart, slot: SLOTS$i.headerActionsStart }), hAsync("slot", { name: SLOTS$j.headerActionsEnd, slot: SLOTS$i.headerActionsEnd }), hAsync("slot", { name: SLOTS$j.headerContent, slot: SLOTS$i.headerContent }), hAsync("slot", { name: SLOTS$j.headerMenuActions, slot: SLOTS$i.headerMenuActions }), hAsync("slot", { name: SLOTS$j.fab, slot: SLOTS$i.fab }), hAsync("slot", { name: SLOTS$j.footerActions, slot: SLOTS$i.footerActions }), hAsync("slot", { name: SLOTS$j.footer, slot: SLOTS$i.footer }), hAsync("slot", null)), backButtonEl ? (hAsync("calcite-tooltip", { label: label, placement: "auto", referenceElement: backButtonEl }, label)) : null));
- }
- get el() { return getElement(this); }
- static get style() { return flowItemCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-flow-item",
- "$members$": {
- "closable": [1540],
- "closed": [1540],
- "beforeBack": [16],
- "description": [1],
- "disabled": [516],
- "heading": [1],
- "headingLevel": [514, "heading-level"],
- "heightScale": [513, "height-scale"],
- "intlBack": [1, "intl-back"],
- "intlClose": [1, "intl-close"],
- "intlOptions": [1, "intl-options"],
- "loading": [516],
- "menuOpen": [516, "menu-open"],
- "showBackButton": [516, "show-back-button"],
- "widthScale": [513, "width-scale"],
- "backButtonEl": [32],
- "setFocus": [64],
- "scrollContentTo": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["closable", "closable"], ["closed", "closed"], ["disabled", "disabled"], ["headingLevel", "heading-level"], ["heightScale", "height-scale"], ["loading", "loading"], ["menuOpen", "menu-open"], ["showBackButton", "show-back-button"], ["widthScale", "width-scale"]]
- }; }
- }
- /**
- * Calculate slope of the tangents
- * uses Steffen interpolation as it's monotonic
- * http://jrwalsh1.github.io/posts/interpolations/
- *
- * @param p0
- * @param p1
- * @param p2
- */
- function slope(p0, p1, p2) {
- const dx = p1[0] - p0[0];
- const dx1 = p2[0] - p1[0];
- const dy = p1[1] - p0[1];
- const dy1 = p2[1] - p1[1];
- const m = dy / (dx || (dx1 < 0 && 0));
- const m1 = dy1 / (dx1 || (dx < 0 && 0));
- const p = (m * dx1 + m1 * dx) / (dx + dx1);
- return (Math.sign(m) + Math.sign(m1)) * Math.min(Math.abs(m), Math.abs(m1), 0.5 * Math.abs(p)) || 0;
- }
- /**
- * Calculate slope for just one tangent (single-sided)
- *
- * @param p0
- * @param p1
- * @param m
- */
- function slopeSingle(p0, p1, m) {
- const dx = p1[0] - p0[0];
- const dy = p1[1] - p0[1];
- return dx ? ((3 * dy) / dx - m) / 2 : m;
- }
- /**
- * Given two points and their tangent slopes,
- * calculate the bezier handle coordinates and return draw command.
- *
- * Translates Hermite Spline to Beziér curve:
- * stackoverflow.com/questions/42574940/
- *
- * @param p0
- * @param p1
- * @param m0
- * @param m1
- * @param t
- */
- function bezier(p0, p1, m0, m1, t) {
- const [x0, y0] = p0;
- const [x1, y1] = p1;
- const dx = (x1 - x0) / 3;
- const h1 = t([x0 + dx, y0 + dx * m0]).join(",");
- const h2 = t([x1 - dx, y1 - dx * m1]).join(",");
- const p = t([x1, y1]).join(",");
- return `C ${h1} ${h2} ${p}`;
- }
- /**
- * Generate a function which will translate a point
- * from the data coordinate space to svg viewbox oriented pixels
- *
- * @param root0
- * @param root0.width
- * @param root0.height
- * @param root0.min
- * @param root0.max
- */
- function translate({ width, height, min, max }) {
- const rangeX = max[0] - min[0];
- const rangeY = max[1] - min[1];
- return (point) => {
- const x = ((point[0] - min[0]) / rangeX) * width;
- const y = height - (point[1] / rangeY) * height;
- return [x, y];
- };
- }
- /**
- * Get the min and max values from the dataset
- *
- * @param data
- */
- function range(data) {
- const [startX, startY] = data[0];
- const min = [startX, startY];
- const max = [startX, startY];
- return data.reduce(({ min, max }, [x, y]) => ({
- min: [Math.min(min[0], x), Math.min(min[1], y)],
- max: [Math.max(max[0], x), Math.max(max[1], y)]
- }), { min, max });
- }
- /**
- * Generate drawing commands for an area graph
- * returns a string can can be passed directly to a path element's `d` attribute
- *
- * @param root0
- * @param root0.data
- * @param root0.min
- * @param root0.max
- * @param root0.t
- */
- function area({ data, min, max, t }) {
- if (data.length === 0) {
- return "";
- }
- // important points for beginning and ending the path
- const [startX, startY] = t(data[0]);
- const [minX, minY] = t(min);
- const [maxX] = t(max);
- // keep track of previous slope/points
- let m;
- let p0;
- let p1;
- // iterate over data points, calculating command for each
- const commands = data.reduce((acc, point, i) => {
- p0 = data[i - 2];
- p1 = data[i - 1];
- if (i > 1) {
- const m1 = slope(p0, p1, point);
- const m0 = m === undefined ? slopeSingle(p0, p1, m1) : m;
- const command = bezier(p0, p1, m0, m1, t);
- m = m1;
- return `${acc} ${command}`;
- }
- return acc;
- }, `M ${minX},${minY} L ${minX},${startY} L ${startX},${startY}`);
- // close the path
- const last = data[data.length - 1];
- const end = bezier(p1, last, m, slopeSingle(p1, last, m), t);
- return `${commands} ${end} L ${maxX},${minY} Z`;
- }
- const graphCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-graph{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-graph{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-graph{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-graph{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-graph:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-graph:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-graph-h{display:none}/*!@:host*/.sc-calcite-graph-h{display:block;block-size:100%}/*!@.svg*/.svg.sc-calcite-graph{fill:currentColor;stroke:transparent;margin:0px;display:block;block-size:100%;inline-size: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}";
- class Graph {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * Array of tuples describing a single data point ([x, y])
- * These data points should be sorted by x-axis value
- */
- this.data = [];
- //--------------------------------------------------------------------------
- //
- // Private State/Props
- //
- //--------------------------------------------------------------------------
- this.graphId = `calcite-graph-${guid()}`;
- this.resizeObserver = createObserver();
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el);
- }
- disconnectedCallback() {
- var _a;
- (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- }
- render() {
- const { data, colorStops, el, highlightMax, highlightMin, min, max } = this;
- const id = this.graphId;
- const { clientHeight: height, clientWidth: width } = el;
- // if we have no data, return empty svg
- if (!data || data.length === 0) {
- return (hAsync("svg", { class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }));
- }
- const { min: rangeMin, max: rangeMax } = range(data);
- let currentMin = rangeMin;
- let currentMax = rangeMax;
- if (min < rangeMin[0] || min > rangeMin[0]) {
- currentMin = [min, 0];
- }
- if (max > rangeMax[0] || max < rangeMax[0]) {
- currentMax = [max, rangeMax[1]];
- }
- const t = translate({ min: currentMin, max: currentMax, width, height });
- const [hMinX] = t([highlightMin, currentMax[1]]);
- const [hMaxX] = t([highlightMax, currentMax[1]]);
- const areaPath = area({ data, min: rangeMin, max: rangeMax, t });
- const fill = colorStops ? `url(#linear-gradient-${id})` : undefined;
- 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 ? ([
- hAsync("mask", { height: "100%", id: `${id}1`, width: "100%", x: "0%", y: "0%" }, hAsync("path", { d: `
- M 0,0
- L ${hMinX - 1},0
- L ${hMinX - 1},${height}
- L 0,${height}
- Z
- `, fill: "white" })),
- hAsync("mask", { height: "100%", id: `${id}2`, width: "100%", x: "0%", y: "0%" }, hAsync("path", { d: `
- M ${hMinX + 1},0
- L ${hMaxX - 1},0
- L ${hMaxX - 1},${height}
- L ${hMinX + 1}, ${height}
- Z
- `, fill: "white" })),
- hAsync("mask", { height: "100%", id: `${id}3`, width: "100%", x: "0%", y: "0%" }, hAsync("path", { d: `
- M ${hMaxX + 1},0
- L ${width},0
- L ${width},${height}
- L ${hMaxX + 1}, ${height}
- Z
- `, fill: "white" })),
- hAsync("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}1)` }),
- hAsync("path", { class: "graph-path--highlight", d: areaPath, fill: fill, mask: `url(#${id}2)` }),
- hAsync("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}3)` })
- ]) : (hAsync("path", { class: "graph-path", d: areaPath, fill: fill }))));
- }
- get el() { return getElement(this); }
- static get style() { return graphCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-graph",
- "$members$": {
- "data": [16],
- "colorStops": [16],
- "highlightMin": [2, "highlight-min"],
- "highlightMax": [2, "highlight-max"],
- "min": [514],
- "max": [514]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["min", "min"], ["max", "max"]]
- }; }
- }
- const CSS$y = {
- handle: "handle",
- handleActivated: "handle--activated"
- };
- const ICONS$6 = {
- drag: "drag"
- };
- const handleCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-handle{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-handle{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-handle{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-handle{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-handle:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-handle:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-handle-h{display:none}/*!@:host*/.sc-calcite-handle-h{display:flex}/*!@.handle*/.handle.sc-calcite-handle{display:flex;cursor:move;align-items:center;justify-content:center;align-self:stretch;border-style:none;background-color:transparent;outline-color:transparent;color:var(--calcite-ui-border-input);padding-block:0.75rem;padding-inline: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}";
- class Handle {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteHandleNudge = createEvent(this, "calciteHandleNudge", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * @internal
- */
- this.activated = false;
- /**
- * Value for the button title attribute
- */
- this.textTitle = "handle";
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.handleKeyDown = (event) => {
- switch (event.key) {
- case " ":
- this.activated = !this.activated;
- event.preventDefault();
- break;
- case "ArrowUp":
- case "ArrowDown":
- if (!this.activated) {
- return;
- }
- event.preventDefault();
- const direction = event.key.toLowerCase().replace("arrow", "");
- this.calciteHandleNudge.emit({ handle: this.el, direction });
- break;
- }
- };
- this.handleBlur = () => {
- this.activated = false;
- };
- }
- // --------------------------------------------------------------------------
- //
- // Methods
- //
- // --------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.handleButton) === null || _a === void 0 ? void 0 : _a.focus();
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- return (
- // Needs to be a span because of https://github.com/SortableJS/Sortable/issues/1486
- hAsync("span", { "aria-pressed": toAriaBoolean(this.activated), class: { [CSS$y.handle]: true, [CSS$y.handleActivated]: this.activated }, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
- this.handleButton = el;
- }, role: "button", tabindex: "0", title: this.textTitle }, hAsync("calcite-icon", { icon: ICONS$6.drag, scale: "s" })));
- }
- get el() { return getElement(this); }
- static get style() { return handleCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-handle",
- "$members$": {
- "activated": [1540],
- "textTitle": [513, "text-title"],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["activated", "activated"], ["textTitle", "text-title"]]
- }; }
- }
- const CSS$x = {
- icon: "icon",
- flipRtl: "flip-rtl"
- };
- const scaleToPx = {
- s: 16,
- m: 24,
- l: 32
- };
- const iconCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-icon{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-icon{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-icon{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-icon{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-icon:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-icon:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-icon-h{display:none}/*!@:host*/.sc-calcite-icon-h{display:inline-flex;color:var(--calcite-ui-icon-color)}/*!@:host([scale=s])*/[scale=s].sc-calcite-icon-h{block-size:1rem;inline-size:1rem;min-inline-size:1rem;min-block-size:1rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-icon-h{block-size:1.5rem;inline-size:1.5rem;min-inline-size:1.5rem;min-block-size:1.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-icon-h{block-size:2rem;inline-size:2rem;min-inline-size:2rem;min-block-size:2rem}/*!@.flip-rtl*/.flip-rtl.sc-calcite-icon{transform:scaleX(-1)}/*!@.svg*/.svg.sc-calcite-icon{display:block}";
- class Icon {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * 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/.
- */
- this.icon = null;
- /**
- * When true, the icon will be flipped when the element direction is 'rtl'.
- */
- this.flipRtl = false;
- /**
- * Icon scale.
- */
- this.scale = "m";
- this.visible = false;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- this.waitUntilVisible(() => {
- this.visible = true;
- this.loadIconPathData();
- });
- }
- disconnectedCallback() {
- var _a;
- (_a = this.intersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- this.intersectionObserver = null;
- }
- async componentWillLoad() {
- this.loadIconPathData();
- }
- render() {
- const { el, flipRtl, pathData, scale, textLabel } = this;
- const dir = getElementDir(el);
- const size = scaleToPx[scale];
- const semantic = !!textLabel;
- const paths = [].concat(pathData || "");
- return (hAsync(Host, { "aria-hidden": toAriaBoolean(!semantic), "aria-label": semantic ? textLabel : null, role: semantic ? "img" : null }, hAsync("svg", { class: {
- [CSS$x.flipRtl]: dir === "rtl" && flipRtl,
- svg: true
- }, 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 }))))));
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- async loadIconPathData() {
- {
- return;
- }
- }
- waitUntilVisible(callback) {
- this.intersectionObserver = createObserver();
- if (!this.intersectionObserver) {
- callback();
- return;
- }
- this.intersectionObserver.observe(this.el);
- }
- static get assetsDirs() { return ["assets"]; }
- get el() { return getElement(this); }
- static get watchers() { return {
- "icon": ["loadIconPathData"],
- "scale": ["loadIconPathData"]
- }; }
- static get style() { return iconCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-icon",
- "$members$": {
- "icon": [513],
- "flipRtl": [516, "flip-rtl"],
- "scale": [513],
- "textLabel": [1, "text-label"],
- "pathData": [32],
- "visible": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["icon", "icon"], ["flipRtl", "flip-rtl"], ["scale", "scale"]]
- }; }
- }
- const CSS$w = {
- wrapper: "wrapper",
- confirmChangesButton: "confirm-changes-button",
- cancelEditingButton: "cancel-editing-button",
- inputWrapper: "input-wrapper",
- cancelEditingButtonWrapper: "cancel-editing-button-wrapper",
- enableEditingButton: "enable-editing-button",
- controlsWrapper: "controls-wrapper"
- };
- const TEXT$e = {
- intlEnablingEditing: "Click to edit",
- intlCancelEditing: "Cancel",
- intlConfirmChanges: "Save"
- };
- const inlineEditableCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-inline-editable{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-inline-editable{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-inline-editable{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-inline-editable{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-inline-editable:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-inline-editable:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-inline-editable-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-inline-editable-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@: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{block-size:1.5rem}/*!@:host([scale=m]) .controls-wrapper*/[scale=m].sc-calcite-inline-editable-h .controls-wrapper.sc-calcite-inline-editable{block-size:2rem}/*!@:host([scale=l]) .controls-wrapper*/[scale=l].sc-calcite-inline-editable-h .controls-wrapper.sc-calcite-inline-editable{block-size: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{box-sizing:border-box;display:flex;justify-content:space-between;background-color:var(--calcite-ui-foreground-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.wrapper .input-wrapper*/.wrapper.sc-calcite-inline-editable .input-wrapper.sc-calcite-inline-editable{flex:1 1 0%}/*!@.controls-wrapper*/.controls-wrapper.sc-calcite-inline-editable{display:flex}/*!@: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}";
- /**
- * @slot - A slot for adding a `calcite-input`.
- */
- class InlineEditable {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInlineEditableEditCancel = createEvent(this, "calciteInlineEditableEditCancel", 6);
- this.calciteInlineEditableEditConfirm = createEvent(this, "calciteInlineEditableEditConfirm", 6);
- this.calciteInternalInlineEditableEnableEditingChange = createEvent(this, "calciteInternalInlineEditableEnableEditingChange", 6);
- //--------------------------------------------------------------------------
- //
- // Props
- //
- //--------------------------------------------------------------------------
- /** specify whether editing can be enabled */
- this.disabled = false;
- /** specify whether the wrapped input element is editable, defaults to false */
- this.editingEnabled = false;
- /** specify whether the confirm button should display a loading state, defaults to false */
- this.loading = false;
- /** specify whether save/cancel controls should be displayed when editingEnabled is true, defaults to false */
- this.controls = false;
- /**
- * specify text to be user for the enable editing button's aria-label, defaults to `Click to edit`
- *
- * @default "Click to edit"
- */
- this.intlEnableEditing = TEXT$e.intlEnablingEditing;
- /**
- * specify text to be user for the cancel editing button's aria-label, defaults to `Cancel`
- *
- * @default "Cancel"
- */
- this.intlCancelEditing = TEXT$e.intlCancelEditing;
- /**
- * specify text to be user for the confirm changes button's aria-label, defaults to `Save`
- *
- * @default "Save"
- */
- this.intlConfirmChanges = TEXT$e.intlConfirmChanges;
- this.mutationObserver = createObserver();
- this.enableEditing = () => {
- var _a, _b;
- this.valuePriorToEditing = (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.value;
- this.editingEnabled = true;
- (_b = this.inputElement) === null || _b === void 0 ? void 0 : _b.setFocus();
- this.calciteInternalInlineEditableEnableEditingChange.emit();
- };
- this.disableEditing = () => {
- this.editingEnabled = false;
- };
- this.cancelEditing = () => {
- if (this.inputElement) {
- this.inputElement.value = this.valuePriorToEditing;
- }
- this.disableEditing();
- this.enableEditingButton.setFocus();
- if (!this.editingEnabled && !!this.shouldEmitCancel) {
- this.calciteInlineEditableEditCancel.emit();
- }
- };
- this.escapeKeyHandler = async (event) => {
- var _a;
- if (event.defaultPrevented) {
- return;
- }
- if (event.key === "Escape") {
- event.preventDefault();
- this.cancelEditing();
- }
- if (event.key === "Tab" && this.shouldShowControls) {
- if (!event.shiftKey && event.target === this.inputElement) {
- event.preventDefault();
- this.cancelEditingButton.setFocus();
- }
- if (!!event.shiftKey && event.target === this.cancelEditingButton) {
- event.preventDefault();
- (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setFocus();
- }
- }
- };
- this.cancelEditingHandler = async (event) => {
- event.preventDefault();
- this.cancelEditing();
- };
- this.enableEditingHandler = async (event) => {
- if (this.disabled ||
- event.target === this.cancelEditingButton ||
- event.target === this.confirmEditingButton) {
- return;
- }
- event.preventDefault();
- if (!this.editingEnabled) {
- this.enableEditing();
- }
- };
- this.confirmChangesHandler = async (event) => {
- event.preventDefault();
- this.calciteInlineEditableEditConfirm.emit();
- try {
- if (this.afterConfirm) {
- this.loading = true;
- await this.afterConfirm();
- this.disableEditing();
- this.enableEditingButton.setFocus();
- }
- }
- catch (error) {
- }
- finally {
- this.loading = false;
- }
- };
- }
- disabledWatcher(disabled) {
- if (this.inputElement) {
- this.inputElement.disabled = disabled;
- }
- }
- editingEnabledWatcher(newValue, oldValue) {
- if (this.inputElement) {
- this.inputElement.editingEnabled = newValue;
- }
- if (!newValue && !!oldValue) {
- this.shouldEmitCancel = true;
- }
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- connectLabel(this);
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
- this.mutationObserverCallback();
- }
- disconnectedCallback() {
- var _a;
- disconnectLabel(this);
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- render() {
- return (hAsync("div", { class: CSS$w.wrapper, onClick: this.enableEditingHandler, onKeyDown: this.escapeKeyHandler }, hAsync("div", { class: CSS$w.inputWrapper }, hAsync("slot", null)), hAsync("div", { class: CSS$w.controlsWrapper }, hAsync("calcite-button", { appearance: "transparent", class: CSS$w.enableEditingButton, color: "neutral", disabled: this.disabled, iconStart: "pencil", label: this.intlEnableEditing, onClick: this.enableEditingHandler, ref: (el) => (this.enableEditingButton = el), scale: this.scale, style: {
- opacity: this.editingEnabled ? "0" : "1",
- width: this.editingEnabled ? "0" : "inherit"
- }, type: "button" }), this.shouldShowControls && [
- hAsync("div", { class: CSS$w.cancelEditingButtonWrapper }, hAsync("calcite-button", { appearance: "transparent", class: CSS$w.cancelEditingButton, color: "neutral", disabled: this.disabled, iconStart: "x", label: this.intlCancelEditing, onClick: this.cancelEditingHandler, ref: (el) => (this.cancelEditingButton = el), scale: this.scale, type: "button" })),
- hAsync("calcite-button", { appearance: "solid", class: CSS$w.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" })
- ])));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- blurHandler() {
- if (!this.controls) {
- this.disableEditing();
- }
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- async setFocus() {
- var _a, _b;
- if (this.editingEnabled) {
- (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setFocus();
- }
- else {
- (_b = this.enableEditingButton) === null || _b === void 0 ? void 0 : _b.setFocus();
- }
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- mutationObserverCallback() {
- var _a;
- this.updateSlottedInput();
- this.scale =
- this.scale || ((_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.scale) || getElementProp(this.el, "scale", undefined);
- }
- onLabelClick() {
- this.setFocus();
- }
- updateSlottedInput() {
- const inputElement = getSlotted(this.el, {
- matches: "calcite-input"
- });
- this.inputElement = inputElement;
- if (!inputElement) {
- return;
- }
- this.inputElement.disabled = this.disabled;
- this.inputElement.label = this.inputElement.label || getLabelText(this);
- }
- get shouldShowControls() {
- return this.editingEnabled && this.controls;
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["disabledWatcher"],
- "editingEnabled": ["editingEnabledWatcher"]
- }; }
- static get style() { return inlineEditableCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-inline-editable",
- "$members$": {
- "disabled": [516],
- "editingEnabled": [1540, "editing-enabled"],
- "loading": [1540],
- "controls": [516],
- "intlEnableEditing": [513, "intl-enable-editing"],
- "intlCancelEditing": [513, "intl-cancel-editing"],
- "intlConfirmChanges": [513, "intl-confirm-changes"],
- "scale": [1537],
- "afterConfirm": [16],
- "setFocus": [64]
- },
- "$listeners$": [[0, "calciteInternalInputBlur", "blurHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["editingEnabled", "editing-enabled"], ["loading", "loading"], ["controls", "controls"], ["intlEnableEditing", "intl-enable-editing"], ["intlCancelEditing", "intl-cancel-editing"], ["intlConfirmChanges", "intl-confirm-changes"], ["scale", "scale"]]
- }; }
- }
- const CSS$v = {
- loader: "loader",
- clearButton: "clear-button",
- editingEnabled: "editing-enabled",
- inlineChild: "inline-child",
- inputIcon: "icon",
- prefix: "prefix",
- suffix: "suffix",
- numberButtonWrapper: "number-button-wrapper",
- buttonItemHorizontal: "number-button-item--horizontal",
- wrapper: "element-wrapper",
- inputWrapper: "wrapper",
- actionWrapper: "action-wrapper",
- resizeIconWrapper: "resize-icon-wrapper",
- numberButtonItem: "number-button-item"
- };
- const INPUT_TYPE_ICONS = {
- tel: "phone",
- password: "lock",
- email: "email-address",
- date: "calendar",
- time: "clock",
- search: "search"
- };
- const SLOTS$h = {
- action: "action"
- };
- const TEXT$d = {
- clear: "Clear value"
- };
- const inputCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-input:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-input-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@: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{block-size:1.5rem;padding-inline: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{block-size:1.5rem;min-block-size: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{block-size:1.5rem}/*!@:host([scale=s]) input[type=file]*/[scale=s].sc-calcite-input-h input[type=file].sc-calcite-input{block-size:1.5rem}/*!@:host([scale=s]) .clear-button*/[scale=s].sc-calcite-input-h .clear-button.sc-calcite-input{min-block-size:1.5rem;min-inline-size:1.5rem}/*!@:host([scale=s]) textarea*/[scale=s].sc-calcite-input-h textarea.sc-calcite-input{block-size:auto;padding-block:0.25rem;padding-inline: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{block-size:2rem;padding-inline: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-block-size: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{block-size:2rem}/*!@:host([scale=m]) input[type=file]*/[scale=m].sc-calcite-input-h input[type=file].sc-calcite-input{block-size:2rem}/*!@:host([scale=m]) .clear-button*/[scale=m].sc-calcite-input-h .clear-button.sc-calcite-input{min-block-size:2rem;min-inline-size:2rem}/*!@:host([scale=m]) textarea*/[scale=m].sc-calcite-input-h textarea.sc-calcite-input{block-size:auto;padding-block:0.5rem;padding-inline: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{block-size:2.75rem;padding-inline: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-block-size: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{block-size:2.75rem}/*!@:host([scale=l]) input[type=file]*/[scale=l].sc-calcite-input-h input[type=file].sc-calcite-input{block-size:2.75rem}/*!@:host([scale=l]) .clear-button*/[scale=l].sc-calcite-input-h .clear-button.sc-calcite-input{min-block-size:2.75rem;min-inline-size:2.75rem}/*!@:host([scale=l]) textarea*/[scale=l].sc-calcite-input-h textarea.sc-calcite-input{block-size:auto;padding-block:0.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@: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{transition:var(--calcite-animation-timing), block-size 0, outline-offset 0s;-webkit-appearance:none;position:relative;margin:0px;box-sizing:border-box;display:flex;max-block-size:100%;inline-size:100%;max-inline-size:100%;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::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, \n:host input*/.sc-calcite-input-h textarea.sc-calcite-input,.sc-calcite-input-h input.sc-calcite-input{outline-color:transparent}/*!@:host textarea:focus, \n: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{padding-inline-start:2rem}/*!@:host([icon][scale=m]) input*/[icon][scale=m].sc-calcite-input-h input.sc-calcite-input{padding-inline-start:2.5rem}/*!@:host([icon][scale=l]) input*/[icon][scale=l].sc-calcite-input-h input.sc-calcite-input{padding-inline-start:3rem}/*!@.element-wrapper*/.element-wrapper.sc-calcite-input{position:relative;order:3;display:inline-flex;flex:1 1 0%;align-items:center}/*!@.icon*/.icon.sc-calcite-input{pointer-events:none;position:absolute;display:block;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.icon, \n.resize-icon-wrapper*/.icon.sc-calcite-input,.resize-icon-wrapper.sc-calcite-input{z-index:1}/*!@input[type=text]::-ms-clear, \ninput[type=text]::-ms-reveal*/input[type=text].sc-calcite-input::-ms-clear,input[type=text].sc-calcite-input::-ms-reveal{display:none;block-size:0px;inline-size:0px}/*!@input[type=search]::-webkit-search-decoration, \ninput[type=search]::-webkit-search-cancel-button, \ninput[type=search]::-webkit-search-results-button, \ninput[type=search]::-webkit-search-results-decoration, \ninput[type=date]::-webkit-clear-button, \ninput[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;order:4;margin:0px;box-sizing:border-box;display:flex;min-block-size:100%;cursor:pointer;align-items:center;justify-content:center;align-self:stretch;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);outline-color:transparent;border-inline-start-width:0px}/*!@.clear-button:hover*/.clear-button.sc-calcite-input:hover{background-color:var(--calcite-ui-foreground-2);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button:hover calcite-icon*/.clear-button.sc-calcite-input:hover calcite-icon.sc-calcite-input{color:var(--calcite-ui-text-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 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{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}/*!@.action-wrapper*/.action-wrapper.sc-calcite-input{order:7;display:flex}/*!@.prefix, \n.suffix*/.prefix.sc-calcite-input,.suffix.sc-calcite-input{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;user-select:none;align-content: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{order:2;border-inline-end-width:0px}/*!@.suffix*/.suffix.sc-calcite-input{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;order:6;box-sizing:border-box;display:flex;flex-direction:column;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host([number-button-type=vertical]) .wrapper*/[number-button-type=vertical].sc-calcite-input-h .wrapper.sc-calcite-input{flex-direction:row;display:flex}/*!@:host([number-button-type=vertical]) input, \n: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{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{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{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{order:1;max-block-size:100%;min-block-size:100%;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{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{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-block-start-width:0px}/*!@.number-button-item*/.number-button-item.sc-calcite-input{max-block-size:50%;min-block-size:50%;pointer-events:initial;margin:0px;box-sizing:border-box;display:flex;cursor:pointer;align-items: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-block:0px;padding-inline:0.5rem;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 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;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 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)}/*!@.number-button-item:disabled*/.number-button-item.sc-calcite-input:disabled{pointer-events:none}/*!@.wrapper*/.wrapper.sc-calcite-input{position:relative;display:flex;flex-direction:row;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;inset-block-end:0px;box-sizing:border-box;padding-block:0px;padding-inline:0.25rem;inset-inline-end:0}/*!@.resize-icon-wrapper*/.resize-icon-wrapper.sc-calcite-input{inset-block-end:2px;inset-inline-end:2px;pointer-events:none;position:absolute;block-size:0.75rem;inline-size: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{inset-block-end:0.25rem;inset-inline-end:0.25rem;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{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-block:1px;padding-inline:0.5rem}/*!@:host([type=file][scale=m]) input*/[type=file][scale=m].sc-calcite-input-h input.sc-calcite-input{padding-block:0.25rem;padding-inline:0.75rem}/*!@:host([type=file][scale=l]) input*/[type=file][scale=l].sc-calcite-input-h input.sc-calcite-input{padding-block:0.5rem;padding-inline:1rem}/*!@:host(.no-bottom-border) input*/.no-bottom-border.sc-calcite-input-h input.sc-calcite-input{border-block-end-width:0px}/*!@:host(.border-top-color-one) input*/.border-top-color-one.sc-calcite-input-h input.sc-calcite-input{border-block-start-color:var(--calcite-ui-border-1)}/*!@:host .inline-child*/.sc-calcite-input-h .inline-child.sc-calcite-input{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 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:flex;cursor:pointer;border-color:transparent;padding-inline-start:0}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-input-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- /**
- * @slot action - A slot for positioning a `calcite-button` next to the component.
- */
- class Input {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalInputFocus = createEvent(this, "calciteInternalInputFocus", 6);
- this.calciteInternalInputBlur = createEvent(this, "calciteInternalInputBlur", 6);
- this.calciteInputInput = createEvent(this, "calciteInputInput", 7);
- this.calciteInputChange = createEvent(this, "calciteInputChange", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** Specifies the text alignment of the component's value. */
- this.alignment = "start";
- /**
- * When `true`, the component is focused on page load.
- *
- * @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
- */
- this.autofocus = false;
- /**
- * When `true`, a clear button is displayed when the component has a value. The clear button shows by default for `"search"`, `"time"`, and `"date"` types, and will not display for the `"textarea"` type.
- */
- this.clearable = false;
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- *
- * @mdn [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled)
- */
- this.disabled = false;
- /**
- * When `true`, number values are displayed with a group separator corresponding to the language and country format.
- */
- this.groupSeparator = false;
- /**
- * When `true`, the component will not be visible.
- *
- * @mdn [hidden](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden)
- */
- this.hidden = false;
- /**
- * Accessible name when the component is loading.
- *
- * @default "Loading"
- */
- this.intlLoading = TEXT$v.loading;
- /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
- this.iconFlipRtl = false;
- /** When `true`, a busy indicator is displayed. */
- this.loading = false;
- /**
- * When `true`, uses locale formatting for numbers.
- *
- * @internal
- */
- this.localeFormat = false;
- /** Specifies the placement of the buttons for `type="number"`. */
- this.numberButtonType = "vertical";
- /**
- * When `true`, the component's value can be read, but cannot be modified.
- *
- * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
- */
- this.readOnly = false;
- /** When `true`, the component must have a value in order for the form to submit. */
- this.required = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- /** Specifies the status of the input field, which determines message and icons. */
- this.status = "idle";
- /**
- * @internal
- */
- this.editingEnabled = false;
- /**
- * Specifies the component type.
- *
- * Note that the following `type`s add type-specific icons by default: `"date"`, `"email"`, `"password"`, `"search"`, `"tel"`, `"time"`.
- */
- this.type = "text";
- /** The component's value. */
- this.value = "";
- /** keep track of the rendered child type */
- this.childElType = "input";
- this.previousValueOrigin = "initial";
- this.mutationObserver = createObserver();
- this.userChangedValue = false;
- //--------------------------------------------------------------------------
- //
- // State
- //
- //--------------------------------------------------------------------------
- this.effectiveLocale = "";
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.keyDownHandler = (event) => {
- if (this.readOnly || this.disabled) {
- return;
- }
- if (this.isClearable && event.key === "Escape") {
- this.clearInputValue(event);
- event.preventDefault();
- }
- if (event.key === "Enter" && !event.defaultPrevented) {
- if (submitForm(this)) {
- event.preventDefault();
- }
- }
- };
- this.clearInputValue = (nativeEvent) => {
- this.setValue({
- committing: true,
- nativeEvent,
- origin: "user",
- value: ""
- });
- };
- this.emitChangeIfUserModified = () => {
- if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue) {
- this.calciteInputChange.emit();
- }
- this.previousEmittedValue = this.value;
- };
- this.inputBlurHandler = () => {
- this.calciteInternalInputBlur.emit();
- this.emitChangeIfUserModified();
- };
- this.inputFocusHandler = (event) => {
- const slottedActionEl = getSlotted(this.el, "action");
- if (event.target !== slottedActionEl) {
- this.setFocus();
- }
- this.calciteInternalInputFocus.emit();
- };
- this.inputInputHandler = (nativeEvent) => {
- if (this.disabled || this.readOnly) {
- return;
- }
- this.setValue({
- nativeEvent,
- origin: "user",
- value: nativeEvent.target.value
- });
- };
- this.inputKeyDownHandler = (event) => {
- if (this.disabled || this.readOnly) {
- return;
- }
- if (event.key === "Enter") {
- this.emitChangeIfUserModified();
- }
- };
- this.inputNumberInputHandler = (nativeEvent) => {
- if (this.disabled || this.readOnly) {
- return;
- }
- const value = nativeEvent.target.value;
- numberStringFormatter.numberFormatOptions = {
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- useGrouping: this.groupSeparator
- };
- const delocalizedValue = numberStringFormatter.delocalize(value);
- if (nativeEvent.inputType === "insertFromPaste") {
- if (!isValidNumber(delocalizedValue)) {
- nativeEvent.preventDefault();
- }
- this.setValue({
- nativeEvent,
- origin: "user",
- value: parseNumberString(delocalizedValue)
- });
- this.childNumberEl.value = this.localizedValue;
- }
- else {
- this.setValue({
- nativeEvent,
- origin: "user",
- value: delocalizedValue
- });
- }
- };
- this.inputNumberKeyDownHandler = (event) => {
- if (this.type !== "number" || this.disabled || this.readOnly) {
- return;
- }
- if (event.key === "ArrowUp") {
- /* prevent default behavior of moving cursor to the beginning of the input when holding down ArrowUp */
- event.preventDefault();
- this.nudgeNumberValue("up", event);
- return;
- }
- if (event.key === "ArrowDown") {
- this.nudgeNumberValue("down", event);
- return;
- }
- const supportedKeys = [
- ...numberKeys,
- "ArrowLeft",
- "ArrowRight",
- "Backspace",
- "Delete",
- "Enter",
- "Escape",
- "Tab"
- ];
- if (event.altKey || event.ctrlKey || event.metaKey) {
- return;
- }
- const isShiftTabEvent = event.shiftKey && event.key === "Tab";
- if (supportedKeys.includes(event.key) && (!event.shiftKey || isShiftTabEvent)) {
- if (event.key === "Enter") {
- this.emitChangeIfUserModified();
- }
- return;
- }
- numberStringFormatter.numberFormatOptions = {
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- useGrouping: this.groupSeparator
- };
- if (event.key === numberStringFormatter.decimal) {
- if (!this.value && !this.childNumberEl.value) {
- return;
- }
- if (this.value && this.childNumberEl.value.indexOf(numberStringFormatter.decimal) === -1) {
- return;
- }
- }
- if (/[eE]/.test(event.key)) {
- if (!this.value && !this.childNumberEl.value) {
- return;
- }
- if (this.value && !/[eE]/.test(this.childNumberEl.value)) {
- return;
- }
- }
- if (event.key === "-") {
- if (!this.value && !this.childNumberEl.value) {
- return;
- }
- if (this.value && this.childNumberEl.value.split("-").length <= 2) {
- return;
- }
- }
- event.preventDefault();
- };
- this.nudgeNumberValue = (direction, nativeEvent) => {
- if ((nativeEvent instanceof KeyboardEvent && nativeEvent.repeat) || this.type !== "number") {
- return;
- }
- const inputMax = this.maxString ? parseFloat(this.maxString) : null;
- const inputMin = this.minString ? parseFloat(this.minString) : null;
- const valueNudgeDelayInMs = 100;
- this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
- if (this.nudgeNumberValueIntervalId) {
- window.clearInterval(this.nudgeNumberValueIntervalId);
- }
- let firstValueNudge = true;
- this.nudgeNumberValueIntervalId = window.setInterval(() => {
- if (firstValueNudge) {
- firstValueNudge = false;
- return;
- }
- this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
- }, valueNudgeDelayInMs);
- };
- this.numberButtonPointerUpAndOutHandler = () => {
- window.clearInterval(this.nudgeNumberValueIntervalId);
- };
- this.numberButtonPointerDownHandler = (event) => {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- event.preventDefault();
- const direction = event.target.dataset.adjustment;
- if (!this.disabled) {
- this.nudgeNumberValue(direction, event);
- }
- };
- this.hiddenInputChangeHandler = (event) => {
- if (event.target.name === this.name) {
- const hiddenInputValue = event.target.value;
- const value = this.type === "number"
- ? isValidNumber(hiddenInputValue)
- ? hiddenInputValue
- : ""
- : hiddenInputValue;
- this.setValue({
- value,
- origin: "direct"
- });
- }
- event.stopPropagation();
- };
- this.setChildElRef = (el) => {
- this.childEl = el;
- };
- this.setChildNumberElRef = (el) => {
- this.childNumberEl = el;
- };
- this.setInputValue = (newInputValue) => {
- if (this.type === "text" && !this.childEl) {
- return;
- }
- if (this.type === "number" && !this.childNumberEl) {
- return;
- }
- this[`child${this.type === "number" ? "Number" : ""}El`].value = newInputValue;
- };
- this.setPreviousEmittedValue = (newPreviousEmittedValue) => {
- this.previousEmittedValue =
- this.type === "number"
- ? isValidNumber(newPreviousEmittedValue)
- ? newPreviousEmittedValue
- : ""
- : newPreviousEmittedValue;
- };
- this.setPreviousValue = (newPreviousValue) => {
- this.previousValue =
- this.type === "number"
- ? isValidNumber(newPreviousValue)
- ? newPreviousValue
- : ""
- : newPreviousValue;
- };
- this.setValue = ({ committing = false, nativeEvent, origin, previousValue, value }) => {
- numberStringFormatter.numberFormatOptions = {
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- useGrouping: this.groupSeparator
- };
- if (this.type === "number") {
- const delocalizedValue = (this.numberingSystem && this.numberingSystem !== "latn") ||
- defaultNumberingSystem !== "latn"
- ? numberStringFormatter.delocalize(value)
- : value;
- const sanitizedValue = sanitizeNumberString(delocalizedValue);
- const newValue = (value && !sanitizedValue) || [".", "-"].includes(sanitizedValue)
- ? isValidNumber(this.previousValue)
- ? this.previousValue
- : ""
- : sanitizedValue;
- const newLocalizedValue = numberStringFormatter.localize(newValue);
- this.localizedValue = newLocalizedValue;
- this.userChangedValue = origin === "user" && this.value !== newValue;
- this.value = newValue;
- origin === "direct" && this.setInputValue(newLocalizedValue);
- }
- else {
- this.userChangedValue = origin === "user" && this.value !== value;
- this.value = value;
- origin === "direct" && this.setInputValue(value);
- }
- this.setPreviousValue(previousValue || this.value);
- this.previousValueOrigin = origin;
- if (nativeEvent) {
- const calciteInputInputEvent = this.calciteInputInput.emit({
- element: this.childEl,
- nativeEvent,
- value: this.value
- });
- if (calciteInputInputEvent.defaultPrevented) {
- this.value = this.previousValue;
- this.localizedValue =
- this.type === "number"
- ? numberStringFormatter.localize(this.previousValue)
- : this.previousValue;
- }
- else if (committing) {
- this.emitChangeIfUserModified();
- }
- }
- };
- this.inputKeyUpHandler = () => {
- window.clearInterval(this.nudgeNumberValueIntervalId);
- };
- }
- disabledWatcher() {
- this.setDisabledAction();
- }
- localeChanged() {
- updateEffectiveLocale(this);
- }
- /** watcher to update number-to-string for max */
- maxWatcher() {
- var _a;
- this.maxString = ((_a = this.max) === null || _a === void 0 ? void 0 : _a.toString()) || null;
- }
- /** watcher to update number-to-string for min */
- minWatcher() {
- var _a;
- this.minString = ((_a = this.min) === null || _a === void 0 ? void 0 : _a.toString()) || null;
- }
- valueWatcher(newValue, previousValue) {
- if (!this.userChangedValue) {
- this.setValue({
- origin: "direct",
- previousValue,
- value: newValue == null || newValue == ""
- ? ""
- : this.type === "number"
- ? isValidNumber(newValue)
- ? newValue
- : this.previousValue || ""
- : newValue
- });
- this.warnAboutInvalidNumberValue(newValue);
- }
- this.userChangedValue = false;
- }
- updateRequestedIcon() {
- this.requestedIcon = setRequestedIcon(INPUT_TYPE_ICONS, this.icon, this.type);
- }
- get isClearable() {
- return !this.isTextarea && (this.clearable || this.type === "search") && this.value.length > 0;
- }
- get isTextarea() {
- return this.childElType === "textarea";
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- connectLocalized(this);
- this.scale = getElementProp(this.el, "scale", this.scale);
- this.status = getElementProp(this.el, "status", this.status);
- this.inlineEditableEl = this.el.closest("calcite-inline-editable");
- if (this.inlineEditableEl) {
- this.editingEnabled = this.inlineEditableEl.editingEnabled || false;
- }
- connectLabel(this);
- connectForm(this);
- this.setPreviousEmittedValue(this.value);
- this.setPreviousValue(this.value);
- if (this.type === "number") {
- this.warnAboutInvalidNumberValue(this.value);
- this.setValue({
- origin: "connected",
- value: isValidNumber(this.value) ? this.value : ""
- });
- }
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
- this.setDisabledAction();
- this.el.addEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
- }
- disconnectedCallback() {
- var _a;
- disconnectLabel(this);
- disconnectForm(this);
- disconnectLocalized(this);
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- this.el.removeEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
- }
- componentWillLoad() {
- var _a, _b;
- this.childElType = this.type === "textarea" ? "textarea" : "input";
- this.maxString = (_a = this.max) === null || _a === void 0 ? void 0 : _a.toString();
- this.minString = (_b = this.min) === null || _b === void 0 ? void 0 : _b.toString();
- this.requestedIcon = setRequestedIcon(INPUT_TYPE_ICONS, this.icon, this.type);
- }
- componentShouldUpdate(newValue, oldValue, property) {
- if (this.type === "number" && property === "value" && newValue && !isValidNumber(newValue)) {
- this.setValue({
- origin: "reset",
- value: oldValue
- });
- return false;
- }
- return true;
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a, _b;
- if (this.type === "number") {
- (_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.focus();
- }
- else {
- (_b = this.childEl) === null || _b === void 0 ? void 0 : _b.focus();
- }
- }
- /** Selects all text of the component's `value`. */
- async selectText() {
- var _a, _b;
- if (this.type === "number") {
- (_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.select();
- }
- else {
- (_b = this.childEl) === null || _b === void 0 ? void 0 : _b.select();
- }
- }
- onLabelClick() {
- this.setFocus();
- }
- incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent) {
- const { value } = this;
- const inputStep = this.step === "any" ? 1 : Math.abs(this.step || 1);
- const inputVal = value && value !== "" ? parseFloat(value) : 0;
- const adjustment = direction === "up" ? 1 : -1;
- const nudgedValue = inputVal + inputStep * adjustment;
- const finalValue = (typeof inputMin === "number" && !isNaN(inputMin) && nudgedValue < inputMin) ||
- (typeof inputMax === "number" && !isNaN(inputMax) && nudgedValue > inputMax)
- ? inputVal
- : nudgedValue;
- const inputValPlaces = decimalPlaces(inputVal);
- const inputStepPlaces = decimalPlaces(inputStep);
- this.setValue({
- committing: true,
- nativeEvent,
- origin: "user",
- value: finalValue.toFixed(Math.max(inputValPlaces, inputStepPlaces))
- });
- }
- onFormReset() {
- this.setValue({
- origin: "reset",
- value: this.defaultValue
- });
- }
- syncHiddenFormInput(input) {
- var _a, _b, _c, _d;
- if (this.type === "number") {
- input.type = "number";
- input.min = (_b = (_a = this.min) === null || _a === void 0 ? void 0 : _a.toString(10)) !== null && _b !== void 0 ? _b : "";
- input.max = (_d = (_c = this.max) === null || _c === void 0 ? void 0 : _c.toString(10)) !== null && _d !== void 0 ? _d : "";
- }
- else if (this.type === "text") {
- input.type = "text";
- if (this.minLength != null) {
- input.minLength = this.minLength;
- }
- if (this.maxLength != null) {
- input.maxLength = this.maxLength;
- }
- }
- else if (this.type === "password") {
- input.type = "password";
- }
- }
- setDisabledAction() {
- const slottedActionEl = getSlotted(this.el, "action");
- if (!slottedActionEl) {
- return;
- }
- this.disabled
- ? slottedActionEl.setAttribute("disabled", "")
- : slottedActionEl.removeAttribute("disabled");
- }
- warnAboutInvalidNumberValue(value) {
- if (this.type === "number" && value && !isValidNumber(value)) {
- console.warn(`The specified value "${value}" cannot be parsed, or is out of range.`);
- }
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const dir = getElementDir(this.el);
- const loader = (hAsync("div", { class: CSS$v.loader }, hAsync("calcite-progress", { label: this.intlLoading, type: "indeterminate" })));
- const inputClearButton = (hAsync("button", { "aria-label": this.intlClear || TEXT$d.clear, class: CSS$v.clearButton, disabled: this.disabled || this.readOnly, onClick: this.clearInputValue, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "x", scale: "s" })));
- const iconEl = (hAsync("calcite-icon", { class: CSS$v.inputIcon, flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: "s" }));
- const isHorizontalNumberButton = this.numberButtonType === "horizontal";
- const numberButtonsHorizontalUp = (hAsync("button", { "aria-hidden": "true", class: {
- [CSS$v.numberButtonItem]: true,
- [CSS$v.buttonItemHorizontal]: isHorizontalNumberButton
- }, "data-adjustment": "up", disabled: this.disabled || this.readOnly, onPointerDown: this.numberButtonPointerDownHandler, onPointerOut: this.numberButtonPointerUpAndOutHandler, onPointerUp: this.numberButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "chevron-up", scale: "s" })));
- const numberButtonsHorizontalDown = (hAsync("button", { "aria-hidden": "true", class: {
- [CSS$v.numberButtonItem]: true,
- [CSS$v.buttonItemHorizontal]: isHorizontalNumberButton
- }, "data-adjustment": "down", disabled: this.disabled || this.readOnly, onPointerDown: this.numberButtonPointerDownHandler, onPointerOut: this.numberButtonPointerUpAndOutHandler, onPointerUp: this.numberButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "chevron-down", scale: "s" })));
- const numberButtonsVertical = (hAsync("div", { class: CSS$v.numberButtonWrapper }, numberButtonsHorizontalUp, numberButtonsHorizontalDown));
- const prefixText = hAsync("div", { class: CSS$v.prefix }, this.prefixText);
- const suffixText = hAsync("div", { class: CSS$v.suffix }, this.suffixText);
- 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;
- const childEl = this.type !== "number"
- ? [
- hAsync(this.childElType, { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, class: {
- [CSS$v.editingEnabled]: this.editingEnabled,
- [CSS$v.inlineChild]: !!this.inlineEditableEl
- }, 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 }),
- this.isTextarea ? (hAsync("div", { class: CSS$v.resizeIconWrapper }, hAsync("calcite-icon", { icon: "chevron-down", scale: "s" }))) : null
- ]
- : null;
- return (hAsync(Host, { onClick: this.inputFocusHandler, onKeyDown: this.keyDownHandler }, hAsync("div", { class: { [CSS$v.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" } }, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
- ? numberButtonsHorizontalDown
- : null, this.prefixText ? prefixText : null, hAsync("div", { class: CSS$v.wrapper }, localeNumberInput, childEl, this.isClearable ? inputClearButton : null, this.requestedIcon ? iconEl : null, this.loading ? loader : null), hAsync("div", { class: CSS$v.actionWrapper }, hAsync("slot", { name: SLOTS$h.action })), this.type === "number" && this.numberButtonType === "vertical" && !this.readOnly
- ? numberButtonsVertical
- : null, this.suffixText ? suffixText : null, this.type === "number" && this.numberButtonType === "horizontal" && !this.readOnly
- ? numberButtonsHorizontalUp
- : null, hAsync(HiddenFormInputSlot, { component: this }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["disabledWatcher"],
- "locale": ["localeChanged"],
- "max": ["maxWatcher"],
- "min": ["minWatcher"],
- "value": ["valueWatcher"],
- "icon": ["updateRequestedIcon"],
- "type": ["updateRequestedIcon"]
- }; }
- static get style() { return inputCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-input",
- "$members$": {
- "alignment": [513],
- "autofocus": [516],
- "clearable": [516],
- "disabled": [516],
- "groupSeparator": [516, "group-separator"],
- "hidden": [516],
- "icon": [520],
- "intlClear": [1, "intl-clear"],
- "intlLoading": [1, "intl-loading"],
- "iconFlipRtl": [516, "icon-flip-rtl"],
- "label": [1],
- "loading": [516],
- "locale": [1],
- "numberingSystem": [513, "numbering-system"],
- "localeFormat": [4, "locale-format"],
- "max": [514],
- "min": [514],
- "maxlength": [514],
- "maxLength": [514, "max-length"],
- "minLength": [514, "min-length"],
- "name": [513],
- "numberButtonType": [513, "number-button-type"],
- "placeholder": [1],
- "prefixText": [1, "prefix-text"],
- "readOnly": [516, "read-only"],
- "required": [516],
- "scale": [1537],
- "status": [1537],
- "step": [520],
- "suffixText": [1, "suffix-text"],
- "editingEnabled": [1540, "editing-enabled"],
- "type": [513],
- "value": [1025],
- "effectiveLocale": [32],
- "localizedValue": [32],
- "setFocus": [64],
- "selectText": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["alignment", "alignment"], ["autofocus", "autofocus"], ["clearable", "clearable"], ["disabled", "disabled"], ["groupSeparator", "group-separator"], ["hidden", "hidden"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["loading", "loading"], ["numberingSystem", "numbering-system"], ["max", "max"], ["min", "min"], ["maxlength", "maxlength"], ["maxLength", "max-length"], ["minLength", "min-length"], ["name", "name"], ["numberButtonType", "number-button-type"], ["readOnly", "read-only"], ["required", "required"], ["scale", "scale"], ["status", "status"], ["step", "step"], ["editingEnabled", "editing-enabled"], ["type", "type"]]
- }; }
- }
- const CSS$u = {
- menu: "menu-container",
- menuActive: "menu-container--active"
- };
- const inputDatePickerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-date-picker{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-date-picker{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-date-picker{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-date-picker{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input-date-picker:root{--calcite-internal-duration-factor:0.01}}/*!@: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-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-date-picker-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-input-date-picker-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-input-date-picker-h{position:relative;display:inline-block;inline-size:100%;overflow:visible;vertical-align:top;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host .menu-container .calcite-floating-ui-anim*/.sc-calcite-input-date-picker-h .menu-container.sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@:host .menu-container[data-placement^=bottom] .calcite-floating-ui-anim*/.sc-calcite-input-date-picker-h .menu-container[data-placement^=bottom].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateY(-5px)}/*!@:host .menu-container[data-placement^=top] .calcite-floating-ui-anim*/.sc-calcite-input-date-picker-h .menu-container[data-placement^=top].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateY(5px)}/*!@:host .menu-container[data-placement^=left] .calcite-floating-ui-anim*/.sc-calcite-input-date-picker-h .menu-container[data-placement^=left].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateX(5px)}/*!@:host .menu-container[data-placement^=right] .calcite-floating-ui-anim*/.sc-calcite-input-date-picker-h .menu-container[data-placement^=right].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateX(-5px)}/*!@:host .menu-container[data-placement] .calcite-floating-ui-anim--active*/.sc-calcite-input-date-picker-h .menu-container[data-placement].sc-calcite-input-date-picker .calcite-floating-ui-anim--active.sc-calcite-input-date-picker{opacity:1;visibility:visible;transform:translate(0)}/*!@: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;inline-size:100%;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);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:flex}/*!@:host([range]) .input-wrapper*/[range].sc-calcite-input-date-picker-h .input-wrapper.sc-calcite-input-date-picker{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:flex;align-items:center;border-width:1px;border-inline-start-width:0px;border-inline-end-width:0px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);padding-block:0px;padding-inline:0.25rem}/*!@:host([range][layout=vertical]) .input-wrapper*/[range][layout=vertical].sc-calcite-input-date-picker-h .input-wrapper.sc-calcite-input-date-picker{inline-size:100%}/*!@:host([range][layout=vertical]) .input-container*/[range][layout=vertical].sc-calcite-input-date-picker-h .input-container.sc-calcite-input-date-picker{flex-direction:column;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{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{inset-block-start:1.5rem;position:absolute;z-index:1;margin-inline:1px;background-color:var(--calcite-ui-foreground-1);padding-inline:0.625rem;inset-inline-start:0}/*!@: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{inline-size: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{inline-size: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{inline-size:398px}/*!@.menu-container*/.menu-container.sc-calcite-input-date-picker{display:block;position:absolute;z-index:900;inline-size:0;block-size:0;overflow:hidden;pointer-events:none;visibility:hidden}/*!@.menu-container .calcite-floating-ui-anim*/.menu-container.sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@.menu-container[data-placement^=bottom] .calcite-floating-ui-anim*/.menu-container[data-placement^=bottom].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateY(-5px)}/*!@.menu-container[data-placement^=top] .calcite-floating-ui-anim*/.menu-container[data-placement^=top].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateY(5px)}/*!@.menu-container[data-placement^=left] .calcite-floating-ui-anim*/.menu-container[data-placement^=left].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateX(5px)}/*!@.menu-container[data-placement^=right] .calcite-floating-ui-anim*/.menu-container[data-placement^=right].sc-calcite-input-date-picker .calcite-floating-ui-anim.sc-calcite-input-date-picker{transform:translateX(-5px)}/*!@.menu-container[data-placement] .calcite-floating-ui-anim--active*/.menu-container[data-placement].sc-calcite-input-date-picker .calcite-floating-ui-anim--active.sc-calcite-input-date-picker{opacity:1;visibility:visible;transform:translate(0)}/*!@:host([open]) .menu-container*/[open].sc-calcite-input-date-picker-h .menu-container.sc-calcite-input-date-picker{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}/*!@.menu-container--active*/.menu-container--active.sc-calcite-input-date-picker{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}/*!@.input .calcite-input__wrapper*/.input.sc-calcite-input-date-picker .calcite-input__wrapper.sc-calcite-input-date-picker{margin-block-start: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{inset-block-start:1.5rem;padding-inline-start: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{block-size:0.75rem;inline-size:0.75rem;min-inline-size: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{inset-block-start:2.25rem;padding-inline:0.875rem}/*!@:host([range][layout=vertical][open]) .vertical-arrow-container*/[range][layout=vertical][open].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]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- class InputDatePicker {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteDatePickerChange = createEvent(this, "calciteDatePickerChange", 6);
- this.calciteDatePickerRangeChange = createEvent(this, "calciteDatePickerRangeChange", 6);
- this.calciteInputDatePickerChange = createEvent(this, "calciteInputDatePickerChange", 6);
- this.calciteInputDatePickerBeforeClose = createEvent(this, "calciteInputDatePickerBeforeClose", 6);
- this.calciteInputDatePickerClose = createEvent(this, "calciteInputDatePickerClose", 6);
- this.calciteInputDatePickerBeforeOpen = createEvent(this, "calciteInputDatePickerBeforeOpen", 6);
- this.calciteInputDatePickerOpen = createEvent(this, "calciteInputDatePickerOpen", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * When `true`, the component's value can be read, but controls are not accessible and the value cannot be modified.
- *
- * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
- */
- this.readOnly = false;
- /**
- * When `true`, the component is active.
- *
- * @deprecated use `open` instead.
- */
- this.active = false;
- /** When `true`, displays the `calcite-date-picker` component. */
- this.open = false;
- /**
- * Accessible name for the component's previous month button.
- *
- * @default "Previous month"
- */
- this.intlPrevMonth = TEXT$i.prevMonth;
- /**
- * Accessible name for the component's next month button.
- *
- * @default "Next month"
- */
- this.intlNextMonth = TEXT$i.nextMonth;
- /**
- * Accessible name for the component's year input.
- *
- * @default "Year"
- */
- this.intlYear = TEXT$i.year;
- /** Specifies the size of the component. */
- this.scale = "m";
- /**
- * Specifies the placement of the `calcite-date-picker` relative to the component.
- *
- * @default "bottom-start"
- */
- this.placement = defaultMenuPlacement;
- /** When `true`, activates a range for the component. */
- this.range = false;
- /**
- * When `true`, the component must have a value in order for the form to submit.
- *
- * @internal
- */
- this.required = false;
- /**
- * Determines the type of positioning to use for the overlaid content.
- *
- * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
- *
- * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
- *
- */
- this.overlayPositioning = "absolute";
- /**
- * When `true`, disables the default behavior on the third click of narrowing or extending the range.
- * Instead starts a new range.
- */
- this.proximitySelectionDisabled = false;
- /** Defines the layout of the component. */
- this.layout = "horizontal";
- this.effectiveLocale = "";
- this.focusedInput = "start";
- this.globalAttributes = {};
- this.openTransitionProp = "opacity";
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.setFilteredPlacements = () => {
- const { el, flipPlacements } = this;
- this.filteredFlipPlacements = flipPlacements
- ? filterComputedPlacements(flipPlacements, el)
- : null;
- };
- this.setTransitionEl = (el) => {
- this.transitionEl = el;
- connectOpenCloseComponent(this);
- };
- this.setStartInput = (el) => {
- this.startInput = el;
- };
- this.setEndInput = (el) => {
- this.endInput = el;
- };
- this.deactivate = () => {
- this.open = false;
- };
- this.keyDownHandler = (event) => {
- const { defaultPrevented, key } = event;
- if (key === "Enter" && !defaultPrevented) {
- if (submitForm(this)) {
- event.preventDefault();
- }
- }
- else if (key === "Escape" && !defaultPrevented) {
- this.active = false;
- this.open = false;
- event.preventDefault();
- }
- };
- this.inputBlur = (event) => {
- this.blur(event.currentTarget);
- };
- this.startInputFocus = () => {
- if (!this.readOnly) {
- this.open = true;
- }
- this.focusedInput = "start";
- };
- this.endInputFocus = () => {
- if (!this.readOnly) {
- this.open = true;
- }
- this.focusedInput = "end";
- };
- this.startInputInput = () => {
- const parsedValue = this.parseNumerals(this.startInput.value);
- const formattedValue = this.formatNumerals(parsedValue);
- this.startInput.value = formattedValue;
- this.input(parsedValue);
- };
- this.endInputInput = () => {
- const parsedValue = this.parseNumerals(this.endInput.value);
- const formattedValue = this.formatNumerals(parsedValue);
- this.endInput.value = formattedValue;
- this.input(parsedValue);
- };
- this.setFloatingEl = (el) => {
- if (el) {
- this.floatingEl = el;
- connectFloatingUI(this, this.referenceEl, this.floatingEl);
- }
- };
- this.setStartWrapper = (el) => {
- this.startWrapper = el;
- this.setReferenceEl();
- };
- this.setEndWrapper = (el) => {
- this.endWrapper = el;
- this.setReferenceEl();
- };
- /**
- * Event handler for when the selected date changes
- *
- * @param event
- */
- this.handleDateChange = (event) => {
- if (this.range) {
- return;
- }
- this.value = dateToISO(event.detail);
- };
- this.handleDateRangeChange = (event) => {
- var _a, _b;
- if (!this.range || !event.detail) {
- return;
- }
- const { startDate, endDate } = event.detail;
- this.start = dateToISO(startDate);
- this.end = dateToISO(endDate);
- this.value = [this.start, this.end];
- if (this.shouldFocusRangeEnd()) {
- (_a = this.endInput) === null || _a === void 0 ? void 0 : _a.setFocus();
- }
- else if (this.shouldFocusRangeStart()) {
- (_b = this.startInput) === null || _b === void 0 ? void 0 : _b.setFocus();
- }
- };
- this.commonDateSeparators = [".", "-", "/"];
- this.formatNumerals = (value) => value
- ? value
- .split("")
- .map((char) =>
- // convert common separators to the locale's
- this.commonDateSeparators.includes(char)
- ? this.localeData.separator
- : numberKeys.includes(char)
- ? numberStringFormatter.numberFormatter.format(Number(char))
- : char)
- .join("")
- : "";
- this.parseNumerals = (value) => value
- ? value
- .split("")
- .map((char) => numberKeys.includes(char) ? numberStringFormatter.delocalize(char) : char)
- .join("")
- : "";
- }
- handleDisabledAndReadOnlyChange(value) {
- if (!value) {
- this.open = false;
- }
- }
- valueHandler(value) {
- if (Array.isArray(value)) {
- this.valueAsDate = getValueAsDateRange(value);
- this.start = value[0];
- this.end = value[1];
- }
- else if (value) {
- this.valueAsDate = dateFromISO(value);
- this.start = "";
- this.end = "";
- }
- else {
- this.valueAsDate = undefined;
- this.start = undefined;
- this.end = undefined;
- }
- }
- flipPlacementsHandler() {
- this.setFilteredPlacements();
- this.reposition(true);
- }
- onMinChanged(min) {
- if (min) {
- this.minAsDate = dateFromISO(min);
- }
- }
- onMaxChanged(max) {
- if (max) {
- this.maxAsDate = dateFromISO(max);
- }
- }
- activeHandler(value) {
- this.open = value;
- }
- openHandler(value) {
- this.active = value;
- if (this.disabled || this.readOnly) {
- if (!value) {
- updateAfterClose(this.floatingEl);
- }
- this.open = false;
- return;
- }
- if (value) {
- this.reposition(true);
- }
- else {
- updateAfterClose(this.floatingEl);
- }
- }
- overlayPositioningHandler() {
- this.reposition(true);
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- handleDateOrRangeChange() {
- this.calciteInputDatePickerChange.emit();
- }
- calciteDaySelectHandler() {
- if (this.shouldFocusRangeStart() || this.shouldFocusRangeEnd()) {
- return;
- }
- this.open = false;
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.startInput) === null || _a === void 0 ? void 0 : _a.setFocus();
- }
- /**
- * Updates the position of the component.
- *
- * @param delayed
- */
- async reposition(delayed = false) {
- const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
- return reposition(this, {
- floatingEl,
- referenceEl,
- overlayPositioning,
- placement,
- flipPlacements: filteredFlipPlacements,
- type: "menu"
- }, delayed);
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectLocalized(this);
- const isOpen = this.active || this.open;
- isOpen && this.activeHandler(isOpen);
- isOpen && this.openHandler(isOpen);
- if (Array.isArray(this.value)) {
- this.valueAsDate = getValueAsDateRange(this.value);
- this.start = this.value[0];
- this.end = this.value[1];
- }
- else if (this.value) {
- this.valueAsDate = dateFromISO(this.value);
- this.start = "";
- this.end = "";
- }
- if (this.start) {
- this.startAsDate = dateFromISO(this.start);
- }
- if (this.end) {
- this.endAsDate = setEndOfDay(dateFromISO(this.end));
- }
- if (this.min) {
- this.minAsDate = dateFromISO(this.min);
- }
- if (this.max) {
- this.maxAsDate = dateFromISO(this.max);
- }
- connectLabel(this);
- connectForm(this);
- connectOpenCloseComponent(this);
- this.setFilteredPlacements();
- this.reposition(true);
- numberStringFormatter.numberFormatOptions = {
- numberingSystem: this.numberingSystem,
- locale: this.effectiveLocale,
- useGrouping: false
- };
- }
- async componentWillLoad() {
- await this.loadLocaleData();
- this.onMinChanged(this.min);
- this.onMaxChanged(this.max);
- }
- componentDidLoad() {
- this.reposition(true);
- }
- disconnectedCallback() {
- disconnectLabel(this);
- disconnectForm(this);
- disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
- disconnectOpenCloseComponent(this);
- disconnectLocalized(this);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- render() {
- var _a, _b;
- const { disabled, readOnly, numberingSystem, effectiveLocale } = this;
- numberStringFormatter.numberFormatOptions = {
- numberingSystem,
- locale: effectiveLocale,
- useGrouping: false
- };
- const date = dateFromRange(this.range ? this.startAsDate : this.valueAsDate, this.minAsDate, this.maxAsDate);
- const endDate = this.range
- ? dateFromRange(this.endAsDate, this.minAsDate, this.maxAsDate)
- : null;
- const formattedEndDate = endDate
- ? this.formatNumerals(endDate.toLocaleDateString(effectiveLocale))
- : "";
- const formattedDate = date ? this.formatNumerals(date.toLocaleDateString(effectiveLocale)) : "";
- return (hAsync(Host, { onBlur: this.deactivate, onKeyDown: this.keyDownHandler, role: "application" }, this.localeData && (hAsync("div", { "aria-expanded": toAriaBoolean(this.open), 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), lang: effectiveLocale, "number-button-type": "none", numberingSystem: numberingSystem, onCalciteInputInput: this.startInputInput, onCalciteInternalInputBlur: this.inputBlur, onCalciteInternalInputFocus: this.startInputFocus, placeholder: (_a = this.localeData) === null || _a === void 0 ? void 0 : _a.placeholder, readOnly: readOnly, ref: this.setStartInput, scale: this.scale, type: "text", value: formattedDate })), hAsync("div", { "aria-hidden": toAriaBoolean(!this.open), class: {
- [CSS$u.menu]: true,
- [CSS$u.menuActive]: this.open
- }, ref: this.setFloatingEl }, hAsync("div", { class: {
- ["calendar-picker-wrapper"]: true,
- ["calendar-picker-wrapper--end"]: this.focusedInput === "end",
- [FloatingCSS.animation]: true,
- [FloatingCSS.animationActive]: this.open
- }, ref: this.setTransitionEl }, hAsync("calcite-date-picker", { activeRange: this.focusedInput, endAsDate: this.endAsDate, headingLevel: this.headingLevel, intlNextMonth: this.intlNextMonth, intlPrevMonth: this.intlPrevMonth, intlYear: this.intlYear, lang: effectiveLocale, max: this.max, maxAsDate: this.maxAsDate, min: this.min, minAsDate: this.minAsDate, numberingSystem: numberingSystem, 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: {
- input: true,
- "border-top-color-one": this.layout === "vertical" && this.range
- }, disabled: disabled, icon: "calendar", lang: effectiveLocale, "number-button-type": "none", numberingSystem: numberingSystem, onCalciteInputInput: this.endInputInput, onCalciteInternalInputBlur: this.inputBlur, onCalciteInternalInputFocus: this.endInputFocus, placeholder: (_b = this.localeData) === null || _b === void 0 ? void 0 : _b.placeholder, readOnly: readOnly, ref: this.setEndInput, scale: this.scale, type: "text", value: formattedEndDate }))))), hAsync(HiddenFormInputSlot, { component: this })));
- }
- setReferenceEl() {
- const { focusedInput, layout, endWrapper, startWrapper } = this;
- this.referenceEl =
- focusedInput === "end" || layout === "vertical"
- ? endWrapper || startWrapper
- : startWrapper || endWrapper;
- connectFloatingUI(this, this.referenceEl, this.floatingEl);
- }
- onLabelClick() {
- this.setFocus();
- }
- onBeforeOpen() {
- this.calciteInputDatePickerBeforeOpen.emit();
- }
- onOpen() {
- this.calciteInputDatePickerOpen.emit();
- }
- onBeforeClose() {
- this.calciteInputDatePickerBeforeClose.emit();
- }
- onClose() {
- this.calciteInputDatePickerClose.emit();
- }
- startWatcher(start) {
- this.startAsDate = dateFromISO(start);
- }
- endWatcher(end) {
- this.endAsDate = end ? setEndOfDay(dateFromISO(end)) : dateFromISO(end);
- }
- async loadLocaleData() {
- {
- return;
- }
- }
- clearCurrentValue() {
- if (!this.range) {
- if (typeof this.value === "string" && this.value) {
- this.calciteDatePickerChange.emit();
- }
- this.value = "";
- return;
- }
- const { focusedInput } = this;
- if (focusedInput === "start") {
- if (this.start) {
- this.calciteDatePickerRangeChange.emit();
- }
- this.value = Array.isArray(this.value) ? ["", this.value[1] || ""] : [""];
- this.start = undefined;
- }
- else if (focusedInput === "end") {
- if (this.end) {
- this.calciteDatePickerRangeChange.emit();
- }
- this.value = Array.isArray(this.value) ? [this.value[0] || "", ""] : ["", ""];
- this.end = undefined;
- }
- }
- /**
- * If inputted string is a valid date, update value/active
- *
- * @param value
- */
- input(value) {
- const date = this.getDateFromInput(value);
- if (!date) {
- this.clearCurrentValue();
- return;
- }
- if (!this.range) {
- this.value = dateToISO(date);
- this.calciteDatePickerChange.emit(date);
- return;
- }
- const { focusedInput } = this;
- if (focusedInput === "start") {
- if (!this.startAsDate || !sameDate(date, this.startAsDate)) {
- const startDateISO = dateToISO(date);
- this.value = Array.isArray(this.value)
- ? [startDateISO, this.value[1] || ""]
- : [startDateISO];
- this.start = startDateISO;
- this.calciteDatePickerRangeChange.emit({
- startDate: date,
- endDate: this.endAsDate
- });
- }
- }
- else if (focusedInput === "end") {
- if (!this.endAsDate || !sameDate(date, this.endAsDate)) {
- const endDateISO = dateToISO(date);
- this.value = Array.isArray(this.value)
- ? [this.value[0] || "", endDateISO]
- : ["", endDateISO];
- this.end = endDateISO;
- this.calciteDatePickerRangeChange.emit({
- startDate: this.startAsDate,
- endDate: setEndOfDay(date)
- });
- }
- }
- }
- /**
- * Clean up invalid date from input on blur
- *
- * @param target
- */
- blur(target) {
- const { focusedInput, endAsDate, range, startAsDate, valueAsDate } = this;
- const locale = this.effectiveLocale;
- const date = this.getDateFromInput(target.value);
- if (!date) {
- if (!range && valueAsDate) {
- target.value = this.formatNumerals(Array.isArray(valueAsDate)
- ? valueAsDate[focusedInput === "end" ? 1 : 0].toLocaleDateString(locale)
- : valueAsDate.toLocaleDateString(locale));
- }
- else if (focusedInput === "start" && startAsDate) {
- target.value = this.formatNumerals(startAsDate.toLocaleDateString(locale));
- }
- else if (focusedInput === "end" && endAsDate) {
- target.value = this.formatNumerals(endAsDate.toLocaleDateString(locale));
- }
- }
- }
- shouldFocusRangeStart() {
- return !!(this.endAsDate &&
- !this.startAsDate &&
- this.focusedInput === "end" &&
- this.startInput);
- }
- shouldFocusRangeEnd() {
- return !!(this.startAsDate &&
- !this.endAsDate &&
- this.focusedInput === "start" &&
- this.endInput);
- }
- /**
- * Find a date from input string
- * return false if date is invalid, or out of range
- *
- * @param value
- */
- getDateFromInput(value) {
- if (!this.localeData) {
- return false;
- }
- const { separator } = this.localeData;
- const { day, month, year } = parseDateString(value, this.localeData);
- const validDay = day > 0;
- const validMonth = month > -1;
- const date = new Date(year, month, day);
- date.setFullYear(year);
- const validDate = !isNaN(date.getTime());
- const validLength = value.split(separator).filter((c) => c).length > 2;
- const validYear = year.toString().length > 0;
- if (validDay &&
- validMonth &&
- validDate &&
- validLength &&
- validYear &&
- inRange(date, this.min, this.max)) {
- return date;
- }
- return false;
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["handleDisabledAndReadOnlyChange"],
- "readOnly": ["handleDisabledAndReadOnlyChange"],
- "value": ["valueHandler"],
- "flipPlacements": ["flipPlacementsHandler"],
- "min": ["onMinChanged"],
- "max": ["onMaxChanged"],
- "active": ["activeHandler"],
- "open": ["openHandler"],
- "overlayPositioning": ["overlayPositioningHandler"],
- "layout": ["setReferenceEl"],
- "focusedInput": ["setReferenceEl"],
- "start": ["startWatcher"],
- "end": ["endWatcher"],
- "effectiveLocale": ["loadLocaleData"]
- }; }
- static get style() { return inputDatePickerCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-input-date-picker",
- "$members$": {
- "disabled": [516],
- "readOnly": [516, "read-only"],
- "value": [1025],
- "flipPlacements": [16],
- "headingLevel": [514, "heading-level"],
- "valueAsDate": [1040],
- "startAsDate": [1040],
- "endAsDate": [1040],
- "minAsDate": [1040],
- "maxAsDate": [1040],
- "min": [1025],
- "max": [1025],
- "active": [1540],
- "open": [1540],
- "name": [513],
- "intlPrevMonth": [1, "intl-prev-month"],
- "intlNextMonth": [1, "intl-next-month"],
- "intlYear": [1, "intl-year"],
- "locale": [1],
- "numberingSystem": [513, "numbering-system"],
- "scale": [513],
- "placement": [513],
- "range": [516],
- "required": [516],
- "start": [1537],
- "end": [1537],
- "overlayPositioning": [513, "overlay-positioning"],
- "proximitySelectionDisabled": [4, "proximity-selection-disabled"],
- "layout": [513],
- "effectiveLocale": [32],
- "focusedInput": [32],
- "globalAttributes": [32],
- "localeData": [32],
- "setFocus": [64],
- "reposition": [64]
- },
- "$listeners$": [[0, "calciteDatePickerChange", "handleDateOrRangeChange"], [0, "calciteDatePickerRangeChange", "handleDateOrRangeChange"], [0, "calciteDaySelect", "calciteDaySelectHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["readOnly", "read-only"], ["headingLevel", "heading-level"], ["active", "active"], ["open", "open"], ["name", "name"], ["numberingSystem", "numbering-system"], ["scale", "scale"], ["placement", "placement"], ["range", "range"], ["required", "required"], ["start", "start"], ["end", "end"], ["overlayPositioning", "overlay-positioning"], ["layout", "layout"]]
- }; }
- }
- var StatusIconDefaults;
- (function (StatusIconDefaults) {
- StatusIconDefaults["valid"] = "check-circle";
- StatusIconDefaults["invalid"] = "exclamation-mark-triangle";
- StatusIconDefaults["idle"] = "information";
- })(StatusIconDefaults || (StatusIconDefaults = {}));
- const inputMessageCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-message{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-message{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-message{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-message{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input-message:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-input-message:root{--calcite-floating-ui-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;box-sizing:border-box;display:flex;block-size:0px;inline-size:100%;align-items:center;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host([active])*/[active].sc-calcite-input-message-h{visibility:visible;block-size:auto;opacity:1;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 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-block-start:var(--calcite-input-message-spacing-value)}/*!@:host([calcite-hydrated-hidden])*/[calcite-hydrated-hidden].sc-calcite-input-message-h{visibility:hidden !important;pointer-events:none}/*!@.calcite-input-message-icon*/.calcite-input-message-icon.sc-calcite-input-message{pointer-events:none;display:inline-flex;flex-shrink:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;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{color:var(--calcite-ui-text-1)}/*!@:host([status][scale=s])*/[status][scale=s].sc-calcite-input-message-h{font-size:var(--calcite-font-size--3);line-height:0.75rem}/*!@:host([status][scale=m])*/[status][scale=m].sc-calcite-input-message-h{margin-block-start:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([status][scale=l])*/[status][scale=l].sc-calcite-input-message-h{margin-block-start:0.25rem;font-size:var(--calcite-font-size--1);line-height:1rem}";
- /**
- * @slot - A slot for adding text.
- */
- class InputMessage {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, the component is active. */
- this.active = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- /** Specifies the status of the input field, which determines message and icons. */
- this.status = "idle";
- }
- handleIconEl() {
- this.requestedIcon = setRequestedIcon(StatusIconDefaults, this.icon, this.status);
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- this.status = getElementProp(this.el, "status", this.status);
- this.scale = getElementProp(this.el, "scale", this.scale);
- this.requestedIcon = setRequestedIcon(StatusIconDefaults, this.icon, this.status);
- }
- render() {
- const hidden = !this.active;
- return (hAsync(Host, { "calcite-hydrated-hidden": hidden }, this.renderIcon(this.requestedIcon), hAsync("slot", null)));
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- renderIcon(iconName) {
- if (iconName) {
- return hAsync("calcite-icon", { class: "calcite-input-message-icon", icon: iconName, scale: "s" });
- }
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "status": ["handleIconEl"],
- "icon": ["handleIconEl"]
- }; }
- static get style() { return inputMessageCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-input-message",
- "$members$": {
- "active": [516],
- "icon": [520],
- "scale": [1537],
- "status": [1537],
- "type": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["icon", "icon"], ["scale", "scale"], ["status", "status"], ["type", "type"]]
- }; }
- }
- const CSS$t = {
- loader: "loader",
- clearButton: "clear-button",
- editingEnabled: "editing-enabled",
- inlineChild: "inline-child",
- inputIcon: "icon",
- prefix: "prefix",
- suffix: "suffix",
- numberButtonWrapper: "number-button-wrapper",
- buttonItemHorizontal: "number-button-item--horizontal",
- wrapper: "element-wrapper",
- inputWrapper: "wrapper",
- actionWrapper: "action-wrapper",
- resizeIconWrapper: "resize-icon-wrapper",
- numberButtonItem: "number-button-item"
- };
- const SLOTS$g = {
- action: "action"
- };
- const TEXT$c = {
- clear: "Clear value"
- };
- const inputNumberCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input-number: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-number{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-number{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-number{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-number{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-number{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input-number:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-input-number:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-number-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-input-number-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-input-number-h{display:block}/*!@:host([scale=s]) input, :host([scale=s]) .prefix, :host([scale=s]) .suffix*/[scale=s].sc-calcite-input-number-h input.sc-calcite-input-number,[scale=s].sc-calcite-input-number-h .prefix.sc-calcite-input-number,[scale=s].sc-calcite-input-number-h .suffix.sc-calcite-input-number{block-size:1.5rem;padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@: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-number-h .number-button-wrapper.sc-calcite-input-number,[scale=s].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number,[scale=s].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number button.sc-calcite-input-number{block-size:1.5rem}/*!@:host([scale=s]) .clear-button*/[scale=s].sc-calcite-input-number-h .clear-button.sc-calcite-input-number{min-block-size:1.5rem;min-inline-size:1.5rem}/*!@:host([scale=m]) input, :host([scale=m]) .prefix, :host([scale=m]) .suffix*/[scale=m].sc-calcite-input-number-h input.sc-calcite-input-number,[scale=m].sc-calcite-input-number-h .prefix.sc-calcite-input-number,[scale=m].sc-calcite-input-number-h .suffix.sc-calcite-input-number{block-size:2rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@: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-number-h .number-button-wrapper.sc-calcite-input-number,[scale=m].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number,[scale=m].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number button.sc-calcite-input-number{block-size:2rem}/*!@:host([scale=m]) .clear-button*/[scale=m].sc-calcite-input-number-h .clear-button.sc-calcite-input-number{min-block-size:2rem;min-inline-size:2rem}/*!@:host([scale=l]) input, :host([scale=l]) .prefix, :host([scale=l]) .suffix*/[scale=l].sc-calcite-input-number-h input.sc-calcite-input-number,[scale=l].sc-calcite-input-number-h .prefix.sc-calcite-input-number,[scale=l].sc-calcite-input-number-h .suffix.sc-calcite-input-number{block-size:2.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@: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-number-h .number-button-wrapper.sc-calcite-input-number,[scale=l].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number,[scale=l].sc-calcite-input-number-h .action-wrapper.sc-calcite-input-number calcite-button.sc-calcite-input-number button.sc-calcite-input-number{block-size:2.75rem}/*!@:host([scale=l]) .clear-button*/[scale=l].sc-calcite-input-number-h .clear-button.sc-calcite-input-number{min-block-size:2.75rem;min-inline-size:2.75rem}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-input-number-h[disabled] .sc-calcite-input-number-s>[calcite-hydrated][disabled],[disabled].sc-calcite-input-number-h [calcite-hydrated][disabled].sc-calcite-input-number{opacity:1}/*!@:host input*/.sc-calcite-input-number-h input.sc-calcite-input-number{transition:var(--calcite-animation-timing), block-size 0, outline-offset 0s;-webkit-appearance:none;position:relative;margin:0px;box-sizing:border-box;display:flex;max-block-size:100%;inline-size:100%;max-inline-size:100%;flex:1 1 0%;border-radius:0px;background-color:var(--calcite-ui-foreground-1);font-family:inherit;font-weight:var(--calcite-font-weight-normal);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*/.sc-calcite-input-number-h input.sc-calcite-input-number::placeholder,.sc-calcite-input-number-h input.sc-calcite-input-number:-ms-input-placeholder,.sc-calcite-input-number-h input.sc-calcite-input-number::-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}/*!@:host input:focus*/.sc-calcite-input-number-h input.sc-calcite-input-number:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-1)}/*!@:host input[readonly]*/.sc-calcite-input-number-h input[readonly].sc-calcite-input-number{background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium)}/*!@:host input[readonly]:focus*/.sc-calcite-input-number-h input[readonly].sc-calcite-input-number:focus{color:var(--calcite-ui-text-1)}/*!@:host calcite-icon*/.sc-calcite-input-number-h calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-3)}/*!@:host input*/.sc-calcite-input-number-h input.sc-calcite-input-number{outline-color:transparent}/*!@:host input:focus*/.sc-calcite-input-number-h input.sc-calcite-input-number:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([status=invalid]) input*/[status=invalid].sc-calcite-input-number-h input.sc-calcite-input-number{border-color:var(--calcite-ui-danger)}/*!@:host([status=invalid]) input:focus*/[status=invalid].sc-calcite-input-number-h input.sc-calcite-input-number:focus{outline:2px solid var(--calcite-ui-danger);outline-offset:-2px}/*!@:host([scale=s]) .icon*/[scale=s].sc-calcite-input-number-h .icon.sc-calcite-input-number{inset-inline-start:0.5rem}/*!@:host([scale=m]) .icon*/[scale=m].sc-calcite-input-number-h .icon.sc-calcite-input-number{inset-inline-start:0.75rem}/*!@:host([scale=l]) .icon*/[scale=l].sc-calcite-input-number-h .icon.sc-calcite-input-number{inset-inline-start:1rem}/*!@:host([icon][scale=s]) input*/[icon][scale=s].sc-calcite-input-number-h input.sc-calcite-input-number{padding-inline-start:2rem}/*!@:host([icon][scale=m]) input*/[icon][scale=m].sc-calcite-input-number-h input.sc-calcite-input-number{padding-inline-start:2.5rem}/*!@:host([icon][scale=l]) input*/[icon][scale=l].sc-calcite-input-number-h input.sc-calcite-input-number{padding-inline-start:3rem}/*!@.element-wrapper*/.element-wrapper.sc-calcite-input-number{position:relative;order:3;display:inline-flex;flex:1 1 0%;align-items:center}/*!@.icon*/.icon.sc-calcite-input-number{pointer-events:none;position:absolute;z-index:1;display:block;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button*/.clear-button.sc-calcite-input-number{pointer-events:initial;order:4;margin:0px;box-sizing:border-box;display:flex;min-block-size:100%;cursor:pointer;align-items:center;justify-content:center;align-self:stretch;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);outline-color:transparent;border-inline-start-width:0px}/*!@.clear-button:hover*/.clear-button.sc-calcite-input-number:hover{background-color:var(--calcite-ui-foreground-2);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button:hover calcite-icon*/.clear-button.sc-calcite-input-number:hover calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button:active*/.clear-button.sc-calcite-input-number:active{background-color:var(--calcite-ui-foreground-3)}/*!@.clear-button:active calcite-icon*/.clear-button.sc-calcite-input-number:active calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-1)}/*!@.clear-button:focus*/.clear-button.sc-calcite-input-number:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.clear-button:disabled*/.clear-button.sc-calcite-input-number:disabled{opacity:var(--calcite-ui-opacity-disabled)}/*!@.loader*/.loader.sc-calcite-input-number{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}/*!@.action-wrapper*/.action-wrapper.sc-calcite-input-number{order:7;display:flex}/*!@.prefix, \n.suffix*/.prefix.sc-calcite-input-number,.suffix.sc-calcite-input-number{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;user-select:none;align-content: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-number{order:2;border-inline-end-width:0px}/*!@.suffix*/.suffix.sc-calcite-input-number{order:5;border-inline-start-width:0px}/*!@:host([alignment=start]) input*/[alignment=start].sc-calcite-input-number-h input.sc-calcite-input-number{text-align:start}/*!@:host([alignment=end]) input*/[alignment=end].sc-calcite-input-number-h input.sc-calcite-input-number{text-align:end}/*!@.number-button-wrapper*/.number-button-wrapper.sc-calcite-input-number{pointer-events:none;order:6;box-sizing:border-box;display:flex;flex-direction:column;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host([number-button-type=vertical]) .wrapper*/[number-button-type=vertical].sc-calcite-input-number-h .wrapper.sc-calcite-input-number{flex-direction:row;display:flex}/*!@:host([number-button-type=vertical]) input*/[number-button-type=vertical].sc-calcite-input-number-h input.sc-calcite-input-number{order:2}/*!@:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon*/[number-button-type=horizontal].sc-calcite-input-number-h .calcite--rtl.sc-calcite-input-number .number-button-item[data-adjustment=down].sc-calcite-input-number calcite-icon.sc-calcite-input-number{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-number-h .calcite--rtl.sc-calcite-input-number .number-button-item[data-adjustment=up].sc-calcite-input-number calcite-icon.sc-calcite-input-number{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,.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input-number{order:1;max-block-size:100%;min-block-size:100%;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-number calcite-icon.sc-calcite-input-number,.number-button-item.number-button-item--horizontal[data-adjustment=up].sc-calcite-input-number calcite-icon.sc-calcite-input-number{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-number{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-number: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-number:hover calcite-icon.sc-calcite-input-number{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-number{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-number: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-number:hover calcite-icon.sc-calcite-input-number{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-number-h .number-button-item[data-adjustment=down].sc-calcite-input-number: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-number-h .number-button-item[data-adjustment=down].sc-calcite-input-number:hover calcite-icon.sc-calcite-input-number{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-number-h .number-button-item[data-adjustment=up].sc-calcite-input-number: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-number-h .number-button-item[data-adjustment=up].sc-calcite-input-number:hover calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-1)}/*!@:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]*/[number-button-type=vertical].sc-calcite-input-number-h .number-button-item[data-adjustment=down].sc-calcite-input-number{border-block-start-width:0px}/*!@.number-button-item*/.number-button-item.sc-calcite-input-number{max-block-size:50%;min-block-size:50%;pointer-events:initial;margin:0px;box-sizing:border-box;display:flex;cursor:pointer;align-items: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-block:0px;padding-inline:0.5rem;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-inline-start-width:0px}/*!@.number-button-item calcite-icon*/.number-button-item.sc-calcite-input-number calcite-icon.sc-calcite-input-number{pointer-events:none;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.number-button-item:focus*/.number-button-item.sc-calcite-input-number:focus{background-color:var(--calcite-ui-foreground-2)}/*!@.number-button-item:focus calcite-icon*/.number-button-item.sc-calcite-input-number:focus calcite-icon.sc-calcite-input-number{color:var(--calcite-ui-text-1)}/*!@.number-button-item:active*/.number-button-item.sc-calcite-input-number:active{background-color:var(--calcite-ui-foreground-3)}/*!@.number-button-item:disabled*/.number-button-item.sc-calcite-input-number:disabled{pointer-events:none}/*!@.wrapper*/.wrapper.sc-calcite-input-number{position:relative;display:flex;flex-direction:row;align-items:center}/*!@:host(.no-bottom-border) input*/.no-bottom-border.sc-calcite-input-number-h input.sc-calcite-input-number{border-block-end-width:0px}/*!@:host(.border-top-color-one) input*/.border-top-color-one.sc-calcite-input-number-h input.sc-calcite-input-number{border-block-start-color:var(--calcite-ui-border-1)}/*!@:host .inline-child*/.sc-calcite-input-number-h .inline-child.sc-calcite-input-number{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host .inline-child .editing-enabled*/.sc-calcite-input-number-h .inline-child.sc-calcite-input-number .editing-enabled.sc-calcite-input-number{background-color:inherit}/*!@:host .inline-child:not(.editing-enabled)*/.sc-calcite-input-number-h .inline-child.sc-calcite-input-number:not(.editing-enabled){display:flex;cursor:pointer;border-color:transparent;padding-inline-start:0}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-input-number-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- /**
- * @slot action - A slot for positioning a button next to the component.
- */
- class InputNumber {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalInputNumberFocus = createEvent(this, "calciteInternalInputNumberFocus", 6);
- this.calciteInternalInputNumberBlur = createEvent(this, "calciteInternalInputNumberBlur", 6);
- this.calciteInputNumberInput = createEvent(this, "calciteInputNumberInput", 7);
- this.calciteInputNumberChange = createEvent(this, "calciteInputNumberChange", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** Specifies the text alignment of the component's value. */
- this.alignment = "start";
- /**
- * When `true`, the component is focused on page load.
- *
- * @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
- */
- this.autofocus = false;
- /**
- * When `true`, a clear button is displayed when the component has a value.
- */
- this.clearable = false;
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- *
- * @mdn [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled)
- */
- this.disabled = false;
- /**
- * When `true`, number values are displayed with a group separator corresponding to the language and country format.
- */
- this.groupSeparator = false;
- /**
- * When `true`, the component will not be visible.
- *
- * @mdn [hidden](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden)
- */
- this.hidden = false;
- /**
- * Accessible name that will appear while loading.
- *
- * @default "Loading"
- */
- this.intlLoading = TEXT$v.loading;
- /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
- this.iconFlipRtl = false;
- /** When `true`, the component is in the loading state and `calcite-progress` is displayed. */
- this.loading = false;
- /**
- * Toggles locale formatting for numbers.
- *
- * @internal
- */
- this.localeFormat = false;
- /** Specifies the placement of the buttons. */
- this.numberButtonType = "vertical";
- /**
- * When `true`, the component's value can be read, but cannot be modified.
- *
- * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
- */
- this.readOnly = false;
- /** When `true`, the component must have a value in order for the form to submit. */
- this.required = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- /** Specifies the status of the input field, which determines message and icons. */
- this.status = "idle";
- /**
- * @internal
- */
- this.editingEnabled = false;
- /** The component's value. */
- this.value = "";
- this.previousValueOrigin = "initial";
- this.mutationObserver = createObserver();
- this.userChangedValue = false;
- //--------------------------------------------------------------------------
- //
- // State
- //
- //--------------------------------------------------------------------------
- this.effectiveLocale = "";
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.keyDownHandler = (event) => {
- if (this.readOnly || this.disabled) {
- return;
- }
- if (this.isClearable && event.key === "Escape") {
- this.clearInputValue(event);
- event.preventDefault();
- }
- if (event.key === "Enter" && !event.defaultPrevented) {
- if (submitForm(this)) {
- event.preventDefault();
- }
- }
- };
- this.clearInputValue = (nativeEvent) => {
- this.setNumberValue({
- committing: true,
- nativeEvent,
- origin: "user",
- value: ""
- });
- };
- this.emitChangeIfUserModified = () => {
- if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue) {
- this.calciteInputNumberChange.emit();
- }
- this.previousEmittedValue = this.value;
- };
- this.inputNumberBlurHandler = () => {
- this.calciteInternalInputNumberBlur.emit();
- this.emitChangeIfUserModified();
- };
- this.inputNumberFocusHandler = (event) => {
- const slottedActionEl = getSlotted(this.el, "action");
- if (event.target !== slottedActionEl) {
- this.setFocus();
- }
- this.calciteInternalInputNumberFocus.emit();
- };
- this.inputNumberInputHandler = (nativeEvent) => {
- if (this.disabled || this.readOnly) {
- return;
- }
- const value = nativeEvent.target.value;
- numberStringFormatter.numberFormatOptions = {
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- useGrouping: this.groupSeparator
- };
- const delocalizedValue = numberStringFormatter.delocalize(value);
- if (nativeEvent.inputType === "insertFromPaste") {
- if (!isValidNumber(delocalizedValue)) {
- nativeEvent.preventDefault();
- }
- this.setNumberValue({
- nativeEvent,
- origin: "user",
- value: parseNumberString(delocalizedValue)
- });
- this.childNumberEl.value = this.localizedValue;
- }
- else {
- this.setNumberValue({
- nativeEvent,
- origin: "user",
- value: delocalizedValue
- });
- }
- };
- this.inputNumberKeyDownHandler = (event) => {
- if (this.disabled || this.readOnly) {
- return;
- }
- if (event.key === "ArrowUp") {
- /* prevent default behavior of moving cursor to the beginning of the input when holding down ArrowUp */
- event.preventDefault();
- this.nudgeNumberValue("up", event);
- return;
- }
- if (event.key === "ArrowDown") {
- this.nudgeNumberValue("down", event);
- return;
- }
- const supportedKeys = [
- ...numberKeys,
- "ArrowLeft",
- "ArrowRight",
- "Backspace",
- "Delete",
- "Enter",
- "Escape",
- "Tab"
- ];
- if (event.altKey || event.ctrlKey || event.metaKey) {
- return;
- }
- const isShiftTabEvent = event.shiftKey && event.key === "Tab";
- if (supportedKeys.includes(event.key) && (!event.shiftKey || isShiftTabEvent)) {
- if (event.key === "Enter") {
- this.emitChangeIfUserModified();
- }
- return;
- }
- numberStringFormatter.numberFormatOptions = {
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- useGrouping: this.groupSeparator
- };
- if (event.key === numberStringFormatter.decimal) {
- if (!this.value && !this.childNumberEl.value) {
- return;
- }
- if (this.value && this.childNumberEl.value.indexOf(numberStringFormatter.decimal) === -1) {
- return;
- }
- }
- if (/[eE]/.test(event.key)) {
- if (!this.value && !this.childNumberEl.value) {
- return;
- }
- if (this.value && !/[eE]/.test(this.childNumberEl.value)) {
- return;
- }
- }
- if (event.key === "-") {
- if (!this.value && !this.childNumberEl.value) {
- return;
- }
- if (this.value && this.childNumberEl.value.split("-").length <= 2) {
- return;
- }
- }
- event.preventDefault();
- };
- this.nudgeNumberValue = (direction, nativeEvent) => {
- if (nativeEvent instanceof KeyboardEvent && nativeEvent.repeat) {
- return;
- }
- const inputMax = this.maxString ? parseFloat(this.maxString) : null;
- const inputMin = this.minString ? parseFloat(this.minString) : null;
- const valueNudgeDelayInMs = 100;
- this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
- if (this.nudgeNumberValueIntervalId) {
- window.clearInterval(this.nudgeNumberValueIntervalId);
- }
- let firstValueNudge = true;
- this.nudgeNumberValueIntervalId = window.setInterval(() => {
- if (firstValueNudge) {
- firstValueNudge = false;
- return;
- }
- this.incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent);
- }, valueNudgeDelayInMs);
- };
- this.nudgeButtonPointerUpAndOutHandler = (event) => {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- window.clearInterval(this.nudgeNumberValueIntervalId);
- };
- this.nudgeButtonPointerDownHandler = (event) => {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- event.preventDefault();
- const direction = event.target.dataset.adjustment;
- if (!this.disabled) {
- this.nudgeNumberValue(direction, event);
- }
- };
- this.hiddenInputChangeHandler = (event) => {
- if (event.target.name === this.name) {
- this.setNumberValue({
- value: event.target.value,
- origin: "direct"
- });
- }
- event.stopPropagation();
- };
- this.setChildNumberElRef = (el) => {
- this.childNumberEl = el;
- };
- this.setInputNumberValue = (newInputValue) => {
- if (!this.childNumberEl) {
- return;
- }
- this.childNumberEl.value = newInputValue;
- };
- this.setPreviousEmittedNumberValue = (newPreviousEmittedValue) => {
- this.previousEmittedValue = isValidNumber(newPreviousEmittedValue)
- ? newPreviousEmittedValue
- : "";
- };
- this.setPreviousNumberValue = (newPreviousValue) => {
- this.previousValue = isValidNumber(newPreviousValue) ? newPreviousValue : "";
- };
- this.setNumberValue = ({ committing = false, nativeEvent, origin, previousValue, value }) => {
- numberStringFormatter.numberFormatOptions = {
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- useGrouping: this.groupSeparator
- };
- const sanitizedValue = sanitizeNumberString((this.numberingSystem && this.numberingSystem !== "latn") || defaultNumberingSystem !== "latn"
- ? numberStringFormatter.delocalize(value)
- : value);
- const newValue = value && !sanitizedValue
- ? isValidNumber(this.previousValue)
- ? this.previousValue
- : ""
- : sanitizedValue;
- const newLocalizedValue = numberStringFormatter.localize(newValue);
- this.setPreviousNumberValue(previousValue || this.value);
- this.previousValueOrigin = origin;
- this.userChangedValue = origin === "user" && this.value !== newValue;
- this.value = newValue;
- this.localizedValue = newLocalizedValue;
- if (origin === "direct") {
- this.setInputNumberValue(newLocalizedValue);
- }
- if (nativeEvent) {
- const calciteInputNumberInputEvent = this.calciteInputNumberInput.emit({
- element: this.childNumberEl,
- nativeEvent,
- value: this.value
- });
- if (calciteInputNumberInputEvent.defaultPrevented) {
- const previousLocalizedValue = numberStringFormatter.localize(this.previousValue);
- this.value = this.previousValue;
- this.localizedValue = previousLocalizedValue;
- }
- else if (committing) {
- this.emitChangeIfUserModified();
- }
- }
- };
- this.inputNumberKeyUpHandler = () => {
- window.clearInterval(this.nudgeNumberValueIntervalId);
- };
- }
- disabledWatcher() {
- this.setDisabledAction();
- }
- localeChanged() {
- updateEffectiveLocale(this);
- }
- /** watcher to update number-to-string for max */
- maxWatcher() {
- var _a;
- this.maxString = ((_a = this.max) === null || _a === void 0 ? void 0 : _a.toString()) || null;
- }
- /** watcher to update number-to-string for min */
- minWatcher() {
- var _a;
- this.minString = ((_a = this.min) === null || _a === void 0 ? void 0 : _a.toString()) || null;
- }
- valueWatcher(newValue, previousValue) {
- if (!this.userChangedValue) {
- this.setNumberValue({
- origin: "direct",
- previousValue,
- value: newValue == null || newValue == ""
- ? ""
- : isValidNumber(newValue)
- ? newValue
- : this.previousValue || ""
- });
- this.warnAboutInvalidNumberValue(newValue);
- }
- this.userChangedValue = false;
- }
- updateRequestedIcon() {
- this.requestedIcon = setRequestedIcon({}, this.icon, "number");
- }
- get isClearable() {
- return this.clearable && this.value.length > 0;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- connectLocalized(this);
- this.scale = getElementProp(this.el, "scale", this.scale);
- this.status = getElementProp(this.el, "status", this.status);
- this.inlineEditableEl = this.el.closest("calcite-inline-editable");
- if (this.inlineEditableEl) {
- this.editingEnabled = this.inlineEditableEl.editingEnabled || false;
- }
- connectLabel(this);
- connectForm(this);
- this.setPreviousEmittedNumberValue(this.value);
- this.setPreviousNumberValue(this.value);
- this.warnAboutInvalidNumberValue(this.value);
- this.setNumberValue({
- origin: "connected",
- value: isValidNumber(this.value) ? this.value : ""
- });
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
- this.setDisabledAction();
- this.el.addEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
- }
- disconnectedCallback() {
- var _a;
- disconnectLabel(this);
- disconnectForm(this);
- disconnectLocalized(this);
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- this.el.removeEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
- }
- componentWillLoad() {
- var _a, _b;
- this.maxString = (_a = this.max) === null || _a === void 0 ? void 0 : _a.toString();
- this.minString = (_b = this.min) === null || _b === void 0 ? void 0 : _b.toString();
- this.requestedIcon = setRequestedIcon({}, this.icon, "number");
- }
- componentShouldUpdate(newValue, oldValue, property) {
- if (property === "value" && newValue && !isValidNumber(newValue)) {
- this.setNumberValue({
- origin: "reset",
- value: oldValue
- });
- return false;
- }
- return true;
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.focus();
- }
- /** Selects all text of the component's `value`. */
- async selectText() {
- var _a;
- (_a = this.childNumberEl) === null || _a === void 0 ? void 0 : _a.select();
- }
- onLabelClick() {
- this.setFocus();
- }
- incrementOrDecrementNumberValue(direction, inputMax, inputMin, nativeEvent) {
- const { value } = this;
- const inputStep = this.step === "any" ? 1 : Math.abs(this.step || 1);
- const inputVal = value && value !== "" ? parseFloat(value) : 0;
- const adjustment = direction === "up" ? 1 : -1;
- const nudgedValue = inputVal + inputStep * adjustment;
- const finalValue = (typeof inputMin === "number" && !isNaN(inputMin) && nudgedValue < inputMin) ||
- (typeof inputMax === "number" && !isNaN(inputMax) && nudgedValue > inputMax)
- ? inputVal
- : nudgedValue;
- const inputValPlaces = decimalPlaces(inputVal);
- const inputStepPlaces = decimalPlaces(inputStep);
- this.setNumberValue({
- committing: true,
- nativeEvent,
- origin: "user",
- value: finalValue.toFixed(Math.max(inputValPlaces, inputStepPlaces))
- });
- }
- onFormReset() {
- this.setNumberValue({
- origin: "reset",
- value: this.defaultValue
- });
- }
- syncHiddenFormInput(input) {
- var _a, _b, _c, _d;
- input.type = "number";
- input.min = (_b = (_a = this.min) === null || _a === void 0 ? void 0 : _a.toString(10)) !== null && _b !== void 0 ? _b : "";
- input.max = (_d = (_c = this.max) === null || _c === void 0 ? void 0 : _c.toString(10)) !== null && _d !== void 0 ? _d : "";
- }
- setDisabledAction() {
- const slottedActionEl = getSlotted(this.el, "action");
- if (!slottedActionEl) {
- return;
- }
- this.disabled
- ? slottedActionEl.setAttribute("disabled", "")
- : slottedActionEl.removeAttribute("disabled");
- }
- warnAboutInvalidNumberValue(value) {
- if (value && !isValidNumber(value)) {
- console.warn(`The specified value "${value}" cannot be parsed, or is out of range.`);
- }
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const dir = getElementDir(this.el);
- const loader = (hAsync("div", { class: CSS$t.loader }, hAsync("calcite-progress", { label: this.intlLoading, type: "indeterminate" })));
- const inputClearButton = (hAsync("button", { "aria-label": this.intlClear || TEXT$c.clear, class: CSS$t.clearButton, disabled: this.disabled || this.readOnly, onClick: this.clearInputValue, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "x", scale: "s" })));
- const iconEl = (hAsync("calcite-icon", { class: CSS$t.inputIcon, flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: "s" }));
- const isHorizontalNumberButton = this.numberButtonType === "horizontal";
- const numberButtonsHorizontalUp = (hAsync("button", { "aria-hidden": "true", class: {
- [CSS$t.numberButtonItem]: true,
- [CSS$t.buttonItemHorizontal]: isHorizontalNumberButton
- }, "data-adjustment": "up", disabled: this.disabled || this.readOnly, onPointerDown: this.nudgeButtonPointerDownHandler, onPointerOut: this.nudgeButtonPointerUpAndOutHandler, onPointerUp: this.nudgeButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "chevron-up", scale: "s" })));
- const numberButtonsHorizontalDown = (hAsync("button", { "aria-hidden": "true", class: {
- [CSS$t.numberButtonItem]: true,
- [CSS$t.buttonItemHorizontal]: isHorizontalNumberButton
- }, "data-adjustment": "down", disabled: this.disabled || this.readOnly, onPointerDown: this.nudgeButtonPointerDownHandler, onPointerOut: this.nudgeButtonPointerUpAndOutHandler, onPointerUp: this.nudgeButtonPointerUpAndOutHandler, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "chevron-down", scale: "s" })));
- const numberButtonsVertical = (hAsync("div", { class: CSS$t.numberButtonWrapper }, numberButtonsHorizontalUp, numberButtonsHorizontalDown));
- const prefixText = hAsync("div", { class: CSS$t.prefix }, this.prefixText);
- const suffixText = hAsync("div", { class: CSS$t.suffix }, this.suffixText);
- const childEl = (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.inputNumberBlurHandler, onFocus: this.inputNumberFocusHandler, onInput: this.inputNumberInputHandler, onKeyDown: this.inputNumberKeyDownHandler, onKeyUp: this.inputNumberKeyUpHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildNumberElRef, type: "text", value: this.localizedValue }));
- return (hAsync(Host, { onClick: this.inputNumberFocusHandler, onKeyDown: this.keyDownHandler }, hAsync("div", { class: { [CSS$t.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" } }, this.numberButtonType === "horizontal" && !this.readOnly
- ? numberButtonsHorizontalDown
- : null, this.prefixText ? prefixText : null, hAsync("div", { class: CSS$t.wrapper }, childEl, this.isClearable ? inputClearButton : null, this.requestedIcon ? iconEl : null, this.loading ? loader : null), hAsync("div", { class: CSS$t.actionWrapper }, hAsync("slot", { name: SLOTS$g.action })), this.numberButtonType === "vertical" && !this.readOnly ? numberButtonsVertical : null, this.suffixText ? suffixText : null, this.numberButtonType === "horizontal" && !this.readOnly
- ? numberButtonsHorizontalUp
- : null, hAsync(HiddenFormInputSlot, { component: this }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["disabledWatcher"],
- "locale": ["localeChanged"],
- "max": ["maxWatcher"],
- "min": ["minWatcher"],
- "value": ["valueWatcher"],
- "icon": ["updateRequestedIcon"]
- }; }
- static get style() { return inputNumberCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-input-number",
- "$members$": {
- "alignment": [513],
- "autofocus": [516],
- "clearable": [516],
- "disabled": [516],
- "groupSeparator": [516, "group-separator"],
- "hidden": [516],
- "icon": [520],
- "intlClear": [1, "intl-clear"],
- "intlLoading": [1, "intl-loading"],
- "iconFlipRtl": [516, "icon-flip-rtl"],
- "label": [1],
- "loading": [516],
- "locale": [1],
- "numberingSystem": [513, "numbering-system"],
- "localeFormat": [4, "locale-format"],
- "max": [514],
- "min": [514],
- "maxLength": [514, "max-length"],
- "minLength": [514, "min-length"],
- "name": [513],
- "numberButtonType": [513, "number-button-type"],
- "placeholder": [1],
- "prefixText": [1, "prefix-text"],
- "readOnly": [516, "read-only"],
- "required": [516],
- "scale": [1537],
- "status": [1537],
- "step": [520],
- "suffixText": [1, "suffix-text"],
- "editingEnabled": [1540, "editing-enabled"],
- "value": [1025],
- "effectiveLocale": [32],
- "localizedValue": [32],
- "setFocus": [64],
- "selectText": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["alignment", "alignment"], ["autofocus", "autofocus"], ["clearable", "clearable"], ["disabled", "disabled"], ["groupSeparator", "group-separator"], ["hidden", "hidden"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["loading", "loading"], ["numberingSystem", "numbering-system"], ["max", "max"], ["min", "min"], ["maxLength", "max-length"], ["minLength", "min-length"], ["name", "name"], ["numberButtonType", "number-button-type"], ["readOnly", "read-only"], ["required", "required"], ["scale", "scale"], ["status", "status"], ["step", "step"], ["editingEnabled", "editing-enabled"]]
- }; }
- }
- const CSS$s = {
- loader: "loader",
- clearButton: "clear-button",
- editingEnabled: "editing-enabled",
- inlineChild: "inline-child",
- inputIcon: "icon",
- prefix: "prefix",
- suffix: "suffix",
- wrapper: "element-wrapper",
- inputWrapper: "wrapper",
- actionWrapper: "action-wrapper",
- resizeIconWrapper: "resize-icon-wrapper"
- };
- const SLOTS$f = {
- action: "action"
- };
- const TEXT$b = {
- clear: "Clear value"
- };
- const inputTextCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}/*!@:root*/.sc-calcite-input-text: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-text{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-text{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-text{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-text{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-text{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input-text:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-input-text:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-text-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-input-text-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-input-text-h{display:block}/*!@:host([scale=s]) input, :host([scale=s]) .prefix, :host([scale=s]) .suffix*/[scale=s].sc-calcite-input-text-h input.sc-calcite-input-text,[scale=s].sc-calcite-input-text-h .prefix.sc-calcite-input-text,[scale=s].sc-calcite-input-text-h .suffix.sc-calcite-input-text{block-size:1.5rem;padding-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s]) .action-wrapper calcite-button, :host([scale=s]) .action-wrapper calcite-button button*/[scale=s].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text,[scale=s].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text button.sc-calcite-input-text{block-size:1.5rem}/*!@:host([scale=s]) .clear-button*/[scale=s].sc-calcite-input-text-h .clear-button.sc-calcite-input-text{min-block-size:1.5rem;min-inline-size:1.5rem}/*!@:host([scale=m]) input, :host([scale=m]) .prefix, :host([scale=m]) .suffix*/[scale=m].sc-calcite-input-text-h input.sc-calcite-input-text,[scale=m].sc-calcite-input-text-h .prefix.sc-calcite-input-text,[scale=m].sc-calcite-input-text-h .suffix.sc-calcite-input-text{block-size:2rem;padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]) .action-wrapper calcite-button, :host([scale=m]) .action-wrapper calcite-button button*/[scale=m].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text,[scale=m].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text button.sc-calcite-input-text{block-size:2rem}/*!@:host([scale=m]) .clear-button*/[scale=m].sc-calcite-input-text-h .clear-button.sc-calcite-input-text{min-block-size:2rem;min-inline-size:2rem}/*!@:host([scale=l]) input, :host([scale=l]) .prefix, :host([scale=l]) .suffix*/[scale=l].sc-calcite-input-text-h input.sc-calcite-input-text,[scale=l].sc-calcite-input-text-h .prefix.sc-calcite-input-text,[scale=l].sc-calcite-input-text-h .suffix.sc-calcite-input-text{block-size:2.75rem;padding-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]) .action-wrapper calcite-button, :host([scale=l]) .action-wrapper calcite-button button*/[scale=l].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text,[scale=l].sc-calcite-input-text-h .action-wrapper.sc-calcite-input-text calcite-button.sc-calcite-input-text button.sc-calcite-input-text{block-size:2.75rem}/*!@:host([scale=l]) .clear-button*/[scale=l].sc-calcite-input-text-h .clear-button.sc-calcite-input-text{min-block-size:2.75rem;min-inline-size:2.75rem}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-input-text-h[disabled] .sc-calcite-input-text-s>[calcite-hydrated][disabled],[disabled].sc-calcite-input-text-h [calcite-hydrated][disabled].sc-calcite-input-text{opacity:1}/*!@input*/input.sc-calcite-input-text{transition:var(--calcite-animation-timing), block-size 0, outline-offset 0s;-webkit-appearance:none;position:relative;margin:0px;box-sizing:border-box;display:flex;max-block-size:100%;inline-size:100%;max-inline-size:100%;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*/.sc-calcite-input-text-h input.sc-calcite-input-text{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*/.sc-calcite-input-text-h input.sc-calcite-input-text::placeholder,.sc-calcite-input-text-h input.sc-calcite-input-text:-ms-input-placeholder,.sc-calcite-input-text-h input.sc-calcite-input-text::-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}/*!@:host input:focus*/.sc-calcite-input-text-h input.sc-calcite-input-text:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-1)}/*!@:host input[readonly]*/.sc-calcite-input-text-h input[readonly].sc-calcite-input-text{background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium)}/*!@:host input[readonly]:focus*/.sc-calcite-input-text-h input[readonly].sc-calcite-input-text:focus{color:var(--calcite-ui-text-1)}/*!@:host calcite-icon*/.sc-calcite-input-text-h calcite-icon.sc-calcite-input-text{color:var(--calcite-ui-text-3)}/*!@input*/input.sc-calcite-input-text{outline-color:transparent}/*!@input:focus*/input.sc-calcite-input-text:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host([status=invalid]) input*/[status=invalid].sc-calcite-input-text-h input.sc-calcite-input-text{border-color:var(--calcite-ui-danger)}/*!@:host([status=invalid]) input:focus*/[status=invalid].sc-calcite-input-text-h input.sc-calcite-input-text:focus{outline:2px solid var(--calcite-ui-danger);outline-offset:-2px}/*!@:host([scale=s]) .icon*/[scale=s].sc-calcite-input-text-h .icon.sc-calcite-input-text{inset-inline-start:0.5rem}/*!@:host([scale=m]) .icon*/[scale=m].sc-calcite-input-text-h .icon.sc-calcite-input-text{inset-inline-start:0.75rem}/*!@:host([scale=l]) .icon*/[scale=l].sc-calcite-input-text-h .icon.sc-calcite-input-text{inset-inline-start:1rem}/*!@:host([icon][scale=s]) input*/[icon][scale=s].sc-calcite-input-text-h input.sc-calcite-input-text{padding-inline-start:2rem}/*!@:host([icon][scale=m]) input*/[icon][scale=m].sc-calcite-input-text-h input.sc-calcite-input-text{padding-inline-start:2.5rem}/*!@:host([icon][scale=l]) input*/[icon][scale=l].sc-calcite-input-text-h input.sc-calcite-input-text{padding-inline-start:3rem}/*!@.element-wrapper*/.element-wrapper.sc-calcite-input-text{position:relative;order:3;display:inline-flex;flex:1 1 0%;align-items:center}/*!@.icon*/.icon.sc-calcite-input-text{pointer-events:none;position:absolute;z-index:1;display:block;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@input[type=text]::-ms-clear, \ninput[type=text]::-ms-reveal*/input[type=text].sc-calcite-input-text::-ms-clear,input[type=text].sc-calcite-input-text::-ms-reveal{display:none;block-size:0px;inline-size:0px}/*!@.clear-button*/.clear-button.sc-calcite-input-text{pointer-events:initial;order:4;margin:0px;box-sizing:border-box;display:flex;min-block-size:100%;cursor:pointer;align-items:center;justify-content:center;align-self:stretch;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);outline-color:transparent;border-inline-start-width:0px}/*!@.clear-button:hover*/.clear-button.sc-calcite-input-text:hover{background-color:var(--calcite-ui-foreground-2);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button:hover calcite-icon*/.clear-button.sc-calcite-input-text:hover calcite-icon.sc-calcite-input-text{color:var(--calcite-ui-text-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.clear-button:active*/.clear-button.sc-calcite-input-text:active{background-color:var(--calcite-ui-foreground-3)}/*!@.clear-button:active calcite-icon*/.clear-button.sc-calcite-input-text:active calcite-icon.sc-calcite-input-text{color:var(--calcite-ui-text-1)}/*!@.clear-button:focus*/.clear-button.sc-calcite-input-text:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.clear-button:disabled*/.clear-button.sc-calcite-input-text:disabled{opacity:var(--calcite-ui-opacity-disabled)}/*!@.loader*/.loader.sc-calcite-input-text{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}/*!@.action-wrapper*/.action-wrapper.sc-calcite-input-text{order:7;display:flex}/*!@.prefix, \n.suffix*/.prefix.sc-calcite-input-text,.suffix.sc-calcite-input-text{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;user-select:none;align-content: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-text{order:2;border-inline-end-width:0px}/*!@.suffix*/.suffix.sc-calcite-input-text{order:5;border-inline-start-width:0px}/*!@:host([alignment=start]) input*/[alignment=start].sc-calcite-input-text-h input.sc-calcite-input-text{text-align:start}/*!@:host([alignment=end]) input*/[alignment=end].sc-calcite-input-text-h input.sc-calcite-input-text{text-align:end}/*!@.wrapper*/.wrapper.sc-calcite-input-text{position:relative;display:flex;flex-direction:row;align-items:center}/*!@:host(.no-bottom-border) input*/.no-bottom-border.sc-calcite-input-text-h input.sc-calcite-input-text{border-block-end-width:0px}/*!@:host(.border-top-color-one) input*/.border-top-color-one.sc-calcite-input-text-h input.sc-calcite-input-text{border-block-start-color:var(--calcite-ui-border-1)}/*!@.inline-child*/.inline-child.sc-calcite-input-text{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.inline-child .editing-enabled*/.inline-child.sc-calcite-input-text .editing-enabled.sc-calcite-input-text{background-color:inherit}/*!@.inline-child:not(.editing-enabled)*/.inline-child.sc-calcite-input-text:not(.editing-enabled){display:flex;cursor:pointer;border-color:transparent;padding-inline-start:0}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-input-text-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- /**
- * @slot action - A slot for positioning a button next to the component.
- */
- class InputText {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalInputTextFocus = createEvent(this, "calciteInternalInputTextFocus", 7);
- this.calciteInternalInputTextBlur = createEvent(this, "calciteInternalInputTextBlur", 7);
- this.calciteInputTextInput = createEvent(this, "calciteInputTextInput", 7);
- this.calciteInputTextChange = createEvent(this, "calciteInputTextChange", 7);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** Specifies the text alignment of the component's value. */
- this.alignment = "start";
- /**
- * When `true`, the component is focused on page load.
- *
- * @mdn [autofocus](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus)
- */
- this.autofocus = false;
- /**
- * When `true`, a clear button is displayed when the component has a value.
- */
- this.clearable = false;
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- *
- * @mdn [disabled](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled)
- */
- this.disabled = false;
- /**
- * When `true`, the component will not be visible.
- *
- * @mdn [hidden](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden)
- */
- this.hidden = false;
- /**
- * Accessible name that will appear while loading.
- *
- * @default "Loading"
- */
- this.intlLoading = TEXT$v.loading;
- /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
- this.iconFlipRtl = false;
- /** When `true`, the component is in the loading state and `calcite-progress` is displayed. */
- this.loading = false;
- /**
- * When `true`, the component's value can be read, but cannot be modified.
- *
- * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
- */
- this.readOnly = false;
- /** When `true`, the component must have a value in order for the form to submit. */
- this.required = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- /** Specifies the status of the input field, which determines message and icons. */
- this.status = "idle";
- /**
- * @internal
- */
- this.editingEnabled = false;
- /** The component's value. */
- this.value = "";
- this.previousValueOrigin = "initial";
- this.mutationObserver = createObserver();
- this.userChangedValue = false;
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.keyDownHandler = (event) => {
- if (this.readOnly || this.disabled) {
- return;
- }
- if (this.isClearable && event.key === "Escape") {
- this.clearInputTextValue(event);
- event.preventDefault();
- }
- if (event.key === "Enter" && !event.defaultPrevented) {
- if (submitForm(this)) {
- event.preventDefault();
- }
- }
- };
- this.clearInputTextValue = (nativeEvent) => {
- this.setValue({
- committing: true,
- nativeEvent,
- origin: "user",
- value: ""
- });
- };
- this.emitChangeIfUserModified = () => {
- if (this.previousValueOrigin === "user" && this.value !== this.previousEmittedValue) {
- this.calciteInputTextChange.emit();
- }
- this.previousEmittedValue = this.value;
- };
- this.inputTextBlurHandler = () => {
- this.calciteInternalInputTextBlur.emit({
- element: this.childEl,
- value: this.value
- });
- this.emitChangeIfUserModified();
- };
- this.inputTextFocusHandler = (event) => {
- const slottedActionEl = getSlotted(this.el, "action");
- if (event.target !== slottedActionEl) {
- this.setFocus();
- }
- this.calciteInternalInputTextFocus.emit({
- element: this.childEl,
- value: this.value
- });
- };
- this.inputTextInputHandler = (nativeEvent) => {
- if (this.disabled || this.readOnly) {
- return;
- }
- this.setValue({
- nativeEvent,
- origin: "user",
- value: nativeEvent.target.value
- });
- };
- this.inputTextKeyDownHandler = (event) => {
- if (this.disabled || this.readOnly) {
- return;
- }
- if (event.key === "Enter") {
- this.emitChangeIfUserModified();
- }
- };
- this.hiddenInputChangeHandler = (event) => {
- if (event.target.name === this.name) {
- this.setValue({
- value: event.target.value,
- origin: "direct"
- });
- }
- event.stopPropagation();
- };
- this.setChildElRef = (el) => {
- this.childEl = el;
- };
- this.setInputValue = (newInputValue) => {
- if (!this.childEl) {
- return;
- }
- this.childEl.value = newInputValue;
- };
- this.setPreviousEmittedValue = (newPreviousEmittedValue) => {
- this.previousEmittedValue = newPreviousEmittedValue;
- };
- this.setPreviousValue = (newPreviousValue) => {
- this.previousValue = newPreviousValue;
- };
- this.setValue = ({ committing = false, nativeEvent, origin, previousValue, value }) => {
- this.setPreviousValue(previousValue || this.value);
- this.previousValueOrigin = origin;
- this.userChangedValue = origin === "user" && value !== this.value;
- this.value = value;
- if (origin === "direct") {
- this.setInputValue(value);
- }
- if (nativeEvent) {
- const calciteInputTextInputEvent = this.calciteInputTextInput.emit({
- element: this.childEl,
- nativeEvent,
- value: this.value
- });
- if (calciteInputTextInputEvent.defaultPrevented) {
- this.value = this.previousValue;
- }
- else if (committing) {
- this.emitChangeIfUserModified();
- }
- }
- };
- }
- disabledWatcher() {
- this.setDisabledAction();
- }
- valueWatcher(newValue, previousValue) {
- if (!this.userChangedValue) {
- this.setValue({
- origin: "direct",
- previousValue,
- value: !newValue ? "" : newValue
- });
- }
- this.userChangedValue = false;
- }
- updateRequestedIcon() {
- this.requestedIcon = setRequestedIcon({}, this.icon, "text");
- }
- get isClearable() {
- return this.clearable && this.value.length > 0;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- this.scale = getElementProp(this.el, "scale", this.scale);
- this.status = getElementProp(this.el, "status", this.status);
- this.inlineEditableEl = this.el.closest("calcite-inline-editable");
- if (this.inlineEditableEl) {
- this.editingEnabled = this.inlineEditableEl.editingEnabled || false;
- }
- this.setPreviousEmittedValue(this.value);
- this.setPreviousValue(this.value);
- connectLabel(this);
- connectForm(this);
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
- this.setDisabledAction();
- this.el.addEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
- }
- disconnectedCallback() {
- var _a;
- disconnectLabel(this);
- disconnectForm(this);
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- this.el.removeEventListener("calciteInternalHiddenInputChange", this.hiddenInputChangeHandler);
- }
- componentWillLoad() {
- this.requestedIcon = setRequestedIcon({}, this.icon, "text");
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.childEl) === null || _a === void 0 ? void 0 : _a.focus();
- }
- /** Selects all text of the component's `value`. */
- async selectText() {
- var _a;
- (_a = this.childEl) === null || _a === void 0 ? void 0 : _a.select();
- }
- onLabelClick() {
- this.setFocus();
- }
- onFormReset() {
- this.setValue({
- origin: "reset",
- value: this.defaultValue
- });
- }
- syncHiddenFormInput(input) {
- if (this.minLength != null) {
- input.minLength = this.minLength;
- }
- if (this.maxLength != null) {
- input.maxLength = this.maxLength;
- }
- }
- setDisabledAction() {
- const slottedActionEl = getSlotted(this.el, "action");
- if (!slottedActionEl) {
- return;
- }
- this.disabled
- ? slottedActionEl.setAttribute("disabled", "")
- : slottedActionEl.removeAttribute("disabled");
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const dir = getElementDir(this.el);
- const loader = (hAsync("div", { class: CSS$s.loader }, hAsync("calcite-progress", { label: this.intlLoading, type: "indeterminate" })));
- const inputClearButton = (hAsync("button", { "aria-label": this.intlClear || TEXT$b.clear, class: CSS$s.clearButton, disabled: this.disabled || this.readOnly, onClick: this.clearInputTextValue, tabIndex: -1, type: "button" }, hAsync("calcite-icon", { icon: "x", scale: "s" })));
- const iconEl = (hAsync("calcite-icon", { class: CSS$s.inputIcon, flipRtl: this.iconFlipRtl, icon: this.requestedIcon, scale: "s" }));
- const prefixText = hAsync("div", { class: CSS$s.prefix }, this.prefixText);
- const suffixText = hAsync("div", { class: CSS$s.suffix }, this.suffixText);
- const childEl = (hAsync("input", { "aria-label": getLabelText(this), autofocus: this.autofocus ? true : null, class: {
- [CSS$s.editingEnabled]: this.editingEnabled,
- [CSS$s.inlineChild]: !!this.inlineEditableEl
- }, defaultValue: this.defaultValue, disabled: this.disabled ? true : null, enterKeyHint: this.el.enterKeyHint, inputMode: this.el.inputMode, maxLength: this.maxLength, minLength: this.minLength, name: this.name, onBlur: this.inputTextBlurHandler, onFocus: this.inputTextFocusHandler, onInput: this.inputTextInputHandler, onKeyDown: this.inputTextKeyDownHandler, placeholder: this.placeholder || "", readOnly: this.readOnly, ref: this.setChildElRef, required: this.required ? true : null, tabIndex: this.disabled || (this.inlineEditableEl && !this.editingEnabled) ? -1 : null, type: "text", value: this.value }));
- return (hAsync(Host, { onClick: this.inputTextFocusHandler, onKeyDown: this.keyDownHandler }, hAsync("div", { class: { [CSS$s.inputWrapper]: true, [CSS_UTILITY.rtl]: dir === "rtl" } }, this.prefixText ? prefixText : null, hAsync("div", { class: CSS$s.wrapper }, childEl, this.isClearable ? inputClearButton : null, this.requestedIcon ? iconEl : null, this.loading ? loader : null), hAsync("div", { class: CSS$s.actionWrapper }, hAsync("slot", { name: SLOTS$f.action })), this.suffixText ? suffixText : null, hAsync(HiddenFormInputSlot, { component: this }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["disabledWatcher"],
- "value": ["valueWatcher"],
- "icon": ["updateRequestedIcon"]
- }; }
- static get style() { return inputTextCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-input-text",
- "$members$": {
- "alignment": [513],
- "autofocus": [516],
- "clearable": [516],
- "disabled": [516],
- "hidden": [516],
- "icon": [520],
- "intlClear": [1, "intl-clear"],
- "intlLoading": [1, "intl-loading"],
- "iconFlipRtl": [516, "icon-flip-rtl"],
- "label": [1],
- "loading": [516],
- "maxLength": [514, "max-length"],
- "minLength": [514, "min-length"],
- "name": [513],
- "placeholder": [1],
- "prefixText": [1, "prefix-text"],
- "readOnly": [516, "read-only"],
- "required": [516],
- "scale": [1537],
- "status": [1537],
- "suffixText": [1, "suffix-text"],
- "editingEnabled": [1540, "editing-enabled"],
- "value": [1025],
- "setFocus": [64],
- "selectText": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["alignment", "alignment"], ["autofocus", "autofocus"], ["clearable", "clearable"], ["disabled", "disabled"], ["hidden", "hidden"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["loading", "loading"], ["maxLength", "max-length"], ["minLength", "min-length"], ["name", "name"], ["readOnly", "read-only"], ["required", "required"], ["scale", "scale"], ["status", "status"], ["editingEnabled", "editing-enabled"]]
- }; }
- }
- const maxTenthForMinuteAndSecond = 5;
- function createLocaleDateTimeFormatter(locale, numberingSystem, includeSeconds = true) {
- try {
- const options = {
- hour: "2-digit",
- minute: "2-digit",
- timeZone: "UTC",
- numberingSystem: getSupportedNumberingSystem(numberingSystem)
- };
- if (includeSeconds) {
- options.second = "2-digit";
- }
- return new Intl.DateTimeFormat(getSupportedLocale(locale), options);
- }
- catch (error) {
- throw new Error(`Invalid locale supplied while attempting to create a DateTime formatter: ${locale}`);
- }
- }
- function formatTimePart(number) {
- const numberAsString = number.toString();
- return number >= 0 && number <= 9 ? numberAsString.padStart(2, "0") : numberAsString;
- }
- function formatTimeString(value) {
- if (!isValidTime(value)) {
- return null;
- }
- const [hourString, minuteString, secondString] = value.split(":");
- const hour = formatTimePart(parseInt(hourString));
- const minute = formatTimePart(parseInt(minuteString));
- if (secondString) {
- const second = formatTimePart(parseInt(secondString));
- return `${hour}:${minute}:${second}`;
- }
- return `${hour}:${minute}`;
- }
- function getLocaleHourCycle(locale, numberingSystem) {
- const formatter = createLocaleDateTimeFormatter(locale, numberingSystem);
- const parts = formatter.formatToParts(new Date(Date.UTC(0, 0, 0, 0, 0, 0)));
- return getLocalizedTimePart("meridiem", parts) ? "12" : "24";
- }
- function getLocalizedTimePart(part, parts) {
- var _a, _b, _c, _d;
- if (!part || !parts) {
- return null;
- }
- if (part === "hourSuffix") {
- const hourIndex = parts.indexOf(parts.find(({ type }) => type === "hour"));
- const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
- const hourSuffix = parts[hourIndex + 1];
- return hourSuffix && hourSuffix.type === "literal" && minuteIndex - hourIndex === 2
- ? ((_a = hourSuffix.value) === null || _a === void 0 ? void 0 : _a.trim()) || null
- : null;
- }
- if (part === "minuteSuffix") {
- const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
- const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
- const minuteSuffix = parts[minuteIndex + 1];
- return minuteSuffix && minuteSuffix.type === "literal" && secondIndex - minuteIndex === 2
- ? ((_b = minuteSuffix.value) === null || _b === void 0 ? void 0 : _b.trim()) || null
- : null;
- }
- if (part === "secondSuffix") {
- const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
- const secondSuffix = parts[secondIndex + 1];
- return secondSuffix && secondSuffix.type === "literal" ? ((_c = secondSuffix.value) === null || _c === void 0 ? void 0 : _c.trim()) || null : null;
- }
- return ((_d = parts.find(({ type }) => (part == "meridiem" ? type === "dayPeriod" : type === part))) === null || _d === void 0 ? void 0 : _d.value) || null;
- }
- function getMeridiem(hour) {
- if (!isValidNumber(hour)) {
- return null;
- }
- const hourAsNumber = parseInt(hour);
- return hourAsNumber >= 0 && hourAsNumber <= 11 ? "AM" : "PM";
- }
- function isValidTime(value) {
- if (!value || value.startsWith(":") || value.endsWith(":")) {
- return false;
- }
- const splitValue = value.split(":");
- const validLength = splitValue.length > 1 && splitValue.length < 4;
- if (!validLength) {
- return false;
- }
- const [hour, minute, second] = splitValue;
- const hourAsNumber = parseInt(splitValue[0]);
- const minuteAsNumber = parseInt(splitValue[1]);
- const secondAsNumber = parseInt(splitValue[2]);
- const hourValid = isValidNumber(hour) && hourAsNumber >= 0 && hourAsNumber < 24;
- const minuteValid = isValidNumber(minute) && minuteAsNumber >= 0 && minuteAsNumber < 60;
- const secondValid = isValidNumber(second) && secondAsNumber >= 0 && secondAsNumber < 60;
- if ((hourValid && minuteValid && !second) || (hourValid && minuteValid && secondValid)) {
- return true;
- }
- }
- function isValidTimePart(value, part) {
- if (part === "meridiem") {
- return value === "AM" || value === "PM";
- }
- if (!isValidNumber(value)) {
- return false;
- }
- const valueAsNumber = Number(value);
- return part === "hour" ? valueAsNumber >= 0 && valueAsNumber < 24 : valueAsNumber >= 0 && valueAsNumber < 60;
- }
- function localizeTimePart({ value, part, locale, numberingSystem }) {
- if (!isValidTimePart(value, part)) {
- return;
- }
- const valueAsNumber = parseInt(value);
- 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));
- if (!date) {
- return;
- }
- const formatter = createLocaleDateTimeFormatter(locale, numberingSystem);
- const parts = formatter.formatToParts(date);
- return getLocalizedTimePart(part, parts);
- }
- function localizeTimeString({ value, locale, numberingSystem, includeSeconds = true }) {
- if (!isValidTime(value)) {
- return null;
- }
- const { hour, minute, second = "0" } = parseTimeString(value);
- const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
- const formatter = createLocaleDateTimeFormatter(locale, numberingSystem, includeSeconds);
- return (formatter === null || formatter === void 0 ? void 0 : formatter.format(dateFromTimeString)) || null;
- }
- function localizeTimeStringToParts({ value, locale, numberingSystem }) {
- if (!isValidTime(value)) {
- return null;
- }
- const { hour, minute, second = "0" } = parseTimeString(value);
- const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
- if (dateFromTimeString) {
- const formatter = createLocaleDateTimeFormatter(locale, numberingSystem);
- const parts = formatter.formatToParts(dateFromTimeString);
- return {
- localizedHour: getLocalizedTimePart("hour", parts),
- localizedHourSuffix: getLocalizedTimePart("hourSuffix", parts),
- localizedMinute: getLocalizedTimePart("minute", parts),
- localizedMinuteSuffix: getLocalizedTimePart("minuteSuffix", parts),
- localizedSecond: getLocalizedTimePart("second", parts),
- localizedSecondSuffix: getLocalizedTimePart("secondSuffix", parts),
- localizedMeridiem: getLocalizedTimePart("meridiem", parts)
- };
- }
- return null;
- }
- function getTimeParts({ value, locale, numberingSystem }) {
- if (!isValidTime(value)) {
- return null;
- }
- const { hour, minute, second = "0" } = parseTimeString(value);
- const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
- if (dateFromTimeString) {
- const formatter = createLocaleDateTimeFormatter(locale, numberingSystem);
- const parts = formatter.formatToParts(dateFromTimeString);
- return parts;
- }
- return null;
- }
- function parseTimeString(value) {
- if (isValidTime(value)) {
- const [hour, minute, second] = value.split(":");
- return {
- hour,
- minute,
- second
- };
- }
- return {
- hour: null,
- minute: null,
- second: null
- };
- }
- const inputTimePickerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-input-time-picker{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-input-time-picker{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-input-time-picker{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-input-time-picker{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-input-time-picker:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-input-time-picker:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-input-time-picker-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-input-time-picker-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-input-time-picker-h{display:inline-block;-webkit-user-select:none;user-select:none}/*!@: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]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- class InputTimePicker {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInputTimePickerChange = createEvent(this, "calciteInputTimePickerChange", 7);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, the component is active.
- *
- * @deprecated Use `open` instead.
- */
- this.active = false;
- /** When `true`, displays the `calcite-time-picker` component. */
- this.open = false;
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /**
- * When `true`, the component's value can be read, but controls are not accessible and the value cannot be modified.
- *
- * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
- */
- this.readOnly = false;
- /**
- * When `true`, the component must have a value in order for the form to submit.
- *
- * @internal
- */
- this.required = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- /**
- * Determines the type of positioning to use for the overlaid content.
- *
- * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
- *
- * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
- *
- */
- this.overlayPositioning = "absolute";
- /**
- * Determines where the popover will be positioned relative to the input.
- *
- * @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
- */
- this.placement = "auto";
- /** Specifies the granularity the component's `value` must adhere to (in seconds). */
- this.step = 60;
- /** The component's value in UTC (always 24-hour format). */
- this.value = null;
- /** whether the value of the input was changed as a result of user typing or not */
- this.internalValueChange = false;
- this.previousValidValue = null;
- this.referenceElementId = `input-time-picker-${guid()}`;
- //--------------------------------------------------------------------------
- //
- // State
- //
- //--------------------------------------------------------------------------
- this.effectiveLocale = "";
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- this.calciteInternalInputBlurHandler = () => {
- this.open = false;
- const shouldIncludeSeconds = this.shouldIncludeSeconds();
- const { effectiveLocale: locale, numberingSystem, value, calciteInputEl } = this;
- numberStringFormatter.numberFormatOptions = {
- locale,
- numberingSystem,
- useGrouping: false
- };
- const delocalizedValue = numberStringFormatter.delocalize(calciteInputEl.value);
- const localizedInputValue = localizeTimeString({
- value: delocalizedValue,
- includeSeconds: shouldIncludeSeconds,
- locale,
- numberingSystem
- });
- this.setInputValue(localizedInputValue ||
- localizeTimeString({ value, locale, numberingSystem, includeSeconds: shouldIncludeSeconds }));
- };
- this.calciteInternalInputFocusHandler = (event) => {
- if (!this.readOnly) {
- this.open = true;
- event.stopPropagation();
- }
- };
- this.calciteInputInputHandler = (event) => {
- const target = event.target;
- numberStringFormatter.numberFormatOptions = {
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- useGrouping: false
- };
- const delocalizedValue = numberStringFormatter.delocalize(target.value);
- this.setValue({ value: delocalizedValue });
- // only translate the numerals until blur
- const localizedValue = delocalizedValue
- .split("")
- .map((char) => numberKeys.includes(char)
- ? numberStringFormatter.numberFormatter.format(Number(char))
- : char)
- .join("");
- this.setInputValue(localizedValue);
- };
- this.timePickerChangeHandler = (event) => {
- event.stopPropagation();
- const target = event.target;
- const value = target.value;
- this.setValue({ value, origin: "time-picker" });
- };
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.keyDownHandler = (event) => {
- const { defaultPrevented, key } = event;
- if (defaultPrevented) {
- return;
- }
- if (key === "Enter") {
- if (submitForm(this)) {
- event.preventDefault();
- }
- }
- if (key === "Escape" && this.open) {
- this.open = false;
- event.preventDefault();
- }
- };
- this.setCalcitePopoverEl = (el) => {
- this.popoverEl = el;
- };
- this.setCalciteInputEl = (el) => {
- this.calciteInputEl = el;
- };
- this.setCalciteTimePickerEl = (el) => {
- this.calciteTimePickerEl = el;
- };
- this.setInputValue = (newInputValue) => {
- if (!this.calciteInputEl) {
- return;
- }
- this.calciteInputEl.value = newInputValue;
- };
- this.setValue = ({ value, origin = "input" }) => {
- const previousValue = this.value;
- const newValue = formatTimeString(value);
- const newLocalizedValue = localizeTimeString({
- value: newValue,
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- includeSeconds: this.shouldIncludeSeconds()
- });
- this.internalValueChange = origin !== "external" && origin !== "loading";
- const shouldEmit = origin !== "loading" &&
- origin !== "external" &&
- ((value !== this.previousValidValue && !value) ||
- !!(!this.previousValidValue && newValue) ||
- (newValue !== this.previousValidValue && newValue));
- if (value) {
- if (shouldEmit) {
- this.previousValidValue = newValue;
- }
- if (newValue && newValue !== this.value) {
- this.value = newValue;
- }
- this.localizedValue = newLocalizedValue;
- }
- else {
- this.value = value;
- this.localizedValue = null;
- }
- if (origin === "time-picker" || origin === "external") {
- this.setInputValue(newLocalizedValue);
- }
- if (shouldEmit) {
- const changeEvent = this.calciteInputTimePickerChange.emit();
- if (changeEvent.defaultPrevented) {
- this.internalValueChange = false;
- this.value = previousValue;
- this.setInputValue(previousValue);
- this.previousValidValue = previousValue;
- }
- else {
- this.previousValidValue = newValue;
- }
- }
- };
- }
- activeHandler(value) {
- this.open = value;
- }
- openHandler(value) {
- this.active = value;
- if (this.disabled || this.readOnly) {
- this.open = false;
- return;
- }
- if (value) {
- this.reposition(true);
- }
- }
- handleDisabledAndReadOnlyChange(value) {
- if (!value) {
- this.open = false;
- }
- }
- localeChanged() {
- updateEffectiveLocale(this);
- }
- valueWatcher(newValue) {
- if (!this.internalValueChange) {
- this.setValue({ value: newValue, origin: "external" });
- }
- this.internalValueChange = false;
- }
- effectiveLocaleWatcher() {
- this.setInputValue(localizeTimeString({
- value: this.value,
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- includeSeconds: this.shouldIncludeSeconds()
- }));
- }
- clickHandler(event) {
- if (event.composedPath().includes(this.calciteTimePickerEl)) {
- return;
- }
- this.setFocus();
- }
- timePickerBlurHandler(event) {
- event.preventDefault();
- event.stopPropagation();
- this.open = false;
- }
- timePickerFocusHandler(event) {
- event.preventDefault();
- event.stopPropagation();
- if (!this.readOnly) {
- this.open = true;
- }
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.calciteInputEl) === null || _a === void 0 ? void 0 : _a.setFocus();
- }
- /**
- * Updates the position of the component.
- *
- * @param delayed
- */
- async reposition(delayed = false) {
- var _a;
- (_a = this.popoverEl) === null || _a === void 0 ? void 0 : _a.reposition(delayed);
- }
- onLabelClick() {
- this.setFocus();
- }
- shouldIncludeSeconds() {
- return this.step < 60;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- connectLocalized(this);
- const { active, open } = this;
- if (this.value) {
- this.setValue({ value: isValidTime(this.value) ? this.value : undefined, origin: "loading" });
- }
- connectLabel(this);
- connectForm(this);
- if (open) {
- this.active = open;
- }
- else if (active) {
- this.open = active;
- }
- }
- componentDidLoad() {
- this.setInputValue(this.localizedValue);
- }
- disconnectedCallback() {
- disconnectLabel(this);
- disconnectForm(this);
- disconnectLocalized(this);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const popoverId = `${this.referenceElementId}-popover`;
- 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), onCalciteInputInput: this.calciteInputInputHandler, onCalciteInternalInputBlur: this.calciteInternalInputBlurHandler, onCalciteInternalInputFocus: this.calciteInternalInputFocusHandler, readOnly: this.readOnly, ref: this.setCalciteInputEl, scale: this.scale, step: this.step })), hAsync("calcite-popover", { id: popoverId, label: "Time Picker", open: this.open, overlayPositioning: this.overlayPositioning, placement: this.placement, ref: this.setCalcitePopoverEl, referenceElement: this.referenceElementId, triggerDisabled: true }, 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.effectiveLocale, numberingSystem: this.numberingSystem, onCalciteInternalTimePickerChange: this.timePickerChangeHandler, ref: this.setCalciteTimePickerEl, scale: this.scale, step: this.step, value: this.value })), hAsync(HiddenFormInputSlot, { component: this })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "open": ["openHandler"],
- "disabled": ["handleDisabledAndReadOnlyChange"],
- "readOnly": ["handleDisabledAndReadOnlyChange"],
- "locale": ["localeChanged"],
- "value": ["valueWatcher"],
- "effectiveLocale": ["effectiveLocaleWatcher"]
- }; }
- static get style() { return inputTimePickerCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-input-time-picker",
- "$members$": {
- "active": [1540],
- "open": [1540],
- "disabled": [516],
- "readOnly": [516, "read-only"],
- "intlHour": [1, "intl-hour"],
- "intlHourDown": [1, "intl-hour-down"],
- "intlHourUp": [1, "intl-hour-up"],
- "intlMeridiem": [1, "intl-meridiem"],
- "intlMeridiemDown": [1, "intl-meridiem-down"],
- "intlMeridiemUp": [1, "intl-meridiem-up"],
- "intlMinute": [1, "intl-minute"],
- "intlMinuteDown": [1, "intl-minute-down"],
- "intlMinuteUp": [1, "intl-minute-up"],
- "intlSecond": [1, "intl-second"],
- "intlSecondDown": [1, "intl-second-down"],
- "intlSecondUp": [1, "intl-second-up"],
- "locale": [1025],
- "name": [1],
- "numberingSystem": [1, "numbering-system"],
- "required": [516],
- "scale": [513],
- "overlayPositioning": [1, "overlay-positioning"],
- "placement": [513],
- "step": [2],
- "value": [1025],
- "effectiveLocale": [32],
- "localizedValue": [32],
- "setFocus": [64],
- "reposition": [64]
- },
- "$listeners$": [[0, "click", "clickHandler"], [0, "calciteInternalTimePickerBlur", "timePickerBlurHandler"], [0, "calciteInternalTimePickerFocus", "timePickerFocusHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["open", "open"], ["disabled", "disabled"], ["readOnly", "read-only"], ["required", "required"], ["scale", "scale"], ["placement", "placement"]]
- }; }
- }
- const CSS$r = {
- container: "container"
- };
- const labelCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-label{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-label{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-label{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-label{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-label:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-label:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-label-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-label-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@: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{gap:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host(:not([disable-spacing])[scale=s]) .container*/.sc-calcite-label-h:not([disable-spacing])[scale=s] .container.sc-calcite-label{margin-block-end:var(--calcite-label-margin-bottom, 0.5rem)}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-label-h .container.sc-calcite-label{gap:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host(:not([disable-spacing])[scale=m]) .container*/.sc-calcite-label-h:not([disable-spacing])[scale=m] .container.sc-calcite-label{margin-block-end:var(--calcite-label-margin-bottom, 0.75rem)}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-label-h .container.sc-calcite-label{gap:0.5rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host(:not([disable-spacing])[scale=l]) .container*/.sc-calcite-label-h:not([disable-spacing])[scale=l] .container.sc-calcite-label{margin-block-end:var(--calcite-label-margin-bottom, 1rem)}/*!@:host .container*/.sc-calcite-label-h .container.sc-calcite-label{margin-inline:0px;margin-block-start:0px;inline-size: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:flex;flex-direction:column}/*!@:host([layout=inline]) .container, \n: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:flex;flex-direction:row;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{justify-content:space-between}/*!@: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]), \n: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}";
- /**
- * @slot - A slot for adding text and a component that can be labeled.
- */
- class Label {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalLabelClick = createEvent(this, "calciteInternalLabelClick", 2);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** Specifies the text alignment of the component. */
- this.alignment = "start";
- /**
- * Specifies the status of the component and any child input, or input messages.
- *
- * @deprecated Set directly on the component the label is bound to instead.
- */
- this.status = "idle";
- /** Specifies the size of the component. */
- this.scale = "m";
- /** Defines the layout of the label in relation to the component. Use `"inline"` positions to wrap the label and component on the same line. */
- this.layout = "default";
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- *
- * @deprecated Use the `disabled` property on the component the label is bound to instead.
- */
- this.disabled = false;
- /**
- * When `true`, disables the component's spacing.
- *
- * @deprecated Set the `--calcite-label-margin-bottom` css variable to `0` instead.
- */
- this.disableSpacing = false;
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.labelClickHandler = (event) => {
- this.calciteInternalLabelClick.emit({
- sourceEvent: event
- });
- };
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- document.dispatchEvent(new CustomEvent(labelConnectedEvent));
- }
- disconnectedCallback() {
- document.dispatchEvent(new CustomEvent(labelDisconnectedEvent));
- }
- render() {
- return (hAsync(Host, { onClick: this.labelClickHandler }, hAsync("div", { class: CSS$r.container }, hAsync("slot", null))));
- }
- get el() { return getElement(this); }
- static get style() { return labelCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-label",
- "$members$": {
- "alignment": [513],
- "status": [513],
- "for": [513],
- "scale": [513],
- "layout": [513],
- "disabled": [516],
- "disableSpacing": [516, "disable-spacing"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["alignment", "alignment"], ["status", "status"], ["for", "for"], ["scale", "scale"], ["layout", "layout"], ["disabled", "disabled"], ["disableSpacing", "disable-spacing"]]
- }; }
- }
- const linkCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-link{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-link{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-link{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-link{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-link:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-link:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-link-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-link-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-link-h{display:inline}/*!@:host a, \n:host span*/.sc-calcite-link-h a.sc-calcite-link,.sc-calcite-link-h span.sc-calcite-link{position:relative;display:flex;cursor:pointer;align-items:center;justify-content:center;border-radius:0px;border-style:none;font-family:inherit;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 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, \n:host span*/.sc-calcite-link-h a.sc-calcite-link,.sc-calcite-link-h span.sc-calcite-link{outline-color:transparent}/*!@:host a:focus, \n: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{inline-size:1em;block-size:1em;min-inline-size:unset;min-block-size:unset}/*!@.calcite-link--icon*/.calcite-link--icon.sc-calcite-link{vertical-align:text-top;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;margin-block-start:0.125rem}/*!@:host .calcite-link--icon.icon-start*/.sc-calcite-link-h .calcite-link--icon.icon-start.sc-calcite-link{margin-inline-end:0.5rem}/*!@:host .calcite-link--icon.icon-end*/.sc-calcite-link-h .calcite-link--icon.icon-end.sc-calcite-link{margin-inline-start:0.5rem}/*!@:host span, \n: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);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;line-height:inherit;white-space:initial;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]) ::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}";
- /** Any attributes placed on <calcite-link> component will propagate to the rendered child */
- /** Passing a 'href' will render an anchor link, instead of a span. Role will be set to link, or link, depending on this. */
- /** It is the consumers responsibility to add aria information, rel, target, for links, and any link attributes for form submission */
- /** @slot - A slot for adding text. */
- class Link {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /**
- * Prompts the user to save the linked URL instead of navigating to it. Can be used with or without a value:
- * Without a value, the browser will suggest a filename/extension
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download.
- */
- this.download = false;
- this.childElClickHandler = (event) => {
- if (!event.isTrusted) {
- // click was invoked internally, we stop it here
- event.stopPropagation();
- }
- };
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.storeTagRef = (el) => {
- this.childEl = el;
- };
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidRender() {
- updateHostInteraction(this);
- }
- render() {
- const { download, el } = this;
- const dir = getElementDir(el);
- const childElType = this.href ? "a" : "span";
- const iconStartEl = (hAsync("calcite-icon", { class: "calcite-link--icon icon-start", flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
- const iconEndEl = (hAsync("calcite-icon", { class: "calcite-link--icon icon-end", flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
- const Tag = childElType;
- const role = childElType === "span" ? "link" : null;
- const tabIndex = childElType === "span" ? 0 : null;
- return (hAsync(Host, { role: "presentation" }, hAsync(Tag, { class: { [CSS_UTILITY.rtl]: dir === "rtl" },
- /*
- When the 'download' property of type 'boolean | string' is set to true, the value is "".
- This works around that issue for now.
- */
- download: Tag === "a" && (download === "" || download) ? download : null, href: Tag === "a" && this.href, onClick: this.childElClickHandler, 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)));
- }
- //--------------------------------------------------------------------------
- //
- // Events
- //
- //--------------------------------------------------------------------------
- clickHandler(event) {
- // forwards the click() to the internal link for non user-initiated events
- if (!event.isTrusted) {
- this.childEl.click();
- }
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- focusElement(this.childEl);
- }
- get el() { return getElement(this); }
- static get style() { return linkCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-link",
- "$members$": {
- "disabled": [516],
- "download": [520],
- "href": [513],
- "iconEnd": [513, "icon-end"],
- "iconFlipRtl": [513, "icon-flip-rtl"],
- "iconStart": [513, "icon-start"],
- "rel": [1],
- "target": [1],
- "setFocus": [64]
- },
- "$listeners$": [[0, "click", "clickHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["download", "download"], ["href", "href"], ["iconEnd", "icon-end"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"]]
- }; }
- }
- const CSS$q = {
- container: "container"
- };
- const listCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-list{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-list{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-list{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-list{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-list:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-list:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-list-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-list-h{display:block}/*!@: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{box-sizing:border-box;display:flex;inline-size:100%;flex-direction:column;background-color:transparent}/*!@.container **/.container.sc-calcite-list *.sc-calcite-list{box-sizing:border-box}/*!@::slotted(calcite-list-item)*/.sc-calcite-list-s>calcite-list-item{margin-block-end:1px;--tw-shadow:0 1px 0 var(--calcite-ui-border-3);--tw-shadow-colored:0 1px 0 var(--tw-shadow-color);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;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}";
- /**
- * A general purpose list that enables users to construct list items that conform to Calcite styling.
- *
- * @slot - A slot for adding `calcite-list-item` elements.
- */
- class List$1 {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- const firstListItem = this.el.querySelector(`calcite-list-item:not([non-interactive])`);
- firstListItem === null || firstListItem === void 0 ? void 0 : firstListItem.setFocus();
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- return (hAsync(Host, { role: "list" }, hAsync("div", { class: CSS$q.container }, hAsync("slot", null))));
- }
- get el() { return getElement(this); }
- static get style() { return listCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-list",
- "$members$": {
- "disabled": [516],
- "headingLevel": [514, "heading-level"],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["headingLevel", "heading-level"]]
- }; }
- }
- const CSS$p = {
- container: "container",
- contentContainer: "content-container",
- nestedContainer: "nested-container",
- contentContainerButton: "content-container--button",
- content: "content",
- actionsStart: "actions-start",
- contentStart: "content-start",
- label: "label",
- description: "description",
- contentEnd: "content-end",
- actionsEnd: "actions-end",
- hasCenterContent: "has-center-content"
- };
- const SLOTS$e = {
- actionsStart: "actions-start",
- contentStart: "content-start",
- contentEnd: "content-end",
- actionsEnd: "actions-end"
- };
- const listItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-list-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-list-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-list-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-list-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-list-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-list-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-list-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-list-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-list-item-h{display:flex;flex-direction:column}/*!@: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{box-sizing:border-box;display:flex;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{box-sizing:border-box}/*!@.nested-container*/.nested-container.sc-calcite-list-item{display:flex;flex-direction:column;background-color:var(--calcite-ui-foreground-1)}/*!@.content-container*/.content-container.sc-calcite-list-item{display:flex;flex:1 1 auto;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-color:transparent}/*!@.content-container--button*/.content-container--button.sc-calcite-list-item{cursor:pointer;border-style:none;background-color:var(--calcite-ui-foreground-1);outline-color:transparent;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, \n.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, \n.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:flex;flex:1 1 auto;flex-direction:column;justify-content:center;padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--2);line-height:1.375}/*!@.label, \n.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, \n.description:only-child*/.label.sc-calcite-list-item:only-child,.description.sc-calcite-list-item:only-child{margin:0px;padding-block:0.25rem}/*!@.label*/.label.sc-calcite-list-item{color:var(--calcite-ui-text-1)}/*!@.description*/.description.sc-calcite-list-item{margin-block-start:0.125rem;color:var(--calcite-ui-text-3)}/*!@.content-start*/.content-start.sc-calcite-list-item{justify-content:flex-start}/*!@.content-end*/.content-end.sc-calcite-list-item{justify-content:flex-end}/*!@.content-start, \n.content-end*/.content-start.sc-calcite-list-item,.content-end.sc-calcite-list-item{flex:1 1 auto}/*!@.has-center-content .content-start, \n.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{flex:0 1 auto}/*!@.actions-start, \n.actions-end, \n.content-start, \n.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:flex;align-items:center}/*!@.content-start ::slotted(calcite-icon), \n.content-end ::slotted(calcite-icon)*/.content-start .sc-calcite-list-item-s>calcite-icon,.content-end .sc-calcite-list-item-s>calcite-icon{margin-inline:0.75rem;align-self:center}/*!@.actions-start ::slotted(calcite-action), \n.actions-end ::slotted(calcite-action)*/.actions-start .sc-calcite-list-item-s>calcite-action,.actions-end .sc-calcite-list-item-s>calcite-action{align-self:stretch;color:inherit}/*!@::slotted(calcite-list-item-group),\n::slotted(calcite-list-item)*/.sc-calcite-list-item-s>calcite-list-item-group,.sc-calcite-list-item-s>calcite-list-item{padding-inline-start:0.5rem}";
- /**
- * @slot - A slot for adding `calcite-list-item` and `calcite-list-item-group` elements.
- * @slot actions-start - A slot for adding actionable `calcite-action` elements before the content of the component.
- * @slot content-start - A slot for adding non-actionable elements before the label and description of the component.
- * @slot content-end - A slot for adding non-actionable elements after the label and description of the component.
- * @slot actions-end - A slot for adding actionable `calcite-action` elements after the content of the component.
- */
- class ListItem {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, prevents the content of the component from user interaction.
- */
- this.nonInteractive = false;
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.focusEl) === null || _a === void 0 ? void 0 : _a.focus();
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderActionsStart() {
- const { el } = this;
- return getSlotted(el, SLOTS$e.actionsStart) ? (hAsync("div", { class: CSS$p.actionsStart }, hAsync("slot", { name: SLOTS$e.actionsStart }))) : null;
- }
- renderActionsEnd() {
- const { el } = this;
- return getSlotted(el, SLOTS$e.actionsEnd) ? (hAsync("div", { class: CSS$p.actionsEnd }, hAsync("slot", { name: SLOTS$e.actionsEnd }))) : null;
- }
- renderContentStart() {
- const { el } = this;
- return getSlotted(el, SLOTS$e.contentStart) ? (hAsync("div", { class: CSS$p.contentStart }, hAsync("slot", { name: SLOTS$e.contentStart }))) : null;
- }
- renderContentEnd() {
- const { el } = this;
- return getSlotted(el, SLOTS$e.contentEnd) ? (hAsync("div", { class: CSS$p.contentEnd }, hAsync("slot", { name: SLOTS$e.contentEnd }))) : null;
- }
- renderContent() {
- const { label, description } = this;
- 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;
- }
- renderContentContainer() {
- const { description, disabled, label, nonInteractive } = this;
- const hasCenterContent = !!label || !!description;
- const content = [this.renderContentStart(), this.renderContent(), this.renderContentEnd()];
- return !nonInteractive ? (hAsync("button", { class: {
- [CSS$p.contentContainer]: true,
- [CSS$p.contentContainerButton]: true,
- [CSS$p.hasCenterContent]: hasCenterContent
- }, disabled: disabled, ref: (focusEl) => (this.focusEl = focusEl) }, content)) : (hAsync("div", { class: { [CSS$p.contentContainer]: true, [CSS$p.hasCenterContent]: hasCenterContent }, ref: () => (this.focusEl = null) }, content));
- }
- render() {
- 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))));
- }
- get el() { return getElement(this); }
- static get style() { return listItemCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-list-item",
- "$members$": {
- "nonInteractive": [516, "non-interactive"],
- "description": [1],
- "disabled": [516],
- "label": [1],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["nonInteractive", "non-interactive"], ["disabled", "disabled"]]
- }; }
- }
- const CSS$o = {
- heading: "heading",
- container: "container"
- };
- const HEADING_LEVEL$4 = 3;
- const listItemGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-list-item-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-list-item-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-list-item-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-list-item-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-list-item-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-list-item-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-list-item-group-h{display:none}/*!@:host*/.sc-calcite-list-item-group-h{display:flex;flex-direction:column}/*!@.heading*/.heading.sc-calcite-list-item-group{margin:0px;display:flex;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:flex;inline-size:100%;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-inline-start:0.5rem}";
- /**
- * @slot - A slot for adding `calcite-list-item` and `calcite-list-item-group` elements.
- */
- class ListItemGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- var _a;
- const { el, heading, headingLevel } = this;
- const parentLevel = (_a = el.closest("calcite-list, calcite-list-item-group")) === null || _a === void 0 ? void 0 : _a.headingLevel;
- const relativeLevel = parentLevel ? constrainHeadingLevel(parentLevel + 1) : null;
- const level = headingLevel || relativeLevel || HEADING_LEVEL$4;
- 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))));
- }
- get el() { return getElement(this); }
- static get style() { return listItemGroupCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-list-item-group",
- "$members$": {
- "heading": [513],
- "headingLevel": [514, "heading-level"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["heading", "heading"], ["headingLevel", "heading-level"]]
- }; }
- }
- const loaderCss = "@charset \"UTF-8\";@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-loader{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-loader{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-loader{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-loader{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-loader:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-loader:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-loader-h{display:none}/*!@:host*/.sc-calcite-loader-h{position:relative;margin-inline:auto;display:none;align-items:center;justify-content:center;opacity:1;min-block-size:var(--calcite-loader-size);font-size:var(--calcite-loader-font-size);stroke:var(--calcite-ui-brand);stroke-width:3;fill:none;transform:scale(1, 1);animation:loader-color-shift calc(var(--calcite-internal-animation-timing-slow) * 2) alternate-reverse infinite linear;padding-block:var(--calcite-loader-padding, 4rem)}/*!@: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-block:0px}/*!@:host*/.sc-calcite-loader-h{display:none}/*!@:host([active])*/[active].sc-calcite-loader-h{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-block-start: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);inline-size:var(--calcite-loader-size);inset-inline-start:50%;margin-inline-start:calc(var(--calcite-loader-size) / 2 * -1);line-height:0.25;transform:scale(1, 1)}/*!@.loader__svgs*/.loader__svgs.sc-calcite-loader{position:absolute;overflow:visible;opacity:1;inline-size:var(--calcite-loader-size);block-size:var(--calcite-loader-size);inset-inline-start:50%;margin-inline-start:calc(var(--calcite-loader-size) / 2 * -1);transform:scale(1, 1)}/*!@.loader__svg*/.loader__svg.sc-calcite-loader{position:absolute;inset-block-start:0px;transform-origin:center;overflow:visible;inset-inline-start:0;inline-size:var(--calcite-loader-size);block-size:var(--calcite-loader-size);animation-iteration-count:infinite;animation-timing-function:linear;animation-name:loader-clockwise}@supports (display: grid){/*!@.loader__svg--1*/.loader__svg--1.sc-calcite-loader{animation-name:loader-offset-1}/*!@.loader__svg--2*/.loader__svg--2.sc-calcite-loader{animation-name:loader-offset-2}/*!@.loader__svg--3*/.loader__svg--3.sc-calcite-loader{animation-name:loader-offset-3}}/*!@:host([type=determinate])*/[type=determinate].sc-calcite-loader-h{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{animation:none;stroke:var(--calcite-ui-brand);stroke-dasharray:150.79632;transform:rotate(-90deg);transition:all var(--calcite-internal-animation-timing-fast) linear}/*!@:host([inline])*/[inline].sc-calcite-loader-h{position:relative;margin:0px;animation:none;stroke:currentColor;stroke-width:2;padding-block:0px;block-size:var(--calcite-loader-size-inline);min-block-size:var(--calcite-loader-size-inline);inline-size:var(--calcite-loader-size-inline);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{inset-block-start:0px;margin:0px;inset-inline-start:0;inline-size:var(--calcite-loader-size-inline);block-size:var(--calcite-loader-size-inline)}/*!@:host([inline]) .loader__svg*/[inline].sc-calcite-loader-h .loader__svg.sc-calcite-loader{inline-size:var(--calcite-loader-size-inline);block-size:var(--calcite-loader-size-inline)}/*!@:host([complete])*/[complete].sc-calcite-loader-h{opacity:0;transform:scale(0.75, 0.75);transform-origin:center;transition:opacity var(--calcite-internal-animation-timing-medium) linear 1000ms, 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;transform:scale(0.75, 0.75);transform-origin:center;transition:opacity calc(180ms * var(--calcite-internal-duration-factor)) linear 800ms, 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);transform:scale(1.05, 1.05);transform-origin:center;transition:color var(--calcite-internal-animation-timing-medium) linear, transform var(--calcite-internal-animation-timing-medium) linear}/*!@.loader__svg--1*/.loader__svg--1.sc-calcite-loader{stroke-dasharray:27.9252444444% 139.6262222222%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 2.4)}@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%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 3.2)}@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%;animation-duration:calc(var(--calcite-internal-animation-timing-slow) * 3.867)}@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-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-clockwise{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
- class Loader {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, the component is active. */
- this.active = false;
- /** When `true`, displays smaller and appears to the left of the text. */
- this.inline = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- /** The component's value. Valid only for `"determinate"` indicators. Percent complete of 100. */
- this.value = 0;
- /** Text that displays under the component's indicator. */
- this.text = "";
- /**
- * Disables spacing around the component.
- *
- * @deprecated Use `--calcite-loader-padding` CSS variable instead.
- */
- this.noPadding = false;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- render() {
- const { el, inline, label, scale, text, type, value } = this;
- const id = el.id || guid();
- const radiusRatio = 0.45;
- const size = inline ? this.getInlineSize(scale) : this.getSize(scale);
- const radius = size * radiusRatio;
- const viewbox = `0 0 ${size} ${size}`;
- const isDeterminate = type === "determinate";
- const circumference = 2 * radius * Math.PI;
- const progress = (value / 100) * circumference;
- const remaining = circumference - progress;
- const valueNow = Math.floor(value);
- const hostAttributes = {
- "aria-valuenow": valueNow,
- "aria-valuemin": 0,
- "aria-valuemax": 100,
- complete: valueNow === 100
- };
- const svgAttributes = { r: radius, cx: size / 2, cy: size / 2 };
- const determinateStyle = { "stroke-dasharray": `${progress} ${remaining}` };
- return (hAsync(Host, { "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", { ...svgAttributes })), hAsync("svg", { class: "loader__svg loader__svg--2", viewBox: viewbox }, hAsync("circle", { ...svgAttributes })), hAsync("svg", { class: "loader__svg loader__svg--3", viewBox: viewbox, ...(isDeterminate ? { style: determinateStyle } : {}) }, hAsync("circle", { ...svgAttributes }))), text && hAsync("div", { class: "loader__text" }, text), isDeterminate && hAsync("div", { class: "loader__percentage" }, value)));
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- /**
- * Return the proper sizes based on the scale property
- *
- * @param scale
- */
- getSize(scale) {
- return {
- s: 32,
- m: 56,
- l: 80
- }[scale];
- }
- getInlineSize(scale) {
- return {
- s: 12,
- m: 16,
- l: 20
- }[scale];
- }
- get el() { return getElement(this); }
- static get style() { return loaderCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-loader",
- "$members$": {
- "active": [516],
- "inline": [516],
- "label": [1],
- "scale": [513],
- "type": [513],
- "value": [2],
- "text": [1],
- "noPadding": [516, "no-padding"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["inline", "inline"], ["scale", "scale"], ["type", "type"], ["noPadding", "no-padding"]]
- }; }
- }
- /**
- * Traverses the slots of the open shadowroots and returns all children matching the query.
- * @param {ShadowRoot | HTMLElement} root
- * @param skipNode
- * @param isMatch
- * @param {number} maxDepth
- * @param {number} depth
- * @returns {HTMLElement[]}
- */
- function queryShadowRoot(root, skipNode, isMatch, maxDepth = 20, depth = 0) {
- let matches = [];
- // If the depth is above the max depth, abort the searching here.
- if (depth >= maxDepth) {
- return matches;
- }
- // Traverses a slot element
- const traverseSlot = ($slot) => {
- // Only check nodes that are of the type Node.ELEMENT_NODE
- // Read more here https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
- const assignedNodes = $slot.assignedNodes().filter(node => node.nodeType === 1);
- if (assignedNodes.length > 0) {
- return queryShadowRoot(assignedNodes[0].parentElement, skipNode, isMatch, maxDepth, depth + 1);
- }
- return [];
- };
- // Go through each child and continue the traversing if necessary
- // Even though the typing says that children can't be undefined, Edge 15 sometimes gives an undefined value.
- // Therefore we fallback to an empty array if it is undefined.
- const children = Array.from(root.children || []);
- for (const $child of children) {
- // Check if the node and its descendants should be skipped
- if (skipNode($child)) {
- continue;
- }
- // If the child matches we always add it
- if (isMatch($child)) {
- matches.push($child);
- }
- if ($child.shadowRoot != null) {
- matches.push(...queryShadowRoot($child.shadowRoot, skipNode, isMatch, maxDepth, depth + 1));
- }
- else if ($child.tagName === "SLOT") {
- matches.push(...traverseSlot($child));
- }
- else {
- matches.push(...queryShadowRoot($child, skipNode, isMatch, maxDepth, depth + 1));
- }
- }
- return matches;
- }
- /**
- * Returns whether the element is hidden.
- * @param $elem
- */
- function isHidden($elem) {
- return $elem.hasAttribute("hidden")
- || ($elem.hasAttribute("aria-hidden") && $elem.getAttribute("aria-hidden") !== "false")
- // A quick and dirty way to check whether the element is hidden.
- // For a more fine-grained check we could use "window.getComputedStyle" but we don't because of bad performance.
- // If the element has visibility set to "hidden" or "collapse", display set to "none" or opacity set to "0" through CSS
- // we won't be able to catch it here. We accept it due to the huge performance benefits.
- || $elem.style.display === `none`
- || $elem.style.opacity === `0`
- || $elem.style.visibility === `hidden`
- || $elem.style.visibility === `collapse`;
- // If offsetParent is null we can assume that the element is hidden
- // https://stackoverflow.com/questions/306305/what-would-make-offsetparent-null
- //|| $elem.offsetParent == null;
- }
- /**
- * Returns whether the element is disabled.
- * @param $elem
- */
- function isDisabled($elem) {
- return $elem.hasAttribute("disabled")
- || ($elem.hasAttribute("aria-disabled") && $elem.getAttribute("aria-disabled") !== "false");
- }
- /**
- * Determines whether an element is focusable.
- * Read more here: https://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus/1600194#1600194
- * Or here: https://stackoverflow.com/questions/18261595/how-to-check-if-a-dom-element-is-focusable
- * @param $elem
- */
- function isFocusable($elem) {
- // Discard elements that are removed from the tab order.
- if ($elem.getAttribute("tabindex") === "-1" || isHidden($elem) || isDisabled($elem)) {
- return false;
- }
- return (
- // At this point we know that the element can have focus (eg. won't be -1) if the tabindex attribute exists
- $elem.hasAttribute("tabindex")
- // Anchor tags or area tags with a href set
- || ($elem instanceof HTMLAnchorElement || $elem instanceof HTMLAreaElement) && $elem.hasAttribute("href")
- // Form elements which are not disabled
- || ($elem instanceof HTMLButtonElement
- || $elem instanceof HTMLInputElement
- || $elem instanceof HTMLTextAreaElement
- || $elem instanceof HTMLSelectElement)
- // IFrames
- || $elem instanceof HTMLIFrameElement);
- }
- const CSS$n = {
- modal: "modal",
- modalOpen: "modal--open",
- title: "title",
- header: "header",
- footer: "footer",
- scrim: "scrim",
- back: "back",
- close: "close",
- secondary: "secondary",
- primary: "primary",
- overflowHidden: "overflow-hidden",
- // these classes help apply the animation in phases to only set transform on open/close
- // this helps avoid a positioning issue for any floating-ui-owning children
- openingIdle: "modal--opening-idle",
- openingActive: "modal--opening-active",
- closingIdle: "modal--closing-idle",
- closingActive: "modal--closing-active"
- };
- const ICONS$5 = {
- close: "x"
- };
- const SLOTS$d = {
- content: "content",
- header: "header",
- back: "back",
- secondary: "secondary",
- primary: "primary"
- };
- const TEXT$a = {
- close: "Close"
- };
- const modalCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-modal{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-modal{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-modal{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-modal{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-modal:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-modal:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-modal-h{display:none}/*!@:host*/.sc-calcite-modal-h{position:fixed;inset:0px;z-index:700;display:flex;align-items:center;justify-content:center;overflow-y:hidden;color:var(--calcite-ui-text-2);opacity:0;visibility:hidden !important;transition:visibility 0ms linear var(--calcite-internal-animation-timing-slow), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88)}/*!@: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);--calcite-modal-padding-internal:0.75rem;--calcite-modal-padding-large-internal:1rem;--calcite-modal-title-text-internal:var(--calcite-font-size-1);--calcite-modal-content-text-internal: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);--calcite-modal-padding-internal:1rem;--calcite-modal-padding-large-internal:1.25rem;--calcite-modal-title-text-internal:var(--calcite-font-size-2);--calcite-modal-content-text-internal: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);--calcite-modal-padding-internal:1.25rem;--calcite-modal-padding-large-internal:1.5rem;--calcite-modal-title-text-internal:var(--calcite-font-size-3);--calcite-modal-content-text-internal:var(--calcite-font-size-1)}/*!@.scrim*/.scrim.sc-calcite-modal{--calcite-scrim-background:rgba(0, 0, 0, 0.75);position:fixed;inset:0px;display:flex;overflow-y:hidden}/*!@.modal*/.modal.sc-calcite-modal{pointer-events:none;z-index:800;float:none;margin:1.5rem;box-sizing:border-box;display:flex;inline-size:100%;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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);-webkit-overflow-scrolling:touch;visibility:hidden;transition:transform var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), visibility 0ms linear var(--calcite-internal-animation-timing-slow), opacity var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);--calcite-modal-hidden-position:translate3d(0, 20px, 0);--calcite-modal-shown-position:translate3d(0, 0, 0)}/*!@.modal--opening-idle*/.modal--opening-idle.sc-calcite-modal{transform:var(--calcite-modal-hidden-position)}/*!@.modal--opening-active*/.modal--opening-active.sc-calcite-modal{transform:var(--calcite-modal-shown-position)}/*!@.modal--closing-idle*/.modal--closing-idle.sc-calcite-modal{transform:var(--calcite-modal-shown-position)}/*!@.modal--closing-active*/.modal--closing-active.sc-calcite-modal{transform:var(--calcite-modal-hidden-position)}/*!@:host([open])*/[open].sc-calcite-modal-h{opacity:1;visibility:visible !important;transition-delay:0ms}/*!@:host([open]) .modal--open*/[open].sc-calcite-modal-h .modal--open.sc-calcite-modal{pointer-events:auto;visibility:visible;opacity:1;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-inline-size var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88), max-block-size var(--calcite-internal-animation-timing-slow) cubic-bezier(0.215, 0.44, 0.42, 0.88);transition-delay:0ms}/*!@.header*/.header.sc-calcite-modal{z-index:400;display:flex;min-inline-size:0px;max-inline-size:100%;border-start-start-radius:0.25rem;border-start-end-radius:0.25rem;border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1);flex:0 0 auto}/*!@.close*/.close.sc-calcite-modal{order:2;margin:0px;cursor:pointer;-webkit-appearance:none;appearance:none;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-start-end-radius:0.25rem;padding-block:var(--calcite-modal-padding, var(--calcite-modal-padding-internal));padding-inline:var(--calcite-modal-padding, var(--calcite-modal-padding-internal));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{order:1;display:flex;min-inline-size:0px;align-items:center;flex:1 1 auto;padding-block:var(--calcite-modal-padding, var(--calcite-model-padding-internal));padding-inline:var(--calcite-modal-padding-large, var(--calcite-modal-padding-large-internal))}/*!@slot[name=header]::slotted(*), \n*::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, var(--calcite-modal-title-text-internal))}/*!@.content*/.content.sc-calcite-modal{position:relative;box-sizing:border-box;display:block;block-size:100%;overflow:auto;background-color:var(--calcite-ui-foreground-1);padding:0px;max-block-size:calc(100vh - 12rem)}/*!@.content--spaced*/.content--spaced.sc-calcite-modal{padding:var(--calcite-modal-padding)}/*!@.content--no-footer*/.content--no-footer.sc-calcite-modal{border-end-end-radius:0.25rem;border-end-start-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, var(--calcite-modal-context-text-internal))}/*!@: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{z-index:400;margin-block-start:auto;box-sizing:border-box;display:flex;inline-size:100%;justify-content:space-between;border-end-end-radius:0.25rem;border-end-start-radius:0.25rem;border-width:0px;border-block-start-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1);flex:0 0 auto;padding-block:var(--calcite-modal-padding, var(--calcite-modal-padding-internal));padding-inline:var(--calcite-modal-padding-large, var(--calcite-modal-padding-large-internal))}/*!@.footer--hide-back .back, \n.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;margin-inline-end:auto}/*!@.secondary*/.secondary.sc-calcite-modal{margin-inline: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{inline-size:auto}/*!@:host([width=s]) .modal*/[width=s].sc-calcite-modal-h .modal.sc-calcite-modal{max-inline-size:32rem}@media screen and (max-width: 35rem){/*!@:host([width=s]) .modal*/[width=s].sc-calcite-modal-h .modal.sc-calcite-modal{margin:0px;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;border-radius:0px}/*!@:host([width=s]) .content*/[width=s].sc-calcite-modal-h .content.sc-calcite-modal{flex:1 1 auto;max-block-size:unset}/*!@:host([width=s][docked])*/[width=s][docked].sc-calcite-modal-h{align-items:flex-end}}/*!@:host([width=m]) .modal*/[width=m].sc-calcite-modal-h .modal.sc-calcite-modal{max-inline-size:48rem}@media screen and (max-width: 51rem){/*!@:host([width=m]) .modal*/[width=m].sc-calcite-modal-h .modal.sc-calcite-modal{margin:0px;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;border-radius:0px}/*!@:host([width=m]) .content*/[width=m].sc-calcite-modal-h .content.sc-calcite-modal{flex:1 1 auto;max-block-size:unset}/*!@:host([width=m][docked])*/[width=m][docked].sc-calcite-modal-h{align-items:flex-end}}/*!@:host([width=l]) .modal*/[width=l].sc-calcite-modal-h .modal.sc-calcite-modal{max-inline-size:94rem}@media screen and (max-width: 97rem){/*!@:host([width=l]) .modal*/[width=l].sc-calcite-modal-h .modal.sc-calcite-modal{margin:0px;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;border-radius:0px}/*!@:host([width=l]) .content*/[width=l].sc-calcite-modal-h .content.sc-calcite-modal{flex:1 1 auto;max-block-size:unset}/*!@:host([width=l][docked])*/[width=l][docked].sc-calcite-modal-h{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;block-size:100%;max-block-size:100%;inline-size:100%;max-inline-size:100%;--calcite-modal-hidden-position:translate3D(0, 20px, 0) scale(0.95);--calcite-modal-shown-position:translate3D(0, 0, 0) scale(1)}/*!@:host([fullscreen]) .content*/[fullscreen].sc-calcite-modal-h .content.sc-calcite-modal{max-block-size:100%;flex:1 1 auto}/*!@:host([open][fullscreen]) .header*/[open][fullscreen].sc-calcite-modal-h .header.sc-calcite-modal{border-radius:0}/*!@:host([open][fullscreen]) .footer*/[open][fullscreen].sc-calcite-modal-h .footer.sc-calcite-modal{border-radius:0}/*!@:host([docked]) .modal*/[docked].sc-calcite-modal-h .modal.sc-calcite-modal{block-size:auto}/*!@:host([docked]) .content*/[docked].sc-calcite-modal-h .content.sc-calcite-modal{block-size: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, \n: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-block-start-width:4px;border-style:solid}/*!@:host([color=red]) .header, \n: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-end-end-radius:0px;border-end-start-radius:0px}@media screen and (max-width: 860px){/*!@slot[name=header]::slotted(*), \n*::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:sticky;inset-block-end:0px}}@media screen and (max-width: 480px){/*!@.footer*/.footer.sc-calcite-modal{flex-direction:column}/*!@.back, \n.secondary*/.back.sc-calcite-modal,.secondary.sc-calcite-modal{margin:0px;margin-block-end:0.25rem}}";
- const isFocusableExtended = (el) => {
- return isCalciteFocusable(el) || isFocusable(el);
- };
- const getFocusableElements = (el) => {
- return queryShadowRoot(el, isHidden, isFocusableExtended);
- };
- /**
- * @slot header - A slot for adding header text.
- * @slot content - A slot for adding the component's content.
- * @slot primary - A slot for adding a primary button.
- * @slot secondary - A slot for adding a secondary button.
- * @slot back - A slot for adding a back button.
- */
- class Modal {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteModalBeforeClose = createEvent(this, "calciteModalBeforeClose", 6);
- this.calciteModalClose = createEvent(this, "calciteModalClose", 6);
- this.calciteModalBeforeOpen = createEvent(this, "calciteModalBeforeOpen", 6);
- this.calciteModalOpen = createEvent(this, "calciteModalOpen", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, the component is active.
- *
- * @deprecated use `open` instead.
- */
- this.active = false;
- /** When `true`, displays and positions the component. */
- this.open = false;
- /** Passes a function to run before the component closes. */
- this.beforeClose = () => Promise.resolve();
- /** When `true`, disables the component's close button. */
- this.disableCloseButton = false;
- /** When `true`, disables the closing of the component when clicked outside. */
- this.disableOutsideClose = false;
- /** Accessible name for the component's close button. */
- this.intlClose = TEXT$a.close;
- /** When `true`, disables the default close on escape behavior. */
- this.disableEscape = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- /** Specifies the width of the component. Can use scale sizes or pass a number (displays in pixels). */
- this.width = "m";
- /** Sets the background color of the component's content. */
- this.backgroundColor = "white";
- /**
- * When `true`, disables spacing to the content area slot.
- *
- * @deprecated Use `--calcite-modal-padding` CSS variable instead.
- */
- this.noPadding = false;
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
- this.hasFooter = true;
- /**
- * We use internal variable to make sure initially open modal can transition from closed state when rendered
- *
- * @private
- */
- this.isOpen = false;
- this.mutationObserver = createObserver();
- this.openTransitionProp = "opacity";
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.setTransitionEl = (el) => {
- this.transitionEl = el;
- connectOpenCloseComponent(this);
- };
- this.openEnd = () => {
- this.setFocus();
- this.el.removeEventListener("calciteModalOpen", this.openEnd);
- };
- this.handleOutsideClose = () => {
- if (this.disableOutsideClose) {
- return;
- }
- this.close();
- };
- /** Close the modal, first running the `beforeClose` method */
- this.close = () => {
- return this.beforeClose(this.el).then(() => {
- this.open = false;
- this.isOpen = false;
- focusElement(this.previousActiveElement);
- this.removeOverflowHiddenClass();
- });
- };
- this.focusFirstElement = () => {
- focusElement(this.disableCloseButton ? getFocusableElements(this.el)[0] : this.closeButtonEl);
- };
- this.focusLastElement = () => {
- const focusableElements = getFocusableElements(this.el).filter((el) => !el.getAttribute("data-focus-fence"));
- if (focusableElements.length > 0) {
- focusElement(focusableElements[focusableElements.length - 1]);
- }
- else {
- focusElement(this.closeButtonEl);
- }
- };
- this.updateFooterVisibility = () => {
- this.hasFooter = !!getSlotted(this.el, [SLOTS$d.back, SLOTS$d.primary, SLOTS$d.secondary]);
- };
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentWillLoad() {
- // when modal initially renders, if active was set we need to open as watcher doesn't fire
- if (this.open) {
- requestAnimationFrame(() => this.openModal());
- }
- }
- connectedCallback() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- this.updateFooterVisibility();
- connectConditionalSlotComponent(this);
- connectOpenCloseComponent(this);
- if (this.open) {
- this.active = this.open;
- }
- if (this.active) {
- this.activeHandler(this.active);
- }
- }
- disconnectedCallback() {
- var _a;
- this.removeOverflowHiddenClass();
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- disconnectConditionalSlotComponent(this);
- disconnectOpenCloseComponent(this);
- }
- render() {
- 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: {
- [CSS$n.modal]: true,
- [CSS$n.modalOpen]: this.isOpen
- }, ref: this.setTransitionEl }, 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: {
- content: true,
- "content--spaced": !this.noPadding,
- "content--no-footer": !this.hasFooter
- }, ref: (el) => (this.modalContent = el) }, hAsync("slot", { name: SLOTS$d.content })), this.renderFooter(), hAsync("div", { "data-focus-fence": true, onFocus: this.focusFirstElement, tabindex: "0" }))));
- }
- renderFooter() {
- return this.hasFooter ? (hAsync("div", { class: CSS$n.footer, key: "footer" }, hAsync("span", { class: CSS$n.back }, hAsync("slot", { name: SLOTS$d.back })), hAsync("span", { class: CSS$n.secondary }, hAsync("slot", { name: SLOTS$d.secondary })), hAsync("span", { class: CSS$n.primary }, hAsync("slot", { name: SLOTS$d.primary })))) : null;
- }
- renderCloseButton() {
- 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$5.close, scale: this.scale === "s" ? "s" : this.scale === "m" ? "m" : this.scale === "l" ? "l" : null }))) : null;
- }
- renderStyle() {
- const hasCustomWidth = !isNaN(parseInt(`${this.width}`));
- return hasCustomWidth ? (hAsync("style", null, `
- .${CSS$n.modal} {
- max-width: ${this.width}px !important;
- }
- @media screen and (max-width: ${this.width}px) {
- .${CSS$n.modal} {
- height: 100% !important;
- max-height: 100% !important;
- width: 100% !important;
- max-width: 100% !important;
- margin: 0 !important;
- border-radius: 0 !important;
- }
- .content {
- flex: 1 1 auto !important;
- max-height: unset !important;
- }
- }
- `)) : null;
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- handleEscape(event) {
- if (this.open && !this.disableEscape && event.key === "Escape" && !event.defaultPrevented) {
- this.close();
- event.preventDefault();
- }
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /**
- * Focus the first interactive element.
- *
- * @param el
- * @deprecated use `setFocus` instead.
- */
- async focusElement(el) {
- if (el) {
- el.focus();
- }
- return this.setFocus();
- }
- /**
- * Sets focus on the component.
- *
- * By default, tries to focus on focusable content. If there is none, it will focus on the close button.
- * To focus on the close button, use the `close-button` focus ID.
- *
- * @param focusId
- */
- async setFocus(focusId) {
- const closeButton = this.closeButtonEl;
- return focusElement(focusId === "close-button" ? closeButton : getFocusableElements(this.el)[0] || closeButton);
- }
- /**
- * Sets the scroll top of the component's content.
- *
- * @param top
- * @param left
- */
- async scrollContent(top = 0, left = 0) {
- if (this.modalContent) {
- if (this.modalContent.scrollTo) {
- this.modalContent.scrollTo({ top, left, behavior: "smooth" });
- }
- else {
- this.modalContent.scrollTop = top;
- this.modalContent.scrollLeft = left;
- }
- }
- }
- onBeforeOpen() {
- this.transitionEl.classList.add(CSS$n.openingActive);
- this.calciteModalBeforeOpen.emit();
- }
- onOpen() {
- this.transitionEl.classList.remove(CSS$n.openingIdle, CSS$n.openingActive);
- this.calciteModalOpen.emit();
- }
- onBeforeClose() {
- this.transitionEl.classList.add(CSS$n.closingActive);
- this.calciteModalBeforeClose.emit();
- }
- onClose() {
- this.transitionEl.classList.remove(CSS$n.closingIdle, CSS$n.closingActive);
- this.calciteModalClose.emit();
- }
- activeHandler(value) {
- this.open = value;
- }
- async toggleModal(value) {
- var _a, _b;
- this.active = value;
- if (value) {
- (_a = this.transitionEl) === null || _a === void 0 ? void 0 : _a.classList.add(CSS$n.openingIdle);
- this.openModal();
- }
- else {
- (_b = this.transitionEl) === null || _b === void 0 ? void 0 : _b.classList.add(CSS$n.closingIdle);
- this.close();
- }
- }
- /** Open the modal */
- openModal() {
- this.previousActiveElement = document.activeElement;
- this.el.addEventListener("calciteModalOpen", this.openEnd);
- this.open = true;
- this.isOpen = true;
- const titleEl = getSlotted(this.el, SLOTS$d.header);
- const contentEl = getSlotted(this.el, SLOTS$d.content);
- this.titleId = ensureId(titleEl);
- this.contentId = ensureId(contentEl);
- document.documentElement.classList.add(CSS$n.overflowHidden);
- }
- removeOverflowHiddenClass() {
- document.documentElement.classList.remove(CSS$n.overflowHidden);
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "open": ["toggleModal"]
- }; }
- static get style() { return modalCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-modal",
- "$members$": {
- "active": [1540],
- "open": [1540],
- "beforeClose": [16],
- "disableCloseButton": [516, "disable-close-button"],
- "disableOutsideClose": [516, "disable-outside-close"],
- "intlClose": [1, "intl-close"],
- "docked": [516],
- "disableEscape": [516, "disable-escape"],
- "scale": [513],
- "width": [520],
- "fullscreen": [516],
- "color": [513],
- "backgroundColor": [513, "background-color"],
- "noPadding": [516, "no-padding"],
- "hasFooter": [32],
- "isOpen": [32],
- "focusElement": [64],
- "setFocus": [64],
- "scrollContent": [64]
- },
- "$listeners$": [[8, "keydown", "handleEscape"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["open", "open"], ["disableCloseButton", "disable-close-button"], ["disableOutsideClose", "disable-outside-close"], ["docked", "docked"], ["disableEscape", "disable-escape"], ["scale", "scale"], ["width", "width"], ["fullscreen", "fullscreen"], ["color", "color"], ["backgroundColor", "background-color"], ["noPadding", "no-padding"]]
- }; }
- }
- const TEXT$9 = {
- close: "Close"
- };
- const SLOTS$c = {
- title: "title",
- message: "message",
- link: "link",
- actionsEnd: "actions-end"
- };
- const CSS$m = {
- actionsEnd: "actions-end",
- close: "notice-close",
- container: "container",
- content: "notice-content",
- icon: "notice-icon"
- };
- const noticeCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-notice{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-notice{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-notice{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-notice{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-notice:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-notice:root{--calcite-floating-ui-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(*), \n: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-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}/*!@:host([scale=s]) .container slot[name=message]::slotted(*), \n: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-block: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-block: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(*), \n: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-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}/*!@:host([scale=m]) .container slot[name=message]::slotted(*), \n: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-block: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-block: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(*), \n: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-block:0.125rem;font-size:var(--calcite-font-size-1);line-height:1.375}/*!@:host([scale=l]) .container slot[name=message]::slotted(*), \n: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-block: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-block: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-inline:auto;display:none;max-inline-size:100%;align-items:center;inline-size:var(--calcite-notice-width)}/*!@.container*/.container.sc-calcite-notice{pointer-events:none;margin-block:0px;box-sizing:border-box;display:none;inline-size:100%;background-color:var(--calcite-ui-foreground-1);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;max-block-size:0;text-align:start;border-inline-start:0px solid;box-shadow:0 0 0 0 transparent}/*!@.notice-close*/.notice-close.sc-calcite-notice{outline-color:transparent}/*!@.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:flex}/*!@:host([open]) .container*/[open].sc-calcite-notice-h .container.sc-calcite-notice{pointer-events:auto;display:flex;max-block-size:100%;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);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(*), \n.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(*), \n.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);margin-inline-end:var(--calcite-notice-spacing-token-small)}/*!@.notice-content*/.notice-content.sc-calcite-notice{box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;display:flex;min-inline-size:0px;flex-direction:column;overflow-wrap:break-word;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){padding-inline-start:var(--calcite-notice-spacing-token-large)}/*!@.notice-content:only-of-type*/.notice-content.sc-calcite-notice:only-of-type{padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large)}/*!@.notice-icon*/.notice-icon.sc-calcite-notice{display:flex;align-items:center;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto}/*!@.notice-close*/.notice-close.sc-calcite-notice{display:flex;cursor:pointer;align-items:center;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);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:flex;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)}";
- /**
- * Notices are intended to be used to present users with important-but-not-crucial contextual tips or copy. Because
- * notices are displayed inline, a common use case is displaying them on page-load to present users with short hints or contextual copy.
- * They are optionally dismissible - useful for keeping track of whether or not a user has dismissed the notice. You can also choose not
- * to display a notice on page load and set the "active" attribute as needed to contextually provide inline messaging to users.
- */
- /**
- * @slot title - A slot for adding the title.
- * @slot message - A slot for adding the message.
- * @slot link - A slot for adding actions to take, such as: undo, try again, link to page, etc.
- * @slot actions-end - A slot for adding actions to the end of the component. It is recommended to use two or less actions.
- */
- class Notice {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteNoticeClose = createEvent(this, "calciteNoticeClose", 6);
- this.calciteNoticeOpen = createEvent(this, "calciteNoticeOpen", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //---------------------------------------------------------------------------
- /**
- * When `true`, the component is active.
- *
- * @deprecated Use `open` instead.
- */
- this.active = false;
- /** When `true`, the component is visible. */
- this.open = false;
- /** The color for the component's top border and icon. */
- this.color = "blue";
- /**
- * When `true`, a close button is added to the component.
- *
- * @deprecated use `closable` instead.
- */
- this.dismissible = false;
- /** When `true`, a close button is added to the component. */
- this.closable = false;
- /**
- * Accessible name for the close button.
- *
- * @default "Close"
- */
- this.intlClose = TEXT$9.close;
- /** Specifies the size of the component. */
- this.scale = "m";
- /** Specifies the width of the component. */
- this.width = "auto";
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.close = () => {
- this.open = false;
- this.calciteNoticeClose.emit();
- };
- }
- activeHandler(value) {
- this.open = value;
- }
- openHandler(value) {
- this.active = value;
- }
- handleDismissible(value) {
- this.closable = value;
- }
- handleClosable(value) {
- this.dismissible = value;
- }
- updateRequestedIcon() {
- this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- const isOpen = this.active || this.open;
- if (isOpen) {
- this.activeHandler(isOpen);
- this.openHandler(isOpen);
- }
- if (this.dismissible) {
- this.handleDismissible(this.dismissible);
- }
- if (this.closable) {
- this.handleClosable(this.closable);
- }
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- componentWillLoad() {
- this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
- }
- render() {
- const { el } = this;
- 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" })));
- const hasActionEnd = getSlotted(el, SLOTS$c.actionsEnd);
- 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$c.title }), hAsync("slot", { name: SLOTS$c.message }), hAsync("slot", { name: SLOTS$c.link })), hasActionEnd ? (hAsync("div", { class: CSS$m.actionsEnd }, hAsync("slot", { name: SLOTS$c.actionsEnd }))) : null, this.closable ? closeButton : null));
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- const noticeLinkEl = this.el.querySelector("calcite-link");
- if (!this.closeButton && !noticeLinkEl) {
- return;
- }
- if (noticeLinkEl) {
- noticeLinkEl.setFocus();
- }
- else if (this.closeButton) {
- this.closeButton.focus();
- }
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "open": ["openHandler"],
- "dismissible": ["handleDismissible"],
- "closable": ["handleClosable"],
- "icon": ["updateRequestedIcon"],
- "color": ["updateRequestedIcon"]
- }; }
- static get style() { return noticeCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-notice",
- "$members$": {
- "active": [1540],
- "open": [1540],
- "color": [513],
- "dismissible": [516],
- "closable": [516],
- "icon": [520],
- "intlClose": [1, "intl-close"],
- "scale": [513],
- "width": [513],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["open", "open"], ["color", "color"], ["dismissible", "dismissible"], ["closable", "closable"], ["icon", "icon"], ["scale", "scale"], ["width", "width"]]
- }; }
- }
- const optionCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-option{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-option{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-option{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-option{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-option:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-option:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-option-h{display:none}/*!@:host*/.sc-calcite-option-h{display:block}";
- class Option {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalOptionChange = createEvent(this, "calciteInternalOptionChange", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- this.mutationObserver = createObserver();
- }
- handlePropChange(_newValue, _oldValue, propName) {
- if (propName === "label" || propName === "value") {
- this.ensureTextContentDependentProps();
- }
- this.calciteInternalOptionChange.emit();
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- ensureTextContentDependentProps() {
- const { el: { textContent } } = this;
- if (!this.label || this.label === this.internallySetLabel) {
- this.label = textContent;
- this.internallySetLabel = textContent;
- }
- if (!this.value || this.value === this.internallySetValue) {
- this.value = textContent;
- this.internallySetValue = textContent;
- }
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- this.ensureTextContentDependentProps();
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, {
- attributeFilter: ["label", "value"],
- characterData: true,
- childList: true,
- subtree: true
- });
- }
- disconnectedCallback() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- }
- //--------------------------------------------------------------------------
- //
- // Render Methods
- //
- //--------------------------------------------------------------------------
- render() {
- return hAsync("slot", null, this.label);
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["handlePropChange"],
- "label": ["handlePropChange"],
- "selected": ["handlePropChange"],
- "value": ["handlePropChange"]
- }; }
- static get style() { return optionCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-option",
- "$members$": {
- "disabled": [516],
- "label": [1025],
- "selected": [516],
- "value": [1032]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["selected", "selected"]]
- }; }
- }
- const optionGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-option-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-option-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-option-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-option-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-option-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-option-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-option-group-h{display:none}/*!@:host*/.sc-calcite-option-group-h{display:block}";
- /**
- * @slot - A slot for adding `calcite-option`s.
- */
- class OptionGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalOptionGroupChange = createEvent(this, "calciteInternalOptionGroupChange", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- }
- handlePropChange() {
- this.calciteInternalOptionGroupChange.emit();
- }
- //--------------------------------------------------------------------------
- //
- // Render Methods
- //
- //--------------------------------------------------------------------------
- render() {
- return (hAsync(Fragment, null, hAsync("div", null, this.label), hAsync("slot", null)));
- }
- static get watchers() { return {
- "disabled": ["handlePropChange"],
- "label": ["handlePropChange"]
- }; }
- static get style() { return optionGroupCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-option-group",
- "$members$": {
- "disabled": [516],
- "label": [1]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"]]
- }; }
- }
- const CSS$l = {
- page: "page",
- selected: "is-selected",
- previous: "previous",
- next: "next",
- disabled: "is-disabled",
- ellipsis: "ellipsis",
- ellipsisStart: "ellipsis--start",
- ellipsisEnd: "ellipsis--end"
- };
- const TEXT$8 = {
- nextLabel: "Next",
- previousLabel: "Previous"
- };
- const paginationCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pagination{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pagination{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pagination{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pagination{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-pagination:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-pagination:root{--calcite-floating-ui-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{block-size:1.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=s]) .previous, \n: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-inline: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{block-size:2rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=m]) .previous, \n: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-inline: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{block-size:2.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host([scale=l]) .previous, \n: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-inline:1rem}/*!@:host*/.sc-calcite-pagination-h{display:flex;writing-mode:horizontal-tb}/*!@:host button*/.sc-calcite-pagination-h button.sc-calcite-pagination{outline-color:transparent}/*!@:host button:focus*/.sc-calcite-pagination-h button.sc-calcite-pagination:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.previous, \n.next, \n.page*/.previous.sc-calcite-pagination,.next.sc-calcite-pagination,.page.sc-calcite-pagination{box-sizing:border-box;display:flex;cursor:pointer;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-block:2px solid transparent}/*!@.previous:hover, \n.next:hover, \n.page:hover*/.previous.sc-calcite-pagination:hover,.next.sc-calcite-pagination:hover,.page.sc-calcite-pagination:hover{color:var(--calcite-ui-text-1);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@.page:hover*/.page.sc-calcite-pagination:hover{border-block-end-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-block-end-color:var(--calcite-ui-brand)}/*!@.previous:hover, \n.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, \n.next:active*/.previous.sc-calcite-pagination:active,.next.sc-calcite-pagination:active{background-color:var(--calcite-ui-foreground-3)}/*!@.previous.is-disabled, \n.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, \n.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-inline-end:0px}/*!@.page,\n.ellipsis*/.page.sc-calcite-pagination,.ellipsis.sc-calcite-pagination{padding:var(--calcite-pagination-spacing)}/*!@.ellipsis*/.ellipsis.sc-calcite-pagination{display:flex;align-items:flex-end;color:var(--calcite-ui-text-3)}";
- const maxPagesDisplayed = 5;
- class Pagination {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calcitePaginationUpdate = createEvent(this, "calcitePaginationUpdate", 6);
- this.calcitePaginationChange = createEvent(this, "calcitePaginationChange", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, number values are displayed with a group separator corresponding to the language and country format.
- */
- this.groupSeparator = false;
- /** Specifies the number of items per page. */
- this.num = 20;
- /** Specifies the starting item number. */
- this.start = 1;
- /** Specifies the total number of items. */
- this.total = 0;
- /**
- * Accessible name for the component's next button.
- *
- * @default "Next"
- */
- this.textLabelNext = TEXT$8.nextLabel;
- /**
- * Accessible name for the component's previous button.
- *
- * @default "Previous"
- */
- this.textLabelPrevious = TEXT$8.previousLabel;
- /** Specifies the size of the component. */
- this.scale = "m";
- //--------------------------------------------------------------------------
- //
- // State
- //
- //--------------------------------------------------------------------------
- this.effectiveLocale = "";
- this.previousClicked = () => {
- this.previousPage().then();
- this.emitUpdate();
- };
- this.nextClicked = () => {
- this.nextPage();
- this.emitUpdate();
- };
- /**
- * Returns a string representing the localized label value based on groupSeparator prop being on or off.
- *
- * @param value
- */
- this.determineGroupSeparator = (value) => {
- numberStringFormatter.numberFormatOptions = {
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- useGrouping: this.groupSeparator
- };
- return this.groupSeparator
- ? numberStringFormatter.localize(value.toString())
- : value.toString();
- };
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectLocalized(this);
- }
- disconnectedCallback() {
- disconnectLocalized(this);
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /** Go to the next page of results. */
- async nextPage() {
- this.start = Math.min(this.getLastStart(), this.start + this.num);
- }
- /** Go to the previous page of results. */
- async previousPage() {
- this.start = Math.max(1, this.start - this.num);
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- getLastStart() {
- const { total, num } = this;
- const lastStart = total % num === 0 ? total - num : Math.floor(total / num) * num;
- return lastStart + 1;
- }
- showLeftEllipsis() {
- return Math.floor(this.start / this.num) > 3;
- }
- showRightEllipsis() {
- return (this.total - this.start) / this.num > 3;
- }
- emitUpdate() {
- const changePayload = {
- start: this.start,
- total: this.total,
- num: this.num
- };
- this.calcitePaginationChange.emit(changePayload);
- this.calcitePaginationUpdate.emit(changePayload);
- }
- //--------------------------------------------------------------------------
- //
- // Render Methods
- //
- //--------------------------------------------------------------------------
- renderPages() {
- const lastStart = this.getLastStart();
- let end;
- let nextStart;
- // if we don't need ellipses render the whole set
- if (this.total / this.num <= maxPagesDisplayed) {
- nextStart = 1 + this.num;
- end = lastStart - this.num;
- }
- else {
- // if we're within max pages of page 1
- if (this.start / this.num < maxPagesDisplayed - 1) {
- nextStart = 1 + this.num;
- end = 1 + 4 * this.num;
- }
- else {
- // if we're within max pages of last page
- if (this.start + 3 * this.num >= this.total) {
- nextStart = lastStart - 4 * this.num;
- end = lastStart - this.num;
- }
- else {
- nextStart = this.start - this.num;
- end = this.start + this.num;
- }
- }
- }
- const pages = [];
- while (nextStart <= end) {
- pages.push(nextStart);
- nextStart = nextStart + this.num;
- }
- return pages.map((page) => this.renderPage(page));
- }
- renderPage(start) {
- const page = Math.floor(start / this.num) + (this.num === 1 ? 0 : 1);
- const displayedPage = this.determineGroupSeparator(page);
- return (hAsync("button", { class: {
- [CSS$l.page]: true,
- [CSS$l.selected]: start === this.start
- }, onClick: () => {
- this.start = start;
- this.emitUpdate();
- } }, displayedPage));
- }
- renderLeftEllipsis() {
- if (this.total / this.num > maxPagesDisplayed && this.showLeftEllipsis()) {
- return hAsync("span", { class: `${CSS$l.ellipsis} ${CSS$l.ellipsisStart}` }, "\u2026");
- }
- }
- renderRightEllipsis() {
- if (this.total / this.num > maxPagesDisplayed && this.showRightEllipsis()) {
- return hAsync("span", { class: `${CSS$l.ellipsis} ${CSS$l.ellipsisEnd}` }, "\u2026");
- }
- }
- render() {
- const { total, num, start } = this;
- const prevDisabled = num === 1 ? start <= num : start < num;
- const nextDisabled = num === 1 ? start + num > total : start + num > total;
- return (hAsync(Fragment, null, hAsync("button", { "aria-label": this.textLabelPrevious, class: {
- [CSS$l.previous]: true,
- [CSS$l.disabled]: prevDisabled
- }, 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: {
- [CSS$l.next]: true,
- [CSS$l.disabled]: nextDisabled
- }, disabled: nextDisabled, onClick: this.nextClicked }, hAsync("calcite-icon", { flipRtl: true, icon: "chevronRight", scale: "s" }))));
- }
- get el() { return getElement(this); }
- static get style() { return paginationCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-pagination",
- "$members$": {
- "groupSeparator": [516, "group-separator"],
- "num": [514],
- "numberingSystem": [1, "numbering-system"],
- "start": [1538],
- "total": [514],
- "textLabelNext": [1, "text-label-next"],
- "textLabelPrevious": [1, "text-label-previous"],
- "scale": [513],
- "effectiveLocale": [32],
- "nextPage": [64],
- "previousPage": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["groupSeparator", "group-separator"], ["num", "num"], ["start", "start"], ["total", "total"], ["scale", "scale"]]
- }; }
- }
- const panelCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-panel{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-panel{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-panel{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-panel{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-panel:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-panel-h{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{box-sizing:border-box}/*!@:root*/.sc-calcite-panel:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-panel-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-panel-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-panel-h{position:relative;display:flex;inline-size:100%;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]) ::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:flex;align-content:space-between;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{flex:1 1 auto;padding:0.5rem}/*!@.container*/.container.sc-calcite-panel{margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;background-color:var(--calcite-ui-background);padding:0px;max-block-size:var(--calcite-panel-max-height);inline-size:var(--calcite-panel-width);max-inline-size:var(--calcite-panel-max-width);min-inline-size:var(--calcite-panel-min-width);transition:max-block-size var(--calcite-animation-timing), inline-size 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}/*!@.header*/.header.sc-calcite-panel{border-block-end:1px solid;position:sticky;inset-block-start:0px;z-index:400;inline-size:100%;align-items:stretch;justify-content:flex-start;background-color:var(--calcite-ui-foreground-1);border-block-end-color:var(--calcite-ui-border-3);flex:0 0 auto}/*!@.header-content*/.header-content.sc-calcite-panel{display:flex;flex-direction:column;overflow:hidden;padding-inline:0.75rem;padding-block:0.875rem;margin-inline-end:auto}/*!@.header-content .heading, \n.header-content .description*/.header-content.sc-calcite-panel .heading.sc-calcite-panel,.header-content.sc-calcite-panel .description.sc-calcite-panel{display:block;overflow-wrap:break-word;padding:0px}/*!@.header-content .heading*/.header-content.sc-calcite-panel .heading.sc-calcite-panel{margin-inline:0px;margin-block:0px 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-block-end:0px}/*!@.header-content .description*/.header-content.sc-calcite-panel .description.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:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch}/*!@.header-actions--end*/.header-actions--end.sc-calcite-panel{margin-inline-start:auto}/*!@.content-wrapper*/.content-wrapper.sc-calcite-panel{overflow:auto}/*!@.content-height*/.content-height.sc-calcite-panel{block-size:100%}/*!@.content-container*/.content-container.sc-calcite-panel{display:flex;flex:1 1 auto;flex-direction:column;flex-wrap:nowrap;align-items:stretch;background-color:var(--calcite-ui-background)}/*!@.footer*/.footer.sc-calcite-panel{border-block-start:1px solid;position:sticky;inset-block-end:0px;display:flex;inline-size:100%;justify-content:space-evenly;background-color:var(--calcite-ui-foreground-1);border-block-start-color:var(--calcite-ui-border-3);flex:0 0 auto;min-block-size:3rem;padding:0.5rem}/*!@.fab-container*/.fab-container.sc-calcite-panel{position:sticky;inset-block-end:0px;z-index:300;margin-block:0px;margin-inline:auto;display:block;padding:0.5rem;inset-inline:0;inline-size:-moz-fit-content;inline-size:fit-content}/*!@[hidden]*/[hidden].sc-calcite-panel{display:none}";
- /**
- * @slot - A slot for adding custom content.
- * @slot header-actions-start - A slot for adding actions or content to the start side of the header.
- * @slot header-actions-end - A slot for adding actions or content to the end side of the header.
- * @slot header-content - A slot for adding custom content to the header.
- * @slot header-menu-actions - A slot for adding an overflow menu with actions inside a `calcite-dropdown`.
- * @slot fab - A slot for adding a `calcite-fab` (floating action button) to perform an action.
- * @slot footer-actions - A slot for adding buttons to the footer.
- * @slot footer - A slot for adding custom content to the footer.
- */
- class Panel {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calcitePanelClose = createEvent(this, "calcitePanelClose", 6);
- this.calcitePanelDismiss = createEvent(this, "calcitePanelDismiss", 6);
- this.calcitePanelDismissedChange = createEvent(this, "calcitePanelDismissedChange", 6);
- this.calcitePanelScroll = createEvent(this, "calcitePanelScroll", 6);
- this.calcitePanelBackClick = createEvent(this, "calcitePanelBackClick", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, hides the component.
- *
- * @deprecated use `closed` instead.
- */
- this.dismissed = false;
- /** When `true`, the component will be hidden. */
- this.closed = false;
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * When `true`, a close button is added to the component.
- *
- * @deprecated use `closable` instead
- */
- this.dismissible = false;
- /** When `true`, displays a close button in the trailing side of the header. */
- this.closable = false;
- /**
- * When `true`, displays a back button in the header.
- *
- * @deprecated use `calcite-flow-item` instead.
- */
- this.showBackButton = false;
- /**
- * When `true`, a busy indicator is displayed.
- */
- this.loading = false;
- /**
- * When `true`, the action menu items in the `header-menu-actions` slot are open.
- */
- this.menuOpen = false;
- this.resizeObserver = createObserver();
- this.hasStartActions = false;
- this.hasEndActions = false;
- this.hasMenuItems = false;
- this.hasHeaderContent = false;
- this.hasFooterContent = false;
- this.hasFooterActions = false;
- this.hasFab = false;
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.resizeHandler = () => {
- const { panelScrollEl } = this;
- if (!panelScrollEl ||
- typeof panelScrollEl.scrollHeight !== "number" ||
- typeof panelScrollEl.offsetHeight !== "number") {
- return;
- }
- panelScrollEl.tabIndex = panelScrollEl.scrollHeight > panelScrollEl.offsetHeight ? 0 : -1;
- };
- this.setContainerRef = (node) => {
- this.containerEl = node;
- };
- this.setCloseRef = (node) => {
- this.closeButtonEl = node;
- };
- this.setBackRef = (node) => {
- this.backButtonEl = node;
- };
- this.panelKeyDownHandler = (event) => {
- if (this.closable && event.key === "Escape" && !event.defaultPrevented) {
- this.close();
- event.preventDefault();
- }
- };
- this.close = () => {
- this.closed = true;
- this.calcitePanelDismiss.emit();
- this.calcitePanelClose.emit();
- };
- this.panelScrollHandler = () => {
- this.calcitePanelScroll.emit();
- };
- this.backButtonClick = () => {
- this.calcitePanelBackClick.emit();
- };
- this.handleHeaderActionsStartSlotChange = (event) => {
- const elements = event.target.assignedElements({
- flatten: true
- });
- this.hasStartActions = !!elements.length;
- };
- this.handleHeaderActionsEndSlotChange = (event) => {
- const elements = event.target.assignedElements({
- flatten: true
- });
- this.hasEndActions = !!elements.length;
- };
- this.handleHeaderMenuActionsSlotChange = (event) => {
- const elements = event.target.assignedElements({
- flatten: true
- });
- this.hasMenuItems = !!elements.length;
- };
- this.handleHeaderContentSlotChange = (event) => {
- const elements = event.target.assignedElements({
- flatten: true
- });
- this.hasHeaderContent = !!elements.length;
- };
- this.handleFooterSlotChange = (event) => {
- const elements = event.target.assignedElements({
- flatten: true
- });
- this.hasFooterContent = !!elements.length;
- };
- this.handleFooterActionsSlotChange = (event) => {
- const elements = event.target.assignedElements({
- flatten: true
- });
- this.hasFooterActions = !!elements.length;
- };
- this.handleFabSlotChange = (event) => {
- const elements = event.target.assignedElements({
- flatten: true
- });
- this.hasFab = !!elements.length;
- };
- this.setPanelScrollEl = (el) => {
- var _a, _b;
- this.panelScrollEl = el;
- (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- if (el) {
- (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.observe(el);
- this.resizeHandler();
- }
- };
- }
- dismissedHandler(value) {
- this.closed = value;
- this.calcitePanelDismissedChange.emit();
- }
- closedHandler(value) {
- this.dismissed = value;
- }
- dismissibleHandler(value) {
- this.closable = value;
- }
- closableHandler(value) {
- this.dismissible = value;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- const isClosed = this.dismissed || this.closed;
- const isClosable = this.dismissible || this.closable;
- if (isClosed) {
- this.dismissedHandler(isClosed);
- this.closedHandler(isClosed);
- }
- if (isClosable) {
- this.dismissibleHandler(isClosable);
- this.closableHandler(isClosable);
- }
- }
- disconnectedCallback() {
- var _a;
- (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- }
- // --------------------------------------------------------------------------
- //
- // Methods
- //
- // --------------------------------------------------------------------------
- /**
- * Sets focus on the component.
- *
- * @param focusId
- */
- async setFocus(focusId) {
- const { backButtonEl, closeButtonEl, containerEl } = this;
- if (focusId === "back-button") {
- backButtonEl === null || backButtonEl === void 0 ? void 0 : backButtonEl.setFocus();
- return;
- }
- if (focusId === "dismiss-button") {
- closeButtonEl === null || closeButtonEl === void 0 ? void 0 : closeButtonEl.setFocus();
- return;
- }
- if (backButtonEl) {
- backButtonEl.setFocus();
- return;
- }
- if (closeButtonEl) {
- closeButtonEl.setFocus();
- return;
- }
- containerEl === null || containerEl === void 0 ? void 0 : containerEl.focus();
- }
- /**
- * Scrolls the component's content to a specified set of coordinates.
- *
- * @example
- * myCalciteFlowItem.scrollContentTo({
- * left: 0, // Specifies the number of pixels along the X axis to scroll the window or element.
- * top: 0, // Specifies the number of pixels along the Y axis to scroll the window or element
- * behavior: "auto" // Specifies whether the scrolling should animate smoothly (smooth), or happen instantly in a single jump (auto, the default value).
- * });
- * @param options
- */
- async scrollContentTo(options) {
- var _a;
- (_a = this.panelScrollEl) === null || _a === void 0 ? void 0 : _a.scrollTo(options);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderBackButton() {
- const { el } = this;
- const rtl = getElementDir(el) === "rtl";
- const { showBackButton, intlBack, backButtonClick } = this;
- const label = intlBack || TEXT$f.back;
- const icon = rtl ? ICONS$7.backRight : ICONS$7.backLeft;
- return showBackButton ? (hAsync("calcite-action", { "aria-label": label, class: CSS$z.backButton, icon: icon, key: "back-button", onClick: backButtonClick, ref: this.setBackRef, scale: "s", slot: SLOTS$i.headerActionsStart, text: label })) : null;
- }
- renderHeaderContent() {
- const { heading, headingLevel, summary, description, hasHeaderContent } = this;
- const headingNode = heading ? (hAsync(Heading, { class: CSS$z.heading, level: headingLevel || HEADING_LEVEL$5 }, heading)) : null;
- const descriptionNode = description || summary ? hAsync("span", { class: CSS$z.description }, description || summary) : null;
- return !hasHeaderContent && (headingNode || descriptionNode) ? (hAsync("div", { class: CSS$z.headerContent, key: "header-content" }, headingNode, descriptionNode)) : null;
- }
- /**
- * Allows user to override the entire header-content node.
- */
- renderHeaderSlottedContent() {
- return (hAsync("div", { class: CSS$z.headerContent, hidden: !this.hasHeaderContent, key: "slotted-header-content" }, hAsync("slot", { name: SLOTS$i.headerContent, onSlotchange: this.handleHeaderContentSlotChange })));
- }
- renderHeaderStartActions() {
- const { hasStartActions } = this;
- return (hAsync("div", { class: { [CSS$z.headerActionsStart]: true, [CSS$z.headerActions]: true }, hidden: !hasStartActions, key: "header-actions-start" }, hAsync("slot", { name: SLOTS$i.headerActionsStart, onSlotchange: this.handleHeaderActionsStartSlotChange })));
- }
- renderHeaderActionsEnd() {
- const { close, hasEndActions, intlClose, closable } = this;
- const text = intlClose || TEXT$f.close;
- const closableNode = closable ? (hAsync("calcite-action", { "aria-label": text, icon: ICONS$7.close, onClick: close, ref: this.setCloseRef, text: text })) : null;
- const slotNode = (hAsync("slot", { name: SLOTS$i.headerActionsEnd, onSlotchange: this.handleHeaderActionsEndSlotChange }));
- const showContainer = hasEndActions || closableNode;
- return (hAsync("div", { class: { [CSS$z.headerActionsEnd]: true, [CSS$z.headerActions]: true }, hidden: !showContainer, key: "header-actions-end" }, slotNode, closableNode));
- }
- renderMenu() {
- const { hasMenuItems, intlOptions, menuOpen } = this;
- return (hAsync("calcite-action-menu", { flipPlacements: ["top", "bottom"], hidden: !hasMenuItems, key: "menu", label: intlOptions || TEXT$f.options, open: menuOpen, placement: "bottom-end" }, hAsync("calcite-action", { icon: ICONS$7.menu, slot: SLOTS$s.trigger, text: intlOptions || TEXT$f.options }), hAsync("slot", { name: SLOTS$i.headerMenuActions, onSlotchange: this.handleHeaderMenuActionsSlotChange })));
- }
- renderHeaderNode() {
- const { showBackButton, hasHeaderContent, hasStartActions, hasEndActions, closable, hasMenuItems } = this;
- const headerContentNode = this.renderHeaderContent();
- const showHeader = showBackButton ||
- hasHeaderContent ||
- headerContentNode ||
- hasStartActions ||
- hasEndActions ||
- closable ||
- hasMenuItems;
- return (hAsync("header", { class: CSS$z.header, hidden: !showHeader }, this.renderBackButton(), this.renderHeaderStartActions(), this.renderHeaderSlottedContent(), headerContentNode, this.renderHeaderActionsEnd(), this.renderMenu()));
- }
- renderFooterNode() {
- const { hasFooterContent, hasFooterActions } = this;
- const showFooter = hasFooterContent || hasFooterActions;
- return (hAsync("footer", { class: CSS$z.footer, hidden: !showFooter }, hAsync("slot", { key: "footer-slot", name: SLOTS$i.footer, onSlotchange: this.handleFooterSlotChange }), hAsync("slot", { key: "footer-actions-slot", name: SLOTS$i.footerActions, onSlotchange: this.handleFooterActionsSlotChange })));
- }
- renderContent() {
- const { hasFab } = this;
- const defaultSlotNode = hAsync("slot", { key: "default-slot" });
- const containerNode = hasFab ? (hAsync("section", { class: CSS$z.contentContainer }, defaultSlotNode)) : (defaultSlotNode);
- return (hAsync("div", { class: {
- [CSS$z.contentWrapper]: true,
- [CSS$z.contentContainer]: !hasFab,
- [CSS$z.contentHeight]: hasFab
- }, onScroll: this.panelScrollHandler, ref: this.setPanelScrollEl }, containerNode, this.renderFab()));
- }
- renderFab() {
- return (hAsync("div", { class: CSS$z.fabContainer, hidden: !this.hasFab }, hAsync("slot", { name: SLOTS$i.fab, onSlotchange: this.handleFabSlotChange })));
- }
- render() {
- const { loading, panelKeyDownHandler, closed, closable } = this;
- const panelNode = (hAsync("article", { "aria-busy": toAriaBoolean(loading), class: CSS$z.container, hidden: closed, onKeyDown: panelKeyDownHandler, ref: this.setContainerRef, tabIndex: closable ? 0 : -1 }, this.renderHeaderNode(), this.renderContent(), this.renderFooterNode()));
- return (hAsync(Fragment, null, loading ? hAsync("calcite-scrim", { loading: loading }) : null, panelNode));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "dismissed": ["dismissedHandler"],
- "closed": ["closedHandler"],
- "dismissible": ["dismissibleHandler"],
- "closable": ["closableHandler"]
- }; }
- static get style() { return panelCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-panel",
- "$members$": {
- "dismissed": [1540],
- "closed": [1540],
- "beforeBack": [16],
- "disabled": [516],
- "dismissible": [1540],
- "closable": [1540],
- "headingLevel": [514, "heading-level"],
- "showBackButton": [516, "show-back-button"],
- "intlBack": [1, "intl-back"],
- "heightScale": [513, "height-scale"],
- "widthScale": [513, "width-scale"],
- "loading": [516],
- "intlClose": [1, "intl-close"],
- "intlOptions": [1, "intl-options"],
- "heading": [1],
- "summary": [1],
- "description": [1],
- "menuOpen": [516, "menu-open"],
- "hasStartActions": [32],
- "hasEndActions": [32],
- "hasMenuItems": [32],
- "hasHeaderContent": [32],
- "hasFooterContent": [32],
- "hasFooterActions": [32],
- "hasFab": [32],
- "setFocus": [64],
- "scrollContentTo": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["dismissed", "dismissed"], ["closed", "closed"], ["disabled", "disabled"], ["dismissible", "dismissible"], ["closable", "closable"], ["headingLevel", "heading-level"], ["showBackButton", "show-back-button"], ["heightScale", "height-scale"], ["widthScale", "width-scale"], ["loading", "loading"], ["menuOpen", "menu-open"]]
- }; }
- }
- const CSS$k = {
- sticky: "sticky-pos"
- };
- var ICON_TYPES$1;
- (function (ICON_TYPES) {
- ICON_TYPES["circle"] = "circle";
- ICON_TYPES["square"] = "square";
- ICON_TYPES["grip"] = "grip";
- })(ICON_TYPES$1 || (ICON_TYPES$1 = {}));
- const SLOTS$b = {
- menuActions: "menu-actions"
- };
- const CSS$j = {
- heading: "heading",
- container: "container",
- indented: "container--indented"
- };
- const SLOTS$a = {
- parentItem: "parent-item"
- };
- const HEADING_LEVEL$3 = 3;
- function mutationObserverCallback() {
- this.setUpItems();
- this.setUpFilter();
- this.deselectRemovedItems();
- }
- const SUPPORTED_ARROW_KEYS = ["ArrowUp", "ArrowDown"];
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- function initialize() {
- this.setUpItems();
- this.setUpFilter();
- this.emitCalciteListChange = debounce(internalCalciteListChangeEvent.bind(this), 0);
- }
- function initializeObserver() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- }
- function cleanUpObserver() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- }
- // --------------------------------------------------------------------------
- //
- // Listeners
- //
- // --------------------------------------------------------------------------
- function calciteListItemChangeHandler(event) {
- const { selectedValues } = this;
- const { item, value, selected, shiftPressed } = event.detail;
- if (selected) {
- if (this.multiple && shiftPressed) {
- this.selectSiblings(item);
- }
- if (!this.multiple) {
- this.deselectSiblingItems(item);
- }
- selectedValues.set(value, item);
- }
- else {
- selectedValues.delete(value);
- if (this.multiple && shiftPressed) {
- this.selectSiblings(item, true);
- }
- }
- if (!this.multiple) {
- toggleSingleSelectItemTabbing(item, selected);
- if (selected) {
- focusElement(item);
- }
- }
- this.lastSelectedItem = item;
- this.emitCalciteListChange();
- }
- function calciteInternalListItemValueChangeHandler(event) {
- const oldValue = event.detail.oldValue;
- const selectedValues = this.selectedValues;
- if (selectedValues.has(oldValue)) {
- const item = selectedValues.get(oldValue);
- selectedValues.delete(oldValue);
- selectedValues.set(event.detail.newValue, item);
- }
- event.stopPropagation();
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- function isValidNavigationKey(key) {
- return !!SUPPORTED_ARROW_KEYS.find((k) => k === key);
- }
- function calciteListFocusOutHandler(event) {
- const { el, items, multiple, selectedValues } = this;
- if (multiple) {
- return;
- }
- const focusedInside = el.contains(event.relatedTarget);
- if (focusedInside) {
- return;
- }
- filterOutDisabled(items).forEach((item) => {
- toggleSingleSelectItemTabbing(item, selectedValues.size === 0 ? item.contains(event.target) || event.target === item : item.selected);
- });
- }
- function keyDownHandler(event) {
- const { key, target } = event;
- if (!isValidNavigationKey(key)) {
- return;
- }
- const { items, multiple, selectionFollowsFocus } = this;
- const { length: totalItems } = items;
- const currentIndex = items.indexOf(target);
- if (!totalItems || currentIndex === -1) {
- return;
- }
- event.preventDefault();
- const index = moveItemIndex(this, target, key === "ArrowUp" ? "up" : "down");
- const item = items[index];
- items.forEach((i) => toggleSingleSelectItemTabbing(i, i === item));
- if (!multiple && selectionFollowsFocus) {
- item.selected = true;
- }
- focusElement(item);
- }
- function moveItemIndex(list, item, direction) {
- const { items } = list;
- const { length: totalItems } = items;
- const currentIndex = items.indexOf(item);
- const directionFactor = direction === "up" ? -1 : 1;
- let moveOffset = 1;
- let index = getRoundRobinIndex(currentIndex + directionFactor * moveOffset++, totalItems);
- const firstMovedIndex = index;
- while (items[index].disabled) {
- index = getRoundRobinIndex(currentIndex + directionFactor * moveOffset++, totalItems);
- if (index === firstMovedIndex) {
- break;
- }
- }
- return index;
- }
- function getItemIndex(list, item) {
- const { items } = list;
- return items.indexOf(item);
- }
- function filterOutDisabled(items) {
- return items.filter((item) => !item.disabled);
- }
- function internalCalciteListChangeEvent() {
- this.calciteListChange.emit(this.selectedValues);
- }
- function removeItem(event) {
- if (event.defaultPrevented) {
- return;
- }
- const item = event.target;
- const selectedValues = this.selectedValues;
- if (item.parentElement.tagName === "CALCITE-PICK-LIST-GROUP" && item.slot === SLOTS$a.parentItem) {
- item.parentElement.remove();
- Array.from(item.parentElement.children).forEach((item) => selectedValues.delete(item.value));
- }
- else {
- item.remove();
- selectedValues.delete(item.value);
- }
- this.emitCalciteListChange();
- }
- function toggleSingleSelectItemTabbing(item, selectable) {
- if (item.disabled) {
- return;
- }
- // using attribute intentionally
- if (selectable) {
- item.removeAttribute("tabindex");
- }
- else {
- item.setAttribute("tabindex", "-1");
- }
- }
- async function setFocus(focusId) {
- var _a;
- if (this.filterEnabled && focusId === "filter") {
- await focusElement(this.filterEl);
- return;
- }
- const { items, multiple, selectionFollowsFocus } = this;
- if (items.length === 0) {
- return;
- }
- if (multiple) {
- return (_a = filterOutDisabled(items)[0]) === null || _a === void 0 ? void 0 : _a.setFocus();
- }
- const filtered = filterOutDisabled(items);
- const focusTarget = filtered.find((item) => item.selected) || filtered[0];
- if (selectionFollowsFocus && focusTarget) {
- focusTarget.selected = true;
- }
- return focusTarget.setFocus();
- }
- function setUpItems(tagName) {
- this.items = Array.from(this.el.querySelectorAll(tagName));
- let hasSelected = false;
- const { items } = this;
- items.forEach((item) => {
- item.icon = this.getIconType();
- if (!this.multiple) {
- item.disableDeselect = true;
- toggleSingleSelectItemTabbing(item, false);
- }
- if (item.selected) {
- hasSelected = true;
- toggleSingleSelectItemTabbing(item, true);
- this.selectedValues.set(item.value, item);
- }
- });
- const [first] = items;
- if (!hasSelected && first && !first.disabled) {
- toggleSingleSelectItemTabbing(first, true);
- }
- }
- function deselectRemovedItems() {
- const selectedValues = this.selectedValues;
- const itemValues = this.items.map(({ value }) => value);
- selectedValues.forEach((selectedItem) => {
- if (!itemValues.includes(selectedItem.value)) {
- this.selectedValues.delete(selectedItem.value);
- }
- });
- }
- function deselectSiblingItems(item) {
- this.items.forEach((currentItem) => {
- if (currentItem.value !== item.value) {
- currentItem.toggleSelected(false);
- if (this.selectedValues.has(currentItem.value)) {
- this.selectedValues.delete(currentItem.value);
- }
- }
- });
- }
- function selectSiblings(item, deselect = false) {
- if (!this.lastSelectedItem) {
- return;
- }
- const { items } = this;
- const start = items.findIndex((currentItem) => {
- return currentItem.value === this.lastSelectedItem.value;
- });
- const end = items.findIndex((currentItem) => {
- return currentItem.value === item.value;
- });
- items.slice(Math.min(start, end), Math.max(start, end)).forEach((currentItem) => {
- currentItem.toggleSelected(!deselect);
- if (!deselect) {
- this.selectedValues.set(currentItem.value, currentItem);
- }
- else {
- this.selectedValues.delete(currentItem.value);
- }
- });
- }
- let groups;
- function handleFilter(event) {
- const { filteredItems } = event.currentTarget;
- const values = filteredItems.map((item) => item.value);
- let hasSelectedMatch = false;
- if (!groups) {
- groups = new Set();
- }
- const matchedItems = this.items.filter((item) => {
- const parent = item.parentElement;
- const grouped = parent.matches("calcite-pick-list-group");
- if (grouped) {
- groups.add(parent);
- }
- const matches = values.includes(item.value);
- item.hidden = !matches;
- if (!hasSelectedMatch) {
- hasSelectedMatch = matches && item.selected;
- }
- return matches;
- });
- groups.forEach((group) => {
- const hasAtLeastOneMatch = matchedItems.some((item) => group.contains(item));
- group.hidden = !hasAtLeastOneMatch;
- if (!hasAtLeastOneMatch) {
- return;
- }
- const parentItem = getSlotted(group, "parent-item");
- if (parentItem) {
- parentItem.hidden = false;
- if (matchedItems.includes(parentItem)) {
- Array.from(group.children).forEach((child) => (child.hidden = false));
- }
- }
- });
- groups.clear();
- if (matchedItems.length > 0 && !hasSelectedMatch && !this.multiple) {
- toggleSingleSelectItemTabbing(matchedItems[0], true);
- }
- }
- function getItemData() {
- return this.items.map((item) => ({
- label: item.label,
- description: item.description,
- metadata: item.metadata,
- value: item.value
- }));
- }
- const List = ({ props: { disabled, loading, filterEnabled, dataForFilter, handleFilter, filterPlaceholder, setFilterEl, dragEnabled, storeAssistiveEl }, ...rest }) => {
- const defaultSlot = hAsync("slot", null);
- return (hAsync(Host, { "aria-busy": toAriaBoolean(loading), role: "menu", ...rest },
- hAsync("section", null,
- dragEnabled ? (hAsync("span", { "aria-live": "assertive", class: "assistive-text", ref: storeAssistiveEl })) : null,
- hAsync("header", { class: { [CSS$k.sticky]: true } },
- filterEnabled ? (hAsync("calcite-filter", { "aria-label": filterPlaceholder, disabled: loading || disabled, items: dataForFilter, onCalciteFilterChange: handleFilter, placeholder: filterPlaceholder, ref: setFilterEl })) : null,
- hAsync("slot", { name: SLOTS$b.menuActions })),
- loading ? hAsync("calcite-scrim", { loading: loading }) : null,
- defaultSlot)));
- };
- const pickListCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pick-list{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pick-list{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pick-list{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pick-list{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-pick-list:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-pick-list:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-pick-list-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-pick-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-pick-list-h{position:relative;box-sizing:border-box;display:flex;flex-shrink:0;flex-grow:1;flex-direction:column;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{box-sizing:border-box}/*!@: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-block-end:0.25rem;display:flex;align-items:stretch;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);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:sticky;inset-block-start:0px;z-index:1}/*!@calcite-filter*/calcite-filter.sc-calcite-pick-list{margin-block-end:0px}/*!@:host([loading][disabled])*/[loading][disabled].sc-calcite-pick-list-h{min-block-size:2rem}";
- /**
- * @slot - A slot for adding `calcite-pick-list-item` or `calcite-pick-list-group` elements. Items are displayed as a vertical list.
- * @slot menu-actions - A slot for adding a button and menu combination for performing actions, such as sorting.
- */
- class PickList {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteListChange = createEvent(this, "calciteListChange", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * When `true`, an input appears at the top of the list that can be used by end users to filter items in the list.
- */
- this.filterEnabled = false;
- /**
- * When `true`, a busy indicator is displayed.
- */
- this.loading = false;
- /**
- * Similar to standard radio buttons and checkboxes.
- * When `true`, a user can select multiple `calcite-pick-list-item`s at a time.
- * When `false`, only a single `calcite-pick-list-item` can be selected at a time,
- * and a new selection will deselect previous selections.
- */
- this.multiple = false;
- /**
- * When `true` and single selection is enabled, the selection changes when navigating `calcite-pick-list-item`s via keyboard.
- */
- this.selectionFollowsFocus = false;
- // --------------------------------------------------------------------------
- //
- // Private Properties
- //
- // --------------------------------------------------------------------------
- this.selectedValues = new Map();
- this.dataForFilter = [];
- this.lastSelectedItem = null;
- this.mutationObserver = createObserver("mutation", mutationObserverCallback.bind(this));
- this.setFilterEl = (el) => {
- this.filterEl = el;
- };
- this.deselectRemovedItems = deselectRemovedItems.bind(this);
- this.deselectSiblingItems = deselectSiblingItems.bind(this);
- this.selectSiblings = selectSiblings.bind(this);
- this.handleFilter = handleFilter.bind(this);
- this.getItemData = getItemData.bind(this);
- this.keyDownHandler = keyDownHandler.bind(this);
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- initialize.call(this);
- initializeObserver.call(this);
- }
- disconnectedCallback() {
- cleanUpObserver.call(this);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- calciteListItemRemoveHandler(event) {
- removeItem.call(this, event);
- }
- calciteListItemChangeHandler(event) {
- calciteListItemChangeHandler.call(this, event);
- }
- calciteInternalListItemPropsChangeHandler(event) {
- event.stopPropagation();
- this.setUpFilter();
- }
- calciteInternalListItemValueChangeHandler(event) {
- calciteInternalListItemValueChangeHandler.call(this, event);
- event.stopPropagation();
- }
- calciteListFocusOutHandler(event) {
- calciteListFocusOutHandler.call(this, event);
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- setUpItems() {
- setUpItems.call(this, "calcite-pick-list-item");
- }
- setUpFilter() {
- if (this.filterEnabled) {
- this.dataForFilter = this.getItemData();
- }
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /** Returns the component's selected `calcite-pick-list-item`s. */
- async getSelectedItems() {
- return this.selectedValues;
- }
- /**
- * Sets focus on the component.
- *
- * @param focusId
- */
- async setFocus(focusId) {
- return setFocus.call(this, focusId);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- getIconType() {
- return this.multiple ? ICON_TYPES$1.square : ICON_TYPES$1.circle;
- }
- render() {
- return hAsync(List, { onKeyDown: this.keyDownHandler, props: this });
- }
- get el() { return getElement(this); }
- static get style() { return pickListCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-pick-list",
- "$members$": {
- "disabled": [516],
- "filterEnabled": [516, "filter-enabled"],
- "filterPlaceholder": [513, "filter-placeholder"],
- "headingLevel": [514, "heading-level"],
- "loading": [516],
- "multiple": [516],
- "selectionFollowsFocus": [516, "selection-follows-focus"],
- "selectedValues": [32],
- "dataForFilter": [32],
- "getSelectedItems": [64],
- "setFocus": [64]
- },
- "$listeners$": [[0, "calciteListItemRemove", "calciteListItemRemoveHandler"], [0, "calciteListItemChange", "calciteListItemChangeHandler"], [0, "calciteInternalListItemPropsChange", "calciteInternalListItemPropsChangeHandler"], [0, "calciteInternalListItemValueChange", "calciteInternalListItemValueChangeHandler"], [0, "focusout", "calciteListFocusOutHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["filterEnabled", "filter-enabled"], ["filterPlaceholder", "filter-placeholder"], ["headingLevel", "heading-level"], ["loading", "loading"], ["multiple", "multiple"], ["selectionFollowsFocus", "selection-follows-focus"]]
- }; }
- }
- const pickListGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pick-list-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pick-list-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pick-list-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pick-list-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-pick-list-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-pick-list-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-pick-list-group-h{display:none}/*!@:host*/.sc-calcite-pick-list-group-h{margin-block-end:0.25rem;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{box-sizing:border-box}/*!@:host(:last-child)*/.sc-calcite-pick-list-group-h:last-child{margin-block-end:0px}/*!@.header*/.header.sc-calcite-pick-list-group{margin:0px;display:flex;align-content:space-between;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{flex:1 1 auto;padding:0.5rem}/*!@.heading*/.heading.sc-calcite-pick-list-group{margin-block:0.5rem;margin-inline:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;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{margin-inline-start:1.5rem}";
- /**
- * @slot - A slot for adding `calcite-pick-list-item` elements.
- */
- class PickListGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- var _a;
- const { el, groupTitle, headingLevel } = this;
- const hasParentItem = getSlotted(el, SLOTS$a.parentItem) !== null;
- const sectionClasses = {
- [CSS$j.container]: true,
- [CSS$j.indented]: hasParentItem
- };
- const title = groupTitle;
- const parentLevel = (_a = el.closest("calcite-pick-list")) === null || _a === void 0 ? void 0 : _a.headingLevel;
- const relativeLevel = parentLevel ? constrainHeadingLevel(parentLevel + 1) : null;
- const level = headingLevel || relativeLevel || HEADING_LEVEL$3;
- return (hAsync(Fragment, null, title ? (hAsync(Heading, { class: CSS$j.heading, level: level }, title)) : null, hAsync("slot", { name: SLOTS$a.parentItem }), hAsync("section", { class: sectionClasses }, hAsync("slot", null))));
- }
- get el() { return getElement(this); }
- static get style() { return pickListGroupCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-pick-list-group",
- "$members$": {
- "groupTitle": [513, "group-title"],
- "headingLevel": [514, "heading-level"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["groupTitle", "group-title"], ["headingLevel", "heading-level"]]
- }; }
- }
- const CSS$i = {
- actions: "actions",
- actionsEnd: "actions--end",
- actionsStart: "actions--start",
- description: "description",
- handle: "handle",
- handleActivated: "handle--activated",
- highlight: "highlight",
- icon: "icon",
- iconDot: "icon-dot",
- label: "label",
- remove: "remove",
- title: "title",
- textContainer: "text-container"
- };
- const ICONS$4 = {
- checked: "check",
- remove: "x"
- };
- const SLOTS$9 = {
- actionsEnd: "actions-end",
- actionsStart: "actions-start"
- };
- const TEXT$7 = {
- remove: "Remove"
- };
- const pickListItemCss = "@charset \"UTF-8\";@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-pick-list-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-pick-list-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-pick-list-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-pick-list-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-pick-list-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-pick-list-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-pick-list-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-pick-list-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-pick-list-item-h{margin:0px;margin-block-end:1px;box-sizing:border-box;display:flex;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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition:background-color var(--calcite-animation-timing);animation:calcite-fade-in var(--calcite-animation-timing)}/*!@:host **/.sc-calcite-pick-list-item-h *.sc-calcite-pick-list-item{box-sizing:border-box}/*!@.label*/.label.sc-calcite-pick-list-item{display:flex;flex:1 1 auto;cursor:pointer;align-items:center;background-color:transparent;outline-color:transparent}/*!@.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, \n: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-block:0px;display:flex;cursor:pointer;align-items:center;padding:0.25rem;color:var(--calcite-ui-brand);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:flex;inline-size:1.5rem;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{transition:opacity var(--calcite-animation-timing);opacity:1}/*!@.text-container*/.text-container.sc-calcite-pick-list-item{pointer-events:none;display:flex;flex-direction:column;flex-wrap:nowrap;overflow:hidden;padding-block:0.5rem;padding-inline: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-block-start: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:flex;flex:0 1 auto;align-items:stretch;justify-content:flex-end}/*!@.actions--start ~ .label*/.actions--start.sc-calcite-pick-list-item~.label.sc-calcite-pick-list-item{padding-inline-start:0.25rem}/*!@: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}";
- /**
- * @slot actions-end - A slot for adding `calcite-action`s or content to the end side of the component.
- * @slot actions-start - A slot for adding `calcite-action`s or content to the start side of the component.
- */
- class PickListItem {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteListItemChange = createEvent(this, "calciteListItemChange", 6);
- this.calciteListItemRemove = createEvent(this, "calciteListItemRemove", 7);
- this.calciteInternalListItemPropsChange = createEvent(this, "calciteInternalListItemPropsChange", 6);
- this.calciteInternalListItemValueChange = createEvent(this, "calciteInternalListItemValueChange", 6);
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * When `false`, the component cannot be deselected by user interaction.
- */
- this.disableDeselect = false;
- /**
- * @internal
- */
- this.nonInteractive = false;
- /**
- * Determines the icon SVG symbol that will be shown. Options are `"circle"`, `"square"`, `"grip"` or `null`.
- *
- * @see [ICON_TYPES](https://github.com/Esri/calcite-components/blob/master/src/components/pick-list/resources.ts#L5)
- */
- this.icon = null;
- /**
- * When `true`, displays a remove action that removes the item from the list.
- */
- this.removable = false;
- /**
- * When `true`, selects an item. Toggles when an item is checked/unchecked.
- */
- this.selected = false;
- /**
- * When `removable` is `true`, the accessible name for the component's remove button.
- *
- * @default "Remove"
- */
- this.intlRemove = TEXT$7.remove;
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.pickListClickHandler = (event) => {
- if (this.disabled || (this.disableDeselect && this.selected) || this.nonInteractive) {
- return;
- }
- this.shiftPressed = event.shiftKey;
- this.selected = !this.selected;
- };
- this.pickListKeyDownHandler = (event) => {
- if (event.key === " ") {
- event.preventDefault();
- if ((this.disableDeselect && this.selected) || this.nonInteractive) {
- return;
- }
- this.selected = !this.selected;
- }
- };
- this.removeClickHandler = () => {
- this.calciteListItemRemove.emit();
- };
- }
- descriptionWatchHandler() {
- this.calciteInternalListItemPropsChange.emit();
- }
- labelWatchHandler() {
- this.calciteInternalListItemPropsChange.emit();
- }
- metadataWatchHandler() {
- this.calciteInternalListItemPropsChange.emit();
- }
- selectedWatchHandler() {
- this.calciteListItemChange.emit({
- item: this.el,
- value: this.value,
- selected: this.selected,
- shiftPressed: this.shiftPressed
- });
- this.shiftPressed = false;
- }
- valueWatchHandler(newValue, oldValue) {
- this.calciteInternalListItemValueChange.emit({ oldValue, newValue });
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- componentDidRender() {
- updateHostInteraction(this, this.el.closest("calcite-pick-list") ? "managed" : false);
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /**
- * Toggles the selection state. By default this won't trigger an event.
- * The first argument allows the value to be coerced, rather than swapping values.
- *
- * @param coerce
- */
- async toggleSelected(coerce) {
- this.selected = typeof coerce === "boolean" ? coerce : !this.selected;
- }
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.focusEl) === null || _a === void 0 ? void 0 : _a.focus();
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderIcon() {
- const { icon } = this;
- if (!icon) {
- return null;
- }
- return (hAsync("span", { class: {
- [CSS$i.icon]: true,
- [CSS$i.iconDot]: icon === ICON_TYPES$1.circle
- }, onClick: this.pickListClickHandler }, icon === ICON_TYPES$1.square ? hAsync("calcite-icon", { icon: ICONS$4.checked, scale: "s" }) : null));
- }
- renderRemoveAction() {
- return this.removable ? (hAsync("calcite-action", { class: CSS$i.remove, icon: ICONS$4.remove, onCalciteActionClick: this.removeClickHandler, slot: SLOTS$9.actionsEnd, text: this.intlRemove })) : null;
- }
- renderActionsStart() {
- const { el } = this;
- const hasActionsStart = getSlotted(el, SLOTS$9.actionsStart);
- return hasActionsStart ? (hAsync("div", { class: { [CSS$i.actions]: true, [CSS$i.actionsStart]: true } }, hAsync("slot", { name: SLOTS$9.actionsStart }))) : null;
- }
- renderActionsEnd() {
- const { el, removable } = this;
- const hasActionsEnd = getSlotted(el, SLOTS$9.actionsEnd);
- return hasActionsEnd || removable ? (hAsync("div", { class: { [CSS$i.actions]: true, [CSS$i.actionsEnd]: true } }, hAsync("slot", { name: SLOTS$9.actionsEnd }), this.renderRemoveAction())) : null;
- }
- render() {
- const { description, label } = this;
- return (hAsync(Fragment, null, this.renderIcon(), this.renderActionsStart(), hAsync("label", { "aria-label": label, class: CSS$i.label, onClick: this.pickListClickHandler, onKeyDown: this.pickListKeyDownHandler, ref: (focusEl) => (this.focusEl = focusEl), tabIndex: 0 }, hAsync("div", { "aria-checked": toAriaBoolean(this.selected), class: CSS$i.textContainer, role: "menuitemcheckbox" }, hAsync("span", { class: CSS$i.title }, label), description ? hAsync("span", { class: CSS$i.description }, description) : null)), this.renderActionsEnd()));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "description": ["descriptionWatchHandler"],
- "label": ["labelWatchHandler"],
- "metadata": ["metadataWatchHandler"],
- "selected": ["selectedWatchHandler"],
- "value": ["valueWatchHandler"]
- }; }
- static get style() { return pickListItemCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-pick-list-item",
- "$members$": {
- "description": [513],
- "disabled": [516],
- "disableDeselect": [516, "disable-deselect"],
- "nonInteractive": [516, "non-interactive"],
- "icon": [513],
- "label": [513],
- "metadata": [16],
- "removable": [516],
- "selected": [1540],
- "intlRemove": [513, "intl-remove"],
- "value": [8],
- "toggleSelected": [64],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["description", "description"], ["disabled", "disabled"], ["disableDeselect", "disable-deselect"], ["nonInteractive", "non-interactive"], ["icon", "icon"], ["label", "label"], ["removable", "removable"], ["selected", "selected"], ["intlRemove", "intl-remove"]]
- }; }
- }
- const CSS$h = {
- container: "container",
- arrow: "arrow",
- imageContainer: "image-container",
- closeButtonContainer: "close-button-container",
- closeButton: "close-button",
- content: "content",
- hasHeader: "has-header",
- header: "header",
- headerContent: "header-content",
- heading: "heading"
- };
- const TEXT$6 = {
- close: "Close"
- };
- const defaultPopoverPlacement = "auto";
- const ARIA_CONTROLS = "aria-controls";
- const ARIA_EXPANDED = "aria-expanded";
- const HEADING_LEVEL$2 = 2;
- class PopoverManager$1 {
- constructor() {
- // --------------------------------------------------------------------------
- //
- // Private Properties
- //
- // --------------------------------------------------------------------------
- this.registeredElements = new Map();
- this.registeredElementCount = 0;
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.queryPopover = (composedPath) => {
- const { registeredElements } = this;
- const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
- return registeredElements.get(registeredElement);
- };
- this.togglePopovers = (event) => {
- const composedPath = event.composedPath();
- const togglePopover = this.queryPopover(composedPath);
- if (togglePopover && !togglePopover.triggerDisabled) {
- togglePopover.toggle();
- }
- Array.from(this.registeredElements.values())
- .filter((popover) => popover !== togglePopover && popover.autoClose && popover.open && !composedPath.includes(popover))
- .forEach((popover) => popover.toggle(false));
- };
- this.keyHandler = (event) => {
- if (event.defaultPrevented || !isActivationKey(event.key)) {
- return;
- }
- this.togglePopovers(event);
- };
- this.clickHandler = (event) => {
- if (isPrimaryPointerButton(event)) {
- this.togglePopovers(event);
- }
- };
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- registerElement(referenceEl, popover) {
- this.registeredElementCount++;
- this.registeredElements.set(referenceEl, popover);
- if (this.registeredElementCount === 1) {
- this.addListeners();
- }
- }
- unregisterElement(referenceEl) {
- if (this.registeredElements.delete(referenceEl)) {
- this.registeredElementCount--;
- }
- if (this.registeredElementCount === 0) {
- this.removeListeners();
- }
- }
- addListeners() {
- document.addEventListener("pointerdown", this.clickHandler, { capture: true });
- document.addEventListener("keydown", this.keyHandler, { capture: true });
- }
- removeListeners() {
- document.removeEventListener("pointerdown", this.clickHandler, { capture: true });
- document.removeEventListener("keydown", this.keyHandler, { capture: true });
- }
- }
- const popoverCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-popover{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-popover{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-popover{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-popover{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-popover:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-popover:root{--calcite-floating-ui-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}/*!@.calcite-floating-ui-anim*/.calcite-floating-ui-anim.sc-calcite-popover{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@:host([data-placement^=bottom]) .calcite-floating-ui-anim*/[data-placement^=bottom].sc-calcite-popover-h .calcite-floating-ui-anim.sc-calcite-popover{transform:translateY(-5px)}/*!@:host([data-placement^=top]) .calcite-floating-ui-anim*/[data-placement^=top].sc-calcite-popover-h .calcite-floating-ui-anim.sc-calcite-popover{transform:translateY(5px)}/*!@:host([data-placement^=left]) .calcite-floating-ui-anim*/[data-placement^=left].sc-calcite-popover-h .calcite-floating-ui-anim.sc-calcite-popover{transform:translateX(5px)}/*!@:host([data-placement^=right]) .calcite-floating-ui-anim*/[data-placement^=right].sc-calcite-popover-h .calcite-floating-ui-anim.sc-calcite-popover{transform:translateX(-5px)}/*!@:host([data-placement]) .calcite-floating-ui-anim--active*/[data-placement].sc-calcite-popover-h .calcite-floating-ui-anim--active.sc-calcite-popover{opacity:1;visibility:visible;transform:translate(0)}/*!@:host([calcite-hydrated-hidden])*/[calcite-hydrated-hidden].sc-calcite-popover-h{visibility:hidden !important;pointer-events:none}/*!@.arrow,\n.arrow::before*/.arrow.sc-calcite-popover,.arrow.sc-calcite-popover::before{position:absolute;inline-size:8px;block-size: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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transform:rotate(45deg);background:var(--calcite-ui-foreground-1)}/*!@:host([data-placement^=top]) .arrow*/[data-placement^=top].sc-calcite-popover-h .arrow.sc-calcite-popover{inset-block-end:-4px}/*!@:host([data-placement^=bottom]) .arrow*/[data-placement^=bottom].sc-calcite-popover-h .arrow.sc-calcite-popover{inset-block-start:-4px}/*!@:host([data-placement^=left]) .arrow*/[data-placement^=left].sc-calcite-popover-h .arrow.sc-calcite-popover{direction:ltr;inset-inline-end:-4px}/*!@:host([data-placement^=right]) .arrow*/[data-placement^=right].sc-calcite-popover-h .arrow.sc-calcite-popover{direction:ltr;inset-inline-start:-4px}/*!@:host*/.sc-calcite-popover-h{pointer-events:none}/*!@:host([open])*/[open].sc-calcite-popover-h{pointer-events:initial}/*!@.calcite-floating-ui-anim*/.calcite-floating-ui-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:flex;flex:1 1 auto;align-items:stretch;justify-content:flex-start;border-width:0px;border-block-end-width:1px;border-style:solid;background-color:var(--calcite-ui-foreground-1);border-block-end-color:var(--calcite-ui-border-3)}/*!@.heading*/.heading.sc-calcite-popover{margin:0px;display:block;flex:1 1 auto;align-self:center;white-space:normal;padding-inline:1rem;padding-block: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:flex;block-size:100%;flex-direction:row;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{flex-direction:column}/*!@.content*/.content.sc-calcite-popover{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;align-self:center;word-wrap:break-word;word-break:break-word}/*!@.close-button-container*/.close-button-container.sc-calcite-popover{display:flex;overflow:hidden;flex:0 0 auto;border-start-end-radius:0.25rem;border-end-end-radius:0.25rem}/*!@::slotted(calcite-panel), \n::slotted(calcite-flow)*/.sc-calcite-popover-s>calcite-panel,.sc-calcite-popover-s>calcite-flow{block-size:100%}";
- const manager$1 = new PopoverManager$1();
- /**
- * @slot - A slot for adding custom content.
- */
- class Popover {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calcitePopoverBeforeClose = createEvent(this, "calcitePopoverBeforeClose", 6);
- this.calcitePopoverClose = createEvent(this, "calcitePopoverClose", 6);
- this.calcitePopoverBeforeOpen = createEvent(this, "calcitePopoverBeforeOpen", 6);
- this.calcitePopoverOpen = createEvent(this, "calcitePopoverOpen", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, clicking outside of the component automatically closes open `calcite-popover`s.
- */
- this.autoClose = false;
- /**
- * When `true`, a close button is added to the component.
- *
- * @deprecated use dismissible instead.
- */
- this.closeButton = false;
- /**
- * When `true`, a close button is added to the component.
- *
- * @deprecated use `closable` instead.
- */
- this.dismissible = false;
- /** When `true`, display a close button within the component. */
- this.closable = false;
- /**
- * When `true`, prevents flipping the component's placement when overlapping its `referenceElement`.
- */
- this.disableFlip = false;
- /**
- * When `true`, removes the caret pointer.
- */
- this.disablePointer = false;
- /**
- * Offsets the position of the component away from the `referenceElement`.
- *
- * @default 6
- */
- this.offsetDistance = defaultOffsetDistance;
- /**
- * Offsets the position of the component along the `referenceElement`.
- */
- this.offsetSkidding = 0;
- /**
- * When `true`, displays and positions the component.
- */
- this.open = false;
- /**
- * Determines the type of positioning to use for the overlaid content.
- *
- * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
- *
- * `"fixed"` value should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
- *
- */
- this.overlayPositioning = "absolute";
- /**
- * Determines where the component will be positioned relative to the `referenceElement`.
- *
- * @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
- */
- this.placement = defaultPopoverPlacement;
- /**
- * When `true`, disables automatically toggling the component when its `referenceElement` has been triggered.
- *
- * This property can be set to `true` to manage when the component is open.
- */
- this.triggerDisabled = false;
- /**
- * Accessible name for the component's close button.
- *
- * @default "Close"
- */
- this.intlClose = TEXT$6.close;
- this.guid = `calcite-popover-${guid()}`;
- this.openTransitionProp = "opacity";
- this.hasLoaded = false;
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.setTransitionEl = (el) => {
- this.transitionEl = el;
- connectOpenCloseComponent(this);
- };
- this.setFilteredPlacements = () => {
- const { el, flipPlacements } = this;
- this.filteredFlipPlacements = flipPlacements
- ? filterComputedPlacements(flipPlacements, el)
- : null;
- };
- this.setUpReferenceElement = (warn = true) => {
- this.removeReferences();
- this.effectiveReferenceElement = this.getReferenceElement();
- connectFloatingUI(this, this.effectiveReferenceElement, this.el);
- const { el, referenceElement, effectiveReferenceElement } = this;
- if (warn && referenceElement && !effectiveReferenceElement) {
- console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
- el
- });
- }
- this.addReferences();
- };
- this.getId = () => {
- return this.el.id || this.guid;
- };
- this.setExpandedAttr = () => {
- const { effectiveReferenceElement, open } = this;
- if (!effectiveReferenceElement) {
- return;
- }
- if ("setAttribute" in effectiveReferenceElement) {
- effectiveReferenceElement.setAttribute(ARIA_EXPANDED, toAriaBoolean(open));
- }
- };
- this.addReferences = () => {
- const { effectiveReferenceElement } = this;
- if (!effectiveReferenceElement) {
- return;
- }
- const id = this.getId();
- if ("setAttribute" in effectiveReferenceElement) {
- effectiveReferenceElement.setAttribute(ARIA_CONTROLS, id);
- }
- manager$1.registerElement(effectiveReferenceElement, this.el);
- this.setExpandedAttr();
- };
- this.removeReferences = () => {
- const { effectiveReferenceElement } = this;
- if (!effectiveReferenceElement) {
- return;
- }
- if ("removeAttribute" in effectiveReferenceElement) {
- effectiveReferenceElement.removeAttribute(ARIA_CONTROLS);
- effectiveReferenceElement.removeAttribute(ARIA_EXPANDED);
- }
- manager$1.unregisterElement(effectiveReferenceElement);
- };
- this.hide = () => {
- this.open = false;
- };
- this.storeArrowEl = (el) => {
- this.arrowEl = el;
- this.reposition(true);
- };
- }
- handleDismissible(value) {
- this.closable = value;
- }
- handleClosable(value) {
- this.dismissible = value;
- }
- flipPlacementsHandler() {
- this.setFilteredPlacements();
- this.reposition(true);
- }
- offsetDistanceOffsetHandler() {
- this.reposition(true);
- }
- offsetSkiddingHandler() {
- this.reposition(true);
- }
- openHandler(value) {
- if (value) {
- this.reposition(true);
- }
- else {
- updateAfterClose(this.el);
- }
- this.setExpandedAttr();
- }
- overlayPositioningHandler() {
- this.reposition(true);
- }
- placementHandler() {
- this.reposition(true);
- }
- referenceElementHandler() {
- this.setUpReferenceElement();
- this.reposition(true);
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- this.setFilteredPlacements();
- connectOpenCloseComponent(this);
- const closable = this.closable || this.dismissible;
- if (closable) {
- this.handleDismissible(closable);
- }
- if (closable) {
- this.handleClosable(closable);
- }
- this.setUpReferenceElement(this.hasLoaded);
- }
- componentDidLoad() {
- if (this.referenceElement && !this.effectiveReferenceElement) {
- this.setUpReferenceElement();
- }
- this.reposition();
- this.hasLoaded = true;
- }
- disconnectedCallback() {
- this.removeReferences();
- disconnectFloatingUI(this, this.effectiveReferenceElement, this.el);
- disconnectOpenCloseComponent(this);
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /**
- * Updates the position of the component.
- *
- * @param delayed
- */
- async reposition(delayed = false) {
- const { el, effectiveReferenceElement, placement, overlayPositioning, disableFlip, filteredFlipPlacements, offsetDistance, offsetSkidding, arrowEl } = this;
- return reposition(this, {
- floatingEl: el,
- referenceEl: effectiveReferenceElement,
- overlayPositioning,
- placement,
- disableFlip,
- flipPlacements: filteredFlipPlacements,
- offsetDistance,
- offsetSkidding,
- includeArrow: !this.disablePointer,
- arrowEl,
- type: "popover"
- }, delayed);
- }
- /**
- * Sets focus on the component.
- *
- * @param focusId
- */
- async setFocus(focusId) {
- var _a;
- const { closeButtonEl } = this;
- if (focusId === "close-button" && closeButtonEl) {
- forceUpdate$1(closeButtonEl);
- closeButtonEl.setFocus();
- return;
- }
- (_a = this.el) === null || _a === void 0 ? void 0 : _a.focus();
- }
- /**
- * Toggles the component's open property.
- *
- * @param value
- */
- async toggle(value = !this.open) {
- this.open = value;
- }
- getReferenceElement() {
- const { referenceElement, el } = this;
- return ((typeof referenceElement === "string"
- ? queryElementRoots(el, { id: referenceElement })
- : referenceElement) || null);
- }
- onBeforeOpen() {
- this.calcitePopoverBeforeOpen.emit();
- }
- onOpen() {
- this.calcitePopoverOpen.emit();
- }
- onBeforeClose() {
- this.calcitePopoverBeforeClose.emit();
- }
- onClose() {
- this.calcitePopoverClose.emit();
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderCloseButton() {
- const { closeButton, intlClose, heading, closable } = this;
- return closable || closeButton ? (hAsync("div", { class: CSS$h.closeButtonContainer }, hAsync("calcite-action", { class: CSS$h.closeButton, onClick: this.hide, ref: (closeButtonEl) => (this.closeButtonEl = closeButtonEl), scale: heading ? "s" : "m", text: intlClose }, hAsync("calcite-icon", { icon: "x", scale: heading ? "s" : "m" })))) : null;
- }
- renderHeader() {
- const { heading, headingLevel } = this;
- const headingNode = heading ? (hAsync(Heading, { class: CSS$h.heading, level: headingLevel || HEADING_LEVEL$2 }, heading)) : null;
- return headingNode ? (hAsync("div", { class: CSS$h.header }, headingNode, this.renderCloseButton())) : null;
- }
- render() {
- const { effectiveReferenceElement, heading, label, open, disablePointer } = this;
- const displayed = effectiveReferenceElement && open;
- const hidden = !displayed;
- const arrowNode = !disablePointer ? hAsync("div", { class: CSS$h.arrow, ref: this.storeArrowEl }) : null;
- return (hAsync(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "aria-live": "polite", "calcite-hydrated-hidden": hidden, id: this.getId(), role: "dialog" }, hAsync("div", { class: {
- [FloatingCSS.animation]: true,
- [FloatingCSS.animationActive]: displayed
- }, ref: this.setTransitionEl }, arrowNode, hAsync("div", { class: {
- [CSS$h.hasHeader]: !!heading,
- [CSS$h.container]: true
- } }, this.renderHeader(), hAsync("div", { class: CSS$h.content }, hAsync("slot", null)), !heading ? this.renderCloseButton() : null))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "dismissible": ["handleDismissible"],
- "closable": ["handleClosable"],
- "flipPlacements": ["flipPlacementsHandler"],
- "offsetDistance": ["offsetDistanceOffsetHandler"],
- "offsetSkidding": ["offsetSkiddingHandler"],
- "open": ["openHandler"],
- "overlayPositioning": ["overlayPositioningHandler"],
- "placement": ["placementHandler"],
- "referenceElement": ["referenceElementHandler"]
- }; }
- static get style() { return popoverCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-popover",
- "$members$": {
- "autoClose": [516, "auto-close"],
- "closeButton": [516, "close-button"],
- "dismissible": [1540],
- "closable": [1540],
- "disableFlip": [516, "disable-flip"],
- "disablePointer": [516, "disable-pointer"],
- "flipPlacements": [16],
- "heading": [1],
- "headingLevel": [514, "heading-level"],
- "label": [1],
- "offsetDistance": [514, "offset-distance"],
- "offsetSkidding": [514, "offset-skidding"],
- "open": [1540],
- "overlayPositioning": [513, "overlay-positioning"],
- "placement": [513],
- "referenceElement": [1, "reference-element"],
- "triggerDisabled": [516, "trigger-disabled"],
- "intlClose": [1, "intl-close"],
- "effectiveReferenceElement": [32],
- "reposition": [64],
- "setFocus": [64],
- "toggle": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["autoClose", "auto-close"], ["closeButton", "close-button"], ["dismissible", "dismissible"], ["closable", "closable"], ["disableFlip", "disable-flip"], ["disablePointer", "disable-pointer"], ["headingLevel", "heading-level"], ["offsetDistance", "offset-distance"], ["offsetSkidding", "offset-skidding"], ["open", "open"], ["overlayPositioning", "overlay-positioning"], ["placement", "placement"], ["triggerDisabled", "trigger-disabled"]]
- }; }
- }
- const popoverManagerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-popover-manager{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-popover-manager{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-popover-manager{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-popover-manager{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-popover-manager:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-popover-manager:root{--calcite-floating-ui-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}";
- /**
- * @slot - A slot for adding elements that reference a 'calcite-popover' by the 'selector' property.
- * @deprecated No longer required for popover usage.
- */
- class PopoverManager {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.mutationObserver = createObserver();
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * CSS Selector to match reference elements for popovers. Reference elements will be identified by this selector in order to open their associated popover.
- *
- * @default `[data-calcite-popover-reference]`
- */
- this.selector = "[data-calcite-popover-reference]";
- /**
- * Automatically closes any currently open popovers when clicking outside of a popover.
- */
- this.autoClose = false;
- }
- autoCloseHandler() {
- this.setAutoClose();
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- this.setAutoClose();
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- }
- disconnectedCallback() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- return hAsync("slot", null);
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- setAutoClose() {
- const { autoClose, el } = this;
- el.querySelectorAll("calcite-popover").forEach((popover) => (popover.autoClose = autoClose));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "autoClose": ["autoCloseHandler"]
- }; }
- static get style() { return popoverManagerCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-popover-manager",
- "$members$": {
- "selector": [513],
- "autoClose": [516, "auto-close"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["selector", "selector"], ["autoClose", "auto-close"]]
- }; }
- }
- const progressCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-progress{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-progress{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-progress{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-progress{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-progress:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-progress:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-progress-h{display:none}/*!@:host*/.sc-calcite-progress-h{position:relative;display:block;inline-size:100%}/*!@.track, \n.bar*/.track.sc-calcite-progress,.bar.sc-calcite-progress{position:absolute;inset-block-start:0px;block-size:2px}/*!@.track*/.track.sc-calcite-progress{z-index:1;inline-size:100%;overflow:hidden;background:var(--calcite-ui-border-3)}/*!@.bar*/.bar.sc-calcite-progress{z-index:1;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{inline-size:20%;animation:looping-progress-bar-ani calc(var(--calcite-internal-animation-timing-medium) * 11) linear infinite}/*!@.reversed*/.reversed.sc-calcite-progress{animation-direction:reverse}/*!@.text*/.text.sc-calcite-progress{padding-inline:0px;padding-block:1rem 0px;text-align:center;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}@keyframes looping-progress-bar-ani{0%{transform:translate3d(-100%, 0, 0)}50%{inline-size:40%}100%{transform:translate3d(600%, 0, 0)}}";
- class Progress {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- /**
- * Specifies the component type.
- *
- * Use `"indeterminate"` if finding actual progress value is impossible.
- *
- */
- this.type = "determinate";
- /** The component's progress value, with a range of 0.0 - 1.0. */
- this.value = 0;
- /** When `true` and for `"indeterminate"` progress bars, reverses the animation direction. */
- this.reversed = false;
- }
- render() {
- const isDeterminate = this.type === "determinate";
- const barStyles = isDeterminate ? { width: `${this.value * 100}%` } : {};
- 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: {
- bar: true,
- indeterminate: this.type === "indeterminate",
- reversed: this.reversed
- }, style: barStyles })), this.text ? hAsync("div", { class: "text" }, this.text) : null));
- }
- get el() { return getElement(this); }
- static get style() { return progressCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-progress",
- "$members$": {
- "type": [513],
- "value": [2],
- "label": [1],
- "text": [1],
- "reversed": [516]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["type", "type"], ["reversed", "reversed"]]
- }; }
- }
- const CSS$g = {
- container: "container"
- };
- const radioButtonCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-button{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-button{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-button{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-button{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-radio-button:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-radio-button:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-button-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-radio-button-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@: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);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;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{box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}/*!@:host([focused]) .radio*/[focused].sc-calcite-radio-button-h .radio.sc-calcite-radio-button{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@: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{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{block-size:var(--calcite-radio-size);max-inline-size:var(--calcite-radio-size);min-inline-size: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{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{box-shadow:inset 0 0 0 4px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1)}/*!@: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{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{box-shadow:inset 0 0 0 5px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1)}/*!@: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{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{box-shadow:inset 0 0 0 6px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1)}@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:\"\";inline-size:var(--calcite-radio-size);block-size: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]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- class RadioButton {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalRadioButtonBlur = createEvent(this, "calciteInternalRadioButtonBlur", 6);
- this.calciteRadioButtonChange = createEvent(this, "calciteRadioButtonChange", 6);
- this.calciteInternalRadioButtonCheckedChange = createEvent(this, "calciteInternalRadioButtonCheckedChange", 6);
- this.calciteInternalRadioButtonFocus = createEvent(this, "calciteInternalRadioButtonFocus", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, the component is checked. */
- this.checked = false;
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /**
- * The focused state of the component.
- *
- * @internal
- */
- this.focused = false;
- /** When `true`, the component is not displayed and is not focusable or checkable. */
- this.hidden = false;
- /**
- * The hovered state of the component.
- *
- * @internal
- */
- this.hovered = false;
- /** When `true`, the component must have a value selected from the `calcite-radio-button-group` in order for the form to submit. */
- this.required = false;
- /** Specifies the size of the component inherited from the `calcite-radio-button-group`. */
- this.scale = "m";
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.selectItem = (items, selectedIndex) => {
- items[selectedIndex].click();
- };
- this.queryButtons = () => {
- return Array.from(this.rootNode.querySelectorAll("calcite-radio-button:not([hidden])")).filter((radioButton) => radioButton.name === this.name);
- };
- this.isDefaultSelectable = () => {
- const radioButtons = this.queryButtons();
- return !radioButtons.some((radioButton) => radioButton.checked) && radioButtons[0] === this.el;
- };
- this.check = () => {
- if (this.disabled) {
- return;
- }
- this.uncheckAllRadioButtonsInGroup();
- this.checked = true;
- this.focused = true;
- this.calciteRadioButtonChange.emit();
- this.setFocus();
- };
- this.clickHandler = () => {
- this.check();
- };
- this.setContainerEl = (el) => {
- this.containerEl = el;
- };
- this.handleKeyDown = (event) => {
- const keys = ["ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", " "];
- const { key } = event;
- const { el } = this;
- if (keys.indexOf(key) === -1) {
- return;
- }
- if (key === " ") {
- this.check();
- event.preventDefault();
- return;
- }
- let adjustedKey = key;
- if (getElementDir(el) === "rtl") {
- if (key === "ArrowRight") {
- adjustedKey = "ArrowLeft";
- }
- if (key === "ArrowLeft") {
- adjustedKey = "ArrowRight";
- }
- }
- const radioButtons = Array.from(this.rootNode.querySelectorAll("calcite-radio-button:not([hidden]")).filter((radioButton) => radioButton.name === this.name);
- let currentIndex = 0;
- const radioButtonsLength = radioButtons.length;
- radioButtons.some((item, index) => {
- if (item.checked) {
- currentIndex = index;
- return true;
- }
- });
- switch (adjustedKey) {
- case "ArrowLeft":
- case "ArrowUp":
- event.preventDefault();
- this.selectItem(radioButtons, getRoundRobinIndex(Math.max(currentIndex - 1, -1), radioButtonsLength));
- return;
- case "ArrowRight":
- case "ArrowDown":
- event.preventDefault();
- this.selectItem(radioButtons, getRoundRobinIndex(currentIndex + 1, radioButtonsLength));
- return;
- default:
- return;
- }
- };
- this.onContainerBlur = () => {
- this.focused = false;
- this.calciteInternalRadioButtonBlur.emit();
- };
- this.onContainerFocus = () => {
- if (!this.disabled) {
- this.focused = true;
- this.calciteInternalRadioButtonFocus.emit();
- }
- };
- }
- checkedChanged(newChecked) {
- if (newChecked) {
- this.uncheckOtherRadioButtonsInGroup();
- }
- this.calciteInternalRadioButtonCheckedChange.emit();
- }
- nameChanged() {
- this.checkLastRadioButton();
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- if (!this.disabled) {
- focusElement(this.containerEl);
- }
- }
- onLabelClick(event) {
- if (!this.disabled && !this.hidden) {
- this.uncheckOtherRadioButtonsInGroup();
- const label = event.currentTarget;
- const radioButton = label.for
- ? this.rootNode.querySelector(`calcite-radio-button[id="${label.for}"]`)
- : label.querySelector(`calcite-radio-button[name="${this.name}"]`);
- if (radioButton) {
- radioButton.checked = true;
- radioButton.focused = true;
- }
- this.calciteRadioButtonChange.emit();
- this.setFocus();
- }
- }
- checkLastRadioButton() {
- const radioButtons = this.queryButtons();
- const checkedRadioButtons = radioButtons.filter((radioButton) => radioButton.checked);
- if ((checkedRadioButtons === null || checkedRadioButtons === void 0 ? void 0 : checkedRadioButtons.length) > 1) {
- const lastCheckedRadioButton = checkedRadioButtons[checkedRadioButtons.length - 1];
- checkedRadioButtons
- .filter((checkedRadioButton) => checkedRadioButton !== lastCheckedRadioButton)
- .forEach((checkedRadioButton) => {
- checkedRadioButton.checked = false;
- checkedRadioButton.emitCheckedChange();
- });
- }
- }
- /** @internal */
- async emitCheckedChange() {
- this.calciteInternalRadioButtonCheckedChange.emit();
- }
- uncheckAllRadioButtonsInGroup() {
- const radioButtons = this.queryButtons();
- radioButtons.forEach((radioButton) => {
- if (radioButton.checked) {
- radioButton.checked = false;
- radioButton.focused = false;
- }
- });
- }
- uncheckOtherRadioButtonsInGroup() {
- const radioButtons = this.queryButtons();
- const otherRadioButtons = radioButtons.filter((radioButton) => radioButton.guid !== this.guid);
- otherRadioButtons.forEach((otherRadioButton) => {
- if (otherRadioButton.checked) {
- otherRadioButton.checked = false;
- otherRadioButton.focused = false;
- }
- });
- }
- getTabIndex() {
- if (this.disabled) {
- return undefined;
- }
- return this.checked || this.isDefaultSelectable() ? 0 : -1;
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- mouseenter() {
- this.hovered = true;
- }
- mouseleave() {
- this.hovered = false;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- this.rootNode = this.el.getRootNode();
- this.guid = this.el.id || `calcite-radio-button-${guid()}`;
- if (this.name) {
- this.checkLastRadioButton();
- }
- connectLabel(this);
- connectForm(this);
- }
- componentDidLoad() {
- if (this.focused && !this.disabled) {
- this.setFocus();
- }
- }
- disconnectedCallback() {
- disconnectLabel(this);
- disconnectForm(this);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const tabIndex = this.getTabIndex();
- return (hAsync(Host, { onClick: this.clickHandler, onKeyDown: this.handleKeyDown }, hAsync("div", { "aria-checked": toAriaBoolean(this.checked), "aria-label": getLabelText(this), class: CSS$g.container, onBlur: this.onContainerBlur, onFocus: this.onContainerFocus, ref: this.setContainerEl, role: "radio", tabIndex: tabIndex }, hAsync("div", { class: "radio" })), hAsync(HiddenFormInputSlot, { component: this })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "checked": ["checkedChanged"],
- "name": ["nameChanged"]
- }; }
- static get style() { return radioButtonCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-radio-button",
- "$members$": {
- "checked": [1540],
- "disabled": [516],
- "focused": [1540],
- "guid": [1537],
- "hidden": [516],
- "hovered": [1540],
- "label": [1],
- "name": [513],
- "required": [516],
- "scale": [513],
- "value": [1032],
- "setFocus": [64],
- "emitCheckedChange": [64]
- },
- "$listeners$": [[1, "pointerenter", "mouseenter"], [1, "pointerleave", "mouseleave"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["checked", "checked"], ["disabled", "disabled"], ["focused", "focused"], ["guid", "guid"], ["hidden", "hidden"], ["hovered", "hovered"], ["name", "name"], ["required", "required"], ["scale", "scale"]]
- }; }
- }
- const radioButtonGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-button-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-button-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-button-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-button-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-radio-button-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-radio-button-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-button-group-h{display:none}/*!@:host*/.sc-calcite-radio-button-group-h{display:flex;max-inline-size:100vw}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-radio-button-group-h{flex-direction:row;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{flex-direction:column}";
- /**
- * @slot - A slot for adding `calcite-radio-button`s.
- */
- class RadioButtonGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteRadioButtonGroupChange = createEvent(this, "calciteRadioButtonGroupChange", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /** When `true`, the component is not displayed and its `calcite-radio-button`s are not focusable or checkable. */
- this.hidden = false;
- /** Defines the layout of the component. */
- this.layout = "horizontal";
- /** When `true`, the component must have a value in order for the form to submit. */
- this.required = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- // --------------------------------------------------------------------------
- //
- // Private Properties
- //
- // --------------------------------------------------------------------------
- this.mutationObserver = createObserver();
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.passPropsToRadioButtons = () => {
- const radioButtons = this.el.querySelectorAll("calcite-radio-button");
- if (radioButtons.length > 0) {
- radioButtons.forEach((radioButton) => {
- radioButton.disabled = this.disabled || radioButton.disabled;
- radioButton.hidden = this.hidden;
- radioButton.name = this.name;
- radioButton.required = this.required;
- radioButton.scale = this.scale;
- });
- }
- };
- }
- onDisabledChange() {
- this.passPropsToRadioButtons();
- }
- onHiddenChange() {
- this.passPropsToRadioButtons();
- }
- onLayoutChange() {
- this.passPropsToRadioButtons();
- }
- onScaleChange() {
- this.passPropsToRadioButtons();
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- this.passPropsToRadioButtons();
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- }
- disconnectedCallback() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- radioButtonChangeHandler(event) {
- this.calciteRadioButtonGroupChange.emit(event.target.value);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- return (hAsync(Host, { role: "radiogroup" }, hAsync("slot", null)));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["onDisabledChange"],
- "hidden": ["onHiddenChange"],
- "layout": ["onLayoutChange"],
- "scale": ["onScaleChange"]
- }; }
- static get style() { return radioButtonGroupCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-radio-button-group",
- "$members$": {
- "disabled": [516],
- "hidden": [516],
- "layout": [513],
- "name": [513],
- "required": [516],
- "scale": [513]
- },
- "$listeners$": [[0, "calciteRadioButtonChange", "radioButtonChangeHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["hidden", "hidden"], ["layout", "layout"], ["name", "name"], ["required", "required"], ["scale", "scale"]]
- }; }
- }
- const radioGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-radio-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-radio-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-group-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-radio-group-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-radio-group-h{display:flex;background-color:var(--calcite-ui-foreground-1);inline-size:-moz-fit-content;inline-size:fit-content;outline:1px solid var(--calcite-ui-border-input);outline-offset:-1px}/*!@: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{flex-direction:column;align-items:flex-start;align-self:flex-start}/*!@:host([width=full])*/[width=full].sc-calcite-radio-group-h{inline-size:100%;min-inline-size:-moz-fit-content;min-inline-size: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{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{justify-content:flex-start}/*!@::slotted(input[slot=hidden-form-input])*/.sc-calcite-radio-group-s>input[slot=hidden-form-input]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- /**
- * @slot - A slot for adding `calcite-radio-group-item`s.
- */
- class RadioGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteRadioGroupChange = createEvent(this, "calciteRadioGroupChange", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** Specifies the appearance style of the component. */
- this.appearance = "solid";
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /**
- * When `true`, the component must have a value in order for the form to submit.
- *
- * @internal
- */
- this.required = false;
- /** Defines the layout of the component. */
- this.layout = "horizontal";
- /** Specifies the size of the component. */
- this.scale = "m";
- /** The component's `selectedItem` value. */
- this.value = null;
- /** Specifies the width of the component. */
- this.width = "auto";
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- this.handleClick = (event) => {
- if (event.target.localName === "calcite-radio-group-item") {
- this.selectItem(event.target, true);
- }
- };
- }
- valueHandler(value) {
- const items = this.getItems();
- items.forEach((item) => (item.checked = item.value === value));
- }
- handleSelectedItemChange(newItem, oldItem) {
- this.value = newItem === null || newItem === void 0 ? void 0 : newItem.value;
- if (newItem === oldItem) {
- return;
- }
- const items = this.getItems();
- const match = Array.from(items)
- .filter((item) => item === newItem)
- .pop();
- if (match) {
- this.selectItem(match);
- }
- else if (items[0]) {
- items[0].tabIndex = 0;
- }
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentWillLoad() {
- const items = this.getItems();
- const lastChecked = Array.from(items)
- .filter((item) => item.checked)
- .pop();
- if (lastChecked) {
- this.selectItem(lastChecked);
- }
- else if (items[0]) {
- items[0].tabIndex = 0;
- }
- }
- componentDidLoad() {
- afterConnectDefaultValueSet(this, this.value);
- }
- connectedCallback() {
- connectLabel(this);
- connectForm(this);
- }
- disconnectedCallback() {
- disconnectLabel(this);
- disconnectForm(this);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- render() {
- return (hAsync(Host, { onClick: this.handleClick, role: "radiogroup" }, hAsync("slot", null), hAsync(HiddenFormInputSlot, { component: this })));
- }
- handleSelected(event) {
- event.preventDefault();
- this.selectItem(event.target);
- event.stopPropagation();
- }
- handleKeyDown(event) {
- const keys = ["ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", " "];
- const { key } = event;
- const { el, selectedItem } = this;
- if (keys.indexOf(key) === -1) {
- return;
- }
- let adjustedKey = key;
- if (getElementDir(el) === "rtl") {
- if (key === "ArrowRight") {
- adjustedKey = "ArrowLeft";
- }
- if (key === "ArrowLeft") {
- adjustedKey = "ArrowRight";
- }
- }
- const items = this.getItems();
- let selectedIndex = -1;
- items.forEach((item, index) => {
- if (item === selectedItem) {
- selectedIndex = index;
- }
- });
- switch (adjustedKey) {
- case "ArrowLeft":
- case "ArrowUp":
- event.preventDefault();
- const previous = selectedIndex < 1 ? items.item(items.length - 1) : items.item(selectedIndex - 1);
- this.selectItem(previous, true);
- return;
- case "ArrowRight":
- case "ArrowDown":
- event.preventDefault();
- const next = selectedIndex === -1 ? items.item(1) : items.item(selectedIndex + 1) || items.item(0);
- this.selectItem(next, true);
- return;
- case " ":
- event.preventDefault();
- this.selectItem(event.target, true);
- return;
- default:
- return;
- }
- }
- // --------------------------------------------------------------------------
- //
- // Methods
- //
- // --------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = (this.selectedItem || this.getItems()[0])) === null || _a === void 0 ? void 0 : _a.focus();
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- onLabelClick() {
- this.setFocus();
- }
- getItems() {
- return this.el.querySelectorAll("calcite-radio-group-item");
- }
- selectItem(selected, emit = false) {
- if (selected === this.selectedItem) {
- return;
- }
- const items = this.getItems();
- let match = null;
- items.forEach((item) => {
- const matches = item.value === selected.value;
- if ((matches && !item.checked) || (!matches && item.checked)) {
- item.checked = matches;
- }
- item.tabIndex = matches ? 0 : -1;
- if (matches) {
- match = item;
- if (emit) {
- this.calciteRadioGroupChange.emit(match.value);
- }
- }
- });
- this.selectedItem = match;
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "value": ["valueHandler"],
- "selectedItem": ["handleSelectedItemChange"]
- }; }
- static get style() { return radioGroupCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-radio-group",
- "$members$": {
- "appearance": [513],
- "disabled": [516],
- "required": [516],
- "layout": [513],
- "name": [513],
- "scale": [513],
- "value": [1025],
- "selectedItem": [1040],
- "width": [513],
- "setFocus": [64]
- },
- "$listeners$": [[0, "calciteInternalRadioGroupItemChange", "handleSelected"], [0, "keydown", "handleKeyDown"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["appearance", "appearance"], ["disabled", "disabled"], ["required", "required"], ["layout", "layout"], ["name", "name"], ["scale", "scale"], ["width", "width"]]
- }; }
- }
- const SLOTS$8 = {
- input: "input"
- };
- const CSS$f = {
- radioGroupItemIcon: "radio-group-item-icon"
- };
- const radioGroupItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-radio-group-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-radio-group-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-radio-group-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-radio-group-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-radio-group-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-radio-group-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-radio-group-item-h{display:none}/*!@:host*/.sc-calcite-radio-group-item-h{display:flex;cursor:pointer;align-self:stretch;font-weight:var(--calcite-font-weight-normal);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;box-sizing:border-box;display:flex;flex:1 1 0%;align-items:center;color:var(--calcite-ui-text-3);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{justify-content:center}/*!@:host*/.sc-calcite-radio-group-item-h{outline-color:transparent}/*!@: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-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-block:0.125rem}/*!@.label--scale-m*/.label--scale-m.sc-calcite-radio-group-item{padding-inline:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-block:0.375rem}/*!@.label--scale-l*/.label--scale-l.sc-calcite-radio-group-item{padding-inline:1rem;padding-block: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);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}@media (forced-colors: active){/*!@:host([checked]) label*/[checked].sc-calcite-radio-group-item-h label.sc-calcite-radio-group-item{background-color:highlight}/*!@:host([checked]) .label--outline*/[checked].sc-calcite-radio-group-item-h .label--outline.sc-calcite-radio-group-item{outline:2px solid transparent;outline-offset:2px}/*!@:host([checked]) label:not([class~=label--outline]) .radio-group-item-icon*/[checked].sc-calcite-radio-group-item-h label.sc-calcite-radio-group-item:not([class~=label--outline]) .radio-group-item-icon.sc-calcite-radio-group-item{color:highlightText}}/*!@.radio-group-item-icon*/.radio-group-item-icon.sc-calcite-radio-group-item{position:relative;margin:0px;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{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{margin-inline-end:unset;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{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{margin-inline-end:unset;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{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{margin-inline-end:unset;margin-inline-start:1rem}/*!@:host([icon-start]) .label--scale-s .radio-group-item-icon*/[icon-start].sc-calcite-radio-group-item-h .label--scale-s.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:0.5rem}/*!@:host([icon-end]) .label--scale-s .radio-group-item-icon*/[icon-end].sc-calcite-radio-group-item-h .label--scale-s.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-start:0.5rem}/*!@:host([icon-start]) .label--scale-m .radio-group-item-icon*/[icon-start].sc-calcite-radio-group-item-h .label--scale-m.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:0.75rem}/*!@:host([icon-end]) .label--scale-m .radio-group-item-icon*/[icon-end].sc-calcite-radio-group-item-h .label--scale-m.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-start:0.75rem}/*!@:host([icon-start]) .label--scale-l .radio-group-item-icon*/[icon-start].sc-calcite-radio-group-item-h .label--scale-l.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-end:1rem}/*!@:host([icon-end]) .label--scale-l .radio-group-item-icon*/[icon-end].sc-calcite-radio-group-item-h .label--scale-l.sc-calcite-radio-group-item .radio-group-item-icon.sc-calcite-radio-group-item{margin-inline-start:1rem}";
- class RadioGroupItem {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalRadioGroupItemChange = createEvent(this, "calciteInternalRadioGroupItemChange", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, the component is checked. */
- this.checked = false;
- /** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
- this.iconFlipRtl = false;
- /**
- * Specifies the placement of the icon.
- *
- * @deprecated Use either `iconStart` or `iconEnd` but do not combine them with `icon` and `iconPosition`.
- */
- this.iconPosition = "start";
- }
- handleCheckedChange() {
- this.calciteInternalRadioGroupItemChange.emit();
- }
- render() {
- const { checked, value } = this;
- const scale = getElementProp(this.el, "scale", "m");
- const appearance = getElementProp(this.el, "appearance", "solid");
- const layout = getElementProp(this.el, "layout", "horizontal");
- const iconStartEl = this.iconStart ? (hAsync("calcite-icon", { class: CSS$f.radioGroupItemIcon, flipRtl: this.iconFlipRtl, icon: this.iconStart, key: "icon-start", scale: "s" })) : null;
- const iconEndEl = this.iconEnd ? (hAsync("calcite-icon", { class: CSS$f.radioGroupItemIcon, flipRtl: this.iconFlipRtl, icon: this.iconEnd, key: "icon-end", scale: "s" })) : null;
- const iconEl = (hAsync("calcite-icon", { class: CSS$f.radioGroupItemIcon, flipRtl: this.iconFlipRtl, icon: this.icon, key: "icon", scale: "s" }));
- const iconAtStart = this.icon && this.iconPosition === "start" && !this.iconStart ? iconEl : null;
- const iconAtEnd = this.icon && this.iconPosition === "end" && !this.iconEnd ? iconEl : null;
- return (hAsync(Host, { "aria-checked": toAriaBoolean(checked), "aria-label": value, role: "radio" }, hAsync("label", { class: {
- "label--scale-s": scale === "s",
- "label--scale-m": scale === "m",
- "label--scale-l": scale === "l",
- "label--horizontal": layout === "horizontal",
- "label--outline": appearance === "outline"
- } }, iconAtStart, this.iconStart ? iconStartEl : null, hAsync("slot", null, value), hAsync("slot", { name: SLOTS$8.input }), iconAtEnd, this.iconEnd ? iconEndEl : null)));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "checked": ["handleCheckedChange"]
- }; }
- static get style() { return radioGroupItemCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-radio-group-item",
- "$members$": {
- "checked": [1540],
- "icon": [513],
- "iconFlipRtl": [516, "icon-flip-rtl"],
- "iconPosition": [513, "icon-position"],
- "iconStart": [513, "icon-start"],
- "iconEnd": [513, "icon-end"],
- "value": [1032]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["checked", "checked"], ["icon", "icon"], ["iconFlipRtl", "icon-flip-rtl"], ["iconPosition", "icon-position"], ["iconStart", "icon-start"], ["iconEnd", "icon-end"]]
- }; }
- }
- const TEXT$5 = {
- rating: "Rating",
- stars: "Stars: ${num}"
- };
- const ratingCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-rating{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-rating{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-rating{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-rating{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-rating:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-rating:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-rating-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-rating-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-rating-h{position:relative;display:flex;align-items:center;inline-size:-moz-fit-content;inline-size:fit-content}/*!@: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{block-size:1.5rem;--calcite-rating-spacing-unit:0.25rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-rating-h{block-size:2rem;--calcite-rating-spacing-unit:0.5rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-rating-h{block-size: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:flex;border-width:0px;padding:0px}/*!@.wrapper*/.wrapper.sc-calcite-rating{display:inline-block;margin-inline-end:var(--calcite-rating-spacing-unit)}/*!@.star*/.star.sc-calcite-rating{position:relative;display:flex;cursor:pointer;outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;color:var(--calcite-ui-border-input)}/*!@.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)}/*!@:host .fraction*/.sc-calcite-rating-h .fraction.sc-calcite-rating{pointer-events:none;position:absolute;inset-block-start:0px;overflow:hidden;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;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){margin-inline-start:var(--calcite-rating-spacing-unit)}/*!@.visually-hidden*/.visually-hidden.sc-calcite-rating{position:absolute;inline-size:1px;block-size: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]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- class Rating {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteRatingChange = createEvent(this, "calciteRatingChange", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /** Specifies the size of the component. */
- this.scale = "m";
- /** The component's value. */
- this.value = 0;
- /** When `true`, the component's value can be read, but cannot be modified. */
- this.readOnly = false;
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /** When `true`, and if available, displays the `average` and/or `count` data summary in a `calcite-chip`. */
- this.showChip = false;
- /**
- * Accessible name for the component.
- *
- * @default "Rating"
- */
- this.intlRating = TEXT$5.rating;
- /**
- * Accessible name for each star. The `${num}` in the string will be replaced by the number.
- *
- * @default "Stars: ${num}"
- */
- this.intlStars = TEXT$5.stars;
- /**
- * When `true`, the component must have a value in order for the form to submit.
- *
- * @internal
- */
- this.required = false;
- this.onKeyboardPressed = (event) => {
- if (!this.required && isActivationKey(event.key)) {
- event.preventDefault();
- this.updateValue(0);
- }
- };
- this.onFocusChange = (selectedRatingValue) => {
- this.hasFocus = true;
- if (!this.required && this.focusValue === selectedRatingValue) {
- this.updateValue(0);
- }
- else {
- this.focusValue = selectedRatingValue;
- }
- };
- this.guid = `calcite-ratings-${guid()}`;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- connectLabel(this);
- connectForm(this);
- }
- disconnectedCallback() {
- disconnectLabel(this);
- disconnectForm(this);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- blurHandler() {
- this.hasFocus = false;
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderStars() {
- return [1, 2, 3, 4, 5].map((i) => {
- const selected = this.value >= i;
- const average = this.average && !this.value && i <= this.average;
- const hovered = i <= this.hoverValue;
- const fraction = this.average && this.average + 1 - i;
- const partial = !this.value && !hovered && fraction > 0 && fraction < 1;
- const focused = this.hasFocus && this.focusValue === i;
- return (hAsync("span", { class: { wrapper: true } }, hAsync("label", { class: { star: true, focused, selected, average, hovered, partial }, htmlFor: `${this.guid}-${i}`, onPointerOver: () => {
- this.hoverValue = i;
- } }, 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) =>
- // click is fired from the component's label, so we treat this as an internal event
- event.stopPropagation(), onFocus: () => this.onFocusChange(i), onKeyDown: this.onKeyboardPressed, ref: (el) => (i === 1 || i === this.value) && (this.inputFocusRef = el), type: "radio", value: i })));
- });
- }
- render() {
- const { disabled, intlRating, showChip, scale, count, average } = this;
- return (hAsync(Fragment, null, hAsync("fieldset", { class: "fieldset", disabled: disabled, onBlur: () => (this.hoverValue = null), onPointerLeave: () => (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 :
- count.toString(), ")"))) : null, hAsync(HiddenFormInputSlot, { component: this })));
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- onLabelClick() {
- this.setFocus();
- }
- updateValue(value) {
- this.value = value;
- this.calciteRatingChange.emit({ value });
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.inputFocusRef) === null || _a === void 0 ? void 0 : _a.focus();
- }
- get el() { return getElement(this); }
- static get style() { return ratingCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-rating",
- "$members$": {
- "scale": [513],
- "value": [1538],
- "readOnly": [516, "read-only"],
- "disabled": [516],
- "showChip": [516, "show-chip"],
- "count": [514],
- "average": [514],
- "name": [513],
- "intlRating": [1, "intl-rating"],
- "intlStars": [1, "intl-stars"],
- "required": [516],
- "hoverValue": [32],
- "focusValue": [32],
- "hasFocus": [32],
- "setFocus": [64]
- },
- "$listeners$": [[0, "blur", "blurHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["scale", "scale"], ["value", "value"], ["readOnly", "read-only"], ["disabled", "disabled"], ["showChip", "show-chip"], ["count", "count"], ["average", "average"], ["name", "name"], ["required", "required"]]
- }; }
- }
- const CSS$e = {
- scrim: "scrim",
- content: "content"
- };
- const TEXT$4 = {
- loading: "Loading"
- };
- const scrimCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-scrim{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-scrim{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-scrim{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-scrim{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-scrim:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-scrim:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-scrim-h{display:none}/*!@:host*/.sc-calcite-scrim-h{position:absolute;inset:0px;z-index:700;display:flex;block-size:100%;inline-size:100%;flex-direction:column;align-items:stretch}@keyframes calcite-scrim-fade-in{0%{--tw-bg-opacity:0}100%{--tw-text-opacity:1}}/*!@.scrim*/.scrim.sc-calcite-scrim{position:absolute;inset:0px;display:flex;flex-direction:column;align-content:center;align-items:center;justify-content:center;overflow:hidden;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}";
- /**
- * @slot - A slot for adding custom content, primarily loading information.
- */
- class Scrim {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * Accessible name when the component is loading.
- *
- * @default "Loading"
- */
- this.intlLoading = TEXT$4.loading;
- /**
- * When `true`, a busy indicator is displayed.
- */
- this.loading = false;
- }
- // --------------------------------------------------------------------------
- //
- // Render Method
- //
- // --------------------------------------------------------------------------
- render() {
- const { el, loading, intlLoading } = this;
- const hasContent = el.innerHTML.trim().length > 0;
- const loaderNode = loading ? hAsync("calcite-loader", { active: true, label: intlLoading }) : null;
- const contentNode = hasContent ? (hAsync("div", { class: CSS$e.content }, hAsync("slot", null))) : null;
- return (hAsync("div", { class: CSS$e.scrim }, loaderNode, contentNode));
- }
- get el() { return getElement(this); }
- static get style() { return scrimCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-scrim",
- "$members$": {
- "intlLoading": [1, "intl-loading"],
- "loading": [516]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["loading", "loading"]]
- }; }
- }
- const CSS$d = {
- icon: "icon",
- iconContainer: "icon-container",
- select: "select"
- };
- const selectCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-select{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-select{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-select{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-select{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-select:root{--calcite-internal-duration-factor:0.01}}/*!@: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-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-select-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-select-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-select-h{position:relative;display:flex;align-items:stretch;inline-size:var(--select-width)}/*!@: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{block-size: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-inline:0.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-select-h{block-size: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-inline:0.75rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-select-h{block-size: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-inline:1rem}/*!@:host([width=auto])*/[width=auto].sc-calcite-select-h{inline-size:auto}/*!@:host([width=half])*/[width=half].sc-calcite-select-h{inline-size:50%}/*!@:host([width=full])*/[width=full].sc-calcite-select-h{inline-size:100%}/*!@.select*/.select.sc-calcite-select{margin:0px;box-sizing:border-box;inline-size:100%;cursor:pointer;-webkit-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-color:transparent;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;inset-block:0px;display:flex;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]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- function isOption(optionOrGroup) {
- return optionOrGroup.tagName === "CALCITE-OPTION";
- }
- function isOptionGroup(optionOrGroup) {
- return optionOrGroup.tagName === "CALCITE-OPTION-GROUP";
- }
- /**
- * @slot - A slot for adding `calcite-option`s.
- */
- class Select {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteSelectChange = createEvent(this, "calciteSelectChange", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * When `true`, the component must have a value in order for the form to submit.
- *
- * @internal
- */
- this.required = false;
- /**
- * Specifies the size of the component.
- */
- this.scale = "m";
- /** The component's `selectedOption` value. */
- this.value = null;
- /**
- * Specifies the width of the component.
- */
- this.width = "auto";
- this.componentToNativeEl = new Map();
- this.mutationObserver = createObserver();
- this.handleInternalSelectChange = () => {
- const selected = this.selectEl.selectedOptions[0];
- this.selectFromNativeOption(selected);
- requestAnimationFrame(() => this.emitChangeEvent());
- };
- this.populateInternalSelect = () => {
- const optionsAndGroups = Array.from(this.el.children).filter((child) => child.tagName === "CALCITE-OPTION" || child.tagName === "CALCITE-OPTION-GROUP");
- this.clearInternalSelect();
- optionsAndGroups.forEach((optionOrGroup) => { var _a; return (_a = this.selectEl) === null || _a === void 0 ? void 0 : _a.append(this.toNativeElement(optionOrGroup)); });
- };
- this.storeSelectRef = (node) => {
- this.selectEl = node;
- this.populateInternalSelect();
- const selected = this.selectEl.selectedOptions[0];
- this.selectFromNativeOption(selected);
- };
- this.emitChangeEvent = () => {
- this.calciteSelectChange.emit();
- };
- }
- valueHandler(value) {
- const items = this.el.querySelectorAll("calcite-option");
- items.forEach((item) => (item.selected = item.value === value));
- }
- selectedOptionHandler(selectedOption) {
- this.value = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- const { el } = this;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(el, {
- subtree: true,
- childList: true
- });
- connectLabel(this);
- connectForm(this);
- }
- disconnectedCallback() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- disconnectLabel(this);
- disconnectForm(this);
- }
- componentDidLoad() {
- var _a, _b;
- afterConnectDefaultValueSet(this, (_b = (_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "");
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- focusElement(this.selectEl);
- }
- handleOptionOrGroupChange(event) {
- event.stopPropagation();
- const optionOrGroup = event.target;
- const nativeEl = this.componentToNativeEl.get(optionOrGroup);
- if (!nativeEl) {
- return;
- }
- this.updateNativeElement(optionOrGroup, nativeEl);
- if (isOption(optionOrGroup) && optionOrGroup.selected) {
- this.deselectAllExcept(optionOrGroup);
- this.selectedOption = optionOrGroup;
- }
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- onLabelClick() {
- this.setFocus();
- }
- updateNativeElement(optionOrGroup, nativeOptionOrGroup) {
- nativeOptionOrGroup.disabled = optionOrGroup.disabled;
- nativeOptionOrGroup.label = optionOrGroup.label;
- if (isOption(optionOrGroup)) {
- const option = nativeOptionOrGroup;
- option.selected = optionOrGroup.selected;
- option.value = optionOrGroup.value;
- // need to set innerText for mobile
- // see https://stackoverflow.com/questions/35021620/ios-safari-not-showing-all-options-for-select-menu/41749701
- option.innerText = optionOrGroup.label;
- }
- }
- clearInternalSelect() {
- this.componentToNativeEl.forEach((value) => value.remove());
- this.componentToNativeEl.clear();
- }
- selectFromNativeOption(nativeOption) {
- if (!nativeOption) {
- return;
- }
- let futureSelected;
- this.componentToNativeEl.forEach((nativeOptionOrGroup, optionOrGroup) => {
- if (isOption(optionOrGroup) && nativeOptionOrGroup === nativeOption) {
- optionOrGroup.selected = true;
- futureSelected = optionOrGroup;
- this.deselectAllExcept(optionOrGroup);
- }
- });
- if (futureSelected) {
- this.selectedOption = futureSelected;
- }
- }
- toNativeElement(optionOrGroup) {
- if (isOption(optionOrGroup)) {
- const option = document.createElement("option");
- this.updateNativeElement(optionOrGroup, option);
- this.componentToNativeEl.set(optionOrGroup, option);
- return option;
- }
- if (isOptionGroup(optionOrGroup)) {
- const group = document.createElement("optgroup");
- this.updateNativeElement(optionOrGroup, group);
- Array.from(optionOrGroup.children).forEach((option) => {
- const nativeOption = this.toNativeElement(option);
- group.append(nativeOption);
- this.componentToNativeEl.set(optionOrGroup, nativeOption);
- });
- this.componentToNativeEl.set(optionOrGroup, group);
- return group;
- }
- throw new Error("unsupported element child provided");
- }
- deselectAllExcept(except) {
- this.el.querySelectorAll("calcite-option").forEach((option) => {
- if (option === except) {
- return;
- }
- option.selected = false;
- });
- }
- //--------------------------------------------------------------------------
- //
- // Render Methods
- //
- //--------------------------------------------------------------------------
- renderChevron() {
- return (hAsync("div", { class: CSS$d.iconContainer }, hAsync("calcite-icon", { class: CSS$d.icon, icon: "chevron-down", scale: "s" })));
- }
- render() {
- return (hAsync(Fragment, null, hAsync("select", { "aria-label": this.label, class: CSS$d.select, disabled: this.disabled, onChange: this.handleInternalSelectChange, ref: this.storeSelectRef }, hAsync("slot", null)), this.renderChevron(), hAsync(HiddenFormInputSlot, { component: this })));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "value": ["valueHandler"],
- "selectedOption": ["selectedOptionHandler"]
- }; }
- static get style() { return selectCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-select",
- "$members$": {
- "disabled": [516],
- "label": [1],
- "name": [513],
- "required": [516],
- "scale": [513],
- "value": [1025],
- "selectedOption": [1040],
- "width": [513],
- "setFocus": [64]
- },
- "$listeners$": [[0, "calciteInternalOptionChange", "handleOptionOrGroupChange"], [0, "calciteInternalOptionGroupChange", "handleOptionOrGroupChange"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["name", "name"], ["required", "required"], ["scale", "scale"], ["width", "width"]]
- }; }
- }
- const CSS$c = {
- main: "main",
- mainReversed: "main--reversed",
- content: "content",
- contentBehind: "content--behind",
- footer: "footer"
- };
- const SLOTS$7 = {
- centerRow: "center-row",
- primaryPanel: "primary-panel",
- contextualPanel: "contextual-panel",
- panelStart: "panel-start",
- panelEnd: "panel-end",
- header: "header",
- footer: "footer"
- };
- const shellCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-shell{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-shell{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-shell{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-shell{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-shell:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-shell-h{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{box-sizing:border-box}/*!@:root*/.sc-calcite-shell:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-shell-h{display:none}/*!@:host*/.sc-calcite-shell-h{position:absolute;inset:0px;display:flex;block-size:100%;inline-size:100%;flex-direction:column;overflow:hidden;--calcite-shell-tip-spacing:26vw}/*!@.main*/.main.sc-calcite-shell{position:relative;display:flex;block-size:100%;inline-size:100%;flex:1 1 auto;flex-direction:row;justify-content:space-between;overflow:hidden}/*!@.main--reversed*/.main--reversed.sc-calcite-shell{flex-direction:row-reverse}/*!@.content*/.content.sc-calcite-shell{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;overflow:auto}/*!@.content ::slotted(calcite-shell-center-row), \n.content ::slotted(calcite-panel), \n.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-flow{flex:1 1 auto;align-self:stretch;max-block-size:unset}/*!@.content--behind*/.content--behind.sc-calcite-shell{position:absolute;inset:0px;border-width:0px;z-index:calc(1 - 1);display:initial}/*!@::slotted(calcite-shell-center-row)*/.sc-calcite-shell-s>calcite-shell-center-row{inline-size: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)}/*!@slot[name=panel-end]::slotted(calcite-shell-panel)*/slot[name=panel-end].sc-calcite-shell-s>calcite-shell-panel{margin-inline-start:auto}/*!@::slotted(calcite-shell-panel), \n::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), \n::slotted(calcite-flow)*/.sc-calcite-shell-s>calcite-panel,.sc-calcite-shell-s>calcite-flow{border-width:1px;border-inline-start-width:0px;border-inline-end-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-inline-start-width:1px;border-inline-end-width:1px;border-color:var(--calcite-ui-border-3)}/*!@::slotted(calcite-tip-manager)*/.sc-calcite-shell-s>calcite-tip-manager{position:absolute;z-index:500;box-sizing:border-box}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}/*!@::slotted(calcite-tip-manager)*/.sc-calcite-shell-s>calcite-tip-manager{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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);inset-block-end:0.5rem;inset-inline:var(--calcite-shell-tip-spacing)}";
- /**
- * @slot - A slot for adding content to the component. This content will appear between any leading and trailing panels added to the component, such as a map.
- * @slot header - A slot for adding header content. This content will be positioned at the top of the component.
- * @slot footer - A slot for adding footer content. This content will be positioned at the bottom of the component.
- * @slot panel-start - A slot for adding the starting `calcite-shell-panel`.
- * @slot panel-end - A slot for adding the ending `calcite-shell-panel`.
- * @slot primary-panel - [DEPRECATED] A slot for adding the leading `calcite-shell-panel`.
- * @slot contextual-panel - [DEPRECATED] A slot for adding the trailing `calcite-shell-panel`.
- * @slot center-row - A slot for adding content to the center row.
- */
- class Shell {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * Positions the center content behind any `calcite-shell-panel`s.
- */
- this.contentBehind = false;
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderHeader() {
- const hasHeader = !!getSlotted(this.el, SLOTS$7.header);
- return hasHeader ? hAsync("slot", { key: "header", name: SLOTS$7.header }) : null;
- }
- renderContent() {
- const defaultSlotNode = hAsync("slot", { key: "default-slot" });
- const centerRowSlotNode = hAsync("slot", { key: "center-row-slot", name: SLOTS$7.centerRow });
- const contentContainerKey = "content-container";
- const content = !!this.contentBehind
- ? [
- hAsync("div", { class: {
- [CSS$c.content]: true,
- [CSS$c.contentBehind]: true
- }, key: contentContainerKey }, defaultSlotNode),
- centerRowSlotNode
- ]
- : [
- hAsync("div", { class: CSS$c.content, key: contentContainerKey }, defaultSlotNode, centerRowSlotNode)
- ];
- return content;
- }
- renderFooter() {
- const hasFooter = !!getSlotted(this.el, SLOTS$7.footer);
- return hasFooter ? (hAsync("div", { class: CSS$c.footer, key: "footer" }, hAsync("slot", { name: SLOTS$7.footer }))) : null;
- }
- renderMain() {
- const primaryPanel = getSlotted(this.el, SLOTS$7.primaryPanel);
- const mainClasses = {
- [CSS$c.main]: true,
- [CSS$c.mainReversed]: (primaryPanel === null || primaryPanel === void 0 ? void 0 : primaryPanel.position) === "end"
- };
- return (hAsync("div", { class: mainClasses }, hAsync("slot", { name: SLOTS$7.primaryPanel }), hAsync("slot", { name: SLOTS$7.panelStart }), this.renderContent(), hAsync("slot", { name: SLOTS$7.panelEnd }), hAsync("slot", { name: SLOTS$7.contextualPanel })));
- }
- render() {
- return (hAsync(Fragment, null, this.renderHeader(), this.renderMain(), this.renderFooter()));
- }
- get el() { return getElement(this); }
- static get style() { return shellCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-shell",
- "$members$": {
- "contentBehind": [516, "content-behind"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["contentBehind", "content-behind"]]
- }; }
- }
- const CSS$b = {
- actionBarContainer: "action-bar-container",
- content: "content"
- };
- const SLOTS$6 = {
- actionBar: "action-bar"
- };
- const shellCenterRowCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-shell-center-row{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-shell-center-row{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-shell-center-row{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-shell-center-row{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-shell-center-row:root{--calcite-internal-duration-factor:0.01}}/*!@:host*/.sc-calcite-shell-center-row-h{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{box-sizing:border-box}/*!@:root*/.sc-calcite-shell-center-row:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-shell-center-row-h{display:none}/*!@:host*/.sc-calcite-shell-center-row-h{display:flex;flex:1 1 auto;overflow:hidden;background-color:transparent}/*!@.content*/.content.sc-calcite-shell-center-row{margin:0px;display:flex;block-size:100%;inline-size:100%;overflow:hidden;flex:1 0 0}/*!@.action-bar-container*/.action-bar-container.sc-calcite-shell-center-row{display:flex}/*!@:host([detached])*/[detached].sc-calcite-shell-center-row-h{margin-inline:0.5rem;margin-block:0.5rem 1.5rem}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}/*!@:host([detached])*/[detached].sc-calcite-shell-center-row-h{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);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{align-self:flex-end}/*!@:host([position=start])*/[position=start].sc-calcite-shell-center-row-h{align-self:flex-start}/*!@:host([height-scale=s])*/[height-scale=s].sc-calcite-shell-center-row-h{block-size:33.333333%}/*!@:host([height-scale=m])*/[height-scale=m].sc-calcite-shell-center-row-h{block-size:70%}/*!@:host([height-scale=l])*/[height-scale=l].sc-calcite-shell-center-row-h{block-size:100%}/*!@:host([height-scale=l][detached])*/[height-scale=l][detached].sc-calcite-shell-center-row-h{block-size:calc(100% - 2rem)}/*!@::slotted(calcite-panel)*/.sc-calcite-shell-center-row-s>calcite-panel{block-size:100%;inline-size: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]{border-inline-end:1px solid;border-color:var(--calcite-ui-border-3)}";
- /**
- * @slot - A slot for adding content to the `calcite-shell-panel`.
- * @slot action-bar - A slot for adding a `calcite-action-bar` to the `calcite-shell-panel`.
- */
- class ShellCenterRow {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, the content area displays like a floating panel.
- */
- this.detached = false;
- /**
- * Specifies the maximum height of the component.
- */
- this.heightScale = "s";
- /**
- * Specifies the component's position. Will be flipped when the element direction is right-to-left (`"rtl"`).
- */
- this.position = "end";
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const { el } = this;
- const contentNode = (hAsync("div", { class: CSS$b.content }, hAsync("slot", null)));
- const actionBar = getSlotted(el, SLOTS$6.actionBar);
- const actionBarNode = actionBar ? (hAsync("div", { class: CSS$b.actionBarContainer, key: "action-bar" }, hAsync("slot", { name: SLOTS$6.actionBar }))) : null;
- const children = [actionBarNode, contentNode];
- if ((actionBar === null || actionBar === void 0 ? void 0 : actionBar.position) === "end") {
- children.reverse();
- }
- return hAsync(Fragment, null, children);
- }
- get el() { return getElement(this); }
- static get style() { return shellCenterRowCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-shell-center-row",
- "$members$": {
- "detached": [516],
- "heightScale": [513, "height-scale"],
- "position": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["detached", "detached"], ["heightScale", "height-scale"], ["position", "position"]]
- }; }
- }
- const CSS$a = {
- container: "container",
- content: "content",
- contentHeader: "content__header",
- contentBody: "content__body",
- contentDetached: "content--detached",
- separator: "separator"
- };
- const SLOTS$5 = {
- actionBar: "action-bar",
- header: "header"
- };
- const TEXT$3 = {
- resize: "Resize"
- };
- const shellPanelCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-shell-panel{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-shell-panel{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-shell-panel{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-shell-panel{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-shell-panel:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-shell-panel:root{--calcite-floating-ui-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:flex;flex:0 1 auto;align-items:stretch;--calcite-shell-panel-detached-max-height:unset}/*!@.container*/.container.sc-calcite-shell-panel{pointer-events:none;box-sizing:border-box;display:flex;flex:1 1 auto;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{box-sizing:border-box}/*!@:host(:hover) .separator:not(:hover):not(:focus), \n: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;inset-block:0px;display:flex;block-size:100%;inline-size:0.125rem;background-color:transparent;opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 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), \n::slotted(calcite-flow)*/.sc-calcite-shell-panel-s>calcite-panel,.sc-calcite-shell-panel-s>calcite-flow{block-size:100%;inline-size:100%;flex:1 1 auto;max-block-size:unset;max-inline-size:unset}/*!@::slotted(.calcite-match-height)*/.sc-calcite-shell-panel-s>.calcite-match-height{display:flex;flex:1 1 auto;overflow:hidden}/*!@.content*/.content.sc-calcite-shell-panel{pointer-events:auto;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;align-self:stretch;background-color:var(--calcite-ui-background);padding:0px;inline-size:var(--calcite-shell-panel-width);max-inline-size:var(--calcite-shell-panel-max-width);min-inline-size:var(--calcite-shell-panel-min-width);transition:max-block-size var(--calcite-animation-timing), max-inline-size var(--calcite-animation-timing)}/*!@.content__header*/.content__header.sc-calcite-shell-panel{display:flex;flex:0 1 auto;flex-direction:column;flex-wrap:nowrap;align-items:stretch}/*!@.content__body*/.content__body.sc-calcite-shell-panel{display:flex;flex:1 1 auto;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-inline:0.5rem;margin-block:0.5rem auto;block-size: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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);max-block-size: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-block-size:unset}/*!@:host([position=start]) .content--detached ::slotted(calcite-panel), \n:host([position=start]) .content--detached ::slotted(calcite-flow), \n:host([position=end]) .content--detached ::slotted(calcite-panel), \n: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), \n.content ::slotted(calcite-flow), \n.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-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{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{border-inline-end:none}";
- /**
- * @slot - A slot for adding content to the component.
- * @slot action-bar - A slot for adding a `calcite-action-bar` to the component.
- */
- class ShellPanel {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteShellPanelToggle = createEvent(this, "calciteShellPanelToggle", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, hides the component's content area.
- */
- this.collapsed = false;
- /**
- * When `true`, the content area displays like a floating panel.
- */
- this.detached = false;
- /**
- * When `detached`, specifies the maximum height of the component.
- */
- this.detachedHeightScale = "l";
- /**
- * Specifies the width of the component's content area.
- */
- this.widthScale = "m";
- /**
- * Accessible name for the resize separator.
- *
- * @default "Resize"
- */
- this.intlResize = TEXT$3.resize;
- /**
- * When `true` and not `detached`, the component's content area is resizable.
- */
- this.resizable = false;
- this.contentWidth = null;
- this.initialContentWidth = null;
- this.initialClientX = null;
- this.contentWidthMax = null;
- this.contentWidthMin = null;
- this.step = 1;
- this.stepMultiplier = 10;
- this.storeContentEl = (contentEl) => {
- this.contentEl = contentEl;
- };
- this.getKeyAdjustedWidth = (event) => {
- const { key } = event;
- const { el, step, stepMultiplier, contentWidthMin, contentWidthMax, initialContentWidth, position } = this;
- const multipliedStep = step * stepMultiplier;
- const MOVEMENT_KEYS = [
- "ArrowUp",
- "ArrowDown",
- "ArrowLeft",
- "ArrowRight",
- "Home",
- "End",
- "PageUp",
- "PageDown"
- ];
- if (MOVEMENT_KEYS.indexOf(key) > -1) {
- event.preventDefault();
- }
- const dir = getElementDir(el);
- const directionKeys = ["ArrowLeft", "ArrowRight"];
- const directionFactor = dir === "rtl" && directionKeys.includes(key) ? -1 : 1;
- const increaseKeys = key === "ArrowUp" ||
- (position === "end" ? key === directionKeys[0] : key === directionKeys[1]);
- if (increaseKeys) {
- const stepValue = event.shiftKey ? multipliedStep : step;
- return initialContentWidth + directionFactor * stepValue;
- }
- const decreaseKeys = key === "ArrowDown" ||
- (position === "end" ? key === directionKeys[1] : key === directionKeys[0]);
- if (decreaseKeys) {
- const stepValue = event.shiftKey ? multipliedStep : step;
- return initialContentWidth - directionFactor * stepValue;
- }
- if (typeof contentWidthMin === "number" && key === "Home") {
- return contentWidthMin;
- }
- if (typeof contentWidthMax === "number" && key === "End") {
- return contentWidthMax;
- }
- if (key === "PageDown") {
- return initialContentWidth - multipliedStep;
- }
- if (key === "PageUp") {
- return initialContentWidth + multipliedStep;
- }
- return null;
- };
- this.separatorKeyDown = (event) => {
- this.setInitialContentWidth();
- const width = this.getKeyAdjustedWidth(event);
- if (typeof width === "number") {
- this.setContentWidth(width);
- }
- };
- this.separatorPointerMove = (event) => {
- event.preventDefault();
- const { el, initialContentWidth, position, initialClientX } = this;
- const offset = event.clientX - initialClientX;
- const dir = getElementDir(el);
- const adjustmentDirection = dir === "rtl" ? -1 : 1;
- const adjustedOffset = position === "end" ? -adjustmentDirection * offset : adjustmentDirection * offset;
- const width = initialContentWidth + adjustedOffset;
- this.setContentWidth(width);
- };
- this.separatorPointerUp = (event) => {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- event.preventDefault();
- document.removeEventListener("pointerup", this.separatorPointerUp);
- document.removeEventListener("pointermove", this.separatorPointerMove);
- };
- this.setInitialContentWidth = () => {
- var _a;
- this.initialContentWidth = (_a = this.contentEl) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
- };
- this.separatorPointerDown = (event) => {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- event.preventDefault();
- const { separatorEl } = this;
- separatorEl && document.activeElement !== separatorEl && separatorEl.focus();
- this.setInitialContentWidth();
- this.initialClientX = event.clientX;
- document.addEventListener("pointerup", this.separatorPointerUp);
- document.addEventListener("pointermove", this.separatorPointerMove);
- };
- this.connectSeparator = (separatorEl) => {
- this.disconnectSeparator();
- this.separatorEl = separatorEl;
- separatorEl.addEventListener("pointerdown", this.separatorPointerDown);
- };
- this.disconnectSeparator = () => {
- var _a;
- (_a = this.separatorEl) === null || _a === void 0 ? void 0 : _a.removeEventListener("pointerdown", this.separatorPointerDown);
- };
- }
- watchHandler() {
- this.calciteShellPanelToggle.emit();
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- this.disconnectSeparator();
- }
- componentDidLoad() {
- this.updateAriaValues();
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderHeader() {
- const { el } = this;
- const hasHeader = getSlotted(el, SLOTS$5.header);
- return hasHeader ? (hAsync("div", { class: CSS$a.contentHeader, key: "header" }, hAsync("slot", { name: SLOTS$5.header }))) : null;
- }
- render() {
- const { collapsed, detached, position, initialContentWidth, contentWidth, contentWidthMax, contentWidthMin, intlResize, resizable } = this;
- const allowResizing = !detached && resizable;
- const contentNode = (hAsync("div", { class: { [CSS$a.content]: true, [CSS$a.contentDetached]: detached }, hidden: collapsed, key: "content", ref: this.storeContentEl, style: allowResizing && contentWidth ? { width: `${contentWidth}px` } : null }, this.renderHeader(), hAsync("div", { class: CSS$a.contentBody }, hAsync("slot", null))));
- 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$a.separator, key: "separator", onKeyDown: this.separatorKeyDown, ref: this.connectSeparator, role: "separator", tabIndex: 0, "touch-action": "none" })) : null;
- const actionBarNode = hAsync("slot", { key: "action-bar", name: SLOTS$5.actionBar });
- const mainNodes = [actionBarNode, contentNode, separatorNode];
- if (position === "end") {
- mainNodes.reverse();
- }
- return hAsync("div", { class: { [CSS$a.container]: true } }, mainNodes);
- }
- // --------------------------------------------------------------------------
- //
- // private Methods
- //
- // --------------------------------------------------------------------------
- setContentWidth(width) {
- const { contentWidthMax, contentWidthMin } = this;
- const roundedWidth = Math.round(width);
- this.contentWidth =
- typeof contentWidthMax === "number" && typeof contentWidthMin === "number"
- ? clamp(roundedWidth, contentWidthMin, contentWidthMax)
- : roundedWidth;
- }
- updateAriaValues() {
- const { contentEl } = this;
- const computedStyle = contentEl && getComputedStyle(contentEl);
- if (!computedStyle) {
- return;
- }
- const max = parseInt(computedStyle.getPropertyValue("max-width"), 10);
- const min = parseInt(computedStyle.getPropertyValue("min-width"), 10);
- const valueNow = parseInt(computedStyle.getPropertyValue("width"), 10);
- if (typeof valueNow === "number" && !isNaN(valueNow)) {
- this.initialContentWidth = valueNow;
- }
- if (typeof max === "number" && !isNaN(max)) {
- this.contentWidthMax = max;
- }
- if (typeof min === "number" && !isNaN(min)) {
- this.contentWidthMin = min;
- }
- forceUpdate$1(this);
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "collapsed": ["watchHandler"]
- }; }
- static get style() { return shellPanelCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-shell-panel",
- "$members$": {
- "collapsed": [516],
- "detached": [516],
- "detachedHeightScale": [513, "detached-height-scale"],
- "widthScale": [513, "width-scale"],
- "position": [513],
- "intlResize": [1, "intl-resize"],
- "resizable": [516],
- "contentWidth": [32]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["collapsed", "collapsed"], ["detached", "detached"], ["detachedHeightScale", "detached-height-scale"], ["widthScale", "width-scale"], ["position", "position"], ["resizable", "resizable"]]
- }; }
- }
- const CSS$9 = {
- handleLabel: "handle__label",
- handleLabelMinValue: "handle__label--minValue",
- handleLabelValue: "handle__label--value",
- tickMin: "tick__label--min",
- tickMax: "tick__label--max"
- };
- const sliderCss = "@charset \"UTF-8\";@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-slider{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-slider{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-slider{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-slider{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-slider:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-slider:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-slider-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-slider-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@.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, \n.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, \n.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, \n.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, \n.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-inline:calc(var(--calcite-slider-handle-size) * 0.5);padding-block:calc(var(--calcite-slider-handle-size) * 0.5);margin-block:calc(var(--calcite-slider-handle-size) * 0.5);margin-inline:0;--calcite-slider-full-handle-height:calc(\n var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height)\n )}/*!@: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-inline-size:100%}/*!@.thumb*/.thumb.sc-calcite-slider{--calcite-slider-thumb-x-offset:calc(var(--calcite-slider-handle-size) * 0.5);position:absolute;margin:0px;display:flex;cursor:pointer;flex-direction:column;align-items:center;border-style:none;background-color:transparent;padding:0px;font-family:inherit;outline:2px solid transparent;outline-offset:2px;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;inset-block:0px;opacity:0}/*!@.thumb .handle__label.hyphen::after*/.thumb.sc-calcite-slider .handle__label.hyphen.sc-calcite-slider::after{content:\"—\";display:inline-block;inline-size:1em}/*!@.thumb .handle__label.hyphen--wrap*/.thumb.sc-calcite-slider .handle__label.hyphen--wrap.sc-calcite-slider{display:flex}/*!@.thumb .handle*/.thumb.sc-calcite-slider .handle.sc-calcite-slider{box-sizing:border-box;border-radius:9999px;background-color:var(--calcite-ui-foreground-1);outline-color:transparent;block-size:var(--calcite-slider-handle-size);inline-size:var(--calcite-slider-handle-size);box-shadow:0 0 0 2px var(--calcite-ui-text-3) inset;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}/*!@.thumb .handle-extension*/.thumb.sc-calcite-slider .handle-extension.sc-calcite-slider{inline-size:0.125rem;block-size: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{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{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-block-start: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-block-end: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, \n.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);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.16)}/*!@.thumb:hover.thumb--precise:after, \n.thumb:focus.thumb--precise:after, \n.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;block-size:0.125rem;border-radius:0px;background-color:var(--calcite-ui-border-2);transition:all var(--calcite-internal-animation-timing-medium) ease-in}/*!@.track__range*/.track__range.sc-calcite-slider{position:absolute;inset-block-start:0px;block-size: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;inline-size:100%;content:\"\";inset-block-start:calc(var(--calcite-slider-full-handle-height) * 0.5 * -1);block-size: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;block-size:0.25rem;inline-size:0.125rem;border-width:1px;border-style:solid;background-color:var(--calcite-ui-border-input);border-color:var(--calcite-ui-foreground-1);inset-block-start:-2px;pointer-events:none;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-block-start:0.875rem;display:flex;justify-content:center}/*!@.tick__label--min*/.tick__label--min.sc-calcite-slider{transition:opacity var(--calcite-animation-timing)}/*!@.tick__label--max*/.tick__label--max.sc-calcite-slider{transition:opacity var(--calcite-internal-animation-timing-fast)}/*!@:host([has-histogram][label-handles]) .tick__label--min, \n:host([has-histogram][label-handles]) .tick__label--max, \n:host([has-histogram][precise]) .tick__label--min, \n: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);block-size:48px}/*!@:host([label-ticks][ticks]) .container*/[label-ticks][ticks].sc-calcite-slider-h .container.sc-calcite-slider{padding-block-end: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-block-end: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-block-end: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-block-end: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-block-start: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-block-end: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-block-start: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-block-start: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-block-end: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]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- function isRange(value) {
- return Array.isArray(value);
- }
- class Slider {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteSliderInput = createEvent(this, "calciteSliderInput", 6);
- this.calciteSliderChange = createEvent(this, "calciteSliderChange", 6);
- this.calciteSliderUpdate = createEvent(this, "calciteSliderUpdate", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /**
- * When `true`, number values are displayed with a group separator corresponding to the language and country format.
- */
- this.groupSeparator = false;
- /** When `true`, indicates a histogram is present. */
- this.hasHistogram = false;
- /** When `true`, displays label handles with their numeric value. */
- this.labelHandles = false;
- /** When `true` and `ticks` is specified, displays label tick marks with their numeric value. */
- this.labelTicks = false;
- /** The component's maximum selectable value. */
- this.max = 100;
- /** The component's minimum selectable value. */
- this.min = 0;
- /**
- * When `true`, the slider will display values from high to low.
- *
- * Note that this value will be ignored if the slider has an associated histogram.
- */
- this.mirrored = false;
- /** When `true`, sets a finer point for handles. */
- this.precise = false;
- /**
- * When `true`, the component must have a value in order for the form to submit.
- */
- this.required = false;
- /** When `true`, enables snap selection in coordination with `step` via a mouse. */
- this.snap = false;
- /** Specifies the interval to move with the up, or down keys. */
- this.step = 1;
- /** The component's value. */
- this.value = 0;
- /**
- * Specifies the size of the component.
- */
- this.scale = "m";
- this.activeProp = "value";
- this.guid = `calcite-slider-${guid()}`;
- this.effectiveLocale = "";
- this.minMaxValueRange = null;
- this.minValueDragRange = null;
- this.maxValueDragRange = null;
- this.tickValues = [];
- this.dragUpdate = (event) => {
- event.preventDefault();
- if (this.dragProp) {
- const value = this.translate(event.clientX || event.pageX);
- if (isRange(this.value) && this.dragProp === "minMaxValue") {
- if (this.minValueDragRange && this.maxValueDragRange && this.minMaxValueRange) {
- const newMinValue = value - this.minValueDragRange;
- const newMaxValue = value + this.maxValueDragRange;
- if (newMaxValue <= this.max &&
- newMinValue >= this.min &&
- newMaxValue - newMinValue === this.minMaxValueRange) {
- this.setValue({
- minValue: this.clamp(newMinValue, "minValue"),
- maxValue: this.clamp(newMaxValue, "maxValue")
- });
- }
- }
- else {
- this.minValueDragRange = value - this.minValue;
- this.maxValueDragRange = this.maxValue - value;
- this.minMaxValueRange = this.maxValue - this.minValue;
- }
- }
- else {
- this.setValue({ [this.dragProp]: this.clamp(value, this.dragProp) });
- }
- }
- };
- this.pointerUpDragEnd = (event) => {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- this.dragEnd(event);
- };
- this.dragEnd = (event) => {
- this.removeDragListeners();
- this.focusActiveHandle(event.clientX);
- if (this.lastDragPropValue != this[this.dragProp]) {
- this.emitChange();
- }
- this.dragProp = null;
- this.lastDragPropValue = null;
- this.minValueDragRange = null;
- this.maxValueDragRange = null;
- this.minMaxValueRange = null;
- };
- /**
- * Set the reference of the track Element
- *
- * @internal
- * @param node
- */
- this.storeTrackRef = (node) => {
- this.trackEl = node;
- };
- /**
- * Returns a string representing the localized label value based if the groupSeparator prop is parsed.
- *
- * @param value
- */
- this.determineGroupSeparator = (value) => {
- if (typeof value === "number") {
- numberStringFormatter.numberFormatOptions = {
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem,
- useGrouping: this.groupSeparator
- };
- return numberStringFormatter.localize(value.toString());
- }
- };
- }
- histogramWatcher(newHistogram) {
- this.hasHistogram = !!newHistogram;
- }
- valueHandler() {
- this.setMinMaxFromValue();
- }
- minMaxValueHandler() {
- this.setValueFromMinMax();
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- connectLocalized(this);
- this.setMinMaxFromValue();
- this.setValueFromMinMax();
- connectLabel(this);
- connectForm(this);
- }
- disconnectedCallback() {
- disconnectLabel(this);
- disconnectForm(this);
- disconnectLocalized(this);
- this.removeDragListeners();
- }
- componentWillLoad() {
- this.tickValues = this.generateTickValues();
- if (!isRange(this.value)) {
- this.value = this.clamp(this.value);
- }
- afterConnectDefaultValueSet(this, this.value);
- if (this.snap && !isRange(this.value)) {
- this.value = this.getClosestStep(this.value);
- }
- if (this.histogram) {
- this.hasHistogram = true;
- }
- }
- componentDidRender() {
- if (this.labelHandles) {
- this.adjustHostObscuredHandleLabel("value");
- if (isRange(this.value)) {
- this.adjustHostObscuredHandleLabel("minValue");
- if (!(this.precise && !this.hasHistogram)) {
- this.hyphenateCollidingRangeHandleLabels();
- }
- }
- }
- this.hideObscuredBoundingTickLabels();
- updateHostInteraction(this);
- }
- render() {
- const id = this.el.id || this.guid;
- const maxProp = isRange(this.value) ? "maxValue" : "value";
- const value = isRange(this.value) ? this.maxValue : this.value;
- const displayedValue = this.determineGroupSeparator(value);
- const displayedMinValue = this.determineGroupSeparator(this.minValue);
- const min = this.minValue || this.min;
- const useMinValue = this.shouldUseMinValue();
- const minInterval = this.getUnitInterval(useMinValue ? this.minValue : min) * 100;
- const maxInterval = this.getUnitInterval(value) * 100;
- const mirror = this.shouldMirror();
- const leftThumbOffset = `${mirror ? 100 - minInterval : minInterval}%`;
- const rightThumbOffset = `${mirror ? maxInterval : 100 - maxInterval}%`;
- const valueIsRange = isRange(this.value);
- const handleLabelMinValueClasses = `${CSS$9.handleLabel} ${CSS$9.handleLabelMinValue}`;
- const handleLabelValueClasses = `${CSS$9.handleLabel} ${CSS$9.handleLabelValue}`;
- 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: {
- thumb: true,
- "thumb--value": true,
- "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" })));
- 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: {
- thumb: true,
- "thumb--value": true,
- "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("span", { "aria-hidden": "true", class: handleLabelValueClasses }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue), hAsync("div", { class: "handle" })));
- 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: {
- thumb: true,
- "thumb--value": true,
- "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" }), hAsync("span", { "aria-hidden": "true", class: handleLabelValueClasses }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue)));
- 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: {
- thumb: true,
- "thumb--value": true,
- "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
- "thumb--precise": true
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" }), hAsync("div", { class: "handle-extension" })));
- 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: {
- thumb: true,
- "thumb--value": true,
- "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
- "thumb--precise": true
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle-extension" }), hAsync("div", { class: "handle" })));
- 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: {
- thumb: true,
- "thumb--value": true,
- "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
- "thumb--precise": true
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, hAsync("span", { "aria-hidden": "true", class: handleLabelValueClasses }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue), hAsync("div", { class: "handle" }), hAsync("div", { class: "handle-extension" })));
- 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: {
- thumb: true,
- "thumb--value": true,
- "thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
- "thumb--precise": true
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: (event) => this.pointerDownDragStart(event, 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: handleLabelValueClasses }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} static` }, displayedValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelValueClasses} transformed` }, displayedValue)));
- 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: {
- thumb: true,
- "thumb--minValue": true,
- "thumb--active": this.dragProp === "minValue"
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" })));
- 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: {
- thumb: true,
- "thumb--minValue": true,
- "thumb--active": this.dragProp === "minValue"
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("span", { "aria-hidden": "true", class: handleLabelMinValueClasses }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} static` }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} transformed` }, displayedMinValue), hAsync("div", { class: "handle" })));
- 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: {
- thumb: true,
- "thumb--minValue": true,
- "thumb--active": this.dragProp === "minValue"
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle" }), hAsync("span", { "aria-hidden": "true", class: handleLabelMinValueClasses }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} static` }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} transformed` }, displayedMinValue)));
- 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: {
- thumb: true,
- "thumb--minValue": true,
- "thumb--active": this.dragProp === "minValue",
- "thumb--precise": true
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, hAsync("div", { class: "handle-extension" }), hAsync("div", { class: "handle" })));
- 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: {
- thumb: true,
- "thumb--minValue": true,
- "thumb--active": this.dragProp === "minValue",
- "thumb--precise": true
- }, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: (event) => this.pointerDownDragStart(event, "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: handleLabelMinValueClasses }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} static` }, displayedMinValue), hAsync("span", { "aria-hidden": "true", class: `${handleLabelMinValueClasses} transformed` }, displayedMinValue)));
- return (hAsync(Host, { id: id, onTouchStart: this.handleTouchStart }, hAsync("div", { class: {
- ["container"]: true,
- ["container--range"]: valueIsRange,
- [`scale--${this.scale}`]: true
- } }, this.renderGraph(), hAsync("div", { class: "track", ref: this.storeTrackRef }, hAsync("div", { class: "track__range", onPointerDown: (event) => this.pointerDownDragStart(event, "minMaxValue"), style: {
- left: `${mirror ? 100 - maxInterval : minInterval}%`,
- right: `${mirror ? minInterval : 100 - maxInterval}%`
- } }), hAsync("div", { class: "ticks" }, this.tickValues.map((tick) => {
- const tickOffset = `${this.getUnitInterval(tick) * 100}%`;
- let activeTicks = tick >= min && tick <= value;
- if (useMinValue) {
- activeTicks = tick >= this.minValue && tick <= this.maxValue;
- }
- return (hAsync("span", { class: {
- tick: true,
- "tick--active": activeTicks
- }, style: {
- left: mirror ? "" : tickOffset,
- right: mirror ? tickOffset : ""
- } }, this.renderTickLabel(tick)));
- }))), hAsync("div", { class: "thumb-container" }, !this.precise && !this.labelHandles && valueIsRange && minHandle, !this.hasHistogram &&
- !this.precise &&
- this.labelHandles &&
- valueIsRange &&
- minLabeledHandle, this.precise && !this.labelHandles && valueIsRange && minPreciseHandle, this.precise && this.labelHandles && valueIsRange && minLabeledPreciseHandle, this.hasHistogram &&
- !this.precise &&
- this.labelHandles &&
- valueIsRange &&
- 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 &&
- this.precise &&
- this.labelHandles &&
- histogramLabeledPreciseHandle, hAsync(HiddenFormInputSlot, { component: this })))));
- }
- renderGraph() {
- 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;
- }
- renderTickLabel(tick) {
- const valueIsRange = isRange(this.value);
- const isMinTickLabel = tick === this.min;
- const isMaxTickLabel = tick === this.max;
- const displayedTickValue = this.determineGroupSeparator(tick);
- const tickLabel = (hAsync("span", { class: {
- tick__label: true,
- [CSS$9.tickMin]: isMinTickLabel,
- [CSS$9.tickMax]: isMaxTickLabel
- } }, displayedTickValue));
- if (this.labelTicks && !this.hasHistogram && !valueIsRange) {
- return tickLabel;
- }
- if (this.labelTicks &&
- !this.hasHistogram &&
- valueIsRange &&
- !this.precise &&
- !this.labelHandles) {
- return tickLabel;
- }
- if (this.labelTicks &&
- !this.hasHistogram &&
- valueIsRange &&
- !this.precise &&
- this.labelHandles) {
- return tickLabel;
- }
- if (this.labelTicks &&
- !this.hasHistogram &&
- valueIsRange &&
- this.precise &&
- (isMinTickLabel || isMaxTickLabel)) {
- return tickLabel;
- }
- if (this.labelTicks && this.hasHistogram && !this.precise && !this.labelHandles) {
- return tickLabel;
- }
- if (this.labelTicks &&
- this.hasHistogram &&
- this.precise &&
- !this.labelHandles &&
- (isMinTickLabel || isMaxTickLabel)) {
- return tickLabel;
- }
- if (this.labelTicks &&
- this.hasHistogram &&
- !this.precise &&
- this.labelHandles &&
- (isMinTickLabel || isMaxTickLabel)) {
- return tickLabel;
- }
- if (this.labelTicks &&
- this.hasHistogram &&
- this.precise &&
- this.labelHandles &&
- (isMinTickLabel || isMaxTickLabel)) {
- return tickLabel;
- }
- return null;
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- keyDownHandler(event) {
- const mirror = this.shouldMirror();
- const { activeProp, max, min, pageStep, step } = this;
- const value = this[activeProp];
- const { key } = event;
- if (isActivationKey(key)) {
- event.preventDefault();
- return;
- }
- let adjustment;
- if (key === "ArrowUp" || key === "ArrowRight") {
- const directionFactor = mirror && key === "ArrowRight" ? -1 : 1;
- adjustment = value + step * directionFactor;
- }
- else if (key === "ArrowDown" || key === "ArrowLeft") {
- const directionFactor = mirror && key === "ArrowLeft" ? -1 : 1;
- adjustment = value - step * directionFactor;
- }
- else if (key === "PageUp") {
- if (pageStep) {
- adjustment = value + pageStep;
- }
- }
- else if (key === "PageDown") {
- if (pageStep) {
- adjustment = value - pageStep;
- }
- }
- else if (key === "Home") {
- adjustment = min;
- }
- else if (key === "End") {
- adjustment = max;
- }
- if (isNaN(adjustment)) {
- return;
- }
- event.preventDefault();
- const fixedDecimalAdjustment = Number(adjustment.toFixed(decimalPlaces(step)));
- this.setValue({
- [activeProp]: this.clamp(fixedDecimalAdjustment, activeProp)
- });
- }
- pointerDownHandler(event) {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- const x = event.clientX || event.pageX;
- const position = this.translate(x);
- let prop = "value";
- if (isRange(this.value)) {
- const inRange = position >= this.minValue && position <= this.maxValue;
- if (inRange && this.lastDragProp === "minMaxValue") {
- prop = "minMaxValue";
- }
- else {
- const closerToMax = Math.abs(this.maxValue - position) < Math.abs(this.minValue - position);
- prop = closerToMax || position > this.maxValue ? "maxValue" : "minValue";
- }
- }
- this.lastDragPropValue = this[prop];
- this.dragStart(prop);
- const isThumbActive = this.el.shadowRoot.querySelector(".thumb:active");
- if (!isThumbActive) {
- this.setValue({ [prop]: this.clamp(position, prop) });
- }
- this.focusActiveHandle(x);
- }
- handleTouchStart(event) {
- // needed to prevent extra click at the end of a handle drag
- event.preventDefault();
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- const handle = this.minHandle ? this.minHandle : this.maxHandle;
- handle === null || handle === void 0 ? void 0 : handle.focus();
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- setValueFromMinMax() {
- const { minValue, maxValue } = this;
- if (typeof minValue === "number" && typeof maxValue === "number") {
- this.value = [minValue, maxValue];
- }
- }
- setMinMaxFromValue() {
- const { value } = this;
- if (isRange(value)) {
- this.minValue = value[0];
- this.maxValue = value[1];
- }
- }
- onLabelClick() {
- this.setFocus();
- }
- shouldMirror() {
- return this.mirrored && !this.hasHistogram;
- }
- shouldUseMinValue() {
- if (!isRange(this.value)) {
- return false;
- }
- return ((this.hasHistogram && this.maxValue === 0) || (!this.hasHistogram && this.minValue === 0));
- }
- generateTickValues() {
- const ticks = [];
- let current = this.min;
- while (this.ticks && current < this.max + this.ticks) {
- ticks.push(Math.min(current, this.max));
- current = current + this.ticks;
- }
- return ticks;
- }
- pointerDownDragStart(event, prop) {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- this.dragStart(prop);
- }
- dragStart(prop) {
- this.dragProp = prop;
- this.lastDragProp = this.dragProp;
- this.activeProp = prop;
- document.addEventListener("pointermove", this.dragUpdate);
- document.addEventListener("pointerup", this.pointerUpDragEnd);
- document.addEventListener("pointercancel", this.dragEnd);
- }
- focusActiveHandle(valueX) {
- switch (this.dragProp) {
- case "minValue":
- this.minHandle.focus();
- break;
- case "maxValue":
- case "value":
- this.maxHandle.focus();
- break;
- case "minMaxValue":
- this.getClosestHandle(valueX).focus();
- break;
- }
- }
- emitInput() {
- this.calciteSliderInput.emit();
- this.calciteSliderUpdate.emit();
- }
- emitChange() {
- this.calciteSliderChange.emit();
- }
- removeDragListeners() {
- document.removeEventListener("pointermove", this.dragUpdate);
- document.removeEventListener("pointerup", this.pointerUpDragEnd);
- document.removeEventListener("pointercancel", this.dragEnd);
- }
- /**
- * Set prop value(s) if changed at the component level
- *
- * @param {object} values - a set of key/value pairs delineating what properties in the component to update
- */
- setValue(values) {
- let valueChanged;
- Object.keys(values).forEach((propName) => {
- const newValue = values[propName];
- if (!valueChanged) {
- const oldValue = this[propName];
- valueChanged = oldValue !== newValue;
- }
- this[propName] = newValue;
- });
- if (!valueChanged) {
- return;
- }
- const dragging = this.dragProp;
- if (!dragging) {
- this.emitChange();
- }
- this.emitInput();
- }
- /**
- * If number is outside range, constrain to min or max
- *
- * @param value
- * @param prop
- * @internal
- */
- clamp(value, prop) {
- value = clamp(value, this.min, this.max);
- // ensure that maxValue and minValue don't swap positions
- if (prop === "maxValue") {
- value = Math.max(value, this.minValue);
- }
- if (prop === "minValue") {
- value = Math.min(value, this.maxValue);
- }
- return value;
- }
- /**
- * Translate a pixel position to value along the range
- *
- * @param x
- * @internal
- */
- translate(x) {
- const range = this.max - this.min;
- const { left, width } = this.trackEl.getBoundingClientRect();
- const percent = (x - left) / width;
- const mirror = this.shouldMirror();
- const clampedValue = this.clamp(this.min + range * (mirror ? 1 - percent : percent));
- let value = Number(clampedValue.toFixed(decimalPlaces(this.step)));
- if (this.snap && this.step) {
- value = this.getClosestStep(value);
- }
- return value;
- }
- /**
- * Get closest allowed value along stepped values
- *
- * @param num
- * @internal
- */
- getClosestStep(num) {
- num = Number(this.clamp(num).toFixed(decimalPlaces(this.step)));
- if (this.step) {
- const step = Math.round(num / this.step) * this.step;
- num = Number(this.clamp(step).toFixed(decimalPlaces(this.step)));
- }
- return num;
- }
- getClosestHandle(valueX) {
- return this.getDistanceX(this.maxHandle, valueX) > this.getDistanceX(this.minHandle, valueX)
- ? this.minHandle
- : this.maxHandle;
- }
- getDistanceX(el, valueX) {
- return Math.abs(el.getBoundingClientRect().left - valueX);
- }
- getFontSizeForElement(element) {
- return Number(window.getComputedStyle(element).getPropertyValue("font-size").match(/\d+/)[0]);
- }
- /**
- * Get position of value along range as fractional value
- *
- * @param num
- * @return {number} number in the unit interval [0,1]
- * @internal
- */
- getUnitInterval(num) {
- num = this.clamp(num);
- const range = this.max - this.min;
- return (num - this.min) / range;
- }
- adjustHostObscuredHandleLabel(name) {
- const label = this.el.shadowRoot.querySelector(`.handle__label--${name}`);
- const labelStatic = this.el.shadowRoot.querySelector(`.handle__label--${name}.static`);
- const labelTransformed = this.el.shadowRoot.querySelector(`.handle__label--${name}.transformed`);
- const labelStaticBounds = labelStatic.getBoundingClientRect();
- const labelStaticOffset = this.getHostOffset(labelStaticBounds.left, labelStaticBounds.right);
- label.style.transform = `translateX(${labelStaticOffset}px)`;
- labelTransformed.style.transform = `translateX(${labelStaticOffset}px)`;
- }
- hyphenateCollidingRangeHandleLabels() {
- const { shadowRoot } = this.el;
- const mirror = this.shouldMirror();
- const leftModifier = mirror ? "value" : "minValue";
- const rightModifier = mirror ? "minValue" : "value";
- const leftValueLabel = shadowRoot.querySelector(`.handle__label--${leftModifier}`);
- const leftValueLabelStatic = shadowRoot.querySelector(`.handle__label--${leftModifier}.static`);
- const leftValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${leftModifier}.transformed`);
- const leftValueLabelStaticHostOffset = this.getHostOffset(leftValueLabelStatic.getBoundingClientRect().left, leftValueLabelStatic.getBoundingClientRect().right);
- const rightValueLabel = shadowRoot.querySelector(`.handle__label--${rightModifier}`);
- const rightValueLabelStatic = shadowRoot.querySelector(`.handle__label--${rightModifier}.static`);
- const rightValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${rightModifier}.transformed`);
- const rightValueLabelStaticHostOffset = this.getHostOffset(rightValueLabelStatic.getBoundingClientRect().left, rightValueLabelStatic.getBoundingClientRect().right);
- const labelFontSize = this.getFontSizeForElement(leftValueLabel);
- const labelTransformedOverlap = this.getRangeLabelOverlap(leftValueLabelTransformed, rightValueLabelTransformed);
- const hyphenLabel = leftValueLabel;
- const labelOffset = labelFontSize / 2;
- if (labelTransformedOverlap > 0) {
- hyphenLabel.classList.add("hyphen", "hyphen--wrap");
- if (rightValueLabelStaticHostOffset === 0 && leftValueLabelStaticHostOffset === 0) {
- // Neither handle overlaps the host boundary
- let leftValueLabelTranslate = labelTransformedOverlap / 2 - labelOffset;
- leftValueLabelTranslate =
- Math.sign(leftValueLabelTranslate) === -1
- ? Math.abs(leftValueLabelTranslate)
- : -leftValueLabelTranslate;
- const leftValueLabelTransformedHostOffset = this.getHostOffset(leftValueLabelTransformed.getBoundingClientRect().left +
- leftValueLabelTranslate -
- labelOffset, leftValueLabelTransformed.getBoundingClientRect().right +
- leftValueLabelTranslate -
- labelOffset);
- let rightValueLabelTranslate = labelTransformedOverlap / 2;
- const rightValueLabelTransformedHostOffset = this.getHostOffset(rightValueLabelTransformed.getBoundingClientRect().left + rightValueLabelTranslate, rightValueLabelTransformed.getBoundingClientRect().right + rightValueLabelTranslate);
- if (leftValueLabelTransformedHostOffset !== 0) {
- leftValueLabelTranslate += leftValueLabelTransformedHostOffset;
- rightValueLabelTranslate += leftValueLabelTransformedHostOffset;
- }
- if (rightValueLabelTransformedHostOffset !== 0) {
- leftValueLabelTranslate += rightValueLabelTransformedHostOffset;
- rightValueLabelTranslate += rightValueLabelTransformedHostOffset;
- }
- leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
- leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
- rightValueLabel.style.transform = `translateX(${rightValueLabelTranslate}px)`;
- rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelTranslate}px)`;
- }
- else if (leftValueLabelStaticHostOffset > 0 || rightValueLabelStaticHostOffset > 0) {
- // labels overlap host boundary on the left side
- leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset + labelOffset}px)`;
- rightValueLabel.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
- rightValueLabelTransformed.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
- }
- else if (leftValueLabelStaticHostOffset < 0 || rightValueLabelStaticHostOffset < 0) {
- // labels overlap host boundary on the right side
- let leftValueLabelTranslate = Math.abs(leftValueLabelStaticHostOffset) + labelTransformedOverlap - labelOffset;
- leftValueLabelTranslate =
- Math.sign(leftValueLabelTranslate) === -1
- ? Math.abs(leftValueLabelTranslate)
- : -leftValueLabelTranslate;
- leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
- leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
- }
- }
- else {
- hyphenLabel.classList.remove("hyphen", "hyphen--wrap");
- leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
- leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
- rightValueLabel.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
- rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
- }
- }
- /**
- * Hides bounding tick labels that are obscured by either handle.
- */
- hideObscuredBoundingTickLabels() {
- const valueIsRange = isRange(this.value);
- if (!this.hasHistogram && !valueIsRange && !this.labelHandles && !this.precise) {
- return;
- }
- if (!this.hasHistogram && !valueIsRange && this.labelHandles && !this.precise) {
- return;
- }
- if (!this.hasHistogram && !valueIsRange && !this.labelHandles && this.precise) {
- return;
- }
- if (!this.hasHistogram && !valueIsRange && this.labelHandles && this.precise) {
- return;
- }
- if (!this.hasHistogram && valueIsRange && !this.precise) {
- return;
- }
- if (this.hasHistogram && !this.precise && !this.labelHandles) {
- return;
- }
- const minHandle = this.el.shadowRoot.querySelector(".thumb--minValue");
- const maxHandle = this.el.shadowRoot.querySelector(".thumb--value");
- const minTickLabel = this.el.shadowRoot.querySelector(".tick__label--min");
- const maxTickLabel = this.el.shadowRoot.querySelector(".tick__label--max");
- if (!minHandle && maxHandle && minTickLabel && maxTickLabel) {
- minTickLabel.style.opacity = this.isMinTickLabelObscured(minTickLabel, maxHandle) ? "0" : "1";
- maxTickLabel.style.opacity = this.isMaxTickLabelObscured(maxTickLabel, maxHandle) ? "0" : "1";
- }
- if (minHandle && maxHandle && minTickLabel && maxTickLabel) {
- minTickLabel.style.opacity =
- this.isMinTickLabelObscured(minTickLabel, minHandle) ||
- this.isMinTickLabelObscured(minTickLabel, maxHandle)
- ? "0"
- : "1";
- maxTickLabel.style.opacity =
- this.isMaxTickLabelObscured(maxTickLabel, minHandle) ||
- (this.isMaxTickLabelObscured(maxTickLabel, maxHandle) && this.hasHistogram)
- ? "0"
- : "1";
- }
- }
- /**
- * Returns an integer representing the number of pixels to offset on the left or right side based on desired position behavior.
- *
- * @param leftBounds
- * @param rightBounds
- * @internal
- */
- getHostOffset(leftBounds, rightBounds) {
- const hostBounds = this.el.getBoundingClientRect();
- const buffer = 7;
- if (leftBounds + buffer < hostBounds.left) {
- return hostBounds.left - leftBounds - buffer;
- }
- if (rightBounds - buffer > hostBounds.right) {
- return -(rightBounds - hostBounds.right) + buffer;
- }
- return 0;
- }
- /**
- * Returns an integer representing the number of pixels that the two given span elements are overlapping, taking into account
- * 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.
- *
- * @param leftLabel
- * @param rightLabel
- */
- getRangeLabelOverlap(leftLabel, rightLabel) {
- const leftLabelBounds = leftLabel.getBoundingClientRect();
- const rightLabelBounds = rightLabel.getBoundingClientRect();
- const leftLabelFontSize = this.getFontSizeForElement(leftLabel);
- const rangeLabelOverlap = leftLabelBounds.right + leftLabelFontSize - rightLabelBounds.left;
- return Math.max(rangeLabelOverlap, 0);
- }
- /**
- * Returns a boolean value representing if the minLabel span element is obscured (being overlapped) by the given handle div element.
- *
- * @param minLabel
- * @param handle
- */
- isMinTickLabelObscured(minLabel, handle) {
- const minLabelBounds = minLabel.getBoundingClientRect();
- const handleBounds = handle.getBoundingClientRect();
- return intersects(minLabelBounds, handleBounds);
- }
- /**
- * Returns a boolean value representing if the maxLabel span element is obscured (being overlapped) by the given handle div element.
- *
- * @param maxLabel
- * @param handle
- */
- isMaxTickLabelObscured(maxLabel, handle) {
- const maxLabelBounds = maxLabel.getBoundingClientRect();
- const handleBounds = handle.getBoundingClientRect();
- return intersects(maxLabelBounds, handleBounds);
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "histogram": ["histogramWatcher"],
- "value": ["valueHandler"],
- "minValue": ["minMaxValueHandler"],
- "maxValue": ["minMaxValueHandler"]
- }; }
- static get style() { return sliderCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-slider",
- "$members$": {
- "disabled": [516],
- "groupSeparator": [516, "group-separator"],
- "hasHistogram": [1540, "has-histogram"],
- "histogram": [16],
- "histogramStops": [16],
- "labelHandles": [516, "label-handles"],
- "labelTicks": [516, "label-ticks"],
- "max": [514],
- "maxLabel": [1, "max-label"],
- "maxValue": [1026, "max-value"],
- "min": [514],
- "minLabel": [1, "min-label"],
- "minValue": [1026, "min-value"],
- "mirrored": [516],
- "name": [513],
- "numberingSystem": [1, "numbering-system"],
- "pageStep": [514, "page-step"],
- "precise": [516],
- "required": [516],
- "snap": [516],
- "step": [514],
- "ticks": [514],
- "value": [1538],
- "scale": [513],
- "effectiveLocale": [32],
- "minMaxValueRange": [32],
- "minValueDragRange": [32],
- "maxValueDragRange": [32],
- "tickValues": [32],
- "setFocus": [64]
- },
- "$listeners$": [[0, "keydown", "keyDownHandler"], [1, "pointerdown", "pointerDownHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["groupSeparator", "group-separator"], ["hasHistogram", "has-histogram"], ["labelHandles", "label-handles"], ["labelTicks", "label-ticks"], ["max", "max"], ["min", "min"], ["mirrored", "mirrored"], ["name", "name"], ["pageStep", "page-step"], ["precise", "precise"], ["required", "required"], ["snap", "snap"], ["step", "step"], ["ticks", "ticks"], ["value", "value"], ["scale", "scale"]]
- }; }
- }
- /**!
- * Sortable 1.15.0
- * @author RubaXa <trash@rubaxa.org>
- * @author owenm <owen23355@gmail.com>
- * @license MIT
- */
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- if (enumerableOnly) {
- symbols = symbols.filter(function (sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- });
- }
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys(Object(source), true).forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (Object.getOwnPropertyDescriptors) {
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
- } else {
- ownKeys(Object(source)).forEach(function (key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- }
- return target;
- }
- function _typeof(obj) {
- "@babel/helpers - typeof";
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
- _typeof = function (obj) {
- return typeof obj;
- };
- } else {
- _typeof = function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
- };
- }
- return _typeof(obj);
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- function _extends() {
- _extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- };
- return _extends.apply(this, arguments);
- }
- function _objectWithoutPropertiesLoose(source, excluded) {
- if (source == null) return {};
- var target = {};
- var sourceKeys = Object.keys(source);
- var key, i;
- for (i = 0; i < sourceKeys.length; i++) {
- key = sourceKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- target[key] = source[key];
- }
- return target;
- }
- function _objectWithoutProperties(source, excluded) {
- if (source == null) return {};
- var target = _objectWithoutPropertiesLoose(source, excluded);
- var key, i;
- if (Object.getOwnPropertySymbols) {
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
- for (i = 0; i < sourceSymbolKeys.length; i++) {
- key = sourceSymbolKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
- target[key] = source[key];
- }
- }
- return target;
- }
- var version = "1.15.0";
- function userAgent(pattern) {
- if (typeof window !== 'undefined' && window.navigator) {
- return !! /*@__PURE__*/navigator.userAgent.match(pattern);
- }
- }
- var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
- var Edge = userAgent(/Edge/i);
- var FireFox = userAgent(/firefox/i);
- var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
- var IOS = userAgent(/iP(ad|od|hone)/i);
- var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
- var captureMode = {
- capture: false,
- passive: false
- };
- function on(el, event, fn) {
- el.addEventListener(event, fn, !IE11OrLess && captureMode);
- }
- function off(el, event, fn) {
- el.removeEventListener(event, fn, !IE11OrLess && captureMode);
- }
- function matches(
- /**HTMLElement*/
- el,
- /**String*/
- selector) {
- if (!selector) return;
- selector[0] === '>' && (selector = selector.substring(1));
- if (el) {
- try {
- if (el.matches) {
- return el.matches(selector);
- } else if (el.msMatchesSelector) {
- return el.msMatchesSelector(selector);
- } else if (el.webkitMatchesSelector) {
- return el.webkitMatchesSelector(selector);
- }
- } catch (_) {
- return false;
- }
- }
- return false;
- }
- function getParentOrHost(el) {
- return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
- }
- function closest(
- /**HTMLElement*/
- el,
- /**String*/
- selector,
- /**HTMLElement*/
- ctx, includeCTX) {
- if (el) {
- ctx = ctx || document;
- do {
- if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
- return el;
- }
- if (el === ctx) break;
- /* jshint boss:true */
- } while (el = getParentOrHost(el));
- }
- return null;
- }
- var R_SPACE = /\s+/g;
- function toggleClass(el, name, state) {
- if (el && name) {
- if (el.classList) {
- el.classList[state ? 'add' : 'remove'](name);
- } else {
- var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
- el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
- }
- }
- }
- function css(el, prop, val) {
- var style = el && el.style;
- if (style) {
- if (val === void 0) {
- if (document.defaultView && document.defaultView.getComputedStyle) {
- val = document.defaultView.getComputedStyle(el, '');
- } else if (el.currentStyle) {
- val = el.currentStyle;
- }
- return prop === void 0 ? val : val[prop];
- } else {
- if (!(prop in style) && prop.indexOf('webkit') === -1) {
- prop = '-webkit-' + prop;
- }
- style[prop] = val + (typeof val === 'string' ? '' : 'px');
- }
- }
- }
- function matrix(el, selfOnly) {
- var appliedTransforms = '';
- if (typeof el === 'string') {
- appliedTransforms = el;
- } else {
- do {
- var transform = css(el, 'transform');
- if (transform && transform !== 'none') {
- appliedTransforms = transform + ' ' + appliedTransforms;
- }
- /* jshint boss:true */
- } while (!selfOnly && (el = el.parentNode));
- }
- var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
- /*jshint -W056 */
- return matrixFn && new matrixFn(appliedTransforms);
- }
- function find(ctx, tagName, iterator) {
- if (ctx) {
- var list = ctx.getElementsByTagName(tagName),
- i = 0,
- n = list.length;
- if (iterator) {
- for (; i < n; i++) {
- iterator(list[i], i);
- }
- }
- return list;
- }
- return [];
- }
- function getWindowScrollingElement() {
- var scrollingElement = document.scrollingElement;
- if (scrollingElement) {
- return scrollingElement;
- } else {
- return document.documentElement;
- }
- }
- /**
- * Returns the "bounding client rect" of given element
- * @param {HTMLElement} el The element whose boundingClientRect is wanted
- * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
- * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
- * @param {[Boolean]} undoScale Whether the container's scale() should be undone
- * @param {[HTMLElement]} container The parent the element will be placed in
- * @return {Object} The boundingClientRect of el, with specified adjustments
- */
- function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
- if (!el.getBoundingClientRect && el !== window) return;
- var elRect, top, left, bottom, right, height, width;
- if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
- elRect = el.getBoundingClientRect();
- top = elRect.top;
- left = elRect.left;
- bottom = elRect.bottom;
- right = elRect.right;
- height = elRect.height;
- width = elRect.width;
- } else {
- top = 0;
- left = 0;
- bottom = window.innerHeight;
- right = window.innerWidth;
- height = window.innerHeight;
- width = window.innerWidth;
- }
- if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
- // Adjust for translate()
- container = container || el.parentNode; // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
- // Not needed on <= IE11
- if (!IE11OrLess) {
- do {
- if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
- var containerRect = container.getBoundingClientRect(); // Set relative to edges of padding box of container
- top -= containerRect.top + parseInt(css(container, 'border-top-width'));
- left -= containerRect.left + parseInt(css(container, 'border-left-width'));
- bottom = top + elRect.height;
- right = left + elRect.width;
- break;
- }
- /* jshint boss:true */
- } while (container = container.parentNode);
- }
- }
- if (undoScale && el !== window) {
- // Adjust for scale()
- var elMatrix = matrix(container || el),
- scaleX = elMatrix && elMatrix.a,
- scaleY = elMatrix && elMatrix.d;
- if (elMatrix) {
- top /= scaleY;
- left /= scaleX;
- width /= scaleX;
- height /= scaleY;
- bottom = top + height;
- right = left + width;
- }
- }
- return {
- top: top,
- left: left,
- bottom: bottom,
- right: right,
- width: width,
- height: height
- };
- }
- /**
- * Checks if a side of an element is scrolled past a side of its parents
- * @param {HTMLElement} el The element who's side being scrolled out of view is in question
- * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
- * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
- * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
- */
- function isScrolledPast(el, elSide, parentSide) {
- var parent = getParentAutoScrollElement(el, true),
- elSideVal = getRect(el)[elSide];
- /* jshint boss:true */
- while (parent) {
- var parentSideVal = getRect(parent)[parentSide],
- visible = void 0;
- if (parentSide === 'top' || parentSide === 'left') {
- visible = elSideVal >= parentSideVal;
- } else {
- visible = elSideVal <= parentSideVal;
- }
- if (!visible) return parent;
- if (parent === getWindowScrollingElement()) break;
- parent = getParentAutoScrollElement(parent, false);
- }
- return false;
- }
- /**
- * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
- * and non-draggable elements
- * @param {HTMLElement} el The parent element
- * @param {Number} childNum The index of the child
- * @param {Object} options Parent Sortable's options
- * @return {HTMLElement} The child at index childNum, or null if not found
- */
- function getChild(el, childNum, options, includeDragEl) {
- var currentChild = 0,
- i = 0,
- children = el.children;
- while (i < children.length) {
- if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
- if (currentChild === childNum) {
- return children[i];
- }
- currentChild++;
- }
- i++;
- }
- return null;
- }
- /**
- * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
- * @param {HTMLElement} el Parent element
- * @param {selector} selector Any other elements that should be ignored
- * @return {HTMLElement} The last child, ignoring ghostEl
- */
- function lastChild(el, selector) {
- var last = el.lastElementChild;
- while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
- last = last.previousElementSibling;
- }
- return last || null;
- }
- /**
- * Returns the index of an element within its parent for a selected set of
- * elements
- * @param {HTMLElement} el
- * @param {selector} selector
- * @return {number}
- */
- function index(el, selector) {
- var index = 0;
- if (!el || !el.parentNode) {
- return -1;
- }
- /* jshint boss:true */
- while (el = el.previousElementSibling) {
- if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
- index++;
- }
- }
- return index;
- }
- /**
- * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
- * The value is returned in real pixels.
- * @param {HTMLElement} el
- * @return {Array} Offsets in the format of [left, top]
- */
- function getRelativeScrollOffset(el) {
- var offsetLeft = 0,
- offsetTop = 0,
- winScroller = getWindowScrollingElement();
- if (el) {
- do {
- var elMatrix = matrix(el),
- scaleX = elMatrix.a,
- scaleY = elMatrix.d;
- offsetLeft += el.scrollLeft * scaleX;
- offsetTop += el.scrollTop * scaleY;
- } while (el !== winScroller && (el = el.parentNode));
- }
- return [offsetLeft, offsetTop];
- }
- /**
- * Returns the index of the object within the given array
- * @param {Array} arr Array that may or may not hold the object
- * @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
- * @return {Number} The index of the object in the array, or -1
- */
- function indexOfObject(arr, obj) {
- for (var i in arr) {
- if (!arr.hasOwnProperty(i)) continue;
- for (var key in obj) {
- if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
- }
- }
- return -1;
- }
- function getParentAutoScrollElement(el, includeSelf) {
- // skip to window
- if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
- var elem = el;
- var gotSelf = false;
- do {
- // we don't need to get elem css if it isn't even overflowing in the first place (performance)
- if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
- var elemCSS = css(elem);
- if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
- if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
- if (gotSelf || includeSelf) return elem;
- gotSelf = true;
- }
- }
- /* jshint boss:true */
- } while (elem = elem.parentNode);
- return getWindowScrollingElement();
- }
- function extend(dst, src) {
- if (dst && src) {
- for (var key in src) {
- if (src.hasOwnProperty(key)) {
- dst[key] = src[key];
- }
- }
- }
- return dst;
- }
- function isRectEqual(rect1, rect2) {
- 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);
- }
- var _throttleTimeout;
- function throttle(callback, ms) {
- return function () {
- if (!_throttleTimeout) {
- var args = arguments,
- _this = this;
- if (args.length === 1) {
- callback.call(_this, args[0]);
- } else {
- callback.apply(_this, args);
- }
- _throttleTimeout = setTimeout(function () {
- _throttleTimeout = void 0;
- }, ms);
- }
- };
- }
- function cancelThrottle() {
- clearTimeout(_throttleTimeout);
- _throttleTimeout = void 0;
- }
- function scrollBy(el, x, y) {
- el.scrollLeft += x;
- el.scrollTop += y;
- }
- function clone(el) {
- var Polymer = window.Polymer;
- var $ = window.jQuery || window.Zepto;
- if (Polymer && Polymer.dom) {
- return Polymer.dom(el).cloneNode(true);
- } else if ($) {
- return $(el).clone(true)[0];
- } else {
- return el.cloneNode(true);
- }
- }
- var expando = 'Sortable' + new Date().getTime();
- function AnimationStateManager() {
- var animationStates = [],
- animationCallbackId;
- return {
- captureAnimationState: function captureAnimationState() {
- animationStates = [];
- if (!this.options.animation) return;
- var children = [].slice.call(this.el.children);
- children.forEach(function (child) {
- if (css(child, 'display') === 'none' || child === Sortable.ghost) return;
- animationStates.push({
- target: child,
- rect: getRect(child)
- });
- var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect); // If animating: compensate for current animation
- if (child.thisAnimationDuration) {
- var childMatrix = matrix(child, true);
- if (childMatrix) {
- fromRect.top -= childMatrix.f;
- fromRect.left -= childMatrix.e;
- }
- }
- child.fromRect = fromRect;
- });
- },
- addAnimationState: function addAnimationState(state) {
- animationStates.push(state);
- },
- removeAnimationState: function removeAnimationState(target) {
- animationStates.splice(indexOfObject(animationStates, {
- target: target
- }), 1);
- },
- animateAll: function animateAll(callback) {
- var _this = this;
- if (!this.options.animation) {
- clearTimeout(animationCallbackId);
- if (typeof callback === 'function') callback();
- return;
- }
- var animating = false,
- animationTime = 0;
- animationStates.forEach(function (state) {
- var time = 0,
- target = state.target,
- fromRect = target.fromRect,
- toRect = getRect(target),
- prevFromRect = target.prevFromRect,
- prevToRect = target.prevToRect,
- animatingRect = state.rect,
- targetMatrix = matrix(target, true);
- if (targetMatrix) {
- // Compensate for current animation
- toRect.top -= targetMatrix.f;
- toRect.left -= targetMatrix.e;
- }
- target.toRect = toRect;
- if (target.thisAnimationDuration) {
- // Could also check if animatingRect is between fromRect and toRect
- if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect
- (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
- // If returning to same place as started from animation and on same axis
- time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
- }
- } // if fromRect != toRect: animate
- if (!isRectEqual(toRect, fromRect)) {
- target.prevFromRect = fromRect;
- target.prevToRect = toRect;
- if (!time) {
- time = _this.options.animation;
- }
- _this.animate(target, animatingRect, toRect, time);
- }
- if (time) {
- animating = true;
- animationTime = Math.max(animationTime, time);
- clearTimeout(target.animationResetTimer);
- target.animationResetTimer = setTimeout(function () {
- target.animationTime = 0;
- target.prevFromRect = null;
- target.fromRect = null;
- target.prevToRect = null;
- target.thisAnimationDuration = null;
- }, time);
- target.thisAnimationDuration = time;
- }
- });
- clearTimeout(animationCallbackId);
- if (!animating) {
- if (typeof callback === 'function') callback();
- } else {
- animationCallbackId = setTimeout(function () {
- if (typeof callback === 'function') callback();
- }, animationTime);
- }
- animationStates = [];
- },
- animate: function animate(target, currentRect, toRect, duration) {
- if (duration) {
- css(target, 'transition', '');
- css(target, 'transform', '');
- var elMatrix = matrix(this.el),
- scaleX = elMatrix && elMatrix.a,
- scaleY = elMatrix && elMatrix.d,
- translateX = (currentRect.left - toRect.left) / (scaleX || 1),
- translateY = (currentRect.top - toRect.top) / (scaleY || 1);
- target.animatingX = !!translateX;
- target.animatingY = !!translateY;
- css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
- this.forRepaintDummy = repaint(target); // repaint
- css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
- css(target, 'transform', 'translate3d(0,0,0)');
- typeof target.animated === 'number' && clearTimeout(target.animated);
- target.animated = setTimeout(function () {
- css(target, 'transition', '');
- css(target, 'transform', '');
- target.animated = false;
- target.animatingX = false;
- target.animatingY = false;
- }, duration);
- }
- }
- };
- }
- function repaint(target) {
- return target.offsetWidth;
- }
- function calculateRealTime(animatingRect, fromRect, toRect, options) {
- 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;
- }
- var plugins = [];
- var defaults = {
- initializeByDefault: true
- };
- var PluginManager = {
- mount: function mount(plugin) {
- // Set default static properties
- for (var option in defaults) {
- if (defaults.hasOwnProperty(option) && !(option in plugin)) {
- plugin[option] = defaults[option];
- }
- }
- plugins.forEach(function (p) {
- if (p.pluginName === plugin.pluginName) {
- throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
- }
- });
- plugins.push(plugin);
- },
- pluginEvent: function pluginEvent(eventName, sortable, evt) {
- var _this = this;
- this.eventCanceled = false;
- evt.cancel = function () {
- _this.eventCanceled = true;
- };
- var eventNameGlobal = eventName + 'Global';
- plugins.forEach(function (plugin) {
- if (!sortable[plugin.pluginName]) return; // Fire global events if it exists in this sortable
- if (sortable[plugin.pluginName][eventNameGlobal]) {
- sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
- sortable: sortable
- }, evt));
- } // Only fire plugin event if plugin is enabled in this sortable,
- // and plugin has event defined
- if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
- sortable[plugin.pluginName][eventName](_objectSpread2({
- sortable: sortable
- }, evt));
- }
- });
- },
- initializePlugins: function initializePlugins(sortable, el, defaults, options) {
- plugins.forEach(function (plugin) {
- var pluginName = plugin.pluginName;
- if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
- var initialized = new plugin(sortable, el, sortable.options);
- initialized.sortable = sortable;
- initialized.options = sortable.options;
- sortable[pluginName] = initialized; // Add default options from plugin
- _extends(defaults, initialized.defaults);
- });
- for (var option in sortable.options) {
- if (!sortable.options.hasOwnProperty(option)) continue;
- var modified = this.modifyOption(sortable, option, sortable.options[option]);
- if (typeof modified !== 'undefined') {
- sortable.options[option] = modified;
- }
- }
- },
- getEventProperties: function getEventProperties(name, sortable) {
- var eventProperties = {};
- plugins.forEach(function (plugin) {
- if (typeof plugin.eventProperties !== 'function') return;
- _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
- });
- return eventProperties;
- },
- modifyOption: function modifyOption(sortable, name, value) {
- var modifiedValue;
- plugins.forEach(function (plugin) {
- // Plugin must exist on the Sortable
- 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
- if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
- modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
- }
- });
- return modifiedValue;
- }
- };
- function dispatchEvent(_ref) {
- var sortable = _ref.sortable,
- rootEl = _ref.rootEl,
- name = _ref.name,
- targetEl = _ref.targetEl,
- cloneEl = _ref.cloneEl,
- toEl = _ref.toEl,
- fromEl = _ref.fromEl,
- oldIndex = _ref.oldIndex,
- newIndex = _ref.newIndex,
- oldDraggableIndex = _ref.oldDraggableIndex,
- newDraggableIndex = _ref.newDraggableIndex,
- originalEvent = _ref.originalEvent,
- putSortable = _ref.putSortable,
- extraEventProperties = _ref.extraEventProperties;
- sortable = sortable || rootEl && rootEl[expando];
- if (!sortable) return;
- var evt,
- options = sortable.options,
- onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1); // Support for new CustomEvent feature
- if (window.CustomEvent && !IE11OrLess && !Edge) {
- evt = new CustomEvent(name, {
- bubbles: true,
- cancelable: true
- });
- } else {
- evt = document.createEvent('Event');
- evt.initEvent(name, true, true);
- }
- evt.to = toEl || rootEl;
- evt.from = fromEl || rootEl;
- evt.item = targetEl || rootEl;
- evt.clone = cloneEl;
- evt.oldIndex = oldIndex;
- evt.newIndex = newIndex;
- evt.oldDraggableIndex = oldDraggableIndex;
- evt.newDraggableIndex = newDraggableIndex;
- evt.originalEvent = originalEvent;
- evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
- var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
- for (var option in allEventProperties) {
- evt[option] = allEventProperties[option];
- }
- if (rootEl) {
- rootEl.dispatchEvent(evt);
- }
- if (options[onName]) {
- options[onName].call(sortable, evt);
- }
- }
- var _excluded = ["evt"];
- var pluginEvent = function pluginEvent(eventName, sortable) {
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
- originalEvent = _ref.evt,
- data = _objectWithoutProperties(_ref, _excluded);
- PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
- dragEl: dragEl,
- parentEl: parentEl,
- ghostEl: ghostEl,
- rootEl: rootEl,
- nextEl: nextEl,
- lastDownEl: lastDownEl,
- cloneEl: cloneEl,
- cloneHidden: cloneHidden,
- dragStarted: moved,
- putSortable: putSortable,
- activeSortable: Sortable.active,
- originalEvent: originalEvent,
- oldIndex: oldIndex,
- oldDraggableIndex: oldDraggableIndex,
- newIndex: newIndex,
- newDraggableIndex: newDraggableIndex,
- hideGhostForTarget: _hideGhostForTarget,
- unhideGhostForTarget: _unhideGhostForTarget,
- cloneNowHidden: function cloneNowHidden() {
- cloneHidden = true;
- },
- cloneNowShown: function cloneNowShown() {
- cloneHidden = false;
- },
- dispatchSortableEvent: function dispatchSortableEvent(name) {
- _dispatchEvent({
- sortable: sortable,
- name: name,
- originalEvent: originalEvent
- });
- }
- }, data));
- };
- function _dispatchEvent(info) {
- dispatchEvent(_objectSpread2({
- putSortable: putSortable,
- cloneEl: cloneEl,
- targetEl: dragEl,
- rootEl: rootEl,
- oldIndex: oldIndex,
- oldDraggableIndex: oldDraggableIndex,
- newIndex: newIndex,
- newDraggableIndex: newDraggableIndex
- }, info));
- }
- var dragEl,
- parentEl,
- ghostEl,
- rootEl,
- nextEl,
- lastDownEl,
- cloneEl,
- cloneHidden,
- oldIndex,
- newIndex,
- oldDraggableIndex,
- newDraggableIndex,
- activeGroup,
- putSortable,
- awaitingDragStarted = false,
- ignoreNextClick = false,
- sortables = [],
- tapEvt,
- touchEvt,
- lastDx,
- lastDy,
- tapDistanceLeft,
- tapDistanceTop,
- moved,
- lastTarget,
- lastDirection,
- pastFirstInvertThresh = false,
- isCircumstantialInvert = false,
- targetMoveDistance,
- // For positioning ghost absolutely
- ghostRelativeParent,
- ghostRelativeParentInitialScroll = [],
- // (left, top)
- _silent = false,
- savedInputChecked = [];
- /** @const */
- var documentExists = typeof document !== 'undefined',
- PositionGhostAbsolutely = IOS,
- CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
- // This will not pass for IE9, because IE9 DnD only works on anchors
- supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
- supportCssPointerEvents = function () {
- if (!documentExists) return; // false when <= IE11
- if (IE11OrLess) {
- return false;
- }
- var el = document.createElement('x');
- el.style.cssText = 'pointer-events:auto';
- return el.style.pointerEvents === 'auto';
- }(),
- _detectDirection = function _detectDirection(el, options) {
- var elCSS = css(el),
- elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
- child1 = getChild(el, 0, options),
- child2 = getChild(el, 1, options),
- firstChildCSS = child1 && css(child1),
- secondChildCSS = child2 && css(child2),
- firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,
- secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
- if (elCSS.display === 'flex') {
- return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
- }
- if (elCSS.display === 'grid') {
- return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
- }
- if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
- var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
- return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
- }
- 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';
- },
- _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
- var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
- dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
- dragElOppLength = vertical ? dragRect.width : dragRect.height,
- targetS1Opp = vertical ? targetRect.left : targetRect.top,
- targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
- targetOppLength = vertical ? targetRect.width : targetRect.height;
- return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
- },
- /**
- * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
- * @param {Number} x X position
- * @param {Number} y Y position
- * @return {HTMLElement} Element of the first found nearest Sortable
- */
- _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
- var ret;
- sortables.some(function (sortable) {
- var threshold = sortable[expando].options.emptyInsertThreshold;
- if (!threshold || lastChild(sortable)) return;
- var rect = getRect(sortable),
- insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
- insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
- if (insideHorizontally && insideVertically) {
- return ret = sortable;
- }
- });
- return ret;
- },
- _prepareGroup = function _prepareGroup(options) {
- function toFn(value, pull) {
- return function (to, from, dragEl, evt) {
- var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
- if (value == null && (pull || sameGroup)) {
- // Default pull value
- // Default pull and put value if same group
- return true;
- } else if (value == null || value === false) {
- return false;
- } else if (pull && value === 'clone') {
- return value;
- } else if (typeof value === 'function') {
- return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
- } else {
- var otherGroup = (pull ? to : from).options.group.name;
- return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
- }
- };
- }
- var group = {};
- var originalGroup = options.group;
- if (!originalGroup || _typeof(originalGroup) != 'object') {
- originalGroup = {
- name: originalGroup
- };
- }
- group.name = originalGroup.name;
- group.checkPull = toFn(originalGroup.pull, true);
- group.checkPut = toFn(originalGroup.put);
- group.revertClone = originalGroup.revertClone;
- options.group = group;
- },
- _hideGhostForTarget = function _hideGhostForTarget() {
- if (!supportCssPointerEvents && ghostEl) {
- css(ghostEl, 'display', 'none');
- }
- },
- _unhideGhostForTarget = function _unhideGhostForTarget() {
- if (!supportCssPointerEvents && ghostEl) {
- css(ghostEl, 'display', '');
- }
- }; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
- if (documentExists && !ChromeForAndroid) {
- document.addEventListener('click', function (evt) {
- if (ignoreNextClick) {
- evt.preventDefault();
- evt.stopPropagation && evt.stopPropagation();
- evt.stopImmediatePropagation && evt.stopImmediatePropagation();
- ignoreNextClick = false;
- return false;
- }
- }, true);
- }
- var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
- if (dragEl) {
- evt = evt.touches ? evt.touches[0] : evt;
- var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
- if (nearest) {
- // Create imitation event
- var event = {};
- for (var i in evt) {
- if (evt.hasOwnProperty(i)) {
- event[i] = evt[i];
- }
- }
- event.target = event.rootEl = nearest;
- event.preventDefault = void 0;
- event.stopPropagation = void 0;
- nearest[expando]._onDragOver(event);
- }
- }
- };
- var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
- if (dragEl) {
- dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
- }
- };
- /**
- * @class Sortable
- * @param {HTMLElement} el
- * @param {Object} [options]
- */
- function Sortable(el, options) {
- if (!(el && el.nodeType && el.nodeType === 1)) {
- throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
- }
- this.el = el; // root element
- this.options = options = _extends({}, options); // Export instance
- el[expando] = this;
- var defaults = {
- group: null,
- sort: true,
- disabled: false,
- store: null,
- handle: null,
- draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',
- swapThreshold: 1,
- // percentage; 0 <= x <= 1
- invertSwap: false,
- // invert always
- invertedSwapThreshold: null,
- // will be set to same as swapThreshold if default
- removeCloneOnHide: true,
- direction: function direction() {
- return _detectDirection(el, this.options);
- },
- ghostClass: 'sortable-ghost',
- chosenClass: 'sortable-chosen',
- dragClass: 'sortable-drag',
- ignore: 'a, img',
- filter: null,
- preventOnFilter: true,
- animation: 0,
- easing: null,
- setData: function setData(dataTransfer, dragEl) {
- dataTransfer.setData('Text', dragEl.textContent);
- },
- dropBubble: false,
- dragoverBubble: false,
- dataIdAttr: 'data-id',
- delay: 0,
- delayOnTouchOnly: false,
- touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
- forceFallback: false,
- fallbackClass: 'sortable-fallback',
- fallbackOnBody: false,
- fallbackTolerance: 0,
- fallbackOffset: {
- x: 0,
- y: 0
- },
- supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
- emptyInsertThreshold: 5
- };
- PluginManager.initializePlugins(this, el, defaults); // Set default options
- for (var name in defaults) {
- !(name in options) && (options[name] = defaults[name]);
- }
- _prepareGroup(options); // Bind all private methods
- for (var fn in this) {
- if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
- this[fn] = this[fn].bind(this);
- }
- } // Setup drag mode
- this.nativeDraggable = options.forceFallback ? false : supportDraggable;
- if (this.nativeDraggable) {
- // Touch start threshold cannot be greater than the native dragstart threshold
- this.options.touchStartThreshold = 1;
- } // Bind events
- if (options.supportPointer) {
- on(el, 'pointerdown', this._onTapStart);
- } else {
- on(el, 'mousedown', this._onTapStart);
- on(el, 'touchstart', this._onTapStart);
- }
- if (this.nativeDraggable) {
- on(el, 'dragover', this);
- on(el, 'dragenter', this);
- }
- sortables.push(this.el); // Restore sorting
- options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager
- _extends(this, AnimationStateManager());
- }
- Sortable.prototype =
- /** @lends Sortable.prototype */
- {
- constructor: Sortable,
- _isOutsideThisEl: function _isOutsideThisEl(target) {
- if (!this.el.contains(target) && target !== this.el) {
- lastTarget = null;
- }
- },
- _getDirection: function _getDirection(evt, target) {
- return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
- },
- _onTapStart: function _onTapStart(
- /** Event|TouchEvent */
- evt) {
- if (!evt.cancelable) return;
- var _this = this,
- el = this.el,
- options = this.options,
- preventOnFilter = options.preventOnFilter,
- type = evt.type,
- touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
- target = (touch || evt).target,
- originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
- filter = options.filter;
- _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
- if (dragEl) {
- return;
- }
- if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
- return; // only left button and enabled
- } // cancel dnd if original target is content editable
- if (originalTarget.isContentEditable) {
- return;
- } // Safari ignores further event handling after mousedown
- if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
- return;
- }
- target = closest(target, options.draggable, el, false);
- if (target && target.animated) {
- return;
- }
- if (lastDownEl === target) {
- // Ignoring duplicate `down`
- return;
- } // Get the index of the dragged element within its parent
- oldIndex = index(target);
- oldDraggableIndex = index(target, options.draggable); // Check filter
- if (typeof filter === 'function') {
- if (filter.call(this, evt, target, this)) {
- _dispatchEvent({
- sortable: _this,
- rootEl: originalTarget,
- name: 'filter',
- targetEl: target,
- toEl: el,
- fromEl: el
- });
- pluginEvent('filter', _this, {
- evt: evt
- });
- preventOnFilter && evt.cancelable && evt.preventDefault();
- return; // cancel dnd
- }
- } else if (filter) {
- filter = filter.split(',').some(function (criteria) {
- criteria = closest(originalTarget, criteria.trim(), el, false);
- if (criteria) {
- _dispatchEvent({
- sortable: _this,
- rootEl: criteria,
- name: 'filter',
- targetEl: target,
- fromEl: el,
- toEl: el
- });
- pluginEvent('filter', _this, {
- evt: evt
- });
- return true;
- }
- });
- if (filter) {
- preventOnFilter && evt.cancelable && evt.preventDefault();
- return; // cancel dnd
- }
- }
- if (options.handle && !closest(originalTarget, options.handle, el, false)) {
- return;
- } // Prepare `dragstart`
- this._prepareDragStart(evt, touch, target);
- },
- _prepareDragStart: function _prepareDragStart(
- /** Event */
- evt,
- /** Touch */
- touch,
- /** HTMLElement */
- target) {
- var _this = this,
- el = _this.el,
- options = _this.options,
- ownerDocument = el.ownerDocument,
- dragStartFn;
- if (target && !dragEl && target.parentNode === el) {
- var dragRect = getRect(target);
- rootEl = el;
- dragEl = target;
- parentEl = dragEl.parentNode;
- nextEl = dragEl.nextSibling;
- lastDownEl = target;
- activeGroup = options.group;
- Sortable.dragged = dragEl;
- tapEvt = {
- target: dragEl,
- clientX: (touch || evt).clientX,
- clientY: (touch || evt).clientY
- };
- tapDistanceLeft = tapEvt.clientX - dragRect.left;
- tapDistanceTop = tapEvt.clientY - dragRect.top;
- this._lastX = (touch || evt).clientX;
- this._lastY = (touch || evt).clientY;
- dragEl.style['will-change'] = 'all';
- dragStartFn = function dragStartFn() {
- pluginEvent('delayEnded', _this, {
- evt: evt
- });
- if (Sortable.eventCanceled) {
- _this._onDrop();
- return;
- } // Delayed drag has been triggered
- // we can re-enable the events: touchmove/mousemove
- _this._disableDelayedDragEvents();
- if (!FireFox && _this.nativeDraggable) {
- dragEl.draggable = true;
- } // Bind the events: dragstart/dragend
- _this._triggerDragStart(evt, touch); // Drag start event
- _dispatchEvent({
- sortable: _this,
- name: 'choose',
- originalEvent: evt
- }); // Chosen item
- toggleClass(dragEl, options.chosenClass, true);
- }; // Disable "draggable"
- options.ignore.split(',').forEach(function (criteria) {
- find(dragEl, criteria.trim(), _disableDraggable);
- });
- on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
- on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
- on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
- on(ownerDocument, 'mouseup', _this._onDrop);
- on(ownerDocument, 'touchend', _this._onDrop);
- on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)
- if (FireFox && this.nativeDraggable) {
- this.options.touchStartThreshold = 4;
- dragEl.draggable = true;
- }
- pluginEvent('delayStart', this, {
- evt: evt
- }); // Delay is impossible for native DnD in Edge or IE
- if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
- if (Sortable.eventCanceled) {
- this._onDrop();
- return;
- } // If the user moves the pointer or let go the click or touch
- // before the delay has been reached:
- // disable the delayed drag
- on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
- on(ownerDocument, 'touchend', _this._disableDelayedDrag);
- on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
- on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
- on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
- options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
- _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
- } else {
- dragStartFn();
- }
- }
- },
- _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(
- /** TouchEvent|PointerEvent **/
- e) {
- var touch = e.touches ? e.touches[0] : e;
- 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))) {
- this._disableDelayedDrag();
- }
- },
- _disableDelayedDrag: function _disableDelayedDrag() {
- dragEl && _disableDraggable(dragEl);
- clearTimeout(this._dragStartTimer);
- this._disableDelayedDragEvents();
- },
- _disableDelayedDragEvents: function _disableDelayedDragEvents() {
- var ownerDocument = this.el.ownerDocument;
- off(ownerDocument, 'mouseup', this._disableDelayedDrag);
- off(ownerDocument, 'touchend', this._disableDelayedDrag);
- off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
- off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
- off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
- off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
- },
- _triggerDragStart: function _triggerDragStart(
- /** Event */
- evt,
- /** Touch */
- touch) {
- touch = touch || evt.pointerType == 'touch' && evt;
- if (!this.nativeDraggable || touch) {
- if (this.options.supportPointer) {
- on(document, 'pointermove', this._onTouchMove);
- } else if (touch) {
- on(document, 'touchmove', this._onTouchMove);
- } else {
- on(document, 'mousemove', this._onTouchMove);
- }
- } else {
- on(dragEl, 'dragend', this);
- on(rootEl, 'dragstart', this._onDragStart);
- }
- try {
- if (document.selection) {
- // Timeout neccessary for IE9
- _nextTick(function () {
- document.selection.empty();
- });
- } else {
- window.getSelection().removeAllRanges();
- }
- } catch (err) {}
- },
- _dragStarted: function _dragStarted(fallback, evt) {
- awaitingDragStarted = false;
- if (rootEl && dragEl) {
- pluginEvent('dragStarted', this, {
- evt: evt
- });
- if (this.nativeDraggable) {
- on(document, 'dragover', _checkOutsideTargetEl);
- }
- var options = this.options; // Apply effect
- !fallback && toggleClass(dragEl, options.dragClass, false);
- toggleClass(dragEl, options.ghostClass, true);
- Sortable.active = this;
- fallback && this._appendGhost(); // Drag start event
- _dispatchEvent({
- sortable: this,
- name: 'start',
- originalEvent: evt
- });
- } else {
- this._nulling();
- }
- },
- _emulateDragOver: function _emulateDragOver() {
- if (touchEvt) {
- this._lastX = touchEvt.clientX;
- this._lastY = touchEvt.clientY;
- _hideGhostForTarget();
- var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
- var parent = target;
- while (target && target.shadowRoot) {
- target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
- if (target === parent) break;
- parent = target;
- }
- dragEl.parentNode[expando]._isOutsideThisEl(target);
- if (parent) {
- do {
- if (parent[expando]) {
- var inserted = void 0;
- inserted = parent[expando]._onDragOver({
- clientX: touchEvt.clientX,
- clientY: touchEvt.clientY,
- target: target,
- rootEl: parent
- });
- if (inserted && !this.options.dragoverBubble) {
- break;
- }
- }
- target = parent; // store last element
- }
- /* jshint boss:true */
- while (parent = parent.parentNode);
- }
- _unhideGhostForTarget();
- }
- },
- _onTouchMove: function _onTouchMove(
- /**TouchEvent*/
- evt) {
- if (tapEvt) {
- var options = this.options,
- fallbackTolerance = options.fallbackTolerance,
- fallbackOffset = options.fallbackOffset,
- touch = evt.touches ? evt.touches[0] : evt,
- ghostMatrix = ghostEl && matrix(ghostEl, true),
- scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
- scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
- relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
- dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
- 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
- if (!Sortable.active && !awaitingDragStarted) {
- if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
- return;
- }
- this._onDragStart(evt, true);
- }
- if (ghostEl) {
- if (ghostMatrix) {
- ghostMatrix.e += dx - (lastDx || 0);
- ghostMatrix.f += dy - (lastDy || 0);
- } else {
- ghostMatrix = {
- a: 1,
- b: 0,
- c: 0,
- d: 1,
- e: dx,
- f: dy
- };
- }
- var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
- css(ghostEl, 'webkitTransform', cssMatrix);
- css(ghostEl, 'mozTransform', cssMatrix);
- css(ghostEl, 'msTransform', cssMatrix);
- css(ghostEl, 'transform', cssMatrix);
- lastDx = dx;
- lastDy = dy;
- touchEvt = touch;
- }
- evt.cancelable && evt.preventDefault();
- }
- },
- _appendGhost: function _appendGhost() {
- // Bug if using scale(): https://stackoverflow.com/questions/2637058
- // Not being adjusted for
- if (!ghostEl) {
- var container = this.options.fallbackOnBody ? document.body : rootEl,
- rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),
- options = this.options; // Position absolutely
- if (PositionGhostAbsolutely) {
- // Get relatively positioned parent
- ghostRelativeParent = container;
- while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
- ghostRelativeParent = ghostRelativeParent.parentNode;
- }
- if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
- if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
- rect.top += ghostRelativeParent.scrollTop;
- rect.left += ghostRelativeParent.scrollLeft;
- } else {
- ghostRelativeParent = getWindowScrollingElement();
- }
- ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
- }
- ghostEl = dragEl.cloneNode(true);
- toggleClass(ghostEl, options.ghostClass, false);
- toggleClass(ghostEl, options.fallbackClass, true);
- toggleClass(ghostEl, options.dragClass, true);
- css(ghostEl, 'transition', '');
- css(ghostEl, 'transform', '');
- css(ghostEl, 'box-sizing', 'border-box');
- css(ghostEl, 'margin', 0);
- css(ghostEl, 'top', rect.top);
- css(ghostEl, 'left', rect.left);
- css(ghostEl, 'width', rect.width);
- css(ghostEl, 'height', rect.height);
- css(ghostEl, 'opacity', '0.8');
- css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');
- css(ghostEl, 'zIndex', '100000');
- css(ghostEl, 'pointerEvents', 'none');
- Sortable.ghost = ghostEl;
- container.appendChild(ghostEl); // Set transform-origin
- css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
- }
- },
- _onDragStart: function _onDragStart(
- /**Event*/
- evt,
- /**boolean*/
- fallback) {
- var _this = this;
- var dataTransfer = evt.dataTransfer;
- var options = _this.options;
- pluginEvent('dragStart', this, {
- evt: evt
- });
- if (Sortable.eventCanceled) {
- this._onDrop();
- return;
- }
- pluginEvent('setupClone', this);
- if (!Sortable.eventCanceled) {
- cloneEl = clone(dragEl);
- cloneEl.removeAttribute("id");
- cloneEl.draggable = false;
- cloneEl.style['will-change'] = '';
- this._hideClone();
- toggleClass(cloneEl, this.options.chosenClass, false);
- Sortable.clone = cloneEl;
- } // #1143: IFrame support workaround
- _this.cloneId = _nextTick(function () {
- pluginEvent('clone', _this);
- if (Sortable.eventCanceled) return;
- if (!_this.options.removeCloneOnHide) {
- rootEl.insertBefore(cloneEl, dragEl);
- }
- _this._hideClone();
- _dispatchEvent({
- sortable: _this,
- name: 'clone'
- });
- });
- !fallback && toggleClass(dragEl, options.dragClass, true); // Set proper drop events
- if (fallback) {
- ignoreNextClick = true;
- _this._loopId = setInterval(_this._emulateDragOver, 50);
- } else {
- // Undo what was set in _prepareDragStart before drag started
- off(document, 'mouseup', _this._onDrop);
- off(document, 'touchend', _this._onDrop);
- off(document, 'touchcancel', _this._onDrop);
- if (dataTransfer) {
- dataTransfer.effectAllowed = 'move';
- options.setData && options.setData.call(_this, dataTransfer, dragEl);
- }
- on(document, 'drop', _this); // #1276 fix:
- css(dragEl, 'transform', 'translateZ(0)');
- }
- awaitingDragStarted = true;
- _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
- on(document, 'selectstart', _this);
- moved = true;
- if (Safari) {
- css(document.body, 'user-select', 'none');
- }
- },
- // Returns true - if no further action is needed (either inserted or another condition)
- _onDragOver: function _onDragOver(
- /**Event*/
- evt) {
- var el = this.el,
- target = evt.target,
- dragRect,
- targetRect,
- revert,
- options = this.options,
- group = options.group,
- activeSortable = Sortable.active,
- isOwner = activeGroup === group,
- canSort = options.sort,
- fromSortable = putSortable || activeSortable,
- vertical,
- _this = this,
- completedFired = false;
- if (_silent) return;
- function dragOverEvent(name, extra) {
- pluginEvent(name, _this, _objectSpread2({
- evt: evt,
- isOwner: isOwner,
- axis: vertical ? 'vertical' : 'horizontal',
- revert: revert,
- dragRect: dragRect,
- targetRect: targetRect,
- canSort: canSort,
- fromSortable: fromSortable,
- target: target,
- completed: completed,
- onMove: function onMove(target, after) {
- return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);
- },
- changed: changed
- }, extra));
- } // Capture animation state
- function capture() {
- dragOverEvent('dragOverAnimationCapture');
- _this.captureAnimationState();
- if (_this !== fromSortable) {
- fromSortable.captureAnimationState();
- }
- } // Return invocation when dragEl is inserted (or completed)
- function completed(insertion) {
- dragOverEvent('dragOverCompleted', {
- insertion: insertion
- });
- if (insertion) {
- // Clones must be hidden before folding animation to capture dragRectAbsolute properly
- if (isOwner) {
- activeSortable._hideClone();
- } else {
- activeSortable._showClone(_this);
- }
- if (_this !== fromSortable) {
- // Set ghost class to new sortable's ghost class
- toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
- toggleClass(dragEl, options.ghostClass, true);
- }
- if (putSortable !== _this && _this !== Sortable.active) {
- putSortable = _this;
- } else if (_this === Sortable.active && putSortable) {
- putSortable = null;
- } // Animation
- if (fromSortable === _this) {
- _this._ignoreWhileAnimating = target;
- }
- _this.animateAll(function () {
- dragOverEvent('dragOverAnimationComplete');
- _this._ignoreWhileAnimating = null;
- });
- if (_this !== fromSortable) {
- fromSortable.animateAll();
- fromSortable._ignoreWhileAnimating = null;
- }
- } // Null lastTarget if it is not inside a previously swapped element
- if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
- lastTarget = null;
- } // no bubbling and not fallback
- if (!options.dragoverBubble && !evt.rootEl && target !== document) {
- dragEl.parentNode[expando]._isOutsideThisEl(evt.target); // Do not detect for empty insert if already inserted
- !insertion && nearestEmptyInsertDetectEvent(evt);
- }
- !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
- return completedFired = true;
- } // Call when dragEl has been inserted
- function changed() {
- newIndex = index(dragEl);
- newDraggableIndex = index(dragEl, options.draggable);
- _dispatchEvent({
- sortable: _this,
- name: 'change',
- toEl: el,
- newIndex: newIndex,
- newDraggableIndex: newDraggableIndex,
- originalEvent: evt
- });
- }
- if (evt.preventDefault !== void 0) {
- evt.cancelable && evt.preventDefault();
- }
- target = closest(target, options.draggable, el, true);
- dragOverEvent('dragOver');
- if (Sortable.eventCanceled) return completedFired;
- if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
- return completed(false);
- }
- ignoreNextClick = false;
- if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
- : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
- vertical = this._getDirection(evt, target) === 'vertical';
- dragRect = getRect(dragEl);
- dragOverEvent('dragOverValid');
- if (Sortable.eventCanceled) return completedFired;
- if (revert) {
- parentEl = rootEl; // actualization
- capture();
- this._hideClone();
- dragOverEvent('revert');
- if (!Sortable.eventCanceled) {
- if (nextEl) {
- rootEl.insertBefore(dragEl, nextEl);
- } else {
- rootEl.appendChild(dragEl);
- }
- }
- return completed(true);
- }
- var elLastChild = lastChild(el, options.draggable);
- if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
- // Insert to end of list
- // If already at end of list: Do not insert
- if (elLastChild === dragEl) {
- return completed(false);
- } // if there is a last element, it is the target
- if (elLastChild && el === evt.target) {
- target = elLastChild;
- }
- if (target) {
- targetRect = getRect(target);
- }
- if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
- capture();
- if (elLastChild && elLastChild.nextSibling) {
- // the last draggable element is not the last node
- el.insertBefore(dragEl, elLastChild.nextSibling);
- } else {
- el.appendChild(dragEl);
- }
- parentEl = el; // actualization
- changed();
- return completed(true);
- }
- } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
- // Insert to start of list
- var firstChild = getChild(el, 0, options, true);
- if (firstChild === dragEl) {
- return completed(false);
- }
- target = firstChild;
- targetRect = getRect(target);
- if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
- capture();
- el.insertBefore(dragEl, firstChild);
- parentEl = el; // actualization
- changed();
- return completed(true);
- }
- } else if (target.parentNode === el) {
- targetRect = getRect(target);
- var direction = 0,
- targetBeforeFirstSwap,
- differentLevel = dragEl.parentNode !== el,
- differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
- side1 = vertical ? 'top' : 'left',
- scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
- scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
- if (lastTarget !== target) {
- targetBeforeFirstSwap = targetRect[side1];
- pastFirstInvertThresh = false;
- isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
- }
- direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
- var sibling;
- if (direction !== 0) {
- // Check if target is beside dragEl in respective direction (ignoring hidden elements)
- var dragIndex = index(dragEl);
- do {
- dragIndex -= direction;
- sibling = parentEl.children[dragIndex];
- } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
- } // If dragEl is already beside target: Do not insert
- if (direction === 0 || sibling === target) {
- return completed(false);
- }
- lastTarget = target;
- lastDirection = direction;
- var nextSibling = target.nextElementSibling,
- after = false;
- after = direction === 1;
- var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
- if (moveVector !== false) {
- if (moveVector === 1 || moveVector === -1) {
- after = moveVector === 1;
- }
- _silent = true;
- setTimeout(_unsilent, 30);
- capture();
- if (after && !nextSibling) {
- el.appendChild(dragEl);
- } else {
- target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
- } // Undo chrome's scroll adjustment (has no effect on other browsers)
- if (scrolledPastTop) {
- scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
- }
- parentEl = dragEl.parentNode; // actualization
- // must be done before animation
- if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
- targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
- }
- changed();
- return completed(true);
- }
- }
- if (el.contains(dragEl)) {
- return completed(false);
- }
- }
- return false;
- },
- _ignoreWhileAnimating: null,
- _offMoveEvents: function _offMoveEvents() {
- off(document, 'mousemove', this._onTouchMove);
- off(document, 'touchmove', this._onTouchMove);
- off(document, 'pointermove', this._onTouchMove);
- off(document, 'dragover', nearestEmptyInsertDetectEvent);
- off(document, 'mousemove', nearestEmptyInsertDetectEvent);
- off(document, 'touchmove', nearestEmptyInsertDetectEvent);
- },
- _offUpEvents: function _offUpEvents() {
- var ownerDocument = this.el.ownerDocument;
- off(ownerDocument, 'mouseup', this._onDrop);
- off(ownerDocument, 'touchend', this._onDrop);
- off(ownerDocument, 'pointerup', this._onDrop);
- off(ownerDocument, 'touchcancel', this._onDrop);
- off(document, 'selectstart', this);
- },
- _onDrop: function _onDrop(
- /**Event*/
- evt) {
- var el = this.el,
- options = this.options; // Get the index of the dragged element within its parent
- newIndex = index(dragEl);
- newDraggableIndex = index(dragEl, options.draggable);
- pluginEvent('drop', this, {
- evt: evt
- });
- parentEl = dragEl && dragEl.parentNode; // Get again after plugin event
- newIndex = index(dragEl);
- newDraggableIndex = index(dragEl, options.draggable);
- if (Sortable.eventCanceled) {
- this._nulling();
- return;
- }
- awaitingDragStarted = false;
- isCircumstantialInvert = false;
- pastFirstInvertThresh = false;
- clearInterval(this._loopId);
- clearTimeout(this._dragStartTimer);
- _cancelNextTick(this.cloneId);
- _cancelNextTick(this._dragStartId); // Unbind events
- if (this.nativeDraggable) {
- off(document, 'drop', this);
- off(el, 'dragstart', this._onDragStart);
- }
- this._offMoveEvents();
- this._offUpEvents();
- if (Safari) {
- css(document.body, 'user-select', '');
- }
- css(dragEl, 'transform', '');
- if (evt) {
- if (moved) {
- evt.cancelable && evt.preventDefault();
- !options.dropBubble && evt.stopPropagation();
- }
- ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
- if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
- // Remove clone(s)
- cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
- }
- if (dragEl) {
- if (this.nativeDraggable) {
- off(dragEl, 'dragend', this);
- }
- _disableDraggable(dragEl);
- dragEl.style['will-change'] = ''; // Remove classes
- // ghostClass is added in dragStarted
- if (moved && !awaitingDragStarted) {
- toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
- }
- toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event
- _dispatchEvent({
- sortable: this,
- name: 'unchoose',
- toEl: parentEl,
- newIndex: null,
- newDraggableIndex: null,
- originalEvent: evt
- });
- if (rootEl !== parentEl) {
- if (newIndex >= 0) {
- // Add event
- _dispatchEvent({
- rootEl: parentEl,
- name: 'add',
- toEl: parentEl,
- fromEl: rootEl,
- originalEvent: evt
- }); // Remove event
- _dispatchEvent({
- sortable: this,
- name: 'remove',
- toEl: parentEl,
- originalEvent: evt
- }); // drag from one list and drop into another
- _dispatchEvent({
- rootEl: parentEl,
- name: 'sort',
- toEl: parentEl,
- fromEl: rootEl,
- originalEvent: evt
- });
- _dispatchEvent({
- sortable: this,
- name: 'sort',
- toEl: parentEl,
- originalEvent: evt
- });
- }
- putSortable && putSortable.save();
- } else {
- if (newIndex !== oldIndex) {
- if (newIndex >= 0) {
- // drag & drop within the same list
- _dispatchEvent({
- sortable: this,
- name: 'update',
- toEl: parentEl,
- originalEvent: evt
- });
- _dispatchEvent({
- sortable: this,
- name: 'sort',
- toEl: parentEl,
- originalEvent: evt
- });
- }
- }
- }
- if (Sortable.active) {
- /* jshint eqnull:true */
- if (newIndex == null || newIndex === -1) {
- newIndex = oldIndex;
- newDraggableIndex = oldDraggableIndex;
- }
- _dispatchEvent({
- sortable: this,
- name: 'end',
- toEl: parentEl,
- originalEvent: evt
- }); // Save sorting
- this.save();
- }
- }
- }
- this._nulling();
- },
- _nulling: function _nulling() {
- pluginEvent('nulling', this);
- 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;
- savedInputChecked.forEach(function (el) {
- el.checked = true;
- });
- savedInputChecked.length = lastDx = lastDy = 0;
- },
- handleEvent: function handleEvent(
- /**Event*/
- evt) {
- switch (evt.type) {
- case 'drop':
- case 'dragend':
- this._onDrop(evt);
- break;
- case 'dragenter':
- case 'dragover':
- if (dragEl) {
- this._onDragOver(evt);
- _globalDragOver(evt);
- }
- break;
- case 'selectstart':
- evt.preventDefault();
- break;
- }
- },
- /**
- * Serializes the item into an array of string.
- * @returns {String[]}
- */
- toArray: function toArray() {
- var order = [],
- el,
- children = this.el.children,
- i = 0,
- n = children.length,
- options = this.options;
- for (; i < n; i++) {
- el = children[i];
- if (closest(el, options.draggable, this.el, false)) {
- order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
- }
- }
- return order;
- },
- /**
- * Sorts the elements according to the array.
- * @param {String[]} order order of the items
- */
- sort: function sort(order, useAnimation) {
- var items = {},
- rootEl = this.el;
- this.toArray().forEach(function (id, i) {
- var el = rootEl.children[i];
- if (closest(el, this.options.draggable, rootEl, false)) {
- items[id] = el;
- }
- }, this);
- useAnimation && this.captureAnimationState();
- order.forEach(function (id) {
- if (items[id]) {
- rootEl.removeChild(items[id]);
- rootEl.appendChild(items[id]);
- }
- });
- useAnimation && this.animateAll();
- },
- /**
- * Save the current sorting
- */
- save: function save() {
- var store = this.options.store;
- store && store.set && store.set(this);
- },
- /**
- * 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.
- * @param {HTMLElement} el
- * @param {String} [selector] default: `options.draggable`
- * @returns {HTMLElement|null}
- */
- closest: function closest$1(el, selector) {
- return closest(el, selector || this.options.draggable, this.el, false);
- },
- /**
- * Set/get option
- * @param {string} name
- * @param {*} [value]
- * @returns {*}
- */
- option: function option(name, value) {
- var options = this.options;
- if (value === void 0) {
- return options[name];
- } else {
- var modifiedValue = PluginManager.modifyOption(this, name, value);
- if (typeof modifiedValue !== 'undefined') {
- options[name] = modifiedValue;
- } else {
- options[name] = value;
- }
- if (name === 'group') {
- _prepareGroup(options);
- }
- }
- },
- /**
- * Destroy
- */
- destroy: function destroy() {
- pluginEvent('destroy', this);
- var el = this.el;
- el[expando] = null;
- off(el, 'mousedown', this._onTapStart);
- off(el, 'touchstart', this._onTapStart);
- off(el, 'pointerdown', this._onTapStart);
- if (this.nativeDraggable) {
- off(el, 'dragover', this);
- off(el, 'dragenter', this);
- } // Remove draggable attributes
- Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
- el.removeAttribute('draggable');
- });
- this._onDrop();
- this._disableDelayedDragEvents();
- sortables.splice(sortables.indexOf(this.el), 1);
- this.el = el = null;
- },
- _hideClone: function _hideClone() {
- if (!cloneHidden) {
- pluginEvent('hideClone', this);
- if (Sortable.eventCanceled) return;
- css(cloneEl, 'display', 'none');
- if (this.options.removeCloneOnHide && cloneEl.parentNode) {
- cloneEl.parentNode.removeChild(cloneEl);
- }
- cloneHidden = true;
- }
- },
- _showClone: function _showClone(putSortable) {
- if (putSortable.lastPutMode !== 'clone') {
- this._hideClone();
- return;
- }
- if (cloneHidden) {
- pluginEvent('showClone', this);
- if (Sortable.eventCanceled) return; // show clone at dragEl or original position
- if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
- rootEl.insertBefore(cloneEl, dragEl);
- } else if (nextEl) {
- rootEl.insertBefore(cloneEl, nextEl);
- } else {
- rootEl.appendChild(cloneEl);
- }
- if (this.options.group.revertClone) {
- this.animate(dragEl, cloneEl);
- }
- css(cloneEl, 'display', '');
- cloneHidden = false;
- }
- }
- };
- function _globalDragOver(
- /**Event*/
- evt) {
- if (evt.dataTransfer) {
- evt.dataTransfer.dropEffect = 'move';
- }
- evt.cancelable && evt.preventDefault();
- }
- function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
- var evt,
- sortable = fromEl[expando],
- onMoveFn = sortable.options.onMove,
- retVal; // Support for new CustomEvent feature
- if (window.CustomEvent && !IE11OrLess && !Edge) {
- evt = new CustomEvent('move', {
- bubbles: true,
- cancelable: true
- });
- } else {
- evt = document.createEvent('Event');
- evt.initEvent('move', true, true);
- }
- evt.to = toEl;
- evt.from = fromEl;
- evt.dragged = dragEl;
- evt.draggedRect = dragRect;
- evt.related = targetEl || toEl;
- evt.relatedRect = targetRect || getRect(toEl);
- evt.willInsertAfter = willInsertAfter;
- evt.originalEvent = originalEvent;
- fromEl.dispatchEvent(evt);
- if (onMoveFn) {
- retVal = onMoveFn.call(sortable, evt, originalEvent);
- }
- return retVal;
- }
- function _disableDraggable(el) {
- el.draggable = false;
- }
- function _unsilent() {
- _silent = false;
- }
- function _ghostIsFirst(evt, vertical, sortable) {
- var rect = getRect(getChild(sortable.el, 0, sortable.options, true));
- var spacer = 10;
- 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;
- }
- function _ghostIsLast(evt, vertical, sortable) {
- var rect = getRect(lastChild(sortable.el, sortable.options.draggable));
- var spacer = 10;
- 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;
- }
- function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
- var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
- targetLength = vertical ? targetRect.height : targetRect.width,
- targetS1 = vertical ? targetRect.top : targetRect.left,
- targetS2 = vertical ? targetRect.bottom : targetRect.right,
- invert = false;
- if (!invertSwap) {
- // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
- if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
- // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2
- // check if past first invert threshold on side opposite of lastDirection
- if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
- // past first invert threshold, do not restrict inverted threshold to dragEl shadow
- pastFirstInvertThresh = true;
- }
- if (!pastFirstInvertThresh) {
- // dragEl shadow (target move distance shadow)
- if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
- : mouseOnAxis > targetS2 - targetMoveDistance) {
- return -lastDirection;
- }
- } else {
- invert = true;
- }
- } else {
- // Regular
- if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
- return _getInsertDirection(target);
- }
- }
- }
- invert = invert || invertSwap;
- if (invert) {
- // Invert of regular
- if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
- return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
- }
- }
- return 0;
- }
- /**
- * Gets the direction dragEl must be swapped relative to target in order to make it
- * seem that dragEl has been "inserted" into that element's position
- * @param {HTMLElement} target The target whose position dragEl is being inserted at
- * @return {Number} Direction dragEl must be swapped
- */
- function _getInsertDirection(target) {
- if (index(dragEl) < index(target)) {
- return 1;
- } else {
- return -1;
- }
- }
- /**
- * Generate id
- * @param {HTMLElement} el
- * @returns {String}
- * @private
- */
- function _generateId(el) {
- var str = el.tagName + el.className + el.src + el.href + el.textContent,
- i = str.length,
- sum = 0;
- while (i--) {
- sum += str.charCodeAt(i);
- }
- return sum.toString(36);
- }
- function _saveInputCheckedState(root) {
- savedInputChecked.length = 0;
- var inputs = root.getElementsByTagName('input');
- var idx = inputs.length;
- while (idx--) {
- var el = inputs[idx];
- el.checked && savedInputChecked.push(el);
- }
- }
- function _nextTick(fn) {
- return setTimeout(fn, 0);
- }
- function _cancelNextTick(id) {
- return clearTimeout(id);
- } // Fixed #973:
- if (documentExists) {
- on(document, 'touchmove', function (evt) {
- if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
- evt.preventDefault();
- }
- });
- } // Export utils
- Sortable.utils = {
- on: on,
- off: off,
- css: css,
- find: find,
- is: function is(el, selector) {
- return !!closest(el, selector, el, false);
- },
- extend: extend,
- throttle: throttle,
- closest: closest,
- toggleClass: toggleClass,
- clone: clone,
- index: index,
- nextTick: _nextTick,
- cancelNextTick: _cancelNextTick,
- detectDirection: _detectDirection,
- getChild: getChild
- };
- /**
- * Get the Sortable instance of an element
- * @param {HTMLElement} element The element
- * @return {Sortable|undefined} The instance of Sortable
- */
- Sortable.get = function (element) {
- return element[expando];
- };
- /**
- * Mount a plugin to Sortable
- * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
- */
- Sortable.mount = function () {
- for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
- plugins[_key] = arguments[_key];
- }
- if (plugins[0].constructor === Array) plugins = plugins[0];
- plugins.forEach(function (plugin) {
- if (!plugin.prototype || !plugin.prototype.constructor) {
- throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
- }
- if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
- PluginManager.mount(plugin);
- });
- };
- /**
- * Create sortable instance
- * @param {HTMLElement} el
- * @param {Object} [options]
- */
- Sortable.create = function (el, options) {
- return new Sortable(el, options);
- }; // Export
- Sortable.version = version;
- var autoScrolls = [],
- scrollEl,
- scrollRootEl,
- scrolling = false,
- lastAutoScrollX,
- lastAutoScrollY,
- touchEvt$1,
- pointerElemChangedInterval;
- function AutoScrollPlugin() {
- function AutoScroll() {
- this.defaults = {
- scroll: true,
- forceAutoScrollFallback: false,
- scrollSensitivity: 30,
- scrollSpeed: 10,
- bubbleScroll: true
- }; // Bind all private methods
- for (var fn in this) {
- if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
- this[fn] = this[fn].bind(this);
- }
- }
- }
- AutoScroll.prototype = {
- dragStarted: function dragStarted(_ref) {
- var originalEvent = _ref.originalEvent;
- if (this.sortable.nativeDraggable) {
- on(document, 'dragover', this._handleAutoScroll);
- } else {
- if (this.options.supportPointer) {
- on(document, 'pointermove', this._handleFallbackAutoScroll);
- } else if (originalEvent.touches) {
- on(document, 'touchmove', this._handleFallbackAutoScroll);
- } else {
- on(document, 'mousemove', this._handleFallbackAutoScroll);
- }
- }
- },
- dragOverCompleted: function dragOverCompleted(_ref2) {
- var originalEvent = _ref2.originalEvent;
- // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
- if (!this.options.dragOverBubble && !originalEvent.rootEl) {
- this._handleAutoScroll(originalEvent);
- }
- },
- drop: function drop() {
- if (this.sortable.nativeDraggable) {
- off(document, 'dragover', this._handleAutoScroll);
- } else {
- off(document, 'pointermove', this._handleFallbackAutoScroll);
- off(document, 'touchmove', this._handleFallbackAutoScroll);
- off(document, 'mousemove', this._handleFallbackAutoScroll);
- }
- clearPointerElemChangedInterval();
- clearAutoScrolls();
- cancelThrottle();
- },
- nulling: function nulling() {
- touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
- autoScrolls.length = 0;
- },
- _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
- this._handleAutoScroll(evt, true);
- },
- _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
- var _this = this;
- var x = (evt.touches ? evt.touches[0] : evt).clientX,
- y = (evt.touches ? evt.touches[0] : evt).clientY,
- elem = document.elementFromPoint(x, y);
- touchEvt$1 = evt; // IE does not seem to have native autoscroll,
- // Edge's autoscroll seems too conditional,
- // MACOS Safari does not have autoscroll,
- // Firefox and Chrome are good
- if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
- autoScroll(evt, this.options, elem, fallback); // Listener for pointer element change
- var ogElemScroller = getParentAutoScrollElement(elem, true);
- if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
- pointerElemChangedInterval && clearPointerElemChangedInterval(); // Detect for pointer elem change, emulating native DnD behaviour
- pointerElemChangedInterval = setInterval(function () {
- var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
- if (newElem !== ogElemScroller) {
- ogElemScroller = newElem;
- clearAutoScrolls();
- }
- autoScroll(evt, _this.options, newElem, fallback);
- }, 10);
- lastAutoScrollX = x;
- lastAutoScrollY = y;
- }
- } else {
- // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll
- if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
- clearAutoScrolls();
- return;
- }
- autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
- }
- }
- };
- return _extends(AutoScroll, {
- pluginName: 'scroll',
- initializeByDefault: true
- });
- }
- function clearAutoScrolls() {
- autoScrolls.forEach(function (autoScroll) {
- clearInterval(autoScroll.pid);
- });
- autoScrolls = [];
- }
- function clearPointerElemChangedInterval() {
- clearInterval(pointerElemChangedInterval);
- }
- var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
- // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
- if (!options.scroll) return;
- var x = (evt.touches ? evt.touches[0] : evt).clientX,
- y = (evt.touches ? evt.touches[0] : evt).clientY,
- sens = options.scrollSensitivity,
- speed = options.scrollSpeed,
- winScroller = getWindowScrollingElement();
- var scrollThisInstance = false,
- scrollCustomFn; // New scroll root, set scrollEl
- if (scrollRootEl !== rootEl) {
- scrollRootEl = rootEl;
- clearAutoScrolls();
- scrollEl = options.scroll;
- scrollCustomFn = options.scrollFn;
- if (scrollEl === true) {
- scrollEl = getParentAutoScrollElement(rootEl, true);
- }
- }
- var layersOut = 0;
- var currentParent = scrollEl;
- do {
- var el = currentParent,
- rect = getRect(el),
- top = rect.top,
- bottom = rect.bottom,
- left = rect.left,
- right = rect.right,
- width = rect.width,
- height = rect.height,
- canScrollX = void 0,
- canScrollY = void 0,
- scrollWidth = el.scrollWidth,
- scrollHeight = el.scrollHeight,
- elCSS = css(el),
- scrollPosX = el.scrollLeft,
- scrollPosY = el.scrollTop;
- if (el === winScroller) {
- canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
- canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
- } else {
- canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
- canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
- }
- var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
- var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
- if (!autoScrolls[layersOut]) {
- for (var i = 0; i <= layersOut; i++) {
- if (!autoScrolls[i]) {
- autoScrolls[i] = {};
- }
- }
- }
- if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
- autoScrolls[layersOut].el = el;
- autoScrolls[layersOut].vx = vx;
- autoScrolls[layersOut].vy = vy;
- clearInterval(autoScrolls[layersOut].pid);
- if (vx != 0 || vy != 0) {
- scrollThisInstance = true;
- /* jshint loopfunc:true */
- autoScrolls[layersOut].pid = setInterval(function () {
- // emulate drag over during autoscroll (fallback), emulating native DnD behaviour
- if (isFallback && this.layer === 0) {
- Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
- }
- var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
- var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
- if (typeof scrollCustomFn === 'function') {
- if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
- return;
- }
- }
- scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
- }.bind({
- layer: layersOut
- }), 24);
- }
- }
- layersOut++;
- } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
- scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
- }, 30);
- var drop = function drop(_ref) {
- var originalEvent = _ref.originalEvent,
- putSortable = _ref.putSortable,
- dragEl = _ref.dragEl,
- activeSortable = _ref.activeSortable,
- dispatchSortableEvent = _ref.dispatchSortableEvent,
- hideGhostForTarget = _ref.hideGhostForTarget,
- unhideGhostForTarget = _ref.unhideGhostForTarget;
- if (!originalEvent) return;
- var toSortable = putSortable || activeSortable;
- hideGhostForTarget();
- var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
- var target = document.elementFromPoint(touch.clientX, touch.clientY);
- unhideGhostForTarget();
- if (toSortable && !toSortable.el.contains(target)) {
- dispatchSortableEvent('spill');
- this.onSpill({
- dragEl: dragEl,
- putSortable: putSortable
- });
- }
- };
- function Revert() {}
- Revert.prototype = {
- startIndex: null,
- dragStart: function dragStart(_ref2) {
- var oldDraggableIndex = _ref2.oldDraggableIndex;
- this.startIndex = oldDraggableIndex;
- },
- onSpill: function onSpill(_ref3) {
- var dragEl = _ref3.dragEl,
- putSortable = _ref3.putSortable;
- this.sortable.captureAnimationState();
- if (putSortable) {
- putSortable.captureAnimationState();
- }
- var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
- if (nextSibling) {
- this.sortable.el.insertBefore(dragEl, nextSibling);
- } else {
- this.sortable.el.appendChild(dragEl);
- }
- this.sortable.animateAll();
- if (putSortable) {
- putSortable.animateAll();
- }
- },
- drop: drop
- };
- _extends(Revert, {
- pluginName: 'revertOnSpill'
- });
- function Remove() {}
- Remove.prototype = {
- onSpill: function onSpill(_ref4) {
- var dragEl = _ref4.dragEl,
- putSortable = _ref4.putSortable;
- var parentSortable = putSortable || this.sortable;
- parentSortable.captureAnimationState();
- dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
- parentSortable.animateAll();
- },
- drop: drop
- };
- _extends(Remove, {
- pluginName: 'removeOnSpill'
- });
- Sortable.mount(new AutoScrollPlugin());
- Sortable.mount(Remove, Revert);
- const CSS$8 = {
- sortItem: "sort-item",
- container: "container",
- containerHorizontal: "container--horizontal",
- containerVertical: "container--vertical"
- };
- const sortableListCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-sortable-list{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-sortable-list{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-sortable-list{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-sortable-list{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-sortable-list:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-sortable-list:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-sortable-list-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-sortable-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-sortable-list-h{display:flex}/*!@: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:flex;flex:1 1 auto}/*!@.container--vertical*/.container--vertical.sc-calcite-sortable-list{flex-direction:column}/*!@.container--horizontal*/.container--horizontal.sc-calcite-sortable-list{flex-direction:row}";
- /**
- * @slot - A slot for adding sortable items.
- */
- class SortableList {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteListOrderChange = createEvent(this, "calciteListOrderChange", 6);
- /**
- * The selector for the handle elements.
- */
- this.handleSelector = "calcite-handle";
- /**
- * Indicates the horizontal or vertical orientation of the component.
- */
- this.layout = "vertical";
- /**
- * When true, disabled prevents interaction. This state shows items with lower opacity/grayed.
- */
- this.disabled = false;
- /**
- * When true, content is waiting to be loaded. This state shows a busy indicator.
- */
- this.loading = false;
- this.handleActivated = false;
- this.items = [];
- this.mutationObserver = createObserver();
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- this.items = Array.from(this.el.children);
- this.setUpDragAndDrop();
- this.beginObserving();
- }
- disconnectedCallback() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- this.cleanUpDragAndDrop();
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- calciteHandleNudgeHandler(event) {
- var _a;
- const sortItem = this.items.find((item) => {
- return item.contains(event.detail.handle) || event.composedPath().includes(item);
- });
- const lastIndex = this.items.length - 1;
- const startingIndex = this.items.indexOf(sortItem);
- let appendInstead = false;
- let buddyIndex;
- switch (event.detail.direction) {
- case "up":
- event.preventDefault();
- if (startingIndex === 0) {
- appendInstead = true;
- }
- else {
- buddyIndex = startingIndex - 1;
- }
- break;
- case "down":
- event.preventDefault();
- if (startingIndex === lastIndex) {
- buddyIndex = 0;
- }
- else if (startingIndex === lastIndex - 1) {
- appendInstead = true;
- }
- else {
- buddyIndex = startingIndex + 2;
- }
- break;
- default:
- return;
- }
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- if (appendInstead) {
- sortItem.parentElement.appendChild(sortItem);
- }
- else {
- sortItem.parentElement.insertBefore(sortItem, this.items[buddyIndex]);
- }
- this.items = Array.from(this.el.children);
- event.detail.handle.activated = true;
- event.detail.handle.setFocus();
- this.beginObserving();
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- setUpDragAndDrop() {
- this.cleanUpDragAndDrop();
- const options = {
- dataIdAttr: "id",
- group: this.group,
- handle: this.handleSelector,
- // Changed sorting within list
- onUpdate: () => {
- this.items = Array.from(this.el.children);
- this.calciteListOrderChange.emit();
- },
- // Element dragging started
- onStart: () => {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- },
- // Element dragging ended
- onEnd: () => {
- this.beginObserving();
- }
- };
- if (this.dragSelector) {
- options.draggable = this.dragSelector;
- }
- this.sortable = Sortable.create(this.el, options);
- }
- cleanUpDragAndDrop() {
- var _a;
- (_a = this.sortable) === null || _a === void 0 ? void 0 : _a.destroy();
- this.sortable = null;
- }
- beginObserving() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const { layout } = this;
- const horizontal = layout === "horizontal" || false;
- return (hAsync("div", { class: {
- [CSS$8.container]: true,
- [CSS$8.containerVertical]: !horizontal,
- [CSS$8.containerHorizontal]: horizontal
- } }, hAsync("slot", null)));
- }
- get el() { return getElement(this); }
- static get style() { return sortableListCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-sortable-list",
- "$members$": {
- "dragSelector": [513, "drag-selector"],
- "group": [513],
- "handleSelector": [513, "handle-selector"],
- "layout": [513],
- "disabled": [516],
- "loading": [516],
- "handleActivated": [32]
- },
- "$listeners$": [[0, "calciteHandleNudge", "calciteHandleNudgeHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["dragSelector", "drag-selector"], ["group", "group"], ["handleSelector", "handle-selector"], ["layout", "layout"], ["disabled", "disabled"], ["loading", "loading"]]
- }; }
- }
- const CSS$7 = {
- container: "split-button__container",
- dividerContainer: "split-button__divider-container",
- divider: "split-button__divider",
- widthAuto: "width-auto",
- widthHalf: "width-half",
- widthFull: "width-full"
- };
- const splitButtonCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-split-button{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-split-button{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-split-button{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-split-button{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-split-button:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-split-button:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-split-button-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-split-button-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@: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:flex;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{block-size:100%;vertical-align:top}/*!@:host:host([color=blue])*/.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:host([color=red])*/.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:host([color=neutral])*/.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:host([color=inverse])*/.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{inline-size:auto}/*!@.width-half*/.width-half.sc-calcite-split-button{inline-size:50%}/*!@.width-full*/.width-full.sc-calcite-split-button{inline-size:100%}/*!@.split-button__divider-container*/.split-button__divider-container.sc-calcite-split-button{display:flex;inline-size:1px;align-items:stretch;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;background-color:var(--calcite-split-button-background)}/*!@.split-button__divider*/.split-button__divider.sc-calcite-split-button{margin-block:0.25rem;display:inline-block;inline-size:1px;background-color:var(--calcite-split-button-divider)}/*!@:host([appearance=outline]) .split-button__divider-container,\n:host([appearance=clear]) .split-button__divider-container,\n:host([appearance=minimal]) .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,[appearance=minimal].sc-calcite-split-button-h .split-button__divider-container.sc-calcite-split-button{border-block:1px solid var(--calcite-split-button-divider)}/*!@:host([appearance=outline]):hover .split-button__divider-container,\n:host([appearance=clear]):hover .split-button__divider-container,\n:host([appearance=minimal]):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,[appearance=minimal].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,\n:host([appearance=minimal]):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,[appearance=minimal].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]),\n:host([appearance=minimal]: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]),[appearance=minimal].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]),\n:host([appearance=minimal]: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]),[appearance=minimal].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,\n:host([appearance=minimal]: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,[appearance=minimal].sc-calcite-split-button-h:focus-within .split-button__divider-container.sc-calcite-split-button{background-color:var(--calcite-split-button-divider)}/*!@: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}";
- /**
- * @slot - A slot for adding `calcite-dropdown` content.
- */
- class SplitButton {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteSplitButtonPrimaryClick = createEvent(this, "calciteSplitButtonPrimaryClick", 6);
- this.calciteSplitButtonSecondaryClick = createEvent(this, "calciteSplitButtonSecondaryClick", 6);
- /** Specifies the appearance style of the component. */
- this.appearance = "solid";
- /** Specifies the color of the component. */
- this.color = "blue";
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /**
- * When `true`, the component is active.
- *
- * @internal
- */
- this.active = false;
- /** Specifies the icon used for the dropdown menu. */
- this.dropdownIconType = "chevron";
- /**
- When `true`, a busy indicator is displayed on the primary button.
- */
- this.loading = false;
- /**
- * Determines the type of positioning to use for the overlaid content.
- *
- * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
- *
- * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
- *
- */
- this.overlayPositioning = "absolute";
- /** Specifies the size of the component. */
- this.scale = "m";
- /** Specifies the width of the component. */
- this.width = "auto";
- this.calciteSplitButtonPrimaryClickHandler = (event) => this.calciteSplitButtonPrimaryClick.emit(event);
- this.calciteSplitButtonSecondaryClickHandler = (event) => this.calciteSplitButtonSecondaryClick.emit(event);
- }
- handleDisabledChange(value) {
- if (!value) {
- this.active = false;
- }
- }
- activeHandler() {
- if (this.disabled) {
- this.active = false;
- }
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidRender() {
- updateHostInteraction(this);
- }
- render() {
- const widthClasses = {
- [CSS$7.container]: true,
- [CSS$7.widthAuto]: this.width === "auto",
- [CSS$7.widthHalf]: this.width === "half",
- [CSS$7.widthFull]: this.width === "full"
- };
- const buttonWidth = this.width === "auto" ? "auto" : "full";
- 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-end", 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))));
- }
- get dropdownIcon() {
- return this.dropdownIconType === "chevron"
- ? "chevronDown"
- : this.dropdownIconType === "caret"
- ? "caretDown"
- : this.dropdownIconType === "ellipsis"
- ? "ellipsis"
- : "handle-vertical";
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "disabled": ["handleDisabledChange"],
- "active": ["activeHandler"]
- }; }
- static get style() { return splitButtonCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-split-button",
- "$members$": {
- "appearance": [513],
- "color": [513],
- "disabled": [516],
- "active": [1540],
- "dropdownIconType": [513, "dropdown-icon-type"],
- "dropdownLabel": [513, "dropdown-label"],
- "loading": [516],
- "overlayPositioning": [513, "overlay-positioning"],
- "primaryIconEnd": [513, "primary-icon-end"],
- "primaryIconFlipRtl": [513, "primary-icon-flip-rtl"],
- "primaryIconStart": [513, "primary-icon-start"],
- "primaryLabel": [513, "primary-label"],
- "primaryText": [513, "primary-text"],
- "scale": [513],
- "width": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["appearance", "appearance"], ["color", "color"], ["disabled", "disabled"], ["active", "active"], ["dropdownIconType", "dropdown-icon-type"], ["dropdownLabel", "dropdown-label"], ["loading", "loading"], ["overlayPositioning", "overlay-positioning"], ["primaryIconEnd", "primary-icon-end"], ["primaryIconFlipRtl", "primary-icon-flip-rtl"], ["primaryIconStart", "primary-icon-start"], ["primaryLabel", "primary-label"], ["primaryText", "primary-text"], ["scale", "scale"], ["width", "width"]]
- }; }
- }
- const stepperCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-stepper{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-stepper{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-stepper{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-stepper{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-stepper:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-stepper:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-stepper-h{display:none}/*!@:host*/.sc-calcite-stepper-h{position:relative;display:flex;inline-size:100%;min-inline-size:-moz-fit-content;min-inline-size:fit-content;flex-direction:row;flex-wrap:wrap;align-items:stretch;justify-content:space-between}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-stepper-h{flex:1 1 auto;flex-direction:column}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-stepper-h{display:grid;grid-template-areas:\"items\" \"content\"}";
- /**
- * @slot - A slot for adding `calcite-stepper-item`s.
- */
- class Stepper {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteStepperItemChange = createEvent(this, "calciteStepperItemChange", 6);
- this.calciteInternalStepperItemChange = createEvent(this, "calciteInternalStepperItemChange", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, displays a status icon in the `calcite-stepper-item` heading. */
- this.icon = false;
- /** Defines the layout of the component. */
- this.layout = "horizontal";
- /** When `true`, displays the step number in the `calcite-stepper-item` heading. */
- this.numbered = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- //--------------------------------------------------------------------------
- //
- // Private State/Props
- //
- //--------------------------------------------------------------------------
- this.itemMap = new Map();
- /** list of sorted Stepper items */
- this.items = [];
- /** list of enabled Stepper items */
- this.enabledItems = [];
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidLoad() {
- // if no stepper items are set as active, default to the first one
- if (typeof this.currentPosition !== "number") {
- this.calciteInternalStepperItemChange.emit({
- position: 0
- });
- }
- }
- render() {
- return (hAsync("slot", { onSlotchange: (event) => {
- const items = event.currentTarget
- .assignedElements()
- .filter((el) => (el === null || el === void 0 ? void 0 : el.tagName) === "CALCITE-STEPPER-ITEM");
- const spacing = Array(items.length).fill("1fr").join(" ");
- this.el.style.gridTemplateAreas = spacing;
- this.el.style.gridTemplateColumns = spacing;
- } }));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- calciteInternalStepperItemKeyEvent(event) {
- const item = event.detail.item;
- const itemToFocus = event.target;
- const isFirstItem = this.itemIndex(itemToFocus) === 0;
- const isLastItem = this.itemIndex(itemToFocus) === this.enabledItems.length - 1;
- switch (item.key) {
- case "ArrowDown":
- case "ArrowRight":
- if (isLastItem) {
- this.focusFirstItem();
- }
- else {
- this.focusNextItem(itemToFocus);
- }
- break;
- case "ArrowUp":
- case "ArrowLeft":
- if (isFirstItem) {
- this.focusLastItem();
- }
- else {
- this.focusPrevItem(itemToFocus);
- }
- break;
- case "Home":
- this.focusFirstItem();
- break;
- case "End":
- this.focusLastItem();
- break;
- }
- event.stopPropagation();
- }
- registerItem(event) {
- const item = event.target;
- const { content, position } = event.detail;
- this.itemMap.set(item, { position, content });
- this.items = this.sortItems();
- this.enabledItems = this.filterItems();
- event.stopPropagation();
- }
- updateItem(event) {
- const { position } = event.detail;
- if (typeof position === "number") {
- this.currentPosition = position;
- }
- this.calciteInternalStepperItemChange.emit({
- position
- });
- }
- handleUserRequestedStepperItemSelect(event) {
- const { position } = event.detail;
- this.calciteStepperItemChange.emit({
- position
- });
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Set the next `calcite-stepper-item` as active. */
- async nextStep() {
- const enabledStepIndex = this.getEnabledStepIndex(this.currentPosition + 1, "next");
- if (typeof enabledStepIndex !== "number") {
- return;
- }
- this.updateStep(enabledStepIndex);
- }
- /** Set the previous `calcite-stepper-item` as active. */
- async prevStep() {
- const enabledStepIndex = this.getEnabledStepIndex(this.currentPosition - 1, "previous");
- if (typeof enabledStepIndex !== "number") {
- return;
- }
- this.updateStep(enabledStepIndex);
- }
- /**
- * Set a specified `calcite-stepper-item` as active.
- *
- * @param step
- */
- async goToStep(step) {
- const position = step - 1;
- if (this.currentPosition !== position) {
- this.updateStep(position);
- }
- }
- /** Set the first `calcite-stepper-item` as active. */
- async startStep() {
- const enabledStepIndex = this.getEnabledStepIndex(0, "next");
- if (typeof enabledStepIndex !== "number") {
- return;
- }
- this.updateStep(enabledStepIndex);
- }
- /** Set the last `calcite-stepper-item` as active. */
- async endStep() {
- const enabledStepIndex = this.getEnabledStepIndex(this.items.length - 1, "previous");
- if (typeof enabledStepIndex !== "number") {
- return;
- }
- this.updateStep(enabledStepIndex);
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- getEnabledStepIndex(startIndex, direction = "next") {
- var _a;
- const { items, currentPosition } = this;
- let newIndex = startIndex;
- while ((_a = items[newIndex]) === null || _a === void 0 ? void 0 : _a.disabled) {
- newIndex = newIndex + (direction === "previous" ? -1 : 1);
- }
- return newIndex !== currentPosition && newIndex < items.length && newIndex >= 0
- ? newIndex
- : null;
- }
- updateStep(position) {
- this.currentPosition = position;
- this.calciteInternalStepperItemChange.emit({
- position
- });
- }
- focusFirstItem() {
- const firstItem = this.enabledItems[0];
- focusElement(firstItem);
- }
- focusLastItem() {
- const lastItem = this.enabledItems[this.enabledItems.length - 1];
- focusElement(lastItem);
- }
- focusNextItem(el) {
- const index = this.itemIndex(el);
- const nextItem = this.enabledItems[index + 1] || this.enabledItems[0];
- focusElement(nextItem);
- }
- focusPrevItem(el) {
- const index = this.itemIndex(el);
- const prevItem = this.enabledItems[index - 1] || this.enabledItems[this.enabledItems.length - 1];
- focusElement(prevItem);
- }
- itemIndex(el) {
- return this.enabledItems.indexOf(el);
- }
- sortItems() {
- const { itemMap } = this;
- return Array.from(itemMap.keys()).sort((a, b) => itemMap.get(a).position - itemMap.get(b).position);
- }
- filterItems() {
- return this.items.filter((item) => !item.disabled);
- }
- get el() { return getElement(this); }
- static get style() { return stepperCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-stepper",
- "$members$": {
- "icon": [516],
- "layout": [513],
- "numbered": [516],
- "numberingSystem": [513, "numbering-system"],
- "scale": [513],
- "nextStep": [64],
- "prevStep": [64],
- "goToStep": [64],
- "startStep": [64],
- "endStep": [64]
- },
- "$listeners$": [[0, "calciteInternalStepperItemKeyEvent", "calciteInternalStepperItemKeyEvent"], [0, "calciteInternalStepperItemRegister", "registerItem"], [0, "calciteInternalStepperItemSelect", "updateItem"], [0, "calciteInternalUserRequestedStepperItemSelect", "handleUserRequestedStepperItemSelect"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["icon", "icon"], ["layout", "layout"], ["numbered", "numbered"], ["numberingSystem", "numbering-system"], ["scale", "scale"]]
- }; }
- }
- const stepperItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-stepper-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-stepper-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-stepper-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-stepper-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-stepper-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-stepper-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-stepper-item-h{display:none}/*!@:host([layout=horizontal][disabled]) .stepper-item-header, :host([disabled])*/[layout=horizontal][disabled].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item,[disabled].sc-calcite-stepper-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@: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;margin-inline-end:0.25rem}/*!@:host([scale=s]) .stepper-item-description*/[scale=s].sc-calcite-stepper-item-h .stepper-item-description.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;margin-inline-end:0.5rem}/*!@:host([scale=m]) .stepper-item-description*/[scale=m].sc-calcite-stepper-item-h .stepper-item-description.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;margin-inline-end:0.75rem}/*!@:host([scale=l]) .stepper-item-description*/[scale=l].sc-calcite-stepper-item-h .stepper-item-description.sc-calcite-stepper-item{font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@:host*/.sc-calcite-stepper-item-h{position:relative;display:flex;flex-grow:1;flex-direction:column;align-self:flex-start;margin-block-end:var(--calcite-stepper-item-spacing-unit-s)}/*!@:host .container*/.sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{position:relative;display:flex;flex-grow:1;cursor:pointer;flex-direction:column;border-width:0px;border-block-start-width:2px;border-style:solid;border-color:var(--calcite-ui-border-3);color:var(--calcite-ui-text-3);text-decoration-line:none;outline:2px solid transparent;outline-offset:2px;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host*/.sc-calcite-stepper-item-h{outline-color:transparent}/*!@: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:flex;cursor:pointer;align-items:flex-start}/*!@:host .stepper-item-content, \n: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{transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);padding-block:var(--calcite-stepper-item-spacing-unit-l);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:inline-flex;align-items:center;transition-duration:150ms;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;inline-size:100%;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{margin-inline-end:var(--calcite-stepper-item-spacing-unit-m);margin-block-start:1px;display:inline-flex;block-size:0.75rem;flex-shrink:0;align-self:flex-start;color:var(--calcite-ui-text-3);opacity:var(--calcite-ui-opacity-disabled);transition-duration:150ms;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{flex-direction:column;text-align:initial;margin-inline-end:auto}/*!@:host .stepper-item-heading, \n:host .stepper-item-description*/.sc-calcite-stepper-item-h .stepper-item-heading.sc-calcite-stepper-item,.sc-calcite-stepper-item-h .stepper-item-description.sc-calcite-stepper-item{display:flex;inline-size:100%}/*!@:host .stepper-item-heading*/.sc-calcite-stepper-item-h .stepper-item-heading.sc-calcite-stepper-item{margin-block-end:0.25rem;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2)}/*!@:host .stepper-item-description*/.sc-calcite-stepper-item-h .stepper-item-description.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);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);margin-inline-end:var(--calcite-stepper-item-spacing-unit-m)}/*!@: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-block-start-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([selected])) .container, \n:host(:focus:not([disabled]):not([selected])) .container*/.sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item,.sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item{border-block-start-color:var(--calcite-ui-brand)}/*!@:host(:hover:not([disabled]):not([selected])) .container .stepper-item-heading, \n:host(:focus:not([disabled]):not([selected])) .container .stepper-item-heading*/.sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item .stepper-item-heading.sc-calcite-stepper-item,.sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item .stepper-item-heading.sc-calcite-stepper-item{color:var(--calcite-ui-text-1)}/*!@:host(:hover:not([disabled]):not([selected])) .container .stepper-item-description, \n:host(:focus:not([disabled]):not([selected])) .container .stepper-item-description*/.sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item .stepper-item-description.sc-calcite-stepper-item,.sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item .stepper-item-description.sc-calcite-stepper-item{color:var(--calcite-ui-text-2)}/*!@:host([error]:hover:not([disabled]):not([selected])) .container, \n:host([error]:focus:not([disabled]):not([selected])) .container*/[error].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item,[error].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item{border-block-start-color:var(--calcite-ui-danger-hover)}/*!@:host([selected]) .container*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-block-start-color:var(--calcite-ui-brand)}/*!@:host([selected]) .container .stepper-item-heading*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-heading.sc-calcite-stepper-item{color:var(--calcite-ui-text-1)}/*!@:host([selected]) .container .stepper-item-description*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-description.sc-calcite-stepper-item{color:var(--calcite-ui-text-2)}/*!@:host([selected]) .container .stepper-item-number*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-number.sc-calcite-stepper-item{color:var(--calcite-ui-brand)}/*!@:host([selected]) .container .stepper-item-icon*/[selected].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([selected]) .container .stepper-item-content*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-content.sc-calcite-stepper-item{display:flex}/*!@:host([layout=vertical]) .container*/[layout=vertical].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{margin-inline:0px;margin-block-start:0px;flex:1 1 auto;border-block-start-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-block:0px;border-inline-start-width:2px;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{order:3;margin-block:1px 0px;padding-inline-start:var(--calcite-stepper-item-spacing-unit-s);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{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][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([selected])) .container, \n:host([layout=vertical][complete]:focus:not([disabled]):not([selected])) .container*/[layout=vertical][complete].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item,[layout=vertical][complete].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .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][selected]) .container*/[layout=vertical][selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-color:var(--calcite-ui-brand)}/*!@:host([layout=vertical][selected]) .container .stepper-item-content ::slotted(:last-child)*/.sc-calcite-stepper-item-h[layout=vertical][selected] .container .stepper-item-content .sc-calcite-stepper-item-s>:last-child{margin-block-end:var(--calcite-stepper-item-spacing-unit-l)}/*!@:host([layout=vertical]:hover:not([disabled]):not([selected])) .container,\n:host([layout=vertical]:focus:not([disabled]):not([selected])) .container*/[layout=vertical].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item,[layout=vertical].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item{border-color:rgba(0, 122, 194, 0.5)}/*!@:host([layout=vertical][error]:hover:not([disabled]):not([selected])) .container, \n:host([layout=vertical][error]:focus:not([disabled]):not([selected])) .container*/[layout=vertical][error].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .container.sc-calcite-stepper-item,[layout=vertical][error].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .container.sc-calcite-stepper-item{border-color:var(--calcite-ui-danger-hover)}/*!@:host([layout=horizontal])*/[layout=horizontal].sc-calcite-stepper-item-h{display:contents}/*!@:host([layout=horizontal]) .container*/[layout=horizontal].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{display:contents}/*!@:host([layout=horizontal]) .stepper-item-header*/[layout=horizontal].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{border-width:0px;border-block-start-width:2px;border-style:solid;border-color:var(--calcite-ui-border-3);outline-color:transparent;grid-row:items;margin-inline-end:0.5rem;margin-block-end:var(--calcite-stepper-item-spacing-unit-s)}/*!@:host([layout=horizontal]) .stepper-item-header:focus*/[layout=horizontal].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}/*!@:host([layout=horizontal]) .stepper-item-content*/[layout=horizontal].sc-calcite-stepper-item-h .stepper-item-content.sc-calcite-stepper-item{cursor:auto;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);padding-block:0;padding-inline-end:var(--calcite-stepper-item-spacing-unit-m);text-align:start}/*!@:host([layout=horizontal][selected]) .stepper-item-content*/[layout=horizontal][selected].sc-calcite-stepper-item-h .stepper-item-content.sc-calcite-stepper-item{grid-area:2/1/2/-1}/*!@:host([layout=horizontal][scale=s]) .stepper-item-header*/[layout=horizontal][scale=s].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{margin-inline-end:0.25rem;margin-block-end:var(--calcite-stepper-item-spacing-unit-s)}/*!@:host([layout=horizontal][scale=l]) .stepper-item-header*/[layout=horizontal][scale=l].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{margin-inline-end:0.75rem;margin-block-end:var(--calcite-stepper-item-spacing-unit-s)}/*!@:host([layout=horizontal][complete]) .stepper-item-header*/[layout=horizontal][complete].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{border-color:rgba(0, 122, 194, 0.5)}/*!@:host([layout=horizontal][complete]:hover:not([disabled]):not([selected])) .stepper-item-header, \n:host([layout=horizontal][complete]:focus:not([disabled]):not([selected])) .stepper-item-header*/[layout=horizontal][complete].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item,[layout=horizontal][complete].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item{border-color:var(--calcite-ui-brand)}/*!@:host([layout=horizontal][error]) .stepper-item-header*/[layout=horizontal][error].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{border-color:var(--calcite-ui-danger)}/*!@:host([layout=horizontal][selected]) .stepper-item-header*/[layout=horizontal][selected].sc-calcite-stepper-item-h .stepper-item-header.sc-calcite-stepper-item{border-color:var(--calcite-ui-brand)}/*!@:host([layout=horizontal]:hover:not([disabled]):not([selected])) .stepper-item-header,\n:host([layout=horizontal]:focus:not([disabled]):not([selected])) .stepper-item-header*/[layout=horizontal].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item,[layout=horizontal].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item{border-color:rgba(0, 122, 194, 0.5)}/*!@:host([layout=horizontal][error]:hover:not([disabled]):not([selected])) .stepper-item-header, \n:host([layout=horizontal][error]:focus:not([disabled]):not([selected])) .stepper-item-header*/[layout=horizontal][error].sc-calcite-stepper-item-h:hover:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item,[layout=horizontal][error].sc-calcite-stepper-item-h:focus:not([disabled]):not([selected]) .stepper-item-header.sc-calcite-stepper-item{border-color:var(--calcite-ui-danger-hover)}@media (forced-colors: active){/*!@:host .container*/.sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{outline-width:0;outline-offset:0}/*!@:host(:focus),\n:host(:focus-visible)*/.sc-calcite-stepper-item-h:focus,.sc-calcite-stepper-item-h:focus-visible{outline-color:canvasText}/*!@:host([selected]) .container*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-block-start-color:highlight}/*!@:host([selected]) .container .stepper-item-number*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-number.sc-calcite-stepper-item{color:highlight}/*!@:host([selected]) .container .stepper-item-icon*/[selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item .stepper-item-icon.sc-calcite-stepper-item{color:highlight}/*!@:host([layout=vertical][selected]) .container*/[layout=vertical][selected].sc-calcite-stepper-item-h .container.sc-calcite-stepper-item{border-color:highlight}}";
- /**
- * @slot - A slot for adding custom content.
- */
- class StepperItem {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalStepperItemKeyEvent = createEvent(this, "calciteInternalStepperItemKeyEvent", 6);
- this.calciteInternalStepperItemSelect = createEvent(this, "calciteInternalStepperItemSelect", 6);
- this.calciteInternalUserRequestedStepperItemSelect = createEvent(this, "calciteInternalUserRequestedStepperItemSelect", 6);
- this.calciteInternalStepperItemRegister = createEvent(this, "calciteInternalStepperItemRegister", 6);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, the component is selected.
- *
- * @deprecated Use `selected` instead.
- */
- this.active = false;
- /**
- * When `true`, the component is selected.
- */
- this.selected = false;
- /** When `true`, the step has been completed. */
- this.complete = false;
- /** When `true`, the component contains an error that requires resolution from the user. */
- this.error = false;
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- // internal props inherited from wrapping calcite-stepper
- /** Defines the layout of the component. */
- /** @internal */
- this.layout = "horizontal";
- /** When `true`, displays a status icon in the component's heading. */
- /** @internal */
- this.icon = false;
- /** When `true`, displays the step number in the component's heading. */
- /** @internal */
- this.numbered = false;
- /** Specifies the size of the component. */
- /** @internal */
- this.scale = "m";
- //--------------------------------------------------------------------------
- //
- // Internal State/Props
- //
- //--------------------------------------------------------------------------
- this.effectiveLocale = "";
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.keyDownHandler = (event) => {
- if (!this.disabled && event.target === this.el) {
- switch (event.key) {
- case " ":
- case "Enter":
- this.emitUserRequestedItem();
- event.preventDefault();
- break;
- case "ArrowUp":
- case "ArrowDown":
- case "ArrowLeft":
- case "ArrowRight":
- case "Home":
- case "End":
- this.calciteInternalStepperItemKeyEvent.emit({ item: event });
- event.preventDefault();
- break;
- }
- }
- };
- this.handleItemClick = (event) => {
- if (this.layout === "horizontal" &&
- event
- .composedPath()
- .some((el) => { var _a; return (_a = el.classList) === null || _a === void 0 ? void 0 : _a.contains("stepper-item-content"); })) {
- return;
- }
- this.emitUserRequestedItem();
- };
- this.emitUserRequestedItem = () => {
- this.emitRequestedItem();
- if (!this.disabled) {
- const position = this.itemPosition;
- this.calciteInternalUserRequestedStepperItemSelect.emit({
- position
- });
- }
- };
- this.emitRequestedItem = () => {
- if (!this.disabled) {
- const position = this.itemPosition;
- this.calciteInternalStepperItemSelect.emit({
- position
- });
- }
- };
- }
- activeHandler(value) {
- this.selected = value;
- }
- selectedHandler(value) {
- this.active = value;
- if (this.selected) {
- this.emitRequestedItem();
- }
- }
- // watch for removal of disabled to register step
- disabledWatcher() {
- this.registerStepperItem();
- }
- effectiveLocaleWatcher(locale) {
- var _a;
- numberStringFormatter.numberFormatOptions = {
- locale,
- numberingSystem: (_a = this.parentStepperEl) === null || _a === void 0 ? void 0 : _a.numberingSystem,
- useGrouping: false
- };
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- connectLocalized(this);
- const { selected, active } = this;
- if (selected) {
- this.active = selected;
- }
- else if (active) {
- this.selected = active;
- }
- }
- componentWillLoad() {
- var _a;
- this.icon = getElementProp(this.el, "icon", false);
- this.numbered = getElementProp(this.el, "numbered", false);
- this.layout = getElementProp(this.el, "layout", false);
- this.scale = getElementProp(this.el, "scale", "m");
- this.parentStepperEl = this.el.parentElement;
- this.itemPosition = this.getItemPosition();
- this.registerStepperItem();
- if (this.selected) {
- this.emitRequestedItem();
- }
- numberStringFormatter.numberFormatOptions = {
- locale: this.effectiveLocale,
- numberingSystem: (_a = this.parentStepperEl) === null || _a === void 0 ? void 0 : _a.numberingSystem,
- useGrouping: false
- };
- }
- componentDidRender() {
- updateHostInteraction(this, true);
- }
- disconnectedCallback() {
- disconnectLocalized(this);
- }
- render() {
- return (hAsync(Host, { "aria-expanded": toAriaBoolean(this.active), onClick: this.handleItemClick, onKeyDown: this.keyDownHandler }, hAsync("div", { class: "container" }, hAsync("div", { class: "stepper-item-header", ref: (el) => (this.headerEl = el), tabIndex:
- /* additional tab index logic needed because of display: contents */
- this.layout === "horizontal" && !this.disabled ? 0 : null }, this.icon ? this.renderIcon() : null, this.numbered ? (hAsync("div", { class: "stepper-item-number" }, numberStringFormatter.numberFormatter.format(this.itemPosition + 1), ".")) : null, hAsync("div", { class: "stepper-item-header-text" }, hAsync("span", { class: "stepper-item-heading" }, this.heading || this.itemTitle), hAsync("span", { class: "stepper-item-description" }, this.description || this.itemSubtitle))), hAsync("div", { class: "stepper-item-content" }, hAsync("slot", null)))));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- updateActiveItemOnChange(event) {
- if (event.target === this.parentStepperEl ||
- event.composedPath().includes(this.parentStepperEl)) {
- this.selectedPosition = event.detail.position;
- this.determineSelectedItem();
- }
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- async setFocus() {
- var _a;
- (_a = (this.layout === "vertical" ? this.el : this.headerEl)) === null || _a === void 0 ? void 0 : _a.focus();
- }
- renderIcon() {
- const path = this.selected
- ? "circleF"
- : this.error
- ? "exclamationMarkCircleF"
- : this.complete
- ? "checkCircleF"
- : "circle";
- return hAsync("calcite-icon", { class: "stepper-item-icon", icon: path, scale: "s" });
- }
- determineSelectedItem() {
- this.selected = !this.disabled && this.itemPosition === this.selectedPosition;
- }
- registerStepperItem() {
- this.calciteInternalStepperItemRegister.emit({
- position: this.itemPosition
- });
- }
- getItemPosition() {
- var _a;
- return Array.from((_a = this.parentStepperEl) === null || _a === void 0 ? void 0 : _a.querySelectorAll("calcite-stepper-item")).indexOf(this.el);
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "selected": ["selectedHandler"],
- "disabled": ["disabledWatcher"],
- "effectiveLocale": ["effectiveLocaleWatcher"]
- }; }
- static get style() { return stepperItemCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-stepper-item",
- "$members$": {
- "active": [1540],
- "selected": [1540],
- "complete": [516],
- "error": [516],
- "disabled": [516],
- "itemTitle": [1, "item-title"],
- "heading": [1],
- "itemSubtitle": [1, "item-subtitle"],
- "description": [1],
- "layout": [1537],
- "icon": [1028],
- "numbered": [1028],
- "scale": [1537],
- "effectiveLocale": [32],
- "setFocus": [64]
- },
- "$listeners$": [[16, "calciteInternalStepperItemChange", "updateActiveItemOnChange"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["selected", "selected"], ["complete", "complete"], ["error", "error"], ["disabled", "disabled"], ["layout", "layout"], ["scale", "scale"]]
- }; }
- }
- const switchCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-switch{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-switch{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-switch{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-switch{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-switch:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-switch:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-switch-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-switch-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host([scale=s]) .container*/[scale=s].sc-calcite-switch-h .container.sc-calcite-switch{block-size:0.75rem}/*!@:host([scale=s]) .track*/[scale=s].sc-calcite-switch-h .track.sc-calcite-switch{block-size:0.75rem;inline-size:1.5rem}/*!@:host([scale=s]) .handle*/[scale=s].sc-calcite-switch-h .handle.sc-calcite-switch{block-size:0.5rem;inline-size:0.5rem}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-switch-h .container.sc-calcite-switch{block-size:1rem}/*!@:host([scale=m]) .track*/[scale=m].sc-calcite-switch-h .track.sc-calcite-switch{block-size:1rem;inline-size:2rem}/*!@:host([scale=m]) .handle*/[scale=m].sc-calcite-switch-h .handle.sc-calcite-switch{block-size:0.75rem;inline-size:0.75rem}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-switch-h .container.sc-calcite-switch{block-size:1.5rem}/*!@:host([scale=l]) .track*/[scale=l].sc-calcite-switch-h .track.sc-calcite-switch{block-size:1.5rem;inline-size:3rem}/*!@:host([scale=l]) .handle*/[scale=l].sc-calcite-switch-h .handle.sc-calcite-switch{block-size:1.25rem;inline-size:1.25rem}/*!@:host*/.sc-calcite-switch-h{position:relative;display:inline-block;inline-size:auto;cursor:pointer;-webkit-user-select:none;user-select:none;vertical-align:middle;tap-highlight-color:transparent}/*!@: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{inline-size:auto;outline-color:transparent}/*!@.track*/.track.sc-calcite-switch{pointer-events:none;position:relative;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;transition-property:all;transition-duration:150ms;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);transition-property:all;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);inset-block-start:-1px;inset-inline:-1px auto}/*!@:host(:hover) .handle, \n: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);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);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]{margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
- class Switch {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteSwitchChange = createEvent(this, "calciteSwitchChange", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- /**
- * When `true`, the component is checked.
- *
- * @deprecated use `checked` instead.
- */
- this.switched = false;
- /** When `true`, the component is checked. */
- this.checked = false;
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.keyDownHandler = (event) => {
- if (!this.disabled && isActivationKey(event.key)) {
- this.toggle();
- event.preventDefault();
- }
- };
- this.clickHandler = () => {
- this.toggle();
- };
- this.setSwitchEl = (el) => {
- this.switchEl = el;
- };
- }
- switchedWatcher(switched) {
- this.checked = switched;
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- focusElement(this.switchEl);
- }
- onLabelClick() {
- if (!this.disabled) {
- this.toggle();
- this.setFocus();
- }
- }
- toggle() {
- this.checked = !this.checked;
- this.calciteSwitchChange.emit({
- switched: this.checked
- });
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- const initiallyChecked = this.checked || this.switched;
- if (initiallyChecked) {
- // if either prop is set, we ensure both are synced initially
- this.switched = this.checked = initiallyChecked;
- }
- connectLabel(this);
- connectForm(this);
- }
- disconnectedCallback() {
- disconnectLabel(this);
- disconnectForm(this);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- 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 }))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "switched": ["switchedWatcher"]
- }; }
- static get style() { return switchCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-switch",
- "$members$": {
- "disabled": [516],
- "label": [1],
- "name": [513],
- "scale": [513],
- "switched": [1540],
- "checked": [1540],
- "value": [8],
- "setFocus": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["name", "name"], ["scale", "scale"], ["switched", "switched"], ["checked", "checked"]]
- }; }
- }
- const tabCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tab{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tab{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tab{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tab{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tab:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tab:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tab-h{display:none}/*!@:host([selected]) section, \n:host([selected]) .container*/[selected].sc-calcite-tab-h section.sc-calcite-tab,[selected].sc-calcite-tab-h .container.sc-calcite-tab{display:block}/*!@:host*/.sc-calcite-tab-h{display:none;block-size:100%;inline-size:100%}/*!@:host([selected])*/[selected].sc-calcite-tab-h{display:block;block-size:100%;inline-size:100%;overflow:auto}/*!@section, \n.container*/section.sc-calcite-tab,.container.sc-calcite-tab{display:none;block-size:100%;inline-size:100%}/*!@:host([scale=s])*/[scale=s].sc-calcite-tab-h{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-tab-h{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-tab-h{padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}";
- /**
- * @slot - A slot for adding content to the component.
- */
- class Tab {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalTabRegister = createEvent(this, "calciteInternalTabRegister", 6);
- /**
- * When `true`, the component's contents are selected.
- *
- * Only one tab can be selected within the `calcite-tabs` parent.
- *
- * @deprecated Use `selected` instead.
- */
- this.active = false;
- /**
- * When `true`, the component's contents are selected.
- *
- * Only one tab can be selected within the `calcite-tabs` parent.
- */
- this.selected = false;
- /**
- * @internal
- */
- this.scale = "m";
- this.guid = `calcite-tab-title-${guid()}`;
- }
- activeHandler(value) {
- this.selected = value;
- }
- selectedHandler(value) {
- this.active = value;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- render() {
- const id = this.el.id || this.guid;
- return (hAsync(Host, { "aria-labelledby": this.labeledBy, id: id }, hAsync("div", { class: "container", role: "tabpanel", tabIndex: this.selected ? 0 : -1 }, hAsync("section", null, hAsync("slot", null)))));
- }
- connectedCallback() {
- this.parentTabsEl = this.el.closest("calcite-tabs");
- const isSelected = this.selected || this.active;
- if (isSelected) {
- this.activeHandler(isSelected);
- this.selectedHandler(isSelected);
- }
- }
- componentDidLoad() {
- this.calciteInternalTabRegister.emit();
- }
- componentWillRender() {
- var _a;
- this.scale = (_a = this.parentTabsEl) === null || _a === void 0 ? void 0 : _a.scale;
- }
- disconnectedCallback() {
- var _a;
- // Dispatching to body in order to be listened by other elements that are still connected to the DOM.
- (_a = document.body) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new CustomEvent("calciteTabUnregister", {
- detail: this.el
- }));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- internalTabChangeHandler(event) {
- const targetTabsEl = event
- .composedPath()
- .find((el) => el.tagName === "CALCITE-TABS");
- // to allow `<calcite-tabs>` to be nested we need to make sure this
- // `calciteTabChange` event was actually fired from a within the same
- // `<calcite-tabs>` that is the a parent of this tab.
- if (targetTabsEl !== this.parentTabsEl) {
- return;
- }
- if (this.tab) {
- this.selected = this.tab === event.detail.tab;
- }
- else {
- this.getTabIndex().then((index) => {
- this.selected = index === event.detail.tab;
- });
- }
- event.stopPropagation();
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /**
- * Returns the index of the component item within the tab array.
- */
- async getTabIndex() {
- return Array.prototype.indexOf.call(nodeListToArray(this.el.parentElement.children).filter((el) => el.matches("calcite-tab")), this.el);
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- /**
- * @param tabIds
- * @param titleIds
- * @internal
- */
- async updateAriaInfo(tabIds = [], titleIds = []) {
- this.labeledBy = titleIds[tabIds.indexOf(this.el.id)] || null;
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "selected": ["selectedHandler"]
- }; }
- static get style() { return tabCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tab",
- "$members$": {
- "tab": [513],
- "active": [1540],
- "selected": [1540],
- "scale": [1537],
- "labeledBy": [32],
- "getTabIndex": [64],
- "updateAriaInfo": [64]
- },
- "$listeners$": [[16, "calciteInternalTabChange", "internalTabChangeHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["tab", "tab"], ["active", "active"], ["selected", "selected"], ["scale", "scale"]]
- }; }
- }
- const tabNavCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tab-nav{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tab-nav{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tab-nav{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tab-nav{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tab-nav:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tab-nav:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tab-nav-h{display:none}/*!@:host*/.sc-calcite-tab-nav-h{position:relative;display:flex}/*!@:host([scale=s])*/[scale=s].sc-calcite-tab-nav-h{min-block-size:1.5rem}/*!@:host([scale=m])*/[scale=m].sc-calcite-tab-nav-h{min-block-size:2rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-tab-nav-h{min-block-size:2.75rem}/*!@.tab-nav*/.tab-nav.sc-calcite-tab-nav{display:flex;inline-size:100%;justify-content:flex-start;overflow:auto}/*!@.tab-nav-active-indicator-container*/.tab-nav-active-indicator-container.sc-calcite-tab-nav{position:absolute;inset-inline:0px;inset-block-end:0px;block-size:0.125rem;inline-size:100%;overflow:hidden}/*!@.tab-nav-active-indicator*/.tab-nav-active-indicator.sc-calcite-tab-nav{position:absolute;inset-block-end:0px;display:block;block-size:0.125rem;background-color:var(--calcite-ui-brand);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;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{inset-block-end:unset;inset-block-start:0px}/*!@:host([position=bottom]) .tab-nav-active-indicator*/[position=bottom].sc-calcite-tab-nav-h .tab-nav-active-indicator.sc-calcite-tab-nav{inset-block-end:unset;inset-block-start: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{inset-block-start:0px;inset-block-end:unset}/*!@:host([position=bottom]) .tab-nav-active-indicator-container*/[position=bottom].sc-calcite-tab-nav-h .tab-nav-active-indicator-container.sc-calcite-tab-nav{inset-block-end:unset;inset-block-start:0px}/*!@:host([bordered]) .tab-nav-active-indicator-container*/[bordered].sc-calcite-tab-nav-h .tab-nav-active-indicator-container.sc-calcite-tab-nav{inset-block-end: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{inset-block-end:0;inset-block-start:unset}/*!@:host([bordered][position=bottom]) .tab-nav-active-indicator-container*/[bordered][position=bottom].sc-calcite-tab-nav-h .tab-nav-active-indicator-container.sc-calcite-tab-nav{inset-block-end:0;inset-block-start:unset}@media (forced-colors: active){/*!@.tab-nav-active-indicator*/.tab-nav-active-indicator.sc-calcite-tab-nav{background-color:highlight}}";
- /**
- * @slot - A slot for adding `calcite-tab-title`s.
- */
- class TabNav {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteTabChange = createEvent(this, "calciteTabChange", 6);
- this.calciteInternalTabChange = createEvent(this, "calciteInternalTabChange", 6);
- /**
- * @internal
- */
- this.scale = "m";
- /**
- * @internal
- */
- this.layout = "inline";
- /**
- * @internal
- */
- this.position = "bottom";
- /**
- * @internal
- */
- this.bordered = false;
- this.animationActiveDuration = 0.3;
- this.resizeObserver = createObserver();
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.handleContainerScroll = () => {
- // remove active indicator transition duration while container is scrolling to prevent wobble
- this.activeIndicatorEl.style.transitionDuration = "0s";
- this.updateOffsetPosition();
- };
- }
- async selectedTabChanged() {
- if (localStorage &&
- this.storageId &&
- this.selectedTab !== undefined &&
- this.selectedTab !== null) {
- localStorage.setItem(`calcite-tab-nav-${this.storageId}`, JSON.stringify(this.selectedTab));
- }
- this.calciteInternalTabChange.emit({
- tab: this.selectedTab
- });
- this.selectedTabEl = await this.getTabTitleById(this.selectedTab);
- }
- selectedTabElChanged() {
- this.updateOffsetPosition();
- this.updateActiveWidth();
- // reset the animation time on tab selection
- this.activeIndicatorEl.style.transitionDuration = `${this.animationActiveDuration}s`;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- this.parentTabsEl = this.el.closest("calcite-tabs");
- (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el);
- }
- disconnectedCallback() {
- var _a;
- (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- }
- componentWillLoad() {
- const storageKey = `calcite-tab-nav-${this.storageId}`;
- if (localStorage && this.storageId && localStorage.getItem(storageKey)) {
- const storedTab = JSON.parse(localStorage.getItem(storageKey));
- this.selectedTab = storedTab;
- }
- }
- componentWillRender() {
- const { parentTabsEl } = this;
- this.layout = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.layout;
- this.position = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.position;
- this.scale = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.scale;
- this.bordered = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.bordered;
- // fix issue with active tab-title not lining up with blue indicator
- if (this.selectedTabEl) {
- this.updateOffsetPosition();
- }
- }
- componentDidRender() {
- // if every tab title is active select the first tab.
- if (this.tabTitles.length &&
- this.tabTitles.every((title) => !title.active) &&
- !this.selectedTab) {
- this.tabTitles[0].getTabIdentifier().then((tab) => {
- this.calciteInternalTabChange.emit({
- tab
- });
- });
- }
- }
- render() {
- const dir = getElementDir(this.el);
- const width = `${this.indicatorWidth}px`;
- const offset = `${this.indicatorOffset}px`;
- const indicatorStyle = dir !== "rtl" ? { width, left: offset } : { width, right: offset };
- 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))));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- focusPreviousTabHandler(event) {
- const currentIndex = this.getIndexOfTabTitle(event.target, this.enabledTabTitles);
- const previousTab = this.enabledTabTitles[currentIndex - 1] ||
- this.enabledTabTitles[this.enabledTabTitles.length - 1];
- previousTab === null || previousTab === void 0 ? void 0 : previousTab.focus();
- event.stopPropagation();
- event.preventDefault();
- }
- focusNextTabHandler(event) {
- const currentIndex = this.getIndexOfTabTitle(event.target, this.enabledTabTitles);
- const nextTab = this.enabledTabTitles[currentIndex + 1] || this.enabledTabTitles[0];
- nextTab === null || nextTab === void 0 ? void 0 : nextTab.focus();
- event.stopPropagation();
- event.preventDefault();
- }
- internalActivateTabHandler(event) {
- this.selectedTab = event.detail.tab
- ? event.detail.tab
- : this.getIndexOfTabTitle(event.target);
- event.stopPropagation();
- event.preventDefault();
- }
- activateTabHandler(event) {
- this.calciteTabChange.emit({
- tab: this.selectedTab
- });
- event.stopPropagation();
- event.preventDefault();
- }
- /**
- * Check for active tabs on register and update selected
- *
- * @param event
- */
- updateTabTitles(event) {
- if (event.target.active) {
- this.selectedTab = event.detail;
- }
- }
- globalInternalTabChangeHandler(event) {
- if (this.syncId &&
- event.target !== this.el &&
- event.target.syncId === this.syncId &&
- this.selectedTab !== event.detail.tab) {
- this.selectedTab = event.detail.tab;
- }
- event.stopPropagation();
- }
- iconStartChangeHandler() {
- this.updateActiveWidth();
- }
- updateOffsetPosition() {
- var _a, _b, _c, _d, _e;
- const dir = getElementDir(this.el);
- const navWidth = (_a = this.activeIndicatorContainerEl) === null || _a === void 0 ? void 0 : _a.offsetWidth;
- const tabLeft = (_b = this.selectedTabEl) === null || _b === void 0 ? void 0 : _b.offsetLeft;
- const tabWidth = (_c = this.selectedTabEl) === null || _c === void 0 ? void 0 : _c.offsetWidth;
- const offsetRight = navWidth - (tabLeft + tabWidth);
- this.indicatorOffset =
- 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);
- }
- updateActiveWidth() {
- var _a;
- this.indicatorWidth = (_a = this.selectedTabEl) === null || _a === void 0 ? void 0 : _a.offsetWidth;
- }
- getIndexOfTabTitle(el, tabTitles = this.tabTitles) {
- // In most cases, since these indexes correlate with tab contents, we want to consider all tab titles.
- // However, when doing relative index operations, it makes sense to pass in this.enabledTabTitles as the 2nd arg.
- return tabTitles.indexOf(el);
- }
- async getTabTitleById(id) {
- return Promise.all(this.tabTitles.map((el) => el.getTabIdentifier())).then((ids) => {
- return this.tabTitles[ids.indexOf(id)];
- });
- }
- get tabTitles() {
- return filterDirectChildren(this.el, "calcite-tab-title");
- }
- get enabledTabTitles() {
- return filterDirectChildren(this.el, "calcite-tab-title:not([disabled])");
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "selectedTab": ["selectedTabChanged"],
- "selectedTabEl": ["selectedTabElChanged"]
- }; }
- static get style() { return tabNavCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tab-nav",
- "$members$": {
- "storageId": [513, "storage-id"],
- "syncId": [513, "sync-id"],
- "scale": [1537],
- "layout": [1537],
- "position": [1537],
- "bordered": [1540],
- "indicatorOffset": [1026, "indicator-offset"],
- "indicatorWidth": [1026, "indicator-width"],
- "selectedTab": [32],
- "selectedTabEl": [32]
- },
- "$listeners$": [[0, "calciteInternalTabsFocusPrevious", "focusPreviousTabHandler"], [0, "calciteInternalTabsFocusNext", "focusNextTabHandler"], [0, "calciteInternalTabsActivate", "internalActivateTabHandler"], [0, "calciteTabsActivate", "activateTabHandler"], [0, "calciteInternalTabTitleRegister", "updateTabTitles"], [16, "calciteInternalTabChange", "globalInternalTabChangeHandler"], [0, "calciteInternalTabIconChanged", "iconStartChangeHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["storageId", "storage-id"], ["syncId", "sync-id"], ["scale", "scale"], ["layout", "layout"], ["position", "position"], ["bordered", "bordered"]]
- }; }
- }
- const tabTitleCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tab-title{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tab-title{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tab-title{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tab-title{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tab-title:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tab-title:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tab-title-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-tab-title-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-tab-title-h{display:block;flex:0 1 auto;outline:2px solid transparent;outline-offset:2px;margin-inline-start:0px;margin-inline-end:1.25rem}/*!@:host([layout=center])*/[layout=center].sc-calcite-tab-title-h{margin-block:0px;margin-inline:1.25rem;text-align:center;flex-basis:12rem;margin:auto}/*!@:host([position=below]) .container*/[position=below].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-end-width:0px;border-block-start-width:2px;border-block-start-color:transparent;border-block-start-style:solid}/*!@:host([position=bottom]) .container*/[position=bottom].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-end-width:0px;border-block-start-width:2px;border-block-start-color:transparent;border-block-start-style:solid}/*!@:host .container*/.sc-calcite-tab-title-h .container.sc-calcite-tab-title{outline-color:transparent}/*!@:host(:focus) .container*/.sc-calcite-tab-title-h:focus .container.sc-calcite-tab-title{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@:host(:active) a, \n:host(:focus) a, \n: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);text-decoration-line:none}/*!@:host([selected]) .container*/[selected].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-color:transparent;color:var(--calcite-ui-text-1)}/*!@:host([disabled]) .container*/[disabled].sc-calcite-tab-title-h .container.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{margin-inline-end:1rem}/*!@:host([scale=s]) .container*/[scale=s].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}/*!@:host([scale=m]) .container*/[scale=m].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}/*!@:host([scale=l])*/[scale=l].sc-calcite-tab-title-h{margin-inline-end:1.5rem}/*!@:host([scale=l]) .container*/[scale=l].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}/*!@.container*/.container.sc-calcite-tab-title{box-sizing:border-box;display:flex;block-size:100%;inline-size:100%;cursor:pointer;-webkit-appearance:none;appearance:none;justify-content:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-block-end-width:2px;padding-inline:0px;padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-3);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-block-end-color:transparent;border-block-end-style:solid}/*!@.calcite-tab-title--icon*/.calcite-tab-title--icon.sc-calcite-tab-title{position:relative;margin:0px;display:inline-flex;align-self:center}/*!@.calcite-tab-title--icon svg*/.calcite-tab-title--icon.sc-calcite-tab-title svg.sc-calcite-tab-title{transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 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{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{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{margin-inline-end:0.5rem}/*!@:host([bordered])*/[bordered].sc-calcite-tab-title-h{margin-inline-end:0}/*!@:host([bordered][selected])*/[bordered][selected].sc-calcite-tab-title-h{box-shadow:inset 0px -2px var(--calcite-ui-foreground-1)}/*!@:host([bordered][selected][position=below])*/[bordered][selected][position=below].sc-calcite-tab-title-h{box-shadow:inset 0 2px 0 var(--calcite-ui-foreground-1)}/*!@:host([bordered][selected][position=bottom])*/[bordered][selected][position=bottom].sc-calcite-tab-title-h{box-shadow:inset 0 2px 0 var(--calcite-ui-foreground-1)}/*!@:host([bordered]:hover) .container, \n:host([bordered]:focus) .container, \n:host([bordered]:active) .container*/[bordered].sc-calcite-tab-title-h:hover .container.sc-calcite-tab-title,[bordered].sc-calcite-tab-title-h:focus .container.sc-calcite-tab-title,[bordered].sc-calcite-tab-title-h:active .container.sc-calcite-tab-title{position:relative}/*!@:host([bordered]:hover) .container*/[bordered].sc-calcite-tab-title-h:hover .container.sc-calcite-tab-title{background-color:var(--calcite-button-transparent-hover)}/*!@:host([bordered]) .container*/[bordered].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-end-style:unset;border-inline-start:1px solid transparent;border-inline-end:1px solid transparent}/*!@:host([bordered][position=below]) .container*/[bordered][position=below].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:unset}/*!@:host([bordered][position=bottom]) .container*/[bordered][position=bottom].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:unset}/*!@:host([selected][bordered]) .container*/[selected][bordered].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-inline-start-color:var(--calcite-ui-border-1);border-inline-end-color:var(--calcite-ui-border-1)}/*!@:host([bordered]) .container*/[bordered].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-inline:0.75rem}/*!@:host([bordered][scale=s]) .container*/[bordered][scale=s].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-inline:0.5rem}/*!@:host([bordered][scale=l]) .container*/[bordered][scale=l].sc-calcite-tab-title-h .container.sc-calcite-tab-title{padding-inline:1rem}@media (forced-colors: active){/*!@:host*/.sc-calcite-tab-title-h{outline-width:0;outline-offset:0}/*!@:host(:focus) .container*/.sc-calcite-tab-title-h:focus .container.sc-calcite-tab-title{outline-color:highlight}/*!@:host([bordered]) .container*/[bordered].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-end-style:solid}/*!@:host([bordered][position=below]) .container*/[bordered][position=below].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:solid}/*!@:host([bordered][position=bottom]) .container*/[bordered][position=bottom].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:solid}/*!@:host([bordered][selected]) .container*/[bordered][selected].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-end-style:none}/*!@:host([bordered][position=below][selected]) .container*/[bordered][position=below][selected].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:none}/*!@:host([bordered][position=bottom][selected]) .container*/[bordered][position=bottom][selected].sc-calcite-tab-title-h .container.sc-calcite-tab-title{border-block-start-style:none}}";
- /**
- * @slot - A slot for adding text.
- */
- class TabTitle {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteTabsActivate = createEvent(this, "calciteTabsActivate", 6);
- this.calciteInternalTabsActivate = createEvent(this, "calciteInternalTabsActivate", 6);
- this.calciteInternalTabsFocusNext = createEvent(this, "calciteInternalTabsFocusNext", 6);
- this.calciteInternalTabsFocusPrevious = createEvent(this, "calciteInternalTabsFocusPrevious", 6);
- this.calciteInternalTabTitleRegister = createEvent(this, "calciteInternalTabTitleRegister", 6);
- this.calciteInternalTabIconChanged = createEvent(this, "calciteInternalTabIconChanged", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, the component and its respective `calcite-tab` contents are selected.
- *
- * Only one tab can be selected within the `calcite-tabs` parent.
- *
- * @deprecated Use `selected` instead.
- */
- this.active = false;
- /**
- * When `true`, the component and its respective `calcite-tab` contents are selected.
- *
- * Only one tab can be selected within the `calcite-tabs` parent.
- */
- this.selected = false;
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /**
- * @internal
- */
- this.bordered = false;
- //--------------------------------------------------------------------------
- //
- // Private State/Props
- //
- //--------------------------------------------------------------------------
- /** watches for changing text content */
- this.mutationObserver = createObserver();
- /** determine if there is slotted text for styling purposes */
- this.hasText = false;
- this.resizeObserver = createObserver();
- this.guid = `calcite-tab-title-${guid()}`;
- }
- activeHandler(value) {
- this.selected = value;
- }
- selectedHandler(value) {
- this.active = value;
- if (this.selected) {
- this.emitActiveTab(false);
- }
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- const { selected, active } = this;
- if (selected) {
- this.active = selected;
- }
- else if (active) {
- this.activeHandler(active);
- }
- this.setupTextContentObserver();
- this.parentTabNavEl = this.el.closest("calcite-tab-nav");
- this.parentTabsEl = this.el.closest("calcite-tabs");
- }
- disconnectedCallback() {
- var _a, _b, _c;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- // Dispatching to body in order to be listened by other elements that are still connected to the DOM.
- (_b = document.body) === null || _b === void 0 ? void 0 : _b.dispatchEvent(new CustomEvent("calciteTabTitleUnregister", {
- detail: this.el
- }));
- (_c = this.resizeObserver) === null || _c === void 0 ? void 0 : _c.disconnect();
- }
- componentWillLoad() {
- if (this.tab && this.selected) {
- this.emitActiveTab(false);
- }
- }
- componentWillRender() {
- if (this.parentTabsEl) {
- this.layout = this.parentTabsEl.layout;
- this.position = this.parentTabsEl.position;
- this.scale = this.parentTabsEl.scale;
- this.bordered = this.parentTabsEl.bordered;
- }
- // handle case when tab-nav is only parent
- if (!this.parentTabsEl && this.parentTabNavEl) {
- this.position = getElementProp(this.parentTabNavEl, "position", this.position);
- this.scale = getElementProp(this.parentTabNavEl, "scale", this.scale);
- }
- }
- render() {
- const id = this.el.id || this.guid;
- const iconStartEl = (hAsync("calcite-icon", { class: "calcite-tab-title--icon icon-start", flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
- const iconEndEl = (hAsync("calcite-icon", { class: "calcite-tab-title--icon icon-end", flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
- return (hAsync(Host, { "aria-controls": this.controls, "aria-selected": toAriaBoolean(this.selected), id: id, role: "tab", tabIndex: this.selected ? 0 : -1 }, hAsync("div", { class: {
- container: true,
- "container--has-text": this.hasText
- }, ref: (el) => { var _a; return (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el); } }, this.iconStart ? iconStartEl : null, hAsync("slot", null), this.iconEnd ? iconEndEl : null)));
- }
- async componentDidLoad() {
- this.calciteInternalTabTitleRegister.emit(await this.getTabIdentifier());
- }
- componentDidRender() {
- updateHostInteraction(this, () => {
- return this.selected;
- });
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- internalTabChangeHandler(event) {
- const targetTabsEl = event
- .composedPath()
- .find((el) => el.tagName === "CALCITE-TABS");
- if (targetTabsEl !== this.parentTabsEl) {
- return;
- }
- if (this.tab) {
- this.selected = this.tab === event.detail.tab;
- }
- else {
- this.getTabIndex().then((index) => {
- this.selected = index === event.detail.tab;
- });
- }
- event.stopPropagation();
- }
- onClick() {
- this.emitActiveTab();
- }
- keyDownHandler(event) {
- switch (event.key) {
- case " ":
- case "Enter":
- this.emitActiveTab();
- event.preventDefault();
- break;
- case "ArrowRight":
- event.preventDefault();
- if (getElementDir(this.el) === "ltr") {
- this.calciteInternalTabsFocusNext.emit();
- }
- else {
- this.calciteInternalTabsFocusPrevious.emit();
- }
- break;
- case "ArrowLeft":
- event.preventDefault();
- if (getElementDir(this.el) === "ltr") {
- this.calciteInternalTabsFocusPrevious.emit();
- }
- else {
- this.calciteInternalTabsFocusNext.emit();
- }
- break;
- }
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /**
- * Returns the index of the title within the `calcite-tab-nav`.
- */
- async getTabIndex() {
- return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-tab-title"), this.el);
- }
- /**
- * @internal
- */
- async getTabIdentifier() {
- return this.tab ? this.tab : this.getTabIndex();
- }
- /**
- * @param tabIds
- * @param titleIds
- * @internal
- */
- async updateAriaInfo(tabIds = [], titleIds = []) {
- this.controls = tabIds[titleIds.indexOf(this.el.id)] || null;
- }
- updateHasText() {
- this.hasText = this.el.textContent.trim().length > 0;
- }
- setupTextContentObserver() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- }
- emitActiveTab(userTriggered = true) {
- if (this.disabled) {
- return;
- }
- const payload = { tab: this.tab };
- this.calciteInternalTabsActivate.emit(payload);
- if (userTriggered) {
- this.calciteTabsActivate.emit(payload);
- }
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "selected": ["selectedHandler"]
- }; }
- static get style() { return tabTitleCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tab-title",
- "$members$": {
- "active": [1540],
- "selected": [1540],
- "disabled": [516],
- "iconEnd": [513, "icon-end"],
- "iconFlipRtl": [513, "icon-flip-rtl"],
- "iconStart": [513, "icon-start"],
- "layout": [1537],
- "position": [1537],
- "scale": [1537],
- "bordered": [1540],
- "tab": [513],
- "controls": [32],
- "hasText": [32],
- "getTabIndex": [64],
- "getTabIdentifier": [64],
- "updateAriaInfo": [64]
- },
- "$listeners$": [[16, "calciteInternalTabChange", "internalTabChangeHandler"], [0, "click", "onClick"], [0, "keydown", "keyDownHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["selected", "selected"], ["disabled", "disabled"], ["iconEnd", "icon-end"], ["iconFlipRtl", "icon-flip-rtl"], ["iconStart", "icon-start"], ["layout", "layout"], ["position", "position"], ["scale", "scale"], ["bordered", "bordered"], ["tab", "tab"]]
- }; }
- }
- const SLOTS$4 = {
- tabNav: "tab-nav"
- };
- const tabsCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tabs{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tabs{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tabs{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tabs{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tabs:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tabs:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tabs-h{display:none}/*!@:host*/.sc-calcite-tabs-h{display:flex;flex-direction:column}/*!@:host([bordered])*/[bordered].sc-calcite-tabs-h{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-block-end:-1px}/*!@:host([bordered]:not([position=bottom])) ::slotted(calcite-tab-nav)*/.sc-calcite-tabs-h[bordered]:not([position=bottom]) .sc-calcite-tabs-s>calcite-tab-nav{margin-block-end:-1px}/*!@:host([bordered][position=below]) ::slotted(calcite-tab-nav)*/.sc-calcite-tabs-h[bordered][position=below] .sc-calcite-tabs-s>calcite-tab-nav{margin-block-start:-1px}/*!@:host([bordered][position=below])*/[bordered][position=below].sc-calcite-tabs-h{box-shadow:inset 0 1px 0 var(--calcite-ui-border-1), inset 0 -1px 0 var(--calcite-ui-border-1)}/*!@:host([bordered][position=bottom])*/[bordered][position=bottom].sc-calcite-tabs-h{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{flex-direction:column-reverse}/*!@:host([position=bottom])*/[position=bottom].sc-calcite-tabs-h{flex-direction:column-reverse}/*!@section*/section.sc-calcite-tabs{display:flex;flex-grow:1;overflow:hidden;border-block-start-width:1px;border-block-start-color:var(--calcite-ui-border-1);border-block-start-style:solid}/*!@:host([position=below]) section*/[position=below].sc-calcite-tabs-h section.sc-calcite-tabs{flex-direction:column-reverse;border-block-start-width:0px;border-block-end-width:1px;border-block-end-color:var(--calcite-ui-border-1)}/*!@:host([position=bottom]) section*/[position=bottom].sc-calcite-tabs-h section.sc-calcite-tabs{flex-direction:column-reverse;border-block-start-width:0px;border-block-end-width:1px;border-block-end-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-block-end-style:solid}/*!@:host([position=bottom]:not([bordered])) section*/[position=bottom].sc-calcite-tabs-h:not([bordered]) section.sc-calcite-tabs{border-block-end-style:solid}@media (forced-colors: active){/*!@:host([bordered]) section*/[bordered].sc-calcite-tabs-h section.sc-calcite-tabs{border-block-start-width:0px;border-block-end-width:1px}/*!@:host([position=below][bordered]) section*/[position=below][bordered].sc-calcite-tabs-h section.sc-calcite-tabs{border-block-start-width:1px;border-block-end-width:0px}/*!@:host([position=bottom][bordered]) section*/[position=bottom][bordered].sc-calcite-tabs-h section.sc-calcite-tabs{border-block-start-width:1px;border-block-end-width:0px}}";
- /**
- * @slot - A slot for adding `calcite-tab`s.
- * @slot tab-nav - A slot for adding a `calcite-tab-nav`.
- */
- class Tabs {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /**
- * Specifies the layout of the `calcite-tab-nav`, justifying the `calcite-tab-title`s to the start (`"inline"`), or across and centered (`"center"`).
- */
- this.layout = "inline";
- /**
- * Specifies the position of the component in relation to the `calcite-tab`s. The `"above"` and `"below"` values are deprecated.
- *
- */
- this.position = "top";
- /**
- * Specifies the size of the component.
- */
- this.scale = "m";
- /**
- * When `true`, the component will display with a folder style menu.
- */
- this.bordered = false;
- //--------------------------------------------------------------------------
- //
- // Events
- //
- //--------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- //
- // Private State/Props
- //
- //--------------------------------------------------------------------------
- /**
- *
- * Stores an array of ids of `<calcite-tab-titles>`s to match up ARIA
- * attributes.
- */
- this.titles = [];
- /**
- *
- * Stores an array of ids of `<calcite-tab>`s to match up ARIA attributes.
- */
- this.tabs = [];
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- render() {
- return (hAsync(Fragment, null, hAsync("slot", { name: SLOTS$4.tabNav }), hAsync("section", null, hAsync("slot", null))));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- /**
- * @param event
- * @internal
- */
- calciteInternalTabTitleRegister(event) {
- this.titles = [...this.titles, event.target];
- this.registryHandler();
- event.stopPropagation();
- }
- /**
- * @param event
- * @internal
- */
- calciteTabTitleUnregister(event) {
- this.titles = this.titles.filter((el) => el !== event.detail);
- this.registryHandler();
- event.stopPropagation();
- }
- /**
- * @param event
- * @internal
- */
- calciteInternalTabRegister(event) {
- this.tabs = [...this.tabs, event.target];
- this.registryHandler();
- event.stopPropagation();
- }
- /**
- * @param event
- * @internal
- */
- calciteTabUnregister(event) {
- this.tabs = this.tabs.filter((el) => el !== event.detail);
- this.registryHandler();
- event.stopPropagation();
- }
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- /**
- *
- * Matches up elements from the internal `tabs` and `titles` to automatically
- * update the ARIA attributes and link `<calcite-tab>` and
- * `<calcite-tab-title>` components.
- */
- async registryHandler() {
- let tabIds;
- let titleIds;
- // determine if we are using `tab` based or `index` based tab identifiers.
- if (this.tabs.some((el) => el.tab) || this.titles.some((el) => el.tab)) {
- // if we are using `tab` based identifiers sort by `tab` to account for
- // possible out of order tabs and get the id of each tab
- tabIds = this.tabs.sort((a, b) => a.tab.localeCompare(b.tab)).map((el) => el.id);
- titleIds = this.titles.sort((a, b) => a.tab.localeCompare(b.tab)).map((el) => el.id);
- }
- else {
- // if we are using index based tabs then the `<calcite-tab>` and
- // `<calcite-tab-title>` might have been rendered out of order so the
- // order of `this.tabs` and `this.titles` might not reflect the DOM state,
- // and might not match each other so we need to get the index of all the
- // tabs and titles in the DOM order to match them up as a source of truth
- const tabDomIndexes = await Promise.all(this.tabs.map((el) => el.getTabIndex()));
- const titleDomIndexes = await Promise.all(this.titles.map((el) => el.getTabIndex()));
- // once we have the DOM order as a source of truth we can build the
- // matching tabIds and titleIds arrays
- tabIds = tabDomIndexes.reduce((ids, indexInDOM, registryIndex) => {
- ids[indexInDOM] = this.tabs[registryIndex].id;
- return ids;
- }, []);
- titleIds = titleDomIndexes.reduce((ids, indexInDOM, registryIndex) => {
- ids[indexInDOM] = this.titles[registryIndex].id;
- return ids;
- }, []);
- }
- // pass all our new aria information to each `<calcite-tab>` and
- // `<calcite-tab-title>` which will check if they can update their internal
- // `controlled` or `labeledBy` states and re-render if necessary
- this.tabs.forEach((el) => el.updateAriaInfo(tabIds, titleIds));
- this.titles.forEach((el) => el.updateAriaInfo(tabIds, titleIds));
- }
- get el() { return getElement(this); }
- static get style() { return tabsCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tabs",
- "$members$": {
- "layout": [513],
- "position": [513],
- "scale": [513],
- "bordered": [1540],
- "titles": [32],
- "tabs": [32]
- },
- "$listeners$": [[0, "calciteInternalTabTitleRegister", "calciteInternalTabTitleRegister"], [16, "calciteTabTitleUnregister", "calciteTabTitleUnregister"], [0, "calciteInternalTabRegister", "calciteInternalTabRegister"], [16, "calciteTabUnregister", "calciteTabUnregister"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["layout", "layout"], ["position", "position"], ["scale", "scale"], ["bordered", "bordered"]]
- }; }
- }
- const SLOTS$3 = {
- contentStart: "content-start",
- contentEnd: "content-end"
- };
- const tileCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tile{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tile{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tile{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tile{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tile:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tile:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tile-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-tile-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-tile-h{box-sizing:border-box;display:inline-block;-webkit-user-select:none;user-select:none;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3);transition-duration:150ms;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:flex;flex:1 1 auto;flex-direction:column;justify-content:center;gap:0.5rem;inline-size:10%}/*!@:host .content-container*/.sc-calcite-tile-h .content-container.sc-calcite-tile{display:flex;inline-size:100%;flex:1 1 auto;align-items:stretch;padding:0px;color:var(--calcite-ui-text-2);outline-color:transparent}/*!@:host .content-slot-container*/.sc-calcite-tile-h .content-slot-container.sc-calcite-tile{display:flex;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);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host .large-visual*/.sc-calcite-tile-h .large-visual.sc-calcite-tile{align-items:center;text-align:center;min-block-size:12rem}/*!@:host .large-visual .icon*/.sc-calcite-tile-h .large-visual.sc-calcite-tile .icon.sc-calcite-tile{display:flex;justify-content:center;align-self:flex-end}/*!@:host .large-visual .content-container*/.sc-calcite-tile-h .large-visual.sc-calcite-tile .content-container.sc-calcite-tile{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);transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}/*!@:host(:not([embed]))*/.sc-calcite-tile-h:not([embed]){padding:0.75rem;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;box-shadow:0 0 0 2px var(--calcite-ui-brand)}/*!@:host(:not([embed])[href]:active)*/.sc-calcite-tile-h:not([embed])[href]:active{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:flex;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]) ::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, \n: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, \n: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)}";
- /**
- * @slot content-start - A slot for adding non-actionable elements before the component's content.
- * @slot content-end - A slot for adding non-actionable elements after the component's content.
- */
- class Tile {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, the component is active.
- */
- this.active = false;
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * The component's embed mode.
- *
- * When `true`, renders without a border and padding for use by other components.
- */
- this.embed = false;
- /**
- * The focused state of the component.
- *
- * @internal
- */
- this.focused = false;
- /** When `true`, the component is not displayed and is not focusable. */
- this.hidden = false;
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderTile() {
- const { icon, el, heading, description } = this;
- const isLargeVisual = heading && icon && !description;
- const iconStyle = isLargeVisual
- ? {
- height: "64px",
- width: "64px"
- }
- : undefined;
- 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)));
- }
- render() {
- return (hAsync(Fragment, null, this.href ? (hAsync("calcite-link", { disabled: this.disabled, href: this.href }, this.renderTile())) : (this.renderTile())));
- }
- get el() { return getElement(this); }
- static get style() { return tileCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tile",
- "$members$": {
- "active": [516],
- "description": [513],
- "disabled": [516],
- "embed": [516],
- "focused": [516],
- "heading": [513],
- "hidden": [516],
- "href": [513],
- "icon": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["active", "active"], ["description", "description"], ["disabled", "disabled"], ["embed", "embed"], ["focused", "focused"], ["heading", "heading"], ["hidden", "hidden"], ["href", "href"], ["icon", "icon"]]
- }; }
- }
- const CSS$6 = {
- checked: "checked",
- description: "description",
- descriptionOnly: "description-only",
- disabled: "disabled",
- heading: "heading",
- headingOnly: "heading-only",
- icon: "icon",
- iconOnly: "icon-only",
- inputAlignmentEnd: "input-alignment-end",
- inputAlignmentStart: "input-alignment-start",
- inputEnabled: "input-enabled",
- largeVisual: "large-visual",
- widthAuto: "width-auto",
- widthFull: "width-full"
- };
- const tileSelectCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tile-select{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tile-select{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tile-select{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tile-select{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tile-select:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tile-select:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tile-select-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-tile-select-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@: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);box-shadow:0 0 0 1px var(--calcite-ui-border-2);box-sizing:border-box;cursor:pointer;display:inline-block;block-size:100%;max-inline-size:300px;padding:0.75rem;position:relative;vertical-align:top;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}/*!@:host .container.checked*/.sc-calcite-tile-select-h .container.checked.sc-calcite-tile-select{z-index:1;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{align-items:center}/*!@:host .container:not(.input-enabled) ::slotted(calcite-checkbox), \n: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;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}/*!@:host .container.focused*/.sc-calcite-tile-select-h .container.focused.sc-calcite-tile-select{outline-color:transparent}/*!@:host .container.focused:not(.disabled):not(.input-enabled)*/.sc-calcite-tile-select-h .container.focused.sc-calcite-tile-select:not(.disabled):not(.input-enabled){outline:2px solid var(--calcite-ui-brand);outline-offset:-4px;box-shadow:0 0 0 1px var(--calcite-ui-brand), inset 0 0 0 2px var(--calcite-ui-foreground-1)}/*!@: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: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{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: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:flex;max-inline-size: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{flex:1 1 auto}/*!@:host(:hover) .container:not(.input-enabled)*/.sc-calcite-tile-select-h:hover .container.sc-calcite-tile-select:not(.input-enabled){box-shadow:0 0 0 1px var(--calcite-ui-brand)}/*!@: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}";
- /**
- * @slot - A slot for adding custom content.
- */
- class TileSelect {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteTileSelectChange = createEvent(this, "calciteTileSelectChange", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, the component is checked. */
- this.checked = false;
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /** When `true`, the component is not displayed and is not focusable or checkable. */
- this.hidden = false;
- /** When `true`, displays an interactive input based on the `type` property. */
- this.inputEnabled = false;
- /** When `inputEnabled` is `true`, specifies the placement of the interactive input on the component. */
- this.inputAlignment = "start";
- /**
- * The selection mode of the component.
- *
- * Use radio for single selection, and checkbox for multiple selections.
- */
- this.type = "radio";
- /** Specifies the width of the component. */
- this.width = "auto";
- this.guid = `calcite-tile-select-${guid()}`;
- //--------------------------------------------------------------------------
- //
- // State
- //
- //--------------------------------------------------------------------------
- /** The focused state of the tile-select. */
- this.focused = false;
- }
- checkedChanged(newChecked) {
- this.input.checked = newChecked;
- }
- nameChanged(newName) {
- this.input.name = newName;
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.input) === null || _a === void 0 ? void 0 : _a.setFocus();
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- checkboxChangeHandler(event) {
- const checkbox = event.target;
- if (checkbox === this.input) {
- this.checked = checkbox.checked;
- }
- event.stopPropagation();
- this.calciteTileSelectChange.emit();
- }
- checkboxFocusBlurHandler(event) {
- const checkbox = event.target;
- if (checkbox === this.input) {
- this.focused = event.detail;
- }
- event.stopPropagation();
- }
- radioButtonChangeHandler(event) {
- const radioButton = event.target;
- if (radioButton === this.input) {
- this.checked = radioButton.checked;
- }
- event.stopPropagation();
- this.calciteTileSelectChange.emit();
- }
- radioButtonCheckedChangeHandler(event) {
- const radioButton = event.target;
- if (radioButton === this.input) {
- this.checked = radioButton.checked;
- }
- event.stopPropagation();
- }
- radioButtonFocusBlurHandler(event) {
- const radioButton = event.target;
- if (radioButton === this.input) {
- this.focused = radioButton.focused;
- }
- event.stopPropagation();
- }
- click(event) {
- const target = event.target;
- const targets = ["calcite-tile", "calcite-tile-select"];
- if (targets.includes(target.localName)) {
- this.input.click();
- }
- }
- mouseenter() {
- if (this.input.localName === "calcite-radio-button") {
- this.input.hovered = true;
- }
- if (this.input.localName === "calcite-checkbox") {
- this.input.hovered = true;
- }
- }
- mouseleave() {
- if (this.input.localName === "calcite-radio-button") {
- this.input.hovered = false;
- }
- if (this.input.localName === "calcite-checkbox") {
- this.input.hovered = false;
- }
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- this.renderInput();
- }
- disconnectedCallback() {
- this.input.parentNode.removeChild(this.input);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderInput() {
- this.input = document.createElement(this.type === "radio" ? "calcite-radio-button" : "calcite-checkbox");
- this.input.checked = this.checked;
- this.input.disabled = this.disabled;
- this.input.hidden = this.hidden;
- this.input.id = this.guid;
- this.input.label = this.heading || this.name || "";
- if (this.name) {
- this.input.name = this.name;
- }
- if (this.value) {
- this.input.value = this.value != null ? this.value.toString() : "";
- }
- this.el.insertAdjacentElement("beforeend", this.input);
- }
- render() {
- const { checked, description, disabled, focused, heading, icon, inputAlignment, inputEnabled, width } = this;
- return (hAsync("div", { class: {
- checked,
- container: true,
- [CSS$6.description]: Boolean(description),
- [CSS$6.descriptionOnly]: Boolean(!heading && !icon && description),
- disabled,
- focused,
- [CSS$6.heading]: Boolean(heading),
- [CSS$6.headingOnly]: heading && !icon && !description,
- [CSS$6.icon]: Boolean(icon),
- [CSS$6.iconOnly]: !heading && icon && !description,
- [CSS$6.inputAlignmentEnd]: inputAlignment === "end",
- [CSS$6.inputAlignmentStart]: inputAlignment === "start",
- [CSS$6.inputEnabled]: inputEnabled,
- [CSS$6.largeVisual]: heading && icon && !description,
- [CSS$6.widthAuto]: width === "auto",
- [CSS$6.widthFull]: width === "full"
- } }, hAsync("calcite-tile", { active: checked, description: description, embed: true, heading: heading, icon: icon }), hAsync("slot", null)));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "checked": ["checkedChanged"],
- "name": ["nameChanged"]
- }; }
- static get style() { return tileSelectCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tile-select",
- "$members$": {
- "checked": [1540],
- "description": [513],
- "disabled": [516],
- "heading": [513],
- "hidden": [516],
- "icon": [513],
- "name": [520],
- "inputEnabled": [516, "input-enabled"],
- "inputAlignment": [513, "input-alignment"],
- "type": [513],
- "value": [8],
- "width": [513],
- "focused": [32],
- "setFocus": [64]
- },
- "$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, "pointerenter", "mouseenter"], [1, "pointerleave", "mouseleave"]],
- "$lazyBundleId$": "-",
- "$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"]]
- }; }
- }
- const tileSelectGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tile-select-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tile-select-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tile-select-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tile-select-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tile-select-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tile-select-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tile-select-group-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-tile-select-group-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-tile-select-group-h{display:flex;flex-wrap:wrap}/*!@:host ::slotted(calcite-tile-select)*/.sc-calcite-tile-select-group-h .sc-calcite-tile-select-group-s>calcite-tile-select{margin-block-end:1px;margin-inline-end:1px}/*!@:host([layout=vertical])*/[layout=vertical].sc-calcite-tile-select-group-h{flex-direction:column}/*!@: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}";
- /**
- * @slot - A slot for adding `calcite-tile-select`s.
- */
- class TileSelectGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** When `true`, interaction is prevented and the component is displayed with lower opacity. */
- this.disabled = false;
- /**
- * Defines the layout of the component.
- *
- * Use `"horizontal"` for rows, and `"vertical"` for a single column.
- */
- this.layout = "horizontal";
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentDidRender() {
- updateHostInteraction(this);
- }
- render() {
- return hAsync("slot", null);
- }
- get el() { return getElement(this); }
- static get style() { return tileSelectGroupCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tile-select-group",
- "$members$": {
- "disabled": [516],
- "layout": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["layout", "layout"]]
- }; }
- }
- const CSS$5 = {
- button: "button",
- buttonBottomLeft: "button--bottom-left",
- buttonBottomRight: "button--bottom-right",
- buttonHourDown: "button--hour-down",
- buttonHourUp: "button--hour-up",
- buttonMeridiemDown: "button--meridiem-down",
- buttonMeridiemUp: "button--meridiem-up",
- buttonMinuteDown: "button--minute-down",
- buttonMinuteUp: "button--minute-up",
- buttonSecondDown: "button--second-down",
- buttonSecondUp: "button--second-up",
- buttonTopLeft: "button--top-left",
- buttonTopRight: "button--top-right",
- column: "column",
- delimiter: "delimiter",
- hour: "hour",
- input: "input",
- meridiem: "meridiem",
- minute: "minute",
- second: "second",
- showMeridiem: "show-meridiem",
- showSecond: "show-second",
- "scale-s": "scale-s",
- "scale-m": "scale-m",
- "scale-l": "scale-l",
- timePicker: "time-picker",
- meridiemStart: "meridiem--start"
- };
- const TEXT$2 = {
- hour: "Hour",
- hourDown: "Decrease hour",
- hourUp: "Increase hour",
- meridiem: "AM/PM",
- meridiemDown: "Decrease AM/PM",
- meridiemUp: "Increase AM/PM",
- minute: "Minute",
- minuteDown: "Decrease minute",
- minuteUp: "Increase minute",
- second: "Second",
- secondDown: "Decrease second",
- secondUp: "Increase second"
- };
- const timePickerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-time-picker{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-time-picker{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-time-picker{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-time-picker{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-time-picker:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-time-picker:root{--calcite-floating-ui-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:flex;-webkit-user-select:none;user-select:none;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);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:flex;flex-direction:column}/*!@.time-picker .meridiem--start*/.time-picker.sc-calcite-time-picker .meridiem--start.sc-calcite-time-picker{order:-1}/*!@.time-picker .button*/.time-picker.sc-calcite-time-picker .button.sc-calcite-time-picker{display:inline-flex;cursor:pointer;align-items: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-start-start-radius:var(--calcite-border-radius)}/*!@.time-picker .button.bottom-left*/.time-picker.sc-calcite-time-picker .button.bottom-left.sc-calcite-time-picker{border-end-start-radius:var(--calcite-border-radius)}/*!@.time-picker .button.top-right*/.time-picker.sc-calcite-time-picker .button.top-right.sc-calcite-time-picker{border-start-end-radius:var(--calcite-border-radius)}/*!@.time-picker .button.bottom-right*/.time-picker.sc-calcite-time-picker .button.bottom-right.sc-calcite-time-picker{border-end-end-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:inline-flex;cursor:pointer;align-items: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{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;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, \n.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-inline:0.75rem;padding-block: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{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, \n.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-inline:1rem;padding-block: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{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, \n.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-inline:1.25rem;padding-block: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{padding-inline-end:1.25rem}";
- function capitalize(str) {
- return str.charAt(0).toUpperCase() + str.slice(1);
- }
- class TimePicker {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalTimePickerBlur = createEvent(this, "calciteInternalTimePickerBlur", 6);
- this.calciteInternalTimePickerChange = createEvent(this, "calciteInternalTimePickerChange", 6);
- this.calciteInternalTimePickerFocus = createEvent(this, "calciteInternalTimePickerFocus", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * Accessible name for the component's hour input.
- *
- * @default "Hour"
- */
- this.intlHour = TEXT$2.hour;
- /**
- * Accessible name for the component's hour down button.
- *
- * @default "Decrease hour"
- */
- this.intlHourDown = TEXT$2.hourDown;
- /**
- * Accessible name for the component's hour up button.
- *
- * @default "Increase hour"
- */
- this.intlHourUp = TEXT$2.hourUp;
- /**
- * Accessible name for the component's meridiem (AM/PM) input.
- *
- * @default "AM/PM"
- */
- this.intlMeridiem = TEXT$2.meridiem;
- /**
- * Accessible name for the component's meridiem (AM/PM) down button.
- *
- * @default "Decrease AM/PM"
- */
- this.intlMeridiemDown = TEXT$2.meridiemDown;
- /**
- * Accessible name for the component's meridiem (AM/PM) up button.
- *
- * @default "Increase AM/PM"
- */
- this.intlMeridiemUp = TEXT$2.meridiemUp;
- /**
- * Accessible name for the component's minute input.
- *
- * @default "Minute"
- */
- this.intlMinute = TEXT$2.minute;
- /**
- * Accessible name for the component's minute down button.
- *
- * @default "Decrease minute"
- */
- this.intlMinuteDown = TEXT$2.minuteDown;
- /**
- * Accessible name for the component's minute up button.
- *
- * @default "Increase minute"
- */
- this.intlMinuteUp = TEXT$2.minuteUp;
- /**
- * Accessible name for the component's second input.
- *
- * @default "Second"
- */
- this.intlSecond = TEXT$2.second;
- /**
- * Accessible name for the component's second down button.
- *
- * @default "Decrease second"
- */
- this.intlSecondDown = TEXT$2.secondDown;
- /**
- * Accessible name for the component's second up button.
- *
- * @default "Increase second"
- */
- this.intlSecondUp = TEXT$2.secondUp;
- /** Specifies the size of the component. */
- this.scale = "m";
- /** Specifies the granularity the `value` must adhere to (in seconds). */
- this.step = 60;
- /** The component's value in UTC (always 24-hour format). */
- this.value = null;
- // --------------------------------------------------------------------------
- //
- // State
- //
- // --------------------------------------------------------------------------
- this.effectiveLocale = "";
- this.showSecond = this.step < 60;
- this.decrementHour = () => {
- const newHour = !this.hour ? 0 : this.hour === "00" ? 23 : parseInt(this.hour) - 1;
- this.setValuePart("hour", newHour);
- };
- this.decrementMeridiem = () => {
- const newMeridiem = this.meridiem === "PM" ? "AM" : "PM";
- this.setValuePart("meridiem", newMeridiem);
- };
- this.decrementMinuteOrSecond = (key) => {
- let newValue;
- if (isValidNumber(this[key])) {
- const valueAsNumber = parseInt(this[key]);
- newValue = valueAsNumber === 0 ? 59 : valueAsNumber - 1;
- }
- else {
- newValue = 59;
- }
- this.setValuePart(key, newValue);
- };
- this.decrementMinute = () => {
- this.decrementMinuteOrSecond("minute");
- };
- this.decrementSecond = () => {
- this.decrementMinuteOrSecond("second");
- };
- this.focusHandler = (event) => {
- this.activeEl = event.currentTarget;
- };
- this.hourDownButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.decrementHour();
- }
- };
- this.hourKeyDownHandler = (event) => {
- const { key } = event;
- if (numberKeys.includes(key)) {
- const keyAsNumber = parseInt(key);
- let newHour;
- if (isValidNumber(this.hour)) {
- switch (this.hourCycle) {
- case "12":
- newHour =
- this.hour === "01" && keyAsNumber >= 0 && keyAsNumber <= 2
- ? `1${keyAsNumber}`
- : keyAsNumber;
- break;
- case "24":
- if (this.hour === "01") {
- newHour = `1${keyAsNumber}`;
- }
- else if (this.hour === "02" && keyAsNumber >= 0 && keyAsNumber <= 3) {
- newHour = `2${keyAsNumber}`;
- }
- else {
- newHour = keyAsNumber;
- }
- break;
- }
- }
- else {
- newHour = keyAsNumber;
- }
- this.setValuePart("hour", newHour);
- }
- else {
- switch (key) {
- case "Backspace":
- case "Delete":
- this.setValuePart("hour", null);
- break;
- case "ArrowDown":
- event.preventDefault();
- this.decrementHour();
- break;
- case "ArrowUp":
- event.preventDefault();
- this.incrementHour();
- break;
- case " ":
- event.preventDefault();
- break;
- }
- }
- };
- this.hourUpButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.incrementHour();
- }
- };
- this.incrementMeridiem = () => {
- const newMeridiem = this.meridiem === "AM" ? "PM" : "AM";
- this.setValuePart("meridiem", newMeridiem);
- };
- this.incrementHour = () => {
- const newHour = isValidNumber(this.hour)
- ? this.hour === "23"
- ? 0
- : parseInt(this.hour) + 1
- : 1;
- this.setValuePart("hour", newHour);
- };
- this.incrementMinuteOrSecond = (key) => {
- const newValue = isValidNumber(this[key])
- ? this[key] === "59"
- ? 0
- : parseInt(this[key]) + 1
- : 0;
- this.setValuePart(key, newValue);
- };
- this.incrementMinute = () => {
- this.incrementMinuteOrSecond("minute");
- };
- this.incrementSecond = () => {
- this.incrementMinuteOrSecond("second");
- };
- this.meridiemDownButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.decrementMeridiem();
- }
- };
- this.meridiemKeyDownHandler = (event) => {
- switch (event.key) {
- case "a":
- this.setValuePart("meridiem", "AM");
- break;
- case "p":
- this.setValuePart("meridiem", "PM");
- break;
- case "Backspace":
- case "Delete":
- this.setValuePart("meridiem", null);
- break;
- case "ArrowUp":
- event.preventDefault();
- this.incrementMeridiem();
- break;
- case "ArrowDown":
- event.preventDefault();
- this.decrementMeridiem();
- break;
- case " ":
- event.preventDefault();
- break;
- }
- };
- this.meridiemUpButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.incrementMeridiem();
- }
- };
- this.minuteDownButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.decrementMinute();
- }
- };
- this.minuteKeyDownHandler = (event) => {
- const { key } = event;
- if (numberKeys.includes(key)) {
- const keyAsNumber = parseInt(key);
- let newMinute;
- if (isValidNumber(this.minute) && this.minute.startsWith("0")) {
- const minuteAsNumber = parseInt(this.minute);
- newMinute =
- minuteAsNumber > maxTenthForMinuteAndSecond
- ? keyAsNumber
- : `${minuteAsNumber}${keyAsNumber}`;
- }
- else {
- newMinute = keyAsNumber;
- }
- this.setValuePart("minute", newMinute);
- }
- else {
- switch (key) {
- case "Backspace":
- case "Delete":
- this.setValuePart("minute", null);
- break;
- case "ArrowDown":
- event.preventDefault();
- this.decrementMinute();
- break;
- case "ArrowUp":
- event.preventDefault();
- this.incrementMinute();
- break;
- case " ":
- event.preventDefault();
- break;
- }
- }
- };
- this.minuteUpButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.incrementMinute();
- }
- };
- this.secondDownButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.decrementSecond();
- }
- };
- this.secondKeyDownHandler = (event) => {
- const { key } = event;
- if (numberKeys.includes(key)) {
- const keyAsNumber = parseInt(key);
- let newSecond;
- if (isValidNumber(this.second) && this.second.startsWith("0")) {
- const secondAsNumber = parseInt(this.second);
- newSecond =
- secondAsNumber > maxTenthForMinuteAndSecond
- ? keyAsNumber
- : `${secondAsNumber}${keyAsNumber}`;
- }
- else {
- newSecond = keyAsNumber;
- }
- this.setValuePart("second", newSecond);
- }
- else {
- switch (key) {
- case "Backspace":
- case "Delete":
- this.setValuePart("second", null);
- break;
- case "ArrowDown":
- event.preventDefault();
- this.decrementSecond();
- break;
- case "ArrowUp":
- event.preventDefault();
- this.incrementSecond();
- break;
- case " ":
- event.preventDefault();
- break;
- }
- }
- };
- this.secondUpButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.incrementSecond();
- }
- };
- this.setHourEl = (el) => (this.hourEl = el);
- this.setMeridiemEl = (el) => (this.meridiemEl = el);
- this.setMinuteEl = (el) => (this.minuteEl = el);
- this.setSecondEl = (el) => (this.secondEl = el);
- this.setValue = (value, emit = true) => {
- if (isValidTime(value)) {
- const { hour, minute, second } = parseTimeString(value);
- const { effectiveLocale: locale, numberingSystem } = this;
- const { localizedHour, localizedHourSuffix, localizedMinute, localizedMinuteSuffix, localizedSecond, localizedSecondSuffix, localizedMeridiem } = localizeTimeStringToParts({ value, locale, numberingSystem });
- this.localizedHour = localizedHour;
- this.localizedHourSuffix = localizedHourSuffix;
- this.localizedMinute = localizedMinute;
- this.localizedMinuteSuffix = localizedMinuteSuffix;
- this.localizedSecond = localizedSecond;
- this.localizedSecondSuffix = localizedSecondSuffix;
- this.hour = hour;
- this.minute = minute;
- this.second = second;
- if (localizedMeridiem) {
- this.localizedMeridiem = localizedMeridiem;
- this.meridiem = getMeridiem(this.hour);
- const formatParts = getTimeParts({ value, locale, numberingSystem });
- this.meridiemOrder = this.getMeridiemOrder(formatParts);
- }
- }
- else {
- this.hour = null;
- this.localizedHour = null;
- this.localizedHourSuffix = null;
- this.localizedMeridiem = null;
- this.localizedMinute = null;
- this.localizedMinuteSuffix = null;
- this.localizedSecond = null;
- this.localizedSecondSuffix = null;
- this.meridiem = null;
- this.minute = null;
- this.second = null;
- this.value = null;
- }
- if (emit) {
- this.calciteInternalTimePickerChange.emit();
- }
- };
- this.setValuePart = (key, value, emit = true) => {
- var _a;
- const { effectiveLocale: locale, numberingSystem } = this;
- if (key === "meridiem") {
- this.meridiem = value;
- if (isValidNumber(this.hour)) {
- const hourAsNumber = parseInt(this.hour);
- switch (value) {
- case "AM":
- if (hourAsNumber >= 12) {
- this.hour = formatTimePart(hourAsNumber - 12);
- }
- break;
- case "PM":
- if (hourAsNumber < 12) {
- this.hour = formatTimePart(hourAsNumber + 12);
- }
- break;
- }
- this.localizedHour = localizeTimePart({
- value: this.hour,
- part: "hour",
- locale,
- numberingSystem
- });
- }
- }
- else {
- this[key] = typeof value === "number" ? formatTimePart(value) : value;
- this[`localized${capitalize(key)}`] = localizeTimePart({
- value: this[key],
- part: key,
- locale,
- numberingSystem
- });
- }
- if (this.hour && this.minute) {
- const showSeconds = this.second && this.showSecond;
- this.value = `${this.hour}:${this.minute}:${showSeconds ? this.second : "00"}`;
- }
- else {
- this.value = null;
- }
- this.localizedMeridiem = this.value
- ? ((_a = localizeTimeStringToParts({ value: this.value, locale, numberingSystem })) === null || _a === void 0 ? void 0 : _a.localizedMeridiem) || null
- : localizeTimePart({ value: this.meridiem, part: "meridiem", locale, numberingSystem });
- if (emit) {
- this.calciteInternalTimePickerChange.emit();
- }
- };
- }
- localeChanged() {
- updateEffectiveLocale(this);
- }
- valueWatcher(newValue) {
- this.setValue(newValue, false);
- }
- effectiveLocaleWatcher() {
- this.updateLocale();
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- hostBlurHandler() {
- this.calciteInternalTimePickerBlur.emit();
- }
- hostFocusHandler() {
- this.calciteInternalTimePickerFocus.emit();
- }
- keyDownHandler(event) {
- const { defaultPrevented, key } = event;
- if (defaultPrevented) {
- return;
- }
- switch (this.activeEl) {
- case this.hourEl:
- if (key === "ArrowRight") {
- this.setFocus("minute");
- event.preventDefault();
- }
- break;
- case this.minuteEl:
- switch (key) {
- case "ArrowLeft":
- this.setFocus("hour");
- event.preventDefault();
- break;
- case "ArrowRight":
- if (this.step !== 60) {
- this.setFocus("second");
- event.preventDefault();
- }
- else if (this.hourCycle === "12") {
- this.setFocus("meridiem");
- event.preventDefault();
- }
- break;
- }
- break;
- case this.secondEl:
- switch (key) {
- case "ArrowLeft":
- this.setFocus("minute");
- event.preventDefault();
- break;
- case "ArrowRight":
- if (this.hourCycle === "12") {
- this.setFocus("meridiem");
- event.preventDefault();
- }
- break;
- }
- break;
- case this.meridiemEl:
- switch (key) {
- case "ArrowLeft":
- if (this.step !== 60) {
- this.setFocus("second");
- event.preventDefault();
- }
- else {
- this.setFocus("minute");
- event.preventDefault();
- }
- break;
- }
- break;
- }
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /**
- * Sets focus on the component.
- *
- * @param target
- */
- async setFocus(target) {
- var _a;
- (_a = this[`${target || "hour"}El`]) === null || _a === void 0 ? void 0 : _a.focus();
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- buttonActivated(event) {
- const { key } = event;
- if (key === " ") {
- event.preventDefault();
- }
- return isActivationKey(key);
- }
- getMeridiemOrder(formatParts) {
- const locale = this.effectiveLocale;
- const isRTLKind = locale === "ar" || locale === "he";
- if (formatParts && !isRTLKind) {
- const index = formatParts.findIndex((parts) => {
- return parts.value === this.localizedMeridiem;
- });
- return index;
- }
- return 0;
- }
- updateLocale() {
- this.hourCycle = getLocaleHourCycle(this.effectiveLocale, this.numberingSystem);
- this.setValue(this.value, false);
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectLocalized(this);
- this.updateLocale();
- this.meridiemOrder = this.getMeridiemOrder(getTimeParts({
- value: "0:00:00",
- locale: this.effectiveLocale,
- numberingSystem: this.numberingSystem
- }));
- }
- disconnectedCallback() {
- disconnectLocalized(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const hourIsNumber = isValidNumber(this.hour);
- const iconScale = this.scale === "s" || this.scale === "m" ? "s" : "m";
- const minuteIsNumber = isValidNumber(this.minute);
- const secondIsNumber = isValidNumber(this.second);
- const showMeridiem = this.hourCycle === "12";
- return (hAsync("div", { class: {
- [CSS$5.timePicker]: true,
- [CSS$5.showMeridiem]: showMeridiem,
- [CSS$5.showSecond]: this.showSecond,
- [CSS$5[`scale-${this.scale}`]]: true
- }, dir: "ltr" }, hAsync("div", { class: CSS$5.column, role: "group" }, hAsync("span", { "aria-label": this.intlHourUp, class: {
- [CSS$5.button]: true,
- [CSS$5.buttonHourUp]: true,
- [CSS$5.buttonTopLeft]: true
- }, 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: {
- [CSS$5.input]: true,
- [CSS$5.hour]: true
- }, onFocus: this.focusHandler, onKeyDown: this.hourKeyDownHandler, ref: this.setHourEl, role: "spinbutton", tabIndex: 0 }, this.localizedHour || "--"), hAsync("span", { "aria-label": this.intlHourDown, class: {
- [CSS$5.button]: true,
- [CSS$5.buttonHourDown]: true,
- [CSS$5.buttonBottomLeft]: true
- }, 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: {
- [CSS$5.button]: true,
- [CSS$5.buttonMinuteUp]: true
- }, 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: {
- [CSS$5.input]: true,
- [CSS$5.minute]: true
- }, onFocus: this.focusHandler, onKeyDown: this.minuteKeyDownHandler, ref: this.setMinuteEl, role: "spinbutton", tabIndex: 0 }, this.localizedMinute || "--"), hAsync("span", { "aria-label": this.intlMinuteDown, class: {
- [CSS$5.button]: true,
- [CSS$5.buttonMinuteDown]: true
- }, 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: {
- [CSS$5.button]: true,
- [CSS$5.buttonSecondUp]: true
- }, 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: {
- [CSS$5.input]: true,
- [CSS$5.second]: true
- }, onFocus: this.focusHandler, onKeyDown: this.secondKeyDownHandler, ref: this.setSecondEl, role: "spinbutton", tabIndex: 0 }, this.localizedSecond || "--"), hAsync("span", { "aria-label": this.intlSecondDown, class: {
- [CSS$5.button]: true,
- [CSS$5.buttonSecondDown]: true
- }, 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: {
- [CSS$5.column]: true,
- [CSS$5.meridiemStart]: this.meridiemOrder === 0
- }, role: "group" }, hAsync("span", { "aria-label": this.intlMeridiemUp, class: {
- [CSS$5.button]: true,
- [CSS$5.buttonMeridiemUp]: true,
- [CSS$5.buttonTopRight]: true
- }, 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: {
- [CSS$5.input]: true,
- [CSS$5.meridiem]: true
- }, onFocus: this.focusHandler, onKeyDown: this.meridiemKeyDownHandler, ref: this.setMeridiemEl, role: "spinbutton", tabIndex: 0 }, this.localizedMeridiem || "--"), hAsync("span", { "aria-label": this.intlMeridiemDown, class: {
- [CSS$5.button]: true,
- [CSS$5.buttonMeridiemDown]: true,
- [CSS$5.buttonBottomRight]: true
- }, onClick: this.decrementMeridiem, onKeyDown: this.meridiemDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, hAsync("calcite-icon", { icon: "chevron-down", scale: iconScale }))))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "locale": ["localeChanged"],
- "value": ["valueWatcher"],
- "effectiveLocale": ["effectiveLocaleWatcher"]
- }; }
- static get style() { return timePickerCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-time-picker",
- "$members$": {
- "intlHour": [1, "intl-hour"],
- "intlHourDown": [1, "intl-hour-down"],
- "intlHourUp": [1, "intl-hour-up"],
- "intlMeridiem": [1, "intl-meridiem"],
- "intlMeridiemDown": [1, "intl-meridiem-down"],
- "intlMeridiemUp": [1, "intl-meridiem-up"],
- "intlMinute": [1, "intl-minute"],
- "intlMinuteDown": [1, "intl-minute-down"],
- "intlMinuteUp": [1, "intl-minute-up"],
- "intlSecond": [1, "intl-second"],
- "intlSecondDown": [1, "intl-second-down"],
- "intlSecondUp": [1, "intl-second-up"],
- "locale": [1025],
- "scale": [513],
- "step": [514],
- "numberingSystem": [1, "numbering-system"],
- "value": [1025],
- "effectiveLocale": [32],
- "hour": [32],
- "hourCycle": [32],
- "localizedHour": [32],
- "localizedHourSuffix": [32],
- "localizedMeridiem": [32],
- "localizedMinute": [32],
- "localizedMinuteSuffix": [32],
- "localizedSecond": [32],
- "localizedSecondSuffix": [32],
- "meridiem": [32],
- "minute": [32],
- "second": [32],
- "showSecond": [32],
- "setFocus": [64]
- },
- "$listeners$": [[0, "blur", "hostBlurHandler"], [0, "focus", "hostFocusHandler"], [0, "keydown", "keyDownHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["scale", "scale"], ["step", "step"]]
- }; }
- }
- const CSS$4 = {
- header: "header",
- heading: "heading",
- close: "close",
- container: "container",
- tipContainer: "tip-container",
- tipContainerAdvancing: "tip-container--advancing",
- tipContainerRetreating: "tip-container--retreating",
- pagination: "pagination",
- pagePosition: "page-position",
- pageNext: "page-next",
- pagePrevious: "page-previous"
- };
- const ICONS$3 = {
- chevronLeft: "chevron-left",
- chevronRight: "chevron-right",
- close: "x"
- };
- const TEXT$1 = {
- defaultGroupTitle: "Tips",
- defaultPaginationLabel: "Tip",
- close: "Close",
- previous: "Previous",
- next: "Next"
- };
- const HEADING_LEVEL$1 = 2;
- const CSS$3 = {
- container: "container",
- header: "header",
- heading: "heading",
- close: "close",
- imageFrame: "image-frame",
- content: "content",
- info: "info"
- };
- const ICONS$2 = {
- close: "x"
- };
- const SLOTS$2 = {
- thumbnail: "thumbnail"
- };
- const TEXT = {
- close: "Close"
- };
- const HEADING_LEVEL = (HEADING_LEVEL$1 + 1);
- const tipCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tip{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tip{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tip{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tip{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tip:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tip:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tip-h{display:none}/*!@:host*/.sc-calcite-tip-h{position:relative;margin:1rem;box-sizing:border-box;display:flex;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{box-sizing:border-box}/*!@.container*/.container.sc-calcite-tip{inline-size:100%;padding:1rem}/*!@:host([dismissed]), \n: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:flex;align-content:space-between;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{flex:1 1 auto;padding:0.5rem}/*!@.header*/.header.sc-calcite-tip{margin-block-end:0.5rem}/*!@.header .heading*/.header.sc-calcite-tip .heading.sc-calcite-tip{padding:0px;font-size:var(--calcite-font-size-0);line-height:1.25rem;color:var(--calcite-ui-text-1)}/*!@.container[hidden]*/.container[hidden].sc-calcite-tip{display:none}/*!@.content*/.content.sc-calcite-tip{display:flex}/*!@.info*/.info.sc-calcite-tip{padding-block:0px;padding-inline:1rem;inline-size:70%}/*!@.info:only-child*/.info.sc-calcite-tip:only-child{inline-size:100%;padding-inline:0px}/*!@::slotted(p)*/.sc-calcite-tip-s>p{margin-block-start:0px}/*!@::slotted(a)*/.sc-calcite-tip-s>a{outline-color:transparent;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{inline-size:25%}/*!@.image-frame img*/.image-frame.sc-calcite-tip img.sc-calcite-tip{max-inline-size:100%}/*!@::slotted(img)*/.sc-calcite-tip-s>img{max-inline-size:100%}";
- /**
- * @slot - A slot for adding text and a hyperlink.
- * @slot thumbnail - A slot for adding an HTML image element.
- */
- class Tip {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteTipDismiss = createEvent(this, "calciteTipDismiss", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, the component does not display.
- */
- this.dismissed = false;
- /**
- * When `true`, the close button is not present on the component.
- */
- this.nonDismissible = false;
- /**
- * When `true`, the component is selected if it has a parent `calcite-tip-manager`.
- *
- * Only one tip can be selected within the `calcite-tip-manager` parent.
- */
- this.selected = false;
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.hideTip = () => {
- this.dismissed = true;
- this.calciteTipDismiss.emit();
- };
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderHeader() {
- var _a;
- const { heading, headingLevel, el } = this;
- const parentLevel = (_a = el.closest("calcite-tip-manager")) === null || _a === void 0 ? void 0 : _a.headingLevel;
- const relativeLevel = parentLevel ? constrainHeadingLevel(parentLevel + 1) : null;
- const level = headingLevel || relativeLevel || HEADING_LEVEL;
- return heading ? (hAsync("header", { class: CSS$3.header }, hAsync(Heading, { class: CSS$3.heading, level: level }, heading))) : null;
- }
- renderDismissButton() {
- const { nonDismissible, hideTip, intlClose } = this;
- const text = intlClose || TEXT.close;
- return !nonDismissible ? (hAsync("calcite-action", { class: CSS$3.close, icon: ICONS$2.close, onClick: hideTip, scale: "l", text: text })) : null;
- }
- renderImageFrame() {
- const { el } = this;
- return getSlotted(el, SLOTS$2.thumbnail) ? (hAsync("div", { class: CSS$3.imageFrame, key: "thumbnail" }, hAsync("slot", { name: SLOTS$2.thumbnail }))) : null;
- }
- renderInfoNode() {
- return (hAsync("div", { class: CSS$3.info }, hAsync("slot", null)));
- }
- renderContent() {
- return (hAsync("div", { class: CSS$3.content }, this.renderImageFrame(), this.renderInfoNode()));
- }
- render() {
- return (hAsync(Fragment, null, hAsync("article", { class: CSS$3.container }, this.renderHeader(), this.renderContent()), this.renderDismissButton()));
- }
- get el() { return getElement(this); }
- static get style() { return tipCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tip",
- "$members$": {
- "dismissed": [1540],
- "nonDismissible": [516, "non-dismissible"],
- "heading": [1],
- "headingLevel": [514, "heading-level"],
- "selected": [516],
- "intlClose": [1, "intl-close"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["dismissed", "dismissed"], ["nonDismissible", "non-dismissible"], ["headingLevel", "heading-level"], ["selected", "selected"]]
- }; }
- }
- const tipGroupCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tip-group{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tip-group{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tip-group{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tip-group{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tip-group:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tip-group:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tip-group-h{display:none}/*!@:host*/.sc-calcite-tip-group-h{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-block: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}";
- /**
- * @slot - A slot for adding `calcite-tip`s.
- */
- class TipGroup {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- }
- render() {
- return hAsync("slot", null);
- }
- static get style() { return tipGroupCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tip-group",
- "$members$": {
- "groupTitle": [1, "group-title"]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": []
- }; }
- }
- const tipManagerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tip-manager{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tip-manager{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tip-manager{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tip-manager{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tip-manager:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tip-manager:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tip-manager-h{display:none}/*!@:host*/.sc-calcite-tip-manager-h{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{box-sizing:border-box}/*!@:host([closed])*/[closed].sc-calcite-tip-manager-h{display:none}/*!@.header*/.header.sc-calcite-tip-manager{margin:0px;display:flex;align-content:space-between;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{flex:1 1 auto;padding:0.5rem}/*!@.header*/.header.sc-calcite-tip-manager{border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);padding-block:0px;padding-inline-end:0px;padding-inline-start:1rem}/*!@.header .heading*/.header.sc-calcite-tip-manager .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-color:transparent;min-block-size: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-block-start:1px;display:flex;align-items:flex-start;justify-content:center;overflow:auto;outline-color:transparent;animation-name:none;animation-duration:var(--calcite-animation-timing);block-size: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-inline-size:var(--calcite-tip-max-width)}/*!@.tip-container--advancing*/.tip-container--advancing.sc-calcite-tip-manager{animation-name:tip-advance}/*!@.tip-container--retreating*/.tip-container--retreating.sc-calcite-tip-manager{animation-name:tip-retreat}/*!@.pagination*/.pagination.sc-calcite-tip-manager{display:flex;align-items:center;justify-content:center;padding-inline:0px;padding-block:0.75rem 0.5rem}/*!@.page-position*/.page-position.sc-calcite-tip-manager{margin-block:0px;margin-inline:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}@keyframes tip-advance{0%{opacity:0;transform:translate3d(50px, 0, 0) scale(0.99)}100%{opacity:1;transform:translate3d(0, 0, 0) scale(1)}}@keyframes tip-retreat{0%{opacity:0;transform:translate3d(-50px, 0, 0) scale(0.99)}100%{opacity:1;transform:translate3d(0, 0, 0) scale(1)}}";
- /**
- * @slot - A slot for adding `calcite-tip`s.
- */
- class TipManager {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteTipManagerToggle = createEvent(this, "calciteTipManagerToggle", 6);
- this.calciteTipManagerClose = createEvent(this, "calciteTipManagerClose", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, does not display or position the component.
- */
- this.closed = false;
- this.mutationObserver = createObserver();
- this.hideTipManager = () => {
- this.closed = true;
- this.calciteTipManagerToggle.emit();
- this.calciteTipManagerClose.emit();
- };
- this.previousClicked = () => {
- this.previousTip();
- };
- this.nextClicked = () => {
- this.nextTip();
- };
- this.tipManagerKeyDownHandler = (event) => {
- if (event.target !== this.container) {
- return;
- }
- switch (event.key) {
- case "ArrowRight":
- event.preventDefault();
- this.nextTip();
- break;
- case "ArrowLeft":
- event.preventDefault();
- this.previousTip();
- break;
- case "Home":
- event.preventDefault();
- this.selectedIndex = 0;
- break;
- case "End":
- event.preventDefault();
- this.selectedIndex = this.total - 1;
- break;
- }
- };
- this.storeContainerRef = (el) => {
- this.container = el;
- };
- }
- closedChangeHandler() {
- this.direction = null;
- this.calciteTipManagerToggle.emit();
- }
- selectedChangeHandler() {
- this.showSelectedTip();
- this.updateGroupTitle();
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- this.setUpTips();
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
- }
- disconnectedCallback() {
- var _a;
- (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /** Selects the next `calcite-tip` to display. */
- async nextTip() {
- this.direction = "advancing";
- const nextIndex = this.selectedIndex + 1;
- this.selectedIndex = (nextIndex + this.total) % this.total;
- }
- /** Selects the previous `calcite-tip` to display. */
- async previousTip() {
- this.direction = "retreating";
- const previousIndex = this.selectedIndex - 1;
- this.selectedIndex = (previousIndex + this.total) % this.total;
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- setUpTips() {
- const tips = Array.from(this.el.querySelectorAll("calcite-tip"));
- this.total = tips.length;
- if (this.total === 0) {
- return;
- }
- const selectedTip = this.el.querySelector("calcite-tip[selected]");
- this.tips = tips;
- this.selectedIndex = selectedTip ? tips.indexOf(selectedTip) : 0;
- tips.forEach((tip) => {
- tip.nonDismissible = true;
- });
- this.showSelectedTip();
- this.updateGroupTitle();
- }
- showSelectedTip() {
- this.tips.forEach((tip, index) => {
- const isSelected = this.selectedIndex === index;
- tip.selected = isSelected;
- tip.hidden = !isSelected;
- });
- }
- updateGroupTitle() {
- const selectedTip = this.tips[this.selectedIndex];
- const tipParent = selectedTip.closest("calcite-tip-group");
- this.groupTitle = (tipParent === null || tipParent === void 0 ? void 0 : tipParent.groupTitle) || this.intlDefaultTitle || TEXT$1.defaultGroupTitle;
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderPagination() {
- const dir = getElementDir(this.el);
- const { selectedIndex, tips, total, intlNext, intlPrevious, intlPaginationLabel } = this;
- const nextLabel = intlNext || TEXT$1.next;
- const previousLabel = intlPrevious || TEXT$1.previous;
- const paginationLabel = intlPaginationLabel || TEXT$1.defaultPaginationLabel;
- 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;
- }
- render() {
- const { closed, direction, headingLevel, groupTitle, selectedIndex, intlClose, total } = this;
- const closeLabel = intlClose || TEXT$1.close;
- if (total === 0) {
- return null;
- }
- return (hAsync("section", { "aria-hidden": toAriaBoolean(closed), class: CSS$4.container, hidden: closed, onKeyDown: this.tipManagerKeyDownHandler, 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: {
- [CSS$4.tipContainer]: true,
- [CSS$4.tipContainerAdvancing]: !closed && direction === "advancing",
- [CSS$4.tipContainerRetreating]: !closed && direction === "retreating"
- }, key: selectedIndex, tabIndex: 0 }, hAsync("slot", null)), this.renderPagination()));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "closed": ["closedChangeHandler"],
- "selectedIndex": ["selectedChangeHandler"]
- }; }
- static get style() { return tipManagerCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tip-manager",
- "$members$": {
- "closed": [1540],
- "headingLevel": [514, "heading-level"],
- "intlClose": [1, "intl-close"],
- "intlDefaultTitle": [1, "intl-default-title"],
- "intlNext": [1, "intl-next"],
- "intlPaginationLabel": [1, "intl-pagination-label"],
- "intlPrevious": [1, "intl-previous"],
- "selectedIndex": [32],
- "tips": [32],
- "total": [32],
- "direction": [32],
- "groupTitle": [32],
- "nextTip": [64],
- "previousTip": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["closed", "closed"], ["headingLevel", "heading-level"]]
- }; }
- }
- const CSS$2 = {
- container: "container",
- arrow: "arrow"
- };
- const TOOLTIP_DELAY_MS = 500;
- const ARIA_DESCRIBED_BY = "aria-describedby";
- class TooltipManager$1 {
- constructor() {
- // --------------------------------------------------------------------------
- //
- // Private Properties
- //
- // --------------------------------------------------------------------------
- this.registeredElements = new WeakMap();
- this.hoverTimeouts = new WeakMap();
- this.registeredElementCount = 0;
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.queryTooltip = (composedPath) => {
- const { registeredElements } = this;
- const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
- return registeredElements.get(registeredElement);
- };
- this.keyDownHandler = (event) => {
- if (event.key === "Escape") {
- const { activeTooltipEl } = this;
- if (activeTooltipEl) {
- this.clearHoverTimeout(activeTooltipEl);
- this.toggleTooltip(activeTooltipEl, false);
- }
- }
- };
- this.mouseEnterShow = (event) => {
- this.hoverEvent(event, true);
- };
- this.mouseLeaveHide = (event) => {
- this.hoverEvent(event, false);
- };
- this.clickHandler = (event) => {
- if (!isPrimaryPointerButton(event)) {
- return;
- }
- const clickedTooltip = this.queryTooltip(event.composedPath());
- this.clickedTooltip = clickedTooltip;
- if (clickedTooltip === null || clickedTooltip === void 0 ? void 0 : clickedTooltip.closeOnClick) {
- this.toggleTooltip(clickedTooltip, false);
- this.clearHoverTimeout(clickedTooltip);
- }
- };
- this.focusShow = (event) => {
- this.focusEvent(event, true);
- };
- this.blurHide = (event) => {
- this.focusEvent(event, false);
- };
- this.hoverToggle = (tooltip, value) => {
- const { hoverTimeouts } = this;
- hoverTimeouts.delete(tooltip);
- if (value) {
- this.closeExistingTooltip();
- }
- this.toggleTooltip(tooltip, value);
- };
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- registerElement(referenceEl, tooltip) {
- this.registeredElementCount++;
- this.registeredElements.set(referenceEl, tooltip);
- if (this.registeredElementCount === 1) {
- this.addListeners();
- }
- }
- unregisterElement(referenceEl) {
- if (this.registeredElements.delete(referenceEl)) {
- this.registeredElementCount--;
- }
- if (this.registeredElementCount === 0) {
- this.removeListeners();
- }
- }
- addListeners() {
- document.addEventListener("keydown", this.keyDownHandler);
- document.addEventListener("pointerover", this.mouseEnterShow, { capture: true });
- document.addEventListener("pointerout", this.mouseLeaveHide, { capture: true });
- document.addEventListener("pointerdown", this.clickHandler, { capture: true });
- document.addEventListener("focusin", this.focusShow, { capture: true });
- document.addEventListener("focusout", this.blurHide, { capture: true });
- }
- removeListeners() {
- document.removeEventListener("keydown", this.keyDownHandler);
- document.removeEventListener("pointerover", this.mouseEnterShow, { capture: true });
- document.removeEventListener("pointerout", this.mouseLeaveHide, { capture: true });
- document.removeEventListener("pointerdown", this.clickHandler, { capture: true });
- document.removeEventListener("focusin", this.focusShow, { capture: true });
- document.removeEventListener("focusout", this.blurHide, { capture: true });
- }
- clearHoverTimeout(tooltip) {
- const { hoverTimeouts } = this;
- if (hoverTimeouts.has(tooltip)) {
- window.clearTimeout(hoverTimeouts.get(tooltip));
- hoverTimeouts.delete(tooltip);
- }
- }
- closeExistingTooltip() {
- const { activeTooltipEl } = this;
- if (activeTooltipEl) {
- this.toggleTooltip(activeTooltipEl, false);
- }
- }
- focusTooltip(tooltip, value) {
- this.closeExistingTooltip();
- if (value) {
- this.clearHoverTimeout(tooltip);
- }
- this.toggleTooltip(tooltip, value);
- }
- toggleTooltip(tooltip, value) {
- tooltip.open = value;
- if (value) {
- this.activeTooltipEl = tooltip;
- }
- }
- hoverTooltip(tooltip, value) {
- this.clearHoverTimeout(tooltip);
- const { hoverTimeouts } = this;
- const timeoutId = window.setTimeout(() => this.hoverToggle(tooltip, value), TOOLTIP_DELAY_MS );
- hoverTimeouts.set(tooltip, timeoutId);
- }
- activeTooltipHover(event) {
- const { activeTooltipEl, hoverTimeouts } = this;
- const { type } = event;
- if (!activeTooltipEl) {
- return;
- }
- if (type === "pointerover" && event.composedPath().includes(activeTooltipEl)) {
- this.clearHoverTimeout(activeTooltipEl);
- }
- else if (type === "pointerout" && !hoverTimeouts.has(activeTooltipEl)) {
- this.hoverTooltip(activeTooltipEl, false);
- }
- }
- hoverEvent(event, value) {
- const tooltip = this.queryTooltip(event.composedPath());
- this.activeTooltipHover(event);
- if (!tooltip) {
- return;
- }
- this.hoverTooltip(tooltip, value);
- }
- focusEvent(event, value) {
- const tooltip = this.queryTooltip(event.composedPath());
- if (!tooltip || tooltip === this.clickedTooltip) {
- this.clickedTooltip = null;
- return;
- }
- this.focusTooltip(tooltip, value);
- }
- }
- const tooltipCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tooltip{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tooltip{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tooltip{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tooltip{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tooltip:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tooltip:root{--calcite-floating-ui-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}/*!@.calcite-floating-ui-anim*/.calcite-floating-ui-anim.sc-calcite-tooltip{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}/*!@:host([data-placement^=bottom]) .calcite-floating-ui-anim*/[data-placement^=bottom].sc-calcite-tooltip-h .calcite-floating-ui-anim.sc-calcite-tooltip{transform:translateY(-5px)}/*!@:host([data-placement^=top]) .calcite-floating-ui-anim*/[data-placement^=top].sc-calcite-tooltip-h .calcite-floating-ui-anim.sc-calcite-tooltip{transform:translateY(5px)}/*!@:host([data-placement^=left]) .calcite-floating-ui-anim*/[data-placement^=left].sc-calcite-tooltip-h .calcite-floating-ui-anim.sc-calcite-tooltip{transform:translateX(5px)}/*!@:host([data-placement^=right]) .calcite-floating-ui-anim*/[data-placement^=right].sc-calcite-tooltip-h .calcite-floating-ui-anim.sc-calcite-tooltip{transform:translateX(-5px)}/*!@:host([data-placement]) .calcite-floating-ui-anim--active*/[data-placement].sc-calcite-tooltip-h .calcite-floating-ui-anim--active.sc-calcite-tooltip{opacity:1;visibility:visible;transform:translate(0)}/*!@:host([calcite-hydrated-hidden])*/[calcite-hydrated-hidden].sc-calcite-tooltip-h{visibility:hidden !important;pointer-events:none}/*!@.arrow,\n.arrow::before*/.arrow.sc-calcite-tooltip,.arrow.sc-calcite-tooltip::before{position:absolute;inline-size:8px;block-size: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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transform:rotate(45deg);background:var(--calcite-ui-foreground-1)}/*!@:host([data-placement^=top]) .arrow*/[data-placement^=top].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{inset-block-end:-4px}/*!@:host([data-placement^=bottom]) .arrow*/[data-placement^=bottom].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{inset-block-start:-4px}/*!@:host([data-placement^=left]) .arrow*/[data-placement^=left].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{direction:ltr;inset-inline-end:-4px}/*!@:host([data-placement^=right]) .arrow*/[data-placement^=right].sc-calcite-tooltip-h .arrow.sc-calcite-tooltip{direction:ltr;inset-inline-start:-4px}/*!@.container*/.container.sc-calcite-tooltip{position:relative;overflow:hidden;border-radius:0.25rem;background-color:var(--calcite-ui-foreground-1);padding-block:0.75rem;padding-inline: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-inline-size:20rem;max-block-size:20rem;text-align:start}/*!@.calcite-floating-ui-anim*/.calcite-floating-ui-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)}";
- const manager = new TooltipManager$1();
- /**
- * @slot - A slot for adding text.
- */
- class Tooltip {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /** Closes the component when the `referenceElement` is clicked. */
- this.closeOnClick = false;
- /**
- * Offset the position of the component away from the `referenceElement`.
- *
- * @default 6
- */
- this.offsetDistance = defaultOffsetDistance;
- /**
- * Offset the position of the component along the `referenceElement`.
- */
- this.offsetSkidding = 0;
- /**
- * When `true`, the component is open.
- */
- this.open = false;
- /**
- * Determines the type of positioning to use for the overlaid content.
- *
- * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
- *
- * The `"fixed"` value should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
- *
- */
- this.overlayPositioning = "absolute";
- /**
- * Determines where the component will be positioned relative to the `referenceElement`.
- *
- * @see [LogicalPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/floating-ui.ts#L25)
- */
- this.placement = "auto";
- this.guid = `calcite-tooltip-${guid()}`;
- this.hasLoaded = false;
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.setUpReferenceElement = (warn = true) => {
- this.removeReferences();
- this.effectiveReferenceElement = this.getReferenceElement();
- connectFloatingUI(this, this.effectiveReferenceElement, this.el);
- const { el, referenceElement, effectiveReferenceElement } = this;
- if (warn && referenceElement && !effectiveReferenceElement) {
- console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
- el
- });
- }
- this.addReferences();
- };
- this.getId = () => {
- return this.el.id || this.guid;
- };
- this.addReferences = () => {
- const { effectiveReferenceElement } = this;
- if (!effectiveReferenceElement) {
- return;
- }
- const id = this.getId();
- if ("setAttribute" in effectiveReferenceElement) {
- effectiveReferenceElement.setAttribute(ARIA_DESCRIBED_BY, id);
- }
- manager.registerElement(effectiveReferenceElement, this.el);
- };
- this.removeReferences = () => {
- const { effectiveReferenceElement } = this;
- if (!effectiveReferenceElement) {
- return;
- }
- if ("removeAttribute" in effectiveReferenceElement) {
- effectiveReferenceElement.removeAttribute(ARIA_DESCRIBED_BY);
- }
- manager.unregisterElement(effectiveReferenceElement);
- };
- }
- offsetDistanceOffsetHandler() {
- this.reposition(true);
- }
- offsetSkiddingHandler() {
- this.reposition(true);
- }
- openHandler(value) {
- if (value) {
- this.reposition(true);
- }
- else {
- updateAfterClose(this.el);
- }
- }
- overlayPositioningHandler() {
- this.reposition(true);
- }
- placementHandler() {
- this.reposition(true);
- }
- referenceElementHandler() {
- this.setUpReferenceElement();
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- this.setUpReferenceElement(this.hasLoaded);
- }
- componentDidLoad() {
- if (this.referenceElement && !this.effectiveReferenceElement) {
- this.setUpReferenceElement();
- }
- this.reposition(true);
- this.hasLoaded = true;
- }
- disconnectedCallback() {
- this.removeReferences();
- disconnectFloatingUI(this, this.effectiveReferenceElement, this.el);
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /**
- * Updates the position of the component.
- *
- * @param delayed
- */
- async reposition(delayed = false) {
- const { el, effectiveReferenceElement, placement, overlayPositioning, offsetDistance, offsetSkidding, arrowEl } = this;
- return reposition(this, {
- floatingEl: el,
- referenceEl: effectiveReferenceElement,
- overlayPositioning,
- placement,
- offsetDistance,
- offsetSkidding,
- includeArrow: true,
- arrowEl,
- type: "tooltip"
- }, delayed);
- }
- getReferenceElement() {
- const { referenceElement, el } = this;
- return ((typeof referenceElement === "string"
- ? queryElementRoots(el, { id: referenceElement })
- : referenceElement) || null);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const { effectiveReferenceElement, label, open } = this;
- const displayed = effectiveReferenceElement && open;
- const hidden = !displayed;
- return (hAsync(Host, { "aria-hidden": toAriaBoolean(hidden), "aria-label": label, "aria-live": "polite", "calcite-hydrated-hidden": hidden, id: this.getId(), role: "tooltip" }, hAsync("div", { class: {
- [FloatingCSS.animation]: true,
- [FloatingCSS.animationActive]: displayed
- } }, hAsync("div", { class: CSS$2.arrow, ref: (arrowEl) => (this.arrowEl = arrowEl) }), hAsync("div", { class: CSS$2.container }, hAsync("slot", null)))));
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "offsetDistance": ["offsetDistanceOffsetHandler"],
- "offsetSkidding": ["offsetSkiddingHandler"],
- "open": ["openHandler"],
- "overlayPositioning": ["overlayPositioningHandler"],
- "placement": ["placementHandler"],
- "referenceElement": ["referenceElementHandler"]
- }; }
- static get style() { return tooltipCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tooltip",
- "$members$": {
- "closeOnClick": [516, "close-on-click"],
- "label": [1],
- "offsetDistance": [514, "offset-distance"],
- "offsetSkidding": [514, "offset-skidding"],
- "open": [516],
- "overlayPositioning": [513, "overlay-positioning"],
- "placement": [513],
- "referenceElement": [1, "reference-element"],
- "effectiveReferenceElement": [32],
- "reposition": [64]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["closeOnClick", "close-on-click"], ["offsetDistance", "offset-distance"], ["offsetSkidding", "offset-skidding"], ["open", "open"], ["overlayPositioning", "overlay-positioning"], ["placement", "placement"]]
- }; }
- }
- const tooltipManagerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tooltip-manager{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tooltip-manager{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tooltip-manager{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tooltip-manager{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tooltip-manager:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tooltip-manager:root{--calcite-floating-ui-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}";
- /**
- * @slot - A slot for adding elements that reference a `calcite-tooltip` by the `selector` property.
- * @deprecated No longer required for tooltip usage.
- */
- class TooltipManager {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * CSS Selector to match reference elements for tooltips. Reference elements will be identified by this selector in order to open their associated tooltip.
- *
- * @default `[data-calcite-tooltip-reference]`
- */
- this.selector = "[data-calcite-tooltip-reference]";
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- return hAsync("slot", null);
- }
- static get style() { return tooltipManagerCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tooltip-manager",
- "$members$": {
- "selector": [513]
- },
- "$listeners$": undefined,
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["selector", "selector"]]
- }; }
- }
- var TreeSelectionMode;
- (function (TreeSelectionMode) {
- TreeSelectionMode["Single"] = "single";
- TreeSelectionMode["Multi"] = "multi";
- TreeSelectionMode["None"] = "none";
- TreeSelectionMode["Children"] = "children";
- TreeSelectionMode["MultiChildren"] = "multi-children";
- TreeSelectionMode["Ancestors"] = "ancestors";
- })(TreeSelectionMode || (TreeSelectionMode = {}));
- function isTreeItem(element) {
- return element === null || element === void 0 ? void 0 : element.matches("calcite-tree-item");
- }
- function getEnabledSiblingItem(el, direction) {
- const directionProp = direction === "down" ? "nextElementSibling" : "previousElementSibling";
- let currentEl = el;
- let enabledEl = null;
- while (isTreeItem(currentEl)) {
- if (!currentEl.disabled) {
- enabledEl = currentEl;
- break;
- }
- currentEl = currentEl[directionProp];
- }
- return enabledEl;
- }
- const treeCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tree{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tree{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tree{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tree{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tree:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tree:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tree-h{display:none}/*!@:host*/.sc-calcite-tree-h{display:block}/*!@:host(:focus)*/.sc-calcite-tree-h:focus{outline:2px solid transparent;outline-offset:2px}";
- /**
- * @slot - A slot for `calcite-tree-item` elements.
- */
- class Tree {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteTreeSelect = createEvent(this, "calciteTreeSelect", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** Displays indentation guide lines. */
- this.lines = false;
- /**
- * Display input
- *
- * @deprecated Use `selectionMode="ancestors"` for checkbox input.
- */
- this.inputEnabled = false;
- /** Specifies the size of the component. */
- this.scale = "m";
- /**
- * Customize how the component's selection works.
- *
- * @default "single"
- * @see [TreeSelectionMode](https://github.com/Esri/calcite-components/blob/master/src/components/tree/interfaces.ts#L5)
- */
- this.selectionMode = TreeSelectionMode.Single;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- componentWillRender() {
- var _a;
- const parent = (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.closest("calcite-tree");
- this.lines = parent ? parent.lines : this.lines;
- this.scale = parent ? parent.scale : this.scale;
- this.selectionMode = parent ? parent.selectionMode : this.selectionMode;
- this.child = !!parent;
- }
- render() {
- return (hAsync(Host, { "aria-multiselectable": this.child
- ? undefined
- : (this.selectionMode === TreeSelectionMode.Multi ||
- this.selectionMode === TreeSelectionMode.MultiChildren).toString(), role: !this.child ? "tree" : undefined, tabIndex: this.getRootTabIndex() }, hAsync("slot", null)));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- onFocus() {
- if (!this.child) {
- const focusTarget = this.el.querySelector("calcite-tree-item[selected]:not([disabled])") || this.el.querySelector("calcite-tree-item:not([disabled])");
- focusElement(focusTarget);
- }
- }
- onFocusIn(event) {
- const focusedFromRootOrOutsideTree = event.relatedTarget === this.el || !this.el.contains(event.relatedTarget);
- if (focusedFromRootOrOutsideTree) {
- // gives user the ability to tab into external elements (modifying tabindex property will not work in firefox)
- this.el.removeAttribute("tabindex");
- }
- }
- onFocusOut(event) {
- const willFocusOutsideTree = !this.el.contains(event.relatedTarget);
- if (willFocusOutsideTree) {
- this.el.tabIndex = this.getRootTabIndex();
- }
- }
- onClick(event) {
- const target = event.target;
- const childItems = nodeListToArray(target.querySelectorAll("calcite-tree-item"));
- if (this.child) {
- return;
- }
- if (!this.child) {
- event.preventDefault();
- event.stopPropagation();
- }
- if (this.selectionMode === TreeSelectionMode.Ancestors && !this.child) {
- this.updateAncestorTree(event);
- return;
- }
- const isNoneSelectionMode = this.selectionMode === TreeSelectionMode.None;
- const shouldSelect = this.selectionMode !== null &&
- (!target.hasChildren ||
- (target.hasChildren &&
- (this.selectionMode === TreeSelectionMode.Children ||
- this.selectionMode === TreeSelectionMode.MultiChildren)));
- const shouldModifyToCurrentSelection = !isNoneSelectionMode &&
- event.detail.modifyCurrentSelection &&
- (this.selectionMode === TreeSelectionMode.Multi ||
- this.selectionMode === TreeSelectionMode.MultiChildren);
- const shouldSelectChildren = this.selectionMode === TreeSelectionMode.MultiChildren ||
- this.selectionMode === TreeSelectionMode.Children;
- const shouldClearCurrentSelection = !shouldModifyToCurrentSelection &&
- (((this.selectionMode === TreeSelectionMode.Single ||
- this.selectionMode === TreeSelectionMode.Multi) &&
- childItems.length <= 0) ||
- this.selectionMode === TreeSelectionMode.Children ||
- this.selectionMode === TreeSelectionMode.MultiChildren);
- const shouldExpandTarget = this.selectionMode === TreeSelectionMode.Children ||
- this.selectionMode === TreeSelectionMode.MultiChildren;
- if (!this.child) {
- const targetItems = [];
- if (shouldSelect) {
- targetItems.push(target);
- }
- if (shouldSelectChildren) {
- childItems.forEach((treeItem) => {
- targetItems.push(treeItem);
- });
- }
- if (shouldClearCurrentSelection) {
- const selectedItems = nodeListToArray(this.el.querySelectorAll("calcite-tree-item[selected]"));
- selectedItems.forEach((treeItem) => {
- if (!targetItems.includes(treeItem)) {
- treeItem.selected = false;
- }
- });
- }
- if (shouldExpandTarget && !event.detail.forceToggle) {
- target.expanded = true;
- }
- if (shouldModifyToCurrentSelection) {
- window.getSelection().removeAllRanges();
- }
- if ((shouldModifyToCurrentSelection && target.selected) ||
- (shouldSelectChildren && event.detail.forceToggle)) {
- targetItems.forEach((treeItem) => {
- if (!treeItem.disabled) {
- treeItem.selected = false;
- }
- });
- }
- else if (!isNoneSelectionMode) {
- targetItems.forEach((treeItem) => {
- if (!treeItem.disabled) {
- treeItem.selected = true;
- }
- });
- }
- }
- const selected = isNoneSelectionMode
- ? [target]
- : nodeListToArray(this.el.querySelectorAll("calcite-tree-item")).filter((i) => i.selected);
- this.calciteTreeSelect.emit({ selected });
- event.stopPropagation();
- }
- keyDownHandler(event) {
- var _a;
- const root = this.el.closest("calcite-tree:not([child])");
- const target = event.target;
- if (!(root === this.el && target.tagName === "CALCITE-TREE-ITEM" && this.el.contains(target))) {
- return;
- }
- if (event.key === "ArrowDown") {
- const next = getEnabledSiblingItem(target.nextElementSibling, "down");
- if (next) {
- next.focus();
- event.preventDefault();
- }
- return;
- }
- if (event.key === "ArrowUp") {
- const previous = getEnabledSiblingItem(target.previousElementSibling, "up");
- if (previous) {
- previous.focus();
- event.preventDefault();
- }
- }
- if (event.key === "ArrowLeft" && !target.disabled) {
- // When focus is on an open node, closes the node.
- if (target.hasChildren && target.expanded) {
- target.expanded = false;
- event.preventDefault();
- return;
- }
- // When focus is on a child node that is also either an end node or a closed node, moves focus to its parent node.
- const parentItem = target.parentElement.closest("calcite-tree-item");
- if (parentItem && (!target.hasChildren || target.expanded === false)) {
- parentItem.focus();
- event.preventDefault();
- return;
- }
- // When focus is on a root node that is also either an end node or a closed node, does nothing.
- return;
- }
- if (event.key === "ArrowRight" && !target.disabled) {
- if (target.hasChildren) {
- if (target.expanded && getRootNode(this.el).activeElement === target) {
- // When focus is on an open node, moves focus to the first child node.
- (_a = getEnabledSiblingItem(target.querySelector("calcite-tree-item"), "down")) === null || _a === void 0 ? void 0 : _a.focus();
- event.preventDefault();
- }
- else {
- // When focus is on a closed node, opens the node; focus does not move.
- target.expanded = true;
- event.preventDefault();
- }
- }
- return;
- }
- }
- updateAncestorTree(event) {
- const item = event.target;
- if (item.disabled) {
- return;
- }
- const ancestors = [];
- let parent = item.parentElement.closest("calcite-tree-item");
- while (parent) {
- ancestors.push(parent);
- parent = parent.parentElement.closest("calcite-tree-item");
- }
- const childItems = Array.from(item.querySelectorAll("calcite-tree-item:not([disabled])"));
- const childItemsWithNoChildren = childItems.filter((child) => !child.hasChildren);
- const childItemsWithChildren = childItems.filter((child) => child.hasChildren);
- const futureSelected = item.hasChildren
- ? !(item.selected || item.indeterminate)
- : !item.selected;
- childItemsWithNoChildren.forEach((el) => {
- el.selected = futureSelected;
- el.indeterminate = false;
- });
- function updateItemState(childItems, item) {
- const selected = childItems.filter((child) => child.selected);
- const unselected = childItems.filter((child) => !child.selected);
- item.selected = selected.length === childItems.length;
- item.indeterminate = selected.length > 0 && unselected.length > 0;
- }
- childItemsWithChildren.forEach((el) => {
- const directChildItems = Array.from(el.querySelectorAll(":scope > calcite-tree > calcite-tree-item"));
- updateItemState(directChildItems, el);
- });
- if (item.hasChildren) {
- updateItemState(childItems, item);
- }
- else {
- item.selected = futureSelected;
- item.indeterminate = false;
- }
- ancestors.forEach((ancestor) => {
- const descendants = nodeListToArray(ancestor.querySelectorAll("calcite-tree-item"));
- const activeDescendants = descendants.filter((el) => el.selected);
- if (activeDescendants.length === 0) {
- ancestor.selected = false;
- ancestor.indeterminate = false;
- return;
- }
- const indeterminate = activeDescendants.length < descendants.length;
- ancestor.indeterminate = indeterminate;
- ancestor.selected = !indeterminate;
- });
- this.calciteTreeSelect.emit({
- selected: nodeListToArray(this.el.querySelectorAll("calcite-tree-item")).filter((i) => i.selected)
- });
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- getRootTabIndex() {
- return !this.child ? 0 : -1;
- }
- get el() { return getElement(this); }
- static get style() { return treeCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tree",
- "$members$": {
- "lines": [1540],
- "inputEnabled": [4, "input-enabled"],
- "child": [1540],
- "scale": [1537],
- "selectionMode": [1537, "selection-mode"]
- },
- "$listeners$": [[0, "focus", "onFocus"], [0, "focusin", "onFocusIn"], [0, "focusout", "onFocusOut"], [0, "calciteInternalTreeItemSelect", "onClick"], [0, "keydown", "keyDownHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["lines", "lines"], ["child", "child"], ["scale", "scale"], ["selectionMode", "selection-mode"]]
- }; }
- }
- const CSS$1 = {
- checkboxLabel: "checkbox-label",
- checkbox: "checkbox",
- chevron: "chevron",
- nodeContainer: "node-container",
- childrenContainer: "children-container",
- bulletPointIcon: "bullet-point",
- checkmarkIcon: "checkmark"
- };
- const SLOTS$1 = {
- children: "children"
- };
- const ICONS$1 = {
- bulletPoint: "bullet-point",
- checkmark: "check",
- chevronRight: "chevron-right",
- blank: "blank"
- };
- const treeItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-tree-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-tree-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-tree-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-tree-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-tree-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-tree-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-tree-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-tree-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-tree-item-h{display:block;max-inline-size:100%;cursor:pointer;color:var(--calcite-ui-text-3)}/*!@:host([calcite-hydrated-hidden])*/[calcite-hydrated-hidden].sc-calcite-tree-item-h{visibility:hidden !important;pointer-events:none}/*!@:host([disabled]) ::slotted([calcite-hydrated][disabled]),\n:host([disabled]) [calcite-hydrated][disabled]*/.sc-calcite-tree-item-h[disabled] .sc-calcite-tree-item-s>[calcite-hydrated][disabled],[disabled].sc-calcite-tree-item-h [calcite-hydrated][disabled].sc-calcite-tree-item{opacity:1}/*!@: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;inset-block-start:0px;z-index:1;inline-size:1px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;block-size:96%;content:\"\";background-color:var(--calcite-ui-border-2)}/*!@: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-inline-size:0px;max-inline-size: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{inline-size:100%;text-decoration-line:none}/*!@:host*/.sc-calcite-tree-item-h{outline-color:transparent}/*!@:host(:focus:not([disabled]))*/.sc-calcite-tree-item-h:focus:not([disabled]){outline:2px solid transparent;outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}/*!@.checkbox*/.checkbox.sc-calcite-tree-item{line-height:0}/*!@.checkbox-label*/.checkbox-label.sc-calcite-tree-item{pointer-events:none;display:flex;align-items:center}/*!@.checkbox:focus*/.checkbox.sc-calcite-tree-item:focus{outline:2px solid transparent;outline-offset:2px}/*!@.children-container*/.children-container.sc-calcite-tree-item{position:relative;block-size:0px;overflow:hidden;margin-inline-start:1.25rem;transform:scaleY(0);opacity:0;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;transform-origin:top}/*!@:host([expanded]) > .children-container*/[expanded].sc-calcite-tree-item-h>.children-container.sc-calcite-tree-item{transform:scaleY(1);opacity:1;block-size:auto}/*!@.node-container*/.node-container.sc-calcite-tree-item{position:relative;display:flex;align-items:center;padding-block:var(--calcite-tree-padding-y);padding-inline:0}/*!@.node-container .checkmark, \n.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;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;color:var(--calcite-ui-border-1)}/*!@.node-container:hover .checkmark, \n.node-container:hover .bullet-point, \n:host([selected]) .node-container:hover .checkmark, \n:host([selected]) .node-container:hover .bullet-point, \n:host(:focus:not([disabled])) .node-container .checkmark, \n:host(:focus:not([disabled])) .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:not([disabled]) .node-container.sc-calcite-tree-item .checkmark.sc-calcite-tree-item,.sc-calcite-tree-item-h:focus:not([disabled]) .node-container.sc-calcite-tree-item .bullet-point.sc-calcite-tree-item{opacity:1}/*!@:host([selected]) > .node-container, \n: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, \n:host([selected]) > .node-container .checkmark, \n:host([selected]) > .node-container:hover .bullet-point, \n: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([selection-mode=none]:not([has-children])):host([scale=s]) > .node-container*/[selection-mode=none].sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=s])>.node-container.sc-calcite-tree-item{padding-inline-start:0.5rem}/*!@:host([selection-mode=none]:not([has-children])):host([scale=m]) > .node-container*/[selection-mode=none].sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=m])>.node-container.sc-calcite-tree-item{padding-inline-start:1rem}/*!@:host([selection-mode=none]:not([has-children])):host([scale=l]) > .node-container*/[selection-mode=none].sc-calcite-tree-item-h:not([has-children]).sc-calcite-tree-item-h([scale=l])>.node-container.sc-calcite-tree-item{padding-inline-start:1.5rem}/*!@: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{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{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{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{margin-inline-start:0}/*!@:host([has-children]) > .node-container .bullet-point, \n: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]):not([selection-mode=none])) > .node-container ::slotted(*)*/.sc-calcite-tree-item-h[has-children][expanded]:not([selected]):not([selection-mode=none])>.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;align-self:center;color:var(--calcite-ui-text-3);transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;flex:0 0 auto;transform:rotate(0deg)}/*!@.calcite--rtl .chevron*/.calcite--rtl.sc-calcite-tree-item .chevron.sc-calcite-tree-item{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{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)}";
- /**
- * @slot - A slot for adding the component's content.
- * @slot children - A slot for adding nested `calcite-tree` elements.
- */
- class TreeItem {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteInternalTreeItemSelect = createEvent(this, "calciteInternalTreeItemSelect", 6);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /** When `true`, the component is selected. */
- this.selected = false;
- /** When `true`, the component is expanded. */
- this.expanded = false;
- /**
- * @internal
- */
- this.parentExpanded = false;
- /**
- * @internal
- */
- this.depth = -1;
- /**
- * @internal
- */
- this.hasChildren = null;
- this.iconClickHandler = (event) => {
- event.stopPropagation();
- this.expanded = !this.expanded;
- };
- this.childrenClickHandler = (event) => event.stopPropagation();
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.updateParentIsExpanded = (el, expanded) => {
- const items = getSlotted(el, SLOTS$1.children, {
- all: true,
- selector: "calcite-tree-item"
- });
- items.forEach((item) => (item.parentExpanded = expanded));
- };
- this.updateAncestorTree = () => {
- var _a;
- if (this.selected && this.selectionMode === TreeSelectionMode.Ancestors) {
- const ancestors = [];
- let parent = this.parentTreeItem;
- while (parent) {
- ancestors.push(parent);
- parent = (_a = parent.parentElement) === null || _a === void 0 ? void 0 : _a.closest("calcite-tree-item");
- }
- ancestors.forEach((item) => (item.indeterminate = true));
- return;
- }
- };
- }
- expandedHandler(newValue) {
- this.updateParentIsExpanded(this.el, newValue);
- }
- getselectionMode() {
- this.isSelectionMultiLike =
- this.selectionMode === TreeSelectionMode.Multi ||
- this.selectionMode === TreeSelectionMode.MultiChildren;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- var _a;
- this.parentTreeItem = (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.closest("calcite-tree-item");
- if (this.parentTreeItem) {
- const { expanded } = this.parentTreeItem;
- this.updateParentIsExpanded(this.parentTreeItem, expanded);
- }
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- componentWillRender() {
- var _a;
- this.hasChildren = !!this.el.querySelector("calcite-tree");
- this.depth = 0;
- let parentTree = this.el.closest("calcite-tree");
- if (!parentTree) {
- return;
- }
- this.selectionMode = parentTree.selectionMode;
- this.scale = parentTree.scale || "m";
- this.lines = parentTree.lines;
- let nextParentTree;
- while (parentTree) {
- nextParentTree = (_a = parentTree.parentElement) === null || _a === void 0 ? void 0 : _a.closest("calcite-tree");
- if (nextParentTree === parentTree) {
- break;
- }
- else {
- parentTree = nextParentTree;
- this.depth = this.depth + 1;
- }
- }
- }
- componentDidLoad() {
- this.updateAncestorTree();
- }
- componentDidRender() {
- updateHostInteraction(this, () => this.parentExpanded || this.depth === 1);
- }
- render() {
- const rtl = getElementDir(this.el) === "rtl";
- const showBulletPoint = this.selectionMode === TreeSelectionMode.Single ||
- this.selectionMode === TreeSelectionMode.Children;
- const showCheckmark = this.selectionMode === TreeSelectionMode.Multi ||
- this.selectionMode === TreeSelectionMode.MultiChildren;
- const showBlank = this.selectionMode === TreeSelectionMode.None && !this.hasChildren;
- const chevron = this.hasChildren ? (hAsync("calcite-icon", { class: {
- [CSS$1.chevron]: true,
- [CSS_UTILITY.rtl]: rtl
- }, "data-test-id": "icon", icon: ICONS$1.chevronRight, onClick: this.iconClickHandler, scale: "s" })) : null;
- const defaultSlotNode = hAsync("slot", { key: "default-slot" });
- 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;
- const selectedIcon = showBulletPoint
- ? ICONS$1.bulletPoint
- : showCheckmark
- ? ICONS$1.checkmark
- : showBlank
- ? ICONS$1.blank
- : null;
- const itemIndicator = selectedIcon ? (hAsync("calcite-icon", { class: {
- [CSS$1.bulletPointIcon]: selectedIcon === ICONS$1.bulletPoint,
- [CSS$1.checkmarkIcon]: selectedIcon === ICONS$1.checkmark,
- [CSS_UTILITY.rtl]: rtl
- }, icon: selectedIcon, scale: "s" })) : null;
- const hidden = !(this.parentExpanded || this.depth === 1);
- 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" }, hAsync("div", { class: {
- [CSS$1.nodeContainer]: true,
- [CSS_UTILITY.rtl]: rtl
- }, "data-selection-mode": this.selectionMode, ref: (el) => (this.defaultSlotWrapper = el) }, chevron, itemIndicator, checkbox ? checkbox : defaultSlotNode), hAsync("div", { class: {
- [CSS$1.childrenContainer]: true,
- [CSS_UTILITY.rtl]: rtl
- }, "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 }))));
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- onClick(event) {
- // Solve for if the item is clicked somewhere outside the slotted anchor.
- // Anchor is triggered anywhere you click
- const [link] = filterDirectChildren(this.el, "a");
- if (link && event.composedPath()[0].tagName.toLowerCase() !== "a") {
- const target = link.target === "" ? "_self" : link.target;
- window.open(link.href, target);
- }
- this.calciteInternalTreeItemSelect.emit({
- modifyCurrentSelection: this.selectionMode === TreeSelectionMode.Ancestors || this.isSelectionMultiLike,
- forceToggle: false
- });
- }
- keyDownHandler(event) {
- let root;
- switch (event.key) {
- case " ":
- this.calciteInternalTreeItemSelect.emit({
- modifyCurrentSelection: this.isSelectionMultiLike,
- forceToggle: false
- });
- event.preventDefault();
- break;
- case "Enter":
- // 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.
- const link = nodeListToArray(this.el.children).find((el) => el.matches("a"));
- if (link) {
- link.click();
- this.selected = true;
- }
- else {
- this.calciteInternalTreeItemSelect.emit({
- modifyCurrentSelection: this.isSelectionMultiLike,
- forceToggle: false
- });
- }
- event.preventDefault();
- break;
- case "Home":
- root = this.el.closest("calcite-tree:not([child])");
- const firstNode = root.querySelector("calcite-tree-item");
- firstNode === null || firstNode === void 0 ? void 0 : firstNode.focus();
- break;
- case "End":
- root = this.el.closest("calcite-tree:not([child])");
- let currentNode = root.children[root.children.length - 1]; // last child
- let currentTree = nodeListToArray(currentNode.children).find((el) => el.matches("calcite-tree"));
- while (currentTree) {
- currentNode = currentTree.children[root.children.length - 1];
- currentTree = nodeListToArray(currentNode.children).find((el) => el.matches("calcite-tree"));
- }
- currentNode === null || currentNode === void 0 ? void 0 : currentNode.focus();
- break;
- }
- }
- get el() { return getElement(this); }
- static get watchers() { return {
- "expanded": ["expandedHandler"],
- "selectionMode": ["getselectionMode"]
- }; }
- static get style() { return treeItemCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-tree-item",
- "$members$": {
- "disabled": [516],
- "selected": [1540],
- "expanded": [1540],
- "parentExpanded": [4, "parent-expanded"],
- "depth": [1538],
- "hasChildren": [1540, "has-children"],
- "lines": [1540],
- "inputEnabled": [4, "input-enabled"],
- "scale": [1537],
- "indeterminate": [516],
- "selectionMode": [1537, "selection-mode"]
- },
- "$listeners$": [[0, "click", "onClick"], [0, "keydown", "keyDownHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["selected", "selected"], ["expanded", "expanded"], ["depth", "depth"], ["hasChildren", "has-children"], ["lines", "lines"], ["scale", "scale"], ["indeterminate", "indeterminate"], ["selectionMode", "selection-mode"]]
- }; }
- }
- const CSS = {
- container: "container",
- handle: "handle"
- };
- var ICON_TYPES;
- (function (ICON_TYPES) {
- ICON_TYPES["grip"] = "grip";
- })(ICON_TYPES || (ICON_TYPES = {}));
- function getScreenReaderText(item, status, valueList) {
- const { items, intlDragHandleIdle, intlDragHandleActive, intlDragHandleChange, intlDragHandleCommit } = valueList;
- const total = items.length;
- const position = getItemIndex(valueList, item) + 1;
- if (status === "idle") {
- const idleText = intlDragHandleIdle
- ? replacePlaceholders(intlDragHandleIdle, item.label, position, total)
- : `${item.label}, press space and use arrow keys to reorder content. Current position ${position} of ${total}.`;
- return idleText;
- }
- else if (status === "active") {
- const activeText = intlDragHandleActive
- ? replacePlaceholders(intlDragHandleActive, item.label, position, total)
- : `Reordering ${item.label}, current position ${position} of ${total}.`;
- return activeText;
- }
- else if (status === "change") {
- const changeText = intlDragHandleChange
- ? replacePlaceholders(intlDragHandleChange, item.label, position, total)
- : `${item.label}, new position ${position} of ${total}. Press space to confirm.`;
- return changeText;
- }
- else {
- const commitText = intlDragHandleCommit
- ? replacePlaceholders(intlDragHandleCommit, item.label, position, total)
- : `${item.label}, current position ${position} of ${total}.`;
- return commitText;
- }
- }
- function getHandleAndItemElement(event) {
- const handle = event
- .composedPath()
- .find((item) => { var _a; return ((_a = item.dataset) === null || _a === void 0 ? void 0 : _a.jsHandle) !== undefined; });
- const item = event
- .composedPath()
- .find((item) => { var _a; return ((_a = item.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "calcite-value-list-item"; });
- return { handle, item };
- }
- function replacePlaceholders(text, label, position, total) {
- const replacePosition = text.replace("${position}", position.toString());
- const replaceLabel = replacePosition.replace("${item.label}", label);
- return replaceLabel.replace("${total}", total.toString());
- }
- const valueListCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-value-list{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-value-list{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-value-list{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-value-list{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-value-list:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-value-list:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-value-list-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-value-list-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-value-list-h{position:relative;box-sizing:border-box;display:flex;flex-shrink:0;flex-grow:0;flex-direction:column;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{box-sizing:border-box}/*!@: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;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-block-end:0.25rem;display:flex;align-items:center;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);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:sticky;inset-block-start:0px;z-index:300}/*!@calcite-filter*/calcite-filter.sc-calcite-value-list{margin-block-end:1px}";
- /**
- * @slot - A slot for adding `calcite-value-list-item` elements. List items are displayed as a vertical list.
- * @slot menu-actions - A slot for adding a button and menu combination for performing actions, such as sorting.
- */
- class ValueList {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteListChange = createEvent(this, "calciteListChange", 6);
- this.calciteListOrderChange = createEvent(this, "calciteListOrderChange", 6);
- // --------------------------------------------------------------------------
- //
- // Properties
- //
- // --------------------------------------------------------------------------
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * When `true`, `calcite-value-list-item`s are sortable via a draggable button.
- */
- this.dragEnabled = false;
- /**
- * When `true`, an input appears at the top of the component that can be used by end users to filter list items.
- */
- this.filterEnabled = false;
- /**
- * When `true`, a busy indicator is displayed.
- */
- this.loading = false;
- /**
- * Similar to standard radio buttons and checkboxes.
- * When `true`, a user can select multiple `calcite-value-list-item`s at a time.
- * When `false`, only a single `calcite-value-list-item` can be selected at a time,
- * and a new selection will deselect previous selections.
- */
- this.multiple = false;
- /**
- * When `true` and single-selection is enabled, the selection changes when navigating `calcite-value-list-item`s via keyboard.
- */
- this.selectionFollowsFocus = false;
- // --------------------------------------------------------------------------
- //
- // Private Properties
- //
- // --------------------------------------------------------------------------
- this.selectedValues = new Map();
- this.dataForFilter = [];
- this.lastSelectedItem = null;
- this.mutationObserver = createObserver("mutation", mutationObserverCallback.bind(this));
- this.setFilterEl = (el) => {
- this.filterEl = el;
- };
- this.deselectRemovedItems = deselectRemovedItems.bind(this);
- this.deselectSiblingItems = deselectSiblingItems.bind(this);
- this.selectSiblings = selectSiblings.bind(this);
- this.handleFilter = handleFilter.bind(this);
- this.getItemData = getItemData.bind(this);
- this.keyDownHandler = (event) => {
- if (event.defaultPrevented) {
- return;
- }
- const { handle, item } = getHandleAndItemElement(event);
- if (handle && !item.handleActivated && event.key === " ") {
- this.updateScreenReaderText(getScreenReaderText(item, "commit", this));
- }
- if (!handle || !item.handleActivated) {
- keyDownHandler.call(this, event);
- return;
- }
- const { items } = this;
- if (event.key === " ") {
- this.updateScreenReaderText(getScreenReaderText(item, "active", this));
- }
- if ((event.key !== "ArrowUp" && event.key !== "ArrowDown") || items.length <= 1) {
- return;
- }
- event.preventDefault();
- const { el } = this;
- const nextIndex = moveItemIndex(this, item, event.key === "ArrowUp" ? "up" : "down");
- if (nextIndex === items.length - 1) {
- el.appendChild(item);
- }
- else {
- const itemAtNextIndex = el.children[nextIndex];
- const insertionReferenceItem = itemAtNextIndex === item.nextElementSibling
- ? itemAtNextIndex.nextElementSibling
- : itemAtNextIndex;
- el.insertBefore(item, insertionReferenceItem);
- }
- this.items = this.getItems();
- this.calciteListOrderChange.emit(this.items.map(({ value }) => value));
- requestAnimationFrame(() => handle === null || handle === void 0 ? void 0 : handle.focus());
- item.handleActivated = true;
- this.updateHandleAriaLabel(handle, getScreenReaderText(item, "change", this));
- };
- this.storeAssistiveEl = (el) => {
- this.assistiveTextEl = el;
- };
- this.handleFocusIn = (event) => {
- const { handle, item } = getHandleAndItemElement(event);
- if (!(item === null || item === void 0 ? void 0 : item.handleActivated) && item && handle) {
- this.updateHandleAriaLabel(handle, getScreenReaderText(item, "idle", this));
- }
- };
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- initialize.call(this);
- initializeObserver.call(this);
- }
- componentDidLoad() {
- this.setUpDragAndDrop();
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- disconnectedCallback() {
- cleanUpObserver.call(this);
- this.cleanUpDragAndDrop();
- }
- calciteListFocusOutHandler(event) {
- calciteListFocusOutHandler.call(this, event);
- }
- calciteListItemRemoveHandler(event) {
- removeItem.call(this, event);
- }
- calciteListItemChangeHandler(event) {
- calciteListItemChangeHandler.call(this, event);
- }
- calciteInternalListItemPropsChangeHandler(event) {
- event.stopPropagation();
- this.setUpFilter();
- }
- calciteInternalListItemValueChangeHandler(event) {
- calciteInternalListItemValueChangeHandler.call(this, event);
- event.stopPropagation();
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- getItems() {
- return Array.from(this.el.querySelectorAll("calcite-value-list-item"));
- }
- setUpItems() {
- setUpItems.call(this, "calcite-value-list-item");
- }
- setUpFilter() {
- if (this.filterEnabled) {
- this.dataForFilter = this.getItemData();
- }
- }
- setUpDragAndDrop() {
- this.cleanUpDragAndDrop();
- if (!this.dragEnabled) {
- return;
- }
- this.sortable = Sortable.create(this.el, {
- dataIdAttr: "id",
- handle: `.${CSS.handle}`,
- draggable: "calcite-value-list-item",
- group: this.group,
- onSort: () => {
- this.items = Array.from(this.el.querySelectorAll("calcite-value-list-item"));
- const values = this.items.map((item) => item.value);
- this.calciteListOrderChange.emit(values);
- }
- });
- }
- cleanUpDragAndDrop() {
- var _a;
- (_a = this.sortable) === null || _a === void 0 ? void 0 : _a.destroy();
- this.sortable = null;
- }
- handleBlur() {
- if (this.dragEnabled) {
- this.updateScreenReaderText("");
- }
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /** Returns the currently selected items */
- async getSelectedItems() {
- return this.selectedValues;
- }
- /**
- * Sets focus on the component.
- *
- * @param focusId
- */
- async setFocus(focusId) {
- return setFocus.call(this, focusId);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- getIconType() {
- let type = null;
- if (this.dragEnabled) {
- type = ICON_TYPES.grip;
- }
- return type;
- }
- updateScreenReaderText(text) {
- this.assistiveTextEl.textContent = text;
- }
- updateHandleAriaLabel(handleElement, text) {
- handleElement.ariaLabel = text;
- }
- render() {
- return (hAsync(List, { onBlur: this.handleBlur, onFocusin: this.handleFocusIn, onKeyDown: this.keyDownHandler, props: this }));
- }
- get el() { return getElement(this); }
- static get style() { return valueListCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-value-list",
- "$members$": {
- "disabled": [516],
- "dragEnabled": [516, "drag-enabled"],
- "filterEnabled": [516, "filter-enabled"],
- "filterPlaceholder": [513, "filter-placeholder"],
- "group": [513],
- "loading": [516],
- "multiple": [516],
- "selectionFollowsFocus": [516, "selection-follows-focus"],
- "intlDragHandleIdle": [1, "intl-drag-handle-idle"],
- "intlDragHandleActive": [1, "intl-drag-handle-active"],
- "intlDragHandleChange": [1, "intl-drag-handle-change"],
- "intlDragHandleCommit": [1, "intl-drag-handle-commit"],
- "selectedValues": [32],
- "dataForFilter": [32],
- "getSelectedItems": [64],
- "setFocus": [64]
- },
- "$listeners$": [[0, "focusout", "calciteListFocusOutHandler"], [0, "calciteListItemRemove", "calciteListItemRemoveHandler"], [0, "calciteListItemChange", "calciteListItemChangeHandler"], [0, "calciteInternalListItemPropsChange", "calciteInternalListItemPropsChangeHandler"], [0, "calciteInternalListItemValueChange", "calciteInternalListItemValueChangeHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["disabled", "disabled"], ["dragEnabled", "drag-enabled"], ["filterEnabled", "filter-enabled"], ["filterPlaceholder", "filter-placeholder"], ["group", "group"], ["loading", "loading"], ["multiple", "multiple"], ["selectionFollowsFocus", "selection-follows-focus"]]
- }; }
- }
- const ICONS = {
- drag: "drag"
- };
- const SLOTS = {
- actionsEnd: "actions-end",
- actionsStart: "actions-start"
- };
- const valueListItemCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity: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;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}/*!@.calcite-animate__in*/.calcite-animate__in.sc-calcite-value-list-item{animation-name:in}/*!@.calcite-animate__in-down*/.calcite-animate__in-down.sc-calcite-value-list-item{animation-name:in-down}/*!@.calcite-animate__in-up*/.calcite-animate__in-up.sc-calcite-value-list-item{animation-name:in-up}/*!@.calcite-animate__in-scale*/.calcite-animate__in-scale.sc-calcite-value-list-item{animation-name:in-scale}@media (prefers-reduced-motion: reduce){/*!@:root*/.sc-calcite-value-list-item:root{--calcite-internal-duration-factor:0.01}}/*!@:root*/.sc-calcite-value-list-item:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}/*!@:host([hidden])*/[hidden].sc-calcite-value-list-item-h{display:none}/*!@:host([disabled])*/[disabled].sc-calcite-value-list-item-h{pointer-events:none;cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}/*!@:host*/.sc-calcite-value-list-item-h{margin-block-end:1px;box-sizing:border-box;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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);transition:background-color var(--calcite-animation-timing), box-shadow var(--calcite-animation-timing)}/*!@:host **/.sc-calcite-value-list-item-h *.sc-calcite-value-list-item{box-sizing:border-box}/*!@calcite-pick-list-item*/calcite-pick-list-item.sc-calcite-value-list-item{position:relative;margin:0px;flex-grow:1;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}/*!@:host([active]), \n: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);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:flex;cursor:move;align-items:center;justify-content:center;border-style:none;background-color:transparent;padding-block:0px;padding-inline:0.25rem;color:var(--calcite-ui-border-input);outline-color:transparent}/*!@.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]) ::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}";
- /**
- * @slot actions-end - A slot for adding actions or content to the end side of the component.
- * @slot actions-start - A slot for adding actions or content to the start side of the component.
- */
- class ValueListItem {
- constructor(hostRef) {
- registerInstance(this, hostRef);
- this.calciteListItemRemove = createEvent(this, "calciteListItemRemove", 7);
- /**
- * When `true`, interaction is prevented and the component is displayed with lower opacity.
- */
- this.disabled = false;
- /**
- * @internal
- */
- this.disableDeselect = false;
- /**
- * When `true`, prevents the content of the component from user interaction.
- */
- this.nonInteractive = false;
- /**
- * @internal
- */
- this.handleActivated = false;
- /**
- * Determines the icon SVG symbol that will be shown. Options are circle, square, grip or null.
- *
- * @see [ICON_TYPES](https://github.com/Esri/calcite-components/blob/master/src/components/pick-list/resources.ts#L5)
- */
- this.icon = null;
- /**
- * When `true`, adds an action to remove the component.
- */
- this.removable = false;
- /**
- * When `true`, the component is selected.
- */
- this.selected = false;
- this.pickListItem = null;
- this.guid = `calcite-value-list-item-${guid()}`;
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.getPickListRef = (el) => (this.pickListItem = el);
- this.handleKeyDown = (event) => {
- if (event.key === " ") {
- this.handleActivated = !this.handleActivated;
- }
- };
- this.handleBlur = () => {
- this.handleActivated = false;
- };
- this.handleSelectChange = (event) => {
- this.selected = event.detail.selected;
- };
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- connectConditionalSlotComponent(this);
- }
- disconnectedCallback() {
- disconnectConditionalSlotComponent(this);
- }
- componentDidRender() {
- updateHostInteraction(this, this.el.closest("calcite-value-list") ? "managed" : false);
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /**
- * Toggle the selection state. By default this won't trigger an event.
- * The first argument allows the value to be coerced, rather than swapping values.
- *
- * @param coerce
- */
- async toggleSelected(coerce) {
- this.pickListItem.toggleSelected(coerce);
- }
- /** Set focus on the component. */
- async setFocus() {
- var _a;
- (_a = this.pickListItem) === null || _a === void 0 ? void 0 : _a.setFocus();
- }
- calciteListItemChangeHandler(event) {
- // adjust item payload from wrapped item before bubbling
- event.detail.item = this.el;
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- renderActionsEnd() {
- const { el } = this;
- const hasActionsEnd = getSlotted(el, SLOTS.actionsEnd);
- return hasActionsEnd ? (hAsync("slot", { name: SLOTS.actionsEnd, slot: SLOTS$9.actionsEnd })) : null;
- }
- renderActionsStart() {
- const { el } = this;
- const hasActionsStart = getSlotted(el, SLOTS.actionsStart);
- return hasActionsStart ? (hAsync("slot", { name: SLOTS.actionsStart, slot: SLOTS$9.actionsStart })) : null;
- }
- renderHandle() {
- const { icon } = this;
- if (icon === ICON_TYPES$1.grip) {
- return (hAsync("span", { class: {
- [CSS$i.handle]: true,
- [CSS$i.handleActivated]: this.handleActivated
- }, "data-js-handle": true, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, role: "button", tabindex: "0" }, hAsync("calcite-icon", { icon: ICONS.drag, scale: "s" })));
- }
- }
- render() {
- 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())));
- }
- get el() { return getElement(this); }
- static get style() { return valueListItemCss; }
- static get cmpMeta() { return {
- "$flags$": 9,
- "$tagName$": "calcite-value-list-item",
- "$members$": {
- "description": [513],
- "disabled": [516],
- "disableDeselect": [4, "disable-deselect"],
- "nonInteractive": [516, "non-interactive"],
- "handleActivated": [1028, "handle-activated"],
- "icon": [513],
- "label": [513],
- "metadata": [16],
- "removable": [516],
- "selected": [1540],
- "value": [8],
- "toggleSelected": [64],
- "setFocus": [64]
- },
- "$listeners$": [[0, "calciteListItemChange", "calciteListItemChangeHandler"]],
- "$lazyBundleId$": "-",
- "$attrsToReflect$": [["description", "description"], ["disabled", "disabled"], ["nonInteractive", "non-interactive"], ["icon", "icon"], ["label", "label"], ["removable", "removable"], ["selected", "selected"]]
- }; }
- }
- registerComponents([
- Accordion,
- AccordionItem,
- Action,
- ActionBar,
- ActionGroup,
- ActionMenu,
- ActionPad,
- Alert,
- Avatar,
- Block,
- BlockSection,
- Button,
- Card,
- Checkbox,
- Chip,
- ColorPicker,
- ColorPickerHexInput,
- ColorPickerSwatch,
- Combobox,
- ComboboxItem,
- ComboboxItemGroup,
- DatePicker,
- DatePickerDay,
- DatePickerMonth,
- DatePickerMonthHeader,
- Dropdown,
- DropdownGroup,
- DropdownItem,
- Fab,
- Filter,
- Flow,
- FlowItem,
- Graph,
- Handle,
- Icon,
- InlineEditable,
- Input,
- InputDatePicker,
- InputMessage,
- InputNumber,
- InputText,
- InputTimePicker,
- Label,
- Link,
- List$1,
- ListItem,
- ListItemGroup,
- Loader,
- Modal,
- Notice,
- Option,
- OptionGroup,
- Pagination,
- Panel,
- PickList,
- PickListGroup,
- PickListItem,
- Popover,
- PopoverManager,
- Progress,
- RadioButton,
- RadioButtonGroup,
- RadioGroup,
- RadioGroupItem,
- Rating,
- Scrim,
- Select,
- Shell,
- ShellCenterRow,
- ShellPanel,
- Slider,
- SortableList,
- SplitButton,
- Stepper,
- StepperItem,
- Switch,
- Tab,
- TabNav,
- TabTitle,
- Tabs,
- Tile,
- TileSelect,
- TileSelectGroup,
- TimePicker,
- Tip,
- TipGroup,
- TipManager,
- Tooltip,
- TooltipManager,
- Tree,
- TreeItem,
- ValueList,
- ValueListItem,
- ]);
- exports.hydrateApp = hydrateApp;
- /*hydrateAppClosure end*/
- hydrateApp(window, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve);
- }
- hydrateAppClosure($stencilWindow);
- }
- function createWindowFromHtml(e, t) {
- let r = templateWindows.get(t);
- return null == r && (r = new MockWindow(e), templateWindows.set(t, r)), cloneWindow(r);
- }
- function inspectElement(e, t, r) {
- const s = t.children;
- for (let t = 0, n = s.length; t < n; t++) {
- const n = s[t], o = n.nodeName.toLowerCase();
- if (o.includes("-")) {
- const t = e.components.find((e => e.tag === o));
- null != t && (t.count++, r > t.depth && (t.depth = r));
- } else switch (o) {
- case "a":
- const t = collectAttributes(n);
- t.href = n.href, "string" == typeof t.href && (e.anchors.some((e => e.href === t.href)) || e.anchors.push(t));
- break;
- case "img":
- const r = collectAttributes(n);
- r.src = n.src, "string" == typeof r.src && (e.imgs.some((e => e.src === r.src)) || e.imgs.push(r));
- break;
- case "link":
- const s = collectAttributes(n);
- 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,
- delete s.type, e.styles.push(s)));
- break;
- case "script":
- const o = collectAttributes(n);
- 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 {
- const t = n.getAttribute("data-stencil-static");
- t && e.staticData.push({
- id: t,
- type: n.getAttribute("type"),
- content: n.textContent
- });
- }
- }
- inspectElement(e, n, ++r);
- }
- }
- function collectAttributes(e) {
- const t = {}, r = e.attributes;
- for (let e = 0, s = r.length; e < s; e++) {
- const s = r.item(e), n = s.nodeName.toLowerCase();
- if (SKIP_ATTRS.has(n)) continue;
- const o = s.nodeValue;
- "class" === n && "" === o || (t[n] = o);
- }
- return t;
- }
- function patchDomImplementation(e, t) {
- let r;
- if (null != e.defaultView ? (t.destroyWindow = !0, patchWindow(e.defaultView), r = e.defaultView) : (t.destroyWindow = !0,
- t.destroyDocument = !1, r = new MockWindow(!1)), r.document !== e && (r.document = e),
- e.defaultView !== r && (e.defaultView = r), "function" != typeof e.documentElement.constructor.prototype.getRootNode && (e.createElement("unknown-element").constructor.prototype.getRootNode = getRootNode),
- "function" == typeof e.createEvent) {
- const t = e.createEvent("CustomEvent").constructor;
- r.CustomEvent !== t && (r.CustomEvent = t);
- }
- try {
- e.baseURI;
- } catch (t) {
- Object.defineProperty(e, "baseURI", {
- get() {
- const t = e.querySelector("base[href]");
- return t ? new URL(t.getAttribute("href"), r.location.href).href : r.location.href;
- }
- });
- }
- return r;
- }
- function getRootNode(e) {
- const t = null != e && !0 === e.composed;
- let r = this;
- for (;null != r.parentNode; ) r = r.parentNode, !0 === t && null == r.parentNode && null != r.host && (r = r.host);
- return r;
- }
- function normalizeHydrateOptions(e) {
- const t = Object.assign({
- serializeToHtml: !1,
- destroyWindow: !1,
- destroyDocument: !1
- }, e || {});
- return "boolean" != typeof t.clientHydrateAnnotations && (t.clientHydrateAnnotations = !0),
- "boolean" != typeof t.constrainTimeouts && (t.constrainTimeouts = !0), "number" != typeof t.maxHydrateCount && (t.maxHydrateCount = 300),
- "boolean" != typeof t.runtimeLogging && (t.runtimeLogging = !1), "number" != typeof t.timeout && (t.timeout = 15e3),
- Array.isArray(t.excludeComponents) ? t.excludeComponents = t.excludeComponents.filter(filterValidTags).map(mapValidTags) : t.excludeComponents = [],
- Array.isArray(t.staticComponents) ? t.staticComponents = t.staticComponents.filter(filterValidTags).map(mapValidTags) : t.staticComponents = [],
- t;
- }
- function filterValidTags(e) {
- return "string" == typeof e && e.includes("-");
- }
- function mapValidTags(e) {
- return e.trim().toLowerCase();
- }
- function generateHydrateResults(e) {
- "string" != typeof e.url && (e.url = "https://hydrate.stenciljs.com/"), "string" != typeof e.buildId && (e.buildId = createHydrateBuildId());
- const t = {
- buildId: e.buildId,
- diagnostics: [],
- url: e.url,
- host: null,
- hostname: null,
- href: null,
- pathname: null,
- port: null,
- search: null,
- hash: null,
- html: null,
- httpStatus: null,
- hydratedCount: 0,
- anchors: [],
- components: [],
- imgs: [],
- scripts: [],
- staticData: [],
- styles: [],
- title: null
- };
- try {
- const r = new URL(e.url, "https://hydrate.stenciljs.com/");
- t.url = r.href, t.host = r.host, t.hostname = r.hostname, t.href = r.href, t.port = r.port,
- t.pathname = r.pathname, t.search = r.search, t.hash = r.hash;
- } catch (e) {
- renderCatchError(t, e);
- }
- return t;
- }
- function renderBuildDiagnostic(e, t, r, s) {
- const n = {
- level: t,
- type: "build",
- header: r,
- messageText: s,
- relFilePath: null,
- absFilePath: null,
- lines: []
- };
- return e.pathname ? "/" !== e.pathname && (n.header += ": " + e.pathname) : e.url && (n.header += ": " + e.url),
- e.diagnostics.push(n), n;
- }
- function renderBuildError(e, t) {
- return renderBuildDiagnostic(e, "error", "Hydrate Error", t);
- }
- function renderCatchError(e, t) {
- const r = renderBuildError(e, null);
- return null != t && (null != t.stack ? r.messageText = t.stack.toString() : null != t.message ? r.messageText = t.message.toString() : r.messageText = t.toString()),
- r;
- }
- function runtimeLog(e, t, r) {
- global.console[t].apply(global.console, [ `[ ${e} ${t} ] `, ...r ]);
- }
- function renderToString(e, t) {
- const r = normalizeHydrateOptions(t);
- return r.serializeToHtml = !0, new Promise((t => {
- let s;
- const n = generateHydrateResults(r);
- if (hasError(n.diagnostics)) t(n); else if ("string" == typeof e) try {
- r.destroyWindow = !0, r.destroyDocument = !0, s = new MockWindow(e), render(s, r, n, t);
- } catch (e) {
- s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
- } else if (isValidDocument(e)) try {
- r.destroyDocument = !1, s = patchDomImplementation(e, r), render(s, r, n, t);
- } catch (e) {
- s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
- } else renderBuildError(n, 'Invalid html or document. Must be either a valid "html" string, or DOM "document".'),
- t(n);
- }));
- }
- function hydrateDocument(e, t) {
- const r = normalizeHydrateOptions(t);
- return r.serializeToHtml = !1, new Promise((t => {
- let s;
- const n = generateHydrateResults(r);
- if (hasError(n.diagnostics)) t(n); else if ("string" == typeof e) try {
- r.destroyWindow = !0, r.destroyDocument = !0, s = new MockWindow(e), render(s, r, n, t);
- } catch (e) {
- s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
- } else if (isValidDocument(e)) try {
- r.destroyDocument = !1, s = patchDomImplementation(e, r), render(s, r, n, t);
- } catch (e) {
- s && s.close && s.close(), s = null, renderCatchError(n, e), t(n);
- } else renderBuildError(n, 'Invalid html or document. Must be either a valid "html" string, or DOM "document".'),
- t(n);
- }));
- }
- function render(e, t, r, s) {
- if (process.__stencilErrors || (process.__stencilErrors = !0, process.on("unhandledRejection", (e => {
- console.log("unhandledRejection", e);
- }))), function n(e, t, r, s) {
- try {
- e.location.href = r.url;
- } catch (e) {
- renderCatchError(s, e);
- }
- if ("string" == typeof r.userAgent) try {
- e.navigator.userAgent = r.userAgent;
- } catch (e) {}
- if ("string" == typeof r.cookie) try {
- t.cookie = r.cookie;
- } catch (e) {}
- if ("string" == typeof r.referrer) try {
- t.referrer = r.referrer;
- } catch (e) {}
- if ("string" == typeof r.direction) try {
- t.documentElement.setAttribute("dir", r.direction);
- } catch (e) {}
- if ("string" == typeof r.language) try {
- t.documentElement.setAttribute("lang", r.language);
- } catch (e) {}
- if ("string" == typeof r.buildId) try {
- t.documentElement.setAttribute("data-stencil-build", r.buildId);
- } catch (e) {}
- try {
- e.customElements = null;
- } catch (e) {}
- return r.constrainTimeouts && constrainTimeouts(e), function n(e, t, r) {
- try {
- const s = e.location.pathname;
- e.console.error = (...e) => {
- const n = e.reduce(((e, t) => {
- if (t) {
- if (null != t.stack) return e + " " + String(t.stack);
- if (null != t.message) return e + " " + String(t.message);
- }
- return String(t);
- }), "").trim();
- "" !== n && (renderCatchError(r, n), t.runtimeLogging && runtimeLog(s, "error", [ n ]));
- }, e.console.debug = (...e) => {
- renderBuildDiagnostic(r, "debug", "Hydrate Debug", [ ...e ].join(", ")), t.runtimeLogging && runtimeLog(s, "debug", e);
- }, t.runtimeLogging && [ "log", "warn", "assert", "info", "trace" ].forEach((t => {
- e.console[t] = (...e) => {
- runtimeLog(s, t, e);
- };
- }));
- } catch (e) {
- renderCatchError(r, e);
- }
- }(e, r, s), e;
- }(e, e.document, t, r), "function" == typeof t.beforeHydrate) try {
- const n = t.beforeHydrate(e.document);
- isPromise(n) ? n.then((() => {
- hydrateFactory(e, t, r, afterHydrate, s);
- })) : hydrateFactory(e, t, r, afterHydrate, s);
- } catch (n) {
- renderCatchError(r, n), finalizeHydrate(e, e.document, t, r, s);
- } else hydrateFactory(e, t, r, afterHydrate, s);
- }
- function afterHydrate(e, t, r, s) {
- if ("function" == typeof t.afterHydrate) try {
- const n = t.afterHydrate(e.document);
- isPromise(n) ? n.then((() => {
- finalizeHydrate(e, e.document, t, r, s);
- })) : finalizeHydrate(e, e.document, t, r, s);
- } catch (n) {
- renderCatchError(r, n), finalizeHydrate(e, e.document, t, r, s);
- } else finalizeHydrate(e, e.document, t, r, s);
- }
- function finalizeHydrate(e, t, r, s, n) {
- try {
- if (inspectElement(s, t.documentElement, 0), !1 !== r.removeUnusedStyles) try {
- ((e, t) => {
- try {
- const r = e.head.querySelectorAll("style[data-styles]"), s = r.length;
- if (s > 0) {
- const n = (e => {
- const t = {
- attrs: new Set,
- classNames: new Set,
- ids: new Set,
- tags: new Set
- };
- return collectUsedSelectors(t, e), t;
- })(e.documentElement);
- for (let e = 0; e < s; e++) removeUnusedStyleText(n, t, r[e]);
- }
- } catch (e) {
- ((e, t, r) => {
- const s = {
- level: "error",
- type: "build",
- header: "Build Error",
- messageText: "build error",
- relFilePath: null,
- absFilePath: null,
- lines: []
- };
- 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()),
- null == e || shouldIgnoreError(s.messageText) || e.push(s);
- })(t, e);
- }
- })(t, s.diagnostics);
- } catch (e) {
- renderCatchError(s, e);
- }
- if ("string" == typeof r.title) try {
- t.title = r.title;
- } catch (e) {
- renderCatchError(s, e);
- }
- s.title = t.title, r.removeScripts && removeScripts(t.documentElement);
- try {
- ((e, t) => {
- let r = e.head.querySelector('link[rel="canonical"]');
- "string" == typeof t ? (null == r && (r = e.createElement("link"), r.setAttribute("rel", "canonical"),
- e.head.appendChild(r)), r.setAttribute("href", t)) : null != r && (r.getAttribute("href") || r.parentNode.removeChild(r));
- })(t, r.canonicalUrl);
- } catch (e) {
- renderCatchError(s, e);
- }
- try {
- (e => {
- const t = e.head;
- let r = t.querySelector("meta[charset]");
- null == r ? (r = e.createElement("meta"), r.setAttribute("charset", "utf-8")) : r.remove(),
- t.insertBefore(r, t.firstChild);
- })(t);
- } catch (e) {}
- hasError(s.diagnostics) || (s.httpStatus = 200);
- try {
- const e = t.head.querySelector('meta[http-equiv="status"]');
- if (null != e) {
- const t = e.getAttribute("content");
- t && t.length > 0 && (s.httpStatus = parseInt(t, 10));
- }
- } catch (e) {}
- r.clientHydrateAnnotations && t.documentElement.classList.add("hydrated"), r.serializeToHtml && (s.html = serializeDocumentToString(t, r));
- } catch (e) {
- renderCatchError(s, e);
- }
- if (r.destroyWindow) try {
- r.destroyDocument || (e.document = null, t.defaultView = null), e.close && e.close();
- } catch (e) {
- renderCatchError(s, e);
- }
- n(s);
- }
- function serializeDocumentToString(e, t) {
- return serializeNodeToHtml(e, {
- approximateLineWidth: t.approximateLineWidth,
- outerHtml: !1,
- prettyHtml: t.prettyHtml,
- removeAttributeQuotes: t.removeAttributeQuotes,
- removeBooleanAttributeQuotes: t.removeBooleanAttributeQuotes,
- removeEmptyAttributes: t.removeEmptyAttributes,
- removeHtmlComments: t.removeHtmlComments,
- serializeShadowRoot: !1
- });
- }
- function isValidDocument(e) {
- return null != e && 9 === e.nodeType && null != e.documentElement && 1 === e.documentElement.nodeType && null != e.body && 1 === e.body.nodeType;
- }
- function removeScripts(e) {
- const t = e.children;
- for (let e = t.length - 1; e >= 0; e--) {
- const r = t[e];
- removeScripts(r), ("SCRIPT" === r.nodeName || "LINK" === r.nodeName && "modulepreload" === r.getAttribute("rel")) && r.remove();
- }
- }
- const templateWindows = new Map, 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", parseCss = (e, t) => {
- let r = 1, s = 1;
- const n = [], o = e => {
- const t = e.match(/\n/g);
- t && (r += t.length);
- const n = e.lastIndexOf("\n");
- s = ~n ? e.length - n : s + e.length;
- }, i = () => {
- const e = {
- line: r,
- column: s
- };
- return t => (t.position = new z(e), m(), t);
- }, a = o => {
- const i = e.split("\n"), a = {
- level: "error",
- type: "css",
- language: "css",
- header: "CSS Parse",
- messageText: o,
- absFilePath: t,
- lines: [ {
- lineIndex: r - 1,
- lineNumber: r,
- errorCharStart: s,
- text: e[r - 1]
- } ]
- };
- if (r > 1) {
- const t = {
- lineIndex: r - 1,
- lineNumber: r - 1,
- text: e[r - 2],
- errorCharStart: -1,
- errorLength: -1
- };
- a.lines.unshift(t);
- }
- if (r + 2 < i.length) {
- const e = {
- lineIndex: r,
- lineNumber: r + 1,
- text: i[r],
- errorCharStart: -1,
- errorLength: -1
- };
- a.lines.push(e);
- }
- return n.push(a), null;
- }, l = () => u(/^{\s*/), c = () => u(/^}/), u = t => {
- const r = t.exec(e);
- if (!r) return;
- const s = r[0];
- return o(s), e = e.slice(s.length), r;
- }, d = () => {
- let t;
- const r = [];
- for (m(), h(r); e.length && "}" !== e.charAt(0) && (t = w() || A()); ) !1 !== t && (r.push(t),
- h(r));
- return r;
- }, m = () => u(/^\s*/), h = e => {
- let t;
- for (e = e || []; t = p(); ) !1 !== t && e.push(t);
- return e;
- }, p = () => {
- const t = i();
- if ("/" !== e.charAt(0) || "*" !== e.charAt(1)) return null;
- let r = 2;
- for (;"" !== e.charAt(r) && ("*" !== e.charAt(r) || "/" !== e.charAt(r + 1)); ) ++r;
- if (r += 2, "" === e.charAt(r - 1)) return a("End of comment missing");
- const n = e.slice(2, r - 2);
- return s += 2, o(n), e = e.slice(r), s += 2, t({
- type: 1,
- comment: n
- });
- }, f = () => {
- const e = u(/^([^{]+)/);
- return e ? trim(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, "").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, (function(e) {
- return e.replace(/,/g, "");
- })).split(/\s*(?![^(]*\)),\s*/).map((function(e) {
- return e.replace(/\u200C/g, ",");
- })) : null;
- }, g = () => {
- const e = i();
- let t = u(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
- if (!t) return null;
- if (t = trim(t[0]), !u(/^:\s*/)) return a("property missing ':'");
- const r = u(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/), s = e({
- type: 4,
- property: t.replace(commentre, ""),
- value: r ? trim(r[0]).replace(commentre, "") : ""
- });
- return u(/^[;\s]*/), s;
- }, y = () => {
- const e = [];
- if (!l()) return a("missing '{'");
- let t;
- for (h(e); t = g(); ) !1 !== t && (e.push(t), h(e));
- return c() ? e : a("missing '}'");
- }, C = () => {
- let e;
- const t = [], r = i();
- for (;e = u(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/); ) t.push(e[1]), u(/^,\s*/);
- return t.length ? r({
- type: 9,
- values: t,
- declarations: y()
- }) : null;
- }, S = (e, t) => {
- const r = new RegExp("^@" + e + "\\s*([^;]+);");
- return () => {
- const s = i(), n = u(r);
- if (!n) return null;
- const o = {
- type: t
- };
- return o[e] = n[1].trim(), s(o);
- };
- }, E = S("import", 7), b = S("charset", 0), T = S("namespace", 11), w = () => "@" !== e[0] ? null : (() => {
- const e = i();
- let t = u(/^@([-\w]+)?keyframes\s*/);
- if (!t) return null;
- const r = t[1];
- if (t = u(/^([-\w]+)\s*/), !t) return a("@keyframes missing name");
- const s = t[1];
- if (!l()) return a("@keyframes missing '{'");
- let n, o = h();
- for (;n = C(); ) o.push(n), o = o.concat(h());
- return c() ? e({
- type: 8,
- name: s,
- vendor: r,
- keyframes: o
- }) : a("@keyframes missing '}'");
- })() || (() => {
- const e = i(), t = u(/^@media *([^{]+)/);
- if (!t) return null;
- const r = trim(t[1]);
- if (!l()) return a("@media missing '{'");
- const s = h().concat(d());
- return c() ? e({
- type: 10,
- media: r,
- rules: s
- }) : a("@media missing '}'");
- })() || (() => {
- const e = i(), t = u(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
- return t ? e({
- type: 2,
- name: trim(t[1]),
- media: trim(t[2])
- }) : null;
- })() || (() => {
- const e = i(), t = u(/^@supports *([^{]+)/);
- if (!t) return null;
- const r = trim(t[1]);
- if (!l()) return a("@supports missing '{'");
- const s = h().concat(d());
- return c() ? e({
- type: 15,
- supports: r,
- rules: s
- }) : a("@supports missing '}'");
- })() || E() || b() || T() || (() => {
- const e = i(), t = u(/^@([-\w]+)?document *([^{]+)/);
- if (!t) return null;
- const r = trim(t[1]), s = trim(t[2]);
- if (!l()) return a("@document missing '{'");
- const n = h().concat(d());
- return c() ? e({
- type: 3,
- document: s,
- vendor: r,
- rules: n
- }) : a("@document missing '}'");
- })() || (() => {
- const e = i();
- if (!u(/^@page */)) return null;
- const t = f() || [];
- if (!l()) return a("@page missing '{'");
- let r, s = h();
- for (;r = g(); ) s.push(r), s = s.concat(h());
- return c() ? e({
- type: 12,
- selectors: t,
- declarations: s
- }) : a("@page missing '}'");
- })() || (() => {
- const e = i();
- if (!u(/^@host\s*/)) return null;
- if (!l()) return a("@host missing '{'");
- const t = h().concat(d());
- return c() ? e({
- type: 6,
- rules: t
- }) : a("@host missing '}'");
- })() || (() => {
- const e = i();
- if (!u(/^@font-face\s*/)) return null;
- if (!l()) return a("@font-face missing '{'");
- let t, r = h();
- for (;t = g(); ) r.push(t), r = r.concat(h());
- return c() ? e({
- type: 5,
- declarations: r
- }) : a("@font-face missing '}'");
- })(), A = () => {
- const e = i(), t = f();
- return t ? (h(), e({
- type: 13,
- selectors: t,
- declarations: y()
- })) : a("selector missing");
- };
- class z {
- constructor(e) {
- this.start = e, this.end = {
- line: r,
- column: s
- }, this.source = t;
- }
- }
- return z.prototype.content = e, {
- diagnostics: n,
- ...addParent((() => {
- const e = d();
- return {
- type: 14,
- stylesheet: {
- source: t,
- rules: e
- }
- };
- })())
- };
- }, trim = e => e ? e.trim() : "", addParent = (e, t) => {
- const r = e && "string" == typeof e.type, s = r ? e : t;
- for (const t in e) {
- const r = e[t];
- Array.isArray(r) ? r.forEach((function(e) {
- addParent(e, s);
- })) : r && "object" == typeof r && addParent(r, s);
- }
- return r && Object.defineProperty(e, "parent", {
- configurable: !0,
- writable: !0,
- enumerable: !1,
- value: t || null
- }), e;
- }, commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g, getCssSelectors = e => {
- SELECTORS.all.length = SELECTORS.tags.length = SELECTORS.classNames.length = SELECTORS.ids.length = SELECTORS.attrs.length = 0;
- const t = (e = e.replace(/\./g, " .").replace(/\#/g, " #").replace(/\[/g, " [").replace(/\>/g, " > ").replace(/\+/g, " + ").replace(/\~/g, " ~ ").replace(/\*/g, " * ").replace(/\:not\((.*?)\)/g, " ")).split(" ");
- 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(),
- SELECTORS.attrs.push(t[e].toLowerCase())) : /[a-z]/g.test(t[e].charAt(0)) && SELECTORS.tags.push(t[e].toLowerCase()));
- return SELECTORS.classNames = SELECTORS.classNames.sort(((e, t) => e.length < t.length ? -1 : e.length > t.length ? 1 : 0)),
- SELECTORS;
- }, SELECTORS = {
- all: [],
- tags: [],
- classNames: [],
- ids: [],
- attrs: []
- }, serializeCssVisitNode = (e, t, r, s) => {
- const n = t.type;
- 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 + ";" : "";
- }, serializeCssRule = (e, t) => {
- const r = t.declarations, s = e.usedSelectors, n = t.selectors.slice();
- if (null == r || 0 === r.length) return "";
- if (s) {
- let t, r, o = !0;
- for (t = n.length - 1; t >= 0; t--) {
- const i = getCssSelectors(n[t]);
- o = !0;
- let a = i.classNames.length;
- if (a > 0 && e.hasUsedClassNames) for (r = 0; r < a; r++) if (!s.classNames.has(i.classNames[r])) {
- o = !1;
- break;
- }
- if (o && e.hasUsedTags && (a = i.tags.length, a > 0)) for (r = 0; r < a; r++) if (!s.tags.has(i.tags[r])) {
- o = !1;
- break;
- }
- if (o && e.hasUsedAttrs && (a = i.attrs.length, a > 0)) for (r = 0; r < a; r++) if (!s.attrs.has(i.attrs[r])) {
- o = !1;
- break;
- }
- if (o && e.hasUsedIds && (a = i.ids.length, a > 0)) for (r = 0; r < a; r++) if (!s.ids.has(i.ids[r])) {
- o = !1;
- break;
- }
- o || n.splice(t, 1);
- }
- }
- if (0 === n.length) return "";
- const o = [];
- let i = "";
- for (const e of t.selectors) i = removeSelectorWhitespace(e), o.includes(i) || o.push(i);
- return `${o}{${serializeCssMapVisit(e, r)}}`;
- }, serializeCssDeclaration = (e, t, r) => "" === e.value ? "" : r - 1 === t ? e.property + ":" + e.value : e.property + ":" + e.value + ";", serializeCssMedia = (e, t) => {
- const r = serializeCssMapVisit(e, t.rules);
- return "" === r ? "" : "@media " + removeMediaWhitespace(t.media) + "{" + r + "}";
- }, serializeCssKeyframes = (e, t) => {
- const r = serializeCssMapVisit(e, t.keyframes);
- return "" === r ? "" : "@" + (t.vendor || "") + "keyframes " + t.name + "{" + r + "}";
- }, serializeCssKeyframe = (e, t) => t.values.join(",") + "{" + serializeCssMapVisit(e, t.declarations) + "}", serializeCssFontFace = (e, t) => {
- const r = serializeCssMapVisit(e, t.declarations);
- return "" === r ? "" : "@font-face{" + r + "}";
- }, serializeCssSupports = (e, t) => {
- const r = serializeCssMapVisit(e, t.rules);
- return "" === r ? "" : "@supports " + t.supports + "{" + r + "}";
- }, serializeCssPage = (e, t) => "@page " + t.selectors.join(", ") + "{" + serializeCssMapVisit(e, t.declarations) + "}", serializeCssDocument = (e, t) => {
- const r = serializeCssMapVisit(e, t.rules), s = "@" + (t.vendor || "") + "document " + t.document;
- return "" === r ? "" : s + "{" + r + "}";
- }, serializeCssMapVisit = (e, t) => {
- let r = "";
- if (t) for (let s = 0, n = t.length; s < n; s++) r += serializeCssVisitNode(e, t[s], s, n);
- return r;
- }, removeSelectorWhitespace = e => {
- let t = "", r = "", s = !1;
- 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),
- !s && CSS_WS_REG.test(r)) {
- if (CSS_NEXT_CHAR_REG.test(e[n + 1])) continue;
- if (CSS_PREV_CHAR_REG.test(t[t.length - 1])) continue;
- t += " ";
- } else t += r;
- return t;
- }, removeMediaWhitespace = e => {
- let t = "", r = "";
- for (let s = 0, n = (e = e.trim()).length; s < n; s++) if (r = e[s], CSS_WS_REG.test(r)) {
- if (CSS_WS_REG.test(t[t.length - 1])) continue;
- t += " ";
- } else t += r;
- return t;
- }, CSS_WS_REG = /\s/, CSS_NEXT_CHAR_REG = /[>\(\)\~\,\+\s]/, CSS_PREV_CHAR_REG = /[>\(\~\,\+]/, collectUsedSelectors = (e, t) => {
- if (null != t && 1 === t.nodeType) {
- const r = t.children, s = t.nodeName.toLowerCase();
- e.tags.add(s);
- const n = t.attributes;
- for (let r = 0, s = n.length; r < s; r++) {
- const s = n.item(r), o = s.name.toLowerCase();
- if (e.attrs.add(o), "class" === o) {
- const r = t.classList;
- for (let t = 0, s = r.length; t < s; t++) e.classNames.add(r.item(t));
- } else "id" === o && e.ids.add(s.value);
- }
- if (r) for (let t = 0, s = r.length; t < s; t++) collectUsedSelectors(e, r[t]);
- }
- }, removeUnusedStyleText = (e, t, r) => {
- try {
- const s = parseCss(r.innerHTML);
- if (t.push(...s.diagnostics), hasError(t)) return;
- try {
- r.innerHTML = ((e, t) => {
- const r = t.usedSelectors || null, s = {
- usedSelectors: r || null,
- hasUsedAttrs: !!r && r.attrs.size > 0,
- hasUsedClassNames: !!r && r.classNames.size > 0,
- hasUsedIds: !!r && r.ids.size > 0,
- hasUsedTags: !!r && r.tags.size > 0
- }, n = e.rules;
- if (!n) return "";
- const o = n.length, i = [];
- for (let e = 0; e < o; e++) i.push(serializeCssVisitNode(s, n[e], e, o));
- return i.join("");
- })(s.stylesheet, {
- usedSelectors: e
- });
- } catch (e) {
- t.push({
- level: "warn",
- type: "css",
- header: "CSS Stringify",
- messageText: e
- });
- }
- } catch (e) {
- t.push({
- level: "warn",
- type: "css",
- header: "CSS Parse",
- messageText: e
- });
- }
- }, SKIP_ATTRS = new Set([ "s-id", "c-id" ]), createHydrateBuildId = () => {
- let e = "abcdefghijklmnopqrstuvwxyz", t = "";
- for (;t.length < 8; ) t += e[Math.floor(Math.random() * e.length)], 1 === t.length && (e += "0123456789");
- return t;
- };
- exports.createWindowFromHtml = createWindowFromHtml;
- exports.hydrateDocument = hydrateDocument;
- exports.renderToString = renderToString;
- exports.serializeDocumentToString = serializeDocumentToString;
|