bootstrap-table.js 293 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :
  3. typeof define === 'function' && define.amd ? define(['jquery'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BootstrapTable = factory(global.jQuery));
  5. })(this, (function ($) { 'use strict';
  6. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  7. var $__default = /*#__PURE__*/_interopDefaultLegacy($);
  8. function _typeof(obj) {
  9. "@babel/helpers - typeof";
  10. return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
  11. return typeof obj;
  12. } : function (obj) {
  13. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  14. }, _typeof(obj);
  15. }
  16. function _classCallCheck(instance, Constructor) {
  17. if (!(instance instanceof Constructor)) {
  18. throw new TypeError("Cannot call a class as a function");
  19. }
  20. }
  21. function _defineProperties(target, props) {
  22. for (var i = 0; i < props.length; i++) {
  23. var descriptor = props[i];
  24. descriptor.enumerable = descriptor.enumerable || false;
  25. descriptor.configurable = true;
  26. if ("value" in descriptor) descriptor.writable = true;
  27. Object.defineProperty(target, descriptor.key, descriptor);
  28. }
  29. }
  30. function _createClass(Constructor, protoProps, staticProps) {
  31. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  32. if (staticProps) _defineProperties(Constructor, staticProps);
  33. Object.defineProperty(Constructor, "prototype", {
  34. writable: false
  35. });
  36. return Constructor;
  37. }
  38. function _slicedToArray(arr, i) {
  39. return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
  40. }
  41. function _toConsumableArray(arr) {
  42. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  43. }
  44. function _arrayWithoutHoles(arr) {
  45. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  46. }
  47. function _arrayWithHoles(arr) {
  48. if (Array.isArray(arr)) return arr;
  49. }
  50. function _iterableToArray(iter) {
  51. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  52. }
  53. function _iterableToArrayLimit(arr, i) {
  54. var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
  55. if (_i == null) return;
  56. var _arr = [];
  57. var _n = true;
  58. var _d = false;
  59. var _s, _e;
  60. try {
  61. for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
  62. _arr.push(_s.value);
  63. if (i && _arr.length === i) break;
  64. }
  65. } catch (err) {
  66. _d = true;
  67. _e = err;
  68. } finally {
  69. try {
  70. if (!_n && _i["return"] != null) _i["return"]();
  71. } finally {
  72. if (_d) throw _e;
  73. }
  74. }
  75. return _arr;
  76. }
  77. function _unsupportedIterableToArray(o, minLen) {
  78. if (!o) return;
  79. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  80. var n = Object.prototype.toString.call(o).slice(8, -1);
  81. if (n === "Object" && o.constructor) n = o.constructor.name;
  82. if (n === "Map" || n === "Set") return Array.from(o);
  83. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  84. }
  85. function _arrayLikeToArray(arr, len) {
  86. if (len == null || len > arr.length) len = arr.length;
  87. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  88. return arr2;
  89. }
  90. function _nonIterableSpread() {
  91. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  92. }
  93. function _nonIterableRest() {
  94. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  95. }
  96. function _createForOfIteratorHelper(o, allowArrayLike) {
  97. var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
  98. if (!it) {
  99. if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  100. if (it) o = it;
  101. var i = 0;
  102. var F = function () {};
  103. return {
  104. s: F,
  105. n: function () {
  106. if (i >= o.length) return {
  107. done: true
  108. };
  109. return {
  110. done: false,
  111. value: o[i++]
  112. };
  113. },
  114. e: function (e) {
  115. throw e;
  116. },
  117. f: F
  118. };
  119. }
  120. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  121. }
  122. var normalCompletion = true,
  123. didErr = false,
  124. err;
  125. return {
  126. s: function () {
  127. it = it.call(o);
  128. },
  129. n: function () {
  130. var step = it.next();
  131. normalCompletion = step.done;
  132. return step;
  133. },
  134. e: function (e) {
  135. didErr = true;
  136. err = e;
  137. },
  138. f: function () {
  139. try {
  140. if (!normalCompletion && it.return != null) it.return();
  141. } finally {
  142. if (didErr) throw err;
  143. }
  144. }
  145. };
  146. }
  147. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  148. function createCommonjsModule(fn, module) {
  149. return module = { exports: {} }, fn(module, module.exports), module.exports;
  150. }
  151. var check = function (it) {
  152. return it && it.Math == Math && it;
  153. };
  154. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  155. var global_1 =
  156. // eslint-disable-next-line es-x/no-global-this -- safe
  157. check(typeof globalThis == 'object' && globalThis) ||
  158. check(typeof window == 'object' && window) ||
  159. // eslint-disable-next-line no-restricted-globals -- safe
  160. check(typeof self == 'object' && self) ||
  161. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  162. // eslint-disable-next-line no-new-func -- fallback
  163. (function () { return this; })() || Function('return this')();
  164. var fails = function (exec) {
  165. try {
  166. return !!exec();
  167. } catch (error) {
  168. return true;
  169. }
  170. };
  171. // Detect IE8's incomplete defineProperty implementation
  172. var descriptors = !fails(function () {
  173. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  174. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  175. });
  176. var functionBindNative = !fails(function () {
  177. // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
  178. var test = (function () { /* empty */ }).bind();
  179. // eslint-disable-next-line no-prototype-builtins -- safe
  180. return typeof test != 'function' || test.hasOwnProperty('prototype');
  181. });
  182. var call$2 = Function.prototype.call;
  183. var functionCall = functionBindNative ? call$2.bind(call$2) : function () {
  184. return call$2.apply(call$2, arguments);
  185. };
  186. var $propertyIsEnumerable$1 = {}.propertyIsEnumerable;
  187. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  188. var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor;
  189. // Nashorn ~ JDK8 bug
  190. var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable$1.call({ 1: 2 }, 1);
  191. // `Object.prototype.propertyIsEnumerable` method implementation
  192. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  193. var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) {
  194. var descriptor = getOwnPropertyDescriptor$4(this, V);
  195. return !!descriptor && descriptor.enumerable;
  196. } : $propertyIsEnumerable$1;
  197. var objectPropertyIsEnumerable = {
  198. f: f$5
  199. };
  200. var createPropertyDescriptor = function (bitmap, value) {
  201. return {
  202. enumerable: !(bitmap & 1),
  203. configurable: !(bitmap & 2),
  204. writable: !(bitmap & 4),
  205. value: value
  206. };
  207. };
  208. var FunctionPrototype$2 = Function.prototype;
  209. var bind$1 = FunctionPrototype$2.bind;
  210. var call$1 = FunctionPrototype$2.call;
  211. var uncurryThis = functionBindNative && bind$1.bind(call$1, call$1);
  212. var functionUncurryThis = functionBindNative ? function (fn) {
  213. return fn && uncurryThis(fn);
  214. } : function (fn) {
  215. return fn && function () {
  216. return call$1.apply(fn, arguments);
  217. };
  218. };
  219. var toString$1 = functionUncurryThis({}.toString);
  220. var stringSlice$7 = functionUncurryThis(''.slice);
  221. var classofRaw = function (it) {
  222. return stringSlice$7(toString$1(it), 8, -1);
  223. };
  224. var Object$5 = global_1.Object;
  225. var split = functionUncurryThis(''.split);
  226. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  227. var indexedObject = fails(function () {
  228. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  229. // eslint-disable-next-line no-prototype-builtins -- safe
  230. return !Object$5('z').propertyIsEnumerable(0);
  231. }) ? function (it) {
  232. return classofRaw(it) == 'String' ? split(it, '') : Object$5(it);
  233. } : Object$5;
  234. var TypeError$e = global_1.TypeError;
  235. // `RequireObjectCoercible` abstract operation
  236. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  237. var requireObjectCoercible = function (it) {
  238. if (it == undefined) throw TypeError$e("Can't call method on " + it);
  239. return it;
  240. };
  241. // toObject with fallback for non-array-like ES3 strings
  242. var toIndexedObject = function (it) {
  243. return indexedObject(requireObjectCoercible(it));
  244. };
  245. // `IsCallable` abstract operation
  246. // https://tc39.es/ecma262/#sec-iscallable
  247. var isCallable = function (argument) {
  248. return typeof argument == 'function';
  249. };
  250. var isObject = function (it) {
  251. return typeof it == 'object' ? it !== null : isCallable(it);
  252. };
  253. var aFunction = function (argument) {
  254. return isCallable(argument) ? argument : undefined;
  255. };
  256. var getBuiltIn = function (namespace, method) {
  257. return arguments.length < 2 ? aFunction(global_1[namespace]) : global_1[namespace] && global_1[namespace][method];
  258. };
  259. var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
  260. var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
  261. var process = global_1.process;
  262. var Deno = global_1.Deno;
  263. var versions = process && process.versions || Deno && Deno.version;
  264. var v8 = versions && versions.v8;
  265. var match, version;
  266. if (v8) {
  267. match = v8.split('.');
  268. // in old Chrome, versions of V8 isn't V8 = Chrome / 10
  269. // but their correct versions are not interesting for us
  270. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  271. }
  272. // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
  273. // so check `userAgent` even if `.v8` exists, but 0
  274. if (!version && engineUserAgent) {
  275. match = engineUserAgent.match(/Edge\/(\d+)/);
  276. if (!match || match[1] >= 74) {
  277. match = engineUserAgent.match(/Chrome\/(\d+)/);
  278. if (match) version = +match[1];
  279. }
  280. }
  281. var engineV8Version = version;
  282. /* eslint-disable es-x/no-symbol -- required for testing */
  283. // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
  284. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  285. var symbol = Symbol();
  286. // Chrome 38 Symbol has incorrect toString conversion
  287. // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  288. return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
  289. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  290. !Symbol.sham && engineV8Version && engineV8Version < 41;
  291. });
  292. /* eslint-disable es-x/no-symbol -- required for testing */
  293. var useSymbolAsUid = nativeSymbol
  294. && !Symbol.sham
  295. && typeof Symbol.iterator == 'symbol';
  296. var Object$4 = global_1.Object;
  297. var isSymbol = useSymbolAsUid ? function (it) {
  298. return typeof it == 'symbol';
  299. } : function (it) {
  300. var $Symbol = getBuiltIn('Symbol');
  301. return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, Object$4(it));
  302. };
  303. var String$4 = global_1.String;
  304. var tryToString = function (argument) {
  305. try {
  306. return String$4(argument);
  307. } catch (error) {
  308. return 'Object';
  309. }
  310. };
  311. var TypeError$d = global_1.TypeError;
  312. // `Assert: IsCallable(argument) is true`
  313. var aCallable = function (argument) {
  314. if (isCallable(argument)) return argument;
  315. throw TypeError$d(tryToString(argument) + ' is not a function');
  316. };
  317. // `GetMethod` abstract operation
  318. // https://tc39.es/ecma262/#sec-getmethod
  319. var getMethod = function (V, P) {
  320. var func = V[P];
  321. return func == null ? undefined : aCallable(func);
  322. };
  323. var TypeError$c = global_1.TypeError;
  324. // `OrdinaryToPrimitive` abstract operation
  325. // https://tc39.es/ecma262/#sec-ordinarytoprimitive
  326. var ordinaryToPrimitive = function (input, pref) {
  327. var fn, val;
  328. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
  329. if (isCallable(fn = input.valueOf) && !isObject(val = functionCall(fn, input))) return val;
  330. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
  331. throw TypeError$c("Can't convert object to primitive value");
  332. };
  333. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  334. var defineProperty$5 = Object.defineProperty;
  335. var setGlobal = function (key, value) {
  336. try {
  337. defineProperty$5(global_1, key, { value: value, configurable: true, writable: true });
  338. } catch (error) {
  339. global_1[key] = value;
  340. } return value;
  341. };
  342. var SHARED = '__core-js_shared__';
  343. var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
  344. var sharedStore = store$1;
  345. var shared = createCommonjsModule(function (module) {
  346. (module.exports = function (key, value) {
  347. return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
  348. })('versions', []).push({
  349. version: '3.22.4',
  350. mode: 'global',
  351. copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
  352. license: 'https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE',
  353. source: 'https://github.com/zloirock/core-js'
  354. });
  355. });
  356. var Object$3 = global_1.Object;
  357. // `ToObject` abstract operation
  358. // https://tc39.es/ecma262/#sec-toobject
  359. var toObject = function (argument) {
  360. return Object$3(requireObjectCoercible(argument));
  361. };
  362. var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
  363. // `HasOwnProperty` abstract operation
  364. // https://tc39.es/ecma262/#sec-hasownproperty
  365. // eslint-disable-next-line es-x/no-object-hasown -- safe
  366. var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
  367. return hasOwnProperty(toObject(it), key);
  368. };
  369. var id = 0;
  370. var postfix = Math.random();
  371. var toString = functionUncurryThis(1.0.toString);
  372. var uid = function (key) {
  373. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  374. };
  375. var WellKnownSymbolsStore = shared('wks');
  376. var Symbol$3 = global_1.Symbol;
  377. var symbolFor = Symbol$3 && Symbol$3['for'];
  378. var createWellKnownSymbol = useSymbolAsUid ? Symbol$3 : Symbol$3 && Symbol$3.withoutSetter || uid;
  379. var wellKnownSymbol = function (name) {
  380. if (!hasOwnProperty_1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
  381. var description = 'Symbol.' + name;
  382. if (nativeSymbol && hasOwnProperty_1(Symbol$3, name)) {
  383. WellKnownSymbolsStore[name] = Symbol$3[name];
  384. } else if (useSymbolAsUid && symbolFor) {
  385. WellKnownSymbolsStore[name] = symbolFor(description);
  386. } else {
  387. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  388. }
  389. } return WellKnownSymbolsStore[name];
  390. };
  391. var TypeError$b = global_1.TypeError;
  392. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  393. // `ToPrimitive` abstract operation
  394. // https://tc39.es/ecma262/#sec-toprimitive
  395. var toPrimitive = function (input, pref) {
  396. if (!isObject(input) || isSymbol(input)) return input;
  397. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  398. var result;
  399. if (exoticToPrim) {
  400. if (pref === undefined) pref = 'default';
  401. result = functionCall(exoticToPrim, input, pref);
  402. if (!isObject(result) || isSymbol(result)) return result;
  403. throw TypeError$b("Can't convert object to primitive value");
  404. }
  405. if (pref === undefined) pref = 'number';
  406. return ordinaryToPrimitive(input, pref);
  407. };
  408. // `ToPropertyKey` abstract operation
  409. // https://tc39.es/ecma262/#sec-topropertykey
  410. var toPropertyKey = function (argument) {
  411. var key = toPrimitive(argument, 'string');
  412. return isSymbol(key) ? key : key + '';
  413. };
  414. var document$1 = global_1.document;
  415. // typeof document.createElement is 'object' in old IE
  416. var EXISTS$1 = isObject(document$1) && isObject(document$1.createElement);
  417. var documentCreateElement = function (it) {
  418. return EXISTS$1 ? document$1.createElement(it) : {};
  419. };
  420. // Thanks to IE8 for its funny defineProperty
  421. var ie8DomDefine = !descriptors && !fails(function () {
  422. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  423. return Object.defineProperty(documentCreateElement('div'), 'a', {
  424. get: function () { return 7; }
  425. }).a != 7;
  426. });
  427. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  428. var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
  429. // `Object.getOwnPropertyDescriptor` method
  430. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  431. var f$4 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
  432. O = toIndexedObject(O);
  433. P = toPropertyKey(P);
  434. if (ie8DomDefine) try {
  435. return $getOwnPropertyDescriptor$1(O, P);
  436. } catch (error) { /* empty */ }
  437. if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
  438. };
  439. var objectGetOwnPropertyDescriptor = {
  440. f: f$4
  441. };
  442. // V8 ~ Chrome 36-
  443. // https://bugs.chromium.org/p/v8/issues/detail?id=3334
  444. var v8PrototypeDefineBug = descriptors && fails(function () {
  445. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  446. return Object.defineProperty(function () { /* empty */ }, 'prototype', {
  447. value: 42,
  448. writable: false
  449. }).prototype != 42;
  450. });
  451. var String$3 = global_1.String;
  452. var TypeError$a = global_1.TypeError;
  453. // `Assert: Type(argument) is Object`
  454. var anObject = function (argument) {
  455. if (isObject(argument)) return argument;
  456. throw TypeError$a(String$3(argument) + ' is not an object');
  457. };
  458. var TypeError$9 = global_1.TypeError;
  459. // eslint-disable-next-line es-x/no-object-defineproperty -- safe
  460. var $defineProperty = Object.defineProperty;
  461. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  462. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  463. var ENUMERABLE = 'enumerable';
  464. var CONFIGURABLE$1 = 'configurable';
  465. var WRITABLE = 'writable';
  466. // `Object.defineProperty` method
  467. // https://tc39.es/ecma262/#sec-object.defineproperty
  468. var f$3 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
  469. anObject(O);
  470. P = toPropertyKey(P);
  471. anObject(Attributes);
  472. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  473. var current = $getOwnPropertyDescriptor(O, P);
  474. if (current && current[WRITABLE]) {
  475. O[P] = Attributes.value;
  476. Attributes = {
  477. configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
  478. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  479. writable: false
  480. };
  481. }
  482. } return $defineProperty(O, P, Attributes);
  483. } : $defineProperty : function defineProperty(O, P, Attributes) {
  484. anObject(O);
  485. P = toPropertyKey(P);
  486. anObject(Attributes);
  487. if (ie8DomDefine) try {
  488. return $defineProperty(O, P, Attributes);
  489. } catch (error) { /* empty */ }
  490. if ('get' in Attributes || 'set' in Attributes) throw TypeError$9('Accessors not supported');
  491. if ('value' in Attributes) O[P] = Attributes.value;
  492. return O;
  493. };
  494. var objectDefineProperty = {
  495. f: f$3
  496. };
  497. var createNonEnumerableProperty = descriptors ? function (object, key, value) {
  498. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  499. } : function (object, key, value) {
  500. object[key] = value;
  501. return object;
  502. };
  503. var FunctionPrototype$1 = Function.prototype;
  504. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  505. var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
  506. var EXISTS = hasOwnProperty_1(FunctionPrototype$1, 'name');
  507. // additional protection from minified / mangled / dropped function names
  508. var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
  509. var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$1, 'name').configurable));
  510. var functionName = {
  511. EXISTS: EXISTS,
  512. PROPER: PROPER,
  513. CONFIGURABLE: CONFIGURABLE
  514. };
  515. var functionToString = functionUncurryThis(Function.toString);
  516. // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
  517. if (!isCallable(sharedStore.inspectSource)) {
  518. sharedStore.inspectSource = function (it) {
  519. return functionToString(it);
  520. };
  521. }
  522. var inspectSource = sharedStore.inspectSource;
  523. var WeakMap$1 = global_1.WeakMap;
  524. var nativeWeakMap = isCallable(WeakMap$1) && /native code/.test(inspectSource(WeakMap$1));
  525. var keys$2 = shared('keys');
  526. var sharedKey = function (key) {
  527. return keys$2[key] || (keys$2[key] = uid(key));
  528. };
  529. var hiddenKeys$1 = {};
  530. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  531. var TypeError$8 = global_1.TypeError;
  532. var WeakMap = global_1.WeakMap;
  533. var set, get, has;
  534. var enforce = function (it) {
  535. return has(it) ? get(it) : set(it, {});
  536. };
  537. var getterFor = function (TYPE) {
  538. return function (it) {
  539. var state;
  540. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  541. throw TypeError$8('Incompatible receiver, ' + TYPE + ' required');
  542. } return state;
  543. };
  544. };
  545. if (nativeWeakMap || sharedStore.state) {
  546. var store = sharedStore.state || (sharedStore.state = new WeakMap());
  547. var wmget = functionUncurryThis(store.get);
  548. var wmhas = functionUncurryThis(store.has);
  549. var wmset = functionUncurryThis(store.set);
  550. set = function (it, metadata) {
  551. if (wmhas(store, it)) throw new TypeError$8(OBJECT_ALREADY_INITIALIZED);
  552. metadata.facade = it;
  553. wmset(store, it, metadata);
  554. return metadata;
  555. };
  556. get = function (it) {
  557. return wmget(store, it) || {};
  558. };
  559. has = function (it) {
  560. return wmhas(store, it);
  561. };
  562. } else {
  563. var STATE = sharedKey('state');
  564. hiddenKeys$1[STATE] = true;
  565. set = function (it, metadata) {
  566. if (hasOwnProperty_1(it, STATE)) throw new TypeError$8(OBJECT_ALREADY_INITIALIZED);
  567. metadata.facade = it;
  568. createNonEnumerableProperty(it, STATE, metadata);
  569. return metadata;
  570. };
  571. get = function (it) {
  572. return hasOwnProperty_1(it, STATE) ? it[STATE] : {};
  573. };
  574. has = function (it) {
  575. return hasOwnProperty_1(it, STATE);
  576. };
  577. }
  578. var internalState = {
  579. set: set,
  580. get: get,
  581. has: has,
  582. enforce: enforce,
  583. getterFor: getterFor
  584. };
  585. var makeBuiltIn_1 = createCommonjsModule(function (module) {
  586. var defineProperty = objectDefineProperty.f;
  587. var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
  588. var enforceInternalState = internalState.enforce;
  589. var getInternalState = internalState.get;
  590. var CONFIGURABLE_LENGTH = !fails(function () {
  591. return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
  592. });
  593. var TEMPLATE = String(String).split('String');
  594. var makeBuiltIn = module.exports = function (value, name, options) {
  595. if (String(name).slice(0, 7) === 'Symbol(') {
  596. name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
  597. }
  598. if (options && options.getter) name = 'get ' + name;
  599. if (options && options.setter) name = 'set ' + name;
  600. if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
  601. defineProperty(value, 'name', { value: name, configurable: true });
  602. }
  603. if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
  604. defineProperty(value, 'length', { value: options.arity });
  605. }
  606. var state = enforceInternalState(value);
  607. if (!hasOwnProperty_1(state, 'source')) {
  608. state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
  609. } return value;
  610. };
  611. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  612. // eslint-disable-next-line no-extend-native -- required
  613. Function.prototype.toString = makeBuiltIn(function toString() {
  614. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  615. }, 'toString');
  616. });
  617. var defineBuiltIn = function (O, key, value, options) {
  618. var unsafe = options ? !!options.unsafe : false;
  619. var simple = options ? !!options.enumerable : false;
  620. var noTargetGet = options ? !!options.noTargetGet : false;
  621. var name = options && options.name !== undefined ? options.name : key;
  622. if (isCallable(value)) makeBuiltIn_1(value, name, options);
  623. if (O === global_1) {
  624. if (simple) O[key] = value;
  625. else setGlobal(key, value);
  626. return O;
  627. } else if (!unsafe) {
  628. delete O[key];
  629. } else if (!noTargetGet && O[key]) {
  630. simple = true;
  631. }
  632. if (simple) O[key] = value;
  633. else createNonEnumerableProperty(O, key, value);
  634. return O;
  635. };
  636. var ceil = Math.ceil;
  637. var floor$2 = Math.floor;
  638. // `ToIntegerOrInfinity` abstract operation
  639. // https://tc39.es/ecma262/#sec-tointegerorinfinity
  640. var toIntegerOrInfinity = function (argument) {
  641. var number = +argument;
  642. // eslint-disable-next-line no-self-compare -- safe
  643. return number !== number || number === 0 ? 0 : (number > 0 ? floor$2 : ceil)(number);
  644. };
  645. var max$4 = Math.max;
  646. var min$6 = Math.min;
  647. // Helper for a popular repeating case of the spec:
  648. // Let integer be ? ToInteger(index).
  649. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  650. var toAbsoluteIndex = function (index, length) {
  651. var integer = toIntegerOrInfinity(index);
  652. return integer < 0 ? max$4(integer + length, 0) : min$6(integer, length);
  653. };
  654. var min$5 = Math.min;
  655. // `ToLength` abstract operation
  656. // https://tc39.es/ecma262/#sec-tolength
  657. var toLength = function (argument) {
  658. return argument > 0 ? min$5(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  659. };
  660. // `LengthOfArrayLike` abstract operation
  661. // https://tc39.es/ecma262/#sec-lengthofarraylike
  662. var lengthOfArrayLike = function (obj) {
  663. return toLength(obj.length);
  664. };
  665. // `Array.prototype.{ indexOf, includes }` methods implementation
  666. var createMethod$4 = function (IS_INCLUDES) {
  667. return function ($this, el, fromIndex) {
  668. var O = toIndexedObject($this);
  669. var length = lengthOfArrayLike(O);
  670. var index = toAbsoluteIndex(fromIndex, length);
  671. var value;
  672. // Array#includes uses SameValueZero equality algorithm
  673. // eslint-disable-next-line no-self-compare -- NaN check
  674. if (IS_INCLUDES && el != el) while (length > index) {
  675. value = O[index++];
  676. // eslint-disable-next-line no-self-compare -- NaN check
  677. if (value != value) return true;
  678. // Array#indexOf ignores holes, Array#includes - not
  679. } else for (;length > index; index++) {
  680. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  681. } return !IS_INCLUDES && -1;
  682. };
  683. };
  684. var arrayIncludes = {
  685. // `Array.prototype.includes` method
  686. // https://tc39.es/ecma262/#sec-array.prototype.includes
  687. includes: createMethod$4(true),
  688. // `Array.prototype.indexOf` method
  689. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  690. indexOf: createMethod$4(false)
  691. };
  692. var indexOf$1 = arrayIncludes.indexOf;
  693. var push$5 = functionUncurryThis([].push);
  694. var objectKeysInternal = function (object, names) {
  695. var O = toIndexedObject(object);
  696. var i = 0;
  697. var result = [];
  698. var key;
  699. for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$5(result, key);
  700. // Don't enum bug & hidden keys
  701. while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
  702. ~indexOf$1(result, key) || push$5(result, key);
  703. }
  704. return result;
  705. };
  706. // IE8- don't enum bug keys
  707. var enumBugKeys = [
  708. 'constructor',
  709. 'hasOwnProperty',
  710. 'isPrototypeOf',
  711. 'propertyIsEnumerable',
  712. 'toLocaleString',
  713. 'toString',
  714. 'valueOf'
  715. ];
  716. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  717. // `Object.getOwnPropertyNames` method
  718. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  719. // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
  720. var f$2 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  721. return objectKeysInternal(O, hiddenKeys);
  722. };
  723. var objectGetOwnPropertyNames = {
  724. f: f$2
  725. };
  726. // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
  727. var f$1 = Object.getOwnPropertySymbols;
  728. var objectGetOwnPropertySymbols = {
  729. f: f$1
  730. };
  731. var concat$2 = functionUncurryThis([].concat);
  732. // all object keys, includes non-enumerable and symbols
  733. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  734. var keys = objectGetOwnPropertyNames.f(anObject(it));
  735. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  736. return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys;
  737. };
  738. var copyConstructorProperties = function (target, source, exceptions) {
  739. var keys = ownKeys(source);
  740. var defineProperty = objectDefineProperty.f;
  741. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  742. for (var i = 0; i < keys.length; i++) {
  743. var key = keys[i];
  744. if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) {
  745. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  746. }
  747. }
  748. };
  749. var replacement = /#|\.prototype\./;
  750. var isForced = function (feature, detection) {
  751. var value = data[normalize(feature)];
  752. return value == POLYFILL ? true
  753. : value == NATIVE ? false
  754. : isCallable(detection) ? fails(detection)
  755. : !!detection;
  756. };
  757. var normalize = isForced.normalize = function (string) {
  758. return String(string).replace(replacement, '.').toLowerCase();
  759. };
  760. var data = isForced.data = {};
  761. var NATIVE = isForced.NATIVE = 'N';
  762. var POLYFILL = isForced.POLYFILL = 'P';
  763. var isForced_1 = isForced;
  764. var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
  765. /*
  766. options.target - name of the target object
  767. options.global - target is the global object
  768. options.stat - export as static methods of target
  769. options.proto - export as prototype methods of target
  770. options.real - real prototype method for the `pure` version
  771. options.forced - export even if the native feature is available
  772. options.bind - bind methods to the target, required for the `pure` version
  773. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  774. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  775. options.sham - add a flag to not completely full polyfills
  776. options.enumerable - export as enumerable property
  777. options.noTargetGet - prevent calling a getter on target
  778. options.name - the .name of the function if it does not match the key
  779. */
  780. var _export = function (options, source) {
  781. var TARGET = options.target;
  782. var GLOBAL = options.global;
  783. var STATIC = options.stat;
  784. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  785. if (GLOBAL) {
  786. target = global_1;
  787. } else if (STATIC) {
  788. target = global_1[TARGET] || setGlobal(TARGET, {});
  789. } else {
  790. target = (global_1[TARGET] || {}).prototype;
  791. }
  792. if (target) for (key in source) {
  793. sourceProperty = source[key];
  794. if (options.noTargetGet) {
  795. descriptor = getOwnPropertyDescriptor$3(target, key);
  796. targetProperty = descriptor && descriptor.value;
  797. } else targetProperty = target[key];
  798. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  799. // contained in target
  800. if (!FORCED && targetProperty !== undefined) {
  801. if (typeof sourceProperty == typeof targetProperty) continue;
  802. copyConstructorProperties(sourceProperty, targetProperty);
  803. }
  804. // add a flag to not completely full polyfills
  805. if (options.sham || (targetProperty && targetProperty.sham)) {
  806. createNonEnumerableProperty(sourceProperty, 'sham', true);
  807. }
  808. defineBuiltIn(target, key, sourceProperty, options);
  809. }
  810. };
  811. // `Object.keys` method
  812. // https://tc39.es/ecma262/#sec-object.keys
  813. // eslint-disable-next-line es-x/no-object-keys -- safe
  814. var objectKeys = Object.keys || function keys(O) {
  815. return objectKeysInternal(O, enumBugKeys);
  816. };
  817. // eslint-disable-next-line es-x/no-object-assign -- safe
  818. var $assign = Object.assign;
  819. // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
  820. var defineProperty$4 = Object.defineProperty;
  821. var concat$1 = functionUncurryThis([].concat);
  822. // `Object.assign` method
  823. // https://tc39.es/ecma262/#sec-object.assign
  824. var objectAssign = !$assign || fails(function () {
  825. // should have correct order of operations (Edge bug)
  826. if (descriptors && $assign({ b: 1 }, $assign(defineProperty$4({}, 'a', {
  827. enumerable: true,
  828. get: function () {
  829. defineProperty$4(this, 'b', {
  830. value: 3,
  831. enumerable: false
  832. });
  833. }
  834. }), { b: 2 })).b !== 1) return true;
  835. // should work with symbols and should have deterministic property order (V8 bug)
  836. var A = {};
  837. var B = {};
  838. // eslint-disable-next-line es-x/no-symbol -- safe
  839. var symbol = Symbol();
  840. var alphabet = 'abcdefghijklmnopqrst';
  841. A[symbol] = 7;
  842. alphabet.split('').forEach(function (chr) { B[chr] = chr; });
  843. return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
  844. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
  845. var T = toObject(target);
  846. var argumentsLength = arguments.length;
  847. var index = 1;
  848. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  849. var propertyIsEnumerable = objectPropertyIsEnumerable.f;
  850. while (argumentsLength > index) {
  851. var S = indexedObject(arguments[index++]);
  852. var keys = getOwnPropertySymbols ? concat$1(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
  853. var length = keys.length;
  854. var j = 0;
  855. var key;
  856. while (length > j) {
  857. key = keys[j++];
  858. if (!descriptors || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
  859. }
  860. } return T;
  861. } : $assign;
  862. // `Object.assign` method
  863. // https://tc39.es/ecma262/#sec-object.assign
  864. // eslint-disable-next-line es-x/no-object-assign -- required for testing
  865. _export({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== objectAssign }, {
  866. assign: objectAssign
  867. });
  868. var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
  869. var test$2 = {};
  870. test$2[TO_STRING_TAG$3] = 'z';
  871. var toStringTagSupport = String(test$2) === '[object z]';
  872. var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
  873. var Object$2 = global_1.Object;
  874. // ES3 wrong here
  875. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  876. // fallback for IE11 Script Access Denied error
  877. var tryGet = function (it, key) {
  878. try {
  879. return it[key];
  880. } catch (error) { /* empty */ }
  881. };
  882. // getting tag from ES6+ `Object.prototype.toString`
  883. var classof = toStringTagSupport ? classofRaw : function (it) {
  884. var O, tag, result;
  885. return it === undefined ? 'Undefined' : it === null ? 'Null'
  886. // @@toStringTag case
  887. : typeof (tag = tryGet(O = Object$2(it), TO_STRING_TAG$2)) == 'string' ? tag
  888. // builtinTag case
  889. : CORRECT_ARGUMENTS ? classofRaw(O)
  890. // ES3 arguments fallback
  891. : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
  892. };
  893. var String$2 = global_1.String;
  894. var toString_1 = function (argument) {
  895. if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
  896. return String$2(argument);
  897. };
  898. // a string of all valid unicode whitespaces
  899. var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
  900. '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  901. var replace$3 = functionUncurryThis(''.replace);
  902. var whitespace = '[' + whitespaces + ']';
  903. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  904. var rtrim = RegExp(whitespace + whitespace + '*$');
  905. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  906. var createMethod$3 = function (TYPE) {
  907. return function ($this) {
  908. var string = toString_1(requireObjectCoercible($this));
  909. if (TYPE & 1) string = replace$3(string, ltrim, '');
  910. if (TYPE & 2) string = replace$3(string, rtrim, '');
  911. return string;
  912. };
  913. };
  914. var stringTrim = {
  915. // `String.prototype.{ trimLeft, trimStart }` methods
  916. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  917. start: createMethod$3(1),
  918. // `String.prototype.{ trimRight, trimEnd }` methods
  919. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  920. end: createMethod$3(2),
  921. // `String.prototype.trim` method
  922. // https://tc39.es/ecma262/#sec-string.prototype.trim
  923. trim: createMethod$3(3)
  924. };
  925. var PROPER_FUNCTION_NAME$2 = functionName.PROPER;
  926. var non = '\u200B\u0085\u180E';
  927. // check that a method works with the correct list
  928. // of whitespaces and has a correct name
  929. var stringTrimForced = function (METHOD_NAME) {
  930. return fails(function () {
  931. return !!whitespaces[METHOD_NAME]()
  932. || non[METHOD_NAME]() !== non
  933. || (PROPER_FUNCTION_NAME$2 && whitespaces[METHOD_NAME].name !== METHOD_NAME);
  934. });
  935. };
  936. var $trim = stringTrim.trim;
  937. // `String.prototype.trim` method
  938. // https://tc39.es/ecma262/#sec-string.prototype.trim
  939. _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {
  940. trim: function trim() {
  941. return $trim(this);
  942. }
  943. });
  944. var arrayMethodIsStrict = function (METHOD_NAME, argument) {
  945. var method = [][METHOD_NAME];
  946. return !!method && fails(function () {
  947. // eslint-disable-next-line no-useless-call -- required for testing
  948. method.call(null, argument || function () { return 1; }, 1);
  949. });
  950. };
  951. var un$Join = functionUncurryThis([].join);
  952. var ES3_STRINGS = indexedObject != Object;
  953. var STRICT_METHOD$3 = arrayMethodIsStrict('join', ',');
  954. // `Array.prototype.join` method
  955. // https://tc39.es/ecma262/#sec-array.prototype.join
  956. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$3 }, {
  957. join: function join(separator) {
  958. return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
  959. }
  960. });
  961. // `RegExp.prototype.flags` getter implementation
  962. // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
  963. var regexpFlags = function () {
  964. var that = anObject(this);
  965. var result = '';
  966. if (that.hasIndices) result += 'd';
  967. if (that.global) result += 'g';
  968. if (that.ignoreCase) result += 'i';
  969. if (that.multiline) result += 'm';
  970. if (that.dotAll) result += 's';
  971. if (that.unicode) result += 'u';
  972. if (that.sticky) result += 'y';
  973. return result;
  974. };
  975. // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  976. var $RegExp$2 = global_1.RegExp;
  977. var UNSUPPORTED_Y$3 = fails(function () {
  978. var re = $RegExp$2('a', 'y');
  979. re.lastIndex = 2;
  980. return re.exec('abcd') != null;
  981. });
  982. // UC Browser bug
  983. // https://github.com/zloirock/core-js/issues/1008
  984. var MISSED_STICKY$1 = UNSUPPORTED_Y$3 || fails(function () {
  985. return !$RegExp$2('a', 'y').sticky;
  986. });
  987. var BROKEN_CARET = UNSUPPORTED_Y$3 || fails(function () {
  988. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  989. var re = $RegExp$2('^r', 'gy');
  990. re.lastIndex = 2;
  991. return re.exec('str') != null;
  992. });
  993. var regexpStickyHelpers = {
  994. BROKEN_CARET: BROKEN_CARET,
  995. MISSED_STICKY: MISSED_STICKY$1,
  996. UNSUPPORTED_Y: UNSUPPORTED_Y$3
  997. };
  998. // `Object.defineProperties` method
  999. // https://tc39.es/ecma262/#sec-object.defineproperties
  1000. // eslint-disable-next-line es-x/no-object-defineproperties -- safe
  1001. var f = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
  1002. anObject(O);
  1003. var props = toIndexedObject(Properties);
  1004. var keys = objectKeys(Properties);
  1005. var length = keys.length;
  1006. var index = 0;
  1007. var key;
  1008. while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
  1009. return O;
  1010. };
  1011. var objectDefineProperties = {
  1012. f: f
  1013. };
  1014. var html = getBuiltIn('document', 'documentElement');
  1015. /* global ActiveXObject -- old IE, WSH */
  1016. var GT = '>';
  1017. var LT = '<';
  1018. var PROTOTYPE = 'prototype';
  1019. var SCRIPT = 'script';
  1020. var IE_PROTO$1 = sharedKey('IE_PROTO');
  1021. var EmptyConstructor = function () { /* empty */ };
  1022. var scriptTag = function (content) {
  1023. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  1024. };
  1025. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  1026. var NullProtoObjectViaActiveX = function (activeXDocument) {
  1027. activeXDocument.write(scriptTag(''));
  1028. activeXDocument.close();
  1029. var temp = activeXDocument.parentWindow.Object;
  1030. activeXDocument = null; // avoid memory leak
  1031. return temp;
  1032. };
  1033. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  1034. var NullProtoObjectViaIFrame = function () {
  1035. // Thrash, waste and sodomy: IE GC bug
  1036. var iframe = documentCreateElement('iframe');
  1037. var JS = 'java' + SCRIPT + ':';
  1038. var iframeDocument;
  1039. iframe.style.display = 'none';
  1040. html.appendChild(iframe);
  1041. // https://github.com/zloirock/core-js/issues/475
  1042. iframe.src = String(JS);
  1043. iframeDocument = iframe.contentWindow.document;
  1044. iframeDocument.open();
  1045. iframeDocument.write(scriptTag('document.F=Object'));
  1046. iframeDocument.close();
  1047. return iframeDocument.F;
  1048. };
  1049. // Check for document.domain and active x support
  1050. // No need to use active x approach when document.domain is not set
  1051. // see https://github.com/es-shims/es5-shim/issues/150
  1052. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  1053. // avoid IE GC bug
  1054. var activeXDocument;
  1055. var NullProtoObject = function () {
  1056. try {
  1057. activeXDocument = new ActiveXObject('htmlfile');
  1058. } catch (error) { /* ignore */ }
  1059. NullProtoObject = typeof document != 'undefined'
  1060. ? document.domain && activeXDocument
  1061. ? NullProtoObjectViaActiveX(activeXDocument) // old IE
  1062. : NullProtoObjectViaIFrame()
  1063. : NullProtoObjectViaActiveX(activeXDocument); // WSH
  1064. var length = enumBugKeys.length;
  1065. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  1066. return NullProtoObject();
  1067. };
  1068. hiddenKeys$1[IE_PROTO$1] = true;
  1069. // `Object.create` method
  1070. // https://tc39.es/ecma262/#sec-object.create
  1071. // eslint-disable-next-line es-x/no-object-create -- safe
  1072. var objectCreate = Object.create || function create(O, Properties) {
  1073. var result;
  1074. if (O !== null) {
  1075. EmptyConstructor[PROTOTYPE] = anObject(O);
  1076. result = new EmptyConstructor();
  1077. EmptyConstructor[PROTOTYPE] = null;
  1078. // add "__proto__" for Object.getPrototypeOf polyfill
  1079. result[IE_PROTO$1] = O;
  1080. } else result = NullProtoObject();
  1081. return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
  1082. };
  1083. // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
  1084. var $RegExp$1 = global_1.RegExp;
  1085. var regexpUnsupportedDotAll = fails(function () {
  1086. var re = $RegExp$1('.', 's');
  1087. return !(re.dotAll && re.exec('\n') && re.flags === 's');
  1088. });
  1089. // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
  1090. var $RegExp = global_1.RegExp;
  1091. var regexpUnsupportedNcg = fails(function () {
  1092. var re = $RegExp('(?<a>b)', 'g');
  1093. return re.exec('b').groups.a !== 'b' ||
  1094. 'b'.replace(re, '$<a>c') !== 'bc';
  1095. });
  1096. /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
  1097. /* eslint-disable regexp/no-useless-quantifier -- testing */
  1098. var getInternalState$1 = internalState.get;
  1099. var nativeReplace = shared('native-string-replace', String.prototype.replace);
  1100. var nativeExec = RegExp.prototype.exec;
  1101. var patchedExec = nativeExec;
  1102. var charAt$5 = functionUncurryThis(''.charAt);
  1103. var indexOf = functionUncurryThis(''.indexOf);
  1104. var replace$2 = functionUncurryThis(''.replace);
  1105. var stringSlice$6 = functionUncurryThis(''.slice);
  1106. var UPDATES_LAST_INDEX_WRONG = (function () {
  1107. var re1 = /a/;
  1108. var re2 = /b*/g;
  1109. functionCall(nativeExec, re1, 'a');
  1110. functionCall(nativeExec, re2, 'a');
  1111. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  1112. })();
  1113. var UNSUPPORTED_Y$2 = regexpStickyHelpers.BROKEN_CARET;
  1114. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  1115. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  1116. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2 || regexpUnsupportedDotAll || regexpUnsupportedNcg;
  1117. if (PATCH) {
  1118. patchedExec = function exec(string) {
  1119. var re = this;
  1120. var state = getInternalState$1(re);
  1121. var str = toString_1(string);
  1122. var raw = state.raw;
  1123. var result, reCopy, lastIndex, match, i, object, group;
  1124. if (raw) {
  1125. raw.lastIndex = re.lastIndex;
  1126. result = functionCall(patchedExec, raw, str);
  1127. re.lastIndex = raw.lastIndex;
  1128. return result;
  1129. }
  1130. var groups = state.groups;
  1131. var sticky = UNSUPPORTED_Y$2 && re.sticky;
  1132. var flags = functionCall(regexpFlags, re);
  1133. var source = re.source;
  1134. var charsAdded = 0;
  1135. var strCopy = str;
  1136. if (sticky) {
  1137. flags = replace$2(flags, 'y', '');
  1138. if (indexOf(flags, 'g') === -1) {
  1139. flags += 'g';
  1140. }
  1141. strCopy = stringSlice$6(str, re.lastIndex);
  1142. // Support anchored sticky behavior.
  1143. if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$5(str, re.lastIndex - 1) !== '\n')) {
  1144. source = '(?: ' + source + ')';
  1145. strCopy = ' ' + strCopy;
  1146. charsAdded++;
  1147. }
  1148. // ^(? + rx + ) is needed, in combination with some str slicing, to
  1149. // simulate the 'y' flag.
  1150. reCopy = new RegExp('^(?:' + source + ')', flags);
  1151. }
  1152. if (NPCG_INCLUDED) {
  1153. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  1154. }
  1155. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  1156. match = functionCall(nativeExec, sticky ? reCopy : re, strCopy);
  1157. if (sticky) {
  1158. if (match) {
  1159. match.input = stringSlice$6(match.input, charsAdded);
  1160. match[0] = stringSlice$6(match[0], charsAdded);
  1161. match.index = re.lastIndex;
  1162. re.lastIndex += match[0].length;
  1163. } else re.lastIndex = 0;
  1164. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  1165. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  1166. }
  1167. if (NPCG_INCLUDED && match && match.length > 1) {
  1168. // Fix browsers whose `exec` methods don't consistently return `undefined`
  1169. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  1170. functionCall(nativeReplace, match[0], reCopy, function () {
  1171. for (i = 1; i < arguments.length - 2; i++) {
  1172. if (arguments[i] === undefined) match[i] = undefined;
  1173. }
  1174. });
  1175. }
  1176. if (match && groups) {
  1177. match.groups = object = objectCreate(null);
  1178. for (i = 0; i < groups.length; i++) {
  1179. group = groups[i];
  1180. object[group[0]] = match[group[1]];
  1181. }
  1182. }
  1183. return match;
  1184. };
  1185. }
  1186. var regexpExec = patchedExec;
  1187. // `RegExp.prototype.exec` method
  1188. // https://tc39.es/ecma262/#sec-regexp.prototype.exec
  1189. _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
  1190. exec: regexpExec
  1191. });
  1192. var FunctionPrototype = Function.prototype;
  1193. var apply = FunctionPrototype.apply;
  1194. var call = FunctionPrototype.call;
  1195. // eslint-disable-next-line es-x/no-reflect -- safe
  1196. var functionApply = typeof Reflect == 'object' && Reflect.apply || (functionBindNative ? call.bind(apply) : function () {
  1197. return call.apply(apply, arguments);
  1198. });
  1199. // TODO: Remove from `core-js@4` since it's moved to entry points
  1200. var SPECIES$5 = wellKnownSymbol('species');
  1201. var RegExpPrototype$3 = RegExp.prototype;
  1202. var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
  1203. var SYMBOL = wellKnownSymbol(KEY);
  1204. var DELEGATES_TO_SYMBOL = !fails(function () {
  1205. // String methods call symbol-named RegEp methods
  1206. var O = {};
  1207. O[SYMBOL] = function () { return 7; };
  1208. return ''[KEY](O) != 7;
  1209. });
  1210. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  1211. // Symbol-named RegExp methods call .exec
  1212. var execCalled = false;
  1213. var re = /a/;
  1214. if (KEY === 'split') {
  1215. // We can't use real regex here since it causes deoptimization
  1216. // and serious performance degradation in V8
  1217. // https://github.com/zloirock/core-js/issues/306
  1218. re = {};
  1219. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  1220. // a new one. We need to return the patched regex when creating the new one.
  1221. re.constructor = {};
  1222. re.constructor[SPECIES$5] = function () { return re; };
  1223. re.flags = '';
  1224. re[SYMBOL] = /./[SYMBOL];
  1225. }
  1226. re.exec = function () { execCalled = true; return null; };
  1227. re[SYMBOL]('');
  1228. return !execCalled;
  1229. });
  1230. if (
  1231. !DELEGATES_TO_SYMBOL ||
  1232. !DELEGATES_TO_EXEC ||
  1233. FORCED
  1234. ) {
  1235. var uncurriedNativeRegExpMethod = functionUncurryThis(/./[SYMBOL]);
  1236. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  1237. var uncurriedNativeMethod = functionUncurryThis(nativeMethod);
  1238. var $exec = regexp.exec;
  1239. if ($exec === regexpExec || $exec === RegExpPrototype$3.exec) {
  1240. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  1241. // The native String method already delegates to @@method (this
  1242. // polyfilled function), leasing to infinite recursion.
  1243. // We avoid it by directly calling the native @@method method.
  1244. return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
  1245. }
  1246. return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
  1247. }
  1248. return { done: false };
  1249. });
  1250. defineBuiltIn(String.prototype, KEY, methods[0]);
  1251. defineBuiltIn(RegExpPrototype$3, SYMBOL, methods[1]);
  1252. }
  1253. if (SHAM) createNonEnumerableProperty(RegExpPrototype$3[SYMBOL], 'sham', true);
  1254. };
  1255. var MATCH$2 = wellKnownSymbol('match');
  1256. // `IsRegExp` abstract operation
  1257. // https://tc39.es/ecma262/#sec-isregexp
  1258. var isRegexp = function (it) {
  1259. var isRegExp;
  1260. return isObject(it) && ((isRegExp = it[MATCH$2]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  1261. };
  1262. var noop = function () { /* empty */ };
  1263. var empty = [];
  1264. var construct = getBuiltIn('Reflect', 'construct');
  1265. var constructorRegExp = /^\s*(?:class|function)\b/;
  1266. var exec$3 = functionUncurryThis(constructorRegExp.exec);
  1267. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  1268. var isConstructorModern = function isConstructor(argument) {
  1269. if (!isCallable(argument)) return false;
  1270. try {
  1271. construct(noop, empty, argument);
  1272. return true;
  1273. } catch (error) {
  1274. return false;
  1275. }
  1276. };
  1277. var isConstructorLegacy = function isConstructor(argument) {
  1278. if (!isCallable(argument)) return false;
  1279. switch (classof(argument)) {
  1280. case 'AsyncFunction':
  1281. case 'GeneratorFunction':
  1282. case 'AsyncGeneratorFunction': return false;
  1283. }
  1284. try {
  1285. // we can't check .prototype since constructors produced by .bind haven't it
  1286. // `Function#toString` throws on some built-it function in some legacy engines
  1287. // (for example, `DOMQuad` and similar in FF41-)
  1288. return INCORRECT_TO_STRING || !!exec$3(constructorRegExp, inspectSource(argument));
  1289. } catch (error) {
  1290. return true;
  1291. }
  1292. };
  1293. isConstructorLegacy.sham = true;
  1294. // `IsConstructor` abstract operation
  1295. // https://tc39.es/ecma262/#sec-isconstructor
  1296. var isConstructor = !construct || fails(function () {
  1297. var called;
  1298. return isConstructorModern(isConstructorModern.call)
  1299. || !isConstructorModern(Object)
  1300. || !isConstructorModern(function () { called = true; })
  1301. || called;
  1302. }) ? isConstructorLegacy : isConstructorModern;
  1303. var TypeError$7 = global_1.TypeError;
  1304. // `Assert: IsConstructor(argument) is true`
  1305. var aConstructor = function (argument) {
  1306. if (isConstructor(argument)) return argument;
  1307. throw TypeError$7(tryToString(argument) + ' is not a constructor');
  1308. };
  1309. var SPECIES$4 = wellKnownSymbol('species');
  1310. // `SpeciesConstructor` abstract operation
  1311. // https://tc39.es/ecma262/#sec-speciesconstructor
  1312. var speciesConstructor = function (O, defaultConstructor) {
  1313. var C = anObject(O).constructor;
  1314. var S;
  1315. return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aConstructor(S);
  1316. };
  1317. var charAt$4 = functionUncurryThis(''.charAt);
  1318. var charCodeAt$1 = functionUncurryThis(''.charCodeAt);
  1319. var stringSlice$5 = functionUncurryThis(''.slice);
  1320. var createMethod$2 = function (CONVERT_TO_STRING) {
  1321. return function ($this, pos) {
  1322. var S = toString_1(requireObjectCoercible($this));
  1323. var position = toIntegerOrInfinity(pos);
  1324. var size = S.length;
  1325. var first, second;
  1326. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  1327. first = charCodeAt$1(S, position);
  1328. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  1329. || (second = charCodeAt$1(S, position + 1)) < 0xDC00 || second > 0xDFFF
  1330. ? CONVERT_TO_STRING
  1331. ? charAt$4(S, position)
  1332. : first
  1333. : CONVERT_TO_STRING
  1334. ? stringSlice$5(S, position, position + 2)
  1335. : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  1336. };
  1337. };
  1338. var stringMultibyte = {
  1339. // `String.prototype.codePointAt` method
  1340. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  1341. codeAt: createMethod$2(false),
  1342. // `String.prototype.at` method
  1343. // https://github.com/mathiasbynens/String.prototype.at
  1344. charAt: createMethod$2(true)
  1345. };
  1346. var charAt$3 = stringMultibyte.charAt;
  1347. // `AdvanceStringIndex` abstract operation
  1348. // https://tc39.es/ecma262/#sec-advancestringindex
  1349. var advanceStringIndex = function (S, index, unicode) {
  1350. return index + (unicode ? charAt$3(S, index).length : 1);
  1351. };
  1352. var createProperty = function (object, key, value) {
  1353. var propertyKey = toPropertyKey(key);
  1354. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  1355. else object[propertyKey] = value;
  1356. };
  1357. var Array$3 = global_1.Array;
  1358. var max$3 = Math.max;
  1359. var arraySliceSimple = function (O, start, end) {
  1360. var length = lengthOfArrayLike(O);
  1361. var k = toAbsoluteIndex(start, length);
  1362. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  1363. var result = Array$3(max$3(fin - k, 0));
  1364. for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
  1365. result.length = n;
  1366. return result;
  1367. };
  1368. var TypeError$6 = global_1.TypeError;
  1369. // `RegExpExec` abstract operation
  1370. // https://tc39.es/ecma262/#sec-regexpexec
  1371. var regexpExecAbstract = function (R, S) {
  1372. var exec = R.exec;
  1373. if (isCallable(exec)) {
  1374. var result = functionCall(exec, R, S);
  1375. if (result !== null) anObject(result);
  1376. return result;
  1377. }
  1378. if (classofRaw(R) === 'RegExp') return functionCall(regexpExec, R, S);
  1379. throw TypeError$6('RegExp#exec called on incompatible receiver');
  1380. };
  1381. var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y;
  1382. var MAX_UINT32 = 0xFFFFFFFF;
  1383. var min$4 = Math.min;
  1384. var $push = [].push;
  1385. var exec$2 = functionUncurryThis(/./.exec);
  1386. var push$4 = functionUncurryThis($push);
  1387. var stringSlice$4 = functionUncurryThis(''.slice);
  1388. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  1389. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  1390. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  1391. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  1392. var re = /(?:)/;
  1393. var originalExec = re.exec;
  1394. re.exec = function () { return originalExec.apply(this, arguments); };
  1395. var result = 'ab'.split(re);
  1396. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  1397. });
  1398. // @@split logic
  1399. fixRegexpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
  1400. var internalSplit;
  1401. if (
  1402. 'abbc'.split(/(b)*/)[1] == 'c' ||
  1403. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  1404. 'test'.split(/(?:)/, -1).length != 4 ||
  1405. 'ab'.split(/(?:ab)*/).length != 2 ||
  1406. '.'.split(/(.?)(.?)/).length != 4 ||
  1407. // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
  1408. '.'.split(/()()/).length > 1 ||
  1409. ''.split(/.?/).length
  1410. ) {
  1411. // based on es5-shim implementation, need to rework it
  1412. internalSplit = function (separator, limit) {
  1413. var string = toString_1(requireObjectCoercible(this));
  1414. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1415. if (lim === 0) return [];
  1416. if (separator === undefined) return [string];
  1417. // If `separator` is not a regex, use native split
  1418. if (!isRegexp(separator)) {
  1419. return functionCall(nativeSplit, string, separator, lim);
  1420. }
  1421. var output = [];
  1422. var flags = (separator.ignoreCase ? 'i' : '') +
  1423. (separator.multiline ? 'm' : '') +
  1424. (separator.unicode ? 'u' : '') +
  1425. (separator.sticky ? 'y' : '');
  1426. var lastLastIndex = 0;
  1427. // Make `global` and avoid `lastIndex` issues by working with a copy
  1428. var separatorCopy = new RegExp(separator.source, flags + 'g');
  1429. var match, lastIndex, lastLength;
  1430. while (match = functionCall(regexpExec, separatorCopy, string)) {
  1431. lastIndex = separatorCopy.lastIndex;
  1432. if (lastIndex > lastLastIndex) {
  1433. push$4(output, stringSlice$4(string, lastLastIndex, match.index));
  1434. if (match.length > 1 && match.index < string.length) functionApply($push, output, arraySliceSimple(match, 1));
  1435. lastLength = match[0].length;
  1436. lastLastIndex = lastIndex;
  1437. if (output.length >= lim) break;
  1438. }
  1439. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  1440. }
  1441. if (lastLastIndex === string.length) {
  1442. if (lastLength || !exec$2(separatorCopy, '')) push$4(output, '');
  1443. } else push$4(output, stringSlice$4(string, lastLastIndex));
  1444. return output.length > lim ? arraySliceSimple(output, 0, lim) : output;
  1445. };
  1446. // Chakra, V8
  1447. } else if ('0'.split(undefined, 0).length) {
  1448. internalSplit = function (separator, limit) {
  1449. return separator === undefined && limit === 0 ? [] : functionCall(nativeSplit, this, separator, limit);
  1450. };
  1451. } else internalSplit = nativeSplit;
  1452. return [
  1453. // `String.prototype.split` method
  1454. // https://tc39.es/ecma262/#sec-string.prototype.split
  1455. function split(separator, limit) {
  1456. var O = requireObjectCoercible(this);
  1457. var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT);
  1458. return splitter
  1459. ? functionCall(splitter, separator, O, limit)
  1460. : functionCall(internalSplit, toString_1(O), separator, limit);
  1461. },
  1462. // `RegExp.prototype[@@split]` method
  1463. // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
  1464. //
  1465. // NOTE: This cannot be properly polyfilled in engines that don't support
  1466. // the 'y' flag.
  1467. function (string, limit) {
  1468. var rx = anObject(this);
  1469. var S = toString_1(string);
  1470. var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
  1471. if (res.done) return res.value;
  1472. var C = speciesConstructor(rx, RegExp);
  1473. var unicodeMatching = rx.unicode;
  1474. var flags = (rx.ignoreCase ? 'i' : '') +
  1475. (rx.multiline ? 'm' : '') +
  1476. (rx.unicode ? 'u' : '') +
  1477. (UNSUPPORTED_Y$1 ? 'g' : 'y');
  1478. // ^(? + rx + ) is needed, in combination with some S slicing, to
  1479. // simulate the 'y' flag.
  1480. var splitter = new C(UNSUPPORTED_Y$1 ? '^(?:' + rx.source + ')' : rx, flags);
  1481. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1482. if (lim === 0) return [];
  1483. if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
  1484. var p = 0;
  1485. var q = 0;
  1486. var A = [];
  1487. while (q < S.length) {
  1488. splitter.lastIndex = UNSUPPORTED_Y$1 ? 0 : q;
  1489. var z = regexpExecAbstract(splitter, UNSUPPORTED_Y$1 ? stringSlice$4(S, q) : S);
  1490. var e;
  1491. if (
  1492. z === null ||
  1493. (e = min$4(toLength(splitter.lastIndex + (UNSUPPORTED_Y$1 ? q : 0)), S.length)) === p
  1494. ) {
  1495. q = advanceStringIndex(S, q, unicodeMatching);
  1496. } else {
  1497. push$4(A, stringSlice$4(S, p, q));
  1498. if (A.length === lim) return A;
  1499. for (var i = 1; i <= z.length - 1; i++) {
  1500. push$4(A, z[i]);
  1501. if (A.length === lim) return A;
  1502. }
  1503. q = p = e;
  1504. }
  1505. }
  1506. push$4(A, stringSlice$4(S, p));
  1507. return A;
  1508. }
  1509. ];
  1510. }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y$1);
  1511. var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
  1512. var propertyIsEnumerable = functionUncurryThis($propertyIsEnumerable);
  1513. var push$3 = functionUncurryThis([].push);
  1514. // `Object.{ entries, values }` methods implementation
  1515. var createMethod$1 = function (TO_ENTRIES) {
  1516. return function (it) {
  1517. var O = toIndexedObject(it);
  1518. var keys = objectKeys(O);
  1519. var length = keys.length;
  1520. var i = 0;
  1521. var result = [];
  1522. var key;
  1523. while (length > i) {
  1524. key = keys[i++];
  1525. if (!descriptors || propertyIsEnumerable(O, key)) {
  1526. push$3(result, TO_ENTRIES ? [key, O[key]] : O[key]);
  1527. }
  1528. }
  1529. return result;
  1530. };
  1531. };
  1532. var objectToArray = {
  1533. // `Object.entries` method
  1534. // https://tc39.es/ecma262/#sec-object.entries
  1535. entries: createMethod$1(true),
  1536. // `Object.values` method
  1537. // https://tc39.es/ecma262/#sec-object.values
  1538. values: createMethod$1(false)
  1539. };
  1540. var $entries = objectToArray.entries;
  1541. // `Object.entries` method
  1542. // https://tc39.es/ecma262/#sec-object.entries
  1543. _export({ target: 'Object', stat: true }, {
  1544. entries: function entries(O) {
  1545. return $entries(O);
  1546. }
  1547. });
  1548. var UNSCOPABLES = wellKnownSymbol('unscopables');
  1549. var ArrayPrototype = Array.prototype;
  1550. // Array.prototype[@@unscopables]
  1551. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1552. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  1553. objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
  1554. configurable: true,
  1555. value: objectCreate(null)
  1556. });
  1557. }
  1558. // add a key to Array.prototype[@@unscopables]
  1559. var addToUnscopables = function (key) {
  1560. ArrayPrototype[UNSCOPABLES][key] = true;
  1561. };
  1562. var $includes = arrayIncludes.includes;
  1563. // FF99+ bug
  1564. var BROKEN_ON_SPARSE = fails(function () {
  1565. return !Array(1).includes();
  1566. });
  1567. // `Array.prototype.includes` method
  1568. // https://tc39.es/ecma262/#sec-array.prototype.includes
  1569. _export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
  1570. includes: function includes(el /* , fromIndex = 0 */) {
  1571. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  1572. }
  1573. });
  1574. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1575. addToUnscopables('includes');
  1576. // `IsArray` abstract operation
  1577. // https://tc39.es/ecma262/#sec-isarray
  1578. // eslint-disable-next-line es-x/no-array-isarray -- safe
  1579. var isArray = Array.isArray || function isArray(argument) {
  1580. return classofRaw(argument) == 'Array';
  1581. };
  1582. var SPECIES$3 = wellKnownSymbol('species');
  1583. var Array$2 = global_1.Array;
  1584. // a part of `ArraySpeciesCreate` abstract operation
  1585. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  1586. var arraySpeciesConstructor = function (originalArray) {
  1587. var C;
  1588. if (isArray(originalArray)) {
  1589. C = originalArray.constructor;
  1590. // cross-realm fallback
  1591. if (isConstructor(C) && (C === Array$2 || isArray(C.prototype))) C = undefined;
  1592. else if (isObject(C)) {
  1593. C = C[SPECIES$3];
  1594. if (C === null) C = undefined;
  1595. }
  1596. } return C === undefined ? Array$2 : C;
  1597. };
  1598. // `ArraySpeciesCreate` abstract operation
  1599. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  1600. var arraySpeciesCreate = function (originalArray, length) {
  1601. return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
  1602. };
  1603. var SPECIES$2 = wellKnownSymbol('species');
  1604. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  1605. // We can't use this feature detection in V8 since it causes
  1606. // deoptimization and serious performance degradation
  1607. // https://github.com/zloirock/core-js/issues/677
  1608. return engineV8Version >= 51 || !fails(function () {
  1609. var array = [];
  1610. var constructor = array.constructor = {};
  1611. constructor[SPECIES$2] = function () {
  1612. return { foo: 1 };
  1613. };
  1614. return array[METHOD_NAME](Boolean).foo !== 1;
  1615. });
  1616. };
  1617. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  1618. var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
  1619. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  1620. var TypeError$5 = global_1.TypeError;
  1621. // We can't use this feature detection in V8 since it causes
  1622. // deoptimization and serious performance degradation
  1623. // https://github.com/zloirock/core-js/issues/679
  1624. var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
  1625. var array = [];
  1626. array[IS_CONCAT_SPREADABLE] = false;
  1627. return array.concat()[0] !== array;
  1628. });
  1629. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  1630. var isConcatSpreadable = function (O) {
  1631. if (!isObject(O)) return false;
  1632. var spreadable = O[IS_CONCAT_SPREADABLE];
  1633. return spreadable !== undefined ? !!spreadable : isArray(O);
  1634. };
  1635. var FORCED$3 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  1636. // `Array.prototype.concat` method
  1637. // https://tc39.es/ecma262/#sec-array.prototype.concat
  1638. // with adding support of @@isConcatSpreadable and @@species
  1639. _export({ target: 'Array', proto: true, arity: 1, forced: FORCED$3 }, {
  1640. // eslint-disable-next-line no-unused-vars -- required for `.length`
  1641. concat: function concat(arg) {
  1642. var O = toObject(this);
  1643. var A = arraySpeciesCreate(O, 0);
  1644. var n = 0;
  1645. var i, k, length, len, E;
  1646. for (i = -1, length = arguments.length; i < length; i++) {
  1647. E = i === -1 ? O : arguments[i];
  1648. if (isConcatSpreadable(E)) {
  1649. len = lengthOfArrayLike(E);
  1650. if (n + len > MAX_SAFE_INTEGER$1) throw TypeError$5(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  1651. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  1652. } else {
  1653. if (n >= MAX_SAFE_INTEGER$1) throw TypeError$5(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  1654. createProperty(A, n++, E);
  1655. }
  1656. }
  1657. A.length = n;
  1658. return A;
  1659. }
  1660. });
  1661. var bind = functionUncurryThis(functionUncurryThis.bind);
  1662. // optional / simple context binding
  1663. var functionBindContext = function (fn, that) {
  1664. aCallable(fn);
  1665. return that === undefined ? fn : functionBindNative ? bind(fn, that) : function (/* ...args */) {
  1666. return fn.apply(that, arguments);
  1667. };
  1668. };
  1669. var push$2 = functionUncurryThis([].push);
  1670. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
  1671. var createMethod = function (TYPE) {
  1672. var IS_MAP = TYPE == 1;
  1673. var IS_FILTER = TYPE == 2;
  1674. var IS_SOME = TYPE == 3;
  1675. var IS_EVERY = TYPE == 4;
  1676. var IS_FIND_INDEX = TYPE == 6;
  1677. var IS_FILTER_REJECT = TYPE == 7;
  1678. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  1679. return function ($this, callbackfn, that, specificCreate) {
  1680. var O = toObject($this);
  1681. var self = indexedObject(O);
  1682. var boundFunction = functionBindContext(callbackfn, that);
  1683. var length = lengthOfArrayLike(self);
  1684. var index = 0;
  1685. var create = specificCreate || arraySpeciesCreate;
  1686. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
  1687. var value, result;
  1688. for (;length > index; index++) if (NO_HOLES || index in self) {
  1689. value = self[index];
  1690. result = boundFunction(value, index, O);
  1691. if (TYPE) {
  1692. if (IS_MAP) target[index] = result; // map
  1693. else if (result) switch (TYPE) {
  1694. case 3: return true; // some
  1695. case 5: return value; // find
  1696. case 6: return index; // findIndex
  1697. case 2: push$2(target, value); // filter
  1698. } else switch (TYPE) {
  1699. case 4: return false; // every
  1700. case 7: push$2(target, value); // filterReject
  1701. }
  1702. }
  1703. }
  1704. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  1705. };
  1706. };
  1707. var arrayIteration = {
  1708. // `Array.prototype.forEach` method
  1709. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  1710. forEach: createMethod(0),
  1711. // `Array.prototype.map` method
  1712. // https://tc39.es/ecma262/#sec-array.prototype.map
  1713. map: createMethod(1),
  1714. // `Array.prototype.filter` method
  1715. // https://tc39.es/ecma262/#sec-array.prototype.filter
  1716. filter: createMethod(2),
  1717. // `Array.prototype.some` method
  1718. // https://tc39.es/ecma262/#sec-array.prototype.some
  1719. some: createMethod(3),
  1720. // `Array.prototype.every` method
  1721. // https://tc39.es/ecma262/#sec-array.prototype.every
  1722. every: createMethod(4),
  1723. // `Array.prototype.find` method
  1724. // https://tc39.es/ecma262/#sec-array.prototype.find
  1725. find: createMethod(5),
  1726. // `Array.prototype.findIndex` method
  1727. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  1728. findIndex: createMethod(6),
  1729. // `Array.prototype.filterReject` method
  1730. // https://github.com/tc39/proposal-array-filtering
  1731. filterReject: createMethod(7)
  1732. };
  1733. var $find = arrayIteration.find;
  1734. var FIND = 'find';
  1735. var SKIPS_HOLES$1 = true;
  1736. // Shouldn't skip holes
  1737. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES$1 = false; });
  1738. // `Array.prototype.find` method
  1739. // https://tc39.es/ecma262/#sec-array.prototype.find
  1740. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, {
  1741. find: function find(callbackfn /* , that = undefined */) {
  1742. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1743. }
  1744. });
  1745. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1746. addToUnscopables(FIND);
  1747. // `Object.prototype.toString` method implementation
  1748. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  1749. var objectToString = toStringTagSupport ? {}.toString : function toString() {
  1750. return '[object ' + classof(this) + ']';
  1751. };
  1752. // `Object.prototype.toString` method
  1753. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  1754. if (!toStringTagSupport) {
  1755. defineBuiltIn(Object.prototype, 'toString', objectToString, { unsafe: true });
  1756. }
  1757. var TypeError$4 = global_1.TypeError;
  1758. var notARegexp = function (it) {
  1759. if (isRegexp(it)) {
  1760. throw TypeError$4("The method doesn't accept regular expressions");
  1761. } return it;
  1762. };
  1763. var MATCH$1 = wellKnownSymbol('match');
  1764. var correctIsRegexpLogic = function (METHOD_NAME) {
  1765. var regexp = /./;
  1766. try {
  1767. '/./'[METHOD_NAME](regexp);
  1768. } catch (error1) {
  1769. try {
  1770. regexp[MATCH$1] = false;
  1771. return '/./'[METHOD_NAME](regexp);
  1772. } catch (error2) { /* empty */ }
  1773. } return false;
  1774. };
  1775. var stringIndexOf$2 = functionUncurryThis(''.indexOf);
  1776. // `String.prototype.includes` method
  1777. // https://tc39.es/ecma262/#sec-string.prototype.includes
  1778. _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
  1779. includes: function includes(searchString /* , position = 0 */) {
  1780. return !!~stringIndexOf$2(
  1781. toString_1(requireObjectCoercible(this)),
  1782. toString_1(notARegexp(searchString)),
  1783. arguments.length > 1 ? arguments[1] : undefined
  1784. );
  1785. }
  1786. });
  1787. // iterable DOM collections
  1788. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  1789. var domIterables = {
  1790. CSSRuleList: 0,
  1791. CSSStyleDeclaration: 0,
  1792. CSSValueList: 0,
  1793. ClientRectList: 0,
  1794. DOMRectList: 0,
  1795. DOMStringList: 0,
  1796. DOMTokenList: 1,
  1797. DataTransferItemList: 0,
  1798. FileList: 0,
  1799. HTMLAllCollection: 0,
  1800. HTMLCollection: 0,
  1801. HTMLFormElement: 0,
  1802. HTMLSelectElement: 0,
  1803. MediaList: 0,
  1804. MimeTypeArray: 0,
  1805. NamedNodeMap: 0,
  1806. NodeList: 1,
  1807. PaintRequestList: 0,
  1808. Plugin: 0,
  1809. PluginArray: 0,
  1810. SVGLengthList: 0,
  1811. SVGNumberList: 0,
  1812. SVGPathSegList: 0,
  1813. SVGPointList: 0,
  1814. SVGStringList: 0,
  1815. SVGTransformList: 0,
  1816. SourceBufferList: 0,
  1817. StyleSheetList: 0,
  1818. TextTrackCueList: 0,
  1819. TextTrackList: 0,
  1820. TouchList: 0
  1821. };
  1822. // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
  1823. var classList = documentCreateElement('span').classList;
  1824. var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;
  1825. var domTokenListPrototype = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;
  1826. var $forEach = arrayIteration.forEach;
  1827. var STRICT_METHOD$2 = arrayMethodIsStrict('forEach');
  1828. // `Array.prototype.forEach` method implementation
  1829. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  1830. var arrayForEach = !STRICT_METHOD$2 ? function forEach(callbackfn /* , thisArg */) {
  1831. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1832. // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
  1833. } : [].forEach;
  1834. var handlePrototype$1 = function (CollectionPrototype) {
  1835. // some Chrome versions have non-configurable methods on DOMTokenList
  1836. if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
  1837. createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
  1838. } catch (error) {
  1839. CollectionPrototype.forEach = arrayForEach;
  1840. }
  1841. };
  1842. for (var COLLECTION_NAME$1 in domIterables) {
  1843. if (domIterables[COLLECTION_NAME$1]) {
  1844. handlePrototype$1(global_1[COLLECTION_NAME$1] && global_1[COLLECTION_NAME$1].prototype);
  1845. }
  1846. }
  1847. handlePrototype$1(domTokenListPrototype);
  1848. var trim$2 = stringTrim.trim;
  1849. var charAt$2 = functionUncurryThis(''.charAt);
  1850. var n$ParseFloat = global_1.parseFloat;
  1851. var Symbol$2 = global_1.Symbol;
  1852. var ITERATOR$4 = Symbol$2 && Symbol$2.iterator;
  1853. var FORCED$2 = 1 / n$ParseFloat(whitespaces + '-0') !== -Infinity
  1854. // MS Edge 18- broken with boxed symbols
  1855. || (ITERATOR$4 && !fails(function () { n$ParseFloat(Object(ITERATOR$4)); }));
  1856. // `parseFloat` method
  1857. // https://tc39.es/ecma262/#sec-parsefloat-string
  1858. var numberParseFloat = FORCED$2 ? function parseFloat(string) {
  1859. var trimmedString = trim$2(toString_1(string));
  1860. var result = n$ParseFloat(trimmedString);
  1861. return result === 0 && charAt$2(trimmedString, 0) == '-' ? -0 : result;
  1862. } : n$ParseFloat;
  1863. // `parseFloat` method
  1864. // https://tc39.es/ecma262/#sec-parsefloat-string
  1865. _export({ global: true, forced: parseFloat != numberParseFloat }, {
  1866. parseFloat: numberParseFloat
  1867. });
  1868. /* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
  1869. var $IndexOf = arrayIncludes.indexOf;
  1870. var un$IndexOf = functionUncurryThis([].indexOf);
  1871. var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
  1872. var STRICT_METHOD$1 = arrayMethodIsStrict('indexOf');
  1873. // `Array.prototype.indexOf` method
  1874. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  1875. _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$1 }, {
  1876. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  1877. var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
  1878. return NEGATIVE_ZERO
  1879. // convert -0 to +0
  1880. ? un$IndexOf(this, searchElement, fromIndex) || 0
  1881. : $IndexOf(this, searchElement, fromIndex);
  1882. }
  1883. });
  1884. var floor$1 = Math.floor;
  1885. var mergeSort = function (array, comparefn) {
  1886. var length = array.length;
  1887. var middle = floor$1(length / 2);
  1888. return length < 8 ? insertionSort(array, comparefn) : merge(
  1889. array,
  1890. mergeSort(arraySliceSimple(array, 0, middle), comparefn),
  1891. mergeSort(arraySliceSimple(array, middle), comparefn),
  1892. comparefn
  1893. );
  1894. };
  1895. var insertionSort = function (array, comparefn) {
  1896. var length = array.length;
  1897. var i = 1;
  1898. var element, j;
  1899. while (i < length) {
  1900. j = i;
  1901. element = array[i];
  1902. while (j && comparefn(array[j - 1], element) > 0) {
  1903. array[j] = array[--j];
  1904. }
  1905. if (j !== i++) array[j] = element;
  1906. } return array;
  1907. };
  1908. var merge = function (array, left, right, comparefn) {
  1909. var llength = left.length;
  1910. var rlength = right.length;
  1911. var lindex = 0;
  1912. var rindex = 0;
  1913. while (lindex < llength || rindex < rlength) {
  1914. array[lindex + rindex] = (lindex < llength && rindex < rlength)
  1915. ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
  1916. : lindex < llength ? left[lindex++] : right[rindex++];
  1917. } return array;
  1918. };
  1919. var arraySort = mergeSort;
  1920. var firefox = engineUserAgent.match(/firefox\/(\d+)/i);
  1921. var engineFfVersion = !!firefox && +firefox[1];
  1922. var engineIsIeOrEdge = /MSIE|Trident/.test(engineUserAgent);
  1923. var webkit = engineUserAgent.match(/AppleWebKit\/(\d+)\./);
  1924. var engineWebkitVersion = !!webkit && +webkit[1];
  1925. var test$1 = [];
  1926. var un$Sort = functionUncurryThis(test$1.sort);
  1927. var push$1 = functionUncurryThis(test$1.push);
  1928. // IE8-
  1929. var FAILS_ON_UNDEFINED = fails(function () {
  1930. test$1.sort(undefined);
  1931. });
  1932. // V8 bug
  1933. var FAILS_ON_NULL = fails(function () {
  1934. test$1.sort(null);
  1935. });
  1936. // Old WebKit
  1937. var STRICT_METHOD = arrayMethodIsStrict('sort');
  1938. var STABLE_SORT = !fails(function () {
  1939. // feature detection can be too slow, so check engines versions
  1940. if (engineV8Version) return engineV8Version < 70;
  1941. if (engineFfVersion && engineFfVersion > 3) return;
  1942. if (engineIsIeOrEdge) return true;
  1943. if (engineWebkitVersion) return engineWebkitVersion < 603;
  1944. var result = '';
  1945. var code, chr, value, index;
  1946. // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
  1947. for (code = 65; code < 76; code++) {
  1948. chr = String.fromCharCode(code);
  1949. switch (code) {
  1950. case 66: case 69: case 70: case 72: value = 3; break;
  1951. case 68: case 71: value = 4; break;
  1952. default: value = 2;
  1953. }
  1954. for (index = 0; index < 47; index++) {
  1955. test$1.push({ k: chr + index, v: value });
  1956. }
  1957. }
  1958. test$1.sort(function (a, b) { return b.v - a.v; });
  1959. for (index = 0; index < test$1.length; index++) {
  1960. chr = test$1[index].k.charAt(0);
  1961. if (result.charAt(result.length - 1) !== chr) result += chr;
  1962. }
  1963. return result !== 'DGBEFHACIJK';
  1964. });
  1965. var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
  1966. var getSortCompare = function (comparefn) {
  1967. return function (x, y) {
  1968. if (y === undefined) return -1;
  1969. if (x === undefined) return 1;
  1970. if (comparefn !== undefined) return +comparefn(x, y) || 0;
  1971. return toString_1(x) > toString_1(y) ? 1 : -1;
  1972. };
  1973. };
  1974. // `Array.prototype.sort` method
  1975. // https://tc39.es/ecma262/#sec-array.prototype.sort
  1976. _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
  1977. sort: function sort(comparefn) {
  1978. if (comparefn !== undefined) aCallable(comparefn);
  1979. var array = toObject(this);
  1980. if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
  1981. var items = [];
  1982. var arrayLength = lengthOfArrayLike(array);
  1983. var itemsLength, index;
  1984. for (index = 0; index < arrayLength; index++) {
  1985. if (index in array) push$1(items, array[index]);
  1986. }
  1987. arraySort(items, getSortCompare(comparefn));
  1988. itemsLength = items.length;
  1989. index = 0;
  1990. while (index < itemsLength) array[index] = items[index++];
  1991. while (index < arrayLength) delete array[index++];
  1992. return array;
  1993. }
  1994. });
  1995. var floor = Math.floor;
  1996. var charAt$1 = functionUncurryThis(''.charAt);
  1997. var replace$1 = functionUncurryThis(''.replace);
  1998. var stringSlice$3 = functionUncurryThis(''.slice);
  1999. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
  2000. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
  2001. // `GetSubstitution` abstract operation
  2002. // https://tc39.es/ecma262/#sec-getsubstitution
  2003. var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) {
  2004. var tailPos = position + matched.length;
  2005. var m = captures.length;
  2006. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  2007. if (namedCaptures !== undefined) {
  2008. namedCaptures = toObject(namedCaptures);
  2009. symbols = SUBSTITUTION_SYMBOLS;
  2010. }
  2011. return replace$1(replacement, symbols, function (match, ch) {
  2012. var capture;
  2013. switch (charAt$1(ch, 0)) {
  2014. case '$': return '$';
  2015. case '&': return matched;
  2016. case '`': return stringSlice$3(str, 0, position);
  2017. case "'": return stringSlice$3(str, tailPos);
  2018. case '<':
  2019. capture = namedCaptures[stringSlice$3(ch, 1, -1)];
  2020. break;
  2021. default: // \d\d?
  2022. var n = +ch;
  2023. if (n === 0) return match;
  2024. if (n > m) {
  2025. var f = floor(n / 10);
  2026. if (f === 0) return match;
  2027. if (f <= m) return captures[f - 1] === undefined ? charAt$1(ch, 1) : captures[f - 1] + charAt$1(ch, 1);
  2028. return match;
  2029. }
  2030. capture = captures[n - 1];
  2031. }
  2032. return capture === undefined ? '' : capture;
  2033. });
  2034. };
  2035. var REPLACE = wellKnownSymbol('replace');
  2036. var max$2 = Math.max;
  2037. var min$3 = Math.min;
  2038. var concat = functionUncurryThis([].concat);
  2039. var push = functionUncurryThis([].push);
  2040. var stringIndexOf$1 = functionUncurryThis(''.indexOf);
  2041. var stringSlice$2 = functionUncurryThis(''.slice);
  2042. var maybeToString = function (it) {
  2043. return it === undefined ? it : String(it);
  2044. };
  2045. // IE <= 11 replaces $0 with the whole match, as if it was $&
  2046. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  2047. var REPLACE_KEEPS_$0 = (function () {
  2048. // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
  2049. return 'a'.replace(/./, '$0') === '$0';
  2050. })();
  2051. // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
  2052. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
  2053. if (/./[REPLACE]) {
  2054. return /./[REPLACE]('a', '$0') === '';
  2055. }
  2056. return false;
  2057. })();
  2058. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  2059. var re = /./;
  2060. re.exec = function () {
  2061. var result = [];
  2062. result.groups = { a: '7' };
  2063. return result;
  2064. };
  2065. // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
  2066. return ''.replace(re, '$<a>') !== '7';
  2067. });
  2068. // @@replace logic
  2069. fixRegexpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
  2070. var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
  2071. return [
  2072. // `String.prototype.replace` method
  2073. // https://tc39.es/ecma262/#sec-string.prototype.replace
  2074. function replace(searchValue, replaceValue) {
  2075. var O = requireObjectCoercible(this);
  2076. var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
  2077. return replacer
  2078. ? functionCall(replacer, searchValue, O, replaceValue)
  2079. : functionCall(nativeReplace, toString_1(O), searchValue, replaceValue);
  2080. },
  2081. // `RegExp.prototype[@@replace]` method
  2082. // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
  2083. function (string, replaceValue) {
  2084. var rx = anObject(this);
  2085. var S = toString_1(string);
  2086. if (
  2087. typeof replaceValue == 'string' &&
  2088. stringIndexOf$1(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
  2089. stringIndexOf$1(replaceValue, '$<') === -1
  2090. ) {
  2091. var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
  2092. if (res.done) return res.value;
  2093. }
  2094. var functionalReplace = isCallable(replaceValue);
  2095. if (!functionalReplace) replaceValue = toString_1(replaceValue);
  2096. var global = rx.global;
  2097. if (global) {
  2098. var fullUnicode = rx.unicode;
  2099. rx.lastIndex = 0;
  2100. }
  2101. var results = [];
  2102. while (true) {
  2103. var result = regexpExecAbstract(rx, S);
  2104. if (result === null) break;
  2105. push(results, result);
  2106. if (!global) break;
  2107. var matchStr = toString_1(result[0]);
  2108. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  2109. }
  2110. var accumulatedResult = '';
  2111. var nextSourcePosition = 0;
  2112. for (var i = 0; i < results.length; i++) {
  2113. result = results[i];
  2114. var matched = toString_1(result[0]);
  2115. var position = max$2(min$3(toIntegerOrInfinity(result.index), S.length), 0);
  2116. var captures = [];
  2117. // NOTE: This is equivalent to
  2118. // captures = result.slice(1).map(maybeToString)
  2119. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  2120. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  2121. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  2122. for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
  2123. var namedCaptures = result.groups;
  2124. if (functionalReplace) {
  2125. var replacerArgs = concat([matched], captures, position, S);
  2126. if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
  2127. var replacement = toString_1(functionApply(replaceValue, undefined, replacerArgs));
  2128. } else {
  2129. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  2130. }
  2131. if (position >= nextSourcePosition) {
  2132. accumulatedResult += stringSlice$2(S, nextSourcePosition, position) + replacement;
  2133. nextSourcePosition = position + matched.length;
  2134. }
  2135. }
  2136. return accumulatedResult + stringSlice$2(S, nextSourcePosition);
  2137. }
  2138. ];
  2139. }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
  2140. var $filter = arrayIteration.filter;
  2141. var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('filter');
  2142. // `Array.prototype.filter` method
  2143. // https://tc39.es/ecma262/#sec-array.prototype.filter
  2144. // with adding support of @@species
  2145. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 }, {
  2146. filter: function filter(callbackfn /* , thisArg */) {
  2147. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  2148. }
  2149. });
  2150. // `SameValue` abstract operation
  2151. // https://tc39.es/ecma262/#sec-samevalue
  2152. // eslint-disable-next-line es-x/no-object-is -- safe
  2153. var sameValue = Object.is || function is(x, y) {
  2154. // eslint-disable-next-line no-self-compare -- NaN check
  2155. return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
  2156. };
  2157. // @@search logic
  2158. fixRegexpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) {
  2159. return [
  2160. // `String.prototype.search` method
  2161. // https://tc39.es/ecma262/#sec-string.prototype.search
  2162. function search(regexp) {
  2163. var O = requireObjectCoercible(this);
  2164. var searcher = regexp == undefined ? undefined : getMethod(regexp, SEARCH);
  2165. return searcher ? functionCall(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString_1(O));
  2166. },
  2167. // `RegExp.prototype[@@search]` method
  2168. // https://tc39.es/ecma262/#sec-regexp.prototype-@@search
  2169. function (string) {
  2170. var rx = anObject(this);
  2171. var S = toString_1(string);
  2172. var res = maybeCallNative(nativeSearch, rx, S);
  2173. if (res.done) return res.value;
  2174. var previousLastIndex = rx.lastIndex;
  2175. if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
  2176. var result = regexpExecAbstract(rx, S);
  2177. if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
  2178. return result === null ? -1 : result.index;
  2179. }
  2180. ];
  2181. });
  2182. var trim$1 = stringTrim.trim;
  2183. var $parseInt = global_1.parseInt;
  2184. var Symbol$1 = global_1.Symbol;
  2185. var ITERATOR$3 = Symbol$1 && Symbol$1.iterator;
  2186. var hex = /^[+-]?0x/i;
  2187. var exec$1 = functionUncurryThis(hex.exec);
  2188. var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22
  2189. // MS Edge 18- broken with boxed symbols
  2190. || (ITERATOR$3 && !fails(function () { $parseInt(Object(ITERATOR$3)); }));
  2191. // `parseInt` method
  2192. // https://tc39.es/ecma262/#sec-parseint-string-radix
  2193. var numberParseInt = FORCED ? function parseInt(string, radix) {
  2194. var S = trim$1(toString_1(string));
  2195. return $parseInt(S, (radix >>> 0) || (exec$1(hex, S) ? 16 : 10));
  2196. } : $parseInt;
  2197. // `parseInt` method
  2198. // https://tc39.es/ecma262/#sec-parseint-string-radix
  2199. _export({ global: true, forced: parseInt != numberParseInt }, {
  2200. parseInt: numberParseInt
  2201. });
  2202. var $map = arrayIteration.map;
  2203. var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');
  2204. // `Array.prototype.map` method
  2205. // https://tc39.es/ecma262/#sec-array.prototype.map
  2206. // with adding support of @@species
  2207. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, {
  2208. map: function map(callbackfn /* , thisArg */) {
  2209. return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  2210. }
  2211. });
  2212. var $findIndex = arrayIteration.findIndex;
  2213. var FIND_INDEX = 'findIndex';
  2214. var SKIPS_HOLES = true;
  2215. // Shouldn't skip holes
  2216. if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });
  2217. // `Array.prototype.findIndex` method
  2218. // https://tc39.es/ecma262/#sec-array.prototype.findindex
  2219. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  2220. findIndex: function findIndex(callbackfn /* , that = undefined */) {
  2221. return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  2222. }
  2223. });
  2224. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  2225. addToUnscopables(FIND_INDEX);
  2226. var String$1 = global_1.String;
  2227. var TypeError$3 = global_1.TypeError;
  2228. var aPossiblePrototype = function (argument) {
  2229. if (typeof argument == 'object' || isCallable(argument)) return argument;
  2230. throw TypeError$3("Can't set " + String$1(argument) + ' as a prototype');
  2231. };
  2232. /* eslint-disable no-proto -- safe */
  2233. // `Object.setPrototypeOf` method
  2234. // https://tc39.es/ecma262/#sec-object.setprototypeof
  2235. // Works with __proto__ only. Old v8 can't work with null proto objects.
  2236. // eslint-disable-next-line es-x/no-object-setprototypeof -- safe
  2237. var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  2238. var CORRECT_SETTER = false;
  2239. var test = {};
  2240. var setter;
  2241. try {
  2242. // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
  2243. setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
  2244. setter(test, []);
  2245. CORRECT_SETTER = test instanceof Array;
  2246. } catch (error) { /* empty */ }
  2247. return function setPrototypeOf(O, proto) {
  2248. anObject(O);
  2249. aPossiblePrototype(proto);
  2250. if (CORRECT_SETTER) setter(O, proto);
  2251. else O.__proto__ = proto;
  2252. return O;
  2253. };
  2254. }() : undefined);
  2255. // makes subclassing work correct for wrapped built-ins
  2256. var inheritIfRequired = function ($this, dummy, Wrapper) {
  2257. var NewTarget, NewTargetPrototype;
  2258. if (
  2259. // it can work only with native `setPrototypeOf`
  2260. objectSetPrototypeOf &&
  2261. // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
  2262. isCallable(NewTarget = dummy.constructor) &&
  2263. NewTarget !== Wrapper &&
  2264. isObject(NewTargetPrototype = NewTarget.prototype) &&
  2265. NewTargetPrototype !== Wrapper.prototype
  2266. ) objectSetPrototypeOf($this, NewTargetPrototype);
  2267. return $this;
  2268. };
  2269. var RegExpPrototype$2 = RegExp.prototype;
  2270. var regexpGetFlags = function (R) {
  2271. var flags = R.flags;
  2272. return flags === undefined && !('flags' in RegExpPrototype$2) && !hasOwnProperty_1(R, 'flags') && objectIsPrototypeOf(RegExpPrototype$2, R)
  2273. ? functionCall(regexpFlags, R) : flags;
  2274. };
  2275. var defineProperty$3 = objectDefineProperty.f;
  2276. var proxyAccessor = function (Target, Source, key) {
  2277. key in Target || defineProperty$3(Target, key, {
  2278. configurable: true,
  2279. get: function () { return Source[key]; },
  2280. set: function (it) { Source[key] = it; }
  2281. });
  2282. };
  2283. var SPECIES$1 = wellKnownSymbol('species');
  2284. var setSpecies = function (CONSTRUCTOR_NAME) {
  2285. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  2286. var defineProperty = objectDefineProperty.f;
  2287. if (descriptors && Constructor && !Constructor[SPECIES$1]) {
  2288. defineProperty(Constructor, SPECIES$1, {
  2289. configurable: true,
  2290. get: function () { return this; }
  2291. });
  2292. }
  2293. };
  2294. var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
  2295. var enforceInternalState = internalState.enforce;
  2296. var MATCH = wellKnownSymbol('match');
  2297. var NativeRegExp = global_1.RegExp;
  2298. var RegExpPrototype$1 = NativeRegExp.prototype;
  2299. var SyntaxError = global_1.SyntaxError;
  2300. var exec = functionUncurryThis(RegExpPrototype$1.exec);
  2301. var charAt = functionUncurryThis(''.charAt);
  2302. var replace = functionUncurryThis(''.replace);
  2303. var stringIndexOf = functionUncurryThis(''.indexOf);
  2304. var stringSlice$1 = functionUncurryThis(''.slice);
  2305. // TODO: Use only propper RegExpIdentifierName
  2306. var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
  2307. var re1 = /a/g;
  2308. var re2 = /a/g;
  2309. // "new" should create a new object, old webkit bug
  2310. var CORRECT_NEW = new NativeRegExp(re1) !== re1;
  2311. var MISSED_STICKY = regexpStickyHelpers.MISSED_STICKY;
  2312. var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y;
  2313. var BASE_FORCED = descriptors &&
  2314. (!CORRECT_NEW || MISSED_STICKY || regexpUnsupportedDotAll || regexpUnsupportedNcg || fails(function () {
  2315. re2[MATCH] = false;
  2316. // RegExp constructor can alter flags and IsRegExp works correct with @@match
  2317. return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
  2318. }));
  2319. var handleDotAll = function (string) {
  2320. var length = string.length;
  2321. var index = 0;
  2322. var result = '';
  2323. var brackets = false;
  2324. var chr;
  2325. for (; index <= length; index++) {
  2326. chr = charAt(string, index);
  2327. if (chr === '\\') {
  2328. result += chr + charAt(string, ++index);
  2329. continue;
  2330. }
  2331. if (!brackets && chr === '.') {
  2332. result += '[\\s\\S]';
  2333. } else {
  2334. if (chr === '[') {
  2335. brackets = true;
  2336. } else if (chr === ']') {
  2337. brackets = false;
  2338. } result += chr;
  2339. }
  2340. } return result;
  2341. };
  2342. var handleNCG = function (string) {
  2343. var length = string.length;
  2344. var index = 0;
  2345. var result = '';
  2346. var named = [];
  2347. var names = {};
  2348. var brackets = false;
  2349. var ncg = false;
  2350. var groupid = 0;
  2351. var groupname = '';
  2352. var chr;
  2353. for (; index <= length; index++) {
  2354. chr = charAt(string, index);
  2355. if (chr === '\\') {
  2356. chr = chr + charAt(string, ++index);
  2357. } else if (chr === ']') {
  2358. brackets = false;
  2359. } else if (!brackets) switch (true) {
  2360. case chr === '[':
  2361. brackets = true;
  2362. break;
  2363. case chr === '(':
  2364. if (exec(IS_NCG, stringSlice$1(string, index + 1))) {
  2365. index += 2;
  2366. ncg = true;
  2367. }
  2368. result += chr;
  2369. groupid++;
  2370. continue;
  2371. case chr === '>' && ncg:
  2372. if (groupname === '' || hasOwnProperty_1(names, groupname)) {
  2373. throw new SyntaxError('Invalid capture group name');
  2374. }
  2375. names[groupname] = true;
  2376. named[named.length] = [groupname, groupid];
  2377. ncg = false;
  2378. groupname = '';
  2379. continue;
  2380. }
  2381. if (ncg) groupname += chr;
  2382. else result += chr;
  2383. } return [result, named];
  2384. };
  2385. // `RegExp` constructor
  2386. // https://tc39.es/ecma262/#sec-regexp-constructor
  2387. if (isForced_1('RegExp', BASE_FORCED)) {
  2388. var RegExpWrapper = function RegExp(pattern, flags) {
  2389. var thisIsRegExp = objectIsPrototypeOf(RegExpPrototype$1, this);
  2390. var patternIsRegExp = isRegexp(pattern);
  2391. var flagsAreUndefined = flags === undefined;
  2392. var groups = [];
  2393. var rawPattern = pattern;
  2394. var rawFlags, dotAll, sticky, handled, result, state;
  2395. if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
  2396. return pattern;
  2397. }
  2398. if (patternIsRegExp || objectIsPrototypeOf(RegExpPrototype$1, pattern)) {
  2399. pattern = pattern.source;
  2400. if (flagsAreUndefined) flags = regexpGetFlags(rawPattern);
  2401. }
  2402. pattern = pattern === undefined ? '' : toString_1(pattern);
  2403. flags = flags === undefined ? '' : toString_1(flags);
  2404. rawPattern = pattern;
  2405. if (regexpUnsupportedDotAll && 'dotAll' in re1) {
  2406. dotAll = !!flags && stringIndexOf(flags, 's') > -1;
  2407. if (dotAll) flags = replace(flags, /s/g, '');
  2408. }
  2409. rawFlags = flags;
  2410. if (MISSED_STICKY && 'sticky' in re1) {
  2411. sticky = !!flags && stringIndexOf(flags, 'y') > -1;
  2412. if (sticky && UNSUPPORTED_Y) flags = replace(flags, /y/g, '');
  2413. }
  2414. if (regexpUnsupportedNcg) {
  2415. handled = handleNCG(pattern);
  2416. pattern = handled[0];
  2417. groups = handled[1];
  2418. }
  2419. result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype$1, RegExpWrapper);
  2420. if (dotAll || sticky || groups.length) {
  2421. state = enforceInternalState(result);
  2422. if (dotAll) {
  2423. state.dotAll = true;
  2424. state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
  2425. }
  2426. if (sticky) state.sticky = true;
  2427. if (groups.length) state.groups = groups;
  2428. }
  2429. if (pattern !== rawPattern) try {
  2430. // fails in old engines, but we have no alternatives for unsupported regex syntax
  2431. createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
  2432. } catch (error) { /* empty */ }
  2433. return result;
  2434. };
  2435. for (var keys$1 = getOwnPropertyNames$1(NativeRegExp), index = 0; keys$1.length > index;) {
  2436. proxyAccessor(RegExpWrapper, NativeRegExp, keys$1[index++]);
  2437. }
  2438. RegExpPrototype$1.constructor = RegExpWrapper;
  2439. RegExpWrapper.prototype = RegExpPrototype$1;
  2440. defineBuiltIn(global_1, 'RegExp', RegExpWrapper);
  2441. }
  2442. // https://tc39.es/ecma262/#sec-get-regexp-@@species
  2443. setSpecies('RegExp');
  2444. var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
  2445. var TO_STRING = 'toString';
  2446. var RegExpPrototype = RegExp.prototype;
  2447. var n$ToString = RegExpPrototype[TO_STRING];
  2448. var NOT_GENERIC = fails(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  2449. // FF44- RegExp#toString has a wrong name
  2450. var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && n$ToString.name != TO_STRING;
  2451. // `RegExp.prototype.toString` method
  2452. // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
  2453. if (NOT_GENERIC || INCORRECT_NAME) {
  2454. defineBuiltIn(RegExp.prototype, TO_STRING, function toString() {
  2455. var R = anObject(this);
  2456. var pattern = toString_1(R.source);
  2457. var flags = toString_1(regexpGetFlags(R));
  2458. return '/' + pattern + '/' + flags;
  2459. }, { unsafe: true });
  2460. }
  2461. var arraySlice$1 = functionUncurryThis([].slice);
  2462. var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('slice');
  2463. var SPECIES = wellKnownSymbol('species');
  2464. var Array$1 = global_1.Array;
  2465. var max$1 = Math.max;
  2466. // `Array.prototype.slice` method
  2467. // https://tc39.es/ecma262/#sec-array.prototype.slice
  2468. // fallback for not array-like ES3 strings and DOM objects
  2469. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, {
  2470. slice: function slice(start, end) {
  2471. var O = toIndexedObject(this);
  2472. var length = lengthOfArrayLike(O);
  2473. var k = toAbsoluteIndex(start, length);
  2474. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  2475. // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
  2476. var Constructor, result, n;
  2477. if (isArray(O)) {
  2478. Constructor = O.constructor;
  2479. // cross-realm fallback
  2480. if (isConstructor(Constructor) && (Constructor === Array$1 || isArray(Constructor.prototype))) {
  2481. Constructor = undefined;
  2482. } else if (isObject(Constructor)) {
  2483. Constructor = Constructor[SPECIES];
  2484. if (Constructor === null) Constructor = undefined;
  2485. }
  2486. if (Constructor === Array$1 || Constructor === undefined) {
  2487. return arraySlice$1(O, k, fin);
  2488. }
  2489. }
  2490. result = new (Constructor === undefined ? Array$1 : Constructor)(max$1(fin - k, 0));
  2491. for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
  2492. result.length = n;
  2493. return result;
  2494. }
  2495. });
  2496. var iterators = {};
  2497. var correctPrototypeGetter = !fails(function () {
  2498. function F() { /* empty */ }
  2499. F.prototype.constructor = null;
  2500. // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
  2501. return Object.getPrototypeOf(new F()) !== F.prototype;
  2502. });
  2503. var IE_PROTO = sharedKey('IE_PROTO');
  2504. var Object$1 = global_1.Object;
  2505. var ObjectPrototype = Object$1.prototype;
  2506. // `Object.getPrototypeOf` method
  2507. // https://tc39.es/ecma262/#sec-object.getprototypeof
  2508. var objectGetPrototypeOf = correctPrototypeGetter ? Object$1.getPrototypeOf : function (O) {
  2509. var object = toObject(O);
  2510. if (hasOwnProperty_1(object, IE_PROTO)) return object[IE_PROTO];
  2511. var constructor = object.constructor;
  2512. if (isCallable(constructor) && object instanceof constructor) {
  2513. return constructor.prototype;
  2514. } return object instanceof Object$1 ? ObjectPrototype : null;
  2515. };
  2516. var ITERATOR$2 = wellKnownSymbol('iterator');
  2517. var BUGGY_SAFARI_ITERATORS$1 = false;
  2518. // `%IteratorPrototype%` object
  2519. // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
  2520. var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
  2521. /* eslint-disable es-x/no-array-prototype-keys -- safe */
  2522. if ([].keys) {
  2523. arrayIterator = [].keys();
  2524. // Safari 8 has buggy iterators w/o `next`
  2525. if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
  2526. else {
  2527. PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
  2528. if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
  2529. }
  2530. }
  2531. var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () {
  2532. var test = {};
  2533. // FF44- legacy iterators case
  2534. return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
  2535. });
  2536. if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
  2537. // `%IteratorPrototype%[@@iterator]()` method
  2538. // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
  2539. if (!isCallable(IteratorPrototype$2[ITERATOR$2])) {
  2540. defineBuiltIn(IteratorPrototype$2, ITERATOR$2, function () {
  2541. return this;
  2542. });
  2543. }
  2544. var iteratorsCore = {
  2545. IteratorPrototype: IteratorPrototype$2,
  2546. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
  2547. };
  2548. var defineProperty$2 = objectDefineProperty.f;
  2549. var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
  2550. var setToStringTag = function (target, TAG, STATIC) {
  2551. if (target && !STATIC) target = target.prototype;
  2552. if (target && !hasOwnProperty_1(target, TO_STRING_TAG$1)) {
  2553. defineProperty$2(target, TO_STRING_TAG$1, { configurable: true, value: TAG });
  2554. }
  2555. };
  2556. var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
  2557. var returnThis$1 = function () { return this; };
  2558. var createIteratorConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
  2559. var TO_STRING_TAG = NAME + ' Iterator';
  2560. IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
  2561. setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
  2562. iterators[TO_STRING_TAG] = returnThis$1;
  2563. return IteratorConstructor;
  2564. };
  2565. var PROPER_FUNCTION_NAME = functionName.PROPER;
  2566. var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
  2567. var IteratorPrototype = iteratorsCore.IteratorPrototype;
  2568. var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS;
  2569. var ITERATOR$1 = wellKnownSymbol('iterator');
  2570. var KEYS = 'keys';
  2571. var VALUES = 'values';
  2572. var ENTRIES = 'entries';
  2573. var returnThis = function () { return this; };
  2574. var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  2575. createIteratorConstructor(IteratorConstructor, NAME, next);
  2576. var getIterationMethod = function (KIND) {
  2577. if (KIND === DEFAULT && defaultIterator) return defaultIterator;
  2578. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
  2579. switch (KIND) {
  2580. case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
  2581. case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
  2582. case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
  2583. } return function () { return new IteratorConstructor(this); };
  2584. };
  2585. var TO_STRING_TAG = NAME + ' Iterator';
  2586. var INCORRECT_VALUES_NAME = false;
  2587. var IterablePrototype = Iterable.prototype;
  2588. var nativeIterator = IterablePrototype[ITERATOR$1]
  2589. || IterablePrototype['@@iterator']
  2590. || DEFAULT && IterablePrototype[DEFAULT];
  2591. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  2592. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  2593. var CurrentIteratorPrototype, methods, KEY;
  2594. // fix native
  2595. if (anyNativeIterator) {
  2596. CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
  2597. if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  2598. if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  2599. if (objectSetPrototypeOf) {
  2600. objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  2601. } else if (!isCallable(CurrentIteratorPrototype[ITERATOR$1])) {
  2602. defineBuiltIn(CurrentIteratorPrototype, ITERATOR$1, returnThis);
  2603. }
  2604. }
  2605. // Set @@toStringTag to native iterators
  2606. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
  2607. }
  2608. }
  2609. // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
  2610. if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  2611. if (CONFIGURABLE_FUNCTION_NAME) {
  2612. createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
  2613. } else {
  2614. INCORRECT_VALUES_NAME = true;
  2615. defaultIterator = function values() { return functionCall(nativeIterator, this); };
  2616. }
  2617. }
  2618. // export additional methods
  2619. if (DEFAULT) {
  2620. methods = {
  2621. values: getIterationMethod(VALUES),
  2622. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  2623. entries: getIterationMethod(ENTRIES)
  2624. };
  2625. if (FORCED) for (KEY in methods) {
  2626. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  2627. defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
  2628. }
  2629. } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
  2630. }
  2631. // define iterator
  2632. if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
  2633. defineBuiltIn(IterablePrototype, ITERATOR$1, defaultIterator, { name: DEFAULT });
  2634. }
  2635. iterators[NAME] = defaultIterator;
  2636. return methods;
  2637. };
  2638. var defineProperty$1 = objectDefineProperty.f;
  2639. var ARRAY_ITERATOR = 'Array Iterator';
  2640. var setInternalState = internalState.set;
  2641. var getInternalState = internalState.getterFor(ARRAY_ITERATOR);
  2642. // `Array.prototype.entries` method
  2643. // https://tc39.es/ecma262/#sec-array.prototype.entries
  2644. // `Array.prototype.keys` method
  2645. // https://tc39.es/ecma262/#sec-array.prototype.keys
  2646. // `Array.prototype.values` method
  2647. // https://tc39.es/ecma262/#sec-array.prototype.values
  2648. // `Array.prototype[@@iterator]` method
  2649. // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
  2650. // `CreateArrayIterator` internal method
  2651. // https://tc39.es/ecma262/#sec-createarrayiterator
  2652. var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
  2653. setInternalState(this, {
  2654. type: ARRAY_ITERATOR,
  2655. target: toIndexedObject(iterated), // target
  2656. index: 0, // next index
  2657. kind: kind // kind
  2658. });
  2659. // `%ArrayIteratorPrototype%.next` method
  2660. // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
  2661. }, function () {
  2662. var state = getInternalState(this);
  2663. var target = state.target;
  2664. var kind = state.kind;
  2665. var index = state.index++;
  2666. if (!target || index >= target.length) {
  2667. state.target = undefined;
  2668. return { value: undefined, done: true };
  2669. }
  2670. if (kind == 'keys') return { value: index, done: false };
  2671. if (kind == 'values') return { value: target[index], done: false };
  2672. return { value: [index, target[index]], done: false };
  2673. }, 'values');
  2674. // argumentsList[@@iterator] is %ArrayProto_values%
  2675. // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
  2676. // https://tc39.es/ecma262/#sec-createmappedargumentsobject
  2677. var values = iterators.Arguments = iterators.Array;
  2678. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  2679. addToUnscopables('keys');
  2680. addToUnscopables('values');
  2681. addToUnscopables('entries');
  2682. // V8 ~ Chrome 45- bug
  2683. if (descriptors && values.name !== 'values') try {
  2684. defineProperty$1(values, 'name', { value: 'values' });
  2685. } catch (error) { /* empty */ }
  2686. var ITERATOR = wellKnownSymbol('iterator');
  2687. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2688. var ArrayValues = es_array_iterator.values;
  2689. var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
  2690. if (CollectionPrototype) {
  2691. // some Chrome versions have non-configurable methods on DOMTokenList
  2692. if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
  2693. createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
  2694. } catch (error) {
  2695. CollectionPrototype[ITERATOR] = ArrayValues;
  2696. }
  2697. if (!CollectionPrototype[TO_STRING_TAG]) {
  2698. createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
  2699. }
  2700. if (domIterables[COLLECTION_NAME]) for (var METHOD_NAME in es_array_iterator) {
  2701. // some Chrome versions have non-configurable methods on DOMTokenList
  2702. if (CollectionPrototype[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
  2703. createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, es_array_iterator[METHOD_NAME]);
  2704. } catch (error) {
  2705. CollectionPrototype[METHOD_NAME] = es_array_iterator[METHOD_NAME];
  2706. }
  2707. }
  2708. }
  2709. };
  2710. for (var COLLECTION_NAME in domIterables) {
  2711. handlePrototype(global_1[COLLECTION_NAME] && global_1[COLLECTION_NAME].prototype, COLLECTION_NAME);
  2712. }
  2713. handlePrototype(domTokenListPrototype, 'DOMTokenList');
  2714. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
  2715. var TypeError$2 = global_1.TypeError;
  2716. var max = Math.max;
  2717. var min$2 = Math.min;
  2718. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  2719. var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
  2720. // `Array.prototype.splice` method
  2721. // https://tc39.es/ecma262/#sec-array.prototype.splice
  2722. // with adding support of @@species
  2723. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  2724. splice: function splice(start, deleteCount /* , ...items */) {
  2725. var O = toObject(this);
  2726. var len = lengthOfArrayLike(O);
  2727. var actualStart = toAbsoluteIndex(start, len);
  2728. var argumentsLength = arguments.length;
  2729. var insertCount, actualDeleteCount, A, k, from, to;
  2730. if (argumentsLength === 0) {
  2731. insertCount = actualDeleteCount = 0;
  2732. } else if (argumentsLength === 1) {
  2733. insertCount = 0;
  2734. actualDeleteCount = len - actualStart;
  2735. } else {
  2736. insertCount = argumentsLength - 2;
  2737. actualDeleteCount = min$2(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
  2738. }
  2739. if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
  2740. throw TypeError$2(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
  2741. }
  2742. A = arraySpeciesCreate(O, actualDeleteCount);
  2743. for (k = 0; k < actualDeleteCount; k++) {
  2744. from = actualStart + k;
  2745. if (from in O) createProperty(A, k, O[from]);
  2746. }
  2747. A.length = actualDeleteCount;
  2748. if (insertCount < actualDeleteCount) {
  2749. for (k = actualStart; k < len - actualDeleteCount; k++) {
  2750. from = k + actualDeleteCount;
  2751. to = k + insertCount;
  2752. if (from in O) O[to] = O[from];
  2753. else delete O[to];
  2754. }
  2755. for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
  2756. } else if (insertCount > actualDeleteCount) {
  2757. for (k = len - actualDeleteCount; k > actualStart; k--) {
  2758. from = k + actualDeleteCount - 1;
  2759. to = k + insertCount - 1;
  2760. if (from in O) O[to] = O[from];
  2761. else delete O[to];
  2762. }
  2763. }
  2764. for (k = 0; k < insertCount; k++) {
  2765. O[k + actualStart] = arguments[k + 2];
  2766. }
  2767. O.length = len - actualDeleteCount + insertCount;
  2768. return A;
  2769. }
  2770. });
  2771. // `thisNumberValue` abstract operation
  2772. // https://tc39.es/ecma262/#sec-thisnumbervalue
  2773. var thisNumberValue = functionUncurryThis(1.0.valueOf);
  2774. var getOwnPropertyNames = objectGetOwnPropertyNames.f;
  2775. var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
  2776. var defineProperty = objectDefineProperty.f;
  2777. var trim = stringTrim.trim;
  2778. var NUMBER = 'Number';
  2779. var NativeNumber = global_1[NUMBER];
  2780. var NumberPrototype = NativeNumber.prototype;
  2781. var TypeError$1 = global_1.TypeError;
  2782. var arraySlice = functionUncurryThis(''.slice);
  2783. var charCodeAt = functionUncurryThis(''.charCodeAt);
  2784. // `ToNumeric` abstract operation
  2785. // https://tc39.es/ecma262/#sec-tonumeric
  2786. var toNumeric = function (value) {
  2787. var primValue = toPrimitive(value, 'number');
  2788. return typeof primValue == 'bigint' ? primValue : toNumber(primValue);
  2789. };
  2790. // `ToNumber` abstract operation
  2791. // https://tc39.es/ecma262/#sec-tonumber
  2792. var toNumber = function (argument) {
  2793. var it = toPrimitive(argument, 'number');
  2794. var first, third, radix, maxCode, digits, length, index, code;
  2795. if (isSymbol(it)) throw TypeError$1('Cannot convert a Symbol value to a number');
  2796. if (typeof it == 'string' && it.length > 2) {
  2797. it = trim(it);
  2798. first = charCodeAt(it, 0);
  2799. if (first === 43 || first === 45) {
  2800. third = charCodeAt(it, 2);
  2801. if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
  2802. } else if (first === 48) {
  2803. switch (charCodeAt(it, 1)) {
  2804. case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
  2805. case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
  2806. default: return +it;
  2807. }
  2808. digits = arraySlice(it, 2);
  2809. length = digits.length;
  2810. for (index = 0; index < length; index++) {
  2811. code = charCodeAt(digits, index);
  2812. // parseInt parses a string to a first unavailable symbol
  2813. // but ToNumber should return NaN if a string contains unavailable symbols
  2814. if (code < 48 || code > maxCode) return NaN;
  2815. } return parseInt(digits, radix);
  2816. }
  2817. } return +it;
  2818. };
  2819. // `Number` constructor
  2820. // https://tc39.es/ecma262/#sec-number-constructor
  2821. if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
  2822. var NumberWrapper = function Number(value) {
  2823. var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
  2824. var dummy = this;
  2825. // check on 1..constructor(foo) case
  2826. return objectIsPrototypeOf(NumberPrototype, dummy) && fails(function () { thisNumberValue(dummy); })
  2827. ? inheritIfRequired(Object(n), dummy, NumberWrapper) : n;
  2828. };
  2829. for (var keys = descriptors ? getOwnPropertyNames(NativeNumber) : (
  2830. // ES3:
  2831. 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  2832. // ES2015 (in case, if modules with ES2015 Number statics required before):
  2833. 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' +
  2834. // ESNext
  2835. 'fromString,range'
  2836. ).split(','), j = 0, key; keys.length > j; j++) {
  2837. if (hasOwnProperty_1(NativeNumber, key = keys[j]) && !hasOwnProperty_1(NumberWrapper, key)) {
  2838. defineProperty(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));
  2839. }
  2840. }
  2841. NumberWrapper.prototype = NumberPrototype;
  2842. NumberPrototype.constructor = NumberWrapper;
  2843. defineBuiltIn(global_1, NUMBER, NumberWrapper);
  2844. }
  2845. var un$Reverse = functionUncurryThis([].reverse);
  2846. var test = [1, 2];
  2847. // `Array.prototype.reverse` method
  2848. // https://tc39.es/ecma262/#sec-array.prototype.reverse
  2849. // fix for Safari 12.0 bug
  2850. // https://bugs.webkit.org/show_bug.cgi?id=188794
  2851. _export({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {
  2852. reverse: function reverse() {
  2853. // eslint-disable-next-line no-self-assign -- dirty hack
  2854. if (isArray(this)) this.length = this.length;
  2855. return un$Reverse(this);
  2856. }
  2857. });
  2858. var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
  2859. // `Object.keys` method
  2860. // https://tc39.es/ecma262/#sec-object.keys
  2861. _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  2862. keys: function keys(it) {
  2863. return objectKeys(toObject(it));
  2864. }
  2865. });
  2866. // @@match logic
  2867. fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
  2868. return [
  2869. // `String.prototype.match` method
  2870. // https://tc39.es/ecma262/#sec-string.prototype.match
  2871. function match(regexp) {
  2872. var O = requireObjectCoercible(this);
  2873. var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH);
  2874. return matcher ? functionCall(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString_1(O));
  2875. },
  2876. // `RegExp.prototype[@@match]` method
  2877. // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
  2878. function (string) {
  2879. var rx = anObject(this);
  2880. var S = toString_1(string);
  2881. var res = maybeCallNative(nativeMatch, rx, S);
  2882. if (res.done) return res.value;
  2883. if (!rx.global) return regexpExecAbstract(rx, S);
  2884. var fullUnicode = rx.unicode;
  2885. rx.lastIndex = 0;
  2886. var A = [];
  2887. var n = 0;
  2888. var result;
  2889. while ((result = regexpExecAbstract(rx, S)) !== null) {
  2890. var matchStr = toString_1(result[0]);
  2891. A[n] = matchStr;
  2892. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  2893. n++;
  2894. }
  2895. return n === 0 ? null : A;
  2896. }
  2897. ];
  2898. });
  2899. var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
  2900. // eslint-disable-next-line es-x/no-string-prototype-startswith -- safe
  2901. var un$StartsWith = functionUncurryThis(''.startsWith);
  2902. var stringSlice = functionUncurryThis(''.slice);
  2903. var min$1 = Math.min;
  2904. var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic('startsWith');
  2905. // https://github.com/zloirock/core-js/pull/702
  2906. var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () {
  2907. var descriptor = getOwnPropertyDescriptor$1(String.prototype, 'startsWith');
  2908. return descriptor && !descriptor.writable;
  2909. }();
  2910. // `String.prototype.startsWith` method
  2911. // https://tc39.es/ecma262/#sec-string.prototype.startswith
  2912. _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, {
  2913. startsWith: function startsWith(searchString /* , position = 0 */) {
  2914. var that = toString_1(requireObjectCoercible(this));
  2915. notARegexp(searchString);
  2916. var index = toLength(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length));
  2917. var search = toString_1(searchString);
  2918. return un$StartsWith
  2919. ? un$StartsWith(that, search, index)
  2920. : stringSlice(that, index, index + search.length) === search;
  2921. }
  2922. });
  2923. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  2924. // eslint-disable-next-line es-x/no-string-prototype-endswith -- safe
  2925. var un$EndsWith = functionUncurryThis(''.endsWith);
  2926. var slice = functionUncurryThis(''.slice);
  2927. var min = Math.min;
  2928. var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('endsWith');
  2929. // https://github.com/zloirock/core-js/pull/702
  2930. var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
  2931. var descriptor = getOwnPropertyDescriptor(String.prototype, 'endsWith');
  2932. return descriptor && !descriptor.writable;
  2933. }();
  2934. // `String.prototype.endsWith` method
  2935. // https://tc39.es/ecma262/#sec-string.prototype.endswith
  2936. _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
  2937. endsWith: function endsWith(searchString /* , endPosition = @length */) {
  2938. var that = toString_1(requireObjectCoercible(this));
  2939. notARegexp(searchString);
  2940. var endPosition = arguments.length > 1 ? arguments[1] : undefined;
  2941. var len = that.length;
  2942. var end = endPosition === undefined ? len : min(toLength(endPosition), len);
  2943. var search = toString_1(searchString);
  2944. return un$EndsWith
  2945. ? un$EndsWith(that, search, end)
  2946. : slice(that, end - search.length, end) === search;
  2947. }
  2948. });
  2949. var Utils = {
  2950. getBootstrapVersion: function getBootstrapVersion() {
  2951. var bootstrapVersion = 5;
  2952. try {
  2953. var rawVersion = $__default["default"].fn.dropdown.Constructor.VERSION; // Only try to parse VERSION if it is defined.
  2954. // It is undefined in older versions of Bootstrap (tested with 3.1.1).
  2955. if (rawVersion !== undefined) {
  2956. bootstrapVersion = parseInt(rawVersion, 10);
  2957. }
  2958. } catch (e) {// ignore
  2959. }
  2960. try {
  2961. // eslint-disable-next-line no-undef
  2962. var _rawVersion = bootstrap.Tooltip.VERSION;
  2963. if (_rawVersion !== undefined) {
  2964. bootstrapVersion = parseInt(_rawVersion, 10);
  2965. }
  2966. } catch (e) {// ignore
  2967. }
  2968. return bootstrapVersion;
  2969. },
  2970. getIconsPrefix: function getIconsPrefix(theme) {
  2971. return {
  2972. bootstrap3: 'glyphicon',
  2973. bootstrap4: 'fa',
  2974. bootstrap5: 'bi',
  2975. 'bootstrap-table': 'icon',
  2976. bulma: 'fa',
  2977. foundation: 'fa',
  2978. materialize: 'material-icons',
  2979. semantic: 'fa'
  2980. }[theme] || 'fa';
  2981. },
  2982. getIcons: function getIcons(prefix) {
  2983. return {
  2984. glyphicon: {
  2985. paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down',
  2986. paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up',
  2987. refresh: 'glyphicon-refresh icon-refresh',
  2988. toggleOff: 'glyphicon-list-alt icon-list-alt',
  2989. toggleOn: 'glyphicon-list-alt icon-list-alt',
  2990. columns: 'glyphicon-th icon-th',
  2991. detailOpen: 'glyphicon-plus icon-plus',
  2992. detailClose: 'glyphicon-minus icon-minus',
  2993. fullscreen: 'glyphicon-fullscreen',
  2994. search: 'glyphicon-search',
  2995. clearSearch: 'glyphicon-trash'
  2996. },
  2997. fa: {
  2998. paginationSwitchDown: 'fa-caret-square-down',
  2999. paginationSwitchUp: 'fa-caret-square-up',
  3000. refresh: 'fa-sync',
  3001. toggleOff: 'fa-toggle-off',
  3002. toggleOn: 'fa-toggle-on',
  3003. columns: 'fa-th-list',
  3004. detailOpen: 'fa-plus',
  3005. detailClose: 'fa-minus',
  3006. fullscreen: 'fa-arrows-alt',
  3007. search: 'fa-search',
  3008. clearSearch: 'fa-trash'
  3009. },
  3010. bi: {
  3011. paginationSwitchDown: 'bi-caret-down-square',
  3012. paginationSwitchUp: 'bi-caret-up-square',
  3013. refresh: 'bi-arrow-clockwise',
  3014. toggleOff: 'bi-toggle-off',
  3015. toggleOn: 'bi-toggle-on',
  3016. columns: 'bi-list-ul',
  3017. detailOpen: 'bi-plus',
  3018. detailClose: 'bi-dash',
  3019. fullscreen: 'bi-arrows-move',
  3020. search: 'bi-search',
  3021. clearSearch: 'bi-trash'
  3022. },
  3023. icon: {
  3024. paginationSwitchDown: 'icon-arrow-up-circle',
  3025. paginationSwitchUp: 'icon-arrow-down-circle',
  3026. refresh: 'icon-refresh-cw',
  3027. toggleOff: 'icon-toggle-right',
  3028. toggleOn: 'icon-toggle-right',
  3029. columns: 'icon-list',
  3030. detailOpen: 'icon-plus',
  3031. detailClose: 'icon-minus',
  3032. fullscreen: 'icon-maximize',
  3033. search: 'icon-search',
  3034. clearSearch: 'icon-trash-2'
  3035. },
  3036. 'material-icons': {
  3037. paginationSwitchDown: 'grid_on',
  3038. paginationSwitchUp: 'grid_off',
  3039. refresh: 'refresh',
  3040. toggleOff: 'tablet',
  3041. toggleOn: 'tablet_android',
  3042. columns: 'view_list',
  3043. detailOpen: 'add',
  3044. detailClose: 'remove',
  3045. fullscreen: 'fullscreen',
  3046. sort: 'sort',
  3047. search: 'search',
  3048. clearSearch: 'delete'
  3049. }
  3050. }[prefix];
  3051. },
  3052. getSearchInput: function getSearchInput(that) {
  3053. if (typeof that.options.searchSelector === 'string') {
  3054. return $__default["default"](that.options.searchSelector);
  3055. }
  3056. return that.$toolbar.find('.search input');
  3057. },
  3058. // it only does '%s', and return '' when arguments are undefined
  3059. sprintf: function sprintf(_str) {
  3060. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3061. args[_key - 1] = arguments[_key];
  3062. }
  3063. var flag = true;
  3064. var i = 0;
  3065. var str = _str.replace(/%s/g, function () {
  3066. var arg = args[i++];
  3067. if (typeof arg === 'undefined') {
  3068. flag = false;
  3069. return '';
  3070. }
  3071. return arg;
  3072. });
  3073. return flag ? str : '';
  3074. },
  3075. isObject: function isObject(val) {
  3076. return val instanceof Object && !Array.isArray(val);
  3077. },
  3078. isEmptyObject: function isEmptyObject() {
  3079. var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  3080. return Object.entries(obj).length === 0 && obj.constructor === Object;
  3081. },
  3082. isNumeric: function isNumeric(n) {
  3083. return !isNaN(parseFloat(n)) && isFinite(n);
  3084. },
  3085. getFieldTitle: function getFieldTitle(list, value) {
  3086. var _iterator = _createForOfIteratorHelper(list),
  3087. _step;
  3088. try {
  3089. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  3090. var item = _step.value;
  3091. if (item.field === value) {
  3092. return item.title;
  3093. }
  3094. }
  3095. } catch (err) {
  3096. _iterator.e(err);
  3097. } finally {
  3098. _iterator.f();
  3099. }
  3100. return '';
  3101. },
  3102. setFieldIndex: function setFieldIndex(columns) {
  3103. var totalCol = 0;
  3104. var flag = [];
  3105. var _iterator2 = _createForOfIteratorHelper(columns[0]),
  3106. _step2;
  3107. try {
  3108. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  3109. var column = _step2.value;
  3110. totalCol += column.colspan || 1;
  3111. }
  3112. } catch (err) {
  3113. _iterator2.e(err);
  3114. } finally {
  3115. _iterator2.f();
  3116. }
  3117. for (var i = 0; i < columns.length; i++) {
  3118. flag[i] = [];
  3119. for (var j = 0; j < totalCol; j++) {
  3120. flag[i][j] = false;
  3121. }
  3122. }
  3123. for (var _i = 0; _i < columns.length; _i++) {
  3124. var _iterator3 = _createForOfIteratorHelper(columns[_i]),
  3125. _step3;
  3126. try {
  3127. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  3128. var r = _step3.value;
  3129. var rowspan = r.rowspan || 1;
  3130. var colspan = r.colspan || 1;
  3131. var index = flag[_i].indexOf(false);
  3132. r.colspanIndex = index;
  3133. if (colspan === 1) {
  3134. r.fieldIndex = index; // when field is undefined, use index instead
  3135. if (typeof r.field === 'undefined') {
  3136. r.field = index;
  3137. }
  3138. } else {
  3139. r.colspanGroup = r.colspan;
  3140. }
  3141. for (var _j = 0; _j < rowspan; _j++) {
  3142. for (var k = 0; k < colspan; k++) {
  3143. flag[_i + _j][index + k] = true;
  3144. }
  3145. }
  3146. }
  3147. } catch (err) {
  3148. _iterator3.e(err);
  3149. } finally {
  3150. _iterator3.f();
  3151. }
  3152. }
  3153. },
  3154. normalizeAccent: function normalizeAccent(value) {
  3155. if (typeof value !== 'string') {
  3156. return value;
  3157. }
  3158. return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
  3159. },
  3160. updateFieldGroup: function updateFieldGroup(columns, fieldColumns) {
  3161. var _ref;
  3162. var allColumns = (_ref = []).concat.apply(_ref, _toConsumableArray(columns));
  3163. var _iterator4 = _createForOfIteratorHelper(columns),
  3164. _step4;
  3165. try {
  3166. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  3167. var c = _step4.value;
  3168. var _iterator6 = _createForOfIteratorHelper(c),
  3169. _step6;
  3170. try {
  3171. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  3172. var r = _step6.value;
  3173. if (r.colspanGroup > 1) {
  3174. var colspan = 0;
  3175. var _loop = function _loop(i) {
  3176. var column = allColumns.find(function (col) {
  3177. return col.fieldIndex === i;
  3178. });
  3179. if (column.visible) {
  3180. colspan++;
  3181. }
  3182. };
  3183. for (var i = r.colspanIndex; i < r.colspanIndex + r.colspanGroup; i++) {
  3184. _loop(i);
  3185. }
  3186. r.colspan = colspan;
  3187. r.visible = colspan > 0;
  3188. }
  3189. }
  3190. } catch (err) {
  3191. _iterator6.e(err);
  3192. } finally {
  3193. _iterator6.f();
  3194. }
  3195. }
  3196. } catch (err) {
  3197. _iterator4.e(err);
  3198. } finally {
  3199. _iterator4.f();
  3200. }
  3201. if (columns.length < 2) {
  3202. return;
  3203. }
  3204. var _iterator5 = _createForOfIteratorHelper(fieldColumns),
  3205. _step5;
  3206. try {
  3207. var _loop2 = function _loop2() {
  3208. var column = _step5.value;
  3209. var sameColumns = allColumns.filter(function (col) {
  3210. return col.fieldIndex === column.fieldIndex;
  3211. });
  3212. if (sameColumns.length > 1) {
  3213. var _iterator7 = _createForOfIteratorHelper(sameColumns),
  3214. _step7;
  3215. try {
  3216. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  3217. var _c = _step7.value;
  3218. _c.visible = column.visible;
  3219. }
  3220. } catch (err) {
  3221. _iterator7.e(err);
  3222. } finally {
  3223. _iterator7.f();
  3224. }
  3225. }
  3226. };
  3227. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  3228. _loop2();
  3229. }
  3230. } catch (err) {
  3231. _iterator5.e(err);
  3232. } finally {
  3233. _iterator5.f();
  3234. }
  3235. },
  3236. getScrollBarWidth: function getScrollBarWidth() {
  3237. if (this.cachedWidth === undefined) {
  3238. var $inner = $__default["default"]('<div/>').addClass('fixed-table-scroll-inner');
  3239. var $outer = $__default["default"]('<div/>').addClass('fixed-table-scroll-outer');
  3240. $outer.append($inner);
  3241. $__default["default"]('body').append($outer);
  3242. var w1 = $inner[0].offsetWidth;
  3243. $outer.css('overflow', 'scroll');
  3244. var w2 = $inner[0].offsetWidth;
  3245. if (w1 === w2) {
  3246. w2 = $outer[0].clientWidth;
  3247. }
  3248. $outer.remove();
  3249. this.cachedWidth = w1 - w2;
  3250. }
  3251. return this.cachedWidth;
  3252. },
  3253. calculateObjectValue: function calculateObjectValue(self, name, args, defaultValue) {
  3254. var func = name;
  3255. if (typeof name === 'string') {
  3256. // support obj.func1.func2
  3257. var names = name.split('.');
  3258. if (names.length > 1) {
  3259. func = window;
  3260. var _iterator8 = _createForOfIteratorHelper(names),
  3261. _step8;
  3262. try {
  3263. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  3264. var f = _step8.value;
  3265. func = func[f];
  3266. }
  3267. } catch (err) {
  3268. _iterator8.e(err);
  3269. } finally {
  3270. _iterator8.f();
  3271. }
  3272. } else {
  3273. func = window[name];
  3274. }
  3275. }
  3276. if (func !== null && _typeof(func) === 'object') {
  3277. return func;
  3278. }
  3279. if (typeof func === 'function') {
  3280. return func.apply(self, args || []);
  3281. }
  3282. if (!func && typeof name === 'string' && args && this.sprintf.apply(this, [name].concat(_toConsumableArray(args)))) {
  3283. return this.sprintf.apply(this, [name].concat(_toConsumableArray(args)));
  3284. }
  3285. return defaultValue;
  3286. },
  3287. compareObjects: function compareObjects(objectA, objectB, compareLength) {
  3288. var aKeys = Object.keys(objectA);
  3289. var bKeys = Object.keys(objectB);
  3290. if (compareLength && aKeys.length !== bKeys.length) {
  3291. return false;
  3292. }
  3293. for (var _i2 = 0, _aKeys = aKeys; _i2 < _aKeys.length; _i2++) {
  3294. var key = _aKeys[_i2];
  3295. if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
  3296. return false;
  3297. }
  3298. }
  3299. return true;
  3300. },
  3301. regexCompare: function regexCompare(value, search) {
  3302. try {
  3303. var regexpParts = search.match(/^\/(.*?)\/([gim]*)$/);
  3304. if (value.toString().search(regexpParts ? new RegExp(regexpParts[1], regexpParts[2]) : new RegExp(search, 'gim')) !== -1) {
  3305. return true;
  3306. }
  3307. } catch (e) {
  3308. return false;
  3309. }
  3310. },
  3311. escapeHTML: function escapeHTML(text) {
  3312. if (!text) {
  3313. return text;
  3314. }
  3315. return text.toString().replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
  3316. },
  3317. unescapeHTML: function unescapeHTML(text) {
  3318. if (typeof text !== 'string' || !text) {
  3319. return text;
  3320. }
  3321. return text.toString().replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, '\'');
  3322. },
  3323. removeHTML: function removeHTML(text) {
  3324. if (!text) {
  3325. return text;
  3326. }
  3327. return text.toString().replace(/(<([^>]+)>)/ig, '').replace(/&[#A-Za-z0-9]+;/gi, '').trim();
  3328. },
  3329. getRealDataAttr: function getRealDataAttr(dataAttr) {
  3330. for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) {
  3331. var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
  3332. attr = _Object$entries$_i[0],
  3333. value = _Object$entries$_i[1];
  3334. var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
  3335. if (auxAttr !== attr) {
  3336. dataAttr[auxAttr] = value;
  3337. delete dataAttr[attr];
  3338. }
  3339. }
  3340. return dataAttr;
  3341. },
  3342. getItemField: function getItemField(item, field, escape) {
  3343. var columnEscape = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
  3344. var value = item; // use column escape if it is defined
  3345. if (typeof columnEscape !== 'undefined') {
  3346. escape = columnEscape;
  3347. }
  3348. if (typeof field !== 'string' || item.hasOwnProperty(field)) {
  3349. return escape ? this.escapeHTML(item[field]) : item[field];
  3350. }
  3351. var props = field.split('.');
  3352. var _iterator9 = _createForOfIteratorHelper(props),
  3353. _step9;
  3354. try {
  3355. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  3356. var p = _step9.value;
  3357. value = value && value[p];
  3358. }
  3359. } catch (err) {
  3360. _iterator9.e(err);
  3361. } finally {
  3362. _iterator9.f();
  3363. }
  3364. return escape ? this.escapeHTML(value) : value;
  3365. },
  3366. isIEBrowser: function isIEBrowser() {
  3367. return navigator.userAgent.includes('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent);
  3368. },
  3369. findIndex: function findIndex(items, item) {
  3370. var _iterator10 = _createForOfIteratorHelper(items),
  3371. _step10;
  3372. try {
  3373. for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
  3374. var it = _step10.value;
  3375. if (JSON.stringify(it) === JSON.stringify(item)) {
  3376. return items.indexOf(it);
  3377. }
  3378. }
  3379. } catch (err) {
  3380. _iterator10.e(err);
  3381. } finally {
  3382. _iterator10.f();
  3383. }
  3384. return -1;
  3385. },
  3386. trToData: function trToData(columns, $els) {
  3387. var _this = this;
  3388. var data = [];
  3389. var m = [];
  3390. $els.each(function (y, el) {
  3391. var $el = $__default["default"](el);
  3392. var row = {}; // save tr's id, class and data-* attributes
  3393. row._id = $el.attr('id');
  3394. row._class = $el.attr('class');
  3395. row._data = _this.getRealDataAttr($el.data());
  3396. row._style = $el.attr('style');
  3397. $el.find('>td,>th').each(function (_x, el) {
  3398. var $el = $__default["default"](el);
  3399. var cspan = +$el.attr('colspan') || 1;
  3400. var rspan = +$el.attr('rowspan') || 1;
  3401. var x = _x; // skip already occupied cells in current row
  3402. for (; m[y] && m[y][x]; x++) {// ignore
  3403. } // mark matrix elements occupied by current cell with true
  3404. for (var tx = x; tx < x + cspan; tx++) {
  3405. for (var ty = y; ty < y + rspan; ty++) {
  3406. if (!m[ty]) {
  3407. // fill missing rows
  3408. m[ty] = [];
  3409. }
  3410. m[ty][tx] = true;
  3411. }
  3412. }
  3413. var field = columns[x].field;
  3414. row[field] = $el.html().trim(); // save td's id, class and data-* attributes
  3415. row["_".concat(field, "_id")] = $el.attr('id');
  3416. row["_".concat(field, "_class")] = $el.attr('class');
  3417. row["_".concat(field, "_rowspan")] = $el.attr('rowspan');
  3418. row["_".concat(field, "_colspan")] = $el.attr('colspan');
  3419. row["_".concat(field, "_title")] = $el.attr('title');
  3420. row["_".concat(field, "_data")] = _this.getRealDataAttr($el.data());
  3421. row["_".concat(field, "_style")] = $el.attr('style');
  3422. });
  3423. data.push(row);
  3424. });
  3425. return data;
  3426. },
  3427. sort: function sort(a, b, order, sortStable, aPosition, bPosition) {
  3428. if (a === undefined || a === null) {
  3429. a = '';
  3430. }
  3431. if (b === undefined || b === null) {
  3432. b = '';
  3433. }
  3434. if (sortStable && a === b) {
  3435. a = aPosition;
  3436. b = bPosition;
  3437. } // If both values are numeric, do a numeric comparison
  3438. if (this.isNumeric(a) && this.isNumeric(b)) {
  3439. // Convert numerical values form string to float.
  3440. a = parseFloat(a);
  3441. b = parseFloat(b);
  3442. if (a < b) {
  3443. return order * -1;
  3444. }
  3445. if (a > b) {
  3446. return order;
  3447. }
  3448. return 0;
  3449. }
  3450. if (a === b) {
  3451. return 0;
  3452. } // If value is not a string, convert to string
  3453. if (typeof a !== 'string') {
  3454. a = a.toString();
  3455. }
  3456. if (a.localeCompare(b) === -1) {
  3457. return order * -1;
  3458. }
  3459. return order;
  3460. },
  3461. getEventName: function getEventName(eventPrefix) {
  3462. var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  3463. id = id || "".concat(+new Date()).concat(~~(Math.random() * 1000000));
  3464. return "".concat(eventPrefix, "-").concat(id);
  3465. },
  3466. hasDetailViewIcon: function hasDetailViewIcon(options) {
  3467. return options.detailView && options.detailViewIcon && !options.cardView;
  3468. },
  3469. getDetailViewIndexOffset: function getDetailViewIndexOffset(options) {
  3470. return this.hasDetailViewIcon(options) && options.detailViewAlign !== 'right' ? 1 : 0;
  3471. },
  3472. checkAutoMergeCells: function checkAutoMergeCells(data) {
  3473. var _iterator11 = _createForOfIteratorHelper(data),
  3474. _step11;
  3475. try {
  3476. for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
  3477. var row = _step11.value;
  3478. for (var _i4 = 0, _Object$keys = Object.keys(row); _i4 < _Object$keys.length; _i4++) {
  3479. var key = _Object$keys[_i4];
  3480. if (key.startsWith('_') && (key.endsWith('_rowspan') || key.endsWith('_colspan'))) {
  3481. return true;
  3482. }
  3483. }
  3484. }
  3485. } catch (err) {
  3486. _iterator11.e(err);
  3487. } finally {
  3488. _iterator11.f();
  3489. }
  3490. return false;
  3491. },
  3492. deepCopy: function deepCopy(arg) {
  3493. if (arg === undefined) {
  3494. return arg;
  3495. }
  3496. return $__default["default"].extend(true, Array.isArray(arg) ? [] : {}, arg);
  3497. },
  3498. debounce: function debounce(func, wait, immediate) {
  3499. var timeout;
  3500. return function executedFunction() {
  3501. var context = this;
  3502. var args = arguments;
  3503. var later = function later() {
  3504. timeout = null;
  3505. if (!immediate) func.apply(context, args);
  3506. };
  3507. var callNow = immediate && !timeout;
  3508. clearTimeout(timeout);
  3509. timeout = setTimeout(later, wait);
  3510. if (callNow) func.apply(context, args);
  3511. };
  3512. }
  3513. };
  3514. var VERSION = '1.20.1';
  3515. var bootstrapVersion = Utils.getBootstrapVersion();
  3516. var CONSTANTS = {
  3517. 3: {
  3518. classes: {
  3519. buttonsPrefix: 'btn',
  3520. buttons: 'default',
  3521. buttonsGroup: 'btn-group',
  3522. buttonsDropdown: 'btn-group',
  3523. pull: 'pull',
  3524. inputGroup: 'input-group',
  3525. inputPrefix: 'input-',
  3526. input: 'form-control',
  3527. select: 'form-control',
  3528. paginationDropdown: 'btn-group dropdown',
  3529. dropup: 'dropup',
  3530. dropdownActive: 'active',
  3531. paginationActive: 'active',
  3532. buttonActive: 'active'
  3533. },
  3534. html: {
  3535. toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
  3536. toolbarDropdownItem: '<li class="dropdown-item-marker" role="menuitem"><label>%s</label></li>',
  3537. toolbarDropdownSeparator: '<li class="divider"></li>',
  3538. pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
  3539. pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
  3540. dropdownCaret: '<span class="caret"></span>',
  3541. pagination: ['<ul class="pagination%s">', '</ul>'],
  3542. paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
  3543. icon: '<i class="%s %s"></i>',
  3544. inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
  3545. searchInput: '<input class="%s%s" type="text" placeholder="%s">',
  3546. searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
  3547. searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
  3548. }
  3549. },
  3550. 4: {
  3551. classes: {
  3552. buttonsPrefix: 'btn',
  3553. buttons: 'secondary',
  3554. buttonsGroup: 'btn-group',
  3555. buttonsDropdown: 'btn-group',
  3556. pull: 'float',
  3557. inputGroup: 'btn-group',
  3558. inputPrefix: 'form-control-',
  3559. input: 'form-control',
  3560. select: 'form-control',
  3561. paginationDropdown: 'btn-group dropdown',
  3562. dropup: 'dropup',
  3563. dropdownActive: 'active',
  3564. paginationActive: 'active',
  3565. buttonActive: 'active'
  3566. },
  3567. html: {
  3568. toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
  3569. toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
  3570. pageDropdown: ['<div class="dropdown-menu">', '</div>'],
  3571. pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
  3572. toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
  3573. dropdownCaret: '<span class="caret"></span>',
  3574. pagination: ['<ul class="pagination%s">', '</ul>'],
  3575. paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
  3576. icon: '<i class="%s %s"></i>',
  3577. inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
  3578. searchInput: '<input class="%s%s" type="text" placeholder="%s">',
  3579. searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
  3580. searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
  3581. }
  3582. },
  3583. 5: {
  3584. classes: {
  3585. buttonsPrefix: 'btn',
  3586. buttons: 'secondary',
  3587. buttonsGroup: 'btn-group',
  3588. buttonsDropdown: 'btn-group',
  3589. pull: 'float',
  3590. inputGroup: 'btn-group',
  3591. inputPrefix: 'form-control-',
  3592. input: 'form-control',
  3593. select: 'form-select',
  3594. paginationDropdown: 'btn-group dropdown',
  3595. dropup: 'dropup',
  3596. dropdownActive: 'active',
  3597. paginationActive: 'active',
  3598. buttonActive: 'active'
  3599. },
  3600. html: {
  3601. dataToggle: 'data-bs-toggle',
  3602. toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
  3603. toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
  3604. pageDropdown: ['<div class="dropdown-menu">', '</div>'],
  3605. pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
  3606. toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
  3607. dropdownCaret: '<span class="caret"></span>',
  3608. pagination: ['<ul class="pagination%s">', '</ul>'],
  3609. paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
  3610. icon: '<i class="%s %s"></i>',
  3611. inputGroup: '<div class="input-group">%s%s</div>',
  3612. searchInput: '<input class="%s%s" type="text" placeholder="%s">',
  3613. searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
  3614. searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
  3615. }
  3616. }
  3617. }[bootstrapVersion];
  3618. var DEFAULTS = {
  3619. height: undefined,
  3620. classes: 'table table-bordered table-hover',
  3621. buttons: {},
  3622. theadClasses: '',
  3623. headerStyle: function headerStyle(column) {
  3624. return {};
  3625. },
  3626. rowStyle: function rowStyle(row, index) {
  3627. return {};
  3628. },
  3629. rowAttributes: function rowAttributes(row, index) {
  3630. return {};
  3631. },
  3632. undefinedText: '-',
  3633. locale: undefined,
  3634. virtualScroll: false,
  3635. virtualScrollItemHeight: undefined,
  3636. sortable: true,
  3637. sortClass: undefined,
  3638. silentSort: true,
  3639. sortName: undefined,
  3640. sortOrder: undefined,
  3641. sortReset: false,
  3642. sortStable: false,
  3643. rememberOrder: false,
  3644. serverSort: true,
  3645. customSort: undefined,
  3646. columns: [[]],
  3647. data: [],
  3648. url: undefined,
  3649. method: 'get',
  3650. cache: true,
  3651. contentType: 'application/json',
  3652. dataType: 'json',
  3653. ajax: undefined,
  3654. ajaxOptions: {},
  3655. queryParams: function queryParams(params) {
  3656. return params;
  3657. },
  3658. queryParamsType: 'limit',
  3659. // 'limit', undefined
  3660. responseHandler: function responseHandler(res) {
  3661. return res;
  3662. },
  3663. totalField: 'total',
  3664. totalNotFilteredField: 'totalNotFiltered',
  3665. dataField: 'rows',
  3666. footerField: 'footer',
  3667. pagination: false,
  3668. paginationParts: ['pageInfo', 'pageSize', 'pageList'],
  3669. showExtendedPagination: false,
  3670. paginationLoop: true,
  3671. sidePagination: 'client',
  3672. // client or server
  3673. totalRows: 0,
  3674. totalNotFiltered: 0,
  3675. pageNumber: 1,
  3676. pageSize: 10,
  3677. pageList: [10, 25, 50, 100],
  3678. paginationHAlign: 'right',
  3679. // right, left
  3680. paginationVAlign: 'bottom',
  3681. // bottom, top, both
  3682. paginationDetailHAlign: 'left',
  3683. // right, left
  3684. paginationPreText: '&lsaquo;',
  3685. paginationNextText: '&rsaquo;',
  3686. paginationSuccessivelySize: 5,
  3687. // Maximum successively number of pages in a row
  3688. paginationPagesBySide: 1,
  3689. // Number of pages on each side (right, left) of the current page.
  3690. paginationUseIntermediate: false,
  3691. // Calculate intermediate pages for quick access
  3692. search: false,
  3693. searchHighlight: false,
  3694. searchOnEnterKey: false,
  3695. strictSearch: false,
  3696. regexSearch: false,
  3697. searchSelector: false,
  3698. visibleSearch: false,
  3699. showButtonIcons: true,
  3700. showButtonText: false,
  3701. showSearchButton: false,
  3702. showSearchClearButton: false,
  3703. trimOnSearch: true,
  3704. searchAlign: 'right',
  3705. searchTimeOut: 500,
  3706. searchText: '',
  3707. customSearch: undefined,
  3708. showHeader: true,
  3709. showFooter: false,
  3710. footerStyle: function footerStyle(column) {
  3711. return {};
  3712. },
  3713. searchAccentNeutralise: false,
  3714. showColumns: false,
  3715. showColumnsToggleAll: false,
  3716. showColumnsSearch: false,
  3717. minimumCountColumns: 1,
  3718. showPaginationSwitch: false,
  3719. showRefresh: false,
  3720. showToggle: false,
  3721. showFullscreen: false,
  3722. smartDisplay: true,
  3723. escape: false,
  3724. filterOptions: {
  3725. filterAlgorithm: 'and'
  3726. },
  3727. idField: undefined,
  3728. selectItemName: 'btSelectItem',
  3729. clickToSelect: false,
  3730. ignoreClickToSelectOn: function ignoreClickToSelectOn(_ref) {
  3731. var tagName = _ref.tagName;
  3732. return ['A', 'BUTTON'].includes(tagName);
  3733. },
  3734. singleSelect: false,
  3735. checkboxHeader: true,
  3736. maintainMetaData: false,
  3737. multipleSelectRow: false,
  3738. uniqueId: undefined,
  3739. cardView: false,
  3740. detailView: false,
  3741. detailViewIcon: true,
  3742. detailViewByClick: false,
  3743. detailViewAlign: 'left',
  3744. detailFormatter: function detailFormatter(index, row) {
  3745. return '';
  3746. },
  3747. detailFilter: function detailFilter(index, row) {
  3748. return true;
  3749. },
  3750. toolbar: undefined,
  3751. toolbarAlign: 'left',
  3752. buttonsToolbar: undefined,
  3753. buttonsAlign: 'right',
  3754. buttonsOrder: ['paginationSwitch', 'refresh', 'toggle', 'fullscreen', 'columns'],
  3755. buttonsPrefix: CONSTANTS.classes.buttonsPrefix,
  3756. buttonsClass: CONSTANTS.classes.buttons,
  3757. iconsPrefix: undefined,
  3758. // init in initConstants
  3759. icons: {},
  3760. // init in initConstants
  3761. iconSize: undefined,
  3762. loadingFontSize: 'auto',
  3763. loadingTemplate: function loadingTemplate(loadingMessage) {
  3764. return "<span class=\"loading-wrap\">\n <span class=\"loading-text\">".concat(loadingMessage, "</span>\n <span class=\"animation-wrap\"><span class=\"animation-dot\"></span></span>\n </span>\n ");
  3765. },
  3766. onAll: function onAll(name, args) {
  3767. return false;
  3768. },
  3769. onClickCell: function onClickCell(field, value, row, $element) {
  3770. return false;
  3771. },
  3772. onDblClickCell: function onDblClickCell(field, value, row, $element) {
  3773. return false;
  3774. },
  3775. onClickRow: function onClickRow(item, $element) {
  3776. return false;
  3777. },
  3778. onDblClickRow: function onDblClickRow(item, $element) {
  3779. return false;
  3780. },
  3781. onSort: function onSort(name, order) {
  3782. return false;
  3783. },
  3784. onCheck: function onCheck(row) {
  3785. return false;
  3786. },
  3787. onUncheck: function onUncheck(row) {
  3788. return false;
  3789. },
  3790. onCheckAll: function onCheckAll(rows) {
  3791. return false;
  3792. },
  3793. onUncheckAll: function onUncheckAll(rows) {
  3794. return false;
  3795. },
  3796. onCheckSome: function onCheckSome(rows) {
  3797. return false;
  3798. },
  3799. onUncheckSome: function onUncheckSome(rows) {
  3800. return false;
  3801. },
  3802. onLoadSuccess: function onLoadSuccess(data) {
  3803. return false;
  3804. },
  3805. onLoadError: function onLoadError(status) {
  3806. return false;
  3807. },
  3808. onColumnSwitch: function onColumnSwitch(field, checked) {
  3809. return false;
  3810. },
  3811. onColumnSwitchAll: function onColumnSwitchAll(checked) {
  3812. return false;
  3813. },
  3814. onPageChange: function onPageChange(number, size) {
  3815. return false;
  3816. },
  3817. onSearch: function onSearch(text) {
  3818. return false;
  3819. },
  3820. onToggle: function onToggle(cardView) {
  3821. return false;
  3822. },
  3823. onPreBody: function onPreBody(data) {
  3824. return false;
  3825. },
  3826. onPostBody: function onPostBody() {
  3827. return false;
  3828. },
  3829. onPostHeader: function onPostHeader() {
  3830. return false;
  3831. },
  3832. onPostFooter: function onPostFooter() {
  3833. return false;
  3834. },
  3835. onExpandRow: function onExpandRow(index, row, $detail) {
  3836. return false;
  3837. },
  3838. onCollapseRow: function onCollapseRow(index, row) {
  3839. return false;
  3840. },
  3841. onRefreshOptions: function onRefreshOptions(options) {
  3842. return false;
  3843. },
  3844. onRefresh: function onRefresh(params) {
  3845. return false;
  3846. },
  3847. onResetView: function onResetView() {
  3848. return false;
  3849. },
  3850. onScrollBody: function onScrollBody() {
  3851. return false;
  3852. },
  3853. onTogglePagination: function onTogglePagination(newState) {
  3854. return false;
  3855. },
  3856. onVirtualScroll: function onVirtualScroll(startIndex, endIndex) {
  3857. return false;
  3858. }
  3859. };
  3860. var EN = {
  3861. formatLoadingMessage: function formatLoadingMessage() {
  3862. return 'Loading, please wait';
  3863. },
  3864. formatRecordsPerPage: function formatRecordsPerPage(pageNumber) {
  3865. return "".concat(pageNumber, " rows per page");
  3866. },
  3867. formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) {
  3868. if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
  3869. return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows (filtered from ").concat(totalNotFiltered, " total rows)");
  3870. }
  3871. return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows");
  3872. },
  3873. formatSRPaginationPreText: function formatSRPaginationPreText() {
  3874. return 'previous page';
  3875. },
  3876. formatSRPaginationPageText: function formatSRPaginationPageText(page) {
  3877. return "to page ".concat(page);
  3878. },
  3879. formatSRPaginationNextText: function formatSRPaginationNextText() {
  3880. return 'next page';
  3881. },
  3882. formatDetailPagination: function formatDetailPagination(totalRows) {
  3883. return "Showing ".concat(totalRows, " rows");
  3884. },
  3885. formatSearch: function formatSearch() {
  3886. return 'Search';
  3887. },
  3888. formatClearSearch: function formatClearSearch() {
  3889. return 'Clear Search';
  3890. },
  3891. formatNoMatches: function formatNoMatches() {
  3892. return 'No matching records found';
  3893. },
  3894. formatPaginationSwitch: function formatPaginationSwitch() {
  3895. return 'Hide/Show pagination';
  3896. },
  3897. formatPaginationSwitchDown: function formatPaginationSwitchDown() {
  3898. return 'Show pagination';
  3899. },
  3900. formatPaginationSwitchUp: function formatPaginationSwitchUp() {
  3901. return 'Hide pagination';
  3902. },
  3903. formatRefresh: function formatRefresh() {
  3904. return 'Refresh';
  3905. },
  3906. formatToggle: function formatToggle() {
  3907. return 'Toggle';
  3908. },
  3909. formatToggleOn: function formatToggleOn() {
  3910. return 'Show card view';
  3911. },
  3912. formatToggleOff: function formatToggleOff() {
  3913. return 'Hide card view';
  3914. },
  3915. formatColumns: function formatColumns() {
  3916. return 'Columns';
  3917. },
  3918. formatColumnsToggleAll: function formatColumnsToggleAll() {
  3919. return 'Toggle all';
  3920. },
  3921. formatFullscreen: function formatFullscreen() {
  3922. return 'Fullscreen';
  3923. },
  3924. formatAllRows: function formatAllRows() {
  3925. return 'All';
  3926. }
  3927. };
  3928. var COLUMN_DEFAULTS = {
  3929. field: undefined,
  3930. title: undefined,
  3931. titleTooltip: undefined,
  3932. class: undefined,
  3933. width: undefined,
  3934. widthUnit: 'px',
  3935. rowspan: undefined,
  3936. colspan: undefined,
  3937. align: undefined,
  3938. // left, right, center
  3939. halign: undefined,
  3940. // left, right, center
  3941. falign: undefined,
  3942. // left, right, center
  3943. valign: undefined,
  3944. // top, middle, bottom
  3945. cellStyle: undefined,
  3946. radio: false,
  3947. checkbox: false,
  3948. checkboxEnabled: true,
  3949. clickToSelect: true,
  3950. showSelectTitle: false,
  3951. sortable: false,
  3952. sortName: undefined,
  3953. order: 'asc',
  3954. // asc, desc
  3955. sorter: undefined,
  3956. visible: true,
  3957. switchable: true,
  3958. cardVisible: true,
  3959. searchable: true,
  3960. formatter: undefined,
  3961. footerFormatter: undefined,
  3962. detailFormatter: undefined,
  3963. searchFormatter: true,
  3964. searchHighlightFormatter: false,
  3965. escape: undefined,
  3966. events: undefined
  3967. };
  3968. var METHODS = ['getOptions', 'refreshOptions', 'getData', 'getSelections', 'load', 'append', 'prepend', 'remove', 'removeAll', 'insertRow', 'updateRow', 'getRowByUniqueId', 'updateByUniqueId', 'removeByUniqueId', 'updateCell', 'updateCellByUniqueId', 'showRow', 'hideRow', 'getHiddenRows', 'showColumn', 'hideColumn', 'getVisibleColumns', 'getHiddenColumns', 'showAllColumns', 'hideAllColumns', 'mergeCells', 'checkAll', 'uncheckAll', 'checkInvert', 'check', 'uncheck', 'checkBy', 'uncheckBy', 'refresh', 'destroy', 'resetView', 'showLoading', 'hideLoading', 'togglePagination', 'toggleFullscreen', 'toggleView', 'resetSearch', 'filterBy', 'scrollTo', 'getScrollPosition', 'selectPage', 'prevPage', 'nextPage', 'toggleDetailView', 'expandRow', 'collapseRow', 'expandRowByUniqueId', 'collapseRowByUniqueId', 'expandAllRows', 'collapseAllRows', 'updateColumnTitle', 'updateFormatText'];
  3969. var EVENTS = {
  3970. 'all.bs.table': 'onAll',
  3971. 'click-row.bs.table': 'onClickRow',
  3972. 'dbl-click-row.bs.table': 'onDblClickRow',
  3973. 'click-cell.bs.table': 'onClickCell',
  3974. 'dbl-click-cell.bs.table': 'onDblClickCell',
  3975. 'sort.bs.table': 'onSort',
  3976. 'check.bs.table': 'onCheck',
  3977. 'uncheck.bs.table': 'onUncheck',
  3978. 'check-all.bs.table': 'onCheckAll',
  3979. 'uncheck-all.bs.table': 'onUncheckAll',
  3980. 'check-some.bs.table': 'onCheckSome',
  3981. 'uncheck-some.bs.table': 'onUncheckSome',
  3982. 'load-success.bs.table': 'onLoadSuccess',
  3983. 'load-error.bs.table': 'onLoadError',
  3984. 'column-switch.bs.table': 'onColumnSwitch',
  3985. 'column-switch-all.bs.table': 'onColumnSwitchAll',
  3986. 'page-change.bs.table': 'onPageChange',
  3987. 'search.bs.table': 'onSearch',
  3988. 'toggle.bs.table': 'onToggle',
  3989. 'pre-body.bs.table': 'onPreBody',
  3990. 'post-body.bs.table': 'onPostBody',
  3991. 'post-header.bs.table': 'onPostHeader',
  3992. 'post-footer.bs.table': 'onPostFooter',
  3993. 'expand-row.bs.table': 'onExpandRow',
  3994. 'collapse-row.bs.table': 'onCollapseRow',
  3995. 'refresh-options.bs.table': 'onRefreshOptions',
  3996. 'reset-view.bs.table': 'onResetView',
  3997. 'refresh.bs.table': 'onRefresh',
  3998. 'scroll-body.bs.table': 'onScrollBody',
  3999. 'toggle-pagination.bs.table': 'onTogglePagination',
  4000. 'virtual-scroll.bs.table': 'onVirtualScroll'
  4001. };
  4002. Object.assign(DEFAULTS, EN);
  4003. var Constants = {
  4004. VERSION: VERSION,
  4005. THEME: "bootstrap".concat(bootstrapVersion),
  4006. CONSTANTS: CONSTANTS,
  4007. DEFAULTS: DEFAULTS,
  4008. COLUMN_DEFAULTS: COLUMN_DEFAULTS,
  4009. METHODS: METHODS,
  4010. EVENTS: EVENTS,
  4011. LOCALES: {
  4012. en: EN,
  4013. 'en-US': EN
  4014. }
  4015. };
  4016. var BLOCK_ROWS = 50;
  4017. var CLUSTER_BLOCKS = 4;
  4018. var VirtualScroll = /*#__PURE__*/function () {
  4019. function VirtualScroll(options) {
  4020. var _this = this;
  4021. _classCallCheck(this, VirtualScroll);
  4022. this.rows = options.rows;
  4023. this.scrollEl = options.scrollEl;
  4024. this.contentEl = options.contentEl;
  4025. this.callback = options.callback;
  4026. this.itemHeight = options.itemHeight;
  4027. this.cache = {};
  4028. this.scrollTop = this.scrollEl.scrollTop;
  4029. this.initDOM(this.rows, options.fixedScroll);
  4030. this.scrollEl.scrollTop = this.scrollTop;
  4031. this.lastCluster = 0;
  4032. var onScroll = function onScroll() {
  4033. if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) {
  4034. _this.initDOM(_this.rows);
  4035. _this.callback(_this.startIndex, _this.endIndex);
  4036. }
  4037. };
  4038. this.scrollEl.addEventListener('scroll', onScroll, false);
  4039. this.destroy = function () {
  4040. _this.contentEl.innerHtml = '';
  4041. _this.scrollEl.removeEventListener('scroll', onScroll, false);
  4042. };
  4043. }
  4044. _createClass(VirtualScroll, [{
  4045. key: "initDOM",
  4046. value: function initDOM(rows, fixedScroll) {
  4047. if (typeof this.clusterHeight === 'undefined') {
  4048. this.cache.scrollTop = this.scrollEl.scrollTop;
  4049. this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0];
  4050. this.getRowsHeight(rows);
  4051. }
  4052. var data = this.initData(rows, this.getNum(fixedScroll));
  4053. var thisRows = data.rows.join('');
  4054. var dataChanged = this.checkChanges('data', thisRows);
  4055. var topOffsetChanged = this.checkChanges('top', data.topOffset);
  4056. var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset);
  4057. var html = [];
  4058. if (dataChanged && topOffsetChanged) {
  4059. if (data.topOffset) {
  4060. html.push(this.getExtra('top', data.topOffset));
  4061. }
  4062. html.push(thisRows);
  4063. if (data.bottomOffset) {
  4064. html.push(this.getExtra('bottom', data.bottomOffset));
  4065. }
  4066. this.startIndex = data.start;
  4067. this.endIndex = data.end;
  4068. this.contentEl.innerHTML = html.join('');
  4069. if (fixedScroll) {
  4070. this.contentEl.scrollTop = this.cache.scrollTop;
  4071. }
  4072. } else if (bottomOffsetChanged) {
  4073. this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px");
  4074. }
  4075. }
  4076. }, {
  4077. key: "getRowsHeight",
  4078. value: function getRowsHeight() {
  4079. if (typeof this.itemHeight === 'undefined') {
  4080. var nodes = this.contentEl.children;
  4081. var node = nodes[Math.floor(nodes.length / 2)];
  4082. this.itemHeight = node.offsetHeight;
  4083. }
  4084. this.blockHeight = this.itemHeight * BLOCK_ROWS;
  4085. this.clusterRows = BLOCK_ROWS * CLUSTER_BLOCKS;
  4086. this.clusterHeight = this.blockHeight * CLUSTER_BLOCKS;
  4087. }
  4088. }, {
  4089. key: "getNum",
  4090. value: function getNum(fixedScroll) {
  4091. this.scrollTop = fixedScroll ? this.cache.scrollTop : this.scrollEl.scrollTop;
  4092. return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0;
  4093. }
  4094. }, {
  4095. key: "initData",
  4096. value: function initData(rows, num) {
  4097. if (rows.length < BLOCK_ROWS) {
  4098. return {
  4099. topOffset: 0,
  4100. bottomOffset: 0,
  4101. rowsAbove: 0,
  4102. rows: rows
  4103. };
  4104. }
  4105. var start = Math.max((this.clusterRows - BLOCK_ROWS) * num, 0);
  4106. var end = start + this.clusterRows;
  4107. var topOffset = Math.max(start * this.itemHeight, 0);
  4108. var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0);
  4109. var thisRows = [];
  4110. var rowsAbove = start;
  4111. if (topOffset < 1) {
  4112. rowsAbove++;
  4113. }
  4114. for (var i = start; i < end; i++) {
  4115. rows[i] && thisRows.push(rows[i]);
  4116. }
  4117. return {
  4118. start: start,
  4119. end: end,
  4120. topOffset: topOffset,
  4121. bottomOffset: bottomOffset,
  4122. rowsAbove: rowsAbove,
  4123. rows: thisRows
  4124. };
  4125. }
  4126. }, {
  4127. key: "checkChanges",
  4128. value: function checkChanges(type, value) {
  4129. var changed = value !== this.cache[type];
  4130. this.cache[type] = value;
  4131. return changed;
  4132. }
  4133. }, {
  4134. key: "getExtra",
  4135. value: function getExtra(className, height) {
  4136. var tag = document.createElement('tr');
  4137. tag.className = "virtual-scroll-".concat(className);
  4138. if (height) {
  4139. tag.style.height = "".concat(height, "px");
  4140. }
  4141. return tag.outerHTML;
  4142. }
  4143. }]);
  4144. return VirtualScroll;
  4145. }();
  4146. var BootstrapTable = /*#__PURE__*/function () {
  4147. function BootstrapTable(el, options) {
  4148. _classCallCheck(this, BootstrapTable);
  4149. this.options = options;
  4150. this.$el = $__default["default"](el);
  4151. this.$el_ = this.$el.clone();
  4152. this.timeoutId_ = 0;
  4153. this.timeoutFooter_ = 0;
  4154. }
  4155. _createClass(BootstrapTable, [{
  4156. key: "init",
  4157. value: function init() {
  4158. this.initConstants();
  4159. this.initLocale();
  4160. this.initContainer();
  4161. this.initTable();
  4162. this.initHeader();
  4163. this.initData();
  4164. this.initHiddenRows();
  4165. this.initToolbar();
  4166. this.initPagination();
  4167. this.initBody();
  4168. this.initSearchText();
  4169. this.initServer();
  4170. }
  4171. }, {
  4172. key: "initConstants",
  4173. value: function initConstants() {
  4174. var opts = this.options;
  4175. this.constants = Constants.CONSTANTS;
  4176. this.constants.theme = $__default["default"].fn.bootstrapTable.theme;
  4177. this.constants.dataToggle = this.constants.html.dataToggle || 'data-toggle'; // init iconsPrefix and icons
  4178. var iconsPrefix = Utils.getIconsPrefix($__default["default"].fn.bootstrapTable.theme);
  4179. var icons = Utils.getIcons(iconsPrefix);
  4180. if (typeof opts.icons === 'string') {
  4181. opts.icons = Utils.calculateObjectValue(null, opts.icons);
  4182. }
  4183. opts.iconsPrefix = opts.iconsPrefix || $__default["default"].fn.bootstrapTable.defaults.iconsPrefix || iconsPrefix;
  4184. opts.icons = Object.assign(icons, $__default["default"].fn.bootstrapTable.defaults.icons, opts.icons); // init buttons class
  4185. var buttonsPrefix = opts.buttonsPrefix ? "".concat(opts.buttonsPrefix, "-") : '';
  4186. this.constants.buttonsClass = [opts.buttonsPrefix, buttonsPrefix + opts.buttonsClass, Utils.sprintf("".concat(buttonsPrefix, "%s"), opts.iconSize)].join(' ').trim();
  4187. this.buttons = Utils.calculateObjectValue(this, opts.buttons, [], {});
  4188. if (_typeof(this.buttons) !== 'object') {
  4189. this.buttons = {};
  4190. }
  4191. }
  4192. }, {
  4193. key: "initLocale",
  4194. value: function initLocale() {
  4195. if (this.options.locale) {
  4196. var locales = $__default["default"].fn.bootstrapTable.locales;
  4197. var parts = this.options.locale.split(/-|_/);
  4198. parts[0] = parts[0].toLowerCase();
  4199. if (parts[1]) {
  4200. parts[1] = parts[1].toUpperCase();
  4201. }
  4202. var localesToExtend = {};
  4203. if (locales[this.options.locale]) {
  4204. localesToExtend = locales[this.options.locale];
  4205. } else if (locales[parts.join('-')]) {
  4206. localesToExtend = locales[parts.join('-')];
  4207. } else if (locales[parts[0]]) {
  4208. localesToExtend = locales[parts[0]];
  4209. }
  4210. for (var _i = 0, _Object$entries = Object.entries(localesToExtend); _i < _Object$entries.length; _i++) {
  4211. var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
  4212. formatName = _Object$entries$_i[0],
  4213. func = _Object$entries$_i[1];
  4214. if (this.options[formatName] !== BootstrapTable.DEFAULTS[formatName]) {
  4215. continue;
  4216. }
  4217. this.options[formatName] = func;
  4218. }
  4219. }
  4220. }
  4221. }, {
  4222. key: "initContainer",
  4223. value: function initContainer() {
  4224. var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination clearfix"></div>' : '';
  4225. var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination"></div>' : '';
  4226. var loadingTemplate = Utils.calculateObjectValue(this.options, this.options.loadingTemplate, [this.options.formatLoadingMessage()]);
  4227. this.$container = $__default["default"]("\n <div class=\"bootstrap-table ".concat(this.constants.theme, "\">\n <div class=\"fixed-table-toolbar\"></div>\n ").concat(topPagination, "\n <div class=\"fixed-table-container\">\n <div class=\"fixed-table-header\"><table></table></div>\n <div class=\"fixed-table-body\">\n <div class=\"fixed-table-loading\">\n ").concat(loadingTemplate, "\n </div>\n </div>\n <div class=\"fixed-table-footer\"></div>\n </div>\n ").concat(bottomPagination, "\n </div>\n "));
  4228. this.$container.insertAfter(this.$el);
  4229. this.$tableContainer = this.$container.find('.fixed-table-container');
  4230. this.$tableHeader = this.$container.find('.fixed-table-header');
  4231. this.$tableBody = this.$container.find('.fixed-table-body');
  4232. this.$tableLoading = this.$container.find('.fixed-table-loading');
  4233. this.$tableFooter = this.$el.find('tfoot'); // checking if custom table-toolbar exists or not
  4234. if (this.options.buttonsToolbar) {
  4235. this.$toolbar = $__default["default"]('body').find(this.options.buttonsToolbar);
  4236. } else {
  4237. this.$toolbar = this.$container.find('.fixed-table-toolbar');
  4238. }
  4239. this.$pagination = this.$container.find('.fixed-table-pagination');
  4240. this.$tableBody.append(this.$el);
  4241. this.$container.after('<div class="clearfix"></div>');
  4242. this.$el.addClass(this.options.classes);
  4243. this.$tableLoading.addClass(this.options.classes);
  4244. if (this.options.height) {
  4245. this.$tableContainer.addClass('fixed-height');
  4246. if (this.options.showFooter) {
  4247. this.$tableContainer.addClass('has-footer');
  4248. }
  4249. if (this.options.classes.split(' ').includes('table-bordered')) {
  4250. this.$tableBody.append('<div class="fixed-table-border"></div>');
  4251. this.$tableBorder = this.$tableBody.find('.fixed-table-border');
  4252. this.$tableLoading.addClass('fixed-table-border');
  4253. }
  4254. this.$tableFooter = this.$container.find('.fixed-table-footer');
  4255. }
  4256. }
  4257. }, {
  4258. key: "initTable",
  4259. value: function initTable() {
  4260. var _this = this;
  4261. var columns = [];
  4262. this.$header = this.$el.find('>thead');
  4263. if (!this.$header.length) {
  4264. this.$header = $__default["default"]("<thead class=\"".concat(this.options.theadClasses, "\"></thead>")).appendTo(this.$el);
  4265. } else if (this.options.theadClasses) {
  4266. this.$header.addClass(this.options.theadClasses);
  4267. }
  4268. this._headerTrClasses = [];
  4269. this._headerTrStyles = [];
  4270. this.$header.find('tr').each(function (i, el) {
  4271. var $tr = $__default["default"](el);
  4272. var column = [];
  4273. $tr.find('th').each(function (i, el) {
  4274. var $th = $__default["default"](el); // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not
  4275. if (typeof $th.data('field') !== 'undefined') {
  4276. $th.data('field', "".concat($th.data('field')));
  4277. }
  4278. column.push($__default["default"].extend({}, {
  4279. title: $th.html(),
  4280. class: $th.attr('class'),
  4281. titleTooltip: $th.attr('title'),
  4282. rowspan: $th.attr('rowspan') ? +$th.attr('rowspan') : undefined,
  4283. colspan: $th.attr('colspan') ? +$th.attr('colspan') : undefined
  4284. }, $th.data()));
  4285. });
  4286. columns.push(column);
  4287. if ($tr.attr('class')) {
  4288. _this._headerTrClasses.push($tr.attr('class'));
  4289. }
  4290. if ($tr.attr('style')) {
  4291. _this._headerTrStyles.push($tr.attr('style'));
  4292. }
  4293. });
  4294. if (!Array.isArray(this.options.columns[0])) {
  4295. this.options.columns = [this.options.columns];
  4296. }
  4297. this.options.columns = $__default["default"].extend(true, [], columns, this.options.columns);
  4298. this.columns = [];
  4299. this.fieldsColumnsIndex = [];
  4300. Utils.setFieldIndex(this.options.columns);
  4301. this.options.columns.forEach(function (columns, i) {
  4302. columns.forEach(function (_column, j) {
  4303. var column = $__default["default"].extend({}, BootstrapTable.COLUMN_DEFAULTS, _column);
  4304. if (typeof column.fieldIndex !== 'undefined') {
  4305. _this.columns[column.fieldIndex] = column;
  4306. _this.fieldsColumnsIndex[column.field] = column.fieldIndex;
  4307. }
  4308. _this.options.columns[i][j] = column;
  4309. });
  4310. }); // if options.data is setting, do not process tbody and tfoot data
  4311. if (!this.options.data.length) {
  4312. var htmlData = Utils.trToData(this.columns, this.$el.find('>tbody>tr'));
  4313. if (htmlData.length) {
  4314. this.options.data = htmlData;
  4315. this.fromHtml = true;
  4316. }
  4317. }
  4318. if (!(this.options.pagination && this.options.sidePagination !== 'server')) {
  4319. this.footerData = Utils.trToData(this.columns, this.$el.find('>tfoot>tr'));
  4320. }
  4321. if (this.footerData) {
  4322. this.$el.find('tfoot').html('<tr></tr>');
  4323. }
  4324. if (!this.options.showFooter || this.options.cardView) {
  4325. this.$tableFooter.hide();
  4326. } else {
  4327. this.$tableFooter.show();
  4328. }
  4329. }
  4330. }, {
  4331. key: "initHeader",
  4332. value: function initHeader() {
  4333. var _this2 = this;
  4334. var visibleColumns = {};
  4335. var headerHtml = [];
  4336. this.header = {
  4337. fields: [],
  4338. styles: [],
  4339. classes: [],
  4340. formatters: [],
  4341. detailFormatters: [],
  4342. events: [],
  4343. sorters: [],
  4344. sortNames: [],
  4345. cellStyles: [],
  4346. searchables: []
  4347. };
  4348. Utils.updateFieldGroup(this.options.columns, this.columns);
  4349. this.options.columns.forEach(function (columns, i) {
  4350. var html = [];
  4351. html.push("<tr".concat(Utils.sprintf(' class="%s"', _this2._headerTrClasses[i]), " ").concat(Utils.sprintf(' style="%s"', _this2._headerTrStyles[i]), ">"));
  4352. var detailViewTemplate = '';
  4353. if (i === 0 && Utils.hasDetailViewIcon(_this2.options)) {
  4354. var rowspan = _this2.options.columns.length > 1 ? " rowspan=\"".concat(_this2.options.columns.length, "\"") : '';
  4355. detailViewTemplate = "<th class=\"detail\"".concat(rowspan, ">\n <div class=\"fht-cell\"></div>\n </th>");
  4356. }
  4357. if (detailViewTemplate && _this2.options.detailViewAlign !== 'right') {
  4358. html.push(detailViewTemplate);
  4359. }
  4360. columns.forEach(function (column, j) {
  4361. var class_ = Utils.sprintf(' class="%s"', column['class']);
  4362. var unitWidth = column.widthUnit;
  4363. var width = parseFloat(column.width);
  4364. var halign = Utils.sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
  4365. var align = Utils.sprintf('text-align: %s; ', column.align);
  4366. var style = Utils.sprintf('vertical-align: %s; ', column.valign);
  4367. style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? !column.showSelectTitle ? '36px' : undefined : width ? width + unitWidth : undefined);
  4368. if (typeof column.fieldIndex === 'undefined' && !column.visible) {
  4369. return;
  4370. }
  4371. var headerStyle = Utils.calculateObjectValue(null, _this2.options.headerStyle, [column]);
  4372. var csses = [];
  4373. var classes = '';
  4374. if (headerStyle && headerStyle.css) {
  4375. for (var _i2 = 0, _Object$entries2 = Object.entries(headerStyle.css); _i2 < _Object$entries2.length; _i2++) {
  4376. var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
  4377. key = _Object$entries2$_i[0],
  4378. value = _Object$entries2$_i[1];
  4379. csses.push("".concat(key, ": ").concat(value));
  4380. }
  4381. }
  4382. if (headerStyle && headerStyle.classes) {
  4383. classes = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], headerStyle.classes].join(' ') : headerStyle.classes);
  4384. }
  4385. if (typeof column.fieldIndex !== 'undefined') {
  4386. _this2.header.fields[column.fieldIndex] = column.field;
  4387. _this2.header.styles[column.fieldIndex] = align + style;
  4388. _this2.header.classes[column.fieldIndex] = class_;
  4389. _this2.header.formatters[column.fieldIndex] = column.formatter;
  4390. _this2.header.detailFormatters[column.fieldIndex] = column.detailFormatter;
  4391. _this2.header.events[column.fieldIndex] = column.events;
  4392. _this2.header.sorters[column.fieldIndex] = column.sorter;
  4393. _this2.header.sortNames[column.fieldIndex] = column.sortName;
  4394. _this2.header.cellStyles[column.fieldIndex] = column.cellStyle;
  4395. _this2.header.searchables[column.fieldIndex] = column.searchable;
  4396. if (!column.visible) {
  4397. return;
  4398. }
  4399. if (_this2.options.cardView && !column.cardVisible) {
  4400. return;
  4401. }
  4402. visibleColumns[column.field] = column;
  4403. }
  4404. html.push("<th".concat(Utils.sprintf(' title="%s"', column.titleTooltip)), column.checkbox || column.radio ? Utils.sprintf(' class="bs-checkbox %s"', column['class'] || '') : classes || class_, Utils.sprintf(' style="%s"', halign + style + csses.join('; ')), Utils.sprintf(' rowspan="%s"', column.rowspan), Utils.sprintf(' colspan="%s"', column.colspan), Utils.sprintf(' data-field="%s"', column.field), // If `column` is not the first element of `this.options.columns[0]`, then className 'data-not-first-th' should be added.
  4405. j === 0 && i > 0 ? ' data-not-first-th' : '', '>');
  4406. html.push(Utils.sprintf('<div class="th-inner %s">', _this2.options.sortable && column.sortable ? 'sortable both' : ''));
  4407. var text = _this2.options.escape ? Utils.escapeHTML(column.title) : column.title;
  4408. var title = text;
  4409. if (column.checkbox) {
  4410. text = '';
  4411. if (!_this2.options.singleSelect && _this2.options.checkboxHeader) {
  4412. text = '<label><input name="btSelectAll" type="checkbox" /><span></span></label>';
  4413. }
  4414. _this2.header.stateField = column.field;
  4415. }
  4416. if (column.radio) {
  4417. text = '';
  4418. _this2.header.stateField = column.field;
  4419. }
  4420. if (!text && column.showSelectTitle) {
  4421. text += title;
  4422. }
  4423. html.push(text);
  4424. html.push('</div>');
  4425. html.push('<div class="fht-cell"></div>');
  4426. html.push('</div>');
  4427. html.push('</th>');
  4428. });
  4429. if (detailViewTemplate && _this2.options.detailViewAlign === 'right') {
  4430. html.push(detailViewTemplate);
  4431. }
  4432. html.push('</tr>');
  4433. if (html.length > 3) {
  4434. headerHtml.push(html.join(''));
  4435. }
  4436. });
  4437. this.$header.html(headerHtml.join(''));
  4438. this.$header.find('th[data-field]').each(function (i, el) {
  4439. $__default["default"](el).data(visibleColumns[$__default["default"](el).data('field')]);
  4440. });
  4441. this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) {
  4442. var $this = $__default["default"](e.currentTarget);
  4443. if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) {
  4444. if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) {
  4445. return false;
  4446. }
  4447. }
  4448. if (_this2.options.sortable && $this.parent().data().sortable) {
  4449. _this2.onSort(e);
  4450. }
  4451. });
  4452. var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id'));
  4453. $__default["default"](window).off(resizeEvent);
  4454. if (!this.options.showHeader || this.options.cardView) {
  4455. this.$header.hide();
  4456. this.$tableHeader.hide();
  4457. this.$tableLoading.css('top', 0);
  4458. } else {
  4459. this.$header.show();
  4460. this.$tableHeader.show();
  4461. this.$tableLoading.css('top', this.$header.outerHeight() + 1); // Assign the correct sortable arrow
  4462. this.getCaret();
  4463. $__default["default"](window).on(resizeEvent, function () {
  4464. return _this2.resetView();
  4465. });
  4466. }
  4467. this.$selectAll = this.$header.find('[name="btSelectAll"]');
  4468. this.$selectAll.off('click').on('click', function (e) {
  4469. e.stopPropagation();
  4470. var checked = $__default["default"](e.currentTarget).prop('checked');
  4471. _this2[checked ? 'checkAll' : 'uncheckAll']();
  4472. _this2.updateSelected();
  4473. });
  4474. }
  4475. }, {
  4476. key: "initData",
  4477. value: function initData(data, type) {
  4478. if (type === 'append') {
  4479. this.options.data = this.options.data.concat(data);
  4480. } else if (type === 'prepend') {
  4481. this.options.data = [].concat(data).concat(this.options.data);
  4482. } else {
  4483. data = data || Utils.deepCopy(this.options.data);
  4484. this.options.data = Array.isArray(data) ? data : data[this.options.dataField];
  4485. }
  4486. this.data = _toConsumableArray(this.options.data);
  4487. if (this.options.sortReset) {
  4488. this.unsortedData = _toConsumableArray(this.data);
  4489. }
  4490. if (this.options.sidePagination === 'server') {
  4491. return;
  4492. }
  4493. this.initSort();
  4494. }
  4495. }, {
  4496. key: "initSort",
  4497. value: function initSort() {
  4498. var _this3 = this;
  4499. var name = this.options.sortName;
  4500. var order = this.options.sortOrder === 'desc' ? -1 : 1;
  4501. var index = this.header.fields.indexOf(this.options.sortName);
  4502. var timeoutId = 0;
  4503. if (index !== -1) {
  4504. if (this.options.sortStable) {
  4505. this.data.forEach(function (row, i) {
  4506. if (!row.hasOwnProperty('_position')) {
  4507. row._position = i;
  4508. }
  4509. });
  4510. }
  4511. if (this.options.customSort) {
  4512. Utils.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]);
  4513. } else {
  4514. this.data.sort(function (a, b) {
  4515. if (_this3.header.sortNames[index]) {
  4516. name = _this3.header.sortNames[index];
  4517. }
  4518. var aa = Utils.getItemField(a, name, _this3.options.escape);
  4519. var bb = Utils.getItemField(b, name, _this3.options.escape);
  4520. var value = Utils.calculateObjectValue(_this3.header, _this3.header.sorters[index], [aa, bb, a, b]);
  4521. if (value !== undefined) {
  4522. if (_this3.options.sortStable && value === 0) {
  4523. return order * (a._position - b._position);
  4524. }
  4525. return order * value;
  4526. }
  4527. return Utils.sort(aa, bb, order, _this3.options.sortStable, a._position, b._position);
  4528. });
  4529. }
  4530. if (this.options.sortClass !== undefined) {
  4531. clearTimeout(timeoutId);
  4532. timeoutId = setTimeout(function () {
  4533. _this3.$el.removeClass(_this3.options.sortClass);
  4534. var index = _this3.$header.find("[data-field=\"".concat(_this3.options.sortName, "\"]")).index();
  4535. _this3.$el.find("tr td:nth-child(".concat(index + 1, ")")).addClass(_this3.options.sortClass);
  4536. }, 250);
  4537. }
  4538. } else if (this.options.sortReset) {
  4539. this.data = _toConsumableArray(this.unsortedData);
  4540. }
  4541. }
  4542. }, {
  4543. key: "onSort",
  4544. value: function onSort(_ref) {
  4545. var type = _ref.type,
  4546. currentTarget = _ref.currentTarget;
  4547. var $this = type === 'keypress' ? $__default["default"](currentTarget) : $__default["default"](currentTarget).parent();
  4548. var $this_ = this.$header.find('th').eq($this.index());
  4549. this.$header.add(this.$header_).find('span.order').remove();
  4550. if (this.options.sortName === $this.data('field')) {
  4551. var currentSortOrder = this.options.sortOrder;
  4552. if (currentSortOrder === undefined) {
  4553. this.options.sortOrder = 'asc';
  4554. } else if (currentSortOrder === 'asc') {
  4555. this.options.sortOrder = 'desc';
  4556. } else if (this.options.sortOrder === 'desc') {
  4557. this.options.sortOrder = this.options.sortReset ? undefined : 'asc';
  4558. }
  4559. if (this.options.sortOrder === undefined) {
  4560. this.options.sortName = undefined;
  4561. }
  4562. } else {
  4563. this.options.sortName = $this.data('field');
  4564. if (this.options.rememberOrder) {
  4565. this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
  4566. } else {
  4567. this.options.sortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order;
  4568. }
  4569. }
  4570. this.trigger('sort', this.options.sortName, this.options.sortOrder);
  4571. $this.add($this_).data('order', this.options.sortOrder); // Assign the correct sortable arrow
  4572. this.getCaret();
  4573. if (this.options.sidePagination === 'server' && this.options.serverSort) {
  4574. this.options.pageNumber = 1;
  4575. this.initServer(this.options.silentSort);
  4576. return;
  4577. }
  4578. this.initSort();
  4579. this.initBody();
  4580. }
  4581. }, {
  4582. key: "initToolbar",
  4583. value: function initToolbar() {
  4584. var _this4 = this;
  4585. var opts = this.options;
  4586. var html = [];
  4587. var timeoutId = 0;
  4588. var $keepOpen;
  4589. var switchableCount = 0;
  4590. if (this.$toolbar.find('.bs-bars').children().length) {
  4591. $__default["default"]('body').append($__default["default"](opts.toolbar));
  4592. }
  4593. this.$toolbar.html('');
  4594. if (typeof opts.toolbar === 'string' || _typeof(opts.toolbar) === 'object') {
  4595. $__default["default"](Utils.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, opts.toolbarAlign)).appendTo(this.$toolbar).append($__default["default"](opts.toolbar));
  4596. } // showColumns, showToggle, showRefresh
  4597. html = ["<div class=\"".concat(['columns', "columns-".concat(opts.buttonsAlign), this.constants.classes.buttonsGroup, "".concat(this.constants.classes.pull, "-").concat(opts.buttonsAlign)].join(' '), "\">")];
  4598. if (typeof opts.buttonsOrder === 'string') {
  4599. opts.buttonsOrder = opts.buttonsOrder.replace(/\[|\]| |'/g, '').split(',');
  4600. }
  4601. this.buttons = Object.assign(this.buttons, {
  4602. paginationSwitch: {
  4603. text: opts.pagination ? opts.formatPaginationSwitchUp() : opts.formatPaginationSwitchDown(),
  4604. icon: opts.pagination ? opts.icons.paginationSwitchDown : opts.icons.paginationSwitchUp,
  4605. render: false,
  4606. event: this.togglePagination,
  4607. attributes: {
  4608. 'aria-label': opts.formatPaginationSwitch(),
  4609. title: opts.formatPaginationSwitch()
  4610. }
  4611. },
  4612. refresh: {
  4613. text: opts.formatRefresh(),
  4614. icon: opts.icons.refresh,
  4615. render: false,
  4616. event: this.refresh,
  4617. attributes: {
  4618. 'aria-label': opts.formatRefresh(),
  4619. title: opts.formatRefresh()
  4620. }
  4621. },
  4622. toggle: {
  4623. text: opts.formatToggle(),
  4624. icon: opts.icons.toggleOff,
  4625. render: false,
  4626. event: this.toggleView,
  4627. attributes: {
  4628. 'aria-label': opts.formatToggleOn(),
  4629. title: opts.formatToggleOn()
  4630. }
  4631. },
  4632. fullscreen: {
  4633. text: opts.formatFullscreen(),
  4634. icon: opts.icons.fullscreen,
  4635. render: false,
  4636. event: this.toggleFullscreen,
  4637. attributes: {
  4638. 'aria-label': opts.formatFullscreen(),
  4639. title: opts.formatFullscreen()
  4640. }
  4641. },
  4642. columns: {
  4643. render: false,
  4644. html: function html() {
  4645. var html = [];
  4646. html.push("<div class=\"keep-open ".concat(_this4.constants.classes.buttonsDropdown, "\" title=\"").concat(opts.formatColumns(), "\">\n <button class=\"").concat(_this4.constants.buttonsClass, " dropdown-toggle\" type=\"button\" ").concat(_this4.constants.dataToggle, "=\"dropdown\"\n aria-label=\"Columns\" title=\"").concat(opts.formatColumns(), "\">\n ").concat(opts.showButtonIcons ? Utils.sprintf(_this4.constants.html.icon, opts.iconsPrefix, opts.icons.columns) : '', "\n ").concat(opts.showButtonText ? opts.formatColumns() : '', "\n ").concat(_this4.constants.html.dropdownCaret, "\n </button>\n ").concat(_this4.constants.html.toolbarDropdown[0]));
  4647. if (opts.showColumnsSearch) {
  4648. html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="text" class="%s" name="columnsSearch" placeholder="%s" autocomplete="off">', _this4.constants.classes.input, opts.formatSearch())));
  4649. html.push(_this4.constants.html.toolbarDropdownSeparator);
  4650. }
  4651. if (opts.showColumnsToggleAll) {
  4652. var allFieldsVisible = _this4.getVisibleColumns().length === _this4.columns.filter(function (column) {
  4653. return !_this4.isSelectionColumn(column);
  4654. }).length;
  4655. html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" class="toggle-all" %s> <span>%s</span>', allFieldsVisible ? 'checked="checked"' : '', opts.formatColumnsToggleAll())));
  4656. html.push(_this4.constants.html.toolbarDropdownSeparator);
  4657. }
  4658. var visibleColumns = 0;
  4659. _this4.columns.forEach(function (column) {
  4660. if (column.visible) {
  4661. visibleColumns++;
  4662. }
  4663. });
  4664. _this4.columns.forEach(function (column, i) {
  4665. if (_this4.isSelectionColumn(column)) {
  4666. return;
  4667. }
  4668. if (opts.cardView && !column.cardVisible) {
  4669. return;
  4670. }
  4671. var checked = column.visible ? ' checked="checked"' : '';
  4672. var disabled = visibleColumns <= opts.minimumCountColumns && checked ? ' disabled="disabled"' : '';
  4673. if (column.switchable) {
  4674. html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" data-field="%s" value="%s"%s%s> <span>%s</span>', column.field, i, checked, disabled, column.title)));
  4675. switchableCount++;
  4676. }
  4677. });
  4678. html.push(_this4.constants.html.toolbarDropdown[1], '</div>');
  4679. return html.join('');
  4680. }
  4681. }
  4682. });
  4683. var buttonsHtml = {};
  4684. for (var _i3 = 0, _Object$entries3 = Object.entries(this.buttons); _i3 < _Object$entries3.length; _i3++) {
  4685. var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
  4686. buttonName = _Object$entries3$_i[0],
  4687. buttonConfig = _Object$entries3$_i[1];
  4688. var buttonHtml = void 0;
  4689. if (buttonConfig.hasOwnProperty('html')) {
  4690. if (typeof buttonConfig.html === 'function') {
  4691. buttonHtml = buttonConfig.html();
  4692. } else if (typeof buttonConfig.html === 'string') {
  4693. buttonHtml = buttonConfig.html;
  4694. }
  4695. } else {
  4696. buttonHtml = "<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"").concat(buttonName, "\"");
  4697. if (buttonConfig.hasOwnProperty('attributes')) {
  4698. for (var _i4 = 0, _Object$entries4 = Object.entries(buttonConfig.attributes); _i4 < _Object$entries4.length; _i4++) {
  4699. var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),
  4700. attributeName = _Object$entries4$_i[0],
  4701. value = _Object$entries4$_i[1];
  4702. buttonHtml += " ".concat(attributeName, "=\"").concat(value, "\"");
  4703. }
  4704. }
  4705. buttonHtml += '>';
  4706. if (opts.showButtonIcons && buttonConfig.hasOwnProperty('icon')) {
  4707. buttonHtml += "".concat(Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, buttonConfig.icon), " ");
  4708. }
  4709. if (opts.showButtonText && buttonConfig.hasOwnProperty('text')) {
  4710. buttonHtml += buttonConfig.text;
  4711. }
  4712. buttonHtml += '</button>';
  4713. }
  4714. buttonsHtml[buttonName] = buttonHtml;
  4715. var optionName = "show".concat(buttonName.charAt(0).toUpperCase()).concat(buttonName.substring(1));
  4716. var showOption = opts[optionName];
  4717. if ((!buttonConfig.hasOwnProperty('render') || buttonConfig.hasOwnProperty('render') && buttonConfig.render) && (showOption === undefined || showOption === true)) {
  4718. opts[optionName] = true;
  4719. }
  4720. if (!opts.buttonsOrder.includes(buttonName)) {
  4721. opts.buttonsOrder.push(buttonName);
  4722. }
  4723. } // Adding the button html to the final toolbar html when the showOption is true
  4724. var _iterator = _createForOfIteratorHelper(opts.buttonsOrder),
  4725. _step;
  4726. try {
  4727. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  4728. var button = _step.value;
  4729. var _showOption = opts["show".concat(button.charAt(0).toUpperCase()).concat(button.substring(1))];
  4730. if (_showOption) {
  4731. html.push(buttonsHtml[button]);
  4732. }
  4733. }
  4734. } catch (err) {
  4735. _iterator.e(err);
  4736. } finally {
  4737. _iterator.f();
  4738. }
  4739. html.push('</div>'); // Fix #188: this.showToolbar is for extensions
  4740. if (this.showToolbar || html.length > 2) {
  4741. this.$toolbar.append(html.join(''));
  4742. }
  4743. for (var _i5 = 0, _Object$entries5 = Object.entries(this.buttons); _i5 < _Object$entries5.length; _i5++) {
  4744. var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2),
  4745. _buttonName = _Object$entries5$_i[0],
  4746. _buttonConfig = _Object$entries5$_i[1];
  4747. if (_buttonConfig.hasOwnProperty('event')) {
  4748. if (typeof _buttonConfig.event === 'function' || typeof _buttonConfig.event === 'string') {
  4749. var _ret = function () {
  4750. var event = typeof _buttonConfig.event === 'string' ? window[_buttonConfig.event] : _buttonConfig.event;
  4751. _this4.$toolbar.find("button[name=\"".concat(_buttonName, "\"]")).off('click').on('click', function () {
  4752. return event.call(_this4);
  4753. });
  4754. return "continue";
  4755. }();
  4756. if (_ret === "continue") continue;
  4757. }
  4758. var _loop = function _loop() {
  4759. var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i6], 2),
  4760. eventType = _Object$entries6$_i[0],
  4761. eventFunction = _Object$entries6$_i[1];
  4762. var event = typeof eventFunction === 'string' ? window[eventFunction] : eventFunction;
  4763. _this4.$toolbar.find("button[name=\"".concat(_buttonName, "\"]")).off(eventType).on(eventType, function () {
  4764. return event.call(_this4);
  4765. });
  4766. };
  4767. for (var _i6 = 0, _Object$entries6 = Object.entries(_buttonConfig.event); _i6 < _Object$entries6.length; _i6++) {
  4768. _loop();
  4769. }
  4770. }
  4771. }
  4772. if (opts.showColumns) {
  4773. $keepOpen = this.$toolbar.find('.keep-open');
  4774. var $checkboxes = $keepOpen.find('input[type="checkbox"]:not(".toggle-all")');
  4775. var $toggleAll = $keepOpen.find('input[type="checkbox"].toggle-all');
  4776. if (switchableCount <= opts.minimumCountColumns) {
  4777. $keepOpen.find('input').prop('disabled', true);
  4778. }
  4779. $keepOpen.find('li, label').off('click').on('click', function (e) {
  4780. e.stopImmediatePropagation();
  4781. });
  4782. $checkboxes.off('click').on('click', function (_ref2) {
  4783. var currentTarget = _ref2.currentTarget;
  4784. var $this = $__default["default"](currentTarget);
  4785. _this4._toggleColumn($this.val(), $this.prop('checked'), false);
  4786. _this4.trigger('column-switch', $this.data('field'), $this.prop('checked'));
  4787. $toggleAll.prop('checked', $checkboxes.filter(':checked').length === _this4.columns.filter(function (column) {
  4788. return !_this4.isSelectionColumn(column);
  4789. }).length);
  4790. });
  4791. $toggleAll.off('click').on('click', function (_ref3) {
  4792. var currentTarget = _ref3.currentTarget;
  4793. _this4._toggleAllColumns($__default["default"](currentTarget).prop('checked'));
  4794. _this4.trigger('column-switch-all', $__default["default"](currentTarget).prop('checked'));
  4795. });
  4796. if (opts.showColumnsSearch) {
  4797. var $columnsSearch = $keepOpen.find('[name="columnsSearch"]');
  4798. var $listItems = $keepOpen.find('.dropdown-item-marker');
  4799. $columnsSearch.on('keyup paste change', function (_ref4) {
  4800. var currentTarget = _ref4.currentTarget;
  4801. var $this = $__default["default"](currentTarget);
  4802. var searchValue = $this.val().toLowerCase();
  4803. $listItems.show();
  4804. $checkboxes.each(function (i, el) {
  4805. var $checkbox = $__default["default"](el);
  4806. var $listItem = $checkbox.parents('.dropdown-item-marker');
  4807. var text = $listItem.text().toLowerCase();
  4808. if (!text.includes(searchValue)) {
  4809. $listItem.hide();
  4810. }
  4811. });
  4812. });
  4813. }
  4814. }
  4815. var handleInputEvent = function handleInputEvent($searchInput) {
  4816. var eventTriggers = 'keyup drop blur mouseup';
  4817. $searchInput.off(eventTriggers).on(eventTriggers, function (event) {
  4818. if (opts.searchOnEnterKey && event.keyCode !== 13) {
  4819. return;
  4820. }
  4821. if ([37, 38, 39, 40].includes(event.keyCode)) {
  4822. return;
  4823. }
  4824. clearTimeout(timeoutId); // doesn't matter if it's 0
  4825. timeoutId = setTimeout(function () {
  4826. _this4.onSearch({
  4827. currentTarget: event.currentTarget
  4828. });
  4829. }, opts.searchTimeOut);
  4830. });
  4831. }; // Fix #4516: this.showSearchClearButton is for extensions
  4832. if ((opts.search || this.showSearchClearButton) && typeof opts.searchSelector !== 'string') {
  4833. html = [];
  4834. var showSearchButton = Utils.sprintf(this.constants.html.searchButton, this.constants.buttonsClass, opts.formatSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.search) : '', opts.showButtonText ? opts.formatSearch() : '');
  4835. var showSearchClearButton = Utils.sprintf(this.constants.html.searchClearButton, this.constants.buttonsClass, opts.formatClearSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.clearSearch) : '', opts.showButtonText ? opts.formatClearSearch() : '');
  4836. var searchInputHtml = "<input class=\"".concat(this.constants.classes.input, "\n ").concat(Utils.sprintf(' %s%s', this.constants.classes.inputPrefix, opts.iconSize), "\n search-input\" type=\"search\" placeholder=\"").concat(opts.formatSearch(), "\" autocomplete=\"off\">");
  4837. var searchInputFinalHtml = searchInputHtml;
  4838. if (opts.showSearchButton || opts.showSearchClearButton) {
  4839. var _buttonsHtml = (opts.showSearchButton ? showSearchButton : '') + (opts.showSearchClearButton ? showSearchClearButton : '');
  4840. searchInputFinalHtml = opts.search ? Utils.sprintf(this.constants.html.inputGroup, searchInputHtml, _buttonsHtml) : _buttonsHtml;
  4841. }
  4842. html.push(Utils.sprintf("\n <div class=\"".concat(this.constants.classes.pull, "-").concat(opts.searchAlign, " search ").concat(this.constants.classes.inputGroup, "\">\n %s\n </div>\n "), searchInputFinalHtml));
  4843. this.$toolbar.append(html.join(''));
  4844. var $searchInput = Utils.getSearchInput(this);
  4845. if (opts.showSearchButton) {
  4846. this.$toolbar.find('.search button[name=search]').off('click').on('click', function () {
  4847. clearTimeout(timeoutId); // doesn't matter if it's 0
  4848. timeoutId = setTimeout(function () {
  4849. _this4.onSearch({
  4850. currentTarget: $searchInput
  4851. });
  4852. }, opts.searchTimeOut);
  4853. });
  4854. if (opts.searchOnEnterKey) {
  4855. handleInputEvent($searchInput);
  4856. }
  4857. } else {
  4858. handleInputEvent($searchInput);
  4859. }
  4860. if (opts.showSearchClearButton) {
  4861. this.$toolbar.find('.search button[name=clearSearch]').click(function () {
  4862. _this4.resetSearch();
  4863. });
  4864. }
  4865. } else if (typeof opts.searchSelector === 'string') {
  4866. var _$searchInput = Utils.getSearchInput(this);
  4867. handleInputEvent(_$searchInput);
  4868. }
  4869. }
  4870. }, {
  4871. key: "onSearch",
  4872. value: function onSearch() {
  4873. var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4874. currentTarget = _ref5.currentTarget,
  4875. firedByInitSearchText = _ref5.firedByInitSearchText;
  4876. var overwriteSearchText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  4877. if (currentTarget !== undefined && $__default["default"](currentTarget).length && overwriteSearchText) {
  4878. var text = $__default["default"](currentTarget).val().trim();
  4879. if (this.options.trimOnSearch && $__default["default"](currentTarget).val() !== text) {
  4880. $__default["default"](currentTarget).val(text);
  4881. }
  4882. if (this.searchText === text) {
  4883. return;
  4884. }
  4885. var $searchInput = Utils.getSearchInput(this);
  4886. var $currentTarget = currentTarget instanceof jQuery ? currentTarget : $__default["default"](currentTarget);
  4887. if ($currentTarget.is($searchInput) || $currentTarget.hasClass('search-input')) {
  4888. this.searchText = text;
  4889. this.options.searchText = text;
  4890. }
  4891. }
  4892. if (!firedByInitSearchText && !this.options.cookie) {
  4893. this.options.pageNumber = 1;
  4894. }
  4895. this.initSearch();
  4896. if (firedByInitSearchText) {
  4897. if (this.options.sidePagination === 'client') {
  4898. this.updatePagination();
  4899. }
  4900. } else {
  4901. this.updatePagination();
  4902. }
  4903. this.trigger('search', this.searchText);
  4904. }
  4905. }, {
  4906. key: "initSearch",
  4907. value: function initSearch() {
  4908. var _this5 = this;
  4909. this.filterOptions = this.filterOptions || this.options.filterOptions;
  4910. if (this.options.sidePagination !== 'server') {
  4911. if (this.options.customSearch) {
  4912. this.data = Utils.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText, this.filterColumns]);
  4913. if (this.options.sortReset) {
  4914. this.unsortedData = _toConsumableArray(this.data);
  4915. }
  4916. return;
  4917. }
  4918. var rawSearchText = this.searchText && (this.fromHtml ? Utils.escapeHTML(this.searchText) : this.searchText);
  4919. var searchText = rawSearchText ? rawSearchText.toLowerCase() : '';
  4920. var f = Utils.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
  4921. if (this.options.searchAccentNeutralise) {
  4922. searchText = Utils.normalizeAccent(searchText);
  4923. } // Check filter
  4924. if (typeof this.filterOptions.filterAlgorithm === 'function') {
  4925. this.data = this.options.data.filter(function (item) {
  4926. return _this5.filterOptions.filterAlgorithm.apply(null, [item, f]);
  4927. });
  4928. } else if (typeof this.filterOptions.filterAlgorithm === 'string') {
  4929. this.data = f ? this.options.data.filter(function (item) {
  4930. var filterAlgorithm = _this5.filterOptions.filterAlgorithm;
  4931. if (filterAlgorithm === 'and') {
  4932. for (var key in f) {
  4933. if (Array.isArray(f[key]) && !f[key].includes(item[key]) || !Array.isArray(f[key]) && item[key] !== f[key]) {
  4934. return false;
  4935. }
  4936. }
  4937. } else if (filterAlgorithm === 'or') {
  4938. var match = false;
  4939. for (var _key in f) {
  4940. if (Array.isArray(f[_key]) && f[_key].includes(item[_key]) || !Array.isArray(f[_key]) && item[_key] === f[_key]) {
  4941. match = true;
  4942. }
  4943. }
  4944. return match;
  4945. }
  4946. return true;
  4947. }) : _toConsumableArray(this.options.data);
  4948. }
  4949. var visibleFields = this.getVisibleFields();
  4950. this.data = searchText ? this.data.filter(function (item, i) {
  4951. for (var j = 0; j < _this5.header.fields.length; j++) {
  4952. if (!_this5.header.searchables[j] || _this5.options.visibleSearch && visibleFields.indexOf(_this5.header.fields[j]) === -1) {
  4953. continue;
  4954. }
  4955. var key = Utils.isNumeric(_this5.header.fields[j]) ? parseInt(_this5.header.fields[j], 10) : _this5.header.fields[j];
  4956. var column = _this5.columns[_this5.fieldsColumnsIndex[key]];
  4957. var value = void 0;
  4958. if (typeof key === 'string') {
  4959. value = item;
  4960. var props = key.split('.');
  4961. for (var _i7 = 0; _i7 < props.length; _i7++) {
  4962. if (value[props[_i7]] !== null) {
  4963. value = value[props[_i7]];
  4964. }
  4965. }
  4966. } else {
  4967. value = item[key];
  4968. }
  4969. if (_this5.options.searchAccentNeutralise) {
  4970. value = Utils.normalizeAccent(value);
  4971. } // Fix #142: respect searchFormatter boolean
  4972. if (column && column.searchFormatter) {
  4973. value = Utils.calculateObjectValue(column, _this5.header.formatters[j], [value, item, i, column.field], value);
  4974. }
  4975. if (typeof value === 'string' || typeof value === 'number') {
  4976. if (_this5.options.strictSearch && "".concat(value).toLowerCase() === searchText || _this5.options.regexSearch && Utils.regexCompare(value, rawSearchText)) {
  4977. return true;
  4978. }
  4979. var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(-?\d+)?|(-?\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
  4980. var matches = largerSmallerEqualsRegex.exec(_this5.searchText);
  4981. var comparisonCheck = false;
  4982. if (matches) {
  4983. var operator = matches[1] || "".concat(matches[5], "l");
  4984. var comparisonValue = matches[2] || matches[3];
  4985. var int = parseInt(value, 10);
  4986. var comparisonInt = parseInt(comparisonValue, 10);
  4987. switch (operator) {
  4988. case '>':
  4989. case '<l':
  4990. comparisonCheck = int > comparisonInt;
  4991. break;
  4992. case '<':
  4993. case '>l':
  4994. comparisonCheck = int < comparisonInt;
  4995. break;
  4996. case '<=':
  4997. case '=<':
  4998. case '>=l':
  4999. case '=>l':
  5000. comparisonCheck = int <= comparisonInt;
  5001. break;
  5002. case '>=':
  5003. case '=>':
  5004. case '<=l':
  5005. case '=<l':
  5006. comparisonCheck = int >= comparisonInt;
  5007. break;
  5008. }
  5009. }
  5010. if (comparisonCheck || "".concat(value).toLowerCase().includes(searchText)) {
  5011. return true;
  5012. }
  5013. }
  5014. }
  5015. return false;
  5016. }) : this.data;
  5017. if (this.options.sortReset) {
  5018. this.unsortedData = _toConsumableArray(this.data);
  5019. }
  5020. this.initSort();
  5021. }
  5022. }
  5023. }, {
  5024. key: "initPagination",
  5025. value: function initPagination() {
  5026. var _this6 = this;
  5027. var opts = this.options;
  5028. if (!opts.pagination) {
  5029. this.$pagination.hide();
  5030. return;
  5031. }
  5032. this.$pagination.show();
  5033. var html = [];
  5034. var allSelected = false;
  5035. var i;
  5036. var from;
  5037. var to;
  5038. var $pageList;
  5039. var $pre;
  5040. var $next;
  5041. var $number;
  5042. var data = this.getData({
  5043. includeHiddenRows: false
  5044. });
  5045. var pageList = opts.pageList;
  5046. if (typeof pageList === 'string') {
  5047. pageList = pageList.replace(/\[|\]| /g, '').toLowerCase().split(',');
  5048. }
  5049. pageList = pageList.map(function (value) {
  5050. if (typeof value === 'string') {
  5051. return value.toLowerCase() === opts.formatAllRows().toLowerCase() || ['all', 'unlimited'].includes(value.toLowerCase()) ? opts.formatAllRows() : +value;
  5052. }
  5053. return value;
  5054. });
  5055. this.paginationParts = opts.paginationParts;
  5056. if (typeof this.paginationParts === 'string') {
  5057. this.paginationParts = this.paginationParts.replace(/\[|\]| |'/g, '').split(',');
  5058. }
  5059. if (opts.sidePagination !== 'server') {
  5060. opts.totalRows = data.length;
  5061. }
  5062. this.totalPages = 0;
  5063. if (opts.totalRows) {
  5064. if (opts.pageSize === opts.formatAllRows()) {
  5065. opts.pageSize = opts.totalRows;
  5066. allSelected = true;
  5067. }
  5068. this.totalPages = ~~((opts.totalRows - 1) / opts.pageSize) + 1;
  5069. opts.totalPages = this.totalPages;
  5070. }
  5071. if (this.totalPages > 0 && opts.pageNumber > this.totalPages) {
  5072. opts.pageNumber = this.totalPages;
  5073. }
  5074. this.pageFrom = (opts.pageNumber - 1) * opts.pageSize + 1;
  5075. this.pageTo = opts.pageNumber * opts.pageSize;
  5076. if (this.pageTo > opts.totalRows) {
  5077. this.pageTo = opts.totalRows;
  5078. }
  5079. if (this.options.pagination && this.options.sidePagination !== 'server') {
  5080. this.options.totalNotFiltered = this.options.data.length;
  5081. }
  5082. if (!this.options.showExtendedPagination) {
  5083. this.options.totalNotFiltered = undefined;
  5084. }
  5085. if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) {
  5086. html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationDetailHAlign, " pagination-detail\">"));
  5087. }
  5088. if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort')) {
  5089. var paginationInfo = this.paginationParts.includes('pageInfoShort') ? opts.formatDetailPagination(opts.totalRows) : opts.formatShowingRows(this.pageFrom, this.pageTo, opts.totalRows, opts.totalNotFiltered);
  5090. html.push("<span class=\"pagination-info\">\n ".concat(paginationInfo, "\n </span>"));
  5091. }
  5092. if (this.paginationParts.includes('pageSize')) {
  5093. html.push('<div class="page-list">');
  5094. var pageNumber = ["<div class=\"".concat(this.constants.classes.paginationDropdown, "\">\n <button class=\"").concat(this.constants.buttonsClass, " dropdown-toggle\" type=\"button\" ").concat(this.constants.dataToggle, "=\"dropdown\">\n <span class=\"page-size\">\n ").concat(allSelected ? opts.formatAllRows() : opts.pageSize, "\n </span>\n ").concat(this.constants.html.dropdownCaret, "\n </button>\n ").concat(this.constants.html.pageDropdown[0])];
  5095. pageList.forEach(function (page, i) {
  5096. if (!opts.smartDisplay || i === 0 || pageList[i - 1] < opts.totalRows || page === opts.formatAllRows()) {
  5097. var active;
  5098. if (allSelected) {
  5099. active = page === opts.formatAllRows() ? _this6.constants.classes.dropdownActive : '';
  5100. } else {
  5101. active = page === opts.pageSize ? _this6.constants.classes.dropdownActive : '';
  5102. }
  5103. pageNumber.push(Utils.sprintf(_this6.constants.html.pageDropdownItem, active, page));
  5104. }
  5105. });
  5106. pageNumber.push("".concat(this.constants.html.pageDropdown[1], "</div>"));
  5107. html.push(opts.formatRecordsPerPage(pageNumber.join('')));
  5108. }
  5109. if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) {
  5110. html.push('</div></div>');
  5111. }
  5112. if (this.paginationParts.includes('pageList')) {
  5113. html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationHAlign, " pagination\">"), Utils.sprintf(this.constants.html.pagination[0], Utils.sprintf(' pagination-%s', opts.iconSize)), Utils.sprintf(this.constants.html.paginationItem, ' page-pre', opts.formatSRPaginationPreText(), opts.paginationPreText));
  5114. if (this.totalPages < opts.paginationSuccessivelySize) {
  5115. from = 1;
  5116. to = this.totalPages;
  5117. } else {
  5118. from = opts.pageNumber - opts.paginationPagesBySide;
  5119. to = from + opts.paginationPagesBySide * 2;
  5120. }
  5121. if (opts.pageNumber < opts.paginationSuccessivelySize - 1) {
  5122. to = opts.paginationSuccessivelySize;
  5123. }
  5124. if (opts.paginationSuccessivelySize > this.totalPages - from) {
  5125. from = from - (opts.paginationSuccessivelySize - (this.totalPages - from)) + 1;
  5126. }
  5127. if (from < 1) {
  5128. from = 1;
  5129. }
  5130. if (to > this.totalPages) {
  5131. to = this.totalPages;
  5132. }
  5133. var middleSize = Math.round(opts.paginationPagesBySide / 2);
  5134. var pageItem = function pageItem(i) {
  5135. var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  5136. return Utils.sprintf(_this6.constants.html.paginationItem, classes + (i === opts.pageNumber ? " ".concat(_this6.constants.classes.paginationActive) : ''), opts.formatSRPaginationPageText(i), i);
  5137. };
  5138. if (from > 1) {
  5139. var max = opts.paginationPagesBySide;
  5140. if (max >= from) max = from - 1;
  5141. for (i = 1; i <= max; i++) {
  5142. html.push(pageItem(i));
  5143. }
  5144. if (from - 1 === max + 1) {
  5145. i = from - 1;
  5146. html.push(pageItem(i));
  5147. } else if (from - 1 > max) {
  5148. if (from - opts.paginationPagesBySide * 2 > opts.paginationPagesBySide && opts.paginationUseIntermediate) {
  5149. i = Math.round((from - middleSize) / 2 + middleSize);
  5150. html.push(pageItem(i, ' page-intermediate'));
  5151. } else {
  5152. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '', '...'));
  5153. }
  5154. }
  5155. }
  5156. for (i = from; i <= to; i++) {
  5157. html.push(pageItem(i));
  5158. }
  5159. if (this.totalPages > to) {
  5160. var min = this.totalPages - (opts.paginationPagesBySide - 1);
  5161. if (to >= min) min = to + 1;
  5162. if (to + 1 === min - 1) {
  5163. i = to + 1;
  5164. html.push(pageItem(i));
  5165. } else if (min > to + 1) {
  5166. if (this.totalPages - to > opts.paginationPagesBySide * 2 && opts.paginationUseIntermediate) {
  5167. i = Math.round((this.totalPages - middleSize - to) / 2 + to);
  5168. html.push(pageItem(i, ' page-intermediate'));
  5169. } else {
  5170. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '', '...'));
  5171. }
  5172. }
  5173. for (i = min; i <= this.totalPages; i++) {
  5174. html.push(pageItem(i));
  5175. }
  5176. }
  5177. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-next', opts.formatSRPaginationNextText(), opts.paginationNextText));
  5178. html.push(this.constants.html.pagination[1], '</div>');
  5179. }
  5180. this.$pagination.html(html.join(''));
  5181. var dropupClass = ['bottom', 'both'].includes(opts.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : '';
  5182. this.$pagination.last().find('.page-list > div').addClass(dropupClass);
  5183. if (!opts.onlyInfoPagination) {
  5184. $pageList = this.$pagination.find('.page-list a');
  5185. $pre = this.$pagination.find('.page-pre');
  5186. $next = this.$pagination.find('.page-next');
  5187. $number = this.$pagination.find('.page-item').not('.page-next, .page-pre, .page-last-separator, .page-first-separator');
  5188. if (this.totalPages <= 1) {
  5189. this.$pagination.find('div.pagination').hide();
  5190. }
  5191. if (opts.smartDisplay) {
  5192. if (pageList.length < 2 || opts.totalRows <= pageList[0]) {
  5193. this.$pagination.find('div.page-list').hide();
  5194. }
  5195. } // when data is empty, hide the pagination
  5196. this.$pagination[this.getData().length ? 'show' : 'hide']();
  5197. if (!opts.paginationLoop) {
  5198. if (opts.pageNumber === 1) {
  5199. $pre.addClass('disabled');
  5200. }
  5201. if (opts.pageNumber === this.totalPages) {
  5202. $next.addClass('disabled');
  5203. }
  5204. }
  5205. if (allSelected) {
  5206. opts.pageSize = opts.formatAllRows();
  5207. } // removed the events for last and first, onPageNumber executeds the same logic
  5208. $pageList.off('click').on('click', function (e) {
  5209. return _this6.onPageListChange(e);
  5210. });
  5211. $pre.off('click').on('click', function (e) {
  5212. return _this6.onPagePre(e);
  5213. });
  5214. $next.off('click').on('click', function (e) {
  5215. return _this6.onPageNext(e);
  5216. });
  5217. $number.off('click').on('click', function (e) {
  5218. return _this6.onPageNumber(e);
  5219. });
  5220. }
  5221. }
  5222. }, {
  5223. key: "updatePagination",
  5224. value: function updatePagination(event) {
  5225. // Fix #171: IE disabled button can be clicked bug.
  5226. if (event && $__default["default"](event.currentTarget).hasClass('disabled')) {
  5227. return;
  5228. }
  5229. if (!this.options.maintainMetaData) {
  5230. this.resetRows();
  5231. }
  5232. this.initPagination();
  5233. this.trigger('page-change', this.options.pageNumber, this.options.pageSize);
  5234. if (this.options.sidePagination === 'server') {
  5235. this.initServer();
  5236. } else {
  5237. this.initBody();
  5238. }
  5239. }
  5240. }, {
  5241. key: "onPageListChange",
  5242. value: function onPageListChange(event) {
  5243. event.preventDefault();
  5244. var $this = $__default["default"](event.currentTarget);
  5245. $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive);
  5246. this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text();
  5247. this.$toolbar.find('.page-size').text(this.options.pageSize);
  5248. this.updatePagination(event);
  5249. return false;
  5250. }
  5251. }, {
  5252. key: "onPagePre",
  5253. value: function onPagePre(event) {
  5254. if ($__default["default"](event.target).hasClass('disabled')) {
  5255. return;
  5256. }
  5257. event.preventDefault();
  5258. if (this.options.pageNumber - 1 === 0) {
  5259. this.options.pageNumber = this.options.totalPages;
  5260. } else {
  5261. this.options.pageNumber--;
  5262. }
  5263. this.updatePagination(event);
  5264. return false;
  5265. }
  5266. }, {
  5267. key: "onPageNext",
  5268. value: function onPageNext(event) {
  5269. if ($__default["default"](event.target).hasClass('disabled')) {
  5270. return;
  5271. }
  5272. event.preventDefault();
  5273. if (this.options.pageNumber + 1 > this.options.totalPages) {
  5274. this.options.pageNumber = 1;
  5275. } else {
  5276. this.options.pageNumber++;
  5277. }
  5278. this.updatePagination(event);
  5279. return false;
  5280. }
  5281. }, {
  5282. key: "onPageNumber",
  5283. value: function onPageNumber(event) {
  5284. event.preventDefault();
  5285. if (this.options.pageNumber === +$__default["default"](event.currentTarget).text()) {
  5286. return;
  5287. }
  5288. this.options.pageNumber = +$__default["default"](event.currentTarget).text();
  5289. this.updatePagination(event);
  5290. return false;
  5291. } // eslint-disable-next-line no-unused-vars
  5292. }, {
  5293. key: "initRow",
  5294. value: function initRow(item, i, data, trFragments) {
  5295. var _this7 = this;
  5296. var html = [];
  5297. var style = {};
  5298. var csses = [];
  5299. var data_ = '';
  5300. var attributes = {};
  5301. var htmlAttributes = [];
  5302. if (Utils.findIndex(this.hiddenRows, item) > -1) {
  5303. return;
  5304. }
  5305. style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
  5306. if (style && style.css) {
  5307. for (var _i8 = 0, _Object$entries7 = Object.entries(style.css); _i8 < _Object$entries7.length; _i8++) {
  5308. var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i8], 2),
  5309. key = _Object$entries7$_i[0],
  5310. value = _Object$entries7$_i[1];
  5311. csses.push("".concat(key, ": ").concat(value));
  5312. }
  5313. }
  5314. attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes);
  5315. if (attributes) {
  5316. for (var _i9 = 0, _Object$entries8 = Object.entries(attributes); _i9 < _Object$entries8.length; _i9++) {
  5317. var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i9], 2),
  5318. _key2 = _Object$entries8$_i[0],
  5319. _value = _Object$entries8$_i[1];
  5320. htmlAttributes.push("".concat(_key2, "=\"").concat(Utils.escapeHTML(_value), "\""));
  5321. }
  5322. }
  5323. if (item._data && !Utils.isEmptyObject(item._data)) {
  5324. for (var _i10 = 0, _Object$entries9 = Object.entries(item._data); _i10 < _Object$entries9.length; _i10++) {
  5325. var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i10], 2),
  5326. k = _Object$entries9$_i[0],
  5327. v = _Object$entries9$_i[1];
  5328. // ignore data-index
  5329. if (k === 'index') {
  5330. return;
  5331. }
  5332. data_ += " data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'");
  5333. }
  5334. }
  5335. html.push('<tr', Utils.sprintf(' %s', htmlAttributes.length ? htmlAttributes.join(' ') : undefined), Utils.sprintf(' id="%s"', Array.isArray(item) ? undefined : item._id), Utils.sprintf(' class="%s"', style.classes || (Array.isArray(item) ? undefined : item._class)), Utils.sprintf(' style="%s"', Array.isArray(item) ? undefined : item._style), " data-index=\"".concat(i, "\""), Utils.sprintf(' data-uniqueid="%s"', Utils.getItemField(item, this.options.uniqueId, false)), Utils.sprintf(' data-has-detail-view="%s"', this.options.detailView && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item]) ? 'true' : undefined), Utils.sprintf('%s', data_), '>');
  5336. if (this.options.cardView) {
  5337. html.push("<td colspan=\"".concat(this.header.fields.length, "\"><div class=\"card-views\">"));
  5338. }
  5339. var detailViewTemplate = '';
  5340. if (Utils.hasDetailViewIcon(this.options)) {
  5341. detailViewTemplate = '<td>';
  5342. if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) {
  5343. detailViewTemplate += "\n <a class=\"detail-icon\" href=\"#\">\n ".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen), "\n </a>\n ");
  5344. }
  5345. detailViewTemplate += '</td>';
  5346. }
  5347. if (detailViewTemplate && this.options.detailViewAlign !== 'right') {
  5348. html.push(detailViewTemplate);
  5349. }
  5350. this.header.fields.forEach(function (field, j) {
  5351. var column = _this7.columns[j];
  5352. var text = '';
  5353. var value_ = Utils.getItemField(item, field, _this7.options.escape, column.escape);
  5354. var value = '';
  5355. var type = '';
  5356. var cellStyle = {};
  5357. var id_ = '';
  5358. var class_ = _this7.header.classes[j];
  5359. var style_ = '';
  5360. var styleToAdd_ = '';
  5361. var data_ = '';
  5362. var rowspan_ = '';
  5363. var colspan_ = '';
  5364. var title_ = '';
  5365. if ((_this7.fromHtml || _this7.autoMergeCells) && typeof value_ === 'undefined') {
  5366. if (!column.checkbox && !column.radio) {
  5367. return;
  5368. }
  5369. }
  5370. if (!column.visible) {
  5371. return;
  5372. }
  5373. if (_this7.options.cardView && !column.cardVisible) {
  5374. return;
  5375. }
  5376. if (column.escape) {
  5377. value_ = Utils.escapeHTML(value_);
  5378. } // Style concat
  5379. if (csses.concat([_this7.header.styles[j]]).length) {
  5380. styleToAdd_ += "".concat(csses.concat([_this7.header.styles[j]]).join('; '));
  5381. }
  5382. if (item["_".concat(field, "_style")]) {
  5383. styleToAdd_ += "".concat(item["_".concat(field, "_style")]);
  5384. }
  5385. if (styleToAdd_) {
  5386. style_ = " style=\"".concat(styleToAdd_, "\"");
  5387. } // Style concat
  5388. // handle id and class of td
  5389. if (item["_".concat(field, "_id")]) {
  5390. id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]);
  5391. }
  5392. if (item["_".concat(field, "_class")]) {
  5393. class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]);
  5394. }
  5395. if (item["_".concat(field, "_rowspan")]) {
  5396. rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]);
  5397. }
  5398. if (item["_".concat(field, "_colspan")]) {
  5399. colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]);
  5400. }
  5401. if (item["_".concat(field, "_title")]) {
  5402. title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]);
  5403. }
  5404. cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle);
  5405. if (cellStyle.classes) {
  5406. class_ = " class=\"".concat(cellStyle.classes, "\"");
  5407. }
  5408. if (cellStyle.css) {
  5409. var csses_ = [];
  5410. for (var _i11 = 0, _Object$entries10 = Object.entries(cellStyle.css); _i11 < _Object$entries10.length; _i11++) {
  5411. var _Object$entries10$_i = _slicedToArray(_Object$entries10[_i11], 2),
  5412. _key3 = _Object$entries10$_i[0],
  5413. _value2 = _Object$entries10$_i[1];
  5414. csses_.push("".concat(_key3, ": ").concat(_value2));
  5415. }
  5416. style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\"");
  5417. }
  5418. value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_);
  5419. if (!(column.checkbox || column.radio)) {
  5420. value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value;
  5421. }
  5422. if (column.searchable && _this7.searchText && _this7.options.searchHighlight && !(column.checkbox || column.radio)) {
  5423. var defValue = '';
  5424. var regExp = new RegExp("(".concat(_this7.searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), ")"), 'gim');
  5425. var marker = '<mark>$1</mark>';
  5426. var isHTML = value && /<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(value);
  5427. if (isHTML) {
  5428. // value can contains a HTML tags
  5429. var textContent = new DOMParser().parseFromString(value.toString(), 'text/html').documentElement.textContent;
  5430. var textReplaced = textContent.replace(regExp, marker);
  5431. textContent = textContent.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
  5432. defValue = value.replace(new RegExp("(>\\s*)(".concat(textContent, ")(\\s*)"), 'gm'), "$1".concat(textReplaced, "$3"));
  5433. } else {
  5434. // but usually not
  5435. defValue = value.toString().replace(regExp, marker);
  5436. }
  5437. value = Utils.calculateObjectValue(column, column.searchHighlightFormatter, [value, _this7.searchText], defValue);
  5438. }
  5439. if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) {
  5440. for (var _i12 = 0, _Object$entries11 = Object.entries(item["_".concat(field, "_data")]); _i12 < _Object$entries11.length; _i12++) {
  5441. var _Object$entries11$_i = _slicedToArray(_Object$entries11[_i12], 2),
  5442. _k = _Object$entries11$_i[0],
  5443. _v = _Object$entries11$_i[1];
  5444. // ignore data-index
  5445. if (_k === 'index') {
  5446. return;
  5447. }
  5448. data_ += " data-".concat(_k, "=\"").concat(_v, "\"");
  5449. }
  5450. }
  5451. if (column.checkbox || column.radio) {
  5452. type = column.checkbox ? 'checkbox' : type;
  5453. type = column.radio ? 'radio' : type;
  5454. var c = column['class'] || '';
  5455. var isChecked = Utils.isObject(value) && value.hasOwnProperty('checked') ? value.checked : (value === true || value_) && value !== false;
  5456. var isDisabled = !column.checkboxEnabled || value && value.disabled;
  5457. text = [_this7.options.cardView ? "<div class=\"card-view ".concat(c, "\">") : "<td class=\"bs-checkbox ".concat(c, "\"").concat(class_).concat(style_, ">"), "<label>\n <input\n data-index=\"".concat(i, "\"\n name=\"").concat(_this7.options.selectItemName, "\"\n type=\"").concat(type, "\"\n ").concat(Utils.sprintf('value="%s"', item[_this7.options.idField]), "\n ").concat(Utils.sprintf('checked="%s"', isChecked ? 'checked' : undefined), "\n ").concat(Utils.sprintf('disabled="%s"', isDisabled ? 'disabled' : undefined), " />\n <span></span>\n </label>"), _this7.header.formatters[j] && typeof value === 'string' ? value : '', _this7.options.cardView ? '</div>' : '</td>'].join('');
  5458. item[_this7.header.stateField] = value === true || !!value_ || value && value.checked;
  5459. } else if (_this7.options.cardView) {
  5460. var cardTitle = _this7.options.showHeader ? "<span class=\"card-view-title ".concat(cellStyle.classes || '', "\"").concat(style_, ">").concat(Utils.getFieldTitle(_this7.columns, field), "</span>") : '';
  5461. text = "<div class=\"card-view\">".concat(cardTitle, "<span class=\"card-view-value ").concat(cellStyle.classes || '', "\"").concat(style_, ">").concat(value, "</span></div>");
  5462. if (_this7.options.smartDisplay && value === '') {
  5463. text = '<div class="card-view"></div>';
  5464. }
  5465. } else {
  5466. text = "<td".concat(id_).concat(class_).concat(style_).concat(data_).concat(rowspan_).concat(colspan_).concat(title_, ">").concat(value, "</td>");
  5467. }
  5468. html.push(text);
  5469. });
  5470. if (detailViewTemplate && this.options.detailViewAlign === 'right') {
  5471. html.push(detailViewTemplate);
  5472. }
  5473. if (this.options.cardView) {
  5474. html.push('</div></td>');
  5475. }
  5476. html.push('</tr>');
  5477. return html.join('');
  5478. }
  5479. }, {
  5480. key: "initBody",
  5481. value: function initBody(fixedScroll, updatedUid) {
  5482. var _this8 = this;
  5483. var data = this.getData();
  5484. this.trigger('pre-body', data);
  5485. this.$body = this.$el.find('>tbody');
  5486. if (!this.$body.length) {
  5487. this.$body = $__default["default"]('<tbody></tbody>').appendTo(this.$el);
  5488. } // Fix #389 Bootstrap-table-flatJSON is not working
  5489. if (!this.options.pagination || this.options.sidePagination === 'server') {
  5490. this.pageFrom = 1;
  5491. this.pageTo = data.length;
  5492. }
  5493. var rows = [];
  5494. var trFragments = $__default["default"](document.createDocumentFragment());
  5495. var hasTr = false;
  5496. var toExpand = [];
  5497. this.autoMergeCells = Utils.checkAutoMergeCells(data.slice(this.pageFrom - 1, this.pageTo));
  5498. for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
  5499. var item = data[i];
  5500. var tr = this.initRow(item, i, data, trFragments);
  5501. hasTr = hasTr || !!tr;
  5502. if (tr && typeof tr === 'string') {
  5503. var uniqueId = this.options.uniqueId;
  5504. if (uniqueId && item.hasOwnProperty(uniqueId)) {
  5505. var itemUniqueId = item[uniqueId];
  5506. var oldTr = this.$body.find(Utils.sprintf('> tr[data-uniqueid="%s"][data-has-detail-view]', itemUniqueId));
  5507. var oldTrNext = oldTr.next();
  5508. if (oldTrNext.is('tr.detail-view')) {
  5509. toExpand.push(i);
  5510. if (!updatedUid || itemUniqueId !== updatedUid) {
  5511. tr += oldTrNext[0].outerHTML;
  5512. }
  5513. }
  5514. }
  5515. if (!this.options.virtualScroll) {
  5516. trFragments.append(tr);
  5517. } else {
  5518. rows.push(tr);
  5519. }
  5520. }
  5521. } // show no records
  5522. if (!hasTr) {
  5523. this.$body.html("<tr class=\"no-records-found\">".concat(Utils.sprintf('<td colspan="%s">%s</td>', this.getVisibleFields().length + Utils.getDetailViewIndexOffset(this.options), this.options.formatNoMatches()), "</tr>"));
  5524. } else if (!this.options.virtualScroll) {
  5525. this.$body.html(trFragments);
  5526. } else {
  5527. if (this.virtualScroll) {
  5528. this.virtualScroll.destroy();
  5529. }
  5530. this.virtualScroll = new VirtualScroll({
  5531. rows: rows,
  5532. fixedScroll: fixedScroll,
  5533. scrollEl: this.$tableBody[0],
  5534. contentEl: this.$body[0],
  5535. itemHeight: this.options.virtualScrollItemHeight,
  5536. callback: function callback(startIndex, endIndex) {
  5537. _this8.fitHeader();
  5538. _this8.initBodyEvent();
  5539. _this8.trigger('virtual-scroll', startIndex, endIndex);
  5540. }
  5541. });
  5542. }
  5543. toExpand.forEach(function (index) {
  5544. _this8.expandRow(index);
  5545. });
  5546. if (!fixedScroll) {
  5547. this.scrollTo(0);
  5548. }
  5549. this.initBodyEvent();
  5550. this.initFooter();
  5551. this.resetView();
  5552. this.updateSelected();
  5553. if (this.options.sidePagination !== 'server') {
  5554. this.options.totalRows = data.length;
  5555. }
  5556. this.trigger('post-body', data);
  5557. }
  5558. }, {
  5559. key: "initBodyEvent",
  5560. value: function initBodyEvent() {
  5561. var _this9 = this;
  5562. // click to select by column
  5563. this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  5564. var $td = $__default["default"](e.currentTarget);
  5565. var $tr = $td.parent();
  5566. var $cardViewArr = $__default["default"](e.target).parents('.card-views').children();
  5567. var $cardViewTarget = $__default["default"](e.target).parents('.card-view');
  5568. var rowIndex = $tr.data('index');
  5569. var item = _this9.data[rowIndex];
  5570. var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex;
  5571. var fields = _this9.getVisibleFields();
  5572. var field = fields[index - Utils.getDetailViewIndexOffset(_this9.options)];
  5573. var column = _this9.columns[_this9.fieldsColumnsIndex[field]];
  5574. var value = Utils.getItemField(item, field, _this9.options.escape, column.escape);
  5575. if ($td.find('.detail-icon').length) {
  5576. return;
  5577. }
  5578. _this9.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
  5579. _this9.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); // if click to select - then trigger the checkbox/radio click
  5580. if (e.type === 'click' && _this9.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this9.options, _this9.options.ignoreClickToSelectOn, [e.target])) {
  5581. var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this9.options.selectItemName));
  5582. if ($selectItem.length) {
  5583. $selectItem[0].click();
  5584. }
  5585. }
  5586. if (e.type === 'click' && _this9.options.detailViewByClick) {
  5587. _this9.toggleDetailView(rowIndex, _this9.header.detailFormatters[_this9.fieldsColumnsIndex[field]]);
  5588. }
  5589. }).off('mousedown').on('mousedown', function (e) {
  5590. // https://github.com/jquery/jquery/issues/1741
  5591. _this9.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey;
  5592. _this9.multipleSelectRowShiftKey = e.shiftKey;
  5593. });
  5594. this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) {
  5595. e.preventDefault();
  5596. _this9.toggleDetailView($__default["default"](e.currentTarget).parent().parent().data('index'));
  5597. return false;
  5598. });
  5599. this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName));
  5600. this.$selectItem.off('click').on('click', function (e) {
  5601. e.stopImmediatePropagation();
  5602. var $this = $__default["default"](e.currentTarget);
  5603. _this9._toggleCheck($this.prop('checked'), $this.data('index'));
  5604. });
  5605. this.header.events.forEach(function (_events, i) {
  5606. var events = _events;
  5607. if (!events) {
  5608. return;
  5609. } // fix bug, if events is defined with namespace
  5610. if (typeof events === 'string') {
  5611. events = Utils.calculateObjectValue(null, events);
  5612. }
  5613. if (!events) {
  5614. throw new Error("Unknown event in the scope: ".concat(_events));
  5615. }
  5616. var field = _this9.header.fields[i];
  5617. var fieldIndex = _this9.getVisibleFields().indexOf(field);
  5618. if (fieldIndex === -1) {
  5619. return;
  5620. }
  5621. fieldIndex += Utils.getDetailViewIndexOffset(_this9.options);
  5622. var _loop2 = function _loop2(key) {
  5623. if (!events.hasOwnProperty(key)) {
  5624. return "continue";
  5625. }
  5626. var event = events[key];
  5627. _this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) {
  5628. var $tr = $__default["default"](tr);
  5629. var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex);
  5630. var index = key.indexOf(' ');
  5631. var name = key.substring(0, index);
  5632. var el = key.substring(index + 1);
  5633. $td.find(el).off(name).on(name, function (e) {
  5634. var index = $tr.data('index');
  5635. var row = _this9.data[index];
  5636. var value = row[field];
  5637. event.apply(_this9, [e, value, row, index]);
  5638. });
  5639. });
  5640. };
  5641. for (var key in events) {
  5642. var _ret2 = _loop2(key);
  5643. if (_ret2 === "continue") continue;
  5644. }
  5645. });
  5646. }
  5647. }, {
  5648. key: "initServer",
  5649. value: function initServer(silent, query, url) {
  5650. var _this10 = this;
  5651. var data = {};
  5652. var index = this.header.fields.indexOf(this.options.sortName);
  5653. var params = {
  5654. searchText: this.searchText,
  5655. sortName: this.options.sortName,
  5656. sortOrder: this.options.sortOrder
  5657. };
  5658. if (this.header.sortNames[index]) {
  5659. params.sortName = this.header.sortNames[index];
  5660. }
  5661. if (this.options.pagination && this.options.sidePagination === 'server') {
  5662. params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
  5663. params.pageNumber = this.options.pageNumber;
  5664. }
  5665. if (!(url || this.options.url) && !this.options.ajax) {
  5666. return;
  5667. }
  5668. if (this.options.queryParamsType === 'limit') {
  5669. params = {
  5670. search: params.searchText,
  5671. sort: params.sortName,
  5672. order: params.sortOrder
  5673. };
  5674. if (this.options.pagination && this.options.sidePagination === 'server') {
  5675. params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1);
  5676. params.limit = this.options.pageSize;
  5677. if (params.limit === 0 || this.options.pageSize === this.options.formatAllRows()) {
  5678. delete params.limit;
  5679. }
  5680. }
  5681. }
  5682. if (this.options.search && this.options.sidePagination === 'server' && this.columns.filter(function (column) {
  5683. return !column.searchable;
  5684. }).length) {
  5685. params.searchable = [];
  5686. var _iterator2 = _createForOfIteratorHelper(this.columns),
  5687. _step2;
  5688. try {
  5689. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  5690. var column = _step2.value;
  5691. if (!column.checkbox && column.searchable && (this.options.visibleSearch && column.visible || !this.options.visibleSearch)) {
  5692. params.searchable.push(column.field);
  5693. }
  5694. }
  5695. } catch (err) {
  5696. _iterator2.e(err);
  5697. } finally {
  5698. _iterator2.f();
  5699. }
  5700. }
  5701. if (!Utils.isEmptyObject(this.filterColumnsPartial)) {
  5702. params.filter = JSON.stringify(this.filterColumnsPartial, null);
  5703. }
  5704. $__default["default"].extend(params, query || {});
  5705. data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data); // false to stop request
  5706. if (data === false) {
  5707. return;
  5708. }
  5709. if (!silent) {
  5710. this.showLoading();
  5711. }
  5712. var request = $__default["default"].extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), {
  5713. type: this.options.method,
  5714. url: url || this.options.url,
  5715. data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data,
  5716. cache: this.options.cache,
  5717. contentType: this.options.contentType,
  5718. dataType: this.options.dataType,
  5719. success: function success(_res, textStatus, jqXHR) {
  5720. var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, jqXHR], _res);
  5721. _this10.load(res);
  5722. _this10.trigger('load-success', res, jqXHR && jqXHR.status, jqXHR);
  5723. if (!silent) {
  5724. _this10.hideLoading();
  5725. }
  5726. if (_this10.options.sidePagination === 'server' && _this10.options.pageNumber > 1 && res[_this10.options.totalField] > 0 && !res[_this10.options.dataField].length) {
  5727. _this10.updatePagination();
  5728. }
  5729. },
  5730. error: function error(jqXHR) {
  5731. // abort ajax by multiple request
  5732. if (jqXHR && jqXHR.status === 0 && _this10._xhrAbort) {
  5733. _this10._xhrAbort = false;
  5734. return;
  5735. }
  5736. var data = [];
  5737. if (_this10.options.sidePagination === 'server') {
  5738. data = {};
  5739. data[_this10.options.totalField] = 0;
  5740. data[_this10.options.dataField] = [];
  5741. }
  5742. _this10.load(data);
  5743. _this10.trigger('load-error', jqXHR && jqXHR.status, jqXHR);
  5744. if (!silent) {
  5745. _this10.hideLoading();
  5746. }
  5747. }
  5748. });
  5749. if (this.options.ajax) {
  5750. Utils.calculateObjectValue(this, this.options.ajax, [request], null);
  5751. } else {
  5752. if (this._xhr && this._xhr.readyState !== 4) {
  5753. this._xhrAbort = true;
  5754. this._xhr.abort();
  5755. }
  5756. this._xhr = $__default["default"].ajax(request);
  5757. }
  5758. return data;
  5759. }
  5760. }, {
  5761. key: "initSearchText",
  5762. value: function initSearchText() {
  5763. if (this.options.search) {
  5764. this.searchText = '';
  5765. if (this.options.searchText !== '') {
  5766. var $search = Utils.getSearchInput(this);
  5767. $search.val(this.options.searchText);
  5768. this.onSearch({
  5769. currentTarget: $search,
  5770. firedByInitSearchText: true
  5771. });
  5772. }
  5773. }
  5774. }
  5775. }, {
  5776. key: "getCaret",
  5777. value: function getCaret() {
  5778. var _this11 = this;
  5779. this.$header.find('th').each(function (i, th) {
  5780. $__default["default"](th).find('.sortable').removeClass('desc asc').addClass($__default["default"](th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both');
  5781. });
  5782. }
  5783. }, {
  5784. key: "updateSelected",
  5785. value: function updateSelected() {
  5786. var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length;
  5787. this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
  5788. this.$selectItem.each(function (i, el) {
  5789. $__default["default"](el).closest('tr')[$__default["default"](el).prop('checked') ? 'addClass' : 'removeClass']('selected');
  5790. });
  5791. }
  5792. }, {
  5793. key: "updateRows",
  5794. value: function updateRows() {
  5795. var _this12 = this;
  5796. this.$selectItem.each(function (i, el) {
  5797. _this12.data[$__default["default"](el).data('index')][_this12.header.stateField] = $__default["default"](el).prop('checked');
  5798. });
  5799. }
  5800. }, {
  5801. key: "resetRows",
  5802. value: function resetRows() {
  5803. var _iterator3 = _createForOfIteratorHelper(this.data),
  5804. _step3;
  5805. try {
  5806. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  5807. var row = _step3.value;
  5808. this.$selectAll.prop('checked', false);
  5809. this.$selectItem.prop('checked', false);
  5810. if (this.header.stateField) {
  5811. row[this.header.stateField] = false;
  5812. }
  5813. }
  5814. } catch (err) {
  5815. _iterator3.e(err);
  5816. } finally {
  5817. _iterator3.f();
  5818. }
  5819. this.initHiddenRows();
  5820. }
  5821. }, {
  5822. key: "trigger",
  5823. value: function trigger(_name) {
  5824. var _this$options, _this$options2;
  5825. var name = "".concat(_name, ".bs.table");
  5826. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key4 = 1; _key4 < _len; _key4++) {
  5827. args[_key4 - 1] = arguments[_key4];
  5828. }
  5829. (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, [].concat(args, [this]));
  5830. this.$el.trigger($__default["default"].Event(name, {
  5831. sender: this
  5832. }), args);
  5833. (_this$options2 = this.options).onAll.apply(_this$options2, [name].concat([].concat(args, [this])));
  5834. this.$el.trigger($__default["default"].Event('all.bs.table', {
  5835. sender: this
  5836. }), [name, args]);
  5837. }
  5838. }, {
  5839. key: "resetHeader",
  5840. value: function resetHeader() {
  5841. var _this13 = this;
  5842. // fix #61: the hidden table reset header bug.
  5843. // fix bug: get $el.css('width') error sometime (height = 500)
  5844. clearTimeout(this.timeoutId_);
  5845. this.timeoutId_ = setTimeout(function () {
  5846. return _this13.fitHeader();
  5847. }, this.$el.is(':hidden') ? 100 : 0);
  5848. }
  5849. }, {
  5850. key: "fitHeader",
  5851. value: function fitHeader() {
  5852. var _this14 = this;
  5853. if (this.$el.is(':hidden')) {
  5854. this.timeoutId_ = setTimeout(function () {
  5855. return _this14.fitHeader();
  5856. }, 100);
  5857. return;
  5858. }
  5859. var fixedBody = this.$tableBody.get(0);
  5860. var scrollWidth = this.hasScrollBar && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
  5861. this.$el.css('margin-top', -this.$header.outerHeight());
  5862. var focused = $__default["default"](':focus');
  5863. if (focused.length > 0) {
  5864. var $th = focused.parents('th');
  5865. if ($th.length > 0) {
  5866. var dataField = $th.attr('data-field');
  5867. if (dataField !== undefined) {
  5868. var $headerTh = this.$header.find("[data-field='".concat(dataField, "']"));
  5869. if ($headerTh.length > 0) {
  5870. $headerTh.find(':input').addClass('focus-temp');
  5871. }
  5872. }
  5873. }
  5874. }
  5875. this.$header_ = this.$header.clone(true, true);
  5876. this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
  5877. this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_);
  5878. this.$tableLoading.css('width', this.$el.outerWidth());
  5879. var focusedTemp = $__default["default"]('.focus-temp:visible:eq(0)');
  5880. if (focusedTemp.length > 0) {
  5881. focusedTemp.focus();
  5882. this.$header.find('.focus-temp').removeClass('focus-temp');
  5883. } // fix bug: $.data() is not working as expected after $.append()
  5884. this.$header.find('th[data-field]').each(function (i, el) {
  5885. _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $__default["default"](el).data('field'))).data($__default["default"](el).data());
  5886. });
  5887. var visibleFields = this.getVisibleFields();
  5888. var $ths = this.$header_.find('th');
  5889. var $tr = this.$body.find('>tr:not(.no-records-found,.virtual-scroll-top)').eq(0);
  5890. while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
  5891. $tr = $tr.next();
  5892. }
  5893. var trLength = $tr.find('> *').length;
  5894. $tr.find('> *').each(function (i, el) {
  5895. var $this = $__default["default"](el);
  5896. if (Utils.hasDetailViewIcon(_this14.options)) {
  5897. if (i === 0 && _this14.options.detailViewAlign !== 'right' || i === trLength - 1 && _this14.options.detailViewAlign === 'right') {
  5898. var $thDetail = $ths.filter('.detail');
  5899. var _zoomWidth = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
  5900. $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth);
  5901. return;
  5902. }
  5903. }
  5904. var index = i - Utils.getDetailViewIndexOffset(_this14.options);
  5905. var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index]));
  5906. if ($th.length > 1) {
  5907. $th = $__default["default"]($ths[$this[0].cellIndex]);
  5908. }
  5909. var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
  5910. $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
  5911. });
  5912. this.horizontalScroll();
  5913. this.trigger('post-header');
  5914. }
  5915. }, {
  5916. key: "initFooter",
  5917. value: function initFooter() {
  5918. if (!this.options.showFooter || this.options.cardView) {
  5919. // do nothing
  5920. return;
  5921. }
  5922. var data = this.getData();
  5923. var html = [];
  5924. var detailTemplate = '';
  5925. if (Utils.hasDetailViewIcon(this.options)) {
  5926. detailTemplate = '<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>';
  5927. }
  5928. if (detailTemplate && this.options.detailViewAlign !== 'right') {
  5929. html.push(detailTemplate);
  5930. }
  5931. var _iterator4 = _createForOfIteratorHelper(this.columns),
  5932. _step4;
  5933. try {
  5934. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  5935. var column = _step4.value;
  5936. var falign = '';
  5937. var valign = '';
  5938. var csses = [];
  5939. var style = {};
  5940. var class_ = Utils.sprintf(' class="%s"', column['class']);
  5941. if (!column.visible || this.footerData && this.footerData.length > 0 && !(column.field in this.footerData[0])) {
  5942. continue;
  5943. }
  5944. if (this.options.cardView && !column.cardVisible) {
  5945. return;
  5946. }
  5947. falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align);
  5948. valign = Utils.sprintf('vertical-align: %s; ', column.valign);
  5949. style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]);
  5950. if (style && style.css) {
  5951. for (var _i13 = 0, _Object$entries12 = Object.entries(style.css); _i13 < _Object$entries12.length; _i13++) {
  5952. var _Object$entries12$_i = _slicedToArray(_Object$entries12[_i13], 2),
  5953. key = _Object$entries12$_i[0],
  5954. _value3 = _Object$entries12$_i[1];
  5955. csses.push("".concat(key, ": ").concat(_value3));
  5956. }
  5957. }
  5958. if (style && style.classes) {
  5959. class_ = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], style.classes].join(' ') : style.classes);
  5960. }
  5961. html.push('<th', class_, Utils.sprintf(' style="%s"', falign + valign + csses.concat().join('; ')));
  5962. var colspan = 0;
  5963. if (this.footerData && this.footerData.length > 0) {
  5964. colspan = this.footerData[0]["_".concat(column.field, "_colspan")] || 0;
  5965. }
  5966. if (colspan) {
  5967. html.push(" colspan=\"".concat(colspan, "\" "));
  5968. }
  5969. html.push('>');
  5970. html.push('<div class="th-inner">');
  5971. var value = '';
  5972. if (this.footerData && this.footerData.length > 0) {
  5973. value = this.footerData[0][column.field] || '';
  5974. }
  5975. html.push(Utils.calculateObjectValue(column, column.footerFormatter, [data, value], value));
  5976. html.push('</div>');
  5977. html.push('<div class="fht-cell"></div>');
  5978. html.push('</div>');
  5979. html.push('</th>');
  5980. }
  5981. } catch (err) {
  5982. _iterator4.e(err);
  5983. } finally {
  5984. _iterator4.f();
  5985. }
  5986. if (detailTemplate && this.options.detailViewAlign === 'right') {
  5987. html.push(detailTemplate);
  5988. }
  5989. if (!this.options.height && !this.$tableFooter.length) {
  5990. this.$el.append('<tfoot><tr></tr></tfoot>');
  5991. this.$tableFooter = this.$el.find('tfoot');
  5992. }
  5993. if (!this.$tableFooter.find('tr').length) {
  5994. this.$tableFooter.html('<table><thead><tr></tr></thead></table>');
  5995. }
  5996. this.$tableFooter.find('tr').html(html.join(''));
  5997. this.trigger('post-footer', this.$tableFooter);
  5998. }
  5999. }, {
  6000. key: "fitFooter",
  6001. value: function fitFooter() {
  6002. var _this15 = this;
  6003. if (this.$el.is(':hidden')) {
  6004. setTimeout(function () {
  6005. return _this15.fitFooter();
  6006. }, 100);
  6007. return;
  6008. }
  6009. var fixedBody = this.$tableBody.get(0);
  6010. var scrollWidth = this.hasScrollBar && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
  6011. this.$tableFooter.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class'));
  6012. var $ths = this.$tableFooter.find('th');
  6013. var $tr = this.$body.find('>tr:first-child:not(.no-records-found)');
  6014. $ths.find('.fht-cell').width('auto');
  6015. while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
  6016. $tr = $tr.next();
  6017. }
  6018. var trLength = $tr.find('> *').length;
  6019. $tr.find('> *').each(function (i, el) {
  6020. var $this = $__default["default"](el);
  6021. if (Utils.hasDetailViewIcon(_this15.options)) {
  6022. if (i === 0 && _this15.options.detailViewAlign === 'left' || i === trLength - 1 && _this15.options.detailViewAlign === 'right') {
  6023. var $thDetail = $ths.filter('.detail');
  6024. var _zoomWidth2 = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
  6025. $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth2);
  6026. return;
  6027. }
  6028. }
  6029. var $th = $ths.eq(i);
  6030. var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
  6031. $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
  6032. });
  6033. this.horizontalScroll();
  6034. }
  6035. }, {
  6036. key: "horizontalScroll",
  6037. value: function horizontalScroll() {
  6038. var _this16 = this;
  6039. // horizontal scroll event
  6040. // TODO: it's probably better improving the layout than binding to scroll event
  6041. this.$tableBody.off('scroll').on('scroll', function () {
  6042. var scrollLeft = _this16.$tableBody.scrollLeft();
  6043. if (_this16.options.showHeader && _this16.options.height) {
  6044. _this16.$tableHeader.scrollLeft(scrollLeft);
  6045. }
  6046. if (_this16.options.showFooter && !_this16.options.cardView) {
  6047. _this16.$tableFooter.scrollLeft(scrollLeft);
  6048. }
  6049. _this16.trigger('scroll-body', _this16.$tableBody);
  6050. });
  6051. }
  6052. }, {
  6053. key: "getVisibleFields",
  6054. value: function getVisibleFields() {
  6055. var visibleFields = [];
  6056. var _iterator5 = _createForOfIteratorHelper(this.header.fields),
  6057. _step5;
  6058. try {
  6059. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  6060. var field = _step5.value;
  6061. var column = this.columns[this.fieldsColumnsIndex[field]];
  6062. if (!column || !column.visible || this.options.cardView && !column.cardVisible) {
  6063. continue;
  6064. }
  6065. visibleFields.push(field);
  6066. }
  6067. } catch (err) {
  6068. _iterator5.e(err);
  6069. } finally {
  6070. _iterator5.f();
  6071. }
  6072. return visibleFields;
  6073. }
  6074. }, {
  6075. key: "initHiddenRows",
  6076. value: function initHiddenRows() {
  6077. this.hiddenRows = [];
  6078. } // PUBLIC FUNCTION DEFINITION
  6079. // =======================
  6080. }, {
  6081. key: "getOptions",
  6082. value: function getOptions() {
  6083. // deep copy and remove data
  6084. var options = $__default["default"].extend({}, this.options);
  6085. delete options.data;
  6086. return $__default["default"].extend(true, {}, options);
  6087. }
  6088. }, {
  6089. key: "refreshOptions",
  6090. value: function refreshOptions(options) {
  6091. // If the objects are equivalent then avoid the call of destroy / init methods
  6092. if (Utils.compareObjects(this.options, options, true)) {
  6093. return;
  6094. }
  6095. this.options = $__default["default"].extend(this.options, options);
  6096. this.trigger('refresh-options', this.options);
  6097. this.destroy();
  6098. this.init();
  6099. }
  6100. }, {
  6101. key: "getData",
  6102. value: function getData(params) {
  6103. var _this17 = this;
  6104. var data = this.options.data;
  6105. if ((this.searchText || this.options.customSearch || this.options.sortName !== undefined || this.enableCustomSort || // Fix #4616: this.enableCustomSort is for extensions
  6106. !Utils.isEmptyObject(this.filterColumns) || typeof this.options.filterOptions.filterAlgorithm === 'function' || !Utils.isEmptyObject(this.filterColumnsPartial)) && (!params || !params.unfiltered)) {
  6107. data = this.data;
  6108. }
  6109. if (params && params.useCurrentPage) {
  6110. data = data.slice(this.pageFrom - 1, this.pageTo);
  6111. }
  6112. if (params && !params.includeHiddenRows) {
  6113. var hiddenRows = this.getHiddenRows();
  6114. data = data.filter(function (row) {
  6115. return Utils.findIndex(hiddenRows, row) === -1;
  6116. });
  6117. }
  6118. if (params && params.formatted) {
  6119. data.forEach(function (row) {
  6120. for (var _i14 = 0, _Object$entries13 = Object.entries(row); _i14 < _Object$entries13.length; _i14++) {
  6121. var _Object$entries13$_i = _slicedToArray(_Object$entries13[_i14], 2),
  6122. key = _Object$entries13$_i[0],
  6123. value = _Object$entries13$_i[1];
  6124. var column = _this17.columns[_this17.fieldsColumnsIndex[key]];
  6125. if (!column) {
  6126. return;
  6127. }
  6128. row[key] = Utils.calculateObjectValue(column, _this17.header.formatters[column.fieldIndex], [value, row, row.index, column.field], value);
  6129. }
  6130. });
  6131. }
  6132. return data;
  6133. }
  6134. }, {
  6135. key: "getSelections",
  6136. value: function getSelections() {
  6137. var _this18 = this;
  6138. return (this.options.maintainMetaData ? this.options.data : this.data).filter(function (row) {
  6139. return row[_this18.header.stateField] === true;
  6140. });
  6141. }
  6142. }, {
  6143. key: "load",
  6144. value: function load(_data) {
  6145. var fixedScroll = false;
  6146. var data = _data; // #431: support pagination
  6147. if (this.options.pagination && this.options.sidePagination === 'server') {
  6148. this.options.totalRows = data[this.options.totalField];
  6149. this.options.totalNotFiltered = data[this.options.totalNotFilteredField];
  6150. this.footerData = data[this.options.footerField] ? [data[this.options.footerField]] : undefined;
  6151. }
  6152. fixedScroll = data.fixedScroll;
  6153. data = Array.isArray(data) ? data : data[this.options.dataField];
  6154. this.initData(data);
  6155. this.initSearch();
  6156. this.initPagination();
  6157. this.initBody(fixedScroll);
  6158. }
  6159. }, {
  6160. key: "append",
  6161. value: function append(data) {
  6162. this.initData(data, 'append');
  6163. this.initSearch();
  6164. this.initPagination();
  6165. this.initSort();
  6166. this.initBody(true);
  6167. }
  6168. }, {
  6169. key: "prepend",
  6170. value: function prepend(data) {
  6171. this.initData(data, 'prepend');
  6172. this.initSearch();
  6173. this.initPagination();
  6174. this.initSort();
  6175. this.initBody(true);
  6176. }
  6177. }, {
  6178. key: "remove",
  6179. value: function remove(params) {
  6180. var removed = 0;
  6181. for (var i = this.options.data.length - 1; i >= 0; i--) {
  6182. var row = this.options.data[i];
  6183. if (!row.hasOwnProperty(params.field) && params.field !== '$index') {
  6184. continue;
  6185. }
  6186. if (!row.hasOwnProperty(params.field) && params.field === '$index' && params.values.includes(i) || params.values.includes(row[params.field])) {
  6187. removed++;
  6188. this.options.data.splice(i, 1);
  6189. }
  6190. }
  6191. if (!removed) {
  6192. return;
  6193. }
  6194. if (this.options.sidePagination === 'server') {
  6195. this.options.totalRows -= removed;
  6196. this.data = _toConsumableArray(this.options.data);
  6197. }
  6198. this.initSearch();
  6199. this.initPagination();
  6200. this.initSort();
  6201. this.initBody(true);
  6202. }
  6203. }, {
  6204. key: "removeAll",
  6205. value: function removeAll() {
  6206. if (this.options.data.length > 0) {
  6207. this.options.data.splice(0, this.options.data.length);
  6208. this.initSearch();
  6209. this.initPagination();
  6210. this.initBody(true);
  6211. }
  6212. }
  6213. }, {
  6214. key: "insertRow",
  6215. value: function insertRow(params) {
  6216. if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
  6217. return;
  6218. }
  6219. this.options.data.splice(params.index, 0, params.row);
  6220. this.initSearch();
  6221. this.initPagination();
  6222. this.initSort();
  6223. this.initBody(true);
  6224. }
  6225. }, {
  6226. key: "updateRow",
  6227. value: function updateRow(params) {
  6228. var allParams = Array.isArray(params) ? params : [params];
  6229. var _iterator6 = _createForOfIteratorHelper(allParams),
  6230. _step6;
  6231. try {
  6232. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  6233. var _params = _step6.value;
  6234. if (!_params.hasOwnProperty('index') || !_params.hasOwnProperty('row')) {
  6235. continue;
  6236. }
  6237. if (_params.hasOwnProperty('replace') && _params.replace) {
  6238. this.options.data[_params.index] = _params.row;
  6239. } else {
  6240. $__default["default"].extend(this.options.data[_params.index], _params.row);
  6241. }
  6242. }
  6243. } catch (err) {
  6244. _iterator6.e(err);
  6245. } finally {
  6246. _iterator6.f();
  6247. }
  6248. this.initSearch();
  6249. this.initPagination();
  6250. this.initSort();
  6251. this.initBody(true);
  6252. }
  6253. }, {
  6254. key: "getRowByUniqueId",
  6255. value: function getRowByUniqueId(_id) {
  6256. var uniqueId = this.options.uniqueId;
  6257. var len = this.options.data.length;
  6258. var id = _id;
  6259. var dataRow = null;
  6260. var i;
  6261. var row;
  6262. var rowUniqueId;
  6263. for (i = len - 1; i >= 0; i--) {
  6264. row = this.options.data[i];
  6265. if (row.hasOwnProperty(uniqueId)) {
  6266. // uniqueId is a column
  6267. rowUniqueId = row[uniqueId];
  6268. } else if (row._data && row._data.hasOwnProperty(uniqueId)) {
  6269. // uniqueId is a row data property
  6270. rowUniqueId = row._data[uniqueId];
  6271. } else {
  6272. continue;
  6273. }
  6274. if (typeof rowUniqueId === 'string') {
  6275. id = id.toString();
  6276. } else if (typeof rowUniqueId === 'number') {
  6277. if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
  6278. id = parseInt(id, 10);
  6279. } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
  6280. id = parseFloat(id);
  6281. }
  6282. }
  6283. if (rowUniqueId === id) {
  6284. dataRow = row;
  6285. break;
  6286. }
  6287. }
  6288. return dataRow;
  6289. }
  6290. }, {
  6291. key: "updateByUniqueId",
  6292. value: function updateByUniqueId(params) {
  6293. var allParams = Array.isArray(params) ? params : [params];
  6294. var updatedUid = null;
  6295. var _iterator7 = _createForOfIteratorHelper(allParams),
  6296. _step7;
  6297. try {
  6298. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  6299. var _params2 = _step7.value;
  6300. if (!_params2.hasOwnProperty('id') || !_params2.hasOwnProperty('row')) {
  6301. continue;
  6302. }
  6303. var rowId = this.options.data.indexOf(this.getRowByUniqueId(_params2.id));
  6304. if (rowId === -1) {
  6305. continue;
  6306. }
  6307. if (_params2.hasOwnProperty('replace') && _params2.replace) {
  6308. this.options.data[rowId] = _params2.row;
  6309. } else {
  6310. $__default["default"].extend(this.options.data[rowId], _params2.row);
  6311. }
  6312. updatedUid = _params2.id;
  6313. }
  6314. } catch (err) {
  6315. _iterator7.e(err);
  6316. } finally {
  6317. _iterator7.f();
  6318. }
  6319. this.initSearch();
  6320. this.initPagination();
  6321. this.initSort();
  6322. this.initBody(true, updatedUid);
  6323. }
  6324. }, {
  6325. key: "removeByUniqueId",
  6326. value: function removeByUniqueId(id) {
  6327. var len = this.options.data.length;
  6328. var row = this.getRowByUniqueId(id);
  6329. if (row) {
  6330. this.options.data.splice(this.options.data.indexOf(row), 1);
  6331. }
  6332. if (len === this.options.data.length) {
  6333. return;
  6334. }
  6335. if (this.options.sidePagination === 'server') {
  6336. this.options.totalRows -= 1;
  6337. this.data = _toConsumableArray(this.options.data);
  6338. }
  6339. this.initSearch();
  6340. this.initPagination();
  6341. this.initBody(true);
  6342. }
  6343. }, {
  6344. key: "updateCell",
  6345. value: function updateCell(params) {
  6346. if (!params.hasOwnProperty('index') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
  6347. return;
  6348. }
  6349. this.data[params.index][params.field] = params.value;
  6350. if (params.reinit === false) {
  6351. return;
  6352. }
  6353. this.initSort();
  6354. this.initBody(true);
  6355. }
  6356. }, {
  6357. key: "updateCellByUniqueId",
  6358. value: function updateCellByUniqueId(params) {
  6359. var _this19 = this;
  6360. var allParams = Array.isArray(params) ? params : [params];
  6361. allParams.forEach(function (_ref6) {
  6362. var id = _ref6.id,
  6363. field = _ref6.field,
  6364. value = _ref6.value;
  6365. var rowId = _this19.options.data.indexOf(_this19.getRowByUniqueId(id));
  6366. if (rowId === -1) {
  6367. return;
  6368. }
  6369. _this19.options.data[rowId][field] = value;
  6370. });
  6371. if (params.reinit === false) {
  6372. return;
  6373. }
  6374. this.initSort();
  6375. this.initBody(true);
  6376. }
  6377. }, {
  6378. key: "showRow",
  6379. value: function showRow(params) {
  6380. this._toggleRow(params, true);
  6381. }
  6382. }, {
  6383. key: "hideRow",
  6384. value: function hideRow(params) {
  6385. this._toggleRow(params, false);
  6386. }
  6387. }, {
  6388. key: "_toggleRow",
  6389. value: function _toggleRow(params, visible) {
  6390. var row;
  6391. if (params.hasOwnProperty('index')) {
  6392. row = this.getData()[params.index];
  6393. } else if (params.hasOwnProperty('uniqueId')) {
  6394. row = this.getRowByUniqueId(params.uniqueId);
  6395. }
  6396. if (!row) {
  6397. return;
  6398. }
  6399. var index = Utils.findIndex(this.hiddenRows, row);
  6400. if (!visible && index === -1) {
  6401. this.hiddenRows.push(row);
  6402. } else if (visible && index > -1) {
  6403. this.hiddenRows.splice(index, 1);
  6404. }
  6405. this.initBody(true);
  6406. this.initPagination();
  6407. }
  6408. }, {
  6409. key: "getHiddenRows",
  6410. value: function getHiddenRows(show) {
  6411. if (show) {
  6412. this.initHiddenRows();
  6413. this.initBody(true);
  6414. this.initPagination();
  6415. return;
  6416. }
  6417. var data = this.getData();
  6418. var rows = [];
  6419. var _iterator8 = _createForOfIteratorHelper(data),
  6420. _step8;
  6421. try {
  6422. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  6423. var row = _step8.value;
  6424. if (this.hiddenRows.includes(row)) {
  6425. rows.push(row);
  6426. }
  6427. }
  6428. } catch (err) {
  6429. _iterator8.e(err);
  6430. } finally {
  6431. _iterator8.f();
  6432. }
  6433. this.hiddenRows = rows;
  6434. return rows;
  6435. }
  6436. }, {
  6437. key: "showColumn",
  6438. value: function showColumn(field) {
  6439. var _this20 = this;
  6440. var fields = Array.isArray(field) ? field : [field];
  6441. fields.forEach(function (field) {
  6442. _this20._toggleColumn(_this20.fieldsColumnsIndex[field], true, true);
  6443. });
  6444. }
  6445. }, {
  6446. key: "hideColumn",
  6447. value: function hideColumn(field) {
  6448. var _this21 = this;
  6449. var fields = Array.isArray(field) ? field : [field];
  6450. fields.forEach(function (field) {
  6451. _this21._toggleColumn(_this21.fieldsColumnsIndex[field], false, true);
  6452. });
  6453. }
  6454. }, {
  6455. key: "_toggleColumn",
  6456. value: function _toggleColumn(index, checked, needUpdate) {
  6457. if (index === -1 || this.columns[index].visible === checked) {
  6458. return;
  6459. }
  6460. this.columns[index].visible = checked;
  6461. this.initHeader();
  6462. this.initSearch();
  6463. this.initPagination();
  6464. this.initBody();
  6465. if (this.options.showColumns) {
  6466. var $items = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop('disabled', false);
  6467. if (needUpdate) {
  6468. $items.filter(Utils.sprintf('[value="%s"]', index)).prop('checked', checked);
  6469. }
  6470. if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
  6471. $items.filter(':checked').prop('disabled', true);
  6472. }
  6473. }
  6474. }
  6475. }, {
  6476. key: "getVisibleColumns",
  6477. value: function getVisibleColumns() {
  6478. var _this22 = this;
  6479. return this.columns.filter(function (column) {
  6480. return column.visible && !_this22.isSelectionColumn(column);
  6481. });
  6482. }
  6483. }, {
  6484. key: "getHiddenColumns",
  6485. value: function getHiddenColumns() {
  6486. return this.columns.filter(function (_ref7) {
  6487. var visible = _ref7.visible;
  6488. return !visible;
  6489. });
  6490. }
  6491. }, {
  6492. key: "isSelectionColumn",
  6493. value: function isSelectionColumn(column) {
  6494. return column.radio || column.checkbox;
  6495. }
  6496. }, {
  6497. key: "showAllColumns",
  6498. value: function showAllColumns() {
  6499. this._toggleAllColumns(true);
  6500. }
  6501. }, {
  6502. key: "hideAllColumns",
  6503. value: function hideAllColumns() {
  6504. this._toggleAllColumns(false);
  6505. }
  6506. }, {
  6507. key: "_toggleAllColumns",
  6508. value: function _toggleAllColumns(visible) {
  6509. var _this23 = this;
  6510. var _iterator9 = _createForOfIteratorHelper(this.columns.slice().reverse()),
  6511. _step9;
  6512. try {
  6513. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  6514. var column = _step9.value;
  6515. if (column.switchable) {
  6516. if (!visible && this.options.showColumns && this.getVisibleColumns().filter(function (it) {
  6517. return it.switchable;
  6518. }).length === this.options.minimumCountColumns) {
  6519. continue;
  6520. }
  6521. column.visible = visible;
  6522. }
  6523. }
  6524. } catch (err) {
  6525. _iterator9.e(err);
  6526. } finally {
  6527. _iterator9.f();
  6528. }
  6529. this.initHeader();
  6530. this.initSearch();
  6531. this.initPagination();
  6532. this.initBody();
  6533. if (this.options.showColumns) {
  6534. var $items = this.$toolbar.find('.keep-open input[type="checkbox"]:not(".toggle-all")').prop('disabled', false);
  6535. if (visible) {
  6536. $items.prop('checked', visible);
  6537. } else {
  6538. $items.get().reverse().forEach(function (item) {
  6539. if ($items.filter(':checked').length > _this23.options.minimumCountColumns) {
  6540. $__default["default"](item).prop('checked', visible);
  6541. }
  6542. });
  6543. }
  6544. if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
  6545. $items.filter(':checked').prop('disabled', true);
  6546. }
  6547. }
  6548. }
  6549. }, {
  6550. key: "mergeCells",
  6551. value: function mergeCells(options) {
  6552. var row = options.index;
  6553. var col = this.getVisibleFields().indexOf(options.field);
  6554. var rowspan = options.rowspan || 1;
  6555. var colspan = options.colspan || 1;
  6556. var i;
  6557. var j;
  6558. var $tr = this.$body.find('>tr[data-index]');
  6559. col += Utils.getDetailViewIndexOffset(this.options);
  6560. var $td = $tr.eq(row).find('>td').eq(col);
  6561. if (row < 0 || col < 0 || row >= this.data.length) {
  6562. return;
  6563. }
  6564. for (i = row; i < row + rowspan; i++) {
  6565. for (j = col; j < col + colspan; j++) {
  6566. $tr.eq(i).find('>td').eq(j).hide();
  6567. }
  6568. }
  6569. $td.attr('rowspan', rowspan).attr('colspan', colspan).show();
  6570. }
  6571. }, {
  6572. key: "checkAll",
  6573. value: function checkAll() {
  6574. this._toggleCheckAll(true);
  6575. }
  6576. }, {
  6577. key: "uncheckAll",
  6578. value: function uncheckAll() {
  6579. this._toggleCheckAll(false);
  6580. }
  6581. }, {
  6582. key: "_toggleCheckAll",
  6583. value: function _toggleCheckAll(checked) {
  6584. var rowsBefore = this.getSelections();
  6585. this.$selectAll.add(this.$selectAll_).prop('checked', checked);
  6586. this.$selectItem.filter(':enabled').prop('checked', checked);
  6587. this.updateRows();
  6588. this.updateSelected();
  6589. var rowsAfter = this.getSelections();
  6590. if (checked) {
  6591. this.trigger('check-all', rowsAfter, rowsBefore);
  6592. return;
  6593. }
  6594. this.trigger('uncheck-all', rowsAfter, rowsBefore);
  6595. }
  6596. }, {
  6597. key: "checkInvert",
  6598. value: function checkInvert() {
  6599. var $items = this.$selectItem.filter(':enabled');
  6600. var checked = $items.filter(':checked');
  6601. $items.each(function (i, el) {
  6602. $__default["default"](el).prop('checked', !$__default["default"](el).prop('checked'));
  6603. });
  6604. this.updateRows();
  6605. this.updateSelected();
  6606. this.trigger('uncheck-some', checked);
  6607. checked = this.getSelections();
  6608. this.trigger('check-some', checked);
  6609. }
  6610. }, {
  6611. key: "check",
  6612. value: function check(index) {
  6613. this._toggleCheck(true, index);
  6614. }
  6615. }, {
  6616. key: "uncheck",
  6617. value: function uncheck(index) {
  6618. this._toggleCheck(false, index);
  6619. }
  6620. }, {
  6621. key: "_toggleCheck",
  6622. value: function _toggleCheck(checked, index) {
  6623. var $el = this.$selectItem.filter("[data-index=\"".concat(index, "\"]"));
  6624. var row = this.data[index];
  6625. if ($el.is(':radio') || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) {
  6626. var _iterator10 = _createForOfIteratorHelper(this.options.data),
  6627. _step10;
  6628. try {
  6629. for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
  6630. var r = _step10.value;
  6631. r[this.header.stateField] = false;
  6632. }
  6633. } catch (err) {
  6634. _iterator10.e(err);
  6635. } finally {
  6636. _iterator10.f();
  6637. }
  6638. this.$selectItem.filter(':checked').not($el).prop('checked', false);
  6639. }
  6640. row[this.header.stateField] = checked;
  6641. if (this.options.multipleSelectRow) {
  6642. if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0) {
  6643. var _ref8 = this.multipleSelectRowLastSelectedIndex < index ? [this.multipleSelectRowLastSelectedIndex, index] : [index, this.multipleSelectRowLastSelectedIndex],
  6644. _ref9 = _slicedToArray(_ref8, 2),
  6645. fromIndex = _ref9[0],
  6646. toIndex = _ref9[1];
  6647. for (var i = fromIndex + 1; i < toIndex; i++) {
  6648. this.data[i][this.header.stateField] = true;
  6649. this.$selectItem.filter("[data-index=\"".concat(i, "\"]")).prop('checked', true);
  6650. }
  6651. }
  6652. this.multipleSelectRowCtrlKey = false;
  6653. this.multipleSelectRowShiftKey = false;
  6654. this.multipleSelectRowLastSelectedIndex = checked ? index : -1;
  6655. }
  6656. $el.prop('checked', checked);
  6657. this.updateSelected();
  6658. this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el);
  6659. }
  6660. }, {
  6661. key: "checkBy",
  6662. value: function checkBy(obj) {
  6663. this._toggleCheckBy(true, obj);
  6664. }
  6665. }, {
  6666. key: "uncheckBy",
  6667. value: function uncheckBy(obj) {
  6668. this._toggleCheckBy(false, obj);
  6669. }
  6670. }, {
  6671. key: "_toggleCheckBy",
  6672. value: function _toggleCheckBy(checked, obj) {
  6673. var _this24 = this;
  6674. if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) {
  6675. return;
  6676. }
  6677. var rows = [];
  6678. this.data.forEach(function (row, i) {
  6679. if (!row.hasOwnProperty(obj.field)) {
  6680. return false;
  6681. }
  6682. if (obj.values.includes(row[obj.field])) {
  6683. var $el = _this24.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i));
  6684. var onlyCurrentPage = obj.hasOwnProperty('onlyCurrentPage') ? obj.onlyCurrentPage : false;
  6685. $el = checked ? $el.not(':checked') : $el.filter(':checked');
  6686. if (!$el.length && onlyCurrentPage) {
  6687. return;
  6688. }
  6689. $el.prop('checked', checked);
  6690. row[_this24.header.stateField] = checked;
  6691. rows.push(row);
  6692. _this24.trigger(checked ? 'check' : 'uncheck', row, $el);
  6693. }
  6694. });
  6695. this.updateSelected();
  6696. this.trigger(checked ? 'check-some' : 'uncheck-some', rows);
  6697. }
  6698. }, {
  6699. key: "refresh",
  6700. value: function refresh(params) {
  6701. if (params && params.url) {
  6702. this.options.url = params.url;
  6703. }
  6704. if (params && params.pageNumber) {
  6705. this.options.pageNumber = params.pageNumber;
  6706. }
  6707. if (params && params.pageSize) {
  6708. this.options.pageSize = params.pageSize;
  6709. }
  6710. this.trigger('refresh', this.initServer(params && params.silent, params && params.query, params && params.url));
  6711. }
  6712. }, {
  6713. key: "destroy",
  6714. value: function destroy() {
  6715. this.$el.insertBefore(this.$container);
  6716. $__default["default"](this.options.toolbar).insertBefore(this.$el);
  6717. this.$container.next().remove();
  6718. this.$container.remove();
  6719. this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class
  6720. }
  6721. }, {
  6722. key: "resetView",
  6723. value: function resetView(params) {
  6724. var padding = 0;
  6725. if (params && params.height) {
  6726. this.options.height = params.height;
  6727. }
  6728. this.$tableContainer.toggleClass('has-card-view', this.options.cardView);
  6729. if (this.options.height) {
  6730. var fixedBody = this.$tableBody.get(0);
  6731. this.hasScrollBar = fixedBody.scrollWidth > fixedBody.clientWidth;
  6732. }
  6733. if (!this.options.cardView && this.options.showHeader && this.options.height) {
  6734. this.$tableHeader.show();
  6735. this.resetHeader();
  6736. padding += this.$header.outerHeight(true) + 1;
  6737. } else {
  6738. this.$tableHeader.hide();
  6739. this.trigger('post-header');
  6740. }
  6741. if (!this.options.cardView && this.options.showFooter) {
  6742. this.$tableFooter.show();
  6743. this.fitFooter();
  6744. if (this.options.height) {
  6745. padding += this.$tableFooter.outerHeight(true);
  6746. }
  6747. }
  6748. if (this.$container.hasClass('fullscreen')) {
  6749. this.$tableContainer.css('height', '');
  6750. this.$tableContainer.css('width', '');
  6751. } else if (this.options.height) {
  6752. if (this.$tableBorder) {
  6753. this.$tableBorder.css('width', '');
  6754. this.$tableBorder.css('height', '');
  6755. }
  6756. var toolbarHeight = this.$toolbar.outerHeight(true);
  6757. var paginationHeight = this.$pagination.outerHeight(true);
  6758. var height = this.options.height - toolbarHeight - paginationHeight;
  6759. var $bodyTable = this.$tableBody.find('>table');
  6760. var tableHeight = $bodyTable.outerHeight();
  6761. this.$tableContainer.css('height', "".concat(height, "px"));
  6762. if (this.$tableBorder && $bodyTable.is(':visible')) {
  6763. var tableBorderHeight = height - tableHeight - 2;
  6764. if (this.hasScrollBar) {
  6765. tableBorderHeight -= Utils.getScrollBarWidth();
  6766. }
  6767. this.$tableBorder.css('width', "".concat($bodyTable.outerWidth(), "px"));
  6768. this.$tableBorder.css('height', "".concat(tableBorderHeight, "px"));
  6769. }
  6770. }
  6771. if (this.options.cardView) {
  6772. // remove the element css
  6773. this.$el.css('margin-top', '0');
  6774. this.$tableContainer.css('padding-bottom', '0');
  6775. this.$tableFooter.hide();
  6776. } else {
  6777. // Assign the correct sortable arrow
  6778. this.getCaret();
  6779. this.$tableContainer.css('padding-bottom', "".concat(padding, "px"));
  6780. }
  6781. this.trigger('reset-view');
  6782. }
  6783. }, {
  6784. key: "showLoading",
  6785. value: function showLoading() {
  6786. this.$tableLoading.toggleClass('open', true);
  6787. var fontSize = this.options.loadingFontSize;
  6788. if (this.options.loadingFontSize === 'auto') {
  6789. fontSize = this.$tableLoading.width() * 0.04;
  6790. fontSize = Math.max(12, fontSize);
  6791. fontSize = Math.min(32, fontSize);
  6792. fontSize = "".concat(fontSize, "px");
  6793. }
  6794. this.$tableLoading.find('.loading-text').css('font-size', fontSize);
  6795. }
  6796. }, {
  6797. key: "hideLoading",
  6798. value: function hideLoading() {
  6799. this.$tableLoading.toggleClass('open', false);
  6800. }
  6801. }, {
  6802. key: "togglePagination",
  6803. value: function togglePagination() {
  6804. this.options.pagination = !this.options.pagination;
  6805. var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : '';
  6806. var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : '';
  6807. this.$toolbar.find('button[name="paginationSwitch"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text));
  6808. this.updatePagination();
  6809. this.trigger('toggle-pagination', this.options.pagination);
  6810. }
  6811. }, {
  6812. key: "toggleFullscreen",
  6813. value: function toggleFullscreen() {
  6814. this.$el.closest('.bootstrap-table').toggleClass('fullscreen');
  6815. this.resetView();
  6816. }
  6817. }, {
  6818. key: "toggleView",
  6819. value: function toggleView() {
  6820. this.options.cardView = !this.options.cardView;
  6821. this.initHeader();
  6822. var icon = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : '';
  6823. var text = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : '';
  6824. this.$toolbar.find('button[name="toggle"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text));
  6825. this.initBody();
  6826. this.trigger('toggle', this.options.cardView);
  6827. }
  6828. }, {
  6829. key: "resetSearch",
  6830. value: function resetSearch(text) {
  6831. var $search = Utils.getSearchInput(this);
  6832. var textToUse = text || '';
  6833. $search.val(textToUse);
  6834. this.searchText = textToUse;
  6835. this.onSearch({
  6836. currentTarget: $search
  6837. }, false);
  6838. }
  6839. }, {
  6840. key: "filterBy",
  6841. value: function filterBy(columns, options) {
  6842. this.filterOptions = Utils.isEmptyObject(options) ? this.options.filterOptions : $__default["default"].extend(this.options.filterOptions, options);
  6843. this.filterColumns = Utils.isEmptyObject(columns) ? {} : columns;
  6844. this.options.pageNumber = 1;
  6845. this.initSearch();
  6846. this.updatePagination();
  6847. }
  6848. }, {
  6849. key: "scrollTo",
  6850. value: function scrollTo(params) {
  6851. var options = {
  6852. unit: 'px',
  6853. value: 0
  6854. };
  6855. if (_typeof(params) === 'object') {
  6856. options = Object.assign(options, params);
  6857. } else if (typeof params === 'string' && params === 'bottom') {
  6858. options.value = this.$tableBody[0].scrollHeight;
  6859. } else if (typeof params === 'string' || typeof params === 'number') {
  6860. options.value = params;
  6861. }
  6862. var scrollTo = options.value;
  6863. if (options.unit === 'rows') {
  6864. scrollTo = 0;
  6865. this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) {
  6866. scrollTo += $__default["default"](el).outerHeight(true);
  6867. });
  6868. }
  6869. this.$tableBody.scrollTop(scrollTo);
  6870. }
  6871. }, {
  6872. key: "getScrollPosition",
  6873. value: function getScrollPosition() {
  6874. return this.$tableBody.scrollTop();
  6875. }
  6876. }, {
  6877. key: "selectPage",
  6878. value: function selectPage(page) {
  6879. if (page > 0 && page <= this.options.totalPages) {
  6880. this.options.pageNumber = page;
  6881. this.updatePagination();
  6882. }
  6883. }
  6884. }, {
  6885. key: "prevPage",
  6886. value: function prevPage() {
  6887. if (this.options.pageNumber > 1) {
  6888. this.options.pageNumber--;
  6889. this.updatePagination();
  6890. }
  6891. }
  6892. }, {
  6893. key: "nextPage",
  6894. value: function nextPage() {
  6895. if (this.options.pageNumber < this.options.totalPages) {
  6896. this.options.pageNumber++;
  6897. this.updatePagination();
  6898. }
  6899. }
  6900. }, {
  6901. key: "toggleDetailView",
  6902. value: function toggleDetailView(index, _columnDetailFormatter) {
  6903. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"]', index));
  6904. if ($tr.next().is('tr.detail-view')) {
  6905. this.collapseRow(index);
  6906. } else {
  6907. this.expandRow(index, _columnDetailFormatter);
  6908. }
  6909. this.resetView();
  6910. }
  6911. }, {
  6912. key: "expandRow",
  6913. value: function expandRow(index, _columnDetailFormatter) {
  6914. var row = this.data[index];
  6915. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
  6916. if (this.options.detailViewIcon) {
  6917. $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose));
  6918. }
  6919. if ($tr.next().is('tr.detail-view')) {
  6920. return;
  6921. }
  6922. $tr.after(Utils.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.children('td').length));
  6923. var $element = $tr.next().find('td');
  6924. var detailFormatter = _columnDetailFormatter || this.options.detailFormatter;
  6925. var content = Utils.calculateObjectValue(this.options, detailFormatter, [index, row, $element], '');
  6926. if ($element.length === 1) {
  6927. $element.append(content);
  6928. }
  6929. this.trigger('expand-row', index, row, $element);
  6930. }
  6931. }, {
  6932. key: "expandRowByUniqueId",
  6933. value: function expandRowByUniqueId(uniqueId) {
  6934. var row = this.getRowByUniqueId(uniqueId);
  6935. if (!row) {
  6936. return;
  6937. }
  6938. this.expandRow(this.data.indexOf(row));
  6939. }
  6940. }, {
  6941. key: "collapseRow",
  6942. value: function collapseRow(index) {
  6943. var row = this.data[index];
  6944. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
  6945. if (!$tr.next().is('tr.detail-view')) {
  6946. return;
  6947. }
  6948. if (this.options.detailViewIcon) {
  6949. $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen));
  6950. }
  6951. this.trigger('collapse-row', index, row, $tr.next());
  6952. $tr.next().remove();
  6953. }
  6954. }, {
  6955. key: "collapseRowByUniqueId",
  6956. value: function collapseRowByUniqueId(uniqueId) {
  6957. var row = this.getRowByUniqueId(uniqueId);
  6958. if (!row) {
  6959. return;
  6960. }
  6961. this.collapseRow(this.data.indexOf(row));
  6962. }
  6963. }, {
  6964. key: "expandAllRows",
  6965. value: function expandAllRows() {
  6966. var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
  6967. for (var i = 0; i < trs.length; i++) {
  6968. this.expandRow($__default["default"](trs[i]).data('index'));
  6969. }
  6970. }
  6971. }, {
  6972. key: "collapseAllRows",
  6973. value: function collapseAllRows() {
  6974. var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
  6975. for (var i = 0; i < trs.length; i++) {
  6976. this.collapseRow($__default["default"](trs[i]).data('index'));
  6977. }
  6978. }
  6979. }, {
  6980. key: "updateColumnTitle",
  6981. value: function updateColumnTitle(params) {
  6982. if (!params.hasOwnProperty('field') || !params.hasOwnProperty('title')) {
  6983. return;
  6984. }
  6985. this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape ? Utils.escapeHTML(params.title) : params.title;
  6986. if (this.columns[this.fieldsColumnsIndex[params.field]].visible) {
  6987. this.$header.find('th[data-field]').each(function (i, el) {
  6988. if ($__default["default"](el).data('field') === params.field) {
  6989. $__default["default"]($__default["default"](el).find('.th-inner')[0]).text(params.title);
  6990. return false;
  6991. }
  6992. });
  6993. this.resetView();
  6994. }
  6995. }
  6996. }, {
  6997. key: "updateFormatText",
  6998. value: function updateFormatText(formatName, text) {
  6999. if (!/^format/.test(formatName) || !this.options[formatName]) {
  7000. return;
  7001. }
  7002. if (typeof text === 'string') {
  7003. this.options[formatName] = function () {
  7004. return text;
  7005. };
  7006. } else if (typeof text === 'function') {
  7007. this.options[formatName] = text;
  7008. }
  7009. this.initToolbar();
  7010. this.initPagination();
  7011. this.initBody();
  7012. }
  7013. }]);
  7014. return BootstrapTable;
  7015. }();
  7016. BootstrapTable.VERSION = Constants.VERSION;
  7017. BootstrapTable.DEFAULTS = Constants.DEFAULTS;
  7018. BootstrapTable.LOCALES = Constants.LOCALES;
  7019. BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS;
  7020. BootstrapTable.METHODS = Constants.METHODS;
  7021. BootstrapTable.EVENTS = Constants.EVENTS; // BOOTSTRAP TABLE PLUGIN DEFINITION
  7022. // =======================
  7023. $__default["default"].BootstrapTable = BootstrapTable;
  7024. $__default["default"].fn.bootstrapTable = function (option) {
  7025. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key5 = 1; _key5 < _len2; _key5++) {
  7026. args[_key5 - 1] = arguments[_key5];
  7027. }
  7028. var value;
  7029. this.each(function (i, el) {
  7030. var data = $__default["default"](el).data('bootstrap.table');
  7031. var options = $__default["default"].extend({}, BootstrapTable.DEFAULTS, $__default["default"](el).data(), _typeof(option) === 'object' && option);
  7032. if (typeof option === 'string') {
  7033. var _data2;
  7034. if (!Constants.METHODS.includes(option)) {
  7035. throw new Error("Unknown method: ".concat(option));
  7036. }
  7037. if (!data) {
  7038. return;
  7039. }
  7040. value = (_data2 = data)[option].apply(_data2, args);
  7041. if (option === 'destroy') {
  7042. $__default["default"](el).removeData('bootstrap.table');
  7043. }
  7044. }
  7045. if (!data) {
  7046. data = new $__default["default"].BootstrapTable(el, options);
  7047. $__default["default"](el).data('bootstrap.table', data);
  7048. data.init();
  7049. }
  7050. });
  7051. return typeof value === 'undefined' ? this : value;
  7052. };
  7053. $__default["default"].fn.bootstrapTable.Constructor = BootstrapTable;
  7054. $__default["default"].fn.bootstrapTable.theme = Constants.THEME;
  7055. $__default["default"].fn.bootstrapTable.VERSION = Constants.VERSION;
  7056. $__default["default"].fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS;
  7057. $__default["default"].fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;
  7058. $__default["default"].fn.bootstrapTable.events = BootstrapTable.EVENTS;
  7059. $__default["default"].fn.bootstrapTable.locales = BootstrapTable.LOCALES;
  7060. $__default["default"].fn.bootstrapTable.methods = BootstrapTable.METHODS;
  7061. $__default["default"].fn.bootstrapTable.utils = Utils; // BOOTSTRAP TABLE INIT
  7062. // =======================
  7063. $__default["default"](function () {
  7064. $__default["default"]('[data-toggle="table"]').bootstrapTable();
  7065. });
  7066. return BootstrapTable;
  7067. }));