index.js 1.3 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  3. typeof define === 'function' && define.amd ? define(['exports'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.wangEditor = {}));
  5. })(this, (function (exports) { 'use strict';
  6. /**
  7. * @description browser polyfill
  8. * @author wangfupeng
  9. */
  10. var _a;
  11. // @ts-nocheck
  12. // 必须是浏览器环境
  13. if (typeof global === 'undefined') {
  14. // 检查 IE 浏览器
  15. if ('ActiveXObject' in window) {
  16. var info = '抱歉,wangEditor V5+ 版本开始,不在支持 IE 浏览器';
  17. info += '\n Sorry, wangEditor V5+ versions do not support IE browser.';
  18. console.error(info);
  19. }
  20. globalThisPolyfill();
  21. AggregateErrorPolyfill();
  22. }
  23. else if (global && ((_a = global.navigator) === null || _a === void 0 ? void 0 : _a.userAgent.match('QQBrowser'))) {
  24. // 兼容 QQ 浏览器 AggregateError 报错
  25. globalThisPolyfill();
  26. AggregateErrorPolyfill();
  27. }
  28. function globalThisPolyfill() {
  29. // 部分浏览器不支持 globalThis
  30. if (typeof globalThis === 'undefined') {
  31. // @ts-ignore
  32. window.globalThis = window;
  33. }
  34. }
  35. function AggregateErrorPolyfill() {
  36. if (typeof AggregateError === 'undefined') {
  37. window.AggregateError = function (errors, msg) {
  38. var err = new Error(msg);
  39. err.errors = errors;
  40. return err;
  41. };
  42. }
  43. }
  44. /**
  45. * @description node polyfill
  46. * @author wangfupeng
  47. */
  48. // @ts-nocheck
  49. // 必须是 node 环境
  50. if (typeof global === 'object') {
  51. // 用于 nodejs ,避免报错
  52. var globalProperty = Object.getOwnPropertyDescriptor(global, 'window');
  53. // global.window 为空则直接写入
  54. // 部分框架下已经定义了global.window且是不可写属性
  55. if (!global.window || globalProperty.set) {
  56. global.window = global;
  57. global.requestAnimationFrame = function () { };
  58. global.navigator = {
  59. userAgent: '',
  60. };
  61. global.location = {
  62. hostname: '0.0.0.0',
  63. port: 0,
  64. protocol: 'http:',
  65. };
  66. global.btoa = function () { };
  67. global.crypto = {
  68. getRandomValues: function (buffer) {
  69. return nodeCrypto.randomFillSync(buffer);
  70. },
  71. };
  72. }
  73. if (global.document != null) {
  74. // SSR 环境下可能会报错 (issue 4409)
  75. if (global.document.getElementsByTagName == null) {
  76. global.document.getElementsByTagName = function () { return []; };
  77. }
  78. }
  79. }
  80. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  81. function getDefaultExportFromCjs (x) {
  82. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  83. }
  84. function createCommonjsModule$1(fn) {
  85. var module = { exports: {} };
  86. return fn(module, module.exports), module.exports;
  87. }
  88. /*!
  89. * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
  90. *
  91. * Copyright (c) 2014-2017, Jon Schlinkert.
  92. * Released under the MIT License.
  93. */
  94. function isObject$4(o) {
  95. return Object.prototype.toString.call(o) === '[object Object]';
  96. }
  97. function isPlainObject$2(o) {
  98. var ctor,prot;
  99. if (isObject$4(o) === false) return false;
  100. // If has modified constructor
  101. ctor = o.constructor;
  102. if (ctor === undefined) return true;
  103. // If has modified prototype
  104. prot = ctor.prototype;
  105. if (isObject$4(prot) === false) return false;
  106. // If constructor does not have an Object-specific method
  107. if (prot.hasOwnProperty('isPrototypeOf') === false) {
  108. return false;
  109. }
  110. // Most likely a plain Object
  111. return true;
  112. }
  113. var isPlainObject_2 = isPlainObject$2;
  114. var isPlainObject_1 = /*#__PURE__*/Object.defineProperty({
  115. isPlainObject: isPlainObject_2
  116. }, '__esModule', {value: true});
  117. var _ref;
  118. // Should be no imports here!
  119. // Some things that should be evaluated before all else...
  120. // We only want to know if non-polyfilled symbols are available
  121. var hasSymbol = typeof Symbol !== "undefined" && typeof
  122. /*#__PURE__*/
  123. Symbol("x") === "symbol";
  124. var hasMap = typeof Map !== "undefined";
  125. var hasSet = typeof Set !== "undefined";
  126. var hasProxies = typeof Proxy !== "undefined" && typeof Proxy.revocable !== "undefined" && typeof Reflect !== "undefined";
  127. /**
  128. * The sentinel value returned by producers to replace the draft with undefined.
  129. */
  130. var NOTHING = hasSymbol ?
  131. /*#__PURE__*/
  132. Symbol.for("immer-nothing") : (_ref = {}, _ref["immer-nothing"] = true, _ref);
  133. /**
  134. * To let Immer treat your class instances as plain immutable objects
  135. * (albeit with a custom prototype), you must define either an instance property
  136. * or a static property on each of your custom classes.
  137. *
  138. * Otherwise, your class instance will never be drafted, which means it won't be
  139. * safe to mutate in a produce callback.
  140. */
  141. var DRAFTABLE = hasSymbol ?
  142. /*#__PURE__*/
  143. Symbol.for("immer-draftable") : "__$immer_draftable";
  144. var DRAFT_STATE = hasSymbol ?
  145. /*#__PURE__*/
  146. Symbol.for("immer-state") : "__$immer_state"; // Even a polyfilled Symbol might provide Symbol.iterator
  147. var iteratorSymbol$1 = typeof Symbol != "undefined" && Symbol.iterator || "@@iterator";
  148. var errors = {
  149. 0: "Illegal state",
  150. 1: "Immer drafts cannot have computed properties",
  151. 2: "This object has been frozen and should not be mutated",
  152. 3: function _(data) {
  153. return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
  154. },
  155. 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
  156. 5: "Immer forbids circular references",
  157. 6: "The first or second argument to `produce` must be a function",
  158. 7: "The third argument to `produce` must be a function or undefined",
  159. 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object",
  160. 9: "First argument to `finishDraft` must be a draft returned by `createDraft`",
  161. 10: "The given draft is already finalized",
  162. 11: "Object.defineProperty() cannot be used on an Immer draft",
  163. 12: "Object.setPrototypeOf() cannot be used on an Immer draft",
  164. 13: "Immer only supports deleting array indices",
  165. 14: "Immer only supports setting array indices and the 'length' property",
  166. 15: function _(path) {
  167. return "Cannot apply patch, path doesn't resolve: " + path;
  168. },
  169. 16: 'Sets cannot have "replace" patches.',
  170. 17: function _(op) {
  171. return "Unsupported patch operation: " + op;
  172. },
  173. 18: function _(plugin) {
  174. return "The plugin for '" + plugin + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + plugin + "()` when initializing your application.";
  175. },
  176. 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",
  177. 21: function _(thing) {
  178. return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '" + thing + "'";
  179. },
  180. 22: function _(thing) {
  181. return "'current' expects a draft, got: " + thing;
  182. },
  183. 23: function _(thing) {
  184. return "'original' expects a draft, got: " + thing;
  185. },
  186. 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed"
  187. };
  188. function die(error) {
  189. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  190. args[_key - 1] = arguments[_key];
  191. }
  192. {
  193. var e = errors[error];
  194. var msg = !e ? "unknown error nr: " + error : typeof e === "function" ? e.apply(null, args) : e;
  195. throw new Error("[Immer] " + msg);
  196. }
  197. }
  198. /** Returns true if the given value is an Immer draft */
  199. function isDraft(value) {
  200. return !!value && !!value[DRAFT_STATE];
  201. }
  202. /** Returns true if the given value can be drafted by Immer */
  203. function isDraftable(value) {
  204. if (!value) return false;
  205. return isPlainObject$1(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE] || isMap(value) || isSet(value);
  206. }
  207. var objectCtorString =
  208. /*#__PURE__*/
  209. Object.prototype.constructor.toString();
  210. function isPlainObject$1(value) {
  211. if (!value || typeof value !== "object") return false;
  212. var proto = Object.getPrototypeOf(value);
  213. if (proto === null) {
  214. return true;
  215. }
  216. var Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
  217. if (Ctor === Object) return true;
  218. return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString;
  219. }
  220. function original(value) {
  221. if (!isDraft(value)) die(23, value);
  222. return value[DRAFT_STATE].base_;
  223. }
  224. var ownKeys$a = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) {
  225. return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));
  226. } :
  227. /* istanbul ignore next */
  228. Object.getOwnPropertyNames;
  229. var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {
  230. // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274
  231. var res = {};
  232. ownKeys$a(target).forEach(function (key) {
  233. res[key] = Object.getOwnPropertyDescriptor(target, key);
  234. });
  235. return res;
  236. };
  237. function each$1(obj, iter, enumerableOnly) {
  238. if (enumerableOnly === void 0) {
  239. enumerableOnly = false;
  240. }
  241. if (getArchtype(obj) === 0
  242. /* Object */
  243. ) {
  244. (enumerableOnly ? Object.keys : ownKeys$a)(obj).forEach(function (key) {
  245. if (!enumerableOnly || typeof key !== "symbol") iter(key, obj[key], obj);
  246. });
  247. } else {
  248. obj.forEach(function (entry, index) {
  249. return iter(index, entry, obj);
  250. });
  251. }
  252. }
  253. function getArchtype(thing) {
  254. /* istanbul ignore next */
  255. var state = thing[DRAFT_STATE];
  256. return state ? state.type_ > 3 ? state.type_ - 4 // cause Object and Array map back from 4 and 5
  257. : state.type_ // others are the same
  258. : Array.isArray(thing) ? 1
  259. /* Array */
  260. : isMap(thing) ? 2
  261. /* Map */
  262. : isSet(thing) ? 3
  263. /* Set */
  264. : 0
  265. /* Object */
  266. ;
  267. }
  268. function has(thing, prop) {
  269. return getArchtype(thing) === 2
  270. /* Map */
  271. ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
  272. }
  273. function get(thing, prop) {
  274. // @ts-ignore
  275. return getArchtype(thing) === 2
  276. /* Map */
  277. ? thing.get(prop) : thing[prop];
  278. }
  279. function set(thing, propOrOldValue, value) {
  280. var t = getArchtype(thing);
  281. if (t === 2
  282. /* Map */
  283. ) thing.set(propOrOldValue, value);else if (t === 3
  284. /* Set */
  285. ) {
  286. thing.delete(propOrOldValue);
  287. thing.add(value);
  288. } else thing[propOrOldValue] = value;
  289. }
  290. function is$1(x, y) {
  291. // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
  292. if (x === y) {
  293. return x !== 0 || 1 / x === 1 / y;
  294. } else {
  295. return x !== x && y !== y;
  296. }
  297. }
  298. function isMap(target) {
  299. return hasMap && target instanceof Map;
  300. }
  301. function isSet(target) {
  302. return hasSet && target instanceof Set;
  303. }
  304. function latest(state) {
  305. return state.copy_ || state.base_;
  306. }
  307. function shallowCopy(base) {
  308. if (Array.isArray(base)) return Array.prototype.slice.call(base);
  309. var descriptors = getOwnPropertyDescriptors(base);
  310. delete descriptors[DRAFT_STATE];
  311. var keys = ownKeys$a(descriptors);
  312. for (var i = 0; i < keys.length; i++) {
  313. var key = keys[i];
  314. var desc = descriptors[key];
  315. if (desc.writable === false) {
  316. desc.writable = true;
  317. desc.configurable = true;
  318. } // like object.assign, we will read any _own_, get/set accessors. This helps in dealing
  319. // with libraries that trap values, like mobx or vue
  320. // unlike object.assign, non-enumerables will be copied as well
  321. if (desc.get || desc.set) descriptors[key] = {
  322. configurable: true,
  323. writable: true,
  324. enumerable: desc.enumerable,
  325. value: base[key]
  326. };
  327. }
  328. return Object.create(Object.getPrototypeOf(base), descriptors);
  329. }
  330. function freeze(obj, deep) {
  331. if (deep === void 0) {
  332. deep = false;
  333. }
  334. if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj;
  335. if (getArchtype(obj) > 1
  336. /* Map or Set */
  337. ) {
  338. obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections;
  339. }
  340. Object.freeze(obj);
  341. if (deep) each$1(obj, function (key, value) {
  342. return freeze(value, true);
  343. }, true);
  344. return obj;
  345. }
  346. function dontMutateFrozenCollections() {
  347. die(2);
  348. }
  349. function isFrozen(obj) {
  350. if (obj == null || typeof obj !== "object") return true; // See #600, IE dies on non-objects in Object.isFrozen
  351. return Object.isFrozen(obj);
  352. }
  353. /** Plugin utilities */
  354. var plugins = {};
  355. function getPlugin(pluginKey) {
  356. var plugin = plugins[pluginKey];
  357. if (!plugin) {
  358. die(18, pluginKey);
  359. } // @ts-ignore
  360. return plugin;
  361. }
  362. function loadPlugin(pluginKey, implementation) {
  363. if (!plugins[pluginKey]) plugins[pluginKey] = implementation;
  364. }
  365. var currentScope;
  366. function getCurrentScope() {
  367. if ( !currentScope) die(0);
  368. return currentScope;
  369. }
  370. function createScope(parent_, immer_) {
  371. return {
  372. drafts_: [],
  373. parent_: parent_,
  374. immer_: immer_,
  375. // Whenever the modified draft contains a draft from another scope, we
  376. // need to prevent auto-freezing so the unowned draft can be finalized.
  377. canAutoFreeze_: true,
  378. unfinalizedDrafts_: 0
  379. };
  380. }
  381. function usePatchesInScope(scope, patchListener) {
  382. if (patchListener) {
  383. getPlugin("Patches"); // assert we have the plugin
  384. scope.patches_ = [];
  385. scope.inversePatches_ = [];
  386. scope.patchListener_ = patchListener;
  387. }
  388. }
  389. function revokeScope(scope) {
  390. leaveScope(scope);
  391. scope.drafts_.forEach(revokeDraft); // @ts-ignore
  392. scope.drafts_ = null;
  393. }
  394. function leaveScope(scope) {
  395. if (scope === currentScope) {
  396. currentScope = scope.parent_;
  397. }
  398. }
  399. function enterScope(immer) {
  400. return currentScope = createScope(currentScope, immer);
  401. }
  402. function revokeDraft(draft) {
  403. var state = draft[DRAFT_STATE];
  404. if (state.type_ === 0
  405. /* ProxyObject */
  406. || state.type_ === 1
  407. /* ProxyArray */
  408. ) state.revoke_();else state.revoked_ = true;
  409. }
  410. function processResult(result, scope) {
  411. scope.unfinalizedDrafts_ = scope.drafts_.length;
  412. var baseDraft = scope.drafts_[0];
  413. var isReplaced = result !== undefined && result !== baseDraft;
  414. if (!scope.immer_.useProxies_) getPlugin("ES5").willFinalizeES5_(scope, result, isReplaced);
  415. if (isReplaced) {
  416. if (baseDraft[DRAFT_STATE].modified_) {
  417. revokeScope(scope);
  418. die(4);
  419. }
  420. if (isDraftable(result)) {
  421. // Finalize the result in case it contains (or is) a subset of the draft.
  422. result = finalize(scope, result);
  423. if (!scope.parent_) maybeFreeze(scope, result);
  424. }
  425. if (scope.patches_) {
  426. getPlugin("Patches").generateReplacementPatches_(baseDraft[DRAFT_STATE], result, scope.patches_, scope.inversePatches_);
  427. }
  428. } else {
  429. // Finalize the base draft.
  430. result = finalize(scope, baseDraft, []);
  431. }
  432. revokeScope(scope);
  433. if (scope.patches_) {
  434. scope.patchListener_(scope.patches_, scope.inversePatches_);
  435. }
  436. return result !== NOTHING ? result : undefined;
  437. }
  438. function finalize(rootScope, value, path) {
  439. // Don't recurse in tho recursive data structures
  440. if (isFrozen(value)) return value;
  441. var state = value[DRAFT_STATE]; // A plain object, might need freezing, might contain drafts
  442. if (!state) {
  443. each$1(value, function (key, childValue) {
  444. return finalizeProperty(rootScope, state, value, key, childValue, path);
  445. }, true // See #590, don't recurse into non-enumerable of non drafted objects
  446. );
  447. return value;
  448. } // Never finalize drafts owned by another scope.
  449. if (state.scope_ !== rootScope) return value; // Unmodified draft, return the (frozen) original
  450. if (!state.modified_) {
  451. maybeFreeze(rootScope, state.base_, true);
  452. return state.base_;
  453. } // Not finalized yet, let's do that now
  454. if (!state.finalized_) {
  455. state.finalized_ = true;
  456. state.scope_.unfinalizedDrafts_--;
  457. var result = // For ES5, create a good copy from the draft first, with added keys and without deleted keys.
  458. state.type_ === 4
  459. /* ES5Object */
  460. || state.type_ === 5
  461. /* ES5Array */
  462. ? state.copy_ = shallowCopy(state.draft_) : state.copy_; // Finalize all children of the copy
  463. // For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628
  464. // Although the original test case doesn't seem valid anyway, so if this in the way we can turn the next line
  465. // back to each(result, ....)
  466. each$1(state.type_ === 3
  467. /* Set */
  468. ? new Set(result) : result, function (key, childValue) {
  469. return finalizeProperty(rootScope, state, result, key, childValue, path);
  470. }); // everything inside is frozen, we can freeze here
  471. maybeFreeze(rootScope, result, false); // first time finalizing, let's create those patches
  472. if (path && rootScope.patches_) {
  473. getPlugin("Patches").generatePatches_(state, path, rootScope.patches_, rootScope.inversePatches_);
  474. }
  475. }
  476. return state.copy_;
  477. }
  478. function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath) {
  479. if ( childValue === targetObject) die(5);
  480. if (isDraft(childValue)) {
  481. var path = rootPath && parentState && parentState.type_ !== 3
  482. /* Set */
  483. && // Set objects are atomic since they have no keys.
  484. !has(parentState.assigned_, prop) // Skip deep patches for assigned keys.
  485. ? rootPath.concat(prop) : undefined; // Drafts owned by `scope` are finalized here.
  486. var res = finalize(rootScope, childValue, path);
  487. set(targetObject, prop, res); // Drafts from another scope must prevented to be frozen
  488. // if we got a draft back from finalize, we're in a nested produce and shouldn't freeze
  489. if (isDraft(res)) {
  490. rootScope.canAutoFreeze_ = false;
  491. } else return;
  492. } // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.
  493. if (isDraftable(childValue) && !isFrozen(childValue)) {
  494. if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
  495. // optimization: if an object is not a draft, and we don't have to
  496. // deepfreeze everything, and we are sure that no drafts are left in the remaining object
  497. // cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.
  498. // This benefits especially adding large data tree's without further processing.
  499. // See add-data.js perf test
  500. return;
  501. }
  502. finalize(rootScope, childValue); // immer deep freezes plain objects, so if there is no parent state, we freeze as well
  503. if (!parentState || !parentState.scope_.parent_) maybeFreeze(rootScope, childValue);
  504. }
  505. }
  506. function maybeFreeze(scope, value, deep) {
  507. if (deep === void 0) {
  508. deep = false;
  509. }
  510. if (scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
  511. freeze(value, deep);
  512. }
  513. }
  514. /**
  515. * Returns a new draft of the `base` object.
  516. *
  517. * The second argument is the parent draft-state (used internally).
  518. */
  519. function createProxyProxy(base, parent) {
  520. var isArray = Array.isArray(base);
  521. var state = {
  522. type_: isArray ? 1
  523. /* ProxyArray */
  524. : 0
  525. /* ProxyObject */
  526. ,
  527. // Track which produce call this is associated with.
  528. scope_: parent ? parent.scope_ : getCurrentScope(),
  529. // True for both shallow and deep changes.
  530. modified_: false,
  531. // Used during finalization.
  532. finalized_: false,
  533. // Track which properties have been assigned (true) or deleted (false).
  534. assigned_: {},
  535. // The parent draft state.
  536. parent_: parent,
  537. // The base state.
  538. base_: base,
  539. // The base proxy.
  540. draft_: null,
  541. // The base copy with any updated values.
  542. copy_: null,
  543. // Called by the `produce` function.
  544. revoke_: null,
  545. isManual_: false
  546. }; // the traps must target something, a bit like the 'real' base.
  547. // but also, we need to be able to determine from the target what the relevant state is
  548. // (to avoid creating traps per instance to capture the state in closure,
  549. // and to avoid creating weird hidden properties as well)
  550. // So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)
  551. // Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb
  552. var target = state;
  553. var traps = objectTraps;
  554. if (isArray) {
  555. target = [state];
  556. traps = arrayTraps;
  557. }
  558. var _Proxy$revocable = Proxy.revocable(target, traps),
  559. revoke = _Proxy$revocable.revoke,
  560. proxy = _Proxy$revocable.proxy;
  561. state.draft_ = proxy;
  562. state.revoke_ = revoke;
  563. return proxy;
  564. }
  565. /**
  566. * Object drafts
  567. */
  568. var objectTraps = {
  569. get: function get(state, prop) {
  570. if (prop === DRAFT_STATE) return state;
  571. var source = latest(state);
  572. if (!has(source, prop)) {
  573. // non-existing or non-own property...
  574. return readPropFromProto(state, source, prop);
  575. }
  576. var value = source[prop];
  577. if (state.finalized_ || !isDraftable(value)) {
  578. return value;
  579. } // Check for existing draft in modified state.
  580. // Assigned values are never drafted. This catches any drafts we created, too.
  581. if (value === peek(state.base_, prop)) {
  582. prepareCopy(state);
  583. return state.copy_[prop] = createProxy(state.scope_.immer_, value, state);
  584. }
  585. return value;
  586. },
  587. has: function has(state, prop) {
  588. return prop in latest(state);
  589. },
  590. ownKeys: function ownKeys(state) {
  591. return Reflect.ownKeys(latest(state));
  592. },
  593. set: function set(state, prop
  594. /* strictly not, but helps TS */
  595. , value) {
  596. var desc = getDescriptorFromProto(latest(state), prop);
  597. if (desc === null || desc === void 0 ? void 0 : desc.set) {
  598. // special case: if this write is captured by a setter, we have
  599. // to trigger it with the correct context
  600. desc.set.call(state.draft_, value);
  601. return true;
  602. }
  603. if (!state.modified_) {
  604. // the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)
  605. // from setting an existing property with value undefined to undefined (which is not a change)
  606. var current = peek(latest(state), prop); // special case, if we assigning the original value to a draft, we can ignore the assignment
  607. var currentState = current === null || current === void 0 ? void 0 : current[DRAFT_STATE];
  608. if (currentState && currentState.base_ === value) {
  609. state.copy_[prop] = value;
  610. state.assigned_[prop] = false;
  611. return true;
  612. }
  613. if (is$1(value, current) && (value !== undefined || has(state.base_, prop))) return true;
  614. prepareCopy(state);
  615. markChanged(state);
  616. }
  617. if (state.copy_[prop] === value && // special case: NaN
  618. typeof value !== "number" && ( // special case: handle new props with value 'undefined'
  619. value !== undefined || prop in state.copy_)) return true; // @ts-ignore
  620. state.copy_[prop] = value;
  621. state.assigned_[prop] = true;
  622. return true;
  623. },
  624. deleteProperty: function deleteProperty(state, prop) {
  625. // The `undefined` check is a fast path for pre-existing keys.
  626. if (peek(state.base_, prop) !== undefined || prop in state.base_) {
  627. state.assigned_[prop] = false;
  628. prepareCopy(state);
  629. markChanged(state);
  630. } else {
  631. // if an originally not assigned property was deleted
  632. delete state.assigned_[prop];
  633. } // @ts-ignore
  634. if (state.copy_) delete state.copy_[prop];
  635. return true;
  636. },
  637. // Note: We never coerce `desc.value` into an Immer draft, because we can't make
  638. // the same guarantee in ES5 mode.
  639. getOwnPropertyDescriptor: function getOwnPropertyDescriptor(state, prop) {
  640. var owner = latest(state);
  641. var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
  642. if (!desc) return desc;
  643. return {
  644. writable: true,
  645. configurable: state.type_ !== 1
  646. /* ProxyArray */
  647. || prop !== "length",
  648. enumerable: desc.enumerable,
  649. value: owner[prop]
  650. };
  651. },
  652. defineProperty: function defineProperty() {
  653. die(11);
  654. },
  655. getPrototypeOf: function getPrototypeOf(state) {
  656. return Object.getPrototypeOf(state.base_);
  657. },
  658. setPrototypeOf: function setPrototypeOf() {
  659. die(12);
  660. }
  661. };
  662. /**
  663. * Array drafts
  664. */
  665. var arrayTraps = {};
  666. each$1(objectTraps, function (key, fn) {
  667. // @ts-ignore
  668. arrayTraps[key] = function () {
  669. arguments[0] = arguments[0][0];
  670. return fn.apply(this, arguments);
  671. };
  672. });
  673. arrayTraps.deleteProperty = function (state, prop) {
  674. if ( isNaN(parseInt(prop))) die(13);
  675. return objectTraps.deleteProperty.call(this, state[0], prop);
  676. };
  677. arrayTraps.set = function (state, prop, value) {
  678. if ( prop !== "length" && isNaN(parseInt(prop))) die(14);
  679. return objectTraps.set.call(this, state[0], prop, value, state[0]);
  680. }; // Access a property without creating an Immer draft.
  681. function peek(draft, prop) {
  682. var state = draft[DRAFT_STATE];
  683. var source = state ? latest(state) : draft;
  684. return source[prop];
  685. }
  686. function readPropFromProto(state, source, prop) {
  687. var _desc$get;
  688. var desc = getDescriptorFromProto(source, prop);
  689. return desc ? "value" in desc ? desc.value : // This is a very special case, if the prop is a getter defined by the
  690. // prototype, we should invoke it with the draft as context!
  691. (_desc$get = desc.get) === null || _desc$get === void 0 ? void 0 : _desc$get.call(state.draft_) : undefined;
  692. }
  693. function getDescriptorFromProto(source, prop) {
  694. // 'in' checks proto!
  695. if (!(prop in source)) return undefined;
  696. var proto = Object.getPrototypeOf(source);
  697. while (proto) {
  698. var desc = Object.getOwnPropertyDescriptor(proto, prop);
  699. if (desc) return desc;
  700. proto = Object.getPrototypeOf(proto);
  701. }
  702. return undefined;
  703. }
  704. function markChanged(state) {
  705. if (!state.modified_) {
  706. state.modified_ = true;
  707. if (state.parent_) {
  708. markChanged(state.parent_);
  709. }
  710. }
  711. }
  712. function prepareCopy(state) {
  713. if (!state.copy_) {
  714. state.copy_ = shallowCopy(state.base_);
  715. }
  716. }
  717. var Immer =
  718. /*#__PURE__*/
  719. function () {
  720. function Immer(config) {
  721. var _this = this;
  722. this.useProxies_ = hasProxies;
  723. this.autoFreeze_ = true;
  724. /**
  725. * The `produce` function takes a value and a "recipe function" (whose
  726. * return value often depends on the base state). The recipe function is
  727. * free to mutate its first argument however it wants. All mutations are
  728. * only ever applied to a __copy__ of the base state.
  729. *
  730. * Pass only a function to create a "curried producer" which relieves you
  731. * from passing the recipe function every time.
  732. *
  733. * Only plain objects and arrays are made mutable. All other objects are
  734. * considered uncopyable.
  735. *
  736. * Note: This function is __bound__ to its `Immer` instance.
  737. *
  738. * @param {any} base - the initial state
  739. * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
  740. * @param {Function} patchListener - optional function that will be called with all the patches produced here
  741. * @returns {any} a new state, or the initial state if nothing was modified
  742. */
  743. this.produce = function (base, recipe, patchListener) {
  744. // curried invocation
  745. if (typeof base === "function" && typeof recipe !== "function") {
  746. var defaultBase = recipe;
  747. recipe = base;
  748. var self = _this;
  749. return function curriedProduce(base) {
  750. var _this2 = this;
  751. if (base === void 0) {
  752. base = defaultBase;
  753. }
  754. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  755. args[_key - 1] = arguments[_key];
  756. }
  757. return self.produce(base, function (draft) {
  758. var _recipe;
  759. return (_recipe = recipe).call.apply(_recipe, [_this2, draft].concat(args));
  760. }); // prettier-ignore
  761. };
  762. }
  763. if (typeof recipe !== "function") die(6);
  764. if (patchListener !== undefined && typeof patchListener !== "function") die(7);
  765. var result; // Only plain objects, arrays, and "immerable classes" are drafted.
  766. if (isDraftable(base)) {
  767. var scope = enterScope(_this);
  768. var proxy = createProxy(_this, base, undefined);
  769. var hasError = true;
  770. try {
  771. result = recipe(proxy);
  772. hasError = false;
  773. } finally {
  774. // finally instead of catch + rethrow better preserves original stack
  775. if (hasError) revokeScope(scope);else leaveScope(scope);
  776. }
  777. if (typeof Promise !== "undefined" && result instanceof Promise) {
  778. return result.then(function (result) {
  779. usePatchesInScope(scope, patchListener);
  780. return processResult(result, scope);
  781. }, function (error) {
  782. revokeScope(scope);
  783. throw error;
  784. });
  785. }
  786. usePatchesInScope(scope, patchListener);
  787. return processResult(result, scope);
  788. } else if (!base || typeof base !== "object") {
  789. result = recipe(base);
  790. if (result === NOTHING) return undefined;
  791. if (result === undefined) result = base;
  792. if (_this.autoFreeze_) freeze(result, true);
  793. return result;
  794. } else die(21, base);
  795. };
  796. this.produceWithPatches = function (arg1, arg2, arg3) {
  797. if (typeof arg1 === "function") {
  798. return function (state) {
  799. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  800. args[_key2 - 1] = arguments[_key2];
  801. }
  802. return _this.produceWithPatches(state, function (draft) {
  803. return arg1.apply(void 0, [draft].concat(args));
  804. });
  805. };
  806. }
  807. var patches, inversePatches;
  808. var nextState = _this.produce(arg1, arg2, function (p, ip) {
  809. patches = p;
  810. inversePatches = ip;
  811. });
  812. return [nextState, patches, inversePatches];
  813. };
  814. if (typeof (config === null || config === void 0 ? void 0 : config.useProxies) === "boolean") this.setUseProxies(config.useProxies);
  815. if (typeof (config === null || config === void 0 ? void 0 : config.autoFreeze) === "boolean") this.setAutoFreeze(config.autoFreeze);
  816. }
  817. var _proto = Immer.prototype;
  818. _proto.createDraft = function createDraft(base) {
  819. if (!isDraftable(base)) die(8);
  820. if (isDraft(base)) base = current(base);
  821. var scope = enterScope(this);
  822. var proxy = createProxy(this, base, undefined);
  823. proxy[DRAFT_STATE].isManual_ = true;
  824. leaveScope(scope);
  825. return proxy;
  826. };
  827. _proto.finishDraft = function finishDraft(draft, patchListener) {
  828. var state = draft && draft[DRAFT_STATE];
  829. {
  830. if (!state || !state.isManual_) die(9);
  831. if (state.finalized_) die(10);
  832. }
  833. var scope = state.scope_;
  834. usePatchesInScope(scope, patchListener);
  835. return processResult(undefined, scope);
  836. }
  837. /**
  838. * Pass true to automatically freeze all copies created by Immer.
  839. *
  840. * By default, auto-freezing is enabled.
  841. */
  842. ;
  843. _proto.setAutoFreeze = function setAutoFreeze(value) {
  844. this.autoFreeze_ = value;
  845. }
  846. /**
  847. * Pass true to use the ES2015 `Proxy` class when creating drafts, which is
  848. * always faster than using ES5 proxies.
  849. *
  850. * By default, feature detection is used, so calling this is rarely necessary.
  851. */
  852. ;
  853. _proto.setUseProxies = function setUseProxies(value) {
  854. if (value && !hasProxies) {
  855. die(20);
  856. }
  857. this.useProxies_ = value;
  858. };
  859. _proto.applyPatches = function applyPatches(base, patches) {
  860. // If a patch replaces the entire state, take that replacement as base
  861. // before applying patches
  862. var i;
  863. for (i = patches.length - 1; i >= 0; i--) {
  864. var patch = patches[i];
  865. if (patch.path.length === 0 && patch.op === "replace") {
  866. base = patch.value;
  867. break;
  868. }
  869. } // If there was a patch that replaced the entire state, start from the
  870. // patch after that.
  871. if (i > -1) {
  872. patches = patches.slice(i + 1);
  873. }
  874. var applyPatchesImpl = getPlugin("Patches").applyPatches_;
  875. if (isDraft(base)) {
  876. // N.B: never hits if some patch a replacement, patches are never drafts
  877. return applyPatchesImpl(base, patches);
  878. } // Otherwise, produce a copy of the base state.
  879. return this.produce(base, function (draft) {
  880. return applyPatchesImpl(draft, patches);
  881. });
  882. };
  883. return Immer;
  884. }();
  885. function createProxy(immer, value, parent) {
  886. // precondition: createProxy should be guarded by isDraftable, so we know we can safely draft
  887. var draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : immer.useProxies_ ? createProxyProxy(value, parent) : getPlugin("ES5").createES5Proxy_(value, parent);
  888. var scope = parent ? parent.scope_ : getCurrentScope();
  889. scope.drafts_.push(draft);
  890. return draft;
  891. }
  892. function current(value) {
  893. if (!isDraft(value)) die(22, value);
  894. return currentImpl(value);
  895. }
  896. function currentImpl(value) {
  897. if (!isDraftable(value)) return value;
  898. var state = value[DRAFT_STATE];
  899. var copy;
  900. var archType = getArchtype(value);
  901. if (state) {
  902. if (!state.modified_ && (state.type_ < 4 || !getPlugin("ES5").hasChanges_(state))) return state.base_; // Optimization: avoid generating new drafts during copying
  903. state.finalized_ = true;
  904. copy = copyHelper(value, archType);
  905. state.finalized_ = false;
  906. } else {
  907. copy = copyHelper(value, archType);
  908. }
  909. each$1(copy, function (key, childValue) {
  910. if (state && get(state.base_, key) === childValue) return; // no need to copy or search in something that didn't change
  911. set(copy, key, currentImpl(childValue));
  912. }); // In the future, we might consider freezing here, based on the current settings
  913. return archType === 3
  914. /* Set */
  915. ? new Set(copy) : copy;
  916. }
  917. function copyHelper(value, archType) {
  918. // creates a shallow copy, even if it is a map or set
  919. switch (archType) {
  920. case 2
  921. /* Map */
  922. :
  923. return new Map(value);
  924. case 3
  925. /* Set */
  926. :
  927. // Set will be cloned as array temporarily, so that we can replace individual items
  928. return Array.from(value);
  929. }
  930. return shallowCopy(value);
  931. }
  932. function enableES5() {
  933. function willFinalizeES5_(scope, result, isReplaced) {
  934. if (!isReplaced) {
  935. if (scope.patches_) {
  936. markChangesRecursively(scope.drafts_[0]);
  937. } // This is faster when we don't care about which attributes changed.
  938. markChangesSweep(scope.drafts_);
  939. } // When a child draft is returned, look for changes.
  940. else if (isDraft(result) && result[DRAFT_STATE].scope_ === scope) {
  941. markChangesSweep(scope.drafts_);
  942. }
  943. }
  944. function createES5Draft(isArray, base) {
  945. if (isArray) {
  946. var draft = new Array(base.length);
  947. for (var i = 0; i < base.length; i++) {
  948. Object.defineProperty(draft, "" + i, proxyProperty(i, true));
  949. }
  950. return draft;
  951. } else {
  952. var _descriptors = getOwnPropertyDescriptors(base);
  953. delete _descriptors[DRAFT_STATE];
  954. var keys = ownKeys$a(_descriptors);
  955. for (var _i = 0; _i < keys.length; _i++) {
  956. var key = keys[_i];
  957. _descriptors[key] = proxyProperty(key, isArray || !!_descriptors[key].enumerable);
  958. }
  959. return Object.create(Object.getPrototypeOf(base), _descriptors);
  960. }
  961. }
  962. function createES5Proxy_(base, parent) {
  963. var isArray = Array.isArray(base);
  964. var draft = createES5Draft(isArray, base);
  965. var state = {
  966. type_: isArray ? 5
  967. /* ES5Array */
  968. : 4
  969. /* ES5Object */
  970. ,
  971. scope_: parent ? parent.scope_ : getCurrentScope(),
  972. modified_: false,
  973. finalized_: false,
  974. assigned_: {},
  975. parent_: parent,
  976. // base is the object we are drafting
  977. base_: base,
  978. // draft is the draft object itself, that traps all reads and reads from either the base (if unmodified) or copy (if modified)
  979. draft_: draft,
  980. copy_: null,
  981. revoked_: false,
  982. isManual_: false
  983. };
  984. Object.defineProperty(draft, DRAFT_STATE, {
  985. value: state,
  986. // enumerable: false <- the default
  987. writable: true
  988. });
  989. return draft;
  990. } // property descriptors are recycled to make sure we don't create a get and set closure per property,
  991. // but share them all instead
  992. var descriptors = {};
  993. function proxyProperty(prop, enumerable) {
  994. var desc = descriptors[prop];
  995. if (desc) {
  996. desc.enumerable = enumerable;
  997. } else {
  998. descriptors[prop] = desc = {
  999. configurable: true,
  1000. enumerable: enumerable,
  1001. get: function get() {
  1002. var state = this[DRAFT_STATE];
  1003. assertUnrevoked(state); // @ts-ignore
  1004. return objectTraps.get(state, prop);
  1005. },
  1006. set: function set(value) {
  1007. var state = this[DRAFT_STATE];
  1008. assertUnrevoked(state); // @ts-ignore
  1009. objectTraps.set(state, prop, value);
  1010. }
  1011. };
  1012. }
  1013. return desc;
  1014. } // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
  1015. function markChangesSweep(drafts) {
  1016. // The natural order of drafts in the `scope` array is based on when they
  1017. // were accessed. By processing drafts in reverse natural order, we have a
  1018. // better chance of processing leaf nodes first. When a leaf node is known to
  1019. // have changed, we can avoid any traversal of its ancestor nodes.
  1020. for (var i = drafts.length - 1; i >= 0; i--) {
  1021. var state = drafts[i][DRAFT_STATE];
  1022. if (!state.modified_) {
  1023. switch (state.type_) {
  1024. case 5
  1025. /* ES5Array */
  1026. :
  1027. if (hasArrayChanges(state)) markChanged(state);
  1028. break;
  1029. case 4
  1030. /* ES5Object */
  1031. :
  1032. if (hasObjectChanges(state)) markChanged(state);
  1033. break;
  1034. }
  1035. }
  1036. }
  1037. }
  1038. function markChangesRecursively(object) {
  1039. if (!object || typeof object !== "object") return;
  1040. var state = object[DRAFT_STATE];
  1041. if (!state) return;
  1042. var base_ = state.base_,
  1043. draft_ = state.draft_,
  1044. assigned_ = state.assigned_,
  1045. type_ = state.type_;
  1046. if (type_ === 4
  1047. /* ES5Object */
  1048. ) {
  1049. // Look for added keys.
  1050. // probably there is a faster way to detect changes, as sweep + recurse seems to do some
  1051. // unnecessary work.
  1052. // also: probably we can store the information we detect here, to speed up tree finalization!
  1053. each$1(draft_, function (key) {
  1054. if (key === DRAFT_STATE) return; // The `undefined` check is a fast path for pre-existing keys.
  1055. if (base_[key] === undefined && !has(base_, key)) {
  1056. assigned_[key] = true;
  1057. markChanged(state);
  1058. } else if (!assigned_[key]) {
  1059. // Only untouched properties trigger recursion.
  1060. markChangesRecursively(draft_[key]);
  1061. }
  1062. }); // Look for removed keys.
  1063. each$1(base_, function (key) {
  1064. // The `undefined` check is a fast path for pre-existing keys.
  1065. if (draft_[key] === undefined && !has(draft_, key)) {
  1066. assigned_[key] = false;
  1067. markChanged(state);
  1068. }
  1069. });
  1070. } else if (type_ === 5
  1071. /* ES5Array */
  1072. ) {
  1073. if (hasArrayChanges(state)) {
  1074. markChanged(state);
  1075. assigned_.length = true;
  1076. }
  1077. if (draft_.length < base_.length) {
  1078. for (var i = draft_.length; i < base_.length; i++) {
  1079. assigned_[i] = false;
  1080. }
  1081. } else {
  1082. for (var _i2 = base_.length; _i2 < draft_.length; _i2++) {
  1083. assigned_[_i2] = true;
  1084. }
  1085. } // Minimum count is enough, the other parts has been processed.
  1086. var min = Math.min(draft_.length, base_.length);
  1087. for (var _i3 = 0; _i3 < min; _i3++) {
  1088. // Only untouched indices trigger recursion.
  1089. if (assigned_[_i3] === undefined) markChangesRecursively(draft_[_i3]);
  1090. }
  1091. }
  1092. }
  1093. function hasObjectChanges(state) {
  1094. var base_ = state.base_,
  1095. draft_ = state.draft_; // Search for added keys and changed keys. Start at the back, because
  1096. // non-numeric keys are ordered by time of definition on the object.
  1097. var keys = ownKeys$a(draft_);
  1098. for (var i = keys.length - 1; i >= 0; i--) {
  1099. var key = keys[i];
  1100. if (key === DRAFT_STATE) continue;
  1101. var baseValue = base_[key]; // The `undefined` check is a fast path for pre-existing keys.
  1102. if (baseValue === undefined && !has(base_, key)) {
  1103. return true;
  1104. } // Once a base key is deleted, future changes go undetected, because its
  1105. // descriptor is erased. This branch detects any missed changes.
  1106. else {
  1107. var value = draft_[key];
  1108. var _state = value && value[DRAFT_STATE];
  1109. if (_state ? _state.base_ !== baseValue : !is$1(value, baseValue)) {
  1110. return true;
  1111. }
  1112. }
  1113. } // At this point, no keys were added or changed.
  1114. // Compare key count to determine if keys were deleted.
  1115. var baseIsDraft = !!base_[DRAFT_STATE];
  1116. return keys.length !== ownKeys$a(base_).length + (baseIsDraft ? 0 : 1); // + 1 to correct for DRAFT_STATE
  1117. }
  1118. function hasArrayChanges(state) {
  1119. var draft_ = state.draft_;
  1120. if (draft_.length !== state.base_.length) return true; // See #116
  1121. // If we first shorten the length, our array interceptors will be removed.
  1122. // If after that new items are added, result in the same original length,
  1123. // those last items will have no intercepting property.
  1124. // So if there is no own descriptor on the last position, we know that items were removed and added
  1125. // N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
  1126. // the last one
  1127. var descriptor = Object.getOwnPropertyDescriptor(draft_, draft_.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
  1128. if (descriptor && !descriptor.get) return true; // For all other cases, we don't have to compare, as they would have been picked up by the index setters
  1129. return false;
  1130. }
  1131. function hasChanges_(state) {
  1132. return state.type_ === 4
  1133. /* ES5Object */
  1134. ? hasObjectChanges(state) : hasArrayChanges(state);
  1135. }
  1136. function assertUnrevoked(state
  1137. /*ES5State | MapState | SetState*/
  1138. ) {
  1139. if (state.revoked_) die(3, JSON.stringify(latest(state)));
  1140. }
  1141. loadPlugin("ES5", {
  1142. createES5Proxy_: createES5Proxy_,
  1143. willFinalizeES5_: willFinalizeES5_,
  1144. hasChanges_: hasChanges_
  1145. });
  1146. }
  1147. function enablePatches() {
  1148. var REPLACE = "replace";
  1149. var ADD = "add";
  1150. var REMOVE = "remove";
  1151. function generatePatches_(state, basePath, patches, inversePatches) {
  1152. switch (state.type_) {
  1153. case 0
  1154. /* ProxyObject */
  1155. :
  1156. case 4
  1157. /* ES5Object */
  1158. :
  1159. case 2
  1160. /* Map */
  1161. :
  1162. return generatePatchesFromAssigned(state, basePath, patches, inversePatches);
  1163. case 5
  1164. /* ES5Array */
  1165. :
  1166. case 1
  1167. /* ProxyArray */
  1168. :
  1169. return generateArrayPatches(state, basePath, patches, inversePatches);
  1170. case 3
  1171. /* Set */
  1172. :
  1173. return generateSetPatches(state, basePath, patches, inversePatches);
  1174. }
  1175. }
  1176. function generateArrayPatches(state, basePath, patches, inversePatches) {
  1177. var base_ = state.base_,
  1178. assigned_ = state.assigned_;
  1179. var copy_ = state.copy_; // Reduce complexity by ensuring `base` is never longer.
  1180. if (copy_.length < base_.length) {
  1181. var _ref = [copy_, base_];
  1182. base_ = _ref[0];
  1183. copy_ = _ref[1];
  1184. var _ref2 = [inversePatches, patches];
  1185. patches = _ref2[0];
  1186. inversePatches = _ref2[1];
  1187. } // Process replaced indices.
  1188. for (var i = 0; i < base_.length; i++) {
  1189. if (assigned_[i] && copy_[i] !== base_[i]) {
  1190. var path = basePath.concat([i]);
  1191. patches.push({
  1192. op: REPLACE,
  1193. path: path,
  1194. // Need to maybe clone it, as it can in fact be the original value
  1195. // due to the base/copy inversion at the start of this function
  1196. value: clonePatchValueIfNeeded(copy_[i])
  1197. });
  1198. inversePatches.push({
  1199. op: REPLACE,
  1200. path: path,
  1201. value: clonePatchValueIfNeeded(base_[i])
  1202. });
  1203. }
  1204. } // Process added indices.
  1205. for (var _i = base_.length; _i < copy_.length; _i++) {
  1206. var _path = basePath.concat([_i]);
  1207. patches.push({
  1208. op: ADD,
  1209. path: _path,
  1210. // Need to maybe clone it, as it can in fact be the original value
  1211. // due to the base/copy inversion at the start of this function
  1212. value: clonePatchValueIfNeeded(copy_[_i])
  1213. });
  1214. }
  1215. if (base_.length < copy_.length) {
  1216. inversePatches.push({
  1217. op: REPLACE,
  1218. path: basePath.concat(["length"]),
  1219. value: base_.length
  1220. });
  1221. }
  1222. } // This is used for both Map objects and normal objects.
  1223. function generatePatchesFromAssigned(state, basePath, patches, inversePatches) {
  1224. var base_ = state.base_,
  1225. copy_ = state.copy_;
  1226. each$1(state.assigned_, function (key, assignedValue) {
  1227. var origValue = get(base_, key);
  1228. var value = get(copy_, key);
  1229. var op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD;
  1230. if (origValue === value && op === REPLACE) return;
  1231. var path = basePath.concat(key);
  1232. patches.push(op === REMOVE ? {
  1233. op: op,
  1234. path: path
  1235. } : {
  1236. op: op,
  1237. path: path,
  1238. value: value
  1239. });
  1240. inversePatches.push(op === ADD ? {
  1241. op: REMOVE,
  1242. path: path
  1243. } : op === REMOVE ? {
  1244. op: ADD,
  1245. path: path,
  1246. value: clonePatchValueIfNeeded(origValue)
  1247. } : {
  1248. op: REPLACE,
  1249. path: path,
  1250. value: clonePatchValueIfNeeded(origValue)
  1251. });
  1252. });
  1253. }
  1254. function generateSetPatches(state, basePath, patches, inversePatches) {
  1255. var base_ = state.base_,
  1256. copy_ = state.copy_;
  1257. var i = 0;
  1258. base_.forEach(function (value) {
  1259. if (!copy_.has(value)) {
  1260. var path = basePath.concat([i]);
  1261. patches.push({
  1262. op: REMOVE,
  1263. path: path,
  1264. value: value
  1265. });
  1266. inversePatches.unshift({
  1267. op: ADD,
  1268. path: path,
  1269. value: value
  1270. });
  1271. }
  1272. i++;
  1273. });
  1274. i = 0;
  1275. copy_.forEach(function (value) {
  1276. if (!base_.has(value)) {
  1277. var path = basePath.concat([i]);
  1278. patches.push({
  1279. op: ADD,
  1280. path: path,
  1281. value: value
  1282. });
  1283. inversePatches.unshift({
  1284. op: REMOVE,
  1285. path: path,
  1286. value: value
  1287. });
  1288. }
  1289. i++;
  1290. });
  1291. }
  1292. function generateReplacementPatches_(rootState, replacement, patches, inversePatches) {
  1293. patches.push({
  1294. op: REPLACE,
  1295. path: [],
  1296. value: replacement === NOTHING ? undefined : replacement
  1297. });
  1298. inversePatches.push({
  1299. op: REPLACE,
  1300. path: [],
  1301. value: rootState.base_
  1302. });
  1303. }
  1304. function applyPatches_(draft, patches) {
  1305. patches.forEach(function (patch) {
  1306. var path = patch.path,
  1307. op = patch.op;
  1308. var base = draft;
  1309. for (var i = 0; i < path.length - 1; i++) {
  1310. var parentType = getArchtype(base);
  1311. var p = "" + path[i]; // See #738, avoid prototype pollution
  1312. if ((parentType === 0
  1313. /* Object */
  1314. || parentType === 1
  1315. /* Array */
  1316. ) && (p === "__proto__" || p === "constructor")) die(24);
  1317. if (typeof base === "function" && p === "prototype") die(24);
  1318. base = get(base, p);
  1319. if (typeof base !== "object") die(15, path.join("/"));
  1320. }
  1321. var type = getArchtype(base);
  1322. var value = deepClonePatchValue(patch.value); // used to clone patch to ensure original patch is not modified, see #411
  1323. var key = path[path.length - 1];
  1324. switch (op) {
  1325. case REPLACE:
  1326. switch (type) {
  1327. case 2
  1328. /* Map */
  1329. :
  1330. return base.set(key, value);
  1331. /* istanbul ignore next */
  1332. case 3
  1333. /* Set */
  1334. :
  1335. die(16);
  1336. default:
  1337. // if value is an object, then it's assigned by reference
  1338. // in the following add or remove ops, the value field inside the patch will also be modifyed
  1339. // so we use value from the cloned patch
  1340. // @ts-ignore
  1341. return base[key] = value;
  1342. }
  1343. case ADD:
  1344. switch (type) {
  1345. case 1
  1346. /* Array */
  1347. :
  1348. return key === "-" ? base.push(value) : base.splice(key, 0, value);
  1349. case 2
  1350. /* Map */
  1351. :
  1352. return base.set(key, value);
  1353. case 3
  1354. /* Set */
  1355. :
  1356. return base.add(value);
  1357. default:
  1358. return base[key] = value;
  1359. }
  1360. case REMOVE:
  1361. switch (type) {
  1362. case 1
  1363. /* Array */
  1364. :
  1365. return base.splice(key, 1);
  1366. case 2
  1367. /* Map */
  1368. :
  1369. return base.delete(key);
  1370. case 3
  1371. /* Set */
  1372. :
  1373. return base.delete(patch.value);
  1374. default:
  1375. return delete base[key];
  1376. }
  1377. default:
  1378. die(17, op);
  1379. }
  1380. });
  1381. return draft;
  1382. }
  1383. function deepClonePatchValue(obj) {
  1384. if (!isDraftable(obj)) return obj;
  1385. if (Array.isArray(obj)) return obj.map(deepClonePatchValue);
  1386. if (isMap(obj)) return new Map(Array.from(obj.entries()).map(function (_ref3) {
  1387. var k = _ref3[0],
  1388. v = _ref3[1];
  1389. return [k, deepClonePatchValue(v)];
  1390. }));
  1391. if (isSet(obj)) return new Set(Array.from(obj).map(deepClonePatchValue));
  1392. var cloned = Object.create(Object.getPrototypeOf(obj));
  1393. for (var key in obj) {
  1394. cloned[key] = deepClonePatchValue(obj[key]);
  1395. }
  1396. if (has(obj, DRAFTABLE)) cloned[DRAFTABLE] = obj[DRAFTABLE];
  1397. return cloned;
  1398. }
  1399. function clonePatchValueIfNeeded(obj) {
  1400. if (isDraft(obj)) {
  1401. return deepClonePatchValue(obj);
  1402. } else return obj;
  1403. }
  1404. loadPlugin("Patches", {
  1405. applyPatches_: applyPatches_,
  1406. generatePatches_: generatePatches_,
  1407. generateReplacementPatches_: generateReplacementPatches_
  1408. });
  1409. }
  1410. // types only!
  1411. function enableMapSet() {
  1412. /* istanbul ignore next */
  1413. var _extendStatics = function extendStatics(d, b) {
  1414. _extendStatics = Object.setPrototypeOf || {
  1415. __proto__: []
  1416. } instanceof Array && function (d, b) {
  1417. d.__proto__ = b;
  1418. } || function (d, b) {
  1419. for (var p in b) {
  1420. if (b.hasOwnProperty(p)) d[p] = b[p];
  1421. }
  1422. };
  1423. return _extendStatics(d, b);
  1424. }; // Ugly hack to resolve #502 and inherit built in Map / Set
  1425. function __extends(d, b) {
  1426. _extendStatics(d, b);
  1427. function __() {
  1428. this.constructor = d;
  1429. }
  1430. d.prototype = ( // @ts-ignore
  1431. __.prototype = b.prototype, new __());
  1432. }
  1433. var DraftMap = function (_super) {
  1434. __extends(DraftMap, _super); // Create class manually, cause #502
  1435. function DraftMap(target, parent) {
  1436. this[DRAFT_STATE] = {
  1437. type_: 2
  1438. /* Map */
  1439. ,
  1440. parent_: parent,
  1441. scope_: parent ? parent.scope_ : getCurrentScope(),
  1442. modified_: false,
  1443. finalized_: false,
  1444. copy_: undefined,
  1445. assigned_: undefined,
  1446. base_: target,
  1447. draft_: this,
  1448. isManual_: false,
  1449. revoked_: false
  1450. };
  1451. return this;
  1452. }
  1453. var p = DraftMap.prototype;
  1454. Object.defineProperty(p, "size", {
  1455. get: function get() {
  1456. return latest(this[DRAFT_STATE]).size;
  1457. } // enumerable: false,
  1458. // configurable: true
  1459. });
  1460. p.has = function (key) {
  1461. return latest(this[DRAFT_STATE]).has(key);
  1462. };
  1463. p.set = function (key, value) {
  1464. var state = this[DRAFT_STATE];
  1465. assertUnrevoked(state);
  1466. if (!latest(state).has(key) || latest(state).get(key) !== value) {
  1467. prepareMapCopy(state);
  1468. markChanged(state);
  1469. state.assigned_.set(key, true);
  1470. state.copy_.set(key, value);
  1471. state.assigned_.set(key, true);
  1472. }
  1473. return this;
  1474. };
  1475. p.delete = function (key) {
  1476. if (!this.has(key)) {
  1477. return false;
  1478. }
  1479. var state = this[DRAFT_STATE];
  1480. assertUnrevoked(state);
  1481. prepareMapCopy(state);
  1482. markChanged(state);
  1483. state.assigned_.set(key, false);
  1484. state.copy_.delete(key);
  1485. return true;
  1486. };
  1487. p.clear = function () {
  1488. var state = this[DRAFT_STATE];
  1489. assertUnrevoked(state);
  1490. if (latest(state).size) {
  1491. prepareMapCopy(state);
  1492. markChanged(state);
  1493. state.assigned_ = new Map();
  1494. each$1(state.base_, function (key) {
  1495. state.assigned_.set(key, false);
  1496. });
  1497. state.copy_.clear();
  1498. }
  1499. };
  1500. p.forEach = function (cb, thisArg) {
  1501. var _this = this;
  1502. var state = this[DRAFT_STATE];
  1503. latest(state).forEach(function (_value, key, _map) {
  1504. cb.call(thisArg, _this.get(key), key, _this);
  1505. });
  1506. };
  1507. p.get = function (key) {
  1508. var state = this[DRAFT_STATE];
  1509. assertUnrevoked(state);
  1510. var value = latest(state).get(key);
  1511. if (state.finalized_ || !isDraftable(value)) {
  1512. return value;
  1513. }
  1514. if (value !== state.base_.get(key)) {
  1515. return value; // either already drafted or reassigned
  1516. } // despite what it looks, this creates a draft only once, see above condition
  1517. var draft = createProxy(state.scope_.immer_, value, state);
  1518. prepareMapCopy(state);
  1519. state.copy_.set(key, draft);
  1520. return draft;
  1521. };
  1522. p.keys = function () {
  1523. return latest(this[DRAFT_STATE]).keys();
  1524. };
  1525. p.values = function () {
  1526. var _this2 = this,
  1527. _ref;
  1528. var iterator = this.keys();
  1529. return _ref = {}, _ref[iteratorSymbol$1] = function () {
  1530. return _this2.values();
  1531. }, _ref.next = function next() {
  1532. var r = iterator.next();
  1533. /* istanbul ignore next */
  1534. if (r.done) return r;
  1535. var value = _this2.get(r.value);
  1536. return {
  1537. done: false,
  1538. value: value
  1539. };
  1540. }, _ref;
  1541. };
  1542. p.entries = function () {
  1543. var _this3 = this,
  1544. _ref2;
  1545. var iterator = this.keys();
  1546. return _ref2 = {}, _ref2[iteratorSymbol$1] = function () {
  1547. return _this3.entries();
  1548. }, _ref2.next = function next() {
  1549. var r = iterator.next();
  1550. /* istanbul ignore next */
  1551. if (r.done) return r;
  1552. var value = _this3.get(r.value);
  1553. return {
  1554. done: false,
  1555. value: [r.value, value]
  1556. };
  1557. }, _ref2;
  1558. };
  1559. p[iteratorSymbol$1] = function () {
  1560. return this.entries();
  1561. };
  1562. return DraftMap;
  1563. }(Map);
  1564. function proxyMap_(target, parent) {
  1565. // @ts-ignore
  1566. return new DraftMap(target, parent);
  1567. }
  1568. function prepareMapCopy(state) {
  1569. if (!state.copy_) {
  1570. state.assigned_ = new Map();
  1571. state.copy_ = new Map(state.base_);
  1572. }
  1573. }
  1574. var DraftSet = function (_super) {
  1575. __extends(DraftSet, _super); // Create class manually, cause #502
  1576. function DraftSet(target, parent) {
  1577. this[DRAFT_STATE] = {
  1578. type_: 3
  1579. /* Set */
  1580. ,
  1581. parent_: parent,
  1582. scope_: parent ? parent.scope_ : getCurrentScope(),
  1583. modified_: false,
  1584. finalized_: false,
  1585. copy_: undefined,
  1586. base_: target,
  1587. draft_: this,
  1588. drafts_: new Map(),
  1589. revoked_: false,
  1590. isManual_: false
  1591. };
  1592. return this;
  1593. }
  1594. var p = DraftSet.prototype;
  1595. Object.defineProperty(p, "size", {
  1596. get: function get() {
  1597. return latest(this[DRAFT_STATE]).size;
  1598. } // enumerable: true,
  1599. });
  1600. p.has = function (value) {
  1601. var state = this[DRAFT_STATE];
  1602. assertUnrevoked(state); // bit of trickery here, to be able to recognize both the value, and the draft of its value
  1603. if (!state.copy_) {
  1604. return state.base_.has(value);
  1605. }
  1606. if (state.copy_.has(value)) return true;
  1607. if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value))) return true;
  1608. return false;
  1609. };
  1610. p.add = function (value) {
  1611. var state = this[DRAFT_STATE];
  1612. assertUnrevoked(state);
  1613. if (!this.has(value)) {
  1614. prepareSetCopy(state);
  1615. markChanged(state);
  1616. state.copy_.add(value);
  1617. }
  1618. return this;
  1619. };
  1620. p.delete = function (value) {
  1621. if (!this.has(value)) {
  1622. return false;
  1623. }
  1624. var state = this[DRAFT_STATE];
  1625. assertUnrevoked(state);
  1626. prepareSetCopy(state);
  1627. markChanged(state);
  1628. return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) :
  1629. /* istanbul ignore next */
  1630. false);
  1631. };
  1632. p.clear = function () {
  1633. var state = this[DRAFT_STATE];
  1634. assertUnrevoked(state);
  1635. if (latest(state).size) {
  1636. prepareSetCopy(state);
  1637. markChanged(state);
  1638. state.copy_.clear();
  1639. }
  1640. };
  1641. p.values = function () {
  1642. var state = this[DRAFT_STATE];
  1643. assertUnrevoked(state);
  1644. prepareSetCopy(state);
  1645. return state.copy_.values();
  1646. };
  1647. p.entries = function entries() {
  1648. var state = this[DRAFT_STATE];
  1649. assertUnrevoked(state);
  1650. prepareSetCopy(state);
  1651. return state.copy_.entries();
  1652. };
  1653. p.keys = function () {
  1654. return this.values();
  1655. };
  1656. p[iteratorSymbol$1] = function () {
  1657. return this.values();
  1658. };
  1659. p.forEach = function forEach(cb, thisArg) {
  1660. var iterator = this.values();
  1661. var result = iterator.next();
  1662. while (!result.done) {
  1663. cb.call(thisArg, result.value, result.value, this);
  1664. result = iterator.next();
  1665. }
  1666. };
  1667. return DraftSet;
  1668. }(Set);
  1669. function proxySet_(target, parent) {
  1670. // @ts-ignore
  1671. return new DraftSet(target, parent);
  1672. }
  1673. function prepareSetCopy(state) {
  1674. if (!state.copy_) {
  1675. // create drafts for all entries to preserve insertion order
  1676. state.copy_ = new Set();
  1677. state.base_.forEach(function (value) {
  1678. if (isDraftable(value)) {
  1679. var draft = createProxy(state.scope_.immer_, value, state);
  1680. state.drafts_.set(value, draft);
  1681. state.copy_.add(draft);
  1682. } else {
  1683. state.copy_.add(value);
  1684. }
  1685. });
  1686. }
  1687. }
  1688. function assertUnrevoked(state
  1689. /*ES5State | MapState | SetState*/
  1690. ) {
  1691. if (state.revoked_) die(3, JSON.stringify(latest(state)));
  1692. }
  1693. loadPlugin("MapSet", {
  1694. proxyMap_: proxyMap_,
  1695. proxySet_: proxySet_
  1696. });
  1697. }
  1698. function enableAllPlugins() {
  1699. enableES5();
  1700. enableMapSet();
  1701. enablePatches();
  1702. }
  1703. var immer$1 =
  1704. /*#__PURE__*/
  1705. new Immer();
  1706. /**
  1707. * The `produce` function takes a value and a "recipe function" (whose
  1708. * return value often depends on the base state). The recipe function is
  1709. * free to mutate its first argument however it wants. All mutations are
  1710. * only ever applied to a __copy__ of the base state.
  1711. *
  1712. * Pass only a function to create a "curried producer" which relieves you
  1713. * from passing the recipe function every time.
  1714. *
  1715. * Only plain objects and arrays are made mutable. All other objects are
  1716. * considered uncopyable.
  1717. *
  1718. * Note: This function is __bound__ to its `Immer` instance.
  1719. *
  1720. * @param {any} base - the initial state
  1721. * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
  1722. * @param {Function} patchListener - optional function that will be called with all the patches produced here
  1723. * @returns {any} a new state, or the initial state if nothing was modified
  1724. */
  1725. var produce = immer$1.produce;
  1726. /**
  1727. * Like `produce`, but `produceWithPatches` always returns a tuple
  1728. * [nextState, patches, inversePatches] (instead of just the next state)
  1729. */
  1730. var produceWithPatches =
  1731. /*#__PURE__*/
  1732. immer$1.produceWithPatches.bind(immer$1);
  1733. /**
  1734. * Pass true to automatically freeze all copies created by Immer.
  1735. *
  1736. * Always freeze by default, even in production mode
  1737. */
  1738. var setAutoFreeze =
  1739. /*#__PURE__*/
  1740. immer$1.setAutoFreeze.bind(immer$1);
  1741. /**
  1742. * Pass true to use the ES2015 `Proxy` class when creating drafts, which is
  1743. * always faster than using ES5 proxies.
  1744. *
  1745. * By default, feature detection is used, so calling this is rarely necessary.
  1746. */
  1747. var setUseProxies =
  1748. /*#__PURE__*/
  1749. immer$1.setUseProxies.bind(immer$1);
  1750. /**
  1751. * Apply an array of Immer patches to the first argument.
  1752. *
  1753. * This function is a producer, which means copy-on-write is in effect.
  1754. */
  1755. var applyPatches =
  1756. /*#__PURE__*/
  1757. immer$1.applyPatches.bind(immer$1);
  1758. /**
  1759. * Create an Immer draft from the given base state, which may be a draft itself.
  1760. * The draft can be modified until you finalize it with the `finishDraft` function.
  1761. */
  1762. var createDraft =
  1763. /*#__PURE__*/
  1764. immer$1.createDraft.bind(immer$1);
  1765. /**
  1766. * Finalize an Immer draft from a `createDraft` call, returning the base state
  1767. * (if no changes were made) or a modified copy. The draft must *not* be
  1768. * mutated afterwards.
  1769. *
  1770. * Pass a function as the 2nd argument to generate Immer patches based on the
  1771. * changes that were made.
  1772. */
  1773. var finishDraft =
  1774. /*#__PURE__*/
  1775. immer$1.finishDraft.bind(immer$1);
  1776. /**
  1777. * This function is actually a no-op, but can be used to cast an immutable type
  1778. * to an draft type and make TypeScript happy
  1779. *
  1780. * @param value
  1781. */
  1782. function castDraft(value) {
  1783. return value;
  1784. }
  1785. /**
  1786. * This function is actually a no-op, but can be used to cast a mutable type
  1787. * to an immutable type and make TypeScript happy
  1788. * @param value
  1789. */
  1790. function castImmutable(value) {
  1791. return value;
  1792. }
  1793. var Immer_1 = Immer;
  1794. var applyPatches_1 = applyPatches;
  1795. var castDraft_1 = castDraft;
  1796. var castImmutable_1 = castImmutable;
  1797. var createDraft_1 = createDraft;
  1798. var current_1 = current;
  1799. var _default$2 = produce;
  1800. var enableAllPlugins_1 = enableAllPlugins;
  1801. var enableES5_1 = enableES5;
  1802. var enableMapSet_1 = enableMapSet;
  1803. var enablePatches_1 = enablePatches;
  1804. var finishDraft_1 = finishDraft;
  1805. var freeze_1 = freeze;
  1806. var immerable = DRAFTABLE;
  1807. var isDraft_1 = isDraft;
  1808. var isDraftable_1 = isDraftable;
  1809. var nothing = NOTHING;
  1810. var original_1 = original;
  1811. var produce_1 = produce;
  1812. var produceWithPatches_1 = produceWithPatches;
  1813. var setAutoFreeze_1 = setAutoFreeze;
  1814. var setUseProxies_1 = setUseProxies;
  1815. var immer_cjs_development = /*#__PURE__*/Object.defineProperty({
  1816. Immer: Immer_1,
  1817. applyPatches: applyPatches_1,
  1818. castDraft: castDraft_1,
  1819. castImmutable: castImmutable_1,
  1820. createDraft: createDraft_1,
  1821. current: current_1,
  1822. default: _default$2,
  1823. enableAllPlugins: enableAllPlugins_1,
  1824. enableES5: enableES5_1,
  1825. enableMapSet: enableMapSet_1,
  1826. enablePatches: enablePatches_1,
  1827. finishDraft: finishDraft_1,
  1828. freeze: freeze_1,
  1829. immerable: immerable,
  1830. isDraft: isDraft_1,
  1831. isDraftable: isDraftable_1,
  1832. nothing: nothing,
  1833. original: original_1,
  1834. produce: produce_1,
  1835. produceWithPatches: produceWithPatches_1,
  1836. setAutoFreeze: setAutoFreeze_1,
  1837. setUseProxies: setUseProxies_1
  1838. }, '__esModule', {value: true});
  1839. var require$$1$1 = immer_cjs_development;
  1840. var dist$8 = createCommonjsModule$1(function (module) {
  1841. {
  1842. module.exports = require$$1$1;
  1843. }
  1844. });
  1845. var isPlainObject = isPlainObject_1;
  1846. var immer = dist$8;
  1847. function unwrapExports (x) {
  1848. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  1849. }
  1850. function createCommonjsModule(fn, module) {
  1851. return module = { exports: {} }, fn(module, module.exports), module.exports;
  1852. }
  1853. var arrayLikeToArray = createCommonjsModule(function (module) {
  1854. function _arrayLikeToArray(arr, len) {
  1855. if (len == null || len > arr.length) len = arr.length;
  1856. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  1857. arr2[i] = arr[i];
  1858. }
  1859. return arr2;
  1860. }
  1861. module.exports = _arrayLikeToArray;
  1862. module.exports["default"] = module.exports, module.exports.__esModule = true;
  1863. });
  1864. unwrapExports(arrayLikeToArray);
  1865. var arrayWithoutHoles = createCommonjsModule(function (module) {
  1866. function _arrayWithoutHoles(arr) {
  1867. if (Array.isArray(arr)) return arrayLikeToArray(arr);
  1868. }
  1869. module.exports = _arrayWithoutHoles;
  1870. module.exports["default"] = module.exports, module.exports.__esModule = true;
  1871. });
  1872. unwrapExports(arrayWithoutHoles);
  1873. var iterableToArray = createCommonjsModule(function (module) {
  1874. function _iterableToArray(iter) {
  1875. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  1876. }
  1877. module.exports = _iterableToArray;
  1878. module.exports["default"] = module.exports, module.exports.__esModule = true;
  1879. });
  1880. unwrapExports(iterableToArray);
  1881. var unsupportedIterableToArray = createCommonjsModule(function (module) {
  1882. function _unsupportedIterableToArray(o, minLen) {
  1883. if (!o) return;
  1884. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  1885. var n = Object.prototype.toString.call(o).slice(8, -1);
  1886. if (n === "Object" && o.constructor) n = o.constructor.name;
  1887. if (n === "Map" || n === "Set") return Array.from(o);
  1888. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  1889. }
  1890. module.exports = _unsupportedIterableToArray;
  1891. module.exports["default"] = module.exports, module.exports.__esModule = true;
  1892. });
  1893. unwrapExports(unsupportedIterableToArray);
  1894. var nonIterableSpread = createCommonjsModule(function (module) {
  1895. function _nonIterableSpread() {
  1896. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  1897. }
  1898. module.exports = _nonIterableSpread;
  1899. module.exports["default"] = module.exports, module.exports.__esModule = true;
  1900. });
  1901. unwrapExports(nonIterableSpread);
  1902. var toConsumableArray = createCommonjsModule(function (module) {
  1903. function _toConsumableArray(arr) {
  1904. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  1905. }
  1906. module.exports = _toConsumableArray;
  1907. module.exports["default"] = module.exports, module.exports.__esModule = true;
  1908. });
  1909. var _toConsumableArray = unwrapExports(toConsumableArray);
  1910. var arrayWithHoles = createCommonjsModule(function (module) {
  1911. function _arrayWithHoles(arr) {
  1912. if (Array.isArray(arr)) return arr;
  1913. }
  1914. module.exports = _arrayWithHoles;
  1915. module.exports["default"] = module.exports, module.exports.__esModule = true;
  1916. });
  1917. unwrapExports(arrayWithHoles);
  1918. var iterableToArrayLimit = createCommonjsModule(function (module) {
  1919. function _iterableToArrayLimit(arr, i) {
  1920. var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
  1921. if (_i == null) return;
  1922. var _arr = [];
  1923. var _n = true;
  1924. var _d = false;
  1925. var _s, _e;
  1926. try {
  1927. for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
  1928. _arr.push(_s.value);
  1929. if (i && _arr.length === i) break;
  1930. }
  1931. } catch (err) {
  1932. _d = true;
  1933. _e = err;
  1934. } finally {
  1935. try {
  1936. if (!_n && _i["return"] != null) _i["return"]();
  1937. } finally {
  1938. if (_d) throw _e;
  1939. }
  1940. }
  1941. return _arr;
  1942. }
  1943. module.exports = _iterableToArrayLimit;
  1944. module.exports["default"] = module.exports, module.exports.__esModule = true;
  1945. });
  1946. unwrapExports(iterableToArrayLimit);
  1947. var nonIterableRest = createCommonjsModule(function (module) {
  1948. function _nonIterableRest() {
  1949. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  1950. }
  1951. module.exports = _nonIterableRest;
  1952. module.exports["default"] = module.exports, module.exports.__esModule = true;
  1953. });
  1954. unwrapExports(nonIterableRest);
  1955. var slicedToArray = createCommonjsModule(function (module) {
  1956. function _slicedToArray(arr, i) {
  1957. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  1958. }
  1959. module.exports = _slicedToArray;
  1960. module.exports["default"] = module.exports, module.exports.__esModule = true;
  1961. });
  1962. var _slicedToArray = unwrapExports(slicedToArray);
  1963. var defineProperty = createCommonjsModule(function (module) {
  1964. function _defineProperty(obj, key, value) {
  1965. if (key in obj) {
  1966. Object.defineProperty(obj, key, {
  1967. value: value,
  1968. enumerable: true,
  1969. configurable: true,
  1970. writable: true
  1971. });
  1972. } else {
  1973. obj[key] = value;
  1974. }
  1975. return obj;
  1976. }
  1977. module.exports = _defineProperty;
  1978. module.exports["default"] = module.exports, module.exports.__esModule = true;
  1979. });
  1980. var _defineProperty = unwrapExports(defineProperty);
  1981. var DIRTY_PATHS = new WeakMap();
  1982. var FLUSHING = new WeakMap();
  1983. var NORMALIZING = new WeakMap();
  1984. var PATH_REFS = new WeakMap();
  1985. var POINT_REFS = new WeakMap();
  1986. var RANGE_REFS = new WeakMap();
  1987. function ownKeys$9(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  1988. function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$9(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  1989. function _createForOfIteratorHelper$7(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$7(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  1990. function _unsupportedIterableToArray$7(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$7(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen); }
  1991. function _arrayLikeToArray$7(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  1992. /**
  1993. * Create a new Slate `Editor` object.
  1994. */
  1995. var createEditor$1 = function createEditor() {
  1996. var editor = {
  1997. children: [],
  1998. operations: [],
  1999. selection: null,
  2000. marks: null,
  2001. isInline: function isInline() {
  2002. return false;
  2003. },
  2004. isVoid: function isVoid() {
  2005. return false;
  2006. },
  2007. onChange: function onChange() {},
  2008. apply: function apply(op) {
  2009. var _iterator = _createForOfIteratorHelper$7(Editor.pathRefs(editor)),
  2010. _step;
  2011. try {
  2012. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2013. var ref = _step.value;
  2014. PathRef.transform(ref, op);
  2015. }
  2016. } catch (err) {
  2017. _iterator.e(err);
  2018. } finally {
  2019. _iterator.f();
  2020. }
  2021. var _iterator2 = _createForOfIteratorHelper$7(Editor.pointRefs(editor)),
  2022. _step2;
  2023. try {
  2024. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  2025. var _ref = _step2.value;
  2026. PointRef.transform(_ref, op);
  2027. }
  2028. } catch (err) {
  2029. _iterator2.e(err);
  2030. } finally {
  2031. _iterator2.f();
  2032. }
  2033. var _iterator3 = _createForOfIteratorHelper$7(Editor.rangeRefs(editor)),
  2034. _step3;
  2035. try {
  2036. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  2037. var _ref2 = _step3.value;
  2038. RangeRef.transform(_ref2, op);
  2039. }
  2040. } catch (err) {
  2041. _iterator3.e(err);
  2042. } finally {
  2043. _iterator3.f();
  2044. }
  2045. var set = new Set();
  2046. var dirtyPaths = [];
  2047. var add = function add(path) {
  2048. if (path) {
  2049. var key = path.join(',');
  2050. if (!set.has(key)) {
  2051. set.add(key);
  2052. dirtyPaths.push(path);
  2053. }
  2054. }
  2055. };
  2056. var oldDirtyPaths = DIRTY_PATHS.get(editor) || [];
  2057. var newDirtyPaths = getDirtyPaths(op);
  2058. var _iterator4 = _createForOfIteratorHelper$7(oldDirtyPaths),
  2059. _step4;
  2060. try {
  2061. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  2062. var path = _step4.value;
  2063. var newPath = Path.transform(path, op);
  2064. add(newPath);
  2065. }
  2066. } catch (err) {
  2067. _iterator4.e(err);
  2068. } finally {
  2069. _iterator4.f();
  2070. }
  2071. var _iterator5 = _createForOfIteratorHelper$7(newDirtyPaths),
  2072. _step5;
  2073. try {
  2074. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  2075. var _path = _step5.value;
  2076. add(_path);
  2077. }
  2078. } catch (err) {
  2079. _iterator5.e(err);
  2080. } finally {
  2081. _iterator5.f();
  2082. }
  2083. DIRTY_PATHS.set(editor, dirtyPaths);
  2084. Transforms.transform(editor, op);
  2085. editor.operations.push(op);
  2086. Editor.normalize(editor); // Clear any formats applied to the cursor if the selection changes.
  2087. if (op.type === 'set_selection') {
  2088. editor.marks = null;
  2089. }
  2090. if (!FLUSHING.get(editor)) {
  2091. FLUSHING.set(editor, true);
  2092. Promise.resolve().then(function () {
  2093. FLUSHING.set(editor, false);
  2094. editor.onChange();
  2095. editor.operations = [];
  2096. });
  2097. }
  2098. },
  2099. addMark: function addMark(key, value) {
  2100. var selection = editor.selection;
  2101. if (selection) {
  2102. if (Range.isExpanded(selection)) {
  2103. Transforms.setNodes(editor, _defineProperty({}, key, value), {
  2104. match: Text.isText,
  2105. split: true
  2106. });
  2107. } else {
  2108. var marks = _objectSpread$9(_objectSpread$9({}, Editor.marks(editor) || {}), {}, _defineProperty({}, key, value));
  2109. editor.marks = marks;
  2110. if (!FLUSHING.get(editor)) {
  2111. editor.onChange();
  2112. }
  2113. }
  2114. }
  2115. },
  2116. deleteBackward: function deleteBackward(unit) {
  2117. var selection = editor.selection;
  2118. if (selection && Range.isCollapsed(selection)) {
  2119. Transforms["delete"](editor, {
  2120. unit: unit,
  2121. reverse: true
  2122. });
  2123. }
  2124. },
  2125. deleteForward: function deleteForward(unit) {
  2126. var selection = editor.selection;
  2127. if (selection && Range.isCollapsed(selection)) {
  2128. Transforms["delete"](editor, {
  2129. unit: unit
  2130. });
  2131. }
  2132. },
  2133. deleteFragment: function deleteFragment(direction) {
  2134. var selection = editor.selection;
  2135. if (selection && Range.isExpanded(selection)) {
  2136. Transforms["delete"](editor, {
  2137. reverse: direction === 'backward'
  2138. });
  2139. }
  2140. },
  2141. getFragment: function getFragment() {
  2142. var selection = editor.selection;
  2143. if (selection) {
  2144. return Node$1.fragment(editor, selection);
  2145. }
  2146. return [];
  2147. },
  2148. insertBreak: function insertBreak() {
  2149. Transforms.splitNodes(editor, {
  2150. always: true
  2151. });
  2152. },
  2153. insertFragment: function insertFragment(fragment) {
  2154. Transforms.insertFragment(editor, fragment);
  2155. },
  2156. insertNode: function insertNode(node) {
  2157. Transforms.insertNodes(editor, node);
  2158. },
  2159. insertText: function insertText(text) {
  2160. var selection = editor.selection,
  2161. marks = editor.marks;
  2162. if (selection) {
  2163. if (marks) {
  2164. var node = _objectSpread$9({
  2165. text: text
  2166. }, marks);
  2167. Transforms.insertNodes(editor, node);
  2168. } else {
  2169. Transforms.insertText(editor, text);
  2170. }
  2171. editor.marks = null;
  2172. }
  2173. },
  2174. normalizeNode: function normalizeNode(entry) {
  2175. var _entry = _slicedToArray(entry, 2),
  2176. node = _entry[0],
  2177. path = _entry[1]; // There are no core normalizations for text nodes.
  2178. if (Text.isText(node)) {
  2179. return;
  2180. } // Ensure that block and inline nodes have at least one text child.
  2181. if (Element$1.isElement(node) && node.children.length === 0) {
  2182. var child = {
  2183. text: ''
  2184. };
  2185. Transforms.insertNodes(editor, child, {
  2186. at: path.concat(0),
  2187. voids: true
  2188. });
  2189. return;
  2190. } // Determine whether the node should have block or inline children.
  2191. var shouldHaveInlines = Editor.isEditor(node) ? false : Element$1.isElement(node) && (editor.isInline(node) || node.children.length === 0 || Text.isText(node.children[0]) || editor.isInline(node.children[0])); // Since we'll be applying operations while iterating, keep track of an
  2192. // index that accounts for any added/removed nodes.
  2193. var n = 0;
  2194. for (var i = 0; i < node.children.length; i++, n++) {
  2195. var currentNode = Node$1.get(editor, path);
  2196. if (Text.isText(currentNode)) continue;
  2197. var _child = node.children[i];
  2198. var prev = currentNode.children[n - 1];
  2199. var isLast = i === node.children.length - 1;
  2200. var isInlineOrText = Text.isText(_child) || Element$1.isElement(_child) && editor.isInline(_child); // Only allow block nodes in the top-level children and parent blocks
  2201. // that only contain block nodes. Similarly, only allow inline nodes in
  2202. // other inline nodes, or parent blocks that only contain inlines and
  2203. // text.
  2204. if (isInlineOrText !== shouldHaveInlines) {
  2205. Transforms.removeNodes(editor, {
  2206. at: path.concat(n),
  2207. voids: true
  2208. });
  2209. n--;
  2210. } else if (Element$1.isElement(_child)) {
  2211. // Ensure that inline nodes are surrounded by text nodes.
  2212. if (editor.isInline(_child)) {
  2213. if (prev == null || !Text.isText(prev)) {
  2214. var newChild = {
  2215. text: ''
  2216. };
  2217. Transforms.insertNodes(editor, newChild, {
  2218. at: path.concat(n),
  2219. voids: true
  2220. });
  2221. n++;
  2222. } else if (isLast) {
  2223. var _newChild = {
  2224. text: ''
  2225. };
  2226. Transforms.insertNodes(editor, _newChild, {
  2227. at: path.concat(n + 1),
  2228. voids: true
  2229. });
  2230. n++;
  2231. }
  2232. }
  2233. } else {
  2234. // Merge adjacent text nodes that are empty or match.
  2235. if (prev != null && Text.isText(prev)) {
  2236. if (Text.equals(_child, prev, {
  2237. loose: true
  2238. })) {
  2239. Transforms.mergeNodes(editor, {
  2240. at: path.concat(n),
  2241. voids: true
  2242. });
  2243. n--;
  2244. } else if (prev.text === '') {
  2245. Transforms.removeNodes(editor, {
  2246. at: path.concat(n - 1),
  2247. voids: true
  2248. });
  2249. n--;
  2250. } else if (_child.text === '') {
  2251. Transforms.removeNodes(editor, {
  2252. at: path.concat(n),
  2253. voids: true
  2254. });
  2255. n--;
  2256. }
  2257. }
  2258. }
  2259. }
  2260. },
  2261. removeMark: function removeMark(key) {
  2262. var selection = editor.selection;
  2263. if (selection) {
  2264. if (Range.isExpanded(selection)) {
  2265. Transforms.unsetNodes(editor, key, {
  2266. match: Text.isText,
  2267. split: true
  2268. });
  2269. } else {
  2270. var marks = _objectSpread$9({}, Editor.marks(editor) || {});
  2271. delete marks[key];
  2272. editor.marks = marks;
  2273. if (!FLUSHING.get(editor)) {
  2274. editor.onChange();
  2275. }
  2276. }
  2277. }
  2278. }
  2279. };
  2280. return editor;
  2281. };
  2282. /**
  2283. * Get the "dirty" paths generated from an operation.
  2284. */
  2285. var getDirtyPaths = function getDirtyPaths(op) {
  2286. switch (op.type) {
  2287. case 'insert_text':
  2288. case 'remove_text':
  2289. case 'set_node':
  2290. {
  2291. var path = op.path;
  2292. return Path.levels(path);
  2293. }
  2294. case 'insert_node':
  2295. {
  2296. var node = op.node,
  2297. _path2 = op.path;
  2298. var levels = Path.levels(_path2);
  2299. var descendants = Text.isText(node) ? [] : Array.from(Node$1.nodes(node), function (_ref3) {
  2300. var _ref4 = _slicedToArray(_ref3, 2),
  2301. p = _ref4[1];
  2302. return _path2.concat(p);
  2303. });
  2304. return [].concat(_toConsumableArray(levels), _toConsumableArray(descendants));
  2305. }
  2306. case 'merge_node':
  2307. {
  2308. var _path3 = op.path;
  2309. var ancestors = Path.ancestors(_path3);
  2310. var previousPath = Path.previous(_path3);
  2311. return [].concat(_toConsumableArray(ancestors), [previousPath]);
  2312. }
  2313. case 'move_node':
  2314. {
  2315. var _path4 = op.path,
  2316. newPath = op.newPath;
  2317. if (Path.equals(_path4, newPath)) {
  2318. return [];
  2319. }
  2320. var oldAncestors = [];
  2321. var newAncestors = [];
  2322. var _iterator6 = _createForOfIteratorHelper$7(Path.ancestors(_path4)),
  2323. _step6;
  2324. try {
  2325. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  2326. var ancestor = _step6.value;
  2327. var p = Path.transform(ancestor, op);
  2328. oldAncestors.push(p);
  2329. }
  2330. } catch (err) {
  2331. _iterator6.e(err);
  2332. } finally {
  2333. _iterator6.f();
  2334. }
  2335. var _iterator7 = _createForOfIteratorHelper$7(Path.ancestors(newPath)),
  2336. _step7;
  2337. try {
  2338. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  2339. var _ancestor = _step7.value;
  2340. var _p = Path.transform(_ancestor, op);
  2341. newAncestors.push(_p);
  2342. }
  2343. } catch (err) {
  2344. _iterator7.e(err);
  2345. } finally {
  2346. _iterator7.f();
  2347. }
  2348. var newParent = newAncestors[newAncestors.length - 1];
  2349. var newIndex = newPath[newPath.length - 1];
  2350. var resultPath = newParent.concat(newIndex);
  2351. return [].concat(oldAncestors, newAncestors, [resultPath]);
  2352. }
  2353. case 'remove_node':
  2354. {
  2355. var _path5 = op.path;
  2356. var _ancestors = Path.ancestors(_path5);
  2357. return _toConsumableArray(_ancestors);
  2358. }
  2359. case 'split_node':
  2360. {
  2361. var _path6 = op.path;
  2362. var _levels = Path.levels(_path6);
  2363. var nextPath = Path.next(_path6);
  2364. return [].concat(_toConsumableArray(_levels), [nextPath]);
  2365. }
  2366. default:
  2367. {
  2368. return [];
  2369. }
  2370. }
  2371. };
  2372. var objectWithoutPropertiesLoose = createCommonjsModule(function (module) {
  2373. function _objectWithoutPropertiesLoose(source, excluded) {
  2374. if (source == null) return {};
  2375. var target = {};
  2376. var sourceKeys = Object.keys(source);
  2377. var key, i;
  2378. for (i = 0; i < sourceKeys.length; i++) {
  2379. key = sourceKeys[i];
  2380. if (excluded.indexOf(key) >= 0) continue;
  2381. target[key] = source[key];
  2382. }
  2383. return target;
  2384. }
  2385. module.exports = _objectWithoutPropertiesLoose;
  2386. module.exports["default"] = module.exports, module.exports.__esModule = true;
  2387. });
  2388. unwrapExports(objectWithoutPropertiesLoose);
  2389. var objectWithoutProperties = createCommonjsModule(function (module) {
  2390. function _objectWithoutProperties(source, excluded) {
  2391. if (source == null) return {};
  2392. var target = objectWithoutPropertiesLoose(source, excluded);
  2393. var key, i;
  2394. if (Object.getOwnPropertySymbols) {
  2395. var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  2396. for (i = 0; i < sourceSymbolKeys.length; i++) {
  2397. key = sourceSymbolKeys[i];
  2398. if (excluded.indexOf(key) >= 0) continue;
  2399. if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
  2400. target[key] = source[key];
  2401. }
  2402. }
  2403. return target;
  2404. }
  2405. module.exports = _objectWithoutProperties;
  2406. module.exports["default"] = module.exports, module.exports.__esModule = true;
  2407. });
  2408. var _objectWithoutProperties = unwrapExports(objectWithoutProperties);
  2409. function _createForOfIteratorHelper$6(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$6(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  2410. function _unsupportedIterableToArray$6(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$6(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen); }
  2411. function _arrayLikeToArray$6(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  2412. // Character (grapheme cluster) boundaries are determined according to
  2413. // the default grapheme cluster boundary specification, extended grapheme clusters variant[1].
  2414. //
  2415. // References:
  2416. //
  2417. // [1] https://www.unicode.org/reports/tr29/#Default_Grapheme_Cluster_Table
  2418. // [2] https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt
  2419. // [3] https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.html
  2420. // [4] https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt
  2421. /**
  2422. * Get the distance to the end of the first character in a string of text.
  2423. */
  2424. var getCharacterDistance = function getCharacterDistance(str) {
  2425. var isRTL = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2426. var isLTR = !isRTL;
  2427. var codepoints = isRTL ? codepointsIteratorRTL(str) : str;
  2428. var left = CodepointType.None;
  2429. var right = CodepointType.None;
  2430. var distance = 0; // Evaluation of these conditions are deferred.
  2431. var gb11 = null; // Is GB11 applicable?
  2432. var gb12Or13 = null; // Is GB12 or GB13 applicable?
  2433. var _iterator = _createForOfIteratorHelper$6(codepoints),
  2434. _step;
  2435. try {
  2436. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2437. var _char = _step.value;
  2438. var code = _char.codePointAt(0);
  2439. if (!code) break;
  2440. var type = getCodepointType(_char, code);
  2441. var _ref = isLTR ? [right, type] : [type, left];
  2442. var _ref2 = _slicedToArray(_ref, 2);
  2443. left = _ref2[0];
  2444. right = _ref2[1];
  2445. if (intersects(left, CodepointType.ZWJ) && intersects(right, CodepointType.ExtPict)) {
  2446. if (isLTR) {
  2447. gb11 = endsWithEmojiZWJ(str.substring(0, distance));
  2448. } else {
  2449. gb11 = endsWithEmojiZWJ(str.substring(0, str.length - distance));
  2450. }
  2451. if (!gb11) break;
  2452. }
  2453. if (intersects(left, CodepointType.RI) && intersects(right, CodepointType.RI)) {
  2454. if (gb12Or13 !== null) {
  2455. gb12Or13 = !gb12Or13;
  2456. } else {
  2457. if (isLTR) {
  2458. gb12Or13 = true;
  2459. } else {
  2460. gb12Or13 = endsWithOddNumberOfRIs(str.substring(0, str.length - distance));
  2461. }
  2462. }
  2463. if (!gb12Or13) break;
  2464. }
  2465. if (left !== CodepointType.None && right !== CodepointType.None && isBoundaryPair(left, right)) {
  2466. break;
  2467. }
  2468. distance += _char.length;
  2469. }
  2470. } catch (err) {
  2471. _iterator.e(err);
  2472. } finally {
  2473. _iterator.f();
  2474. }
  2475. return distance || 1;
  2476. };
  2477. var SPACE = /\s/;
  2478. var PUNCTUATION = /[\u0021-\u0023\u0025-\u002A\u002C-\u002F\u003A\u003B\u003F\u0040\u005B-\u005D\u005F\u007B\u007D\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E3B\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;
  2479. var CHAMELEON = /['\u2018\u2019]/;
  2480. /**
  2481. * Get the distance to the end of the first word in a string of text.
  2482. */
  2483. var getWordDistance = function getWordDistance(text) {
  2484. var isRTL = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2485. var dist = 0;
  2486. var started = false;
  2487. while (text.length > 0) {
  2488. var charDist = getCharacterDistance(text, isRTL);
  2489. var _splitByCharacterDist = splitByCharacterDistance(text, charDist, isRTL),
  2490. _splitByCharacterDist2 = _slicedToArray(_splitByCharacterDist, 2),
  2491. _char2 = _splitByCharacterDist2[0],
  2492. remaining = _splitByCharacterDist2[1];
  2493. if (isWordCharacter(_char2, remaining, isRTL)) {
  2494. started = true;
  2495. dist += charDist;
  2496. } else if (!started) {
  2497. dist += charDist;
  2498. } else {
  2499. break;
  2500. }
  2501. text = remaining;
  2502. }
  2503. return dist;
  2504. };
  2505. /**
  2506. * Split a string in two parts at a given distance starting from the end when
  2507. * `isRTL` is set to `true`.
  2508. */
  2509. var splitByCharacterDistance = function splitByCharacterDistance(str, dist, isRTL) {
  2510. if (isRTL) {
  2511. var at = str.length - dist;
  2512. return [str.slice(at, str.length), str.slice(0, at)];
  2513. }
  2514. return [str.slice(0, dist), str.slice(dist)];
  2515. };
  2516. /**
  2517. * Check if a character is a word character. The `remaining` argument is used
  2518. * because sometimes you must read subsequent characters to truly determine it.
  2519. */
  2520. var isWordCharacter = function isWordCharacter(_char3, remaining) {
  2521. var isRTL = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  2522. if (SPACE.test(_char3)) {
  2523. return false;
  2524. } // Chameleons count as word characters as long as they're in a word, so
  2525. // recurse to see if the next one is a word character or not.
  2526. if (CHAMELEON.test(_char3)) {
  2527. var charDist = getCharacterDistance(remaining, isRTL);
  2528. var _splitByCharacterDist3 = splitByCharacterDistance(remaining, charDist, isRTL),
  2529. _splitByCharacterDist4 = _slicedToArray(_splitByCharacterDist3, 2),
  2530. nextChar = _splitByCharacterDist4[0],
  2531. nextRemaining = _splitByCharacterDist4[1];
  2532. if (isWordCharacter(nextChar, nextRemaining, isRTL)) {
  2533. return true;
  2534. }
  2535. }
  2536. if (PUNCTUATION.test(_char3)) {
  2537. return false;
  2538. }
  2539. return true;
  2540. };
  2541. /**
  2542. * Iterate on codepoints from right to left.
  2543. */
  2544. var codepointsIteratorRTL = function* codepointsIteratorRTL(str) {
  2545. var end = str.length - 1;
  2546. for (var i = 0; i < str.length; i++) {
  2547. var char1 = str.charAt(end - i);
  2548. if (isLowSurrogate(char1.charCodeAt(0))) {
  2549. var char2 = str.charAt(end - i - 1);
  2550. if (isHighSurrogate(char2.charCodeAt(0))) {
  2551. yield char2 + char1;
  2552. i++;
  2553. continue;
  2554. }
  2555. }
  2556. yield char1;
  2557. }
  2558. };
  2559. /**
  2560. * Is `charCode` a high surrogate.
  2561. *
  2562. * https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates
  2563. */
  2564. var isHighSurrogate = function isHighSurrogate(charCode) {
  2565. return charCode >= 0xd800 && charCode <= 0xdbff;
  2566. };
  2567. /**
  2568. * Is `charCode` a low surrogate.
  2569. *
  2570. * https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates
  2571. */
  2572. var isLowSurrogate = function isLowSurrogate(charCode) {
  2573. return charCode >= 0xdc00 && charCode <= 0xdfff;
  2574. };
  2575. var CodepointType;
  2576. (function (CodepointType) {
  2577. CodepointType[CodepointType["None"] = 0] = "None";
  2578. CodepointType[CodepointType["Extend"] = 1] = "Extend";
  2579. CodepointType[CodepointType["ZWJ"] = 2] = "ZWJ";
  2580. CodepointType[CodepointType["RI"] = 4] = "RI";
  2581. CodepointType[CodepointType["Prepend"] = 8] = "Prepend";
  2582. CodepointType[CodepointType["SpacingMark"] = 16] = "SpacingMark";
  2583. CodepointType[CodepointType["L"] = 32] = "L";
  2584. CodepointType[CodepointType["V"] = 64] = "V";
  2585. CodepointType[CodepointType["T"] = 128] = "T";
  2586. CodepointType[CodepointType["LV"] = 256] = "LV";
  2587. CodepointType[CodepointType["LVT"] = 512] = "LVT";
  2588. CodepointType[CodepointType["ExtPict"] = 1024] = "ExtPict";
  2589. CodepointType[CodepointType["Any"] = 2048] = "Any";
  2590. })(CodepointType || (CodepointType = {}));
  2591. var reExtend = /^(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1AC0\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50]|\uD804[\uDC01\uDC38-\uDC46\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])$/;
  2592. var rePrepend = /^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/;
  2593. var reSpacingMark = /^(?:[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E\u094F\u0982\u0983\u09BF\u09C0\u09C7\u09C8\u09CB\u09CC\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB\u0ACC\u0B02\u0B03\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0C01-\u0C03\u0C41-\u0C44\u0C82\u0C83\u0CBE\u0CC0\u0CC1\u0CC3\u0CC4\u0CC7\u0CC8\u0CCA\u0CCB\u0D02\u0D03\u0D3F\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D82\u0D83\u0DD0\u0DD1\u0DD8-\u0DDE\u0DF2\u0DF3\u0E33\u0EB3\u0F3E\u0F3F\u0F7F\u1031\u103B\u103C\u1056\u1057\u1084\u1715\u1734\u17B6\u17BE-\u17C5\u17C7\u17C8\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1A19\u1A1A\u1A55\u1A57\u1A6D-\u1A72\u1B04\u1B3B\u1B3D-\u1B41\u1B43\u1B44\u1B82\u1BA1\u1BA6\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1C24-\u1C2B\u1C34\u1C35\u1CE1\u1CF7\uA823\uA824\uA827\uA880\uA881\uA8B4-\uA8C3\uA952\uA953\uA983\uA9B4\uA9B5\uA9BA\uA9BB\uA9BE-\uA9C0\uAA2F\uAA30\uAA33\uAA34\uAA4D\uAAEB\uAAEE\uAAEF\uAAF5\uABE3\uABE4\uABE6\uABE7\uABE9\uABEA\uABEC]|\uD804[\uDC00\uDC02\uDC82\uDCB0-\uDCB2\uDCB7\uDCB8\uDD2C\uDD45\uDD46\uDD82\uDDB3-\uDDB5\uDDBF\uDDC0\uDDCE\uDE2C-\uDE2E\uDE32\uDE33\uDE35\uDEE0-\uDEE2\uDF02\uDF03\uDF3F\uDF41-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF62\uDF63]|\uD805[\uDC35-\uDC37\uDC40\uDC41\uDC45\uDCB1\uDCB2\uDCB9\uDCBB\uDCBC\uDCBE\uDCC1\uDDB0\uDDB1\uDDB8-\uDDBB\uDDBE\uDE30-\uDE32\uDE3B\uDE3C\uDE3E\uDEAC\uDEAE\uDEAF\uDEB6\uDF26]|\uD806[\uDC2C-\uDC2E\uDC38\uDD31-\uDD35\uDD37\uDD38\uDD3D\uDD40\uDD42\uDDD1-\uDDD3\uDDDC-\uDDDF\uDDE4\uDE39\uDE57\uDE58\uDE97]|\uD807[\uDC2F\uDC3E\uDCA9\uDCB1\uDCB4\uDD8A-\uDD8E\uDD93\uDD94\uDD96\uDEF5\uDEF6]|\uD81B[\uDF51-\uDF87\uDFF0\uDFF1]|\uD834[\uDD66\uDD6D])$/;
  2594. var reL = /^[\u1100-\u115F\uA960-\uA97C]$/;
  2595. var reV = /^[\u1160-\u11A7\uD7B0-\uD7C6]$/;
  2596. var reT = /^[\u11A8-\u11FF\uD7CB-\uD7FB]$/;
  2597. var reLV = /^[\uAC00\uAC1C\uAC38\uAC54\uAC70\uAC8C\uACA8\uACC4\uACE0\uACFC\uAD18\uAD34\uAD50\uAD6C\uAD88\uADA4\uADC0\uADDC\uADF8\uAE14\uAE30\uAE4C\uAE68\uAE84\uAEA0\uAEBC\uAED8\uAEF4\uAF10\uAF2C\uAF48\uAF64\uAF80\uAF9C\uAFB8\uAFD4\uAFF0\uB00C\uB028\uB044\uB060\uB07C\uB098\uB0B4\uB0D0\uB0EC\uB108\uB124\uB140\uB15C\uB178\uB194\uB1B0\uB1CC\uB1E8\uB204\uB220\uB23C\uB258\uB274\uB290\uB2AC\uB2C8\uB2E4\uB300\uB31C\uB338\uB354\uB370\uB38C\uB3A8\uB3C4\uB3E0\uB3FC\uB418\uB434\uB450\uB46C\uB488\uB4A4\uB4C0\uB4DC\uB4F8\uB514\uB530\uB54C\uB568\uB584\uB5A0\uB5BC\uB5D8\uB5F4\uB610\uB62C\uB648\uB664\uB680\uB69C\uB6B8\uB6D4\uB6F0\uB70C\uB728\uB744\uB760\uB77C\uB798\uB7B4\uB7D0\uB7EC\uB808\uB824\uB840\uB85C\uB878\uB894\uB8B0\uB8CC\uB8E8\uB904\uB920\uB93C\uB958\uB974\uB990\uB9AC\uB9C8\uB9E4\uBA00\uBA1C\uBA38\uBA54\uBA70\uBA8C\uBAA8\uBAC4\uBAE0\uBAFC\uBB18\uBB34\uBB50\uBB6C\uBB88\uBBA4\uBBC0\uBBDC\uBBF8\uBC14\uBC30\uBC4C\uBC68\uBC84\uBCA0\uBCBC\uBCD8\uBCF4\uBD10\uBD2C\uBD48\uBD64\uBD80\uBD9C\uBDB8\uBDD4\uBDF0\uBE0C\uBE28\uBE44\uBE60\uBE7C\uBE98\uBEB4\uBED0\uBEEC\uBF08\uBF24\uBF40\uBF5C\uBF78\uBF94\uBFB0\uBFCC\uBFE8\uC004\uC020\uC03C\uC058\uC074\uC090\uC0AC\uC0C8\uC0E4\uC100\uC11C\uC138\uC154\uC170\uC18C\uC1A8\uC1C4\uC1E0\uC1FC\uC218\uC234\uC250\uC26C\uC288\uC2A4\uC2C0\uC2DC\uC2F8\uC314\uC330\uC34C\uC368\uC384\uC3A0\uC3BC\uC3D8\uC3F4\uC410\uC42C\uC448\uC464\uC480\uC49C\uC4B8\uC4D4\uC4F0\uC50C\uC528\uC544\uC560\uC57C\uC598\uC5B4\uC5D0\uC5EC\uC608\uC624\uC640\uC65C\uC678\uC694\uC6B0\uC6CC\uC6E8\uC704\uC720\uC73C\uC758\uC774\uC790\uC7AC\uC7C8\uC7E4\uC800\uC81C\uC838\uC854\uC870\uC88C\uC8A8\uC8C4\uC8E0\uC8FC\uC918\uC934\uC950\uC96C\uC988\uC9A4\uC9C0\uC9DC\uC9F8\uCA14\uCA30\uCA4C\uCA68\uCA84\uCAA0\uCABC\uCAD8\uCAF4\uCB10\uCB2C\uCB48\uCB64\uCB80\uCB9C\uCBB8\uCBD4\uCBF0\uCC0C\uCC28\uCC44\uCC60\uCC7C\uCC98\uCCB4\uCCD0\uCCEC\uCD08\uCD24\uCD40\uCD5C\uCD78\uCD94\uCDB0\uCDCC\uCDE8\uCE04\uCE20\uCE3C\uCE58\uCE74\uCE90\uCEAC\uCEC8\uCEE4\uCF00\uCF1C\uCF38\uCF54\uCF70\uCF8C\uCFA8\uCFC4\uCFE0\uCFFC\uD018\uD034\uD050\uD06C\uD088\uD0A4\uD0C0\uD0DC\uD0F8\uD114\uD130\uD14C\uD168\uD184\uD1A0\uD1BC\uD1D8\uD1F4\uD210\uD22C\uD248\uD264\uD280\uD29C\uD2B8\uD2D4\uD2F0\uD30C\uD328\uD344\uD360\uD37C\uD398\uD3B4\uD3D0\uD3EC\uD408\uD424\uD440\uD45C\uD478\uD494\uD4B0\uD4CC\uD4E8\uD504\uD520\uD53C\uD558\uD574\uD590\uD5AC\uD5C8\uD5E4\uD600\uD61C\uD638\uD654\uD670\uD68C\uD6A8\uD6C4\uD6E0\uD6FC\uD718\uD734\uD750\uD76C\uD788]$/;
  2598. var reLVT = /^[\uAC01-\uAC1B\uAC1D-\uAC37\uAC39-\uAC53\uAC55-\uAC6F\uAC71-\uAC8B\uAC8D-\uACA7\uACA9-\uACC3\uACC5-\uACDF\uACE1-\uACFB\uACFD-\uAD17\uAD19-\uAD33\uAD35-\uAD4F\uAD51-\uAD6B\uAD6D-\uAD87\uAD89-\uADA3\uADA5-\uADBF\uADC1-\uADDB\uADDD-\uADF7\uADF9-\uAE13\uAE15-\uAE2F\uAE31-\uAE4B\uAE4D-\uAE67\uAE69-\uAE83\uAE85-\uAE9F\uAEA1-\uAEBB\uAEBD-\uAED7\uAED9-\uAEF3\uAEF5-\uAF0F\uAF11-\uAF2B\uAF2D-\uAF47\uAF49-\uAF63\uAF65-\uAF7F\uAF81-\uAF9B\uAF9D-\uAFB7\uAFB9-\uAFD3\uAFD5-\uAFEF\uAFF1-\uB00B\uB00D-\uB027\uB029-\uB043\uB045-\uB05F\uB061-\uB07B\uB07D-\uB097\uB099-\uB0B3\uB0B5-\uB0CF\uB0D1-\uB0EB\uB0ED-\uB107\uB109-\uB123\uB125-\uB13F\uB141-\uB15B\uB15D-\uB177\uB179-\uB193\uB195-\uB1AF\uB1B1-\uB1CB\uB1CD-\uB1E7\uB1E9-\uB203\uB205-\uB21F\uB221-\uB23B\uB23D-\uB257\uB259-\uB273\uB275-\uB28F\uB291-\uB2AB\uB2AD-\uB2C7\uB2C9-\uB2E3\uB2E5-\uB2FF\uB301-\uB31B\uB31D-\uB337\uB339-\uB353\uB355-\uB36F\uB371-\uB38B\uB38D-\uB3A7\uB3A9-\uB3C3\uB3C5-\uB3DF\uB3E1-\uB3FB\uB3FD-\uB417\uB419-\uB433\uB435-\uB44F\uB451-\uB46B\uB46D-\uB487\uB489-\uB4A3\uB4A5-\uB4BF\uB4C1-\uB4DB\uB4DD-\uB4F7\uB4F9-\uB513\uB515-\uB52F\uB531-\uB54B\uB54D-\uB567\uB569-\uB583\uB585-\uB59F\uB5A1-\uB5BB\uB5BD-\uB5D7\uB5D9-\uB5F3\uB5F5-\uB60F\uB611-\uB62B\uB62D-\uB647\uB649-\uB663\uB665-\uB67F\uB681-\uB69B\uB69D-\uB6B7\uB6B9-\uB6D3\uB6D5-\uB6EF\uB6F1-\uB70B\uB70D-\uB727\uB729-\uB743\uB745-\uB75F\uB761-\uB77B\uB77D-\uB797\uB799-\uB7B3\uB7B5-\uB7CF\uB7D1-\uB7EB\uB7ED-\uB807\uB809-\uB823\uB825-\uB83F\uB841-\uB85B\uB85D-\uB877\uB879-\uB893\uB895-\uB8AF\uB8B1-\uB8CB\uB8CD-\uB8E7\uB8E9-\uB903\uB905-\uB91F\uB921-\uB93B\uB93D-\uB957\uB959-\uB973\uB975-\uB98F\uB991-\uB9AB\uB9AD-\uB9C7\uB9C9-\uB9E3\uB9E5-\uB9FF\uBA01-\uBA1B\uBA1D-\uBA37\uBA39-\uBA53\uBA55-\uBA6F\uBA71-\uBA8B\uBA8D-\uBAA7\uBAA9-\uBAC3\uBAC5-\uBADF\uBAE1-\uBAFB\uBAFD-\uBB17\uBB19-\uBB33\uBB35-\uBB4F\uBB51-\uBB6B\uBB6D-\uBB87\uBB89-\uBBA3\uBBA5-\uBBBF\uBBC1-\uBBDB\uBBDD-\uBBF7\uBBF9-\uBC13\uBC15-\uBC2F\uBC31-\uBC4B\uBC4D-\uBC67\uBC69-\uBC83\uBC85-\uBC9F\uBCA1-\uBCBB\uBCBD-\uBCD7\uBCD9-\uBCF3\uBCF5-\uBD0F\uBD11-\uBD2B\uBD2D-\uBD47\uBD49-\uBD63\uBD65-\uBD7F\uBD81-\uBD9B\uBD9D-\uBDB7\uBDB9-\uBDD3\uBDD5-\uBDEF\uBDF1-\uBE0B\uBE0D-\uBE27\uBE29-\uBE43\uBE45-\uBE5F\uBE61-\uBE7B\uBE7D-\uBE97\uBE99-\uBEB3\uBEB5-\uBECF\uBED1-\uBEEB\uBEED-\uBF07\uBF09-\uBF23\uBF25-\uBF3F\uBF41-\uBF5B\uBF5D-\uBF77\uBF79-\uBF93\uBF95-\uBFAF\uBFB1-\uBFCB\uBFCD-\uBFE7\uBFE9-\uC003\uC005-\uC01F\uC021-\uC03B\uC03D-\uC057\uC059-\uC073\uC075-\uC08F\uC091-\uC0AB\uC0AD-\uC0C7\uC0C9-\uC0E3\uC0E5-\uC0FF\uC101-\uC11B\uC11D-\uC137\uC139-\uC153\uC155-\uC16F\uC171-\uC18B\uC18D-\uC1A7\uC1A9-\uC1C3\uC1C5-\uC1DF\uC1E1-\uC1FB\uC1FD-\uC217\uC219-\uC233\uC235-\uC24F\uC251-\uC26B\uC26D-\uC287\uC289-\uC2A3\uC2A5-\uC2BF\uC2C1-\uC2DB\uC2DD-\uC2F7\uC2F9-\uC313\uC315-\uC32F\uC331-\uC34B\uC34D-\uC367\uC369-\uC383\uC385-\uC39F\uC3A1-\uC3BB\uC3BD-\uC3D7\uC3D9-\uC3F3\uC3F5-\uC40F\uC411-\uC42B\uC42D-\uC447\uC449-\uC463\uC465-\uC47F\uC481-\uC49B\uC49D-\uC4B7\uC4B9-\uC4D3\uC4D5-\uC4EF\uC4F1-\uC50B\uC50D-\uC527\uC529-\uC543\uC545-\uC55F\uC561-\uC57B\uC57D-\uC597\uC599-\uC5B3\uC5B5-\uC5CF\uC5D1-\uC5EB\uC5ED-\uC607\uC609-\uC623\uC625-\uC63F\uC641-\uC65B\uC65D-\uC677\uC679-\uC693\uC695-\uC6AF\uC6B1-\uC6CB\uC6CD-\uC6E7\uC6E9-\uC703\uC705-\uC71F\uC721-\uC73B\uC73D-\uC757\uC759-\uC773\uC775-\uC78F\uC791-\uC7AB\uC7AD-\uC7C7\uC7C9-\uC7E3\uC7E5-\uC7FF\uC801-\uC81B\uC81D-\uC837\uC839-\uC853\uC855-\uC86F\uC871-\uC88B\uC88D-\uC8A7\uC8A9-\uC8C3\uC8C5-\uC8DF\uC8E1-\uC8FB\uC8FD-\uC917\uC919-\uC933\uC935-\uC94F\uC951-\uC96B\uC96D-\uC987\uC989-\uC9A3\uC9A5-\uC9BF\uC9C1-\uC9DB\uC9DD-\uC9F7\uC9F9-\uCA13\uCA15-\uCA2F\uCA31-\uCA4B\uCA4D-\uCA67\uCA69-\uCA83\uCA85-\uCA9F\uCAA1-\uCABB\uCABD-\uCAD7\uCAD9-\uCAF3\uCAF5-\uCB0F\uCB11-\uCB2B\uCB2D-\uCB47\uCB49-\uCB63\uCB65-\uCB7F\uCB81-\uCB9B\uCB9D-\uCBB7\uCBB9-\uCBD3\uCBD5-\uCBEF\uCBF1-\uCC0B\uCC0D-\uCC27\uCC29-\uCC43\uCC45-\uCC5F\uCC61-\uCC7B\uCC7D-\uCC97\uCC99-\uCCB3\uCCB5-\uCCCF\uCCD1-\uCCEB\uCCED-\uCD07\uCD09-\uCD23\uCD25-\uCD3F\uCD41-\uCD5B\uCD5D-\uCD77\uCD79-\uCD93\uCD95-\uCDAF\uCDB1-\uCDCB\uCDCD-\uCDE7\uCDE9-\uCE03\uCE05-\uCE1F\uCE21-\uCE3B\uCE3D-\uCE57\uCE59-\uCE73\uCE75-\uCE8F\uCE91-\uCEAB\uCEAD-\uCEC7\uCEC9-\uCEE3\uCEE5-\uCEFF\uCF01-\uCF1B\uCF1D-\uCF37\uCF39-\uCF53\uCF55-\uCF6F\uCF71-\uCF8B\uCF8D-\uCFA7\uCFA9-\uCFC3\uCFC5-\uCFDF\uCFE1-\uCFFB\uCFFD-\uD017\uD019-\uD033\uD035-\uD04F\uD051-\uD06B\uD06D-\uD087\uD089-\uD0A3\uD0A5-\uD0BF\uD0C1-\uD0DB\uD0DD-\uD0F7\uD0F9-\uD113\uD115-\uD12F\uD131-\uD14B\uD14D-\uD167\uD169-\uD183\uD185-\uD19F\uD1A1-\uD1BB\uD1BD-\uD1D7\uD1D9-\uD1F3\uD1F5-\uD20F\uD211-\uD22B\uD22D-\uD247\uD249-\uD263\uD265-\uD27F\uD281-\uD29B\uD29D-\uD2B7\uD2B9-\uD2D3\uD2D5-\uD2EF\uD2F1-\uD30B\uD30D-\uD327\uD329-\uD343\uD345-\uD35F\uD361-\uD37B\uD37D-\uD397\uD399-\uD3B3\uD3B5-\uD3CF\uD3D1-\uD3EB\uD3ED-\uD407\uD409-\uD423\uD425-\uD43F\uD441-\uD45B\uD45D-\uD477\uD479-\uD493\uD495-\uD4AF\uD4B1-\uD4CB\uD4CD-\uD4E7\uD4E9-\uD503\uD505-\uD51F\uD521-\uD53B\uD53D-\uD557\uD559-\uD573\uD575-\uD58F\uD591-\uD5AB\uD5AD-\uD5C7\uD5C9-\uD5E3\uD5E5-\uD5FF\uD601-\uD61B\uD61D-\uD637\uD639-\uD653\uD655-\uD66F\uD671-\uD68B\uD68D-\uD6A7\uD6A9-\uD6C3\uD6C5-\uD6DF\uD6E1-\uD6FB\uD6FD-\uD717\uD719-\uD733\uD735-\uD74F\uD751-\uD76B\uD76D-\uD787\uD789-\uD7A3]$/;
  2599. var reExtPict = /^(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])$/;
  2600. var getCodepointType = function getCodepointType(_char4, code) {
  2601. var type = CodepointType.Any;
  2602. if (_char4.search(reExtend) !== -1) {
  2603. type |= CodepointType.Extend;
  2604. }
  2605. if (code === 0x200d) {
  2606. type |= CodepointType.ZWJ;
  2607. }
  2608. if (code >= 0x1f1e6 && code <= 0x1f1ff) {
  2609. type |= CodepointType.RI;
  2610. }
  2611. if (_char4.search(rePrepend) !== -1) {
  2612. type |= CodepointType.Prepend;
  2613. }
  2614. if (_char4.search(reSpacingMark) !== -1) {
  2615. type |= CodepointType.SpacingMark;
  2616. }
  2617. if (_char4.search(reL) !== -1) {
  2618. type |= CodepointType.L;
  2619. }
  2620. if (_char4.search(reV) !== -1) {
  2621. type |= CodepointType.V;
  2622. }
  2623. if (_char4.search(reT) !== -1) {
  2624. type |= CodepointType.T;
  2625. }
  2626. if (_char4.search(reLV) !== -1) {
  2627. type |= CodepointType.LV;
  2628. }
  2629. if (_char4.search(reLVT) !== -1) {
  2630. type |= CodepointType.LVT;
  2631. }
  2632. if (_char4.search(reExtPict) !== -1) {
  2633. type |= CodepointType.ExtPict;
  2634. }
  2635. return type;
  2636. };
  2637. function intersects(x, y) {
  2638. return (x & y) !== 0;
  2639. }
  2640. var NonBoundaryPairs = [// GB6
  2641. [CodepointType.L, CodepointType.L | CodepointType.V | CodepointType.LV | CodepointType.LVT], // GB7
  2642. [CodepointType.LV | CodepointType.V, CodepointType.V | CodepointType.T], // GB8
  2643. [CodepointType.LVT | CodepointType.T, CodepointType.T], // GB9
  2644. [CodepointType.Any, CodepointType.Extend | CodepointType.ZWJ], // GB9a
  2645. [CodepointType.Any, CodepointType.SpacingMark], // GB9b
  2646. [CodepointType.Prepend, CodepointType.Any], // GB11
  2647. [CodepointType.ZWJ, CodepointType.ExtPict], // GB12 and GB13
  2648. [CodepointType.RI, CodepointType.RI]];
  2649. function isBoundaryPair(left, right) {
  2650. return NonBoundaryPairs.findIndex(function (r) {
  2651. return intersects(left, r[0]) && intersects(right, r[1]);
  2652. }) === -1;
  2653. }
  2654. var endingEmojiZWJ = /(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1AC0\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50]|\uD804[\uDC01\uDC38-\uDC46\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])*\u200D$/;
  2655. var endsWithEmojiZWJ = function endsWithEmojiZWJ(str) {
  2656. return str.search(endingEmojiZWJ) !== -1;
  2657. };
  2658. var endingRIs = /(?:\uD83C[\uDDE6-\uDDFF])+$/g;
  2659. var endsWithOddNumberOfRIs = function endsWithOddNumberOfRIs(str) {
  2660. var match = str.match(endingRIs);
  2661. if (match === null) {
  2662. return false;
  2663. } else {
  2664. // A RI is represented by a surrogate pair.
  2665. var numRIs = match[0].length / 2;
  2666. return numRIs % 2 === 1;
  2667. }
  2668. };
  2669. /**
  2670. * Shared the function with isElementType utility
  2671. */
  2672. var isElement = function isElement(value) {
  2673. return isPlainObject.isPlainObject(value) && Node$1.isNodeList(value.children) && !Editor.isEditor(value);
  2674. };
  2675. var Element$1 = {
  2676. /**
  2677. * Check if a value implements the 'Ancestor' interface.
  2678. */
  2679. isAncestor: function isAncestor(value) {
  2680. return isPlainObject.isPlainObject(value) && Node$1.isNodeList(value.children);
  2681. },
  2682. /**
  2683. * Check if a value implements the `Element` interface.
  2684. */
  2685. isElement: isElement,
  2686. /**
  2687. * Check if a value is an array of `Element` objects.
  2688. */
  2689. isElementList: function isElementList(value) {
  2690. return Array.isArray(value) && value.every(function (val) {
  2691. return Element$1.isElement(val);
  2692. });
  2693. },
  2694. /**
  2695. * Check if a set of props is a partial of Element.
  2696. */
  2697. isElementProps: function isElementProps(props) {
  2698. return props.children !== undefined;
  2699. },
  2700. /**
  2701. * Check if a value implements the `Element` interface and has elementKey with selected value.
  2702. * Default it check to `type` key value
  2703. */
  2704. isElementType: function isElementType(value, elementVal) {
  2705. var elementKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'type';
  2706. return isElement(value) && value[elementKey] === elementVal;
  2707. },
  2708. /**
  2709. * Check if an element matches set of properties.
  2710. *
  2711. * Note: this checks custom properties, and it does not ensure that any
  2712. * children are equivalent.
  2713. */
  2714. matches: function matches(element, props) {
  2715. for (var key in props) {
  2716. if (key === 'children') {
  2717. continue;
  2718. }
  2719. if (element[key] !== props[key]) {
  2720. return false;
  2721. }
  2722. }
  2723. return true;
  2724. }
  2725. };
  2726. var _excluded$4 = ["text"],
  2727. _excluded2$3 = ["text"];
  2728. function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  2729. function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  2730. function _createForOfIteratorHelper$5(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  2731. function _unsupportedIterableToArray$5(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); }
  2732. function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  2733. var IS_EDITOR_CACHE = new WeakMap();
  2734. var Editor = {
  2735. /**
  2736. * Get the ancestor above a location in the document.
  2737. */
  2738. above: function above(editor) {
  2739. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2740. var _options$voids = options.voids,
  2741. voids = _options$voids === void 0 ? false : _options$voids,
  2742. _options$mode = options.mode,
  2743. mode = _options$mode === void 0 ? 'lowest' : _options$mode,
  2744. _options$at = options.at,
  2745. at = _options$at === void 0 ? editor.selection : _options$at,
  2746. match = options.match;
  2747. if (!at) {
  2748. return;
  2749. }
  2750. var path = Editor.path(editor, at);
  2751. var reverse = mode === 'lowest';
  2752. var _iterator = _createForOfIteratorHelper$5(Editor.levels(editor, {
  2753. at: path,
  2754. voids: voids,
  2755. match: match,
  2756. reverse: reverse
  2757. })),
  2758. _step;
  2759. try {
  2760. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2761. var _step$value = _slicedToArray(_step.value, 2),
  2762. n = _step$value[0],
  2763. p = _step$value[1];
  2764. if (!Text.isText(n) && !Path.equals(path, p)) {
  2765. return [n, p];
  2766. }
  2767. }
  2768. } catch (err) {
  2769. _iterator.e(err);
  2770. } finally {
  2771. _iterator.f();
  2772. }
  2773. },
  2774. /**
  2775. * Add a custom property to the leaf text nodes in the current selection.
  2776. *
  2777. * If the selection is currently collapsed, the marks will be added to the
  2778. * `editor.marks` property instead, and applied when text is inserted next.
  2779. */
  2780. addMark: function addMark(editor, key, value) {
  2781. editor.addMark(key, value);
  2782. },
  2783. /**
  2784. * Get the point after a location.
  2785. */
  2786. after: function after(editor, at) {
  2787. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2788. var anchor = Editor.point(editor, at, {
  2789. edge: 'end'
  2790. });
  2791. var focus = Editor.end(editor, []);
  2792. var range = {
  2793. anchor: anchor,
  2794. focus: focus
  2795. };
  2796. var _options$distance = options.distance,
  2797. distance = _options$distance === void 0 ? 1 : _options$distance;
  2798. var d = 0;
  2799. var target;
  2800. var _iterator2 = _createForOfIteratorHelper$5(Editor.positions(editor, _objectSpread$8(_objectSpread$8({}, options), {}, {
  2801. at: range
  2802. }))),
  2803. _step2;
  2804. try {
  2805. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  2806. var p = _step2.value;
  2807. if (d > distance) {
  2808. break;
  2809. }
  2810. if (d !== 0) {
  2811. target = p;
  2812. }
  2813. d++;
  2814. }
  2815. } catch (err) {
  2816. _iterator2.e(err);
  2817. } finally {
  2818. _iterator2.f();
  2819. }
  2820. return target;
  2821. },
  2822. /**
  2823. * Get the point before a location.
  2824. */
  2825. before: function before(editor, at) {
  2826. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2827. var anchor = Editor.start(editor, []);
  2828. var focus = Editor.point(editor, at, {
  2829. edge: 'start'
  2830. });
  2831. var range = {
  2832. anchor: anchor,
  2833. focus: focus
  2834. };
  2835. var _options$distance2 = options.distance,
  2836. distance = _options$distance2 === void 0 ? 1 : _options$distance2;
  2837. var d = 0;
  2838. var target;
  2839. var _iterator3 = _createForOfIteratorHelper$5(Editor.positions(editor, _objectSpread$8(_objectSpread$8({}, options), {}, {
  2840. at: range,
  2841. reverse: true
  2842. }))),
  2843. _step3;
  2844. try {
  2845. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  2846. var p = _step3.value;
  2847. if (d > distance) {
  2848. break;
  2849. }
  2850. if (d !== 0) {
  2851. target = p;
  2852. }
  2853. d++;
  2854. }
  2855. } catch (err) {
  2856. _iterator3.e(err);
  2857. } finally {
  2858. _iterator3.f();
  2859. }
  2860. return target;
  2861. },
  2862. /**
  2863. * Delete content in the editor backward from the current selection.
  2864. */
  2865. deleteBackward: function deleteBackward(editor) {
  2866. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2867. var _options$unit = options.unit,
  2868. unit = _options$unit === void 0 ? 'character' : _options$unit;
  2869. editor.deleteBackward(unit);
  2870. },
  2871. /**
  2872. * Delete content in the editor forward from the current selection.
  2873. */
  2874. deleteForward: function deleteForward(editor) {
  2875. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2876. var _options$unit2 = options.unit,
  2877. unit = _options$unit2 === void 0 ? 'character' : _options$unit2;
  2878. editor.deleteForward(unit);
  2879. },
  2880. /**
  2881. * Delete the content in the current selection.
  2882. */
  2883. deleteFragment: function deleteFragment(editor) {
  2884. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2885. var _options$direction = options.direction,
  2886. direction = _options$direction === void 0 ? 'forward' : _options$direction;
  2887. editor.deleteFragment(direction);
  2888. },
  2889. /**
  2890. * Get the start and end points of a location.
  2891. */
  2892. edges: function edges(editor, at) {
  2893. return [Editor.start(editor, at), Editor.end(editor, at)];
  2894. },
  2895. /**
  2896. * Get the end point of a location.
  2897. */
  2898. end: function end(editor, at) {
  2899. return Editor.point(editor, at, {
  2900. edge: 'end'
  2901. });
  2902. },
  2903. /**
  2904. * Get the first node at a location.
  2905. */
  2906. first: function first(editor, at) {
  2907. var path = Editor.path(editor, at, {
  2908. edge: 'start'
  2909. });
  2910. return Editor.node(editor, path);
  2911. },
  2912. /**
  2913. * Get the fragment at a location.
  2914. */
  2915. fragment: function fragment(editor, at) {
  2916. var range = Editor.range(editor, at);
  2917. var fragment = Node$1.fragment(editor, range);
  2918. return fragment;
  2919. },
  2920. /**
  2921. * Check if a node has block children.
  2922. */
  2923. hasBlocks: function hasBlocks(editor, element) {
  2924. return element.children.some(function (n) {
  2925. return Editor.isBlock(editor, n);
  2926. });
  2927. },
  2928. /**
  2929. * Check if a node has inline and text children.
  2930. */
  2931. hasInlines: function hasInlines(editor, element) {
  2932. return element.children.some(function (n) {
  2933. return Text.isText(n) || Editor.isInline(editor, n);
  2934. });
  2935. },
  2936. /**
  2937. * Check if a node has text children.
  2938. */
  2939. hasTexts: function hasTexts(editor, element) {
  2940. return element.children.every(function (n) {
  2941. return Text.isText(n);
  2942. });
  2943. },
  2944. /**
  2945. * Insert a block break at the current selection.
  2946. *
  2947. * If the selection is currently expanded, it will be deleted first.
  2948. */
  2949. insertBreak: function insertBreak(editor) {
  2950. editor.insertBreak();
  2951. },
  2952. /**
  2953. * Insert a fragment at the current selection.
  2954. *
  2955. * If the selection is currently expanded, it will be deleted first.
  2956. */
  2957. insertFragment: function insertFragment(editor, fragment) {
  2958. editor.insertFragment(fragment);
  2959. },
  2960. /**
  2961. * Insert a node at the current selection.
  2962. *
  2963. * If the selection is currently expanded, it will be deleted first.
  2964. */
  2965. insertNode: function insertNode(editor, node) {
  2966. editor.insertNode(node);
  2967. },
  2968. /**
  2969. * Insert text at the current selection.
  2970. *
  2971. * If the selection is currently expanded, it will be deleted first.
  2972. */
  2973. insertText: function insertText(editor, text) {
  2974. editor.insertText(text);
  2975. },
  2976. /**
  2977. * Check if a value is a block `Element` object.
  2978. */
  2979. isBlock: function isBlock(editor, value) {
  2980. return Element$1.isElement(value) && !editor.isInline(value);
  2981. },
  2982. /**
  2983. * Check if a value is an `Editor` object.
  2984. */
  2985. isEditor: function isEditor(value) {
  2986. if (!isPlainObject.isPlainObject(value)) return false;
  2987. var cachedIsEditor = IS_EDITOR_CACHE.get(value);
  2988. if (cachedIsEditor !== undefined) {
  2989. return cachedIsEditor;
  2990. }
  2991. var isEditor = typeof value.addMark === 'function' && typeof value.apply === 'function' && typeof value.deleteBackward === 'function' && typeof value.deleteForward === 'function' && typeof value.deleteFragment === 'function' && typeof value.insertBreak === 'function' && typeof value.insertFragment === 'function' && typeof value.insertNode === 'function' && typeof value.insertText === 'function' && typeof value.isInline === 'function' && typeof value.isVoid === 'function' && typeof value.normalizeNode === 'function' && typeof value.onChange === 'function' && typeof value.removeMark === 'function' && (value.marks === null || isPlainObject.isPlainObject(value.marks)) && (value.selection === null || Range.isRange(value.selection)) && Node$1.isNodeList(value.children) && Operation.isOperationList(value.operations);
  2992. IS_EDITOR_CACHE.set(value, isEditor);
  2993. return isEditor;
  2994. },
  2995. /**
  2996. * Check if a point is the end point of a location.
  2997. */
  2998. isEnd: function isEnd(editor, point, at) {
  2999. var end = Editor.end(editor, at);
  3000. return Point.equals(point, end);
  3001. },
  3002. /**
  3003. * Check if a point is an edge of a location.
  3004. */
  3005. isEdge: function isEdge(editor, point, at) {
  3006. return Editor.isStart(editor, point, at) || Editor.isEnd(editor, point, at);
  3007. },
  3008. /**
  3009. * Check if an element is empty, accounting for void nodes.
  3010. */
  3011. isEmpty: function isEmpty(editor, element) {
  3012. var children = element.children;
  3013. var _children = _slicedToArray(children, 1),
  3014. first = _children[0];
  3015. return children.length === 0 || children.length === 1 && Text.isText(first) && first.text === '' && !editor.isVoid(element);
  3016. },
  3017. /**
  3018. * Check if a value is an inline `Element` object.
  3019. */
  3020. isInline: function isInline(editor, value) {
  3021. return Element$1.isElement(value) && editor.isInline(value);
  3022. },
  3023. /**
  3024. * Check if the editor is currently normalizing after each operation.
  3025. */
  3026. isNormalizing: function isNormalizing(editor) {
  3027. var isNormalizing = NORMALIZING.get(editor);
  3028. return isNormalizing === undefined ? true : isNormalizing;
  3029. },
  3030. /**
  3031. * Check if a point is the start point of a location.
  3032. */
  3033. isStart: function isStart(editor, point, at) {
  3034. // PERF: If the offset isn't `0` we know it's not the start.
  3035. if (point.offset !== 0) {
  3036. return false;
  3037. }
  3038. var start = Editor.start(editor, at);
  3039. return Point.equals(point, start);
  3040. },
  3041. /**
  3042. * Check if a value is a void `Element` object.
  3043. */
  3044. isVoid: function isVoid(editor, value) {
  3045. return Element$1.isElement(value) && editor.isVoid(value);
  3046. },
  3047. /**
  3048. * Get the last node at a location.
  3049. */
  3050. last: function last(editor, at) {
  3051. var path = Editor.path(editor, at, {
  3052. edge: 'end'
  3053. });
  3054. return Editor.node(editor, path);
  3055. },
  3056. /**
  3057. * Get the leaf text node at a location.
  3058. */
  3059. leaf: function leaf(editor, at) {
  3060. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3061. var path = Editor.path(editor, at, options);
  3062. var node = Node$1.leaf(editor, path);
  3063. return [node, path];
  3064. },
  3065. /**
  3066. * Iterate through all of the levels at a location.
  3067. */
  3068. levels: function* levels(editor) {
  3069. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3070. var _options$at2 = options.at,
  3071. at = _options$at2 === void 0 ? editor.selection : _options$at2,
  3072. _options$reverse = options.reverse,
  3073. reverse = _options$reverse === void 0 ? false : _options$reverse,
  3074. _options$voids2 = options.voids,
  3075. voids = _options$voids2 === void 0 ? false : _options$voids2;
  3076. var match = options.match;
  3077. if (match == null) {
  3078. match = function match() {
  3079. return true;
  3080. };
  3081. }
  3082. if (!at) {
  3083. return;
  3084. }
  3085. var levels = [];
  3086. var path = Editor.path(editor, at);
  3087. var _iterator4 = _createForOfIteratorHelper$5(Node$1.levels(editor, path)),
  3088. _step4;
  3089. try {
  3090. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  3091. var _step4$value = _slicedToArray(_step4.value, 2),
  3092. n = _step4$value[0],
  3093. p = _step4$value[1];
  3094. if (!match(n, p)) {
  3095. continue;
  3096. }
  3097. levels.push([n, p]);
  3098. if (!voids && Editor.isVoid(editor, n)) {
  3099. break;
  3100. }
  3101. }
  3102. } catch (err) {
  3103. _iterator4.e(err);
  3104. } finally {
  3105. _iterator4.f();
  3106. }
  3107. if (reverse) {
  3108. levels.reverse();
  3109. }
  3110. yield* levels;
  3111. },
  3112. /**
  3113. * Get the marks that would be added to text at the current selection.
  3114. */
  3115. marks: function marks(editor) {
  3116. var marks = editor.marks,
  3117. selection = editor.selection;
  3118. if (!selection) {
  3119. return null;
  3120. }
  3121. if (marks) {
  3122. return marks;
  3123. }
  3124. if (Range.isExpanded(selection)) {
  3125. var _Editor$nodes = Editor.nodes(editor, {
  3126. match: Text.isText
  3127. }),
  3128. _Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
  3129. match = _Editor$nodes2[0];
  3130. if (match) {
  3131. var _match = _slicedToArray(match, 1),
  3132. _node = _match[0];
  3133. _node.text;
  3134. var _rest = _objectWithoutProperties(_node, _excluded$4);
  3135. return _rest;
  3136. } else {
  3137. return {};
  3138. }
  3139. }
  3140. var anchor = selection.anchor;
  3141. var path = anchor.path;
  3142. var _Editor$leaf = Editor.leaf(editor, path),
  3143. _Editor$leaf2 = _slicedToArray(_Editor$leaf, 1),
  3144. node = _Editor$leaf2[0];
  3145. if (anchor.offset === 0) {
  3146. var prev = Editor.previous(editor, {
  3147. at: path,
  3148. match: Text.isText
  3149. });
  3150. var block = Editor.above(editor, {
  3151. match: function match(n) {
  3152. return Editor.isBlock(editor, n);
  3153. }
  3154. });
  3155. if (prev && block) {
  3156. var _prev = _slicedToArray(prev, 2),
  3157. prevNode = _prev[0],
  3158. prevPath = _prev[1];
  3159. var _block = _slicedToArray(block, 2),
  3160. blockPath = _block[1];
  3161. if (Path.isAncestor(blockPath, prevPath)) {
  3162. node = prevNode;
  3163. }
  3164. }
  3165. }
  3166. var _node2 = node;
  3167. _node2.text;
  3168. var rest = _objectWithoutProperties(_node2, _excluded2$3);
  3169. return rest;
  3170. },
  3171. /**
  3172. * Get the matching node in the branch of the document after a location.
  3173. */
  3174. next: function next(editor) {
  3175. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3176. var _options$mode2 = options.mode,
  3177. mode = _options$mode2 === void 0 ? 'lowest' : _options$mode2,
  3178. _options$voids3 = options.voids,
  3179. voids = _options$voids3 === void 0 ? false : _options$voids3;
  3180. var match = options.match,
  3181. _options$at3 = options.at,
  3182. at = _options$at3 === void 0 ? editor.selection : _options$at3;
  3183. if (!at) {
  3184. return;
  3185. }
  3186. var pointAfterLocation = Editor.after(editor, at, {
  3187. voids: voids
  3188. });
  3189. if (!pointAfterLocation) return;
  3190. var _Editor$last = Editor.last(editor, []),
  3191. _Editor$last2 = _slicedToArray(_Editor$last, 2),
  3192. to = _Editor$last2[1];
  3193. var span = [pointAfterLocation.path, to];
  3194. if (Path.isPath(at) && at.length === 0) {
  3195. throw new Error("Cannot get the next node from the root node!");
  3196. }
  3197. if (match == null) {
  3198. if (Path.isPath(at)) {
  3199. var _Editor$parent = Editor.parent(editor, at),
  3200. _Editor$parent2 = _slicedToArray(_Editor$parent, 1),
  3201. parent = _Editor$parent2[0];
  3202. match = function match(n) {
  3203. return parent.children.includes(n);
  3204. };
  3205. } else {
  3206. match = function match() {
  3207. return true;
  3208. };
  3209. }
  3210. }
  3211. var _Editor$nodes3 = Editor.nodes(editor, {
  3212. at: span,
  3213. match: match,
  3214. mode: mode,
  3215. voids: voids
  3216. }),
  3217. _Editor$nodes4 = _slicedToArray(_Editor$nodes3, 1),
  3218. next = _Editor$nodes4[0];
  3219. return next;
  3220. },
  3221. /**
  3222. * Get the node at a location.
  3223. */
  3224. node: function node(editor, at) {
  3225. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3226. var path = Editor.path(editor, at, options);
  3227. var node = Node$1.get(editor, path);
  3228. return [node, path];
  3229. },
  3230. /**
  3231. * Iterate through all of the nodes in the Editor.
  3232. */
  3233. nodes: function* nodes(editor) {
  3234. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3235. var _options$at4 = options.at,
  3236. at = _options$at4 === void 0 ? editor.selection : _options$at4,
  3237. _options$mode3 = options.mode,
  3238. mode = _options$mode3 === void 0 ? 'all' : _options$mode3,
  3239. _options$universal = options.universal,
  3240. universal = _options$universal === void 0 ? false : _options$universal,
  3241. _options$reverse2 = options.reverse,
  3242. reverse = _options$reverse2 === void 0 ? false : _options$reverse2,
  3243. _options$voids4 = options.voids,
  3244. voids = _options$voids4 === void 0 ? false : _options$voids4;
  3245. var match = options.match;
  3246. if (!match) {
  3247. match = function match() {
  3248. return true;
  3249. };
  3250. }
  3251. if (!at) {
  3252. return;
  3253. }
  3254. var from;
  3255. var to;
  3256. if (Span.isSpan(at)) {
  3257. from = at[0];
  3258. to = at[1];
  3259. } else {
  3260. var first = Editor.path(editor, at, {
  3261. edge: 'start'
  3262. });
  3263. var last = Editor.path(editor, at, {
  3264. edge: 'end'
  3265. });
  3266. from = reverse ? last : first;
  3267. to = reverse ? first : last;
  3268. }
  3269. var nodeEntries = Node$1.nodes(editor, {
  3270. reverse: reverse,
  3271. from: from,
  3272. to: to,
  3273. pass: function pass(_ref) {
  3274. var _ref2 = _slicedToArray(_ref, 1),
  3275. n = _ref2[0];
  3276. return voids ? false : Editor.isVoid(editor, n);
  3277. }
  3278. });
  3279. var matches = [];
  3280. var hit;
  3281. var _iterator5 = _createForOfIteratorHelper$5(nodeEntries),
  3282. _step5;
  3283. try {
  3284. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  3285. var _step5$value = _slicedToArray(_step5.value, 2),
  3286. node = _step5$value[0],
  3287. path = _step5$value[1];
  3288. var isLower = hit && Path.compare(path, hit[1]) === 0; // In highest mode any node lower than the last hit is not a match.
  3289. if (mode === 'highest' && isLower) {
  3290. continue;
  3291. }
  3292. if (!match(node, path)) {
  3293. // If we've arrived at a leaf text node that is not lower than the last
  3294. // hit, then we've found a branch that doesn't include a match, which
  3295. // means the match is not universal.
  3296. if (universal && !isLower && Text.isText(node)) {
  3297. return;
  3298. } else {
  3299. continue;
  3300. }
  3301. } // If there's a match and it's lower than the last, update the hit.
  3302. if (mode === 'lowest' && isLower) {
  3303. hit = [node, path];
  3304. continue;
  3305. } // In lowest mode we emit the last hit, once it's guaranteed lowest.
  3306. var emit = mode === 'lowest' ? hit : [node, path];
  3307. if (emit) {
  3308. if (universal) {
  3309. matches.push(emit);
  3310. } else {
  3311. yield emit;
  3312. }
  3313. }
  3314. hit = [node, path];
  3315. } // Since lowest is always emitting one behind, catch up at the end.
  3316. } catch (err) {
  3317. _iterator5.e(err);
  3318. } finally {
  3319. _iterator5.f();
  3320. }
  3321. if (mode === 'lowest' && hit) {
  3322. if (universal) {
  3323. matches.push(hit);
  3324. } else {
  3325. yield hit;
  3326. }
  3327. } // Universal defers to ensure that the match occurs in every branch, so we
  3328. // yield all of the matches after iterating.
  3329. if (universal) {
  3330. yield* matches;
  3331. }
  3332. },
  3333. /**
  3334. * Normalize any dirty objects in the editor.
  3335. */
  3336. normalize: function normalize(editor) {
  3337. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3338. var _options$force = options.force,
  3339. force = _options$force === void 0 ? false : _options$force;
  3340. var getDirtyPaths = function getDirtyPaths(editor) {
  3341. return DIRTY_PATHS.get(editor) || [];
  3342. };
  3343. if (!Editor.isNormalizing(editor)) {
  3344. return;
  3345. }
  3346. if (force) {
  3347. var allPaths = Array.from(Node$1.nodes(editor), function (_ref3) {
  3348. var _ref4 = _slicedToArray(_ref3, 2),
  3349. p = _ref4[1];
  3350. return p;
  3351. });
  3352. DIRTY_PATHS.set(editor, allPaths);
  3353. }
  3354. if (getDirtyPaths(editor).length === 0) {
  3355. return;
  3356. }
  3357. Editor.withoutNormalizing(editor, function () {
  3358. /*
  3359. Fix dirty elements with no children.
  3360. editor.normalizeNode() does fix this, but some normalization fixes also require it to work.
  3361. Running an initial pass avoids the catch-22 race condition.
  3362. */
  3363. var _iterator6 = _createForOfIteratorHelper$5(getDirtyPaths(editor)),
  3364. _step6;
  3365. try {
  3366. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  3367. var _dirtyPath = _step6.value;
  3368. if (Node$1.has(editor, _dirtyPath)) {
  3369. var _entry = Editor.node(editor, _dirtyPath);
  3370. var _entry2 = _slicedToArray(_entry, 2),
  3371. node = _entry2[0],
  3372. _ = _entry2[1];
  3373. /*
  3374. The default normalizer inserts an empty text node in this scenario, but it can be customised.
  3375. So there is some risk here.
  3376. As long as the normalizer only inserts child nodes for this case it is safe to do in any order;
  3377. by definition adding children to an empty node can't cause other paths to change.
  3378. */
  3379. if (Element$1.isElement(node) && node.children.length === 0) {
  3380. editor.normalizeNode(_entry);
  3381. }
  3382. }
  3383. }
  3384. } catch (err) {
  3385. _iterator6.e(err);
  3386. } finally {
  3387. _iterator6.f();
  3388. }
  3389. var max = getDirtyPaths(editor).length * 42; // HACK: better way?
  3390. var m = 0;
  3391. while (getDirtyPaths(editor).length !== 0) {
  3392. if (m > max) {
  3393. throw new Error("\n Could not completely normalize the editor after ".concat(max, " iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state.\n "));
  3394. }
  3395. var dirtyPath = getDirtyPaths(editor).pop(); // If the node doesn't exist in the tree, it does not need to be normalized.
  3396. if (Node$1.has(editor, dirtyPath)) {
  3397. var entry = Editor.node(editor, dirtyPath);
  3398. editor.normalizeNode(entry);
  3399. }
  3400. m++;
  3401. }
  3402. });
  3403. },
  3404. /**
  3405. * Get the parent node of a location.
  3406. */
  3407. parent: function parent(editor, at) {
  3408. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3409. var path = Editor.path(editor, at, options);
  3410. var parentPath = Path.parent(path);
  3411. var entry = Editor.node(editor, parentPath);
  3412. return entry;
  3413. },
  3414. /**
  3415. * Get the path of a location.
  3416. */
  3417. path: function path(editor, at) {
  3418. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3419. var depth = options.depth,
  3420. edge = options.edge;
  3421. if (Path.isPath(at)) {
  3422. if (edge === 'start') {
  3423. var _Node$first = Node$1.first(editor, at),
  3424. _Node$first2 = _slicedToArray(_Node$first, 2),
  3425. firstPath = _Node$first2[1];
  3426. at = firstPath;
  3427. } else if (edge === 'end') {
  3428. var _Node$last = Node$1.last(editor, at),
  3429. _Node$last2 = _slicedToArray(_Node$last, 2),
  3430. lastPath = _Node$last2[1];
  3431. at = lastPath;
  3432. }
  3433. }
  3434. if (Range.isRange(at)) {
  3435. if (edge === 'start') {
  3436. at = Range.start(at);
  3437. } else if (edge === 'end') {
  3438. at = Range.end(at);
  3439. } else {
  3440. at = Path.common(at.anchor.path, at.focus.path);
  3441. }
  3442. }
  3443. if (Point.isPoint(at)) {
  3444. at = at.path;
  3445. }
  3446. if (depth != null) {
  3447. at = at.slice(0, depth);
  3448. }
  3449. return at;
  3450. },
  3451. hasPath: function hasPath(editor, path) {
  3452. return Node$1.has(editor, path);
  3453. },
  3454. /**
  3455. * Create a mutable ref for a `Path` object, which will stay in sync as new
  3456. * operations are applied to the editor.
  3457. */
  3458. pathRef: function pathRef(editor, path) {
  3459. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3460. var _options$affinity = options.affinity,
  3461. affinity = _options$affinity === void 0 ? 'forward' : _options$affinity;
  3462. var ref = {
  3463. current: path,
  3464. affinity: affinity,
  3465. unref: function unref() {
  3466. var current = ref.current;
  3467. var pathRefs = Editor.pathRefs(editor);
  3468. pathRefs["delete"](ref);
  3469. ref.current = null;
  3470. return current;
  3471. }
  3472. };
  3473. var refs = Editor.pathRefs(editor);
  3474. refs.add(ref);
  3475. return ref;
  3476. },
  3477. /**
  3478. * Get the set of currently tracked path refs of the editor.
  3479. */
  3480. pathRefs: function pathRefs(editor) {
  3481. var refs = PATH_REFS.get(editor);
  3482. if (!refs) {
  3483. refs = new Set();
  3484. PATH_REFS.set(editor, refs);
  3485. }
  3486. return refs;
  3487. },
  3488. /**
  3489. * Get the start or end point of a location.
  3490. */
  3491. point: function point(editor, at) {
  3492. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3493. var _options$edge = options.edge,
  3494. edge = _options$edge === void 0 ? 'start' : _options$edge;
  3495. if (Path.isPath(at)) {
  3496. var path;
  3497. if (edge === 'end') {
  3498. var _Node$last3 = Node$1.last(editor, at),
  3499. _Node$last4 = _slicedToArray(_Node$last3, 2),
  3500. lastPath = _Node$last4[1];
  3501. path = lastPath;
  3502. } else {
  3503. var _Node$first3 = Node$1.first(editor, at),
  3504. _Node$first4 = _slicedToArray(_Node$first3, 2),
  3505. firstPath = _Node$first4[1];
  3506. path = firstPath;
  3507. }
  3508. var node = Node$1.get(editor, path);
  3509. if (!Text.isText(node)) {
  3510. throw new Error("Cannot get the ".concat(edge, " point in the node at path [").concat(at, "] because it has no ").concat(edge, " text node."));
  3511. }
  3512. return {
  3513. path: path,
  3514. offset: edge === 'end' ? node.text.length : 0
  3515. };
  3516. }
  3517. if (Range.isRange(at)) {
  3518. var _Range$edges = Range.edges(at),
  3519. _Range$edges2 = _slicedToArray(_Range$edges, 2),
  3520. start = _Range$edges2[0],
  3521. end = _Range$edges2[1];
  3522. return edge === 'start' ? start : end;
  3523. }
  3524. return at;
  3525. },
  3526. /**
  3527. * Create a mutable ref for a `Point` object, which will stay in sync as new
  3528. * operations are applied to the editor.
  3529. */
  3530. pointRef: function pointRef(editor, point) {
  3531. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3532. var _options$affinity2 = options.affinity,
  3533. affinity = _options$affinity2 === void 0 ? 'forward' : _options$affinity2;
  3534. var ref = {
  3535. current: point,
  3536. affinity: affinity,
  3537. unref: function unref() {
  3538. var current = ref.current;
  3539. var pointRefs = Editor.pointRefs(editor);
  3540. pointRefs["delete"](ref);
  3541. ref.current = null;
  3542. return current;
  3543. }
  3544. };
  3545. var refs = Editor.pointRefs(editor);
  3546. refs.add(ref);
  3547. return ref;
  3548. },
  3549. /**
  3550. * Get the set of currently tracked point refs of the editor.
  3551. */
  3552. pointRefs: function pointRefs(editor) {
  3553. var refs = POINT_REFS.get(editor);
  3554. if (!refs) {
  3555. refs = new Set();
  3556. POINT_REFS.set(editor, refs);
  3557. }
  3558. return refs;
  3559. },
  3560. /**
  3561. * Return all the positions in `at` range where a `Point` can be placed.
  3562. *
  3563. * By default, moves forward by individual offsets at a time, but
  3564. * the `unit` option can be used to to move by character, word, line, or block.
  3565. *
  3566. * The `reverse` option can be used to change iteration direction.
  3567. *
  3568. * Note: By default void nodes are treated as a single point and iteration
  3569. * will not happen inside their content unless you pass in true for the
  3570. * `voids` option, then iteration will occur.
  3571. */
  3572. positions: function* positions(editor) {
  3573. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3574. var _options$at5 = options.at,
  3575. at = _options$at5 === void 0 ? editor.selection : _options$at5,
  3576. _options$unit3 = options.unit,
  3577. unit = _options$unit3 === void 0 ? 'offset' : _options$unit3,
  3578. _options$reverse3 = options.reverse,
  3579. reverse = _options$reverse3 === void 0 ? false : _options$reverse3,
  3580. _options$voids5 = options.voids,
  3581. voids = _options$voids5 === void 0 ? false : _options$voids5;
  3582. if (!at) {
  3583. return;
  3584. }
  3585. /**
  3586. * Algorithm notes:
  3587. *
  3588. * Each step `distance` is dynamic depending on the underlying text
  3589. * and the `unit` specified. Each step, e.g., a line or word, may
  3590. * span multiple text nodes, so we iterate through the text both on
  3591. * two levels in step-sync:
  3592. *
  3593. * `leafText` stores the text on a text leaf level, and is advanced
  3594. * through using the counters `leafTextOffset` and `leafTextRemaining`.
  3595. *
  3596. * `blockText` stores the text on a block level, and is shortened
  3597. * by `distance` every time it is advanced.
  3598. *
  3599. * We only maintain a window of one blockText and one leafText because
  3600. * a block node always appears before all of its leaf nodes.
  3601. */
  3602. var range = Editor.range(editor, at);
  3603. var _Range$edges3 = Range.edges(range),
  3604. _Range$edges4 = _slicedToArray(_Range$edges3, 2),
  3605. start = _Range$edges4[0],
  3606. end = _Range$edges4[1];
  3607. var first = reverse ? end : start;
  3608. var isNewBlock = false;
  3609. var blockText = '';
  3610. var distance = 0; // Distance for leafText to catch up to blockText.
  3611. var leafTextRemaining = 0;
  3612. var leafTextOffset = 0; // Iterate through all nodes in range, grabbing entire textual content
  3613. // of block nodes in blockText, and text nodes in leafText.
  3614. // Exploits the fact that nodes are sequenced in such a way that we first
  3615. // encounter the block node, then all of its text nodes, so when iterating
  3616. // through the blockText and leafText we just need to remember a window of
  3617. // one block node and leaf node, respectively.
  3618. var _iterator7 = _createForOfIteratorHelper$5(Editor.nodes(editor, {
  3619. at: at,
  3620. reverse: reverse,
  3621. voids: voids
  3622. })),
  3623. _step7;
  3624. try {
  3625. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  3626. var _step7$value = _slicedToArray(_step7.value, 2),
  3627. node = _step7$value[0],
  3628. path = _step7$value[1];
  3629. /*
  3630. * ELEMENT NODE - Yield position(s) for voids, collect blockText for blocks
  3631. */
  3632. if (Element$1.isElement(node)) {
  3633. // Void nodes are a special case, so by default we will always
  3634. // yield their first point. If the `voids` option is set to true,
  3635. // then we will iterate over their content.
  3636. if (!voids && editor.isVoid(node)) {
  3637. yield Editor.start(editor, path);
  3638. continue;
  3639. } // Inline element nodes are ignored as they don't themselves
  3640. // contribute to `blockText` or `leafText` - their parent and
  3641. // children do.
  3642. if (editor.isInline(node)) continue; // Block element node - set `blockText` to its text content.
  3643. if (Editor.hasInlines(editor, node)) {
  3644. // We always exhaust block nodes before encountering a new one:
  3645. // console.assert(blockText === '',
  3646. // `blockText='${blockText}' - `+
  3647. // `not exhausted before new block node`, path)
  3648. // Ensure range considered is capped to `range`, in the
  3649. // start/end edge cases where block extends beyond range.
  3650. // Equivalent to this, but presumably more performant:
  3651. // blockRange = Editor.range(editor, ...Editor.edges(editor, path))
  3652. // blockRange = Range.intersection(range, blockRange) // intersect
  3653. // blockText = Editor.string(editor, blockRange, { voids })
  3654. var e = Path.isAncestor(path, end.path) ? end : Editor.end(editor, path);
  3655. var s = Path.isAncestor(path, start.path) ? start : Editor.start(editor, path);
  3656. blockText = Editor.string(editor, {
  3657. anchor: s,
  3658. focus: e
  3659. }, {
  3660. voids: voids
  3661. });
  3662. isNewBlock = true;
  3663. }
  3664. }
  3665. /*
  3666. * TEXT LEAF NODE - Iterate through text content, yielding
  3667. * positions every `distance` offset according to `unit`.
  3668. */
  3669. if (Text.isText(node)) {
  3670. var isFirst = Path.equals(path, first.path); // Proof that we always exhaust text nodes before encountering a new one:
  3671. // console.assert(leafTextRemaining <= 0,
  3672. // `leafTextRemaining=${leafTextRemaining} - `+
  3673. // `not exhausted before new leaf text node`, path)
  3674. // Reset `leafText` counters for new text node.
  3675. if (isFirst) {
  3676. leafTextRemaining = reverse ? first.offset : node.text.length - first.offset;
  3677. leafTextOffset = first.offset; // Works for reverse too.
  3678. } else {
  3679. leafTextRemaining = node.text.length;
  3680. leafTextOffset = reverse ? leafTextRemaining : 0;
  3681. } // Yield position at the start of node (potentially).
  3682. if (isFirst || isNewBlock || unit === 'offset') {
  3683. yield {
  3684. path: path,
  3685. offset: leafTextOffset
  3686. };
  3687. isNewBlock = false;
  3688. } // Yield positions every (dynamically calculated) `distance` offset.
  3689. while (true) {
  3690. // If `leafText` has caught up with `blockText` (distance=0),
  3691. // and if blockText is exhausted, break to get another block node,
  3692. // otherwise advance blockText forward by the new `distance`.
  3693. if (distance === 0) {
  3694. if (blockText === '') break;
  3695. distance = calcDistance(blockText, unit, reverse); // Split the string at the previously found distance and use the
  3696. // remaining string for the next iteration.
  3697. blockText = splitByCharacterDistance(blockText, distance, reverse)[1];
  3698. } // Advance `leafText` by the current `distance`.
  3699. leafTextOffset = reverse ? leafTextOffset - distance : leafTextOffset + distance;
  3700. leafTextRemaining = leafTextRemaining - distance; // If `leafText` is exhausted, break to get a new leaf node
  3701. // and set distance to the overflow amount, so we'll (maybe)
  3702. // catch up to blockText in the next leaf text node.
  3703. if (leafTextRemaining < 0) {
  3704. distance = -leafTextRemaining;
  3705. break;
  3706. } // Successfully walked `distance` offsets through `leafText`
  3707. // to catch up with `blockText`, so we can reset `distance`
  3708. // and yield this position in this node.
  3709. distance = 0;
  3710. yield {
  3711. path: path,
  3712. offset: leafTextOffset
  3713. };
  3714. }
  3715. }
  3716. } // Proof that upon completion, we've exahusted both leaf and block text:
  3717. // console.assert(leafTextRemaining <= 0, "leafText wasn't exhausted")
  3718. // console.assert(blockText === '', "blockText wasn't exhausted")
  3719. // Helper:
  3720. // Return the distance in offsets for a step of size `unit` on given string.
  3721. } catch (err) {
  3722. _iterator7.e(err);
  3723. } finally {
  3724. _iterator7.f();
  3725. }
  3726. function calcDistance(text, unit, reverse) {
  3727. if (unit === 'character') {
  3728. return getCharacterDistance(text, reverse);
  3729. } else if (unit === 'word') {
  3730. return getWordDistance(text, reverse);
  3731. } else if (unit === 'line' || unit === 'block') {
  3732. return text.length;
  3733. }
  3734. return 1;
  3735. }
  3736. },
  3737. /**
  3738. * Get the matching node in the branch of the document before a location.
  3739. */
  3740. previous: function previous(editor) {
  3741. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3742. var _options$mode4 = options.mode,
  3743. mode = _options$mode4 === void 0 ? 'lowest' : _options$mode4,
  3744. _options$voids6 = options.voids,
  3745. voids = _options$voids6 === void 0 ? false : _options$voids6;
  3746. var match = options.match,
  3747. _options$at6 = options.at,
  3748. at = _options$at6 === void 0 ? editor.selection : _options$at6;
  3749. if (!at) {
  3750. return;
  3751. }
  3752. var pointBeforeLocation = Editor.before(editor, at, {
  3753. voids: voids
  3754. });
  3755. if (!pointBeforeLocation) {
  3756. return;
  3757. }
  3758. var _Editor$first = Editor.first(editor, []),
  3759. _Editor$first2 = _slicedToArray(_Editor$first, 2),
  3760. to = _Editor$first2[1]; // The search location is from the start of the document to the path of
  3761. // the point before the location passed in
  3762. var span = [pointBeforeLocation.path, to];
  3763. if (Path.isPath(at) && at.length === 0) {
  3764. throw new Error("Cannot get the previous node from the root node!");
  3765. }
  3766. if (match == null) {
  3767. if (Path.isPath(at)) {
  3768. var _Editor$parent3 = Editor.parent(editor, at),
  3769. _Editor$parent4 = _slicedToArray(_Editor$parent3, 1),
  3770. parent = _Editor$parent4[0];
  3771. match = function match(n) {
  3772. return parent.children.includes(n);
  3773. };
  3774. } else {
  3775. match = function match() {
  3776. return true;
  3777. };
  3778. }
  3779. }
  3780. var _Editor$nodes5 = Editor.nodes(editor, {
  3781. reverse: true,
  3782. at: span,
  3783. match: match,
  3784. mode: mode,
  3785. voids: voids
  3786. }),
  3787. _Editor$nodes6 = _slicedToArray(_Editor$nodes5, 1),
  3788. previous = _Editor$nodes6[0];
  3789. return previous;
  3790. },
  3791. /**
  3792. * Get a range of a location.
  3793. */
  3794. range: function range(editor, at, to) {
  3795. if (Range.isRange(at) && !to) {
  3796. return at;
  3797. }
  3798. var start = Editor.start(editor, at);
  3799. var end = Editor.end(editor, to || at);
  3800. return {
  3801. anchor: start,
  3802. focus: end
  3803. };
  3804. },
  3805. /**
  3806. * Create a mutable ref for a `Range` object, which will stay in sync as new
  3807. * operations are applied to the editor.
  3808. */
  3809. rangeRef: function rangeRef(editor, range) {
  3810. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3811. var _options$affinity3 = options.affinity,
  3812. affinity = _options$affinity3 === void 0 ? 'forward' : _options$affinity3;
  3813. var ref = {
  3814. current: range,
  3815. affinity: affinity,
  3816. unref: function unref() {
  3817. var current = ref.current;
  3818. var rangeRefs = Editor.rangeRefs(editor);
  3819. rangeRefs["delete"](ref);
  3820. ref.current = null;
  3821. return current;
  3822. }
  3823. };
  3824. var refs = Editor.rangeRefs(editor);
  3825. refs.add(ref);
  3826. return ref;
  3827. },
  3828. /**
  3829. * Get the set of currently tracked range refs of the editor.
  3830. */
  3831. rangeRefs: function rangeRefs(editor) {
  3832. var refs = RANGE_REFS.get(editor);
  3833. if (!refs) {
  3834. refs = new Set();
  3835. RANGE_REFS.set(editor, refs);
  3836. }
  3837. return refs;
  3838. },
  3839. /**
  3840. * Remove a custom property from all of the leaf text nodes in the current
  3841. * selection.
  3842. *
  3843. * If the selection is currently collapsed, the removal will be stored on
  3844. * `editor.marks` and applied to the text inserted next.
  3845. */
  3846. removeMark: function removeMark(editor, key) {
  3847. editor.removeMark(key);
  3848. },
  3849. /**
  3850. * Manually set if the editor should currently be normalizing.
  3851. *
  3852. * Note: Using this incorrectly can leave the editor in an invalid state.
  3853. *
  3854. */
  3855. setNormalizing: function setNormalizing(editor, isNormalizing) {
  3856. NORMALIZING.set(editor, isNormalizing);
  3857. },
  3858. /**
  3859. * Get the start point of a location.
  3860. */
  3861. start: function start(editor, at) {
  3862. return Editor.point(editor, at, {
  3863. edge: 'start'
  3864. });
  3865. },
  3866. /**
  3867. * Get the text string content of a location.
  3868. *
  3869. * Note: by default the text of void nodes is considered to be an empty
  3870. * string, regardless of content, unless you pass in true for the voids option
  3871. */
  3872. string: function string(editor, at) {
  3873. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3874. var _options$voids7 = options.voids,
  3875. voids = _options$voids7 === void 0 ? false : _options$voids7;
  3876. var range = Editor.range(editor, at);
  3877. var _Range$edges5 = Range.edges(range),
  3878. _Range$edges6 = _slicedToArray(_Range$edges5, 2),
  3879. start = _Range$edges6[0],
  3880. end = _Range$edges6[1];
  3881. var text = '';
  3882. var _iterator8 = _createForOfIteratorHelper$5(Editor.nodes(editor, {
  3883. at: range,
  3884. match: Text.isText,
  3885. voids: voids
  3886. })),
  3887. _step8;
  3888. try {
  3889. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  3890. var _step8$value = _slicedToArray(_step8.value, 2),
  3891. node = _step8$value[0],
  3892. path = _step8$value[1];
  3893. var t = node.text;
  3894. if (Path.equals(path, end.path)) {
  3895. t = t.slice(0, end.offset);
  3896. }
  3897. if (Path.equals(path, start.path)) {
  3898. t = t.slice(start.offset);
  3899. }
  3900. text += t;
  3901. }
  3902. } catch (err) {
  3903. _iterator8.e(err);
  3904. } finally {
  3905. _iterator8.f();
  3906. }
  3907. return text;
  3908. },
  3909. /**
  3910. * Convert a range into a non-hanging one.
  3911. */
  3912. unhangRange: function unhangRange(editor, range) {
  3913. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3914. var _options$voids8 = options.voids,
  3915. voids = _options$voids8 === void 0 ? false : _options$voids8;
  3916. var _Range$edges7 = Range.edges(range),
  3917. _Range$edges8 = _slicedToArray(_Range$edges7, 2),
  3918. start = _Range$edges8[0],
  3919. end = _Range$edges8[1]; // PERF: exit early if we can guarantee that the range isn't hanging.
  3920. if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range)) {
  3921. return range;
  3922. }
  3923. var endBlock = Editor.above(editor, {
  3924. at: end,
  3925. match: function match(n) {
  3926. return Editor.isBlock(editor, n);
  3927. }
  3928. });
  3929. var blockPath = endBlock ? endBlock[1] : [];
  3930. var first = Editor.start(editor, []);
  3931. var before = {
  3932. anchor: first,
  3933. focus: end
  3934. };
  3935. var skip = true;
  3936. var _iterator9 = _createForOfIteratorHelper$5(Editor.nodes(editor, {
  3937. at: before,
  3938. match: Text.isText,
  3939. reverse: true,
  3940. voids: voids
  3941. })),
  3942. _step9;
  3943. try {
  3944. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  3945. var _step9$value = _slicedToArray(_step9.value, 2),
  3946. node = _step9$value[0],
  3947. path = _step9$value[1];
  3948. if (skip) {
  3949. skip = false;
  3950. continue;
  3951. }
  3952. if (node.text !== '' || Path.isBefore(path, blockPath)) {
  3953. end = {
  3954. path: path,
  3955. offset: node.text.length
  3956. };
  3957. break;
  3958. }
  3959. }
  3960. } catch (err) {
  3961. _iterator9.e(err);
  3962. } finally {
  3963. _iterator9.f();
  3964. }
  3965. return {
  3966. anchor: start,
  3967. focus: end
  3968. };
  3969. },
  3970. /**
  3971. * Match a void node in the current branch of the editor.
  3972. */
  3973. "void": function _void(editor) {
  3974. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3975. return Editor.above(editor, _objectSpread$8(_objectSpread$8({}, options), {}, {
  3976. match: function match(n) {
  3977. return Editor.isVoid(editor, n);
  3978. }
  3979. }));
  3980. },
  3981. /**
  3982. * Call a function, deferring normalization until after it completes.
  3983. */
  3984. withoutNormalizing: function withoutNormalizing(editor, fn) {
  3985. var value = Editor.isNormalizing(editor);
  3986. Editor.setNormalizing(editor, false);
  3987. try {
  3988. fn();
  3989. } finally {
  3990. Editor.setNormalizing(editor, value);
  3991. }
  3992. Editor.normalize(editor);
  3993. }
  3994. };
  3995. var Location = {
  3996. /**
  3997. * Check if a value implements the `Location` interface.
  3998. */
  3999. isLocation: function isLocation(value) {
  4000. return Path.isPath(value) || Point.isPoint(value) || Range.isRange(value);
  4001. }
  4002. };
  4003. var Span = {
  4004. /**
  4005. * Check if a value implements the `Span` interface.
  4006. */
  4007. isSpan: function isSpan(value) {
  4008. return Array.isArray(value) && value.length === 2 && value.every(Path.isPath);
  4009. }
  4010. };
  4011. var _excluded$3 = ["children"],
  4012. _excluded2$2 = ["text"];
  4013. function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  4014. function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
  4015. function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  4016. var IS_NODE_LIST_CACHE = new WeakMap();
  4017. var Node$1 = {
  4018. /**
  4019. * Get the node at a specific path, asserting that it's an ancestor node.
  4020. */
  4021. ancestor: function ancestor(root, path) {
  4022. var node = Node$1.get(root, path);
  4023. if (Text.isText(node)) {
  4024. throw new Error("Cannot get the ancestor node at path [".concat(path, "] because it refers to a text node instead: ").concat(node));
  4025. }
  4026. return node;
  4027. },
  4028. /**
  4029. * Return a generator of all the ancestor nodes above a specific path.
  4030. *
  4031. * By default the order is bottom-up, from lowest to highest ancestor in
  4032. * the tree, but you can pass the `reverse: true` option to go top-down.
  4033. */
  4034. ancestors: function* ancestors(root, path) {
  4035. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4036. var _iterator = _createForOfIteratorHelper$4(Path.ancestors(path, options)),
  4037. _step;
  4038. try {
  4039. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  4040. var p = _step.value;
  4041. var n = Node$1.ancestor(root, p);
  4042. var entry = [n, p];
  4043. yield entry;
  4044. }
  4045. } catch (err) {
  4046. _iterator.e(err);
  4047. } finally {
  4048. _iterator.f();
  4049. }
  4050. },
  4051. /**
  4052. * Get the child of a node at a specific index.
  4053. */
  4054. child: function child(root, index) {
  4055. if (Text.isText(root)) {
  4056. throw new Error("Cannot get the child of a text node: ".concat(JSON.stringify(root)));
  4057. }
  4058. var c = root.children[index];
  4059. if (c == null) {
  4060. throw new Error("Cannot get child at index `".concat(index, "` in node: ").concat(JSON.stringify(root)));
  4061. }
  4062. return c;
  4063. },
  4064. /**
  4065. * Iterate over the children of a node at a specific path.
  4066. */
  4067. children: function* children(root, path) {
  4068. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4069. var _options$reverse = options.reverse,
  4070. reverse = _options$reverse === void 0 ? false : _options$reverse;
  4071. var ancestor = Node$1.ancestor(root, path);
  4072. var children = ancestor.children;
  4073. var index = reverse ? children.length - 1 : 0;
  4074. while (reverse ? index >= 0 : index < children.length) {
  4075. var child = Node$1.child(ancestor, index);
  4076. var childPath = path.concat(index);
  4077. yield [child, childPath];
  4078. index = reverse ? index - 1 : index + 1;
  4079. }
  4080. },
  4081. /**
  4082. * Get an entry for the common ancesetor node of two paths.
  4083. */
  4084. common: function common(root, path, another) {
  4085. var p = Path.common(path, another);
  4086. var n = Node$1.get(root, p);
  4087. return [n, p];
  4088. },
  4089. /**
  4090. * Get the node at a specific path, asserting that it's a descendant node.
  4091. */
  4092. descendant: function descendant(root, path) {
  4093. var node = Node$1.get(root, path);
  4094. if (Editor.isEditor(node)) {
  4095. throw new Error("Cannot get the descendant node at path [".concat(path, "] because it refers to the root editor node instead: ").concat(node));
  4096. }
  4097. return node;
  4098. },
  4099. /**
  4100. * Return a generator of all the descendant node entries inside a root node.
  4101. */
  4102. descendants: function* descendants(root) {
  4103. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4104. var _iterator2 = _createForOfIteratorHelper$4(Node$1.nodes(root, options)),
  4105. _step2;
  4106. try {
  4107. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  4108. var _step2$value = _slicedToArray(_step2.value, 2),
  4109. node = _step2$value[0],
  4110. path = _step2$value[1];
  4111. if (path.length !== 0) {
  4112. // NOTE: we have to coerce here because checking the path's length does
  4113. // guarantee that `node` is not a `Editor`, but TypeScript doesn't know.
  4114. yield [node, path];
  4115. }
  4116. }
  4117. } catch (err) {
  4118. _iterator2.e(err);
  4119. } finally {
  4120. _iterator2.f();
  4121. }
  4122. },
  4123. /**
  4124. * Return a generator of all the element nodes inside a root node. Each iteration
  4125. * will return an `ElementEntry` tuple consisting of `[Element, Path]`. If the
  4126. * root node is an element it will be included in the iteration as well.
  4127. */
  4128. elements: function* elements(root) {
  4129. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4130. var _iterator3 = _createForOfIteratorHelper$4(Node$1.nodes(root, options)),
  4131. _step3;
  4132. try {
  4133. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  4134. var _step3$value = _slicedToArray(_step3.value, 2),
  4135. node = _step3$value[0],
  4136. path = _step3$value[1];
  4137. if (Element$1.isElement(node)) {
  4138. yield [node, path];
  4139. }
  4140. }
  4141. } catch (err) {
  4142. _iterator3.e(err);
  4143. } finally {
  4144. _iterator3.f();
  4145. }
  4146. },
  4147. /**
  4148. * Extract props from a Node.
  4149. */
  4150. extractProps: function extractProps(node) {
  4151. if (Element$1.isAncestor(node)) {
  4152. node.children;
  4153. var properties = _objectWithoutProperties(node, _excluded$3);
  4154. return properties;
  4155. } else {
  4156. node.text;
  4157. var _properties = _objectWithoutProperties(node, _excluded2$2);
  4158. return _properties;
  4159. }
  4160. },
  4161. /**
  4162. * Get the first node entry in a root node from a path.
  4163. */
  4164. first: function first(root, path) {
  4165. var p = path.slice();
  4166. var n = Node$1.get(root, p);
  4167. while (n) {
  4168. if (Text.isText(n) || n.children.length === 0) {
  4169. break;
  4170. } else {
  4171. n = n.children[0];
  4172. p.push(0);
  4173. }
  4174. }
  4175. return [n, p];
  4176. },
  4177. /**
  4178. * Get the sliced fragment represented by a range inside a root node.
  4179. */
  4180. fragment: function fragment(root, range) {
  4181. if (Text.isText(root)) {
  4182. throw new Error("Cannot get a fragment starting from a root text node: ".concat(JSON.stringify(root)));
  4183. }
  4184. var newRoot = immer.produce({
  4185. children: root.children
  4186. }, function (r) {
  4187. var _Range$edges = Range.edges(range),
  4188. _Range$edges2 = _slicedToArray(_Range$edges, 2),
  4189. start = _Range$edges2[0],
  4190. end = _Range$edges2[1];
  4191. var nodeEntries = Node$1.nodes(r, {
  4192. reverse: true,
  4193. pass: function pass(_ref) {
  4194. var _ref2 = _slicedToArray(_ref, 2),
  4195. path = _ref2[1];
  4196. return !Range.includes(range, path);
  4197. }
  4198. });
  4199. var _iterator4 = _createForOfIteratorHelper$4(nodeEntries),
  4200. _step4;
  4201. try {
  4202. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  4203. var _step4$value = _slicedToArray(_step4.value, 2),
  4204. path = _step4$value[1];
  4205. if (!Range.includes(range, path)) {
  4206. var parent = Node$1.parent(r, path);
  4207. var index = path[path.length - 1];
  4208. parent.children.splice(index, 1);
  4209. }
  4210. if (Path.equals(path, end.path)) {
  4211. var leaf = Node$1.leaf(r, path);
  4212. leaf.text = leaf.text.slice(0, end.offset);
  4213. }
  4214. if (Path.equals(path, start.path)) {
  4215. var _leaf = Node$1.leaf(r, path);
  4216. _leaf.text = _leaf.text.slice(start.offset);
  4217. }
  4218. }
  4219. } catch (err) {
  4220. _iterator4.e(err);
  4221. } finally {
  4222. _iterator4.f();
  4223. }
  4224. if (Editor.isEditor(r)) {
  4225. r.selection = null;
  4226. }
  4227. });
  4228. return newRoot.children;
  4229. },
  4230. /**
  4231. * Get the descendant node referred to by a specific path. If the path is an
  4232. * empty array, it refers to the root node itself.
  4233. */
  4234. get: function get(root, path) {
  4235. var node = root;
  4236. for (var i = 0; i < path.length; i++) {
  4237. var p = path[i];
  4238. if (Text.isText(node) || !node.children[p]) {
  4239. throw new Error("Cannot find a descendant at path [".concat(path, "] in node: ").concat(JSON.stringify(root)));
  4240. }
  4241. node = node.children[p];
  4242. }
  4243. return node;
  4244. },
  4245. /**
  4246. * Check if a descendant node exists at a specific path.
  4247. */
  4248. has: function has(root, path) {
  4249. var node = root;
  4250. for (var i = 0; i < path.length; i++) {
  4251. var p = path[i];
  4252. if (Text.isText(node) || !node.children[p]) {
  4253. return false;
  4254. }
  4255. node = node.children[p];
  4256. }
  4257. return true;
  4258. },
  4259. /**
  4260. * Check if a value implements the `Node` interface.
  4261. */
  4262. isNode: function isNode(value) {
  4263. return Text.isText(value) || Element$1.isElement(value) || Editor.isEditor(value);
  4264. },
  4265. /**
  4266. * Check if a value is a list of `Node` objects.
  4267. */
  4268. isNodeList: function isNodeList(value) {
  4269. if (!Array.isArray(value)) {
  4270. return false;
  4271. }
  4272. var cachedResult = IS_NODE_LIST_CACHE.get(value);
  4273. if (cachedResult !== undefined) {
  4274. return cachedResult;
  4275. }
  4276. var isNodeList = value.every(function (val) {
  4277. return Node$1.isNode(val);
  4278. });
  4279. IS_NODE_LIST_CACHE.set(value, isNodeList);
  4280. return isNodeList;
  4281. },
  4282. /**
  4283. * Get the last node entry in a root node from a path.
  4284. */
  4285. last: function last(root, path) {
  4286. var p = path.slice();
  4287. var n = Node$1.get(root, p);
  4288. while (n) {
  4289. if (Text.isText(n) || n.children.length === 0) {
  4290. break;
  4291. } else {
  4292. var i = n.children.length - 1;
  4293. n = n.children[i];
  4294. p.push(i);
  4295. }
  4296. }
  4297. return [n, p];
  4298. },
  4299. /**
  4300. * Get the node at a specific path, ensuring it's a leaf text node.
  4301. */
  4302. leaf: function leaf(root, path) {
  4303. var node = Node$1.get(root, path);
  4304. if (!Text.isText(node)) {
  4305. throw new Error("Cannot get the leaf node at path [".concat(path, "] because it refers to a non-leaf node: ").concat(node));
  4306. }
  4307. return node;
  4308. },
  4309. /**
  4310. * Return a generator of the in a branch of the tree, from a specific path.
  4311. *
  4312. * By default the order is top-down, from lowest to highest node in the tree,
  4313. * but you can pass the `reverse: true` option to go bottom-up.
  4314. */
  4315. levels: function* levels(root, path) {
  4316. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4317. var _iterator5 = _createForOfIteratorHelper$4(Path.levels(path, options)),
  4318. _step5;
  4319. try {
  4320. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  4321. var p = _step5.value;
  4322. var n = Node$1.get(root, p);
  4323. yield [n, p];
  4324. }
  4325. } catch (err) {
  4326. _iterator5.e(err);
  4327. } finally {
  4328. _iterator5.f();
  4329. }
  4330. },
  4331. /**
  4332. * Check if a node matches a set of props.
  4333. */
  4334. matches: function matches(node, props) {
  4335. return Element$1.isElement(node) && Element$1.isElementProps(props) && Element$1.matches(node, props) || Text.isText(node) && Text.isTextProps(props) && Text.matches(node, props);
  4336. },
  4337. /**
  4338. * Return a generator of all the node entries of a root node. Each entry is
  4339. * returned as a `[Node, Path]` tuple, with the path referring to the node's
  4340. * position inside the root node.
  4341. */
  4342. nodes: function* nodes(root) {
  4343. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4344. var pass = options.pass,
  4345. _options$reverse2 = options.reverse,
  4346. reverse = _options$reverse2 === void 0 ? false : _options$reverse2;
  4347. var _options$from = options.from,
  4348. from = _options$from === void 0 ? [] : _options$from,
  4349. to = options.to;
  4350. var visited = new Set();
  4351. var p = [];
  4352. var n = root;
  4353. while (true) {
  4354. if (to && (reverse ? Path.isBefore(p, to) : Path.isAfter(p, to))) {
  4355. break;
  4356. }
  4357. if (!visited.has(n)) {
  4358. yield [n, p];
  4359. } // If we're allowed to go downward and we haven't descended yet, do.
  4360. if (!visited.has(n) && !Text.isText(n) && n.children.length !== 0 && (pass == null || pass([n, p]) === false)) {
  4361. visited.add(n);
  4362. var nextIndex = reverse ? n.children.length - 1 : 0;
  4363. if (Path.isAncestor(p, from)) {
  4364. nextIndex = from[p.length];
  4365. }
  4366. p = p.concat(nextIndex);
  4367. n = Node$1.get(root, p);
  4368. continue;
  4369. } // If we're at the root and we can't go down, we're done.
  4370. if (p.length === 0) {
  4371. break;
  4372. } // If we're going forward...
  4373. if (!reverse) {
  4374. var newPath = Path.next(p);
  4375. if (Node$1.has(root, newPath)) {
  4376. p = newPath;
  4377. n = Node$1.get(root, p);
  4378. continue;
  4379. }
  4380. } // If we're going backward...
  4381. if (reverse && p[p.length - 1] !== 0) {
  4382. var _newPath = Path.previous(p);
  4383. p = _newPath;
  4384. n = Node$1.get(root, p);
  4385. continue;
  4386. } // Otherwise we're going upward...
  4387. p = Path.parent(p);
  4388. n = Node$1.get(root, p);
  4389. visited.add(n);
  4390. }
  4391. },
  4392. /**
  4393. * Get the parent of a node at a specific path.
  4394. */
  4395. parent: function parent(root, path) {
  4396. var parentPath = Path.parent(path);
  4397. var p = Node$1.get(root, parentPath);
  4398. if (Text.isText(p)) {
  4399. throw new Error("Cannot get the parent of path [".concat(path, "] because it does not exist in the root."));
  4400. }
  4401. return p;
  4402. },
  4403. /**
  4404. * Get the concatenated text string of a node's content.
  4405. *
  4406. * Note that this will not include spaces or line breaks between block nodes.
  4407. * It is not a user-facing string, but a string for performing offset-related
  4408. * computations for a node.
  4409. */
  4410. string: function string(node) {
  4411. if (Text.isText(node)) {
  4412. return node.text;
  4413. } else {
  4414. return node.children.map(Node$1.string).join('');
  4415. }
  4416. },
  4417. /**
  4418. * Return a generator of all leaf text nodes in a root node.
  4419. */
  4420. texts: function* texts(root) {
  4421. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4422. var _iterator6 = _createForOfIteratorHelper$4(Node$1.nodes(root, options)),
  4423. _step6;
  4424. try {
  4425. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  4426. var _step6$value = _slicedToArray(_step6.value, 2),
  4427. node = _step6$value[0],
  4428. path = _step6$value[1];
  4429. if (Text.isText(node)) {
  4430. yield [node, path];
  4431. }
  4432. }
  4433. } catch (err) {
  4434. _iterator6.e(err);
  4435. } finally {
  4436. _iterator6.f();
  4437. }
  4438. }
  4439. };
  4440. function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  4441. function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  4442. var Operation = {
  4443. /**
  4444. * Check of a value is a `NodeOperation` object.
  4445. */
  4446. isNodeOperation: function isNodeOperation(value) {
  4447. return Operation.isOperation(value) && value.type.endsWith('_node');
  4448. },
  4449. /**
  4450. * Check of a value is an `Operation` object.
  4451. */
  4452. isOperation: function isOperation(value) {
  4453. if (!isPlainObject.isPlainObject(value)) {
  4454. return false;
  4455. }
  4456. switch (value.type) {
  4457. case 'insert_node':
  4458. return Path.isPath(value.path) && Node$1.isNode(value.node);
  4459. case 'insert_text':
  4460. return typeof value.offset === 'number' && typeof value.text === 'string' && Path.isPath(value.path);
  4461. case 'merge_node':
  4462. return typeof value.position === 'number' && Path.isPath(value.path) && isPlainObject.isPlainObject(value.properties);
  4463. case 'move_node':
  4464. return Path.isPath(value.path) && Path.isPath(value.newPath);
  4465. case 'remove_node':
  4466. return Path.isPath(value.path) && Node$1.isNode(value.node);
  4467. case 'remove_text':
  4468. return typeof value.offset === 'number' && typeof value.text === 'string' && Path.isPath(value.path);
  4469. case 'set_node':
  4470. return Path.isPath(value.path) && isPlainObject.isPlainObject(value.properties) && isPlainObject.isPlainObject(value.newProperties);
  4471. case 'set_selection':
  4472. return value.properties === null && Range.isRange(value.newProperties) || value.newProperties === null && Range.isRange(value.properties) || isPlainObject.isPlainObject(value.properties) && isPlainObject.isPlainObject(value.newProperties);
  4473. case 'split_node':
  4474. return Path.isPath(value.path) && typeof value.position === 'number' && isPlainObject.isPlainObject(value.properties);
  4475. default:
  4476. return false;
  4477. }
  4478. },
  4479. /**
  4480. * Check if a value is a list of `Operation` objects.
  4481. */
  4482. isOperationList: function isOperationList(value) {
  4483. return Array.isArray(value) && value.every(function (val) {
  4484. return Operation.isOperation(val);
  4485. });
  4486. },
  4487. /**
  4488. * Check of a value is a `SelectionOperation` object.
  4489. */
  4490. isSelectionOperation: function isSelectionOperation(value) {
  4491. return Operation.isOperation(value) && value.type.endsWith('_selection');
  4492. },
  4493. /**
  4494. * Check of a value is a `TextOperation` object.
  4495. */
  4496. isTextOperation: function isTextOperation(value) {
  4497. return Operation.isOperation(value) && value.type.endsWith('_text');
  4498. },
  4499. /**
  4500. * Invert an operation, returning a new operation that will exactly undo the
  4501. * original when applied.
  4502. */
  4503. inverse: function inverse(op) {
  4504. switch (op.type) {
  4505. case 'insert_node':
  4506. {
  4507. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4508. type: 'remove_node'
  4509. });
  4510. }
  4511. case 'insert_text':
  4512. {
  4513. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4514. type: 'remove_text'
  4515. });
  4516. }
  4517. case 'merge_node':
  4518. {
  4519. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4520. type: 'split_node',
  4521. path: Path.previous(op.path)
  4522. });
  4523. }
  4524. case 'move_node':
  4525. {
  4526. var newPath = op.newPath,
  4527. path = op.path; // PERF: in this case the move operation is a no-op anyways.
  4528. if (Path.equals(newPath, path)) {
  4529. return op;
  4530. } // If the move happens completely within a single parent the path and
  4531. // newPath are stable with respect to each other.
  4532. if (Path.isSibling(path, newPath)) {
  4533. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4534. path: newPath,
  4535. newPath: path
  4536. });
  4537. } // If the move does not happen within a single parent it is possible
  4538. // for the move to impact the true path to the location where the node
  4539. // was removed from and where it was inserted. We have to adjust for this
  4540. // and find the original path. We can accomplish this (only in non-sibling)
  4541. // moves by looking at the impact of the move operation on the node
  4542. // after the original move path.
  4543. var inversePath = Path.transform(path, op);
  4544. var inverseNewPath = Path.transform(Path.next(path), op);
  4545. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4546. path: inversePath,
  4547. newPath: inverseNewPath
  4548. });
  4549. }
  4550. case 'remove_node':
  4551. {
  4552. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4553. type: 'insert_node'
  4554. });
  4555. }
  4556. case 'remove_text':
  4557. {
  4558. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4559. type: 'insert_text'
  4560. });
  4561. }
  4562. case 'set_node':
  4563. {
  4564. var properties = op.properties,
  4565. newProperties = op.newProperties;
  4566. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4567. properties: newProperties,
  4568. newProperties: properties
  4569. });
  4570. }
  4571. case 'set_selection':
  4572. {
  4573. var _properties = op.properties,
  4574. _newProperties = op.newProperties;
  4575. if (_properties == null) {
  4576. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4577. properties: _newProperties,
  4578. newProperties: null
  4579. });
  4580. } else if (_newProperties == null) {
  4581. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4582. properties: null,
  4583. newProperties: _properties
  4584. });
  4585. } else {
  4586. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4587. properties: _newProperties,
  4588. newProperties: _properties
  4589. });
  4590. }
  4591. }
  4592. case 'split_node':
  4593. {
  4594. return _objectSpread$7(_objectSpread$7({}, op), {}, {
  4595. type: 'merge_node',
  4596. path: Path.next(op.path)
  4597. });
  4598. }
  4599. }
  4600. }
  4601. };
  4602. var Path = {
  4603. /**
  4604. * Get a list of ancestor paths for a given path.
  4605. *
  4606. * The paths are sorted from deepest to shallowest ancestor. However, if the
  4607. * `reverse: true` option is passed, they are reversed.
  4608. */
  4609. ancestors: function ancestors(path) {
  4610. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4611. var _options$reverse = options.reverse,
  4612. reverse = _options$reverse === void 0 ? false : _options$reverse;
  4613. var paths = Path.levels(path, options);
  4614. if (reverse) {
  4615. paths = paths.slice(1);
  4616. } else {
  4617. paths = paths.slice(0, -1);
  4618. }
  4619. return paths;
  4620. },
  4621. /**
  4622. * Get the common ancestor path of two paths.
  4623. */
  4624. common: function common(path, another) {
  4625. var common = [];
  4626. for (var i = 0; i < path.length && i < another.length; i++) {
  4627. var av = path[i];
  4628. var bv = another[i];
  4629. if (av !== bv) {
  4630. break;
  4631. }
  4632. common.push(av);
  4633. }
  4634. return common;
  4635. },
  4636. /**
  4637. * Compare a path to another, returning an integer indicating whether the path
  4638. * was before, at, or after the other.
  4639. *
  4640. * Note: Two paths of unequal length can still receive a `0` result if one is
  4641. * directly above or below the other. If you want exact matching, use
  4642. * [[Path.equals]] instead.
  4643. */
  4644. compare: function compare(path, another) {
  4645. var min = Math.min(path.length, another.length);
  4646. for (var i = 0; i < min; i++) {
  4647. if (path[i] < another[i]) return -1;
  4648. if (path[i] > another[i]) return 1;
  4649. }
  4650. return 0;
  4651. },
  4652. /**
  4653. * Check if a path ends after one of the indexes in another.
  4654. */
  4655. endsAfter: function endsAfter(path, another) {
  4656. var i = path.length - 1;
  4657. var as = path.slice(0, i);
  4658. var bs = another.slice(0, i);
  4659. var av = path[i];
  4660. var bv = another[i];
  4661. return Path.equals(as, bs) && av > bv;
  4662. },
  4663. /**
  4664. * Check if a path ends at one of the indexes in another.
  4665. */
  4666. endsAt: function endsAt(path, another) {
  4667. var i = path.length;
  4668. var as = path.slice(0, i);
  4669. var bs = another.slice(0, i);
  4670. return Path.equals(as, bs);
  4671. },
  4672. /**
  4673. * Check if a path ends before one of the indexes in another.
  4674. */
  4675. endsBefore: function endsBefore(path, another) {
  4676. var i = path.length - 1;
  4677. var as = path.slice(0, i);
  4678. var bs = another.slice(0, i);
  4679. var av = path[i];
  4680. var bv = another[i];
  4681. return Path.equals(as, bs) && av < bv;
  4682. },
  4683. /**
  4684. * Check if a path is exactly equal to another.
  4685. */
  4686. equals: function equals(path, another) {
  4687. return path.length === another.length && path.every(function (n, i) {
  4688. return n === another[i];
  4689. });
  4690. },
  4691. /**
  4692. * Check if the path of previous sibling node exists
  4693. */
  4694. hasPrevious: function hasPrevious(path) {
  4695. return path[path.length - 1] > 0;
  4696. },
  4697. /**
  4698. * Check if a path is after another.
  4699. */
  4700. isAfter: function isAfter(path, another) {
  4701. return Path.compare(path, another) === 1;
  4702. },
  4703. /**
  4704. * Check if a path is an ancestor of another.
  4705. */
  4706. isAncestor: function isAncestor(path, another) {
  4707. return path.length < another.length && Path.compare(path, another) === 0;
  4708. },
  4709. /**
  4710. * Check if a path is before another.
  4711. */
  4712. isBefore: function isBefore(path, another) {
  4713. return Path.compare(path, another) === -1;
  4714. },
  4715. /**
  4716. * Check if a path is a child of another.
  4717. */
  4718. isChild: function isChild(path, another) {
  4719. return path.length === another.length + 1 && Path.compare(path, another) === 0;
  4720. },
  4721. /**
  4722. * Check if a path is equal to or an ancestor of another.
  4723. */
  4724. isCommon: function isCommon(path, another) {
  4725. return path.length <= another.length && Path.compare(path, another) === 0;
  4726. },
  4727. /**
  4728. * Check if a path is a descendant of another.
  4729. */
  4730. isDescendant: function isDescendant(path, another) {
  4731. return path.length > another.length && Path.compare(path, another) === 0;
  4732. },
  4733. /**
  4734. * Check if a path is the parent of another.
  4735. */
  4736. isParent: function isParent(path, another) {
  4737. return path.length + 1 === another.length && Path.compare(path, another) === 0;
  4738. },
  4739. /**
  4740. * Check is a value implements the `Path` interface.
  4741. */
  4742. isPath: function isPath(value) {
  4743. return Array.isArray(value) && (value.length === 0 || typeof value[0] === 'number');
  4744. },
  4745. /**
  4746. * Check if a path is a sibling of another.
  4747. */
  4748. isSibling: function isSibling(path, another) {
  4749. if (path.length !== another.length) {
  4750. return false;
  4751. }
  4752. var as = path.slice(0, -1);
  4753. var bs = another.slice(0, -1);
  4754. var al = path[path.length - 1];
  4755. var bl = another[another.length - 1];
  4756. return al !== bl && Path.equals(as, bs);
  4757. },
  4758. /**
  4759. * Get a list of paths at every level down to a path. Note: this is the same
  4760. * as `Path.ancestors`, but including the path itself.
  4761. *
  4762. * The paths are sorted from shallowest to deepest. However, if the `reverse:
  4763. * true` option is passed, they are reversed.
  4764. */
  4765. levels: function levels(path) {
  4766. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4767. var _options$reverse2 = options.reverse,
  4768. reverse = _options$reverse2 === void 0 ? false : _options$reverse2;
  4769. var list = [];
  4770. for (var i = 0; i <= path.length; i++) {
  4771. list.push(path.slice(0, i));
  4772. }
  4773. if (reverse) {
  4774. list.reverse();
  4775. }
  4776. return list;
  4777. },
  4778. /**
  4779. * Given a path, get the path to the next sibling node.
  4780. */
  4781. next: function next(path) {
  4782. if (path.length === 0) {
  4783. throw new Error("Cannot get the next path of a root path [".concat(path, "], because it has no next index."));
  4784. }
  4785. var last = path[path.length - 1];
  4786. return path.slice(0, -1).concat(last + 1);
  4787. },
  4788. /**
  4789. * Given a path, return a new path referring to the parent node above it.
  4790. */
  4791. parent: function parent(path) {
  4792. if (path.length === 0) {
  4793. throw new Error("Cannot get the parent path of the root path [".concat(path, "]."));
  4794. }
  4795. return path.slice(0, -1);
  4796. },
  4797. /**
  4798. * Given a path, get the path to the previous sibling node.
  4799. */
  4800. previous: function previous(path) {
  4801. if (path.length === 0) {
  4802. throw new Error("Cannot get the previous path of a root path [".concat(path, "], because it has no previous index."));
  4803. }
  4804. var last = path[path.length - 1];
  4805. if (last <= 0) {
  4806. throw new Error("Cannot get the previous path of a first child path [".concat(path, "] because it would result in a negative index."));
  4807. }
  4808. return path.slice(0, -1).concat(last - 1);
  4809. },
  4810. /**
  4811. * Get a path relative to an ancestor.
  4812. */
  4813. relative: function relative(path, ancestor) {
  4814. if (!Path.isAncestor(ancestor, path) && !Path.equals(path, ancestor)) {
  4815. throw new Error("Cannot get the relative path of [".concat(path, "] inside ancestor [").concat(ancestor, "], because it is not above or equal to the path."));
  4816. }
  4817. return path.slice(ancestor.length);
  4818. },
  4819. /**
  4820. * Transform a path by an operation.
  4821. */
  4822. transform: function transform(path, operation) {
  4823. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4824. return immer.produce(path, function (p) {
  4825. var _options$affinity = options.affinity,
  4826. affinity = _options$affinity === void 0 ? 'forward' : _options$affinity; // PERF: Exit early if the operation is guaranteed not to have an effect.
  4827. if (!path || (path === null || path === void 0 ? void 0 : path.length) === 0) {
  4828. return;
  4829. }
  4830. if (p === null) {
  4831. return null;
  4832. }
  4833. switch (operation.type) {
  4834. case 'insert_node':
  4835. {
  4836. var op = operation.path;
  4837. if (Path.equals(op, p) || Path.endsBefore(op, p) || Path.isAncestor(op, p)) {
  4838. p[op.length - 1] += 1;
  4839. }
  4840. break;
  4841. }
  4842. case 'remove_node':
  4843. {
  4844. var _op = operation.path;
  4845. if (Path.equals(_op, p) || Path.isAncestor(_op, p)) {
  4846. return null;
  4847. } else if (Path.endsBefore(_op, p)) {
  4848. p[_op.length - 1] -= 1;
  4849. }
  4850. break;
  4851. }
  4852. case 'merge_node':
  4853. {
  4854. var _op2 = operation.path,
  4855. position = operation.position;
  4856. if (Path.equals(_op2, p) || Path.endsBefore(_op2, p)) {
  4857. p[_op2.length - 1] -= 1;
  4858. } else if (Path.isAncestor(_op2, p)) {
  4859. p[_op2.length - 1] -= 1;
  4860. p[_op2.length] += position;
  4861. }
  4862. break;
  4863. }
  4864. case 'split_node':
  4865. {
  4866. var _op3 = operation.path,
  4867. _position = operation.position;
  4868. if (Path.equals(_op3, p)) {
  4869. if (affinity === 'forward') {
  4870. p[p.length - 1] += 1;
  4871. } else if (affinity === 'backward') ; else {
  4872. return null;
  4873. }
  4874. } else if (Path.endsBefore(_op3, p)) {
  4875. p[_op3.length - 1] += 1;
  4876. } else if (Path.isAncestor(_op3, p) && path[_op3.length] >= _position) {
  4877. p[_op3.length - 1] += 1;
  4878. p[_op3.length] -= _position;
  4879. }
  4880. break;
  4881. }
  4882. case 'move_node':
  4883. {
  4884. var _op4 = operation.path,
  4885. onp = operation.newPath; // If the old and new path are the same, it's a no-op.
  4886. if (Path.equals(_op4, onp)) {
  4887. return;
  4888. }
  4889. if (Path.isAncestor(_op4, p) || Path.equals(_op4, p)) {
  4890. var copy = onp.slice();
  4891. if (Path.endsBefore(_op4, onp) && _op4.length < onp.length) {
  4892. copy[_op4.length - 1] -= 1;
  4893. }
  4894. return copy.concat(p.slice(_op4.length));
  4895. } else if (Path.isSibling(_op4, onp) && (Path.isAncestor(onp, p) || Path.equals(onp, p))) {
  4896. if (Path.endsBefore(_op4, p)) {
  4897. p[_op4.length - 1] -= 1;
  4898. } else {
  4899. p[_op4.length - 1] += 1;
  4900. }
  4901. } else if (Path.endsBefore(onp, p) || Path.equals(onp, p) || Path.isAncestor(onp, p)) {
  4902. if (Path.endsBefore(_op4, p)) {
  4903. p[_op4.length - 1] -= 1;
  4904. }
  4905. p[onp.length - 1] += 1;
  4906. } else if (Path.endsBefore(_op4, p)) {
  4907. if (Path.equals(onp, p)) {
  4908. p[onp.length - 1] += 1;
  4909. }
  4910. p[_op4.length - 1] -= 1;
  4911. }
  4912. break;
  4913. }
  4914. }
  4915. });
  4916. }
  4917. };
  4918. var PathRef = {
  4919. /**
  4920. * Transform the path ref's current value by an operation.
  4921. */
  4922. transform: function transform(ref, op) {
  4923. var current = ref.current,
  4924. affinity = ref.affinity;
  4925. if (current == null) {
  4926. return;
  4927. }
  4928. var path = Path.transform(current, op, {
  4929. affinity: affinity
  4930. });
  4931. ref.current = path;
  4932. if (path == null) {
  4933. ref.unref();
  4934. }
  4935. }
  4936. };
  4937. function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  4938. function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  4939. var Point = {
  4940. /**
  4941. * Compare a point to another, returning an integer indicating whether the
  4942. * point was before, at, or after the other.
  4943. */
  4944. compare: function compare(point, another) {
  4945. var result = Path.compare(point.path, another.path);
  4946. if (result === 0) {
  4947. if (point.offset < another.offset) return -1;
  4948. if (point.offset > another.offset) return 1;
  4949. return 0;
  4950. }
  4951. return result;
  4952. },
  4953. /**
  4954. * Check if a point is after another.
  4955. */
  4956. isAfter: function isAfter(point, another) {
  4957. return Point.compare(point, another) === 1;
  4958. },
  4959. /**
  4960. * Check if a point is before another.
  4961. */
  4962. isBefore: function isBefore(point, another) {
  4963. return Point.compare(point, another) === -1;
  4964. },
  4965. /**
  4966. * Check if a point is exactly equal to another.
  4967. */
  4968. equals: function equals(point, another) {
  4969. // PERF: ensure the offsets are equal first since they are cheaper to check.
  4970. return point.offset === another.offset && Path.equals(point.path, another.path);
  4971. },
  4972. /**
  4973. * Check if a value implements the `Point` interface.
  4974. */
  4975. isPoint: function isPoint(value) {
  4976. return isPlainObject.isPlainObject(value) && typeof value.offset === 'number' && Path.isPath(value.path);
  4977. },
  4978. /**
  4979. * Transform a point by an operation.
  4980. */
  4981. transform: function transform(point, op) {
  4982. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4983. return immer.produce(point, function (p) {
  4984. if (p === null) {
  4985. return null;
  4986. }
  4987. var _options$affinity = options.affinity,
  4988. affinity = _options$affinity === void 0 ? 'forward' : _options$affinity;
  4989. var path = p.path,
  4990. offset = p.offset;
  4991. switch (op.type) {
  4992. case 'insert_node':
  4993. case 'move_node':
  4994. {
  4995. p.path = Path.transform(path, op, options);
  4996. break;
  4997. }
  4998. case 'insert_text':
  4999. {
  5000. if (Path.equals(op.path, path) && op.offset <= offset) {
  5001. p.offset += op.text.length;
  5002. }
  5003. break;
  5004. }
  5005. case 'merge_node':
  5006. {
  5007. if (Path.equals(op.path, path)) {
  5008. p.offset += op.position;
  5009. }
  5010. p.path = Path.transform(path, op, options);
  5011. break;
  5012. }
  5013. case 'remove_text':
  5014. {
  5015. if (Path.equals(op.path, path) && op.offset <= offset) {
  5016. p.offset -= Math.min(offset - op.offset, op.text.length);
  5017. }
  5018. break;
  5019. }
  5020. case 'remove_node':
  5021. {
  5022. if (Path.equals(op.path, path) || Path.isAncestor(op.path, path)) {
  5023. return null;
  5024. }
  5025. p.path = Path.transform(path, op, options);
  5026. break;
  5027. }
  5028. case 'split_node':
  5029. {
  5030. if (Path.equals(op.path, path)) {
  5031. if (op.position === offset && affinity == null) {
  5032. return null;
  5033. } else if (op.position < offset || op.position === offset && affinity === 'forward') {
  5034. p.offset -= op.position;
  5035. p.path = Path.transform(path, op, _objectSpread$6(_objectSpread$6({}, options), {}, {
  5036. affinity: 'forward'
  5037. }));
  5038. }
  5039. } else {
  5040. p.path = Path.transform(path, op, options);
  5041. }
  5042. break;
  5043. }
  5044. }
  5045. });
  5046. }
  5047. };
  5048. var PointRef = {
  5049. /**
  5050. * Transform the point ref's current value by an operation.
  5051. */
  5052. transform: function transform(ref, op) {
  5053. var current = ref.current,
  5054. affinity = ref.affinity;
  5055. if (current == null) {
  5056. return;
  5057. }
  5058. var point = Point.transform(current, op, {
  5059. affinity: affinity
  5060. });
  5061. ref.current = point;
  5062. if (point == null) {
  5063. ref.unref();
  5064. }
  5065. }
  5066. };
  5067. var _excluded$2 = ["anchor", "focus"];
  5068. function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  5069. function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  5070. var Range = {
  5071. /**
  5072. * Get the start and end points of a range, in the order in which they appear
  5073. * in the document.
  5074. */
  5075. edges: function edges(range) {
  5076. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  5077. var _options$reverse = options.reverse,
  5078. reverse = _options$reverse === void 0 ? false : _options$reverse;
  5079. var anchor = range.anchor,
  5080. focus = range.focus;
  5081. return Range.isBackward(range) === reverse ? [anchor, focus] : [focus, anchor];
  5082. },
  5083. /**
  5084. * Get the end point of a range.
  5085. */
  5086. end: function end(range) {
  5087. var _Range$edges = Range.edges(range),
  5088. _Range$edges2 = _slicedToArray(_Range$edges, 2),
  5089. end = _Range$edges2[1];
  5090. return end;
  5091. },
  5092. /**
  5093. * Check if a range is exactly equal to another.
  5094. */
  5095. equals: function equals(range, another) {
  5096. return Point.equals(range.anchor, another.anchor) && Point.equals(range.focus, another.focus);
  5097. },
  5098. /**
  5099. * Check if a range includes a path, a point or part of another range.
  5100. */
  5101. includes: function includes(range, target) {
  5102. if (Range.isRange(target)) {
  5103. if (Range.includes(range, target.anchor) || Range.includes(range, target.focus)) {
  5104. return true;
  5105. }
  5106. var _Range$edges3 = Range.edges(range),
  5107. _Range$edges4 = _slicedToArray(_Range$edges3, 2),
  5108. rs = _Range$edges4[0],
  5109. re = _Range$edges4[1];
  5110. var _Range$edges5 = Range.edges(target),
  5111. _Range$edges6 = _slicedToArray(_Range$edges5, 2),
  5112. ts = _Range$edges6[0],
  5113. te = _Range$edges6[1];
  5114. return Point.isBefore(rs, ts) && Point.isAfter(re, te);
  5115. }
  5116. var _Range$edges7 = Range.edges(range),
  5117. _Range$edges8 = _slicedToArray(_Range$edges7, 2),
  5118. start = _Range$edges8[0],
  5119. end = _Range$edges8[1];
  5120. var isAfterStart = false;
  5121. var isBeforeEnd = false;
  5122. if (Point.isPoint(target)) {
  5123. isAfterStart = Point.compare(target, start) >= 0;
  5124. isBeforeEnd = Point.compare(target, end) <= 0;
  5125. } else {
  5126. isAfterStart = Path.compare(target, start.path) >= 0;
  5127. isBeforeEnd = Path.compare(target, end.path) <= 0;
  5128. }
  5129. return isAfterStart && isBeforeEnd;
  5130. },
  5131. /**
  5132. * Get the intersection of a range with another.
  5133. */
  5134. intersection: function intersection(range, another) {
  5135. range.anchor;
  5136. range.focus;
  5137. var rest = _objectWithoutProperties(range, _excluded$2);
  5138. var _Range$edges9 = Range.edges(range),
  5139. _Range$edges10 = _slicedToArray(_Range$edges9, 2),
  5140. s1 = _Range$edges10[0],
  5141. e1 = _Range$edges10[1];
  5142. var _Range$edges11 = Range.edges(another),
  5143. _Range$edges12 = _slicedToArray(_Range$edges11, 2),
  5144. s2 = _Range$edges12[0],
  5145. e2 = _Range$edges12[1];
  5146. var start = Point.isBefore(s1, s2) ? s2 : s1;
  5147. var end = Point.isBefore(e1, e2) ? e1 : e2;
  5148. if (Point.isBefore(end, start)) {
  5149. return null;
  5150. } else {
  5151. return _objectSpread$5({
  5152. anchor: start,
  5153. focus: end
  5154. }, rest);
  5155. }
  5156. },
  5157. /**
  5158. * Check if a range is backward, meaning that its anchor point appears in the
  5159. * document _after_ its focus point.
  5160. */
  5161. isBackward: function isBackward(range) {
  5162. var anchor = range.anchor,
  5163. focus = range.focus;
  5164. return Point.isAfter(anchor, focus);
  5165. },
  5166. /**
  5167. * Check if a range is collapsed, meaning that both its anchor and focus
  5168. * points refer to the exact same position in the document.
  5169. */
  5170. isCollapsed: function isCollapsed(range) {
  5171. var anchor = range.anchor,
  5172. focus = range.focus;
  5173. return Point.equals(anchor, focus);
  5174. },
  5175. /**
  5176. * Check if a range is expanded.
  5177. *
  5178. * This is the opposite of [[Range.isCollapsed]] and is provided for legibility.
  5179. */
  5180. isExpanded: function isExpanded(range) {
  5181. return !Range.isCollapsed(range);
  5182. },
  5183. /**
  5184. * Check if a range is forward.
  5185. *
  5186. * This is the opposite of [[Range.isBackward]] and is provided for legibility.
  5187. */
  5188. isForward: function isForward(range) {
  5189. return !Range.isBackward(range);
  5190. },
  5191. /**
  5192. * Check if a value implements the [[Range]] interface.
  5193. */
  5194. isRange: function isRange(value) {
  5195. return isPlainObject.isPlainObject(value) && Point.isPoint(value.anchor) && Point.isPoint(value.focus);
  5196. },
  5197. /**
  5198. * Iterate through all of the point entries in a range.
  5199. */
  5200. points: function* points(range) {
  5201. yield [range.anchor, 'anchor'];
  5202. yield [range.focus, 'focus'];
  5203. },
  5204. /**
  5205. * Get the start point of a range.
  5206. */
  5207. start: function start(range) {
  5208. var _Range$edges13 = Range.edges(range),
  5209. _Range$edges14 = _slicedToArray(_Range$edges13, 1),
  5210. start = _Range$edges14[0];
  5211. return start;
  5212. },
  5213. /**
  5214. * Transform a range by an operation.
  5215. */
  5216. transform: function transform(range, op) {
  5217. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  5218. return immer.produce(range, function (r) {
  5219. if (r === null) {
  5220. return null;
  5221. }
  5222. var _options$affinity = options.affinity,
  5223. affinity = _options$affinity === void 0 ? 'inward' : _options$affinity;
  5224. var affinityAnchor;
  5225. var affinityFocus;
  5226. if (affinity === 'inward') {
  5227. // If the range is collapsed, make sure to use the same affinity to
  5228. // avoid the two points passing each other and expanding in the opposite
  5229. // direction
  5230. var isCollapsed = Range.isCollapsed(r);
  5231. if (Range.isForward(r)) {
  5232. affinityAnchor = 'forward';
  5233. affinityFocus = isCollapsed ? affinityAnchor : 'backward';
  5234. } else {
  5235. affinityAnchor = 'backward';
  5236. affinityFocus = isCollapsed ? affinityAnchor : 'forward';
  5237. }
  5238. } else if (affinity === 'outward') {
  5239. if (Range.isForward(r)) {
  5240. affinityAnchor = 'backward';
  5241. affinityFocus = 'forward';
  5242. } else {
  5243. affinityAnchor = 'forward';
  5244. affinityFocus = 'backward';
  5245. }
  5246. } else {
  5247. affinityAnchor = affinity;
  5248. affinityFocus = affinity;
  5249. }
  5250. var anchor = Point.transform(r.anchor, op, {
  5251. affinity: affinityAnchor
  5252. });
  5253. var focus = Point.transform(r.focus, op, {
  5254. affinity: affinityFocus
  5255. });
  5256. if (!anchor || !focus) {
  5257. return null;
  5258. }
  5259. r.anchor = anchor;
  5260. r.focus = focus;
  5261. });
  5262. }
  5263. };
  5264. var RangeRef = {
  5265. /**
  5266. * Transform the range ref's current value by an operation.
  5267. */
  5268. transform: function transform(ref, op) {
  5269. var current = ref.current,
  5270. affinity = ref.affinity;
  5271. if (current == null) {
  5272. return;
  5273. }
  5274. var path = Range.transform(current, op, {
  5275. affinity: affinity
  5276. });
  5277. ref.current = path;
  5278. if (path == null) {
  5279. ref.unref();
  5280. }
  5281. }
  5282. };
  5283. /*
  5284. Custom deep equal comparison for Slate nodes.
  5285. We don't need general purpose deep equality;
  5286. Slate only supports plain values, Arrays, and nested objects.
  5287. Complex values nested inside Arrays are not supported.
  5288. Slate objects are designed to be serialised, so
  5289. missing keys are deliberately normalised to undefined.
  5290. */
  5291. var isDeepEqual = function isDeepEqual(node, another) {
  5292. for (var key in node) {
  5293. var a = node[key];
  5294. var b = another[key];
  5295. if (isPlainObject.isPlainObject(a) && isPlainObject.isPlainObject(b)) {
  5296. if (!isDeepEqual(a, b)) return false;
  5297. } else if (Array.isArray(a) && Array.isArray(b)) {
  5298. if (a.length !== b.length) return false;
  5299. for (var i = 0; i < a.length; i++) {
  5300. if (a[i] !== b[i]) return false;
  5301. }
  5302. } else if (a !== b) {
  5303. return false;
  5304. }
  5305. }
  5306. /*
  5307. Deep object equality is only necessary in one direction; in the reverse direction
  5308. we are only looking for keys that are missing.
  5309. As above, undefined keys are normalised to missing.
  5310. */
  5311. for (var _key in another) {
  5312. if (node[_key] === undefined && another[_key] !== undefined) {
  5313. return false;
  5314. }
  5315. }
  5316. return true;
  5317. };
  5318. var _excluded$1 = ["text"],
  5319. _excluded2$1 = ["anchor", "focus"];
  5320. function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  5321. function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
  5322. function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  5323. function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  5324. function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  5325. var Text = {
  5326. /**
  5327. * Check if two text nodes are equal.
  5328. *
  5329. * When loose is set, the text is not compared. This is
  5330. * used to check whether sibling text nodes can be merged.
  5331. */
  5332. equals: function equals(text, another) {
  5333. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  5334. var _options$loose = options.loose,
  5335. loose = _options$loose === void 0 ? false : _options$loose;
  5336. function omitText(obj) {
  5337. obj.text;
  5338. var rest = _objectWithoutProperties(obj, _excluded$1);
  5339. return rest;
  5340. }
  5341. return isDeepEqual(loose ? omitText(text) : text, loose ? omitText(another) : another);
  5342. },
  5343. /**
  5344. * Check if a value implements the `Text` interface.
  5345. */
  5346. isText: function isText(value) {
  5347. return isPlainObject.isPlainObject(value) && typeof value.text === 'string';
  5348. },
  5349. /**
  5350. * Check if a value is a list of `Text` objects.
  5351. */
  5352. isTextList: function isTextList(value) {
  5353. return Array.isArray(value) && value.every(function (val) {
  5354. return Text.isText(val);
  5355. });
  5356. },
  5357. /**
  5358. * Check if some props are a partial of Text.
  5359. */
  5360. isTextProps: function isTextProps(props) {
  5361. return props.text !== undefined;
  5362. },
  5363. /**
  5364. * Check if an text matches set of properties.
  5365. *
  5366. * Note: this is for matching custom properties, and it does not ensure that
  5367. * the `text` property are two nodes equal.
  5368. */
  5369. matches: function matches(text, props) {
  5370. for (var key in props) {
  5371. if (key === 'text') {
  5372. continue;
  5373. }
  5374. if (!text.hasOwnProperty(key) || text[key] !== props[key]) {
  5375. return false;
  5376. }
  5377. }
  5378. return true;
  5379. },
  5380. /**
  5381. * Get the leaves for a text node given decorations.
  5382. */
  5383. decorations: function decorations(node, _decorations) {
  5384. var leaves = [_objectSpread$4({}, node)];
  5385. var _iterator = _createForOfIteratorHelper$3(_decorations),
  5386. _step;
  5387. try {
  5388. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  5389. var dec = _step.value;
  5390. var anchor = dec.anchor,
  5391. focus = dec.focus,
  5392. rest = _objectWithoutProperties(dec, _excluded2$1);
  5393. var _Range$edges = Range.edges(dec),
  5394. _Range$edges2 = _slicedToArray(_Range$edges, 2),
  5395. start = _Range$edges2[0],
  5396. end = _Range$edges2[1];
  5397. var next = [];
  5398. var o = 0;
  5399. var _iterator2 = _createForOfIteratorHelper$3(leaves),
  5400. _step2;
  5401. try {
  5402. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  5403. var leaf = _step2.value;
  5404. var length = leaf.text.length;
  5405. var offset = o;
  5406. o += length; // If the range encompases the entire leaf, add the range.
  5407. if (start.offset <= offset && end.offset >= o) {
  5408. Object.assign(leaf, rest);
  5409. next.push(leaf);
  5410. continue;
  5411. } // If the range expanded and match the leaf, or starts after, or ends before it, continue.
  5412. if (start.offset !== end.offset && (start.offset === o || end.offset === offset) || start.offset > o || end.offset < offset || end.offset === offset && offset !== 0) {
  5413. next.push(leaf);
  5414. continue;
  5415. } // Otherwise we need to split the leaf, at the start, end, or both,
  5416. // and add the range to the middle intersecting section. Do the end
  5417. // split first since we don't need to update the offset that way.
  5418. var middle = leaf;
  5419. var before = void 0;
  5420. var after = void 0;
  5421. if (end.offset < o) {
  5422. var off = end.offset - offset;
  5423. after = _objectSpread$4(_objectSpread$4({}, middle), {}, {
  5424. text: middle.text.slice(off)
  5425. });
  5426. middle = _objectSpread$4(_objectSpread$4({}, middle), {}, {
  5427. text: middle.text.slice(0, off)
  5428. });
  5429. }
  5430. if (start.offset > offset) {
  5431. var _off = start.offset - offset;
  5432. before = _objectSpread$4(_objectSpread$4({}, middle), {}, {
  5433. text: middle.text.slice(0, _off)
  5434. });
  5435. middle = _objectSpread$4(_objectSpread$4({}, middle), {}, {
  5436. text: middle.text.slice(_off)
  5437. });
  5438. }
  5439. Object.assign(middle, rest);
  5440. if (before) {
  5441. next.push(before);
  5442. }
  5443. next.push(middle);
  5444. if (after) {
  5445. next.push(after);
  5446. }
  5447. }
  5448. } catch (err) {
  5449. _iterator2.e(err);
  5450. } finally {
  5451. _iterator2.f();
  5452. }
  5453. leaves = next;
  5454. }
  5455. } catch (err) {
  5456. _iterator.e(err);
  5457. } finally {
  5458. _iterator.f();
  5459. }
  5460. return leaves;
  5461. }
  5462. };
  5463. function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  5464. function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  5465. function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  5466. function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
  5467. function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  5468. var applyToDraft = function applyToDraft(editor, selection, op) {
  5469. switch (op.type) {
  5470. case 'insert_node':
  5471. {
  5472. var path = op.path,
  5473. node = op.node;
  5474. var parent = Node$1.parent(editor, path);
  5475. var index = path[path.length - 1];
  5476. if (index > parent.children.length) {
  5477. throw new Error("Cannot apply an \"insert_node\" operation at path [".concat(path, "] because the destination is past the end of the node."));
  5478. }
  5479. parent.children.splice(index, 0, node);
  5480. if (selection) {
  5481. var _iterator = _createForOfIteratorHelper$2(Range.points(selection)),
  5482. _step;
  5483. try {
  5484. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  5485. var _step$value = _slicedToArray(_step.value, 2),
  5486. point = _step$value[0],
  5487. key = _step$value[1];
  5488. selection[key] = Point.transform(point, op);
  5489. }
  5490. } catch (err) {
  5491. _iterator.e(err);
  5492. } finally {
  5493. _iterator.f();
  5494. }
  5495. }
  5496. break;
  5497. }
  5498. case 'insert_text':
  5499. {
  5500. var _path = op.path,
  5501. offset = op.offset,
  5502. text = op.text;
  5503. if (text.length === 0) break;
  5504. var _node = Node$1.leaf(editor, _path);
  5505. var before = _node.text.slice(0, offset);
  5506. var after = _node.text.slice(offset);
  5507. _node.text = before + text + after;
  5508. if (selection) {
  5509. var _iterator2 = _createForOfIteratorHelper$2(Range.points(selection)),
  5510. _step2;
  5511. try {
  5512. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  5513. var _step2$value = _slicedToArray(_step2.value, 2),
  5514. _point = _step2$value[0],
  5515. _key = _step2$value[1];
  5516. selection[_key] = Point.transform(_point, op);
  5517. }
  5518. } catch (err) {
  5519. _iterator2.e(err);
  5520. } finally {
  5521. _iterator2.f();
  5522. }
  5523. }
  5524. break;
  5525. }
  5526. case 'merge_node':
  5527. {
  5528. var _path2 = op.path;
  5529. var _node2 = Node$1.get(editor, _path2);
  5530. var prevPath = Path.previous(_path2);
  5531. var prev = Node$1.get(editor, prevPath);
  5532. var _parent = Node$1.parent(editor, _path2);
  5533. var _index = _path2[_path2.length - 1];
  5534. if (Text.isText(_node2) && Text.isText(prev)) {
  5535. prev.text += _node2.text;
  5536. } else if (!Text.isText(_node2) && !Text.isText(prev)) {
  5537. var _prev$children;
  5538. (_prev$children = prev.children).push.apply(_prev$children, _toConsumableArray(_node2.children));
  5539. } else {
  5540. throw new Error("Cannot apply a \"merge_node\" operation at path [".concat(_path2, "] to nodes of different interfaces: ").concat(_node2, " ").concat(prev));
  5541. }
  5542. _parent.children.splice(_index, 1);
  5543. if (selection) {
  5544. var _iterator3 = _createForOfIteratorHelper$2(Range.points(selection)),
  5545. _step3;
  5546. try {
  5547. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  5548. var _step3$value = _slicedToArray(_step3.value, 2),
  5549. _point2 = _step3$value[0],
  5550. _key2 = _step3$value[1];
  5551. selection[_key2] = Point.transform(_point2, op);
  5552. }
  5553. } catch (err) {
  5554. _iterator3.e(err);
  5555. } finally {
  5556. _iterator3.f();
  5557. }
  5558. }
  5559. break;
  5560. }
  5561. case 'move_node':
  5562. {
  5563. var _path3 = op.path,
  5564. newPath = op.newPath;
  5565. if (Path.isAncestor(_path3, newPath)) {
  5566. throw new Error("Cannot move a path [".concat(_path3, "] to new path [").concat(newPath, "] because the destination is inside itself."));
  5567. }
  5568. var _node3 = Node$1.get(editor, _path3);
  5569. var _parent2 = Node$1.parent(editor, _path3);
  5570. var _index2 = _path3[_path3.length - 1]; // This is tricky, but since the `path` and `newPath` both refer to
  5571. // the same snapshot in time, there's a mismatch. After either
  5572. // removing the original position, the second step's path can be out
  5573. // of date. So instead of using the `op.newPath` directly, we
  5574. // transform `op.path` to ascertain what the `newPath` would be after
  5575. // the operation was applied.
  5576. _parent2.children.splice(_index2, 1);
  5577. var truePath = Path.transform(_path3, op);
  5578. var newParent = Node$1.get(editor, Path.parent(truePath));
  5579. var newIndex = truePath[truePath.length - 1];
  5580. newParent.children.splice(newIndex, 0, _node3);
  5581. if (selection) {
  5582. var _iterator4 = _createForOfIteratorHelper$2(Range.points(selection)),
  5583. _step4;
  5584. try {
  5585. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  5586. var _step4$value = _slicedToArray(_step4.value, 2),
  5587. _point3 = _step4$value[0],
  5588. _key3 = _step4$value[1];
  5589. selection[_key3] = Point.transform(_point3, op);
  5590. }
  5591. } catch (err) {
  5592. _iterator4.e(err);
  5593. } finally {
  5594. _iterator4.f();
  5595. }
  5596. }
  5597. break;
  5598. }
  5599. case 'remove_node':
  5600. {
  5601. var _path4 = op.path;
  5602. var _index3 = _path4[_path4.length - 1];
  5603. var _parent3 = Node$1.parent(editor, _path4);
  5604. _parent3.children.splice(_index3, 1); // Transform all of the points in the value, but if the point was in the
  5605. // node that was removed we need to update the range or remove it.
  5606. if (selection) {
  5607. var _iterator5 = _createForOfIteratorHelper$2(Range.points(selection)),
  5608. _step5;
  5609. try {
  5610. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  5611. var _step5$value = _slicedToArray(_step5.value, 2),
  5612. _point4 = _step5$value[0],
  5613. _key4 = _step5$value[1];
  5614. var result = Point.transform(_point4, op);
  5615. if (selection != null && result != null) {
  5616. selection[_key4] = result;
  5617. } else {
  5618. var _prev = void 0;
  5619. var next = void 0;
  5620. var _iterator6 = _createForOfIteratorHelper$2(Node$1.texts(editor)),
  5621. _step6;
  5622. try {
  5623. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  5624. var _step6$value = _slicedToArray(_step6.value, 2),
  5625. n = _step6$value[0],
  5626. p = _step6$value[1];
  5627. if (Path.compare(p, _path4) === -1) {
  5628. _prev = [n, p];
  5629. } else {
  5630. next = [n, p];
  5631. break;
  5632. }
  5633. }
  5634. } catch (err) {
  5635. _iterator6.e(err);
  5636. } finally {
  5637. _iterator6.f();
  5638. }
  5639. var preferNext = false;
  5640. if (_prev && next) {
  5641. if (Path.equals(next[1], _path4)) {
  5642. preferNext = !Path.hasPrevious(next[1]);
  5643. } else {
  5644. preferNext = Path.common(_prev[1], _path4).length < Path.common(next[1], _path4).length;
  5645. }
  5646. }
  5647. if (_prev && !preferNext) {
  5648. _point4.path = _prev[1];
  5649. _point4.offset = _prev[0].text.length;
  5650. } else if (next) {
  5651. _point4.path = next[1];
  5652. _point4.offset = 0;
  5653. } else {
  5654. selection = null;
  5655. }
  5656. }
  5657. }
  5658. } catch (err) {
  5659. _iterator5.e(err);
  5660. } finally {
  5661. _iterator5.f();
  5662. }
  5663. }
  5664. break;
  5665. }
  5666. case 'remove_text':
  5667. {
  5668. var _path5 = op.path,
  5669. _offset = op.offset,
  5670. _text = op.text;
  5671. if (_text.length === 0) break;
  5672. var _node4 = Node$1.leaf(editor, _path5);
  5673. var _before = _node4.text.slice(0, _offset);
  5674. var _after = _node4.text.slice(_offset + _text.length);
  5675. _node4.text = _before + _after;
  5676. if (selection) {
  5677. var _iterator7 = _createForOfIteratorHelper$2(Range.points(selection)),
  5678. _step7;
  5679. try {
  5680. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  5681. var _step7$value = _slicedToArray(_step7.value, 2),
  5682. _point5 = _step7$value[0],
  5683. _key5 = _step7$value[1];
  5684. selection[_key5] = Point.transform(_point5, op);
  5685. }
  5686. } catch (err) {
  5687. _iterator7.e(err);
  5688. } finally {
  5689. _iterator7.f();
  5690. }
  5691. }
  5692. break;
  5693. }
  5694. case 'set_node':
  5695. {
  5696. var _path6 = op.path,
  5697. properties = op.properties,
  5698. newProperties = op.newProperties;
  5699. if (_path6.length === 0) {
  5700. throw new Error("Cannot set properties on the root node!");
  5701. }
  5702. var _node5 = Node$1.get(editor, _path6);
  5703. for (var _key6 in newProperties) {
  5704. if (_key6 === 'children' || _key6 === 'text') {
  5705. throw new Error("Cannot set the \"".concat(_key6, "\" property of nodes!"));
  5706. }
  5707. var value = newProperties[_key6];
  5708. if (value == null) {
  5709. delete _node5[_key6];
  5710. } else {
  5711. _node5[_key6] = value;
  5712. }
  5713. } // properties that were previously defined, but are now missing, must be deleted
  5714. for (var _key7 in properties) {
  5715. if (!newProperties.hasOwnProperty(_key7)) {
  5716. delete _node5[_key7];
  5717. }
  5718. }
  5719. break;
  5720. }
  5721. case 'set_selection':
  5722. {
  5723. var _newProperties = op.newProperties;
  5724. if (_newProperties == null) {
  5725. selection = _newProperties;
  5726. } else {
  5727. if (selection == null) {
  5728. if (!Range.isRange(_newProperties)) {
  5729. throw new Error("Cannot apply an incomplete \"set_selection\" operation properties ".concat(JSON.stringify(_newProperties), " when there is no current selection."));
  5730. }
  5731. selection = _objectSpread$3({}, _newProperties);
  5732. }
  5733. for (var _key8 in _newProperties) {
  5734. var _value = _newProperties[_key8];
  5735. if (_value == null) {
  5736. if (_key8 === 'anchor' || _key8 === 'focus') {
  5737. throw new Error("Cannot remove the \"".concat(_key8, "\" selection property"));
  5738. }
  5739. delete selection[_key8];
  5740. } else {
  5741. selection[_key8] = _value;
  5742. }
  5743. }
  5744. }
  5745. break;
  5746. }
  5747. case 'split_node':
  5748. {
  5749. var _path7 = op.path,
  5750. position = op.position,
  5751. _properties = op.properties;
  5752. if (_path7.length === 0) {
  5753. throw new Error("Cannot apply a \"split_node\" operation at path [".concat(_path7, "] because the root node cannot be split."));
  5754. }
  5755. var _node6 = Node$1.get(editor, _path7);
  5756. var _parent4 = Node$1.parent(editor, _path7);
  5757. var _index4 = _path7[_path7.length - 1];
  5758. var newNode;
  5759. if (Text.isText(_node6)) {
  5760. var _before2 = _node6.text.slice(0, position);
  5761. var _after2 = _node6.text.slice(position);
  5762. _node6.text = _before2;
  5763. newNode = _objectSpread$3(_objectSpread$3({}, _properties), {}, {
  5764. text: _after2
  5765. });
  5766. } else {
  5767. var _before3 = _node6.children.slice(0, position);
  5768. var _after3 = _node6.children.slice(position);
  5769. _node6.children = _before3;
  5770. newNode = _objectSpread$3(_objectSpread$3({}, _properties), {}, {
  5771. children: _after3
  5772. });
  5773. }
  5774. _parent4.children.splice(_index4 + 1, 0, newNode);
  5775. if (selection) {
  5776. var _iterator8 = _createForOfIteratorHelper$2(Range.points(selection)),
  5777. _step8;
  5778. try {
  5779. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  5780. var _step8$value = _slicedToArray(_step8.value, 2),
  5781. _point6 = _step8$value[0],
  5782. _key9 = _step8$value[1];
  5783. selection[_key9] = Point.transform(_point6, op);
  5784. }
  5785. } catch (err) {
  5786. _iterator8.e(err);
  5787. } finally {
  5788. _iterator8.f();
  5789. }
  5790. }
  5791. break;
  5792. }
  5793. }
  5794. return selection;
  5795. };
  5796. var GeneralTransforms = {
  5797. /**
  5798. * Transform the editor by an operation.
  5799. */
  5800. transform: function transform(editor, op) {
  5801. editor.children = immer.createDraft(editor.children);
  5802. var selection = editor.selection && immer.createDraft(editor.selection);
  5803. try {
  5804. selection = applyToDraft(editor, selection, op);
  5805. } finally {
  5806. editor.children = immer.finishDraft(editor.children);
  5807. if (selection) {
  5808. editor.selection = immer.isDraft(selection) ? immer.finishDraft(selection) : selection;
  5809. } else {
  5810. editor.selection = null;
  5811. }
  5812. }
  5813. }
  5814. };
  5815. var _excluded = ["text"],
  5816. _excluded2 = ["children"];
  5817. function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  5818. function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  5819. function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  5820. function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
  5821. function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  5822. var NodeTransforms = {
  5823. /**
  5824. * Insert nodes at a specific location in the Editor.
  5825. */
  5826. insertNodes: function insertNodes(editor, nodes) {
  5827. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  5828. Editor.withoutNormalizing(editor, function () {
  5829. var _options$hanging = options.hanging,
  5830. hanging = _options$hanging === void 0 ? false : _options$hanging,
  5831. _options$voids = options.voids,
  5832. voids = _options$voids === void 0 ? false : _options$voids,
  5833. _options$mode = options.mode,
  5834. mode = _options$mode === void 0 ? 'lowest' : _options$mode;
  5835. var at = options.at,
  5836. match = options.match,
  5837. select = options.select;
  5838. if (Node$1.isNode(nodes)) {
  5839. nodes = [nodes];
  5840. }
  5841. if (nodes.length === 0) {
  5842. return;
  5843. }
  5844. var _nodes = nodes,
  5845. _nodes2 = _slicedToArray(_nodes, 1),
  5846. node = _nodes2[0]; // By default, use the selection as the target location. But if there is
  5847. // no selection, insert at the end of the document since that is such a
  5848. // common use case when inserting from a non-selected state.
  5849. if (!at) {
  5850. if (editor.selection) {
  5851. at = editor.selection;
  5852. } else if (editor.children.length > 0) {
  5853. at = Editor.end(editor, []);
  5854. } else {
  5855. at = [0];
  5856. }
  5857. select = true;
  5858. }
  5859. if (select == null) {
  5860. select = false;
  5861. }
  5862. if (Range.isRange(at)) {
  5863. if (!hanging) {
  5864. at = Editor.unhangRange(editor, at);
  5865. }
  5866. if (Range.isCollapsed(at)) {
  5867. at = at.anchor;
  5868. } else {
  5869. var _Range$edges = Range.edges(at),
  5870. _Range$edges2 = _slicedToArray(_Range$edges, 2),
  5871. end = _Range$edges2[1];
  5872. var pointRef = Editor.pointRef(editor, end);
  5873. Transforms["delete"](editor, {
  5874. at: at
  5875. });
  5876. at = pointRef.unref();
  5877. }
  5878. }
  5879. if (Point.isPoint(at)) {
  5880. if (match == null) {
  5881. if (Text.isText(node)) {
  5882. match = function match(n) {
  5883. return Text.isText(n);
  5884. };
  5885. } else if (editor.isInline(node)) {
  5886. match = function match(n) {
  5887. return Text.isText(n) || Editor.isInline(editor, n);
  5888. };
  5889. } else {
  5890. match = function match(n) {
  5891. return Editor.isBlock(editor, n);
  5892. };
  5893. }
  5894. }
  5895. var _Editor$nodes = Editor.nodes(editor, {
  5896. at: at.path,
  5897. match: match,
  5898. mode: mode,
  5899. voids: voids
  5900. }),
  5901. _Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
  5902. entry = _Editor$nodes2[0];
  5903. if (entry) {
  5904. var _entry = _slicedToArray(entry, 2),
  5905. _matchPath = _entry[1];
  5906. var pathRef = Editor.pathRef(editor, _matchPath);
  5907. var isAtEnd = Editor.isEnd(editor, at, _matchPath);
  5908. Transforms.splitNodes(editor, {
  5909. at: at,
  5910. match: match,
  5911. mode: mode,
  5912. voids: voids
  5913. });
  5914. var path = pathRef.unref();
  5915. at = isAtEnd ? Path.next(path) : path;
  5916. } else {
  5917. return;
  5918. }
  5919. }
  5920. var parentPath = Path.parent(at);
  5921. var index = at[at.length - 1];
  5922. if (!voids && Editor["void"](editor, {
  5923. at: parentPath
  5924. })) {
  5925. return;
  5926. }
  5927. var _iterator = _createForOfIteratorHelper$1(nodes),
  5928. _step;
  5929. try {
  5930. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  5931. var _node = _step.value;
  5932. var _path = parentPath.concat(index);
  5933. index++;
  5934. editor.apply({
  5935. type: 'insert_node',
  5936. path: _path,
  5937. node: _node
  5938. });
  5939. at = Path.next(at);
  5940. }
  5941. } catch (err) {
  5942. _iterator.e(err);
  5943. } finally {
  5944. _iterator.f();
  5945. }
  5946. at = Path.previous(at);
  5947. if (select) {
  5948. var point = Editor.end(editor, at);
  5949. if (point) {
  5950. Transforms.select(editor, point);
  5951. }
  5952. }
  5953. });
  5954. },
  5955. /**
  5956. * Lift nodes at a specific location upwards in the document tree, splitting
  5957. * their parent in two if necessary.
  5958. */
  5959. liftNodes: function liftNodes(editor) {
  5960. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  5961. Editor.withoutNormalizing(editor, function () {
  5962. var _options$at = options.at,
  5963. at = _options$at === void 0 ? editor.selection : _options$at,
  5964. _options$mode2 = options.mode,
  5965. mode = _options$mode2 === void 0 ? 'lowest' : _options$mode2,
  5966. _options$voids2 = options.voids,
  5967. voids = _options$voids2 === void 0 ? false : _options$voids2;
  5968. var match = options.match;
  5969. if (match == null) {
  5970. match = Path.isPath(at) ? matchPath(editor, at) : function (n) {
  5971. return Editor.isBlock(editor, n);
  5972. };
  5973. }
  5974. if (!at) {
  5975. return;
  5976. }
  5977. var matches = Editor.nodes(editor, {
  5978. at: at,
  5979. match: match,
  5980. mode: mode,
  5981. voids: voids
  5982. });
  5983. var pathRefs = Array.from(matches, function (_ref) {
  5984. var _ref2 = _slicedToArray(_ref, 2),
  5985. p = _ref2[1];
  5986. return Editor.pathRef(editor, p);
  5987. });
  5988. for (var _i = 0, _pathRefs = pathRefs; _i < _pathRefs.length; _i++) {
  5989. var pathRef = _pathRefs[_i];
  5990. var path = pathRef.unref();
  5991. if (path.length < 2) {
  5992. throw new Error("Cannot lift node at a path [".concat(path, "] because it has a depth of less than `2`."));
  5993. }
  5994. var parentNodeEntry = Editor.node(editor, Path.parent(path));
  5995. var _parentNodeEntry = _slicedToArray(parentNodeEntry, 2),
  5996. parent = _parentNodeEntry[0],
  5997. parentPath = _parentNodeEntry[1];
  5998. var index = path[path.length - 1];
  5999. var length = parent.children.length;
  6000. if (length === 1) {
  6001. var toPath = Path.next(parentPath);
  6002. Transforms.moveNodes(editor, {
  6003. at: path,
  6004. to: toPath,
  6005. voids: voids
  6006. });
  6007. Transforms.removeNodes(editor, {
  6008. at: parentPath,
  6009. voids: voids
  6010. });
  6011. } else if (index === 0) {
  6012. Transforms.moveNodes(editor, {
  6013. at: path,
  6014. to: parentPath,
  6015. voids: voids
  6016. });
  6017. } else if (index === length - 1) {
  6018. var _toPath = Path.next(parentPath);
  6019. Transforms.moveNodes(editor, {
  6020. at: path,
  6021. to: _toPath,
  6022. voids: voids
  6023. });
  6024. } else {
  6025. var splitPath = Path.next(path);
  6026. var _toPath2 = Path.next(parentPath);
  6027. Transforms.splitNodes(editor, {
  6028. at: splitPath,
  6029. voids: voids
  6030. });
  6031. Transforms.moveNodes(editor, {
  6032. at: path,
  6033. to: _toPath2,
  6034. voids: voids
  6035. });
  6036. }
  6037. }
  6038. });
  6039. },
  6040. /**
  6041. * Merge a node at a location with the previous node of the same depth,
  6042. * removing any empty containing nodes after the merge if necessary.
  6043. */
  6044. mergeNodes: function mergeNodes(editor) {
  6045. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6046. Editor.withoutNormalizing(editor, function () {
  6047. var match = options.match,
  6048. _options$at2 = options.at,
  6049. at = _options$at2 === void 0 ? editor.selection : _options$at2;
  6050. var _options$hanging2 = options.hanging,
  6051. hanging = _options$hanging2 === void 0 ? false : _options$hanging2,
  6052. _options$voids3 = options.voids,
  6053. voids = _options$voids3 === void 0 ? false : _options$voids3,
  6054. _options$mode3 = options.mode,
  6055. mode = _options$mode3 === void 0 ? 'lowest' : _options$mode3;
  6056. if (!at) {
  6057. return;
  6058. }
  6059. if (match == null) {
  6060. if (Path.isPath(at)) {
  6061. var _Editor$parent = Editor.parent(editor, at),
  6062. _Editor$parent2 = _slicedToArray(_Editor$parent, 1),
  6063. parent = _Editor$parent2[0];
  6064. match = function match(n) {
  6065. return parent.children.includes(n);
  6066. };
  6067. } else {
  6068. match = function match(n) {
  6069. return Editor.isBlock(editor, n);
  6070. };
  6071. }
  6072. }
  6073. if (!hanging && Range.isRange(at)) {
  6074. at = Editor.unhangRange(editor, at);
  6075. }
  6076. if (Range.isRange(at)) {
  6077. if (Range.isCollapsed(at)) {
  6078. at = at.anchor;
  6079. } else {
  6080. var _Range$edges3 = Range.edges(at),
  6081. _Range$edges4 = _slicedToArray(_Range$edges3, 2),
  6082. end = _Range$edges4[1];
  6083. var pointRef = Editor.pointRef(editor, end);
  6084. Transforms["delete"](editor, {
  6085. at: at
  6086. });
  6087. at = pointRef.unref();
  6088. if (options.at == null) {
  6089. Transforms.select(editor, at);
  6090. }
  6091. }
  6092. }
  6093. var _Editor$nodes3 = Editor.nodes(editor, {
  6094. at: at,
  6095. match: match,
  6096. voids: voids,
  6097. mode: mode
  6098. }),
  6099. _Editor$nodes4 = _slicedToArray(_Editor$nodes3, 1),
  6100. current = _Editor$nodes4[0];
  6101. var prev = Editor.previous(editor, {
  6102. at: at,
  6103. match: match,
  6104. voids: voids,
  6105. mode: mode
  6106. });
  6107. if (!current || !prev) {
  6108. return;
  6109. }
  6110. var _current = _slicedToArray(current, 2),
  6111. node = _current[0],
  6112. path = _current[1];
  6113. var _prev = _slicedToArray(prev, 2),
  6114. prevNode = _prev[0],
  6115. prevPath = _prev[1];
  6116. if (path.length === 0 || prevPath.length === 0) {
  6117. return;
  6118. }
  6119. var newPath = Path.next(prevPath);
  6120. var commonPath = Path.common(path, prevPath);
  6121. var isPreviousSibling = Path.isSibling(path, prevPath);
  6122. var levels = Array.from(Editor.levels(editor, {
  6123. at: path
  6124. }), function (_ref3) {
  6125. var _ref4 = _slicedToArray(_ref3, 1),
  6126. n = _ref4[0];
  6127. return n;
  6128. }).slice(commonPath.length).slice(0, -1); // Determine if the merge will leave an ancestor of the path empty as a
  6129. // result, in which case we'll want to remove it after merging.
  6130. var emptyAncestor = Editor.above(editor, {
  6131. at: path,
  6132. mode: 'highest',
  6133. match: function match(n) {
  6134. return levels.includes(n) && hasSingleChildNest(editor, n);
  6135. }
  6136. });
  6137. var emptyRef = emptyAncestor && Editor.pathRef(editor, emptyAncestor[1]);
  6138. var properties;
  6139. var position; // Ensure that the nodes are equivalent, and figure out what the position
  6140. // and extra properties of the merge will be.
  6141. if (Text.isText(node) && Text.isText(prevNode)) {
  6142. node.text;
  6143. var rest = _objectWithoutProperties(node, _excluded);
  6144. position = prevNode.text.length;
  6145. properties = rest;
  6146. } else if (Element$1.isElement(node) && Element$1.isElement(prevNode)) {
  6147. node.children;
  6148. var _rest = _objectWithoutProperties(node, _excluded2);
  6149. position = prevNode.children.length;
  6150. properties = _rest;
  6151. } else {
  6152. throw new Error("Cannot merge the node at path [".concat(path, "] with the previous sibling because it is not the same kind: ").concat(JSON.stringify(node), " ").concat(JSON.stringify(prevNode)));
  6153. } // If the node isn't already the next sibling of the previous node, move
  6154. // it so that it is before merging.
  6155. if (!isPreviousSibling) {
  6156. Transforms.moveNodes(editor, {
  6157. at: path,
  6158. to: newPath,
  6159. voids: voids
  6160. });
  6161. } // If there was going to be an empty ancestor of the node that was merged,
  6162. // we remove it from the tree.
  6163. if (emptyRef) {
  6164. Transforms.removeNodes(editor, {
  6165. at: emptyRef.current,
  6166. voids: voids
  6167. });
  6168. } // If the target node that we're merging with is empty, remove it instead
  6169. // of merging the two. This is a common rich text editor behavior to
  6170. // prevent losing formatting when deleting entire nodes when you have a
  6171. // hanging selection.
  6172. // if prevNode is first child in parent,don't remove it.
  6173. if (Element$1.isElement(prevNode) && Editor.isEmpty(editor, prevNode) || Text.isText(prevNode) && prevNode.text === '' && prevPath[prevPath.length - 1] !== 0) {
  6174. Transforms.removeNodes(editor, {
  6175. at: prevPath,
  6176. voids: voids
  6177. });
  6178. } else {
  6179. editor.apply({
  6180. type: 'merge_node',
  6181. path: newPath,
  6182. position: position,
  6183. properties: properties
  6184. });
  6185. }
  6186. if (emptyRef) {
  6187. emptyRef.unref();
  6188. }
  6189. });
  6190. },
  6191. /**
  6192. * Move the nodes at a location to a new location.
  6193. */
  6194. moveNodes: function moveNodes(editor, options) {
  6195. Editor.withoutNormalizing(editor, function () {
  6196. var to = options.to,
  6197. _options$at3 = options.at,
  6198. at = _options$at3 === void 0 ? editor.selection : _options$at3,
  6199. _options$mode4 = options.mode,
  6200. mode = _options$mode4 === void 0 ? 'lowest' : _options$mode4,
  6201. _options$voids4 = options.voids,
  6202. voids = _options$voids4 === void 0 ? false : _options$voids4;
  6203. var match = options.match;
  6204. if (!at) {
  6205. return;
  6206. }
  6207. if (match == null) {
  6208. match = Path.isPath(at) ? matchPath(editor, at) : function (n) {
  6209. return Editor.isBlock(editor, n);
  6210. };
  6211. }
  6212. var toRef = Editor.pathRef(editor, to);
  6213. var targets = Editor.nodes(editor, {
  6214. at: at,
  6215. match: match,
  6216. mode: mode,
  6217. voids: voids
  6218. });
  6219. var pathRefs = Array.from(targets, function (_ref5) {
  6220. var _ref6 = _slicedToArray(_ref5, 2),
  6221. p = _ref6[1];
  6222. return Editor.pathRef(editor, p);
  6223. });
  6224. for (var _i2 = 0, _pathRefs2 = pathRefs; _i2 < _pathRefs2.length; _i2++) {
  6225. var pathRef = _pathRefs2[_i2];
  6226. var path = pathRef.unref();
  6227. var newPath = toRef.current;
  6228. if (path.length !== 0) {
  6229. editor.apply({
  6230. type: 'move_node',
  6231. path: path,
  6232. newPath: newPath
  6233. });
  6234. }
  6235. if (toRef.current && Path.isSibling(newPath, path) && Path.isAfter(newPath, path)) {
  6236. // When performing a sibling move to a later index, the path at the destination is shifted
  6237. // to before the insertion point instead of after. To ensure our group of nodes are inserted
  6238. // in the correct order we increment toRef to account for that
  6239. toRef.current = Path.next(toRef.current);
  6240. }
  6241. }
  6242. toRef.unref();
  6243. });
  6244. },
  6245. /**
  6246. * Remove the nodes at a specific location in the document.
  6247. */
  6248. removeNodes: function removeNodes(editor) {
  6249. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6250. Editor.withoutNormalizing(editor, function () {
  6251. var _options$hanging3 = options.hanging,
  6252. hanging = _options$hanging3 === void 0 ? false : _options$hanging3,
  6253. _options$voids5 = options.voids,
  6254. voids = _options$voids5 === void 0 ? false : _options$voids5,
  6255. _options$mode5 = options.mode,
  6256. mode = _options$mode5 === void 0 ? 'lowest' : _options$mode5;
  6257. var _options$at4 = options.at,
  6258. at = _options$at4 === void 0 ? editor.selection : _options$at4,
  6259. match = options.match;
  6260. if (!at) {
  6261. return;
  6262. }
  6263. if (match == null) {
  6264. match = Path.isPath(at) ? matchPath(editor, at) : function (n) {
  6265. return Editor.isBlock(editor, n);
  6266. };
  6267. }
  6268. if (!hanging && Range.isRange(at)) {
  6269. at = Editor.unhangRange(editor, at);
  6270. }
  6271. var depths = Editor.nodes(editor, {
  6272. at: at,
  6273. match: match,
  6274. mode: mode,
  6275. voids: voids
  6276. });
  6277. var pathRefs = Array.from(depths, function (_ref7) {
  6278. var _ref8 = _slicedToArray(_ref7, 2),
  6279. p = _ref8[1];
  6280. return Editor.pathRef(editor, p);
  6281. });
  6282. for (var _i3 = 0, _pathRefs3 = pathRefs; _i3 < _pathRefs3.length; _i3++) {
  6283. var pathRef = _pathRefs3[_i3];
  6284. var path = pathRef.unref();
  6285. if (path) {
  6286. var _Editor$node = Editor.node(editor, path),
  6287. _Editor$node2 = _slicedToArray(_Editor$node, 1),
  6288. node = _Editor$node2[0];
  6289. editor.apply({
  6290. type: 'remove_node',
  6291. path: path,
  6292. node: node
  6293. });
  6294. }
  6295. }
  6296. });
  6297. },
  6298. /**
  6299. * Set new properties on the nodes at a location.
  6300. */
  6301. setNodes: function setNodes(editor, props) {
  6302. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  6303. Editor.withoutNormalizing(editor, function () {
  6304. var match = options.match,
  6305. _options$at5 = options.at,
  6306. at = _options$at5 === void 0 ? editor.selection : _options$at5;
  6307. var _options$hanging4 = options.hanging,
  6308. hanging = _options$hanging4 === void 0 ? false : _options$hanging4,
  6309. _options$mode6 = options.mode,
  6310. mode = _options$mode6 === void 0 ? 'lowest' : _options$mode6,
  6311. _options$split = options.split,
  6312. split = _options$split === void 0 ? false : _options$split,
  6313. _options$voids6 = options.voids,
  6314. voids = _options$voids6 === void 0 ? false : _options$voids6;
  6315. if (!at) {
  6316. return;
  6317. }
  6318. if (match == null) {
  6319. match = Path.isPath(at) ? matchPath(editor, at) : function (n) {
  6320. return Editor.isBlock(editor, n);
  6321. };
  6322. }
  6323. if (!hanging && Range.isRange(at)) {
  6324. at = Editor.unhangRange(editor, at);
  6325. }
  6326. if (split && Range.isRange(at)) {
  6327. if (Range.isCollapsed(at) && Editor.leaf(editor, at.anchor)[0].text.length > 0) {
  6328. // If the range is collapsed in a non-empty node and 'split' is true, there's nothing to
  6329. // set that won't get normalized away
  6330. return;
  6331. }
  6332. var rangeRef = Editor.rangeRef(editor, at, {
  6333. affinity: 'inward'
  6334. });
  6335. var _Range$edges5 = Range.edges(at),
  6336. _Range$edges6 = _slicedToArray(_Range$edges5, 2),
  6337. start = _Range$edges6[0],
  6338. end = _Range$edges6[1];
  6339. var splitMode = mode === 'lowest' ? 'lowest' : 'highest';
  6340. var endAtEndOfNode = Editor.isEnd(editor, end, end.path);
  6341. Transforms.splitNodes(editor, {
  6342. at: end,
  6343. match: match,
  6344. mode: splitMode,
  6345. voids: voids,
  6346. always: !endAtEndOfNode
  6347. });
  6348. var startAtStartOfNode = Editor.isStart(editor, start, start.path);
  6349. Transforms.splitNodes(editor, {
  6350. at: start,
  6351. match: match,
  6352. mode: splitMode,
  6353. voids: voids,
  6354. always: !startAtStartOfNode
  6355. });
  6356. at = rangeRef.unref();
  6357. if (options.at == null) {
  6358. Transforms.select(editor, at);
  6359. }
  6360. }
  6361. var _iterator2 = _createForOfIteratorHelper$1(Editor.nodes(editor, {
  6362. at: at,
  6363. match: match,
  6364. mode: mode,
  6365. voids: voids
  6366. })),
  6367. _step2;
  6368. try {
  6369. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  6370. var _step2$value = _slicedToArray(_step2.value, 2),
  6371. node = _step2$value[0],
  6372. path = _step2$value[1];
  6373. var properties = {};
  6374. var newProperties = {}; // You can't set properties on the editor node.
  6375. if (path.length === 0) {
  6376. continue;
  6377. }
  6378. var hasChanges = false;
  6379. for (var k in props) {
  6380. if (k === 'children' || k === 'text') {
  6381. continue;
  6382. }
  6383. if (props[k] !== node[k]) {
  6384. hasChanges = true; // Omit new properties from the old properties list
  6385. if (node.hasOwnProperty(k)) properties[k] = node[k]; // Omit properties that have been removed from the new properties list
  6386. if (props[k] != null) newProperties[k] = props[k];
  6387. }
  6388. }
  6389. if (hasChanges) {
  6390. editor.apply({
  6391. type: 'set_node',
  6392. path: path,
  6393. properties: properties,
  6394. newProperties: newProperties
  6395. });
  6396. }
  6397. }
  6398. } catch (err) {
  6399. _iterator2.e(err);
  6400. } finally {
  6401. _iterator2.f();
  6402. }
  6403. });
  6404. },
  6405. /**
  6406. * Split the nodes at a specific location.
  6407. */
  6408. splitNodes: function splitNodes(editor) {
  6409. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6410. Editor.withoutNormalizing(editor, function () {
  6411. var _options$mode7 = options.mode,
  6412. mode = _options$mode7 === void 0 ? 'lowest' : _options$mode7,
  6413. _options$voids7 = options.voids,
  6414. voids = _options$voids7 === void 0 ? false : _options$voids7;
  6415. var match = options.match,
  6416. _options$at6 = options.at,
  6417. at = _options$at6 === void 0 ? editor.selection : _options$at6,
  6418. _options$height = options.height,
  6419. height = _options$height === void 0 ? 0 : _options$height,
  6420. _options$always = options.always,
  6421. always = _options$always === void 0 ? false : _options$always;
  6422. if (match == null) {
  6423. match = function match(n) {
  6424. return Editor.isBlock(editor, n);
  6425. };
  6426. }
  6427. if (Range.isRange(at)) {
  6428. at = deleteRange(editor, at);
  6429. } // If the target is a path, the default height-skipping and position
  6430. // counters need to account for us potentially splitting at a non-leaf.
  6431. if (Path.isPath(at)) {
  6432. var path = at;
  6433. var point = Editor.point(editor, path);
  6434. var _Editor$parent3 = Editor.parent(editor, path),
  6435. _Editor$parent4 = _slicedToArray(_Editor$parent3, 1),
  6436. parent = _Editor$parent4[0];
  6437. match = function match(n) {
  6438. return n === parent;
  6439. };
  6440. height = point.path.length - path.length + 1;
  6441. at = point;
  6442. always = true;
  6443. }
  6444. if (!at) {
  6445. return;
  6446. }
  6447. var beforeRef = Editor.pointRef(editor, at, {
  6448. affinity: 'backward'
  6449. });
  6450. var _Editor$nodes5 = Editor.nodes(editor, {
  6451. at: at,
  6452. match: match,
  6453. mode: mode,
  6454. voids: voids
  6455. }),
  6456. _Editor$nodes6 = _slicedToArray(_Editor$nodes5, 1),
  6457. highest = _Editor$nodes6[0];
  6458. if (!highest) {
  6459. return;
  6460. }
  6461. var voidMatch = Editor["void"](editor, {
  6462. at: at,
  6463. mode: 'highest'
  6464. });
  6465. var nudge = 0;
  6466. if (!voids && voidMatch) {
  6467. var _voidMatch = _slicedToArray(voidMatch, 2),
  6468. voidNode = _voidMatch[0],
  6469. voidPath = _voidMatch[1];
  6470. if (Element$1.isElement(voidNode) && editor.isInline(voidNode)) {
  6471. var after = Editor.after(editor, voidPath);
  6472. if (!after) {
  6473. var text = {
  6474. text: ''
  6475. };
  6476. var afterPath = Path.next(voidPath);
  6477. Transforms.insertNodes(editor, text, {
  6478. at: afterPath,
  6479. voids: voids
  6480. });
  6481. after = Editor.point(editor, afterPath);
  6482. }
  6483. at = after;
  6484. always = true;
  6485. }
  6486. var siblingHeight = at.path.length - voidPath.length;
  6487. height = siblingHeight + 1;
  6488. always = true;
  6489. }
  6490. var afterRef = Editor.pointRef(editor, at);
  6491. var depth = at.path.length - height;
  6492. var _highest = _slicedToArray(highest, 2),
  6493. highestPath = _highest[1];
  6494. var lowestPath = at.path.slice(0, depth);
  6495. var position = height === 0 ? at.offset : at.path[depth] + nudge;
  6496. var _iterator3 = _createForOfIteratorHelper$1(Editor.levels(editor, {
  6497. at: lowestPath,
  6498. reverse: true,
  6499. voids: voids
  6500. })),
  6501. _step3;
  6502. try {
  6503. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  6504. var _step3$value = _slicedToArray(_step3.value, 2),
  6505. node = _step3$value[0],
  6506. _path2 = _step3$value[1];
  6507. var split = false;
  6508. if (_path2.length < highestPath.length || _path2.length === 0 || !voids && Editor.isVoid(editor, node)) {
  6509. break;
  6510. }
  6511. var _point2 = beforeRef.current;
  6512. var isEnd = Editor.isEnd(editor, _point2, _path2);
  6513. if (always || !beforeRef || !Editor.isEdge(editor, _point2, _path2)) {
  6514. split = true;
  6515. var properties = Node$1.extractProps(node);
  6516. editor.apply({
  6517. type: 'split_node',
  6518. path: _path2,
  6519. position: position,
  6520. properties: properties
  6521. });
  6522. }
  6523. position = _path2[_path2.length - 1] + (split || isEnd ? 1 : 0);
  6524. }
  6525. } catch (err) {
  6526. _iterator3.e(err);
  6527. } finally {
  6528. _iterator3.f();
  6529. }
  6530. if (options.at == null) {
  6531. var _point = afterRef.current || Editor.end(editor, []);
  6532. Transforms.select(editor, _point);
  6533. }
  6534. beforeRef.unref();
  6535. afterRef.unref();
  6536. });
  6537. },
  6538. /**
  6539. * Unset properties on the nodes at a location.
  6540. */
  6541. unsetNodes: function unsetNodes(editor, props) {
  6542. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  6543. if (!Array.isArray(props)) {
  6544. props = [props];
  6545. }
  6546. var obj = {};
  6547. var _iterator4 = _createForOfIteratorHelper$1(props),
  6548. _step4;
  6549. try {
  6550. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  6551. var key = _step4.value;
  6552. obj[key] = null;
  6553. }
  6554. } catch (err) {
  6555. _iterator4.e(err);
  6556. } finally {
  6557. _iterator4.f();
  6558. }
  6559. Transforms.setNodes(editor, obj, options);
  6560. },
  6561. /**
  6562. * Unwrap the nodes at a location from a parent node, splitting the parent if
  6563. * necessary to ensure that only the content in the range is unwrapped.
  6564. */
  6565. unwrapNodes: function unwrapNodes(editor) {
  6566. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6567. Editor.withoutNormalizing(editor, function () {
  6568. var _options$mode8 = options.mode,
  6569. mode = _options$mode8 === void 0 ? 'lowest' : _options$mode8,
  6570. _options$split2 = options.split,
  6571. split = _options$split2 === void 0 ? false : _options$split2,
  6572. _options$voids8 = options.voids,
  6573. voids = _options$voids8 === void 0 ? false : _options$voids8;
  6574. var _options$at7 = options.at,
  6575. at = _options$at7 === void 0 ? editor.selection : _options$at7,
  6576. match = options.match;
  6577. if (!at) {
  6578. return;
  6579. }
  6580. if (match == null) {
  6581. match = Path.isPath(at) ? matchPath(editor, at) : function (n) {
  6582. return Editor.isBlock(editor, n);
  6583. };
  6584. }
  6585. if (Path.isPath(at)) {
  6586. at = Editor.range(editor, at);
  6587. }
  6588. var rangeRef = Range.isRange(at) ? Editor.rangeRef(editor, at) : null;
  6589. var matches = Editor.nodes(editor, {
  6590. at: at,
  6591. match: match,
  6592. mode: mode,
  6593. voids: voids
  6594. });
  6595. var pathRefs = Array.from(matches, function (_ref9) {
  6596. var _ref10 = _slicedToArray(_ref9, 2),
  6597. p = _ref10[1];
  6598. return Editor.pathRef(editor, p);
  6599. } // unwrapNode will call liftNode which does not support splitting the node when nested.
  6600. // If we do not reverse the order and call it from top to the bottom, it will remove all blocks
  6601. // that wrap target node. So we reverse the order.
  6602. ).reverse();
  6603. var _iterator5 = _createForOfIteratorHelper$1(pathRefs),
  6604. _step5;
  6605. try {
  6606. var _loop = function _loop() {
  6607. var pathRef = _step5.value;
  6608. var path = pathRef.unref();
  6609. var _Editor$node3 = Editor.node(editor, path),
  6610. _Editor$node4 = _slicedToArray(_Editor$node3, 1),
  6611. node = _Editor$node4[0];
  6612. var range = Editor.range(editor, path);
  6613. if (split && rangeRef) {
  6614. range = Range.intersection(rangeRef.current, range);
  6615. }
  6616. Transforms.liftNodes(editor, {
  6617. at: range,
  6618. match: function match(n) {
  6619. return Element$1.isAncestor(node) && node.children.includes(n);
  6620. },
  6621. voids: voids
  6622. });
  6623. };
  6624. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  6625. _loop();
  6626. }
  6627. } catch (err) {
  6628. _iterator5.e(err);
  6629. } finally {
  6630. _iterator5.f();
  6631. }
  6632. if (rangeRef) {
  6633. rangeRef.unref();
  6634. }
  6635. });
  6636. },
  6637. /**
  6638. * Wrap the nodes at a location in a new container node, splitting the edges
  6639. * of the range first to ensure that only the content in the range is wrapped.
  6640. */
  6641. wrapNodes: function wrapNodes(editor, element) {
  6642. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  6643. Editor.withoutNormalizing(editor, function () {
  6644. var _options$mode9 = options.mode,
  6645. mode = _options$mode9 === void 0 ? 'lowest' : _options$mode9,
  6646. _options$split3 = options.split,
  6647. split = _options$split3 === void 0 ? false : _options$split3,
  6648. _options$voids9 = options.voids,
  6649. voids = _options$voids9 === void 0 ? false : _options$voids9;
  6650. var match = options.match,
  6651. _options$at8 = options.at,
  6652. at = _options$at8 === void 0 ? editor.selection : _options$at8;
  6653. if (!at) {
  6654. return;
  6655. }
  6656. if (match == null) {
  6657. if (Path.isPath(at)) {
  6658. match = matchPath(editor, at);
  6659. } else if (editor.isInline(element)) {
  6660. match = function match(n) {
  6661. return Editor.isInline(editor, n) || Text.isText(n);
  6662. };
  6663. } else {
  6664. match = function match(n) {
  6665. return Editor.isBlock(editor, n);
  6666. };
  6667. }
  6668. }
  6669. if (split && Range.isRange(at)) {
  6670. var _Range$edges7 = Range.edges(at),
  6671. _Range$edges8 = _slicedToArray(_Range$edges7, 2),
  6672. start = _Range$edges8[0],
  6673. end = _Range$edges8[1];
  6674. var rangeRef = Editor.rangeRef(editor, at, {
  6675. affinity: 'inward'
  6676. });
  6677. Transforms.splitNodes(editor, {
  6678. at: end,
  6679. match: match,
  6680. voids: voids
  6681. });
  6682. Transforms.splitNodes(editor, {
  6683. at: start,
  6684. match: match,
  6685. voids: voids
  6686. });
  6687. at = rangeRef.unref();
  6688. if (options.at == null) {
  6689. Transforms.select(editor, at);
  6690. }
  6691. }
  6692. var roots = Array.from(Editor.nodes(editor, {
  6693. at: at,
  6694. match: editor.isInline(element) ? function (n) {
  6695. return Editor.isBlock(editor, n);
  6696. } : function (n) {
  6697. return Editor.isEditor(n);
  6698. },
  6699. mode: 'lowest',
  6700. voids: voids
  6701. }));
  6702. for (var _i4 = 0, _roots = roots; _i4 < _roots.length; _i4++) {
  6703. var _roots$_i = _slicedToArray(_roots[_i4], 2),
  6704. rootPath = _roots$_i[1];
  6705. var a = Range.isRange(at) ? Range.intersection(at, Editor.range(editor, rootPath)) : at;
  6706. if (!a) {
  6707. continue;
  6708. }
  6709. var matches = Array.from(Editor.nodes(editor, {
  6710. at: a,
  6711. match: match,
  6712. mode: mode,
  6713. voids: voids
  6714. }));
  6715. if (matches.length > 0) {
  6716. var _ret = function () {
  6717. var _matches = _slicedToArray(matches, 1),
  6718. first = _matches[0];
  6719. var last = matches[matches.length - 1];
  6720. var _first = _slicedToArray(first, 2),
  6721. firstPath = _first[1];
  6722. var _last = _slicedToArray(last, 2),
  6723. lastPath = _last[1];
  6724. if (firstPath.length === 0 && lastPath.length === 0) {
  6725. // if there's no matching parent - usually means the node is an editor - don't do anything
  6726. return "continue";
  6727. }
  6728. var commonPath = Path.equals(firstPath, lastPath) ? Path.parent(firstPath) : Path.common(firstPath, lastPath);
  6729. var range = Editor.range(editor, firstPath, lastPath);
  6730. var commonNodeEntry = Editor.node(editor, commonPath);
  6731. var _commonNodeEntry = _slicedToArray(commonNodeEntry, 1),
  6732. commonNode = _commonNodeEntry[0];
  6733. var depth = commonPath.length + 1;
  6734. var wrapperPath = Path.next(lastPath.slice(0, depth));
  6735. var wrapper = _objectSpread$2(_objectSpread$2({}, element), {}, {
  6736. children: []
  6737. });
  6738. Transforms.insertNodes(editor, wrapper, {
  6739. at: wrapperPath,
  6740. voids: voids
  6741. });
  6742. Transforms.moveNodes(editor, {
  6743. at: range,
  6744. match: function match(n) {
  6745. return Element$1.isAncestor(commonNode) && commonNode.children.includes(n);
  6746. },
  6747. to: wrapperPath.concat(0),
  6748. voids: voids
  6749. });
  6750. }();
  6751. if (_ret === "continue") continue;
  6752. }
  6753. }
  6754. });
  6755. }
  6756. };
  6757. var hasSingleChildNest = function hasSingleChildNest(editor, node) {
  6758. if (Element$1.isElement(node)) {
  6759. var element = node;
  6760. if (Editor.isVoid(editor, node)) {
  6761. return true;
  6762. } else if (element.children.length === 1) {
  6763. return hasSingleChildNest(editor, element.children[0]);
  6764. } else {
  6765. return false;
  6766. }
  6767. } else if (Editor.isEditor(node)) {
  6768. return false;
  6769. } else {
  6770. return true;
  6771. }
  6772. };
  6773. /**
  6774. * Convert a range into a point by deleting it's content.
  6775. */
  6776. var deleteRange = function deleteRange(editor, range) {
  6777. if (Range.isCollapsed(range)) {
  6778. return range.anchor;
  6779. } else {
  6780. var _Range$edges9 = Range.edges(range),
  6781. _Range$edges10 = _slicedToArray(_Range$edges9, 2),
  6782. end = _Range$edges10[1];
  6783. var pointRef = Editor.pointRef(editor, end);
  6784. Transforms["delete"](editor, {
  6785. at: range
  6786. });
  6787. return pointRef.unref();
  6788. }
  6789. };
  6790. var matchPath = function matchPath(editor, path) {
  6791. var _Editor$node5 = Editor.node(editor, path),
  6792. _Editor$node6 = _slicedToArray(_Editor$node5, 1),
  6793. node = _Editor$node6[0];
  6794. return function (n) {
  6795. return n === node;
  6796. };
  6797. };
  6798. function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  6799. function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  6800. var SelectionTransforms = {
  6801. /**
  6802. * Collapse the selection.
  6803. */
  6804. collapse: function collapse(editor) {
  6805. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6806. var _options$edge = options.edge,
  6807. edge = _options$edge === void 0 ? 'anchor' : _options$edge;
  6808. var selection = editor.selection;
  6809. if (!selection) {
  6810. return;
  6811. } else if (edge === 'anchor') {
  6812. Transforms.select(editor, selection.anchor);
  6813. } else if (edge === 'focus') {
  6814. Transforms.select(editor, selection.focus);
  6815. } else if (edge === 'start') {
  6816. var _Range$edges = Range.edges(selection),
  6817. _Range$edges2 = _slicedToArray(_Range$edges, 1),
  6818. start = _Range$edges2[0];
  6819. Transforms.select(editor, start);
  6820. } else if (edge === 'end') {
  6821. var _Range$edges3 = Range.edges(selection),
  6822. _Range$edges4 = _slicedToArray(_Range$edges3, 2),
  6823. end = _Range$edges4[1];
  6824. Transforms.select(editor, end);
  6825. }
  6826. },
  6827. /**
  6828. * Unset the selection.
  6829. */
  6830. deselect: function deselect(editor) {
  6831. var selection = editor.selection;
  6832. if (selection) {
  6833. editor.apply({
  6834. type: 'set_selection',
  6835. properties: selection,
  6836. newProperties: null
  6837. });
  6838. }
  6839. },
  6840. /**
  6841. * Move the selection's point forward or backward.
  6842. */
  6843. move: function move(editor) {
  6844. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6845. var selection = editor.selection;
  6846. var _options$distance = options.distance,
  6847. distance = _options$distance === void 0 ? 1 : _options$distance,
  6848. _options$unit = options.unit,
  6849. unit = _options$unit === void 0 ? 'character' : _options$unit,
  6850. _options$reverse = options.reverse,
  6851. reverse = _options$reverse === void 0 ? false : _options$reverse;
  6852. var _options$edge2 = options.edge,
  6853. edge = _options$edge2 === void 0 ? null : _options$edge2;
  6854. if (!selection) {
  6855. return;
  6856. }
  6857. if (edge === 'start') {
  6858. edge = Range.isBackward(selection) ? 'focus' : 'anchor';
  6859. }
  6860. if (edge === 'end') {
  6861. edge = Range.isBackward(selection) ? 'anchor' : 'focus';
  6862. }
  6863. var anchor = selection.anchor,
  6864. focus = selection.focus;
  6865. var opts = {
  6866. distance: distance,
  6867. unit: unit
  6868. };
  6869. var props = {};
  6870. if (edge == null || edge === 'anchor') {
  6871. var point = reverse ? Editor.before(editor, anchor, opts) : Editor.after(editor, anchor, opts);
  6872. if (point) {
  6873. props.anchor = point;
  6874. }
  6875. }
  6876. if (edge == null || edge === 'focus') {
  6877. var _point = reverse ? Editor.before(editor, focus, opts) : Editor.after(editor, focus, opts);
  6878. if (_point) {
  6879. props.focus = _point;
  6880. }
  6881. }
  6882. Transforms.setSelection(editor, props);
  6883. },
  6884. /**
  6885. * Set the selection to a new value.
  6886. */
  6887. select: function select(editor, target) {
  6888. var selection = editor.selection;
  6889. target = Editor.range(editor, target);
  6890. if (selection) {
  6891. Transforms.setSelection(editor, target);
  6892. return;
  6893. }
  6894. if (!Range.isRange(target)) {
  6895. throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(JSON.stringify(target)));
  6896. }
  6897. editor.apply({
  6898. type: 'set_selection',
  6899. properties: selection,
  6900. newProperties: target
  6901. });
  6902. },
  6903. /**
  6904. * Set new properties on one of the selection's points.
  6905. */
  6906. setPoint: function setPoint(editor, props) {
  6907. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  6908. var selection = editor.selection;
  6909. var _options$edge3 = options.edge,
  6910. edge = _options$edge3 === void 0 ? 'both' : _options$edge3;
  6911. if (!selection) {
  6912. return;
  6913. }
  6914. if (edge === 'start') {
  6915. edge = Range.isBackward(selection) ? 'focus' : 'anchor';
  6916. }
  6917. if (edge === 'end') {
  6918. edge = Range.isBackward(selection) ? 'anchor' : 'focus';
  6919. }
  6920. var anchor = selection.anchor,
  6921. focus = selection.focus;
  6922. var point = edge === 'anchor' ? anchor : focus;
  6923. Transforms.setSelection(editor, _defineProperty({}, edge === 'anchor' ? 'anchor' : 'focus', _objectSpread$1(_objectSpread$1({}, point), props)));
  6924. },
  6925. /**
  6926. * Set new properties on the selection.
  6927. */
  6928. setSelection: function setSelection(editor, props) {
  6929. var selection = editor.selection;
  6930. var oldProps = {};
  6931. var newProps = {};
  6932. if (!selection) {
  6933. return;
  6934. }
  6935. for (var k in props) {
  6936. if (k === 'anchor' && props.anchor != null && !Point.equals(props.anchor, selection.anchor) || k === 'focus' && props.focus != null && !Point.equals(props.focus, selection.focus) || k !== 'anchor' && k !== 'focus' && props[k] !== selection[k]) {
  6937. oldProps[k] = selection[k];
  6938. newProps[k] = props[k];
  6939. }
  6940. }
  6941. if (Object.keys(oldProps).length > 0) {
  6942. editor.apply({
  6943. type: 'set_selection',
  6944. properties: oldProps,
  6945. newProperties: newProps
  6946. });
  6947. }
  6948. }
  6949. };
  6950. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  6951. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  6952. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  6953. var TextTransforms = {
  6954. /**
  6955. * Delete content in the editor.
  6956. */
  6957. "delete": function _delete(editor) {
  6958. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6959. Editor.withoutNormalizing(editor, function () {
  6960. var _options$reverse = options.reverse,
  6961. reverse = _options$reverse === void 0 ? false : _options$reverse,
  6962. _options$unit = options.unit,
  6963. unit = _options$unit === void 0 ? 'character' : _options$unit,
  6964. _options$distance = options.distance,
  6965. distance = _options$distance === void 0 ? 1 : _options$distance,
  6966. _options$voids = options.voids,
  6967. voids = _options$voids === void 0 ? false : _options$voids;
  6968. var _options$at = options.at,
  6969. at = _options$at === void 0 ? editor.selection : _options$at,
  6970. _options$hanging = options.hanging,
  6971. hanging = _options$hanging === void 0 ? false : _options$hanging;
  6972. if (!at) {
  6973. return;
  6974. }
  6975. if (Range.isRange(at) && Range.isCollapsed(at)) {
  6976. at = at.anchor;
  6977. }
  6978. if (Point.isPoint(at)) {
  6979. var furthestVoid = Editor["void"](editor, {
  6980. at: at,
  6981. mode: 'highest'
  6982. });
  6983. if (!voids && furthestVoid) {
  6984. var _furthestVoid = _slicedToArray(furthestVoid, 2),
  6985. voidPath = _furthestVoid[1];
  6986. at = voidPath;
  6987. } else {
  6988. var opts = {
  6989. unit: unit,
  6990. distance: distance
  6991. };
  6992. var target = reverse ? Editor.before(editor, at, opts) || Editor.start(editor, []) : Editor.after(editor, at, opts) || Editor.end(editor, []);
  6993. at = {
  6994. anchor: at,
  6995. focus: target
  6996. };
  6997. hanging = true;
  6998. }
  6999. }
  7000. if (Path.isPath(at)) {
  7001. Transforms.removeNodes(editor, {
  7002. at: at,
  7003. voids: voids
  7004. });
  7005. return;
  7006. }
  7007. if (Range.isCollapsed(at)) {
  7008. return;
  7009. }
  7010. if (!hanging) {
  7011. var _Range$edges = Range.edges(at),
  7012. _Range$edges2 = _slicedToArray(_Range$edges, 2),
  7013. _end = _Range$edges2[1];
  7014. var endOfDoc = Editor.end(editor, []);
  7015. if (!Point.equals(_end, endOfDoc)) {
  7016. at = Editor.unhangRange(editor, at, {
  7017. voids: voids
  7018. });
  7019. }
  7020. }
  7021. var _Range$edges3 = Range.edges(at),
  7022. _Range$edges4 = _slicedToArray(_Range$edges3, 2),
  7023. start = _Range$edges4[0],
  7024. end = _Range$edges4[1];
  7025. var startBlock = Editor.above(editor, {
  7026. match: function match(n) {
  7027. return Editor.isBlock(editor, n);
  7028. },
  7029. at: start,
  7030. voids: voids
  7031. });
  7032. var endBlock = Editor.above(editor, {
  7033. match: function match(n) {
  7034. return Editor.isBlock(editor, n);
  7035. },
  7036. at: end,
  7037. voids: voids
  7038. });
  7039. var isAcrossBlocks = startBlock && endBlock && !Path.equals(startBlock[1], endBlock[1]);
  7040. var isSingleText = Path.equals(start.path, end.path);
  7041. var startVoid = voids ? null : Editor["void"](editor, {
  7042. at: start,
  7043. mode: 'highest'
  7044. });
  7045. var endVoid = voids ? null : Editor["void"](editor, {
  7046. at: end,
  7047. mode: 'highest'
  7048. }); // If the start or end points are inside an inline void, nudge them out.
  7049. if (startVoid) {
  7050. var before = Editor.before(editor, start);
  7051. if (before && startBlock && Path.isAncestor(startBlock[1], before.path)) {
  7052. start = before;
  7053. }
  7054. }
  7055. if (endVoid) {
  7056. var after = Editor.after(editor, end);
  7057. if (after && endBlock && Path.isAncestor(endBlock[1], after.path)) {
  7058. end = after;
  7059. }
  7060. } // Get the highest nodes that are completely inside the range, as well as
  7061. // the start and end nodes.
  7062. var matches = [];
  7063. var lastPath;
  7064. var _iterator = _createForOfIteratorHelper(Editor.nodes(editor, {
  7065. at: at,
  7066. voids: voids
  7067. })),
  7068. _step;
  7069. try {
  7070. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  7071. var entry = _step.value;
  7072. var _entry = _slicedToArray(entry, 2),
  7073. _node2 = _entry[0],
  7074. _path3 = _entry[1];
  7075. if (lastPath && Path.compare(_path3, lastPath) === 0) {
  7076. continue;
  7077. }
  7078. if (!voids && Editor.isVoid(editor, _node2) || !Path.isCommon(_path3, start.path) && !Path.isCommon(_path3, end.path)) {
  7079. matches.push(entry);
  7080. lastPath = _path3;
  7081. }
  7082. }
  7083. } catch (err) {
  7084. _iterator.e(err);
  7085. } finally {
  7086. _iterator.f();
  7087. }
  7088. var pathRefs = Array.from(matches, function (_ref) {
  7089. var _ref2 = _slicedToArray(_ref, 2),
  7090. p = _ref2[1];
  7091. return Editor.pathRef(editor, p);
  7092. });
  7093. var startRef = Editor.pointRef(editor, start);
  7094. var endRef = Editor.pointRef(editor, end);
  7095. if (!isSingleText && !startVoid) {
  7096. var _point = startRef.current;
  7097. var _Editor$leaf = Editor.leaf(editor, _point),
  7098. _Editor$leaf2 = _slicedToArray(_Editor$leaf, 1),
  7099. node = _Editor$leaf2[0];
  7100. var path = _point.path;
  7101. var _start = start,
  7102. offset = _start.offset;
  7103. var text = node.text.slice(offset);
  7104. if (text.length > 0) editor.apply({
  7105. type: 'remove_text',
  7106. path: path,
  7107. offset: offset,
  7108. text: text
  7109. });
  7110. }
  7111. for (var _i = 0, _pathRefs = pathRefs; _i < _pathRefs.length; _i++) {
  7112. var pathRef = _pathRefs[_i];
  7113. var _path = pathRef.unref();
  7114. Transforms.removeNodes(editor, {
  7115. at: _path,
  7116. voids: voids
  7117. });
  7118. }
  7119. if (!endVoid) {
  7120. var _point2 = endRef.current;
  7121. var _Editor$leaf3 = Editor.leaf(editor, _point2),
  7122. _Editor$leaf4 = _slicedToArray(_Editor$leaf3, 1),
  7123. _node = _Editor$leaf4[0];
  7124. var _path2 = _point2.path;
  7125. var _offset = isSingleText ? start.offset : 0;
  7126. var _text = _node.text.slice(_offset, end.offset);
  7127. if (_text.length > 0) editor.apply({
  7128. type: 'remove_text',
  7129. path: _path2,
  7130. offset: _offset,
  7131. text: _text
  7132. });
  7133. }
  7134. if (!isSingleText && isAcrossBlocks && endRef.current && startRef.current) {
  7135. Transforms.mergeNodes(editor, {
  7136. at: endRef.current,
  7137. hanging: true,
  7138. voids: voids
  7139. });
  7140. }
  7141. var point = reverse ? startRef.unref() || endRef.unref() : endRef.unref() || startRef.unref();
  7142. if (options.at == null && point) {
  7143. Transforms.select(editor, point);
  7144. }
  7145. });
  7146. },
  7147. /**
  7148. * Insert a fragment at a specific location in the editor.
  7149. */
  7150. insertFragment: function insertFragment(editor, fragment) {
  7151. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7152. Editor.withoutNormalizing(editor, function () {
  7153. var _options$hanging2 = options.hanging,
  7154. hanging = _options$hanging2 === void 0 ? false : _options$hanging2,
  7155. _options$voids2 = options.voids,
  7156. voids = _options$voids2 === void 0 ? false : _options$voids2;
  7157. var _options$at2 = options.at,
  7158. at = _options$at2 === void 0 ? editor.selection : _options$at2;
  7159. if (!fragment.length) {
  7160. return;
  7161. }
  7162. if (!at) {
  7163. return;
  7164. } else if (Range.isRange(at)) {
  7165. if (!hanging) {
  7166. at = Editor.unhangRange(editor, at);
  7167. }
  7168. if (Range.isCollapsed(at)) {
  7169. at = at.anchor;
  7170. } else {
  7171. var _Range$edges5 = Range.edges(at),
  7172. _Range$edges6 = _slicedToArray(_Range$edges5, 2),
  7173. end = _Range$edges6[1];
  7174. if (!voids && Editor["void"](editor, {
  7175. at: end
  7176. })) {
  7177. return;
  7178. }
  7179. var pointRef = Editor.pointRef(editor, end);
  7180. Transforms["delete"](editor, {
  7181. at: at
  7182. });
  7183. at = pointRef.unref();
  7184. }
  7185. } else if (Path.isPath(at)) {
  7186. at = Editor.start(editor, at);
  7187. }
  7188. if (!voids && Editor["void"](editor, {
  7189. at: at
  7190. })) {
  7191. return;
  7192. } // If the insert point is at the edge of an inline node, move it outside
  7193. // instead since it will need to be split otherwise.
  7194. var inlineElementMatch = Editor.above(editor, {
  7195. at: at,
  7196. match: function match(n) {
  7197. return Editor.isInline(editor, n);
  7198. },
  7199. mode: 'highest',
  7200. voids: voids
  7201. });
  7202. if (inlineElementMatch) {
  7203. var _inlineElementMatch = _slicedToArray(inlineElementMatch, 2),
  7204. _inlinePath = _inlineElementMatch[1];
  7205. if (Editor.isEnd(editor, at, _inlinePath)) {
  7206. var after = Editor.after(editor, _inlinePath);
  7207. at = after;
  7208. } else if (Editor.isStart(editor, at, _inlinePath)) {
  7209. var before = Editor.before(editor, _inlinePath);
  7210. at = before;
  7211. }
  7212. }
  7213. var blockMatch = Editor.above(editor, {
  7214. match: function match(n) {
  7215. return Editor.isBlock(editor, n);
  7216. },
  7217. at: at,
  7218. voids: voids
  7219. });
  7220. var _blockMatch = _slicedToArray(blockMatch, 2),
  7221. blockPath = _blockMatch[1];
  7222. var isBlockStart = Editor.isStart(editor, at, blockPath);
  7223. var isBlockEnd = Editor.isEnd(editor, at, blockPath);
  7224. var isBlockEmpty = isBlockStart && isBlockEnd;
  7225. var mergeStart = !isBlockStart || isBlockStart && isBlockEnd;
  7226. var mergeEnd = !isBlockEnd;
  7227. var _Node$first = Node$1.first({
  7228. children: fragment
  7229. }, []),
  7230. _Node$first2 = _slicedToArray(_Node$first, 2),
  7231. firstPath = _Node$first2[1];
  7232. var _Node$last = Node$1.last({
  7233. children: fragment
  7234. }, []),
  7235. _Node$last2 = _slicedToArray(_Node$last, 2),
  7236. lastPath = _Node$last2[1];
  7237. var matches = [];
  7238. var matcher = function matcher(_ref3) {
  7239. var _ref4 = _slicedToArray(_ref3, 2),
  7240. n = _ref4[0],
  7241. p = _ref4[1];
  7242. var isRoot = p.length === 0;
  7243. if (isRoot) {
  7244. return false;
  7245. }
  7246. if (isBlockEmpty) {
  7247. return true;
  7248. }
  7249. if (mergeStart && Path.isAncestor(p, firstPath) && Element$1.isElement(n) && !editor.isVoid(n) && !editor.isInline(n)) {
  7250. return false;
  7251. }
  7252. if (mergeEnd && Path.isAncestor(p, lastPath) && Element$1.isElement(n) && !editor.isVoid(n) && !editor.isInline(n)) {
  7253. return false;
  7254. }
  7255. return true;
  7256. };
  7257. var _iterator2 = _createForOfIteratorHelper(Node$1.nodes({
  7258. children: fragment
  7259. }, {
  7260. pass: matcher
  7261. })),
  7262. _step2;
  7263. try {
  7264. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  7265. var entry = _step2.value;
  7266. if (matcher(entry)) {
  7267. matches.push(entry);
  7268. }
  7269. }
  7270. } catch (err) {
  7271. _iterator2.e(err);
  7272. } finally {
  7273. _iterator2.f();
  7274. }
  7275. var starts = [];
  7276. var middles = [];
  7277. var ends = [];
  7278. var starting = true;
  7279. var hasBlocks = false;
  7280. for (var _i2 = 0, _matches = matches; _i2 < _matches.length; _i2++) {
  7281. var _matches$_i = _slicedToArray(_matches[_i2], 1),
  7282. node = _matches$_i[0];
  7283. if (Element$1.isElement(node) && !editor.isInline(node)) {
  7284. starting = false;
  7285. hasBlocks = true;
  7286. middles.push(node);
  7287. } else if (starting) {
  7288. starts.push(node);
  7289. } else {
  7290. ends.push(node);
  7291. }
  7292. }
  7293. var _Editor$nodes = Editor.nodes(editor, {
  7294. at: at,
  7295. match: function match(n) {
  7296. return Text.isText(n) || Editor.isInline(editor, n);
  7297. },
  7298. mode: 'highest',
  7299. voids: voids
  7300. }),
  7301. _Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
  7302. inlineMatch = _Editor$nodes2[0];
  7303. var _inlineMatch = _slicedToArray(inlineMatch, 2),
  7304. inlinePath = _inlineMatch[1];
  7305. var isInlineStart = Editor.isStart(editor, at, inlinePath);
  7306. var isInlineEnd = Editor.isEnd(editor, at, inlinePath);
  7307. var middleRef = Editor.pathRef(editor, isBlockEnd ? Path.next(blockPath) : blockPath);
  7308. var endRef = Editor.pathRef(editor, isInlineEnd ? Path.next(inlinePath) : inlinePath);
  7309. var blockPathRef = Editor.pathRef(editor, blockPath);
  7310. Transforms.splitNodes(editor, {
  7311. at: at,
  7312. match: function match(n) {
  7313. return hasBlocks ? Editor.isBlock(editor, n) : Text.isText(n) || Editor.isInline(editor, n);
  7314. },
  7315. mode: hasBlocks ? 'lowest' : 'highest',
  7316. voids: voids
  7317. });
  7318. var startRef = Editor.pathRef(editor, !isInlineStart || isInlineStart && isInlineEnd ? Path.next(inlinePath) : inlinePath);
  7319. Transforms.insertNodes(editor, starts, {
  7320. at: startRef.current,
  7321. match: function match(n) {
  7322. return Text.isText(n) || Editor.isInline(editor, n);
  7323. },
  7324. mode: 'highest',
  7325. voids: voids
  7326. });
  7327. if (isBlockEmpty && middles.length) {
  7328. Transforms["delete"](editor, {
  7329. at: blockPathRef.unref(),
  7330. voids: voids
  7331. });
  7332. }
  7333. Transforms.insertNodes(editor, middles, {
  7334. at: middleRef.current,
  7335. match: function match(n) {
  7336. return Editor.isBlock(editor, n);
  7337. },
  7338. mode: 'lowest',
  7339. voids: voids
  7340. });
  7341. Transforms.insertNodes(editor, ends, {
  7342. at: endRef.current,
  7343. match: function match(n) {
  7344. return Text.isText(n) || Editor.isInline(editor, n);
  7345. },
  7346. mode: 'highest',
  7347. voids: voids
  7348. });
  7349. if (!options.at) {
  7350. var path;
  7351. if (ends.length > 0) {
  7352. path = Path.previous(endRef.current);
  7353. } else if (middles.length > 0) {
  7354. path = Path.previous(middleRef.current);
  7355. } else {
  7356. path = Path.previous(startRef.current);
  7357. }
  7358. var _end2 = Editor.end(editor, path);
  7359. Transforms.select(editor, _end2);
  7360. }
  7361. startRef.unref();
  7362. middleRef.unref();
  7363. endRef.unref();
  7364. });
  7365. },
  7366. /**
  7367. * Insert a string of text in the Editor.
  7368. */
  7369. insertText: function insertText(editor, text) {
  7370. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  7371. Editor.withoutNormalizing(editor, function () {
  7372. var _options$voids3 = options.voids,
  7373. voids = _options$voids3 === void 0 ? false : _options$voids3;
  7374. var _options$at3 = options.at,
  7375. at = _options$at3 === void 0 ? editor.selection : _options$at3;
  7376. if (!at) {
  7377. return;
  7378. }
  7379. if (Path.isPath(at)) {
  7380. at = Editor.range(editor, at);
  7381. }
  7382. if (Range.isRange(at)) {
  7383. if (Range.isCollapsed(at)) {
  7384. at = at.anchor;
  7385. } else {
  7386. var end = Range.end(at);
  7387. if (!voids && Editor["void"](editor, {
  7388. at: end
  7389. })) {
  7390. return;
  7391. }
  7392. var pointRef = Editor.pointRef(editor, end);
  7393. Transforms["delete"](editor, {
  7394. at: at,
  7395. voids: voids
  7396. });
  7397. at = pointRef.unref();
  7398. Transforms.setSelection(editor, {
  7399. anchor: at,
  7400. focus: at
  7401. });
  7402. }
  7403. }
  7404. if (!voids && Editor["void"](editor, {
  7405. at: at
  7406. })) {
  7407. return;
  7408. }
  7409. var _at = at,
  7410. path = _at.path,
  7411. offset = _at.offset;
  7412. if (text.length > 0) editor.apply({
  7413. type: 'insert_text',
  7414. path: path,
  7415. offset: offset,
  7416. text: text
  7417. });
  7418. });
  7419. }
  7420. };
  7421. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  7422. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  7423. var Transforms = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, GeneralTransforms), NodeTransforms), SelectionTransforms), TextTransforms);
  7424. var Editor_1 = Editor;
  7425. var Element_1 = Element$1;
  7426. var Location_1 = Location;
  7427. var Node_1 = Node$1;
  7428. var Operation_1 = Operation;
  7429. var Path_1 = Path;
  7430. var PathRef_1 = PathRef;
  7431. var Point_1 = Point;
  7432. var PointRef_1 = PointRef;
  7433. var Range_1 = Range;
  7434. var RangeRef_1 = RangeRef;
  7435. var Span_1 = Span;
  7436. var Text_1 = Text;
  7437. var Transforms_1 = Transforms;
  7438. var createEditor_1 = createEditor$1;
  7439. var dist$7 = /*#__PURE__*/Object.defineProperty({
  7440. Editor: Editor_1,
  7441. Element: Element_1,
  7442. Location: Location_1,
  7443. Node: Node_1,
  7444. Operation: Operation_1,
  7445. Path: Path_1,
  7446. PathRef: PathRef_1,
  7447. Point: Point_1,
  7448. PointRef: PointRef_1,
  7449. Range: Range_1,
  7450. RangeRef: RangeRef_1,
  7451. Span: Span_1,
  7452. Text: Text_1,
  7453. Transforms: Transforms_1,
  7454. createEditor: createEditor_1
  7455. }, '__esModule', {value: true});
  7456. /**
  7457. * lodash (Custom Build) <https://lodash.com/>
  7458. * Build: `lodash modularize exports="npm" -o ./`
  7459. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  7460. * Released under MIT license <https://lodash.com/license>
  7461. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  7462. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  7463. */
  7464. /** Used as references for various `Number` constants. */
  7465. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  7466. /** `Object#toString` result references. */
  7467. var argsTag$1 = '[object Arguments]',
  7468. funcTag$1 = '[object Function]',
  7469. genTag$1 = '[object GeneratorFunction]',
  7470. mapTag = '[object Map]',
  7471. objectTag = '[object Object]',
  7472. promiseTag = '[object Promise]',
  7473. setTag = '[object Set]',
  7474. stringTag = '[object String]',
  7475. weakMapTag = '[object WeakMap]';
  7476. var dataViewTag = '[object DataView]';
  7477. /**
  7478. * Used to match `RegExp`
  7479. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  7480. */
  7481. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  7482. /** Used to detect host constructors (Safari). */
  7483. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  7484. /** Used to detect unsigned integer values. */
  7485. var reIsUint$1 = /^(?:0|[1-9]\d*)$/;
  7486. /** Used to compose unicode character classes. */
  7487. var rsAstralRange$1 = '\\ud800-\\udfff',
  7488. rsComboMarksRange$1 = '\\u0300-\\u036f\\ufe20-\\ufe23',
  7489. rsComboSymbolsRange$1 = '\\u20d0-\\u20f0',
  7490. rsVarRange$1 = '\\ufe0e\\ufe0f';
  7491. /** Used to compose unicode capture groups. */
  7492. var rsAstral$1 = '[' + rsAstralRange$1 + ']',
  7493. rsCombo$1 = '[' + rsComboMarksRange$1 + rsComboSymbolsRange$1 + ']',
  7494. rsFitz$1 = '\\ud83c[\\udffb-\\udfff]',
  7495. rsModifier$1 = '(?:' + rsCombo$1 + '|' + rsFitz$1 + ')',
  7496. rsNonAstral$1 = '[^' + rsAstralRange$1 + ']',
  7497. rsRegional$1 = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  7498. rsSurrPair$1 = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  7499. rsZWJ$1 = '\\u200d';
  7500. /** Used to compose unicode regexes. */
  7501. var reOptMod$1 = rsModifier$1 + '?',
  7502. rsOptVar$1 = '[' + rsVarRange$1 + ']?',
  7503. rsOptJoin$1 = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsOptVar$1 + reOptMod$1 + ')*',
  7504. rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1,
  7505. rsSymbol$1 = '(?:' + [rsNonAstral$1 + rsCombo$1 + '?', rsCombo$1, rsRegional$1, rsSurrPair$1, rsAstral$1].join('|') + ')';
  7506. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  7507. var reUnicode$1 = RegExp(rsFitz$1 + '(?=' + rsFitz$1 + ')|' + rsSymbol$1 + rsSeq$1, 'g');
  7508. /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
  7509. var reHasUnicode$1 = RegExp('[' + rsZWJ$1 + rsAstralRange$1 + rsComboMarksRange$1 + rsComboSymbolsRange$1 + rsVarRange$1 + ']');
  7510. /** Detect free variable `global` from Node.js. */
  7511. var freeGlobal$3 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  7512. /** Detect free variable `self`. */
  7513. var freeSelf$3 = typeof self == 'object' && self && self.Object === Object && self;
  7514. /** Used as a reference to the global object. */
  7515. var root$3 = freeGlobal$3 || freeSelf$3 || Function('return this')();
  7516. /**
  7517. * A specialized version of `_.map` for arrays without support for iteratee
  7518. * shorthands.
  7519. *
  7520. * @private
  7521. * @param {Array} [array] The array to iterate over.
  7522. * @param {Function} iteratee The function invoked per iteration.
  7523. * @returns {Array} Returns the new mapped array.
  7524. */
  7525. function arrayMap(array, iteratee) {
  7526. var index = -1,
  7527. length = array ? array.length : 0,
  7528. result = Array(length);
  7529. while (++index < length) {
  7530. result[index] = iteratee(array[index], index, array);
  7531. }
  7532. return result;
  7533. }
  7534. /**
  7535. * Converts an ASCII `string` to an array.
  7536. *
  7537. * @private
  7538. * @param {string} string The string to convert.
  7539. * @returns {Array} Returns the converted array.
  7540. */
  7541. function asciiToArray$1(string) {
  7542. return string.split('');
  7543. }
  7544. /**
  7545. * The base implementation of `_.times` without support for iteratee shorthands
  7546. * or max array length checks.
  7547. *
  7548. * @private
  7549. * @param {number} n The number of times to invoke `iteratee`.
  7550. * @param {Function} iteratee The function invoked per iteration.
  7551. * @returns {Array} Returns the array of results.
  7552. */
  7553. function baseTimes$1(n, iteratee) {
  7554. var index = -1,
  7555. result = Array(n);
  7556. while (++index < n) {
  7557. result[index] = iteratee(index);
  7558. }
  7559. return result;
  7560. }
  7561. /**
  7562. * The base implementation of `_.values` and `_.valuesIn` which creates an
  7563. * array of `object` property values corresponding to the property names
  7564. * of `props`.
  7565. *
  7566. * @private
  7567. * @param {Object} object The object to query.
  7568. * @param {Array} props The property names to get values for.
  7569. * @returns {Object} Returns the array of property values.
  7570. */
  7571. function baseValues(object, props) {
  7572. return arrayMap(props, function(key) {
  7573. return object[key];
  7574. });
  7575. }
  7576. /**
  7577. * Gets the value at `key` of `object`.
  7578. *
  7579. * @private
  7580. * @param {Object} [object] The object to query.
  7581. * @param {string} key The key of the property to get.
  7582. * @returns {*} Returns the property value.
  7583. */
  7584. function getValue(object, key) {
  7585. return object == null ? undefined : object[key];
  7586. }
  7587. /**
  7588. * Checks if `string` contains Unicode symbols.
  7589. *
  7590. * @private
  7591. * @param {string} string The string to inspect.
  7592. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  7593. */
  7594. function hasUnicode$1(string) {
  7595. return reHasUnicode$1.test(string);
  7596. }
  7597. /**
  7598. * Checks if `value` is a host object in IE < 9.
  7599. *
  7600. * @private
  7601. * @param {*} value The value to check.
  7602. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  7603. */
  7604. function isHostObject(value) {
  7605. // Many host objects are `Object` objects that can coerce to strings
  7606. // despite having improperly defined `toString` methods.
  7607. var result = false;
  7608. if (value != null && typeof value.toString != 'function') {
  7609. try {
  7610. result = !!(value + '');
  7611. } catch (e) {}
  7612. }
  7613. return result;
  7614. }
  7615. /**
  7616. * Converts `iterator` to an array.
  7617. *
  7618. * @private
  7619. * @param {Object} iterator The iterator to convert.
  7620. * @returns {Array} Returns the converted array.
  7621. */
  7622. function iteratorToArray(iterator) {
  7623. var data,
  7624. result = [];
  7625. while (!(data = iterator.next()).done) {
  7626. result.push(data.value);
  7627. }
  7628. return result;
  7629. }
  7630. /**
  7631. * Converts `map` to its key-value pairs.
  7632. *
  7633. * @private
  7634. * @param {Object} map The map to convert.
  7635. * @returns {Array} Returns the key-value pairs.
  7636. */
  7637. function mapToArray(map) {
  7638. var index = -1,
  7639. result = Array(map.size);
  7640. map.forEach(function(value, key) {
  7641. result[++index] = [key, value];
  7642. });
  7643. return result;
  7644. }
  7645. /**
  7646. * Creates a unary function that invokes `func` with its argument transformed.
  7647. *
  7648. * @private
  7649. * @param {Function} func The function to wrap.
  7650. * @param {Function} transform The argument transform.
  7651. * @returns {Function} Returns the new function.
  7652. */
  7653. function overArg$1(func, transform) {
  7654. return function(arg) {
  7655. return func(transform(arg));
  7656. };
  7657. }
  7658. /**
  7659. * Converts `set` to an array of its values.
  7660. *
  7661. * @private
  7662. * @param {Object} set The set to convert.
  7663. * @returns {Array} Returns the values.
  7664. */
  7665. function setToArray(set) {
  7666. var index = -1,
  7667. result = Array(set.size);
  7668. set.forEach(function(value) {
  7669. result[++index] = value;
  7670. });
  7671. return result;
  7672. }
  7673. /**
  7674. * Converts `string` to an array.
  7675. *
  7676. * @private
  7677. * @param {string} string The string to convert.
  7678. * @returns {Array} Returns the converted array.
  7679. */
  7680. function stringToArray$1(string) {
  7681. return hasUnicode$1(string)
  7682. ? unicodeToArray$1(string)
  7683. : asciiToArray$1(string);
  7684. }
  7685. /**
  7686. * Converts a Unicode `string` to an array.
  7687. *
  7688. * @private
  7689. * @param {string} string The string to convert.
  7690. * @returns {Array} Returns the converted array.
  7691. */
  7692. function unicodeToArray$1(string) {
  7693. return string.match(reUnicode$1) || [];
  7694. }
  7695. /** Used for built-in method references. */
  7696. var funcProto = Function.prototype,
  7697. objectProto$4 = Object.prototype;
  7698. /** Used to detect overreaching core-js shims. */
  7699. var coreJsData = root$3['__core-js_shared__'];
  7700. /** Used to detect methods masquerading as native. */
  7701. var maskSrcKey = (function() {
  7702. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  7703. return uid ? ('Symbol(src)_1.' + uid) : '';
  7704. }());
  7705. /** Used to resolve the decompiled source of functions. */
  7706. var funcToString = funcProto.toString;
  7707. /** Used to check objects for own properties. */
  7708. var hasOwnProperty$2 = objectProto$4.hasOwnProperty;
  7709. /**
  7710. * Used to resolve the
  7711. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  7712. * of values.
  7713. */
  7714. var objectToString$4 = objectProto$4.toString;
  7715. /** Used to detect if a method is native. */
  7716. var reIsNative = RegExp('^' +
  7717. funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
  7718. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  7719. );
  7720. /** Built-in value references. */
  7721. var Symbol$2 = root$3.Symbol,
  7722. iteratorSymbol = Symbol$2 ? Symbol$2.iterator : undefined,
  7723. propertyIsEnumerable$1 = objectProto$4.propertyIsEnumerable;
  7724. /* Built-in method references for those with the same name as other `lodash` methods. */
  7725. var nativeKeys$1 = overArg$1(Object.keys, Object);
  7726. /* Built-in method references that are verified to be native. */
  7727. var DataView = getNative(root$3, 'DataView'),
  7728. Map$1 = getNative(root$3, 'Map'),
  7729. Promise$1 = getNative(root$3, 'Promise'),
  7730. Set$1 = getNative(root$3, 'Set'),
  7731. WeakMap$1 = getNative(root$3, 'WeakMap');
  7732. /** Used to detect maps, sets, and weakmaps. */
  7733. var dataViewCtorString = toSource(DataView),
  7734. mapCtorString = toSource(Map$1),
  7735. promiseCtorString = toSource(Promise$1),
  7736. setCtorString = toSource(Set$1),
  7737. weakMapCtorString = toSource(WeakMap$1);
  7738. /**
  7739. * Creates an array of the enumerable property names of the array-like `value`.
  7740. *
  7741. * @private
  7742. * @param {*} value The value to query.
  7743. * @param {boolean} inherited Specify returning inherited property names.
  7744. * @returns {Array} Returns the array of property names.
  7745. */
  7746. function arrayLikeKeys$1(value, inherited) {
  7747. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  7748. // Safari 9 makes `arguments.length` enumerable in strict mode.
  7749. var result = (isArray$1(value) || isArguments$1(value))
  7750. ? baseTimes$1(value.length, String)
  7751. : [];
  7752. var length = result.length,
  7753. skipIndexes = !!length;
  7754. for (var key in value) {
  7755. if ((inherited || hasOwnProperty$2.call(value, key)) &&
  7756. !(skipIndexes && (key == 'length' || isIndex$1(key, length)))) {
  7757. result.push(key);
  7758. }
  7759. }
  7760. return result;
  7761. }
  7762. /**
  7763. * The base implementation of `getTag`.
  7764. *
  7765. * @private
  7766. * @param {*} value The value to query.
  7767. * @returns {string} Returns the `toStringTag`.
  7768. */
  7769. function baseGetTag(value) {
  7770. return objectToString$4.call(value);
  7771. }
  7772. /**
  7773. * The base implementation of `_.isNative` without bad shim checks.
  7774. *
  7775. * @private
  7776. * @param {*} value The value to check.
  7777. * @returns {boolean} Returns `true` if `value` is a native function,
  7778. * else `false`.
  7779. */
  7780. function baseIsNative(value) {
  7781. if (!isObject$3(value) || isMasked(value)) {
  7782. return false;
  7783. }
  7784. var pattern = (isFunction$1(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  7785. return pattern.test(toSource(value));
  7786. }
  7787. /**
  7788. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  7789. *
  7790. * @private
  7791. * @param {Object} object The object to query.
  7792. * @returns {Array} Returns the array of property names.
  7793. */
  7794. function baseKeys$1(object) {
  7795. if (!isPrototype$1(object)) {
  7796. return nativeKeys$1(object);
  7797. }
  7798. var result = [];
  7799. for (var key in Object(object)) {
  7800. if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
  7801. result.push(key);
  7802. }
  7803. }
  7804. return result;
  7805. }
  7806. /**
  7807. * Copies the values of `source` to `array`.
  7808. *
  7809. * @private
  7810. * @param {Array} source The array to copy values from.
  7811. * @param {Array} [array=[]] The array to copy values to.
  7812. * @returns {Array} Returns `array`.
  7813. */
  7814. function copyArray(source, array) {
  7815. var index = -1,
  7816. length = source.length;
  7817. array || (array = Array(length));
  7818. while (++index < length) {
  7819. array[index] = source[index];
  7820. }
  7821. return array;
  7822. }
  7823. /**
  7824. * Gets the native function at `key` of `object`.
  7825. *
  7826. * @private
  7827. * @param {Object} object The object to query.
  7828. * @param {string} key The key of the method to get.
  7829. * @returns {*} Returns the function if it's native, else `undefined`.
  7830. */
  7831. function getNative(object, key) {
  7832. var value = getValue(object, key);
  7833. return baseIsNative(value) ? value : undefined;
  7834. }
  7835. /**
  7836. * Gets the `toStringTag` of `value`.
  7837. *
  7838. * @private
  7839. * @param {*} value The value to query.
  7840. * @returns {string} Returns the `toStringTag`.
  7841. */
  7842. var getTag = baseGetTag;
  7843. // Fallback for data views, maps, sets, and weak maps in IE 11,
  7844. // for data views in Edge < 14, and promises in Node.js.
  7845. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  7846. (Map$1 && getTag(new Map$1) != mapTag) ||
  7847. (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
  7848. (Set$1 && getTag(new Set$1) != setTag) ||
  7849. (WeakMap$1 && getTag(new WeakMap$1) != weakMapTag)) {
  7850. getTag = function(value) {
  7851. var result = objectToString$4.call(value),
  7852. Ctor = result == objectTag ? value.constructor : undefined,
  7853. ctorString = Ctor ? toSource(Ctor) : undefined;
  7854. if (ctorString) {
  7855. switch (ctorString) {
  7856. case dataViewCtorString: return dataViewTag;
  7857. case mapCtorString: return mapTag;
  7858. case promiseCtorString: return promiseTag;
  7859. case setCtorString: return setTag;
  7860. case weakMapCtorString: return weakMapTag;
  7861. }
  7862. }
  7863. return result;
  7864. };
  7865. }
  7866. /**
  7867. * Checks if `value` is a valid array-like index.
  7868. *
  7869. * @private
  7870. * @param {*} value The value to check.
  7871. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  7872. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  7873. */
  7874. function isIndex$1(value, length) {
  7875. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  7876. return !!length &&
  7877. (typeof value == 'number' || reIsUint$1.test(value)) &&
  7878. (value > -1 && value % 1 == 0 && value < length);
  7879. }
  7880. /**
  7881. * Checks if `func` has its source masked.
  7882. *
  7883. * @private
  7884. * @param {Function} func The function to check.
  7885. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  7886. */
  7887. function isMasked(func) {
  7888. return !!maskSrcKey && (maskSrcKey in func);
  7889. }
  7890. /**
  7891. * Checks if `value` is likely a prototype object.
  7892. *
  7893. * @private
  7894. * @param {*} value The value to check.
  7895. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  7896. */
  7897. function isPrototype$1(value) {
  7898. var Ctor = value && value.constructor,
  7899. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$4;
  7900. return value === proto;
  7901. }
  7902. /**
  7903. * Converts `func` to its source code.
  7904. *
  7905. * @private
  7906. * @param {Function} func The function to process.
  7907. * @returns {string} Returns the source code.
  7908. */
  7909. function toSource(func) {
  7910. if (func != null) {
  7911. try {
  7912. return funcToString.call(func);
  7913. } catch (e) {}
  7914. try {
  7915. return (func + '');
  7916. } catch (e) {}
  7917. }
  7918. return '';
  7919. }
  7920. /**
  7921. * Checks if `value` is likely an `arguments` object.
  7922. *
  7923. * @static
  7924. * @memberOf _
  7925. * @since 0.1.0
  7926. * @category Lang
  7927. * @param {*} value The value to check.
  7928. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  7929. * else `false`.
  7930. * @example
  7931. *
  7932. * _.isArguments(function() { return arguments; }());
  7933. * // => true
  7934. *
  7935. * _.isArguments([1, 2, 3]);
  7936. * // => false
  7937. */
  7938. function isArguments$1(value) {
  7939. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  7940. return isArrayLikeObject$1(value) && hasOwnProperty$2.call(value, 'callee') &&
  7941. (!propertyIsEnumerable$1.call(value, 'callee') || objectToString$4.call(value) == argsTag$1);
  7942. }
  7943. /**
  7944. * Checks if `value` is classified as an `Array` object.
  7945. *
  7946. * @static
  7947. * @memberOf _
  7948. * @since 0.1.0
  7949. * @category Lang
  7950. * @param {*} value The value to check.
  7951. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  7952. * @example
  7953. *
  7954. * _.isArray([1, 2, 3]);
  7955. * // => true
  7956. *
  7957. * _.isArray(document.body.children);
  7958. * // => false
  7959. *
  7960. * _.isArray('abc');
  7961. * // => false
  7962. *
  7963. * _.isArray(_.noop);
  7964. * // => false
  7965. */
  7966. var isArray$1 = Array.isArray;
  7967. /**
  7968. * Checks if `value` is array-like. A value is considered array-like if it's
  7969. * not a function and has a `value.length` that's an integer greater than or
  7970. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  7971. *
  7972. * @static
  7973. * @memberOf _
  7974. * @since 4.0.0
  7975. * @category Lang
  7976. * @param {*} value The value to check.
  7977. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  7978. * @example
  7979. *
  7980. * _.isArrayLike([1, 2, 3]);
  7981. * // => true
  7982. *
  7983. * _.isArrayLike(document.body.children);
  7984. * // => true
  7985. *
  7986. * _.isArrayLike('abc');
  7987. * // => true
  7988. *
  7989. * _.isArrayLike(_.noop);
  7990. * // => false
  7991. */
  7992. function isArrayLike$1(value) {
  7993. return value != null && isLength$1(value.length) && !isFunction$1(value);
  7994. }
  7995. /**
  7996. * This method is like `_.isArrayLike` except that it also checks if `value`
  7997. * is an object.
  7998. *
  7999. * @static
  8000. * @memberOf _
  8001. * @since 4.0.0
  8002. * @category Lang
  8003. * @param {*} value The value to check.
  8004. * @returns {boolean} Returns `true` if `value` is an array-like object,
  8005. * else `false`.
  8006. * @example
  8007. *
  8008. * _.isArrayLikeObject([1, 2, 3]);
  8009. * // => true
  8010. *
  8011. * _.isArrayLikeObject(document.body.children);
  8012. * // => true
  8013. *
  8014. * _.isArrayLikeObject('abc');
  8015. * // => false
  8016. *
  8017. * _.isArrayLikeObject(_.noop);
  8018. * // => false
  8019. */
  8020. function isArrayLikeObject$1(value) {
  8021. return isObjectLike$4(value) && isArrayLike$1(value);
  8022. }
  8023. /**
  8024. * Checks if `value` is classified as a `Function` object.
  8025. *
  8026. * @static
  8027. * @memberOf _
  8028. * @since 0.1.0
  8029. * @category Lang
  8030. * @param {*} value The value to check.
  8031. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  8032. * @example
  8033. *
  8034. * _.isFunction(_);
  8035. * // => true
  8036. *
  8037. * _.isFunction(/abc/);
  8038. * // => false
  8039. */
  8040. function isFunction$1(value) {
  8041. // The use of `Object#toString` avoids issues with the `typeof` operator
  8042. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  8043. var tag = isObject$3(value) ? objectToString$4.call(value) : '';
  8044. return tag == funcTag$1 || tag == genTag$1;
  8045. }
  8046. /**
  8047. * Checks if `value` is a valid array-like length.
  8048. *
  8049. * **Note:** This method is loosely based on
  8050. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  8051. *
  8052. * @static
  8053. * @memberOf _
  8054. * @since 4.0.0
  8055. * @category Lang
  8056. * @param {*} value The value to check.
  8057. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  8058. * @example
  8059. *
  8060. * _.isLength(3);
  8061. * // => true
  8062. *
  8063. * _.isLength(Number.MIN_VALUE);
  8064. * // => false
  8065. *
  8066. * _.isLength(Infinity);
  8067. * // => false
  8068. *
  8069. * _.isLength('3');
  8070. * // => false
  8071. */
  8072. function isLength$1(value) {
  8073. return typeof value == 'number' &&
  8074. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
  8075. }
  8076. /**
  8077. * Checks if `value` is the
  8078. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  8079. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  8080. *
  8081. * @static
  8082. * @memberOf _
  8083. * @since 0.1.0
  8084. * @category Lang
  8085. * @param {*} value The value to check.
  8086. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  8087. * @example
  8088. *
  8089. * _.isObject({});
  8090. * // => true
  8091. *
  8092. * _.isObject([1, 2, 3]);
  8093. * // => true
  8094. *
  8095. * _.isObject(_.noop);
  8096. * // => true
  8097. *
  8098. * _.isObject(null);
  8099. * // => false
  8100. */
  8101. function isObject$3(value) {
  8102. var type = typeof value;
  8103. return !!value && (type == 'object' || type == 'function');
  8104. }
  8105. /**
  8106. * Checks if `value` is object-like. A value is object-like if it's not `null`
  8107. * and has a `typeof` result of "object".
  8108. *
  8109. * @static
  8110. * @memberOf _
  8111. * @since 4.0.0
  8112. * @category Lang
  8113. * @param {*} value The value to check.
  8114. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  8115. * @example
  8116. *
  8117. * _.isObjectLike({});
  8118. * // => true
  8119. *
  8120. * _.isObjectLike([1, 2, 3]);
  8121. * // => true
  8122. *
  8123. * _.isObjectLike(_.noop);
  8124. * // => false
  8125. *
  8126. * _.isObjectLike(null);
  8127. * // => false
  8128. */
  8129. function isObjectLike$4(value) {
  8130. return !!value && typeof value == 'object';
  8131. }
  8132. /**
  8133. * Checks if `value` is classified as a `String` primitive or object.
  8134. *
  8135. * @static
  8136. * @since 0.1.0
  8137. * @memberOf _
  8138. * @category Lang
  8139. * @param {*} value The value to check.
  8140. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  8141. * @example
  8142. *
  8143. * _.isString('abc');
  8144. * // => true
  8145. *
  8146. * _.isString(1);
  8147. * // => false
  8148. */
  8149. function isString(value) {
  8150. return typeof value == 'string' ||
  8151. (!isArray$1(value) && isObjectLike$4(value) && objectToString$4.call(value) == stringTag);
  8152. }
  8153. /**
  8154. * Converts `value` to an array.
  8155. *
  8156. * @static
  8157. * @since 0.1.0
  8158. * @memberOf _
  8159. * @category Lang
  8160. * @param {*} value The value to convert.
  8161. * @returns {Array} Returns the converted array.
  8162. * @example
  8163. *
  8164. * _.toArray({ 'a': 1, 'b': 2 });
  8165. * // => [1, 2]
  8166. *
  8167. * _.toArray('abc');
  8168. * // => ['a', 'b', 'c']
  8169. *
  8170. * _.toArray(1);
  8171. * // => []
  8172. *
  8173. * _.toArray(null);
  8174. * // => []
  8175. */
  8176. function toArray(value) {
  8177. if (!value) {
  8178. return [];
  8179. }
  8180. if (isArrayLike$1(value)) {
  8181. return isString(value) ? stringToArray$1(value) : copyArray(value);
  8182. }
  8183. if (iteratorSymbol && value[iteratorSymbol]) {
  8184. return iteratorToArray(value[iteratorSymbol]());
  8185. }
  8186. var tag = getTag(value),
  8187. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  8188. return func(value);
  8189. }
  8190. /**
  8191. * Creates an array of the own enumerable property names of `object`.
  8192. *
  8193. * **Note:** Non-object values are coerced to objects. See the
  8194. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  8195. * for more details.
  8196. *
  8197. * @static
  8198. * @since 0.1.0
  8199. * @memberOf _
  8200. * @category Object
  8201. * @param {Object} object The object to query.
  8202. * @returns {Array} Returns the array of property names.
  8203. * @example
  8204. *
  8205. * function Foo() {
  8206. * this.a = 1;
  8207. * this.b = 2;
  8208. * }
  8209. *
  8210. * Foo.prototype.c = 3;
  8211. *
  8212. * _.keys(new Foo);
  8213. * // => ['a', 'b'] (iteration order is not guaranteed)
  8214. *
  8215. * _.keys('hi');
  8216. * // => ['0', '1']
  8217. */
  8218. function keys$1(object) {
  8219. return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys$1(object);
  8220. }
  8221. /**
  8222. * Creates an array of the own enumerable string keyed property values of `object`.
  8223. *
  8224. * **Note:** Non-object values are coerced to objects.
  8225. *
  8226. * @static
  8227. * @since 0.1.0
  8228. * @memberOf _
  8229. * @category Object
  8230. * @param {Object} object The object to query.
  8231. * @returns {Array} Returns the array of property values.
  8232. * @example
  8233. *
  8234. * function Foo() {
  8235. * this.a = 1;
  8236. * this.b = 2;
  8237. * }
  8238. *
  8239. * Foo.prototype.c = 3;
  8240. *
  8241. * _.values(new Foo);
  8242. * // => [1, 2] (iteration order is not guaranteed)
  8243. *
  8244. * _.values('hi');
  8245. * // => ['h', 'i']
  8246. */
  8247. function values(object) {
  8248. return object ? baseValues(object, keys$1(object)) : [];
  8249. }
  8250. var lodash_toarray = toArray;
  8251. /**
  8252. * SSR Window 3.0.0
  8253. * Better handling for window object in SSR environment
  8254. * https://github.com/nolimits4web/ssr-window
  8255. *
  8256. * Copyright 2020, Vladimir Kharlampidi
  8257. *
  8258. * Licensed under MIT
  8259. *
  8260. * Released on: November 9, 2020
  8261. */
  8262. var ssrWindow_umd = createCommonjsModule$1(function (module, exports) {
  8263. (function (global, factory) {
  8264. factory(exports) ;
  8265. }(commonjsGlobal, (function (exports) {
  8266. /* eslint-disable no-param-reassign */
  8267. function isObject(obj) {
  8268. return (obj !== null &&
  8269. typeof obj === 'object' &&
  8270. 'constructor' in obj &&
  8271. obj.constructor === Object);
  8272. }
  8273. function extend(target, src) {
  8274. if (target === void 0) { target = {}; }
  8275. if (src === void 0) { src = {}; }
  8276. Object.keys(src).forEach(function (key) {
  8277. if (typeof target[key] === 'undefined')
  8278. target[key] = src[key];
  8279. else if (isObject(src[key]) &&
  8280. isObject(target[key]) &&
  8281. Object.keys(src[key]).length > 0) {
  8282. extend(target[key], src[key]);
  8283. }
  8284. });
  8285. }
  8286. var ssrDocument = {
  8287. body: {},
  8288. addEventListener: function () { },
  8289. removeEventListener: function () { },
  8290. activeElement: {
  8291. blur: function () { },
  8292. nodeName: '',
  8293. },
  8294. querySelector: function () {
  8295. return null;
  8296. },
  8297. querySelectorAll: function () {
  8298. return [];
  8299. },
  8300. getElementById: function () {
  8301. return null;
  8302. },
  8303. createEvent: function () {
  8304. return {
  8305. initEvent: function () { },
  8306. };
  8307. },
  8308. createElement: function () {
  8309. return {
  8310. children: [],
  8311. childNodes: [],
  8312. style: {},
  8313. setAttribute: function () { },
  8314. getElementsByTagName: function () {
  8315. return [];
  8316. },
  8317. };
  8318. },
  8319. createElementNS: function () {
  8320. return {};
  8321. },
  8322. importNode: function () {
  8323. return null;
  8324. },
  8325. location: {
  8326. hash: '',
  8327. host: '',
  8328. hostname: '',
  8329. href: '',
  8330. origin: '',
  8331. pathname: '',
  8332. protocol: '',
  8333. search: '',
  8334. },
  8335. };
  8336. function getDocument() {
  8337. var doc = typeof document !== 'undefined' ? document : {};
  8338. extend(doc, ssrDocument);
  8339. return doc;
  8340. }
  8341. var ssrWindow = {
  8342. document: ssrDocument,
  8343. navigator: {
  8344. userAgent: '',
  8345. },
  8346. location: {
  8347. hash: '',
  8348. host: '',
  8349. hostname: '',
  8350. href: '',
  8351. origin: '',
  8352. pathname: '',
  8353. protocol: '',
  8354. search: '',
  8355. },
  8356. history: {
  8357. replaceState: function () { },
  8358. pushState: function () { },
  8359. go: function () { },
  8360. back: function () { },
  8361. },
  8362. CustomEvent: function CustomEvent() {
  8363. return this;
  8364. },
  8365. addEventListener: function () { },
  8366. removeEventListener: function () { },
  8367. getComputedStyle: function () {
  8368. return {
  8369. getPropertyValue: function () {
  8370. return '';
  8371. },
  8372. };
  8373. },
  8374. Image: function () { },
  8375. Date: function () { },
  8376. screen: {},
  8377. setTimeout: function () { },
  8378. clearTimeout: function () { },
  8379. matchMedia: function () {
  8380. return {};
  8381. },
  8382. requestAnimationFrame: function (callback) {
  8383. if (typeof setTimeout === 'undefined') {
  8384. callback();
  8385. return null;
  8386. }
  8387. return setTimeout(callback, 0);
  8388. },
  8389. cancelAnimationFrame: function (id) {
  8390. if (typeof setTimeout === 'undefined') {
  8391. return;
  8392. }
  8393. clearTimeout(id);
  8394. },
  8395. };
  8396. function getWindow() {
  8397. var win = typeof window !== 'undefined' ? window : {};
  8398. extend(win, ssrWindow);
  8399. return win;
  8400. }
  8401. exports.extend = extend;
  8402. exports.getDocument = getDocument;
  8403. exports.getWindow = getWindow;
  8404. exports.ssrDocument = ssrDocument;
  8405. exports.ssrWindow = ssrWindow;
  8406. Object.defineProperty(exports, '__esModule', { value: true });
  8407. })));
  8408. });
  8409. /**
  8410. * Dom7 3.0.0
  8411. * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
  8412. * https://framework7.io/docs/dom7.html
  8413. *
  8414. * Copyright 2020, Vladimir Kharlampidi
  8415. *
  8416. * Licensed under MIT
  8417. *
  8418. * Released on: November 9, 2020
  8419. */
  8420. function _inheritsLoose(subClass, superClass) {
  8421. subClass.prototype = Object.create(superClass.prototype);
  8422. subClass.prototype.constructor = subClass;
  8423. subClass.__proto__ = superClass;
  8424. }
  8425. function _getPrototypeOf(o) {
  8426. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  8427. return o.__proto__ || Object.getPrototypeOf(o);
  8428. };
  8429. return _getPrototypeOf(o);
  8430. }
  8431. function _setPrototypeOf(o, p) {
  8432. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  8433. o.__proto__ = p;
  8434. return o;
  8435. };
  8436. return _setPrototypeOf(o, p);
  8437. }
  8438. function _isNativeReflectConstruct() {
  8439. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  8440. if (Reflect.construct.sham) return false;
  8441. if (typeof Proxy === "function") return true;
  8442. try {
  8443. Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
  8444. return true;
  8445. } catch (e) {
  8446. return false;
  8447. }
  8448. }
  8449. function _construct(Parent, args, Class) {
  8450. if (_isNativeReflectConstruct()) {
  8451. _construct = Reflect.construct;
  8452. } else {
  8453. _construct = function _construct(Parent, args, Class) {
  8454. var a = [null];
  8455. a.push.apply(a, args);
  8456. var Constructor = Function.bind.apply(Parent, a);
  8457. var instance = new Constructor();
  8458. if (Class) _setPrototypeOf(instance, Class.prototype);
  8459. return instance;
  8460. };
  8461. }
  8462. return _construct.apply(null, arguments);
  8463. }
  8464. function _isNativeFunction(fn) {
  8465. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  8466. }
  8467. function _wrapNativeSuper(Class) {
  8468. var _cache = typeof Map === "function" ? new Map() : undefined;
  8469. _wrapNativeSuper = function _wrapNativeSuper(Class) {
  8470. if (Class === null || !_isNativeFunction(Class)) return Class;
  8471. if (typeof Class !== "function") {
  8472. throw new TypeError("Super expression must either be null or a function");
  8473. }
  8474. if (typeof _cache !== "undefined") {
  8475. if (_cache.has(Class)) return _cache.get(Class);
  8476. _cache.set(Class, Wrapper);
  8477. }
  8478. function Wrapper() {
  8479. return _construct(Class, arguments, _getPrototypeOf(this).constructor);
  8480. }
  8481. Wrapper.prototype = Object.create(Class.prototype, {
  8482. constructor: {
  8483. value: Wrapper,
  8484. enumerable: false,
  8485. writable: true,
  8486. configurable: true
  8487. }
  8488. });
  8489. return _setPrototypeOf(Wrapper, Class);
  8490. };
  8491. return _wrapNativeSuper(Class);
  8492. }
  8493. function _assertThisInitialized(self) {
  8494. if (self === void 0) {
  8495. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  8496. }
  8497. return self;
  8498. }
  8499. /* eslint-disable no-proto */
  8500. function makeReactive(obj) {
  8501. var proto = obj.__proto__;
  8502. Object.defineProperty(obj, '__proto__', {
  8503. get: function get() {
  8504. return proto;
  8505. },
  8506. set: function set(value) {
  8507. proto.__proto__ = value;
  8508. }
  8509. });
  8510. }
  8511. var Dom7 = /*#__PURE__*/function (_Array) {
  8512. _inheritsLoose(Dom7, _Array);
  8513. function Dom7(items) {
  8514. var _this;
  8515. _this = _Array.call.apply(_Array, [this].concat(items)) || this;
  8516. makeReactive(_assertThisInitialized(_this));
  8517. return _this;
  8518. }
  8519. return Dom7;
  8520. }( /*#__PURE__*/_wrapNativeSuper(Array));
  8521. function arrayFlat(arr) {
  8522. if (arr === void 0) {
  8523. arr = [];
  8524. }
  8525. var res = [];
  8526. arr.forEach(function (el) {
  8527. if (Array.isArray(el)) {
  8528. res.push.apply(res, arrayFlat(el));
  8529. } else {
  8530. res.push(el);
  8531. }
  8532. });
  8533. return res;
  8534. }
  8535. function arrayFilter(arr, callback) {
  8536. return Array.prototype.filter.call(arr, callback);
  8537. }
  8538. function arrayUnique(arr) {
  8539. var uniqueArray = [];
  8540. for (var i = 0; i < arr.length; i += 1) {
  8541. if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]);
  8542. }
  8543. return uniqueArray;
  8544. }
  8545. function toCamelCase(string) {
  8546. return string.toLowerCase().replace(/-(.)/g, function (match, group) {
  8547. return group.toUpperCase();
  8548. });
  8549. }
  8550. function qsa(selector, context) {
  8551. if (typeof selector !== 'string') {
  8552. return [selector];
  8553. }
  8554. var a = [];
  8555. var res = context.querySelectorAll(selector);
  8556. for (var i = 0; i < res.length; i += 1) {
  8557. a.push(res[i]);
  8558. }
  8559. return a;
  8560. }
  8561. function $(selector, context) {
  8562. var window = ssrWindow_umd.getWindow();
  8563. var document = ssrWindow_umd.getDocument();
  8564. var arr = [];
  8565. if (!context && selector instanceof Dom7) {
  8566. return selector;
  8567. }
  8568. if (!selector) {
  8569. return new Dom7(arr);
  8570. }
  8571. if (typeof selector === 'string') {
  8572. var html = selector.trim();
  8573. if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
  8574. var toCreate = 'div';
  8575. if (html.indexOf('<li') === 0) toCreate = 'ul';
  8576. if (html.indexOf('<tr') === 0) toCreate = 'tbody';
  8577. if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
  8578. if (html.indexOf('<tbody') === 0) toCreate = 'table';
  8579. if (html.indexOf('<option') === 0) toCreate = 'select';
  8580. var tempParent = document.createElement(toCreate);
  8581. tempParent.innerHTML = html;
  8582. for (var i = 0; i < tempParent.childNodes.length; i += 1) {
  8583. arr.push(tempParent.childNodes[i]);
  8584. }
  8585. } else {
  8586. arr = qsa(selector.trim(), context || document);
  8587. } // arr = qsa(selector, document);
  8588. } else if (selector.nodeType || selector === window || selector === document) {
  8589. arr.push(selector);
  8590. } else if (Array.isArray(selector)) {
  8591. if (selector instanceof Dom7) return selector;
  8592. arr = selector;
  8593. }
  8594. return new Dom7(arrayUnique(arr));
  8595. }
  8596. $.fn = Dom7.prototype;
  8597. function addClass() {
  8598. for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {
  8599. classes[_key] = arguments[_key];
  8600. }
  8601. var classNames = arrayFlat(classes.map(function (c) {
  8602. return c.split(' ');
  8603. }));
  8604. this.forEach(function (el) {
  8605. var _el$classList;
  8606. (_el$classList = el.classList).add.apply(_el$classList, classNames);
  8607. });
  8608. return this;
  8609. }
  8610. function removeClass() {
  8611. for (var _len2 = arguments.length, classes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  8612. classes[_key2] = arguments[_key2];
  8613. }
  8614. var classNames = arrayFlat(classes.map(function (c) {
  8615. return c.split(' ');
  8616. }));
  8617. this.forEach(function (el) {
  8618. var _el$classList2;
  8619. (_el$classList2 = el.classList).remove.apply(_el$classList2, classNames);
  8620. });
  8621. return this;
  8622. }
  8623. function toggleClass() {
  8624. for (var _len3 = arguments.length, classes = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  8625. classes[_key3] = arguments[_key3];
  8626. }
  8627. var classNames = arrayFlat(classes.map(function (c) {
  8628. return c.split(' ');
  8629. }));
  8630. this.forEach(function (el) {
  8631. classNames.forEach(function (className) {
  8632. el.classList.toggle(className);
  8633. });
  8634. });
  8635. }
  8636. function hasClass() {
  8637. for (var _len4 = arguments.length, classes = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  8638. classes[_key4] = arguments[_key4];
  8639. }
  8640. var classNames = arrayFlat(classes.map(function (c) {
  8641. return c.split(' ');
  8642. }));
  8643. return arrayFilter(this, function (el) {
  8644. return classNames.filter(function (className) {
  8645. return el.classList.contains(className);
  8646. }).length > 0;
  8647. }).length > 0;
  8648. }
  8649. function attr(attrs, value) {
  8650. if (arguments.length === 1 && typeof attrs === 'string') {
  8651. // Get attr
  8652. if (this[0]) return this[0].getAttribute(attrs);
  8653. return undefined;
  8654. } // Set attrs
  8655. for (var i = 0; i < this.length; i += 1) {
  8656. if (arguments.length === 2) {
  8657. // String
  8658. this[i].setAttribute(attrs, value);
  8659. } else {
  8660. // Object
  8661. for (var attrName in attrs) {
  8662. this[i][attrName] = attrs[attrName];
  8663. this[i].setAttribute(attrName, attrs[attrName]);
  8664. }
  8665. }
  8666. }
  8667. return this;
  8668. }
  8669. function removeAttr(attr) {
  8670. for (var i = 0; i < this.length; i += 1) {
  8671. this[i].removeAttribute(attr);
  8672. }
  8673. return this;
  8674. }
  8675. function prop(props, value) {
  8676. if (arguments.length === 1 && typeof props === 'string') {
  8677. // Get prop
  8678. if (this[0]) return this[0][props];
  8679. } else {
  8680. // Set props
  8681. for (var i = 0; i < this.length; i += 1) {
  8682. if (arguments.length === 2) {
  8683. // String
  8684. this[i][props] = value;
  8685. } else {
  8686. // Object
  8687. for (var propName in props) {
  8688. this[i][propName] = props[propName];
  8689. }
  8690. }
  8691. }
  8692. return this;
  8693. }
  8694. return this;
  8695. }
  8696. function data(key, value) {
  8697. var el;
  8698. if (typeof value === 'undefined') {
  8699. el = this[0];
  8700. if (!el) return undefined; // Get value
  8701. if (el.dom7ElementDataStorage && key in el.dom7ElementDataStorage) {
  8702. return el.dom7ElementDataStorage[key];
  8703. }
  8704. var dataKey = el.getAttribute("data-" + key);
  8705. if (dataKey) {
  8706. return dataKey;
  8707. }
  8708. return undefined;
  8709. } // Set value
  8710. for (var i = 0; i < this.length; i += 1) {
  8711. el = this[i];
  8712. if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};
  8713. el.dom7ElementDataStorage[key] = value;
  8714. }
  8715. return this;
  8716. }
  8717. function removeData(key) {
  8718. for (var i = 0; i < this.length; i += 1) {
  8719. var el = this[i];
  8720. if (el.dom7ElementDataStorage && el.dom7ElementDataStorage[key]) {
  8721. el.dom7ElementDataStorage[key] = null;
  8722. delete el.dom7ElementDataStorage[key];
  8723. }
  8724. }
  8725. }
  8726. function dataset() {
  8727. var el = this[0];
  8728. if (!el) return undefined;
  8729. var dataset = {}; // eslint-disable-line
  8730. if (el.dataset) {
  8731. for (var dataKey in el.dataset) {
  8732. dataset[dataKey] = el.dataset[dataKey];
  8733. }
  8734. } else {
  8735. for (var i = 0; i < el.attributes.length; i += 1) {
  8736. var _attr = el.attributes[i];
  8737. if (_attr.name.indexOf('data-') >= 0) {
  8738. dataset[toCamelCase(_attr.name.split('data-')[1])] = _attr.value;
  8739. }
  8740. }
  8741. }
  8742. for (var key in dataset) {
  8743. if (dataset[key] === 'false') dataset[key] = false;else if (dataset[key] === 'true') dataset[key] = true;else if (parseFloat(dataset[key]) === dataset[key] * 1) dataset[key] *= 1;
  8744. }
  8745. return dataset;
  8746. }
  8747. function val(value) {
  8748. if (typeof value === 'undefined') {
  8749. // get value
  8750. var el = this[0];
  8751. if (!el) return undefined;
  8752. if (el.multiple && el.nodeName.toLowerCase() === 'select') {
  8753. var values = [];
  8754. for (var i = 0; i < el.selectedOptions.length; i += 1) {
  8755. values.push(el.selectedOptions[i].value);
  8756. }
  8757. return values;
  8758. }
  8759. return el.value;
  8760. } // set value
  8761. for (var _i = 0; _i < this.length; _i += 1) {
  8762. var _el = this[_i];
  8763. if (Array.isArray(value) && _el.multiple && _el.nodeName.toLowerCase() === 'select') {
  8764. for (var j = 0; j < _el.options.length; j += 1) {
  8765. _el.options[j].selected = value.indexOf(_el.options[j].value) >= 0;
  8766. }
  8767. } else {
  8768. _el.value = value;
  8769. }
  8770. }
  8771. return this;
  8772. }
  8773. function value(value) {
  8774. return this.val(value);
  8775. }
  8776. function transform(transform) {
  8777. for (var i = 0; i < this.length; i += 1) {
  8778. this[i].style.transform = transform;
  8779. }
  8780. return this;
  8781. }
  8782. function transition(duration) {
  8783. for (var i = 0; i < this.length; i += 1) {
  8784. this[i].style.transitionDuration = typeof duration !== 'string' ? duration + "ms" : duration;
  8785. }
  8786. return this;
  8787. }
  8788. function on() {
  8789. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  8790. args[_key5] = arguments[_key5];
  8791. }
  8792. var eventType = args[0],
  8793. targetSelector = args[1],
  8794. listener = args[2],
  8795. capture = args[3];
  8796. if (typeof args[1] === 'function') {
  8797. eventType = args[0];
  8798. listener = args[1];
  8799. capture = args[2];
  8800. targetSelector = undefined;
  8801. }
  8802. if (!capture) capture = false;
  8803. function handleLiveEvent(e) {
  8804. var target = e.target;
  8805. if (!target) return;
  8806. var eventData = e.target.dom7EventData || [];
  8807. if (eventData.indexOf(e) < 0) {
  8808. eventData.unshift(e);
  8809. }
  8810. if ($(target).is(targetSelector)) listener.apply(target, eventData);else {
  8811. var _parents = $(target).parents(); // eslint-disable-line
  8812. for (var k = 0; k < _parents.length; k += 1) {
  8813. if ($(_parents[k]).is(targetSelector)) listener.apply(_parents[k], eventData);
  8814. }
  8815. }
  8816. }
  8817. function handleEvent(e) {
  8818. var eventData = e && e.target ? e.target.dom7EventData || [] : [];
  8819. if (eventData.indexOf(e) < 0) {
  8820. eventData.unshift(e);
  8821. }
  8822. listener.apply(this, eventData);
  8823. }
  8824. var events = eventType.split(' ');
  8825. var j;
  8826. for (var i = 0; i < this.length; i += 1) {
  8827. var el = this[i];
  8828. if (!targetSelector) {
  8829. for (j = 0; j < events.length; j += 1) {
  8830. var event = events[j];
  8831. if (!el.dom7Listeners) el.dom7Listeners = {};
  8832. if (!el.dom7Listeners[event]) el.dom7Listeners[event] = [];
  8833. el.dom7Listeners[event].push({
  8834. listener: listener,
  8835. proxyListener: handleEvent
  8836. });
  8837. el.addEventListener(event, handleEvent, capture);
  8838. }
  8839. } else {
  8840. // Live events
  8841. for (j = 0; j < events.length; j += 1) {
  8842. var _event = events[j];
  8843. if (!el.dom7LiveListeners) el.dom7LiveListeners = {};
  8844. if (!el.dom7LiveListeners[_event]) el.dom7LiveListeners[_event] = [];
  8845. el.dom7LiveListeners[_event].push({
  8846. listener: listener,
  8847. proxyListener: handleLiveEvent
  8848. });
  8849. el.addEventListener(_event, handleLiveEvent, capture);
  8850. }
  8851. }
  8852. }
  8853. return this;
  8854. }
  8855. function off() {
  8856. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  8857. args[_key6] = arguments[_key6];
  8858. }
  8859. var eventType = args[0],
  8860. targetSelector = args[1],
  8861. listener = args[2],
  8862. capture = args[3];
  8863. if (typeof args[1] === 'function') {
  8864. eventType = args[0];
  8865. listener = args[1];
  8866. capture = args[2];
  8867. targetSelector = undefined;
  8868. }
  8869. if (!capture) capture = false;
  8870. var events = eventType.split(' ');
  8871. for (var i = 0; i < events.length; i += 1) {
  8872. var event = events[i];
  8873. for (var j = 0; j < this.length; j += 1) {
  8874. var el = this[j];
  8875. var handlers = void 0;
  8876. if (!targetSelector && el.dom7Listeners) {
  8877. handlers = el.dom7Listeners[event];
  8878. } else if (targetSelector && el.dom7LiveListeners) {
  8879. handlers = el.dom7LiveListeners[event];
  8880. }
  8881. if (handlers && handlers.length) {
  8882. for (var k = handlers.length - 1; k >= 0; k -= 1) {
  8883. var handler = handlers[k];
  8884. if (listener && handler.listener === listener) {
  8885. el.removeEventListener(event, handler.proxyListener, capture);
  8886. handlers.splice(k, 1);
  8887. } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
  8888. el.removeEventListener(event, handler.proxyListener, capture);
  8889. handlers.splice(k, 1);
  8890. } else if (!listener) {
  8891. el.removeEventListener(event, handler.proxyListener, capture);
  8892. handlers.splice(k, 1);
  8893. }
  8894. }
  8895. }
  8896. }
  8897. }
  8898. return this;
  8899. }
  8900. function once() {
  8901. var dom = this;
  8902. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  8903. args[_key7] = arguments[_key7];
  8904. }
  8905. var eventName = args[0],
  8906. targetSelector = args[1],
  8907. listener = args[2],
  8908. capture = args[3];
  8909. if (typeof args[1] === 'function') {
  8910. eventName = args[0];
  8911. listener = args[1];
  8912. capture = args[2];
  8913. targetSelector = undefined;
  8914. }
  8915. function onceHandler() {
  8916. for (var _len8 = arguments.length, eventArgs = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  8917. eventArgs[_key8] = arguments[_key8];
  8918. }
  8919. listener.apply(this, eventArgs);
  8920. dom.off(eventName, targetSelector, onceHandler, capture);
  8921. if (onceHandler.dom7proxy) {
  8922. delete onceHandler.dom7proxy;
  8923. }
  8924. }
  8925. onceHandler.dom7proxy = listener;
  8926. return dom.on(eventName, targetSelector, onceHandler, capture);
  8927. }
  8928. function trigger() {
  8929. var window = ssrWindow_umd.getWindow();
  8930. for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
  8931. args[_key9] = arguments[_key9];
  8932. }
  8933. var events = args[0].split(' ');
  8934. var eventData = args[1];
  8935. for (var i = 0; i < events.length; i += 1) {
  8936. var event = events[i];
  8937. for (var j = 0; j < this.length; j += 1) {
  8938. var el = this[j];
  8939. if (window.CustomEvent) {
  8940. var evt = new window.CustomEvent(event, {
  8941. detail: eventData,
  8942. bubbles: true,
  8943. cancelable: true
  8944. });
  8945. el.dom7EventData = args.filter(function (data, dataIndex) {
  8946. return dataIndex > 0;
  8947. });
  8948. el.dispatchEvent(evt);
  8949. el.dom7EventData = [];
  8950. delete el.dom7EventData;
  8951. }
  8952. }
  8953. }
  8954. return this;
  8955. }
  8956. function transitionEnd(callback) {
  8957. var dom = this;
  8958. function fireCallBack(e) {
  8959. if (e.target !== this) return;
  8960. callback.call(this, e);
  8961. dom.off('transitionend', fireCallBack);
  8962. }
  8963. if (callback) {
  8964. dom.on('transitionend', fireCallBack);
  8965. }
  8966. return this;
  8967. }
  8968. function animationEnd(callback) {
  8969. var dom = this;
  8970. function fireCallBack(e) {
  8971. if (e.target !== this) return;
  8972. callback.call(this, e);
  8973. dom.off('animationend', fireCallBack);
  8974. }
  8975. if (callback) {
  8976. dom.on('animationend', fireCallBack);
  8977. }
  8978. return this;
  8979. }
  8980. function width() {
  8981. var window = ssrWindow_umd.getWindow();
  8982. if (this[0] === window) {
  8983. return window.innerWidth;
  8984. }
  8985. if (this.length > 0) {
  8986. return parseFloat(this.css('width'));
  8987. }
  8988. return null;
  8989. }
  8990. function outerWidth(includeMargins) {
  8991. if (this.length > 0) {
  8992. if (includeMargins) {
  8993. var _styles = this.styles();
  8994. return this[0].offsetWidth + parseFloat(_styles.getPropertyValue('margin-right')) + parseFloat(_styles.getPropertyValue('margin-left'));
  8995. }
  8996. return this[0].offsetWidth;
  8997. }
  8998. return null;
  8999. }
  9000. function height() {
  9001. var window = ssrWindow_umd.getWindow();
  9002. if (this[0] === window) {
  9003. return window.innerHeight;
  9004. }
  9005. if (this.length > 0) {
  9006. return parseFloat(this.css('height'));
  9007. }
  9008. return null;
  9009. }
  9010. function outerHeight(includeMargins) {
  9011. if (this.length > 0) {
  9012. if (includeMargins) {
  9013. var _styles2 = this.styles();
  9014. return this[0].offsetHeight + parseFloat(_styles2.getPropertyValue('margin-top')) + parseFloat(_styles2.getPropertyValue('margin-bottom'));
  9015. }
  9016. return this[0].offsetHeight;
  9017. }
  9018. return null;
  9019. }
  9020. function offset() {
  9021. if (this.length > 0) {
  9022. var window = ssrWindow_umd.getWindow();
  9023. var document = ssrWindow_umd.getDocument();
  9024. var el = this[0];
  9025. var box = el.getBoundingClientRect();
  9026. var body = document.body;
  9027. var clientTop = el.clientTop || body.clientTop || 0;
  9028. var clientLeft = el.clientLeft || body.clientLeft || 0;
  9029. var scrollTop = el === window ? window.scrollY : el.scrollTop;
  9030. var scrollLeft = el === window ? window.scrollX : el.scrollLeft;
  9031. return {
  9032. top: box.top + scrollTop - clientTop,
  9033. left: box.left + scrollLeft - clientLeft
  9034. };
  9035. }
  9036. return null;
  9037. }
  9038. function hide() {
  9039. for (var i = 0; i < this.length; i += 1) {
  9040. this[i].style.display = 'none';
  9041. }
  9042. return this;
  9043. }
  9044. function show() {
  9045. var window = ssrWindow_umd.getWindow();
  9046. for (var i = 0; i < this.length; i += 1) {
  9047. var el = this[i];
  9048. if (el.style.display === 'none') {
  9049. el.style.display = '';
  9050. }
  9051. if (window.getComputedStyle(el, null).getPropertyValue('display') === 'none') {
  9052. // Still not visible
  9053. el.style.display = 'block';
  9054. }
  9055. }
  9056. return this;
  9057. }
  9058. function styles() {
  9059. var window = ssrWindow_umd.getWindow();
  9060. if (this[0]) return window.getComputedStyle(this[0], null);
  9061. return {};
  9062. }
  9063. function css(props, value) {
  9064. var window = ssrWindow_umd.getWindow();
  9065. var i;
  9066. if (arguments.length === 1) {
  9067. if (typeof props === 'string') {
  9068. // .css('width')
  9069. if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
  9070. } else {
  9071. // .css({ width: '100px' })
  9072. for (i = 0; i < this.length; i += 1) {
  9073. for (var _prop in props) {
  9074. this[i].style[_prop] = props[_prop];
  9075. }
  9076. }
  9077. return this;
  9078. }
  9079. }
  9080. if (arguments.length === 2 && typeof props === 'string') {
  9081. // .css('width', '100px')
  9082. for (i = 0; i < this.length; i += 1) {
  9083. this[i].style[props] = value;
  9084. }
  9085. return this;
  9086. }
  9087. return this;
  9088. }
  9089. function each(callback) {
  9090. if (!callback) return this;
  9091. this.forEach(function (el, index) {
  9092. callback.apply(el, [el, index]);
  9093. });
  9094. return this;
  9095. }
  9096. function filter(callback) {
  9097. var result = arrayFilter(this, callback);
  9098. return $(result);
  9099. }
  9100. function html(html) {
  9101. if (typeof html === 'undefined') {
  9102. return this[0] ? this[0].innerHTML : null;
  9103. }
  9104. for (var i = 0; i < this.length; i += 1) {
  9105. this[i].innerHTML = html;
  9106. }
  9107. return this;
  9108. }
  9109. function text(text) {
  9110. if (typeof text === 'undefined') {
  9111. return this[0] ? this[0].textContent.trim() : null;
  9112. }
  9113. for (var i = 0; i < this.length; i += 1) {
  9114. this[i].textContent = text;
  9115. }
  9116. return this;
  9117. }
  9118. function is(selector) {
  9119. var window = ssrWindow_umd.getWindow();
  9120. var document = ssrWindow_umd.getDocument();
  9121. var el = this[0];
  9122. var compareWith;
  9123. var i;
  9124. if (!el || typeof selector === 'undefined') return false;
  9125. if (typeof selector === 'string') {
  9126. if (el.matches) return el.matches(selector);
  9127. if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
  9128. if (el.msMatchesSelector) return el.msMatchesSelector(selector);
  9129. compareWith = $(selector);
  9130. for (i = 0; i < compareWith.length; i += 1) {
  9131. if (compareWith[i] === el) return true;
  9132. }
  9133. return false;
  9134. }
  9135. if (selector === document) {
  9136. return el === document;
  9137. }
  9138. if (selector === window) {
  9139. return el === window;
  9140. }
  9141. if (selector.nodeType || selector instanceof Dom7) {
  9142. compareWith = selector.nodeType ? [selector] : selector;
  9143. for (i = 0; i < compareWith.length; i += 1) {
  9144. if (compareWith[i] === el) return true;
  9145. }
  9146. return false;
  9147. }
  9148. return false;
  9149. }
  9150. function index$1() {
  9151. var child = this[0];
  9152. var i;
  9153. if (child) {
  9154. i = 0; // eslint-disable-next-line
  9155. while ((child = child.previousSibling) !== null) {
  9156. if (child.nodeType === 1) i += 1;
  9157. }
  9158. return i;
  9159. }
  9160. return undefined;
  9161. }
  9162. function eq(index) {
  9163. if (typeof index === 'undefined') return this;
  9164. var length = this.length;
  9165. if (index > length - 1) {
  9166. return $([]);
  9167. }
  9168. if (index < 0) {
  9169. var returnIndex = length + index;
  9170. if (returnIndex < 0) return $([]);
  9171. return $([this[returnIndex]]);
  9172. }
  9173. return $([this[index]]);
  9174. }
  9175. function append() {
  9176. var newChild;
  9177. var document = ssrWindow_umd.getDocument();
  9178. for (var k = 0; k < arguments.length; k += 1) {
  9179. newChild = k < 0 || arguments.length <= k ? undefined : arguments[k];
  9180. for (var i = 0; i < this.length; i += 1) {
  9181. if (typeof newChild === 'string') {
  9182. var tempDiv = document.createElement('div');
  9183. tempDiv.innerHTML = newChild;
  9184. while (tempDiv.firstChild) {
  9185. this[i].appendChild(tempDiv.firstChild);
  9186. }
  9187. } else if (newChild instanceof Dom7) {
  9188. for (var j = 0; j < newChild.length; j += 1) {
  9189. this[i].appendChild(newChild[j]);
  9190. }
  9191. } else {
  9192. this[i].appendChild(newChild);
  9193. }
  9194. }
  9195. }
  9196. return this;
  9197. }
  9198. function appendTo(parent) {
  9199. $(parent).append(this);
  9200. return this;
  9201. }
  9202. function prepend(newChild) {
  9203. var document = ssrWindow_umd.getDocument();
  9204. var i;
  9205. var j;
  9206. for (i = 0; i < this.length; i += 1) {
  9207. if (typeof newChild === 'string') {
  9208. var tempDiv = document.createElement('div');
  9209. tempDiv.innerHTML = newChild;
  9210. for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
  9211. this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
  9212. }
  9213. } else if (newChild instanceof Dom7) {
  9214. for (j = 0; j < newChild.length; j += 1) {
  9215. this[i].insertBefore(newChild[j], this[i].childNodes[0]);
  9216. }
  9217. } else {
  9218. this[i].insertBefore(newChild, this[i].childNodes[0]);
  9219. }
  9220. }
  9221. return this;
  9222. }
  9223. function prependTo(parent) {
  9224. $(parent).prepend(this);
  9225. return this;
  9226. }
  9227. function insertBefore(selector) {
  9228. var before = $(selector);
  9229. for (var i = 0; i < this.length; i += 1) {
  9230. if (before.length === 1) {
  9231. before[0].parentNode.insertBefore(this[i], before[0]);
  9232. } else if (before.length > 1) {
  9233. for (var j = 0; j < before.length; j += 1) {
  9234. before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
  9235. }
  9236. }
  9237. }
  9238. }
  9239. function insertAfter(selector) {
  9240. var after = $(selector);
  9241. for (var i = 0; i < this.length; i += 1) {
  9242. if (after.length === 1) {
  9243. after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
  9244. } else if (after.length > 1) {
  9245. for (var j = 0; j < after.length; j += 1) {
  9246. after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
  9247. }
  9248. }
  9249. }
  9250. }
  9251. function next(selector) {
  9252. if (this.length > 0) {
  9253. if (selector) {
  9254. if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
  9255. return $([this[0].nextElementSibling]);
  9256. }
  9257. return $([]);
  9258. }
  9259. if (this[0].nextElementSibling) return $([this[0].nextElementSibling]);
  9260. return $([]);
  9261. }
  9262. return $([]);
  9263. }
  9264. function nextAll(selector) {
  9265. var nextEls = [];
  9266. var el = this[0];
  9267. if (!el) return $([]);
  9268. while (el.nextElementSibling) {
  9269. var _next = el.nextElementSibling; // eslint-disable-line
  9270. if (selector) {
  9271. if ($(_next).is(selector)) nextEls.push(_next);
  9272. } else nextEls.push(_next);
  9273. el = _next;
  9274. }
  9275. return $(nextEls);
  9276. }
  9277. function prev(selector) {
  9278. if (this.length > 0) {
  9279. var el = this[0];
  9280. if (selector) {
  9281. if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
  9282. return $([el.previousElementSibling]);
  9283. }
  9284. return $([]);
  9285. }
  9286. if (el.previousElementSibling) return $([el.previousElementSibling]);
  9287. return $([]);
  9288. }
  9289. return $([]);
  9290. }
  9291. function prevAll(selector) {
  9292. var prevEls = [];
  9293. var el = this[0];
  9294. if (!el) return $([]);
  9295. while (el.previousElementSibling) {
  9296. var _prev = el.previousElementSibling; // eslint-disable-line
  9297. if (selector) {
  9298. if ($(_prev).is(selector)) prevEls.push(_prev);
  9299. } else prevEls.push(_prev);
  9300. el = _prev;
  9301. }
  9302. return $(prevEls);
  9303. }
  9304. function siblings(selector) {
  9305. return this.nextAll(selector).add(this.prevAll(selector));
  9306. }
  9307. function parent(selector) {
  9308. var parents = []; // eslint-disable-line
  9309. for (var i = 0; i < this.length; i += 1) {
  9310. if (this[i].parentNode !== null) {
  9311. if (selector) {
  9312. if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
  9313. } else {
  9314. parents.push(this[i].parentNode);
  9315. }
  9316. }
  9317. }
  9318. return $(parents);
  9319. }
  9320. function parents(selector) {
  9321. var parents = []; // eslint-disable-line
  9322. for (var i = 0; i < this.length; i += 1) {
  9323. var _parent = this[i].parentNode; // eslint-disable-line
  9324. while (_parent) {
  9325. if (selector) {
  9326. if ($(_parent).is(selector)) parents.push(_parent);
  9327. } else {
  9328. parents.push(_parent);
  9329. }
  9330. _parent = _parent.parentNode;
  9331. }
  9332. }
  9333. return $(parents);
  9334. }
  9335. function closest(selector) {
  9336. var closest = this; // eslint-disable-line
  9337. if (typeof selector === 'undefined') {
  9338. return $([]);
  9339. }
  9340. if (!closest.is(selector)) {
  9341. closest = closest.parents(selector).eq(0);
  9342. }
  9343. return closest;
  9344. }
  9345. function find(selector) {
  9346. var foundElements = [];
  9347. for (var i = 0; i < this.length; i += 1) {
  9348. var found = this[i].querySelectorAll(selector);
  9349. for (var j = 0; j < found.length; j += 1) {
  9350. foundElements.push(found[j]);
  9351. }
  9352. }
  9353. return $(foundElements);
  9354. }
  9355. function children(selector) {
  9356. var children = []; // eslint-disable-line
  9357. for (var i = 0; i < this.length; i += 1) {
  9358. var childNodes = this[i].children;
  9359. for (var j = 0; j < childNodes.length; j += 1) {
  9360. if (!selector || $(childNodes[j]).is(selector)) {
  9361. children.push(childNodes[j]);
  9362. }
  9363. }
  9364. }
  9365. return $(children);
  9366. }
  9367. function remove() {
  9368. for (var i = 0; i < this.length; i += 1) {
  9369. if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
  9370. }
  9371. return this;
  9372. }
  9373. function detach() {
  9374. return this.remove();
  9375. }
  9376. function add() {
  9377. var dom = this;
  9378. var i;
  9379. var j;
  9380. for (var _len10 = arguments.length, els = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
  9381. els[_key10] = arguments[_key10];
  9382. }
  9383. for (i = 0; i < els.length; i += 1) {
  9384. var toAdd = $(els[i]);
  9385. for (j = 0; j < toAdd.length; j += 1) {
  9386. dom.push(toAdd[j]);
  9387. }
  9388. }
  9389. return dom;
  9390. }
  9391. function empty() {
  9392. for (var i = 0; i < this.length; i += 1) {
  9393. var el = this[i];
  9394. if (el.nodeType === 1) {
  9395. for (var j = 0; j < el.childNodes.length; j += 1) {
  9396. if (el.childNodes[j].parentNode) {
  9397. el.childNodes[j].parentNode.removeChild(el.childNodes[j]);
  9398. }
  9399. }
  9400. el.textContent = '';
  9401. }
  9402. }
  9403. return this;
  9404. }
  9405. function scrollTo() {
  9406. var window = ssrWindow_umd.getWindow();
  9407. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  9408. args[_key] = arguments[_key];
  9409. }
  9410. var left = args[0],
  9411. top = args[1],
  9412. duration = args[2],
  9413. easing = args[3],
  9414. callback = args[4];
  9415. if (args.length === 4 && typeof easing === 'function') {
  9416. callback = easing;
  9417. left = args[0];
  9418. top = args[1];
  9419. duration = args[2];
  9420. callback = args[3];
  9421. easing = args[4];
  9422. }
  9423. if (typeof easing === 'undefined') easing = 'swing';
  9424. return this.each(function animate() {
  9425. var el = this;
  9426. var currentTop;
  9427. var currentLeft;
  9428. var maxTop;
  9429. var maxLeft;
  9430. var newTop;
  9431. var newLeft;
  9432. var scrollTop; // eslint-disable-line
  9433. var scrollLeft; // eslint-disable-line
  9434. var animateTop = top > 0 || top === 0;
  9435. var animateLeft = left > 0 || left === 0;
  9436. if (typeof easing === 'undefined') {
  9437. easing = 'swing';
  9438. }
  9439. if (animateTop) {
  9440. currentTop = el.scrollTop;
  9441. if (!duration) {
  9442. el.scrollTop = top;
  9443. }
  9444. }
  9445. if (animateLeft) {
  9446. currentLeft = el.scrollLeft;
  9447. if (!duration) {
  9448. el.scrollLeft = left;
  9449. }
  9450. }
  9451. if (!duration) return;
  9452. if (animateTop) {
  9453. maxTop = el.scrollHeight - el.offsetHeight;
  9454. newTop = Math.max(Math.min(top, maxTop), 0);
  9455. }
  9456. if (animateLeft) {
  9457. maxLeft = el.scrollWidth - el.offsetWidth;
  9458. newLeft = Math.max(Math.min(left, maxLeft), 0);
  9459. }
  9460. var startTime = null;
  9461. if (animateTop && newTop === currentTop) animateTop = false;
  9462. if (animateLeft && newLeft === currentLeft) animateLeft = false;
  9463. function render(time) {
  9464. if (time === void 0) {
  9465. time = new Date().getTime();
  9466. }
  9467. if (startTime === null) {
  9468. startTime = time;
  9469. }
  9470. var progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
  9471. var easeProgress = easing === 'linear' ? progress : 0.5 - Math.cos(progress * Math.PI) / 2;
  9472. var done;
  9473. if (animateTop) scrollTop = currentTop + easeProgress * (newTop - currentTop);
  9474. if (animateLeft) scrollLeft = currentLeft + easeProgress * (newLeft - currentLeft);
  9475. if (animateTop && newTop > currentTop && scrollTop >= newTop) {
  9476. el.scrollTop = newTop;
  9477. done = true;
  9478. }
  9479. if (animateTop && newTop < currentTop && scrollTop <= newTop) {
  9480. el.scrollTop = newTop;
  9481. done = true;
  9482. }
  9483. if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) {
  9484. el.scrollLeft = newLeft;
  9485. done = true;
  9486. }
  9487. if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) {
  9488. el.scrollLeft = newLeft;
  9489. done = true;
  9490. }
  9491. if (done) {
  9492. if (callback) callback();
  9493. return;
  9494. }
  9495. if (animateTop) el.scrollTop = scrollTop;
  9496. if (animateLeft) el.scrollLeft = scrollLeft;
  9497. window.requestAnimationFrame(render);
  9498. }
  9499. window.requestAnimationFrame(render);
  9500. });
  9501. } // scrollTop(top, duration, easing, callback) {
  9502. function scrollTop() {
  9503. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  9504. args[_key2] = arguments[_key2];
  9505. }
  9506. var top = args[0],
  9507. duration = args[1],
  9508. easing = args[2],
  9509. callback = args[3];
  9510. if (args.length === 3 && typeof easing === 'function') {
  9511. top = args[0];
  9512. duration = args[1];
  9513. callback = args[2];
  9514. easing = args[3];
  9515. }
  9516. var dom = this;
  9517. if (typeof top === 'undefined') {
  9518. if (dom.length > 0) return dom[0].scrollTop;
  9519. return null;
  9520. }
  9521. return dom.scrollTo(undefined, top, duration, easing, callback);
  9522. }
  9523. function scrollLeft() {
  9524. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  9525. args[_key3] = arguments[_key3];
  9526. }
  9527. var left = args[0],
  9528. duration = args[1],
  9529. easing = args[2],
  9530. callback = args[3];
  9531. if (args.length === 3 && typeof easing === 'function') {
  9532. left = args[0];
  9533. duration = args[1];
  9534. callback = args[2];
  9535. easing = args[3];
  9536. }
  9537. var dom = this;
  9538. if (typeof left === 'undefined') {
  9539. if (dom.length > 0) return dom[0].scrollLeft;
  9540. return null;
  9541. }
  9542. return dom.scrollTo(left, undefined, duration, easing, callback);
  9543. }
  9544. function animate(initialProps, initialParams) {
  9545. var window = ssrWindow_umd.getWindow();
  9546. var els = this;
  9547. var a = {
  9548. props: Object.assign({}, initialProps),
  9549. params: Object.assign({
  9550. duration: 300,
  9551. easing: 'swing' // or 'linear'
  9552. /* Callbacks
  9553. begin(elements)
  9554. complete(elements)
  9555. progress(elements, complete, remaining, start, tweenValue)
  9556. */
  9557. }, initialParams),
  9558. elements: els,
  9559. animating: false,
  9560. que: [],
  9561. easingProgress: function easingProgress(easing, progress) {
  9562. if (easing === 'swing') {
  9563. return 0.5 - Math.cos(progress * Math.PI) / 2;
  9564. }
  9565. if (typeof easing === 'function') {
  9566. return easing(progress);
  9567. }
  9568. return progress;
  9569. },
  9570. stop: function stop() {
  9571. if (a.frameId) {
  9572. window.cancelAnimationFrame(a.frameId);
  9573. }
  9574. a.animating = false;
  9575. a.elements.each(function (el) {
  9576. var element = el;
  9577. delete element.dom7AnimateInstance;
  9578. });
  9579. a.que = [];
  9580. },
  9581. done: function done(complete) {
  9582. a.animating = false;
  9583. a.elements.each(function (el) {
  9584. var element = el;
  9585. delete element.dom7AnimateInstance;
  9586. });
  9587. if (complete) complete(els);
  9588. if (a.que.length > 0) {
  9589. var que = a.que.shift();
  9590. a.animate(que[0], que[1]);
  9591. }
  9592. },
  9593. animate: function animate(props, params) {
  9594. if (a.animating) {
  9595. a.que.push([props, params]);
  9596. return a;
  9597. }
  9598. var elements = []; // Define & Cache Initials & Units
  9599. a.elements.each(function (el, index) {
  9600. var initialFullValue;
  9601. var initialValue;
  9602. var unit;
  9603. var finalValue;
  9604. var finalFullValue;
  9605. if (!el.dom7AnimateInstance) a.elements[index].dom7AnimateInstance = a;
  9606. elements[index] = {
  9607. container: el
  9608. };
  9609. Object.keys(props).forEach(function (prop) {
  9610. initialFullValue = window.getComputedStyle(el, null).getPropertyValue(prop).replace(',', '.');
  9611. initialValue = parseFloat(initialFullValue);
  9612. unit = initialFullValue.replace(initialValue, '');
  9613. finalValue = parseFloat(props[prop]);
  9614. finalFullValue = props[prop] + unit;
  9615. elements[index][prop] = {
  9616. initialFullValue: initialFullValue,
  9617. initialValue: initialValue,
  9618. unit: unit,
  9619. finalValue: finalValue,
  9620. finalFullValue: finalFullValue,
  9621. currentValue: initialValue
  9622. };
  9623. });
  9624. });
  9625. var startTime = null;
  9626. var time;
  9627. var elementsDone = 0;
  9628. var propsDone = 0;
  9629. var done;
  9630. var began = false;
  9631. a.animating = true;
  9632. function render() {
  9633. time = new Date().getTime();
  9634. var progress;
  9635. var easeProgress; // let el;
  9636. if (!began) {
  9637. began = true;
  9638. if (params.begin) params.begin(els);
  9639. }
  9640. if (startTime === null) {
  9641. startTime = time;
  9642. }
  9643. if (params.progress) {
  9644. // eslint-disable-next-line
  9645. params.progress(els, Math.max(Math.min((time - startTime) / params.duration, 1), 0), startTime + params.duration - time < 0 ? 0 : startTime + params.duration - time, startTime);
  9646. }
  9647. elements.forEach(function (element) {
  9648. var el = element;
  9649. if (done || el.done) return;
  9650. Object.keys(props).forEach(function (prop) {
  9651. if (done || el.done) return;
  9652. progress = Math.max(Math.min((time - startTime) / params.duration, 1), 0);
  9653. easeProgress = a.easingProgress(params.easing, progress);
  9654. var _el$prop = el[prop],
  9655. initialValue = _el$prop.initialValue,
  9656. finalValue = _el$prop.finalValue,
  9657. unit = _el$prop.unit;
  9658. el[prop].currentValue = initialValue + easeProgress * (finalValue - initialValue);
  9659. var currentValue = el[prop].currentValue;
  9660. if (finalValue > initialValue && currentValue >= finalValue || finalValue < initialValue && currentValue <= finalValue) {
  9661. el.container.style[prop] = finalValue + unit;
  9662. propsDone += 1;
  9663. if (propsDone === Object.keys(props).length) {
  9664. el.done = true;
  9665. elementsDone += 1;
  9666. }
  9667. if (elementsDone === elements.length) {
  9668. done = true;
  9669. }
  9670. }
  9671. if (done) {
  9672. a.done(params.complete);
  9673. return;
  9674. }
  9675. el.container.style[prop] = currentValue + unit;
  9676. });
  9677. });
  9678. if (done) return; // Then call
  9679. a.frameId = window.requestAnimationFrame(render);
  9680. }
  9681. a.frameId = window.requestAnimationFrame(render);
  9682. return a;
  9683. }
  9684. };
  9685. if (a.elements.length === 0) {
  9686. return els;
  9687. }
  9688. var animateInstance;
  9689. for (var i = 0; i < a.elements.length; i += 1) {
  9690. if (a.elements[i].dom7AnimateInstance) {
  9691. animateInstance = a.elements[i].dom7AnimateInstance;
  9692. } else a.elements[i].dom7AnimateInstance = a;
  9693. }
  9694. if (!animateInstance) {
  9695. animateInstance = a;
  9696. }
  9697. if (initialProps === 'stop') {
  9698. animateInstance.stop();
  9699. } else {
  9700. animateInstance.animate(a.props, a.params);
  9701. }
  9702. return els;
  9703. }
  9704. function stop() {
  9705. var els = this;
  9706. for (var i = 0; i < els.length; i += 1) {
  9707. if (els[i].dom7AnimateInstance) {
  9708. els[i].dom7AnimateInstance.stop();
  9709. }
  9710. }
  9711. }
  9712. var noTrigger = 'resize scroll'.split(' ');
  9713. function shortcut(name) {
  9714. function eventHandler() {
  9715. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  9716. args[_key] = arguments[_key];
  9717. }
  9718. if (typeof args[0] === 'undefined') {
  9719. for (var i = 0; i < this.length; i += 1) {
  9720. if (noTrigger.indexOf(name) < 0) {
  9721. if (name in this[i]) this[i][name]();else {
  9722. $(this[i]).trigger(name);
  9723. }
  9724. }
  9725. }
  9726. return this;
  9727. }
  9728. return this.on.apply(this, [name].concat(args));
  9729. }
  9730. return eventHandler;
  9731. }
  9732. var click = shortcut('click');
  9733. var blur = shortcut('blur');
  9734. var focus = shortcut('focus');
  9735. var focusin = shortcut('focusin');
  9736. var focusout = shortcut('focusout');
  9737. var keyup = shortcut('keyup');
  9738. var keydown = shortcut('keydown');
  9739. var keypress = shortcut('keypress');
  9740. var submit = shortcut('submit');
  9741. var change = shortcut('change');
  9742. var mousedown = shortcut('mousedown');
  9743. var mousemove = shortcut('mousemove');
  9744. var mouseup = shortcut('mouseup');
  9745. var mouseenter = shortcut('mouseenter');
  9746. var mouseleave = shortcut('mouseleave');
  9747. var mouseout = shortcut('mouseout');
  9748. var mouseover = shortcut('mouseover');
  9749. var touchstart = shortcut('touchstart');
  9750. var touchend = shortcut('touchend');
  9751. var touchmove = shortcut('touchmove');
  9752. var resize = shortcut('resize');
  9753. var scroll = shortcut('scroll');
  9754. var $_1 = $;
  9755. var add_1 = add;
  9756. var addClass_1 = addClass;
  9757. var animate_1 = animate;
  9758. var animationEnd_1 = animationEnd;
  9759. var append_1 = append;
  9760. var appendTo_1 = appendTo;
  9761. var attr_1 = attr;
  9762. var blur_1 = blur;
  9763. var change_1 = change;
  9764. var children_1 = children;
  9765. var click_1 = click;
  9766. var closest_1 = closest;
  9767. var css_1 = css;
  9768. var data_1 = data;
  9769. var dataset_1 = dataset;
  9770. var _default$1 = $;
  9771. var detach_1 = detach;
  9772. var each_1 = each;
  9773. var empty_1 = empty;
  9774. var eq_1 = eq;
  9775. var filter_1 = filter;
  9776. var find_1 = find;
  9777. var focus_1 = focus;
  9778. var focusin_1 = focusin;
  9779. var focusout_1 = focusout;
  9780. var hasClass_1 = hasClass;
  9781. var height_1 = height;
  9782. var hide_1 = hide;
  9783. var html_1 = html;
  9784. var index_1 = index$1;
  9785. var insertAfter_1 = insertAfter;
  9786. var insertBefore_1 = insertBefore;
  9787. var is_1 = is;
  9788. var keydown_1 = keydown;
  9789. var keypress_1 = keypress;
  9790. var keyup_1 = keyup;
  9791. var mousedown_1 = mousedown;
  9792. var mouseenter_1 = mouseenter;
  9793. var mouseleave_1 = mouseleave;
  9794. var mousemove_1 = mousemove;
  9795. var mouseout_1 = mouseout;
  9796. var mouseover_1 = mouseover;
  9797. var mouseup_1 = mouseup;
  9798. var next_1 = next;
  9799. var nextAll_1 = nextAll;
  9800. var off_1 = off;
  9801. var offset_1 = offset;
  9802. var on_1 = on;
  9803. var once_1 = once;
  9804. var outerHeight_1 = outerHeight;
  9805. var outerWidth_1 = outerWidth;
  9806. var parent_1 = parent;
  9807. var parents_1 = parents;
  9808. var prepend_1 = prepend;
  9809. var prependTo_1 = prependTo;
  9810. var prev_1 = prev;
  9811. var prevAll_1 = prevAll;
  9812. var prop_1 = prop;
  9813. var remove_1 = remove;
  9814. var removeAttr_1 = removeAttr;
  9815. var removeClass_1 = removeClass;
  9816. var removeData_1 = removeData;
  9817. var resize_1 = resize;
  9818. var scroll_1 = scroll;
  9819. var scrollLeft_1 = scrollLeft;
  9820. var scrollTo_1 = scrollTo;
  9821. var scrollTop_1 = scrollTop;
  9822. var show_1 = show;
  9823. var siblings_1 = siblings;
  9824. var stop_1 = stop;
  9825. var styles_1 = styles;
  9826. var submit_1 = submit;
  9827. var text_1 = text;
  9828. var toggleClass_1 = toggleClass;
  9829. var touchend_1 = touchend;
  9830. var touchmove_1 = touchmove;
  9831. var touchstart_1 = touchstart;
  9832. var transform_1 = transform;
  9833. var transition_1 = transition;
  9834. var transitionEnd_1 = transitionEnd;
  9835. var trigger_1 = trigger;
  9836. var val_1 = val;
  9837. var value_1 = value;
  9838. var width_1 = width;
  9839. var dom7_cjs = /*#__PURE__*/Object.defineProperty({
  9840. $: $_1,
  9841. add: add_1,
  9842. addClass: addClass_1,
  9843. animate: animate_1,
  9844. animationEnd: animationEnd_1,
  9845. append: append_1,
  9846. appendTo: appendTo_1,
  9847. attr: attr_1,
  9848. blur: blur_1,
  9849. change: change_1,
  9850. children: children_1,
  9851. click: click_1,
  9852. closest: closest_1,
  9853. css: css_1,
  9854. data: data_1,
  9855. dataset: dataset_1,
  9856. default: _default$1,
  9857. detach: detach_1,
  9858. each: each_1,
  9859. empty: empty_1,
  9860. eq: eq_1,
  9861. filter: filter_1,
  9862. find: find_1,
  9863. focus: focus_1,
  9864. focusin: focusin_1,
  9865. focusout: focusout_1,
  9866. hasClass: hasClass_1,
  9867. height: height_1,
  9868. hide: hide_1,
  9869. html: html_1,
  9870. index: index_1,
  9871. insertAfter: insertAfter_1,
  9872. insertBefore: insertBefore_1,
  9873. is: is_1,
  9874. keydown: keydown_1,
  9875. keypress: keypress_1,
  9876. keyup: keyup_1,
  9877. mousedown: mousedown_1,
  9878. mouseenter: mouseenter_1,
  9879. mouseleave: mouseleave_1,
  9880. mousemove: mousemove_1,
  9881. mouseout: mouseout_1,
  9882. mouseover: mouseover_1,
  9883. mouseup: mouseup_1,
  9884. next: next_1,
  9885. nextAll: nextAll_1,
  9886. off: off_1,
  9887. offset: offset_1,
  9888. on: on_1,
  9889. once: once_1,
  9890. outerHeight: outerHeight_1,
  9891. outerWidth: outerWidth_1,
  9892. parent: parent_1,
  9893. parents: parents_1,
  9894. prepend: prepend_1,
  9895. prependTo: prependTo_1,
  9896. prev: prev_1,
  9897. prevAll: prevAll_1,
  9898. prop: prop_1,
  9899. remove: remove_1,
  9900. removeAttr: removeAttr_1,
  9901. removeClass: removeClass_1,
  9902. removeData: removeData_1,
  9903. resize: resize_1,
  9904. scroll: scroll_1,
  9905. scrollLeft: scrollLeft_1,
  9906. scrollTo: scrollTo_1,
  9907. scrollTop: scrollTop_1,
  9908. show: show_1,
  9909. siblings: siblings_1,
  9910. stop: stop_1,
  9911. styles: styles_1,
  9912. submit: submit_1,
  9913. text: text_1,
  9914. toggleClass: toggleClass_1,
  9915. touchend: touchend_1,
  9916. touchmove: touchmove_1,
  9917. touchstart: touchstart_1,
  9918. transform: transform_1,
  9919. transition: transition_1,
  9920. transitionEnd: transitionEnd_1,
  9921. trigger: trigger_1,
  9922. val: val_1,
  9923. value: value_1,
  9924. width: width_1
  9925. }, '__esModule', {value: true});
  9926. /**
  9927. * lodash (Custom Build) <https://lodash.com/>
  9928. * Build: `lodash modularize exports="npm" -o ./`
  9929. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  9930. * Released under MIT license <https://lodash.com/license>
  9931. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  9932. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  9933. */
  9934. /** Used as references for various `Number` constants. */
  9935. var MAX_SAFE_INTEGER = 9007199254740991;
  9936. /** `Object#toString` result references. */
  9937. var argsTag = '[object Arguments]',
  9938. funcTag = '[object Function]',
  9939. genTag = '[object GeneratorFunction]';
  9940. /** Used to detect unsigned integer values. */
  9941. var reIsUint = /^(?:0|[1-9]\d*)$/;
  9942. /**
  9943. * A specialized version of `_.forEach` for arrays without support for
  9944. * iteratee shorthands.
  9945. *
  9946. * @private
  9947. * @param {Array} [array] The array to iterate over.
  9948. * @param {Function} iteratee The function invoked per iteration.
  9949. * @returns {Array} Returns `array`.
  9950. */
  9951. function arrayEach(array, iteratee) {
  9952. var index = -1,
  9953. length = array ? array.length : 0;
  9954. while (++index < length) {
  9955. if (iteratee(array[index], index, array) === false) {
  9956. break;
  9957. }
  9958. }
  9959. return array;
  9960. }
  9961. /**
  9962. * The base implementation of `_.times` without support for iteratee shorthands
  9963. * or max array length checks.
  9964. *
  9965. * @private
  9966. * @param {number} n The number of times to invoke `iteratee`.
  9967. * @param {Function} iteratee The function invoked per iteration.
  9968. * @returns {Array} Returns the array of results.
  9969. */
  9970. function baseTimes(n, iteratee) {
  9971. var index = -1,
  9972. result = Array(n);
  9973. while (++index < n) {
  9974. result[index] = iteratee(index);
  9975. }
  9976. return result;
  9977. }
  9978. /**
  9979. * Creates a unary function that invokes `func` with its argument transformed.
  9980. *
  9981. * @private
  9982. * @param {Function} func The function to wrap.
  9983. * @param {Function} transform The argument transform.
  9984. * @returns {Function} Returns the new function.
  9985. */
  9986. function overArg(func, transform) {
  9987. return function(arg) {
  9988. return func(transform(arg));
  9989. };
  9990. }
  9991. /** Used for built-in method references. */
  9992. var objectProto$3 = Object.prototype;
  9993. /** Used to check objects for own properties. */
  9994. var hasOwnProperty$1 = objectProto$3.hasOwnProperty;
  9995. /**
  9996. * Used to resolve the
  9997. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  9998. * of values.
  9999. */
  10000. var objectToString$3 = objectProto$3.toString;
  10001. /** Built-in value references. */
  10002. var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
  10003. /* Built-in method references for those with the same name as other `lodash` methods. */
  10004. var nativeKeys = overArg(Object.keys, Object);
  10005. /**
  10006. * Creates an array of the enumerable property names of the array-like `value`.
  10007. *
  10008. * @private
  10009. * @param {*} value The value to query.
  10010. * @param {boolean} inherited Specify returning inherited property names.
  10011. * @returns {Array} Returns the array of property names.
  10012. */
  10013. function arrayLikeKeys(value, inherited) {
  10014. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  10015. // Safari 9 makes `arguments.length` enumerable in strict mode.
  10016. var result = (isArray(value) || isArguments(value))
  10017. ? baseTimes(value.length, String)
  10018. : [];
  10019. var length = result.length,
  10020. skipIndexes = !!length;
  10021. for (var key in value) {
  10022. if ((inherited || hasOwnProperty$1.call(value, key)) &&
  10023. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  10024. result.push(key);
  10025. }
  10026. }
  10027. return result;
  10028. }
  10029. /**
  10030. * The base implementation of `_.forEach` without support for iteratee shorthands.
  10031. *
  10032. * @private
  10033. * @param {Array|Object} collection The collection to iterate over.
  10034. * @param {Function} iteratee The function invoked per iteration.
  10035. * @returns {Array|Object} Returns `collection`.
  10036. */
  10037. var baseEach = createBaseEach(baseForOwn);
  10038. /**
  10039. * The base implementation of `baseForOwn` which iterates over `object`
  10040. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  10041. * Iteratee functions may exit iteration early by explicitly returning `false`.
  10042. *
  10043. * @private
  10044. * @param {Object} object The object to iterate over.
  10045. * @param {Function} iteratee The function invoked per iteration.
  10046. * @param {Function} keysFunc The function to get the keys of `object`.
  10047. * @returns {Object} Returns `object`.
  10048. */
  10049. var baseFor = createBaseFor();
  10050. /**
  10051. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  10052. *
  10053. * @private
  10054. * @param {Object} object The object to iterate over.
  10055. * @param {Function} iteratee The function invoked per iteration.
  10056. * @returns {Object} Returns `object`.
  10057. */
  10058. function baseForOwn(object, iteratee) {
  10059. return object && baseFor(object, iteratee, keys);
  10060. }
  10061. /**
  10062. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  10063. *
  10064. * @private
  10065. * @param {Object} object The object to query.
  10066. * @returns {Array} Returns the array of property names.
  10067. */
  10068. function baseKeys(object) {
  10069. if (!isPrototype(object)) {
  10070. return nativeKeys(object);
  10071. }
  10072. var result = [];
  10073. for (var key in Object(object)) {
  10074. if (hasOwnProperty$1.call(object, key) && key != 'constructor') {
  10075. result.push(key);
  10076. }
  10077. }
  10078. return result;
  10079. }
  10080. /**
  10081. * Creates a `baseEach` or `baseEachRight` function.
  10082. *
  10083. * @private
  10084. * @param {Function} eachFunc The function to iterate over a collection.
  10085. * @param {boolean} [fromRight] Specify iterating from right to left.
  10086. * @returns {Function} Returns the new base function.
  10087. */
  10088. function createBaseEach(eachFunc, fromRight) {
  10089. return function(collection, iteratee) {
  10090. if (collection == null) {
  10091. return collection;
  10092. }
  10093. if (!isArrayLike(collection)) {
  10094. return eachFunc(collection, iteratee);
  10095. }
  10096. var length = collection.length,
  10097. index = fromRight ? length : -1,
  10098. iterable = Object(collection);
  10099. while ((fromRight ? index-- : ++index < length)) {
  10100. if (iteratee(iterable[index], index, iterable) === false) {
  10101. break;
  10102. }
  10103. }
  10104. return collection;
  10105. };
  10106. }
  10107. /**
  10108. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  10109. *
  10110. * @private
  10111. * @param {boolean} [fromRight] Specify iterating from right to left.
  10112. * @returns {Function} Returns the new base function.
  10113. */
  10114. function createBaseFor(fromRight) {
  10115. return function(object, iteratee, keysFunc) {
  10116. var index = -1,
  10117. iterable = Object(object),
  10118. props = keysFunc(object),
  10119. length = props.length;
  10120. while (length--) {
  10121. var key = props[fromRight ? length : ++index];
  10122. if (iteratee(iterable[key], key, iterable) === false) {
  10123. break;
  10124. }
  10125. }
  10126. return object;
  10127. };
  10128. }
  10129. /**
  10130. * Checks if `value` is a valid array-like index.
  10131. *
  10132. * @private
  10133. * @param {*} value The value to check.
  10134. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  10135. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  10136. */
  10137. function isIndex(value, length) {
  10138. length = length == null ? MAX_SAFE_INTEGER : length;
  10139. return !!length &&
  10140. (typeof value == 'number' || reIsUint.test(value)) &&
  10141. (value > -1 && value % 1 == 0 && value < length);
  10142. }
  10143. /**
  10144. * Checks if `value` is likely a prototype object.
  10145. *
  10146. * @private
  10147. * @param {*} value The value to check.
  10148. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  10149. */
  10150. function isPrototype(value) {
  10151. var Ctor = value && value.constructor,
  10152. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
  10153. return value === proto;
  10154. }
  10155. /**
  10156. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  10157. * The iteratee is invoked with three arguments: (value, index|key, collection).
  10158. * Iteratee functions may exit iteration early by explicitly returning `false`.
  10159. *
  10160. * **Note:** As with other "Collections" methods, objects with a "length"
  10161. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  10162. * or `_.forOwn` for object iteration.
  10163. *
  10164. * @static
  10165. * @memberOf _
  10166. * @since 0.1.0
  10167. * @alias each
  10168. * @category Collection
  10169. * @param {Array|Object} collection The collection to iterate over.
  10170. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  10171. * @returns {Array|Object} Returns `collection`.
  10172. * @see _.forEachRight
  10173. * @example
  10174. *
  10175. * _([1, 2]).forEach(function(value) {
  10176. * console.log(value);
  10177. * });
  10178. * // => Logs `1` then `2`.
  10179. *
  10180. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  10181. * console.log(key);
  10182. * });
  10183. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  10184. */
  10185. function forEach(collection, iteratee) {
  10186. var func = isArray(collection) ? arrayEach : baseEach;
  10187. return func(collection, typeof iteratee == 'function' ? iteratee : identity);
  10188. }
  10189. /**
  10190. * Checks if `value` is likely an `arguments` object.
  10191. *
  10192. * @static
  10193. * @memberOf _
  10194. * @since 0.1.0
  10195. * @category Lang
  10196. * @param {*} value The value to check.
  10197. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  10198. * else `false`.
  10199. * @example
  10200. *
  10201. * _.isArguments(function() { return arguments; }());
  10202. * // => true
  10203. *
  10204. * _.isArguments([1, 2, 3]);
  10205. * // => false
  10206. */
  10207. function isArguments(value) {
  10208. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  10209. return isArrayLikeObject(value) && hasOwnProperty$1.call(value, 'callee') &&
  10210. (!propertyIsEnumerable.call(value, 'callee') || objectToString$3.call(value) == argsTag);
  10211. }
  10212. /**
  10213. * Checks if `value` is classified as an `Array` object.
  10214. *
  10215. * @static
  10216. * @memberOf _
  10217. * @since 0.1.0
  10218. * @category Lang
  10219. * @param {*} value The value to check.
  10220. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  10221. * @example
  10222. *
  10223. * _.isArray([1, 2, 3]);
  10224. * // => true
  10225. *
  10226. * _.isArray(document.body.children);
  10227. * // => false
  10228. *
  10229. * _.isArray('abc');
  10230. * // => false
  10231. *
  10232. * _.isArray(_.noop);
  10233. * // => false
  10234. */
  10235. var isArray = Array.isArray;
  10236. /**
  10237. * Checks if `value` is array-like. A value is considered array-like if it's
  10238. * not a function and has a `value.length` that's an integer greater than or
  10239. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  10240. *
  10241. * @static
  10242. * @memberOf _
  10243. * @since 4.0.0
  10244. * @category Lang
  10245. * @param {*} value The value to check.
  10246. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  10247. * @example
  10248. *
  10249. * _.isArrayLike([1, 2, 3]);
  10250. * // => true
  10251. *
  10252. * _.isArrayLike(document.body.children);
  10253. * // => true
  10254. *
  10255. * _.isArrayLike('abc');
  10256. * // => true
  10257. *
  10258. * _.isArrayLike(_.noop);
  10259. * // => false
  10260. */
  10261. function isArrayLike(value) {
  10262. return value != null && isLength(value.length) && !isFunction(value);
  10263. }
  10264. /**
  10265. * This method is like `_.isArrayLike` except that it also checks if `value`
  10266. * is an object.
  10267. *
  10268. * @static
  10269. * @memberOf _
  10270. * @since 4.0.0
  10271. * @category Lang
  10272. * @param {*} value The value to check.
  10273. * @returns {boolean} Returns `true` if `value` is an array-like object,
  10274. * else `false`.
  10275. * @example
  10276. *
  10277. * _.isArrayLikeObject([1, 2, 3]);
  10278. * // => true
  10279. *
  10280. * _.isArrayLikeObject(document.body.children);
  10281. * // => true
  10282. *
  10283. * _.isArrayLikeObject('abc');
  10284. * // => false
  10285. *
  10286. * _.isArrayLikeObject(_.noop);
  10287. * // => false
  10288. */
  10289. function isArrayLikeObject(value) {
  10290. return isObjectLike$3(value) && isArrayLike(value);
  10291. }
  10292. /**
  10293. * Checks if `value` is classified as a `Function` object.
  10294. *
  10295. * @static
  10296. * @memberOf _
  10297. * @since 0.1.0
  10298. * @category Lang
  10299. * @param {*} value The value to check.
  10300. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  10301. * @example
  10302. *
  10303. * _.isFunction(_);
  10304. * // => true
  10305. *
  10306. * _.isFunction(/abc/);
  10307. * // => false
  10308. */
  10309. function isFunction(value) {
  10310. // The use of `Object#toString` avoids issues with the `typeof` operator
  10311. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  10312. var tag = isObject$2(value) ? objectToString$3.call(value) : '';
  10313. return tag == funcTag || tag == genTag;
  10314. }
  10315. /**
  10316. * Checks if `value` is a valid array-like length.
  10317. *
  10318. * **Note:** This method is loosely based on
  10319. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  10320. *
  10321. * @static
  10322. * @memberOf _
  10323. * @since 4.0.0
  10324. * @category Lang
  10325. * @param {*} value The value to check.
  10326. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  10327. * @example
  10328. *
  10329. * _.isLength(3);
  10330. * // => true
  10331. *
  10332. * _.isLength(Number.MIN_VALUE);
  10333. * // => false
  10334. *
  10335. * _.isLength(Infinity);
  10336. * // => false
  10337. *
  10338. * _.isLength('3');
  10339. * // => false
  10340. */
  10341. function isLength(value) {
  10342. return typeof value == 'number' &&
  10343. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  10344. }
  10345. /**
  10346. * Checks if `value` is the
  10347. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  10348. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  10349. *
  10350. * @static
  10351. * @memberOf _
  10352. * @since 0.1.0
  10353. * @category Lang
  10354. * @param {*} value The value to check.
  10355. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  10356. * @example
  10357. *
  10358. * _.isObject({});
  10359. * // => true
  10360. *
  10361. * _.isObject([1, 2, 3]);
  10362. * // => true
  10363. *
  10364. * _.isObject(_.noop);
  10365. * // => true
  10366. *
  10367. * _.isObject(null);
  10368. * // => false
  10369. */
  10370. function isObject$2(value) {
  10371. var type = typeof value;
  10372. return !!value && (type == 'object' || type == 'function');
  10373. }
  10374. /**
  10375. * Checks if `value` is object-like. A value is object-like if it's not `null`
  10376. * and has a `typeof` result of "object".
  10377. *
  10378. * @static
  10379. * @memberOf _
  10380. * @since 4.0.0
  10381. * @category Lang
  10382. * @param {*} value The value to check.
  10383. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  10384. * @example
  10385. *
  10386. * _.isObjectLike({});
  10387. * // => true
  10388. *
  10389. * _.isObjectLike([1, 2, 3]);
  10390. * // => true
  10391. *
  10392. * _.isObjectLike(_.noop);
  10393. * // => false
  10394. *
  10395. * _.isObjectLike(null);
  10396. * // => false
  10397. */
  10398. function isObjectLike$3(value) {
  10399. return !!value && typeof value == 'object';
  10400. }
  10401. /**
  10402. * Creates an array of the own enumerable property names of `object`.
  10403. *
  10404. * **Note:** Non-object values are coerced to objects. See the
  10405. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  10406. * for more details.
  10407. *
  10408. * @static
  10409. * @since 0.1.0
  10410. * @memberOf _
  10411. * @category Object
  10412. * @param {Object} object The object to query.
  10413. * @returns {Array} Returns the array of property names.
  10414. * @example
  10415. *
  10416. * function Foo() {
  10417. * this.a = 1;
  10418. * this.b = 2;
  10419. * }
  10420. *
  10421. * Foo.prototype.c = 3;
  10422. *
  10423. * _.keys(new Foo);
  10424. * // => ['a', 'b'] (iteration order is not guaranteed)
  10425. *
  10426. * _.keys('hi');
  10427. * // => ['0', '1']
  10428. */
  10429. function keys(object) {
  10430. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  10431. }
  10432. /**
  10433. * This method returns the first argument it receives.
  10434. *
  10435. * @static
  10436. * @since 0.1.0
  10437. * @memberOf _
  10438. * @category Util
  10439. * @param {*} value Any value.
  10440. * @returns {*} Returns `value`.
  10441. * @example
  10442. *
  10443. * var object = { 'a': 1 };
  10444. *
  10445. * console.log(_.identity(object) === object);
  10446. * // => true
  10447. */
  10448. function identity(value) {
  10449. return value;
  10450. }
  10451. var lodash_foreach = forEach;
  10452. let urlAlphabet$1 =
  10453. 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
  10454. var urlAlphabet_1 = { urlAlphabet: urlAlphabet$1 };
  10455. let { urlAlphabet } = urlAlphabet_1;
  10456. {
  10457. if (
  10458. typeof navigator !== 'undefined' &&
  10459. navigator.product === 'ReactNative' &&
  10460. typeof crypto === 'undefined'
  10461. ) {
  10462. throw new Error(
  10463. 'React Native does not have a built-in secure random generator. ' +
  10464. 'If you don’t need unpredictable IDs use `nanoid/non-secure`. ' +
  10465. 'For secure IDs, import `react-native-get-random-values` ' +
  10466. 'before Nano ID.'
  10467. )
  10468. }
  10469. if (typeof msCrypto !== 'undefined' && typeof crypto === 'undefined') {
  10470. throw new Error(
  10471. 'Import file with `if (!window.crypto) window.crypto = window.msCrypto`' +
  10472. ' before importing Nano ID to fix IE 11 support'
  10473. )
  10474. }
  10475. if (typeof crypto === 'undefined') {
  10476. throw new Error(
  10477. 'Your browser does not have secure random generator. ' +
  10478. 'If you don’t need unpredictable IDs, you can use nanoid/non-secure.'
  10479. )
  10480. }
  10481. }
  10482. let random = bytes => crypto.getRandomValues(new Uint8Array(bytes));
  10483. let customRandom = (alphabet, size, getRandom) => {
  10484. let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1;
  10485. let step = -~((1.6 * mask * size) / alphabet.length);
  10486. return () => {
  10487. let id = '';
  10488. while (true) {
  10489. let bytes = getRandom(step);
  10490. let j = step;
  10491. while (j--) {
  10492. id += alphabet[bytes[j] & mask] || '';
  10493. if (id.length === size) return id
  10494. }
  10495. }
  10496. }
  10497. };
  10498. let customAlphabet = (alphabet, size) => customRandom(alphabet, size, random);
  10499. let nanoid$2 = (size = 21) => {
  10500. let id = '';
  10501. let bytes = crypto.getRandomValues(new Uint8Array(size));
  10502. while (size--) {
  10503. let byte = bytes[size] & 63;
  10504. if (byte < 36) {
  10505. id += byte.toString(36);
  10506. } else if (byte < 62) {
  10507. id += (byte - 26).toString(36).toUpperCase();
  10508. } else if (byte < 63) {
  10509. id += '_';
  10510. } else {
  10511. id += '-';
  10512. }
  10513. }
  10514. return id
  10515. };
  10516. var index_browser = { nanoid: nanoid$2, customAlphabet, customRandom, urlAlphabet, random };
  10517. /**
  10518. * lodash (Custom Build) <https://lodash.com/>
  10519. * Build: `lodash modularize exports="npm" -o ./`
  10520. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  10521. * Released under MIT license <https://lodash.com/license>
  10522. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  10523. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  10524. */
  10525. /** Used as the `TypeError` message for "Functions" methods. */
  10526. var FUNC_ERROR_TEXT$1 = 'Expected a function';
  10527. /** Used as references for various `Number` constants. */
  10528. var NAN$1 = 0 / 0;
  10529. /** `Object#toString` result references. */
  10530. var symbolTag$2 = '[object Symbol]';
  10531. /** Used to match leading and trailing whitespace. */
  10532. var reTrim$1 = /^\s+|\s+$/g;
  10533. /** Used to detect bad signed hexadecimal string values. */
  10534. var reIsBadHex$1 = /^[-+]0x[0-9a-f]+$/i;
  10535. /** Used to detect binary string values. */
  10536. var reIsBinary$1 = /^0b[01]+$/i;
  10537. /** Used to detect octal string values. */
  10538. var reIsOctal$1 = /^0o[0-7]+$/i;
  10539. /** Built-in method references without a dependency on `root`. */
  10540. var freeParseInt$1 = parseInt;
  10541. /** Detect free variable `global` from Node.js. */
  10542. var freeGlobal$2 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  10543. /** Detect free variable `self`. */
  10544. var freeSelf$2 = typeof self == 'object' && self && self.Object === Object && self;
  10545. /** Used as a reference to the global object. */
  10546. var root$2 = freeGlobal$2 || freeSelf$2 || Function('return this')();
  10547. /** Used for built-in method references. */
  10548. var objectProto$2 = Object.prototype;
  10549. /**
  10550. * Used to resolve the
  10551. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  10552. * of values.
  10553. */
  10554. var objectToString$2 = objectProto$2.toString;
  10555. /* Built-in method references for those with the same name as other `lodash` methods. */
  10556. var nativeMax$1 = Math.max,
  10557. nativeMin$1 = Math.min;
  10558. /**
  10559. * Gets the timestamp of the number of milliseconds that have elapsed since
  10560. * the Unix epoch (1 January 1970 00:00:00 UTC).
  10561. *
  10562. * @static
  10563. * @memberOf _
  10564. * @since 2.4.0
  10565. * @category Date
  10566. * @returns {number} Returns the timestamp.
  10567. * @example
  10568. *
  10569. * _.defer(function(stamp) {
  10570. * console.log(_.now() - stamp);
  10571. * }, _.now());
  10572. * // => Logs the number of milliseconds it took for the deferred invocation.
  10573. */
  10574. var now$1 = function() {
  10575. return root$2.Date.now();
  10576. };
  10577. /**
  10578. * Creates a debounced function that delays invoking `func` until after `wait`
  10579. * milliseconds have elapsed since the last time the debounced function was
  10580. * invoked. The debounced function comes with a `cancel` method to cancel
  10581. * delayed `func` invocations and a `flush` method to immediately invoke them.
  10582. * Provide `options` to indicate whether `func` should be invoked on the
  10583. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  10584. * with the last arguments provided to the debounced function. Subsequent
  10585. * calls to the debounced function return the result of the last `func`
  10586. * invocation.
  10587. *
  10588. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10589. * invoked on the trailing edge of the timeout only if the debounced function
  10590. * is invoked more than once during the `wait` timeout.
  10591. *
  10592. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10593. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10594. *
  10595. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10596. * for details over the differences between `_.debounce` and `_.throttle`.
  10597. *
  10598. * @static
  10599. * @memberOf _
  10600. * @since 0.1.0
  10601. * @category Function
  10602. * @param {Function} func The function to debounce.
  10603. * @param {number} [wait=0] The number of milliseconds to delay.
  10604. * @param {Object} [options={}] The options object.
  10605. * @param {boolean} [options.leading=false]
  10606. * Specify invoking on the leading edge of the timeout.
  10607. * @param {number} [options.maxWait]
  10608. * The maximum time `func` is allowed to be delayed before it's invoked.
  10609. * @param {boolean} [options.trailing=true]
  10610. * Specify invoking on the trailing edge of the timeout.
  10611. * @returns {Function} Returns the new debounced function.
  10612. * @example
  10613. *
  10614. * // Avoid costly calculations while the window size is in flux.
  10615. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  10616. *
  10617. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  10618. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  10619. * 'leading': true,
  10620. * 'trailing': false
  10621. * }));
  10622. *
  10623. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  10624. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  10625. * var source = new EventSource('/stream');
  10626. * jQuery(source).on('message', debounced);
  10627. *
  10628. * // Cancel the trailing debounced invocation.
  10629. * jQuery(window).on('popstate', debounced.cancel);
  10630. */
  10631. function debounce$2(func, wait, options) {
  10632. var lastArgs,
  10633. lastThis,
  10634. maxWait,
  10635. result,
  10636. timerId,
  10637. lastCallTime,
  10638. lastInvokeTime = 0,
  10639. leading = false,
  10640. maxing = false,
  10641. trailing = true;
  10642. if (typeof func != 'function') {
  10643. throw new TypeError(FUNC_ERROR_TEXT$1);
  10644. }
  10645. wait = toNumber$1(wait) || 0;
  10646. if (isObject$1(options)) {
  10647. leading = !!options.leading;
  10648. maxing = 'maxWait' in options;
  10649. maxWait = maxing ? nativeMax$1(toNumber$1(options.maxWait) || 0, wait) : maxWait;
  10650. trailing = 'trailing' in options ? !!options.trailing : trailing;
  10651. }
  10652. function invokeFunc(time) {
  10653. var args = lastArgs,
  10654. thisArg = lastThis;
  10655. lastArgs = lastThis = undefined;
  10656. lastInvokeTime = time;
  10657. result = func.apply(thisArg, args);
  10658. return result;
  10659. }
  10660. function leadingEdge(time) {
  10661. // Reset any `maxWait` timer.
  10662. lastInvokeTime = time;
  10663. // Start the timer for the trailing edge.
  10664. timerId = setTimeout(timerExpired, wait);
  10665. // Invoke the leading edge.
  10666. return leading ? invokeFunc(time) : result;
  10667. }
  10668. function remainingWait(time) {
  10669. var timeSinceLastCall = time - lastCallTime,
  10670. timeSinceLastInvoke = time - lastInvokeTime,
  10671. result = wait - timeSinceLastCall;
  10672. return maxing ? nativeMin$1(result, maxWait - timeSinceLastInvoke) : result;
  10673. }
  10674. function shouldInvoke(time) {
  10675. var timeSinceLastCall = time - lastCallTime,
  10676. timeSinceLastInvoke = time - lastInvokeTime;
  10677. // Either this is the first call, activity has stopped and we're at the
  10678. // trailing edge, the system time has gone backwards and we're treating
  10679. // it as the trailing edge, or we've hit the `maxWait` limit.
  10680. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  10681. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  10682. }
  10683. function timerExpired() {
  10684. var time = now$1();
  10685. if (shouldInvoke(time)) {
  10686. return trailingEdge(time);
  10687. }
  10688. // Restart the timer.
  10689. timerId = setTimeout(timerExpired, remainingWait(time));
  10690. }
  10691. function trailingEdge(time) {
  10692. timerId = undefined;
  10693. // Only invoke if we have `lastArgs` which means `func` has been
  10694. // debounced at least once.
  10695. if (trailing && lastArgs) {
  10696. return invokeFunc(time);
  10697. }
  10698. lastArgs = lastThis = undefined;
  10699. return result;
  10700. }
  10701. function cancel() {
  10702. if (timerId !== undefined) {
  10703. clearTimeout(timerId);
  10704. }
  10705. lastInvokeTime = 0;
  10706. lastArgs = lastCallTime = lastThis = timerId = undefined;
  10707. }
  10708. function flush() {
  10709. return timerId === undefined ? result : trailingEdge(now$1());
  10710. }
  10711. function debounced() {
  10712. var time = now$1(),
  10713. isInvoking = shouldInvoke(time);
  10714. lastArgs = arguments;
  10715. lastThis = this;
  10716. lastCallTime = time;
  10717. if (isInvoking) {
  10718. if (timerId === undefined) {
  10719. return leadingEdge(lastCallTime);
  10720. }
  10721. if (maxing) {
  10722. // Handle invocations in a tight loop.
  10723. timerId = setTimeout(timerExpired, wait);
  10724. return invokeFunc(lastCallTime);
  10725. }
  10726. }
  10727. if (timerId === undefined) {
  10728. timerId = setTimeout(timerExpired, wait);
  10729. }
  10730. return result;
  10731. }
  10732. debounced.cancel = cancel;
  10733. debounced.flush = flush;
  10734. return debounced;
  10735. }
  10736. /**
  10737. * Creates a throttled function that only invokes `func` at most once per
  10738. * every `wait` milliseconds. The throttled function comes with a `cancel`
  10739. * method to cancel delayed `func` invocations and a `flush` method to
  10740. * immediately invoke them. Provide `options` to indicate whether `func`
  10741. * should be invoked on the leading and/or trailing edge of the `wait`
  10742. * timeout. The `func` is invoked with the last arguments provided to the
  10743. * throttled function. Subsequent calls to the throttled function return the
  10744. * result of the last `func` invocation.
  10745. *
  10746. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  10747. * invoked on the trailing edge of the timeout only if the throttled function
  10748. * is invoked more than once during the `wait` timeout.
  10749. *
  10750. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  10751. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  10752. *
  10753. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  10754. * for details over the differences between `_.throttle` and `_.debounce`.
  10755. *
  10756. * @static
  10757. * @memberOf _
  10758. * @since 0.1.0
  10759. * @category Function
  10760. * @param {Function} func The function to throttle.
  10761. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  10762. * @param {Object} [options={}] The options object.
  10763. * @param {boolean} [options.leading=true]
  10764. * Specify invoking on the leading edge of the timeout.
  10765. * @param {boolean} [options.trailing=true]
  10766. * Specify invoking on the trailing edge of the timeout.
  10767. * @returns {Function} Returns the new throttled function.
  10768. * @example
  10769. *
  10770. * // Avoid excessively updating the position while scrolling.
  10771. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  10772. *
  10773. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  10774. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  10775. * jQuery(element).on('click', throttled);
  10776. *
  10777. * // Cancel the trailing throttled invocation.
  10778. * jQuery(window).on('popstate', throttled.cancel);
  10779. */
  10780. function throttle(func, wait, options) {
  10781. var leading = true,
  10782. trailing = true;
  10783. if (typeof func != 'function') {
  10784. throw new TypeError(FUNC_ERROR_TEXT$1);
  10785. }
  10786. if (isObject$1(options)) {
  10787. leading = 'leading' in options ? !!options.leading : leading;
  10788. trailing = 'trailing' in options ? !!options.trailing : trailing;
  10789. }
  10790. return debounce$2(func, wait, {
  10791. 'leading': leading,
  10792. 'maxWait': wait,
  10793. 'trailing': trailing
  10794. });
  10795. }
  10796. /**
  10797. * Checks if `value` is the
  10798. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  10799. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  10800. *
  10801. * @static
  10802. * @memberOf _
  10803. * @since 0.1.0
  10804. * @category Lang
  10805. * @param {*} value The value to check.
  10806. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  10807. * @example
  10808. *
  10809. * _.isObject({});
  10810. * // => true
  10811. *
  10812. * _.isObject([1, 2, 3]);
  10813. * // => true
  10814. *
  10815. * _.isObject(_.noop);
  10816. * // => true
  10817. *
  10818. * _.isObject(null);
  10819. * // => false
  10820. */
  10821. function isObject$1(value) {
  10822. var type = typeof value;
  10823. return !!value && (type == 'object' || type == 'function');
  10824. }
  10825. /**
  10826. * Checks if `value` is object-like. A value is object-like if it's not `null`
  10827. * and has a `typeof` result of "object".
  10828. *
  10829. * @static
  10830. * @memberOf _
  10831. * @since 4.0.0
  10832. * @category Lang
  10833. * @param {*} value The value to check.
  10834. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  10835. * @example
  10836. *
  10837. * _.isObjectLike({});
  10838. * // => true
  10839. *
  10840. * _.isObjectLike([1, 2, 3]);
  10841. * // => true
  10842. *
  10843. * _.isObjectLike(_.noop);
  10844. * // => false
  10845. *
  10846. * _.isObjectLike(null);
  10847. * // => false
  10848. */
  10849. function isObjectLike$2(value) {
  10850. return !!value && typeof value == 'object';
  10851. }
  10852. /**
  10853. * Checks if `value` is classified as a `Symbol` primitive or object.
  10854. *
  10855. * @static
  10856. * @memberOf _
  10857. * @since 4.0.0
  10858. * @category Lang
  10859. * @param {*} value The value to check.
  10860. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  10861. * @example
  10862. *
  10863. * _.isSymbol(Symbol.iterator);
  10864. * // => true
  10865. *
  10866. * _.isSymbol('abc');
  10867. * // => false
  10868. */
  10869. function isSymbol$2(value) {
  10870. return typeof value == 'symbol' ||
  10871. (isObjectLike$2(value) && objectToString$2.call(value) == symbolTag$2);
  10872. }
  10873. /**
  10874. * Converts `value` to a number.
  10875. *
  10876. * @static
  10877. * @memberOf _
  10878. * @since 4.0.0
  10879. * @category Lang
  10880. * @param {*} value The value to process.
  10881. * @returns {number} Returns the number.
  10882. * @example
  10883. *
  10884. * _.toNumber(3.2);
  10885. * // => 3.2
  10886. *
  10887. * _.toNumber(Number.MIN_VALUE);
  10888. * // => 5e-324
  10889. *
  10890. * _.toNumber(Infinity);
  10891. * // => Infinity
  10892. *
  10893. * _.toNumber('3.2');
  10894. * // => 3.2
  10895. */
  10896. function toNumber$1(value) {
  10897. if (typeof value == 'number') {
  10898. return value;
  10899. }
  10900. if (isSymbol$2(value)) {
  10901. return NAN$1;
  10902. }
  10903. if (isObject$1(value)) {
  10904. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  10905. value = isObject$1(other) ? (other + '') : other;
  10906. }
  10907. if (typeof value != 'string') {
  10908. return value === 0 ? value : +value;
  10909. }
  10910. value = value.replace(reTrim$1, '');
  10911. var isBinary = reIsBinary$1.test(value);
  10912. return (isBinary || reIsOctal$1.test(value))
  10913. ? freeParseInt$1(value.slice(2), isBinary ? 2 : 8)
  10914. : (reIsBadHex$1.test(value) ? NAN$1 : +value);
  10915. }
  10916. var lodash_throttle = throttle;
  10917. var snabbdom_cjs = createCommonjsModule$1(function (module, exports) {
  10918. Object.defineProperty(exports, '__esModule', { value: true });
  10919. function createElement(tagName, options) {
  10920. return document.createElement(tagName, options);
  10921. }
  10922. function createElementNS(namespaceURI, qualifiedName, options) {
  10923. return document.createElementNS(namespaceURI, qualifiedName, options);
  10924. }
  10925. function createTextNode(text) {
  10926. return document.createTextNode(text);
  10927. }
  10928. function createComment(text) {
  10929. return document.createComment(text);
  10930. }
  10931. function insertBefore(parentNode, newNode, referenceNode) {
  10932. parentNode.insertBefore(newNode, referenceNode);
  10933. }
  10934. function removeChild(node, child) {
  10935. node.removeChild(child);
  10936. }
  10937. function appendChild(node, child) {
  10938. node.appendChild(child);
  10939. }
  10940. function parentNode(node) {
  10941. return node.parentNode;
  10942. }
  10943. function nextSibling(node) {
  10944. return node.nextSibling;
  10945. }
  10946. function tagName(elm) {
  10947. return elm.tagName;
  10948. }
  10949. function setTextContent(node, text) {
  10950. node.textContent = text;
  10951. }
  10952. function getTextContent(node) {
  10953. return node.textContent;
  10954. }
  10955. function isElement(node) {
  10956. return node.nodeType === 1;
  10957. }
  10958. function isText(node) {
  10959. return node.nodeType === 3;
  10960. }
  10961. function isComment(node) {
  10962. return node.nodeType === 8;
  10963. }
  10964. const htmlDomApi = {
  10965. createElement,
  10966. createElementNS,
  10967. createTextNode,
  10968. createComment,
  10969. insertBefore,
  10970. removeChild,
  10971. appendChild,
  10972. parentNode,
  10973. nextSibling,
  10974. tagName,
  10975. setTextContent,
  10976. getTextContent,
  10977. isElement,
  10978. isText,
  10979. isComment,
  10980. };
  10981. function vnode(sel, data, children, text, elm) {
  10982. const key = data === undefined ? undefined : data.key;
  10983. return { sel, data, children, text, elm, key };
  10984. }
  10985. const array = Array.isArray;
  10986. function primitive(s) {
  10987. return typeof s === "string" ||
  10988. typeof s === "number" ||
  10989. s instanceof String ||
  10990. s instanceof Number;
  10991. }
  10992. function isUndef(s) {
  10993. return s === undefined;
  10994. }
  10995. function isDef(s) {
  10996. return s !== undefined;
  10997. }
  10998. const emptyNode = vnode("", {}, [], undefined, undefined);
  10999. function sameVnode(vnode1, vnode2) {
  11000. var _a, _b;
  11001. const isSameKey = vnode1.key === vnode2.key;
  11002. const isSameIs = ((_a = vnode1.data) === null || _a === void 0 ? void 0 : _a.is) === ((_b = vnode2.data) === null || _b === void 0 ? void 0 : _b.is);
  11003. const isSameSel = vnode1.sel === vnode2.sel;
  11004. return isSameSel && isSameKey && isSameIs;
  11005. }
  11006. function isVnode(vnode) {
  11007. return vnode.sel !== undefined;
  11008. }
  11009. function createKeyToOldIdx(children, beginIdx, endIdx) {
  11010. var _a;
  11011. const map = {};
  11012. for (let i = beginIdx; i <= endIdx; ++i) {
  11013. const key = (_a = children[i]) === null || _a === void 0 ? void 0 : _a.key;
  11014. if (key !== undefined) {
  11015. map[key] = i;
  11016. }
  11017. }
  11018. return map;
  11019. }
  11020. const hooks = [
  11021. "create",
  11022. "update",
  11023. "remove",
  11024. "destroy",
  11025. "pre",
  11026. "post",
  11027. ];
  11028. function init$1(modules, domApi) {
  11029. const cbs = {
  11030. create: [],
  11031. update: [],
  11032. remove: [],
  11033. destroy: [],
  11034. pre: [],
  11035. post: [],
  11036. };
  11037. const api = domApi !== undefined ? domApi : htmlDomApi;
  11038. for (const hook of hooks) {
  11039. for (const module of modules) {
  11040. const currentHook = module[hook];
  11041. if (currentHook !== undefined) {
  11042. cbs[hook].push(currentHook);
  11043. }
  11044. }
  11045. }
  11046. function emptyNodeAt(elm) {
  11047. const id = elm.id ? "#" + elm.id : "";
  11048. // elm.className doesn't return a string when elm is an SVG element inside a shadowRoot.
  11049. // https://stackoverflow.com/questions/29454340/detecting-classname-of-svganimatedstring
  11050. const classes = elm.getAttribute("class");
  11051. const c = classes ? "." + classes.split(" ").join(".") : "";
  11052. return vnode(api.tagName(elm).toLowerCase() + id + c, {}, [], undefined, elm);
  11053. }
  11054. function createRmCb(childElm, listeners) {
  11055. return function rmCb() {
  11056. if (--listeners === 0) {
  11057. const parent = api.parentNode(childElm);
  11058. api.removeChild(parent, childElm);
  11059. }
  11060. };
  11061. }
  11062. function createElm(vnode, insertedVnodeQueue) {
  11063. var _a, _b;
  11064. let i;
  11065. let data = vnode.data;
  11066. if (data !== undefined) {
  11067. const init = (_a = data.hook) === null || _a === void 0 ? void 0 : _a.init;
  11068. if (isDef(init)) {
  11069. init(vnode);
  11070. data = vnode.data;
  11071. }
  11072. }
  11073. const children = vnode.children;
  11074. const sel = vnode.sel;
  11075. if (sel === "!") {
  11076. if (isUndef(vnode.text)) {
  11077. vnode.text = "";
  11078. }
  11079. vnode.elm = api.createComment(vnode.text);
  11080. }
  11081. else if (sel !== undefined) {
  11082. // Parse selector
  11083. const hashIdx = sel.indexOf("#");
  11084. const dotIdx = sel.indexOf(".", hashIdx);
  11085. const hash = hashIdx > 0 ? hashIdx : sel.length;
  11086. const dot = dotIdx > 0 ? dotIdx : sel.length;
  11087. const tag = hashIdx !== -1 || dotIdx !== -1
  11088. ? sel.slice(0, Math.min(hash, dot))
  11089. : sel;
  11090. const elm = (vnode.elm =
  11091. isDef(data) && isDef((i = data.ns))
  11092. ? api.createElementNS(i, tag, data)
  11093. : api.createElement(tag, data));
  11094. if (hash < dot)
  11095. elm.setAttribute("id", sel.slice(hash + 1, dot));
  11096. if (dotIdx > 0)
  11097. elm.setAttribute("class", sel.slice(dot + 1).replace(/\./g, " "));
  11098. for (i = 0; i < cbs.create.length; ++i)
  11099. cbs.create[i](emptyNode, vnode);
  11100. if (array(children)) {
  11101. for (i = 0; i < children.length; ++i) {
  11102. const ch = children[i];
  11103. if (ch != null) {
  11104. api.appendChild(elm, createElm(ch, insertedVnodeQueue));
  11105. }
  11106. }
  11107. }
  11108. else if (primitive(vnode.text)) {
  11109. api.appendChild(elm, api.createTextNode(vnode.text));
  11110. }
  11111. const hook = vnode.data.hook;
  11112. if (isDef(hook)) {
  11113. (_b = hook.create) === null || _b === void 0 ? void 0 : _b.call(hook, emptyNode, vnode);
  11114. if (hook.insert) {
  11115. insertedVnodeQueue.push(vnode);
  11116. }
  11117. }
  11118. }
  11119. else {
  11120. vnode.elm = api.createTextNode(vnode.text);
  11121. }
  11122. return vnode.elm;
  11123. }
  11124. function addVnodes(parentElm, before, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  11125. for (; startIdx <= endIdx; ++startIdx) {
  11126. const ch = vnodes[startIdx];
  11127. if (ch != null) {
  11128. api.insertBefore(parentElm, createElm(ch, insertedVnodeQueue), before);
  11129. }
  11130. }
  11131. }
  11132. function invokeDestroyHook(vnode) {
  11133. var _a, _b;
  11134. const data = vnode.data;
  11135. if (data !== undefined) {
  11136. (_b = (_a = data === null || data === void 0 ? void 0 : data.hook) === null || _a === void 0 ? void 0 : _a.destroy) === null || _b === void 0 ? void 0 : _b.call(_a, vnode);
  11137. for (let i = 0; i < cbs.destroy.length; ++i)
  11138. cbs.destroy[i](vnode);
  11139. if (vnode.children !== undefined) {
  11140. for (let j = 0; j < vnode.children.length; ++j) {
  11141. const child = vnode.children[j];
  11142. if (child != null && typeof child !== "string") {
  11143. invokeDestroyHook(child);
  11144. }
  11145. }
  11146. }
  11147. }
  11148. }
  11149. function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
  11150. var _a, _b;
  11151. for (; startIdx <= endIdx; ++startIdx) {
  11152. let listeners;
  11153. let rm;
  11154. const ch = vnodes[startIdx];
  11155. if (ch != null) {
  11156. if (isDef(ch.sel)) {
  11157. invokeDestroyHook(ch);
  11158. listeners = cbs.remove.length + 1;
  11159. rm = createRmCb(ch.elm, listeners);
  11160. for (let i = 0; i < cbs.remove.length; ++i)
  11161. cbs.remove[i](ch, rm);
  11162. const removeHook = (_b = (_a = ch === null || ch === void 0 ? void 0 : ch.data) === null || _a === void 0 ? void 0 : _a.hook) === null || _b === void 0 ? void 0 : _b.remove;
  11163. if (isDef(removeHook)) {
  11164. removeHook(ch, rm);
  11165. }
  11166. else {
  11167. rm();
  11168. }
  11169. }
  11170. else {
  11171. // Text node
  11172. api.removeChild(parentElm, ch.elm);
  11173. }
  11174. }
  11175. }
  11176. }
  11177. function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue) {
  11178. let oldStartIdx = 0;
  11179. let newStartIdx = 0;
  11180. let oldEndIdx = oldCh.length - 1;
  11181. let oldStartVnode = oldCh[0];
  11182. let oldEndVnode = oldCh[oldEndIdx];
  11183. let newEndIdx = newCh.length - 1;
  11184. let newStartVnode = newCh[0];
  11185. let newEndVnode = newCh[newEndIdx];
  11186. let oldKeyToIdx;
  11187. let idxInOld;
  11188. let elmToMove;
  11189. let before;
  11190. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  11191. if (oldStartVnode == null) {
  11192. oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
  11193. }
  11194. else if (oldEndVnode == null) {
  11195. oldEndVnode = oldCh[--oldEndIdx];
  11196. }
  11197. else if (newStartVnode == null) {
  11198. newStartVnode = newCh[++newStartIdx];
  11199. }
  11200. else if (newEndVnode == null) {
  11201. newEndVnode = newCh[--newEndIdx];
  11202. }
  11203. else if (sameVnode(oldStartVnode, newStartVnode)) {
  11204. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  11205. oldStartVnode = oldCh[++oldStartIdx];
  11206. newStartVnode = newCh[++newStartIdx];
  11207. }
  11208. else if (sameVnode(oldEndVnode, newEndVnode)) {
  11209. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  11210. oldEndVnode = oldCh[--oldEndIdx];
  11211. newEndVnode = newCh[--newEndIdx];
  11212. }
  11213. else if (sameVnode(oldStartVnode, newEndVnode)) {
  11214. // Vnode moved right
  11215. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  11216. api.insertBefore(parentElm, oldStartVnode.elm, api.nextSibling(oldEndVnode.elm));
  11217. oldStartVnode = oldCh[++oldStartIdx];
  11218. newEndVnode = newCh[--newEndIdx];
  11219. }
  11220. else if (sameVnode(oldEndVnode, newStartVnode)) {
  11221. // Vnode moved left
  11222. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  11223. api.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  11224. oldEndVnode = oldCh[--oldEndIdx];
  11225. newStartVnode = newCh[++newStartIdx];
  11226. }
  11227. else {
  11228. if (oldKeyToIdx === undefined) {
  11229. oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
  11230. }
  11231. idxInOld = oldKeyToIdx[newStartVnode.key];
  11232. if (isUndef(idxInOld)) {
  11233. // New element
  11234. api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
  11235. }
  11236. else {
  11237. elmToMove = oldCh[idxInOld];
  11238. if (elmToMove.sel !== newStartVnode.sel) {
  11239. api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
  11240. }
  11241. else {
  11242. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  11243. oldCh[idxInOld] = undefined;
  11244. api.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
  11245. }
  11246. }
  11247. newStartVnode = newCh[++newStartIdx];
  11248. }
  11249. }
  11250. if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
  11251. if (oldStartIdx > oldEndIdx) {
  11252. before = newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].elm;
  11253. addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  11254. }
  11255. else {
  11256. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  11257. }
  11258. }
  11259. }
  11260. function patchVnode(oldVnode, vnode, insertedVnodeQueue) {
  11261. var _a, _b, _c, _d, _e;
  11262. const hook = (_a = vnode.data) === null || _a === void 0 ? void 0 : _a.hook;
  11263. (_b = hook === null || hook === void 0 ? void 0 : hook.prepatch) === null || _b === void 0 ? void 0 : _b.call(hook, oldVnode, vnode);
  11264. const elm = (vnode.elm = oldVnode.elm);
  11265. const oldCh = oldVnode.children;
  11266. const ch = vnode.children;
  11267. if (oldVnode === vnode)
  11268. return;
  11269. if (vnode.data !== undefined) {
  11270. for (let i = 0; i < cbs.update.length; ++i)
  11271. cbs.update[i](oldVnode, vnode);
  11272. (_d = (_c = vnode.data.hook) === null || _c === void 0 ? void 0 : _c.update) === null || _d === void 0 ? void 0 : _d.call(_c, oldVnode, vnode);
  11273. }
  11274. if (isUndef(vnode.text)) {
  11275. if (isDef(oldCh) && isDef(ch)) {
  11276. if (oldCh !== ch)
  11277. updateChildren(elm, oldCh, ch, insertedVnodeQueue);
  11278. }
  11279. else if (isDef(ch)) {
  11280. if (isDef(oldVnode.text))
  11281. api.setTextContent(elm, "");
  11282. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  11283. }
  11284. else if (isDef(oldCh)) {
  11285. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  11286. }
  11287. else if (isDef(oldVnode.text)) {
  11288. api.setTextContent(elm, "");
  11289. }
  11290. }
  11291. else if (oldVnode.text !== vnode.text) {
  11292. if (isDef(oldCh)) {
  11293. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  11294. }
  11295. api.setTextContent(elm, vnode.text);
  11296. }
  11297. (_e = hook === null || hook === void 0 ? void 0 : hook.postpatch) === null || _e === void 0 ? void 0 : _e.call(hook, oldVnode, vnode);
  11298. }
  11299. return function patch(oldVnode, vnode) {
  11300. let i, elm, parent;
  11301. const insertedVnodeQueue = [];
  11302. for (i = 0; i < cbs.pre.length; ++i)
  11303. cbs.pre[i]();
  11304. if (!isVnode(oldVnode)) {
  11305. oldVnode = emptyNodeAt(oldVnode);
  11306. }
  11307. if (sameVnode(oldVnode, vnode)) {
  11308. patchVnode(oldVnode, vnode, insertedVnodeQueue);
  11309. }
  11310. else {
  11311. elm = oldVnode.elm;
  11312. parent = api.parentNode(elm);
  11313. createElm(vnode, insertedVnodeQueue);
  11314. if (parent !== null) {
  11315. api.insertBefore(parent, vnode.elm, api.nextSibling(elm));
  11316. removeVnodes(parent, [oldVnode], 0, 0);
  11317. }
  11318. }
  11319. for (i = 0; i < insertedVnodeQueue.length; ++i) {
  11320. insertedVnodeQueue[i].data.hook.insert(insertedVnodeQueue[i]);
  11321. }
  11322. for (i = 0; i < cbs.post.length; ++i)
  11323. cbs.post[i]();
  11324. return vnode;
  11325. };
  11326. }
  11327. function addNS(data, children, sel) {
  11328. data.ns = "http://www.w3.org/2000/svg";
  11329. if (sel !== "foreignObject" && children !== undefined) {
  11330. for (let i = 0; i < children.length; ++i) {
  11331. const childData = children[i].data;
  11332. if (childData !== undefined) {
  11333. addNS(childData, children[i].children, children[i].sel);
  11334. }
  11335. }
  11336. }
  11337. }
  11338. function h(sel, b, c) {
  11339. let data = {};
  11340. let children;
  11341. let text;
  11342. let i;
  11343. if (c !== undefined) {
  11344. if (b !== null) {
  11345. data = b;
  11346. }
  11347. if (array(c)) {
  11348. children = c;
  11349. }
  11350. else if (primitive(c)) {
  11351. text = c.toString();
  11352. }
  11353. else if (c && c.sel) {
  11354. children = [c];
  11355. }
  11356. }
  11357. else if (b !== undefined && b !== null) {
  11358. if (array(b)) {
  11359. children = b;
  11360. }
  11361. else if (primitive(b)) {
  11362. text = b.toString();
  11363. }
  11364. else if (b && b.sel) {
  11365. children = [b];
  11366. }
  11367. else {
  11368. data = b;
  11369. }
  11370. }
  11371. if (children !== undefined) {
  11372. for (i = 0; i < children.length; ++i) {
  11373. if (primitive(children[i]))
  11374. children[i] = vnode(undefined, undefined, undefined, children[i], undefined);
  11375. }
  11376. }
  11377. if (sel[0] === "s" &&
  11378. sel[1] === "v" &&
  11379. sel[2] === "g" &&
  11380. (sel.length === 3 || sel[3] === "." || sel[3] === "#")) {
  11381. addNS(data, children, sel);
  11382. }
  11383. return vnode(sel, data, children, text, undefined);
  11384. }
  11385. function copyToThunk(vnode, thunk) {
  11386. vnode.data.fn = thunk.data.fn;
  11387. vnode.data.args = thunk.data.args;
  11388. thunk.data = vnode.data;
  11389. thunk.children = vnode.children;
  11390. thunk.text = vnode.text;
  11391. thunk.elm = vnode.elm;
  11392. }
  11393. function init(thunk) {
  11394. const cur = thunk.data;
  11395. const vnode = cur.fn(...cur.args);
  11396. copyToThunk(vnode, thunk);
  11397. }
  11398. function prepatch(oldVnode, thunk) {
  11399. let i;
  11400. const old = oldVnode.data;
  11401. const cur = thunk.data;
  11402. const oldArgs = old.args;
  11403. const args = cur.args;
  11404. if (old.fn !== cur.fn || oldArgs.length !== args.length) {
  11405. copyToThunk(cur.fn(...args), thunk);
  11406. return;
  11407. }
  11408. for (i = 0; i < args.length; ++i) {
  11409. if (oldArgs[i] !== args[i]) {
  11410. copyToThunk(cur.fn(...args), thunk);
  11411. return;
  11412. }
  11413. }
  11414. copyToThunk(oldVnode, thunk);
  11415. }
  11416. const thunk = function thunk(sel, key, fn, args) {
  11417. if (args === undefined) {
  11418. args = fn;
  11419. fn = key;
  11420. key = undefined;
  11421. }
  11422. return h(sel, {
  11423. key: key,
  11424. hook: { init, prepatch },
  11425. fn: fn,
  11426. args: args,
  11427. });
  11428. };
  11429. function pre(vnode, newVnode) {
  11430. const attachData = vnode.data.attachData;
  11431. // Copy created placeholder and real element from old vnode
  11432. newVnode.data.attachData.placeholder = attachData.placeholder;
  11433. newVnode.data.attachData.real = attachData.real;
  11434. // Mount real element in vnode so the patch process operates on it
  11435. vnode.elm = vnode.data.attachData.real;
  11436. }
  11437. function post(_, vnode) {
  11438. // Mount dummy placeholder in vnode so potential reorders use it
  11439. vnode.elm = vnode.data.attachData.placeholder;
  11440. }
  11441. function destroy(vnode) {
  11442. // Remove placeholder
  11443. if (vnode.elm !== undefined) {
  11444. vnode.elm.parentNode.removeChild(vnode.elm);
  11445. }
  11446. // Remove real element from where it was inserted
  11447. vnode.elm = vnode.data.attachData.real;
  11448. }
  11449. function create(_, vnode) {
  11450. const real = vnode.elm;
  11451. const attachData = vnode.data.attachData;
  11452. const placeholder = document.createElement("span");
  11453. // Replace actual element with dummy placeholder
  11454. // Snabbdom will then insert placeholder instead
  11455. vnode.elm = placeholder;
  11456. attachData.target.appendChild(real);
  11457. attachData.real = real;
  11458. attachData.placeholder = placeholder;
  11459. }
  11460. function attachTo(target, vnode) {
  11461. if (vnode.data === undefined)
  11462. vnode.data = {};
  11463. if (vnode.data.hook === undefined)
  11464. vnode.data.hook = {};
  11465. const data = vnode.data;
  11466. const hook = vnode.data.hook;
  11467. data.attachData = { target: target, placeholder: undefined, real: undefined };
  11468. hook.create = create;
  11469. hook.prepatch = pre;
  11470. hook.postpatch = post;
  11471. hook.destroy = destroy;
  11472. return vnode;
  11473. }
  11474. function toVNode(node, domApi) {
  11475. const api = domApi !== undefined ? domApi : htmlDomApi;
  11476. let text;
  11477. if (api.isElement(node)) {
  11478. const id = node.id ? "#" + node.id : "";
  11479. const cn = node.getAttribute("class");
  11480. const c = cn ? "." + cn.split(" ").join(".") : "";
  11481. const sel = api.tagName(node).toLowerCase() + id + c;
  11482. const attrs = {};
  11483. const children = [];
  11484. let name;
  11485. let i, n;
  11486. const elmAttrs = node.attributes;
  11487. const elmChildren = node.childNodes;
  11488. for (i = 0, n = elmAttrs.length; i < n; i++) {
  11489. name = elmAttrs[i].nodeName;
  11490. if (name !== "id" && name !== "class") {
  11491. attrs[name] = elmAttrs[i].nodeValue;
  11492. }
  11493. }
  11494. for (i = 0, n = elmChildren.length; i < n; i++) {
  11495. children.push(toVNode(elmChildren[i], domApi));
  11496. }
  11497. return vnode(sel, { attrs }, children, undefined, node);
  11498. }
  11499. else if (api.isText(node)) {
  11500. text = api.getTextContent(node);
  11501. return vnode(undefined, undefined, undefined, text, node);
  11502. }
  11503. else if (api.isComment(node)) {
  11504. text = api.getTextContent(node);
  11505. return vnode("!", {}, [], text, node);
  11506. }
  11507. else {
  11508. return vnode("", {}, [], undefined, node);
  11509. }
  11510. }
  11511. const xlinkNS = "http://www.w3.org/1999/xlink";
  11512. const xmlNS = "http://www.w3.org/XML/1998/namespace";
  11513. const colonChar = 58;
  11514. const xChar = 120;
  11515. function updateAttrs(oldVnode, vnode) {
  11516. let key;
  11517. const elm = vnode.elm;
  11518. let oldAttrs = oldVnode.data.attrs;
  11519. let attrs = vnode.data.attrs;
  11520. if (!oldAttrs && !attrs)
  11521. return;
  11522. if (oldAttrs === attrs)
  11523. return;
  11524. oldAttrs = oldAttrs || {};
  11525. attrs = attrs || {};
  11526. // update modified attributes, add new attributes
  11527. for (key in attrs) {
  11528. const cur = attrs[key];
  11529. const old = oldAttrs[key];
  11530. if (old !== cur) {
  11531. if (cur === true) {
  11532. elm.setAttribute(key, "");
  11533. }
  11534. else if (cur === false) {
  11535. elm.removeAttribute(key);
  11536. }
  11537. else {
  11538. if (key.charCodeAt(0) !== xChar) {
  11539. elm.setAttribute(key, cur);
  11540. }
  11541. else if (key.charCodeAt(3) === colonChar) {
  11542. // Assume xml namespace
  11543. elm.setAttributeNS(xmlNS, key, cur);
  11544. }
  11545. else if (key.charCodeAt(5) === colonChar) {
  11546. // Assume xlink namespace
  11547. elm.setAttributeNS(xlinkNS, key, cur);
  11548. }
  11549. else {
  11550. elm.setAttribute(key, cur);
  11551. }
  11552. }
  11553. }
  11554. }
  11555. // remove removed attributes
  11556. // use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)
  11557. // the other option is to remove all attributes with value == undefined
  11558. for (key in oldAttrs) {
  11559. if (!(key in attrs)) {
  11560. elm.removeAttribute(key);
  11561. }
  11562. }
  11563. }
  11564. const attributesModule = {
  11565. create: updateAttrs,
  11566. update: updateAttrs,
  11567. };
  11568. function updateClass(oldVnode, vnode) {
  11569. let cur;
  11570. let name;
  11571. const elm = vnode.elm;
  11572. let oldClass = oldVnode.data.class;
  11573. let klass = vnode.data.class;
  11574. if (!oldClass && !klass)
  11575. return;
  11576. if (oldClass === klass)
  11577. return;
  11578. oldClass = oldClass || {};
  11579. klass = klass || {};
  11580. for (name in oldClass) {
  11581. if (oldClass[name] && !Object.prototype.hasOwnProperty.call(klass, name)) {
  11582. // was `true` and now not provided
  11583. elm.classList.remove(name);
  11584. }
  11585. }
  11586. for (name in klass) {
  11587. cur = klass[name];
  11588. if (cur !== oldClass[name]) {
  11589. elm.classList[cur ? "add" : "remove"](name);
  11590. }
  11591. }
  11592. }
  11593. const classModule = { create: updateClass, update: updateClass };
  11594. const CAPS_REGEX = /[A-Z]/g;
  11595. function updateDataset(oldVnode, vnode) {
  11596. const elm = vnode.elm;
  11597. let oldDataset = oldVnode.data.dataset;
  11598. let dataset = vnode.data.dataset;
  11599. let key;
  11600. if (!oldDataset && !dataset)
  11601. return;
  11602. if (oldDataset === dataset)
  11603. return;
  11604. oldDataset = oldDataset || {};
  11605. dataset = dataset || {};
  11606. const d = elm.dataset;
  11607. for (key in oldDataset) {
  11608. if (!dataset[key]) {
  11609. if (d) {
  11610. if (key in d) {
  11611. delete d[key];
  11612. }
  11613. }
  11614. else {
  11615. elm.removeAttribute("data-" + key.replace(CAPS_REGEX, "-$&").toLowerCase());
  11616. }
  11617. }
  11618. }
  11619. for (key in dataset) {
  11620. if (oldDataset[key] !== dataset[key]) {
  11621. if (d) {
  11622. d[key] = dataset[key];
  11623. }
  11624. else {
  11625. elm.setAttribute("data-" + key.replace(CAPS_REGEX, "-$&").toLowerCase(), dataset[key]);
  11626. }
  11627. }
  11628. }
  11629. }
  11630. const datasetModule = {
  11631. create: updateDataset,
  11632. update: updateDataset,
  11633. };
  11634. function invokeHandler(handler, vnode, event) {
  11635. if (typeof handler === "function") {
  11636. // call function handler
  11637. handler.call(vnode, event, vnode);
  11638. }
  11639. else if (typeof handler === "object") {
  11640. // call multiple handlers
  11641. for (let i = 0; i < handler.length; i++) {
  11642. invokeHandler(handler[i], vnode, event);
  11643. }
  11644. }
  11645. }
  11646. function handleEvent(event, vnode) {
  11647. const name = event.type;
  11648. const on = vnode.data.on;
  11649. // call event handler(s) if exists
  11650. if (on && on[name]) {
  11651. invokeHandler(on[name], vnode, event);
  11652. }
  11653. }
  11654. function createListener() {
  11655. return function handler(event) {
  11656. handleEvent(event, handler.vnode);
  11657. };
  11658. }
  11659. function updateEventListeners(oldVnode, vnode) {
  11660. const oldOn = oldVnode.data.on;
  11661. const oldListener = oldVnode.listener;
  11662. const oldElm = oldVnode.elm;
  11663. const on = vnode && vnode.data.on;
  11664. const elm = (vnode && vnode.elm);
  11665. let name;
  11666. // optimization for reused immutable handlers
  11667. if (oldOn === on) {
  11668. return;
  11669. }
  11670. // remove existing listeners which no longer used
  11671. if (oldOn && oldListener) {
  11672. // if element changed or deleted we remove all existing listeners unconditionally
  11673. if (!on) {
  11674. for (name in oldOn) {
  11675. // remove listener if element was changed or existing listeners removed
  11676. oldElm.removeEventListener(name, oldListener, false);
  11677. }
  11678. }
  11679. else {
  11680. for (name in oldOn) {
  11681. // remove listener if existing listener removed
  11682. if (!on[name]) {
  11683. oldElm.removeEventListener(name, oldListener, false);
  11684. }
  11685. }
  11686. }
  11687. }
  11688. // add new listeners which has not already attached
  11689. if (on) {
  11690. // reuse existing listener or create new
  11691. const listener = (vnode.listener =
  11692. oldVnode.listener || createListener());
  11693. // update vnode for listener
  11694. listener.vnode = vnode;
  11695. // if element changed or added we add all needed listeners unconditionally
  11696. if (!oldOn) {
  11697. for (name in on) {
  11698. // add listener if element was changed or new listeners added
  11699. elm.addEventListener(name, listener, false);
  11700. }
  11701. }
  11702. else {
  11703. for (name in on) {
  11704. // add listener if new listener added
  11705. if (!oldOn[name]) {
  11706. elm.addEventListener(name, listener, false);
  11707. }
  11708. }
  11709. }
  11710. }
  11711. }
  11712. const eventListenersModule = {
  11713. create: updateEventListeners,
  11714. update: updateEventListeners,
  11715. destroy: updateEventListeners,
  11716. };
  11717. function updateProps(oldVnode, vnode) {
  11718. let key;
  11719. let cur;
  11720. let old;
  11721. const elm = vnode.elm;
  11722. let oldProps = oldVnode.data.props;
  11723. let props = vnode.data.props;
  11724. if (!oldProps && !props)
  11725. return;
  11726. if (oldProps === props)
  11727. return;
  11728. oldProps = oldProps || {};
  11729. props = props || {};
  11730. for (key in props) {
  11731. cur = props[key];
  11732. old = oldProps[key];
  11733. if (old !== cur && (key !== "value" || elm[key] !== cur)) {
  11734. elm[key] = cur;
  11735. }
  11736. }
  11737. }
  11738. const propsModule = { create: updateProps, update: updateProps };
  11739. // Bindig `requestAnimationFrame` like this fixes a bug in IE/Edge. See #360 and #409.
  11740. const raf = (typeof window !== "undefined" &&
  11741. window.requestAnimationFrame.bind(window)) ||
  11742. setTimeout;
  11743. const nextFrame = function (fn) {
  11744. raf(function () {
  11745. raf(fn);
  11746. });
  11747. };
  11748. let reflowForced = false;
  11749. function setNextFrame(obj, prop, val) {
  11750. nextFrame(function () {
  11751. obj[prop] = val;
  11752. });
  11753. }
  11754. function updateStyle(oldVnode, vnode) {
  11755. let cur;
  11756. let name;
  11757. const elm = vnode.elm;
  11758. let oldStyle = oldVnode.data.style;
  11759. let style = vnode.data.style;
  11760. if (!oldStyle && !style)
  11761. return;
  11762. if (oldStyle === style)
  11763. return;
  11764. oldStyle = oldStyle || {};
  11765. style = style || {};
  11766. const oldHasDel = "delayed" in oldStyle;
  11767. for (name in oldStyle) {
  11768. if (!style[name]) {
  11769. if (name[0] === "-" && name[1] === "-") {
  11770. elm.style.removeProperty(name);
  11771. }
  11772. else {
  11773. elm.style[name] = "";
  11774. }
  11775. }
  11776. }
  11777. for (name in style) {
  11778. cur = style[name];
  11779. if (name === "delayed" && style.delayed) {
  11780. for (const name2 in style.delayed) {
  11781. cur = style.delayed[name2];
  11782. if (!oldHasDel || cur !== oldStyle.delayed[name2]) {
  11783. setNextFrame(elm.style, name2, cur);
  11784. }
  11785. }
  11786. }
  11787. else if (name !== "remove" && cur !== oldStyle[name]) {
  11788. if (name[0] === "-" && name[1] === "-") {
  11789. elm.style.setProperty(name, cur);
  11790. }
  11791. else {
  11792. elm.style[name] = cur;
  11793. }
  11794. }
  11795. }
  11796. }
  11797. function applyDestroyStyle(vnode) {
  11798. let style;
  11799. let name;
  11800. const elm = vnode.elm;
  11801. const s = vnode.data.style;
  11802. if (!s || !(style = s.destroy))
  11803. return;
  11804. for (name in style) {
  11805. elm.style[name] = style[name];
  11806. }
  11807. }
  11808. function applyRemoveStyle(vnode, rm) {
  11809. const s = vnode.data.style;
  11810. if (!s || !s.remove) {
  11811. rm();
  11812. return;
  11813. }
  11814. if (!reflowForced) {
  11815. // eslint-disable-next-line @typescript-eslint/no-unused-expressions
  11816. vnode.elm.offsetLeft;
  11817. reflowForced = true;
  11818. }
  11819. let name;
  11820. const elm = vnode.elm;
  11821. let i = 0;
  11822. const style = s.remove;
  11823. let amount = 0;
  11824. const applied = [];
  11825. for (name in style) {
  11826. applied.push(name);
  11827. elm.style[name] = style[name];
  11828. }
  11829. const compStyle = getComputedStyle(elm);
  11830. const props = compStyle["transition-property"].split(", ");
  11831. for (; i < props.length; ++i) {
  11832. if (applied.indexOf(props[i]) !== -1)
  11833. amount++;
  11834. }
  11835. elm.addEventListener("transitionend", function (ev) {
  11836. if (ev.target === elm)
  11837. --amount;
  11838. if (amount === 0)
  11839. rm();
  11840. });
  11841. }
  11842. function forceReflow() {
  11843. reflowForced = false;
  11844. }
  11845. const styleModule = {
  11846. pre: forceReflow,
  11847. create: updateStyle,
  11848. update: updateStyle,
  11849. destroy: applyDestroyStyle,
  11850. remove: applyRemoveStyle,
  11851. };
  11852. /* eslint-disable @typescript-eslint/no-namespace, import/export */
  11853. function flattenAndFilter(children, flattened) {
  11854. for (const child of children) {
  11855. // filter out falsey children, except 0 since zero can be a valid value e.g inside a chart
  11856. if (child !== undefined &&
  11857. child !== null &&
  11858. child !== false &&
  11859. child !== "") {
  11860. if (Array.isArray(child)) {
  11861. flattenAndFilter(child, flattened);
  11862. }
  11863. else if (typeof child === "string" ||
  11864. typeof child === "number" ||
  11865. typeof child === "boolean") {
  11866. flattened.push(vnode(undefined, undefined, undefined, String(child), undefined));
  11867. }
  11868. else {
  11869. flattened.push(child);
  11870. }
  11871. }
  11872. }
  11873. return flattened;
  11874. }
  11875. /**
  11876. * jsx/tsx compatible factory function
  11877. * see: https://www.typescriptlang.org/docs/handbook/jsx.html#factory-functions
  11878. */
  11879. function jsx(tag, data, ...children) {
  11880. const flatChildren = flattenAndFilter(children, []);
  11881. if (typeof tag === "function") {
  11882. // tag is a function component
  11883. return tag(data, flatChildren);
  11884. }
  11885. else {
  11886. if (flatChildren.length === 1 &&
  11887. !flatChildren[0].sel &&
  11888. flatChildren[0].text) {
  11889. // only child is a simple text node, pass as text for a simpler vtree
  11890. return h(tag, data, flatChildren[0].text);
  11891. }
  11892. else {
  11893. return h(tag, data, flatChildren);
  11894. }
  11895. }
  11896. }
  11897. (function (jsx) {
  11898. })(jsx || (jsx = {}));
  11899. exports.array = array;
  11900. exports.attachTo = attachTo;
  11901. exports.attributesModule = attributesModule;
  11902. exports.classModule = classModule;
  11903. exports.datasetModule = datasetModule;
  11904. exports.eventListenersModule = eventListenersModule;
  11905. exports.h = h;
  11906. exports.htmlDomApi = htmlDomApi;
  11907. exports.init = init$1;
  11908. exports.jsx = jsx;
  11909. exports.primitive = primitive;
  11910. exports.propsModule = propsModule;
  11911. exports.styleModule = styleModule;
  11912. exports.thunk = thunk;
  11913. exports.toVNode = toVNode;
  11914. exports.vnode = vnode;
  11915. });
  11916. /**
  11917. * lodash (Custom Build) <https://lodash.com/>
  11918. * Build: `lodash modularize exports="npm" -o ./`
  11919. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  11920. * Released under MIT license <https://lodash.com/license>
  11921. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  11922. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  11923. */
  11924. /** Used as references for various `Number` constants. */
  11925. var INFINITY = 1 / 0;
  11926. /** `Object#toString` result references. */
  11927. var symbolTag$1 = '[object Symbol]';
  11928. /** Used to match words composed of alphanumeric characters. */
  11929. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  11930. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  11931. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  11932. /** Used to compose unicode character classes. */
  11933. var rsAstralRange = '\\ud800-\\udfff',
  11934. rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
  11935. rsComboSymbolsRange = '\\u20d0-\\u20f0',
  11936. rsDingbatRange = '\\u2700-\\u27bf',
  11937. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  11938. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  11939. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  11940. rsPunctuationRange = '\\u2000-\\u206f',
  11941. rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
  11942. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  11943. rsVarRange = '\\ufe0e\\ufe0f',
  11944. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  11945. /** Used to compose unicode capture groups. */
  11946. var rsApos = "['\u2019]",
  11947. rsAstral = '[' + rsAstralRange + ']',
  11948. rsBreak = '[' + rsBreakRange + ']',
  11949. rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
  11950. rsDigits = '\\d+',
  11951. rsDingbat = '[' + rsDingbatRange + ']',
  11952. rsLower = '[' + rsLowerRange + ']',
  11953. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  11954. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  11955. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  11956. rsNonAstral = '[^' + rsAstralRange + ']',
  11957. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  11958. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  11959. rsUpper = '[' + rsUpperRange + ']',
  11960. rsZWJ = '\\u200d';
  11961. /** Used to compose unicode regexes. */
  11962. var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
  11963. rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
  11964. rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  11965. rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  11966. reOptMod = rsModifier + '?',
  11967. rsOptVar = '[' + rsVarRange + ']?',
  11968. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  11969. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  11970. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  11971. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  11972. /** Used to match apostrophes. */
  11973. var reApos = RegExp(rsApos, 'g');
  11974. /**
  11975. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  11976. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  11977. */
  11978. var reComboMark = RegExp(rsCombo, 'g');
  11979. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  11980. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  11981. /** Used to match complex or compound words. */
  11982. var reUnicodeWord = RegExp([
  11983. rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  11984. rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
  11985. rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
  11986. rsUpper + '+' + rsOptUpperContr,
  11987. rsDigits,
  11988. rsEmoji
  11989. ].join('|'), 'g');
  11990. /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
  11991. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
  11992. /** Used to detect strings that need a more robust regexp to match words. */
  11993. var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
  11994. /** Used to map Latin Unicode letters to basic Latin letters. */
  11995. var deburredLetters = {
  11996. // Latin-1 Supplement block.
  11997. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  11998. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  11999. '\xc7': 'C', '\xe7': 'c',
  12000. '\xd0': 'D', '\xf0': 'd',
  12001. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  12002. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  12003. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  12004. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  12005. '\xd1': 'N', '\xf1': 'n',
  12006. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  12007. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  12008. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  12009. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  12010. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  12011. '\xc6': 'Ae', '\xe6': 'ae',
  12012. '\xde': 'Th', '\xfe': 'th',
  12013. '\xdf': 'ss',
  12014. // Latin Extended-A block.
  12015. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  12016. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  12017. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  12018. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  12019. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  12020. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  12021. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  12022. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  12023. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  12024. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  12025. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  12026. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  12027. '\u0134': 'J', '\u0135': 'j',
  12028. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  12029. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  12030. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  12031. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  12032. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  12033. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  12034. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  12035. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  12036. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  12037. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  12038. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  12039. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  12040. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  12041. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  12042. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  12043. '\u0174': 'W', '\u0175': 'w',
  12044. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  12045. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  12046. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  12047. '\u0132': 'IJ', '\u0133': 'ij',
  12048. '\u0152': 'Oe', '\u0153': 'oe',
  12049. '\u0149': "'n", '\u017f': 'ss'
  12050. };
  12051. /** Detect free variable `global` from Node.js. */
  12052. var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  12053. /** Detect free variable `self`. */
  12054. var freeSelf$1 = typeof self == 'object' && self && self.Object === Object && self;
  12055. /** Used as a reference to the global object. */
  12056. var root$1 = freeGlobal$1 || freeSelf$1 || Function('return this')();
  12057. /**
  12058. * A specialized version of `_.reduce` for arrays without support for
  12059. * iteratee shorthands.
  12060. *
  12061. * @private
  12062. * @param {Array} [array] The array to iterate over.
  12063. * @param {Function} iteratee The function invoked per iteration.
  12064. * @param {*} [accumulator] The initial value.
  12065. * @param {boolean} [initAccum] Specify using the first element of `array` as
  12066. * the initial value.
  12067. * @returns {*} Returns the accumulated value.
  12068. */
  12069. function arrayReduce(array, iteratee, accumulator, initAccum) {
  12070. var index = -1,
  12071. length = array ? array.length : 0;
  12072. if (initAccum && length) {
  12073. accumulator = array[++index];
  12074. }
  12075. while (++index < length) {
  12076. accumulator = iteratee(accumulator, array[index], index, array);
  12077. }
  12078. return accumulator;
  12079. }
  12080. /**
  12081. * Converts an ASCII `string` to an array.
  12082. *
  12083. * @private
  12084. * @param {string} string The string to convert.
  12085. * @returns {Array} Returns the converted array.
  12086. */
  12087. function asciiToArray(string) {
  12088. return string.split('');
  12089. }
  12090. /**
  12091. * Splits an ASCII `string` into an array of its words.
  12092. *
  12093. * @private
  12094. * @param {string} The string to inspect.
  12095. * @returns {Array} Returns the words of `string`.
  12096. */
  12097. function asciiWords(string) {
  12098. return string.match(reAsciiWord) || [];
  12099. }
  12100. /**
  12101. * The base implementation of `_.propertyOf` without support for deep paths.
  12102. *
  12103. * @private
  12104. * @param {Object} object The object to query.
  12105. * @returns {Function} Returns the new accessor function.
  12106. */
  12107. function basePropertyOf(object) {
  12108. return function(key) {
  12109. return object == null ? undefined : object[key];
  12110. };
  12111. }
  12112. /**
  12113. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  12114. * letters to basic Latin letters.
  12115. *
  12116. * @private
  12117. * @param {string} letter The matched letter to deburr.
  12118. * @returns {string} Returns the deburred letter.
  12119. */
  12120. var deburrLetter = basePropertyOf(deburredLetters);
  12121. /**
  12122. * Checks if `string` contains Unicode symbols.
  12123. *
  12124. * @private
  12125. * @param {string} string The string to inspect.
  12126. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  12127. */
  12128. function hasUnicode(string) {
  12129. return reHasUnicode.test(string);
  12130. }
  12131. /**
  12132. * Checks if `string` contains a word composed of Unicode symbols.
  12133. *
  12134. * @private
  12135. * @param {string} string The string to inspect.
  12136. * @returns {boolean} Returns `true` if a word is found, else `false`.
  12137. */
  12138. function hasUnicodeWord(string) {
  12139. return reHasUnicodeWord.test(string);
  12140. }
  12141. /**
  12142. * Converts `string` to an array.
  12143. *
  12144. * @private
  12145. * @param {string} string The string to convert.
  12146. * @returns {Array} Returns the converted array.
  12147. */
  12148. function stringToArray(string) {
  12149. return hasUnicode(string)
  12150. ? unicodeToArray(string)
  12151. : asciiToArray(string);
  12152. }
  12153. /**
  12154. * Converts a Unicode `string` to an array.
  12155. *
  12156. * @private
  12157. * @param {string} string The string to convert.
  12158. * @returns {Array} Returns the converted array.
  12159. */
  12160. function unicodeToArray(string) {
  12161. return string.match(reUnicode) || [];
  12162. }
  12163. /**
  12164. * Splits a Unicode `string` into an array of its words.
  12165. *
  12166. * @private
  12167. * @param {string} The string to inspect.
  12168. * @returns {Array} Returns the words of `string`.
  12169. */
  12170. function unicodeWords(string) {
  12171. return string.match(reUnicodeWord) || [];
  12172. }
  12173. /** Used for built-in method references. */
  12174. var objectProto$1 = Object.prototype;
  12175. /**
  12176. * Used to resolve the
  12177. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  12178. * of values.
  12179. */
  12180. var objectToString$1 = objectProto$1.toString;
  12181. /** Built-in value references. */
  12182. var Symbol$1 = root$1.Symbol;
  12183. /** Used to convert symbols to primitives and strings. */
  12184. var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
  12185. symbolToString = symbolProto ? symbolProto.toString : undefined;
  12186. /**
  12187. * The base implementation of `_.slice` without an iteratee call guard.
  12188. *
  12189. * @private
  12190. * @param {Array} array The array to slice.
  12191. * @param {number} [start=0] The start position.
  12192. * @param {number} [end=array.length] The end position.
  12193. * @returns {Array} Returns the slice of `array`.
  12194. */
  12195. function baseSlice(array, start, end) {
  12196. var index = -1,
  12197. length = array.length;
  12198. if (start < 0) {
  12199. start = -start > length ? 0 : (length + start);
  12200. }
  12201. end = end > length ? length : end;
  12202. if (end < 0) {
  12203. end += length;
  12204. }
  12205. length = start > end ? 0 : ((end - start) >>> 0);
  12206. start >>>= 0;
  12207. var result = Array(length);
  12208. while (++index < length) {
  12209. result[index] = array[index + start];
  12210. }
  12211. return result;
  12212. }
  12213. /**
  12214. * The base implementation of `_.toString` which doesn't convert nullish
  12215. * values to empty strings.
  12216. *
  12217. * @private
  12218. * @param {*} value The value to process.
  12219. * @returns {string} Returns the string.
  12220. */
  12221. function baseToString(value) {
  12222. // Exit early for strings to avoid a performance hit in some environments.
  12223. if (typeof value == 'string') {
  12224. return value;
  12225. }
  12226. if (isSymbol$1(value)) {
  12227. return symbolToString ? symbolToString.call(value) : '';
  12228. }
  12229. var result = (value + '');
  12230. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  12231. }
  12232. /**
  12233. * Casts `array` to a slice if it's needed.
  12234. *
  12235. * @private
  12236. * @param {Array} array The array to inspect.
  12237. * @param {number} start The start position.
  12238. * @param {number} [end=array.length] The end position.
  12239. * @returns {Array} Returns the cast slice.
  12240. */
  12241. function castSlice(array, start, end) {
  12242. var length = array.length;
  12243. end = end === undefined ? length : end;
  12244. return (!start && end >= length) ? array : baseSlice(array, start, end);
  12245. }
  12246. /**
  12247. * Creates a function like `_.lowerFirst`.
  12248. *
  12249. * @private
  12250. * @param {string} methodName The name of the `String` case method to use.
  12251. * @returns {Function} Returns the new case function.
  12252. */
  12253. function createCaseFirst(methodName) {
  12254. return function(string) {
  12255. string = toString(string);
  12256. var strSymbols = hasUnicode(string)
  12257. ? stringToArray(string)
  12258. : undefined;
  12259. var chr = strSymbols
  12260. ? strSymbols[0]
  12261. : string.charAt(0);
  12262. var trailing = strSymbols
  12263. ? castSlice(strSymbols, 1).join('')
  12264. : string.slice(1);
  12265. return chr[methodName]() + trailing;
  12266. };
  12267. }
  12268. /**
  12269. * Creates a function like `_.camelCase`.
  12270. *
  12271. * @private
  12272. * @param {Function} callback The function to combine each word.
  12273. * @returns {Function} Returns the new compounder function.
  12274. */
  12275. function createCompounder(callback) {
  12276. return function(string) {
  12277. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  12278. };
  12279. }
  12280. /**
  12281. * Checks if `value` is object-like. A value is object-like if it's not `null`
  12282. * and has a `typeof` result of "object".
  12283. *
  12284. * @static
  12285. * @memberOf _
  12286. * @since 4.0.0
  12287. * @category Lang
  12288. * @param {*} value The value to check.
  12289. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  12290. * @example
  12291. *
  12292. * _.isObjectLike({});
  12293. * // => true
  12294. *
  12295. * _.isObjectLike([1, 2, 3]);
  12296. * // => true
  12297. *
  12298. * _.isObjectLike(_.noop);
  12299. * // => false
  12300. *
  12301. * _.isObjectLike(null);
  12302. * // => false
  12303. */
  12304. function isObjectLike$1(value) {
  12305. return !!value && typeof value == 'object';
  12306. }
  12307. /**
  12308. * Checks if `value` is classified as a `Symbol` primitive or object.
  12309. *
  12310. * @static
  12311. * @memberOf _
  12312. * @since 4.0.0
  12313. * @category Lang
  12314. * @param {*} value The value to check.
  12315. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  12316. * @example
  12317. *
  12318. * _.isSymbol(Symbol.iterator);
  12319. * // => true
  12320. *
  12321. * _.isSymbol('abc');
  12322. * // => false
  12323. */
  12324. function isSymbol$1(value) {
  12325. return typeof value == 'symbol' ||
  12326. (isObjectLike$1(value) && objectToString$1.call(value) == symbolTag$1);
  12327. }
  12328. /**
  12329. * Converts `value` to a string. An empty string is returned for `null`
  12330. * and `undefined` values. The sign of `-0` is preserved.
  12331. *
  12332. * @static
  12333. * @memberOf _
  12334. * @since 4.0.0
  12335. * @category Lang
  12336. * @param {*} value The value to process.
  12337. * @returns {string} Returns the string.
  12338. * @example
  12339. *
  12340. * _.toString(null);
  12341. * // => ''
  12342. *
  12343. * _.toString(-0);
  12344. * // => '-0'
  12345. *
  12346. * _.toString([1, 2, 3]);
  12347. * // => '1,2,3'
  12348. */
  12349. function toString(value) {
  12350. return value == null ? '' : baseToString(value);
  12351. }
  12352. /**
  12353. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  12354. *
  12355. * @static
  12356. * @memberOf _
  12357. * @since 3.0.0
  12358. * @category String
  12359. * @param {string} [string=''] The string to convert.
  12360. * @returns {string} Returns the camel cased string.
  12361. * @example
  12362. *
  12363. * _.camelCase('Foo Bar');
  12364. * // => 'fooBar'
  12365. *
  12366. * _.camelCase('--foo-bar--');
  12367. * // => 'fooBar'
  12368. *
  12369. * _.camelCase('__FOO_BAR__');
  12370. * // => 'fooBar'
  12371. */
  12372. var camelCase = createCompounder(function(result, word, index) {
  12373. word = word.toLowerCase();
  12374. return result + (index ? capitalize(word) : word);
  12375. });
  12376. /**
  12377. * Converts the first character of `string` to upper case and the remaining
  12378. * to lower case.
  12379. *
  12380. * @static
  12381. * @memberOf _
  12382. * @since 3.0.0
  12383. * @category String
  12384. * @param {string} [string=''] The string to capitalize.
  12385. * @returns {string} Returns the capitalized string.
  12386. * @example
  12387. *
  12388. * _.capitalize('FRED');
  12389. * // => 'Fred'
  12390. */
  12391. function capitalize(string) {
  12392. return upperFirst(toString(string).toLowerCase());
  12393. }
  12394. /**
  12395. * Deburrs `string` by converting
  12396. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  12397. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  12398. * letters to basic Latin letters and removing
  12399. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  12400. *
  12401. * @static
  12402. * @memberOf _
  12403. * @since 3.0.0
  12404. * @category String
  12405. * @param {string} [string=''] The string to deburr.
  12406. * @returns {string} Returns the deburred string.
  12407. * @example
  12408. *
  12409. * _.deburr('déjà vu');
  12410. * // => 'deja vu'
  12411. */
  12412. function deburr(string) {
  12413. string = toString(string);
  12414. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  12415. }
  12416. /**
  12417. * Converts the first character of `string` to upper case.
  12418. *
  12419. * @static
  12420. * @memberOf _
  12421. * @since 4.0.0
  12422. * @category String
  12423. * @param {string} [string=''] The string to convert.
  12424. * @returns {string} Returns the converted string.
  12425. * @example
  12426. *
  12427. * _.upperFirst('fred');
  12428. * // => 'Fred'
  12429. *
  12430. * _.upperFirst('FRED');
  12431. * // => 'FRED'
  12432. */
  12433. var upperFirst = createCaseFirst('toUpperCase');
  12434. /**
  12435. * Splits `string` into an array of its words.
  12436. *
  12437. * @static
  12438. * @memberOf _
  12439. * @since 3.0.0
  12440. * @category String
  12441. * @param {string} [string=''] The string to inspect.
  12442. * @param {RegExp|string} [pattern] The pattern to match words.
  12443. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  12444. * @returns {Array} Returns the words of `string`.
  12445. * @example
  12446. *
  12447. * _.words('fred, barney, & pebbles');
  12448. * // => ['fred', 'barney', 'pebbles']
  12449. *
  12450. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  12451. * // => ['fred', 'barney', '&', 'pebbles']
  12452. */
  12453. function words(string, pattern, guard) {
  12454. string = toString(string);
  12455. pattern = guard ? undefined : pattern;
  12456. if (pattern === undefined) {
  12457. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  12458. }
  12459. return string.match(pattern) || [];
  12460. }
  12461. var lodash_camelcase = camelCase;
  12462. /**
  12463. * Constants.
  12464. */
  12465. var IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
  12466. var MODIFIERS = {
  12467. alt: 'altKey',
  12468. control: 'ctrlKey',
  12469. meta: 'metaKey',
  12470. shift: 'shiftKey'
  12471. };
  12472. var ALIASES = {
  12473. add: '+',
  12474. break: 'pause',
  12475. cmd: 'meta',
  12476. command: 'meta',
  12477. ctl: 'control',
  12478. ctrl: 'control',
  12479. del: 'delete',
  12480. down: 'arrowdown',
  12481. esc: 'escape',
  12482. ins: 'insert',
  12483. left: 'arrowleft',
  12484. mod: IS_MAC ? 'meta' : 'control',
  12485. opt: 'alt',
  12486. option: 'alt',
  12487. return: 'enter',
  12488. right: 'arrowright',
  12489. space: ' ',
  12490. spacebar: ' ',
  12491. up: 'arrowup',
  12492. win: 'meta',
  12493. windows: 'meta'
  12494. };
  12495. var CODES = {
  12496. backspace: 8,
  12497. tab: 9,
  12498. enter: 13,
  12499. shift: 16,
  12500. control: 17,
  12501. alt: 18,
  12502. pause: 19,
  12503. capslock: 20,
  12504. escape: 27,
  12505. ' ': 32,
  12506. pageup: 33,
  12507. pagedown: 34,
  12508. end: 35,
  12509. home: 36,
  12510. arrowleft: 37,
  12511. arrowup: 38,
  12512. arrowright: 39,
  12513. arrowdown: 40,
  12514. insert: 45,
  12515. delete: 46,
  12516. meta: 91,
  12517. numlock: 144,
  12518. scrolllock: 145,
  12519. ';': 186,
  12520. '=': 187,
  12521. ',': 188,
  12522. '-': 189,
  12523. '.': 190,
  12524. '/': 191,
  12525. '`': 192,
  12526. '[': 219,
  12527. '\\': 220,
  12528. ']': 221,
  12529. '\'': 222
  12530. };
  12531. for (var f = 1; f < 20; f++) {
  12532. CODES['f' + f] = 111 + f;
  12533. }
  12534. /**
  12535. * Is hotkey?
  12536. */
  12537. function isHotkey(hotkey, options, event) {
  12538. if (options && !('byKey' in options)) {
  12539. event = options;
  12540. options = null;
  12541. }
  12542. if (!Array.isArray(hotkey)) {
  12543. hotkey = [hotkey];
  12544. }
  12545. var array = hotkey.map(function (string) {
  12546. return parseHotkey(string, options);
  12547. });
  12548. var check = function check(e) {
  12549. return array.some(function (object) {
  12550. return compareHotkey(object, e);
  12551. });
  12552. };
  12553. var ret = event == null ? check : check(event);
  12554. return ret;
  12555. }
  12556. function isCodeHotkey(hotkey, event) {
  12557. return isHotkey(hotkey, event);
  12558. }
  12559. function isKeyHotkey(hotkey, event) {
  12560. return isHotkey(hotkey, { byKey: true }, event);
  12561. }
  12562. /**
  12563. * Parse.
  12564. */
  12565. function parseHotkey(hotkey, options) {
  12566. var byKey = options && options.byKey;
  12567. var ret = {};
  12568. // Special case to handle the `+` key since we use it as a separator.
  12569. hotkey = hotkey.replace('++', '+add');
  12570. var values = hotkey.split('+');
  12571. var length = values.length;
  12572. // Ensure that all the modifiers are set to false unless the hotkey has them.
  12573. for (var k in MODIFIERS) {
  12574. ret[MODIFIERS[k]] = false;
  12575. }
  12576. var _iteratorNormalCompletion = true;
  12577. var _didIteratorError = false;
  12578. var _iteratorError = undefined;
  12579. try {
  12580. for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  12581. var value = _step.value;
  12582. var optional = value.endsWith('?') && value.length > 1;
  12583. if (optional) {
  12584. value = value.slice(0, -1);
  12585. }
  12586. var name = toKeyName(value);
  12587. var modifier = MODIFIERS[name];
  12588. if (value.length > 1 && !modifier && !ALIASES[value] && !CODES[name]) {
  12589. throw new TypeError('Unknown modifier: "' + value + '"');
  12590. }
  12591. if (length === 1 || !modifier) {
  12592. if (byKey) {
  12593. ret.key = name;
  12594. } else {
  12595. ret.which = toKeyCode(value);
  12596. }
  12597. }
  12598. if (modifier) {
  12599. ret[modifier] = optional ? null : true;
  12600. }
  12601. }
  12602. } catch (err) {
  12603. _didIteratorError = true;
  12604. _iteratorError = err;
  12605. } finally {
  12606. try {
  12607. if (!_iteratorNormalCompletion && _iterator.return) {
  12608. _iterator.return();
  12609. }
  12610. } finally {
  12611. if (_didIteratorError) {
  12612. throw _iteratorError;
  12613. }
  12614. }
  12615. }
  12616. return ret;
  12617. }
  12618. /**
  12619. * Compare.
  12620. */
  12621. function compareHotkey(object, event) {
  12622. for (var key in object) {
  12623. var expected = object[key];
  12624. var actual = void 0;
  12625. if (expected == null) {
  12626. continue;
  12627. }
  12628. if (key === 'key' && event.key != null) {
  12629. actual = event.key.toLowerCase();
  12630. } else if (key === 'which') {
  12631. actual = expected === 91 && event.which === 93 ? 91 : event.which;
  12632. } else {
  12633. actual = event[key];
  12634. }
  12635. if (actual == null && expected === false) {
  12636. continue;
  12637. }
  12638. if (actual !== expected) {
  12639. return false;
  12640. }
  12641. }
  12642. return true;
  12643. }
  12644. /**
  12645. * Utils.
  12646. */
  12647. function toKeyCode(name) {
  12648. name = toKeyName(name);
  12649. var code = CODES[name] || name.toUpperCase().charCodeAt(0);
  12650. return code;
  12651. }
  12652. function toKeyName(name) {
  12653. name = name.toLowerCase();
  12654. name = ALIASES[name] || name;
  12655. return name;
  12656. }
  12657. /**
  12658. * Export.
  12659. */
  12660. var _default = isHotkey;
  12661. var isHotkey_1 = isHotkey;
  12662. var isCodeHotkey_1 = isCodeHotkey;
  12663. var isKeyHotkey_1 = isKeyHotkey;
  12664. var parseHotkey_1 = parseHotkey;
  12665. var compareHotkey_1 = compareHotkey;
  12666. var toKeyCode_1 = toKeyCode;
  12667. var toKeyName_1 = toKeyName;
  12668. var lib$4 = /*#__PURE__*/Object.defineProperty({
  12669. default: _default,
  12670. isHotkey: isHotkey_1,
  12671. isCodeHotkey: isCodeHotkey_1,
  12672. isKeyHotkey: isKeyHotkey_1,
  12673. parseHotkey: parseHotkey_1,
  12674. compareHotkey: compareHotkey_1,
  12675. toKeyCode: toKeyCode_1,
  12676. toKeyName: toKeyName_1
  12677. }, '__esModule', {value: true});
  12678. /**
  12679. * lodash (Custom Build) <https://lodash.com/>
  12680. * Build: `lodash modularize exports="npm" -o ./`
  12681. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  12682. * Released under MIT license <https://lodash.com/license>
  12683. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  12684. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  12685. */
  12686. /** Used as the `TypeError` message for "Functions" methods. */
  12687. var FUNC_ERROR_TEXT = 'Expected a function';
  12688. /** Used as references for various `Number` constants. */
  12689. var NAN = 0 / 0;
  12690. /** `Object#toString` result references. */
  12691. var symbolTag = '[object Symbol]';
  12692. /** Used to match leading and trailing whitespace. */
  12693. var reTrim = /^\s+|\s+$/g;
  12694. /** Used to detect bad signed hexadecimal string values. */
  12695. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  12696. /** Used to detect binary string values. */
  12697. var reIsBinary = /^0b[01]+$/i;
  12698. /** Used to detect octal string values. */
  12699. var reIsOctal = /^0o[0-7]+$/i;
  12700. /** Built-in method references without a dependency on `root`. */
  12701. var freeParseInt = parseInt;
  12702. /** Detect free variable `global` from Node.js. */
  12703. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  12704. /** Detect free variable `self`. */
  12705. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  12706. /** Used as a reference to the global object. */
  12707. var root = freeGlobal || freeSelf || Function('return this')();
  12708. /** Used for built-in method references. */
  12709. var objectProto = Object.prototype;
  12710. /**
  12711. * Used to resolve the
  12712. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  12713. * of values.
  12714. */
  12715. var objectToString = objectProto.toString;
  12716. /* Built-in method references for those with the same name as other `lodash` methods. */
  12717. var nativeMax = Math.max,
  12718. nativeMin = Math.min;
  12719. /**
  12720. * Gets the timestamp of the number of milliseconds that have elapsed since
  12721. * the Unix epoch (1 January 1970 00:00:00 UTC).
  12722. *
  12723. * @static
  12724. * @memberOf _
  12725. * @since 2.4.0
  12726. * @category Date
  12727. * @returns {number} Returns the timestamp.
  12728. * @example
  12729. *
  12730. * _.defer(function(stamp) {
  12731. * console.log(_.now() - stamp);
  12732. * }, _.now());
  12733. * // => Logs the number of milliseconds it took for the deferred invocation.
  12734. */
  12735. var now = function() {
  12736. return root.Date.now();
  12737. };
  12738. /**
  12739. * Creates a debounced function that delays invoking `func` until after `wait`
  12740. * milliseconds have elapsed since the last time the debounced function was
  12741. * invoked. The debounced function comes with a `cancel` method to cancel
  12742. * delayed `func` invocations and a `flush` method to immediately invoke them.
  12743. * Provide `options` to indicate whether `func` should be invoked on the
  12744. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  12745. * with the last arguments provided to the debounced function. Subsequent
  12746. * calls to the debounced function return the result of the last `func`
  12747. * invocation.
  12748. *
  12749. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  12750. * invoked on the trailing edge of the timeout only if the debounced function
  12751. * is invoked more than once during the `wait` timeout.
  12752. *
  12753. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  12754. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  12755. *
  12756. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  12757. * for details over the differences between `_.debounce` and `_.throttle`.
  12758. *
  12759. * @static
  12760. * @memberOf _
  12761. * @since 0.1.0
  12762. * @category Function
  12763. * @param {Function} func The function to debounce.
  12764. * @param {number} [wait=0] The number of milliseconds to delay.
  12765. * @param {Object} [options={}] The options object.
  12766. * @param {boolean} [options.leading=false]
  12767. * Specify invoking on the leading edge of the timeout.
  12768. * @param {number} [options.maxWait]
  12769. * The maximum time `func` is allowed to be delayed before it's invoked.
  12770. * @param {boolean} [options.trailing=true]
  12771. * Specify invoking on the trailing edge of the timeout.
  12772. * @returns {Function} Returns the new debounced function.
  12773. * @example
  12774. *
  12775. * // Avoid costly calculations while the window size is in flux.
  12776. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  12777. *
  12778. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  12779. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  12780. * 'leading': true,
  12781. * 'trailing': false
  12782. * }));
  12783. *
  12784. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  12785. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  12786. * var source = new EventSource('/stream');
  12787. * jQuery(source).on('message', debounced);
  12788. *
  12789. * // Cancel the trailing debounced invocation.
  12790. * jQuery(window).on('popstate', debounced.cancel);
  12791. */
  12792. function debounce$1(func, wait, options) {
  12793. var lastArgs,
  12794. lastThis,
  12795. maxWait,
  12796. result,
  12797. timerId,
  12798. lastCallTime,
  12799. lastInvokeTime = 0,
  12800. leading = false,
  12801. maxing = false,
  12802. trailing = true;
  12803. if (typeof func != 'function') {
  12804. throw new TypeError(FUNC_ERROR_TEXT);
  12805. }
  12806. wait = toNumber(wait) || 0;
  12807. if (isObject(options)) {
  12808. leading = !!options.leading;
  12809. maxing = 'maxWait' in options;
  12810. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  12811. trailing = 'trailing' in options ? !!options.trailing : trailing;
  12812. }
  12813. function invokeFunc(time) {
  12814. var args = lastArgs,
  12815. thisArg = lastThis;
  12816. lastArgs = lastThis = undefined;
  12817. lastInvokeTime = time;
  12818. result = func.apply(thisArg, args);
  12819. return result;
  12820. }
  12821. function leadingEdge(time) {
  12822. // Reset any `maxWait` timer.
  12823. lastInvokeTime = time;
  12824. // Start the timer for the trailing edge.
  12825. timerId = setTimeout(timerExpired, wait);
  12826. // Invoke the leading edge.
  12827. return leading ? invokeFunc(time) : result;
  12828. }
  12829. function remainingWait(time) {
  12830. var timeSinceLastCall = time - lastCallTime,
  12831. timeSinceLastInvoke = time - lastInvokeTime,
  12832. result = wait - timeSinceLastCall;
  12833. return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
  12834. }
  12835. function shouldInvoke(time) {
  12836. var timeSinceLastCall = time - lastCallTime,
  12837. timeSinceLastInvoke = time - lastInvokeTime;
  12838. // Either this is the first call, activity has stopped and we're at the
  12839. // trailing edge, the system time has gone backwards and we're treating
  12840. // it as the trailing edge, or we've hit the `maxWait` limit.
  12841. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  12842. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  12843. }
  12844. function timerExpired() {
  12845. var time = now();
  12846. if (shouldInvoke(time)) {
  12847. return trailingEdge(time);
  12848. }
  12849. // Restart the timer.
  12850. timerId = setTimeout(timerExpired, remainingWait(time));
  12851. }
  12852. function trailingEdge(time) {
  12853. timerId = undefined;
  12854. // Only invoke if we have `lastArgs` which means `func` has been
  12855. // debounced at least once.
  12856. if (trailing && lastArgs) {
  12857. return invokeFunc(time);
  12858. }
  12859. lastArgs = lastThis = undefined;
  12860. return result;
  12861. }
  12862. function cancel() {
  12863. if (timerId !== undefined) {
  12864. clearTimeout(timerId);
  12865. }
  12866. lastInvokeTime = 0;
  12867. lastArgs = lastCallTime = lastThis = timerId = undefined;
  12868. }
  12869. function flush() {
  12870. return timerId === undefined ? result : trailingEdge(now());
  12871. }
  12872. function debounced() {
  12873. var time = now(),
  12874. isInvoking = shouldInvoke(time);
  12875. lastArgs = arguments;
  12876. lastThis = this;
  12877. lastCallTime = time;
  12878. if (isInvoking) {
  12879. if (timerId === undefined) {
  12880. return leadingEdge(lastCallTime);
  12881. }
  12882. if (maxing) {
  12883. // Handle invocations in a tight loop.
  12884. timerId = setTimeout(timerExpired, wait);
  12885. return invokeFunc(lastCallTime);
  12886. }
  12887. }
  12888. if (timerId === undefined) {
  12889. timerId = setTimeout(timerExpired, wait);
  12890. }
  12891. return result;
  12892. }
  12893. debounced.cancel = cancel;
  12894. debounced.flush = flush;
  12895. return debounced;
  12896. }
  12897. /**
  12898. * Checks if `value` is the
  12899. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  12900. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  12901. *
  12902. * @static
  12903. * @memberOf _
  12904. * @since 0.1.0
  12905. * @category Lang
  12906. * @param {*} value The value to check.
  12907. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  12908. * @example
  12909. *
  12910. * _.isObject({});
  12911. * // => true
  12912. *
  12913. * _.isObject([1, 2, 3]);
  12914. * // => true
  12915. *
  12916. * _.isObject(_.noop);
  12917. * // => true
  12918. *
  12919. * _.isObject(null);
  12920. * // => false
  12921. */
  12922. function isObject(value) {
  12923. var type = typeof value;
  12924. return !!value && (type == 'object' || type == 'function');
  12925. }
  12926. /**
  12927. * Checks if `value` is object-like. A value is object-like if it's not `null`
  12928. * and has a `typeof` result of "object".
  12929. *
  12930. * @static
  12931. * @memberOf _
  12932. * @since 4.0.0
  12933. * @category Lang
  12934. * @param {*} value The value to check.
  12935. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  12936. * @example
  12937. *
  12938. * _.isObjectLike({});
  12939. * // => true
  12940. *
  12941. * _.isObjectLike([1, 2, 3]);
  12942. * // => true
  12943. *
  12944. * _.isObjectLike(_.noop);
  12945. * // => false
  12946. *
  12947. * _.isObjectLike(null);
  12948. * // => false
  12949. */
  12950. function isObjectLike(value) {
  12951. return !!value && typeof value == 'object';
  12952. }
  12953. /**
  12954. * Checks if `value` is classified as a `Symbol` primitive or object.
  12955. *
  12956. * @static
  12957. * @memberOf _
  12958. * @since 4.0.0
  12959. * @category Lang
  12960. * @param {*} value The value to check.
  12961. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  12962. * @example
  12963. *
  12964. * _.isSymbol(Symbol.iterator);
  12965. * // => true
  12966. *
  12967. * _.isSymbol('abc');
  12968. * // => false
  12969. */
  12970. function isSymbol(value) {
  12971. return typeof value == 'symbol' ||
  12972. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  12973. }
  12974. /**
  12975. * Converts `value` to a number.
  12976. *
  12977. * @static
  12978. * @memberOf _
  12979. * @since 4.0.0
  12980. * @category Lang
  12981. * @param {*} value The value to process.
  12982. * @returns {number} Returns the number.
  12983. * @example
  12984. *
  12985. * _.toNumber(3.2);
  12986. * // => 3.2
  12987. *
  12988. * _.toNumber(Number.MIN_VALUE);
  12989. * // => 5e-324
  12990. *
  12991. * _.toNumber(Infinity);
  12992. * // => Infinity
  12993. *
  12994. * _.toNumber('3.2');
  12995. * // => 3.2
  12996. */
  12997. function toNumber(value) {
  12998. if (typeof value == 'number') {
  12999. return value;
  13000. }
  13001. if (isSymbol(value)) {
  13002. return NAN;
  13003. }
  13004. if (isObject(value)) {
  13005. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  13006. value = isObject(other) ? (other + '') : other;
  13007. }
  13008. if (typeof value != 'string') {
  13009. return value === 0 ? value : +value;
  13010. }
  13011. value = value.replace(reTrim, '');
  13012. var isBinary = reIsBinary.test(value);
  13013. return (isBinary || reIsOctal.test(value))
  13014. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  13015. : (reIsBadHex.test(value) ? NAN : +value);
  13016. }
  13017. var lodash_debounce = debounce$1;
  13018. /**
  13019. * lodash (Custom Build) <https://lodash.com/>
  13020. * Build: `lodash modularize exports="npm" -o ./`
  13021. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  13022. * Released under MIT license <https://lodash.com/license>
  13023. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  13024. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  13025. */
  13026. var lodash_clonedeep = createCommonjsModule$1(function (module, exports) {
  13027. /** Used as the size to enable large array optimizations. */
  13028. var LARGE_ARRAY_SIZE = 200;
  13029. /** Used to stand-in for `undefined` hash values. */
  13030. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  13031. /** Used as references for various `Number` constants. */
  13032. var MAX_SAFE_INTEGER = 9007199254740991;
  13033. /** `Object#toString` result references. */
  13034. var argsTag = '[object Arguments]',
  13035. arrayTag = '[object Array]',
  13036. boolTag = '[object Boolean]',
  13037. dateTag = '[object Date]',
  13038. errorTag = '[object Error]',
  13039. funcTag = '[object Function]',
  13040. genTag = '[object GeneratorFunction]',
  13041. mapTag = '[object Map]',
  13042. numberTag = '[object Number]',
  13043. objectTag = '[object Object]',
  13044. promiseTag = '[object Promise]',
  13045. regexpTag = '[object RegExp]',
  13046. setTag = '[object Set]',
  13047. stringTag = '[object String]',
  13048. symbolTag = '[object Symbol]',
  13049. weakMapTag = '[object WeakMap]';
  13050. var arrayBufferTag = '[object ArrayBuffer]',
  13051. dataViewTag = '[object DataView]',
  13052. float32Tag = '[object Float32Array]',
  13053. float64Tag = '[object Float64Array]',
  13054. int8Tag = '[object Int8Array]',
  13055. int16Tag = '[object Int16Array]',
  13056. int32Tag = '[object Int32Array]',
  13057. uint8Tag = '[object Uint8Array]',
  13058. uint8ClampedTag = '[object Uint8ClampedArray]',
  13059. uint16Tag = '[object Uint16Array]',
  13060. uint32Tag = '[object Uint32Array]';
  13061. /**
  13062. * Used to match `RegExp`
  13063. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  13064. */
  13065. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  13066. /** Used to match `RegExp` flags from their coerced string values. */
  13067. var reFlags = /\w*$/;
  13068. /** Used to detect host constructors (Safari). */
  13069. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  13070. /** Used to detect unsigned integer values. */
  13071. var reIsUint = /^(?:0|[1-9]\d*)$/;
  13072. /** Used to identify `toStringTag` values supported by `_.clone`. */
  13073. var cloneableTags = {};
  13074. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  13075. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  13076. cloneableTags[boolTag] = cloneableTags[dateTag] =
  13077. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  13078. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  13079. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  13080. cloneableTags[numberTag] = cloneableTags[objectTag] =
  13081. cloneableTags[regexpTag] = cloneableTags[setTag] =
  13082. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  13083. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  13084. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  13085. cloneableTags[errorTag] = cloneableTags[funcTag] =
  13086. cloneableTags[weakMapTag] = false;
  13087. /** Detect free variable `global` from Node.js. */
  13088. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  13089. /** Detect free variable `self`. */
  13090. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  13091. /** Used as a reference to the global object. */
  13092. var root = freeGlobal || freeSelf || Function('return this')();
  13093. /** Detect free variable `exports`. */
  13094. var freeExports = exports && !exports.nodeType && exports;
  13095. /** Detect free variable `module`. */
  13096. var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
  13097. /** Detect the popular CommonJS extension `module.exports`. */
  13098. var moduleExports = freeModule && freeModule.exports === freeExports;
  13099. /**
  13100. * Adds the key-value `pair` to `map`.
  13101. *
  13102. * @private
  13103. * @param {Object} map The map to modify.
  13104. * @param {Array} pair The key-value pair to add.
  13105. * @returns {Object} Returns `map`.
  13106. */
  13107. function addMapEntry(map, pair) {
  13108. // Don't return `map.set` because it's not chainable in IE 11.
  13109. map.set(pair[0], pair[1]);
  13110. return map;
  13111. }
  13112. /**
  13113. * Adds `value` to `set`.
  13114. *
  13115. * @private
  13116. * @param {Object} set The set to modify.
  13117. * @param {*} value The value to add.
  13118. * @returns {Object} Returns `set`.
  13119. */
  13120. function addSetEntry(set, value) {
  13121. // Don't return `set.add` because it's not chainable in IE 11.
  13122. set.add(value);
  13123. return set;
  13124. }
  13125. /**
  13126. * A specialized version of `_.forEach` for arrays without support for
  13127. * iteratee shorthands.
  13128. *
  13129. * @private
  13130. * @param {Array} [array] The array to iterate over.
  13131. * @param {Function} iteratee The function invoked per iteration.
  13132. * @returns {Array} Returns `array`.
  13133. */
  13134. function arrayEach(array, iteratee) {
  13135. var index = -1,
  13136. length = array ? array.length : 0;
  13137. while (++index < length) {
  13138. if (iteratee(array[index], index, array) === false) {
  13139. break;
  13140. }
  13141. }
  13142. return array;
  13143. }
  13144. /**
  13145. * Appends the elements of `values` to `array`.
  13146. *
  13147. * @private
  13148. * @param {Array} array The array to modify.
  13149. * @param {Array} values The values to append.
  13150. * @returns {Array} Returns `array`.
  13151. */
  13152. function arrayPush(array, values) {
  13153. var index = -1,
  13154. length = values.length,
  13155. offset = array.length;
  13156. while (++index < length) {
  13157. array[offset + index] = values[index];
  13158. }
  13159. return array;
  13160. }
  13161. /**
  13162. * A specialized version of `_.reduce` for arrays without support for
  13163. * iteratee shorthands.
  13164. *
  13165. * @private
  13166. * @param {Array} [array] The array to iterate over.
  13167. * @param {Function} iteratee The function invoked per iteration.
  13168. * @param {*} [accumulator] The initial value.
  13169. * @param {boolean} [initAccum] Specify using the first element of `array` as
  13170. * the initial value.
  13171. * @returns {*} Returns the accumulated value.
  13172. */
  13173. function arrayReduce(array, iteratee, accumulator, initAccum) {
  13174. var index = -1,
  13175. length = array ? array.length : 0;
  13176. if (initAccum && length) {
  13177. accumulator = array[++index];
  13178. }
  13179. while (++index < length) {
  13180. accumulator = iteratee(accumulator, array[index], index, array);
  13181. }
  13182. return accumulator;
  13183. }
  13184. /**
  13185. * The base implementation of `_.times` without support for iteratee shorthands
  13186. * or max array length checks.
  13187. *
  13188. * @private
  13189. * @param {number} n The number of times to invoke `iteratee`.
  13190. * @param {Function} iteratee The function invoked per iteration.
  13191. * @returns {Array} Returns the array of results.
  13192. */
  13193. function baseTimes(n, iteratee) {
  13194. var index = -1,
  13195. result = Array(n);
  13196. while (++index < n) {
  13197. result[index] = iteratee(index);
  13198. }
  13199. return result;
  13200. }
  13201. /**
  13202. * Gets the value at `key` of `object`.
  13203. *
  13204. * @private
  13205. * @param {Object} [object] The object to query.
  13206. * @param {string} key The key of the property to get.
  13207. * @returns {*} Returns the property value.
  13208. */
  13209. function getValue(object, key) {
  13210. return object == null ? undefined : object[key];
  13211. }
  13212. /**
  13213. * Checks if `value` is a host object in IE < 9.
  13214. *
  13215. * @private
  13216. * @param {*} value The value to check.
  13217. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  13218. */
  13219. function isHostObject(value) {
  13220. // Many host objects are `Object` objects that can coerce to strings
  13221. // despite having improperly defined `toString` methods.
  13222. var result = false;
  13223. if (value != null && typeof value.toString != 'function') {
  13224. try {
  13225. result = !!(value + '');
  13226. } catch (e) {}
  13227. }
  13228. return result;
  13229. }
  13230. /**
  13231. * Converts `map` to its key-value pairs.
  13232. *
  13233. * @private
  13234. * @param {Object} map The map to convert.
  13235. * @returns {Array} Returns the key-value pairs.
  13236. */
  13237. function mapToArray(map) {
  13238. var index = -1,
  13239. result = Array(map.size);
  13240. map.forEach(function(value, key) {
  13241. result[++index] = [key, value];
  13242. });
  13243. return result;
  13244. }
  13245. /**
  13246. * Creates a unary function that invokes `func` with its argument transformed.
  13247. *
  13248. * @private
  13249. * @param {Function} func The function to wrap.
  13250. * @param {Function} transform The argument transform.
  13251. * @returns {Function} Returns the new function.
  13252. */
  13253. function overArg(func, transform) {
  13254. return function(arg) {
  13255. return func(transform(arg));
  13256. };
  13257. }
  13258. /**
  13259. * Converts `set` to an array of its values.
  13260. *
  13261. * @private
  13262. * @param {Object} set The set to convert.
  13263. * @returns {Array} Returns the values.
  13264. */
  13265. function setToArray(set) {
  13266. var index = -1,
  13267. result = Array(set.size);
  13268. set.forEach(function(value) {
  13269. result[++index] = value;
  13270. });
  13271. return result;
  13272. }
  13273. /** Used for built-in method references. */
  13274. var arrayProto = Array.prototype,
  13275. funcProto = Function.prototype,
  13276. objectProto = Object.prototype;
  13277. /** Used to detect overreaching core-js shims. */
  13278. var coreJsData = root['__core-js_shared__'];
  13279. /** Used to detect methods masquerading as native. */
  13280. var maskSrcKey = (function() {
  13281. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  13282. return uid ? ('Symbol(src)_1.' + uid) : '';
  13283. }());
  13284. /** Used to resolve the decompiled source of functions. */
  13285. var funcToString = funcProto.toString;
  13286. /** Used to check objects for own properties. */
  13287. var hasOwnProperty = objectProto.hasOwnProperty;
  13288. /**
  13289. * Used to resolve the
  13290. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  13291. * of values.
  13292. */
  13293. var objectToString = objectProto.toString;
  13294. /** Used to detect if a method is native. */
  13295. var reIsNative = RegExp('^' +
  13296. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  13297. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  13298. );
  13299. /** Built-in value references. */
  13300. var Buffer = moduleExports ? root.Buffer : undefined,
  13301. Symbol = root.Symbol,
  13302. Uint8Array = root.Uint8Array,
  13303. getPrototype = overArg(Object.getPrototypeOf, Object),
  13304. objectCreate = Object.create,
  13305. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  13306. splice = arrayProto.splice;
  13307. /* Built-in method references for those with the same name as other `lodash` methods. */
  13308. var nativeGetSymbols = Object.getOwnPropertySymbols,
  13309. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  13310. nativeKeys = overArg(Object.keys, Object);
  13311. /* Built-in method references that are verified to be native. */
  13312. var DataView = getNative(root, 'DataView'),
  13313. Map = getNative(root, 'Map'),
  13314. Promise = getNative(root, 'Promise'),
  13315. Set = getNative(root, 'Set'),
  13316. WeakMap = getNative(root, 'WeakMap'),
  13317. nativeCreate = getNative(Object, 'create');
  13318. /** Used to detect maps, sets, and weakmaps. */
  13319. var dataViewCtorString = toSource(DataView),
  13320. mapCtorString = toSource(Map),
  13321. promiseCtorString = toSource(Promise),
  13322. setCtorString = toSource(Set),
  13323. weakMapCtorString = toSource(WeakMap);
  13324. /** Used to convert symbols to primitives and strings. */
  13325. var symbolProto = Symbol ? Symbol.prototype : undefined,
  13326. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  13327. /**
  13328. * Creates a hash object.
  13329. *
  13330. * @private
  13331. * @constructor
  13332. * @param {Array} [entries] The key-value pairs to cache.
  13333. */
  13334. function Hash(entries) {
  13335. var index = -1,
  13336. length = entries ? entries.length : 0;
  13337. this.clear();
  13338. while (++index < length) {
  13339. var entry = entries[index];
  13340. this.set(entry[0], entry[1]);
  13341. }
  13342. }
  13343. /**
  13344. * Removes all key-value entries from the hash.
  13345. *
  13346. * @private
  13347. * @name clear
  13348. * @memberOf Hash
  13349. */
  13350. function hashClear() {
  13351. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  13352. }
  13353. /**
  13354. * Removes `key` and its value from the hash.
  13355. *
  13356. * @private
  13357. * @name delete
  13358. * @memberOf Hash
  13359. * @param {Object} hash The hash to modify.
  13360. * @param {string} key The key of the value to remove.
  13361. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13362. */
  13363. function hashDelete(key) {
  13364. return this.has(key) && delete this.__data__[key];
  13365. }
  13366. /**
  13367. * Gets the hash value for `key`.
  13368. *
  13369. * @private
  13370. * @name get
  13371. * @memberOf Hash
  13372. * @param {string} key The key of the value to get.
  13373. * @returns {*} Returns the entry value.
  13374. */
  13375. function hashGet(key) {
  13376. var data = this.__data__;
  13377. if (nativeCreate) {
  13378. var result = data[key];
  13379. return result === HASH_UNDEFINED ? undefined : result;
  13380. }
  13381. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  13382. }
  13383. /**
  13384. * Checks if a hash value for `key` exists.
  13385. *
  13386. * @private
  13387. * @name has
  13388. * @memberOf Hash
  13389. * @param {string} key The key of the entry to check.
  13390. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13391. */
  13392. function hashHas(key) {
  13393. var data = this.__data__;
  13394. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  13395. }
  13396. /**
  13397. * Sets the hash `key` to `value`.
  13398. *
  13399. * @private
  13400. * @name set
  13401. * @memberOf Hash
  13402. * @param {string} key The key of the value to set.
  13403. * @param {*} value The value to set.
  13404. * @returns {Object} Returns the hash instance.
  13405. */
  13406. function hashSet(key, value) {
  13407. var data = this.__data__;
  13408. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  13409. return this;
  13410. }
  13411. // Add methods to `Hash`.
  13412. Hash.prototype.clear = hashClear;
  13413. Hash.prototype['delete'] = hashDelete;
  13414. Hash.prototype.get = hashGet;
  13415. Hash.prototype.has = hashHas;
  13416. Hash.prototype.set = hashSet;
  13417. /**
  13418. * Creates an list cache object.
  13419. *
  13420. * @private
  13421. * @constructor
  13422. * @param {Array} [entries] The key-value pairs to cache.
  13423. */
  13424. function ListCache(entries) {
  13425. var index = -1,
  13426. length = entries ? entries.length : 0;
  13427. this.clear();
  13428. while (++index < length) {
  13429. var entry = entries[index];
  13430. this.set(entry[0], entry[1]);
  13431. }
  13432. }
  13433. /**
  13434. * Removes all key-value entries from the list cache.
  13435. *
  13436. * @private
  13437. * @name clear
  13438. * @memberOf ListCache
  13439. */
  13440. function listCacheClear() {
  13441. this.__data__ = [];
  13442. }
  13443. /**
  13444. * Removes `key` and its value from the list cache.
  13445. *
  13446. * @private
  13447. * @name delete
  13448. * @memberOf ListCache
  13449. * @param {string} key The key of the value to remove.
  13450. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13451. */
  13452. function listCacheDelete(key) {
  13453. var data = this.__data__,
  13454. index = assocIndexOf(data, key);
  13455. if (index < 0) {
  13456. return false;
  13457. }
  13458. var lastIndex = data.length - 1;
  13459. if (index == lastIndex) {
  13460. data.pop();
  13461. } else {
  13462. splice.call(data, index, 1);
  13463. }
  13464. return true;
  13465. }
  13466. /**
  13467. * Gets the list cache value for `key`.
  13468. *
  13469. * @private
  13470. * @name get
  13471. * @memberOf ListCache
  13472. * @param {string} key The key of the value to get.
  13473. * @returns {*} Returns the entry value.
  13474. */
  13475. function listCacheGet(key) {
  13476. var data = this.__data__,
  13477. index = assocIndexOf(data, key);
  13478. return index < 0 ? undefined : data[index][1];
  13479. }
  13480. /**
  13481. * Checks if a list cache value for `key` exists.
  13482. *
  13483. * @private
  13484. * @name has
  13485. * @memberOf ListCache
  13486. * @param {string} key The key of the entry to check.
  13487. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13488. */
  13489. function listCacheHas(key) {
  13490. return assocIndexOf(this.__data__, key) > -1;
  13491. }
  13492. /**
  13493. * Sets the list cache `key` to `value`.
  13494. *
  13495. * @private
  13496. * @name set
  13497. * @memberOf ListCache
  13498. * @param {string} key The key of the value to set.
  13499. * @param {*} value The value to set.
  13500. * @returns {Object} Returns the list cache instance.
  13501. */
  13502. function listCacheSet(key, value) {
  13503. var data = this.__data__,
  13504. index = assocIndexOf(data, key);
  13505. if (index < 0) {
  13506. data.push([key, value]);
  13507. } else {
  13508. data[index][1] = value;
  13509. }
  13510. return this;
  13511. }
  13512. // Add methods to `ListCache`.
  13513. ListCache.prototype.clear = listCacheClear;
  13514. ListCache.prototype['delete'] = listCacheDelete;
  13515. ListCache.prototype.get = listCacheGet;
  13516. ListCache.prototype.has = listCacheHas;
  13517. ListCache.prototype.set = listCacheSet;
  13518. /**
  13519. * Creates a map cache object to store key-value pairs.
  13520. *
  13521. * @private
  13522. * @constructor
  13523. * @param {Array} [entries] The key-value pairs to cache.
  13524. */
  13525. function MapCache(entries) {
  13526. var index = -1,
  13527. length = entries ? entries.length : 0;
  13528. this.clear();
  13529. while (++index < length) {
  13530. var entry = entries[index];
  13531. this.set(entry[0], entry[1]);
  13532. }
  13533. }
  13534. /**
  13535. * Removes all key-value entries from the map.
  13536. *
  13537. * @private
  13538. * @name clear
  13539. * @memberOf MapCache
  13540. */
  13541. function mapCacheClear() {
  13542. this.__data__ = {
  13543. 'hash': new Hash,
  13544. 'map': new (Map || ListCache),
  13545. 'string': new Hash
  13546. };
  13547. }
  13548. /**
  13549. * Removes `key` and its value from the map.
  13550. *
  13551. * @private
  13552. * @name delete
  13553. * @memberOf MapCache
  13554. * @param {string} key The key of the value to remove.
  13555. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13556. */
  13557. function mapCacheDelete(key) {
  13558. return getMapData(this, key)['delete'](key);
  13559. }
  13560. /**
  13561. * Gets the map value for `key`.
  13562. *
  13563. * @private
  13564. * @name get
  13565. * @memberOf MapCache
  13566. * @param {string} key The key of the value to get.
  13567. * @returns {*} Returns the entry value.
  13568. */
  13569. function mapCacheGet(key) {
  13570. return getMapData(this, key).get(key);
  13571. }
  13572. /**
  13573. * Checks if a map value for `key` exists.
  13574. *
  13575. * @private
  13576. * @name has
  13577. * @memberOf MapCache
  13578. * @param {string} key The key of the entry to check.
  13579. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13580. */
  13581. function mapCacheHas(key) {
  13582. return getMapData(this, key).has(key);
  13583. }
  13584. /**
  13585. * Sets the map `key` to `value`.
  13586. *
  13587. * @private
  13588. * @name set
  13589. * @memberOf MapCache
  13590. * @param {string} key The key of the value to set.
  13591. * @param {*} value The value to set.
  13592. * @returns {Object} Returns the map cache instance.
  13593. */
  13594. function mapCacheSet(key, value) {
  13595. getMapData(this, key).set(key, value);
  13596. return this;
  13597. }
  13598. // Add methods to `MapCache`.
  13599. MapCache.prototype.clear = mapCacheClear;
  13600. MapCache.prototype['delete'] = mapCacheDelete;
  13601. MapCache.prototype.get = mapCacheGet;
  13602. MapCache.prototype.has = mapCacheHas;
  13603. MapCache.prototype.set = mapCacheSet;
  13604. /**
  13605. * Creates a stack cache object to store key-value pairs.
  13606. *
  13607. * @private
  13608. * @constructor
  13609. * @param {Array} [entries] The key-value pairs to cache.
  13610. */
  13611. function Stack(entries) {
  13612. this.__data__ = new ListCache(entries);
  13613. }
  13614. /**
  13615. * Removes all key-value entries from the stack.
  13616. *
  13617. * @private
  13618. * @name clear
  13619. * @memberOf Stack
  13620. */
  13621. function stackClear() {
  13622. this.__data__ = new ListCache;
  13623. }
  13624. /**
  13625. * Removes `key` and its value from the stack.
  13626. *
  13627. * @private
  13628. * @name delete
  13629. * @memberOf Stack
  13630. * @param {string} key The key of the value to remove.
  13631. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  13632. */
  13633. function stackDelete(key) {
  13634. return this.__data__['delete'](key);
  13635. }
  13636. /**
  13637. * Gets the stack value for `key`.
  13638. *
  13639. * @private
  13640. * @name get
  13641. * @memberOf Stack
  13642. * @param {string} key The key of the value to get.
  13643. * @returns {*} Returns the entry value.
  13644. */
  13645. function stackGet(key) {
  13646. return this.__data__.get(key);
  13647. }
  13648. /**
  13649. * Checks if a stack value for `key` exists.
  13650. *
  13651. * @private
  13652. * @name has
  13653. * @memberOf Stack
  13654. * @param {string} key The key of the entry to check.
  13655. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  13656. */
  13657. function stackHas(key) {
  13658. return this.__data__.has(key);
  13659. }
  13660. /**
  13661. * Sets the stack `key` to `value`.
  13662. *
  13663. * @private
  13664. * @name set
  13665. * @memberOf Stack
  13666. * @param {string} key The key of the value to set.
  13667. * @param {*} value The value to set.
  13668. * @returns {Object} Returns the stack cache instance.
  13669. */
  13670. function stackSet(key, value) {
  13671. var cache = this.__data__;
  13672. if (cache instanceof ListCache) {
  13673. var pairs = cache.__data__;
  13674. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  13675. pairs.push([key, value]);
  13676. return this;
  13677. }
  13678. cache = this.__data__ = new MapCache(pairs);
  13679. }
  13680. cache.set(key, value);
  13681. return this;
  13682. }
  13683. // Add methods to `Stack`.
  13684. Stack.prototype.clear = stackClear;
  13685. Stack.prototype['delete'] = stackDelete;
  13686. Stack.prototype.get = stackGet;
  13687. Stack.prototype.has = stackHas;
  13688. Stack.prototype.set = stackSet;
  13689. /**
  13690. * Creates an array of the enumerable property names of the array-like `value`.
  13691. *
  13692. * @private
  13693. * @param {*} value The value to query.
  13694. * @param {boolean} inherited Specify returning inherited property names.
  13695. * @returns {Array} Returns the array of property names.
  13696. */
  13697. function arrayLikeKeys(value, inherited) {
  13698. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  13699. // Safari 9 makes `arguments.length` enumerable in strict mode.
  13700. var result = (isArray(value) || isArguments(value))
  13701. ? baseTimes(value.length, String)
  13702. : [];
  13703. var length = result.length,
  13704. skipIndexes = !!length;
  13705. for (var key in value) {
  13706. if ((inherited || hasOwnProperty.call(value, key)) &&
  13707. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  13708. result.push(key);
  13709. }
  13710. }
  13711. return result;
  13712. }
  13713. /**
  13714. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  13715. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  13716. * for equality comparisons.
  13717. *
  13718. * @private
  13719. * @param {Object} object The object to modify.
  13720. * @param {string} key The key of the property to assign.
  13721. * @param {*} value The value to assign.
  13722. */
  13723. function assignValue(object, key, value) {
  13724. var objValue = object[key];
  13725. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  13726. (value === undefined && !(key in object))) {
  13727. object[key] = value;
  13728. }
  13729. }
  13730. /**
  13731. * Gets the index at which the `key` is found in `array` of key-value pairs.
  13732. *
  13733. * @private
  13734. * @param {Array} array The array to inspect.
  13735. * @param {*} key The key to search for.
  13736. * @returns {number} Returns the index of the matched value, else `-1`.
  13737. */
  13738. function assocIndexOf(array, key) {
  13739. var length = array.length;
  13740. while (length--) {
  13741. if (eq(array[length][0], key)) {
  13742. return length;
  13743. }
  13744. }
  13745. return -1;
  13746. }
  13747. /**
  13748. * The base implementation of `_.assign` without support for multiple sources
  13749. * or `customizer` functions.
  13750. *
  13751. * @private
  13752. * @param {Object} object The destination object.
  13753. * @param {Object} source The source object.
  13754. * @returns {Object} Returns `object`.
  13755. */
  13756. function baseAssign(object, source) {
  13757. return object && copyObject(source, keys(source), object);
  13758. }
  13759. /**
  13760. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  13761. * traversed objects.
  13762. *
  13763. * @private
  13764. * @param {*} value The value to clone.
  13765. * @param {boolean} [isDeep] Specify a deep clone.
  13766. * @param {boolean} [isFull] Specify a clone including symbols.
  13767. * @param {Function} [customizer] The function to customize cloning.
  13768. * @param {string} [key] The key of `value`.
  13769. * @param {Object} [object] The parent object of `value`.
  13770. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  13771. * @returns {*} Returns the cloned value.
  13772. */
  13773. function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
  13774. var result;
  13775. if (customizer) {
  13776. result = object ? customizer(value, key, object, stack) : customizer(value);
  13777. }
  13778. if (result !== undefined) {
  13779. return result;
  13780. }
  13781. if (!isObject(value)) {
  13782. return value;
  13783. }
  13784. var isArr = isArray(value);
  13785. if (isArr) {
  13786. result = initCloneArray(value);
  13787. if (!isDeep) {
  13788. return copyArray(value, result);
  13789. }
  13790. } else {
  13791. var tag = getTag(value),
  13792. isFunc = tag == funcTag || tag == genTag;
  13793. if (isBuffer(value)) {
  13794. return cloneBuffer(value, isDeep);
  13795. }
  13796. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  13797. if (isHostObject(value)) {
  13798. return object ? value : {};
  13799. }
  13800. result = initCloneObject(isFunc ? {} : value);
  13801. if (!isDeep) {
  13802. return copySymbols(value, baseAssign(result, value));
  13803. }
  13804. } else {
  13805. if (!cloneableTags[tag]) {
  13806. return object ? value : {};
  13807. }
  13808. result = initCloneByTag(value, tag, baseClone, isDeep);
  13809. }
  13810. }
  13811. // Check for circular references and return its corresponding clone.
  13812. stack || (stack = new Stack);
  13813. var stacked = stack.get(value);
  13814. if (stacked) {
  13815. return stacked;
  13816. }
  13817. stack.set(value, result);
  13818. if (!isArr) {
  13819. var props = isFull ? getAllKeys(value) : keys(value);
  13820. }
  13821. arrayEach(props || value, function(subValue, key) {
  13822. if (props) {
  13823. key = subValue;
  13824. subValue = value[key];
  13825. }
  13826. // Recursively populate clone (susceptible to call stack limits).
  13827. assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
  13828. });
  13829. return result;
  13830. }
  13831. /**
  13832. * The base implementation of `_.create` without support for assigning
  13833. * properties to the created object.
  13834. *
  13835. * @private
  13836. * @param {Object} prototype The object to inherit from.
  13837. * @returns {Object} Returns the new object.
  13838. */
  13839. function baseCreate(proto) {
  13840. return isObject(proto) ? objectCreate(proto) : {};
  13841. }
  13842. /**
  13843. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  13844. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  13845. * symbols of `object`.
  13846. *
  13847. * @private
  13848. * @param {Object} object The object to query.
  13849. * @param {Function} keysFunc The function to get the keys of `object`.
  13850. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  13851. * @returns {Array} Returns the array of property names and symbols.
  13852. */
  13853. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  13854. var result = keysFunc(object);
  13855. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  13856. }
  13857. /**
  13858. * The base implementation of `getTag`.
  13859. *
  13860. * @private
  13861. * @param {*} value The value to query.
  13862. * @returns {string} Returns the `toStringTag`.
  13863. */
  13864. function baseGetTag(value) {
  13865. return objectToString.call(value);
  13866. }
  13867. /**
  13868. * The base implementation of `_.isNative` without bad shim checks.
  13869. *
  13870. * @private
  13871. * @param {*} value The value to check.
  13872. * @returns {boolean} Returns `true` if `value` is a native function,
  13873. * else `false`.
  13874. */
  13875. function baseIsNative(value) {
  13876. if (!isObject(value) || isMasked(value)) {
  13877. return false;
  13878. }
  13879. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  13880. return pattern.test(toSource(value));
  13881. }
  13882. /**
  13883. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  13884. *
  13885. * @private
  13886. * @param {Object} object The object to query.
  13887. * @returns {Array} Returns the array of property names.
  13888. */
  13889. function baseKeys(object) {
  13890. if (!isPrototype(object)) {
  13891. return nativeKeys(object);
  13892. }
  13893. var result = [];
  13894. for (var key in Object(object)) {
  13895. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  13896. result.push(key);
  13897. }
  13898. }
  13899. return result;
  13900. }
  13901. /**
  13902. * Creates a clone of `buffer`.
  13903. *
  13904. * @private
  13905. * @param {Buffer} buffer The buffer to clone.
  13906. * @param {boolean} [isDeep] Specify a deep clone.
  13907. * @returns {Buffer} Returns the cloned buffer.
  13908. */
  13909. function cloneBuffer(buffer, isDeep) {
  13910. if (isDeep) {
  13911. return buffer.slice();
  13912. }
  13913. var result = new buffer.constructor(buffer.length);
  13914. buffer.copy(result);
  13915. return result;
  13916. }
  13917. /**
  13918. * Creates a clone of `arrayBuffer`.
  13919. *
  13920. * @private
  13921. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  13922. * @returns {ArrayBuffer} Returns the cloned array buffer.
  13923. */
  13924. function cloneArrayBuffer(arrayBuffer) {
  13925. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  13926. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  13927. return result;
  13928. }
  13929. /**
  13930. * Creates a clone of `dataView`.
  13931. *
  13932. * @private
  13933. * @param {Object} dataView The data view to clone.
  13934. * @param {boolean} [isDeep] Specify a deep clone.
  13935. * @returns {Object} Returns the cloned data view.
  13936. */
  13937. function cloneDataView(dataView, isDeep) {
  13938. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  13939. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  13940. }
  13941. /**
  13942. * Creates a clone of `map`.
  13943. *
  13944. * @private
  13945. * @param {Object} map The map to clone.
  13946. * @param {Function} cloneFunc The function to clone values.
  13947. * @param {boolean} [isDeep] Specify a deep clone.
  13948. * @returns {Object} Returns the cloned map.
  13949. */
  13950. function cloneMap(map, isDeep, cloneFunc) {
  13951. var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
  13952. return arrayReduce(array, addMapEntry, new map.constructor);
  13953. }
  13954. /**
  13955. * Creates a clone of `regexp`.
  13956. *
  13957. * @private
  13958. * @param {Object} regexp The regexp to clone.
  13959. * @returns {Object} Returns the cloned regexp.
  13960. */
  13961. function cloneRegExp(regexp) {
  13962. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  13963. result.lastIndex = regexp.lastIndex;
  13964. return result;
  13965. }
  13966. /**
  13967. * Creates a clone of `set`.
  13968. *
  13969. * @private
  13970. * @param {Object} set The set to clone.
  13971. * @param {Function} cloneFunc The function to clone values.
  13972. * @param {boolean} [isDeep] Specify a deep clone.
  13973. * @returns {Object} Returns the cloned set.
  13974. */
  13975. function cloneSet(set, isDeep, cloneFunc) {
  13976. var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
  13977. return arrayReduce(array, addSetEntry, new set.constructor);
  13978. }
  13979. /**
  13980. * Creates a clone of the `symbol` object.
  13981. *
  13982. * @private
  13983. * @param {Object} symbol The symbol object to clone.
  13984. * @returns {Object} Returns the cloned symbol object.
  13985. */
  13986. function cloneSymbol(symbol) {
  13987. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  13988. }
  13989. /**
  13990. * Creates a clone of `typedArray`.
  13991. *
  13992. * @private
  13993. * @param {Object} typedArray The typed array to clone.
  13994. * @param {boolean} [isDeep] Specify a deep clone.
  13995. * @returns {Object} Returns the cloned typed array.
  13996. */
  13997. function cloneTypedArray(typedArray, isDeep) {
  13998. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  13999. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  14000. }
  14001. /**
  14002. * Copies the values of `source` to `array`.
  14003. *
  14004. * @private
  14005. * @param {Array} source The array to copy values from.
  14006. * @param {Array} [array=[]] The array to copy values to.
  14007. * @returns {Array} Returns `array`.
  14008. */
  14009. function copyArray(source, array) {
  14010. var index = -1,
  14011. length = source.length;
  14012. array || (array = Array(length));
  14013. while (++index < length) {
  14014. array[index] = source[index];
  14015. }
  14016. return array;
  14017. }
  14018. /**
  14019. * Copies properties of `source` to `object`.
  14020. *
  14021. * @private
  14022. * @param {Object} source The object to copy properties from.
  14023. * @param {Array} props The property identifiers to copy.
  14024. * @param {Object} [object={}] The object to copy properties to.
  14025. * @param {Function} [customizer] The function to customize copied values.
  14026. * @returns {Object} Returns `object`.
  14027. */
  14028. function copyObject(source, props, object, customizer) {
  14029. object || (object = {});
  14030. var index = -1,
  14031. length = props.length;
  14032. while (++index < length) {
  14033. var key = props[index];
  14034. var newValue = customizer
  14035. ? customizer(object[key], source[key], key, object, source)
  14036. : undefined;
  14037. assignValue(object, key, newValue === undefined ? source[key] : newValue);
  14038. }
  14039. return object;
  14040. }
  14041. /**
  14042. * Copies own symbol properties of `source` to `object`.
  14043. *
  14044. * @private
  14045. * @param {Object} source The object to copy symbols from.
  14046. * @param {Object} [object={}] The object to copy symbols to.
  14047. * @returns {Object} Returns `object`.
  14048. */
  14049. function copySymbols(source, object) {
  14050. return copyObject(source, getSymbols(source), object);
  14051. }
  14052. /**
  14053. * Creates an array of own enumerable property names and symbols of `object`.
  14054. *
  14055. * @private
  14056. * @param {Object} object The object to query.
  14057. * @returns {Array} Returns the array of property names and symbols.
  14058. */
  14059. function getAllKeys(object) {
  14060. return baseGetAllKeys(object, keys, getSymbols);
  14061. }
  14062. /**
  14063. * Gets the data for `map`.
  14064. *
  14065. * @private
  14066. * @param {Object} map The map to query.
  14067. * @param {string} key The reference key.
  14068. * @returns {*} Returns the map data.
  14069. */
  14070. function getMapData(map, key) {
  14071. var data = map.__data__;
  14072. return isKeyable(key)
  14073. ? data[typeof key == 'string' ? 'string' : 'hash']
  14074. : data.map;
  14075. }
  14076. /**
  14077. * Gets the native function at `key` of `object`.
  14078. *
  14079. * @private
  14080. * @param {Object} object The object to query.
  14081. * @param {string} key The key of the method to get.
  14082. * @returns {*} Returns the function if it's native, else `undefined`.
  14083. */
  14084. function getNative(object, key) {
  14085. var value = getValue(object, key);
  14086. return baseIsNative(value) ? value : undefined;
  14087. }
  14088. /**
  14089. * Creates an array of the own enumerable symbol properties of `object`.
  14090. *
  14091. * @private
  14092. * @param {Object} object The object to query.
  14093. * @returns {Array} Returns the array of symbols.
  14094. */
  14095. var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
  14096. /**
  14097. * Gets the `toStringTag` of `value`.
  14098. *
  14099. * @private
  14100. * @param {*} value The value to query.
  14101. * @returns {string} Returns the `toStringTag`.
  14102. */
  14103. var getTag = baseGetTag;
  14104. // Fallback for data views, maps, sets, and weak maps in IE 11,
  14105. // for data views in Edge < 14, and promises in Node.js.
  14106. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  14107. (Map && getTag(new Map) != mapTag) ||
  14108. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  14109. (Set && getTag(new Set) != setTag) ||
  14110. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  14111. getTag = function(value) {
  14112. var result = objectToString.call(value),
  14113. Ctor = result == objectTag ? value.constructor : undefined,
  14114. ctorString = Ctor ? toSource(Ctor) : undefined;
  14115. if (ctorString) {
  14116. switch (ctorString) {
  14117. case dataViewCtorString: return dataViewTag;
  14118. case mapCtorString: return mapTag;
  14119. case promiseCtorString: return promiseTag;
  14120. case setCtorString: return setTag;
  14121. case weakMapCtorString: return weakMapTag;
  14122. }
  14123. }
  14124. return result;
  14125. };
  14126. }
  14127. /**
  14128. * Initializes an array clone.
  14129. *
  14130. * @private
  14131. * @param {Array} array The array to clone.
  14132. * @returns {Array} Returns the initialized clone.
  14133. */
  14134. function initCloneArray(array) {
  14135. var length = array.length,
  14136. result = array.constructor(length);
  14137. // Add properties assigned by `RegExp#exec`.
  14138. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  14139. result.index = array.index;
  14140. result.input = array.input;
  14141. }
  14142. return result;
  14143. }
  14144. /**
  14145. * Initializes an object clone.
  14146. *
  14147. * @private
  14148. * @param {Object} object The object to clone.
  14149. * @returns {Object} Returns the initialized clone.
  14150. */
  14151. function initCloneObject(object) {
  14152. return (typeof object.constructor == 'function' && !isPrototype(object))
  14153. ? baseCreate(getPrototype(object))
  14154. : {};
  14155. }
  14156. /**
  14157. * Initializes an object clone based on its `toStringTag`.
  14158. *
  14159. * **Note:** This function only supports cloning values with tags of
  14160. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  14161. *
  14162. * @private
  14163. * @param {Object} object The object to clone.
  14164. * @param {string} tag The `toStringTag` of the object to clone.
  14165. * @param {Function} cloneFunc The function to clone values.
  14166. * @param {boolean} [isDeep] Specify a deep clone.
  14167. * @returns {Object} Returns the initialized clone.
  14168. */
  14169. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  14170. var Ctor = object.constructor;
  14171. switch (tag) {
  14172. case arrayBufferTag:
  14173. return cloneArrayBuffer(object);
  14174. case boolTag:
  14175. case dateTag:
  14176. return new Ctor(+object);
  14177. case dataViewTag:
  14178. return cloneDataView(object, isDeep);
  14179. case float32Tag: case float64Tag:
  14180. case int8Tag: case int16Tag: case int32Tag:
  14181. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  14182. return cloneTypedArray(object, isDeep);
  14183. case mapTag:
  14184. return cloneMap(object, isDeep, cloneFunc);
  14185. case numberTag:
  14186. case stringTag:
  14187. return new Ctor(object);
  14188. case regexpTag:
  14189. return cloneRegExp(object);
  14190. case setTag:
  14191. return cloneSet(object, isDeep, cloneFunc);
  14192. case symbolTag:
  14193. return cloneSymbol(object);
  14194. }
  14195. }
  14196. /**
  14197. * Checks if `value` is a valid array-like index.
  14198. *
  14199. * @private
  14200. * @param {*} value The value to check.
  14201. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  14202. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  14203. */
  14204. function isIndex(value, length) {
  14205. length = length == null ? MAX_SAFE_INTEGER : length;
  14206. return !!length &&
  14207. (typeof value == 'number' || reIsUint.test(value)) &&
  14208. (value > -1 && value % 1 == 0 && value < length);
  14209. }
  14210. /**
  14211. * Checks if `value` is suitable for use as unique object key.
  14212. *
  14213. * @private
  14214. * @param {*} value The value to check.
  14215. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  14216. */
  14217. function isKeyable(value) {
  14218. var type = typeof value;
  14219. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  14220. ? (value !== '__proto__')
  14221. : (value === null);
  14222. }
  14223. /**
  14224. * Checks if `func` has its source masked.
  14225. *
  14226. * @private
  14227. * @param {Function} func The function to check.
  14228. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  14229. */
  14230. function isMasked(func) {
  14231. return !!maskSrcKey && (maskSrcKey in func);
  14232. }
  14233. /**
  14234. * Checks if `value` is likely a prototype object.
  14235. *
  14236. * @private
  14237. * @param {*} value The value to check.
  14238. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  14239. */
  14240. function isPrototype(value) {
  14241. var Ctor = value && value.constructor,
  14242. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  14243. return value === proto;
  14244. }
  14245. /**
  14246. * Converts `func` to its source code.
  14247. *
  14248. * @private
  14249. * @param {Function} func The function to process.
  14250. * @returns {string} Returns the source code.
  14251. */
  14252. function toSource(func) {
  14253. if (func != null) {
  14254. try {
  14255. return funcToString.call(func);
  14256. } catch (e) {}
  14257. try {
  14258. return (func + '');
  14259. } catch (e) {}
  14260. }
  14261. return '';
  14262. }
  14263. /**
  14264. * This method is like `_.clone` except that it recursively clones `value`.
  14265. *
  14266. * @static
  14267. * @memberOf _
  14268. * @since 1.0.0
  14269. * @category Lang
  14270. * @param {*} value The value to recursively clone.
  14271. * @returns {*} Returns the deep cloned value.
  14272. * @see _.clone
  14273. * @example
  14274. *
  14275. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  14276. *
  14277. * var deep = _.cloneDeep(objects);
  14278. * console.log(deep[0] === objects[0]);
  14279. * // => false
  14280. */
  14281. function cloneDeep(value) {
  14282. return baseClone(value, true, true);
  14283. }
  14284. /**
  14285. * Performs a
  14286. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  14287. * comparison between two values to determine if they are equivalent.
  14288. *
  14289. * @static
  14290. * @memberOf _
  14291. * @since 4.0.0
  14292. * @category Lang
  14293. * @param {*} value The value to compare.
  14294. * @param {*} other The other value to compare.
  14295. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  14296. * @example
  14297. *
  14298. * var object = { 'a': 1 };
  14299. * var other = { 'a': 1 };
  14300. *
  14301. * _.eq(object, object);
  14302. * // => true
  14303. *
  14304. * _.eq(object, other);
  14305. * // => false
  14306. *
  14307. * _.eq('a', 'a');
  14308. * // => true
  14309. *
  14310. * _.eq('a', Object('a'));
  14311. * // => false
  14312. *
  14313. * _.eq(NaN, NaN);
  14314. * // => true
  14315. */
  14316. function eq(value, other) {
  14317. return value === other || (value !== value && other !== other);
  14318. }
  14319. /**
  14320. * Checks if `value` is likely an `arguments` object.
  14321. *
  14322. * @static
  14323. * @memberOf _
  14324. * @since 0.1.0
  14325. * @category Lang
  14326. * @param {*} value The value to check.
  14327. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  14328. * else `false`.
  14329. * @example
  14330. *
  14331. * _.isArguments(function() { return arguments; }());
  14332. * // => true
  14333. *
  14334. * _.isArguments([1, 2, 3]);
  14335. * // => false
  14336. */
  14337. function isArguments(value) {
  14338. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  14339. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  14340. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  14341. }
  14342. /**
  14343. * Checks if `value` is classified as an `Array` object.
  14344. *
  14345. * @static
  14346. * @memberOf _
  14347. * @since 0.1.0
  14348. * @category Lang
  14349. * @param {*} value The value to check.
  14350. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  14351. * @example
  14352. *
  14353. * _.isArray([1, 2, 3]);
  14354. * // => true
  14355. *
  14356. * _.isArray(document.body.children);
  14357. * // => false
  14358. *
  14359. * _.isArray('abc');
  14360. * // => false
  14361. *
  14362. * _.isArray(_.noop);
  14363. * // => false
  14364. */
  14365. var isArray = Array.isArray;
  14366. /**
  14367. * Checks if `value` is array-like. A value is considered array-like if it's
  14368. * not a function and has a `value.length` that's an integer greater than or
  14369. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  14370. *
  14371. * @static
  14372. * @memberOf _
  14373. * @since 4.0.0
  14374. * @category Lang
  14375. * @param {*} value The value to check.
  14376. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  14377. * @example
  14378. *
  14379. * _.isArrayLike([1, 2, 3]);
  14380. * // => true
  14381. *
  14382. * _.isArrayLike(document.body.children);
  14383. * // => true
  14384. *
  14385. * _.isArrayLike('abc');
  14386. * // => true
  14387. *
  14388. * _.isArrayLike(_.noop);
  14389. * // => false
  14390. */
  14391. function isArrayLike(value) {
  14392. return value != null && isLength(value.length) && !isFunction(value);
  14393. }
  14394. /**
  14395. * This method is like `_.isArrayLike` except that it also checks if `value`
  14396. * is an object.
  14397. *
  14398. * @static
  14399. * @memberOf _
  14400. * @since 4.0.0
  14401. * @category Lang
  14402. * @param {*} value The value to check.
  14403. * @returns {boolean} Returns `true` if `value` is an array-like object,
  14404. * else `false`.
  14405. * @example
  14406. *
  14407. * _.isArrayLikeObject([1, 2, 3]);
  14408. * // => true
  14409. *
  14410. * _.isArrayLikeObject(document.body.children);
  14411. * // => true
  14412. *
  14413. * _.isArrayLikeObject('abc');
  14414. * // => false
  14415. *
  14416. * _.isArrayLikeObject(_.noop);
  14417. * // => false
  14418. */
  14419. function isArrayLikeObject(value) {
  14420. return isObjectLike(value) && isArrayLike(value);
  14421. }
  14422. /**
  14423. * Checks if `value` is a buffer.
  14424. *
  14425. * @static
  14426. * @memberOf _
  14427. * @since 4.3.0
  14428. * @category Lang
  14429. * @param {*} value The value to check.
  14430. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  14431. * @example
  14432. *
  14433. * _.isBuffer(new Buffer(2));
  14434. * // => true
  14435. *
  14436. * _.isBuffer(new Uint8Array(2));
  14437. * // => false
  14438. */
  14439. var isBuffer = nativeIsBuffer || stubFalse;
  14440. /**
  14441. * Checks if `value` is classified as a `Function` object.
  14442. *
  14443. * @static
  14444. * @memberOf _
  14445. * @since 0.1.0
  14446. * @category Lang
  14447. * @param {*} value The value to check.
  14448. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  14449. * @example
  14450. *
  14451. * _.isFunction(_);
  14452. * // => true
  14453. *
  14454. * _.isFunction(/abc/);
  14455. * // => false
  14456. */
  14457. function isFunction(value) {
  14458. // The use of `Object#toString` avoids issues with the `typeof` operator
  14459. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  14460. var tag = isObject(value) ? objectToString.call(value) : '';
  14461. return tag == funcTag || tag == genTag;
  14462. }
  14463. /**
  14464. * Checks if `value` is a valid array-like length.
  14465. *
  14466. * **Note:** This method is loosely based on
  14467. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  14468. *
  14469. * @static
  14470. * @memberOf _
  14471. * @since 4.0.0
  14472. * @category Lang
  14473. * @param {*} value The value to check.
  14474. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  14475. * @example
  14476. *
  14477. * _.isLength(3);
  14478. * // => true
  14479. *
  14480. * _.isLength(Number.MIN_VALUE);
  14481. * // => false
  14482. *
  14483. * _.isLength(Infinity);
  14484. * // => false
  14485. *
  14486. * _.isLength('3');
  14487. * // => false
  14488. */
  14489. function isLength(value) {
  14490. return typeof value == 'number' &&
  14491. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  14492. }
  14493. /**
  14494. * Checks if `value` is the
  14495. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  14496. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  14497. *
  14498. * @static
  14499. * @memberOf _
  14500. * @since 0.1.0
  14501. * @category Lang
  14502. * @param {*} value The value to check.
  14503. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  14504. * @example
  14505. *
  14506. * _.isObject({});
  14507. * // => true
  14508. *
  14509. * _.isObject([1, 2, 3]);
  14510. * // => true
  14511. *
  14512. * _.isObject(_.noop);
  14513. * // => true
  14514. *
  14515. * _.isObject(null);
  14516. * // => false
  14517. */
  14518. function isObject(value) {
  14519. var type = typeof value;
  14520. return !!value && (type == 'object' || type == 'function');
  14521. }
  14522. /**
  14523. * Checks if `value` is object-like. A value is object-like if it's not `null`
  14524. * and has a `typeof` result of "object".
  14525. *
  14526. * @static
  14527. * @memberOf _
  14528. * @since 4.0.0
  14529. * @category Lang
  14530. * @param {*} value The value to check.
  14531. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  14532. * @example
  14533. *
  14534. * _.isObjectLike({});
  14535. * // => true
  14536. *
  14537. * _.isObjectLike([1, 2, 3]);
  14538. * // => true
  14539. *
  14540. * _.isObjectLike(_.noop);
  14541. * // => false
  14542. *
  14543. * _.isObjectLike(null);
  14544. * // => false
  14545. */
  14546. function isObjectLike(value) {
  14547. return !!value && typeof value == 'object';
  14548. }
  14549. /**
  14550. * Creates an array of the own enumerable property names of `object`.
  14551. *
  14552. * **Note:** Non-object values are coerced to objects. See the
  14553. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  14554. * for more details.
  14555. *
  14556. * @static
  14557. * @since 0.1.0
  14558. * @memberOf _
  14559. * @category Object
  14560. * @param {Object} object The object to query.
  14561. * @returns {Array} Returns the array of property names.
  14562. * @example
  14563. *
  14564. * function Foo() {
  14565. * this.a = 1;
  14566. * this.b = 2;
  14567. * }
  14568. *
  14569. * Foo.prototype.c = 3;
  14570. *
  14571. * _.keys(new Foo);
  14572. * // => ['a', 'b'] (iteration order is not guaranteed)
  14573. *
  14574. * _.keys('hi');
  14575. * // => ['0', '1']
  14576. */
  14577. function keys(object) {
  14578. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  14579. }
  14580. /**
  14581. * This method returns a new empty array.
  14582. *
  14583. * @static
  14584. * @memberOf _
  14585. * @since 4.13.0
  14586. * @category Util
  14587. * @returns {Array} Returns the new empty array.
  14588. * @example
  14589. *
  14590. * var arrays = _.times(2, _.stubArray);
  14591. *
  14592. * console.log(arrays);
  14593. * // => [[], []]
  14594. *
  14595. * console.log(arrays[0] === arrays[1]);
  14596. * // => false
  14597. */
  14598. function stubArray() {
  14599. return [];
  14600. }
  14601. /**
  14602. * This method returns `false`.
  14603. *
  14604. * @static
  14605. * @memberOf _
  14606. * @since 4.13.0
  14607. * @category Util
  14608. * @returns {boolean} Returns `false`.
  14609. * @example
  14610. *
  14611. * _.times(2, _.stubFalse);
  14612. * // => [false, false]
  14613. */
  14614. function stubFalse() {
  14615. return false;
  14616. }
  14617. module.exports = cloneDeep;
  14618. });
  14619. var hasProperty = function has(object, key) {
  14620. return Object.prototype.hasOwnProperty.call(object, key);
  14621. };
  14622. var _apply;
  14623. function _classPrivateFieldLooseBase$8(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
  14624. var id$8 = 0;
  14625. function _classPrivateFieldLooseKey$8(name) { return "__private_" + id$8++ + "_" + name; }
  14626. function insertReplacement(source, rx, replacement) {
  14627. const newParts = [];
  14628. source.forEach(chunk => {
  14629. // When the source contains multiple placeholders for interpolation,
  14630. // we should ignore chunks that are not strings, because those
  14631. // can be JSX objects and will be otherwise incorrectly turned into strings.
  14632. // Without this condition we’d get this: [object Object] hello [object Object] my <button>
  14633. if (typeof chunk !== 'string') {
  14634. return newParts.push(chunk);
  14635. }
  14636. return rx[Symbol.split](chunk).forEach((raw, i, list) => {
  14637. if (raw !== '') {
  14638. newParts.push(raw);
  14639. } // Interlace with the `replacement` value
  14640. if (i < list.length - 1) {
  14641. newParts.push(replacement);
  14642. }
  14643. });
  14644. });
  14645. return newParts;
  14646. }
  14647. /**
  14648. * Takes a string with placeholder variables like `%{smart_count} file selected`
  14649. * and replaces it with values from options `{smart_count: 5}`
  14650. *
  14651. * @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
  14652. * taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
  14653. *
  14654. * @param {string} phrase that needs interpolation, with placeholders
  14655. * @param {object} options with values that will be used to replace placeholders
  14656. * @returns {any[]} interpolated
  14657. */
  14658. function interpolate(phrase, options) {
  14659. const dollarRegex = /\$/g;
  14660. const dollarBillsYall = '$$$$';
  14661. let interpolated = [phrase];
  14662. if (options == null) return interpolated;
  14663. for (const arg of Object.keys(options)) {
  14664. if (arg !== '_') {
  14665. // Ensure replacement value is escaped to prevent special $-prefixed
  14666. // regex replace tokens. the "$$$$" is needed because each "$" needs to
  14667. // be escaped with "$" itself, and we need two in the resulting output.
  14668. let replacement = options[arg];
  14669. if (typeof replacement === 'string') {
  14670. replacement = dollarRegex[Symbol.replace](replacement, dollarBillsYall);
  14671. } // We create a new `RegExp` each time instead of using a more-efficient
  14672. // string replace so that the same argument can be replaced multiple times
  14673. // in the same phrase.
  14674. interpolated = insertReplacement(interpolated, new RegExp(`%\\{${arg}\\}`, 'g'), replacement);
  14675. }
  14676. }
  14677. return interpolated;
  14678. }
  14679. /**
  14680. * Translates strings with interpolation & pluralization support.
  14681. * Extensible with custom dictionaries and pluralization functions.
  14682. *
  14683. * Borrows heavily from and inspired by Polyglot https://github.com/airbnb/polyglot.js,
  14684. * basically a stripped-down version of it. Differences: pluralization functions are not hardcoded
  14685. * and can be easily added among with dictionaries, nested objects are used for pluralization
  14686. * as opposed to `||||` delimeter
  14687. *
  14688. * Usage example: `translator.translate('files_chosen', {smart_count: 3})`
  14689. */
  14690. var Translator_1 = (_apply = /*#__PURE__*/_classPrivateFieldLooseKey$8("apply"), class Translator {
  14691. /**
  14692. * @param {object|Array<object>} locales - locale or list of locales.
  14693. */
  14694. constructor(locales) {
  14695. Object.defineProperty(this, _apply, {
  14696. value: _apply2
  14697. });
  14698. this.locale = {
  14699. strings: {},
  14700. pluralize(n) {
  14701. if (n === 1) {
  14702. return 0;
  14703. }
  14704. return 1;
  14705. }
  14706. };
  14707. if (Array.isArray(locales)) {
  14708. locales.forEach(_classPrivateFieldLooseBase$8(this, _apply)[_apply], this);
  14709. } else {
  14710. _classPrivateFieldLooseBase$8(this, _apply)[_apply](locales);
  14711. }
  14712. }
  14713. /**
  14714. * Public translate method
  14715. *
  14716. * @param {string} key
  14717. * @param {object} options with values that will be used later to replace placeholders in string
  14718. * @returns {string} translated (and interpolated)
  14719. */
  14720. translate(key, options) {
  14721. return this.translateArray(key, options).join('');
  14722. }
  14723. /**
  14724. * Get a translation and return the translated and interpolated parts as an array.
  14725. *
  14726. * @param {string} key
  14727. * @param {object} options with values that will be used to replace placeholders
  14728. * @returns {Array} The translated and interpolated parts, in order.
  14729. */
  14730. translateArray(key, options) {
  14731. if (!hasProperty(this.locale.strings, key)) {
  14732. throw new Error(`missing string: ${key}`);
  14733. }
  14734. const string = this.locale.strings[key];
  14735. const hasPluralForms = typeof string === 'object';
  14736. if (hasPluralForms) {
  14737. if (options && typeof options.smart_count !== 'undefined') {
  14738. const plural = this.locale.pluralize(options.smart_count);
  14739. return interpolate(string[plural], options);
  14740. }
  14741. throw new Error('Attempted to use a string with plural forms, but no value was given for %{smart_count}');
  14742. }
  14743. return interpolate(string, options);
  14744. }
  14745. });
  14746. function _apply2(locale) {
  14747. if (!(locale != null && locale.strings)) {
  14748. return;
  14749. }
  14750. const prevLocale = this.locale;
  14751. this.locale = { ...prevLocale,
  14752. strings: { ...prevLocale.strings,
  14753. ...locale.strings
  14754. }
  14755. };
  14756. this.locale.pluralize = locale.pluralize || prevLocale.pluralize;
  14757. }
  14758. /**
  14759. * Create an event emitter with namespaces
  14760. * @name createNamespaceEmitter
  14761. * @example
  14762. * var emitter = require('./index')()
  14763. *
  14764. * emitter.on('*', function () {
  14765. * console.log('all events emitted', this.event)
  14766. * })
  14767. *
  14768. * emitter.on('example', function () {
  14769. * console.log('example event emitted')
  14770. * })
  14771. */
  14772. var namespaceEmitter = function createNamespaceEmitter () {
  14773. var emitter = {};
  14774. var _fns = emitter._fns = {};
  14775. /**
  14776. * Emit an event. Optionally namespace the event. Handlers are fired in the order in which they were added with exact matches taking precedence. Separate the namespace and event with a `:`
  14777. * @name emit
  14778. * @param {String} event – the name of the event, with optional namespace
  14779. * @param {...*} data – up to 6 arguments that are passed to the event listener
  14780. * @example
  14781. * emitter.emit('example')
  14782. * emitter.emit('demo:test')
  14783. * emitter.emit('data', { example: true}, 'a string', 1)
  14784. */
  14785. emitter.emit = function emit (event, arg1, arg2, arg3, arg4, arg5, arg6) {
  14786. var toEmit = getListeners(event);
  14787. if (toEmit.length) {
  14788. emitAll(event, toEmit, [arg1, arg2, arg3, arg4, arg5, arg6]);
  14789. }
  14790. };
  14791. /**
  14792. * Create en event listener.
  14793. * @name on
  14794. * @param {String} event
  14795. * @param {Function} fn
  14796. * @example
  14797. * emitter.on('example', function () {})
  14798. * emitter.on('demo', function () {})
  14799. */
  14800. emitter.on = function on (event, fn) {
  14801. if (!_fns[event]) {
  14802. _fns[event] = [];
  14803. }
  14804. _fns[event].push(fn);
  14805. };
  14806. /**
  14807. * Create en event listener that fires once.
  14808. * @name once
  14809. * @param {String} event
  14810. * @param {Function} fn
  14811. * @example
  14812. * emitter.once('example', function () {})
  14813. * emitter.once('demo', function () {})
  14814. */
  14815. emitter.once = function once (event, fn) {
  14816. function one () {
  14817. fn.apply(this, arguments);
  14818. emitter.off(event, one);
  14819. }
  14820. this.on(event, one);
  14821. };
  14822. /**
  14823. * Stop listening to an event. Stop all listeners on an event by only passing the event name. Stop a single listener by passing that event handler as a callback.
  14824. * You must be explicit about what will be unsubscribed: `emitter.off('demo')` will unsubscribe an `emitter.on('demo')` listener,
  14825. * `emitter.off('demo:example')` will unsubscribe an `emitter.on('demo:example')` listener
  14826. * @name off
  14827. * @param {String} event
  14828. * @param {Function} [fn] – the specific handler
  14829. * @example
  14830. * emitter.off('example')
  14831. * emitter.off('demo', function () {})
  14832. */
  14833. emitter.off = function off (event, fn) {
  14834. var keep = [];
  14835. if (event && fn) {
  14836. var fns = this._fns[event];
  14837. var i = 0;
  14838. var l = fns ? fns.length : 0;
  14839. for (i; i < l; i++) {
  14840. if (fns[i] !== fn) {
  14841. keep.push(fns[i]);
  14842. }
  14843. }
  14844. }
  14845. keep.length ? this._fns[event] = keep : delete this._fns[event];
  14846. };
  14847. function getListeners (e) {
  14848. var out = _fns[e] ? _fns[e] : [];
  14849. var idx = e.indexOf(':');
  14850. var args = (idx === -1) ? [e] : [e.substring(0, idx), e.substring(idx + 1)];
  14851. var keys = Object.keys(_fns);
  14852. var i = 0;
  14853. var l = keys.length;
  14854. for (i; i < l; i++) {
  14855. var key = keys[i];
  14856. if (key === '*') {
  14857. out = out.concat(_fns[key]);
  14858. }
  14859. if (args.length === 2 && args[0] === key) {
  14860. out = out.concat(_fns[key]);
  14861. break
  14862. }
  14863. }
  14864. return out
  14865. }
  14866. function emitAll (e, fns, args) {
  14867. var i = 0;
  14868. var l = fns.length;
  14869. for (i; i < l; i++) {
  14870. if (!fns[i]) break
  14871. fns[i].event = e;
  14872. fns[i].apply(fns[i], args);
  14873. }
  14874. }
  14875. return emitter
  14876. };
  14877. // Adapted from https://github.com/Flet/prettier-bytes/
  14878. // Changing 1000 bytes to 1024, so we can keep uppercase KB vs kB
  14879. // ISC License (c) Dan Flettre https://github.com/Flet/prettier-bytes/blob/master/LICENSE
  14880. var prettierBytes = function prettierBytes (num) {
  14881. if (typeof num !== 'number' || isNaN(num)) {
  14882. throw new TypeError('Expected a number, got ' + typeof num)
  14883. }
  14884. var neg = num < 0;
  14885. var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
  14886. if (neg) {
  14887. num = -num;
  14888. }
  14889. if (num < 1) {
  14890. return (neg ? '-' : '') + num + ' B'
  14891. }
  14892. var exponent = Math.min(Math.floor(Math.log(num) / Math.log(1024)), units.length - 1);
  14893. num = Number(num / Math.pow(1024, exponent));
  14894. var unit = units[exponent];
  14895. if (num >= 10 || num % 1 === 0) {
  14896. // Do not show decimals when the number is two-digit, or if the number has no
  14897. // decimal component.
  14898. return (neg ? '-' : '') + num.toFixed(0) + ' ' + unit
  14899. } else {
  14900. return (neg ? '-' : '') + num.toFixed(1) + ' ' + unit
  14901. }
  14902. };
  14903. /* jshint node: true */
  14904. /**
  14905. # wildcard
  14906. Very simple wildcard matching, which is designed to provide the same
  14907. functionality that is found in the
  14908. [eve](https://github.com/adobe-webplatform/eve) eventing library.
  14909. ## Usage
  14910. It works with strings:
  14911. <<< examples/strings.js
  14912. Arrays:
  14913. <<< examples/arrays.js
  14914. Objects (matching against keys):
  14915. <<< examples/objects.js
  14916. While the library works in Node, if you are are looking for file-based
  14917. wildcard matching then you should have a look at:
  14918. <https://github.com/isaacs/node-glob>
  14919. **/
  14920. function WildcardMatcher(text, separator) {
  14921. this.text = text = text || '';
  14922. this.hasWild = ~text.indexOf('*');
  14923. this.separator = separator;
  14924. this.parts = text.split(separator);
  14925. }
  14926. WildcardMatcher.prototype.match = function(input) {
  14927. var matches = true;
  14928. var parts = this.parts;
  14929. var ii;
  14930. var partsCount = parts.length;
  14931. var testParts;
  14932. if (typeof input == 'string' || input instanceof String) {
  14933. if (!this.hasWild && this.text != input) {
  14934. matches = false;
  14935. } else {
  14936. testParts = (input || '').split(this.separator);
  14937. for (ii = 0; matches && ii < partsCount; ii++) {
  14938. if (parts[ii] === '*') {
  14939. continue;
  14940. } else if (ii < testParts.length) {
  14941. matches = parts[ii] === testParts[ii];
  14942. } else {
  14943. matches = false;
  14944. }
  14945. }
  14946. // If matches, then return the component parts
  14947. matches = matches && testParts;
  14948. }
  14949. }
  14950. else if (typeof input.splice == 'function') {
  14951. matches = [];
  14952. for (ii = input.length; ii--; ) {
  14953. if (this.match(input[ii])) {
  14954. matches[matches.length] = input[ii];
  14955. }
  14956. }
  14957. }
  14958. else if (typeof input == 'object') {
  14959. matches = {};
  14960. for (var key in input) {
  14961. if (this.match(key)) {
  14962. matches[key] = input[key];
  14963. }
  14964. }
  14965. }
  14966. return matches;
  14967. };
  14968. var wildcard = function(text, test, separator) {
  14969. var matcher = new WildcardMatcher(text, separator || /[\/\.]/);
  14970. if (typeof test != 'undefined') {
  14971. return matcher.match(test);
  14972. }
  14973. return matcher;
  14974. };
  14975. var reMimePartSplit = /[\/\+\.]/;
  14976. /**
  14977. # mime-match
  14978. A simple function to checker whether a target mime type matches a mime-type
  14979. pattern (e.g. image/jpeg matches image/jpeg OR image/*).
  14980. ## Example Usage
  14981. <<< example.js
  14982. **/
  14983. var mimeMatch = function(target, pattern) {
  14984. function test(pattern) {
  14985. var result = wildcard(pattern, target, reMimePartSplit);
  14986. // ensure that we have a valid mime type (should have two parts)
  14987. return result && result.length >= 2;
  14988. }
  14989. return pattern ? test(pattern.split(';')[0]) : test;
  14990. };
  14991. function _classPrivateFieldLooseBase$7(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
  14992. var id$7 = 0;
  14993. function _classPrivateFieldLooseKey$7(name) { return "__private_" + id$7++ + "_" + name; }
  14994. var _publish = /*#__PURE__*/_classPrivateFieldLooseKey$7("publish");
  14995. /**
  14996. * Default store that keeps state in a simple object.
  14997. */
  14998. class DefaultStore {
  14999. constructor() {
  15000. Object.defineProperty(this, _publish, {
  15001. value: _publish2
  15002. });
  15003. this.state = {};
  15004. this.callbacks = [];
  15005. }
  15006. getState() {
  15007. return this.state;
  15008. }
  15009. setState(patch) {
  15010. const prevState = { ...this.state
  15011. };
  15012. const nextState = { ...this.state,
  15013. ...patch
  15014. };
  15015. this.state = nextState;
  15016. _classPrivateFieldLooseBase$7(this, _publish)[_publish](prevState, nextState, patch);
  15017. }
  15018. subscribe(listener) {
  15019. this.callbacks.push(listener);
  15020. return () => {
  15021. // Remove the listener.
  15022. this.callbacks.splice(this.callbacks.indexOf(listener), 1);
  15023. };
  15024. }
  15025. }
  15026. function _publish2() {
  15027. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  15028. args[_key] = arguments[_key];
  15029. }
  15030. this.callbacks.forEach(listener => {
  15031. listener(...args);
  15032. });
  15033. }
  15034. DefaultStore.VERSION = "2.0.3";
  15035. var lib$3 = function defaultStore() {
  15036. return new DefaultStore();
  15037. };
  15038. /**
  15039. * Takes a full filename string and returns an object {name, extension}
  15040. *
  15041. * @param {string} fullFileName
  15042. * @returns {object} {name, extension}
  15043. */
  15044. var getFileNameAndExtension = function getFileNameAndExtension(fullFileName) {
  15045. const lastDot = fullFileName.lastIndexOf('.'); // these count as no extension: "no-dot", "trailing-dot."
  15046. if (lastDot === -1 || lastDot === fullFileName.length - 1) {
  15047. return {
  15048. name: fullFileName,
  15049. extension: undefined
  15050. };
  15051. }
  15052. return {
  15053. name: fullFileName.slice(0, lastDot),
  15054. extension: fullFileName.slice(lastDot + 1)
  15055. };
  15056. };
  15057. // ___Why not add the mime-types package?
  15058. // It's 19.7kB gzipped, and we only need mime types for well-known extensions (for file previews).
  15059. // ___Where to take new extensions from?
  15060. // https://github.com/jshttp/mime-db/blob/master/db.json
  15061. var mimeTypes = {
  15062. md: 'text/markdown',
  15063. markdown: 'text/markdown',
  15064. mp4: 'video/mp4',
  15065. mp3: 'audio/mp3',
  15066. svg: 'image/svg+xml',
  15067. jpg: 'image/jpeg',
  15068. png: 'image/png',
  15069. gif: 'image/gif',
  15070. heic: 'image/heic',
  15071. heif: 'image/heif',
  15072. yaml: 'text/yaml',
  15073. yml: 'text/yaml',
  15074. csv: 'text/csv',
  15075. tsv: 'text/tab-separated-values',
  15076. tab: 'text/tab-separated-values',
  15077. avi: 'video/x-msvideo',
  15078. mks: 'video/x-matroska',
  15079. mkv: 'video/x-matroska',
  15080. mov: 'video/quicktime',
  15081. doc: 'application/msword',
  15082. docm: 'application/vnd.ms-word.document.macroenabled.12',
  15083. docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  15084. dot: 'application/msword',
  15085. dotm: 'application/vnd.ms-word.template.macroenabled.12',
  15086. dotx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
  15087. xla: 'application/vnd.ms-excel',
  15088. xlam: 'application/vnd.ms-excel.addin.macroenabled.12',
  15089. xlc: 'application/vnd.ms-excel',
  15090. xlf: 'application/x-xliff+xml',
  15091. xlm: 'application/vnd.ms-excel',
  15092. xls: 'application/vnd.ms-excel',
  15093. xlsb: 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
  15094. xlsm: 'application/vnd.ms-excel.sheet.macroenabled.12',
  15095. xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  15096. xlt: 'application/vnd.ms-excel',
  15097. xltm: 'application/vnd.ms-excel.template.macroenabled.12',
  15098. xltx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
  15099. xlw: 'application/vnd.ms-excel',
  15100. txt: 'text/plain',
  15101. text: 'text/plain',
  15102. conf: 'text/plain',
  15103. log: 'text/plain',
  15104. pdf: 'application/pdf',
  15105. zip: 'application/zip',
  15106. '7z': 'application/x-7z-compressed',
  15107. rar: 'application/x-rar-compressed',
  15108. tar: 'application/x-tar',
  15109. gz: 'application/gzip',
  15110. dmg: 'application/x-apple-diskimage'
  15111. };
  15112. var getFileType = function getFileType(file) {
  15113. var _getFileNameAndExtens;
  15114. if (file.type) return file.type;
  15115. const fileExtension = file.name ? (_getFileNameAndExtens = getFileNameAndExtension(file.name).extension) == null ? void 0 : _getFileNameAndExtens.toLowerCase() : null;
  15116. if (fileExtension && fileExtension in mimeTypes) {
  15117. // else, see if we can map extension to a mime type
  15118. return mimeTypes[fileExtension];
  15119. } // if all fails, fall back to a generic byte stream type
  15120. return 'application/octet-stream';
  15121. };
  15122. function encodeCharacter(character) {
  15123. return character.charCodeAt(0).toString(32);
  15124. }
  15125. function encodeFilename(name) {
  15126. let suffix = '';
  15127. return name.replace(/[^A-Z0-9]/ig, character => {
  15128. suffix += `-${encodeCharacter(character)}`;
  15129. return '/';
  15130. }) + suffix;
  15131. }
  15132. /**
  15133. * Takes a file object and turns it into fileID, by converting file.name to lowercase,
  15134. * removing extra characters and adding type, size and lastModified
  15135. *
  15136. * @param {object} file
  15137. * @returns {string} the fileID
  15138. */
  15139. var generateFileID = function generateFileID(file) {
  15140. // It's tempting to do `[items].filter(Boolean).join('-')` here, but that
  15141. // is slower! simple string concatenation is fast
  15142. let id = 'uppy';
  15143. if (typeof file.name === 'string') {
  15144. id += `-${encodeFilename(file.name.toLowerCase())}`;
  15145. }
  15146. if (file.type !== undefined) {
  15147. id += `-${file.type}`;
  15148. }
  15149. if (file.meta && typeof file.meta.relativePath === 'string') {
  15150. id += `-${encodeFilename(file.meta.relativePath.toLowerCase())}`;
  15151. }
  15152. if (file.data.size !== undefined) {
  15153. id += `-${file.data.size}`;
  15154. }
  15155. if (file.data.lastModified !== undefined) {
  15156. id += `-${file.data.lastModified}`;
  15157. }
  15158. return id;
  15159. };
  15160. // Edge 15.x does not fire 'progress' events on uploads.
  15161. // See https://github.com/transloadit/uppy/issues/945
  15162. // And https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12224510/
  15163. var supportsUploadProgress = function supportsUploadProgress(userAgent) {
  15164. // Allow passing in userAgent for tests
  15165. if (userAgent == null) {
  15166. userAgent = typeof navigator !== 'undefined' ? navigator.userAgent : null;
  15167. } // Assume it works because basically everything supports progress events.
  15168. if (!userAgent) return true;
  15169. const m = /Edge\/(\d+\.\d+)/.exec(userAgent);
  15170. if (!m) return true;
  15171. const edgeVersion = m[1];
  15172. let [major, minor] = edgeVersion.split('.');
  15173. major = parseInt(major, 10);
  15174. minor = parseInt(minor, 10); // Worked before:
  15175. // Edge 40.15063.0.0
  15176. // Microsoft EdgeHTML 15.15063
  15177. if (major < 15 || major === 15 && minor < 15063) {
  15178. return true;
  15179. } // Fixed in:
  15180. // Microsoft EdgeHTML 18.18218
  15181. if (major > 18 || major === 18 && minor >= 18218) {
  15182. return true;
  15183. } // other versions don't work.
  15184. return false;
  15185. };
  15186. var getFileName = function getFileName(fileType, fileDescriptor) {
  15187. if (fileDescriptor.name) {
  15188. return fileDescriptor.name;
  15189. }
  15190. if (fileType.split('/')[0] === 'image') {
  15191. return `${fileType.split('/')[0]}.${fileType.split('/')[1]}`;
  15192. }
  15193. return 'noname';
  15194. };
  15195. /**
  15196. * Adds zero to strings shorter than two characters.
  15197. *
  15198. * @param {number} number
  15199. * @returns {string}
  15200. */
  15201. function pad(number) {
  15202. return number < 10 ? `0${number}` : number.toString();
  15203. }
  15204. /**
  15205. * Returns a timestamp in the format of `hours:minutes:seconds`
  15206. */
  15207. var getTimeStamp = function getTimeStamp() {
  15208. const date = new Date();
  15209. const hours = pad(date.getHours());
  15210. const minutes = pad(date.getMinutes());
  15211. const seconds = pad(date.getSeconds());
  15212. return `${hours}:${minutes}:${seconds}`;
  15213. };
  15214. /* eslint-disable no-console */
  15215. // Swallow all logs, except errors.
  15216. // default if logger is not set or debug: false
  15217. const justErrorsLogger$1 = {
  15218. debug: () => {},
  15219. warn: () => {},
  15220. error: function () {
  15221. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  15222. args[_key] = arguments[_key];
  15223. }
  15224. return console.error(`[Uppy] [${getTimeStamp()}]`, ...args);
  15225. }
  15226. }; // Print logs to console with namespace + timestamp,
  15227. // set by logger: Uppy.debugLogger or debug: true
  15228. const debugLogger$2 = {
  15229. debug: function () {
  15230. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  15231. args[_key2] = arguments[_key2];
  15232. }
  15233. return console.debug(`[Uppy] [${getTimeStamp()}]`, ...args);
  15234. },
  15235. warn: function () {
  15236. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  15237. args[_key3] = arguments[_key3];
  15238. }
  15239. return console.warn(`[Uppy] [${getTimeStamp()}]`, ...args);
  15240. },
  15241. error: function () {
  15242. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  15243. args[_key4] = arguments[_key4];
  15244. }
  15245. return console.error(`[Uppy] [${getTimeStamp()}]`, ...args);
  15246. }
  15247. };
  15248. var loggers = {
  15249. justErrorsLogger: justErrorsLogger$1,
  15250. debugLogger: debugLogger$2
  15251. };
  15252. var locale$1 = {
  15253. strings: {
  15254. addBulkFilesFailed: {
  15255. 0: 'Failed to add %{smart_count} file due to an internal error',
  15256. 1: 'Failed to add %{smart_count} files due to internal errors'
  15257. },
  15258. youCanOnlyUploadX: {
  15259. 0: 'You can only upload %{smart_count} file',
  15260. 1: 'You can only upload %{smart_count} files'
  15261. },
  15262. youHaveToAtLeastSelectX: {
  15263. 0: 'You have to select at least %{smart_count} file',
  15264. 1: 'You have to select at least %{smart_count} files'
  15265. },
  15266. exceedsSize: '%{file} exceeds maximum allowed size of %{size}',
  15267. missingRequiredMetaField: 'Missing required meta fields',
  15268. missingRequiredMetaFieldOnFile: 'Missing required meta fields in %{fileName}',
  15269. inferiorSize: 'This file is smaller than the allowed size of %{size}',
  15270. youCanOnlyUploadFileTypes: 'You can only upload: %{types}',
  15271. noMoreFilesAllowed: 'Cannot add more files',
  15272. noDuplicates: "Cannot add the duplicate file '%{fileName}', it already exists",
  15273. companionError: 'Connection with Companion failed',
  15274. authAborted: 'Authentication aborted',
  15275. companionUnauthorizeHint: 'To unauthorize to your %{provider} account, please go to %{url}',
  15276. failedToUpload: 'Failed to upload %{file}',
  15277. noInternetConnection: 'No Internet connection',
  15278. connectedToInternet: 'Connected to the Internet',
  15279. // Strings for remote providers
  15280. noFilesFound: 'You have no files or folders here',
  15281. selectX: {
  15282. 0: 'Select %{smart_count}',
  15283. 1: 'Select %{smart_count}'
  15284. },
  15285. allFilesFromFolderNamed: 'All files from folder %{name}',
  15286. openFolderNamed: 'Open folder %{name}',
  15287. cancel: 'Cancel',
  15288. logOut: 'Log out',
  15289. filter: 'Filter',
  15290. resetFilter: 'Reset filter',
  15291. loading: 'Loading...',
  15292. authenticateWithTitle: 'Please authenticate with %{pluginName} to select files',
  15293. authenticateWith: 'Connect to %{pluginName}',
  15294. signInWithGoogle: 'Sign in with Google',
  15295. searchImages: 'Search for images',
  15296. enterTextToSearch: 'Enter text to search for images',
  15297. backToSearch: 'Back to Search',
  15298. emptyFolderAdded: 'No files were added from empty folder',
  15299. folderAlreadyAdded: 'The folder "%{folder}" was already added',
  15300. folderAdded: {
  15301. 0: 'Added %{smart_count} file from %{folder}',
  15302. 1: 'Added %{smart_count} files from %{folder}'
  15303. }
  15304. }
  15305. };
  15306. var require$$4 = index_browser;
  15307. /* global AggregateError */
  15308. let _Symbol$for$1, _Symbol$for2$1;
  15309. function _classPrivateFieldLooseBase$6(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
  15310. var id$6 = 0;
  15311. function _classPrivateFieldLooseKey$6(name) { return "__private_" + id$6++ + "_" + name; }
  15312. const {
  15313. nanoid: nanoid$1
  15314. } = require$$4;
  15315. const {
  15316. justErrorsLogger,
  15317. debugLogger: debugLogger$1
  15318. } = loggers;
  15319. // Exported from here.
  15320. class RestrictionError extends Error {
  15321. constructor() {
  15322. super(...arguments);
  15323. this.isRestriction = true;
  15324. }
  15325. }
  15326. if (typeof AggregateError === 'undefined') {
  15327. // eslint-disable-next-line no-global-assign
  15328. globalThis.AggregateError = class AggregateError extends Error {
  15329. constructor(errors, message) {
  15330. super(message);
  15331. this.errors = errors;
  15332. }
  15333. };
  15334. }
  15335. class AggregateRestrictionError extends AggregateError {
  15336. constructor() {
  15337. super(...arguments);
  15338. this.isRestriction = true;
  15339. }
  15340. }
  15341. /**
  15342. * Uppy Core module.
  15343. * Manages plugins, state updates, acts as an event bus,
  15344. * adds/removes files and metadata.
  15345. */
  15346. var _plugins = /*#__PURE__*/_classPrivateFieldLooseKey$6("plugins");
  15347. var _storeUnsubscribe = /*#__PURE__*/_classPrivateFieldLooseKey$6("storeUnsubscribe");
  15348. var _emitter$2 = /*#__PURE__*/_classPrivateFieldLooseKey$6("emitter");
  15349. var _preProcessors = /*#__PURE__*/_classPrivateFieldLooseKey$6("preProcessors");
  15350. var _uploaders = /*#__PURE__*/_classPrivateFieldLooseKey$6("uploaders");
  15351. var _postProcessors = /*#__PURE__*/_classPrivateFieldLooseKey$6("postProcessors");
  15352. var _checkRestrictions = /*#__PURE__*/_classPrivateFieldLooseKey$6("checkRestrictions");
  15353. var _checkMinNumberOfFiles = /*#__PURE__*/_classPrivateFieldLooseKey$6("checkMinNumberOfFiles");
  15354. var _checkRequiredMetaFieldsOnFile = /*#__PURE__*/_classPrivateFieldLooseKey$6("checkRequiredMetaFieldsOnFile");
  15355. var _checkRequiredMetaFields = /*#__PURE__*/_classPrivateFieldLooseKey$6("checkRequiredMetaFields");
  15356. var _showOrLogErrorAndThrow = /*#__PURE__*/_classPrivateFieldLooseKey$6("showOrLogErrorAndThrow");
  15357. var _assertNewUploadAllowed = /*#__PURE__*/_classPrivateFieldLooseKey$6("assertNewUploadAllowed");
  15358. var _checkAndCreateFileStateObject = /*#__PURE__*/_classPrivateFieldLooseKey$6("checkAndCreateFileStateObject");
  15359. var _startIfAutoProceed = /*#__PURE__*/_classPrivateFieldLooseKey$6("startIfAutoProceed");
  15360. var _addListeners = /*#__PURE__*/_classPrivateFieldLooseKey$6("addListeners");
  15361. var _updateOnlineStatus = /*#__PURE__*/_classPrivateFieldLooseKey$6("updateOnlineStatus");
  15362. var _createUpload = /*#__PURE__*/_classPrivateFieldLooseKey$6("createUpload");
  15363. var _getUpload = /*#__PURE__*/_classPrivateFieldLooseKey$6("getUpload");
  15364. var _removeUpload = /*#__PURE__*/_classPrivateFieldLooseKey$6("removeUpload");
  15365. var _runUpload = /*#__PURE__*/_classPrivateFieldLooseKey$6("runUpload");
  15366. _Symbol$for$1 = Symbol.for('uppy test: getPlugins');
  15367. _Symbol$for2$1 = Symbol.for('uppy test: createUpload');
  15368. class Uppy {
  15369. // eslint-disable-next-line global-require
  15370. /** @type {Record<string, BasePlugin[]>} */
  15371. /**
  15372. * Instantiate Uppy
  15373. *
  15374. * @param {object} opts — Uppy options
  15375. */
  15376. constructor(_opts) {
  15377. Object.defineProperty(this, _runUpload, {
  15378. value: _runUpload2
  15379. });
  15380. Object.defineProperty(this, _removeUpload, {
  15381. value: _removeUpload2
  15382. });
  15383. Object.defineProperty(this, _getUpload, {
  15384. value: _getUpload2
  15385. });
  15386. Object.defineProperty(this, _createUpload, {
  15387. value: _createUpload2
  15388. });
  15389. Object.defineProperty(this, _addListeners, {
  15390. value: _addListeners2
  15391. });
  15392. Object.defineProperty(this, _startIfAutoProceed, {
  15393. value: _startIfAutoProceed2
  15394. });
  15395. Object.defineProperty(this, _checkAndCreateFileStateObject, {
  15396. value: _checkAndCreateFileStateObject2
  15397. });
  15398. Object.defineProperty(this, _assertNewUploadAllowed, {
  15399. value: _assertNewUploadAllowed2
  15400. });
  15401. Object.defineProperty(this, _showOrLogErrorAndThrow, {
  15402. value: _showOrLogErrorAndThrow2
  15403. });
  15404. Object.defineProperty(this, _checkRequiredMetaFields, {
  15405. value: _checkRequiredMetaFields2
  15406. });
  15407. Object.defineProperty(this, _checkRequiredMetaFieldsOnFile, {
  15408. value: _checkRequiredMetaFieldsOnFile2
  15409. });
  15410. Object.defineProperty(this, _checkMinNumberOfFiles, {
  15411. value: _checkMinNumberOfFiles2
  15412. });
  15413. Object.defineProperty(this, _checkRestrictions, {
  15414. value: _checkRestrictions2
  15415. });
  15416. Object.defineProperty(this, _plugins, {
  15417. writable: true,
  15418. value: Object.create(null)
  15419. });
  15420. Object.defineProperty(this, _storeUnsubscribe, {
  15421. writable: true,
  15422. value: void 0
  15423. });
  15424. Object.defineProperty(this, _emitter$2, {
  15425. writable: true,
  15426. value: namespaceEmitter()
  15427. });
  15428. Object.defineProperty(this, _preProcessors, {
  15429. writable: true,
  15430. value: new Set()
  15431. });
  15432. Object.defineProperty(this, _uploaders, {
  15433. writable: true,
  15434. value: new Set()
  15435. });
  15436. Object.defineProperty(this, _postProcessors, {
  15437. writable: true,
  15438. value: new Set()
  15439. });
  15440. Object.defineProperty(this, _updateOnlineStatus, {
  15441. writable: true,
  15442. value: this.updateOnlineStatus.bind(this)
  15443. });
  15444. this.defaultLocale = locale$1;
  15445. const defaultOptions = {
  15446. id: 'uppy',
  15447. autoProceed: false,
  15448. /**
  15449. * @deprecated The method should not be used
  15450. */
  15451. allowMultipleUploads: true,
  15452. allowMultipleUploadBatches: true,
  15453. debug: false,
  15454. restrictions: {
  15455. maxFileSize: null,
  15456. minFileSize: null,
  15457. maxTotalFileSize: null,
  15458. maxNumberOfFiles: null,
  15459. minNumberOfFiles: null,
  15460. allowedFileTypes: null,
  15461. requiredMetaFields: []
  15462. },
  15463. meta: {},
  15464. onBeforeFileAdded: currentFile => currentFile,
  15465. onBeforeUpload: files => files,
  15466. store: lib$3(),
  15467. logger: justErrorsLogger,
  15468. infoTimeout: 5000
  15469. }; // Merge default options with the ones set by user,
  15470. // making sure to merge restrictions too
  15471. this.opts = { ...defaultOptions,
  15472. ..._opts,
  15473. restrictions: { ...defaultOptions.restrictions,
  15474. ...(_opts && _opts.restrictions)
  15475. }
  15476. }; // Support debug: true for backwards-compatability, unless logger is set in opts
  15477. // opts instead of this.opts to avoid comparing objects — we set logger: justErrorsLogger in defaultOptions
  15478. if (_opts && _opts.logger && _opts.debug) {
  15479. this.log('You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.', 'warning');
  15480. } else if (_opts && _opts.debug) {
  15481. this.opts.logger = debugLogger$1;
  15482. }
  15483. this.log(`Using Core v${this.constructor.VERSION}`);
  15484. if (this.opts.restrictions.allowedFileTypes && this.opts.restrictions.allowedFileTypes !== null && !Array.isArray(this.opts.restrictions.allowedFileTypes)) {
  15485. throw new TypeError('`restrictions.allowedFileTypes` must be an array');
  15486. }
  15487. this.i18nInit(); // ___Why throttle at 500ms?
  15488. // - We must throttle at >250ms for superfocus in Dashboard to work well
  15489. // (because animation takes 0.25s, and we want to wait for all animations to be over before refocusing).
  15490. // [Practical Check]: if thottle is at 100ms, then if you are uploading a file,
  15491. // and click 'ADD MORE FILES', - focus won't activate in Firefox.
  15492. // - We must throttle at around >500ms to avoid performance lags.
  15493. // [Practical Check] Firefox, try to upload a big file for a prolonged period of time. Laptop will start to heat up.
  15494. this.calculateProgress = lodash_throttle(this.calculateProgress.bind(this), 500, {
  15495. leading: true,
  15496. trailing: true
  15497. });
  15498. this.store = this.opts.store;
  15499. this.setState({
  15500. plugins: {},
  15501. files: {},
  15502. currentUploads: {},
  15503. allowNewUpload: true,
  15504. capabilities: {
  15505. uploadProgress: supportsUploadProgress(),
  15506. individualCancellation: true,
  15507. resumableUploads: false
  15508. },
  15509. totalProgress: 0,
  15510. meta: { ...this.opts.meta
  15511. },
  15512. info: [],
  15513. recoveredState: null
  15514. });
  15515. _classPrivateFieldLooseBase$6(this, _storeUnsubscribe)[_storeUnsubscribe] = this.store.subscribe((prevState, nextState, patch) => {
  15516. this.emit('state-update', prevState, nextState, patch);
  15517. this.updateAll(nextState);
  15518. }); // Exposing uppy object on window for debugging and testing
  15519. if (this.opts.debug && typeof window !== 'undefined') {
  15520. window[this.opts.id] = this;
  15521. }
  15522. _classPrivateFieldLooseBase$6(this, _addListeners)[_addListeners]();
  15523. }
  15524. emit(event) {
  15525. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  15526. args[_key - 1] = arguments[_key];
  15527. }
  15528. _classPrivateFieldLooseBase$6(this, _emitter$2)[_emitter$2].emit(event, ...args);
  15529. }
  15530. on(event, callback) {
  15531. _classPrivateFieldLooseBase$6(this, _emitter$2)[_emitter$2].on(event, callback);
  15532. return this;
  15533. }
  15534. once(event, callback) {
  15535. _classPrivateFieldLooseBase$6(this, _emitter$2)[_emitter$2].once(event, callback);
  15536. return this;
  15537. }
  15538. off(event, callback) {
  15539. _classPrivateFieldLooseBase$6(this, _emitter$2)[_emitter$2].off(event, callback);
  15540. return this;
  15541. }
  15542. /**
  15543. * Iterate on all plugins and run `update` on them.
  15544. * Called each time state changes.
  15545. *
  15546. */
  15547. updateAll(state) {
  15548. this.iteratePlugins(plugin => {
  15549. plugin.update(state);
  15550. });
  15551. }
  15552. /**
  15553. * Updates state with a patch
  15554. *
  15555. * @param {object} patch {foo: 'bar'}
  15556. */
  15557. setState(patch) {
  15558. this.store.setState(patch);
  15559. }
  15560. /**
  15561. * Returns current state.
  15562. *
  15563. * @returns {object}
  15564. */
  15565. getState() {
  15566. return this.store.getState();
  15567. }
  15568. /**
  15569. * Back compat for when uppy.state is used instead of uppy.getState().
  15570. *
  15571. * @deprecated
  15572. */
  15573. get state() {
  15574. // Here, state is a non-enumerable property.
  15575. return this.getState();
  15576. }
  15577. /**
  15578. * Shorthand to set state for a specific file.
  15579. */
  15580. setFileState(fileID, state) {
  15581. if (!this.getState().files[fileID]) {
  15582. throw new Error(`Can’t set state for ${fileID} (the file could have been removed)`);
  15583. }
  15584. this.setState({
  15585. files: { ...this.getState().files,
  15586. [fileID]: { ...this.getState().files[fileID],
  15587. ...state
  15588. }
  15589. }
  15590. });
  15591. }
  15592. i18nInit() {
  15593. const translator = new Translator_1([this.defaultLocale, this.opts.locale]);
  15594. this.i18n = translator.translate.bind(translator);
  15595. this.i18nArray = translator.translateArray.bind(translator);
  15596. this.locale = translator.locale;
  15597. }
  15598. setOptions(newOpts) {
  15599. this.opts = { ...this.opts,
  15600. ...newOpts,
  15601. restrictions: { ...this.opts.restrictions,
  15602. ...(newOpts && newOpts.restrictions)
  15603. }
  15604. };
  15605. if (newOpts.meta) {
  15606. this.setMeta(newOpts.meta);
  15607. }
  15608. this.i18nInit();
  15609. if (newOpts.locale) {
  15610. this.iteratePlugins(plugin => {
  15611. plugin.setOptions();
  15612. });
  15613. } // Note: this is not the preact `setState`, it's an internal function that has the same name.
  15614. this.setState(); // so that UI re-renders with new options
  15615. }
  15616. resetProgress() {
  15617. const defaultProgress = {
  15618. percentage: 0,
  15619. bytesUploaded: 0,
  15620. uploadComplete: false,
  15621. uploadStarted: null
  15622. };
  15623. const files = { ...this.getState().files
  15624. };
  15625. const updatedFiles = {};
  15626. Object.keys(files).forEach(fileID => {
  15627. const updatedFile = { ...files[fileID]
  15628. };
  15629. updatedFile.progress = { ...updatedFile.progress,
  15630. ...defaultProgress
  15631. };
  15632. updatedFiles[fileID] = updatedFile;
  15633. });
  15634. this.setState({
  15635. files: updatedFiles,
  15636. totalProgress: 0
  15637. });
  15638. this.emit('reset-progress');
  15639. }
  15640. addPreProcessor(fn) {
  15641. _classPrivateFieldLooseBase$6(this, _preProcessors)[_preProcessors].add(fn);
  15642. }
  15643. removePreProcessor(fn) {
  15644. return _classPrivateFieldLooseBase$6(this, _preProcessors)[_preProcessors].delete(fn);
  15645. }
  15646. addPostProcessor(fn) {
  15647. _classPrivateFieldLooseBase$6(this, _postProcessors)[_postProcessors].add(fn);
  15648. }
  15649. removePostProcessor(fn) {
  15650. return _classPrivateFieldLooseBase$6(this, _postProcessors)[_postProcessors].delete(fn);
  15651. }
  15652. addUploader(fn) {
  15653. _classPrivateFieldLooseBase$6(this, _uploaders)[_uploaders].add(fn);
  15654. }
  15655. removeUploader(fn) {
  15656. return _classPrivateFieldLooseBase$6(this, _uploaders)[_uploaders].delete(fn);
  15657. }
  15658. setMeta(data) {
  15659. const updatedMeta = { ...this.getState().meta,
  15660. ...data
  15661. };
  15662. const updatedFiles = { ...this.getState().files
  15663. };
  15664. Object.keys(updatedFiles).forEach(fileID => {
  15665. updatedFiles[fileID] = { ...updatedFiles[fileID],
  15666. meta: { ...updatedFiles[fileID].meta,
  15667. ...data
  15668. }
  15669. };
  15670. });
  15671. this.log('Adding metadata:');
  15672. this.log(data);
  15673. this.setState({
  15674. meta: updatedMeta,
  15675. files: updatedFiles
  15676. });
  15677. }
  15678. setFileMeta(fileID, data) {
  15679. const updatedFiles = { ...this.getState().files
  15680. };
  15681. if (!updatedFiles[fileID]) {
  15682. this.log('Was trying to set metadata for a file that has been removed: ', fileID);
  15683. return;
  15684. }
  15685. const newMeta = { ...updatedFiles[fileID].meta,
  15686. ...data
  15687. };
  15688. updatedFiles[fileID] = { ...updatedFiles[fileID],
  15689. meta: newMeta
  15690. };
  15691. this.setState({
  15692. files: updatedFiles
  15693. });
  15694. }
  15695. /**
  15696. * Get a file object.
  15697. *
  15698. * @param {string} fileID The ID of the file object to return.
  15699. */
  15700. getFile(fileID) {
  15701. return this.getState().files[fileID];
  15702. }
  15703. /**
  15704. * Get all files in an array.
  15705. */
  15706. getFiles() {
  15707. const {
  15708. files
  15709. } = this.getState();
  15710. return Object.values(files);
  15711. }
  15712. getObjectOfFilesPerState() {
  15713. const {
  15714. files: filesObject,
  15715. totalProgress,
  15716. error
  15717. } = this.getState();
  15718. const files = Object.values(filesObject);
  15719. const inProgressFiles = files.filter(_ref => {
  15720. let {
  15721. progress
  15722. } = _ref;
  15723. return !progress.uploadComplete && progress.uploadStarted;
  15724. });
  15725. const newFiles = files.filter(file => !file.progress.uploadStarted);
  15726. const startedFiles = files.filter(file => file.progress.uploadStarted || file.progress.preprocess || file.progress.postprocess);
  15727. const uploadStartedFiles = files.filter(file => file.progress.uploadStarted);
  15728. const pausedFiles = files.filter(file => file.isPaused);
  15729. const completeFiles = files.filter(file => file.progress.uploadComplete);
  15730. const erroredFiles = files.filter(file => file.error);
  15731. const inProgressNotPausedFiles = inProgressFiles.filter(file => !file.isPaused);
  15732. const processingFiles = files.filter(file => file.progress.preprocess || file.progress.postprocess);
  15733. return {
  15734. newFiles,
  15735. startedFiles,
  15736. uploadStartedFiles,
  15737. pausedFiles,
  15738. completeFiles,
  15739. erroredFiles,
  15740. inProgressFiles,
  15741. inProgressNotPausedFiles,
  15742. processingFiles,
  15743. isUploadStarted: uploadStartedFiles.length > 0,
  15744. isAllComplete: totalProgress === 100 && completeFiles.length === files.length && processingFiles.length === 0,
  15745. isAllErrored: !!error && erroredFiles.length === files.length,
  15746. isAllPaused: inProgressFiles.length !== 0 && pausedFiles.length === inProgressFiles.length,
  15747. isUploadInProgress: inProgressFiles.length > 0,
  15748. isSomeGhost: files.some(file => file.isGhost)
  15749. };
  15750. }
  15751. /**
  15752. * A public wrapper for _checkRestrictions — checks if a file passes a set of restrictions.
  15753. * For use in UI pluigins (like Providers), to disallow selecting files that won’t pass restrictions.
  15754. *
  15755. * @param {object} file object to check
  15756. * @param {Array} [files] array to check maxNumberOfFiles and maxTotalFileSize
  15757. * @returns {object} { result: true/false, reason: why file didn’t pass restrictions }
  15758. */
  15759. validateRestrictions(file, files) {
  15760. try {
  15761. _classPrivateFieldLooseBase$6(this, _checkRestrictions)[_checkRestrictions](file, files);
  15762. return {
  15763. result: true
  15764. };
  15765. } catch (err) {
  15766. return {
  15767. result: false,
  15768. reason: err.message
  15769. };
  15770. }
  15771. }
  15772. /**
  15773. * Check if file passes a set of restrictions set in options: maxFileSize, minFileSize,
  15774. * maxNumberOfFiles and allowedFileTypes.
  15775. *
  15776. * @param {object} file object to check
  15777. * @param {Array} [files] array to check maxNumberOfFiles and maxTotalFileSize
  15778. * @private
  15779. */
  15780. checkIfFileAlreadyExists(fileID) {
  15781. const {
  15782. files
  15783. } = this.getState();
  15784. if (files[fileID] && !files[fileID].isGhost) {
  15785. return true;
  15786. }
  15787. return false;
  15788. }
  15789. /**
  15790. * Create a file state object based on user-provided `addFile()` options.
  15791. *
  15792. * Note this is extremely side-effectful and should only be done when a file state object
  15793. * will be added to state immediately afterward!
  15794. *
  15795. * The `files` value is passed in because it may be updated by the caller without updating the store.
  15796. */
  15797. /**
  15798. * Add a new file to `state.files`. This will run `onBeforeFileAdded`,
  15799. * try to guess file type in a clever way, check file against restrictions,
  15800. * and start an upload if `autoProceed === true`.
  15801. *
  15802. * @param {object} file object to add
  15803. * @returns {string} id for the added file
  15804. */
  15805. addFile(file) {
  15806. _classPrivateFieldLooseBase$6(this, _assertNewUploadAllowed)[_assertNewUploadAllowed](file);
  15807. const {
  15808. files
  15809. } = this.getState();
  15810. let newFile = _classPrivateFieldLooseBase$6(this, _checkAndCreateFileStateObject)[_checkAndCreateFileStateObject](files, file); // Users are asked to re-select recovered files without data,
  15811. // and to keep the progress, meta and everthing else, we only replace said data
  15812. if (files[newFile.id] && files[newFile.id].isGhost) {
  15813. newFile = { ...files[newFile.id],
  15814. data: file.data,
  15815. isGhost: false
  15816. };
  15817. this.log(`Replaced the blob in the restored ghost file: ${newFile.name}, ${newFile.id}`);
  15818. }
  15819. this.setState({
  15820. files: { ...files,
  15821. [newFile.id]: newFile
  15822. }
  15823. });
  15824. this.emit('file-added', newFile);
  15825. this.emit('files-added', [newFile]);
  15826. this.log(`Added file: ${newFile.name}, ${newFile.id}, mime type: ${newFile.type}`);
  15827. _classPrivateFieldLooseBase$6(this, _startIfAutoProceed)[_startIfAutoProceed]();
  15828. return newFile.id;
  15829. }
  15830. /**
  15831. * Add multiple files to `state.files`. See the `addFile()` documentation.
  15832. *
  15833. * If an error occurs while adding a file, it is logged and the user is notified.
  15834. * This is good for UI plugins, but not for programmatic use.
  15835. * Programmatic users should usually still use `addFile()` on individual files.
  15836. */
  15837. addFiles(fileDescriptors) {
  15838. _classPrivateFieldLooseBase$6(this, _assertNewUploadAllowed)[_assertNewUploadAllowed](); // create a copy of the files object only once
  15839. const files = { ...this.getState().files
  15840. };
  15841. const newFiles = [];
  15842. const errors = [];
  15843. for (let i = 0; i < fileDescriptors.length; i++) {
  15844. try {
  15845. let newFile = _classPrivateFieldLooseBase$6(this, _checkAndCreateFileStateObject)[_checkAndCreateFileStateObject](files, fileDescriptors[i]); // Users are asked to re-select recovered files without data,
  15846. // and to keep the progress, meta and everthing else, we only replace said data
  15847. if (files[newFile.id] && files[newFile.id].isGhost) {
  15848. newFile = { ...files[newFile.id],
  15849. data: fileDescriptors[i].data,
  15850. isGhost: false
  15851. };
  15852. this.log(`Replaced blob in a ghost file: ${newFile.name}, ${newFile.id}`);
  15853. }
  15854. files[newFile.id] = newFile;
  15855. newFiles.push(newFile);
  15856. } catch (err) {
  15857. if (!err.isRestriction) {
  15858. errors.push(err);
  15859. }
  15860. }
  15861. }
  15862. this.setState({
  15863. files
  15864. });
  15865. newFiles.forEach(newFile => {
  15866. this.emit('file-added', newFile);
  15867. });
  15868. this.emit('files-added', newFiles);
  15869. if (newFiles.length > 5) {
  15870. this.log(`Added batch of ${newFiles.length} files`);
  15871. } else {
  15872. Object.keys(newFiles).forEach(fileID => {
  15873. this.log(`Added file: ${newFiles[fileID].name}\n id: ${newFiles[fileID].id}\n type: ${newFiles[fileID].type}`);
  15874. });
  15875. }
  15876. if (newFiles.length > 0) {
  15877. _classPrivateFieldLooseBase$6(this, _startIfAutoProceed)[_startIfAutoProceed]();
  15878. }
  15879. if (errors.length > 0) {
  15880. let message = 'Multiple errors occurred while adding files:\n';
  15881. errors.forEach(subError => {
  15882. message += `\n * ${subError.message}`;
  15883. });
  15884. this.info({
  15885. message: this.i18n('addBulkFilesFailed', {
  15886. smart_count: errors.length
  15887. }),
  15888. details: message
  15889. }, 'error', this.opts.infoTimeout);
  15890. if (typeof AggregateError === 'function') {
  15891. throw new AggregateError(errors, message);
  15892. } else {
  15893. const err = new Error(message);
  15894. err.errors = errors;
  15895. throw err;
  15896. }
  15897. }
  15898. }
  15899. removeFiles(fileIDs, reason) {
  15900. const {
  15901. files,
  15902. currentUploads
  15903. } = this.getState();
  15904. const updatedFiles = { ...files
  15905. };
  15906. const updatedUploads = { ...currentUploads
  15907. };
  15908. const removedFiles = Object.create(null);
  15909. fileIDs.forEach(fileID => {
  15910. if (files[fileID]) {
  15911. removedFiles[fileID] = files[fileID];
  15912. delete updatedFiles[fileID];
  15913. }
  15914. }); // Remove files from the `fileIDs` list in each upload.
  15915. function fileIsNotRemoved(uploadFileID) {
  15916. return removedFiles[uploadFileID] === undefined;
  15917. }
  15918. Object.keys(updatedUploads).forEach(uploadID => {
  15919. const newFileIDs = currentUploads[uploadID].fileIDs.filter(fileIsNotRemoved); // Remove the upload if no files are associated with it anymore.
  15920. if (newFileIDs.length === 0) {
  15921. delete updatedUploads[uploadID];
  15922. return;
  15923. }
  15924. updatedUploads[uploadID] = { ...currentUploads[uploadID],
  15925. fileIDs: newFileIDs
  15926. };
  15927. });
  15928. const stateUpdate = {
  15929. currentUploads: updatedUploads,
  15930. files: updatedFiles
  15931. }; // If all files were removed - allow new uploads,
  15932. // and clear recoveredState
  15933. if (Object.keys(updatedFiles).length === 0) {
  15934. stateUpdate.allowNewUpload = true;
  15935. stateUpdate.error = null;
  15936. stateUpdate.recoveredState = null;
  15937. }
  15938. this.setState(stateUpdate);
  15939. this.calculateTotalProgress();
  15940. const removedFileIDs = Object.keys(removedFiles);
  15941. removedFileIDs.forEach(fileID => {
  15942. this.emit('file-removed', removedFiles[fileID], reason);
  15943. });
  15944. if (removedFileIDs.length > 5) {
  15945. this.log(`Removed ${removedFileIDs.length} files`);
  15946. } else {
  15947. this.log(`Removed files: ${removedFileIDs.join(', ')}`);
  15948. }
  15949. }
  15950. removeFile(fileID, reason) {
  15951. if (reason === void 0) {
  15952. reason = null;
  15953. }
  15954. this.removeFiles([fileID], reason);
  15955. }
  15956. pauseResume(fileID) {
  15957. if (!this.getState().capabilities.resumableUploads || this.getFile(fileID).uploadComplete) {
  15958. return undefined;
  15959. }
  15960. const wasPaused = this.getFile(fileID).isPaused || false;
  15961. const isPaused = !wasPaused;
  15962. this.setFileState(fileID, {
  15963. isPaused
  15964. });
  15965. this.emit('upload-pause', fileID, isPaused);
  15966. return isPaused;
  15967. }
  15968. pauseAll() {
  15969. const updatedFiles = { ...this.getState().files
  15970. };
  15971. const inProgressUpdatedFiles = Object.keys(updatedFiles).filter(file => {
  15972. return !updatedFiles[file].progress.uploadComplete && updatedFiles[file].progress.uploadStarted;
  15973. });
  15974. inProgressUpdatedFiles.forEach(file => {
  15975. const updatedFile = { ...updatedFiles[file],
  15976. isPaused: true
  15977. };
  15978. updatedFiles[file] = updatedFile;
  15979. });
  15980. this.setState({
  15981. files: updatedFiles
  15982. });
  15983. this.emit('pause-all');
  15984. }
  15985. resumeAll() {
  15986. const updatedFiles = { ...this.getState().files
  15987. };
  15988. const inProgressUpdatedFiles = Object.keys(updatedFiles).filter(file => {
  15989. return !updatedFiles[file].progress.uploadComplete && updatedFiles[file].progress.uploadStarted;
  15990. });
  15991. inProgressUpdatedFiles.forEach(file => {
  15992. const updatedFile = { ...updatedFiles[file],
  15993. isPaused: false,
  15994. error: null
  15995. };
  15996. updatedFiles[file] = updatedFile;
  15997. });
  15998. this.setState({
  15999. files: updatedFiles
  16000. });
  16001. this.emit('resume-all');
  16002. }
  16003. retryAll() {
  16004. const updatedFiles = { ...this.getState().files
  16005. };
  16006. const filesToRetry = Object.keys(updatedFiles).filter(file => {
  16007. return updatedFiles[file].error;
  16008. });
  16009. filesToRetry.forEach(file => {
  16010. const updatedFile = { ...updatedFiles[file],
  16011. isPaused: false,
  16012. error: null
  16013. };
  16014. updatedFiles[file] = updatedFile;
  16015. });
  16016. this.setState({
  16017. files: updatedFiles,
  16018. error: null
  16019. });
  16020. this.emit('retry-all', filesToRetry);
  16021. if (filesToRetry.length === 0) {
  16022. return Promise.resolve({
  16023. successful: [],
  16024. failed: []
  16025. });
  16026. }
  16027. const uploadID = _classPrivateFieldLooseBase$6(this, _createUpload)[_createUpload](filesToRetry, {
  16028. forceAllowNewUpload: true // create new upload even if allowNewUpload: false
  16029. });
  16030. return _classPrivateFieldLooseBase$6(this, _runUpload)[_runUpload](uploadID);
  16031. }
  16032. cancelAll() {
  16033. this.emit('cancel-all');
  16034. const {
  16035. files
  16036. } = this.getState();
  16037. const fileIDs = Object.keys(files);
  16038. if (fileIDs.length) {
  16039. this.removeFiles(fileIDs, 'cancel-all');
  16040. }
  16041. this.setState({
  16042. totalProgress: 0,
  16043. error: null,
  16044. recoveredState: null
  16045. });
  16046. }
  16047. retryUpload(fileID) {
  16048. this.setFileState(fileID, {
  16049. error: null,
  16050. isPaused: false
  16051. });
  16052. this.emit('upload-retry', fileID);
  16053. const uploadID = _classPrivateFieldLooseBase$6(this, _createUpload)[_createUpload]([fileID], {
  16054. forceAllowNewUpload: true // create new upload even if allowNewUpload: false
  16055. });
  16056. return _classPrivateFieldLooseBase$6(this, _runUpload)[_runUpload](uploadID);
  16057. }
  16058. reset() {
  16059. this.cancelAll();
  16060. }
  16061. logout() {
  16062. this.iteratePlugins(plugin => {
  16063. if (plugin.provider && plugin.provider.logout) {
  16064. plugin.provider.logout();
  16065. }
  16066. });
  16067. }
  16068. calculateProgress(file, data) {
  16069. if (!this.getFile(file.id)) {
  16070. this.log(`Not setting progress for a file that has been removed: ${file.id}`);
  16071. return;
  16072. } // bytesTotal may be null or zero; in that case we can't divide by it
  16073. const canHavePercentage = Number.isFinite(data.bytesTotal) && data.bytesTotal > 0;
  16074. this.setFileState(file.id, {
  16075. progress: { ...this.getFile(file.id).progress,
  16076. bytesUploaded: data.bytesUploaded,
  16077. bytesTotal: data.bytesTotal,
  16078. percentage: canHavePercentage ? Math.round(data.bytesUploaded / data.bytesTotal * 100) : 0
  16079. }
  16080. });
  16081. this.calculateTotalProgress();
  16082. }
  16083. calculateTotalProgress() {
  16084. // calculate total progress, using the number of files currently uploading,
  16085. // multiplied by 100 and the summ of individual progress of each file
  16086. const files = this.getFiles();
  16087. const inProgress = files.filter(file => {
  16088. return file.progress.uploadStarted || file.progress.preprocess || file.progress.postprocess;
  16089. });
  16090. if (inProgress.length === 0) {
  16091. this.emit('progress', 0);
  16092. this.setState({
  16093. totalProgress: 0
  16094. });
  16095. return;
  16096. }
  16097. const sizedFiles = inProgress.filter(file => file.progress.bytesTotal != null);
  16098. const unsizedFiles = inProgress.filter(file => file.progress.bytesTotal == null);
  16099. if (sizedFiles.length === 0) {
  16100. const progressMax = inProgress.length * 100;
  16101. const currentProgress = unsizedFiles.reduce((acc, file) => {
  16102. return acc + file.progress.percentage;
  16103. }, 0);
  16104. const totalProgress = Math.round(currentProgress / progressMax * 100);
  16105. this.setState({
  16106. totalProgress
  16107. });
  16108. return;
  16109. }
  16110. let totalSize = sizedFiles.reduce((acc, file) => {
  16111. return acc + file.progress.bytesTotal;
  16112. }, 0);
  16113. const averageSize = totalSize / sizedFiles.length;
  16114. totalSize += averageSize * unsizedFiles.length;
  16115. let uploadedSize = 0;
  16116. sizedFiles.forEach(file => {
  16117. uploadedSize += file.progress.bytesUploaded;
  16118. });
  16119. unsizedFiles.forEach(file => {
  16120. uploadedSize += averageSize * (file.progress.percentage || 0) / 100;
  16121. });
  16122. let totalProgress = totalSize === 0 ? 0 : Math.round(uploadedSize / totalSize * 100); // hot fix, because:
  16123. // uploadedSize ended up larger than totalSize, resulting in 1325% total
  16124. if (totalProgress > 100) {
  16125. totalProgress = 100;
  16126. }
  16127. this.setState({
  16128. totalProgress
  16129. });
  16130. this.emit('progress', totalProgress);
  16131. }
  16132. /**
  16133. * Registers listeners for all global actions, like:
  16134. * `error`, `file-removed`, `upload-progress`
  16135. */
  16136. updateOnlineStatus() {
  16137. const online = typeof window.navigator.onLine !== 'undefined' ? window.navigator.onLine : true;
  16138. if (!online) {
  16139. this.emit('is-offline');
  16140. this.info(this.i18n('noInternetConnection'), 'error', 0);
  16141. this.wasOffline = true;
  16142. } else {
  16143. this.emit('is-online');
  16144. if (this.wasOffline) {
  16145. this.emit('back-online');
  16146. this.info(this.i18n('connectedToInternet'), 'success', 3000);
  16147. this.wasOffline = false;
  16148. }
  16149. }
  16150. }
  16151. getID() {
  16152. return this.opts.id;
  16153. }
  16154. /**
  16155. * Registers a plugin with Core.
  16156. *
  16157. * @param {object} Plugin object
  16158. * @param {object} [opts] object with options to be passed to Plugin
  16159. * @returns {object} self for chaining
  16160. */
  16161. // eslint-disable-next-line no-shadow
  16162. use(Plugin, opts) {
  16163. if (typeof Plugin !== 'function') {
  16164. const msg = `Expected a plugin class, but got ${Plugin === null ? 'null' : typeof Plugin}.` + ' Please verify that the plugin was imported and spelled correctly.';
  16165. throw new TypeError(msg);
  16166. } // Instantiate
  16167. const plugin = new Plugin(this, opts);
  16168. const pluginId = plugin.id;
  16169. if (!pluginId) {
  16170. throw new Error('Your plugin must have an id');
  16171. }
  16172. if (!plugin.type) {
  16173. throw new Error('Your plugin must have a type');
  16174. }
  16175. const existsPluginAlready = this.getPlugin(pluginId);
  16176. if (existsPluginAlready) {
  16177. const msg = `Already found a plugin named '${existsPluginAlready.id}'. ` + `Tried to use: '${pluginId}'.\n` + 'Uppy plugins must have unique `id` options. See https://uppy.io/docs/plugins/#id.';
  16178. throw new Error(msg);
  16179. }
  16180. if (Plugin.VERSION) {
  16181. this.log(`Using ${pluginId} v${Plugin.VERSION}`);
  16182. }
  16183. if (plugin.type in _classPrivateFieldLooseBase$6(this, _plugins)[_plugins]) {
  16184. _classPrivateFieldLooseBase$6(this, _plugins)[_plugins][plugin.type].push(plugin);
  16185. } else {
  16186. _classPrivateFieldLooseBase$6(this, _plugins)[_plugins][plugin.type] = [plugin];
  16187. }
  16188. plugin.install();
  16189. return this;
  16190. }
  16191. /**
  16192. * Find one Plugin by name.
  16193. *
  16194. * @param {string} id plugin id
  16195. * @returns {BasePlugin|undefined}
  16196. */
  16197. getPlugin(id) {
  16198. for (const plugins of Object.values(_classPrivateFieldLooseBase$6(this, _plugins)[_plugins])) {
  16199. const foundPlugin = plugins.find(plugin => plugin.id === id);
  16200. if (foundPlugin != null) return foundPlugin;
  16201. }
  16202. return undefined;
  16203. }
  16204. [_Symbol$for$1](type) {
  16205. return _classPrivateFieldLooseBase$6(this, _plugins)[_plugins][type];
  16206. }
  16207. /**
  16208. * Iterate through all `use`d plugins.
  16209. *
  16210. * @param {Function} method that will be run on each plugin
  16211. */
  16212. iteratePlugins(method) {
  16213. Object.values(_classPrivateFieldLooseBase$6(this, _plugins)[_plugins]).flat(1).forEach(method);
  16214. }
  16215. /**
  16216. * Uninstall and remove a plugin.
  16217. *
  16218. * @param {object} instance The plugin instance to remove.
  16219. */
  16220. removePlugin(instance) {
  16221. this.log(`Removing plugin ${instance.id}`);
  16222. this.emit('plugin-remove', instance);
  16223. if (instance.uninstall) {
  16224. instance.uninstall();
  16225. }
  16226. const list = _classPrivateFieldLooseBase$6(this, _plugins)[_plugins][instance.type]; // list.indexOf failed here, because Vue3 converted the plugin instance
  16227. // to a Proxy object, which failed the strict comparison test:
  16228. // obj !== objProxy
  16229. const index = list.findIndex(item => item.id === instance.id);
  16230. if (index !== -1) {
  16231. list.splice(index, 1);
  16232. }
  16233. const state = this.getState();
  16234. const updatedState = {
  16235. plugins: { ...state.plugins,
  16236. [instance.id]: undefined
  16237. }
  16238. };
  16239. this.setState(updatedState);
  16240. }
  16241. /**
  16242. * Uninstall all plugins and close down this Uppy instance.
  16243. */
  16244. close() {
  16245. this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`);
  16246. this.reset();
  16247. _classPrivateFieldLooseBase$6(this, _storeUnsubscribe)[_storeUnsubscribe]();
  16248. this.iteratePlugins(plugin => {
  16249. this.removePlugin(plugin);
  16250. });
  16251. if (typeof window !== 'undefined' && window.removeEventListener) {
  16252. window.removeEventListener('online', _classPrivateFieldLooseBase$6(this, _updateOnlineStatus)[_updateOnlineStatus]);
  16253. window.removeEventListener('offline', _classPrivateFieldLooseBase$6(this, _updateOnlineStatus)[_updateOnlineStatus]);
  16254. }
  16255. }
  16256. hideInfo() {
  16257. const {
  16258. info
  16259. } = this.getState();
  16260. this.setState({
  16261. info: info.slice(1)
  16262. });
  16263. this.emit('info-hidden');
  16264. }
  16265. /**
  16266. * Set info message in `state.info`, so that UI plugins like `Informer`
  16267. * can display the message.
  16268. *
  16269. * @param {string | object} message Message to be displayed by the informer
  16270. * @param {string} [type]
  16271. * @param {number} [duration]
  16272. */
  16273. info(message, type, duration) {
  16274. if (type === void 0) {
  16275. type = 'info';
  16276. }
  16277. if (duration === void 0) {
  16278. duration = 3000;
  16279. }
  16280. const isComplexMessage = typeof message === 'object';
  16281. this.setState({
  16282. info: [...this.getState().info, {
  16283. type,
  16284. message: isComplexMessage ? message.message : message,
  16285. details: isComplexMessage ? message.details : null
  16286. }]
  16287. });
  16288. setTimeout(() => this.hideInfo(), duration);
  16289. this.emit('info-visible');
  16290. }
  16291. /**
  16292. * Passes messages to a function, provided in `opts.logger`.
  16293. * If `opts.logger: Uppy.debugLogger` or `opts.debug: true`, logs to the browser console.
  16294. *
  16295. * @param {string|object} message to log
  16296. * @param {string} [type] optional `error` or `warning`
  16297. */
  16298. log(message, type) {
  16299. const {
  16300. logger
  16301. } = this.opts;
  16302. switch (type) {
  16303. case 'error':
  16304. logger.error(message);
  16305. break;
  16306. case 'warning':
  16307. logger.warn(message);
  16308. break;
  16309. default:
  16310. logger.debug(message);
  16311. break;
  16312. }
  16313. }
  16314. /**
  16315. * Restore an upload by its ID.
  16316. */
  16317. restore(uploadID) {
  16318. this.log(`Core: attempting to restore upload "${uploadID}"`);
  16319. if (!this.getState().currentUploads[uploadID]) {
  16320. _classPrivateFieldLooseBase$6(this, _removeUpload)[_removeUpload](uploadID);
  16321. return Promise.reject(new Error('Nonexistent upload'));
  16322. }
  16323. return _classPrivateFieldLooseBase$6(this, _runUpload)[_runUpload](uploadID);
  16324. }
  16325. /**
  16326. * Create an upload for a bunch of files.
  16327. *
  16328. * @param {Array<string>} fileIDs File IDs to include in this upload.
  16329. * @returns {string} ID of this upload.
  16330. */
  16331. [_Symbol$for2$1]() {
  16332. return _classPrivateFieldLooseBase$6(this, _createUpload)[_createUpload](...arguments);
  16333. }
  16334. /**
  16335. * Add data to an upload's result object.
  16336. *
  16337. * @param {string} uploadID The ID of the upload.
  16338. * @param {object} data Data properties to add to the result object.
  16339. */
  16340. addResultData(uploadID, data) {
  16341. if (!_classPrivateFieldLooseBase$6(this, _getUpload)[_getUpload](uploadID)) {
  16342. this.log(`Not setting result for an upload that has been removed: ${uploadID}`);
  16343. return;
  16344. }
  16345. const {
  16346. currentUploads
  16347. } = this.getState();
  16348. const currentUpload = { ...currentUploads[uploadID],
  16349. result: { ...currentUploads[uploadID].result,
  16350. ...data
  16351. }
  16352. };
  16353. this.setState({
  16354. currentUploads: { ...currentUploads,
  16355. [uploadID]: currentUpload
  16356. }
  16357. });
  16358. }
  16359. /**
  16360. * Remove an upload, eg. if it has been canceled or completed.
  16361. *
  16362. * @param {string} uploadID The ID of the upload.
  16363. */
  16364. /**
  16365. * Start an upload for all the files that are not currently being uploaded.
  16366. *
  16367. * @returns {Promise}
  16368. */
  16369. upload() {
  16370. var _classPrivateFieldLoo;
  16371. if (!((_classPrivateFieldLoo = _classPrivateFieldLooseBase$6(this, _plugins)[_plugins].uploader) != null && _classPrivateFieldLoo.length)) {
  16372. this.log('No uploader type plugins are used', 'warning');
  16373. }
  16374. let {
  16375. files
  16376. } = this.getState();
  16377. const onBeforeUploadResult = this.opts.onBeforeUpload(files);
  16378. if (onBeforeUploadResult === false) {
  16379. return Promise.reject(new Error('Not starting the upload because onBeforeUpload returned false'));
  16380. }
  16381. if (onBeforeUploadResult && typeof onBeforeUploadResult === 'object') {
  16382. files = onBeforeUploadResult; // Updating files in state, because uploader plugins receive file IDs,
  16383. // and then fetch the actual file object from state
  16384. this.setState({
  16385. files
  16386. });
  16387. }
  16388. return Promise.resolve().then(() => {
  16389. _classPrivateFieldLooseBase$6(this, _checkMinNumberOfFiles)[_checkMinNumberOfFiles](files);
  16390. _classPrivateFieldLooseBase$6(this, _checkRequiredMetaFields)[_checkRequiredMetaFields](files);
  16391. }).catch(err => {
  16392. _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](err);
  16393. }).then(() => {
  16394. const {
  16395. currentUploads
  16396. } = this.getState(); // get a list of files that are currently assigned to uploads
  16397. const currentlyUploadingFiles = Object.values(currentUploads).flatMap(curr => curr.fileIDs);
  16398. const waitingFileIDs = [];
  16399. Object.keys(files).forEach(fileID => {
  16400. const file = this.getFile(fileID); // if the file hasn't started uploading and hasn't already been assigned to an upload..
  16401. if (!file.progress.uploadStarted && currentlyUploadingFiles.indexOf(fileID) === -1) {
  16402. waitingFileIDs.push(file.id);
  16403. }
  16404. });
  16405. const uploadID = _classPrivateFieldLooseBase$6(this, _createUpload)[_createUpload](waitingFileIDs);
  16406. return _classPrivateFieldLooseBase$6(this, _runUpload)[_runUpload](uploadID);
  16407. }).catch(err => {
  16408. _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](err, {
  16409. showInformer: false
  16410. });
  16411. });
  16412. }
  16413. }
  16414. function _checkRestrictions2(file, files) {
  16415. if (files === void 0) {
  16416. files = this.getFiles();
  16417. }
  16418. const {
  16419. maxFileSize,
  16420. minFileSize,
  16421. maxTotalFileSize,
  16422. maxNumberOfFiles,
  16423. allowedFileTypes
  16424. } = this.opts.restrictions;
  16425. if (maxNumberOfFiles) {
  16426. if (files.length + 1 > maxNumberOfFiles) {
  16427. throw new RestrictionError(`${this.i18n('youCanOnlyUploadX', {
  16428. smart_count: maxNumberOfFiles
  16429. })}`);
  16430. }
  16431. }
  16432. if (allowedFileTypes) {
  16433. const isCorrectFileType = allowedFileTypes.some(type => {
  16434. // check if this is a mime-type
  16435. if (type.indexOf('/') > -1) {
  16436. if (!file.type) return false;
  16437. return mimeMatch(file.type.replace(/;.*?$/, ''), type);
  16438. } // otherwise this is likely an extension
  16439. if (type[0] === '.' && file.extension) {
  16440. return file.extension.toLowerCase() === type.substr(1).toLowerCase();
  16441. }
  16442. return false;
  16443. });
  16444. if (!isCorrectFileType) {
  16445. const allowedFileTypesString = allowedFileTypes.join(', ');
  16446. throw new RestrictionError(this.i18n('youCanOnlyUploadFileTypes', {
  16447. types: allowedFileTypesString
  16448. }));
  16449. }
  16450. } // We can't check maxTotalFileSize if the size is unknown.
  16451. if (maxTotalFileSize && file.size != null) {
  16452. let totalFilesSize = 0;
  16453. totalFilesSize += file.size;
  16454. files.forEach(f => {
  16455. totalFilesSize += f.size;
  16456. });
  16457. if (totalFilesSize > maxTotalFileSize) {
  16458. throw new RestrictionError(this.i18n('exceedsSize', {
  16459. size: prettierBytes(maxTotalFileSize),
  16460. file: file.name
  16461. }));
  16462. }
  16463. } // We can't check maxFileSize if the size is unknown.
  16464. if (maxFileSize && file.size != null) {
  16465. if (file.size > maxFileSize) {
  16466. throw new RestrictionError(this.i18n('exceedsSize', {
  16467. size: prettierBytes(maxFileSize),
  16468. file: file.name
  16469. }));
  16470. }
  16471. } // We can't check minFileSize if the size is unknown.
  16472. if (minFileSize && file.size != null) {
  16473. if (file.size < minFileSize) {
  16474. throw new RestrictionError(this.i18n('inferiorSize', {
  16475. size: prettierBytes(minFileSize)
  16476. }));
  16477. }
  16478. }
  16479. }
  16480. function _checkMinNumberOfFiles2(files) {
  16481. const {
  16482. minNumberOfFiles
  16483. } = this.opts.restrictions;
  16484. if (Object.keys(files).length < minNumberOfFiles) {
  16485. throw new RestrictionError(`${this.i18n('youHaveToAtLeastSelectX', {
  16486. smart_count: minNumberOfFiles
  16487. })}`);
  16488. }
  16489. }
  16490. function _checkRequiredMetaFieldsOnFile2(file) {
  16491. const {
  16492. requiredMetaFields
  16493. } = this.opts.restrictions;
  16494. const {
  16495. hasOwnProperty
  16496. } = Object.prototype;
  16497. const errors = [];
  16498. const missingFields = [];
  16499. for (let i = 0; i < requiredMetaFields.length; i++) {
  16500. if (!hasOwnProperty.call(file.meta, requiredMetaFields[i]) || file.meta[requiredMetaFields[i]] === '') {
  16501. const err = new RestrictionError(`${this.i18n('missingRequiredMetaFieldOnFile', {
  16502. fileName: file.name
  16503. })}`);
  16504. errors.push(err);
  16505. missingFields.push(requiredMetaFields[i]);
  16506. _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](err, {
  16507. file,
  16508. showInformer: false,
  16509. throwErr: false
  16510. });
  16511. }
  16512. }
  16513. this.setFileState(file.id, {
  16514. missingRequiredMetaFields: missingFields
  16515. });
  16516. return errors;
  16517. }
  16518. function _checkRequiredMetaFields2(files) {
  16519. const errors = Object.keys(files).flatMap(fileID => {
  16520. const file = this.getFile(fileID);
  16521. return _classPrivateFieldLooseBase$6(this, _checkRequiredMetaFieldsOnFile)[_checkRequiredMetaFieldsOnFile](file);
  16522. });
  16523. if (errors.length) {
  16524. throw new AggregateRestrictionError(errors, `${this.i18n('missingRequiredMetaField')}`);
  16525. }
  16526. }
  16527. function _showOrLogErrorAndThrow2(err, _temp) {
  16528. let {
  16529. showInformer = true,
  16530. file = null,
  16531. throwErr = true
  16532. } = _temp === void 0 ? {} : _temp;
  16533. const message = typeof err === 'object' ? err.message : err;
  16534. const details = typeof err === 'object' && err.details ? err.details : ''; // Restriction errors should be logged, but not as errors,
  16535. // as they are expected and shown in the UI.
  16536. let logMessageWithDetails = message;
  16537. if (details) {
  16538. logMessageWithDetails += ` ${details}`;
  16539. }
  16540. if (err.isRestriction) {
  16541. this.log(logMessageWithDetails);
  16542. this.emit('restriction-failed', file, err);
  16543. } else {
  16544. this.log(logMessageWithDetails, 'error');
  16545. } // Sometimes informer has to be shown manually by the developer,
  16546. // for example, in `onBeforeFileAdded`.
  16547. if (showInformer) {
  16548. this.info({
  16549. message,
  16550. details
  16551. }, 'error', this.opts.infoTimeout);
  16552. }
  16553. if (throwErr) {
  16554. throw typeof err === 'object' ? err : new Error(err);
  16555. }
  16556. }
  16557. function _assertNewUploadAllowed2(file) {
  16558. const {
  16559. allowNewUpload
  16560. } = this.getState();
  16561. if (allowNewUpload === false) {
  16562. _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](new RestrictionError(this.i18n('noMoreFilesAllowed')), {
  16563. file
  16564. });
  16565. }
  16566. }
  16567. function _checkAndCreateFileStateObject2(files, fileDescriptor) {
  16568. const fileType = getFileType(fileDescriptor);
  16569. const fileName = getFileName(fileType, fileDescriptor);
  16570. const fileExtension = getFileNameAndExtension(fileName).extension;
  16571. const isRemote = Boolean(fileDescriptor.isRemote);
  16572. const fileID = generateFileID({ ...fileDescriptor,
  16573. type: fileType
  16574. });
  16575. if (this.checkIfFileAlreadyExists(fileID)) {
  16576. const error = new RestrictionError(this.i18n('noDuplicates', {
  16577. fileName
  16578. }));
  16579. _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](error, {
  16580. file: fileDescriptor
  16581. });
  16582. }
  16583. const meta = fileDescriptor.meta || {};
  16584. meta.name = fileName;
  16585. meta.type = fileType; // `null` means the size is unknown.
  16586. const size = Number.isFinite(fileDescriptor.data.size) ? fileDescriptor.data.size : null;
  16587. let newFile = {
  16588. source: fileDescriptor.source || '',
  16589. id: fileID,
  16590. name: fileName,
  16591. extension: fileExtension || '',
  16592. meta: { ...this.getState().meta,
  16593. ...meta
  16594. },
  16595. type: fileType,
  16596. data: fileDescriptor.data,
  16597. progress: {
  16598. percentage: 0,
  16599. bytesUploaded: 0,
  16600. bytesTotal: size,
  16601. uploadComplete: false,
  16602. uploadStarted: null
  16603. },
  16604. size,
  16605. isRemote,
  16606. remote: fileDescriptor.remote || '',
  16607. preview: fileDescriptor.preview
  16608. };
  16609. const onBeforeFileAddedResult = this.opts.onBeforeFileAdded(newFile, files);
  16610. if (onBeforeFileAddedResult === false) {
  16611. // Don’t show UI info for this error, as it should be done by the developer
  16612. _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](new RestrictionError('Cannot add the file because onBeforeFileAdded returned false.'), {
  16613. showInformer: false,
  16614. fileDescriptor
  16615. });
  16616. } else if (typeof onBeforeFileAddedResult === 'object' && onBeforeFileAddedResult !== null) {
  16617. newFile = onBeforeFileAddedResult;
  16618. }
  16619. try {
  16620. const filesArray = Object.keys(files).map(i => files[i]);
  16621. _classPrivateFieldLooseBase$6(this, _checkRestrictions)[_checkRestrictions](newFile, filesArray);
  16622. } catch (err) {
  16623. _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](err, {
  16624. file: newFile
  16625. });
  16626. }
  16627. return newFile;
  16628. }
  16629. function _startIfAutoProceed2() {
  16630. if (this.opts.autoProceed && !this.scheduledAutoProceed) {
  16631. this.scheduledAutoProceed = setTimeout(() => {
  16632. this.scheduledAutoProceed = null;
  16633. this.upload().catch(err => {
  16634. if (!err.isRestriction) {
  16635. this.log(err.stack || err.message || err);
  16636. }
  16637. });
  16638. }, 4);
  16639. }
  16640. }
  16641. function _addListeners2() {
  16642. /**
  16643. * @param {Error} error
  16644. * @param {object} [file]
  16645. * @param {object} [response]
  16646. */
  16647. const errorHandler = (error, file, response) => {
  16648. let errorMsg = error.message || 'Unknown error';
  16649. if (error.details) {
  16650. errorMsg += ` ${error.details}`;
  16651. }
  16652. this.setState({
  16653. error: errorMsg
  16654. });
  16655. if (file != null && file.id in this.getState().files) {
  16656. this.setFileState(file.id, {
  16657. error: errorMsg,
  16658. response
  16659. });
  16660. }
  16661. };
  16662. this.on('error', errorHandler);
  16663. this.on('upload-error', (file, error, response) => {
  16664. errorHandler(error, file, response);
  16665. if (typeof error === 'object' && error.message) {
  16666. const newError = new Error(error.message);
  16667. newError.details = error.message;
  16668. if (error.details) {
  16669. newError.details += ` ${error.details}`;
  16670. }
  16671. newError.message = this.i18n('failedToUpload', {
  16672. file: file.name
  16673. });
  16674. _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](newError, {
  16675. throwErr: false
  16676. });
  16677. } else {
  16678. _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](error, {
  16679. throwErr: false
  16680. });
  16681. }
  16682. });
  16683. this.on('upload', () => {
  16684. this.setState({
  16685. error: null
  16686. });
  16687. });
  16688. this.on('upload-started', file => {
  16689. if (!this.getFile(file.id)) {
  16690. this.log(`Not setting progress for a file that has been removed: ${file.id}`);
  16691. return;
  16692. }
  16693. this.setFileState(file.id, {
  16694. progress: {
  16695. uploadStarted: Date.now(),
  16696. uploadComplete: false,
  16697. percentage: 0,
  16698. bytesUploaded: 0,
  16699. bytesTotal: file.size
  16700. }
  16701. });
  16702. });
  16703. this.on('upload-progress', this.calculateProgress);
  16704. this.on('upload-success', (file, uploadResp) => {
  16705. if (!this.getFile(file.id)) {
  16706. this.log(`Not setting progress for a file that has been removed: ${file.id}`);
  16707. return;
  16708. }
  16709. const currentProgress = this.getFile(file.id).progress;
  16710. this.setFileState(file.id, {
  16711. progress: { ...currentProgress,
  16712. postprocess: _classPrivateFieldLooseBase$6(this, _postProcessors)[_postProcessors].size > 0 ? {
  16713. mode: 'indeterminate'
  16714. } : null,
  16715. uploadComplete: true,
  16716. percentage: 100,
  16717. bytesUploaded: currentProgress.bytesTotal
  16718. },
  16719. response: uploadResp,
  16720. uploadURL: uploadResp.uploadURL,
  16721. isPaused: false
  16722. }); // Remote providers sometimes don't tell us the file size,
  16723. // but we can know how many bytes we uploaded once the upload is complete.
  16724. if (file.size == null) {
  16725. this.setFileState(file.id, {
  16726. size: uploadResp.bytesUploaded || currentProgress.bytesTotal
  16727. });
  16728. }
  16729. this.calculateTotalProgress();
  16730. });
  16731. this.on('preprocess-progress', (file, progress) => {
  16732. if (!this.getFile(file.id)) {
  16733. this.log(`Not setting progress for a file that has been removed: ${file.id}`);
  16734. return;
  16735. }
  16736. this.setFileState(file.id, {
  16737. progress: { ...this.getFile(file.id).progress,
  16738. preprocess: progress
  16739. }
  16740. });
  16741. });
  16742. this.on('preprocess-complete', file => {
  16743. if (!this.getFile(file.id)) {
  16744. this.log(`Not setting progress for a file that has been removed: ${file.id}`);
  16745. return;
  16746. }
  16747. const files = { ...this.getState().files
  16748. };
  16749. files[file.id] = { ...files[file.id],
  16750. progress: { ...files[file.id].progress
  16751. }
  16752. };
  16753. delete files[file.id].progress.preprocess;
  16754. this.setState({
  16755. files
  16756. });
  16757. });
  16758. this.on('postprocess-progress', (file, progress) => {
  16759. if (!this.getFile(file.id)) {
  16760. this.log(`Not setting progress for a file that has been removed: ${file.id}`);
  16761. return;
  16762. }
  16763. this.setFileState(file.id, {
  16764. progress: { ...this.getState().files[file.id].progress,
  16765. postprocess: progress
  16766. }
  16767. });
  16768. });
  16769. this.on('postprocess-complete', file => {
  16770. if (!this.getFile(file.id)) {
  16771. this.log(`Not setting progress for a file that has been removed: ${file.id}`);
  16772. return;
  16773. }
  16774. const files = { ...this.getState().files
  16775. };
  16776. files[file.id] = { ...files[file.id],
  16777. progress: { ...files[file.id].progress
  16778. }
  16779. };
  16780. delete files[file.id].progress.postprocess;
  16781. this.setState({
  16782. files
  16783. });
  16784. });
  16785. this.on('restored', () => {
  16786. // Files may have changed--ensure progress is still accurate.
  16787. this.calculateTotalProgress();
  16788. });
  16789. this.on('dashboard:file-edit-complete', file => {
  16790. if (file) {
  16791. _classPrivateFieldLooseBase$6(this, _checkRequiredMetaFieldsOnFile)[_checkRequiredMetaFieldsOnFile](file);
  16792. }
  16793. }); // show informer if offline
  16794. if (typeof window !== 'undefined' && window.addEventListener) {
  16795. window.addEventListener('online', _classPrivateFieldLooseBase$6(this, _updateOnlineStatus)[_updateOnlineStatus]);
  16796. window.addEventListener('offline', _classPrivateFieldLooseBase$6(this, _updateOnlineStatus)[_updateOnlineStatus]);
  16797. setTimeout(_classPrivateFieldLooseBase$6(this, _updateOnlineStatus)[_updateOnlineStatus], 3000);
  16798. }
  16799. }
  16800. function _createUpload2(fileIDs, opts) {
  16801. if (opts === void 0) {
  16802. opts = {};
  16803. }
  16804. // uppy.retryAll sets this to true — when retrying we want to ignore `allowNewUpload: false`
  16805. const {
  16806. forceAllowNewUpload = false
  16807. } = opts;
  16808. const {
  16809. allowNewUpload,
  16810. currentUploads
  16811. } = this.getState();
  16812. if (!allowNewUpload && !forceAllowNewUpload) {
  16813. throw new Error('Cannot create a new upload: already uploading.');
  16814. }
  16815. const uploadID = nanoid$1();
  16816. this.emit('upload', {
  16817. id: uploadID,
  16818. fileIDs
  16819. });
  16820. this.setState({
  16821. allowNewUpload: this.opts.allowMultipleUploadBatches !== false && this.opts.allowMultipleUploads !== false,
  16822. currentUploads: { ...currentUploads,
  16823. [uploadID]: {
  16824. fileIDs,
  16825. step: 0,
  16826. result: {}
  16827. }
  16828. }
  16829. });
  16830. return uploadID;
  16831. }
  16832. function _getUpload2(uploadID) {
  16833. const {
  16834. currentUploads
  16835. } = this.getState();
  16836. return currentUploads[uploadID];
  16837. }
  16838. function _removeUpload2(uploadID) {
  16839. const currentUploads = { ...this.getState().currentUploads
  16840. };
  16841. delete currentUploads[uploadID];
  16842. this.setState({
  16843. currentUploads
  16844. });
  16845. }
  16846. async function _runUpload2(uploadID) {
  16847. let {
  16848. currentUploads
  16849. } = this.getState();
  16850. let currentUpload = currentUploads[uploadID];
  16851. const restoreStep = currentUpload.step || 0;
  16852. const steps = [..._classPrivateFieldLooseBase$6(this, _preProcessors)[_preProcessors], ..._classPrivateFieldLooseBase$6(this, _uploaders)[_uploaders], ..._classPrivateFieldLooseBase$6(this, _postProcessors)[_postProcessors]];
  16853. try {
  16854. for (let step = restoreStep; step < steps.length; step++) {
  16855. if (!currentUpload) {
  16856. break;
  16857. }
  16858. const fn = steps[step];
  16859. const updatedUpload = { ...currentUpload,
  16860. step
  16861. };
  16862. this.setState({
  16863. currentUploads: { ...currentUploads,
  16864. [uploadID]: updatedUpload
  16865. }
  16866. }); // TODO give this the `updatedUpload` object as its only parameter maybe?
  16867. // Otherwise when more metadata may be added to the upload this would keep getting more parameters
  16868. await fn(updatedUpload.fileIDs, uploadID); // Update currentUpload value in case it was modified asynchronously.
  16869. currentUploads = this.getState().currentUploads;
  16870. currentUpload = currentUploads[uploadID];
  16871. }
  16872. } catch (err) {
  16873. this.emit('error', err);
  16874. _classPrivateFieldLooseBase$6(this, _removeUpload)[_removeUpload](uploadID);
  16875. throw err;
  16876. } // Set result data.
  16877. if (currentUpload) {
  16878. // Mark postprocessing step as complete if necessary; this addresses a case where we might get
  16879. // stuck in the postprocessing UI while the upload is fully complete.
  16880. // If the postprocessing steps do not do any work, they may not emit postprocessing events at
  16881. // all, and never mark the postprocessing as complete. This is fine on its own but we
  16882. // introduced code in the @uppy/core upload-success handler to prepare postprocessing progress
  16883. // state if any postprocessors are registered. That is to avoid a "flash of completed state"
  16884. // before the postprocessing plugins can emit events.
  16885. //
  16886. // So, just in case an upload with postprocessing plugins *has* completed *without* emitting
  16887. // postprocessing completion, we do it instead.
  16888. currentUpload.fileIDs.forEach(fileID => {
  16889. const file = this.getFile(fileID);
  16890. if (file && file.progress.postprocess) {
  16891. this.emit('postprocess-complete', file);
  16892. }
  16893. });
  16894. const files = currentUpload.fileIDs.map(fileID => this.getFile(fileID));
  16895. const successful = files.filter(file => !file.error);
  16896. const failed = files.filter(file => file.error);
  16897. await this.addResultData(uploadID, {
  16898. successful,
  16899. failed,
  16900. uploadID
  16901. }); // Update currentUpload value in case it was modified asynchronously.
  16902. currentUploads = this.getState().currentUploads;
  16903. currentUpload = currentUploads[uploadID];
  16904. } // Emit completion events.
  16905. // This is in a separate function so that the `currentUploads` variable
  16906. // always refers to the latest state. In the handler right above it refers
  16907. // to an outdated object without the `.result` property.
  16908. let result;
  16909. if (currentUpload) {
  16910. result = currentUpload.result;
  16911. this.emit('complete', result);
  16912. _classPrivateFieldLooseBase$6(this, _removeUpload)[_removeUpload](uploadID);
  16913. }
  16914. if (result == null) {
  16915. this.log(`Not setting result for an upload that has been removed: ${uploadID}`);
  16916. }
  16917. return result;
  16918. }
  16919. Uppy.VERSION = "2.1.3";
  16920. var Uppy_1$1 = Uppy;
  16921. var preact = createCommonjsModule$1(function (module, exports) {
  16922. var n,l,u,t,i,r,o,f,e={},c=[],s=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function a(n,l){for(var u in l)n[u]=l[u];return n}function v(n){var l=n.parentNode;l&&l.removeChild(n);}function h(l,u,t){var i,r,o,f={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=u[o];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps)void 0===f[o]&&(f[o]=l.defaultProps[o]);return p(l,f,i,r,null)}function p(n,t,i,r,o){var f={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++u:o};return null==o&&null!=l.vnode&&l.vnode(f),f}function y(n){return n.children}function d(n,l){this.props=n,this.context=l;}function _(n,l){if(null==l)return n.__?_(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function x(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!b.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(b);}function b(){for(var n;b.__r=i.length;)n=i.sort(function(n,l){return n.__v.__b-l.__v.__b}),i=[],n.some(function(n){var l,u,t,i,r,o;n.__d&&(r=(i=(l=n).__v).__e,(o=l.__P)&&(u=[],(t=a({},i)).__v=i.__v+1,I(o,i,t,l.__n,void 0!==o.ownerSVGElement,null!=i.__h?[r]:null,u,null==r?_(i):r,i.__h),T(u,i),i.__e!=r&&k(i)));});}function m(n,l,u,t,i,r,o,f,s,a){var v,h,d,k,x,b,m,A=t&&t.__k||c,P=A.length;for(u.__k=[],v=0;v<l.length;v++)if(null!=(k=u.__k[v]=null==(k=l[v])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?p(null,k,null,null,k):Array.isArray(k)?p(y,{children:k},null,null,null):k.__b>0?p(k.type,k.props,k.key,null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=A[v])||d&&k.key==d.key&&k.type===d.type)A[v]=void 0;else for(h=0;h<P;h++){if((d=A[h])&&k.key==d.key&&k.type===d.type){A[h]=void 0;break}d=null;}I(n,k,d=d||e,i,r,o,f,s,a),x=k.__e,(h=k.ref)&&d.ref!=h&&(m||(m=[]),d.ref&&m.push(d.ref,null,k),m.push(h,k.__c||x,k)),null!=x?(null==b&&(b=x),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=g(k,s,n):s=w(n,k,d,A,x,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_(d));}for(u.__e=b,v=P;v--;)null!=A[v]&&("function"==typeof u.type&&null!=A[v].__e&&A[v].__e==u.__d&&(u.__d=_(t,v+1)),L(A[v],A[v]));if(m)for(v=0;v<m.length;v++)z(m[v],m[++v],m[++v]);}function g(n,l,u){for(var t,i=n.__k,r=0;i&&r<i.length;r++)(t=i[r])&&(t.__=n,l="function"==typeof t.type?g(t,l,u):w(u,t,t,i,t.__e,l));return l}function w(n,l,u,t,i,r){var o,f,e;if(void 0!==l.__d)o=l.__d,l.__d=void 0;else if(null==u||i!=r||null==i.parentNode)n:if(null==r||r.parentNode!==n)n.appendChild(i),o=null;else {for(f=r,e=0;(f=f.nextSibling)&&e<t.length;e+=2)if(f==i)break n;n.insertBefore(i,r),o=r;}return void 0!==o?o:i.nextSibling}function A(n,l,u,t,i){var r;for(r in u)"children"===r||"key"===r||r in l||C(n,r,null,u[r],t);for(r in l)i&&"function"!=typeof l[r]||"children"===r||"key"===r||"value"===r||"checked"===r||u[r]===l[r]||C(n,r,l[r],u[r],t);}function P(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||s.test(l)?u:u+"px";}function C(n,l,u,t,i){var r;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||P(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||P(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])r=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t||n.addEventListener(l,r?H:$,r):n.removeEventListener(l,r?H:$,r);else if("dangerouslySetInnerHTML"!==l){if(i)l=l.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l));}}function $(n){this.l[n.type+!1](l.event?l.event(n):n);}function H(n){this.l[n.type+!0](l.event?l.event(n):n);}function I(n,u,t,i,r,o,f,e,c){var s,v,h,p,_,k,x,b,g,w,A,P=u.type;if(void 0!==u.constructor)return null;null!=t.__h&&(c=t.__h,e=u.__e=t.__e,u.__h=null,o=[e]),(s=l.__b)&&s(u);try{n:if("function"==typeof P){if(b=u.props,g=(s=P.contextType)&&i[s.__c],w=s?g?g.props.value:s.__:i,t.__c?x=(v=u.__c=t.__c).__=v.__E:("prototype"in P&&P.prototype.render?u.__c=v=new P(b,w):(u.__c=v=new d(b,w),v.constructor=P,v.render=M),g&&g.sub(v),v.props=b,v.state||(v.state={}),v.context=w,v.__n=i,h=v.__d=!0,v.__h=[]),null==v.__s&&(v.__s=v.state),null!=P.getDerivedStateFromProps&&(v.__s==v.state&&(v.__s=a({},v.__s)),a(v.__s,P.getDerivedStateFromProps(b,v.__s))),p=v.props,_=v.state,h)null==P.getDerivedStateFromProps&&null!=v.componentWillMount&&v.componentWillMount(),null!=v.componentDidMount&&v.__h.push(v.componentDidMount);else {if(null==P.getDerivedStateFromProps&&b!==p&&null!=v.componentWillReceiveProps&&v.componentWillReceiveProps(b,w),!v.__e&&null!=v.shouldComponentUpdate&&!1===v.shouldComponentUpdate(b,v.__s,w)||u.__v===t.__v){v.props=b,v.state=v.__s,u.__v!==t.__v&&(v.__d=!1),v.__v=u,u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u);}),v.__h.length&&f.push(v);break n}null!=v.componentWillUpdate&&v.componentWillUpdate(b,v.__s,w),null!=v.componentDidUpdate&&v.__h.push(function(){v.componentDidUpdate(p,_,k);});}v.context=w,v.props=b,v.state=v.__s,(s=l.__r)&&s(u),v.__d=!1,v.__v=u,v.__P=n,s=v.render(v.props,v.state,v.context),v.state=v.__s,null!=v.getChildContext&&(i=a(a({},i),v.getChildContext())),h||null==v.getSnapshotBeforeUpdate||(k=v.getSnapshotBeforeUpdate(p,_)),A=null!=s&&s.type===y&&null==s.key?s.props.children:s,m(n,Array.isArray(A)?A:[A],u,t,i,r,o,f,e,c),v.base=u.__e,u.__h=null,v.__h.length&&f.push(v),x&&(v.__E=v.__=null),v.__e=!1;}else null==o&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=j(t.__e,u,t,i,r,o,f,c);(s=l.diffed)&&s(u);}catch(n){u.__v=null,(c||null!=o)&&(u.__e=e,u.__h=!!c,o[o.indexOf(e)]=null),l.__e(n,u,t);}}function T(n,u){l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l.__e(n,u.__v);}});}function j(l,u,t,i,r,o,f,c){var s,a,h,p=t.props,y=u.props,d=u.type,k=0;if("svg"===d&&(r=!0),null!=o)for(;k<o.length;k++)if((s=o[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,o[k]=null;break}if(null==l){if(null===d)return document.createTextNode(y);l=r?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,y.is&&y),o=null,c=!1;}if(null===d)p===y||c&&l.data===y||(l.data=y);else {if(o=o&&n.call(l.childNodes),a=(p=t.props||e).dangerouslySetInnerHTML,h=y.dangerouslySetInnerHTML,!c){if(null!=o)for(p={},k=0;k<l.attributes.length;k++)p[l.attributes[k].name]=l.attributes[k].value;(h||a)&&(h&&(a&&h.__html==a.__html||h.__html===l.innerHTML)||(l.innerHTML=h&&h.__html||""));}if(A(l,y,p,r,c),h)u.__k=[];else if(k=u.props.children,m(l,Array.isArray(k)?k:[k],u,t,i,r&&"foreignObject"!==d,o,f,o?o[0]:t.__k&&_(t,0),c),null!=o)for(k=o.length;k--;)null!=o[k]&&v(o[k]);c||("value"in y&&void 0!==(k=y.value)&&(k!==p.value||k!==l.value||"progress"===d&&!k)&&C(l,"value",k,p.value,!1),"checked"in y&&void 0!==(k=y.checked)&&k!==l.checked&&C(l,"checked",k,p.checked,!1));}return l}function z(n,u,t){try{"function"==typeof n?n(u):n.current=u;}catch(n){l.__e(n,t);}}function L(n,u,t){var i,r;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||z(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l.__e(n,u);}i.base=i.__P=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&L(i[r],u,"function"!=typeof n.type);t||null==n.__e||v(n.__e),n.__e=n.__d=void 0;}function M(n,l,u){return this.constructor(n,u)}function N(u,t,i){var r,o,f;l.__&&l.__(u,t),o=(r="function"==typeof i)?null:i&&i.__k||t.__k,f=[],I(t,u=(!r&&i||t).__k=h(y,null,[u]),o||e,e,void 0!==t.ownerSVGElement,!r&&i?[i]:o?null:t.firstChild?n.call(t.childNodes):null,f,!r&&i?i:o?o.__e:t.firstChild,r),T(f,u);}n=c.slice,l={__e:function(n,l){for(var u,t,i;l=l.__;)if((u=l.__c)&&!u.__)try{if((t=u.constructor)&&null!=t.getDerivedStateFromError&&(u.setState(t.getDerivedStateFromError(n)),i=u.__d),null!=u.componentDidCatch&&(u.componentDidCatch(n),i=u.__d),i)return u.__E=u}catch(l){n=l;}throw n}},u=0,t=function(n){return null!=n&&void 0===n.constructor},d.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=a({},this.state),"function"==typeof n&&(n=n(a({},u),this.props)),n&&a(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),x(this));},d.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),x(this));},d.prototype.render=y,i=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,b.__r=0,f=0,exports.Component=d,exports.Fragment=y,exports.cloneElement=function(l,u,t){var i,r,o,f=a({},l.props);for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),p(l.type,f,i||l.key,r||l.ref,null)},exports.createContext=function(n,l){var u={__c:l="__cC"+f++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(x);},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u},exports.createElement=h,exports.createRef=function(){return {current:null}},exports.h=h,exports.hydrate=function n(l,u){N(l,u,n);},exports.isValidElement=t,exports.options=l,exports.render=N,exports.toChildArray=function n(l,u){return u=u||[],null==l||"boolean"==typeof l||(Array.isArray(l)?l.some(function(l){n(l,u);}):u.push(l)),u};
  16923. });
  16924. /**
  16925. * Check if an object is a DOM element. Duck-typing based on `nodeType`.
  16926. *
  16927. * @param {*} obj
  16928. */
  16929. var isDOMElement = function isDOMElement(obj) {
  16930. return (obj == null ? void 0 : obj.nodeType) === Node.ELEMENT_NODE;
  16931. };
  16932. /**
  16933. * Find a DOM element.
  16934. *
  16935. * @param {Node|string} element
  16936. * @returns {Node|null}
  16937. */
  16938. var findDOMElement = function findDOMElement(element, context) {
  16939. if (context === void 0) {
  16940. context = document;
  16941. }
  16942. if (typeof element === 'string') {
  16943. return context.querySelector(element);
  16944. }
  16945. if (isDOMElement(element)) {
  16946. return element;
  16947. }
  16948. return null;
  16949. };
  16950. /**
  16951. * Core plugin logic that all plugins share.
  16952. *
  16953. * BasePlugin does not contain DOM rendering so it can be used for plugins
  16954. * without a user interface.
  16955. *
  16956. * See `Plugin` for the extended version with Preact rendering for interfaces.
  16957. */
  16958. var BasePlugin_1$1 = class BasePlugin {
  16959. constructor(uppy, opts) {
  16960. if (opts === void 0) {
  16961. opts = {};
  16962. }
  16963. this.uppy = uppy;
  16964. this.opts = opts;
  16965. }
  16966. getPluginState() {
  16967. const {
  16968. plugins
  16969. } = this.uppy.getState();
  16970. return plugins[this.id] || {};
  16971. }
  16972. setPluginState(update) {
  16973. const {
  16974. plugins
  16975. } = this.uppy.getState();
  16976. this.uppy.setState({
  16977. plugins: { ...plugins,
  16978. [this.id]: { ...plugins[this.id],
  16979. ...update
  16980. }
  16981. }
  16982. });
  16983. }
  16984. setOptions(newOpts) {
  16985. this.opts = { ...this.opts,
  16986. ...newOpts
  16987. };
  16988. this.setPluginState(); // so that UI re-renders with new options
  16989. this.i18nInit();
  16990. }
  16991. i18nInit() {
  16992. const translator = new Translator_1([this.defaultLocale, this.uppy.locale, this.opts.locale]);
  16993. this.i18n = translator.translate.bind(translator);
  16994. this.i18nArray = translator.translateArray.bind(translator);
  16995. this.setPluginState(); // so that UI re-renders and we see the updated locale
  16996. }
  16997. /**
  16998. * Extendable methods
  16999. * ==================
  17000. * These methods are here to serve as an overview of the extendable methods as well as
  17001. * making them not conditional in use, such as `if (this.afterUpdate)`.
  17002. */
  17003. // eslint-disable-next-line class-methods-use-this
  17004. addTarget() {
  17005. throw new Error('Extend the addTarget method to add your plugin to another plugin\'s target');
  17006. } // eslint-disable-next-line class-methods-use-this
  17007. install() {} // eslint-disable-next-line class-methods-use-this
  17008. uninstall() {}
  17009. /**
  17010. * Called when plugin is mounted, whether in DOM or into another plugin.
  17011. * Needed because sometimes plugins are mounted separately/after `install`,
  17012. * so this.el and this.parent might not be available in `install`.
  17013. * This is the case with @uppy/react plugins, for example.
  17014. */
  17015. render() {
  17016. throw new Error('Extend the render method to add your plugin to a DOM element');
  17017. } // eslint-disable-next-line class-methods-use-this
  17018. update() {} // Called after every state update, after everything's mounted. Debounced.
  17019. // eslint-disable-next-line class-methods-use-this
  17020. afterUpdate() {}
  17021. };
  17022. function _classPrivateFieldLooseBase$5(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
  17023. var id$5 = 0;
  17024. function _classPrivateFieldLooseKey$5(name) { return "__private_" + id$5++ + "_" + name; }
  17025. const {
  17026. render
  17027. } = preact;
  17028. /**
  17029. * Defer a frequent call to the microtask queue.
  17030. *
  17031. * @param {() => T} fn
  17032. * @returns {Promise<T>}
  17033. */
  17034. function debounce(fn) {
  17035. let calling = null;
  17036. let latestArgs = null;
  17037. return function () {
  17038. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  17039. args[_key] = arguments[_key];
  17040. }
  17041. latestArgs = args;
  17042. if (!calling) {
  17043. calling = Promise.resolve().then(() => {
  17044. calling = null; // At this point `args` may be different from the most
  17045. // recent state, if multiple calls happened since this task
  17046. // was queued. So we use the `latestArgs`, which definitely
  17047. // is the most recent call.
  17048. return fn(...latestArgs);
  17049. });
  17050. }
  17051. return calling;
  17052. };
  17053. }
  17054. /**
  17055. * UIPlugin is the extended version of BasePlugin to incorporate rendering with Preact.
  17056. * Use this for plugins that need a user interface.
  17057. *
  17058. * For plugins without an user interface, see BasePlugin.
  17059. */
  17060. var _updateUI = /*#__PURE__*/_classPrivateFieldLooseKey$5("updateUI");
  17061. class UIPlugin extends BasePlugin_1$1 {
  17062. constructor() {
  17063. super(...arguments);
  17064. Object.defineProperty(this, _updateUI, {
  17065. writable: true,
  17066. value: void 0
  17067. });
  17068. }
  17069. /**
  17070. * Check if supplied `target` is a DOM element or an `object`.
  17071. * If it’s an object — target is a plugin, and we search `plugins`
  17072. * for a plugin with same name and return its target.
  17073. */
  17074. mount(target, plugin) {
  17075. const callerPluginName = plugin.id;
  17076. const targetElement = findDOMElement(target);
  17077. if (targetElement) {
  17078. this.isTargetDOMEl = true; // When target is <body> with a single <div> element,
  17079. // Preact thinks it’s the Uppy root element in there when doing a diff,
  17080. // and destroys it. So we are creating a fragment (could be empty div)
  17081. const uppyRootElement = document.createDocumentFragment(); // API for plugins that require a synchronous rerender.
  17082. _classPrivateFieldLooseBase$5(this, _updateUI)[_updateUI] = debounce(state => {
  17083. // plugin could be removed, but this.rerender is debounced below,
  17084. // so it could still be called even after uppy.removePlugin or uppy.close
  17085. // hence the check
  17086. if (!this.uppy.getPlugin(this.id)) return;
  17087. render(this.render(state), uppyRootElement);
  17088. this.afterUpdate();
  17089. });
  17090. this.uppy.log(`Installing ${callerPluginName} to a DOM element '${target}'`);
  17091. if (this.opts.replaceTargetContent) {
  17092. // Doing render(h(null), targetElement), which should have been
  17093. // a better way, since because the component might need to do additional cleanup when it is removed,
  17094. // stopped working — Preact just adds null into target, not replacing
  17095. targetElement.innerHTML = '';
  17096. }
  17097. render(this.render(this.uppy.getState()), uppyRootElement);
  17098. this.el = uppyRootElement.firstElementChild;
  17099. targetElement.appendChild(uppyRootElement);
  17100. this.onMount();
  17101. return this.el;
  17102. }
  17103. let targetPlugin;
  17104. if (typeof target === 'object' && target instanceof UIPlugin) {
  17105. // Targeting a plugin *instance*
  17106. targetPlugin = target;
  17107. } else if (typeof target === 'function') {
  17108. // Targeting a plugin type
  17109. const Target = target; // Find the target plugin instance.
  17110. this.uppy.iteratePlugins(p => {
  17111. if (p instanceof Target) {
  17112. targetPlugin = p;
  17113. return false;
  17114. }
  17115. });
  17116. }
  17117. if (targetPlugin) {
  17118. this.uppy.log(`Installing ${callerPluginName} to ${targetPlugin.id}`);
  17119. this.parent = targetPlugin;
  17120. this.el = targetPlugin.addTarget(plugin);
  17121. this.onMount();
  17122. return this.el;
  17123. }
  17124. this.uppy.log(`Not installing ${callerPluginName}`);
  17125. let message = `Invalid target option given to ${callerPluginName}.`;
  17126. if (typeof target === 'function') {
  17127. message += ' The given target is not a Plugin class. ' + 'Please check that you\'re not specifying a React Component instead of a plugin. ' + 'If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: ' + 'run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.';
  17128. } else {
  17129. message += 'If you meant to target an HTML element, please make sure that the element exists. ' + 'Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. ' + '(see https://github.com/transloadit/uppy/issues/1042)\n\n' + 'If you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.';
  17130. }
  17131. throw new Error(message);
  17132. }
  17133. update(state) {
  17134. if (this.el != null) {
  17135. var _classPrivateFieldLoo, _classPrivateFieldLoo2;
  17136. (_classPrivateFieldLoo = (_classPrivateFieldLoo2 = _classPrivateFieldLooseBase$5(this, _updateUI))[_updateUI]) == null ? void 0 : _classPrivateFieldLoo.call(_classPrivateFieldLoo2, state);
  17137. }
  17138. }
  17139. unmount() {
  17140. if (this.isTargetDOMEl) {
  17141. var _this$el;
  17142. (_this$el = this.el) == null ? void 0 : _this$el.remove();
  17143. }
  17144. this.onUnmount();
  17145. } // eslint-disable-next-line class-methods-use-this
  17146. onMount() {} // eslint-disable-next-line class-methods-use-this
  17147. onUnmount() {}
  17148. }
  17149. var UIPlugin_1$1 = UIPlugin;
  17150. const {
  17151. debugLogger
  17152. } = loggers;
  17153. var lib$2 = Uppy_1$1;
  17154. var Uppy_1 = Uppy_1$1;
  17155. var UIPlugin_1 = UIPlugin_1$1;
  17156. var BasePlugin_1 = BasePlugin_1$1;
  17157. var debugLogger_1 = debugLogger;
  17158. lib$2.Uppy = Uppy_1;
  17159. lib$2.UIPlugin = UIPlugin_1;
  17160. lib$2.BasePlugin = BasePlugin_1;
  17161. lib$2.debugLogger = debugLogger_1;
  17162. class NetworkError extends Error {
  17163. constructor(error, xhr) {
  17164. if (xhr === void 0) {
  17165. xhr = null;
  17166. }
  17167. super(`This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.`);
  17168. this.cause = error;
  17169. this.isNetworkError = true;
  17170. this.request = xhr;
  17171. }
  17172. }
  17173. var NetworkError_1 = NetworkError;
  17174. /**
  17175. * Wrapper around window.fetch that throws a NetworkError when appropriate
  17176. */
  17177. var fetchWithNetworkError = function fetchWithNetworkError() {
  17178. return fetch(...arguments).catch(err => {
  17179. if (err.name === 'AbortError') {
  17180. throw err;
  17181. } else {
  17182. throw new NetworkError_1(err);
  17183. }
  17184. });
  17185. };
  17186. class AuthError extends Error {
  17187. constructor() {
  17188. super('Authorization required');
  17189. this.name = 'AuthError';
  17190. this.isAuthError = true;
  17191. }
  17192. }
  17193. var AuthError_1 = AuthError;
  17194. var _class$1, _getPostResponseFunc, _getUrl, _errorHandler, _temp$1;
  17195. function _classPrivateFieldLooseBase$4(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
  17196. var id$4 = 0;
  17197. function _classPrivateFieldLooseKey$4(name) { return "__private_" + id$4++ + "_" + name; }
  17198. // Remove the trailing slash so we can always safely append /xyz.
  17199. function stripSlash(url) {
  17200. return url.replace(/\/$/, '');
  17201. }
  17202. async function handleJSONResponse(res) {
  17203. if (res.status === 401) {
  17204. throw new AuthError_1();
  17205. }
  17206. const jsonPromise = res.json();
  17207. if (res.status < 200 || res.status > 300) {
  17208. let errMsg = `Failed request with status: ${res.status}. ${res.statusText}`;
  17209. try {
  17210. const errData = await jsonPromise;
  17211. errMsg = errData.message ? `${errMsg} message: ${errData.message}` : errMsg;
  17212. errMsg = errData.requestId ? `${errMsg} request-Id: ${errData.requestId}` : errMsg;
  17213. } finally {
  17214. // eslint-disable-next-line no-unsafe-finally
  17215. throw new Error(errMsg);
  17216. }
  17217. }
  17218. return jsonPromise;
  17219. }
  17220. var RequestClient_1 = (_temp$1 = (_getPostResponseFunc = /*#__PURE__*/_classPrivateFieldLooseKey$4("getPostResponseFunc"), _getUrl = /*#__PURE__*/_classPrivateFieldLooseKey$4("getUrl"), _errorHandler = /*#__PURE__*/_classPrivateFieldLooseKey$4("errorHandler"), _class$1 = class RequestClient {
  17221. // eslint-disable-next-line global-require
  17222. constructor(uppy, opts) {
  17223. Object.defineProperty(this, _errorHandler, {
  17224. value: _errorHandler2
  17225. });
  17226. Object.defineProperty(this, _getUrl, {
  17227. value: _getUrl2
  17228. });
  17229. Object.defineProperty(this, _getPostResponseFunc, {
  17230. writable: true,
  17231. value: skip => response => skip ? response : this.onReceiveResponse(response)
  17232. });
  17233. this.uppy = uppy;
  17234. this.opts = opts;
  17235. this.onReceiveResponse = this.onReceiveResponse.bind(this);
  17236. this.allowedHeaders = ['accept', 'content-type', 'uppy-auth-token'];
  17237. this.preflightDone = false;
  17238. }
  17239. get hostname() {
  17240. const {
  17241. companion
  17242. } = this.uppy.getState();
  17243. const host = this.opts.companionUrl;
  17244. return stripSlash(companion && companion[host] ? companion[host] : host);
  17245. }
  17246. headers() {
  17247. const userHeaders = this.opts.companionHeaders || {};
  17248. return Promise.resolve({ ...RequestClient.defaultHeaders,
  17249. ...userHeaders
  17250. });
  17251. }
  17252. onReceiveResponse(response) {
  17253. const state = this.uppy.getState();
  17254. const companion = state.companion || {};
  17255. const host = this.opts.companionUrl;
  17256. const {
  17257. headers
  17258. } = response; // Store the self-identified domain name for the Companion instance we just hit.
  17259. if (headers.has('i-am') && headers.get('i-am') !== companion[host]) {
  17260. this.uppy.setState({
  17261. companion: { ...companion,
  17262. [host]: headers.get('i-am')
  17263. }
  17264. });
  17265. }
  17266. return response;
  17267. }
  17268. preflight(path) {
  17269. if (this.preflightDone) {
  17270. return Promise.resolve(this.allowedHeaders.slice());
  17271. }
  17272. return fetch(_classPrivateFieldLooseBase$4(this, _getUrl)[_getUrl](path), {
  17273. method: 'OPTIONS'
  17274. }).then(response => {
  17275. if (response.headers.has('access-control-allow-headers')) {
  17276. this.allowedHeaders = response.headers.get('access-control-allow-headers').split(',').map(headerName => headerName.trim().toLowerCase());
  17277. }
  17278. this.preflightDone = true;
  17279. return this.allowedHeaders.slice();
  17280. }).catch(err => {
  17281. this.uppy.log(`[CompanionClient] unable to make preflight request ${err}`, 'warning');
  17282. this.preflightDone = true;
  17283. return this.allowedHeaders.slice();
  17284. });
  17285. }
  17286. preflightAndHeaders(path) {
  17287. return Promise.all([this.preflight(path), this.headers()]).then(_ref => {
  17288. let [allowedHeaders, headers] = _ref;
  17289. // filter to keep only allowed Headers
  17290. Object.keys(headers).forEach(header => {
  17291. if (!allowedHeaders.includes(header.toLowerCase())) {
  17292. this.uppy.log(`[CompanionClient] excluding disallowed header ${header}`);
  17293. delete headers[header]; // eslint-disable-line no-param-reassign
  17294. }
  17295. });
  17296. return headers;
  17297. });
  17298. }
  17299. get(path, skipPostResponse) {
  17300. const method = 'get';
  17301. return this.preflightAndHeaders(path).then(headers => fetchWithNetworkError(_classPrivateFieldLooseBase$4(this, _getUrl)[_getUrl](path), {
  17302. method,
  17303. headers,
  17304. credentials: this.opts.companionCookiesRule || 'same-origin'
  17305. })).then(_classPrivateFieldLooseBase$4(this, _getPostResponseFunc)[_getPostResponseFunc](skipPostResponse)).then(handleJSONResponse).catch(_classPrivateFieldLooseBase$4(this, _errorHandler)[_errorHandler](method, path));
  17306. }
  17307. post(path, data, skipPostResponse) {
  17308. const method = 'post';
  17309. return this.preflightAndHeaders(path).then(headers => fetchWithNetworkError(_classPrivateFieldLooseBase$4(this, _getUrl)[_getUrl](path), {
  17310. method,
  17311. headers,
  17312. credentials: this.opts.companionCookiesRule || 'same-origin',
  17313. body: JSON.stringify(data)
  17314. })).then(_classPrivateFieldLooseBase$4(this, _getPostResponseFunc)[_getPostResponseFunc](skipPostResponse)).then(handleJSONResponse).catch(_classPrivateFieldLooseBase$4(this, _errorHandler)[_errorHandler](method, path));
  17315. }
  17316. delete(path, data, skipPostResponse) {
  17317. const method = 'delete';
  17318. return this.preflightAndHeaders(path).then(headers => fetchWithNetworkError(`${this.hostname}/${path}`, {
  17319. method,
  17320. headers,
  17321. credentials: this.opts.companionCookiesRule || 'same-origin',
  17322. body: data ? JSON.stringify(data) : null
  17323. })).then(_classPrivateFieldLooseBase$4(this, _getPostResponseFunc)[_getPostResponseFunc](skipPostResponse)).then(handleJSONResponse).catch(_classPrivateFieldLooseBase$4(this, _errorHandler)[_errorHandler](method, path));
  17324. }
  17325. }), _class$1.VERSION = "2.0.4", _class$1.defaultHeaders = {
  17326. Accept: 'application/json',
  17327. 'Content-Type': 'application/json',
  17328. 'Uppy-Versions': `@uppy/companion-client=${_class$1.VERSION}`
  17329. }, _temp$1);
  17330. function _getUrl2(url) {
  17331. if (/^(https?:|)\/\//.test(url)) {
  17332. return url;
  17333. }
  17334. return `${this.hostname}/${url}`;
  17335. }
  17336. function _errorHandler2(method, path) {
  17337. return err => {
  17338. var _err;
  17339. if (!((_err = err) != null && _err.isAuthError)) {
  17340. const error = new Error(`Could not ${method} ${_classPrivateFieldLooseBase$4(this, _getUrl)[_getUrl](path)}`);
  17341. error.cause = err;
  17342. err = error; // eslint-disable-line no-param-reassign
  17343. }
  17344. return Promise.reject(err);
  17345. };
  17346. }
  17347. /**
  17348. * This module serves as an Async wrapper for LocalStorage
  17349. */
  17350. var setItem = (key, value) => {
  17351. return new Promise(resolve => {
  17352. localStorage.setItem(key, value);
  17353. resolve();
  17354. });
  17355. };
  17356. var getItem = key => {
  17357. return Promise.resolve(localStorage.getItem(key));
  17358. };
  17359. var removeItem = key => {
  17360. return new Promise(resolve => {
  17361. localStorage.removeItem(key);
  17362. resolve();
  17363. });
  17364. };
  17365. var tokenStorage = {
  17366. setItem: setItem,
  17367. getItem: getItem,
  17368. removeItem: removeItem
  17369. };
  17370. const getName$1 = id => {
  17371. return id.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');
  17372. };
  17373. var Provider_1 = class Provider extends RequestClient_1 {
  17374. constructor(uppy, opts) {
  17375. super(uppy, opts);
  17376. this.provider = opts.provider;
  17377. this.id = this.provider;
  17378. this.name = this.opts.name || getName$1(this.id);
  17379. this.pluginId = this.opts.pluginId;
  17380. this.tokenKey = `companion-${this.pluginId}-auth-token`;
  17381. this.companionKeysParams = this.opts.companionKeysParams;
  17382. this.preAuthToken = null;
  17383. }
  17384. headers() {
  17385. return Promise.all([super.headers(), this.getAuthToken()]).then(_ref => {
  17386. let [headers, token] = _ref;
  17387. const authHeaders = {};
  17388. if (token) {
  17389. authHeaders['uppy-auth-token'] = token;
  17390. }
  17391. if (this.companionKeysParams) {
  17392. authHeaders['uppy-credentials-params'] = btoa(JSON.stringify({
  17393. params: this.companionKeysParams
  17394. }));
  17395. }
  17396. return { ...headers,
  17397. ...authHeaders
  17398. };
  17399. });
  17400. }
  17401. onReceiveResponse(response) {
  17402. response = super.onReceiveResponse(response);
  17403. const plugin = this.uppy.getPlugin(this.pluginId);
  17404. const oldAuthenticated = plugin.getPluginState().authenticated;
  17405. const authenticated = oldAuthenticated ? response.status !== 401 : response.status < 400;
  17406. plugin.setPluginState({
  17407. authenticated
  17408. });
  17409. return response;
  17410. }
  17411. setAuthToken(token) {
  17412. return this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey, token);
  17413. }
  17414. getAuthToken() {
  17415. return this.uppy.getPlugin(this.pluginId).storage.getItem(this.tokenKey);
  17416. }
  17417. authUrl(queries) {
  17418. if (queries === void 0) {
  17419. queries = {};
  17420. }
  17421. if (this.preAuthToken) {
  17422. queries.uppyPreAuthToken = this.preAuthToken;
  17423. }
  17424. return `${this.hostname}/${this.id}/connect?${new URLSearchParams(queries)}`;
  17425. }
  17426. fileUrl(id) {
  17427. return `${this.hostname}/${this.id}/get/${id}`;
  17428. }
  17429. fetchPreAuthToken() {
  17430. if (!this.companionKeysParams) {
  17431. return Promise.resolve();
  17432. }
  17433. return this.post(`${this.id}/preauth/`, {
  17434. params: this.companionKeysParams
  17435. }).then(res => {
  17436. this.preAuthToken = res.token;
  17437. }).catch(err => {
  17438. this.uppy.log(`[CompanionClient] unable to fetch preAuthToken ${err}`, 'warning');
  17439. });
  17440. }
  17441. list(directory) {
  17442. return this.get(`${this.id}/list/${directory || ''}`);
  17443. }
  17444. logout() {
  17445. return this.get(`${this.id}/logout`).then(response => Promise.all([response, this.uppy.getPlugin(this.pluginId).storage.removeItem(this.tokenKey)])).then(_ref2 => {
  17446. let [response] = _ref2;
  17447. return response;
  17448. });
  17449. }
  17450. static initPlugin(plugin, opts, defaultOpts) {
  17451. plugin.type = 'acquirer';
  17452. plugin.files = [];
  17453. if (defaultOpts) {
  17454. plugin.opts = { ...defaultOpts,
  17455. ...opts
  17456. };
  17457. }
  17458. if (opts.serverUrl || opts.serverPattern) {
  17459. throw new Error('`serverUrl` and `serverPattern` have been renamed to `companionUrl` and `companionAllowedHosts` respectively in the 0.30.5 release. Please consult the docs (for example, https://uppy.io/docs/instagram/ for the Instagram plugin) and use the updated options.`');
  17460. }
  17461. if (opts.companionAllowedHosts) {
  17462. const pattern = opts.companionAllowedHosts; // validate companionAllowedHosts param
  17463. if (typeof pattern !== 'string' && !Array.isArray(pattern) && !(pattern instanceof RegExp)) {
  17464. throw new TypeError(`${plugin.id}: the option "companionAllowedHosts" must be one of string, Array, RegExp`);
  17465. }
  17466. plugin.opts.companionAllowedHosts = pattern;
  17467. } else if (/^(?!https?:\/\/).*$/i.test(opts.companionUrl)) {
  17468. // does not start with https://
  17469. plugin.opts.companionAllowedHosts = `https://${opts.companionUrl.replace(/^\/\//, '')}`;
  17470. } else {
  17471. plugin.opts.companionAllowedHosts = new URL(opts.companionUrl).origin;
  17472. }
  17473. plugin.storage = plugin.opts.storage || tokenStorage;
  17474. }
  17475. };
  17476. const getName = id => {
  17477. return id.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');
  17478. };
  17479. var SearchProvider_1 = class SearchProvider extends RequestClient_1 {
  17480. constructor(uppy, opts) {
  17481. super(uppy, opts);
  17482. this.provider = opts.provider;
  17483. this.id = this.provider;
  17484. this.name = this.opts.name || getName(this.id);
  17485. this.pluginId = this.opts.pluginId;
  17486. }
  17487. fileUrl(id) {
  17488. return `${this.hostname}/search/${this.id}/get/${id}`;
  17489. }
  17490. search(text, queries) {
  17491. queries = queries ? `&${queries}` : '';
  17492. return this.get(`search/${this.id}/list?q=${encodeURIComponent(text)}${queries}`);
  17493. }
  17494. };
  17495. var _queued, _emitter$1, _isOpen, _socket, _handleMessage;
  17496. let _Symbol$for, _Symbol$for2;
  17497. function _classPrivateFieldLooseBase$3(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
  17498. var id$3 = 0;
  17499. function _classPrivateFieldLooseKey$3(name) { return "__private_" + id$3++ + "_" + name; }
  17500. var Socket$1 = (_queued = /*#__PURE__*/_classPrivateFieldLooseKey$3("queued"), _emitter$1 = /*#__PURE__*/_classPrivateFieldLooseKey$3("emitter"), _isOpen = /*#__PURE__*/_classPrivateFieldLooseKey$3("isOpen"), _socket = /*#__PURE__*/_classPrivateFieldLooseKey$3("socket"), _handleMessage = /*#__PURE__*/_classPrivateFieldLooseKey$3("handleMessage"), _Symbol$for = Symbol.for('uppy test: getSocket'), _Symbol$for2 = Symbol.for('uppy test: getQueued'), class UppySocket {
  17501. constructor(opts) {
  17502. Object.defineProperty(this, _queued, {
  17503. writable: true,
  17504. value: []
  17505. });
  17506. Object.defineProperty(this, _emitter$1, {
  17507. writable: true,
  17508. value: namespaceEmitter()
  17509. });
  17510. Object.defineProperty(this, _isOpen, {
  17511. writable: true,
  17512. value: false
  17513. });
  17514. Object.defineProperty(this, _socket, {
  17515. writable: true,
  17516. value: void 0
  17517. });
  17518. Object.defineProperty(this, _handleMessage, {
  17519. writable: true,
  17520. value: e => {
  17521. try {
  17522. const message = JSON.parse(e.data);
  17523. this.emit(message.action, message.payload);
  17524. } catch (err) {
  17525. // TODO: use a more robust error handler.
  17526. console.log(err); // eslint-disable-line no-console
  17527. }
  17528. }
  17529. });
  17530. this.opts = opts;
  17531. if (!opts || opts.autoOpen !== false) {
  17532. this.open();
  17533. }
  17534. }
  17535. get isOpen() {
  17536. return _classPrivateFieldLooseBase$3(this, _isOpen)[_isOpen];
  17537. }
  17538. [_Symbol$for]() {
  17539. return _classPrivateFieldLooseBase$3(this, _socket)[_socket];
  17540. }
  17541. [_Symbol$for2]() {
  17542. return _classPrivateFieldLooseBase$3(this, _queued)[_queued];
  17543. }
  17544. open() {
  17545. _classPrivateFieldLooseBase$3(this, _socket)[_socket] = new WebSocket(this.opts.target);
  17546. _classPrivateFieldLooseBase$3(this, _socket)[_socket].onopen = () => {
  17547. _classPrivateFieldLooseBase$3(this, _isOpen)[_isOpen] = true;
  17548. while (_classPrivateFieldLooseBase$3(this, _queued)[_queued].length > 0 && _classPrivateFieldLooseBase$3(this, _isOpen)[_isOpen]) {
  17549. const first = _classPrivateFieldLooseBase$3(this, _queued)[_queued].shift();
  17550. this.send(first.action, first.payload);
  17551. }
  17552. };
  17553. _classPrivateFieldLooseBase$3(this, _socket)[_socket].onclose = () => {
  17554. _classPrivateFieldLooseBase$3(this, _isOpen)[_isOpen] = false;
  17555. };
  17556. _classPrivateFieldLooseBase$3(this, _socket)[_socket].onmessage = _classPrivateFieldLooseBase$3(this, _handleMessage)[_handleMessage];
  17557. }
  17558. close() {
  17559. var _classPrivateFieldLoo;
  17560. (_classPrivateFieldLoo = _classPrivateFieldLooseBase$3(this, _socket)[_socket]) == null ? void 0 : _classPrivateFieldLoo.close();
  17561. }
  17562. send(action, payload) {
  17563. // attach uuid
  17564. if (!_classPrivateFieldLooseBase$3(this, _isOpen)[_isOpen]) {
  17565. _classPrivateFieldLooseBase$3(this, _queued)[_queued].push({
  17566. action,
  17567. payload
  17568. });
  17569. return;
  17570. }
  17571. _classPrivateFieldLooseBase$3(this, _socket)[_socket].send(JSON.stringify({
  17572. action,
  17573. payload
  17574. }));
  17575. }
  17576. on(action, handler) {
  17577. _classPrivateFieldLooseBase$3(this, _emitter$1)[_emitter$1].on(action, handler);
  17578. }
  17579. emit(action, payload) {
  17580. _classPrivateFieldLooseBase$3(this, _emitter$1)[_emitter$1].emit(action, payload);
  17581. }
  17582. once(action, handler) {
  17583. _classPrivateFieldLooseBase$3(this, _emitter$1)[_emitter$1].once(action, handler);
  17584. }
  17585. });
  17586. /**
  17587. * Manages communications with Companion
  17588. */
  17589. var lib$1 = {
  17590. RequestClient: RequestClient_1,
  17591. Provider: Provider_1,
  17592. SearchProvider: SearchProvider_1,
  17593. Socket: Socket$1
  17594. };
  17595. function emitSocketProgress(uploader, progressData, file) {
  17596. const {
  17597. progress,
  17598. bytesUploaded,
  17599. bytesTotal
  17600. } = progressData;
  17601. if (progress) {
  17602. uploader.uppy.log(`Upload progress: ${progress}`);
  17603. uploader.uppy.emit('upload-progress', file, {
  17604. uploader,
  17605. bytesUploaded,
  17606. bytesTotal
  17607. });
  17608. }
  17609. }
  17610. var emitSocketProgress_1 = lodash_throttle(emitSocketProgress, 300, {
  17611. leading: true,
  17612. trailing: true
  17613. });
  17614. var getSocketHost = function getSocketHost(url) {
  17615. // get the host domain
  17616. const regex = /^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i;
  17617. const host = regex.exec(url)[1];
  17618. const socketProtocol = /^http:\/\//i.test(url) ? 'ws' : 'wss';
  17619. return `${socketProtocol}://${host}`;
  17620. };
  17621. var settle = function settle(promises) {
  17622. const resolutions = [];
  17623. const rejections = [];
  17624. function resolved(value) {
  17625. resolutions.push(value);
  17626. }
  17627. function rejected(error) {
  17628. rejections.push(error);
  17629. }
  17630. const wait = Promise.all(promises.map(promise => promise.then(resolved, rejected)));
  17631. return wait.then(() => {
  17632. return {
  17633. successful: resolutions,
  17634. failed: rejections
  17635. };
  17636. });
  17637. };
  17638. var _emitter, _events;
  17639. function _classPrivateFieldLooseBase$2(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
  17640. var id$2 = 0;
  17641. function _classPrivateFieldLooseKey$2(name) { return "__private_" + id$2++ + "_" + name; }
  17642. /**
  17643. * Create a wrapper around an event emitter with a `remove` method to remove
  17644. * all events that were added using the wrapped emitter.
  17645. */
  17646. var EventTracker_1 = (_emitter = /*#__PURE__*/_classPrivateFieldLooseKey$2("emitter"), _events = /*#__PURE__*/_classPrivateFieldLooseKey$2("events"), class EventTracker {
  17647. constructor(emitter) {
  17648. Object.defineProperty(this, _emitter, {
  17649. writable: true,
  17650. value: void 0
  17651. });
  17652. Object.defineProperty(this, _events, {
  17653. writable: true,
  17654. value: []
  17655. });
  17656. _classPrivateFieldLooseBase$2(this, _emitter)[_emitter] = emitter;
  17657. }
  17658. on(event, fn) {
  17659. _classPrivateFieldLooseBase$2(this, _events)[_events].push([event, fn]);
  17660. return _classPrivateFieldLooseBase$2(this, _emitter)[_emitter].on(event, fn);
  17661. }
  17662. remove() {
  17663. for (const [event, fn] of _classPrivateFieldLooseBase$2(this, _events)[_events].splice(0)) {
  17664. _classPrivateFieldLooseBase$2(this, _emitter)[_emitter].off(event, fn);
  17665. }
  17666. }
  17667. });
  17668. function _classPrivateFieldLooseBase$1(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
  17669. var id$1 = 0;
  17670. function _classPrivateFieldLooseKey$1(name) { return "__private_" + id$1++ + "_" + name; }
  17671. var _aliveTimer = /*#__PURE__*/_classPrivateFieldLooseKey$1("aliveTimer");
  17672. var _isDone = /*#__PURE__*/_classPrivateFieldLooseKey$1("isDone");
  17673. var _onTimedOut = /*#__PURE__*/_classPrivateFieldLooseKey$1("onTimedOut");
  17674. var _timeout = /*#__PURE__*/_classPrivateFieldLooseKey$1("timeout");
  17675. /**
  17676. * Helper to abort upload requests if there has not been any progress for `timeout` ms.
  17677. * Create an instance using `timer = new ProgressTimeout(10000, onTimeout)`
  17678. * Call `timer.progress()` to signal that there has been progress of any kind.
  17679. * Call `timer.done()` when the upload has completed.
  17680. */
  17681. class ProgressTimeout {
  17682. constructor(timeout, timeoutHandler) {
  17683. Object.defineProperty(this, _aliveTimer, {
  17684. writable: true,
  17685. value: void 0
  17686. });
  17687. Object.defineProperty(this, _isDone, {
  17688. writable: true,
  17689. value: false
  17690. });
  17691. Object.defineProperty(this, _onTimedOut, {
  17692. writable: true,
  17693. value: void 0
  17694. });
  17695. Object.defineProperty(this, _timeout, {
  17696. writable: true,
  17697. value: void 0
  17698. });
  17699. _classPrivateFieldLooseBase$1(this, _timeout)[_timeout] = timeout;
  17700. _classPrivateFieldLooseBase$1(this, _onTimedOut)[_onTimedOut] = timeoutHandler;
  17701. }
  17702. progress() {
  17703. // Some browsers fire another progress event when the upload is
  17704. // cancelled, so we have to ignore progress after the timer was
  17705. // told to stop.
  17706. if (_classPrivateFieldLooseBase$1(this, _isDone)[_isDone]) return;
  17707. if (_classPrivateFieldLooseBase$1(this, _timeout)[_timeout] > 0) {
  17708. clearTimeout(_classPrivateFieldLooseBase$1(this, _aliveTimer)[_aliveTimer]);
  17709. _classPrivateFieldLooseBase$1(this, _aliveTimer)[_aliveTimer] = setTimeout(_classPrivateFieldLooseBase$1(this, _onTimedOut)[_onTimedOut], _classPrivateFieldLooseBase$1(this, _timeout)[_timeout]);
  17710. }
  17711. }
  17712. done() {
  17713. if (!_classPrivateFieldLooseBase$1(this, _isDone)[_isDone]) {
  17714. clearTimeout(_classPrivateFieldLooseBase$1(this, _aliveTimer)[_aliveTimer]);
  17715. _classPrivateFieldLooseBase$1(this, _aliveTimer)[_aliveTimer] = null;
  17716. _classPrivateFieldLooseBase$1(this, _isDone)[_isDone] = true;
  17717. }
  17718. }
  17719. }
  17720. var ProgressTimeout_1 = ProgressTimeout;
  17721. function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
  17722. var id = 0;
  17723. function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }
  17724. function createCancelError() {
  17725. return new Error('Cancelled');
  17726. }
  17727. var _activeRequests = /*#__PURE__*/_classPrivateFieldLooseKey("activeRequests");
  17728. var _queuedHandlers = /*#__PURE__*/_classPrivateFieldLooseKey("queuedHandlers");
  17729. var _call = /*#__PURE__*/_classPrivateFieldLooseKey("call");
  17730. var _queueNext = /*#__PURE__*/_classPrivateFieldLooseKey("queueNext");
  17731. var _next = /*#__PURE__*/_classPrivateFieldLooseKey("next");
  17732. var _queue = /*#__PURE__*/_classPrivateFieldLooseKey("queue");
  17733. var _dequeue = /*#__PURE__*/_classPrivateFieldLooseKey("dequeue");
  17734. class RateLimitedQueue$1 {
  17735. constructor(limit) {
  17736. Object.defineProperty(this, _dequeue, {
  17737. value: _dequeue2
  17738. });
  17739. Object.defineProperty(this, _queue, {
  17740. value: _queue2
  17741. });
  17742. Object.defineProperty(this, _next, {
  17743. value: _next2
  17744. });
  17745. Object.defineProperty(this, _queueNext, {
  17746. value: _queueNext2
  17747. });
  17748. Object.defineProperty(this, _call, {
  17749. value: _call2
  17750. });
  17751. Object.defineProperty(this, _activeRequests, {
  17752. writable: true,
  17753. value: 0
  17754. });
  17755. Object.defineProperty(this, _queuedHandlers, {
  17756. writable: true,
  17757. value: []
  17758. });
  17759. if (typeof limit !== 'number' || limit === 0) {
  17760. this.limit = Infinity;
  17761. } else {
  17762. this.limit = limit;
  17763. }
  17764. }
  17765. run(fn, queueOptions) {
  17766. if (_classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] < this.limit) {
  17767. return _classPrivateFieldLooseBase(this, _call)[_call](fn);
  17768. }
  17769. return _classPrivateFieldLooseBase(this, _queue)[_queue](fn, queueOptions);
  17770. }
  17771. wrapPromiseFunction(fn, queueOptions) {
  17772. var _this = this;
  17773. return function () {
  17774. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  17775. args[_key] = arguments[_key];
  17776. }
  17777. let queuedRequest;
  17778. const outerPromise = new Promise((resolve, reject) => {
  17779. queuedRequest = _this.run(() => {
  17780. let cancelError;
  17781. let innerPromise;
  17782. try {
  17783. innerPromise = Promise.resolve(fn(...args));
  17784. } catch (err) {
  17785. innerPromise = Promise.reject(err);
  17786. }
  17787. innerPromise.then(result => {
  17788. if (cancelError) {
  17789. reject(cancelError);
  17790. } else {
  17791. queuedRequest.done();
  17792. resolve(result);
  17793. }
  17794. }, err => {
  17795. if (cancelError) {
  17796. reject(cancelError);
  17797. } else {
  17798. queuedRequest.done();
  17799. reject(err);
  17800. }
  17801. });
  17802. return () => {
  17803. cancelError = createCancelError();
  17804. };
  17805. }, queueOptions);
  17806. });
  17807. outerPromise.abort = () => {
  17808. queuedRequest.abort();
  17809. };
  17810. return outerPromise;
  17811. };
  17812. }
  17813. }
  17814. function _call2(fn) {
  17815. _classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] += 1;
  17816. let done = false;
  17817. let cancelActive;
  17818. try {
  17819. cancelActive = fn();
  17820. } catch (err) {
  17821. _classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] -= 1;
  17822. throw err;
  17823. }
  17824. return {
  17825. abort: () => {
  17826. if (done) return;
  17827. done = true;
  17828. _classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] -= 1;
  17829. cancelActive();
  17830. _classPrivateFieldLooseBase(this, _queueNext)[_queueNext]();
  17831. },
  17832. done: () => {
  17833. if (done) return;
  17834. done = true;
  17835. _classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] -= 1;
  17836. _classPrivateFieldLooseBase(this, _queueNext)[_queueNext]();
  17837. }
  17838. };
  17839. }
  17840. function _queueNext2() {
  17841. // Do it soon but not immediately, this allows clearing out the entire queue synchronously
  17842. // one by one without continuously _advancing_ it (and starting new tasks before immediately
  17843. // aborting them)
  17844. queueMicrotask(() => _classPrivateFieldLooseBase(this, _next)[_next]());
  17845. }
  17846. function _next2() {
  17847. if (_classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] >= this.limit) {
  17848. return;
  17849. }
  17850. if (_classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].length === 0) {
  17851. return;
  17852. } // Dispatch the next request, and update the abort/done handlers
  17853. // so that cancelling it does the Right Thing (and doesn't just try
  17854. // to dequeue an already-running request).
  17855. const next = _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].shift();
  17856. const handler = _classPrivateFieldLooseBase(this, _call)[_call](next.fn);
  17857. next.abort = handler.abort;
  17858. next.done = handler.done;
  17859. }
  17860. function _queue2(fn, options) {
  17861. if (options === void 0) {
  17862. options = {};
  17863. }
  17864. const handler = {
  17865. fn,
  17866. priority: options.priority || 0,
  17867. abort: () => {
  17868. _classPrivateFieldLooseBase(this, _dequeue)[_dequeue](handler);
  17869. },
  17870. done: () => {
  17871. throw new Error('Cannot mark a queued request as done: this indicates a bug');
  17872. }
  17873. };
  17874. const index = _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].findIndex(other => {
  17875. return handler.priority > other.priority;
  17876. });
  17877. if (index === -1) {
  17878. _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].push(handler);
  17879. } else {
  17880. _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].splice(index, 0, handler);
  17881. }
  17882. return handler;
  17883. }
  17884. function _dequeue2(handler) {
  17885. const index = _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].indexOf(handler);
  17886. if (index !== -1) {
  17887. _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].splice(index, 1);
  17888. }
  17889. }
  17890. var RateLimitedQueue_1 = {
  17891. RateLimitedQueue: RateLimitedQueue$1,
  17892. internalRateLimitedQueue: Symbol('__queue')
  17893. };
  17894. function isNetworkError(xhr) {
  17895. if (!xhr) {
  17896. return false;
  17897. }
  17898. return xhr.readyState !== 0 && xhr.readyState !== 4 || xhr.status === 0;
  17899. }
  17900. var isNetworkError_1 = isNetworkError;
  17901. var locale = {
  17902. strings: {
  17903. // Shown in the Informer if an upload is being canceled because it stalled for too long.
  17904. timedOut: 'Upload stalled for %{seconds} seconds, aborting.'
  17905. }
  17906. };
  17907. var _class, _temp;
  17908. const {
  17909. nanoid
  17910. } = require$$4;
  17911. const {
  17912. Provider,
  17913. RequestClient,
  17914. Socket
  17915. } = lib$1;
  17916. const {
  17917. RateLimitedQueue,
  17918. internalRateLimitedQueue
  17919. } = RateLimitedQueue_1;
  17920. function buildResponseError(xhr, err) {
  17921. let error = err; // No error message
  17922. if (!error) error = new Error('Upload error'); // Got an error message string
  17923. if (typeof error === 'string') error = new Error(error); // Got something else
  17924. if (!(error instanceof Error)) {
  17925. error = Object.assign(new Error('Upload error'), {
  17926. data: error
  17927. });
  17928. }
  17929. if (isNetworkError_1(xhr)) {
  17930. error = new NetworkError_1(error, xhr);
  17931. return error;
  17932. }
  17933. error.request = xhr;
  17934. return error;
  17935. }
  17936. /**
  17937. * Set `data.type` in the blob to `file.meta.type`,
  17938. * because we might have detected a more accurate file type in Uppy
  17939. * https://stackoverflow.com/a/50875615
  17940. *
  17941. * @param {object} file File object with `data`, `size` and `meta` properties
  17942. * @returns {object} blob updated with the new `type` set from `file.meta.type`
  17943. */
  17944. function setTypeInBlob(file) {
  17945. const dataWithUpdatedType = file.data.slice(0, file.data.size, file.meta.type);
  17946. return dataWithUpdatedType;
  17947. }
  17948. var lib = (_temp = _class = class XHRUpload extends BasePlugin_1$1 {
  17949. // eslint-disable-next-line global-require
  17950. constructor(uppy, opts) {
  17951. super(uppy, opts);
  17952. this.type = 'uploader';
  17953. this.id = this.opts.id || 'XHRUpload';
  17954. this.title = 'XHRUpload';
  17955. this.defaultLocale = locale; // Default options
  17956. const defaultOptions = {
  17957. formData: true,
  17958. fieldName: opts.bundle ? 'files[]' : 'file',
  17959. method: 'post',
  17960. metaFields: null,
  17961. responseUrlFieldName: 'url',
  17962. bundle: false,
  17963. headers: {},
  17964. timeout: 30 * 1000,
  17965. limit: 5,
  17966. withCredentials: false,
  17967. responseType: '',
  17968. /**
  17969. * @typedef respObj
  17970. * @property {string} responseText
  17971. * @property {number} status
  17972. * @property {string} statusText
  17973. * @property {object.<string, string>} headers
  17974. *
  17975. * @param {string} responseText the response body string
  17976. * @param {XMLHttpRequest | respObj} response the response object (XHR or similar)
  17977. */
  17978. getResponseData(responseText) {
  17979. let parsedResponse = {};
  17980. try {
  17981. parsedResponse = JSON.parse(responseText);
  17982. } catch (err) {
  17983. uppy.log(err);
  17984. }
  17985. return parsedResponse;
  17986. },
  17987. /**
  17988. *
  17989. * @param {string} responseText the response body string
  17990. * @param {XMLHttpRequest | respObj} response the response object (XHR or similar)
  17991. */
  17992. getResponseError(_, response) {
  17993. let error = new Error('Upload error');
  17994. if (isNetworkError_1(response)) {
  17995. error = new NetworkError_1(error, response);
  17996. }
  17997. return error;
  17998. },
  17999. /**
  18000. * Check if the response from the upload endpoint indicates that the upload was successful.
  18001. *
  18002. * @param {number} status the response status code
  18003. */
  18004. validateStatus(status) {
  18005. return status >= 200 && status < 300;
  18006. }
  18007. };
  18008. this.opts = { ...defaultOptions,
  18009. ...opts
  18010. };
  18011. this.i18nInit();
  18012. this.handleUpload = this.handleUpload.bind(this); // Simultaneous upload limiting is shared across all uploads with this plugin.
  18013. if (internalRateLimitedQueue in this.opts) {
  18014. this.requests = this.opts[internalRateLimitedQueue];
  18015. } else {
  18016. this.requests = new RateLimitedQueue(this.opts.limit);
  18017. }
  18018. if (this.opts.bundle && !this.opts.formData) {
  18019. throw new Error('`opts.formData` must be true when `opts.bundle` is enabled.');
  18020. }
  18021. this.uploaderEvents = Object.create(null);
  18022. }
  18023. getOptions(file) {
  18024. const overrides = this.uppy.getState().xhrUpload;
  18025. const {
  18026. headers
  18027. } = this.opts;
  18028. const opts = { ...this.opts,
  18029. ...(overrides || {}),
  18030. ...(file.xhrUpload || {}),
  18031. headers: {}
  18032. }; // Support for `headers` as a function, only in the XHRUpload settings.
  18033. // Options set by other plugins in Uppy state or on the files themselves are still merged in afterward.
  18034. //
  18035. // ```js
  18036. // headers: (file) => ({ expires: file.meta.expires })
  18037. // ```
  18038. if (typeof headers === 'function') {
  18039. opts.headers = headers(file);
  18040. } else {
  18041. Object.assign(opts.headers, this.opts.headers);
  18042. }
  18043. if (overrides) {
  18044. Object.assign(opts.headers, overrides.headers);
  18045. }
  18046. if (file.xhrUpload) {
  18047. Object.assign(opts.headers, file.xhrUpload.headers);
  18048. }
  18049. return opts;
  18050. } // eslint-disable-next-line class-methods-use-this
  18051. addMetadata(formData, meta, opts) {
  18052. const metaFields = Array.isArray(opts.metaFields) ? opts.metaFields : Object.keys(meta); // Send along all fields by default.
  18053. metaFields.forEach(item => {
  18054. formData.append(item, meta[item]);
  18055. });
  18056. }
  18057. createFormDataUpload(file, opts) {
  18058. const formPost = new FormData();
  18059. this.addMetadata(formPost, file.meta, opts);
  18060. const dataWithUpdatedType = setTypeInBlob(file);
  18061. if (file.name) {
  18062. formPost.append(opts.fieldName, dataWithUpdatedType, file.meta.name);
  18063. } else {
  18064. formPost.append(opts.fieldName, dataWithUpdatedType);
  18065. }
  18066. return formPost;
  18067. }
  18068. createBundledUpload(files, opts) {
  18069. const formPost = new FormData();
  18070. const {
  18071. meta
  18072. } = this.uppy.getState();
  18073. this.addMetadata(formPost, meta, opts);
  18074. files.forEach(file => {
  18075. const options = this.getOptions(file);
  18076. const dataWithUpdatedType = setTypeInBlob(file);
  18077. if (file.name) {
  18078. formPost.append(options.fieldName, dataWithUpdatedType, file.name);
  18079. } else {
  18080. formPost.append(options.fieldName, dataWithUpdatedType);
  18081. }
  18082. });
  18083. return formPost;
  18084. }
  18085. upload(file, current, total) {
  18086. const opts = this.getOptions(file);
  18087. this.uppy.log(`uploading ${current} of ${total}`);
  18088. return new Promise((resolve, reject) => {
  18089. this.uppy.emit('upload-started', file);
  18090. const data = opts.formData ? this.createFormDataUpload(file, opts) : file.data;
  18091. const xhr = new XMLHttpRequest();
  18092. this.uploaderEvents[file.id] = new EventTracker_1(this.uppy);
  18093. const timer = new ProgressTimeout_1(opts.timeout, () => {
  18094. xhr.abort();
  18095. queuedRequest.done();
  18096. const error = new Error(this.i18n('timedOut', {
  18097. seconds: Math.ceil(opts.timeout / 1000)
  18098. }));
  18099. this.uppy.emit('upload-error', file, error);
  18100. reject(error);
  18101. });
  18102. const id = nanoid();
  18103. xhr.upload.addEventListener('loadstart', () => {
  18104. this.uppy.log(`[XHRUpload] ${id} started`);
  18105. });
  18106. xhr.upload.addEventListener('progress', ev => {
  18107. this.uppy.log(`[XHRUpload] ${id} progress: ${ev.loaded} / ${ev.total}`); // Begin checking for timeouts when progress starts, instead of loading,
  18108. // to avoid timing out requests on browser concurrency queue
  18109. timer.progress();
  18110. if (ev.lengthComputable) {
  18111. this.uppy.emit('upload-progress', file, {
  18112. uploader: this,
  18113. bytesUploaded: ev.loaded,
  18114. bytesTotal: ev.total
  18115. });
  18116. }
  18117. });
  18118. xhr.addEventListener('load', ev => {
  18119. this.uppy.log(`[XHRUpload] ${id} finished`);
  18120. timer.done();
  18121. queuedRequest.done();
  18122. if (this.uploaderEvents[file.id]) {
  18123. this.uploaderEvents[file.id].remove();
  18124. this.uploaderEvents[file.id] = null;
  18125. }
  18126. if (opts.validateStatus(ev.target.status, xhr.responseText, xhr)) {
  18127. const body = opts.getResponseData(xhr.responseText, xhr);
  18128. const uploadURL = body[opts.responseUrlFieldName];
  18129. const uploadResp = {
  18130. status: ev.target.status,
  18131. body,
  18132. uploadURL
  18133. };
  18134. this.uppy.emit('upload-success', file, uploadResp);
  18135. if (uploadURL) {
  18136. this.uppy.log(`Download ${file.name} from ${uploadURL}`);
  18137. }
  18138. return resolve(file);
  18139. }
  18140. const body = opts.getResponseData(xhr.responseText, xhr);
  18141. const error = buildResponseError(xhr, opts.getResponseError(xhr.responseText, xhr));
  18142. const response = {
  18143. status: ev.target.status,
  18144. body
  18145. };
  18146. this.uppy.emit('upload-error', file, error, response);
  18147. return reject(error);
  18148. });
  18149. xhr.addEventListener('error', () => {
  18150. this.uppy.log(`[XHRUpload] ${id} errored`);
  18151. timer.done();
  18152. queuedRequest.done();
  18153. if (this.uploaderEvents[file.id]) {
  18154. this.uploaderEvents[file.id].remove();
  18155. this.uploaderEvents[file.id] = null;
  18156. }
  18157. const error = buildResponseError(xhr, opts.getResponseError(xhr.responseText, xhr));
  18158. this.uppy.emit('upload-error', file, error);
  18159. return reject(error);
  18160. });
  18161. xhr.open(opts.method.toUpperCase(), opts.endpoint, true); // IE10 does not allow setting `withCredentials` and `responseType`
  18162. // before `open()` is called.
  18163. xhr.withCredentials = opts.withCredentials;
  18164. if (opts.responseType !== '') {
  18165. xhr.responseType = opts.responseType;
  18166. }
  18167. const queuedRequest = this.requests.run(() => {
  18168. this.uppy.emit('upload-started', file); // When using an authentication system like JWT, the bearer token goes as a header. This
  18169. // header needs to be fresh each time the token is refreshed so computing and setting the
  18170. // headers just before the upload starts enables this kind of authentication to work properly.
  18171. // Otherwise, half-way through the list of uploads the token could be stale and the upload would fail.
  18172. const currentOpts = this.getOptions(file);
  18173. Object.keys(currentOpts.headers).forEach(header => {
  18174. xhr.setRequestHeader(header, currentOpts.headers[header]);
  18175. });
  18176. xhr.send(data);
  18177. return () => {
  18178. timer.done();
  18179. xhr.abort();
  18180. };
  18181. });
  18182. this.onFileRemove(file.id, () => {
  18183. queuedRequest.abort();
  18184. reject(new Error('File removed'));
  18185. });
  18186. this.onCancelAll(file.id, () => {
  18187. queuedRequest.abort();
  18188. reject(new Error('Upload cancelled'));
  18189. });
  18190. });
  18191. }
  18192. uploadRemote(file) {
  18193. const opts = this.getOptions(file);
  18194. return new Promise((resolve, reject) => {
  18195. this.uppy.emit('upload-started', file);
  18196. const fields = {};
  18197. const metaFields = Array.isArray(opts.metaFields) ? opts.metaFields // Send along all fields by default.
  18198. : Object.keys(file.meta);
  18199. metaFields.forEach(name => {
  18200. fields[name] = file.meta[name];
  18201. });
  18202. const Client = file.remote.providerOptions.provider ? Provider : RequestClient;
  18203. const client = new Client(this.uppy, file.remote.providerOptions);
  18204. client.post(file.remote.url, { ...file.remote.body,
  18205. endpoint: opts.endpoint,
  18206. size: file.data.size,
  18207. fieldname: opts.fieldName,
  18208. metadata: fields,
  18209. httpMethod: opts.method,
  18210. useFormData: opts.formData,
  18211. headers: opts.headers
  18212. }).then(res => {
  18213. const {
  18214. token
  18215. } = res;
  18216. const host = getSocketHost(file.remote.companionUrl);
  18217. const socket = new Socket({
  18218. target: `${host}/api/${token}`,
  18219. autoOpen: false
  18220. });
  18221. this.uploaderEvents[file.id] = new EventTracker_1(this.uppy);
  18222. this.onFileRemove(file.id, () => {
  18223. socket.send('cancel', {});
  18224. queuedRequest.abort();
  18225. resolve(`upload ${file.id} was removed`);
  18226. });
  18227. this.onCancelAll(file.id, () => {
  18228. socket.send('cancel', {});
  18229. queuedRequest.abort();
  18230. resolve(`upload ${file.id} was canceled`);
  18231. });
  18232. this.onRetry(file.id, () => {
  18233. socket.send('pause', {});
  18234. socket.send('resume', {});
  18235. });
  18236. this.onRetryAll(file.id, () => {
  18237. socket.send('pause', {});
  18238. socket.send('resume', {});
  18239. });
  18240. socket.on('progress', progressData => emitSocketProgress_1(this, progressData, file));
  18241. socket.on('success', data => {
  18242. const body = opts.getResponseData(data.response.responseText, data.response);
  18243. const uploadURL = body[opts.responseUrlFieldName];
  18244. const uploadResp = {
  18245. status: data.response.status,
  18246. body,
  18247. uploadURL
  18248. };
  18249. this.uppy.emit('upload-success', file, uploadResp);
  18250. queuedRequest.done();
  18251. if (this.uploaderEvents[file.id]) {
  18252. this.uploaderEvents[file.id].remove();
  18253. this.uploaderEvents[file.id] = null;
  18254. }
  18255. return resolve();
  18256. });
  18257. socket.on('error', errData => {
  18258. const resp = errData.response;
  18259. const error = resp ? opts.getResponseError(resp.responseText, resp) : Object.assign(new Error(errData.error.message), {
  18260. cause: errData.error
  18261. });
  18262. this.uppy.emit('upload-error', file, error);
  18263. queuedRequest.done();
  18264. if (this.uploaderEvents[file.id]) {
  18265. this.uploaderEvents[file.id].remove();
  18266. this.uploaderEvents[file.id] = null;
  18267. }
  18268. reject(error);
  18269. });
  18270. const queuedRequest = this.requests.run(() => {
  18271. socket.open();
  18272. if (file.isPaused) {
  18273. socket.send('pause', {});
  18274. }
  18275. return () => socket.close();
  18276. });
  18277. }).catch(err => {
  18278. this.uppy.emit('upload-error', file, err);
  18279. reject(err);
  18280. });
  18281. });
  18282. }
  18283. uploadBundle(files) {
  18284. return new Promise((resolve, reject) => {
  18285. const {
  18286. endpoint
  18287. } = this.opts;
  18288. const {
  18289. method
  18290. } = this.opts;
  18291. const optsFromState = this.uppy.getState().xhrUpload;
  18292. const formData = this.createBundledUpload(files, { ...this.opts,
  18293. ...(optsFromState || {})
  18294. });
  18295. const xhr = new XMLHttpRequest();
  18296. const timer = new ProgressTimeout_1(this.opts.timeout, () => {
  18297. xhr.abort();
  18298. const error = new Error(this.i18n('timedOut', {
  18299. seconds: Math.ceil(this.opts.timeout / 1000)
  18300. }));
  18301. emitError(error);
  18302. reject(error);
  18303. });
  18304. const emitError = error => {
  18305. files.forEach(file => {
  18306. this.uppy.emit('upload-error', file, error);
  18307. });
  18308. };
  18309. xhr.upload.addEventListener('loadstart', () => {
  18310. this.uppy.log('[XHRUpload] started uploading bundle');
  18311. timer.progress();
  18312. });
  18313. xhr.upload.addEventListener('progress', ev => {
  18314. timer.progress();
  18315. if (!ev.lengthComputable) return;
  18316. files.forEach(file => {
  18317. this.uppy.emit('upload-progress', file, {
  18318. uploader: this,
  18319. bytesUploaded: ev.loaded / ev.total * file.size,
  18320. bytesTotal: file.size
  18321. });
  18322. });
  18323. });
  18324. xhr.addEventListener('load', ev => {
  18325. timer.done();
  18326. if (this.opts.validateStatus(ev.target.status, xhr.responseText, xhr)) {
  18327. const body = this.opts.getResponseData(xhr.responseText, xhr);
  18328. const uploadResp = {
  18329. status: ev.target.status,
  18330. body
  18331. };
  18332. files.forEach(file => {
  18333. this.uppy.emit('upload-success', file, uploadResp);
  18334. });
  18335. return resolve();
  18336. }
  18337. const error = this.opts.getResponseError(xhr.responseText, xhr) || new Error('Upload error');
  18338. error.request = xhr;
  18339. emitError(error);
  18340. return reject(error);
  18341. });
  18342. xhr.addEventListener('error', () => {
  18343. timer.done();
  18344. const error = this.opts.getResponseError(xhr.responseText, xhr) || new Error('Upload error');
  18345. emitError(error);
  18346. return reject(error);
  18347. });
  18348. this.uppy.on('cancel-all', () => {
  18349. timer.done();
  18350. xhr.abort();
  18351. });
  18352. xhr.open(method.toUpperCase(), endpoint, true); // IE10 does not allow setting `withCredentials` and `responseType`
  18353. // before `open()` is called.
  18354. xhr.withCredentials = this.opts.withCredentials;
  18355. if (this.opts.responseType !== '') {
  18356. xhr.responseType = this.opts.responseType;
  18357. }
  18358. Object.keys(this.opts.headers).forEach(header => {
  18359. xhr.setRequestHeader(header, this.opts.headers[header]);
  18360. });
  18361. xhr.send(formData);
  18362. files.forEach(file => {
  18363. this.uppy.emit('upload-started', file);
  18364. });
  18365. });
  18366. }
  18367. uploadFiles(files) {
  18368. const promises = files.map((file, i) => {
  18369. const current = parseInt(i, 10) + 1;
  18370. const total = files.length;
  18371. if (file.error) {
  18372. return Promise.reject(new Error(file.error));
  18373. }
  18374. if (file.isRemote) {
  18375. return this.uploadRemote(file, current, total);
  18376. }
  18377. return this.upload(file, current, total);
  18378. });
  18379. return settle(promises);
  18380. }
  18381. onFileRemove(fileID, cb) {
  18382. this.uploaderEvents[fileID].on('file-removed', file => {
  18383. if (fileID === file.id) cb(file.id);
  18384. });
  18385. }
  18386. onRetry(fileID, cb) {
  18387. this.uploaderEvents[fileID].on('upload-retry', targetFileID => {
  18388. if (fileID === targetFileID) {
  18389. cb();
  18390. }
  18391. });
  18392. }
  18393. onRetryAll(fileID, cb) {
  18394. this.uploaderEvents[fileID].on('retry-all', () => {
  18395. if (!this.uppy.getFile(fileID)) return;
  18396. cb();
  18397. });
  18398. }
  18399. onCancelAll(fileID, cb) {
  18400. this.uploaderEvents[fileID].on('cancel-all', () => {
  18401. if (!this.uppy.getFile(fileID)) return;
  18402. cb();
  18403. });
  18404. }
  18405. handleUpload(fileIDs) {
  18406. if (fileIDs.length === 0) {
  18407. this.uppy.log('[XHRUpload] No files to upload!');
  18408. return Promise.resolve();
  18409. } // No limit configured by the user, and no RateLimitedQueue passed in by a "parent" plugin
  18410. // (basically just AwsS3) using the internal symbol
  18411. if (this.opts.limit === 0 && !this.opts[internalRateLimitedQueue]) {
  18412. this.uppy.log('[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0', 'warning');
  18413. }
  18414. this.uppy.log('[XHRUpload] Uploading...');
  18415. const files = fileIDs.map(fileID => this.uppy.getFile(fileID));
  18416. if (this.opts.bundle) {
  18417. // if bundle: true, we don’t support remote uploads
  18418. const isSomeFileRemote = files.some(file => file.isRemote);
  18419. if (isSomeFileRemote) {
  18420. throw new Error('Can’t upload remote files when the `bundle: true` option is set');
  18421. }
  18422. if (typeof this.opts.headers === 'function') {
  18423. throw new TypeError('`headers` may not be a function when the `bundle: true` option is set');
  18424. }
  18425. return this.uploadBundle(files);
  18426. }
  18427. return this.uploadFiles(files).then(() => null);
  18428. }
  18429. install() {
  18430. if (this.opts.bundle) {
  18431. const {
  18432. capabilities
  18433. } = this.uppy.getState();
  18434. this.uppy.setState({
  18435. capabilities: { ...capabilities,
  18436. individualCancellation: false
  18437. }
  18438. });
  18439. }
  18440. this.uppy.addUploader(this.handleUpload);
  18441. }
  18442. uninstall() {
  18443. if (this.opts.bundle) {
  18444. const {
  18445. capabilities
  18446. } = this.uppy.getState();
  18447. this.uppy.setState({
  18448. capabilities: { ...capabilities,
  18449. individualCancellation: true
  18450. }
  18451. });
  18452. }
  18453. this.uppy.removeUploader(this.handleUpload);
  18454. }
  18455. }, _class.VERSION = "2.0.6", _temp);
  18456. var require$$2$1 = dist$7;
  18457. var require$$1 = dom7_cjs;
  18458. var require$$2 = snabbdom_cjs;
  18459. var dist$6 = createCommonjsModule$1(function (module, exports) {
  18460. !function(e,t){t(exports,require$$2$1,lodash_toarray,require$$1,lodash_foreach,require$$4,lodash_throttle,require$$2,lodash_camelcase,lib$4,lodash_debounce,lodash_clonedeep,lib$2,lib);}(commonjsGlobal,(function(e,t,n,r,o,i,a,s,l,u,c,f,d,p){function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=h(t),v=h(n),y=h(r),m=h(o),b=h(a),w=h(l),x=h(c),E=h(f),S=h(d),k=h(p),O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{};function C(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function T(e){var t={exports:{}};return e(t,t.exports),t.exports}var N,M,L=function(e){return e&&e.Math==Math&&e},P=L("object"==typeof globalThis&&globalThis)||L("object"==typeof window&&window)||L("object"==typeof self&&self)||L("object"==typeof O&&O)||function(){return this}()||Function("return this")(),R=Object.defineProperty,D=function(e,t){try{R(P,e,{value:t,configurable:!0,writable:!0});}catch(n){P[e]=t;}return t},j="__core-js_shared__",A=P[j]||D(j,{}),_=T((function(e){(e.exports=function(e,t){return A[e]||(A[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});})),F=Function.prototype,I=F.bind,B=F.call,$=I&&I.bind(B),W=I?function(e){return e&&$(B,e)}:function(e){return e&&function(){return B.apply(e,arguments)}},H=P.TypeError,V=function(e){if(null==e)throw H("Can't call method on "+e);return e},z=P.Object,U=function(e){return z(V(e))},K=W({}.hasOwnProperty),q=Object.hasOwn||function(e,t){return K(U(e),t)},G=0,J=Math.random(),Y=W(1..toString),X=function(e){return "Symbol("+(void 0===e?"":e)+")_"+Y(++G+J,36)},Q=function(e){return "function"==typeof e},Z=function(e){return Q(e)?e:void 0},ee=function(e,t){return arguments.length<2?Z(P[e]):P[e]&&P[e][t]},te=ee("navigator","userAgent")||"",ne=P.process,re=P.Deno,oe=ne&&ne.versions||re&&re.version,ie=oe&&oe.v8;ie&&(M=(N=ie.split("."))[0]>0&&N[0]<4?1:+(N[0]+N[1])),!M&&te&&(!(N=te.match(/Edge\/(\d+)/))||N[1]>=74)&&(N=te.match(/Chrome\/(\d+)/))&&(M=+N[1]);var ae=M,se=function(e){try{return !!e()}catch(e){return !0}},le=!!Object.getOwnPropertySymbols&&!se((function(){var e=Symbol();return !String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ae&&ae<41})),ue=le&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ce=_("wks"),fe=P.Symbol,de=fe&&fe.for,pe=ue?fe:fe&&fe.withoutSetter||X,he=function(e){if(!q(ce,e)||!le&&"string"!=typeof ce[e]){var t="Symbol."+e;le&&q(fe,e)?ce[e]=fe[e]:ce[e]=ue&&de?de(t):pe(t);}return ce[e]},ge={};ge[he("toStringTag")]="z";var ve="[object z]"===String(ge),ye=!se((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),me=function(e){return "object"==typeof e?null!==e:Q(e)},be=P.document,we=me(be)&&me(be.createElement),xe=function(e){return we?be.createElement(e):{}},Ee=!ye&&!se((function(){return 7!=Object.defineProperty(xe("div"),"a",{get:function(){return 7}}).a})),Se=P.String,ke=P.TypeError,Oe=function(e){if(me(e))return e;throw ke(Se(e)+" is not an object")},Ce=Function.prototype.call,Te=Ce.bind?Ce.bind(Ce):function(){return Ce.apply(Ce,arguments)},Ne=W({}.isPrototypeOf),Me=P.Object,Le=ue?function(e){return "symbol"==typeof e}:function(e){var t=ee("Symbol");return Q(t)&&Ne(t.prototype,Me(e))},Pe=P.String,Re=function(e){try{return Pe(e)}catch(e){return "Object"}},De=P.TypeError,je=function(e){if(Q(e))return e;throw De(Re(e)+" is not a function")},Ae=function(e,t){var n=e[t];return null==n?void 0:je(n)},_e=P.TypeError,Fe=P.TypeError,Ie=he("toPrimitive"),Be=function(e,t){if(!me(e)||Le(e))return e;var n,r=Ae(e,Ie);if(r){if(void 0===t&&(t="default"),n=Te(r,e,t),!me(n)||Le(n))return n;throw Fe("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var n,r;if("string"===t&&Q(n=e.toString)&&!me(r=Te(n,e)))return r;if(Q(n=e.valueOf)&&!me(r=Te(n,e)))return r;if("string"!==t&&Q(n=e.toString)&&!me(r=Te(n,e)))return r;throw _e("Can't convert object to primitive value")}(e,t)},$e=function(e){var t=Be(e,"string");return Le(t)?t:t+""},We=P.TypeError,He=Object.defineProperty,Ve={f:ye?He:function(e,t,n){if(Oe(e),t=$e(t),Oe(n),Ee)try{return He(e,t,n)}catch(e){}if("get"in n||"set"in n)throw We("Accessors not supported");return "value"in n&&(e[t]=n.value),e}},ze=function(e,t){return {enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Ue=ye?function(e,t,n){return Ve.f(e,t,ze(1,n))}:function(e,t,n){return e[t]=n,e},Ke=W(Function.toString);Q(A.inspectSource)||(A.inspectSource=function(e){return Ke(e)});var qe,Ge,Je,Ye=A.inspectSource,Xe=P.WeakMap,Qe=Q(Xe)&&/native code/.test(Ye(Xe)),Ze=_("keys"),et=function(e){return Ze[e]||(Ze[e]=X(e))},tt={},nt="Object already initialized",rt=P.TypeError,ot=P.WeakMap;if(Qe||A.state){var it=A.state||(A.state=new ot),at=W(it.get),st=W(it.has),lt=W(it.set);qe=function(e,t){if(st(it,e))throw new rt(nt);return t.facade=e,lt(it,e,t),t},Ge=function(e){return at(it,e)||{}},Je=function(e){return st(it,e)};}else {var ut=et("state");tt[ut]=!0,qe=function(e,t){if(q(e,ut))throw new rt(nt);return t.facade=e,Ue(e,ut,t),t},Ge=function(e){return q(e,ut)?e[ut]:{}},Je=function(e){return q(e,ut)};}var ct={set:qe,get:Ge,has:Je,enforce:function(e){return Je(e)?Ge(e):qe(e,{})},getterFor:function(e){return function(t){var n;if(!me(t)||(n=Ge(t)).type!==e)throw rt("Incompatible receiver, "+e+" required");return n}}},ft=Function.prototype,dt=ye&&Object.getOwnPropertyDescriptor,pt=q(ft,"name"),ht={EXISTS:pt,PROPER:pt&&"something"===function(){}.name,CONFIGURABLE:pt&&(!ye||ye&&dt(ft,"name").configurable)},gt=T((function(e){var t=ht.CONFIGURABLE,n=ct.get,r=ct.enforce,o=String(String).split("String");(e.exports=function(e,n,i,a){var s,l=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,c=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:n;Q(i)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!q(i,"name")||t&&i.name!==f)&&Ue(i,"name",f),(s=r(i)).source||(s.source=o.join("string"==typeof f?f:""))),e!==P?(l?!c&&e[n]&&(u=!0):delete e[n],u?e[n]=i:Ue(e,n,i)):u?e[n]=i:D(n,i);})(Function.prototype,"toString",(function(){return Q(this)&&n(this).source||Ye(this)}));})),vt=W({}.toString),yt=W("".slice),mt=function(e){return yt(vt(e),8,-1)},bt=he("toStringTag"),wt=P.Object,xt="Arguments"==mt(function(){return arguments}()),Et=ve?mt:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=wt(e),bt))?n:xt?mt(t):"Object"==(r=mt(t))&&Q(t.callee)?"Arguments":r},St=ve?{}.toString:function(){return "[object "+Et(this)+"]"};ve||gt(Object.prototype,"toString",St,{unsafe:!0});var kt={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Ot=xe("span").classList,Ct=Ot&&Ot.constructor&&Ot.constructor.prototype,Tt=Ct===Object.prototype?void 0:Ct,Nt=W(W.bind),Mt=function(e,t){return je(e),void 0===t?e:Nt?Nt(e,t):function(){return e.apply(t,arguments)}},Lt=P.Object,Pt=W("".split),Rt=se((function(){return !Lt("z").propertyIsEnumerable(0)}))?function(e){return "String"==mt(e)?Pt(e,""):Lt(e)}:Lt,Dt=Math.ceil,jt=Math.floor,At=function(e){var t=+e;return t!=t||0===t?0:(t>0?jt:Dt)(t)},_t=Math.min,Ft=function(e){return e>0?_t(At(e),9007199254740991):0},It=function(e){return Ft(e.length)},Bt=Array.isArray||function(e){return "Array"==mt(e)},$t=function(){},Wt=[],Ht=ee("Reflect","construct"),Vt=/^\s*(?:class|function)\b/,zt=W(Vt.exec),Ut=!Vt.exec($t),Kt=function(e){if(!Q(e))return !1;try{return Ht($t,Wt,e),!0}catch(e){return !1}},qt=!Ht||se((function(){var e;return Kt(Kt.call)||!Kt(Object)||!Kt((function(){e=!0;}))||e}))?function(e){if(!Q(e))return !1;switch(Et(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return !1}return Ut||!!zt(Vt,Ye(e))}:Kt,Gt=he("species"),Jt=P.Array,Yt=function(e,t){return new(function(e){var t;return Bt(e)&&(t=e.constructor,(qt(t)&&(t===Jt||Bt(t.prototype))||me(t)&&null===(t=t[Gt]))&&(t=void 0)),void 0===t?Jt:t}(e))(0===t?0:t)},Xt=W([].push),Qt=function(e){var t=1==e,n=2==e,r=3==e,o=4==e,i=6==e,a=7==e,s=5==e||i;return function(l,u,c,f){for(var d,p,h=U(l),g=Rt(h),v=Mt(u,c),y=It(g),m=0,b=f||Yt,w=t?b(l,y):n||a?b(l,0):void 0;y>m;m++)if((s||m in g)&&(p=v(d=g[m],m,h),e))if(t)w[m]=p;else if(p)switch(e){case 3:return !0;case 5:return d;case 6:return m;case 2:Xt(w,d);}else switch(e){case 4:return !1;case 7:Xt(w,d);}return i?-1:r||o?o:w}},Zt={forEach:Qt(0),map:Qt(1),filter:Qt(2),some:Qt(3),every:Qt(4),find:Qt(5),findIndex:Qt(6),filterReject:Qt(7)},en=function(e,t){var n=[][e];return !!n&&se((function(){n.call(null,t||function(){throw 1},1);}))},tn=Zt.forEach,nn=en("forEach")?[].forEach:function(e){return tn(this,e,arguments.length>1?arguments[1]:void 0)},rn=function(e){if(e&&e.forEach!==nn)try{Ue(e,"forEach",nn);}catch(t){e.forEach=nn;}};for(var on in kt)kt[on]&&rn(P[on]&&P[on].prototype);rn(Tt);var an={}.propertyIsEnumerable,sn=Object.getOwnPropertyDescriptor,ln=sn&&!an.call({1:2},1)?function(e){var t=sn(this,e);return !!t&&t.enumerable}:an,un={f:ln},cn=function(e){return Rt(V(e))},fn=Object.getOwnPropertyDescriptor,dn={f:ye?fn:function(e,t){if(e=cn(e),t=$e(t),Ee)try{return fn(e,t)}catch(e){}if(q(e,t))return ze(!Te(un.f,e,t),e[t])}},pn=Math.max,hn=Math.min,gn=function(e,t){var n=At(e);return n<0?pn(n+t,0):hn(n,t)},vn=function(e){return function(t,n,r){var o,i=cn(t),a=It(i),s=gn(r,a);if(e&&n!=n){for(;a>s;)if((o=i[s++])!=o)return !0}else for(;a>s;s++)if((e||s in i)&&i[s]===n)return e||s||0;return !e&&-1}},yn={includes:vn(!0),indexOf:vn(!1)},mn=yn.indexOf,bn=W([].push),wn=function(e,t){var n,r=cn(e),o=0,i=[];for(n in r)!q(tt,n)&&q(r,n)&&bn(i,n);for(;t.length>o;)q(r,n=t[o++])&&(~mn(i,n)||bn(i,n));return i},xn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],En=xn.concat("length","prototype"),Sn={f:Object.getOwnPropertyNames||function(e){return wn(e,En)}},kn={f:Object.getOwnPropertySymbols},On=W([].concat),Cn=ee("Reflect","ownKeys")||function(e){var t=Sn.f(Oe(e)),n=kn.f;return n?On(t,n(e)):t},Tn=function(e,t){for(var n=Cn(t),r=Ve.f,o=dn.f,i=0;i<n.length;i++){var a=n[i];q(e,a)||r(e,a,o(t,a));}},Nn=/#|\.prototype\./,Mn=function(e,t){var n=Pn[Ln(e)];return n==Dn||n!=Rn&&(Q(t)?se(t):!!t)},Ln=Mn.normalize=function(e){return String(e).replace(Nn,".").toLowerCase()},Pn=Mn.data={},Rn=Mn.NATIVE="N",Dn=Mn.POLYFILL="P",jn=Mn,An=dn.f,_n=function(e,t){var n,r,o,i,a,s=e.target,l=e.global,u=e.stat;if(n=l?P:u?P[s]||D(s,{}):(P[s]||{}).prototype)for(r in t){if(i=t[r],o=e.noTargetGet?(a=An(n,r))&&a.value:n[r],!jn(l?r:s+(u?".":"#")+r,e.forced)&&void 0!==o){if(typeof i==typeof o)continue;Tn(i,o);}(e.sham||o&&o.sham)&&Ue(i,"sham",!0),gt(n,r,i,e);}},Fn=Object.keys||function(e){return wn(e,xn)},In=se((function(){Fn(1);}));
  18461. /*!
  18462. * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
  18463. *
  18464. * Copyright (c) 2014-2017, Jon Schlinkert.
  18465. * Released under the MIT License.
  18466. */
  18467. function Bn(e){return "[object Object]"===Object.prototype.toString.call(e)}_n({target:"Object",stat:!0,forced:In},{keys:function(e){return Fn(U(e))}});var $n=function(e){var t,n;return !1!==Bn(e)&&(void 0===(t=e.constructor)||!1!==Bn(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))},Wn=Object.defineProperty({isPlainObject:$n},"__esModule",{value:!0}),Hn=function(e){return Wn.isPlainObject(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||g.default.Operation.isOperationList(e.redos[0]))&&(0===e.undos.length||g.default.Operation.isOperationList(e.undos[0]))},Vn=new WeakMap,zn=new WeakMap,Un={isHistoryEditor:function(e){return Hn(e.history)&&g.default.Editor.isEditor(e)},isMerging:function(e){return zn.get(e)},isSaving:function(e){return Vn.get(e)},redo:function(e){e.redo();},undo:function(e){e.undo();},withoutMerging:function(e,t){var n=Un.isMerging(e);zn.set(e,!1),t(),zn.set(e,n);},withoutSaving:function(e,t){var n=Un.isSaving(e);Vn.set(e,!1),t(),Vn.set(e,n);}};function Kn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return qn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return {s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return {s:function(){n=n.call(e);},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e;},f:function(){try{a||null==n.return||n.return();}finally{if(s)throw i}}}}function qn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Gn=function(e,t){return "set_selection"===e.type||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!g.default.Path.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!g.default.Path.equals(e.path,t.path)))},Jn=function(e,t){return "set_selection"!==e.type||null!=e.properties&&null!=e.newProperties},Yn=function(e,t){return !(!t||"set_selection"!==e.type||"set_selection"!==t.type)},Xn=function(e){return "set_selection"!==e.type},Qn=function(e){var t=e,n=t.apply;return t.history={undos:[],redos:[]},t.redo=function(){var e=t.history,n=e.redos;if(n.length>0){var r=n[n.length-1];Un.withoutSaving(t,(function(){g.default.Editor.withoutNormalizing(t,(function(){var e,n=Kn(r);try{for(n.s();!(e=n.n()).done;){var o=e.value;t.apply(o);}}catch(e){n.e(e);}finally{n.f();}}));})),e.redos.pop(),e.undos.push(r);}},t.undo=function(){var e=t.history,n=e.undos;if(n.length>0){var r=n[n.length-1];Un.withoutSaving(t,(function(){g.default.Editor.withoutNormalizing(t,(function(){var e,n=Kn(r.map(g.default.Operation.inverse).reverse());try{for(n.s();!(e=n.n()).done;){var o=e.value;t.apply(o);}}catch(e){n.e(e);}finally{n.f();}}));})),e.redos.push(r),e.undos.pop();}},t.apply=function(e){var r=t.operations,o=t.history,i=o.undos,a=i[i.length-1],s=a&&a[a.length-1],l=Yn(e,s),u=Un.isSaving(t),c=Un.isMerging(t);if(null==u&&(u=Jn(e)),u){if(null==c&&(c=null!=a&&(0!==r.length||(Gn(e,s)||l))),a&&c)l&&a.pop(),a.push(e);else {var f=[e];i.push(f);}for(;i.length>100;)i.shift();Xn(e)&&(o.redos=[]);}n(e);},t},Zn=P.String,er=function(e){if("Symbol"===Et(e))throw TypeError("Cannot convert a Symbol value to a string");return Zn(e)},tr=function(){var e=Oe(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},nr=ht.PROPER,rr="toString",or=RegExp.prototype,ir=or.toString,ar=W(tr),sr=se((function(){return "/a/b"!=ir.call({source:"a",flags:"b"})})),lr=nr&&ir.name!=rr;(sr||lr)&&gt(RegExp.prototype,rr,(function(){var e=Oe(this),t=er(e.source),n=e.flags;return "/"+t+"/"+er(void 0===n&&Ne(or,e)&&!("flags"in or)?ar(e):n)}),{unsafe:!0});var ur,cr=ye?Object.defineProperties:function(e,t){Oe(e);for(var n,r=cn(t),o=Fn(t),i=o.length,a=0;i>a;)Ve.f(e,n=o[a++],r[n]);return e},fr=ee("document","documentElement"),dr=et("IE_PROTO"),pr=function(){},hr=function(e){return "<script>"+e+"</"+"script>"},gr=function(e){e.write(hr("")),e.close();var t=e.parentWindow.Object;return e=null,t},vr=function(){try{ur=new ActiveXObject("htmlfile");}catch(e){}var e,t;vr="undefined"!=typeof document?document.domain&&ur?gr(ur):((t=xe("iframe")).style.display="none",fr.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(hr("document.F=Object")),e.close(),e.F):gr(ur);for(var n=xn.length;n--;)delete vr.prototype[xn[n]];return vr()};tt[dr]=!0;var yr=Object.create||function(e,t){var n;return null!==e?(pr.prototype=Oe(e),n=new pr,pr.prototype=null,n[dr]=e):n=vr(),void 0===t?n:cr(n,t)},mr=he("unscopables"),br=Array.prototype;null==br[mr]&&Ve.f(br,mr,{configurable:!0,value:yr(null)});var wr=function(e){br[mr][e]=!0;},xr=yn.includes;_n({target:"Array",proto:!0},{includes:function(e){return xr(this,e,arguments.length>1?arguments[1]:void 0)}}),wr("includes");var Er=he("match"),Sr=function(e){var t;return me(e)&&(void 0!==(t=e[Er])?!!t:"RegExp"==mt(e))},kr=P.TypeError,Or=function(e){if(Sr(e))throw kr("The method doesn't accept regular expressions");return e},Cr=he("match"),Tr=function(e){var t=/./;try{"/./"[e](t);}catch(n){try{return t[Cr]=!1,"/./"[e](t)}catch(e){}}return !1},Nr=W("".indexOf);_n({target:"String",proto:!0,forced:!Tr("includes")},{includes:function(e){return !!~Nr(er(V(this)),er(Or(e)),arguments.length>1?arguments[1]:void 0)}});var Mr,Lr=/"/g,Pr=W("".replace);_n({target:"String",proto:!0,forced:(Mr="anchor",se((function(){var e=""[Mr]('"');return e!==e.toLowerCase()||e.split('"').length>3})))},{anchor:function(e){return t="a",n="name",r=e,o=er(V(this)),i="<"+t,""!==n&&(i+=" "+n+'="'+Pr(er(r),Lr,"&quot;")+'"'),i+">"+o+"</"+t+">";var t,n,r,o,i;}});var Rr=function(e,t,n){var r,o;Oe(e);try{if(!(r=Ae(e,"return"))){if("throw"===t)throw n;return n}r=Te(r,e);}catch(e){o=!0,r=e;}if("throw"===t)throw n;if(o)throw r;return Oe(r),n},Dr=function(e,t,n,r){try{return r?t(Oe(n)[0],n[1]):t(n)}catch(t){Rr(e,"throw",t);}},jr={},Ar=he("iterator"),_r=Array.prototype,Fr=function(e){return void 0!==e&&(jr.Array===e||_r[Ar]===e)},Ir=function(e,t,n){var r=$e(t);r in e?Ve.f(e,r,ze(0,n)):e[r]=n;},Br=he("iterator"),$r=function(e){if(null!=e)return Ae(e,Br)||Ae(e,"@@iterator")||jr[Et(e)]},Wr=P.TypeError,Hr=function(e,t){var n=arguments.length<2?$r(e):t;if(je(n))return Oe(Te(n,e));throw Wr(Re(e)+" is not iterable")},Vr=P.Array,zr=he("iterator"),Ur=!1;try{var Kr=0,qr={next:function(){return {done:!!Kr++}},return:function(){Ur=!0;}};qr[zr]=function(){return this},Array.from(qr,(function(){throw 2}));}catch(e){}var Gr=function(e,t){if(!t&&!Ur)return !1;var n=!1;try{var r={};r[zr]=function(){return {next:function(){return {done:n=!0}}}},e(r);}catch(e){}return n},Jr=!Gr((function(e){Array.from(e);}));_n({target:"Array",stat:!0,forced:Jr},{from:function(e){var t=U(e),n=qt(this),r=arguments.length,o=r>1?arguments[1]:void 0,i=void 0!==o;i&&(o=Mt(o,r>2?arguments[2]:void 0));var a,s,l,u,c,f,d=$r(t),p=0;if(!d||this==Vr&&Fr(d))for(a=It(t),s=n?new this(a):Vr(a);a>p;p++)f=i?o(t[p],p):t[p],Ir(s,p,f);else for(c=(u=Hr(t,d)).next,s=n?new this:[];!(l=Te(c,u)).done;p++)f=i?Dr(u,o,[l.value,p],!0):l.value,Ir(s,p,f);return s.length=p,s}});var Yr,Xr,Qr,Zr=W("".charAt),eo=W("".charCodeAt),to=W("".slice),no=function(e){return function(t,n){var r,o,i=er(V(t)),a=At(n),s=i.length;return a<0||a>=s?e?"":void 0:(r=eo(i,a))<55296||r>56319||a+1===s||(o=eo(i,a+1))<56320||o>57343?e?Zr(i,a):r:e?to(i,a,a+2):o-56320+(r-55296<<10)+65536}},ro={codeAt:no(!1),charAt:no(!0)},oo=!se((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),io=et("IE_PROTO"),ao=P.Object,so=ao.prototype,lo=oo?ao.getPrototypeOf:function(e){var t=U(e);if(q(t,io))return t[io];var n=t.constructor;return Q(n)&&t instanceof n?n.prototype:t instanceof ao?so:null},uo=he("iterator"),co=!1;[].keys&&("next"in(Qr=[].keys())?(Xr=lo(lo(Qr)))!==Object.prototype&&(Yr=Xr):co=!0);var fo=null==Yr||se((function(){var e={};return Yr[uo].call(e)!==e}));fo&&(Yr={}),Q(Yr[uo])||gt(Yr,uo,(function(){return this}));var po={IteratorPrototype:Yr,BUGGY_SAFARI_ITERATORS:co},ho=Ve.f,go=he("toStringTag"),vo=function(e,t,n){e&&!q(e=n?e:e.prototype,go)&&ho(e,go,{configurable:!0,value:t});},yo=po.IteratorPrototype,mo=function(){return this},bo=P.String,wo=P.TypeError,xo=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=W(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),t=n instanceof Array;}catch(e){}return function(n,r){return Oe(n),function(e){if("object"==typeof e||Q(e))return e;throw wo("Can't set "+bo(e)+" as a prototype")}(r),t?e(n,r):n.__proto__=r,n}}():void 0),Eo=ht.PROPER,So=ht.CONFIGURABLE,ko=po.IteratorPrototype,Oo=po.BUGGY_SAFARI_ITERATORS,Co=he("iterator"),To="keys",No="values",Mo="entries",Lo=function(){return this},Po=function(e,t,n,r,o,i,a){!function(e,t,n,r){var o=t+" Iterator";e.prototype=yr(yo,{next:ze(+!r,n)}),vo(e,o,!1),jr[o]=mo;}(n,t,r);var s,l,u,c=function(e){if(e===o&&g)return g;if(!Oo&&e in p)return p[e];switch(e){case To:case No:case Mo:return function(){return new n(this,e)}}return function(){return new n(this)}},f=t+" Iterator",d=!1,p=e.prototype,h=p[Co]||p["@@iterator"]||o&&p[o],g=!Oo&&h||c(o),v="Array"==t&&p.entries||h;if(v&&(s=lo(v.call(new e)))!==Object.prototype&&s.next&&(lo(s)!==ko&&(xo?xo(s,ko):Q(s[Co])||gt(s,Co,Lo)),vo(s,f,!0)),Eo&&o==No&&h&&h.name!==No&&(So?Ue(p,"name",No):(d=!0,g=function(){return Te(h,this)})),o)if(l={values:c(No),keys:i?g:c(To),entries:c(Mo)},a)for(u in l)(Oo||d||!(u in p))&&gt(p,u,l[u]);else _n({target:t,proto:!0,forced:Oo||d},l);return p[Co]!==g&&gt(p,Co,g,{name:o}),jr[t]=g,l},Ro=ro.charAt,Do="String Iterator",jo=ct.set,Ao=ct.getterFor(Do);Po(String,"String",(function(e){jo(this,{type:Do,string:er(e),index:0});}),(function(){var e,t=Ao(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=Ro(n,r),t.index+=e.length,{value:e,done:!1})}));var _o,Fo=dn.f,Io=W("".endsWith),Bo=W("".slice),$o=Math.min,Wo=Tr("endsWith"),Ho=!(Wo||(_o=Fo(String.prototype,"endsWith"),!_o||_o.writable));_n({target:"String",proto:!0,forced:!Ho&&!Wo},{endsWith:function(e){var t=er(V(this));Or(e);var n=arguments.length>1?arguments[1]:void 0,r=t.length,o=void 0===n?r:$o(Ft(n),r),i=er(e);return Io?Io(t,i,o):Bo(t,o-i.length,o)===i}});var Vo=W([].join),zo=Rt!=Object,Uo=en("join",",");_n({target:"Array",proto:!0,forced:zo||!Uo},{join:function(e){return Vo(cn(this),void 0===e?",":e)}});var Ko=he("species"),qo=function(e){return ae>=51||!se((function(){var t=[];return (t.constructor={})[Ko]=function(){return {foo:1}},1!==t[e](Boolean).foo}))},Go=Zt.map,Jo=qo("map");_n({target:"Array",proto:!0,forced:!Jo},{map:function(e){return Go(this,e,arguments.length>1?arguments[1]:void 0)}});var Yo=P.RegExp,Xo=se((function(){var e=Yo("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Qo=Xo||se((function(){return !Yo("a","y").sticky})),Zo={BROKEN_CARET:Xo||se((function(){var e=Yo("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:Qo,UNSUPPORTED_Y:Xo},ei=P.RegExp,ti=se((function(){var e=ei(".","s");return !(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),ni=P.RegExp,ri=se((function(){var e=ni("(?<a>b)","g");return "b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),oi=ct.get,ii=_("native-string-replace",String.prototype.replace),ai=RegExp.prototype.exec,si=ai,li=W("".charAt),ui=W("".indexOf),ci=W("".replace),fi=W("".slice),di=function(){var e=/a/,t=/b*/g;return Te(ai,e,"a"),Te(ai,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),pi=Zo.BROKEN_CARET,hi=void 0!==/()??/.exec("")[1];(di||hi||pi||ti||ri)&&(si=function(e){var t,n,r,o,i,a,s,l=this,u=oi(l),c=er(e),f=u.raw;if(f)return f.lastIndex=l.lastIndex,t=Te(si,f,c),l.lastIndex=f.lastIndex,t;var d=u.groups,p=pi&&l.sticky,h=Te(tr,l),g=l.source,v=0,y=c;if(p&&(h=ci(h,"y",""),-1===ui(h,"g")&&(h+="g"),y=fi(c,l.lastIndex),l.lastIndex>0&&(!l.multiline||l.multiline&&"\n"!==li(c,l.lastIndex-1))&&(g="(?: "+g+")",y=" "+y,v++),n=new RegExp("^(?:"+g+")",h)),hi&&(n=new RegExp("^"+g+"$(?!\\s)",h)),di&&(r=l.lastIndex),o=Te(ai,p?n:l,y),p?o?(o.input=fi(o.input,v),o[0]=fi(o[0],v),o.index=l.lastIndex,l.lastIndex+=o[0].length):l.lastIndex=0:di&&o&&(l.lastIndex=l.global?o.index+o[0].length:r),hi&&o&&o.length>1&&Te(ii,o[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(o[i]=void 0);})),o&&d)for(o.groups=a=yr(null),i=0;i<d.length;i++)a[(s=d[i])[0]]=o[s[1]];return o});var gi=si;_n({target:"RegExp",proto:!0,forced:/./.exec!==gi},{exec:gi});var vi=Function.prototype,yi=vi.apply,mi=vi.bind,bi=vi.call,wi="object"==typeof Reflect&&Reflect.apply||(mi?bi.bind(yi):function(){return bi.apply(yi,arguments)}),xi=he("species"),Ei=RegExp.prototype,Si=function(e,t,n,r){var o=he(e),i=!se((function(){var t={};return t[o]=function(){return 7},7!=""[e](t)})),a=i&&!se((function(){var t=!1,n=/a/;return "split"===e&&((n={}).constructor={},n.constructor[xi]=function(){return n},n.flags="",n[o]=/./[o]),n.exec=function(){return t=!0,null},n[o](""),!t}));if(!i||!a||n){var s=W(/./[o]),l=t(o,""[e],(function(e,t,n,r,o){var a=W(e),l=t.exec;return l===gi||l===Ei.exec?i&&!o?{done:!0,value:s(t,n,r)}:{done:!0,value:a(n,t,r)}:{done:!1}}));gt(String.prototype,e,l[0]),gt(Ei,o,l[1]);}r&&Ue(Ei[o],"sham",!0);},ki=ro.charAt,Oi=function(e,t,n){return t+(n?ki(e,t).length:1)},Ci=Math.floor,Ti=W("".charAt),Ni=W("".replace),Mi=W("".slice),Li=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Pi=/\$([$&'`]|\d{1,2})/g,Ri=function(e,t,n,r,o,i){var a=n+e.length,s=r.length,l=Pi;return void 0!==o&&(o=U(o),l=Li),Ni(i,l,(function(i,l){var u;switch(Ti(l,0)){case"$":return "$";case"&":return e;case"`":return Mi(t,0,n);case"'":return Mi(t,a);case"<":u=o[Mi(l,1,-1)];break;default:var c=+l;if(0===c)return i;if(c>s){var f=Ci(c/10);return 0===f?i:f<=s?void 0===r[f-1]?Ti(l,1):r[f-1]+Ti(l,1):i}u=r[c-1];}return void 0===u?"":u}))},Di=P.TypeError,ji=function(e,t){var n=e.exec;if(Q(n)){var r=Te(n,e,t);return null!==r&&Oe(r),r}if("RegExp"===mt(e))return Te(gi,e,t);throw Di("RegExp#exec called on incompatible receiver")},Ai=he("replace"),_i=Math.max,Fi=Math.min,Ii=W([].concat),Bi=W([].push),$i=W("".indexOf),Wi=W("".slice),Hi="$0"==="a".replace(/./,"$0"),Vi=!!/./[Ai]&&""===/./[Ai]("a","$0");Si("replace",(function(e,t,n){var r=Vi?"$":"$0";return [function(e,n){var r=V(this),o=null==e?void 0:Ae(e,Ai);return o?Te(o,e,r,n):Te(t,er(r),e,n)},function(e,o){var i=Oe(this),a=er(e);if("string"==typeof o&&-1===$i(o,r)&&-1===$i(o,"$<")){var s=n(t,i,a,o);if(s.done)return s.value}var l=Q(o);l||(o=er(o));var u=i.global;if(u){var c=i.unicode;i.lastIndex=0;}for(var f=[];;){var d=ji(i,a);if(null===d)break;if(Bi(f,d),!u)break;""===er(d[0])&&(i.lastIndex=Oi(a,Ft(i.lastIndex),c));}for(var p,h="",g=0,v=0;v<f.length;v++){for(var y=er((d=f[v])[0]),m=_i(Fi(At(d.index),a.length),0),b=[],w=1;w<d.length;w++)Bi(b,void 0===(p=d[w])?p:String(p));var x=d.groups;if(l){var E=Ii([y],b,m,a);void 0!==x&&Bi(E,x);var S=er(wi(o,void 0,E));}else S=Ri(y,a,m,b,x,o);m>=g&&(h+=Wi(a,g,m)+S,g=m+y.length);}return h+Wi(a,g)}]}),!!se((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!Hi||Vi);
  18468. /*! *****************************************************************************
  18469. Copyright (c) Microsoft Corporation.
  18470. Permission to use, copy, modify, and/or distribute this software for any
  18471. purpose with or without fee is hereby granted.
  18472. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  18473. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  18474. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  18475. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  18476. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  18477. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  18478. PERFORMANCE OF THIS SOFTWARE.
  18479. ***************************************************************************** */
  18480. var zi=function(e,t){return zi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);},zi(e,t)};function Ui(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e;}zi(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n);}var Ki=function(){return Ki=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ki.apply(this,arguments)};function qi(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return {next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gi(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value);}catch(e){o={error:e};}finally{try{r&&!r.done&&(n=i.return)&&n.call(i);}finally{if(o)throw o.error}}return a}function Ji(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e}var Yi=0,Xi=function(){this.id=""+Yi++;},Qi="Array Iterator",Zi=ct.set,ea=ct.getterFor(Qi),ta=Po(Array,"Array",(function(e,t){Zi(this,{type:Qi,target:cn(e),index:0,kind:t});}),(function(){var e=ea(this),t=e.target,n=e.kind,r=e.index++;return !t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");jr.Arguments=jr.Array,wr("keys"),wr("values"),wr("entries");var na=function(e,t,n){for(var r in t)gt(e,r,t[r],n);return e},ra=P.Array,oa=Math.max,ia=function(e,t,n){for(var r=It(e),o=gn(t,r),i=gn(void 0===n?r:n,r),a=ra(oa(i-o,0)),s=0;o<i;o++,s++)Ir(a,s,e[o]);return a.length=s,a},aa=Sn.f,sa="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],la={f:function(e){return sa&&"Window"==mt(e)?function(e){try{return aa(e)}catch(e){return ia(sa)}}(e):aa(cn(e))}},ua=se((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8});}})),ca=Object.isExtensible,fa=se((function(){ca(1);}))||ua?function(e){return !!me(e)&&((!ua||"ArrayBuffer"!=mt(e))&&(!ca||ca(e)))}:ca,da=!se((function(){return Object.isExtensible(Object.preventExtensions({}))})),pa=T((function(e){var t=Ve.f,n=!1,r=X("meta"),o=0,i=function(e){t(e,r,{value:{objectID:"O"+o++,weakData:{}}});},a=e.exports={enable:function(){a.enable=function(){},n=!0;var e=Sn.f,t=W([].splice),o={};o[r]=1,e(o).length&&(Sn.f=function(n){for(var o=e(n),i=0,a=o.length;i<a;i++)if(o[i]===r){t(o,i,1);break}return o},_n({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:la.f}));},fastKey:function(e,t){if(!me(e))return "symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!q(e,r)){if(!fa(e))return "F";if(!t)return "E";i(e);}return e[r].objectID},getWeakData:function(e,t){if(!q(e,r)){if(!fa(e))return !0;if(!t)return !1;i(e);}return e[r].weakData},onFreeze:function(e){return da&&n&&fa(e)&&!q(e,r)&&i(e),e}};tt[r]=!0;})),ha=P.TypeError,ga=function(e,t){this.stopped=e,this.result=t;},va=ga.prototype,ya=function(e,t,n){var r,o,i,a,s,l,u,c=n&&n.that,f=!(!n||!n.AS_ENTRIES),d=!(!n||!n.IS_ITERATOR),p=!(!n||!n.INTERRUPTED),h=Mt(t,c),g=function(e){return r&&Rr(r,"normal",e),new ga(!0,e)},v=function(e){return f?(Oe(e),p?h(e[0],e[1],g):h(e[0],e[1])):p?h(e,g):h(e)};if(d)r=e;else {if(!(o=$r(e)))throw ha(Re(e)+" is not iterable");if(Fr(o)){for(i=0,a=It(e);a>i;i++)if((s=v(e[i]))&&Ne(va,s))return s;return new ga(!1)}r=Hr(e,o);}for(l=r.next;!(u=Te(l,r)).done;){try{s=v(u.value);}catch(e){Rr(r,"throw",e);}if("object"==typeof s&&s&&Ne(va,s))return s}return new ga(!1)},ma=P.TypeError,ba=function(e,t){if(Ne(t,e))return e;throw ma("Incorrect invocation")},wa=function(e,t,n){var r,o;return xo&&Q(r=t.constructor)&&r!==n&&me(o=r.prototype)&&o!==n.prototype&&xo(e,o),e},xa=function(e,t,n){var r=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),i=r?"set":"add",a=P[e],s=a&&a.prototype,l=a,u={},c=function(e){var t=W(s[e]);gt(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return !(o&&!me(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return o&&!me(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return !(o&&!me(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this});};if(jn(e,!Q(a)||!(o||s.forEach&&!se((function(){(new a).entries().next();})))))l=n.getConstructor(t,e,r,i),pa.enable();else if(jn(e,!0)){var f=new l,d=f[i](o?{}:-0,1)!=f,p=se((function(){f.has(1);})),h=Gr((function(e){new a(e);})),g=!o&&se((function(){for(var e=new a,t=5;t--;)e[i](t,t);return !e.has(-0)}));h||((l=t((function(e,t){ba(e,s);var n=wa(new a,e,l);return null!=t&&ya(t,n[i],{that:n,AS_ENTRIES:r}),n}))).prototype=s,s.constructor=l),(p||g)&&(c("delete"),c("has"),r&&c("get")),(g||d)&&c(i),o&&s.clear&&delete s.clear;}return u[e]=l,_n({global:!0,forced:l!=a},u),vo(l,e),o||n.setStrong(l,e,r),l},Ea=pa.getWeakData,Sa=ct.set,ka=ct.getterFor,Oa=Zt.find,Ca=Zt.findIndex,Ta=W([].splice),Na=0,Ma=function(e){return e.frozen||(e.frozen=new La)},La=function(){this.entries=[];},Pa=function(e,t){return Oa(e.entries,(function(e){return e[0]===t}))};La.prototype={get:function(e){var t=Pa(this,e);if(t)return t[1]},has:function(e){return !!Pa(this,e)},set:function(e,t){var n=Pa(this,e);n?n[1]=t:this.entries.push([e,t]);},delete:function(e){var t=Ca(this.entries,(function(t){return t[0]===e}));return ~t&&Ta(this.entries,t,1),!!~t}};var Ra,Da={getConstructor:function(e,t,n,r){var o=e((function(e,o){ba(e,i),Sa(e,{type:t,id:Na++,frozen:void 0}),null!=o&&ya(o,e[r],{that:e,AS_ENTRIES:n});})),i=o.prototype,a=ka(t),s=function(e,t,n){var r=a(e),o=Ea(Oe(t),!0);return !0===o?Ma(r).set(t,n):o[r.id]=n,e};return na(i,{delete:function(e){var t=a(this);if(!me(e))return !1;var n=Ea(e);return !0===n?Ma(t).delete(e):n&&q(n,t.id)&&delete n[t.id]},has:function(e){var t=a(this);if(!me(e))return !1;var n=Ea(e);return !0===n?Ma(t).has(e):n&&q(n,t.id)}}),na(i,n?{get:function(e){var t=a(this);if(me(e)){var n=Ea(e);return !0===n?Ma(t).get(e):n?n[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),o}},ja=ct.enforce,Aa=!P.ActiveXObject&&"ActiveXObject"in P,_a=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},Fa=xa("WeakMap",_a,Da);if(Qe&&Aa){Ra=Da.getConstructor(_a,"WeakMap",!0),pa.enable();var Ia=Fa.prototype,Ba=W(Ia.delete),$a=W(Ia.has),Wa=W(Ia.get),Ha=W(Ia.set);na(Ia,{delete:function(e){if(me(e)&&!fa(e)){var t=ja(this);return t.frozen||(t.frozen=new Ra),Ba(this,e)||t.frozen.delete(e)}return Ba(this,e)},has:function(e){if(me(e)&&!fa(e)){var t=ja(this);return t.frozen||(t.frozen=new Ra),$a(this,e)||t.frozen.has(e)}return $a(this,e)},get:function(e){if(me(e)&&!fa(e)){var t=ja(this);return t.frozen||(t.frozen=new Ra),$a(this,e)?Wa(this,e):t.frozen.get(e)}return Wa(this,e)},set:function(e,t){if(me(e)&&!fa(e)){var n=ja(this);n.frozen||(n.frozen=new Ra),$a(this,e)?Ha(this,e,t):n.frozen.set(e,t);}else Ha(this,e,t);return this}});}var Va=he("iterator"),za=he("toStringTag"),Ua=ta.values,Ka=function(e,t){if(e){if(e[Va]!==Ua)try{Ue(e,Va,Ua);}catch(t){e[Va]=Ua;}if(e[za]||Ue(e,za,t),kt[t])for(var n in ta)if(e[n]!==ta[n])try{Ue(e,n,ta[n]);}catch(t){e[n]=ta[n];}}};for(var qa in kt)Ka(P[qa]&&P[qa].prototype,qa);Ka(Tt,"DOMTokenList");var Ga=new WeakMap,Ja=new WeakMap,Ya=new WeakMap,Xa=new WeakMap,Qa=new WeakMap,Za=new WeakMap,es=new WeakMap,ts=new WeakMap,ns=new WeakMap,rs=new WeakMap,os=new WeakMap,is=new WeakMap,as=new WeakMap,ss=new WeakMap,ls=new WeakMap,us=new WeakMap,cs=new WeakMap,fs=new WeakMap,ds=new WeakMap,ps=new WeakMap,hs=new WeakMap,gs=new WeakMap,vs=new WeakMap,ys=new WeakMap,ms=new WeakMap,bs=Zt.find,ws="find",xs=!0;ws in[]&&Array(1).find((function(){xs=!1;})),_n({target:"Array",proto:!0,forced:xs},{find:function(e){return bs(this,e,arguments.length>1?arguments[1]:void 0)}}),wr(ws),_n({global:!0},{globalThis:P});const Es=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","isindex","keygen","link","menuitem","meta","nextid","param","source","track","wbr"];r.css&&(y.default.fn.css=r.css),r.append&&(y.default.fn.append=r.append),r.addClass&&(y.default.fn.addClass=r.addClass),r.removeClass&&(y.default.fn.removeClass=r.removeClass),r.hasClass&&(y.default.fn.hasClass=r.hasClass),r.on&&(y.default.fn.on=r.on),r.focus&&(y.default.fn.focus=r.focus),r.attr&&(y.default.fn.attr=r.attr),r.removeAttr&&(y.default.fn.removeAttr=r.removeAttr),r.hide&&(y.default.fn.hide=r.hide),r.show&&(y.default.fn.show=r.show),r.offset&&(y.default.fn.offset=r.offset),r.width&&(y.default.fn.width=r.width),r.height&&(y.default.fn.height=r.height),r.parent&&(y.default.fn.parent=r.parent),r.parents&&(y.default.fn.parents=r.parents),r.is&&(y.default.fn.is=r.is),r.dataset&&(y.default.fn.dataset=r.dataset),r.val&&(y.default.fn.val=r.val),r.text&&(y.default.fn.text=r.text),r.html&&(y.default.fn.html=r.html),r.children&&(y.default.fn.children=r.children),r.remove&&(y.default.fn.remove=r.remove),r.find&&(y.default.fn.find=r.find),r.each&&(y.default.fn.each=r.each),r.empty&&(y.default.fn.empty=r.empty);var Ss,ks=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||null},Os=function(e){return Cs(e)&&1===e.nodeType},Cs=function(e){var t=ks(e);return !!t&&e instanceof t.Node},Ts=function(e){var t=e&&e.anchorNode&&ks(e.anchorNode);return !!t&&e instanceof t.Selection},Ns=function(e){return Cs(e)&&3===e.nodeType},Ms=function(e){var t,n,r;return null!==(t=window.document.getElementById(e))&&void 0!==t?t:(null===(r=null===(n=window.document.activeElement)||void 0===n?void 0:n.shadowRoot)||void 0===r?void 0:r.getElementById(e))||null},Ls=function(e,t,n){for(var r,o=e.childNodes,i=o[t],a=t,s=!1,l=!1;(Cs(r=i)&&8===r.nodeType||Os(i)&&0===i.childNodes.length||Os(i)&&"false"===i.getAttribute("contenteditable"))&&(!s||!l);)a>=o.length?(s=!0,a=t-1,n="backward"):a<0?(l=!0,a=t+1,n="forward"):(i=o[a],t=a,a+="forward"===n?1:-1);return [i,t]},Ps=function(e,t,n){return Gi(Ls(e,t,n),1)[0]},Rs=function e(t){var n,r,o="";if(Ns(t)&&t.nodeValue)return t.nodeValue;if(Os(t)){try{for(var i=qi(Array.from(t.childNodes)),a=i.next();!a.done;a=i.next()){o+=e(a.value);}}catch(e){n={error:e};}finally{try{a&&!a.done&&(r=i.return)&&r.call(i);}finally{if(n)throw n.error}}var s=getComputedStyle(t).getPropertyValue("display");"block"!==s&&"list"!==s&&"table-row"!==s&&"BR"!==t.tagName||(o+="\n");}return o};function Ds(e,t){if(!(e instanceof HTMLElement&&"true"===e.dataset.slateVoid))for(var n=e.childNodes,r=n.length;r--;){var o=n[r],i=o.nodeType;3==i?t(o,e):1!=i&&9!=i&&11!=i||Ds(o,t);}}function js(e){if(0===e.length)return "";var t=e[0];return t.nodeType!==Ss.ELEMENT_NODE?"":t.tagName.toLowerCase()}!function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE";}(Ss||(Ss={})),void 0!==globalThis.navigator&&void 0!==globalThis.window&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&globalThis.window.MSStream;var As="undefined"!=typeof navigator&&/Mac OS X/.test(navigator.userAgent),_s="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);"undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent);var Fs="undefined"!=typeof navigator&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),Is="undefined"!=typeof navigator&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Bs="undefined"!=typeof navigator&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),$s="undefined"!=typeof navigator&&/Chrome/i.test(navigator.userAgent);"undefined"!=typeof navigator&&/.*QQBrowser/.test(navigator.userAgent);var Ws=!Bs&&!Is&&"undefined"!=typeof globalThis&&globalThis.InputEvent&&"function"==typeof globalThis.InputEvent.prototype.getTargetRanges,Hs={getWindow:function(e){var t=hs.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},findKey:function(e,t){var n=ps.get(t);return n||(n=new Xi,ps.set(t,n)),n},setNewKey:function(e){var t=new Xi;ps.set(e,t);},findPath:function(e,n){for(var r=[],o=n;;){var i=ls.get(o);if(null==i){if(t.Editor.isEditor(o))return r;break}var a=ss.get(o);if(null==a)break;r.unshift(a),o=i;}throw new Error("Unable to find the path for Slate node: "+JSON.stringify(n))},findDocumentOrShadowRoot:function(e){if(e.isDestroyed)return window.document;var t=Hs.toDOMNode(e,e),n=t.getRootNode();return (n instanceof Document||n instanceof ShadowRoot)&&null!=n.getSelection?n:t.ownerDocument},getParentNode:function(e,t){return ls.get(t)||null},getParentsNodes:function(e,t){for(var n=[],r=t;r!==e&&null!=r;){var o=Hs.getParentNode(e,r);if(null==o)break;n.push(o),r=o;}return n},getTopNode:function(e,n){var r=[Hs.findPath(e,n)[0]];return t.Node.get(e,r)},toDOMNode:function(e,n){var r;if(t.Editor.isEditor(n))r=us.get(e);else {var o=Hs.findKey(e,n);r=fs.get(o);}if(!r)throw new Error("Cannot resolve a DOM node from Slate node: "+JSON.stringify(n));return r},hasDOMNode:function(e,t,n){void 0===n&&(n={});var r,o=n.editable,i=void 0!==o&&o,a=Hs.toDOMNode(e,e);try{r=Os(t)?t:t.parentElement;}catch(e){if(!e.message.includes('Permission denied to access property "nodeType"'))throw e}return !!r&&(r.closest("[data-slate-editor]")===a&&(!i||r.isContentEditable||!!r.getAttribute("data-slate-zero-width")))},toDOMRange:function(e,n){var r=n.anchor,o=n.focus,i=t.Range.isBackward(n),a=Hs.toDOMPoint(e,r),s=t.Range.isCollapsed(n)?a:Hs.toDOMPoint(e,o),l=Hs.getWindow(e).document.createRange(),u=Gi(i?s:a,2),c=u[0],f=u[1],d=Gi(i?a:s,2),p=d[0],h=d[1],g=!!(Os(c)?c:c.parentElement).getAttribute("data-slate-zero-width"),v=!!(Os(p)?p:p.parentElement).getAttribute("data-slate-zero-width");return l.setStart(c,g?1:f),l.setEnd(p,v?1:h),l},toDOMPoint:function(e,n){var r,o,i,a=Gi(t.Editor.node(e,n.path),1)[0],s=Hs.toDOMNode(e,a);t.Editor.void(e,{at:n})&&(n={path:n.path,offset:0});var l=Array.from(s.querySelectorAll("[data-slate-string], [data-slate-zero-width]")),u=0;try{for(var c=qi(l),f=c.next();!f.done;f=c.next()){var d=f.value,p=d.childNodes[0];if(null!=p&&null!=p.textContent){var h=p.textContent.length,g=d.getAttribute("data-slate-length"),v=u+(null==g?h:parseInt(g,10));if(n.offset<=v){i=[p,Math.min(h,Math.max(0,n.offset-u))];break}u=v;}}}catch(e){r={error:e};}finally{try{f&&!f.done&&(o=c.return)&&o.call(c);}finally{if(r)throw r.error}}if(!i)throw new Error("Cannot resolve a DOM point from Slate point: "+JSON.stringify(n));return i},toSlateNode:function(e,t){var n=Os(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?cs.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: "+n);return r},findEventRange:function(e,n){"nativeEvent"in n&&(n=n.nativeEvent);var r=n.clientX,o=n.clientY,i=n.target;if(null==r||null==o)throw new Error("Cannot resolve a Slate range from a DOM event: "+n);var a,s=Hs.toSlateNode(e,n.target),l=Hs.findPath(e,s);if(t.Editor.isVoid(e,s)){var u=i.getBoundingClientRect(),c=e.isInline(s)?r-u.left<u.left+u.width-r:o-u.top<u.top+u.height-o,f=t.Editor.point(e,l,{edge:c?"start":"end"}),d=c?t.Editor.before(e,f):t.Editor.after(e,f);if(d)return t.Editor.range(e,d)}var p=this.getWindow(e).document;if(p.caretRangeFromPoint)a=p.caretRangeFromPoint(r,o);else {var h=p.caretPositionFromPoint(r,o);h&&((a=p.createRange()).setStart(h.offsetNode,h.offset),a.setEnd(h.offsetNode,h.offset));}if(!a)throw new Error("Cannot resolve a Slate range from a DOM event: "+n);return Hs.toSlateRange(e,a,{exactMatch:!1,suppressThrow:!1})},toSlateRange:function(e,n,r){var o,i,a,s,l,u=r.exactMatch,c=r.suppressThrow;if((Ts(n)?n.anchorNode:n.startContainer)&&(Ts(n)?(o=n.anchorNode,i=n.anchorOffset,a=n.focusNode,s=n.focusOffset,l=$s&&window.document.activeElement&&window.document.activeElement.shadowRoot?n.anchorNode===n.focusNode&&n.anchorOffset===n.focusOffset:n.isCollapsed):(o=n.startContainer,i=n.startOffset,a=n.endContainer,s=n.endOffset,l=n.collapsed)),null==o||null==a||null==i||null==s)throw new Error("Cannot resolve a Slate range from DOM range: "+n);var f=Hs.toSlatePoint(e,[o,i],{exactMatch:u,suppressThrow:c});if(!f)return null;var d=l?f:Hs.toSlatePoint(e,[a,s],{exactMatch:u,suppressThrow:c});if(!d)return null;var p={anchor:f,focus:d};return t.Range.isExpanded(p)&&t.Range.isForward(p)&&Os(a)&&t.Editor.void(e,{at:p.focus,mode:"highest"})&&(p=t.Editor.unhangRange(e,p,{voids:!0})),p},toSlatePoint:function(e,t,n){var r,o=n.exactMatch,i=n.suppressThrow,a=Gi(o?t:function(e){var t,n=Gi(e,2),r=n[0],o=n[1];if(Os(r)&&r.childNodes.length){var i=o===r.childNodes.length,a=i?o-1:o;for(r=(t=Gi(Ls(r,a,i?"backward":"forward"),2))[0],i=(a=t[1])<o;Os(r)&&r.childNodes.length;){var s=i?r.childNodes.length-1:0;r=Ps(r,s,i?"backward":"forward");}o=i&&null!=r.textContent?r.textContent.length:0;}return [r,o]}(t),2),s=a[0],l=a[1],u=s.parentNode,c=null,f=0;if(u){var d=u.closest('[data-slate-void="true"]'),p=u.closest("[data-slate-leaf]"),h=null;if(p){c=p.closest('[data-slate-node="text"]');var g=Hs.getWindow(e).document.createRange();g.setStart(c,0),g.setEnd(s,l);var y=g.cloneContents();Ji(Ji([],Gi(v.default(y.querySelectorAll("[data-slate-zero-width]")))),Gi(v.default(y.querySelectorAll("[contenteditable=false]")))).forEach((function(e){e.parentNode.removeChild(e);})),f=y.textContent.length,h=c;}else d&&((p=d.querySelector("[data-slate-leaf]"))?(c=p.closest('[data-slate-node="text"]'),f=(h=p).textContent.length,h.querySelectorAll("[data-slate-zero-width]").forEach((function(e){f-=e.textContent.length;}))):f=1);h&&f===h.textContent.length&&(u.hasAttribute("data-slate-zero-width")||_s&&(null===(r=h.textContent)||void 0===r?void 0:r.endsWith("\n")))&&f--;}if(!c){if(i)return null;throw new Error("Cannot resolve a Slate point from DOM point: "+t)}var m=Hs.toSlateNode(e,c);return {path:Hs.findPath(e,m),offset:f}},hasRange:function(e,n){var r=n.anchor,o=n.focus;return t.Editor.hasPath(e,r.path)&&t.Editor.hasPath(e,o.path)},getNodeType:function(e){return t.Element.isElement(e)?e.type:""},checkNodeType:function(e,t){return this.getNodeType(e)===t},getNodesStr:function(e){return e.map((function(e){return t.Node.string(e)})).join("")},getSelectedElems:function(e){var n,r,o=[],i=t.Editor.nodes(e,{universal:!0});try{for(var a=qi(i),s=a.next();!s.done;s=a.next()){var l=Gi(s.value,1)[0];t.Element.isElement(l)&&o.push(l);}}catch(e){n={error:e};}finally{try{s&&!s.done&&(r=a.return)&&r.call(a);}finally{if(n)throw n.error}}return o},getSelectedNodeByType:function(e,n){var r=this,o=Gi(t.Editor.nodes(e,{match:function(e){return r.checkNodeType(e,n)},universal:!0}),1),i=o[0];return null==i?null:i[0]},getSelectedTextNode:function(e){var n=Gi(t.Editor.nodes(e,{match:function(e){return t.Text.isText(e)},universal:!0}),1),r=n[0];return null==r?null:r[0]},isNodeSelected:function(e,n){var r=Gi(t.Editor.nodes(e,{match:function(e){return e===n},universal:!0}),1),o=r[0];return null!=o&&Gi(o,1)[0]===n},isSelectionAtLineEnd:function(e,n){var r=e.selection;return !!r&&(t.Editor.isEnd(e,r.anchor,n)||t.Editor.isEnd(e,r.focus,n))},getTextarea:function(e){var t=Ga.get(e);if(null==t)throw new Error("Cannot find textarea instance by editor");return t},getToolbar:function(e){return Xa.get(e)||null},getHoverbar:function(e){return Za.get(e)||null},normalizeContent:function(e){e.children.forEach((function(t,n){e.normalizeNode([t,[n]]);}));},getLeftLengthOfMaxLength:function(e){var t=e.getConfig(),n=t.maxLength,r=t.onMaxLength;if("number"!=typeof n||n<=0)return 1/0;var o=n-e.getText().replace(/\r|\n|(\r\n)/g,"").length;return o<=0&&r&&r(e),o},cleanExposedTexNodeInSelectionBlock:function(e){var n,r,o,i,a=Hs.getTextarea(e).$textArea,s=null==a?void 0:a[0].childNodes;if(s)try{for(var l=qi(Array.from(s)),u=l.next();!u.done;u=l.next()){var c=u.value;if(3!==c.nodeType)break;c.remove();}}catch(e){n={error:e};}finally{try{u&&!u.done&&(r=l.return)&&r.call(l);}finally{if(n)throw n.error}}var f=t.Editor.nodes(e,{match:function(n){return !(!t.Element.isElement(n)||e.isInline(n))},universal:!0});try{for(var d=qi(f),p=d.next();!p.done;p=d.next()){var h=p.value;if(null!=h){var g=h[0];Ds(Hs.toDOMNode(e,g),(function(e,t){var n=y.default(t);n.attr("data-slate-string")||n.attr("data-slate-zero-width")||n.attr("data-w-e-reserve")||t.removeChild(e);}));}}}catch(e){o={error:e};}finally{try{p&&!p.done&&(i=d.return)&&i.call(d);}finally{if(o)throw o.error}}},isLastNode:function(e,t){var n=e.children||[];return n[n.length-1]===t},genEmptyParagraph:function(){return {type:"paragraph",children:[{text:""}]}},isSelectedVoidNode:function(e){var n,r,o=t.Editor.nodes(e,{match:function(t){return e.isVoid(t)}}),i=0;try{for(var a=qi(o),s=a.next();!s.done;s=a.next()){s.value;i++;}}catch(e){n={error:e};}finally{try{s&&!s.done&&(r=a.return)&&r.call(a);}finally{if(n)throw n.error}}return i>0},isSelectedEmptyParagraph:function(e){var n=e.selection;if(null==n)return !1;if(t.Range.isExpanded(n))return !1;var r=Hs.getSelectedNodeByType(e,"paragraph");if(null===r)return !1;var o=r.children;return 1===o.length&&(""===o[0].text||void 0)},isEmptyPath:function(e,n){var r=t.Editor.node(e,n);if(null==r)return !1;var o=Gi(r,1)[0].children;if(1===o.length&&""===o[0].text)return !0;return !1}},Vs=1,zs={};var Us={};var Ks=Zt.filter,qs=qo("filter");_n({target:"Array",proto:!0,forced:!qs},{filter:function(e){return Ks(this,e,arguments.length>1?arguments[1]:void 0)}});var Gs="\t\n\v\f\r                \u2028\u2029\ufeff",Js=W("".replace),Ys="["+Gs+"]",Xs=RegExp("^"+Ys+Ys+"*"),Qs=RegExp(Ys+Ys+"*$"),Zs=function(e){return function(t){var n=er(V(t));return 1&e&&(n=Js(n,Xs,"")),2&e&&(n=Js(n,Qs,"")),n}},el={start:Zs(1),end:Zs(2),trim:Zs(3)},tl=ht.PROPER,nl=el.trim;_n({target:"String",proto:!0,forced:function(e){return se((function(){return !!Gs[e]()||"​…᠎"!=="​…᠎"[e]()||tl&&Gs[e].name!==e}))}("trim")},{trim:function(){return nl(this)}});var rl=[];var ol={};function il(e,t,n){var r=n.isInline(e)?"span":"div";return "<"+r+">"+t+"</"+r+">"}function al(e,n){var r=e.type,o=void 0===r?"":r,i=e.children,a=void 0===i?[]:i,s=t.Editor.isVoid(n,e),l="";s||(l=a.map((function(e){return Ku(e,n)})).join(""));var u=function(e){return ol[e]||il}(o),c=u(e,l,n),f="";if(f="string"==typeof c?c:c.html||"",s||rl.forEach((function(t){return f=t(e,f)})),"string"==typeof c)return f;var d=c.prefix,p=void 0===d?"":d,h=c.suffix,g=void 0===h?"":h;return p&&(f=p+f),g&&(f+=g),f}var sl,ll,ul,cl,fl=P.Promise,dl=he("species"),pl=function(e){var t=ee(e),n=Ve.f;ye&&t&&!t[dl]&&n(t,dl,{configurable:!0,get:function(){return this}});},hl=P.TypeError,gl=he("species"),vl=function(e,t){var n,r=Oe(e).constructor;return void 0===r||null==(n=Oe(r)[gl])?t:function(e){if(qt(e))return e;throw hl(Re(e)+" is not a constructor")}(n)},yl=W([].slice),ml=/(?:ipad|iphone|ipod).*applewebkit/i.test(te),bl="process"==mt(P.process),wl=P.setImmediate,xl=P.clearImmediate,El=P.process,Sl=P.Dispatch,kl=P.Function,Ol=P.MessageChannel,Cl=P.String,Tl=0,Nl={},Ml="onreadystatechange";try{sl=P.location;}catch(e){}var Ll=function(e){if(q(Nl,e)){var t=Nl[e];delete Nl[e],t();}},Pl=function(e){return function(){Ll(e);}},Rl=function(e){Ll(e.data);},Dl=function(e){P.postMessage(Cl(e),sl.protocol+"//"+sl.host);};wl&&xl||(wl=function(e){var t=yl(arguments,1);return Nl[++Tl]=function(){wi(Q(e)?e:kl(e),void 0,t);},ll(Tl),Tl},xl=function(e){delete Nl[e];},bl?ll=function(e){El.nextTick(Pl(e));}:Sl&&Sl.now?ll=function(e){Sl.now(Pl(e));}:Ol&&!ml?(cl=(ul=new Ol).port2,ul.port1.onmessage=Rl,ll=Mt(cl.postMessage,cl)):P.addEventListener&&Q(P.postMessage)&&!P.importScripts&&sl&&"file:"!==sl.protocol&&!se(Dl)?(ll=Dl,P.addEventListener("message",Rl,!1)):ll=Ml in xe("script")?function(e){fr.appendChild(xe("script")).onreadystatechange=function(){fr.removeChild(this),Ll(e);};}:function(e){setTimeout(Pl(e),0);});var jl,Al,_l,Fl,Il,Bl,$l,Wl,Hl={set:wl,clear:xl},Vl=/ipad|iphone|ipod/i.test(te)&&void 0!==P.Pebble,zl=/web0s(?!.*chrome)/i.test(te),Ul=dn.f,Kl=Hl.set,ql=P.MutationObserver||P.WebKitMutationObserver,Gl=P.document,Jl=P.process,Yl=P.Promise,Xl=Ul(P,"queueMicrotask"),Ql=Xl&&Xl.value;Ql||(jl=function(){var e,t;for(bl&&(e=Jl.domain)&&e.exit();Al;){t=Al.fn,Al=Al.next;try{t();}catch(e){throw Al?Fl():_l=void 0,e}}_l=void 0,e&&e.enter();},ml||bl||zl||!ql||!Gl?!Vl&&Yl&&Yl.resolve?(($l=Yl.resolve(void 0)).constructor=Yl,Wl=Mt($l.then,$l),Fl=function(){Wl(jl);}):bl?Fl=function(){Jl.nextTick(jl);}:(Kl=Mt(Kl,P),Fl=function(){Kl(jl);}):(Il=!0,Bl=Gl.createTextNode(""),new ql(jl).observe(Bl,{characterData:!0}),Fl=function(){Bl.data=Il=!Il;}));var Zl,eu,tu,nu,ru=Ql||function(e){var t={fn:e,next:void 0};_l&&(_l.next=t),Al||(Al=t,Fl()),_l=t;},ou=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r;})),this.resolve=je(t),this.reject=je(n);},iu={f:function(e){return new ou(e)}},au=function(e){try{return {error:!1,value:e()}}catch(e){return {error:!0,value:e}}},su="object"==typeof window,lu=Hl.set,uu=he("species"),cu="Promise",fu=ct.getterFor(cu),du=ct.set,pu=ct.getterFor(cu),hu=fl&&fl.prototype,gu=fl,vu=hu,yu=P.TypeError,mu=P.document,bu=P.process,wu=iu.f,xu=wu,Eu=!!(mu&&mu.createEvent&&P.dispatchEvent),Su=Q(P.PromiseRejectionEvent),ku="unhandledrejection",Ou=!1,Cu=jn(cu,(function(){var e=Ye(gu),t=e!==String(gu);if(!t&&66===ae)return !0;if(ae>=51&&/native code/.test(e))return !1;var n=new gu((function(e){e(1);})),r=function(e){e((function(){}),(function(){}));};return (n.constructor={})[uu]=r,!(Ou=n.then((function(){}))instanceof r)||!t&&su&&!Su})),Tu=Cu||!Gr((function(e){gu.all(e).catch((function(){}));})),Nu=function(e){var t;return !(!me(e)||!Q(t=e.then))&&t},Mu=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;ru((function(){for(var r=e.value,o=1==e.state,i=0;n.length>i;){var a,s,l,u=n[i++],c=o?u.ok:u.fail,f=u.resolve,d=u.reject,p=u.domain;try{c?(o||(2===e.rejection&&Du(e),e.rejection=1),!0===c?a=r:(p&&p.enter(),a=c(r),p&&(p.exit(),l=!0)),a===u.promise?d(yu("Promise-chain cycle")):(s=Nu(a))?Te(s,a,f,d):f(a)):d(r);}catch(e){p&&!l&&p.exit(),d(e);}}e.reactions=[],e.notified=!1,t&&!e.rejection&&Pu(e);}));}},Lu=function(e,t,n){var r,o;Eu?((r=mu.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),P.dispatchEvent(r)):r={promise:t,reason:n},!Su&&(o=P["on"+e])?o(r):e===ku&&function(e,t){var n=P.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t));}("Unhandled promise rejection",n);},Pu=function(e){Te(lu,P,(function(){var t,n=e.facade,r=e.value;if(Ru(e)&&(t=au((function(){bl?bu.emit("unhandledRejection",r,n):Lu(ku,n,r);})),e.rejection=bl||Ru(e)?2:1,t.error))throw t.value}));},Ru=function(e){return 1!==e.rejection&&!e.parent},Du=function(e){Te(lu,P,(function(){var t=e.facade;bl?bu.emit("rejectionHandled",t):Lu("rejectionhandled",t,e.value);}));},ju=function(e,t,n){return function(r){e(t,r,n);}},Au=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,Mu(e,!0));},_u=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw yu("Promise can't be resolved itself");var r=Nu(t);r?ru((function(){var n={done:!1};try{Te(r,t,ju(_u,n,e),ju(Au,n,e));}catch(t){Au(n,t,e);}})):(e.value=t,e.state=1,Mu(e,!1));}catch(t){Au({done:!1},t,e);}}};if(Cu&&(vu=(gu=function(e){ba(this,vu),je(e),Te(Zl,this);var t=fu(this);try{e(ju(_u,t),ju(Au,t));}catch(e){Au(t,e);}}).prototype,(Zl=function(e){du(this,{type:cu,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0});}).prototype=na(vu,{then:function(e,t){var n=pu(this),r=n.reactions,o=wu(vl(this,gu));return o.ok=!Q(e)||e,o.fail=Q(t)&&t,o.domain=bl?bu.domain:void 0,n.parent=!0,r[r.length]=o,0!=n.state&&Mu(n,!1),o.promise},catch:function(e){return this.then(void 0,e)}}),eu=function(){var e=new Zl,t=fu(e);this.promise=e,this.resolve=ju(_u,t),this.reject=ju(Au,t);},iu.f=wu=function(e){return e===gu||e===tu?new eu(e):xu(e)},Q(fl)&&hu!==Object.prototype)){nu=hu.then,Ou||(gt(hu,"then",(function(e,t){var n=this;return new gu((function(e,t){Te(nu,n,e,t);})).then(e,t)}),{unsafe:!0}),gt(hu,"catch",vu.catch,{unsafe:!0}));try{delete hu.constructor;}catch(e){}xo&&xo(hu,vu);}_n({global:!0,wrap:!0,forced:Cu},{Promise:gu}),vo(gu,cu,!1),pl(cu),tu=ee(cu),_n({target:cu,stat:!0,forced:Cu},{reject:function(e){var t=wu(this);return Te(t.reject,void 0,e),t.promise}}),_n({target:cu,stat:!0,forced:Cu},{resolve:function(e){return function(e,t){if(Oe(e),me(t)&&t.constructor===e)return t;var n=iu.f(e);return (0, n.resolve)(t),n.promise}(this,e)}}),_n({target:cu,stat:!0,forced:Tu},{all:function(e){var t=this,n=wu(t),r=n.resolve,o=n.reject,i=au((function(){var n=je(t.resolve),i=[],a=0,s=1;ya(e,(function(e){var l=a++,u=!1;s++,Te(n,t,e).then((function(e){u||(u=!0,i[l]=e,--s||r(i));}),o);})),--s||r(i);}));return i.error&&o(i.value),n.promise},race:function(e){var t=this,n=wu(t),r=n.reject,o=au((function(){var o=je(t.resolve);ya(e,(function(e){Te(o,t,e).then(n.resolve,r);}));}));return o.error&&r(o.value),n.promise}});var Fu=Zo.UNSUPPORTED_Y,Iu=4294967295,Bu=Math.min,$u=[].push,Wu=W(/./.exec),Hu=W($u),Vu=W("".slice),zu=!se((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));function Uu(e){Promise.resolve().then(e);}function Ku(e,n){return t.Element.isElement(e)?al(e,n):function(e,t){var n=e.text;if(null==n)throw new Error("Current node is not slate Text "+JSON.stringify(e));var r=n;r=function(e){return e.replace(/ {2}/g," &nbsp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/®/g,"&reg;").replace(/©/g,"&copy;").replace(/™/g,"&trade;")}(r);var o=Hs.getParentsNodes(t,e).some((function(e){return "pre"===Hs.getNodeType(e)}));if(o||(r=r.replace(/\r\n|\r|\n/g,"<br>")),o&&(r=r.replace(/&nbsp;/g," ")),""===r){var i=Hs.getParentNode(null,e);if(!i||0!==i.children.length)return r;r="<br>";}return rl.forEach((function(t){return r=t(e,r)})),r}(e,n)}function qu(e){return "w-e-element-"+e}Si("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=er(V(this)),o=void 0===n?Iu:n>>>0;if(0===o)return [];if(void 0===e)return [r];if(!Sr(e))return Te(t,r,e,o);for(var i,a,s,l=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),c=0,f=new RegExp(e.source,u+"g");(i=Te(gi,f,r))&&!((a=f.lastIndex)>c&&(Hu(l,Vu(r,c,i.index)),i.length>1&&i.index<r.length&&wi($u,l,ia(i,1)),s=i[0].length,c=a,l.length>=o));)f.lastIndex===i.index&&f.lastIndex++;return c===r.length?!s&&Wu(f,"")||Hu(l,""):Hu(l,Vu(r,c)),l.length>o?ia(l,0,o):l}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:Te(t,this,e,n)}:t,[function(t,n){var o=V(this),i=null==t?void 0:Ae(t,e);return i?Te(i,t,o,n):Te(r,er(o),t,n)},function(e,o){var i=Oe(this),a=er(e),s=n(r,i,a,o,r!==t);if(s.done)return s.value;var l=vl(i,RegExp),u=i.unicode,c=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(Fu?"g":"y"),f=new l(Fu?"^(?:"+i.source+")":i,c),d=void 0===o?Iu:o>>>0;if(0===d)return [];if(0===a.length)return null===ji(f,a)?[a]:[];for(var p=0,h=0,g=[];h<a.length;){f.lastIndex=Fu?0:h;var v,y=ji(f,Fu?Vu(a,h):a);if(null===y||(v=Bu(Ft(f.lastIndex+(Fu?h:0)),a.length))===p)h=Oi(a,h,u);else {if(Hu(g,Vu(a,p,h)),g.length===d)return g;for(var m=1;m<=y.length-1;m++)if(Hu(g,y[m]),g.length===d)return g;h=p=v;}}return Hu(g,Vu(a,p)),g}]}),!zu,Fu);var Gu=function(e,t){var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Ju=function(e,t,n){var r=Hs.toDOMRange(e,t).getBoundingClientRect(),o=Hs.toDOMRange(e,n).getBoundingClientRect();return Gu(r,o)&&Gu(o,r)},Yu=["span","b","strong","i","em","s","strike","u","font","sub","sup"],Xu=[];var Qu=[];var Zu={};var ec=Ve.f,tc=Sn.f,nc=ct.enforce,rc=he("match"),oc=P.RegExp,ic=oc.prototype,ac=P.SyntaxError,sc=W(tr),lc=W(ic.exec),uc=W("".charAt),cc=W("".replace),fc=W("".indexOf),dc=W("".slice),pc=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,hc=/a/g,gc=/a/g,vc=new oc(hc)!==hc,yc=Zo.MISSED_STICKY,mc=Zo.UNSUPPORTED_Y,bc=ye&&(!vc||yc||ti||ri||se((function(){return gc[rc]=!1,oc(hc)!=hc||oc(gc)==gc||"/a/i"!=oc(hc,"i")})));if(jn("RegExp",bc)){for(var wc=function(e,t){var n,r,o,i,a,s,l=Ne(ic,this),u=Sr(e),c=void 0===t,f=[],d=e;if(!l&&u&&c&&e.constructor===wc)return e;if((u||Ne(ic,e))&&(e=e.source,c&&(t="flags"in d?d.flags:sc(d))),e=void 0===e?"":er(e),t=void 0===t?"":er(t),d=e,ti&&"dotAll"in hc&&(r=!!t&&fc(t,"s")>-1)&&(t=cc(t,/s/g,"")),n=t,yc&&"sticky"in hc&&(o=!!t&&fc(t,"y")>-1)&&mc&&(t=cc(t,/y/g,"")),ri&&(i=function(e){for(var t,n=e.length,r=0,o="",i=[],a={},s=!1,l=!1,u=0,c="";r<=n;r++){if("\\"===(t=uc(e,r)))t+=uc(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:lc(pc,dc(e,r+1))&&(r+=2,l=!0),o+=t,u++;continue;case">"===t&&l:if(""===c||q(a,c))throw new ac("Invalid capture group name");a[c]=!0,i[i.length]=[c,u],l=!1,c="";continue}l?c+=t:o+=t;}return [o,i]}(e),e=i[0],f=i[1]),a=wa(oc(e,t),l?this:ic,wc),(r||o||f.length)&&(s=nc(a),r&&(s.dotAll=!0,s.raw=wc(function(e){for(var t,n=e.length,r=0,o="",i=!1;r<=n;r++)"\\"!==(t=uc(e,r))?i||"."!==t?("["===t?i=!0:"]"===t&&(i=!1),o+=t):o+="[\\s\\S]":o+=t+uc(e,++r);return o}(e),n)),o&&(s.sticky=!0),f.length&&(s.groups=f)),e!==d)try{Ue(a,"source",""===d?"(?:)":d);}catch(e){}return a},xc=function(e){e in wc||ec(wc,e,{configurable:!0,get:function(){return oc[e]},set:function(t){oc[e]=t;}});},Ec=tc(oc),Sc=0;Ec.length>Sc;)xc(Ec[Sc++]);ic.constructor=wc,wc.prototype=ic,gt(P,"RegExp",wc);}pl("RegExp");var kc=new RegExp(String.fromCharCode(160),"g");function Oc(e){return e.replace(kc," ")}function Cc(e,n){var r=e.length;if(r){var o=e[r-1];if(t.Text.isText(o)){var i=Object.keys(o);if(1===i.length&&"text"===i[0])return o.text=o.text+n,!0}}return !1}function Tc(e,t,n){return {type:"paragraph",children:[{text:y.default(e).text().replace(/\s+/gm," ")}]}}function Nc(e,n){var r=function(e,t){var n=[];if(null!=e.attr("data-w-e-is-void"))return n;var r=e[0].childNodes;return 1===r.length&&"BR"===r[0].nodeName?(n.push({text:""}),n):(r.forEach((function(e){if(e.nodeType!==Ss.ELEMENT_NODE)if(e.nodeType!==Ss.TEXT_NODE);else {var r=e.textContent||"";if(""===r.trim()&&r.indexOf("\n")>=0)return;r&&(r=Oc(r),Cc(n,r)||n.push({text:r}));}else {if("BR"===e.nodeName)return void(Cc(n,"\n")||n.push({text:"\n"}));var o=Lc(y.default(e),t);Array.isArray(o)?o.forEach((function(e){return n.push(e)})):n.push(o);}})),n)}(e,n),o=function(e){for(var t in Zu)if(e[0].matches(t))return Zu[t];return Tc}(e),i=o(e[0],r,n);return Array.isArray(i)||(i=[i]),i.forEach((function(o){t.Editor.isVoid(n,o)||(0===r.length&&(o.children=[{text:e.text().replace(/\s+/gm," ")}]),Qu.forEach((function(t){o=t(e[0],o,n);})));})),i}function Mc(e,t){0===e.parents("pre").length&&(e[0].innerHTML=e[0].innerHTML.replace(/\s+/gm," ").replace(/<br>/g,"\n"));var n=e[0].textContent||"";n=function(e){return e.replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&reg;/g,"®").replace(/&copy;/g,"©").replace(/&trade;/g,"™").replace(/&quot;/g,'"')}(n);var r={text:n=Oc(n)};return Qu.forEach((function(n){r=n(e[0],r,t);})),r}function Lc(e,t){Xu.forEach((function(t){var n=t.selector,r=t.preParseHtml;e[0].matches(n)&&(e=y.default(r(e[0])));}));var n=js(e);return "span"===n?e.attr("data-w-e-type")?Nc(e,t):Mc(e,t):"code"===n?"pre"===js(e.parent())?Nc(e,t):Mc(e,t):Yu.includes(n)?Mc(e,t):Nc(e,t)}function Pc(e,t,n){var r=y.default(n);return !!r.attr(t)||(r.attr(t,"true"),e.on("destroyed",(function(){r.removeAttr(t);})),!1)}function Rc(e,t){void 0===t&&(t="");var n=[];""===t&&(t="<p><br></p>"),0!==t.indexOf("<")&&(t=t.split(/\n/).map((function(e){return "<p>"+e+"</p>"})).join(""));var r=y.default("<div>"+t+"</div>");return Array.from(r.children()).forEach((function(t){var r=Lc(y.default(t),e);Array.isArray(r)?r.forEach((function(e){return n.push(e)})):n.push(r);})),n}var Dc=Ve.f,jc=pa.fastKey,Ac=ct.set,_c=ct.getterFor,Fc={getConstructor:function(e,t,n,r){var o=e((function(e,o){ba(e,i),Ac(e,{type:t,index:yr(null),first:void 0,last:void 0,size:0}),ye||(e.size=0),null!=o&&ya(o,e[r],{that:e,AS_ENTRIES:n});})),i=o.prototype,a=_c(t),s=function(e,t,n){var r,o,i=a(e),s=l(e,t);return s?s.value=n:(i.last=s={index:o=jc(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=s),r&&(r.next=s),ye?i.size++:e.size++,"F"!==o&&(i.index[o]=s)),e},l=function(e,t){var n,r=a(e),o=jc(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return na(i,{clear:function(){for(var e=a(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,ye?e.size=0:this.size=0;},delete:function(e){var t=this,n=a(t),r=l(t,e);if(r){var o=r.next,i=r.previous;delete n.index[r.index],r.removed=!0,i&&(i.next=o),o&&(o.previous=i),n.first==r&&(n.first=o),n.last==r&&(n.last=i),ye?n.size--:t.size--;}return !!r},forEach:function(e){for(var t,n=a(this),r=Mt(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous;},has:function(e){return !!l(this,e)}}),na(i,n?{get:function(e){var t=l(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),ye&&Dc(i,"size",{get:function(){return a(this).size}}),o},setStrong:function(e,t,n){var r=t+" Iterator",o=_c(t),i=_c(r);Po(e,t,(function(e,t){Ac(this,{type:r,target:e,state:o(e),kind:t,last:void 0});}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),pl(t);}};xa("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Fc);var Ic=new Set(["doctype","!doctype","meta","script","style","link","frame","iframe","title","svg"]);function Bc(e,n){e.isInline(n)?(e.insertNode(n),"link"===n.type&&e.insertFragment([{text:""}])):t.Transforms.insertNodes(e,n,{mode:"highest"});}var $c=function(e){var n=e,r=n.onChange,o=n.insertText,i=n.apply,a=n.deleteBackward;return n.insertText=function(e){n.getConfig().readOnly||o(e);},n.apply=function(e){var r,o,a,s,l,u,c,f,d=[];switch(e.type){case"insert_text":case"remove_text":case"set_node":try{for(var p=qi(t.Editor.levels(n,{at:e.path})),h=p.next();!h.done;h=p.next()){var g=Gi(h.value,2),v=g[0],y=g[1],m=Hs.findKey(n,v);d.push([y,m]);}}catch(e){r={error:e};}finally{try{h&&!h.done&&(o=p.return)&&o.call(p);}finally{if(r)throw r.error}}break;case"insert_node":case"remove_node":case"merge_node":case"split_node":try{for(var b=qi(t.Editor.levels(n,{at:t.Path.parent(e.path)})),w=b.next();!w.done;w=b.next()){var x=Gi(w.value,2);v=x[0],y=x[1],m=Hs.findKey(n,v);d.push([y,m]);}}catch(e){a={error:e};}finally{try{w&&!w.done&&(s=b.return)&&s.call(b);}finally{if(a)throw a.error}}break;case"move_node":try{for(var E=qi(t.Editor.levels(n,{at:t.Path.common(t.Path.parent(e.path),t.Path.parent(e.newPath))})),S=E.next();!S.done;S=E.next()){var k=Gi(S.value,2);v=k[0],y=k[1],m=Hs.findKey(n,v);d.push([y,m]);}}catch(e){l={error:e};}finally{try{S&&!S.done&&(u=E.return)&&u.call(E);}finally{if(l)throw l.error}}}i(e);try{for(var O=qi(d),C=O.next();!C.done;C=O.next()){var T=Gi(C.value,2);y=T[0],m=T[1],v=Gi(t.Editor.node(n,y),1)[0];ps.set(v,m);}}catch(e){c={error:e};}finally{try{C&&!C.done&&(f=O.return)&&f.call(O);}finally{if(c)throw c.error}}},n.deleteBackward=function(r){if("line"!==r)return a(r);if(e.selection&&t.Range.isCollapsed(e.selection)){var o=t.Editor.above(e,{match:function(n){return t.Editor.isBlock(e,n)},at:e.selection});if(o){var i=Gi(o,2)[1],s=t.Editor.range(e,i,e.selection.anchor),l=function(e,n){var r=t.Editor.range(e,t.Range.end(n)),o=Array.from(t.Editor.positions(e,{at:n})),i=0,a=o.length,s=Math.floor(a/2);if(Ju(e,t.Editor.range(e,o[i]),r))return t.Editor.range(e,o[i],r);if(o.length<2)return t.Editor.range(e,o[o.length-1],r);for(;s!==o.length&&s!==i;)Ju(e,t.Editor.range(e,o[s]),r)?a=s:i=s,s=Math.floor((i+a)/2);return t.Editor.range(e,o[a],r)}(n,s);t.Range.isCollapsed(l)||t.Transforms.delete(e,{at:l});}}},n.onChange=function(){var e=n.selection;null!=e&&vs.set(n,e),n.emit("change"),r();},n.handleTab=function(){n.insertText(" ");},n.getHtml=function(){var e=n.children;return (void 0===e?[]:e).map((function(e){return Ku(e,n)})).join("")},n.getText=function(){var e=n.children;return (void 0===e?[]:e).map((function(e){return t.Node.string(e)})).join("\n")},n.getSelectionText=function(){var r=n.selection;return null==r?"":t.Editor.string(e,r)},n.getElemsByType=function(e,r){var o,i;void 0===r&&(r=!1);var a=[],s=t.Editor.nodes(n,{at:[],universal:!0});try{for(var l=qi(s),u=l.next();!u.done;u=l.next()){var c=Gi(u.value,1)[0];if(t.Element.isElement(c))if(r?c.type.indexOf(e)>=0:c.type===e){var f=qu(Hs.findKey(n,c).id);a.push(Ki(Ki({},c),{id:f}));}}}catch(e){o={error:e};}finally{try{u&&!u.done&&(i=l.return)&&i.call(l);}finally{if(o)throw o.error}}return a},n.getElemsByTypePrefix=function(e){return n.getElemsByType(e,!0)},n.isEmpty=function(){var e=n.children,r=void 0===e?[]:e;if(r.length>1)return !1;var o=r[0];if(null==o)return !0;if(t.Element.isElement(o)&&"paragraph"===o.type){var i=o.children,a=void 0===i?[]:i;if(a.length>1)return !1;var s=a[0];if(null==s)return !0;if(t.Text.isText(s)&&""===s.text)return !0}return !1},n.clear=function(){t.Transforms.delete(n,{at:{anchor:t.Editor.start(n,[]),focus:t.Editor.end(n,[])}}),0===n.children.length&&t.Transforms.insertNodes(n,[{type:"paragraph",children:[{text:""}]}]);},n.getParentNode=function(e){return Hs.getParentNode(n,e)},n.dangerouslyInsertHtml=function(e,r){if(void 0===e&&(e=""),void 0===r&&(r=!1),e){var o=document.createElement("div");o.innerHTML=e;var i=Array.from(o.childNodes);if(i=i.filter((function(e){var t=e.nodeType,n=e.nodeName;return t===Ss.TEXT_NODE||t===Ss.ELEMENT_NODE&&!Ic.has(n.toLowerCase())})),0!==i.length){var a=n.selection;if(null!=a){var s=null;if(Hs.isSelectedEmptyParagraph(n)&&!r)s=[a.focus.path[0]];o.setAttribute("hidden","true"),document.body.appendChild(o);var l=0;i.forEach((function(e){var t=e.nodeType,r=e.nodeName,o=e.textContent,i=void 0===o?"":o;if(t!==Ss.TEXT_NODE)if("BR"!==r){var a=e,s=!1;if(Yu.includes(r.toLowerCase()))s=!0;else for(var u in Zu)if(a.matches(u)){s=!0;break}if(s){var c=Lc(y.default(a),n);return Array.isArray(c)?(c.forEach((function(e){return Bc(n,e)})),l++):(Bc(n,c),l++),void(Hs.isSelectedVoidNode(n)&&n.move(1))}var f=window.getComputedStyle(a).display;Hs.isSelectedEmptyParagraph(n)||f.indexOf("inline")<0&&n.insertBreak(),n.dangerouslyInsertHtml(a.innerHTML,!0);}else n.insertText("\n");else {if(!i||!i.trim())return;n.insertNode({text:i});}})),l&&s&&Hs.isEmptyPath(n,s)&&t.Transforms.removeNodes(n,{at:s}),o.remove();}}}},n.setHtml=function(e){void 0===e&&(e="");var r=n.isDisabled(),o=n.isFocused(),i=JSON.stringify(n.selection);n.enable(),n.focus(),n.clear();var a=Rc(n,e);if(t.Transforms.insertFragment(n,a),o||(n.deselect(),n.blur()),r&&(n.deselect(),n.disable()),n.isFocused())try{n.select(JSON.parse(i));}catch(e){n.select(t.Editor.start(n,[]));}},n},Wc=function(e){var n=e,r=n.insertText;return n.insertFragment,n.setFragmentData=function(e){var r=n.selection;if(r){var o=Gi(t.Range.edges(r),2),i=o[0],a=o[1],s=t.Editor.void(n,{at:i.path}),l=t.Editor.void(n,{at:a.path});if(!t.Range.isCollapsed(r)||s){var u=Hs.toDOMRange(n,r),c=u.cloneContents(),f=c.childNodes[0];if(c.childNodes.forEach((function(e){e.textContent&&""!==e.textContent.trim()&&(f=e);})),l){var d=Gi(l,1)[0],p=u.cloneRange(),h=Hs.toDOMNode(n,d);p.setEndAfter(h),c=p.cloneContents();}if(s&&(f=c.querySelector("[data-slate-spacer]")),Array.from(c.querySelectorAll("[data-slate-zero-width]")).forEach((function(e){var t="n"===e.getAttribute("data-slate-zero-width");e.textContent=t?"\n":"";})),Ns(f)){var g=f.ownerDocument.createElement("span");g.style.whiteSpace="pre",g.appendChild(f),c.appendChild(g),f=g;}var v=n.getFragment(),y=JSON.stringify(v),m=window.btoa(encodeURIComponent(y));f.setAttribute("data-slate-fragment",m),e.setData("application/x-slate-fragment",m);var b=c.ownerDocument.createElement("div");return b.appendChild(c),b.setAttribute("hidden","true"),c.ownerDocument.body.appendChild(b),e.setData("text/html",b.innerHTML),e.setData("text/plain",Rs(b)),c.ownerDocument.body.removeChild(b),e}}},n.insertData=function(e){var o,i,a=e.getData("application/x-slate-fragment");if(a){var s=decodeURIComponent(window.atob(a)),l=JSON.parse(s);n.insertFragment(l);}else {var u=e.getData("text/plain"),c=e.getData("text/html");if(c)n.dangerouslyInsertHtml(c);else if(u){var f=u.split(/\r\n|\r|\n/),d=!1;try{for(var p=qi(f),h=p.next();!h.done;h=p.next()){var g=h.value;d&&t.Transforms.splitNodes(n,{always:!0}),r(g),d=!0;}}catch(e){o={error:e};}finally{try{h&&!h.done&&(i=p.return)&&i.call(p);}finally{if(o)throw o.error}}}else;}},n},Hc=function(e){return null!=e},Vc={object:!0,function:!0,undefined:!0},zc=function(e){if(!function(e){return !!Hc(e)&&hasOwnProperty.call(Vc,typeof e)}(e))return !1;try{return !!e.constructor&&e.constructor.prototype===e}catch(e){return !1}},Uc=/^\s*class[\s{/}]/,Kc=Function.prototype.toString,qc=function(e){return !!function(e){if("function"!=typeof e)return !1;if(!hasOwnProperty.call(e,"length"))return !1;try{if("number"!=typeof e.length)return !1;if("function"!=typeof e.call)return !1;if("function"!=typeof e.apply)return !1}catch(e){return !1}return !zc(e)}(e)&&!Uc.test(Kc.call(e))},Gc=function(e){return null!=e},Jc=Object.keys,Yc=function(){try{return Object.keys("primitive"),!0}catch(e){return !1}}()?Object.keys:function(e){return Jc(Gc(e)?Object(e):e)},Xc=function(e){if(!Gc(e))throw new TypeError("Cannot use null or undefined");return e},Qc=Math.max,Zc=function(){var e,t=Object.assign;return "function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}()?Object.assign:function(e,t){var n,r,o,i=Qc(arguments.length,2);for(e=Object(Xc(e)),o=function(r){try{e[r]=t[r];}catch(e){n||(n=e);}},r=1;r<i;++r)Yc(t=arguments[r]).forEach(o);if(void 0!==n)throw n;return e},ef=Array.prototype.forEach,tf=Object.create,nf=function(e,t){var n;for(n in e)t[n]=e[n];},rf=function(e){var t=tf(null);return ef.call(arguments,(function(e){Gc(e)&&nf(Object(e),t);})),t},of="razdwatrzy",af=String.prototype.indexOf,sf="function"==typeof of.contains&&!0===of.contains("dwa")&&!1===of.contains("foo")?String.prototype.contains:function(e){return af.call(this,e,arguments[1])>-1},lf=T((function(e){var t=e.exports=function(e,t){var n,r,o,i,a;return arguments.length<2||"string"!=typeof e?(i=t,t=e,e=null):i=arguments[2],Hc(e)?(n=sf.call(e,"c"),r=sf.call(e,"e"),o=sf.call(e,"w")):(n=o=!0,r=!1),a={value:t,configurable:n,enumerable:r,writable:o},i?Zc(rf(i),a):a};t.gs=function(e,t,n){var r,o,i,a;return "string"!=typeof e?(i=n,n=t,t=e,e=null):i=arguments[3],Hc(t)?qc(t)?Hc(n)?qc(n)||(i=n,n=void 0):n=void 0:(i=t,t=n=void 0):t=void 0,Hc(e)?(r=sf.call(e,"c"),o=sf.call(e,"e")):(r=!0,o=!1),a={get:t,set:n,configurable:r,enumerable:o},i?Zc(rf(i),a):a};})),uf=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},cf=T((function(e,t){var n,r,o,i,a,s,l,u=Function.prototype.apply,c=Function.prototype.call,f=Object.create,d=Object.defineProperty,p=Object.defineProperties,h=Object.prototype.hasOwnProperty,g={configurable:!0,enumerable:!1,writable:!0};n=function(e,t){var n;return uf(t),h.call(this,"__ee__")?n=this.__ee__:(n=g.value=f(null),d(this,"__ee__",g),g.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},r=function(e,t){var r,i;return uf(t),i=this,n.call(this,e,r=function(){o.call(i,e,r),u.call(t,this,arguments);}),r.__eeOnceListener__=t,this},o=function(e,t){var n,r,o,i;if(uf(t),!h.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(r=n[e]))for(i=0;o=r[i];++i)o!==t&&o.__eeOnceListener__!==t||(2===r.length?n[e]=r[i?0:1]:r.splice(i,1));else r!==t&&r.__eeOnceListener__!==t||delete n[e];return this},i=function(e){var t,n,r,o,i;if(h.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];for(o=o.slice(),t=0;r=o[t];++t)u.call(r,this,i);}else switch(arguments.length){case 1:c.call(o,this);break;case 2:c.call(o,this,arguments[1]);break;case 3:c.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,i=new Array(n-1),t=1;t<n;++t)i[t-1]=arguments[t];u.call(o,this,i);}},a={on:n,once:r,off:o,emit:i},s={on:lf(n),once:lf(r),off:lf(o),emit:lf(i)},l=p({},s),e.exports=t=function(e){return null==e?f(l):p(Object(e),s)},t.methods=a;}));function ff(e){var t=ys.get(e);return null==t&&(t=cf(),ys.set(e,t)),t}var df=new WeakMap;function pf(e,t){var n=df.get(e);null==n&&(n=new Set,df.set(e,n)),n.add(t);}function hf(e){return df.get(e)||new Set}function gf(e){df.set(e,new Set);}function vf(e){var t=Hs.getTextarea(e).$textAreaContainer,n=t.width(),r=t.height(),o=t.offset();return {top:o.top,left:o.left,width:n,height:r}}function yf(e){var t={top:"0",left:"0"},n=e.selection;if(null==n)return t;var r=vf(e);if(null==r)return t;var o=r.top,i=r.left,a=r.width,s=r.height,l=Hs.toDOMRange(e,n).getClientRects()[0];if(null==l)return t;l.width;var u=l.height,c={},f=l.top-o,d=l.left-i;if(d>a/2){var p=a-d;c.right=p+5+"px";}else c.left=d+5+"px";if(f>s/2){var h=s-f;c.bottom=h+5+"px";}else {var g=f+u;g<0&&(g=0),c.top=g+5+"px";}return c}function mf(e,n,r){void 0===r&&(r="modal");var o={top:"0",left:"0"};if(null==e.selection)return o;var i=t.Element.isElement(n)&&e.isVoid(n),a=t.Element.isElement(n)&&e.isInline(n),s=ds.get(n);if(null==s)return o;var l=s.getBoundingClientRect(),u=l.top,c=l.left,f=l.height,d=l.width;if(i){var p=function(e){var t=[];t.push(e);for(var n=0;t.length>0;){var r=t.pop();if(null==r)break;if(++n>1e4)break;var o=r.nodeName;if(1===r.nodeType){var i=o.toLowerCase();if(Es.includes(i)||"iframe"===i||"video"===i)return r;var a=r.children||[],s=a.length;if(s)for(var l=s-1;l>=0;l--)t.push(a[l]);}}return null}(s);if(null!=p){var h=p.getBoundingClientRect();u=h.top,f=h.height;}}var g=vf(e);if(null==g)return o;var v=g.top,y=g.left,m=g.width,b=g.height,w={},x=u-v,E=c-y;if("bar"===r)return w.left=E+"px",x>40?w.bottom=b-x+5+"px":w.top=x+f+5+"px",w;if("modal"===r){var S;if(i?a?E>(m-d)/2?w.right=m-E+5+"px":w.left=E+d+5+"px":w.left="20px":w.left=E+"px",i)(S=x)<0&&(S=0),w.top=S+"px";else if(x>(b-f)/2)w.bottom=b-x+5+"px";else (S=x+f)<0&&(S=0),w.top=S+5+"px";return w}throw new Error("type '"+r+"' is invalid")}function bf(e,t){Uu((function(){var n=vf(e);if(null!=n){var r,o=n.top,i=n.left,a=n.width,s=n.height,l=t.offset(),u=l.top,c=l.left,f=t.width(),d=t.height(),p=u-o,h=c-i,g=t.attr("style");if(g.indexOf("top")>=0)if((r=p+d-s)>0){var v=t.css("top"),y=parseInt(v.toString())-r;y<0&&(y=0),t.css("top",y+"px");}if(g.indexOf("bottom")>=0&&u<0){var m=t.css("bottom"),b=parseInt(m.toString())-Math.abs(u);t.css("bottom",b+"px");}if(g.indexOf("left")>=0)if((r=h+f-a)>0){var w=t.css("left"),x=parseInt(w.toString())-r;x<0&&(x=0),t.css("left",x+"px");}if(g.indexOf("right")>=0&&c<0){var E=t.css("right"),S=parseInt(E.toString())-Math.abs(c);t.css("right",S+"px");}}}));}var wf=qo("slice"),xf=he("species"),Ef=P.Array,Sf=Math.max;_n({target:"Array",proto:!0,forced:!wf},{slice:function(e,t){var n,r,o,i=cn(this),a=It(i),s=gn(e,a),l=gn(void 0===t?a:t,a);if(Bt(i)&&(n=i.constructor,(qt(n)&&(n===Ef||Bt(n.prototype))||me(n)&&null===(n=n[xf]))&&(n=void 0),n===Ef||void 0===n))return yl(i,s,l);for(r=new(void 0===n?Ef:n)(Sf(l-s,0)),o=0;s<l;s++,o++)s in i&&Ir(r,o,i[s]);return r.length=o,r}});var kf=dn.f,Of=W("".startsWith),Cf=W("".slice),Tf=Math.min,Nf=Tr("startsWith"),Mf=!Nf&&!!function(){var e=kf(String.prototype,"startsWith");return e&&!e.writable}();_n({target:"String",proto:!0,forced:!Mf&&!Nf},{startsWith:function(e){var t=er(V(this));Or(e);var n=Ft(Tf(arguments.length>1?arguments[1]:void 0,t.length)),r=er(e);return Of?Of(t,r,n):Cf(t,n,n+r.length)===r}});var Lf=Object.assign,Pf=Object.defineProperty,Rf=W([].concat),Df=!Lf||se((function(){if(ye&&1!==Lf({b:1},Lf(Pf({},"a",{enumerable:!0,get:function(){Pf(this,"b",{value:3,enumerable:!1});}}),{b:2})).b)return !0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e;})),7!=Lf({},e)[n]||Fn(Lf({},t)).join("")!=r}))?function(e,t){for(var n=U(e),r=arguments.length,o=1,i=kn.f,a=un.f;r>o;)for(var s,l=Rt(arguments[o++]),u=i?Rf(Fn(l),i(l)):Fn(l),c=u.length,f=0;c>f;)s=u[f++],ye&&!Te(a,l,s)||(n[s]=l[s]);return n}:Lf;_n({target:"Object",stat:!0,forced:Object.assign!==Df},{assign:Df});var jf=["props","attrs","style","dataset","on","hook"];function Af(e){var t=e.data,n=void 0===t?{}:t,r=e.children,o=void 0===r?[]:r;Object.keys(n).forEach((function(t){var r,o,i=n[t];if("key"!==t){if(!jf.includes(t)){if(t.startsWith("data-")){var a=t.slice(5);return a=w.default(a),function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.dataset&&(n.dataset={});Object.assign(n.dataset,t);}(e,((r={})[a]=i,r)),void delete n[t]}!function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.props&&(n.props={});Object.assign(n.props,t);}(e,(o={},o[t]=i,o)),delete n[t];}}else e.key=i;})),o.length>0&&o.forEach((function(e){"string"!=typeof e&&Af(e);}));}var _f=[];var Ff={};function If(e,t,n){var r=n.isInline(e)?"span":"div";return s.jsx(r,null,t)}function Bf(e,n){var r,o=Hs.findKey(n,e),i=n.isInline(e),a=t.Editor.isVoid(n,e),l=qu(o.id),u={id:l,key:o.id,"data-slate-node":"element","data-slate-inline":i},c=e.type,f=e.children,d=void 0===f?[]:f,p=function(e){return Ff[e]||If}(c);r=a?null:d.map((function(t,r){return Vf(t,r,e,n)}));var h=p(e,r,n);if(a){u["data-slate-void"]=!0;var g=i?"span":"div",v=Gi(t.Node.texts(e),1),y=Gi(v[0],1)[0],m=Vf(y,0,e,n),b=s.jsx(g,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},m);h=s.jsx(g,{style:{position:"relative"}},h,b),ss.set(y,0),ls.set(y,e);}return null==h.data&&(h.data={}),Object.assign(h.data,u),a||i||(h=function(e,t){var n=t;return _f.forEach((function(r){n=r(e,t);})),n}(e,h)),Uu((function(){var t=Ms(l);null!=t&&(fs.set(o,t),ds.set(e,t),cs.set(t,e));})),h}function $f(e,t){return void 0===t&&(t=!1),s.jsx("span",{"data-slate-string":!0},t?e+"\n":e)}function Wf(e,t){return void 0===e&&(e=0),void 0===t&&(t=!1),s.jsx("span",{"data-slate-zero-width":t?"n":"z","data-slate-length":e},"\ufeff",t?s.jsx("br",null):null)}function Hf(e,n,r){if(null==e.text)throw new Error("Current node is not slate Text "+JSON.stringify(e));var o=Hs.findKey(r,e),i=r.getConfig().decorate;if(null==i)throw new Error("Can not get config.decorate");var a=Hs.findPath(r,e),l=i([e,a]),u=t.Text.decorations(e,l),c=u.map((function(o,i){var a=function(e,n,r,o,i){void 0===n&&(n=!1);var a=e.text,s=Hs.findPath(i,r),l=t.Path.parent(s);if(t.Editor.isEditor(o))throw new Error("Text node "+JSON.stringify(r)+" parent is Editor");return i.isVoid(o)?Wf(t.Node.string(o).length):""!==a||o.children[o.children.length-1]!==r||i.isInline(o)||""!==t.Editor.string(i,l)?""===a?Wf():n&&"\n"===a.slice(-1)?$f(a,!0):$f(a):Wf(0,!0)}(o,i===u.length-1,e,n,r);return a=function(e,t){var n=t;return _f.forEach((function(t){n=t(e,n);})),n}(o,a),s.jsx("span",{"data-slate-leaf":!0},a)})),f=function(e){return "w-e-text-"+e}(o.id),d=s.jsx("span",{"data-slate-node":"text",id:f,key:o.id},c);return Uu((function(){var t=Ms(f);null!=t&&(fs.set(o,t),ds.set(e,t),cs.set(t,e));})),d}function Vf(e,n,r,o){return ss.set(e,n),ls.set(e,r),t.Element.isElement(e)?Bf(e,o):Hf(e,r,o)}function zf(e,t){var n,r=e.$scroll,o=function(e){return "w-e-textarea-"+e}(e.id),i=t.getConfig(),a=i.readOnly,l=i.autoFocus,u=function(e,t){return void 0===t&&(t=!1),s.h("div#"+e,{props:{contentEditable:!t}})}(o,a),c=t.children||[];u.children=c.map((function(e,n){var r=Vf(e,n,t,t);return Af(r),r}));var f=os.get(e);if(null==f&&(f=!0),f){var d=function(e,t){return y.default('<div\n id="'+e+'"\n data-slate-editor\n data-slate-node="value"\n suppressContentEditableWarning\n role="textarea"\n spellCheck="true"\n autoCorrect="true"\n autoCapitalize="true"\n ></div>')}(o);r.append(d),e.$textArea=d,n=d[0],(h=s.init([s.classModule,s.propsModule,s.styleModule,s.datasetModule,s.eventListenersModule,s.attributesModule]))(n,u),os.set(e,!1),is.set(e,h);}else {var p=as.get(e),h=is.get(e);if(null==p||null==h)return;n=p.elm,h(p,u);}if(null!=n||null!=(n=Ms(o))){if((f?l:t.isFocused())&&n.focus({preventScroll:!0}),f){var g=ks(n);g&&hs.set(t,g);}us.set(t,n),ds.set(t,n),cs.set(n,t),as.set(e,u);}}function Uf(e){return "object"==typeof e&&null!=e&&1===e.nodeType}function Kf(e,t){return (!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function qf(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return Kf(n.overflowY,t)||Kf(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return !!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return !1}function Gf(e,t,n,r,o,i,a,s){return i<e&&a>t||i>e&&a<t?0:i<=e&&s<=n||a>=t&&s>=n?i-e-r:a>t&&s<n||i<e&&s>n?a-t+o:0}var Jf=function(e,t){var n=window,r=t.scrollMode,o=t.block,i=t.inline,a=t.boundary,s=t.skipOverflowHiddenElements,l="function"==typeof a?a:function(e){return e!==a};if(!Uf(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,c=[],f=e;Uf(f)&&l(f);){if((f=f.parentElement)===u){c.push(f);break}null!=f&&f===document.body&&qf(f)&&!qf(document.documentElement)||null!=f&&qf(f,s)&&c.push(f);}for(var d=n.visualViewport?n.visualViewport.width:innerWidth,p=n.visualViewport?n.visualViewport.height:innerHeight,h=window.scrollX||pageXOffset,g=window.scrollY||pageYOffset,v=e.getBoundingClientRect(),y=v.height,m=v.width,b=v.top,w=v.right,x=v.bottom,E=v.left,S="start"===o||"nearest"===o?b:"end"===o?x:b+y/2,k="center"===i?E+m/2:"end"===i?w:E,O=[],C=0;C<c.length;C++){var T=c[C],N=T.getBoundingClientRect(),M=N.height,L=N.width,P=N.top,R=N.right,D=N.bottom,j=N.left;if("if-needed"===r&&b>=0&&E>=0&&x<=p&&w<=d&&b>=P&&x<=D&&E>=j&&w<=R)return O;var A=getComputedStyle(T),_=parseInt(A.borderLeftWidth,10),F=parseInt(A.borderTopWidth,10),I=parseInt(A.borderRightWidth,10),B=parseInt(A.borderBottomWidth,10),$=0,W=0,H="offsetWidth"in T?T.offsetWidth-T.clientWidth-_-I:0,V="offsetHeight"in T?T.offsetHeight-T.clientHeight-F-B:0;if(u===T)$="start"===o?S:"end"===o?S-p:"nearest"===o?Gf(g,g+p,p,F,B,g+S,g+S+y,y):S-p/2,W="start"===i?k:"center"===i?k-d/2:"end"===i?k-d:Gf(h,h+d,d,_,I,h+k,h+k+m,m),$=Math.max(0,$+g),W=Math.max(0,W+h);else {$="start"===o?S-P-F:"end"===o?S-D+B+V:"nearest"===o?Gf(P,D,M,F,B+V,S,S+y,y):S-(P+M/2)+V/2,W="start"===i?k-j-_:"center"===i?k-(j+L/2)+H/2:"end"===i?k-R+I+H:Gf(j,R,L,_,I+H,k,k+m,m);var z=T.scrollLeft,U=T.scrollTop;S+=U-($=Math.max(0,Math.min(U+$,T.scrollHeight-M+V))),k+=z-(W=Math.max(0,Math.min(z+W,T.scrollWidth-L+H)));}O.push({el:T,top:$,left:W});}return O},Yf=T((function(e,t){t.__esModule=!0,t.default=void 0;var n,r=(n=Jf)&&n.__esModule?n:{default:n};function o(e){return e===Object(e)&&0!==Object.keys(e).length}var i=function(e,t){var n=!e.ownerDocument.documentElement.contains(e);if(o(t)&&"function"==typeof t.behavior)return t.behavior(n?[]:(0, r.default)(e,t));if(!n){var i=function(e){return !1===e?{block:"end",inline:"nearest"}:o(e)?e:{block:"start",inline:"nearest"}}(t);return function(e,t){void 0===t&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach((function(e){var r=e.el,o=e.top,i=e.left;r.scroll&&n?r.scroll({top:o,left:i,behavior:t}):(r.scrollTop=o,r.scrollLeft=i);}));}((0, r.default)(e,i),i.behavior)}};t.default=i,e.exports=t.default;})),Xf=C(Yf);function Qf(e,t){return Cs(t)&&Hs.hasDOMNode(e,t,{editable:!0})}function Zf(e,n){if(e.getConfig().readOnly)return !1;var r=ed(e,n)&&Hs.toSlateNode(e,n);return t.Editor.isVoid(e,r)}function ed(e,t){return Cs(t)&&Hs.hasDOMNode(e,t)}function td(e,n,r){void 0===r&&(r=!1);var o=n.selection,i=n.getConfig(),a=Hs.findDocumentOrShadowRoot(n).getSelection();if(a&&(!e.isComposing||r)&&n.isFocused()){var s="None"!==a.type;if(o||s){var l=us.get(n),u=!1;if(l.contains(a.anchorNode)&&l.contains(a.focusNode)&&(u=!0),s&&u&&o){var c=Hs.toSlateRange(n,a,{exactMatch:!0,suppressThrow:!0});if(c&&t.Range.equals(c,o)){var f=!0;if(t.Range.isCollapsed(o)){var d=a.anchorNode,p=a.anchorOffset;if(d===l){var h=l.childNodes,g=void 0;(g=h[p])&&g.matches("table")&&(f=!1),(g=h[p-1])&&g.matches("table")&&(f=!1);}}if(f)return}}if(!o||Hs.hasRange(n,o)){e.isUpdatingSelection=!0;var v=o&&Hs.toDOMRange(n,o);if(v){t.Range.isBackward(o)?a.setBaseAndExtent(v.endContainer,v.endOffset,v.startContainer,v.startOffset):a.setBaseAndExtent(v.startContainer,v.startOffset,v.endContainer,v.endOffset);var y=v.startContainer.parentElement;if(!y.closest("[data-slate-spacer]")){y.getBoundingClientRect=v.getBoundingClientRect.bind(v);var m=document.body;Xf(y,{scrollMode:"if-needed",boundary:i.scroll?l.parentElement:m,block:"end",behavior:"smooth"}),delete y.getBoundingClientRect;}}else a.removeAllRanges();setTimeout((function(){v&&_s&&l.focus(),e.isUpdatingSelection=!1;}));}else n.selection=Hs.toSlateRange(n,a,{exactMatch:!1,suppressThrow:!1});}}}var nd=new WeakMap,rd=new WeakMap;var od={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",splitBlock:"shift?+enter",undo:"mod+z",tab:"tab",selectAll:"mod+a"},id={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},ad={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},sd=function(e){var t=od[e],n=id[e],r=ad[e],o=t&&u.isKeyHotkey(t),i=n&&u.isKeyHotkey(n),a=r&&u.isKeyHotkey(r);return function(e){return !(!o||!o(e))||(!!(As&&i&&i(e))||!(As||!a||!a(e)))}},ld={isBold:sd("bold"),isCompose:sd("compose"),isMoveBackward:sd("moveBackward"),isMoveForward:sd("moveForward"),isDeleteBackward:sd("deleteBackward"),isDeleteForward:sd("deleteForward"),isDeleteLineBackward:sd("deleteLineBackward"),isDeleteLineForward:sd("deleteLineForward"),isDeleteWordBackward:sd("deleteWordBackward"),isDeleteWordForward:sd("deleteWordForward"),isExtendBackward:sd("extendBackward"),isExtendForward:sd("extendForward"),isExtendLineBackward:sd("extendLineBackward"),isExtendLineForward:sd("extendLineForward"),isItalic:sd("italic"),isMoveLineBackward:sd("moveLineBackward"),isMoveLineForward:sd("moveLineForward"),isMoveWordBackward:sd("moveWordBackward"),isMoveWordForward:sd("moveWordForward"),isRedo:sd("redo"),isSplitBlock:sd("splitBlock"),isTransposeCharacter:sd("transposeCharacter"),isUndo:sd("undo"),isTab:sd("tab"),isSelectAll:sd("selectAll")};function ud(e){e.preventDefault();}var cd={beforeinput:function(e,n,r){var o=e,i=r.getConfig().readOnly;if(Ws&&!i&&Qf(r,o.target)){var a=r.selection,s=o.inputType,l=o.dataTransfer||o.data||void 0;if("insertCompositionText"!==s&&"deleteCompositionText"!==s){if(o.preventDefault(),!s.startsWith("delete")||s.startsWith("deleteBy")){var u=Gi(o.getTargetRanges(),1)[0];if(u){var c=Hs.toSlateRange(r,u,{exactMatch:!1,suppressThrow:!1});a&&t.Range.equals(a,c)||t.Transforms.select(r,c);}}if(a&&t.Range.isExpanded(a)&&s.startsWith("delete")){var f=s.endsWith("Backward")?"backward":"forward";t.Editor.deleteFragment(r,{direction:f});}else switch(s){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":t.Editor.deleteFragment(r);break;case"deleteContent":case"deleteContentForward":t.Editor.deleteForward(r);break;case"deleteContentBackward":t.Editor.deleteBackward(r);break;case"deleteEntireSoftLine":t.Editor.deleteBackward(r,{unit:"line"}),t.Editor.deleteForward(r,{unit:"line"});break;case"deleteHardLineBackward":t.Editor.deleteBackward(r,{unit:"block"});break;case"deleteSoftLineBackward":t.Editor.deleteBackward(r,{unit:"line"});break;case"deleteHardLineForward":t.Editor.deleteForward(r,{unit:"block"});break;case"deleteSoftLineForward":t.Editor.deleteForward(r,{unit:"line"});break;case"deleteWordBackward":t.Editor.deleteBackward(r,{unit:"word"});break;case"deleteWordForward":t.Editor.deleteForward(r,{unit:"word"});break;case"insertLineBreak":case"insertParagraph":t.Editor.insertBreak(r);break;case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":if("insertFromPaste"===s&&!ms.get(r))break;l instanceof DataTransfer?r.insertData(l):"string"==typeof l&&t.Editor.insertText(r,l);}}}},blur:function(e,n,r){var o=e,i=n.isUpdatingSelection,a=n.latestElement;if(!r.getConfig().readOnly&&!i&&Qf(r,o.target)){var s=Hs.findDocumentOrShadowRoot(r);if(a!==s.activeElement){var l=o.relatedTarget;if(!(l===Hs.toDOMNode(r,r)||Os(l)&&l.hasAttribute("data-slate-spacer"))){if(null!=l&&Cs(l)&&Hs.hasDOMNode(r,l)){var u=Hs.toSlateNode(r,l);if(t.Element.isElement(u)&&!r.isVoid(u))return}if(Fs){var c=s.getSelection();null==c||c.removeAllRanges();}gs.delete(r);}}}},focus:function(e,t,n){var r=Hs.toDOMNode(n,n),o=Hs.findDocumentOrShadowRoot(n);t.latestElement=o.activeElement,_s&&e.target!==r?r.focus():gs.set(n,!0);},click:function(e,n,r){if(!r.getConfig().readOnly&&ed(r,e.target)&&Cs(e.target)){var o=Hs.toSlateNode(r,e.target),i=Hs.findPath(r,o);if(t.Editor.hasPath(r,i))if(t.Node.get(r,i)===o){var a=t.Editor.start(r,i),s=t.Editor.end(r,i),l=t.Editor.void(r,{at:a}),u=t.Editor.void(r,{at:s});if(l&&u&&t.Path.equals(l[1],u[1])){var c=t.Editor.range(r,a);t.Transforms.select(r,c);}}}},compositionstart:function(e,n,r){if(Qf(r,e.target)){var o=r.selection;if(o&&t.Range.isExpanded(o)&&(t.Editor.deleteFragment(r),Promise.resolve().then((function(){td(n,r,!0);}))),o&&t.Range.isCollapsed(o)){var i=Hs.toDOMRange(r,o).startContainer,a=i.textContent||"";nd.set(r,a),rd.set(r,i);}n.isComposing=!0,function(e,t){var n;t.getConfig().placeholder&&t.isEmpty()&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1);}(n,r);}},compositionend:function(e,n,r){var o=e;if(Qf(r,o.target)){n.isComposing=!1;var i=r.selection;if(null!=i){($s||_s)&&Hs.cleanExposedTexNodeInSelectionBlock(r);for(var a=t.Range.isBackward(i)?i.focus:i.anchor,s=Gi(t.Editor.node(r,[a.path[0]]),1)[0],l=0;l<a.path.length;l++){var u=Gi(t.Editor.node(r,a.path.slice(0,l+1)),1)[0];if(t.Element.isElement(u)&&((Fs||_s)&&"link"===u.type||"code"===u.type)){Hs.setNewKey(s);break}}var c=o.data;if(c){if(r.getConfig().maxLength){var f=Hs.getLeftLengthOfMaxLength(r);if(f<c.length)Hs.toDOMRange(r,i).startContainer.textContent=nd.get(r)||"",f>0&&t.Editor.insertText(r,c.slice(0,f)),n.changeViewState();else t.Editor.insertText(r,c);}else t.Editor.insertText(r,c);Fs||setTimeout((function(){var e=r.selection;if(null!=e){var t=rd.get(r);if(null!=t)Hs.toDOMRange(r,e).startContainer!==t&&(t.textContent=nd.get(r)||"");}}));}}}},compositionupdate:function(e,t,n){Qf(n,e.target)&&(t.isComposing=!0);},keydown:function(e,n,r){var o=e,i=r.selection;if(!r.getConfig().readOnly&&!n.isComposing&&Qf(r,o.target)){if(function(e,t){var n=Xa.get(e),r=n&&n.getMenus(),o=Za.get(e),i=o&&o.getMenus(),a=Ki(Ki({},r),i);for(var s in a){var l=a[s],c=l.hotkey;if(c&&u.isHotkey(c,t)&&!l.isDisabled(e)){var f=l.getValue(e);l.exec(e,f);}}}(r,o),ld.isTab(o))return ud(o),void r.handleTab();if(ld.isRedo(o))return ud(o),void("function"==typeof r.redo&&r.redo());if(ld.isUndo(o))return ud(o),void("function"==typeof r.undo&&r.undo());if(ld.isMoveLineBackward(o))return ud(o),void t.Transforms.move(r,{unit:"line",reverse:!0});if(ld.isMoveLineForward(o))return ud(o),void t.Transforms.move(r,{unit:"line"});if(ld.isExtendLineBackward(o))return ud(o),void t.Transforms.move(r,{unit:"line",edge:"focus",reverse:!0});if(ld.isExtendLineForward(o))return ud(o),void t.Transforms.move(r,{unit:"line",edge:"focus"});if(ld.isMoveBackward(o))return ud(o),void(i&&t.Range.isCollapsed(i)?t.Transforms.move(r,{reverse:!0}):t.Transforms.collapse(r,{edge:"start"}));if(ld.isMoveForward(o))return ud(o),void(i&&t.Range.isCollapsed(i)?t.Transforms.move(r):t.Transforms.collapse(r,{edge:"end"}));if(ld.isMoveWordBackward(o))return ud(o),i&&t.Range.isExpanded(i)&&t.Transforms.collapse(r,{edge:"focus"}),void t.Transforms.move(r,{unit:"word",reverse:!0});if(ld.isMoveWordForward(o))return ud(o),i&&t.Range.isExpanded(i)&&t.Transforms.collapse(r,{edge:"focus"}),void t.Transforms.move(r,{unit:"word"});if(ld.isSelectAll(o))return ud(o),void r.selectAll();if(Ws){if(($s||Fs)&&i&&(ld.isDeleteBackward(o)||ld.isDeleteForward(o))&&t.Range.isCollapsed(i)){var a=t.Node.parent(r,i.anchor.path);if(t.Element.isElement(a)&&t.Editor.isVoid(r,a)&&t.Editor.isInline(r,a))return o.preventDefault(),void t.Transforms.delete(r,{unit:"block"})}}else {if(ld.isBold(o)||ld.isItalic(o)||ld.isTransposeCharacter(o))return void ud(o);if(ld.isSplitBlock(o))return ud(o),void t.Editor.insertBreak(r);if(ld.isDeleteBackward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r));if(ld.isDeleteForward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r));if(ld.isDeleteLineBackward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r,{unit:"line"}));if(ld.isDeleteLineForward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r,{unit:"line"}));if(ld.isDeleteWordBackward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"backward"}):t.Editor.deleteBackward(r,{unit:"word"}));if(ld.isDeleteWordForward(o))return ud(o),void(i&&t.Range.isExpanded(i)?t.Editor.deleteFragment(r,{direction:"forward"}):t.Editor.deleteForward(r,{unit:"word"}))}}},keypress:function(e,n,r){if(!Ws&&!r.getConfig().readOnly&&Qf(r,e.target)){e.preventDefault();var o=e.key;t.Editor.insertText(r,o);}},copy:function(e,t,n){var r=e;if(Qf(n,r.target)){r.preventDefault();var o=r.clipboardData;null!=o&&n.setFragmentData(o);}},cut:function(e,n,r){var o=e,i=r.selection;if(!r.getConfig().readOnly&&Qf(r,o.target)){o.preventDefault();var a=o.clipboardData;if(null!=a&&(r.setFragmentData(a),i))if(t.Range.isExpanded(i))t.Editor.deleteFragment(r);else {var s=t.Node.parent(r,i.anchor.path);t.Editor.isVoid(r,s)&&t.Transforms.delete(r);}}},paste:function(e,t,n){ms.set(n,!0);var r=e;if(!n.getConfig().readOnly&&Qf(n,r.target)){var o=n.getConfig().customPaste;if(o)if(!1===o(n,r))return void ms.set(n,!1);if(!Ws||function(e){return e.clipboardData&&""!==e.clipboardData.getData("text/plain")&&1===e.clipboardData.types.length}(r)){r.preventDefault();var i=r.clipboardData;null!=i&&n.insertData(i);}}},dragover:function(e,n,r){if(ed(r,e.target)){var o=Hs.toSlateNode(r,e.target);t.Editor.isVoid(r,o)&&e.preventDefault();}},dragstart:function(e,n,r){var o=e;if(ed(r,o.target)&&!r.getConfig().readOnly){var i=Hs.toSlateNode(r,o.target),a=Hs.findPath(r,i);if(t.Editor.isVoid(r,i)||t.Editor.void(r,{at:a,voids:!0})){var s=t.Editor.range(r,a);t.Transforms.select(r,s);}var l=o.dataTransfer;null!=l&&(n.isDraggingInternally=!0,r.setFragmentData(l));}},dragend:function(e,t,n){var r=e;n.getConfig().readOnly||t.isDraggingInternally&&ed(n,r.target)&&(t.isDraggingInternally=!1);},drop:function(e,n,r){var o=e,i=o.dataTransfer;if(!r.getConfig().readOnly&&ed(r,o.target)&&null!=i&&!(Ws&&Fs&&i.files.length>0)){o.preventDefault();var a=r.selection,s=Hs.findEventRange(r,o);t.Transforms.select(r,s),n.isDraggingInternally&&(a&&t.Transforms.delete(r,{at:a}),n.isDraggingInternally=!1),r.insertData(i),r.isFocused()||r.focus();}}},fd=1,dd=function(){function e(e){var n=this;this.id=fd++,this.$textArea=null,this.$progressBar=y.default('<div class="w-e-progress-bar"></div>'),this.$maxLengthInfo=y.default('<div class="w-e-max-length-info"></div>'),this.isComposing=!1,this.isUpdatingSelection=!1,this.isDraggingInternally=!1,this.latestElement=null,this.showPlaceholder=!1,this.$placeholder=null,this.latestEditorSelection=null,this.onDOMSelectionChange=b.default((function(){var e=n.editorInstance;!function(e,n){var r=e.isComposing,o=e.isUpdatingSelection,i=e.isDraggingInternally;if(!(n.getConfig().readOnly||r||o||i)){var a=Hs.findDocumentOrShadowRoot(n),s=a.activeElement,l=Hs.toDOMNode(n,n),u=a.getSelection();if(s===l?(e.latestElement=s,gs.set(n,!0)):gs.delete(n),!u)return t.Transforms.deselect(n);var c=u.anchorNode,f=u.focusNode,d=Qf(n,c)||Zf(n,c),p=Qf(n,f)||Zf(n,f);if(d&&p){var h=Hs.toSlateRange(n,u,{exactMatch:!1,suppressThrow:!1});t.Transforms.select(n,h);}else t.Transforms.deselect(n);}}(n,e);}),100);var r=y.default(e);if(0===r.length)throw new Error("Cannot find textarea DOM by selector '"+e+"'");this.$box=r;var o=y.default('<div class="w-e-text-container"></div>');o.append(this.$progressBar),o.append(this.$maxLengthInfo),r.append(o);var i=y.default('<div class="w-e-scroll"></div>');o.append(i),this.$scroll=i,this.$textAreaContainer=o,Uu((function(){var e=n.editorInstance,t=Hs.getWindow(e);t.document.addEventListener("selectionchange",n.onDOMSelectionChange),e.on("destroyed",(function(){t.document.removeEventListener("selectionchange",n.onDOMSelectionChange);})),o.on("click",(function(){return e.hidePanelOrModal()})),e.on("change",n.changeViewState.bind(n));var r=e.getConfig().onChange;r&&e.on("change",(function(){return r(e)})),n.onFocusAndOnBlur(),e.on("change",n.changeMaxLengthInfo.bind(n)),n.bindEvent();}));}return Object.defineProperty(e.prototype,"editorInstance",{get:function(){var e=Ja.get(this);if(null==e)throw new Error("Can not get editor instance");return e},enumerable:!1,configurable:!0}),e.prototype.bindEvent=function(){var e=this,t=this.$textArea,n=this.$scroll,r=this.editorInstance;null!=t&&(m.default(cd,(function(n,o){t.on(o,(function(t){n(t,e,r);}));})),r.getConfig().scroll&&(n.css("overflow-y","auto"),n.on("scroll",b.default((function(){r.emit("scroll");}),100))));},e.prototype.onFocusAndOnBlur=function(){var e=this,t=this.editorInstance,n=t.getConfig(),r=n.onBlur,o=n.onFocus;this.latestEditorSelection=t.selection,t.on("change",(function(){null==e.latestEditorSelection&&null!=t.selection?setTimeout((function(){return o&&o(t)})):null!=e.latestEditorSelection&&null==t.selection&&setTimeout((function(){return r&&r(t)})),e.latestEditorSelection=t.selection;}));},e.prototype.changeMaxLengthInfo=function(){var e=this.editorInstance,t=e.getConfig().maxLength;if(t){var n=t-Hs.getLeftLengthOfMaxLength(e);this.$maxLengthInfo[0].innerHTML=n+"/"+t;}},e.prototype.changeProgress=function(e){var t=this.$progressBar;t.css("width",e+"%"),e>=100&&setTimeout((function(){t.hide(),t.css("width","0"),t.show();}),1e3);},e.prototype.changeViewState=function(){var e=this,t=this.editorInstance;zf(this,t),function(e,t){var n,r=t.getConfig().placeholder;if(r){var o=t.isEmpty();if(o&&!e.showPlaceholder&&!e.isComposing){if(null==e.$placeholder){var i=y.default('<div class="w-e-text-placeholder">'+r+"</div>");e.$textAreaContainer.append(i),e.$placeholder=i;}return e.$placeholder.show(),void(e.showPlaceholder=!0)}!o&&e.showPlaceholder&&(null===(n=e.$placeholder)||void 0===n||n.hide(),e.showPlaceholder=!1);}}(this,t),Uu((function(){td(e,t);}));},e.prototype.destroy=function(){this.$textAreaContainer.remove();},e}();Si("match",(function(e,t,n){return [function(t){var n=V(this),r=null==t?void 0:Ae(t,e);return r?Te(r,t,n):new RegExp(t)[e](er(n))},function(e){var r=Oe(this),o=er(e),i=n(t,r,o);if(i.done)return i.value;if(!r.global)return ji(r,o);var a=r.unicode;r.lastIndex=0;for(var s,l=[],u=0;null!==(s=ji(r,o));){var c=er(s[0]);l[u]=c,""===c&&(r.lastIndex=Oi(o,Ft(r.lastIndex),a)),u++;}return 0===u?null:l}]}));function pd(e){e.removeAttr("width"),e.removeAttr("height"),e.removeAttr("fill"),e.removeAttr("class"),e.removeAttr("t"),e.removeAttr("p-id");var t=e.children();t.length&&pd(t);}function hd(){return y.default('<svg viewBox="0 0 1024 1024"><path d="M498.7 655.8l-197.6-268c-8.1-10.9-0.3-26.4 13.3-26.4h395.2c13.6 0 21.4 15.4 13.3 26.4l-197.6 268c-6.6 9-20 9-26.6 0z"></path></svg>')}function gd(){return y.default('<div class="w-e-bar-divider"></div>')}function vd(e,t,n,r,o){if(void 0===o&&(o=!1),t){if(r){var i=As?"cmd":"ctrl";r=r.replace("mod",i);}if(o)r&&(e.attr("data-tooltip",r),e.addClass("w-e-menu-tooltip-v5"),e.addClass("tooltip-right"));else {var a=r?n+"\n"+r:n;e.attr("data-tooltip",a),e.addClass("w-e-menu-tooltip-v5");}}}var yd=function(){function e(e,t,n){var r=this;void 0===n&&(n=!1),this.$elem=y.default('<div class="w-e-bar-item"></div>'),this.$button=y.default('<button type="button"></button>'),this.disabled=!1,this.menu=t;var o=t.tag,i=t.width;if("button"!==o)throw new Error("Invalid tag '"+o+"', expected 'button'");var a=t.title,s=t.hotkey,l=void 0===s?"":s,u=t.iconSvg,c=void 0===u?"":u,f=this.$button;if(c){var d=y.default(c);pd(d),f.append(d);}else f.text(a);vd(f,c,a,l,n),n&&c&&f.append(y.default('<span class="title">'+a+"</span>")),i&&f.css("width",i+"px"),f.attr("data-menu-key",e),this.$elem.append(f),Uu((function(){return r.init()}));}return e.prototype.init=function(){var e=this;this.setActive(),this.setDisabled(),this.$button.on("click",(function(t){t.preventDefault(),Nd(e).hidePanelOrModal(),e.disabled||(e.exec(),e.onButtonClick());}));},e.prototype.exec=function(){var e=Nd(this),t=this.menu,n=t.getValue(e);t.exec(e,n);},e.prototype.setActive=function(){var e=Nd(this),t=this.$button,n="active";this.menu.isActive(e)?t.addClass(n):t.removeClass(n);},e.prototype.setDisabled=function(){var e=Nd(this),t=this.$button,n=this.menu.isDisabled(e);(null==e.selection||e.isDisabled())&&(n=!0),this.menu.alwaysEnable&&(n=!1);var r="disabled";n?t.addClass(r):t.removeClass(r),this.disabled=n;},e.prototype.changeMenuState=function(){this.setActive(),this.setDisabled();},e}(),md=function(e){function t(t,n,r){return void 0===r&&(r=!1),e.call(this,t,n,r)||this}return Ui(t,e),t.prototype.onButtonClick=function(){},t}(yd),bd=function(){function e(e){this.isShow=!1,this.showTime=0,this.record(e);}return e.prototype.record=function(e){var t=ts.get(e);null==t&&(t=new Set,ts.set(e,t)),t.add(this),ns.set(this,e);},e.prototype.renderContent=function(e){var t=this.$elem;t.empty(),t.append(e);var n=this.genSelfElem();n&&t.append(n);},e.prototype.appendTo=function(e){var t=this.$elem;e.append(t);},e.prototype.show=function(){if(!this.isShow){this.showTime=Date.now(),this.$elem.show(),this.isShow=!0;var e=ns.get(this);e&&e.emit("modalOrPanelShow",this);}},e.prototype.hide=function(){if(this.isShow&&!(Date.now()-this.showTime<200)){this.$elem.hide(),this.isShow=!1;var e=ns.get(this);e&&e.emit("modalOrPanelHide");}},e}(),wd=function(e){function t(t){var n=e.call(this,t)||this;return n.type="dropPanel",n.$elem=y.default('<div class="w-e-drop-panel"></div>'),n}return Ui(t,e),t.prototype.genSelfElem=function(){return null},t}(bd),xd=function(e){function t(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;if(o.dropPanel=null,o.menu=n,n.showDropPanel){var i=hd();o.$button.append(i);}return o}return Ui(t,e),t.prototype.onButtonClick=function(){this.menu.showDropPanel&&this.handleDropPanel();},t.prototype.handleDropPanel=function(){var e=this.menu;if(null!=e.getPanelContentElem){var t=Nd(this);if(null==this.dropPanel){var n=new wd(t),r=e.getPanelContentElem(t);n.renderContent(r),n.appendTo(this.$elem),n.show(),this.dropPanel=n;}else {var o=this.dropPanel;if(o.isShow)o.hide();else {r=e.getPanelContentElem(t);o.renderContent(r),o.show();}}var i=this.dropPanel;if(i.isShow){var a=this.$elem,s=a.offset().left,l=a.parents(".w-e-bar");s-l.offset().left>=l.width()/2?i.$elem.css({left:"none",right:"0"}):i.$elem.css({left:"0",right:"none"});}}},t}(yd),Ed=function(e){function t(t,n){void 0===n&&(n=0);var r=e.call(this,t)||this;r.type="modal",r.$elem=y.default('<div class="w-e-modal"></div>'),r.width=0,n&&(r.width=n);var o=r.$elem;return o.on("click",(function(e){return e.stopPropagation()})),o.on("keyup",(function(e){"Escape"===e.code&&(r.hide(),t.restoreSelection());})),r}return Ui(t,e),t.prototype.genSelfElem=function(){var e=this,t=y.default('<span class="btn-close"><svg viewBox="0 0 1024 1024"><path d="M1024 896.1024l-128 128L512 640 128 1024 0 896 384 512 0 128 128 0 512 384 896.1024 0l128 128L640 512z"></path></svg></span>'),n=ns.get(this);return t.on("click",(function(){e.hide(),null==n||n.restoreSelection();})),t},t.prototype.setStyle=function(e){var t=this.width,n=this.$elem;n.attr("style",""),t&&n.css("width",t+"px"),n.css(e);},t}(bd);var Sd=function(e){function n(t,n,r){void 0===r&&(r=!1);var o=e.call(this,t,n,r)||this;return o.$body=y.default("body"),o.modal=null,o.menu=n,o}return Ui(n,e),n.prototype.onButtonClick=function(){this.menu.showModal&&this.handleModal();},n.prototype.getPosition=function(){var e=Nd(this),n=this.menu.getModalPositionNode(e);return t.Element.isElement(n)?mf(e,n,"modal"):yf(e)},n.prototype.handleModal=function(){var e=Nd(this),t=this.menu;if(null==this.modal){var n=new Ed(e,t.modalWidth);this.renderAndShowModal(n,!0),this.modal=n;}else {(n=this.modal).isShow?n.hide():this.renderAndShowModal(n,!1);}},n.prototype.renderAndShowModal=function(e,t){void 0===t&&(t=!1);var n=Nd(this),r=this.menu;if(null!=r.getModalContentElem){var o=Hs.getTextarea(n),i=Hs.getToolbar(n),a=((null==i?void 0:i.getConfig())||{}).modalAppendToBody,s=r.getModalContentElem(n);if(e.renderContent(s),a)e.setStyle({left:"0",right:"0"});else {var l=this.getPosition();e.setStyle(l);}t&&(a?e.appendTo(this.$body):e.appendTo(o.$textAreaContainer)),e.show(),a||bf(n,e.$elem),setTimeout((function(){n.blur();}));}},n}(yd);var kd=function(e){function t(t,n){var r=e.call(this,t)||this;return r.type="selectList",r.$elem=y.default('<div class="w-e-select-list"></div>'),n&&r.$elem.css("width",n+"px"),r.$elem.on("click",(function(e){e.stopPropagation();})),r}return Ui(t,e),t.prototype.renderList=function(e){var t=this.$elem;t.empty();var n=y.default("<ul></ul>");e.forEach((function(e){var t=e.value,r=e.text,o=e.selected,i=e.styleForRenderMenuList,a=y.default('<li data-value="'+t+'"></li>');if(i&&a.css(i),o){var s=y.default('<svg viewBox="0 0 1446 1024"><path d="M574.116299 786.736392 1238.811249 48.517862C1272.390222 11.224635 1329.414799 7.827718 1366.75664 41.450462 1403.840015 74.840484 1406.731043 132.084741 1373.10189 169.433699L655.118888 966.834607C653.072421 969.716875 650.835807 972.514337 648.407938 975.210759 615.017957 1012.29409 558.292155 1015.652019 521.195664 982.250188L72.778218 578.493306C35.910826 545.297758 32.859041 488.584019 66.481825 451.242134 99.871807 414.158803 156.597563 410.800834 193.694055 444.202665L574.116299 786.736392Z"></path></svg>');a.append(s),a.addClass("selected");}a.append(y.default('<span data-value="'+t+'">'+r+"</span>")),a.attr("title",r),n.append(a);})),t.append(n);},t.prototype.genSelfElem=function(){return null},t}(bd);var Od=function(){function e(e,t,n){var r=this;void 0===n&&(n=!1),this.$elem=y.default('<div class="w-e-bar-item"></div>'),this.$button=y.default('<button type="button" class="select-button"></button>'),this.disabled=!1,this.selectList=null;var o=t.tag,i=t.title,a=t.width,s=t.iconSvg,l=void 0===s?"":s,u=t.hotkey,c=void 0===u?"":u;if("select"!==o)throw new Error("Invalid tag '"+o+"', expected 'select'");var f=this.$button;a&&f.css("width",a+"px"),f.attr("data-menu-key",e),vd(f,l,i,c,n),this.$elem.append(f),this.menu=t,Uu((function(){return r.init()}));}return e.prototype.init=function(){var e=this;this.setSelectedValue(),this.$button.on("click",(function(t){t.preventDefault(),Nd(e).hidePanelOrModal(),e.trigger();}));},e.prototype.trigger=function(){var e=this,t=Nd(this);if(!t.isDisabled()&&!this.disabled){var n=this.menu;if(null==this.selectList){this.selectList=new kd(t,n.selectPanelWidth);var r=this.selectList,o=n.getOptions(t);r.renderList(o),r.appendTo(this.$elem),r.show(),r.$elem.on("click","li",(function(t){var n=t.target;if(null!=n){t.preventDefault();var r=y.default(n).attr("data-value");e.onChange(r);}}));}else {if((r=this.selectList).isShow)r.hide();else {o=n.getOptions(t);r.renderList(o),r.show();}}}},e.prototype.onChange=function(e){var t=Nd(this),n=this.menu;n.exec&&n.exec(t,e);},e.prototype.setSelectedValue=function(){var e=Nd(this),t=this.menu,n=t.getValue(e),r=function(e,t){for(var n=e.length,r="",o=0;o<n;o++){var i=e[o];if(i.value===t){r=i.text;break}}return r}(t.getOptions(e),n.toString()),o=this.$button,i=hd();o.empty(),o.text(r),o.append(i);},e.prototype.setDisabled=function(){var e=Nd(this),t=this.menu.isDisabled(e),n=this.$button;(null==e.selection||e.isDisabled())&&(t=!0);var r="disabled";t?n.addClass(r):n.removeClass(r),this.disabled=t;},e.prototype.changeMenuState=function(){this.setSelectedValue(),this.setDisabled();},e}(),Cd=function(){function e(e){this.$elem=y.default('<div class="w-e-bar-item w-e-bar-item-group"></div>'),this.$container=y.default('<div class="w-e-bar-item-menus-container"></div>'),this.$button=y.default('<button type="button"></button>');var t=e.key,n=e.iconSvg,r=e.title,o=this.$elem,i=this.$button;if(n){var a=y.default(n);pd(a),i.append(a);}else i.text(r);i.attr("data-menu-key",t);var s=hd();i.append(s),o.append(i);var l=this.$container;o.append(l);var u=this.createObserver();this.observe(u);}return e.prototype.appendBarItem=function(e){var t=e.$elem;this.$container.append(t);},e.prototype.observe=function(e){var t=this.$container;e.observe(t[0],{childList:!0,subtree:!0,attributes:!0});},e.prototype.createObserver=function(){var e=this,t=this.$container,n=this.$button,r=new MutationObserver((function(){var o=t.find("button"),i=o.length;if(0!==i){var a=0;o.each((function(e){y.default(e).hasClass("disabled")&&a++;})),r.disconnect(),a===i?n.addClass("disabled"):n.removeClass("disabled"),e.observe(r);}}));return r},e}(),Td=new WeakMap;function Nd(e){var t=es.get(e);if(null==t)throw new Error("Can not get editor instance");return t}function Md(e,t,n){void 0===n&&(n=!1);var r=Td.get(t);if(r)return r;var o=t.tag;if("button"===o){var i=t.showDropPanel,a=t.showModal;r=i?new xd(e,t,n):a?new Sd(e,t,n):new md(e,t,n);}if("select"===o&&(r=new Od(e,t,n)),null==r)throw new Error("Invalid tag in menu "+JSON.stringify(t));return Td.set(t,r),r}function Ld(e,n){var r=e.selection;return null!=r&&(!t.Range.isCollapsed(r)&&(!Hs.getSelectedElems(e).some((function(t){if(e.isVoid(t))return !0;var n=t.type;return !!["pre","code","table"].includes(n)||void 0}))&&!!t.Text.isText(n)))}var Pd=function(){function e(){var e=this;this.$elem=y.default('<div class="w-e-bar w-e-bar-hidden w-e-hover-bar"></div>'),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null,this.isShow=!1,this.changeHoverbarState=x.default((function(){var n=e.isShow,r=e.getSelectedNodeAndMenuKeys()||{},o=r.node,i=void 0===o?null:o,a=r.menuKeys,s=void 0===a?[]:a;if((null!=i&&e.changeItemsState(),i&&t.Element.isElement(i))&&(n&&e.isSamePath(i,e.prevSelectedNode)))return;e.hideAndClean(),null!=i&&(e.registerItems(s),e.setPosition(i),e.show()),e.prevSelectedNode=i;}),200),Uu((function(){var t=e.getEditorInstance(),n=e.$elem;n.on("mousedown",(function(e){return e.preventDefault()}),{passive:!1}),Hs.getTextarea(t).$textAreaContainer.append(n),t.on("change",e.changeHoverbarState);var r=e.hideAndClean.bind(e);t.on("scroll",r),t.on("fullScreen",r),t.on("unFullScreen",r);}));}return e.prototype.getMenus=function(){return this.menus},e.prototype.hideAndClean=function(){var e=this.$elem;e.removeClass("w-e-bar-show").addClass("w-e-bar-hidden"),this.hoverbarItems=[],e.empty(),this.isShow=!1;},e.prototype.checkPositionBottom=function(){var e=this.$elem,t=!1,n=window.innerHeight;n&&n>=360&&(n-e[0].getBoundingClientRect().bottom<360&&(t=!0));t?e.addClass("w-e-bar-bottom"):e.removeClass("w-e-bar-bottom");},e.prototype.show=function(){this.$elem.removeClass("w-e-bar-hidden").addClass("w-e-bar-show"),this.isShow=!0,this.checkPositionBottom();},e.prototype.changeItemsState=function(){var e=this;Uu((function(){e.hoverbarItems.forEach((function(e){e.changeMenuState();}));}));},e.prototype.registerItems=function(e){var t=this,n=this.$elem;e.forEach((function(e){if("|"!==e)t.registerSingleItem(e);else {var r=gd();n.append(r);}}));},e.prototype.registerSingleItem=function(e){var t=this.getEditorInstance(),n=this.menus,r=n[e];if(null==r){var o=Us[e];if(null==o)throw new Error("Not found menu item factory by key '"+e+"'");if("function"!=typeof o)throw new Error("Menu item factory (key='"+e+"') is not a function");r=o(),n[e]=r;}var i=Md(e,r);this.hoverbarItems.push(i),es.set(i,t),this.$elem.append(i.$elem);},e.prototype.setPosition=function(e){var n=this.getEditorInstance(),r=this.$elem;if(r.attr("style",""),t.Element.isElement(e)){var o=mf(n,e,"bar");return r.css(o),void bf(n,r)}if(t.Text.isText(e)){o=yf(n);return r.css(o),void bf(n,r)}throw new Error("hoverbar.setPosition error, current selected node is not elem nor text")},e.prototype.getSelectedNodeAndMenuKeys=function(){var e=this.getEditorInstance();if(null==e.selection)return null;var n=this.getHoverbarKeysConf(),r=null,o=[],i=function(i){var a=n[i],s=a.match,l=a.menuKeys,u=void 0===l?[]:l,c=s||function(e,t){return Hs.checkNodeType(t,i)},f=Gi(t.Editor.nodes(e,{match:function(t){return c(e,t)},universal:!0}),1),d=f[0];if(null!=d)return r=d[0],o=u,"break"};for(var a in n){if("break"===i(a))break}return null==r||0===o.length?null:{node:r,menuKeys:o}},e.prototype.getEditorInstance=function(){var e=Qa.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.getHoverbarKeysConf=function(){var e=this.getEditorInstance().getConfig().hoverbarKeys,t=void 0===e?{}:e,n=t.text;return n&&null==n.match&&(n.match=Ld),t},e.prototype.isSamePath=function(e,n){if(null==e||null==n)return !1;var r=Hs.findPath(null,e),o=Hs.findPath(null,n);return t.Path.equals(r,o)},e.prototype.destroy=function(){this.changeHoverbarState.cancel(),this.$elem.remove(),this.menus={},this.hoverbarItems=[],this.prevSelectedNode=null;},e}();function Rd(e,n,r,o){if(ss.set(e,n),ls.set(e,r),t.Element.isElement(e)){var i=e.children;if((void 0===i?[]:i).forEach((function(t,n){return Rd(t,n,e,o)})),t.Editor.isVoid(o,e)){var a=Gi(t.Node.texts(e),1),s=Gi(a[0],1)[0];ss.set(s,0),ls.set(s,e);}}}var Dd=qo("splice"),jd=P.TypeError,Ad=Math.max,_d=Math.min,Fd=9007199254740991,Id="Maximum allowed length exceeded";_n({target:"Array",proto:!0,forced:!Dd},{splice:function(e,t){var n,r,o,i,a,s,l=U(this),u=It(l),c=gn(e,u),f=arguments.length;if(0===f?n=r=0:1===f?(n=0,r=u-c):(n=f-2,r=_d(Ad(At(t),0),u-c)),u+n-r>Fd)throw jd(Id);for(o=Yt(l,r),i=0;i<r;i++)(a=c+i)in l&&Ir(o,i,l[a]);if(o.length=r,n<r){for(i=c;i<u-r;i++)s=i+n,(a=i+r)in l?l[s]=l[a]:delete l[s];for(i=u;i>u-r+n;i--)delete l[i-1];}else if(n>r)for(i=u-r;i>c;i--)s=i+n-1,(a=i+r-1)in l?l[s]=l[a]:delete l[s];for(i=0;i<n;i++)l[i+c]=arguments[i+2];return l.length=u-r+n,o}});var Bd=function(){function e(e,t){var n=this;this.$toolbar=y.default('<div class="w-e-bar w-e-bar-show w-e-toolbar"></div>'),this.menus={},this.toolbarItems=[],this.config={},this.changeToolbarState=x.default((function(){n.toolbarItems.forEach((function(e){e.changeMenuState();}));}),200),this.config=t;var r=y.default(e);if(0===r.length)throw new Error("Cannot find toolbar DOM by selector '"+e+"'");this.$box=r;var o=this.$toolbar;o.on("mousedown",(function(e){return e.preventDefault()}),{passive:!1}),r.append(o),Uu((function(){n.registerItems(),n.changeToolbarState(),n.getEditorInstance().on("change",n.changeToolbarState);}));}return e.prototype.getMenus=function(){return this.menus},e.prototype.getConfig=function(){return this.config},e.prototype.registerItems=function(){var e=this,t="",n=this.$toolbar,r=this.config,o=r.toolbarKeys,i=void 0===o?[]:o,a=r.insertKeys,s=void 0===a?{index:0,keys:[]}:a,l=r.excludeKeys,u=void 0===l?[]:l,c=E.default(i);s.keys.length>0&&("string"==typeof s.keys&&(s.keys=[s.keys]),s.keys.forEach((function(e,t){c.splice(s.index+t,0,e);})));var f=c.filter((function(e){if("string"==typeof e){if(u.includes(e))return !1}else if(u.includes(e.key))return !1;return !0})),d=f.length;f.forEach((function(r,o){if("|"===r){if(0===o)return;if(o+1===d)return;if("|"===t)return;var i=gd();return n.append(i),void(t=r)}if("string"==typeof r)return e.registerSingleItem(r,e),void(t=r);e.registerGroup(r),t="group";}));},e.prototype.registerGroup=function(e){var t=this,n=this.$toolbar,r=function(e){return new Cd(e)}(e),o=e.menuKeys,i=void 0===o?[]:o,a=this.config.excludeKeys,s=void 0===a?[]:a;i.forEach((function(e){s.includes(e)||t.registerSingleItem(e,r);})),n.append(r.$elem);},e.prototype.registerSingleItem=function(e,t){var n=this.getEditorInstance(),r=t instanceof Cd,o=this.menus,i=o[e];if(null==i){var a=Us[e];if(null==a)throw new Error("Not found menu item factory by key '"+e+"'");if("function"!=typeof a)throw new Error("Menu item factory (key='"+e+"') is not a function");i=a(),o[e]=i;}else console.warn("Duplicated toolbar menu key '"+e+"'\n重复注册了菜单栏 menu '"+e+"'");var s=Md(e,i,r);(this.toolbarItems.push(s),es.set(s,n),r)?t.appendBarItem(s):t.$toolbar.append(s.$elem);},e.prototype.getEditorInstance=function(){var e=Ya.get(this);if(null==e)throw new Error("Can not get editor instance");return e},e.prototype.destroy=function(){this.$toolbar.remove(),this.menus={},this.toolbarItems=[];},e}();var $d=ht.EXISTS,Wd=Ve.f,Hd=Function.prototype,Vd=W(Hd.toString),zd=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Ud=W(zd.exec);ye&&!$d&&Wd(Hd,"name",{configurable:!0,get:function(){try{return Ud(zd,Vd(this))[1]}catch(e){return ""}}});var Kd=T((function(e){function t(n){return "function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),t(n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0;})),qd=T((function(e){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0;})),Gd=T((function(e){e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?Object(arguments[t]):{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach((function(t){qd(e,t,n[t]);}));}return e},e.exports.default=e.exports,e.exports.__esModule=!0;})),Jd=T((function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0;})),Yd=T((function(e){function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r);}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e},e.exports.default=e.exports,e.exports.__esModule=!0;})),Xd=T((function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0;})),Qd=T((function(e){var t=Kd.default;e.exports=function(e,n){if(n&&("object"===t(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return Xd(e)},e.exports.default=e.exports,e.exports.__esModule=!0;})),Zd=T((function(e){function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,t(n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0;})),ep=T((function(e){function t(n,r){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(n,r)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0;})),tp=T((function(e){e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ep(e,t);},e.exports.default=e.exports,e.exports.__esModule=!0;}));function np(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var rp=np(Kd),op=np(Gd),ip=np(Jd),ap=np(Yd),sp=np(Qd),lp=np(Zd),up=np(Xd),cp=np(tp),fp={type:"logger",log:function(e){this.output("log",e);},warn:function(e){this.output("warn",e);},error:function(e){this.output("error",e);},output:function(e,t){console&&console[e]&&console[e].apply(console,t);}},dp=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ip.default(this,e),this.init(t,n);}return ap.default(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||fp,this.options=t,this.debug=t.debug;}},{key:"setDebug",value:function(e){this.debug=e;}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,r){return r&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,op.default({},{prefix:"".concat(this.prefix,":").concat(t,":")},this.options))}}]),e}(),pp=new dp,hp=function(){function e(){ip.default(this,e),this.observers={};}return ap.default(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t);})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e]);}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){var o=[].concat(this.observers[e]);o.forEach((function(e){e.apply(void 0,n);}));}if(this.observers["*"]){var i=[].concat(this.observers["*"]);i.forEach((function(t){t.apply(t,[e].concat(n));}));}}}]),e}();function gp(){var e,t,n=new Promise((function(n,r){e=n,t=r;}));return n.resolve=e,n.reject=t,n}function vp(e){return null==e?"":""+e}function yp(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e]);}));}function mp(e,t,n){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function o(){return !e||"string"==typeof e}for(var i="string"!=typeof t?[].concat(t):t.split(".");i.length>1;){if(o())return {};var a=r(i.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{};}return o()?{}:{obj:e,k:r(i.shift())}}function bp(e,t,n){var r=mp(e,t,Object);r.obj[r.k]=n;}function wp(e,t){var n=mp(e,t),r=n.obj,o=n.k;if(r)return r[o]}function xp(e,t,n){var r=wp(e,n);return void 0!==r?r:wp(t,n)}function Ep(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):Ep(e[r],t[r],n):e[r]=t[r]);return e}function Sp(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var kp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function Op(e){return "string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return kp[e]})):e}var Cp="undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1;function Tp(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),o=e,i=0;i<r.length;++i){if(!o)return;if("string"==typeof o[r[i]]&&i+1<r.length)return;if(void 0===o[r[i]]){for(var a=2,s=r.slice(i,i+a).join(n),l=o[s];void 0===l&&r.length>i+a;)a++,l=o[s=r.slice(i,i+a).join(n)];if(void 0===l)return;if("string"==typeof l)return l;if(s&&"string"==typeof l[s])return l[s];var u=r.slice(i+a).join(n);return u?Tp(l,u,n):void 0}o=o[r[i]];}return o}}var Np=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return ip.default(this,t),n=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(n)),n.data=e||{},n.options=r,void 0===n.options.keySeparator&&(n.options.keySeparator="."),void 0===n.options.ignoreJSONStructure&&(n.options.ignoreJSONStructure=!0),n}return cp.default(t,e),ap.default(t,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e);}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1);}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,i=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=wp(this.data,a);return s||!i||"string"!=typeof n?s:Tp(this.data&&this.data[e]&&this.data[e][t],n,o)}},{key:"addResource",value:function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},i=this.options.keySeparator;void 0===i&&(i=".");var a=[e,t];n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),bp(this.data,a,r),o.silent||this.emit("added",e,t,n,r);}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var o in n)"string"!=typeof n[o]&&"[object Array]"!==Object.prototype.toString.apply(n[o])||this.addResource(e,t,o,n[o],{silent:!0});r.silent||this.emit("added",e,t,n);}},{key:"addResourceBundle",value:function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=wp(this.data,a)||{};r?Ep(s,n,o):s=op.default({},s,n),bp(this.data,a,s),i.silent||this.emit("added",e,t,n);}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t);}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?op.default({},{},this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"toJSON",value:function(){return this.data}}]),t}(hp),Mp={processors:{},addPostProcessor:function(e){this.processors[e.name]=e;},handle:function(e,t,n,r,o){var i=this;return e.forEach((function(e){i.processors[e]&&(t=i.processors[e].process(t,n,r,o));})),t}},Lp={},Pp=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ip.default(this,t),n=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(n)),yp(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,up.default(n)),n.options=r,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n.logger=pp.create("translator"),n}return cp.default(t,e),ap.default(t,[{key:"changeLanguage",value:function(e){e&&(this.language=e);}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return !1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,o=t.ns||this.options.defaultNS;if(n&&e.indexOf(n)>-1){var i=e.match(this.interpolator.nestingRegexp);if(i&&i.length>0)return {key:e,namespaces:o};var a=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(a[0])>-1)&&(o=a.shift()),e=a.join(r);}return "string"==typeof o&&(o=[o]),{key:e,namespaces:o}}},{key:"translate",value:function(e,n,r){var o=this;if("object"!==rp.default(n)&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),n||(n={}),null==e)return "";Array.isArray(e)||(e=[String(e)]);var i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],n),s=a.key,l=a.namespaces,u=l[l.length-1],c=n.lng||this.language,f=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&"cimode"===c.toLowerCase()){if(f){var d=n.nsSeparator||this.options.nsSeparator;return u+d+s}return s}var p=this.resolve(e,n),h=p&&p.res,g=p&&p.usedKey||s,v=p&&p.exactUsedKey||s,y=Object.prototype.toString.apply(h),m=["[object Number]","[object Function]","[object RegExp]"],b=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,x="string"!=typeof h&&"boolean"!=typeof h&&"number"!=typeof h;if(w&&h&&x&&m.indexOf(y)<0&&("string"!=typeof b||"[object Array]"!==y)){if(!n.returnObjects&&!this.options.returnObjects)return this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,h,op.default({},n,{ns:l})):"key '".concat(s," (").concat(this.language,")' returned an object instead of string.");if(i){var E="[object Array]"===y,S=E?[]:{},k=E?v:g;for(var O in h)if(Object.prototype.hasOwnProperty.call(h,O)){var C="".concat(k).concat(i).concat(O);S[O]=this.translate(C,op.default({},n,{joinArrays:!1,ns:l})),S[O]===C&&(S[O]=h[O]);}h=S;}}else if(w&&"string"==typeof b&&"[object Array]"===y)(h=h.join(b))&&(h=this.extendTranslation(h,e,n,r));else {var T=!1,N=!1,M=void 0!==n.count&&"string"!=typeof n.count,L=t.hasDefaultValue(n),P=M?this.pluralResolver.getSuffix(c,n.count):"",R=n["defaultValue".concat(P)]||n.defaultValue;!this.isValidLookup(h)&&L&&(T=!0,h=R),this.isValidLookup(h)||(N=!0,h=s);var D=n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,j=D&&N?void 0:h,A=L&&R!==h&&this.options.updateMissing;if(N||T||A){if(this.logger.log(A?"updateKey":"missingKey",c,u,s,A?R:h),i){var _=this.resolve(s,op.default({},n,{keySeparator:!1}));_&&_.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");}var F=[],I=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&I&&I[0])for(var B=0;B<I.length;B++)F.push(I[B]);else "all"===this.options.saveMissingTo?F=this.languageUtils.toResolveHierarchy(n.lng||this.language):F.push(n.lng||this.language);var $=function(e,t,r){o.options.missingKeyHandler?o.options.missingKeyHandler(e,u,t,A?r:j,A,n):o.backendConnector&&o.backendConnector.saveMissing&&o.backendConnector.saveMissing(e,u,t,A?r:j,A,n),o.emit("missingKey",e,u,t,h);};this.options.saveMissing&&(this.options.saveMissingPlurals&&M?F.forEach((function(e){o.pluralResolver.getSuffixes(e).forEach((function(t){$([e],s+t,n["defaultValue".concat(t)]||R);}));})):$(F,s,R));}h=this.extendTranslation(h,e,n,p,r),N&&h===s&&this.options.appendNamespaceToMissingKey&&(h="".concat(u,":").concat(s)),(N||T)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(h));}return h}},{key:"extendTranslation",value:function(e,t,n,r,o){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,n,r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(op.default({},n,{interpolation:op.default({},this.options.interpolation,n.interpolation)}));var a,s=n.interpolation&&n.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;if(s){var l=e.match(this.interpolator.nestingRegexp);a=l&&l.length;}var u=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(u=op.default({},this.options.interpolation.defaultVariables,u)),e=this.interpolator.interpolate(e,u,n.lng||this.language,n),s){var c=e.match(this.interpolator.nestingRegexp);a<(c&&c.length)&&(n.nest=!1);}!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return o&&o[0]===r[0]&&!n.context?(i.logger.warn("It seems you are nesting recursively key: ".concat(r[0]," in key: ").concat(t[0])),null):i.translate.apply(i,r.concat([t]))}),n)),n.interpolation&&this.interpolator.reset();}var f=n.postProcess||this.options.postProcess,d="string"==typeof f?[f]:f;return null!=e&&d&&d.length&&!1!==n.applyPostProcessor&&(e=Mp.handle(d,e,t,this.options&&this.options.postProcessPassResolved?op.default({i18nResolved:r},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,r,o,i,a=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return "string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,s),u=l.key;n=u;var c=l.namespaces;a.options.fallbackNS&&(c=c.concat(a.options.fallbackNS));var f=void 0!==s.count&&"string"!=typeof s.count,d=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);c.forEach((function(e){a.isValidLookup(t)||(i=e,!Lp["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(i)&&(Lp["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(i,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){o=n;var i,l,c=u,p=[c];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(p,u,n,e,s);else f&&(i=a.pluralResolver.getSuffix(n,s.count)),f&&d&&p.push(c+i),d&&p.push(c+="".concat(a.options.contextSeparator).concat(s.context)),f&&p.push(c+=i);for(;l=p.pop();)a.isValidLookup(t)||(r=l,t=a.getResource(n,e,l,s));}})));}));}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:i}}},{key:"isValidLookup",value:function(e){return !(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return !0;return !1}}]),t}(hp);function Rp(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Dp=function(){function e(t){ip.default(this,e),this.options=t,this.whitelist=this.options.supportedLngs||!1,this.supportedLngs=this.options.supportedLngs||!1,this.logger=pp.create("languageUtils");}return ap.default(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Rp(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=Rp(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=Rp(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isWhitelisted",value:function(e){return this.logger.deprecate("languageUtils.isWhitelisted",'function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it\'s usage asap.'),this.isSupportedCode(e)}},{key:"isSupportedCode",value:function(e){return ("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r);}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}));}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return [];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),o=[],i=function(e){e&&(n.isSupportedCode(e)?o.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)));};return "string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):"string"==typeof e&&i(this.formatLanguageCode(e)),r.forEach((function(e){o.indexOf(e)<0&&i(n.formatLanguageCode(e));})),o}}]),e}(),jp=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Ap={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}};function _p(){var e={};return jp.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:Ap[t.fc]};}));})),e}var Fp=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ip.default(this,e),this.languageUtils=t,this.options=n,this.logger=pp.create("pluralResolver"),this.rules=_p();}return ap.default(e,[{key:"addRule",value:function(e,t){this.rules[e]=t;}},{key:"getRule",value:function(e){return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=this.getRule(e);return t&&t.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){return this.getSuffixes(e).map((function(e){return t+e}))}},{key:"getSuffixes",value:function(e){var t=this,n=this.getRule(e);return n?n.numbers.map((function(n){return t.getSuffix(e,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=this,r=this.getRule(e);if(r){var o=r.noAbs?r.plurals(t):r.plurals(Math.abs(t)),i=r.numbers[o];this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var a=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return "v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):a():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===r.numbers.length&&1===r.numbers[0]?a():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}return this.logger.warn("no plural rule found for: ".concat(e)),""}}]),e}(),Ip=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ip.default(this,e),this.logger=pp.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t);}return ap.default(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:Op,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Sp(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Sp(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?Sp(t.nestingPrefix):t.nestingPrefixEscaped||Sp("$t("),this.nestingSuffix=t.nestingSuffix?Sp(t.nestingSuffix):t.nestingSuffixEscaped||Sp(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp();}},{key:"reset",value:function(){this.options&&this.init(this.options);}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g");}},{key:"interpolate",value:function(e,t,n,r){var o,i,a,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(e.indexOf(s.formatSeparator)<0){var o=xp(t,l,e);return s.alwaysFormat?s.format(o,void 0,n,op.default({},r,t,{interpolationkey:e})):o}var i=e.split(s.formatSeparator),a=i.shift().trim(),u=i.join(s.formatSeparator).trim();return s.format(xp(t,l,a),u,n,op.default({},r,t,{interpolationkey:a}))};this.resetRegExp();var f=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,d=r&&r.interpolation&&r.interpolation.skipOnVariables||this.options.interpolation.skipOnVariables;return [{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?u(s.escape(e)):u(e)}}].forEach((function(t){for(a=0;o=t.regex.exec(e);){if(void 0===(i=c(o[1].trim())))if("function"==typeof f){var n=f(e,o,r);i="string"==typeof n?n:"";}else {if(d){i=o[0];continue}s.logger.warn("missed to pass in variable ".concat(o[1]," for interpolating ").concat(e)),i="";}else "string"==typeof i||s.useRawValueToEscape||(i=vp(i));var l=t.safeValue(i);if(e=e.replace(o[0],l),d?(t.regex.lastIndex+=l.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,o=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=op.default({},i);function s(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),o="{".concat(r[1]);e=r[0],o=(o=this.interpolate(o,a)).replace(/'/g,'"');try{a=JSON.parse(o),t&&(a=op.default({},t,a));}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(o)}return delete a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.defaultValue;n=this.nestingRegexp.exec(e);){var l=[],u=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var c=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=c.shift(),l=c,u=!0;}if((r=t(s.call(this,n[1].trim(),a),a))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=vp(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),u&&(r=l.reduce((function(e,t){return o.format(e,t,i.lng,op.default({},i,{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0;}return e}}]),e}();var Bp=function(e){function t(e,n,r){var o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return ip.default(this,t),o=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(o)),o.backend=e,o.store=n,o.services=r,o.languageUtils=r.languageUtils,o.options=i,o.logger=pp.create("backendConnector"),o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(r,i.backend,i),o}return cp.default(t,e),ap.default(t,[{key:"queueLoad",value:function(e,t,n,r){var o=this,i=[],a=[],s=[],l=[];return e.forEach((function(e){var r=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&o.store.hasResourceBundle(e,t)?o.state[s]=2:o.state[s]<0||(1===o.state[s]?a.indexOf(s)<0&&a.push(s):(o.state[s]=1,r=!1,a.indexOf(s)<0&&a.push(s),i.indexOf(s)<0&&i.push(s),l.indexOf(t)<0&&l.push(t)));})),r||s.push(e);})),(i.length||a.length)&&this.queue.push({pending:a,loaded:{},errors:[],callback:r}),{toLoad:i,pending:a,toLoadLanguages:s,toLoadNamespaces:l}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),o=r[0],i=r[1];t&&this.emit("failedLoading",o,i,t),n&&this.store.addResourceBundle(o,i,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){!function(e,t,n,r){var o=mp(e,t,Object),i=o.obj,a=o.k;i[a]=i[a]||[],r&&(i[a]=i[a].concat(n)),r||i[a].push(n);}(n.loaded,[o],i),function(e,t){for(var n=e.indexOf(t);-1!==n;)e.splice(n,1),n=e.indexOf(t);}(n.pending,e),t&&n.errors.push(t),0!==n.pending.length||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]=[]),n.loaded[e].length&&n.loaded[e].forEach((function(t){a[e].indexOf(t)<0&&a[e].push(t);}));})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback());})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return !e.done}));}},{key:"read",value:function(e,t,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,a=arguments.length>5?arguments[5]:void 0;return e.length?this.backend[n](e,t,(function(s,l){s&&l&&o<5?setTimeout((function(){r.read.call(r,e,t,n,o+1,2*i,a);}),i):a(s,l);})):a(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var i=this.queueLoad(e,t,r,o);if(!i.toLoad.length)return i.pending.length||o(),null;i.toLoad.forEach((function(e){n.loadOne(e);}));}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n);}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n);}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),o=r[0],i=r[1];this.read(o,i,"read",void 0,void 0,(function(r,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(i," for language ").concat(o," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(i," for language ").concat(o),a),t.loaded(e,r,a);}));}},{key:"saveMissing",value:function(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,r,null,op.default({},i,{isUpdate:o})),e&&e[0]&&this.store.addResource(e[0],t,n,r));}}]),t}(hp);function $p(){return {debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===rp.default(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===rp.default(e[2])||"object"===rp.default(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e];}));}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!1}}}function Wp(e){return "string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.whitelist&&(e.whitelist&&e.whitelist.indexOf("cimode")<0&&(e.whitelist=e.whitelist.concat(["cimode"])),e.supportedLngs=e.whitelist),e.nonExplicitWhitelist&&(e.nonExplicitSupportedLngs=e.nonExplicitWhitelist),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Hp(){}var Vp=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(ip.default(this,t),e=sp.default(this,lp.default(t).call(this)),Cp&&hp.call(up.default(e)),e.options=Wp(n),e.services={},e.logger=pp,e.modules={external:[]},r&&!e.isInitialized&&!n.isClone){if(!e.options.initImmediate)return e.init(n,r),sp.default(e,up.default(e));setTimeout((function(){e.init(n,r);}),0);}return e}return cp.default(t,e),ap.default(t,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;function r(e){return e?"function"==typeof e?new e:e:null}if("function"==typeof t&&(n=t,t={}),t.whitelist&&!t.supportedLngs&&this.logger.deprecate("whitelist",'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.'),t.nonExplicitWhitelist&&!t.nonExplicitSupportedLngs&&this.logger.deprecate("whitelist",'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.'),this.options=op.default({},$p(),this.options,Wp(t)),this.format=this.options.interpolation.format,n||(n=Hp),!this.options.isClone){this.modules.logger?pp.init(r(this.modules.logger),this.options):pp.init(null,this.options);var o=new Dp(this.options);this.store=new Np(this.options.resources,this.options);var i=this.services;i.logger=pp,i.resourceStore=this.store,i.languageUtils=o,i.pluralResolver=new Fp(o,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),i.interpolator=new Ip(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new Bp(r(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e.emit.apply(e,[t].concat(r));})),this.modules.languageDetector&&(i.languageDetector=r(this.modules.languageDetector),i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=r(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new Pp(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e.emit.apply(e,[t].concat(r));})),this.modules.external.forEach((function(t){t.init&&t.init(e);}));}if(this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var a=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);a.length>0&&"dev"!==a[0]&&(this.options.lng=a[0]);}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var s=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];s.forEach((function(t){e[t]=function(){var n;return (n=e.store)[t].apply(n,arguments)};}));var l=["addResource","addResources","addResourceBundle","removeResourceBundle"];l.forEach((function(t){e[t]=function(){var n;return (n=e.store)[t].apply(n,arguments),e};}));var u=gp(),c=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),u.resolve(r),n(t,r);};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t);};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),u}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hp,r=n,o="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(o&&"cimode"===o.toLowerCase())return r();var i=[],a=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e);}));};if(o)a(o);else {var s=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);s.forEach((function(e){return a(e)}));}this.options.preload&&this.options.preload.forEach((function(e){return a(e)})),this.services.backendConnector.load(i,this.options.ns,r);}else r(null);}},{key:"reloadResources",value:function(e,t,n){var r=gp();return e||(e=this.languages),t||(t=this.options.ns),n||(n=Hp),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e);})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return "backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Mp.addPostProcessor(e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=gp();this.emit("languageChanging",e);var o=function(o){e||o||!n.services.languageDetector||(o=[]);var i="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);i&&(n.language||(n.language=i,n.languages=n.services.languageUtils.toResolveHierarchy(i)),n.translator.language||n.translator.changeLanguage(i),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(i)),n.loadResources(i,(function(e){!function(e,o){o?(n.language=o,n.languages=n.services.languageUtils.toResolveHierarchy(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}));}(e,i);}));};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,o=function e(t,o){var i;if("object"!==rp.default(o)){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l<a;l++)s[l-2]=arguments[l];i=r.options.overloadTranslationOptionHandler([t,o].concat(s));}else i=op.default({},o);i.lng=i.lng||e.lng,i.lngs=i.lngs||e.lngs,i.ns=i.ns||e.ns;var u=r.options.keySeparator||".",c=n?"".concat(n).concat(u).concat(t):t;return r.t(c,i)};return "string"==typeof e?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=n,o}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e;}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.languages[0],o=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return !0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return -1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return !!this.hasResourceBundle(r,e)||(!this.services.backendConnector.backend||!(!a(r,e)||o&&!a(i,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=gp();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e);})),this.loadResources((function(e){r.resolve(),t&&t(e);})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=gp();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],o=e.filter((function(e){return r.indexOf(e)<0}));return o.length?(this.options.preload=r.concat(o),this.loadResources((function(e){n.resolve(),t&&t(e);})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.languages&&this.languages.length>0?this.languages[0]:this.language),!e)return "rtl";return ["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>=0?"rtl":"ltr"}},{key:"createInstance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new t(e,n)}},{key:"cloneInstance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Hp,o=op.default({},this.options,n,{isClone:!0}),i=new t(o),a=["store","services","language"];return a.forEach((function(t){i[t]=e[t];})),i.services=op.default({},this.services),i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i.translator=new Pp(i.services,i.options),i.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];i.emit.apply(i,[e].concat(n));})),i.init(o,r),i.translator.options=i.options,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}},{key:"toJSON",value:function(){return {options:this.options,store:this.store,language:this.language,languages:this.languages}}}]),t}(hp),zp=new Vp,Up="translation";zp.init({lng:"zh-CN",resources:{}});var Kp=zp.t.bind(zp);e.DomEditor=Hs,e.ELEM_TO_HTML_CONF=ol,e.PARSE_ELEM_HTML_CONF=Zu,e.PARSE_STYLE_HTML_FN_LIST=Qu,e.PRE_PARSE_HTML_CONF_LIST=Xu,e.RENDER_ELEM_CONF=Ff,e.RENDER_STYLE_HANDLER_LIST=_f,e.STYLE_TO_HTML_FN_LIST=rl,e.TEXT_TAGS=Yu,e.Toolbar=Bd,e.coreCreateEditor=function(e){var n=e.selector,r=void 0===n?"":n,o=e.config,i=void 0===o?{}:o,a=e.content,s=e.html,l=e.plugins,u=void 0===l?[]:l,c=Qn(function(e){var n=e,r=n.insertText,o=n.insertNode,i=n.insertFragment,a=n.dangerouslyInsertHtml;return n.insertText=function(e){if(n.getConfig().maxLength){var t=Hs.getLeftLengthOfMaxLength(n);t<=0||(t<e.length?r(e.slice(0,t)):r(e));}else r(e);},n.insertNode=function(e){if(n.getConfig().maxLength){var r=Hs.getLeftLengthOfMaxLength(n);r<=0||r<t.Node.string(e).length||o(e);}else o(e);},n.insertFragment=function(e){if(n.getConfig().maxLength)if(1!==e.length)e.forEach((function(e){n.insertNode(e);}));else {var r=e[0];if(Hs.getLeftLengthOfMaxLength(n)<t.Node.string(r).length)return;i(e);}else i(e);},n.dangerouslyInsertHtml=function(e,t){if(void 0===e&&(e=""),void 0===t&&(t=!1),e)if(n.getConfig().maxLength){var r=Hs.getLeftLengthOfMaxLength(n);if(!(r<=0)){var o=document.createElement("div");o.innerHTML=e;var i=Array.from(o.childNodes).reduce((function(e,t){var n=t.nodeType,r=t.nodeName;return t?n===Ss.TEXT_NODE?e+(t.textContent||""):n===Ss.ELEMENT_NODE?Ic.has(r.toLowerCase())?e:e+(t.textContent||""):e:e}),"");r<i.length||a(e,t);}}else a(e,t);},n}(function(e){var t=e;return t.on=function(e,n){var r=ff(t);if(r.on(e,n),"destroyed"===e&&pf(t,n),"destroyed"!==e){var o=function(){return r.off(e,n)};r.on("destroyed",o),pf(t,o);}},t.once=function(e,n){ff(t).once(e,n);},t.off=function(e,n){ff(t).off(e,n);},t.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=ff(t);(o.emit.apply(o,Ji([e],Gi(n))),"destroyed"===e)&&(hf(t).forEach((function(e){return o.off("destroyed",e)})),gf(t));},t}(function(e){var n=e;return n.select=function(e){t.Transforms.select(n,e);},n.deselect=function(){var r=n.selection,o=Hs.findDocumentOrShadowRoot(n).getSelection();o&&o.rangeCount>0&&o.removeAllRanges(),r&&t.Transforms.deselect(e);},n.move=function(n,r){void 0===r&&(r=!1),n&&(n<0||t.Transforms.move(e,{distance:n,unit:"character",reverse:r}));},n.moveReverse=function(e){n.move(e,!0);},n.restoreSelection=function(){var e=vs.get(n);null!=e&&(n.focus(),t.Transforms.select(n,e));},n.getSelectionPosition=function(){return yf(n)},n.getNodePosition=function(e){return mf(n,e)},n.isSelectedAll=function(){var e=n.selection;if(null==e)return !1;var r=Gi(t.Range.edges(e),2),o=r[0],i=r[1],a=Gi(t.Editor.edges(n,[]),2),s=a[0],l=a[1];return !(!t.Point.equals(o,s)||!t.Point.equals(i,l))},n.selectAll=function(){var e=t.Editor.start(n,[]),r=t.Editor.end(n,[]);t.Transforms.select(n,{anchor:e,focus:r});},n}($c(function(e){var t=e;return t.getAllMenuKeys=function(){var e=[];for(var t in Us)e.push(t);return e},t.getConfig=function(){var e=rs.get(t);if(null==e)throw new Error("Can not get editor config");return e},t.getMenuConfig=function(e){var n=t.getConfig().MENU_CONF;return (void 0===n?{}:n)[e]||{}},t.alert=function(e,n){void 0===n&&(n="info");var r=t.getConfig().customAlert;r&&r(e,n);},t}(function(e){var n=e;return n.id="wangEditor-"+Vs++,n.isDestroyed=!1,n.isFullScreen=!1,n.focus=function(e){if(Hs.toDOMNode(n,n).focus({preventScroll:!0}),gs.set(n,!0),e){var r=t.Editor.end(n,[]);t.Transforms.select(n,r);}else {var o=vs.get(n);o?t.Transforms.select(n,o):t.Transforms.select(n,t.Editor.start(n,[]));}},n.isFocused=function(){return !!gs.get(n)},n.blur=function(){Hs.toDOMNode(n,n).blur(),t.Transforms.deselect(n),gs.set(n,!1);},n.updateView=function(){Hs.getTextarea(n).changeViewState();var e=Hs.getToolbar(n);e&&e.changeToolbarState();var t=Hs.getHoverbar(n);t&&t.changeHoverbarState();},n.destroy=function(){if(!n.isDestroyed){var e=Hs.getTextarea(n);e.destroy(),Ga.delete(n),Ja.delete(e);var t=Hs.getToolbar(n);t&&(t.destroy(),Xa.delete(n),Ya.delete(t));var r=Hs.getHoverbar(n);r&&(r.destroy(),Za.delete(n),Qa.delete(r)),n.isDestroyed=!0,n.emit("destroyed");}},n.scrollToElem=function(e){if(!n.getConfig().scroll){var t="编辑器禁用了 scroll ,编辑器内容无法滚动,请自行实现该功能";return t+="\nYou has disabled editor scroll, please do this yourself",void console.warn(t)}var r=y.default("#"+e);if(0!==r.length){var o=r[0];if(!Hs.hasDOMNode(n,o))return t="Element (found by id is '"+e+"') is not in editor DOM",t+="\n 通过 id '"+e+"' 找到的 element 不在 editor DOM 之内",void console.error(t,o);var i=Hs.getTextarea(n),a=i.$textAreaContainer,s=i.$scroll,l=r.offset().top,u=a.offset().top;s[0].scrollBy({top:l-u,behavior:"smooth"});}},n.showProgressBar=function(e){e<1||Hs.getTextarea(n).changeProgress(e);},n.hidePanelOrModal=function(){var e=ts.get(n);null!=e&&e.forEach((function(e){return e.hide()}));},n.enable=function(){n.getConfig().readOnly=!1,n.updateView();},n.disable=function(){n.getConfig().readOnly=!0,n.updateView();},n.isDisabled=function(){return n.getConfig().readOnly},n.toDOMNode=function(e){return Hs.toDOMNode(n,e)},n.fullScreen=function(){if(!n.isFullScreen){var e=null,t=Hs.getToolbar(n);t&&(e=t.$box);var r=Hs.getTextarea(n).$box.parent();if(e&&e.parent()[0]!==r[0])throw new Error("Can not set full screen, cause toolbar DOM parent is not equal to textarea DOM parent\n不能设置全屏,因为 toolbar DOM 父节点和 textarea DOM 父节点不一致");r.addClass("w-e-full-screen-container");var o=r.css("z-index");r.attr("data-z-index",o.toString()),n.isFullScreen=!0,n.emit("fullScreen");}},n.unFullScreen=function(){if(n.isFullScreen){var e=Hs.getTextarea(n).$box.parent();setTimeout((function(){e.removeClass("w-e-full-screen-container"),n.isFullScreen=!1,n.emit("unFullScreen");}),200);}},n.getEditableContainer=function(){return Hs.getTextarea(n).$textAreaContainer[0]},n}(Wc(t.createEditor()))))))));if(r&&function(e,t){return Pc(e,"data-w-e-textarea",t)}(c,r))throw new Error("Repeated create editor by selector '"+r+"'");var f=function(e){void 0===e&&(e={});var t=E.default(zs),n={},r=e.MENU_CONF,o=void 0===r?{}:r;return m.default(t,(function(e,t){n[t]=Ki(Ki({},e),o[t]||{});})),delete e.MENU_CONF,Ki({scroll:!0,readOnly:!1,autoFocus:!0,decorate:function(){return []},maxLength:0,MENU_CONF:n,hoverbarKeys:{},customAlert:function(e,t){window.alert(t+":\n"+e);}},e)}(i);rs.set(c,f);var d=f.hoverbarKeys,p=void 0===d?{}:d;if(u.forEach((function(e){c=e(c);})),null!=s&&(c.children=Rc(c,s)),a&&a.length&&(c.children=a),0===c.children.length&&(c.children=[{type:"paragraph",children:[{text:""}]}]),Hs.normalizeContent(c),r){var h=new dd(r);Ga.set(c,h),Ja.set(h,c),h.changeViewState(),Uu((function(){var e=h.$scroll;if(null!=e&&e.height()<300){console.warn("编辑区域高度 < 300px 这可能会导致 modal hoverbar 定位异常\nTextarea height < 300px . This may be cause modal and hoverbar position error",e);}}));var g=void 0;Object.keys(p).length>0&&(g=new Pd,Qa.set(g,c),Za.set(c,g)),c.on("change",(function(){c.hidePanelOrModal();})),c.on("scroll",(function(){c.hidePanelOrModal();}));}else c.children.forEach((function(e,t){return Rd(e,t,c,c)}));var v=f.onCreated,b=f.onDestroyed;return v&&c.on("created",(function(){return v(c)})),b&&c.on("destroyed",(function(){return b(c)})),Uu((function(){return c.emit("created")})),c},e.coreCreateToolbar=function(e,t){if(null==e)throw new Error("Cannot create toolbar, because editor is null");var n=t.selector,r=t.config,o=void 0===r?{}:r;if(function(e,t){return Pc(e,"data-w-e-toolbar",t)}(e,n))throw new Error("Repeated create toolbar by selector '"+n+"'");var i=Ki({toolbarKeys:[],excludeKeys:[],insertKeys:{index:0,keys:[]},modalAppendToBody:!1},o||{}),a=new Bd(n,i);return Ya.set(a,e),Xa.set(e,a),a},e.createUploader=function(e){var t=e.server,n=void 0===t?"":t,r=e.fieldName,o=void 0===r?"":r,i=e.maxFileSize,a=void 0===i?10485760:i,s=e.maxNumberOfFiles,l=void 0===s?100:s,u=e.meta,c=void 0===u?{}:u,f=e.metaWithUrl,d=void 0!==f&&f,p=e.headers,h=void 0===p?{}:p,g=e.withCredentials,v=void 0!==g&&g,y=e.timeout,b=void 0===y?1e4:y,w=e.onBeforeUpload,x=void 0===w?function(e){return e}:w,E=e.onSuccess,O=void 0===E?function(e,t){}:E,C=e.onError,T=void 0===C?function(e,t,n){console.error(e.name+" upload error",t,n);}:C,N=e.onProgress,M=void 0===N?function(e){}:N;if(!n)throw new Error("Cannot get upload server address\n没有配置上传地址");if(!o)throw new Error("Cannot get fieldName\n没有配置 fieldName");var L=n;d&&(L=function(e,t){var n=Gi(e.split("#"),2),r=n[0],o=n[1],i=[];m.default(t,(function(e,t){i.push(t+"="+e);}));var a=i.join("&");return r=r.indexOf("?")>0?r+"&"+a:r+"?"+a,o?r+"#"+o:r}(L,c));var P=new S.default({onBeforeUpload:x,restrictions:{maxFileSize:a,maxNumberOfFiles:l},meta:c}).use(k.default,{endpoint:L,headers:h,formData:!0,fieldName:o,bundle:!0,withCredentials:v,timeout:b});return P.on("upload-success",(function(e,t){var n=t.body,r=void 0===n?{}:n;try{O(e,r);}catch(e){console.error("wangEditor upload file - onSuccess error",e);}P.removeFile(e.id);})),P.on("progress",(function(e){e<1||M(e);})),P.on("upload-error",(function(e,t,n){try{T(e,t,n);}catch(e){console.error("wangEditor upload file - onError error",e);}P.removeFile(e.id);})),P.on("restriction-failed",(function(e,t){try{T(e,t);}catch(e){console.error("wangEditor upload file - onError error",e);}P.removeFile(e.id);})),P},e.genModalButtonElems=function(e,t){var n=y.default('<div class="button-container"></div>'),r=y.default('<button type="button" id="'+e+'">'+t+"</button>");return n.append(r),[n[0],r[0]]},e.genModalInputElems=function(e,t,n){var r=y.default('<label class="babel-container"></label>');r.append("<span>"+e+"</span>");var o=y.default('<input type="text" id="'+t+'" placeholder="'+(n||"")+'">');return r.append(o),[r[0],o[0]]},e.genModalTextareaElems=function(e,t,n){var r=y.default('<label class="babel-container"></label>');r.append("<span>"+e+"</span>");var o=y.default('<textarea type="text" id="'+t+'" placeholder="'+(n||"")+'"></textarea>');return r.append(o),[r[0],o[0]]},e.i18nAddResources=function(e,t){zp.addResourceBundle(e,Up,t,!0,!0);},e.i18nChangeLanguage=function(e){zp.changeLanguage(e);},e.i18nGetResources=function(e){return zp.getResourceBundle(e,Up)},e.registerElemToHtmlConf=function(e){var t=e.type,n=e.elemToHtml;ol[t||""]=n;},e.registerMenu=function(e,t){var n=e.key,r=e.factory,o=e.config,i=Ki(Ki({},o),t||{});if(null!=Us[n])throw new Error("Duplicated key '"+n+"' in menu items");Us[n]=r,function(e,t){null!=t&&(zs[e]=t);}(n,i);},e.registerParseElemHtmlConf=function(e){var t=e.selector,n=e.parseElemHtml;Zu[t]=n;},e.registerParseStyleHtmlHandler=function(e){Qu.push(e);},e.registerPreParseHtmlConf=function(e){Xu.push(e);},e.registerRenderElemConf=function(e){var t=e.type,n=e.renderElem;Ff[t||""]=n;},e.registerStyleHandler=function(e){_f.push(e);},e.registerStyleToHtmlHandler=function(e){rl.push(e);},e.t=Kp,Object.defineProperty(e,"__esModule",{value:!0});}));
  18481. });
  18482. /**
  18483. * @description i18n en
  18484. * @author wangfupeng
  18485. */
  18486. var enResources = {
  18487. editor: {
  18488. more: 'More',
  18489. justify: 'Justify',
  18490. indent: 'Indent',
  18491. image: 'Image',
  18492. video: 'Video',
  18493. },
  18494. };
  18495. /**
  18496. * @description i18n zh-CN
  18497. * @author wangfupeng
  18498. */
  18499. var zhResources = {
  18500. editor: {
  18501. more: '更多',
  18502. justify: '对齐',
  18503. indent: '缩进',
  18504. image: '图片',
  18505. video: '视频',
  18506. },
  18507. };
  18508. /**
  18509. * @description i18n entry
  18510. * @author wangfupeng
  18511. */
  18512. dist$6.i18nAddResources('en', enResources);
  18513. dist$6.i18nAddResources('zh-CN', zhResources);
  18514. var dist$5 = createCommonjsModule$1(function (module, exports) {
  18515. !function(t,e){e(exports,dist$6,require$$2,require$$2$1,require$$1,require$$4,lodash_throttle);}(commonjsGlobal,(function(t,e,n,r,o,i,u){function a(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c=a(o),l=a(u);e.i18nAddResources("en",{common:{ok:"OK",delete:"Delete",enter:"Enter"},blockQuote:{title:"Quote"},codeBlock:{title:"Code block"},color:{color:"Font color",bgColor:"Back color",default:"Default color",clear:"Clear back color"},divider:{title:"Divider"},emotion:{title:"Emotion"},fontSize:{title:"Font size",default:"Default"},fontFamily:{title:"Font family",default:"Default"},fullScreen:{title:"Full screen"},header:{title:"Header",text:"Text"},image:{netImage:"Net image",delete:"Delete image",edit:"Edit image",viewLink:"View link",src:"Image src",desc:"Description",link:"Image link"},indent:{decrease:"Decrease",increase:"Increase"},justify:{left:"Left",right:"Right",center:"Center",justify:"Justify"},lineHeight:{title:"Line height",default:"Default"},link:{insert:"Insert link",text:"Link text",url:"Link source",unLink:"Unlink",edit:"Edit link",view:"View link"},textStyle:{bold:"Bold",clear:"Clear styles",code:"Inline code",italic:"Italic",sub:"Sub",sup:"Sup",through:"Through",underline:"Underline"},undo:{undo:"undo",redo:"Redo"},todo:{todo:"Todo"}}),e.i18nAddResources("zh-CN",{common:{ok:"确定",delete:"删除",enter:"回车"},blockQuote:{title:"引用"},codeBlock:{title:"代码块"},color:{color:"文字颜色",bgColor:"背景色",default:"默认颜色",clear:"清除背景色"},divider:{title:"分割线"},emotion:{title:"表情"},fontSize:{title:"字号",default:"默认字号"},fontFamily:{title:"字体",default:"默认字体"},fullScreen:{title:"全屏"},header:{title:"标题",text:"正文"},image:{netImage:"网络图片",delete:"删除图片",edit:"编辑图片",viewLink:"查看链接",src:"图片地址",desc:"图片描述",link:"图片链接"},indent:{decrease:"减少缩进",increase:"增加缩进"},justify:{left:"左对齐",right:"右对齐",center:"居中对齐",justify:"两端对齐"},lineHeight:{title:"行高",default:"默认行高"},link:{insert:"插入链接",text:"链接文本",url:"链接地址",unLink:"取消链接",edit:"修改链接",view:"查看链接"},textStyle:{bold:"粗体",clear:"清除格式",code:"行内代码",italic:"斜体",sub:"下标",sup:"上标",through:"删除线",underline:"下划线"},undo:{undo:"撤销",redo:"重做"},todo:{todo:"待办"}});var s={type:"paragraph",renderElem:function(t,e,r){return n.jsx("p",null,e)}};var f={type:"paragraph",elemToHtml:function(t,e){return ""===e?"<p><br></p>":"<p>"+e+"</p>"}},d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{};function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function h(t){var e={exports:{}};return t(e,e.exports),e.exports}var v,g,m=function(t){return t&&t.Math==Math&&t},y=m("object"==typeof globalThis&&globalThis)||m("object"==typeof window&&window)||m("object"==typeof self&&self)||m("object"==typeof d&&d)||function(){return this}()||Function("return this")(),b=function(t){try{return !!t()}catch(t){return !0}},x=!b((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),w=Function.prototype.call,E=w.bind?w.bind(w):function(){return w.apply(w,arguments)},S={}.propertyIsEnumerable,k=Object.getOwnPropertyDescriptor,T=k&&!S.call({1:2},1)?function(t){var e=k(this,t);return !!e&&e.enumerable}:S,M={f:T},I=function(t,e){return {enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},N=Function.prototype,H=N.bind,O=N.call,j=H&&H.bind(O),D=H?function(t){return t&&j(O,t)}:function(t){return t&&function(){return O.apply(t,arguments)}},L=D({}.toString),z=D("".slice),A=function(t){return z(L(t),8,-1)},P=y.Object,C=D("".split),V=b((function(){return !P("z").propertyIsEnumerable(0)}))?function(t){return "String"==A(t)?C(t,""):P(t)}:P,B=y.TypeError,R=function(t){if(null==t)throw B("Can't call method on "+t);return t},F=function(t){return V(R(t))},_=function(t){return "function"==typeof t},q=function(t){return "object"==typeof t?null!==t:_(t)},$=function(t){return _(t)?t:void 0},W=function(t,e){return arguments.length<2?$(y[t]):y[t]&&y[t][e]},G=D({}.isPrototypeOf),U=W("navigator","userAgent")||"",X=y.process,Y=y.Deno,J=X&&X.versions||Y&&Y.version,K=J&&J.v8;K&&(g=(v=K.split("."))[0]>0&&v[0]<4?1:+(v[0]+v[1])),!g&&U&&(!(v=U.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=U.match(/Chrome\/(\d+)/))&&(g=+v[1]);var Q=g,Z=!!Object.getOwnPropertySymbols&&!b((function(){var t=Symbol();return !String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Q&&Q<41})),tt=Z&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,et=y.Object,nt=tt?function(t){return "symbol"==typeof t}:function(t){var e=W("Symbol");return _(e)&&G(e.prototype,et(t))},rt=y.String,ot=function(t){try{return rt(t)}catch(t){return "Object"}},it=y.TypeError,ut=function(t){if(_(t))return t;throw it(ot(t)+" is not a function")},at=function(t,e){var n=t[e];return null==n?void 0:ut(n)},ct=y.TypeError,lt=Object.defineProperty,st=function(t,e){try{lt(y,t,{value:e,configurable:!0,writable:!0});}catch(n){y[t]=e;}return e},ft="__core-js_shared__",dt=y[ft]||st(ft,{}),pt=h((function(t){(t.exports=function(t,e){return dt[t]||(dt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});})),ht=y.Object,vt=function(t){return ht(R(t))},gt=D({}.hasOwnProperty),mt=Object.hasOwn||function(t,e){return gt(vt(t),e)},yt=0,bt=Math.random(),xt=D(1..toString),wt=function(t){return "Symbol("+(void 0===t?"":t)+")_"+xt(++yt+bt,36)},Et=pt("wks"),St=y.Symbol,kt=St&&St.for,Tt=tt?St:St&&St.withoutSetter||wt,Mt=function(t){if(!mt(Et,t)||!Z&&"string"!=typeof Et[t]){var e="Symbol."+t;Z&&mt(St,t)?Et[t]=St[t]:Et[t]=tt&&kt?kt(e):Tt(e);}return Et[t]},It=y.TypeError,Nt=Mt("toPrimitive"),Ht=function(t,e){if(!q(t)||nt(t))return t;var n,r=at(t,Nt);if(r){if(void 0===e&&(e="default"),n=E(r,t,e),!q(n)||nt(n))return n;throw It("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,r;if("string"===e&&_(n=t.toString)&&!q(r=E(n,t)))return r;if(_(n=t.valueOf)&&!q(r=E(n,t)))return r;if("string"!==e&&_(n=t.toString)&&!q(r=E(n,t)))return r;throw ct("Can't convert object to primitive value")}(t,e)},Ot=function(t){var e=Ht(t,"string");return nt(e)?e:e+""},jt=y.document,Dt=q(jt)&&q(jt.createElement),Lt=function(t){return Dt?jt.createElement(t):{}},zt=!x&&!b((function(){return 7!=Object.defineProperty(Lt("div"),"a",{get:function(){return 7}}).a})),At=Object.getOwnPropertyDescriptor,Pt={f:x?At:function(t,e){if(t=F(t),e=Ot(e),zt)try{return At(t,e)}catch(t){}if(mt(t,e))return I(!E(M.f,t,e),t[e])}},Ct=y.String,Vt=y.TypeError,Bt=function(t){if(q(t))return t;throw Vt(Ct(t)+" is not an object")},Rt=y.TypeError,Ft=Object.defineProperty,_t={f:x?Ft:function(t,e,n){if(Bt(t),e=Ot(e),Bt(n),zt)try{return Ft(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Rt("Accessors not supported");return "value"in n&&(t[e]=n.value),t}},qt=x?function(t,e,n){return _t.f(t,e,I(1,n))}:function(t,e,n){return t[e]=n,t},$t=D(Function.toString);_(dt.inspectSource)||(dt.inspectSource=function(t){return $t(t)});var Wt,Gt,Ut,Xt=dt.inspectSource,Yt=y.WeakMap,Jt=_(Yt)&&/native code/.test(Xt(Yt)),Kt=pt("keys"),Qt=function(t){return Kt[t]||(Kt[t]=wt(t))},Zt={},te="Object already initialized",ee=y.TypeError,ne=y.WeakMap;if(Jt||dt.state){var re=dt.state||(dt.state=new ne),oe=D(re.get),ie=D(re.has),ue=D(re.set);Wt=function(t,e){if(ie(re,t))throw new ee(te);return e.facade=t,ue(re,t,e),e},Gt=function(t){return oe(re,t)||{}},Ut=function(t){return ie(re,t)};}else {var ae=Qt("state");Zt[ae]=!0,Wt=function(t,e){if(mt(t,ae))throw new ee(te);return e.facade=t,qt(t,ae,e),e},Gt=function(t){return mt(t,ae)?t[ae]:{}},Ut=function(t){return mt(t,ae)};}var ce={set:Wt,get:Gt,has:Ut,enforce:function(t){return Ut(t)?Gt(t):Wt(t,{})},getterFor:function(t){return function(e){var n;if(!q(e)||(n=Gt(e)).type!==t)throw ee("Incompatible receiver, "+t+" required");return n}}},le=Function.prototype,se=x&&Object.getOwnPropertyDescriptor,fe=mt(le,"name"),de={EXISTS:fe,PROPER:fe&&"something"===function(){}.name,CONFIGURABLE:fe&&(!x||x&&se(le,"name").configurable)},pe=h((function(t){var e=de.CONFIGURABLE,n=ce.get,r=ce.enforce,o=String(String).split("String");(t.exports=function(t,n,i,u){var a,c=!!u&&!!u.unsafe,l=!!u&&!!u.enumerable,s=!!u&&!!u.noTargetGet,f=u&&void 0!==u.name?u.name:n;_(i)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!mt(i,"name")||e&&i.name!==f)&&qt(i,"name",f),(a=r(i)).source||(a.source=o.join("string"==typeof f?f:""))),t!==y?(c?!s&&t[n]&&(l=!0):delete t[n],l?t[n]=i:qt(t,n,i)):l?t[n]=i:st(n,i);})(Function.prototype,"toString",(function(){return _(this)&&n(this).source||Xt(this)}));})),he=Math.ceil,ve=Math.floor,ge=function(t){var e=+t;return e!=e||0===e?0:(e>0?ve:he)(e)},me=Math.max,ye=Math.min,be=function(t,e){var n=ge(t);return n<0?me(n+e,0):ye(n,e)},xe=Math.min,we=function(t){return t>0?xe(ge(t),9007199254740991):0},Ee=function(t){return we(t.length)},Se=function(t){return function(e,n,r){var o,i=F(e),u=Ee(i),a=be(r,u);if(t&&n!=n){for(;u>a;)if((o=i[a++])!=o)return !0}else for(;u>a;a++)if((t||a in i)&&i[a]===n)return t||a||0;return !t&&-1}},ke={includes:Se(!0),indexOf:Se(!1)},Te=ke.indexOf,Me=D([].push),Ie=function(t,e){var n,r=F(t),o=0,i=[];for(n in r)!mt(Zt,n)&&mt(r,n)&&Me(i,n);for(;e.length>o;)mt(r,n=e[o++])&&(~Te(i,n)||Me(i,n));return i},Ne=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],He=Ne.concat("length","prototype"),Oe={f:Object.getOwnPropertyNames||function(t){return Ie(t,He)}},je={f:Object.getOwnPropertySymbols},De=D([].concat),Le=W("Reflect","ownKeys")||function(t){var e=Oe.f(Bt(t)),n=je.f;return n?De(e,n(t)):e},ze=function(t,e){for(var n=Le(e),r=_t.f,o=Pt.f,i=0;i<n.length;i++){var u=n[i];mt(t,u)||r(t,u,o(e,u));}},Ae=/#|\.prototype\./,Pe=function(t,e){var n=Ve[Ce(t)];return n==Re||n!=Be&&(_(e)?b(e):!!e)},Ce=Pe.normalize=function(t){return String(t).replace(Ae,".").toLowerCase()},Ve=Pe.data={},Be=Pe.NATIVE="N",Re=Pe.POLYFILL="P",Fe=Pe,_e=Pt.f,qe=function(t,e){var n,r,o,i,u,a=t.target,c=t.global,l=t.stat;if(n=c?y:l?y[a]||st(a,{}):(y[a]||{}).prototype)for(r in e){if(i=e[r],o=t.noTargetGet?(u=_e(n,r))&&u.value:n[r],!Fe(c?r:a+(l?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;ze(i,o);}(t.sham||o&&o.sham)&&qt(i,"sham",!0),pe(n,r,i,t);}},$e=D(D.bind),We=Array.isArray||function(t){return "Array"==A(t)},Ge={};Ge[Mt("toStringTag")]="z";var Ue="[object z]"===String(Ge),Xe=Mt("toStringTag"),Ye=y.Object,Je="Arguments"==A(function(){return arguments}()),Ke=Ue?A:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ye(t),Xe))?n:Je?A(e):"Object"==(r=A(e))&&_(e.callee)?"Arguments":r},Qe=function(){},Ze=[],tn=W("Reflect","construct"),en=/^\s*(?:class|function)\b/,nn=D(en.exec),rn=!en.exec(Qe),on=function(t){if(!_(t))return !1;try{return tn(Qe,Ze,t),!0}catch(t){return !1}},un=!tn||b((function(){var t;return on(on.call)||!on(Object)||!on((function(){t=!0;}))||t}))?function(t){if(!_(t))return !1;switch(Ke(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return !1}return rn||!!nn(en,Xt(t))}:on,an=Mt("species"),cn=y.Array,ln=function(t,e){return new(function(t){var e;return We(t)&&(e=t.constructor,(un(e)&&(e===cn||We(e.prototype))||q(e)&&null===(e=e[an]))&&(e=void 0)),void 0===e?cn:e}(t))(0===e?0:e)},sn=D([].push),fn=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,u=7==t,a=5==t||i;return function(c,l,s,f){for(var d,p,h=vt(c),v=V(h),g=function(t,e){return ut(t),void 0===e?t:$e?$e(t,e):function(){return t.apply(e,arguments)}}(l,s),m=Ee(v),y=0,b=f||ln,x=e?b(c,m):n||u?b(c,0):void 0;m>y;y++)if((a||y in v)&&(p=g(d=v[y],y,h),t))if(e)x[y]=p;else if(p)switch(t){case 3:return !0;case 5:return d;case 6:return y;case 2:sn(x,d);}else switch(t){case 4:return !1;case 7:sn(x,d);}return i?-1:r||o?o:x}},dn={forEach:fn(0),map:fn(1),filter:fn(2),some:fn(3),every:fn(4),find:fn(5),findIndex:fn(6),filterReject:fn(7)},pn=Mt("species"),hn=function(t){return Q>=51||!b((function(){var e=[];return (e.constructor={})[pn]=function(){return {foo:1}},1!==e[t](Boolean).foo}))},vn=dn.filter;qe({target:"Array",proto:!0,forced:!hn("filter")},{filter:function(t){return vn(this,t,arguments.length>1?arguments[1]:void 0)}});var gn=Ue?{}.toString:function(){return "[object "+Ke(this)+"]"};Ue||pe(Object.prototype,"toString",gn,{unsafe:!0});var mn,yn=y.String,bn=function(t){if("Symbol"===Ke(t))throw TypeError("Cannot convert a Symbol value to a string");return yn(t)},xn=function(){var t=Bt(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},wn=y.RegExp,En=b((function(){var t=wn("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),Sn=En||b((function(){return !wn("a","y").sticky})),kn={BROKEN_CARET:En||b((function(){var t=wn("^r","gy");return t.lastIndex=2,null!=t.exec("str")})),MISSED_STICKY:Sn,UNSUPPORTED_Y:En},Tn=Object.keys||function(t){return Ie(t,Ne)},Mn=x?Object.defineProperties:function(t,e){Bt(t);for(var n,r=F(e),o=Tn(e),i=o.length,u=0;i>u;)_t.f(t,n=o[u++],r[n]);return t},In=W("document","documentElement"),Nn=Qt("IE_PROTO"),Hn=function(){},On=function(t){return "<script>"+t+"</"+"script>"},jn=function(t){t.write(On("")),t.close();var e=t.parentWindow.Object;return t=null,e},Dn=function(){try{mn=new ActiveXObject("htmlfile");}catch(t){}var t,e;Dn="undefined"!=typeof document?document.domain&&mn?jn(mn):((e=Lt("iframe")).style.display="none",In.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(On("document.F=Object")),t.close(),t.F):jn(mn);for(var n=Ne.length;n--;)delete Dn.prototype[Ne[n]];return Dn()};Zt[Nn]=!0;var Ln,zn,An=Object.create||function(t,e){var n;return null!==t?(Hn.prototype=Bt(t),n=new Hn,Hn.prototype=null,n[Nn]=t):n=Dn(),void 0===e?n:Mn(n,e)},Pn=y.RegExp,Cn=b((function(){var t=Pn(".","s");return !(t.dotAll&&t.exec("\n")&&"s"===t.flags)})),Vn=y.RegExp,Bn=b((function(){var t=Vn("(?<a>b)","g");return "b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})),Rn=ce.get,Fn=pt("native-string-replace",String.prototype.replace),_n=RegExp.prototype.exec,qn=_n,$n=D("".charAt),Wn=D("".indexOf),Gn=D("".replace),Un=D("".slice),Xn=(zn=/b*/g,E(_n,Ln=/a/,"a"),E(_n,zn,"a"),0!==Ln.lastIndex||0!==zn.lastIndex),Yn=kn.BROKEN_CARET,Jn=void 0!==/()??/.exec("")[1];(Xn||Jn||Yn||Cn||Bn)&&(qn=function(t){var e,n,r,o,i,u,a,c=this,l=Rn(c),s=bn(t),f=l.raw;if(f)return f.lastIndex=c.lastIndex,e=E(qn,f,s),c.lastIndex=f.lastIndex,e;var d=l.groups,p=Yn&&c.sticky,h=E(xn,c),v=c.source,g=0,m=s;if(p&&(h=Gn(h,"y",""),-1===Wn(h,"g")&&(h+="g"),m=Un(s,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==$n(s,c.lastIndex-1))&&(v="(?: "+v+")",m=" "+m,g++),n=new RegExp("^(?:"+v+")",h)),Jn&&(n=new RegExp("^"+v+"$(?!\\s)",h)),Xn&&(r=c.lastIndex),o=E(_n,p?n:c,m),p?o?(o.input=Un(o.input,g),o[0]=Un(o[0],g),o.index=c.lastIndex,c.lastIndex+=o[0].length):c.lastIndex=0:Xn&&o&&(c.lastIndex=c.global?o.index+o[0].length:r),Jn&&o&&o.length>1&&E(Fn,o[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(o[i]=void 0);})),o&&d)for(o.groups=u=An(null),i=0;i<d.length;i++)u[(a=d[i])[0]]=o[a[1]];return o});var Kn=qn;qe({target:"RegExp",proto:!0,forced:/./.exec!==Kn},{exec:Kn});var Qn=Function.prototype,Zn=Qn.apply,tr=Qn.bind,er=Qn.call,nr="object"==typeof Reflect&&Reflect.apply||(tr?er.bind(Zn):function(){return er.apply(Zn,arguments)}),rr=Mt("species"),or=RegExp.prototype,ir=function(t,e,n,r){var o=Mt(t),i=!b((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),u=i&&!b((function(){var e=!1,n=/a/;return "split"===t&&((n={}).constructor={},n.constructor[rr]=function(){return n},n.flags="",n[o]=/./[o]),n.exec=function(){return e=!0,null},n[o](""),!e}));if(!i||!u||n){var a=D(/./[o]),c=e(o,""[t],(function(t,e,n,r,o){var u=D(t),c=e.exec;return c===Kn||c===or.exec?i&&!o?{done:!0,value:a(e,n,r)}:{done:!0,value:u(n,e,r)}:{done:!1}}));pe(String.prototype,t,c[0]),pe(or,o,c[1]);}r&&qt(or[o],"sham",!0);},ur=D("".charAt),ar=D("".charCodeAt),cr=D("".slice),lr=function(t){return function(e,n){var r,o,i=bn(R(e)),u=ge(n),a=i.length;return u<0||u>=a?t?"":void 0:(r=ar(i,u))<55296||r>56319||u+1===a||(o=ar(i,u+1))<56320||o>57343?t?ur(i,u):r:t?cr(i,u,u+2):o-56320+(r-55296<<10)+65536}},sr={codeAt:lr(!1),charAt:lr(!0)}.charAt,fr=function(t,e,n){return e+(n?sr(t,e).length:1)},dr=Math.floor,pr=D("".charAt),hr=D("".replace),vr=D("".slice),gr=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,mr=/\$([$&'`]|\d{1,2})/g,yr=function(t,e,n,r,o,i){var u=n+t.length,a=r.length,c=mr;return void 0!==o&&(o=vt(o),c=gr),hr(i,c,(function(i,c){var l;switch(pr(c,0)){case"$":return "$";case"&":return t;case"`":return vr(e,0,n);case"'":return vr(e,u);case"<":l=o[vr(c,1,-1)];break;default:var s=+c;if(0===s)return i;if(s>a){var f=dr(s/10);return 0===f?i:f<=a?void 0===r[f-1]?pr(c,1):r[f-1]+pr(c,1):i}l=r[s-1];}return void 0===l?"":l}))},br=y.TypeError,xr=function(t,e){var n=t.exec;if(_(n)){var r=E(n,t,e);return null!==r&&Bt(r),r}if("RegExp"===A(t))return E(Kn,t,e);throw br("RegExp#exec called on incompatible receiver")},wr=Mt("replace"),Er=Math.max,Sr=Math.min,kr=D([].concat),Tr=D([].push),Mr=D("".indexOf),Ir=D("".slice),Nr="$0"==="a".replace(/./,"$0"),Hr=!!/./[wr]&&""===/./[wr]("a","$0");ir("replace",(function(t,e,n){var r=Hr?"$":"$0";return [function(t,n){var r=R(this),o=null==t?void 0:at(t,wr);return o?E(o,t,r,n):E(e,bn(r),t,n)},function(t,o){var i=Bt(this),u=bn(t);if("string"==typeof o&&-1===Mr(o,r)&&-1===Mr(o,"$<")){var a=n(e,i,u,o);if(a.done)return a.value}var c=_(o);c||(o=bn(o));var l=i.global;if(l){var s=i.unicode;i.lastIndex=0;}for(var f=[];;){var d=xr(i,u);if(null===d)break;if(Tr(f,d),!l)break;""===bn(d[0])&&(i.lastIndex=fr(u,we(i.lastIndex),s));}for(var p,h="",v=0,g=0;g<f.length;g++){for(var m=bn((d=f[g])[0]),y=Er(Sr(ge(d.index),u.length),0),b=[],x=1;x<d.length;x++)Tr(b,void 0===(p=d[x])?p:String(p));var w=d.groups;if(c){var E=kr([m],b,y,u);void 0!==w&&Tr(E,w);var S=bn(nr(o,void 0,E));}else S=yr(m,u,y,b,w,o);y>=v&&(h+=Ir(u,v,y)+S,v=y+m.length);}return h+Ir(u,v)}]}),!!b((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}))||!Nr||Hr);var Or=Mt("unscopables"),jr=Array.prototype;null==jr[Or]&&_t.f(jr,Or,{configurable:!0,value:An(null)});var Dr=function(t){jr[Or][t]=!0;},Lr=dn.find,zr="find",Ar=!0;zr in[]&&Array(1).find((function(){Ar=!1;})),qe({target:"Array",proto:!0,forced:Ar},{find:function(t){return Lr(this,t,arguments.length>1?arguments[1]:void 0)}}),Dr(zr);var Pr=Mt("match"),Cr=function(t){var e;return q(t)&&(void 0!==(e=t[Pr])?!!e:"RegExp"==A(t))},Vr=y.TypeError,Br=Mt("species"),Rr=function(t,e){var n,r=Bt(t).constructor;return void 0===r||null==(n=Bt(r)[Br])?e:function(t){if(un(t))return t;throw Vr(ot(t)+" is not a constructor")}(n)},Fr=function(t,e,n){var r=Ot(e);r in t?_t.f(t,r,I(0,n)):t[r]=n;},_r=y.Array,qr=Math.max,$r=function(t,e,n){for(var r=Ee(t),o=be(e,r),i=be(void 0===n?r:n,r),u=_r(qr(i-o,0)),a=0;o<i;o++,a++)Fr(u,a,t[o]);return u.length=a,u},Wr=kn.UNSUPPORTED_Y,Gr=4294967295,Ur=Math.min,Xr=[].push,Yr=D(/./.exec),Jr=D(Xr),Kr=D("".slice),Qr=!b((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));ir("split",(function(t,e,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,n){var r=bn(R(this)),o=void 0===n?Gr:n>>>0;if(0===o)return [];if(void 0===t)return [r];if(!Cr(t))return E(e,r,t,o);for(var i,u,a,c=[],l=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),s=0,f=new RegExp(t.source,l+"g");(i=E(Kn,f,r))&&!((u=f.lastIndex)>s&&(Jr(c,Kr(r,s,i.index)),i.length>1&&i.index<r.length&&nr(Xr,c,$r(i,1)),a=i[0].length,s=u,c.length>=o));)f.lastIndex===i.index&&f.lastIndex++;return s===r.length?!a&&Yr(f,"")||Jr(c,""):Jr(c,Kr(r,s)),c.length>o?$r(c,0,o):c}:"0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:E(e,this,t,n)}:e,[function(e,n){var o=R(this),i=null==e?void 0:at(e,t);return i?E(i,e,o,n):E(r,bn(o),e,n)},function(t,o){var i=Bt(this),u=bn(t),a=n(r,i,u,o,r!==e);if(a.done)return a.value;var c=Rr(i,RegExp),l=i.unicode,s=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(Wr?"g":"y"),f=new c(Wr?"^(?:"+i.source+")":i,s),d=void 0===o?Gr:o>>>0;if(0===d)return [];if(0===u.length)return null===xr(f,u)?[u]:[];for(var p=0,h=0,v=[];h<u.length;){f.lastIndex=Wr?0:h;var g,m=xr(f,Wr?Kr(u,h):u);if(null===m||(g=Ur(we(f.lastIndex+(Wr?h:0)),u.length))===p)h=fr(u,h,l);else {if(Jr(v,Kr(u,p,h)),v.length===d)return v;for(var y=1;y<=m.length-1;y++)if(Jr(v,m[y]),v.length===d)return v;h=p=g;}}return Jr(v,Kr(u,p)),v}]}),!Qr,Wr);var Zr,to="\t\n\v\f\r                \u2028\u2029\ufeff",eo=D("".replace),no="["+to+"]",ro=RegExp("^"+no+no+"*"),oo=RegExp(no+no+"*$"),io=function(t){return function(e){var n=bn(R(e));return 1&t&&(n=eo(n,ro,"")),2&t&&(n=eo(n,oo,"")),n}},uo={start:io(1),end:io(2),trim:io(3)},ao=de.PROPER,co=uo.trim;function lo(t){return 0===c.default("<div>"+t+"</div>").children().filter((function(t){return "BR"!==t.tagName})).length}function so(t){return 0===t.length?"":t[0].outerHTML}function fo(t){return t.length?t[0].tagName.toLowerCase():""}function po(t,e){for(var n="",r=(t.attr("style")||"").split(";"),o=r.length,i=0;i<o;i++){var u=r[i];if(u){var a=u.split(":");a[0].trim()===e&&(n=a[1].trim());}}return n}qe({target:"String",proto:!0,forced:(Zr="trim",b((function(){return !!to[Zr]()||"​…᠎"!=="​…᠎"[Zr]()||ao&&to[Zr].name!==Zr})))},{trim:function(){return co(this)}}),qe({global:!0},{globalThis:y}),o.css&&(c.default.fn.css=o.css),o.append&&(c.default.fn.append=o.append),o.prepend&&(c.default.fn.prepend=o.prepend),o.addClass&&(c.default.fn.addClass=o.addClass),o.removeClass&&(c.default.fn.removeClass=o.removeClass),o.hasClass&&(c.default.fn.hasClass=o.hasClass),o.on&&(c.default.fn.on=o.on),o.off&&(c.default.fn.off=o.off),o.focus&&(c.default.fn.focus=o.focus),o.attr&&(c.default.fn.attr=o.attr),o.removeAttr&&(c.default.fn.removeAttr=o.removeAttr),o.hide&&(c.default.fn.hide=o.hide),o.show&&(c.default.fn.show=o.show),o.parents&&(c.default.fn.parents=o.parents),o.dataset&&(c.default.fn.dataset=o.dataset),o.val&&(c.default.fn.val=o.val),o.text&&(c.default.fn.text=o.text),o.html&&(c.default.fn.html=o.html),o.children&&(c.default.fn.children=o.children),o.remove&&(c.default.fn.remove=o.remove),o.find&&(c.default.fn.find=o.find),o.width&&(c.default.fn.width=o.width),o.height&&(c.default.fn.height=o.height),o.filter&&(c.default.fn.filter=o.filter),o.empty&&(c.default.fn.empty=o.empty);var ho=function(t,e){return ho=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e;}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);},ho(t,e)};
  18516. /*! *****************************************************************************
  18517. Copyright (c) Microsoft Corporation.
  18518. Permission to use, copy, modify, and/or distribute this software for any
  18519. purpose with or without fee is hereby granted.
  18520. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  18521. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  18522. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  18523. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  18524. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  18525. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  18526. PERFORMANCE OF THIS SOFTWARE.
  18527. ***************************************************************************** */function vo(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t;}ho(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n);}var go=function(){return go=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},go.apply(this,arguments)};function mo(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t));}catch(t){i(t);}}function a(t){try{c(r.throw(t));}catch(t){i(t);}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e);}))).then(u,a);}c((r=r.apply(t,e||[])).next());}))}function yo(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u);}catch(t){i=[6,t],r=0;}finally{n=o=0;}if(5&i[0])throw i[1];return {value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function bo(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return {next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function xo(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)u.push(r.value);}catch(t){o={error:t};}finally{try{r&&!r.done&&(n=i.return)&&n.call(i);}finally{if(o)throw o.error}}return u}function wo(t){var e=xo(r.Editor.nodes(t,{match:function(e){return t.children[0]===e},mode:"highest"}),1),n=e[0];if(null==n)return !1;var o=n[0];if(!r.Element.isElement(o))return !1;if("paragraph"===o.type)return !1;if(""!==r.Node.string(o))return !1;var i=o.children,u=void 0===i?[]:i;return !!r.Text.isText(u[0])&&(r.Transforms.setNodes(t,{type:"paragraph"}),!0)}var Eo={renderElems:[s],elemsToHtml:[f],parseElemsHtml:[{selector:"p:not([data-w-e-type])",parseElemHtml:function(t,e,n){var o=c.default(t);return 0===(e=e.filter((function(t){return !!r.Text.isText(t)||!!n.isInline(t)}))).length&&(e=[{text:o.text().replace(/\s+/gm," ")}]),{type:"paragraph",children:e}}}],editorPlugin:function(t){var e=t.deleteBackward,n=t.deleteForward;t.insertText,t.insertBreak;var r=t;return r.deleteBackward=function(t){wo(r)||e(t);},r.deleteForward=function(t){wo(r)||n(t);},r}},So=/"/g,ko=D("".replace),To=function(t,e,n,r){var o=bn(R(t)),i="<"+e;return ""!==n&&(i+=" "+n+'="'+ko(bn(r),So,"&quot;")+'"'),i+">"+o+"</"+e+">"},Mo=function(t){return b((function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3}))};function Io(t,e){var n=e,r=t,o=r.bold,i=r.italic,u=r.underline;return o&&(n="<strong>"+n+"</strong>"),r.code&&(n="<code>"+n+"</code>"),i&&(n="<em>"+n+"</em>"),u&&(n="<u>"+n+"</u>"),r.through&&(n="<s>"+n+"</s>"),r.sub&&(n="<sub>"+n+"</sub>"),r.sup&&(n="<sup>"+n+"</sup>"),n}function No(t,e){return 0!==t.length&&(!!t[0].matches(e)||t.find(e).length>0)}qe({target:"String",proto:!0,forced:Mo("bold")},{bold:function(){return To(this,"b","","")}}),qe({target:"String",proto:!0,forced:Mo("italics")},{italics:function(){return To(this,"i","","")}}),qe({target:"String",proto:!0,forced:Mo("sub")},{sub:function(){return To(this,"sub","","")}}),qe({target:"String",proto:!0,forced:Mo("sup")},{sup:function(){return To(this,"sup","","")}});var Ho={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Oo=Lt("span").classList,jo=Oo&&Oo.constructor&&Oo.constructor.prototype,Do=jo===Object.prototype?void 0:jo,Lo=function(t,e){var n=[][t];return !!n&&b((function(){n.call(null,e||function(){throw 1},1);}))},zo=dn.forEach,Ao=Lo("forEach")?[].forEach:function(t){return zo(this,t,arguments.length>1?arguments[1]:void 0)},Po=function(t){if(t&&t.forEach!==Ao)try{qt(t,"forEach",Ao);}catch(e){t.forEach=Ao;}};for(var Co in Ho)Ho[Co]&&Po(y[Co]&&y[Co].prototype);function Vo(t,n){return null==t.selection||!!xo(r.Editor.nodes(t,{match:function(n){return "pre"===e.DomEditor.getNodeType(n)||!!r.Editor.isVoid(t,n)},universal:!0}),1)[0]}function Bo(t,e){Object.keys(e).forEach((function(e){"text"!==e&&r.Editor.removeMark(t,e);}));}Po(Do),qe({target:"Object",stat:!0,forced:b((function(){Tn(1);}))},{keys:function(t){return Tn(vt(t))}});var Ro=function(){function t(){this.marksNeedToRemove=[],this.tag="button";}return t.prototype.getValue=function(t){var e=this.mark,n=r.Editor.marks(t);return n?n[e]:!!xo(r.Editor.nodes(t,{match:function(t){return !0===t[e]}}),1)[0]},t.prototype.isActive=function(t){return !!this.getValue(t)},t.prototype.isDisabled=function(t){return Vo(t,this.mark)},t.prototype.exec=function(t,e){var n=this.mark,r=this.marksNeedToRemove;e?t.removeMark(n):(t.addMark(n,!0),r&&r.forEach((function(e){return t.removeMark(e)})));},t}(),Fo='<svg viewBox="0 0 1024 1024"><path d="M707.872 484.64A254.88 254.88 0 0 0 768 320c0-141.152-114.848-256-256-256H192v896h384c141.152 0 256-114.848 256-256a256.096 256.096 0 0 0-124.128-219.36zM384 192h101.504c55.968 0 101.504 57.408 101.504 128s-45.536 128-101.504 128H384V192z m159.008 640H384v-256h159.008c58.464 0 106.016 57.408 106.016 128s-47.552 128-106.016 128z"></path></svg>',_o='<svg viewBox="0 0 1024 1024"><path d="M704 64l128 0 0 416c0 159.072-143.264 288-320 288s-320-128.928-320-288l0-416 128 0 0 416c0 40.16 18.24 78.688 51.36 108.512 36.896 33.216 86.848 51.488 140.64 51.488s103.744-18.304 140.64-51.488c33.12-29.792 51.36-68.352 51.36-108.512l0-416zM192 832l640 0 0 128-640 0z"></path></svg>',qo='<svg viewBox="0 0 1024 1024"><path d="M896 64v64h-128L448 896h128v64H128v-64h128L576 128h-128V64z"></path></svg>',$o='<svg viewBox="0 0 1024 1024"><path d="M1024 512v64h-234.496c27.52 38.496 42.496 82.688 42.496 128 0 70.88-36.672 139.04-100.576 186.976C672.064 935.488 594.144 960 512 960s-160.064-24.512-219.424-69.024C228.64 843.04 192 774.88 192 704h128c0 69.376 87.936 128 192 128s192-58.624 192-128-87.936-128-192-128H0v-64h299.52a385.984 385.984 0 0 1-6.944-5.024C228.64 459.04 192 390.88 192 320s36.672-139.04 100.576-186.976C351.936 88.512 429.856 64 512 64s160.064 24.512 219.424 69.024C795.328 180.96 832 249.12 832 320h-128c0-69.376-87.936-128-192-128s-192 58.624-192 128 87.936 128 192 128c78.976 0 154.048 22.688 212.48 64H1024z"></path></svg>',Wo='<svg viewBox="0 0 1024 1024"><path d="M576 736l96 96 320-320L672 192l-96 96 224 224zM448 288l-96-96L32 512l320 320 96-96-224-224z"></path></svg>',Go='<svg viewBox="0 0 1024 1024"><path d="M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z"></path></svg>',Uo='<svg viewBox="0 0 1024 1024"><path d="M924.402464 1023.068211H0.679665V99.345412h461.861399v98.909208H99.596867v725.896389h725.896389V561.206811h98.909208z" p-id="10909"></path><path d="M930.805104 22.977336l69.965436 69.965436-453.492405 453.492404-69.965435-69.901489z" p-id="10910"></path><path d="M1022.464381 304.030081h-98.917201V99.345412H709.230573V0.428211h313.233808z"></path></svg>',Xo='<svg viewBox="0 0 1024 1024"><path d="M64 864h896v96H64zM360.58 576h302.85l81.53 224h102.16L579.24 64H444.77L176.89 800h102.16l81.53-224zM512 159.96L628.49 480H395.52L512 159.96z"></path></svg>',Yo='<svg viewBox="0 0 1024 1024"><path d="M510.030769 315.076923l84.676923 196.923077h-177.230769l76.8-196.923077h15.753846zM945.230769 157.538462v708.923076c0 43.323077-35.446154 78.769231-78.769231 78.769231H157.538462c-43.323077 0-78.769231-35.446154-78.769231-78.769231V157.538462c0-43.323077 35.446154-78.769231 78.769231-78.769231h708.923076c43.323077 0 78.769231 35.446154 78.769231 78.769231z m-108.307692 643.938461L600.615385 216.615385c-5.907692-11.815385-15.753846-19.692308-29.538462-19.692308h-139.815385c-11.815385 0-23.630769 7.876923-27.56923 19.692308l-216.615385 584.861538c-3.938462 11.815385 3.938462 25.6 17.723077 25.6h80.738462c11.815385 0 23.630769-9.846154 27.56923-21.661538l63.015385-175.261539h263.876923l68.923077 175.261539c3.938462 11.815385 15.753846 21.661538 27.569231 21.661538h80.738461c13.784615 0 23.630769-13.784615 19.692308-25.6z"></path></svg>',Jo='<svg viewBox="0 0 1024 1024"><path d="M64 512h384v128h-128V1024h-128V640h-128z m896-256H708.2496v768h-136.4992V256H320V128h640z"></path></svg>',Ko='<svg viewBox="0 0 1024 1024"><path d="M956.788364 152.110545h-24.110546l23.924364 9.029819 0.186182 121.018181h-65.070546l-86.574545-130.048H566.551273v650.14691l130.048 64.977454v65.163636h-390.050909v-65.163636l129.954909-64.977454V152.110545H198.283636L111.429818 282.065455H46.545455V69.259636C46.545455 33.792 82.664727 22.062545 98.955636 22.062545h812.683637c23.738182 0 45.056 15.173818 45.056 41.053091V169.425455v-17.221819z"></path></svg>',Qo='<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m384 192h640v128H384z m0 192h640v128H384z m0 192h640v128H384zM0 832h1024v128H0z m256-512v384l-256-192z"></path></svg>',Zo='<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m384 192h640v128H384z m0 192h640v128H384z m0 192h640v128H384zM0 832h1024v128H0z m0-128V320l256 192z"></path></svg>',ti='<svg viewBox="0 0 1024 1024"><path d="M768 793.6v102.4H51.2v-102.4h716.8z m204.8-230.4v102.4H51.2v-102.4h921.6z m-204.8-230.4v102.4H51.2v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>',ei='<svg viewBox="0 0 1024 1024"><path d="M972.8 793.6v102.4H256v-102.4h716.8z m0-230.4v102.4H51.2v-102.4h921.6z m0-230.4v102.4H256v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>',ni='<svg viewBox="0 0 1024 1024"><path d="M870.4 793.6v102.4H153.6v-102.4h716.8z m102.4-230.4v102.4H51.2v-102.4h921.6z m-102.4-230.4v102.4H153.6v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>',ri='<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z m0 192h1024v128H0z"></path></svg>',oi='<svg viewBox="0 0 1024 1024"><path d="M768 206.016v50.016h128v64h-192V174.016l128-60V64h-128V0h192v146.016zM676 256h-136L352 444 164 256H28l256 256-256 256h136L352 580 540 768h136l-256-256z"></path></svg>',ii='<svg viewBox="0 0 1024 1024"><path d="M768 910.016v50.016h128v64h-192v-146.016l128-60V768h-128v-64h192v146.016zM676 256h-136L352 444 164 256H28l256 256-256 256h136L352 580 540 768h136l-256-256z"></path></svg>',ui=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.mark="bold",n.title=e.t("textStyle.bold"),n.iconSvg=Fo,n.hotkey="mod+b",n}return vo(n,t),n}(Ro),ai=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.mark="code",n.title=e.t("textStyle.code"),n.iconSvg=Wo,n.hotkey="mod+e",n}return vo(n,t),n}(Ro),ci=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.mark="italic",n.title=e.t("textStyle.italic"),n.iconSvg=qo,n.hotkey="mod+i",n}return vo(n,t),n}(Ro),li=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.mark="through",n.title=e.t("textStyle.through"),n.iconSvg=$o,n.hotkey="mod+shift+x",n}return vo(n,t),n}(Ro),si=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.mark="underline",n.title=e.t("textStyle.underline"),n.iconSvg=_o,n.hotkey="mod+u",n}return vo(n,t),n}(Ro),fi=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.mark="sub",n.marksNeedToRemove=["sup"],n.title=e.t("textStyle.sub"),n.iconSvg=ii,n.hotkey="",n}return vo(n,t),n}(Ro),di=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.mark="sup",n.marksNeedToRemove=["sub"],n.title=e.t("textStyle.sup"),n.iconSvg=oi,n.hotkey="",n}return vo(n,t),n}(Ro),pi=function(){function t(){this.title=e.t("textStyle.clear"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M969.382408 288.738615l-319.401123-270.852152a67.074236 67.074236 0 0 0-96.459139 5.74922l-505.931379 574.922021a68.35184 68.35184 0 0 0-17.886463 47.910169 74.101061 74.101061 0 0 0 24.274486 47.910168l156.50655 132.232065h373.060512L975.131628 383.281347a67.074236 67.074236 0 0 0-5.74922-96.459139z m-440.134747 433.746725H264.144729l-90.071117-78.572676c-5.74922-5.74922-12.137243-12.137243-12.137243-17.886463a36.411728 36.411728 0 0 1 5.749221-24.274485l210.804741-240.828447 265.102932 228.691204z m-439.495945 180.781036h843.218964a60.047411 60.047411 0 1 1 0 120.733624H89.751716a60.047411 60.047411 0 1 1 0-120.733624z m0 0"></path></svg>',this.tag="button";}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.isDisabled=function(t){return Vo(t)},t.prototype.exec=function(t,e){var n,o,i=r.Editor.nodes(t,{match:function(t){return r.Text.isText(t)},universal:!0});try{for(var u=bo(i),a=u.next();!a.done;a=u.next()){Bo(t,a.value[0]);}}catch(t){n={error:t};}finally{try{a&&!a.done&&(o=u.return)&&o.call(u);}finally{if(n)throw n.error}}},t}(),hi={renderStyle:function(t,e){var r=t,o=r.bold,i=r.italic,u=r.underline,a=r.code,c=r.through,l=r.sub,s=r.sup,f=e;return o&&(f=n.jsx("strong",null,f)),a&&(f=n.jsx("code",null,f)),i&&(f=n.jsx("em",null,f)),u&&(f=n.jsx("u",null,f)),c&&(f=n.jsx("s",null,f)),l&&(f=n.jsx("sub",null,f)),s&&(f=n.jsx("sup",null,f)),f},menus:[{key:"bold",factory:function(){return new ui}},{key:"underline",factory:function(){return new si}},{key:"italic",factory:function(){return new ci}},{key:"through",factory:function(){return new li}},{key:"code",factory:function(){return new ai}},{key:"sub",factory:function(){return new fi}},{key:"sup",factory:function(){return new di}},{key:"clearStyle",factory:function(){return new pi}}],styleToHtml:function(t,e){if(!r.Text.isText(t))return e;if(lo(e))return Io(t,e);var n=c.default(e);if("br"===fo(n))return Io(t,"<br>");var o=n.html();return o=Io(t,o),n.html(o),so(n)},parseStyleHtml:function(t,e,n){var o=c.default(t);if(!r.Text.isText(e))return e;var i=e;return No(o,"b,strong")&&(i.bold=!0),No(o,"i,em")&&(i.italic=!0),No(o,"u")&&(i.underline=!0),No(o,"s,strike")&&(i.through=!0),No(o,"sub")&&(i.sub=!0),No(o,"sup")&&(i.sup=!0),No(o,"code")&&(i.code=!0),i}};function vi(t){return function(e,r,o){var i="h"+t;return n.jsx(i,null,r)}}var gi={type:"header1",renderElem:vi(1)},mi={type:"header2",renderElem:vi(2)},yi={type:"header3",renderElem:vi(3)},bi={type:"header4",renderElem:vi(4)},xi={type:"header5",renderElem:vi(5)},wi=de.PROPER,Ei="toString",Si=RegExp.prototype,ki=Si.toString,Ti=D(xn),Mi=b((function(){return "/a/b"!=ki.call({source:"a",flags:"b"})})),Ii=wi&&ki.name!=Ei;(Mi||Ii)&&pe(RegExp.prototype,Ei,(function(){var t=Bt(this),e=bn(t.source),n=t.flags;return "/"+e+"/"+bn(void 0===n&&G(Si,t)&&!("flags"in Si)?Ti(t):n)}),{unsafe:!0});var Ni,Hi=y.TypeError,Oi=function(t){if(Cr(t))throw Hi("The method doesn't accept regular expressions");return t},ji=Mt("match"),Di=function(t){var e=/./;try{"/./"[t](e);}catch(n){try{return e[ji]=!1,"/./"[t](e)}catch(t){}}return !1},Li=Pt.f,zi=D("".startsWith),Ai=D("".slice),Pi=Math.min,Ci=Di("startsWith");function Vi(t){var n=xo(r.Editor.nodes(t,{match:function(t){return e.DomEditor.getNodeType(t).startsWith("header")},universal:!0}),1),o=n[0];if(null==o)return "paragraph";var i=xo(o,1)[0];return e.DomEditor.getNodeType(i)}function Bi(t){return null==t.selection||!xo(r.Editor.nodes(t,{match:function(t){var n=e.DomEditor.getNodeType(t);return "paragraph"===n||!!n.startsWith("header")},universal:!0,mode:"highest"}),1)[0]}function Ri(t,e){e&&r.Transforms.setNodes(t,{type:e});}qe({target:"String",proto:!0,forced:!!(Ci||(Ni=Li(String.prototype,"startsWith"),!Ni||Ni.writable))&&!Ci},{startsWith:function(t){var e=bn(R(this));Oi(t);var n=we(Pi(arguments.length>1?arguments[1]:void 0,e.length)),r=bn(t);return zi?zi(e,r,n):Ai(e,n,n+r.length)===r}});var Fi=function(){function t(){this.title=e.t("header.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M960 960c-51.2 0-102.4-3.2-153.6-3.2-51.2 0-99.2 3.2-150.4 3.2-19.2 0-28.8-22.4-28.8-38.4 0-51.2 57.6-28.8 86.4-48 19.2-12.8 19.2-60.8 19.2-80v-224-19.2c-9.6-3.2-19.2-3.2-28.8-3.2H320c-9.6 0-19.2 0-28.8 3.2V780.8c0 22.4 0 80 22.4 92.8 28.8 19.2 96-6.4 96 44.8 0 16-9.6 41.6-28.8 41.6-54.4 0-105.6-3.2-160-3.2-48 0-96 3.2-147.2 3.2-19.2 0-28.8-22.4-28.8-38.4 0-51.2 51.2-28.8 80-48 19.2-12.8 19.2-60.8 19.2-83.2V294.4c0-28.8 3.2-115.2-22.4-131.2-25.6-16-86.4 9.6-86.4-41.6 0-16 6.4-41.6 28.8-41.6 51.2 0 105.6 3.2 156.8 3.2 48 0 96-3.2 144-3.2 19.2 0 28.8 22.4 28.8 41.6 0 48-57.6 25.6-83.2 41.6-19.2 12.8-19.2 73.6-19.2 92.8v201.6c6.4 3.2 16 3.2 22.4 3.2h400c6.4 0 12.8 0 22.4-3.2V256c0-22.4 0-80-19.2-92.8-28.8-16-86.4 6.4-86.4-41.6 0-16 9.6-41.6 28.8-41.6 51.2 0 99.2 3.2 150.4 3.2 48 0 99.2-3.2 147.2-3.2 19.2 0 28.8 22.4 28.8 41.6 0 51.2-57.6 25.6-86.4 41.6-19.2 12.8-19.2 70.4-19.2 92.8v537.6c0 19.2 0 67.2 19.2 80 28.8 19.2 89.6-6.4 89.6 44.8 0 19.2-6.4 41.6-28.8 41.6z"></path></svg>',this.tag="select",this.width=60;}return t.prototype.getOptions=function(t){var n=[{value:"header1",text:"H1",styleForRenderMenuList:{"font-size":"32px","font-weight":"bold"}},{value:"header2",text:"H2",styleForRenderMenuList:{"font-size":"24px","font-weight":"bold"}},{value:"header3",text:"H3",styleForRenderMenuList:{"font-size":"18px","font-weight":"bold"}},{value:"header4",text:"H4",styleForRenderMenuList:{"font-size":"16px","font-weight":"bold"}},{value:"header5",text:"H5",styleForRenderMenuList:{"font-size":"13px","font-weight":"bold"}},{value:"paragraph",text:e.t("header.text")}],r=this.getValue(t).toString();return n.forEach((function(t){t.value===r?t.selected=!0:delete t.selected;})),n},t.prototype.isActive=function(t){return !1},t.prototype.getValue=function(t){return Vi(t)},t.prototype.isDisabled=function(t){return Bi(t)},t.prototype.exec=function(t,e){Ri(t,e.toString());},t}(),_i=function(){function t(){this.tag="button";}return t.prototype.getValue=function(t){return Vi(t)},t.prototype.isActive=function(t){return this.getValue(t)===this.type},t.prototype.isDisabled=function(t){return Bi(t)},t.prototype.exec=function(t,e){var n=this.type;Ri(t,e===n?"paragraph":n);},t}(),qi=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="H1",e.type="header1",e}return vo(e,t),e}(_i),$i=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="H2",e.type="header2",e}return vo(e,t),e}(_i),Wi=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="H3",e.type="header3",e}return vo(e,t),e}(_i),Gi=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="H4",e.type="header4",e}return vo(e,t),e}(_i),Ui=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="H5",e.type="header5",e}return vo(e,t),e}(_i),Xi={key:"headerSelect",factory:function(){return new Fi}},Yi={key:"header1",factory:function(){return new qi}},Ji={key:"header2",factory:function(){return new $i}},Ki={key:"header3",factory:function(){return new Wi}},Qi={key:"header4",factory:function(){return new Gi}},Zi={key:"header5",factory:function(){return new Ui}};function tu(t){return function(e,n){return "<h"+t+">"+n+"</h"+t+">"}}function eu(t){return function(e,n,o){var i=c.default(e);return 0===(n=n.filter((function(t){return !!r.Text.isText(t)||!!o.isInline(t)}))).length&&(n=[{text:i.text().replace(/\s+/gm," ")}]),{type:"header"+t,children:n}}}var nu={renderElems:[gi,mi,yi,bi,xi],elemsToHtml:[{type:"header1",elemToHtml:tu(1)},{type:"header2",elemToHtml:tu(2)},{type:"header3",elemToHtml:tu(3)},{type:"header4",elemToHtml:tu(4)},{type:"header5",elemToHtml:tu(5)}],parseElemsHtml:[{selector:"h1:not([data-w-e-type])",parseElemHtml:eu(1)},{selector:"h2:not([data-w-e-type])",parseElemHtml:eu(2)},{selector:"h3:not([data-w-e-type])",parseElemHtml:eu(3)},{selector:"h4:not([data-w-e-type])",parseElemHtml:eu(4)},{selector:"h5:not([data-w-e-type])",parseElemHtml:eu(5)}],menus:[Xi,Yi,Ji,Ki,Qi,Zi],editorPlugin:function(t){var n=t.insertBreak;t.insertNode;var o=t;return o.insertBreak=function(){var i=xo(r.Editor.nodes(o,{match:function(t){return e.DomEditor.getNodeType(t).startsWith("header")},universal:!0}),1)[0];if(i)if(e.DomEditor.isSelectionAtLineEnd(t,i[1])){r.Transforms.insertNodes(o,{type:"paragraph",children:[{text:""}]},{mode:"highest"});}else n();else n();},o}},ru=Object.assign,ou=Object.defineProperty,iu=D([].concat),uu=!ru||b((function(){if(x&&1!==ru({b:1},ru(ou({},"a",{enumerable:!0,get:function(){ou(this,"b",{value:3,enumerable:!1});}}),{b:2})).b)return !0;var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t;})),7!=ru({},t)[n]||Tn(ru({},e)).join("")!=r}))?function(t,e){for(var n=vt(t),r=arguments.length,o=1,i=je.f,u=M.f;r>o;)for(var a,c=V(arguments[o++]),l=i?iu(Tn(c),i(c)):Tn(c),s=l.length,f=0;s>f;)a=l[f++],x&&!E(u,c,a)||(n[a]=c[a]);return n}:ru;function au(t,e){null==t.data&&(t.data={});var n=t.data;null==n.style&&(n.style={}),Object.assign(n.style,e);}qe({target:"Object",stat:!0,forced:Object.assign!==uu},{assign:uu});var cu={selector:"font",preParseHtml:function(t){var e=c.default(t);if("font"!==fo(e))return t;var n=e.attr("color")||"";return n&&(e.removeAttr("color"),e.css("color",n)),e[0]}};var lu=function(){function t(){this.tag="button",this.showDropPanel=!0,this.$content=null;}return t.prototype.exec=function(t,e){},t.prototype.getValue=function(t){var e=this.mark,n=r.Editor.marks(t);return n&&n[e]?n[e]:""},t.prototype.isActive=function(t){return !!this.getValue(t)},t.prototype.isDisabled=function(t){return null==t.selection||!!xo(r.Editor.nodes(t,{match:function(n){return "pre"===e.DomEditor.getNodeType(n)||!!r.Editor.isVoid(t,n)},universal:!0}),1)[0]},t.prototype.getPanelContentElem=function(t){var n=this.mark;if(null==this.$content){var o=c.default('<ul class="w-e-panel-content-color"></ul>');o.on("click","li",(function(e){var o=e.target;if(null!=o&&(e.preventDefault(),null!=t.selection)){var i=c.default(o).attr("data-value");"0"===i?r.Editor.removeMark(t,n):r.Editor.addMark(t,n,i);}})),this.$content=o;}var i=this.$content;if(null==i)return document.createElement("ul");i.empty();var u=this.getValue(t),a=t.getMenuConfig(n).colors;(void 0===a?[]:a).forEach((function(t){var e=c.default('<div class="color-block" data-value="'+t+'"></div>');e.css("background-color",t);var n=c.default('<li data-value="'+t+'"></li>');u===t&&n.addClass("active"),n.append(e),i.append(n);}));var l="";"color"===n&&(l=e.t("color.default")),"bgColor"===n&&(l=e.t("color.clear"));var s=c.default('\n <li data-value="0" class="clear">\n <svg viewBox="0 0 1024 1024"><path d="M236.8 128L896 787.2V128H236.8z m614.4 704L192 172.8V832h659.2zM192 64h704c38.4 0 64 25.6 64 64v704c0 38.4-25.6 64-64 64H192c-38.4 0-64-25.6-64-64V128c0-38.4 25.6-64 64-64z"></path></svg>\n '+l+"\n </li>\n ");return i.prepend(s),i[0]},t}(),su=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.title=e.t("color.color"),n.iconSvg=Xo,n.mark="color",n}return vo(n,t),n}(lu),fu=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.title=e.t("color.bgColor"),n.iconSvg=Yo,n.mark="bgColor",n}return vo(n,t),n}(lu),du=["rgb(0, 0, 0)","rgb(38, 38, 38)","rgb(89, 89, 89)","rgb(140, 140, 140)","rgb(191, 191, 191)","rgb(217, 217, 217)","rgb(233, 233, 233)","rgb(245, 245, 245)","rgb(250, 250, 250)","rgb(255, 255, 255)","rgb(225, 60, 57)","rgb(231, 95, 51)","rgb(235, 144, 58)","rgb(245, 219, 77)","rgb(114, 192, 64)","rgb(89, 191, 192)","rgb(66, 144, 247)","rgb(54, 88, 226)","rgb(106, 57, 201)","rgb(216, 68, 147)","rgb(251, 233, 230)","rgb(252, 237, 225)","rgb(252, 239, 212)","rgb(252, 251, 207)","rgb(231, 246, 213)","rgb(218, 244, 240)","rgb(217, 237, 250)","rgb(224, 232, 250)","rgb(237, 225, 248)","rgb(246, 226, 234)","rgb(255, 163, 158)","rgb(255, 187, 150)","rgb(255, 213, 145)","rgb(255, 251, 143)","rgb(183, 235, 143)","rgb(135, 232, 222)","rgb(145, 213, 255)","rgb(173, 198, 255)","rgb(211, 173, 247)","rgb(255, 173, 210)","rgb(255, 77, 79)","rgb(255, 122, 69)","rgb(255, 169, 64)","rgb(255, 236, 61)","rgb(115, 209, 61)","rgb(54, 207, 201)","rgb(64, 169, 255)","rgb(89, 126, 247)","rgb(146, 84, 222)","rgb(247, 89, 171)","rgb(207, 19, 34)","rgb(212, 56, 13)","rgb(212, 107, 8)","rgb(212, 177, 6)","rgb(56, 158, 13)","rgb(8, 151, 156)","rgb(9, 109, 217)","rgb(29, 57, 196)","rgb(83, 29, 171)","rgb(196, 29, 127)","rgb(130, 0, 20)","rgb(135, 20, 0)","rgb(135, 56, 0)","rgb(97, 71, 0)","rgb(19, 82, 0)","rgb(0, 71, 79)","rgb(0, 58, 140)","rgb(6, 17, 120)","rgb(34, 7, 94)","rgb(120, 6, 80)"];var pu={renderStyle:function(t,e){var n=t,r=n.color,o=n.bgColor,i=e;return r&&au(i,{color:r}),o&&au(i,{backgroundColor:o}),i},styleToHtml:function(t,e){if(!r.Text.isText(t))return e;var n,o=t,i=o.color,u=o.bgColor;return i||u?((lo(e)||"span"!==fo(n=c.default(e)))&&(n=c.default("<span>"+e+"</span>")),i&&n.css("color",i),u&&n.css("background-color",u),so(n)):e},preParseHtml:[cu],parseStyleHtml:function(t,e,n){var o=c.default(t);if(!r.Text.isText(e))return e;var i=e,u=po(o,"color");u&&(i.color=u);var a=po(o,"background-color");return a||(a=po(o,"background")),a&&(i.bgColor=a),i},menus:[{key:"color",factory:function(){return new su},config:{colors:du}},{key:"bgColor",factory:function(){return new fu},config:{colors:du}}]},hu=function(t){if("string"!=typeof t)return !1;var e=t.match(vu);if(!e)return !1;var n=e[1];if(!n)return !1;if(gu.test(n)||mu.test(n))return !0;return !1},vu=/^(?:\w+:)?\/\/(\S+)$/,gu=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,mu=/^[^\s\.]+\.\S{2,}$/;var yu=ke.includes;function bu(t){return void 0===t&&(t="r"),t+"-"+i.nanoid()}function xu(t){return t.replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wu(t,e,n,r){return mo(this,void 0,void 0,(function(){var o,i;return yo(this,(function(u){switch(u.label){case 0:return (o=e.getMenuConfig(t).checkLink)?[4,o(n,r)]:[3,2];case 1:if("string"==typeof(i=u.sent()))return e.alert(i,"error"),[2,!1];if(null==i)return [2,!1];u.label=2;case 2:return [2,!0]}}))}))}function Eu(t,e,n){return mo(this,void 0,void 0,(function(){var r;return yo(this,(function(o){switch(o.label){case 0:return (r=e.getMenuConfig(t).parseLinkUrl)?[4,r(n)]:[3,2];case 1:return [2,o.sent()];case 2:return [2,n]}}))}))}function Su(t){return null==t.selection||!!e.DomEditor.getSelectedElems(t).some((function(e){var n=e.type;return !!t.isVoid(e)||(!!["pre","code","link"].includes(n)||void 0)}))}function ku(t,e){return {type:"link",url:xu(t),children:e?[{text:e}]:[]}}function Tu(t,e,n){return mo(this,void 0,void 0,(function(){var o,i,u;return yo(this,(function(a){switch(a.label){case 0:return n?(e||(e=n),t.restoreSelection(),Su(t)?[2]:[4,wu("insertLink",t,e,n)]):[2];case 1:return a.sent()?[4,Eu("insertLink",t,n)]:[2];case 2:return o=a.sent(),null==(i=t.selection)?[2]:(r.Range.isCollapsed(i)?(t.insertText(" "),u=ku(o,e),r.Transforms.insertNodes(t,u),t.insertFragment([{text:" "}])):r.Editor.string(t,i)!==e?(t.deleteFragment(),u=ku(o,e),r.Transforms.insertNodes(t,u)):(u=ku(o),r.Transforms.wrapNodes(t,u,{split:!0}),r.Transforms.collapse(t,{edge:"end"})),[2])}}))}))}qe({target:"Array",proto:!0},{includes:function(t){return yu(this,t,arguments.length>1?arguments[1]:void 0)}}),Dr("includes");var Mu={type:"link",renderElem:function(t,e,r){var o=t,i=o.url,u=o.target,a=void 0===u?"_blank":u;return n.jsx("a",{href:i,target:a},e)}};var Iu={type:"link",elemToHtml:function(t,e){var n=t,r=n.url,o=n.target;return '<a href="'+r+'" target="'+(void 0===o?"_blank":o)+'">'+e+"</a>"}};var Nu={selector:"a:not([data-w-e-type])",parseElemHtml:function(t,e,n){var o=c.default(t);return 0===(e=e.filter((function(t){return !!r.Text.isText(t)||!!n.isInline(t)}))).length&&(e=[{text:o.text().replace(/\s+/gm," ")}]),{type:"link",url:o.attr("href")||"",target:o.attr("target")||"",children:e}}};function Hu(){return bu("w-e-insert-link")}var Ou=function(){function t(){this.title=e.t("link.insert"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M440.224 635.776a51.84 51.84 0 0 1-36.768-15.232c-95.136-95.136-95.136-249.92 0-345.056l192-192C641.536 37.408 702.816 12.032 768 12.032s126.432 25.376 172.544 71.456c95.136 95.136 95.136 249.92 0 345.056l-87.776 87.776a51.968 51.968 0 1 1-73.536-73.536l87.776-87.776a140.16 140.16 0 0 0 0-197.984c-26.432-26.432-61.6-40.992-99.008-40.992s-72.544 14.56-99.008 40.992l-192 192a140.16 140.16 0 0 0 0 197.984 51.968 51.968 0 0 1-36.768 88.768z"></path><path d="M256 1012a242.4 242.4 0 0 1-172.544-71.456c-95.136-95.136-95.136-249.92 0-345.056l87.776-87.776a51.968 51.968 0 1 1 73.536 73.536l-87.776 87.776a140.16 140.16 0 0 0 0 197.984c26.432 26.432 61.6 40.992 99.008 40.992s72.544-14.56 99.008-40.992l192-192a140.16 140.16 0 0 0 0-197.984 51.968 51.968 0 1 1 73.536-73.536c95.136 95.136 95.136 249.92 0 345.056l-192 192A242.4 242.4 0 0 1 256 1012z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.textInputId=Hu(),this.urlInputId=Hu(),this.buttonId=Hu();}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.exec=function(t,e){},t.prototype.isDisabled=function(t){return Su(t)},t.prototype.getModalPositionNode=function(t){return null},t.prototype.getModalContentElem=function(t){var n=t.selection,o=this,i=o.textInputId,u=o.urlInputId,a=o.buttonId,l=xo(e.genModalInputElems(e.t("link.text"),i),2),s=l[0],f=l[1],d=c.default(f),p=xo(e.genModalInputElems(e.t("link.url"),u),2),h=p[0],v=p[1],g=c.default(v),m=xo(e.genModalButtonElems(a,e.t("common.ok")),1)[0];if(null==this.$content){var y=c.default("<div></div>");y.on("click","#"+a,(function(e){e.preventDefault();var n=y.find("#"+i).val(),r=y.find("#"+u).val();Tu(t,n,r),t.hidePanelOrModal();})),this.$content=y;}var b=this.$content;if(b.empty(),b.append(s),b.append(h),b.append(m),null==n||r.Range.isCollapsed(n))d.val("");else {var x=r.Editor.string(t,n);d.val(x);}return g.val(""),setTimeout((function(){d.focus();})),b[0]},t}();function ju(){return bu("w-e-update-link")}var Du=function(){function t(){this.title=e.t("link.edit"),this.iconSvg=Go,this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.urlInputId=ju(),this.buttonId=ju();}return t.prototype.getSelectedLinkElem=function(t){var n=e.DomEditor.getSelectedNodeByType(t,"link");return null==n?null:n},t.prototype.getValue=function(t){var e=this.getSelectedLinkElem(t);return e&&e.url||""},t.prototype.isActive=function(t){return !1},t.prototype.exec=function(t,e){},t.prototype.isDisabled=function(t){return null==t.selection||null==this.getSelectedLinkElem(t)},t.prototype.getModalPositionNode=function(t){return e.DomEditor.getSelectedNodeByType(t,"link")},t.prototype.getModalContentElem=function(t){var n=this.urlInputId,o=this.buttonId,i=xo(e.genModalInputElems(e.t("link.url"),n),2),u=i[0],a=i[1],l=c.default(a),s=xo(e.genModalButtonElems(o,e.t("common.ok")),1)[0];if(null==this.$content){var f=c.default("<div></div>");f.on("click","button",(function(o){o.preventDefault(),t.restoreSelection();var i=e.DomEditor.getSelectedNodeByType(t,"link"),u=i?r.Node.string(i):"",a=f.find("#"+n).val();!function(t,n,o){mo(this,void 0,void 0,(function(){var i,u;return yo(this,(function(a){switch(a.label){case 0:return o?[4,wu("editLink",t,n,o)]:[2];case 1:return a.sent()?[4,Eu("editLink",t,o)]:[2];case 2:return i=a.sent(),u={url:xu(i)},r.Transforms.setNodes(t,u,{match:function(t){return e.DomEditor.checkNodeType(t,"link")}}),[2]}}))}));}(t,u,a),t.hidePanelOrModal();})),this.$content=f;}var d=this.$content;d.empty(),d.append(u),d.append(s);var p=this.getValue(t);return l.val(p),setTimeout((function(){l.focus();})),d[0]},t}(),Lu=function(){function t(){this.title=e.t("link.unLink"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M608.16328 811.815036c9.371954 9.371954 9.371954 24.56788 0 33.941834l-89.347563 89.347564c-118.525421 118.523421-311.38448 118.531421-429.919901 0-118.527421-118.529421-118.527421-311.39048 0-429.917901l89.349564-89.349563c9.371954-9.371954 24.56788-9.371954 33.941834 0l79.195613 79.195613c9.371954 9.371954 9.371954 24.56788 0 33.941834l-89.349563 89.347564c-56.143726 56.145726-56.143726 147.49928 0 203.645005 56.143726 56.143726 147.49928 56.145726 203.647005 0l89.347564-89.347563c9.371954-9.371954 24.56788-9.371954 33.941834 0l79.193613 79.195613z m-113.135447-520.429459c9.371954 9.371954 24.56788 9.371954 33.941834 0l89.347564-89.347564c56.143726-56.149726 147.49928-56.145726 203.647006 0 56.143726 56.145726 56.143726 147.49928 0 203.645006l-89.349564 89.347564c-9.371954 9.371954-9.371954 24.56788 0 33.941834l79.195613 79.195613c9.371954 9.371954 24.56788 9.371954 33.941834 0l89.349564-89.349563c118.529421-118.529421 118.529421-311.38848 0-429.917901-118.531421-118.527421-311.38848-118.527421-429.919901 0l-89.347563 89.347564c-9.371954 9.371954-9.371954 24.56788 0 33.941834l79.193613 79.195613z m469.653707 718.556492l45.253779-45.253779c18.745908-18.745908 18.745908-49.13776 0-67.881669L127.195629 14.062931c-18.745908-18.745908-49.13776-18.745908-67.881669 0L14.058181 59.31871c-18.745908 18.745908-18.745908 49.13776 0 67.881669l882.74169 882.74169c18.745908 18.743908 49.13776 18.743908 67.881669 0z"></path></svg>',this.tag="button";}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.isDisabled=function(t){return null==t.selection||null==e.DomEditor.getSelectedNodeByType(t,"link")},t.prototype.exec=function(t,n){this.isDisabled(t)||r.Transforms.unwrapNodes(t,{match:function(t){return e.DomEditor.checkNodeType(t,"link")}});},t}(),zu=function(){function t(){this.title=e.t("link.view"),this.iconSvg=Uo,this.tag="button";}return t.prototype.getSelectedLinkElem=function(t){var n=e.DomEditor.getSelectedNodeByType(t,"link");return null==n?null:n},t.prototype.getValue=function(t){var e=this.getSelectedLinkElem(t);return e&&e.url||""},t.prototype.isActive=function(t){return !1},t.prototype.isDisabled=function(t){return null==t.selection||null==this.getSelectedLinkElem(t)},t.prototype.exec=function(t,e){if(!this.isDisabled(t)){if(!e||"string"!=typeof e)throw new Error("View link failed, link url is '"+e+"'");window.open(e,"_blank");}},t}();var Au={checkLink:function(t,e){return !0},parseLinkUrl:function(t){return t}},Pu={renderElems:[Mu],elemsToHtml:[Iu],parseElemsHtml:[Nu],menus:[{key:"insertLink",factory:function(){return new Ou},config:Au},{key:"editLink",factory:function(){return new Du},config:Au},{key:"unLink",factory:function(){return new Lu}},{key:"viewLink",factory:function(){return new zu}}],editorPlugin:function(t){var n=t.isInline,o=t.insertData,i=t.normalizeNode;t.insertNode,t.insertText;var u=t;return u.isInline=function(t){return "link"===t.type||n(t)},u.insertData=function(t){var e=t.getData("text/plain");if(hu(e)){if(!Su(u)){var n=u.selection;if(null!=n){var i=r.Editor.string(u,n);Tu(u,i,e);}}}else o(t);},u.normalizeNode=function(t){var n=xo(t,2),o=n[0],a=n[1];return "link"!==e.DomEditor.getNodeType(o)?i([o,a]):""===r.Node.string(o)?r.Transforms.removeNodes(u,{at:a}):i([o,a])},u}};var Cu=D(1..valueOf),Vu=y.RangeError,Bu=y.RangeError,Ru=y.String,Fu=Math.floor,_u=D((function(t){var e=bn(R(this)),n="",r=ge(t);if(r<0||r==1/0)throw Vu("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n})),qu=D("".slice),$u=D(1..toFixed),Wu=function(t,e,n){return 0===e?n:e%2==1?Wu(t,e-1,n*t):Wu(t*t,e/2,n)},Gu=function(t,e,n){for(var r=-1,o=n;++r<6;)o+=e*t[r],t[r]=o%1e7,o=Fu(o/1e7);},Uu=function(t,e){for(var n=6,r=0;--n>=0;)r+=t[n],t[n]=Fu(r/e),r=r%e*1e7;},Xu=function(t){for(var e=6,n="";--e>=0;)if(""!==n||0===e||0!==t[e]){var r=Ru(t[e]);n=""===n?r:n+_u("0",7-r.length)+r;}return n};function Yu(t,n){return "w-e-image-container-"+e.DomEditor.findKey(t,n).id}function Ju(t,o,i,u){var a=c.default("body"),s=Yu(t,o),f=u.width,d=u.height,p=0,h=0,v=0,g=!1,m=null;function y(n){m=function(){var t=c.default("#"+s);if(0===t.length)throw new Error("Cannot find image container elem");return t}(),p=n;var r=m.find("img");if(0===r.length)throw new Error("Cannot find image elem");h=r.width(),v=r.height(),a.on("mousemove",b),a.on("mouseup",x);var o=e.DomEditor.getHoverbar(t);o&&o.hideAndClean();}var b=l.default((function(t){t.preventDefault();var e=t.clientX,n=h+(g?p-e:e-p),r=v*(n/h);null!=m&&(n<=15||r<=15||(m.css("width",n+"px"),m.css("height",r+"px")));}),100);function x(n){if(a.off("mousemove",b),null!=m){var i=m.width().toFixed(2),u=m.height().toFixed(2),c={style:go(go({},o.style),{width:i+"px",height:u+"px"})};r.Transforms.setNodes(t,c,{at:e.DomEditor.findPath(t,o)}),a.off("mouseup",x);}}var w={};return f&&(w.width=f),d&&(w.height=d),n.jsx("div",{id:s,style:w,className:"w-e-image-container w-e-selected-image-container",on:{mousedown:function(t){var e=c.default(t.target);e.hasClass("w-e-image-dragger")&&(t.preventDefault(),(e.hasClass("left-top")||e.hasClass("left-bottom"))&&(g=!0),y(t.clientX));}}},i,n.jsx("div",{className:"w-e-image-dragger left-top"}),n.jsx("div",{className:"w-e-image-dragger right-top"}),n.jsx("div",{className:"w-e-image-dragger left-bottom"}),n.jsx("div",{className:"w-e-image-dragger right-bottom"}))}qe({target:"Number",proto:!0,forced:b((function(){return "0.000"!==$u(8e-5,3)||"1"!==$u(.9,0)||"1.25"!==$u(1.255,2)||"1000000000000000128"!==$u(0xde0b6b3a7640080,0)}))||!b((function(){$u({});}))},{toFixed:function(t){var e,n,r,o,i=Cu(this),u=ge(t),a=[0,0,0,0,0,0],c="",l="0";if(u<0||u>20)throw Bu("Incorrect fraction digits");if(i!=i)return "NaN";if(i<=-1e21||i>=1e21)return Ru(i);if(i<0&&(c="-",i=-i),i>1e-21)if(n=(e=function(t){for(var e=0,n=t;n>=4096;)e+=12,n/=4096;for(;n>=2;)e+=1,n/=2;return e}(i*Wu(2,69,1))-69)<0?i*Wu(2,-e,1):i/Wu(2,e,1),n*=4503599627370496,(e=52-e)>0){for(Gu(a,0,n),r=u;r>=7;)Gu(a,1e7,0),r-=7;for(Gu(a,Wu(10,r,1),0),r=e-1;r>=23;)Uu(a,1<<23),r-=23;Uu(a,1<<r),Gu(a,1,1),Uu(a,2),l=Xu(a);}else Gu(a,0,n),Gu(a,1<<-e,0),l=Xu(a)+_u("0",u);return l=u>0?c+((o=l.length)<=u?"0."+_u("0",u-o)+l:qu(l,0,o-u)+"."+qu(l,o-u)):c+l}});var Ku={type:"image",renderElem:function(t,r,o){var i=t,u=i.src,a=i.alt,c=void 0===a?"":a,l=i.href,s=void 0===l?"":l,f=i.style,d=void 0===f?{}:f,p=d.width,h=void 0===p?"":p,v=d.height,g=void 0===v?"":v,m=e.DomEditor.isNodeSelected(o,t),y={};h&&(y.width="100%"),g&&(y.height="100%");var b=n.jsx("img",{style:y,src:u,alt:c,"data-href":s}),x=o.isDisabled();return m&&!x?Ju(o,t,b,{width:h,height:g}):function(t,e,r,o){var i=o.width,u=o.height,a={};i&&(a.width=i),u&&(a.height=u);var c=Yu(t,e);return n.jsx("div",{id:c,style:a,className:"w-e-image-container"},r)}(o,t,b,{width:h,height:g})}};var Qu={type:"image",elemToHtml:function(t,e){var n=t,r=n.src,o=n.alt,i=void 0===o?"":o,u=n.href,a=void 0===u?"":u,c=n.style,l=void 0===c?{}:c,s=l.width,f=void 0===s?"":s,d=l.height,p=void 0===d?"":d,h="";return f&&(h+="width: "+f+";"),p&&(h+="height: "+p+";"),'<img src="'+r+'" alt="'+i+'" data-href="'+a+'" style="'+h+'"/>'}};var Zu={selector:"img:not([data-w-e-type])",parseElemHtml:function(t,e,n){var r=c.default(t),o=r.attr("data-href")||"";return o=decodeURIComponent(o),{type:"image",src:r.attr("src")||"",alt:r.attr("alt")||"",href:o,style:{width:po(r,"width"),height:po(r,"height")},children:[{text:""}]}}};function ta(t,e,n,r,o){return void 0===r&&(r=""),void 0===o&&(o=""),mo(this,void 0,void 0,(function(){var i,u;return yo(this,(function(a){switch(a.label){case 0:return (i=e.getMenuConfig(t).checkImage)?[4,i(n,r,o)]:[3,2];case 1:if("string"==typeof(u=a.sent()))return e.alert(u,"error"),[2,!1];if(null==u)return [2,!1];a.label=2;case 2:return [2,!0]}}))}))}function ea(t,e,n){return mo(this,void 0,void 0,(function(){var r;return yo(this,(function(o){switch(o.label){case 0:return (r=e.getMenuConfig(t).parseImageSrc)?[4,r(n)]:[3,2];case 1:return [2,o.sent()];case 2:return [2,n]}}))}))}function na(t,n,o,i){return void 0===o&&(o=""),void 0===i&&(i=""),mo(this,void 0,void 0,(function(){var u,a,c;return yo(this,(function(l){switch(l.label){case 0:return [4,ta("insertImage",t,n,o,i)];case 1:return l.sent()?[4,ea("insertImage",t,n)]:[2];case 2:return u=l.sent(),a={type:"image",src:xu(u),href:i,alt:o,style:{},children:[{text:""}]},null===t.selection&&t.restoreSelection(),e.DomEditor.getSelectedNodeByType(t,"image")&&t.move(1),oa(t)?[2]:(r.Transforms.insertNodes(t,a),(c=t.getMenuConfig("insertImage").onInsertedImage)&&c(a),[2])}}))}))}function ra(t,n,o,i,u){return void 0===o&&(o=""),void 0===i&&(i=""),void 0===u&&(u={}),mo(this,void 0,void 0,(function(){var a,c,l,s,f,d;return yo(this,(function(p){switch(p.label){case 0:return [4,ta("editImage",t,n,o,i)];case 1:return p.sent()?[4,ea("editImage",t,n)]:[2];case 2:return a=p.sent(),null==(c=e.DomEditor.getSelectedNodeByType(t,"image"))?[2]:(l=c.style,s={src:a,alt:o,href:i,style:go(go({},void 0===l?{}:l),u)},r.Transforms.setNodes(t,s,{match:function(t){return e.DomEditor.checkNodeType(t,"image")}}),f=e.DomEditor.getSelectedNodeByType(t,"image"),(d=t.getMenuConfig("editImage").onUpdatedImage)&&d(f),[2])}}))}))}function oa(t){var n=t.selection;return null==n||(!r.Range.isCollapsed(n)||!!xo(r.Editor.nodes(t,{match:function(n){var o=e.DomEditor.getNodeType(n);return "code"===o||("pre"===o||("link"===o||("list-item"===o||(!!o.startsWith("header")||("blockquote"===o||!!r.Editor.isVoid(t,n))))))},universal:!0}),1)[0])}function ia(){return bu("w-e-insert-image")}var ua=function(){function t(){this.title=e.t("image.netImage"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.srcInputId=ia(),this.altInputId=ia(),this.hrefInputId=ia(),this.buttonId=ia();}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.exec=function(t,e){},t.prototype.isDisabled=function(t){return oa(t)},t.prototype.getModalPositionNode=function(t){return null},t.prototype.getModalContentElem=function(t){var n=this,r=this,o=r.srcInputId,i=r.altInputId,u=r.hrefInputId,a=r.buttonId,l=xo(e.genModalInputElems(e.t("image.src"),o),2),s=l[0],f=l[1],d=c.default(f),p=xo(e.genModalInputElems(e.t("image.desc"),i),2),h=p[0],v=p[1],g=c.default(v),m=xo(e.genModalInputElems(e.t("image.link"),u),2),y=m[0],b=m[1],x=c.default(b),w=xo(e.genModalButtonElems(a,e.t("common.ok")),1)[0];if(null==this.$content){var E=c.default("<div></div>");E.on("click","#"+a,(function(e){e.preventDefault();var r=E.find("#"+o).val().trim(),a=E.find("#"+i).val().trim(),c=E.find("#"+u).val().trim();n.insertImage(t,r,a,c),t.hidePanelOrModal();})),this.$content=E;}var S=this.$content;return S.empty(),S.append(s),S.append(h),S.append(y),S.append(w),d.val(""),g.val(""),x.val(""),setTimeout((function(){d.focus();})),S[0]},t.prototype.insertImage=function(t,e,n,r){void 0===n&&(n=""),void 0===r&&(r=""),e&&(t.restoreSelection(),this.isDisabled(t)||na(t,e,n,r));},t}(),aa=function(){function t(){this.title=e.t("image.delete"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M826.8032 356.5312c-19.328 0-36.3776 15.6928-36.3776 35.0464v524.2624c0 19.328-16 34.56-35.328 34.56H264.9344c-19.328 0-35.5072-15.3088-35.5072-34.56V390.0416c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.6928-33.5104 35.0464V915.712c0 57.9328 44.6208 108.288 102.528 108.288H755.2c57.9328 0 108.0832-50.4576 108.0832-108.288V391.4752c-0.1024-19.2512-17.1264-34.944-36.48-34.944z" p-id="9577"></path><path d="M437.1712 775.7568V390.6048c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.616-33.5104 35.0464v385.152c0 19.328 14.1568 35.0464 33.5104 35.0464s33.5104-15.7184 33.5104-35.0464zM649.7024 775.7568V390.6048c0-19.328-17.0496-35.0464-36.3776-35.0464s-36.3776 15.616-36.3776 35.0464v385.152c0 19.328 17.0496 35.0464 36.3776 35.0464s36.3776-15.7184 36.3776-35.0464zM965.0432 217.0368h-174.6176V145.5104c0-57.9328-47.2064-101.76-104.6528-101.76h-350.976c-57.8304 0-105.3952 43.8528-105.3952 101.76v71.5264H54.784c-19.4304 0-35.0464 14.1568-35.0464 33.5104 0 19.328 15.616 33.5104 35.0464 33.5104h910.3616c19.328 0 35.0464-14.1568 35.0464-33.5104 0-19.3536-15.6928-33.5104-35.1488-33.5104z m-247.3728 0H297.3952V145.5104c0-19.328 18.2016-34.7648 37.4272-34.7648h350.976c19.1488 0 31.872 15.1296 31.872 34.7648v71.5264z"></path></svg>',this.tag="button";}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.isDisabled=function(t){return null==t.selection||null==e.DomEditor.getSelectedNodeByType(t,"image")},t.prototype.exec=function(t,n){this.isDisabled(t)||r.Transforms.removeNodes(t,{match:function(t){return e.DomEditor.checkNodeType(t,"image")}});},t}();function ca(){return bu("w-e-edit-image")}var la=function(){function t(){this.title=e.t("image.edit"),this.iconSvg=Go,this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.srcInputId=ca(),this.altInputId=ca(),this.hrefInputId=ca(),this.buttonId=ca();}return t.prototype.getValue=function(t){return ""},t.prototype.getImageNode=function(t){return e.DomEditor.getSelectedNodeByType(t,"image")},t.prototype.isActive=function(t){return !1},t.prototype.exec=function(t,e){},t.prototype.isDisabled=function(t){var n=t.selection;return null==n||(!r.Range.isCollapsed(n)||null==e.DomEditor.getSelectedNodeByType(t,"image"))},t.prototype.getModalPositionNode=function(t){return this.getImageNode(t)},t.prototype.getModalContentElem=function(t){var n=this,r=this,o=r.srcInputId,i=r.altInputId,u=r.hrefInputId,a=r.buttonId,l=this.getImageNode(t);if(null==l)throw new Error("Not found selected image node");var s=xo(e.genModalInputElems(e.t("image.src"),o),2),f=s[0],d=s[1],p=c.default(d),h=xo(e.genModalInputElems(e.t("image.desc"),i),2),v=h[0],g=h[1],m=c.default(g),y=xo(e.genModalInputElems(e.t("image.link"),u),2),b=y[0],x=y[1],w=c.default(x),E=xo(e.genModalButtonElems(a,e.t("common.ok")),1)[0];if(null==this.$content){var S=c.default("<div></div>");S.on("click","#"+a,(function(e){e.preventDefault();var r=S.find("#"+o).val(),a=S.find("#"+i).val(),c=S.find("#"+u).val();n.updateImage(t,r,a,c),t.hidePanelOrModal();})),this.$content=S;}var k=this.$content;k.empty(),k.append(f),k.append(v),k.append(b),k.append(E);var T=l,M=T.src,I=T.alt,N=void 0===I?"":I,H=T.href,O=void 0===H?"":H;return p.val(M),m.val(N),w.val(O),setTimeout((function(){p.focus();})),k[0]},t.prototype.updateImage=function(t,e,n,r,o){void 0===n&&(n=""),void 0===r&&(r=""),void 0===o&&(o={}),e&&(t.restoreSelection(),this.isDisabled(t)||ra(t,e,n,r,o));},t}(),sa=function(){function t(){this.title=e.t("image.viewLink"),this.iconSvg=Uo,this.tag="button";}return t.prototype.getValue=function(t){var n=e.DomEditor.getSelectedNodeByType(t,"image");return n&&n.href||""},t.prototype.isActive=function(t){return !1},t.prototype.isDisabled=function(t){return null==t.selection||!this.getValue(t)},t.prototype.exec=function(t,e){if(!this.isDisabled(t)){if(!e||"string"!=typeof e)throw new Error("View image link failed, image.href is '"+e+"'");window.open(e,"_blank");}},t}(),fa=function(){function t(){this.tag="button";}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.getSelectedNode=function(t){return e.DomEditor.getSelectedNodeByType(t,"image")},t.prototype.isDisabled=function(t){return null==t.selection||null==this.getSelectedNode(t)},t.prototype.exec=function(t,n){if(!this.isDisabled(t)){var o=this.getSelectedNode(t);if(null!=o){var i=e.DomEditor.getHoverbar(t);i&&i.hideAndClean();var u=o.style,a={style:go(go({},void 0===u?{}:u),{width:this.value,height:""})};r.Transforms.setNodes(t,a,{match:function(t){return e.DomEditor.checkNodeType(t,"image")}});}}},t}(),da=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="30%",e.value="30%",e}return vo(e,t),e}(fa),pa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="50%",e.value="50%",e}return vo(e,t),e}(fa),ha=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.title="100%",e.value="100%",e}return vo(e,t),e}(fa);var va={onInsertedImage:function(t){},onUpdatedImage:function(t){},checkImage:function(t,e,n){return !0},parseImageSrc:function(t){return t}},ga={renderElems:[Ku],elemsToHtml:[Qu],parseElemsHtml:[Zu],menus:[{key:"insertImage",factory:function(){return new ua},config:va},{key:"deleteImage",factory:function(){return new aa}},{key:"editImage",factory:function(){return new la},config:va},{key:"viewImageLink",factory:function(){return new sa}},{key:"imageWidth30",factory:function(){return new da}},{key:"imageWidth50",factory:function(){return new pa}},{key:"imageWidth100",factory:function(){return new ha}}],editorPlugin:function(t){var e=t.isInline,n=t.isVoid;t.insertNode;var r=t;return r.isInline=function(t){return "image"===t.type||e(t)},r.isVoid=function(t){return "image"===t.type||n(t)},r}};var ma={type:"todo",renderElem:function(t,o,i){var u=!1;i.isDisabled()&&(u=!0);var a=t.checked,c=n.jsx("div",{style:{margin:"5px 0"}},n.jsx("span",{contentEditable:!1,style:{marginRight:"0.5em"}},n.jsx("input",{type:"checkbox",checked:a,disabled:u,on:{change:function(n){var o=e.DomEditor.findPath(i,t),u={checked:n.target.checked};r.Transforms.setNodes(i,u,{at:o});}}})),n.jsx("span",null,o));return c}};var ya=function(){function t(){this.title=e.t("todo.todo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M278.755556 403.911111l-79.644445 79.644445L455.111111 739.555556l568.888889-568.888889-79.644444-79.644445L455.111111 580.266667l-176.355555-176.355556zM910.222222 910.222222H113.777778V113.777778h568.888889V0H113.777778C51.2 0 0 51.2 0 113.777778v796.444444c0 62.577778 51.2 113.777778 113.777778 113.777778h796.444444c62.577778 0 113.777778-51.2 113.777778-113.777778V455.111111h-113.777778v455.111111z"></path></svg>',this.tag="button";}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !!e.DomEditor.getSelectedNodeByType(t,"todo")},t.prototype.isDisabled=function(t){return null==t.selection||!!e.DomEditor.getSelectedElems(t).some((function(e){if(r.Editor.isVoid(t,e)&&r.Editor.isBlock(t,e))return !0;var n=e.type;return !!["pre","table","list-item"].includes(n)||void 0}))},t.prototype.exec=function(t,e){var n=this.isActive(t);r.Transforms.setNodes(t,{type:n?"paragraph":"todo"});},t}();var ba={renderElems:[ma],elemsToHtml:[{type:"todo",elemToHtml:function(t,e){return '<div data-w-e-type="todo"><input type="checkbox" disabled '+(t.checked?"checked":"")+">"+e+"</div>"}}],preParseHtml:[{selector:"ul.w-e-todo",preParseHtml:function(t){var e=c.default(t).find("li"),n=c.default('<div data-w-e-type="todo"></div>'),r=e.find("input[type]");return n.append(r),e.children()[0].remove(),n[0].innerHTML=n[0].innerHTML+e[0].innerHTML,n[0]}}],parseElemsHtml:[{selector:'div[data-w-e-type="todo"]',parseElemHtml:function(t,e,n){var o=c.default(t);0===(e=e.filter((function(t){return !!r.Text.isText(t)||!!n.isInline(t)}))).length&&(e=[{text:o.text().replace(/\s+/gm," ")}]);var i=!1;return null!=o.find('input[type="checkbox"]').attr("checked")&&(i=!0),{type:"todo",checked:i,children:e}}}],menus:[{key:"todo",factory:function(){return new ya}}],editorPlugin:function(t){var n=t.deleteBackward,o=t;return o.deleteBackward=function(o){var i=t.selection;if(i&&r.Range.isCollapsed(i)){var u=e.DomEditor.getSelectedNodeByType(t,"todo");if(u&&0===r.Node.string(u).length)return void r.Transforms.setNodes(t,{type:"paragraph"},{mode:"highest"})}n(o);},o}};var xa={type:"blockquote",renderElem:function(t,e,r){return n.jsx("blockquote",null,e)}};var wa={type:"blockquote",elemToHtml:function(t,e){return "<blockquote>"+e+"</blockquote>"}};var Ea={selector:"blockquote:not([data-w-e-type])",parseElemHtml:function(t,e,n){var o=c.default(t);return 0===(e=e.filter((function(t){return !!r.Text.isText(t)||!!n.isInline(t)}))).length&&(e=[{text:o.text().replace(/\s+/gm," ")}]),{type:"blockquote",children:e}}},Sa=function(){function t(){this.title=e.t("blockQuote.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M894.6 907.1H605.4c-32.6 0-59-26.4-59-59V608.2l-4-14.9c0-315.9 125.5-485.1 376.5-507.5v59.8C752.7 180.4 711.3 315.8 711.3 442.4v41.2l31.5 12.3h151.8c32.6 0 59 26.4 59 59v293.2c0 32.5-26.4 59-59 59z m-472 0H133.4c-32.6 0-59-26.4-59-59V608.2l-4-14.9c0-315.9 125.5-485.1 376.5-507.5v59.8C280.7 180.4 239.3 315.8 239.3 442.4v41.2l31.5 12.3h151.8c32.6 0 59 26.4 59 59v293.2c0 32.5-26.4 59-59 59z"></path></svg>',this.tag="button";}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !!e.DomEditor.getSelectedNodeByType(t,"blockquote")},t.prototype.isDisabled=function(t){return null==t.selection||!xo(r.Editor.nodes(t,{match:function(t){var n=e.DomEditor.getNodeType(t);return "paragraph"===n||"blockquote"===n},universal:!0,mode:"highest"}),1)[0]},t.prototype.exec=function(t,e){if(!this.isDisabled(t)){var n=this.isActive(t)?"paragraph":"blockquote";r.Transforms.setNodes(t,{type:n},{mode:"highest"});}},t}(),ka={key:"blockquote",factory:function(){return new Sa}},Ta=D([].slice),Ma=hn("slice"),Ia=Mt("species"),Na=y.Array,Ha=Math.max;qe({target:"Array",proto:!0,forced:!Ma},{slice:function(t,e){var n,r,o,i=F(this),u=Ee(i),a=be(t,u),c=be(void 0===e?u:e,u);if(We(i)&&(n=i.constructor,(un(n)&&(n===Na||We(n.prototype))||q(n)&&null===(n=n[Ia]))&&(n=void 0),n===Na||void 0===n))return Ta(i,a,c);for(r=new(void 0===n?Na:n)(Ha(c-a,0)),o=0;a<c;a++,o++)a in i&&Fr(r,o,i[a]);return r.length=o,r}});var Oa={renderElems:[xa],elemsToHtml:[wa],parseElemsHtml:[Ea],menus:[ka],editorPlugin:function(t){var n=t.insertBreak,o=t.insertText,i=t;return i.insertBreak=function(){var u=i.selection;if(null==u)return n();var a=xo(r.Editor.nodes(t,{match:function(t){return e.DomEditor.checkNodeType(t,"blockquote")},universal:!0}),1)[0];if(!a)return n();var c=a[0],l=e.DomEditor.findPath(t,c),s=r.Editor.end(t,l);if(r.Point.equals(s,u.focus)){var f=r.Node.string(c);if(f&&"\n"===f.slice(-1)){t.deleteBackward("character");return void r.Transforms.insertNodes(i,{type:"paragraph",children:[{text:""}]},{mode:"highest"})}}o("\n");},i}},ja=function(){function t(){this.title=e.t("emotion.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M512 1024C230.4 1024 0 793.6 0 512S230.4 0 512 0s512 230.4 512 512-230.4 512-512 512z m0-102.4c226.742857 0 409.6-182.857143 409.6-409.6S738.742857 102.4 512 102.4 102.4 285.257143 102.4 512s182.857143 409.6 409.6 409.6z m-204.8-358.4h409.6c0 113.371429-91.428571 204.8-204.8 204.8s-204.8-91.428571-204.8-204.8z m0-102.4c-43.885714 0-76.8-32.914286-76.8-76.8s32.914286-76.8 76.8-76.8 76.8 32.914286 76.8 76.8-32.914286 76.8-76.8 76.8z m409.6 0c-43.885714 0-76.8-32.914286-76.8-76.8s32.914286-76.8 76.8-76.8c43.885714 0 76.8 32.914286 76.8 76.8s-32.914286 76.8-76.8 76.8z"></path></svg>',this.tag="button",this.showDropPanel=!0,this.$content=null;}return t.prototype.exec=function(t,e){},t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.isDisabled=function(t){return null==t.selection||!!xo(r.Editor.nodes(t,{match:function(n){return "pre"===e.DomEditor.getNodeType(n)||!!r.Editor.isVoid(t,n)},universal:!0}),1)[0]},t.prototype.getPanelContentElem=function(t){if(null==this.$content){var e=c.default('<ul class="w-e-panel-content-emotion"></ul>');e.on("click","li",(function(e){var n=e.target;if(null!=n){e.preventDefault();var r=c.default(n).text();t.insertText(r);}})),this.$content=e;}var n=this.$content;if(null==n)return document.createElement("ul");n.empty();var r=t.getMenuConfig("emotion").emotions;return (void 0===r?[]:r).forEach((function(t){var e=c.default("<li>"+t+"</li>");n.append(e);})),n[0]},t}();var Da={menus:[{key:"emotion",factory:function(){return new ja},config:{emotions:"😀 😃 😄 😁 😆 😅 😂 🤣 😊 😇 🙂 🙃 😉 😌 😍 😘 😗 😙 😚 😋 😛 😝 😜 🤓 😎 😏 😒 😞 😔 😟 😕 🙁 😣 😖 😫 😩 😢 😭 😤 😠 😡 😳 😱 😨 🤗 🤔 😶 😑 😬 🙄 😯 😴 😷 🤑 😈 🤡 💩 👻 💀 👀 👣 👐 🙌 👏 🤝 👍 👎 👊 ✊ 🤛 🤜 🤞 ✌️ 🤘 👌 👈 👉 👆 👇 ☝️ ✋ 🤚 🖐 🖖 👋 🤙 💪 🖕 ✍️ 🙏".split(" ")}}]};var La={1:"12px",2:"14px",3:"16px",4:"19px",5:"24px",6:"32px",7:"48px"};var za={selector:"font",preParseHtml:function(t){var e=c.default(t);if("font"!==fo(e))return t;var n=e.attr("size")||"";n&&(e.removeAttr("size"),e.css("font-size",La[n]));var r=e.attr("face")||"";return r&&(e.removeAttr("face"),e.css("font-family",r)),e[0]}},Aa=D("".indexOf);qe({target:"String",proto:!0,forced:!Di("includes")},{includes:function(t){return !!~Aa(bn(R(this)),bn(Oi(t)),arguments.length>1?arguments[1]:void 0)}});var Pa,Ca,Va=function(t){return t&&t.Math==Math&&t},Ba=Va("object"==typeof globalThis&&globalThis)||Va("object"==typeof window&&window)||Va("object"==typeof self&&self)||Va("object"==typeof d&&d)||function(){return this}()||Function("return this")(),Ra=Function.prototype,Fa=Ra.apply,_a=Ra.bind,qa=Ra.call,$a="object"==typeof Reflect&&Reflect.apply||(_a?qa.bind(Fa):function(){return qa.apply(Fa,arguments)}),Wa=Function.prototype,Ga=Wa.bind,Ua=Wa.call,Xa=Ga&&Ga.bind(Ua),Ya=Ga?function(t){return t&&Xa(Ua,t)}:function(t){return t&&function(){return Ua.apply(t,arguments)}},Ja=function(t){return "function"==typeof t},Ka=function(t){try{return !!t()}catch(t){return !0}},Qa=!Ka((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Za=Function.prototype.call,tc=Za.bind?Za.bind(Za):function(){return Za.apply(Za,arguments)},ec={}.propertyIsEnumerable,nc=Object.getOwnPropertyDescriptor,rc=nc&&!ec.call({1:2},1)?function(t){var e=nc(this,t);return !!e&&e.enumerable}:ec,oc={f:rc},ic=function(t,e){return {enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},uc=Ya({}.toString),ac=Ya("".slice),cc=function(t){return ac(uc(t),8,-1)},lc=Ba.Object,sc=Ya("".split),fc=Ka((function(){return !lc("z").propertyIsEnumerable(0)}))?function(t){return "String"==cc(t)?sc(t,""):lc(t)}:lc,dc=Ba.TypeError,pc=function(t){if(null==t)throw dc("Can't call method on "+t);return t},hc=function(t){return fc(pc(t))},vc=function(t){return "object"==typeof t?null!==t:Ja(t)},gc={},mc=function(t){return Ja(t)?t:void 0},yc=function(t,e){return arguments.length<2?mc(gc[t])||mc(Ba[t]):gc[t]&&gc[t][e]||Ba[t]&&Ba[t][e]},bc=Ya({}.isPrototypeOf),xc=yc("navigator","userAgent")||"",wc=Ba.process,Ec=Ba.Deno,Sc=wc&&wc.versions||Ec&&Ec.version,kc=Sc&&Sc.v8;kc&&(Ca=(Pa=kc.split("."))[0]>0&&Pa[0]<4?1:+(Pa[0]+Pa[1])),!Ca&&xc&&(!(Pa=xc.match(/Edge\/(\d+)/))||Pa[1]>=74)&&(Pa=xc.match(/Chrome\/(\d+)/))&&(Ca=+Pa[1]);var Tc=Ca,Mc=!!Object.getOwnPropertySymbols&&!Ka((function(){var t=Symbol();return !String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Tc&&Tc<41})),Ic=Mc&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Nc=Ba.Object,Hc=Ic?function(t){return "symbol"==typeof t}:function(t){var e=yc("Symbol");return Ja(e)&&bc(e.prototype,Nc(t))},Oc=Ba.String,jc=Ba.TypeError,Dc=function(t){if(Ja(t))return t;throw jc(function(t){try{return Oc(t)}catch(t){return "Object"}}(t)+" is not a function")},Lc=Ba.TypeError,zc=Object.defineProperty,Ac="__core-js_shared__",Pc=Ba[Ac]||function(t,e){try{zc(Ba,t,{value:e,configurable:!0,writable:!0});}catch(n){Ba[t]=e;}return e}(Ac,{}),Cc=h((function(t){(t.exports=function(t,e){return Pc[t]||(Pc[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"pure",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});})),Vc=Ba.Object,Bc=function(t){return Vc(pc(t))},Rc=Ya({}.hasOwnProperty),Fc=Object.hasOwn||function(t,e){return Rc(Bc(t),e)},_c=0,qc=Math.random(),$c=Ya(1..toString),Wc=function(t){return "Symbol("+(void 0===t?"":t)+")_"+$c(++_c+qc,36)},Gc=Cc("wks"),Uc=Ba.Symbol,Xc=Uc&&Uc.for,Yc=Ic?Uc:Uc&&Uc.withoutSetter||Wc,Jc=function(t){if(!Fc(Gc,t)||!Mc&&"string"!=typeof Gc[t]){var e="Symbol."+t;Mc&&Fc(Uc,t)?Gc[t]=Uc[t]:Gc[t]=Ic&&Xc?Xc(e):Yc(e);}return Gc[t]},Kc=Ba.TypeError,Qc=Jc("toPrimitive"),Zc=function(t,e){if(!vc(t)||Hc(t))return t;var n,r,o=null==(n=t[Qc])?void 0:Dc(n);if(o){if(void 0===e&&(e="default"),r=tc(o,t,e),!vc(r)||Hc(r))return r;throw Kc("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,r;if("string"===e&&Ja(n=t.toString)&&!vc(r=tc(n,t)))return r;if(Ja(n=t.valueOf)&&!vc(r=tc(n,t)))return r;if("string"!==e&&Ja(n=t.toString)&&!vc(r=tc(n,t)))return r;throw Lc("Can't convert object to primitive value")}(t,e)},tl=function(t){var e=Zc(t,"string");return Hc(e)?e:e+""},el=Ba.document,nl=vc(el)&&vc(el.createElement),rl=function(t){return nl?el.createElement(t):{}},ol=!Qa&&!Ka((function(){return 7!=Object.defineProperty(rl("div"),"a",{get:function(){return 7}}).a})),il=Object.getOwnPropertyDescriptor,ul={f:Qa?il:function(t,e){if(t=hc(t),e=tl(e),ol)try{return il(t,e)}catch(t){}if(Fc(t,e))return ic(!tc(oc.f,t,e),t[e])}},al=/#|\.prototype\./,cl=function(t,e){var n=sl[ll(t)];return n==dl||n!=fl&&(Ja(e)?Ka(e):!!e)},ll=cl.normalize=function(t){return String(t).replace(al,".").toLowerCase()},sl=cl.data={},fl=cl.NATIVE="N",dl=cl.POLYFILL="P",pl=cl,hl=Ya(Ya.bind),vl=function(t,e){return Dc(t),void 0===e?t:hl?hl(t,e):function(){return t.apply(e,arguments)}},gl=Ba.String,ml=Ba.TypeError,yl=function(t){if(vc(t))return t;throw ml(gl(t)+" is not an object")},bl=Ba.TypeError,xl=Object.defineProperty,wl={f:Qa?xl:function(t,e,n){if(yl(t),e=tl(e),yl(n),ol)try{return xl(t,e,n)}catch(t){}if("get"in n||"set"in n)throw bl("Accessors not supported");return "value"in n&&(t[e]=n.value),t}},El=Qa?function(t,e,n){return wl.f(t,e,ic(1,n))}:function(t,e,n){return t[e]=n,t},Sl=ul.f,kl=function(t){var e=function(n,r,o){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,r)}return new t(n,r,o)}return $a(t,this,arguments)};return e.prototype=t.prototype,e},Tl=function(t,e){var n,r,o,i,u,a,c,l,s=t.target,f=t.global,d=t.stat,p=t.proto,h=f?Ba:d?Ba[s]:(Ba[s]||{}).prototype,v=f?gc:gc[s]||El(gc,s,{})[s],g=v.prototype;for(o in e)n=!pl(f?o:s+(d?".":"#")+o,t.forced)&&h&&Fc(h,o),u=v[o],n&&(a=t.noTargetGet?(l=Sl(h,o))&&l.value:h[o]),i=n&&a?a:e[o],n&&typeof u==typeof i||(c=t.bind&&n?vl(i,Ba):t.wrap&&n?kl(i):p&&Ja(i)?Ya(i):i,(t.sham||i&&i.sham||u&&u.sham)&&El(c,"sham",!0),El(v,o,c),p&&(Fc(gc,r=s+"Prototype")||El(gc,r,{}),El(gc[r],o,i),t.real&&g&&!g[o]&&El(g,o,i)));},Ml=Array.isArray||function(t){return "Array"==cc(t)},Il=Math.ceil,Nl=Math.floor,Hl=function(t){var e=+t;return e!=e||0===e?0:(e>0?Nl:Il)(e)},Ol=Math.min,jl=function(t){return (e=t.length)>0?Ol(Hl(e),9007199254740991):0;var e;},Dl=function(t,e,n){var r=tl(e);r in t?wl.f(t,r,ic(0,n)):t[r]=n;},Ll={};Ll[Jc("toStringTag")]="z";var zl="[object z]"===String(Ll),Al=Jc("toStringTag"),Pl=Ba.Object,Cl="Arguments"==cc(function(){return arguments}()),Vl=zl?cc:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Pl(t),Al))?n:Cl?cc(e):"Object"==(r=cc(e))&&Ja(e.callee)?"Arguments":r},Bl=Ya(Function.toString);Ja(Pc.inspectSource)||(Pc.inspectSource=function(t){return Bl(t)});var Rl=Pc.inspectSource,Fl=function(){},_l=[],ql=yc("Reflect","construct"),$l=/^\s*(?:class|function)\b/,Wl=Ya($l.exec),Gl=!$l.exec(Fl),Ul=function(t){if(!Ja(t))return !1;try{return ql(Fl,_l,t),!0}catch(t){return !1}},Xl=!ql||Ka((function(){var t;return Ul(Ul.call)||!Ul(Object)||!Ul((function(){t=!0;}))||t}))?function(t){if(!Ja(t))return !1;switch(Vl(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return !1}return Gl||!!Wl($l,Rl(t))}:Ul,Yl=Jc("species"),Jl=Ba.Array,Kl=function(t,e){return new(function(t){var e;return Ml(t)&&(e=t.constructor,(Xl(e)&&(e===Jl||Ml(e.prototype))||vc(e)&&null===(e=e[Yl]))&&(e=void 0)),void 0===e?Jl:e}(t))(0===e?0:e)},Ql=Jc("species"),Zl=Jc("isConcatSpreadable"),ts=9007199254740991,es="Maximum allowed index exceeded",ns=Ba.TypeError,rs=Tc>=51||!Ka((function(){var t=[];return t[Zl]=!1,t.concat()[0]!==t})),os=function(t){return Tc>=51||!Ka((function(){var e=[];return (e.constructor={})[Ql]=function(){return {foo:1}},1!==e[t](Boolean).foo}))}("concat"),is=function(t){if(!vc(t))return !1;var e=t[Zl];return void 0!==e?!!e:Ml(t)};Tl({target:"Array",proto:!0,forced:!rs||!os},{concat:function(t){var e,n,r,o,i,u=Bc(this),a=Kl(u,0),c=0;for(e=-1,r=arguments.length;e<r;e++)if(is(i=-1===e?u:arguments[e])){if(c+(o=jl(i))>ts)throw ns(es);for(n=0;n<o;n++,c++)n in i&&Dl(a,c,i[n]);}else {if(c>=ts)throw ns(es);Dl(a,c++,i);}return a.length=c,a}});var us,as=Ba.String,cs=function(t){if("Symbol"===Vl(t))throw TypeError("Cannot convert a Symbol value to a string");return as(t)},ls=Math.max,ss=Math.min,fs=function(t,e){var n=Hl(t);return n<0?ls(n+e,0):ss(n,e)},ds=function(t){return function(e,n,r){var o,i=hc(e),u=jl(i),a=fs(r,u);if(t&&n!=n){for(;u>a;)if((o=i[a++])!=o)return !0}else for(;u>a;a++)if((t||a in i)&&i[a]===n)return t||a||0;return !t&&-1}},ps={includes:ds(!0),indexOf:ds(!1)},hs={},vs=ps.indexOf,gs=Ya([].push),ms=function(t,e){var n,r=hc(t),o=0,i=[];for(n in r)!Fc(hs,n)&&Fc(r,n)&&gs(i,n);for(;e.length>o;)Fc(r,n=e[o++])&&(~vs(i,n)||gs(i,n));return i},ys=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],bs=Object.keys||function(t){return ms(t,ys)},xs=Qa?Object.defineProperties:function(t,e){yl(t);for(var n,r=hc(e),o=bs(e),i=o.length,u=0;i>u;)wl.f(t,n=o[u++],r[n]);return t},ws=yc("document","documentElement"),Es=Cc("keys"),Ss=function(t){return Es[t]||(Es[t]=Wc(t))},ks=Ss("IE_PROTO"),Ts=function(){},Ms=function(t){return "<script>"+t+"</"+"script>"},Is=function(t){t.write(Ms("")),t.close();var e=t.parentWindow.Object;return t=null,e},Ns=function(){try{us=new ActiveXObject("htmlfile");}catch(t){}var t,e;Ns="undefined"!=typeof document?document.domain&&us?Is(us):((e=rl("iframe")).style.display="none",ws.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Ms("document.F=Object")),t.close(),t.F):Is(us);for(var n=ys.length;n--;)delete Ns.prototype[ys[n]];return Ns()};hs[ks]=!0;var Hs,Os,js,Ds=Object.create||function(t,e){var n;return null!==t?(Ts.prototype=yl(t),n=new Ts,Ts.prototype=null,n[ks]=t):n=Ns(),void 0===e?n:xs(n,e)},Ls=ys.concat("length","prototype"),zs={f:Object.getOwnPropertyNames||function(t){return ms(t,Ls)}},As=Ba.Array,Ps=Math.max,Cs=zs.f,Vs="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Bs=function(t){try{return Cs(t)}catch(t){return function(t,e,n){for(var r=jl(t),o=fs(e,r),i=fs(void 0===n?r:n,r),u=As(Ps(i-o,0)),a=0;o<i;o++,a++)Dl(u,a,t[o]);return u.length=a,u}(Vs)}},Rs={f:function(t){return Vs&&"Window"==cc(t)?Bs(t):Cs(hc(t))}},Fs={f:Object.getOwnPropertySymbols},_s=Ya([].slice),qs=function(t,e,n,r){r&&r.enumerable?t[e]=n:El(t,e,n);},$s={f:Jc},Ws=wl.f,Gs=function(t){var e=gc.Symbol||(gc.Symbol={});Fc(e,t)||Ws(e,t,{value:$s.f(t)});},Us=zl?{}.toString:function(){return "[object "+Vl(this)+"]"},Xs=wl.f,Ys=Jc("toStringTag"),Js=function(t,e,n,r){if(t){var o=n?t:t.prototype;Fc(o,Ys)||Xs(o,Ys,{configurable:!0,value:e}),r&&!zl&&El(o,"toString",Us);}},Ks=Ba.WeakMap,Qs=Ja(Ks)&&/native code/.test(Rl(Ks)),Zs="Object already initialized",tf=Ba.TypeError,ef=Ba.WeakMap;if(Qs||Pc.state){var nf=Pc.state||(Pc.state=new ef),rf=Ya(nf.get),of=Ya(nf.has),uf=Ya(nf.set);Hs=function(t,e){if(of(nf,t))throw new tf(Zs);return e.facade=t,uf(nf,t,e),e},Os=function(t){return rf(nf,t)||{}},js=function(t){return of(nf,t)};}else {var af=Ss("state");hs[af]=!0,Hs=function(t,e){if(Fc(t,af))throw new tf(Zs);return e.facade=t,El(t,af,e),e},Os=function(t){return Fc(t,af)?t[af]:{}},js=function(t){return Fc(t,af)};}var cf={set:Hs,get:Os,has:js,enforce:function(t){return js(t)?Os(t):Hs(t,{})},getterFor:function(t){return function(e){var n;if(!vc(e)||(n=Os(e)).type!==t)throw tf("Incompatible receiver, "+t+" required");return n}}},lf=Ya([].push),sf=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,u=7==t,a=5==t||i;return function(c,l,s,f){for(var d,p,h=Bc(c),v=fc(h),g=vl(l,s),m=jl(v),y=0,b=f||Kl,x=e?b(c,m):n||u?b(c,0):void 0;m>y;y++)if((a||y in v)&&(p=g(d=v[y],y,h),t))if(e)x[y]=p;else if(p)switch(t){case 3:return !0;case 5:return d;case 6:return y;case 2:lf(x,d);}else switch(t){case 4:return !1;case 7:lf(x,d);}return i?-1:r||o?o:x}},ff={forEach:sf(0),map:sf(1),filter:sf(2),some:sf(3),every:sf(4),find:sf(5),findIndex:sf(6),filterReject:sf(7)}.forEach,df=Ss("hidden"),pf="Symbol",hf=Jc("toPrimitive"),vf=cf.set,gf=cf.getterFor(pf),mf=Object.prototype,yf=Ba.Symbol,bf=yf&&yf.prototype,xf=Ba.TypeError,wf=Ba.QObject,Ef=yc("JSON","stringify"),Sf=ul.f,kf=wl.f,Tf=Rs.f,Mf=oc.f,If=Ya([].push),Nf=Cc("symbols"),Hf=Cc("op-symbols"),Of=Cc("string-to-symbol-registry"),jf=Cc("symbol-to-string-registry"),Df=Cc("wks"),Lf=!wf||!wf.prototype||!wf.prototype.findChild,zf=Qa&&Ka((function(){return 7!=Ds(kf({},"a",{get:function(){return kf(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=Sf(mf,e);r&&delete mf[e],kf(t,e,n),r&&t!==mf&&kf(mf,e,r);}:kf,Af=function(t,e){var n=Nf[t]=Ds(bf);return vf(n,{type:pf,tag:t,description:e}),Qa||(n.description=e),n},Pf=function(t,e,n){t===mf&&Pf(Hf,e,n),yl(t);var r=tl(e);return yl(n),Fc(Nf,r)?(n.enumerable?(Fc(t,df)&&t[df][r]&&(t[df][r]=!1),n=Ds(n,{enumerable:ic(0,!1)})):(Fc(t,df)||kf(t,df,ic(1,{})),t[df][r]=!0),zf(t,r,n)):kf(t,r,n)},Cf=function(t,e){yl(t);var n=hc(e),r=bs(n).concat(Ff(n));return ff(r,(function(e){Qa&&!tc(Vf,n,e)||Pf(t,e,n[e]);})),t},Vf=function(t){var e=tl(t),n=tc(Mf,this,e);return !(this===mf&&Fc(Nf,e)&&!Fc(Hf,e))&&(!(n||!Fc(this,e)||!Fc(Nf,e)||Fc(this,df)&&this[df][e])||n)},Bf=function(t,e){var n=hc(t),r=tl(e);if(n!==mf||!Fc(Nf,r)||Fc(Hf,r)){var o=Sf(n,r);return !o||!Fc(Nf,r)||Fc(n,df)&&n[df][r]||(o.enumerable=!0),o}},Rf=function(t){var e=Tf(hc(t)),n=[];return ff(e,(function(t){Fc(Nf,t)||Fc(hs,t)||If(n,t);})),n},Ff=function(t){var e=t===mf,n=Tf(e?Hf:hc(t)),r=[];return ff(n,(function(t){!Fc(Nf,t)||e&&!Fc(mf,t)||If(r,Nf[t]);})),r};if(Mc||(yf=function(){if(bc(bf,this))throw xf("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?cs(arguments[0]):void 0,e=Wc(t),n=function(t){this===mf&&tc(n,Hf,t),Fc(this,df)&&Fc(this[df],e)&&(this[df][e]=!1),zf(this,e,ic(1,t));};return Qa&&Lf&&zf(mf,e,{configurable:!0,set:n}),Af(e,t)},bf=yf.prototype,qs(bf,"toString",(function(){return gf(this).tag})),qs(yf,"withoutSetter",(function(t){return Af(Wc(t),t)})),oc.f=Vf,wl.f=Pf,ul.f=Bf,zs.f=Rs.f=Rf,Fs.f=Ff,$s.f=function(t){return Af(Jc(t),t)},Qa&&kf(bf,"description",{configurable:!0,get:function(){return gf(this).description}})),Tl({global:!0,wrap:!0,forced:!Mc,sham:!Mc},{Symbol:yf}),ff(bs(Df),(function(t){Gs(t);})),Tl({target:pf,stat:!0,forced:!Mc},{for:function(t){var e=cs(t);if(Fc(Of,e))return Of[e];var n=yf(e);return Of[e]=n,jf[n]=e,n},keyFor:function(t){if(!Hc(t))throw xf(t+" is not a symbol");if(Fc(jf,t))return jf[t]},useSetter:function(){Lf=!0;},useSimple:function(){Lf=!1;}}),Tl({target:"Object",stat:!0,forced:!Mc,sham:!Qa},{create:function(t,e){return void 0===e?Ds(t):Cf(Ds(t),e)},defineProperty:Pf,defineProperties:Cf,getOwnPropertyDescriptor:Bf}),Tl({target:"Object",stat:!0,forced:!Mc},{getOwnPropertyNames:Rf,getOwnPropertySymbols:Ff}),Tl({target:"Object",stat:!0,forced:Ka((function(){Fs.f(1);}))},{getOwnPropertySymbols:function(t){return Fs.f(Bc(t))}}),Ef){var _f=!Mc||Ka((function(){var t=yf();return "[null]"!=Ef([t])||"{}"!=Ef({a:t})||"{}"!=Ef(Object(t))}));Tl({target:"JSON",stat:!0,forced:_f},{stringify:function(t,e,n){var r=_s(arguments),o=e;if((vc(e)||void 0!==t)&&!Hc(t))return Ml(e)||(e=function(t,e){if(Ja(o)&&(e=tc(o,this,t,e)),!Hc(e))return e}),r[1]=e,$a(Ef,null,r)}});}if(!bf[hf]){var qf=bf.valueOf;qs(bf,hf,(function(t){return tc(qf,this)}));}Js(yf,pf),hs[df]=!0,Gs("asyncIterator"),Gs("hasInstance"),Gs("isConcatSpreadable"),Gs("iterator"),Gs("match"),Gs("matchAll"),Gs("replace"),Gs("search"),Gs("species"),Gs("split"),Gs("toPrimitive"),Gs("toStringTag"),Gs("unscopables"),Js(Ba.JSON,"JSON",!0);var $f,Wf,Gf,Uf=gc.Symbol,Xf={},Yf=Function.prototype,Jf=Qa&&Object.getOwnPropertyDescriptor,Kf=Fc(Yf,"name"),Qf={EXISTS:Kf,PROPER:Kf&&"something"===function(){}.name,CONFIGURABLE:Kf&&(!Qa||Qa&&Jf(Yf,"name").configurable)},Zf=!Ka((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),td=Ss("IE_PROTO"),ed=Ba.Object,nd=ed.prototype,rd=Zf?ed.getPrototypeOf:function(t){var e=Bc(t);if(Fc(e,td))return e[td];var n=e.constructor;return Ja(n)&&e instanceof n?n.prototype:e instanceof ed?nd:null},od=Jc("iterator"),id=!1;[].keys&&("next"in(Gf=[].keys())?(Wf=rd(rd(Gf)))!==Object.prototype&&($f=Wf):id=!0);var ud=null==$f||Ka((function(){var t={};return $f[od].call(t)!==t}));$f=ud?{}:Ds($f),Ja($f[od])||qs($f,od,(function(){return this}));var ad={IteratorPrototype:$f,BUGGY_SAFARI_ITERATORS:id},cd=ad.IteratorPrototype,ld=function(){return this};Ba.String,Ba.TypeError;Object.setPrototypeOf||"__proto__"in{}&&function(){var t,e=!1,n={};try{(t=Ya(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),e=n instanceof Array;}catch(t){}}();var sd=Qf.PROPER,fd=ad.BUGGY_SAFARI_ITERATORS,dd=Jc("iterator"),pd="keys",hd="values",vd="entries",gd=function(){return this},md=function(t,e,n,r,o,i,u){!function(t,e,n,r){var o=e+" Iterator";t.prototype=Ds(cd,{next:ic(+!r,n)}),Js(t,o,!1,!0),Xf[o]=ld;}(n,e,r);var a,c,l,s=function(t){if(t===o&&v)return v;if(!fd&&t in p)return p[t];switch(t){case pd:case hd:case vd:return function(){return new n(this,t)}}return function(){return new n(this)}},f=e+" Iterator",d=!1,p=t.prototype,h=p[dd]||p["@@iterator"]||o&&p[o],v=!fd&&h||s(o),g="Array"==e&&p.entries||h;if(g&&(a=rd(g.call(new t)))!==Object.prototype&&a.next&&(Js(a,f,!0,!0),Xf[f]=gd),sd&&o==hd&&h&&h.name!==hd&&(d=!0,v=function(){return tc(h,this)}),o)if(c={values:s(hd),keys:i?v:s(pd),entries:s(vd)},u)for(l in c)(fd||d||!(l in p))&&qs(p,l,c[l]);else Tl({target:e,proto:!0,forced:fd||d},c);return u&&p[dd]!==v&&qs(p,dd,v,{name:o}),Xf[e]=v,c},yd="Array Iterator",bd=cf.set,xd=cf.getterFor(yd);md(Array,"Array",(function(t,e){bd(this,{type:yd,target:hc(t),index:0,kind:e});}),(function(){var t=xd(this),e=t.target,n=t.kind,r=t.index++;return !e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}}),"values"),Xf.Arguments=Xf.Array;var wd=Jc("toStringTag");for(var Ed in {CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var Sd=Ba[Ed],kd=Sd&&Sd.prototype;kd&&Vl(kd)!==wd&&El(kd,wd,Ed),Xf[Ed]=Xf.Array;}var Td=Uf;Gs("asyncDispose"),Gs("dispose"),Gs("matcher"),Gs("metadata"),Gs("observable"),Gs("patternMatch"),Gs("replaceAll");var Md=Td,Id=Ya("".charAt),Nd=Ya("".charCodeAt),Hd=Ya("".slice),Od=function(t){return function(e,n){var r,o,i=cs(pc(e)),u=Hl(n),a=i.length;return u<0||u>=a?t?"":void 0:(r=Nd(i,u))<55296||r>56319||u+1===a||(o=Nd(i,u+1))<56320||o>57343?t?Id(i,u):r:t?Hd(i,u,u+2):o-56320+(r-55296<<10)+65536}},jd={codeAt:Od(!1),charAt:Od(!0)}.charAt,Dd="String Iterator",Ld=cf.set,zd=cf.getterFor(Dd);md(String,"String",(function(t){Ld(this,{type:Dd,string:cs(t),index:0});}),(function(){var t,e=zd(this),n=e.string,r=e.index;return r>=n.length?{value:void 0,done:!0}:(t=jd(n,r),e.index+=t.length,{value:t,done:!1})}));var Ad=$s.f("iterator"),Pd=h((function(t){function e(n){return "function"==typeof Md&&"symbol"==typeof Ad?(t.exports=e=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=e=function(t){return t&&"function"==typeof Md&&t.constructor===Md&&t!==Md.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),e(n)}t.exports=e,t.exports.default=t.exports,t.exports.__esModule=!0;})),Cd=p(Pd),Vd=de.EXISTS,Bd=_t.f,Rd=Function.prototype,Fd=D(Rd.toString),_d=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,qd=D(_d.exec);x&&!Vd&&Bd(Rd,"name",{configurable:!0,get:function(){try{return qd(_d,Fd(this))[1]}catch(t){return ""}}});var $d=function(){function t(){this.tag="select",this.width=80;}return t.prototype.isActive=function(t){return !1},t.prototype.getValue=function(t){var e=this.mark,n=r.Editor.marks(t);return n&&n[e]?n[e]:""},t.prototype.isDisabled=function(t){return null==t.selection||(this.mark,!!xo(r.Editor.nodes(t,{match:function(n){return "pre"===e.DomEditor.getNodeType(n)||!!r.Editor.isVoid(t,n)},universal:!0}),1)[0])},t.prototype.exec=function(t,e){var n=this.mark;e?t.addMark(n,e):t.removeMark(n);},t}(),Wd=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.title=e.t("fontSize.title"),n.iconSvg=Jo,n.mark="fontSize",n}return vo(n,t),n.prototype.getOptions=function(t){var n=[],r=t.getMenuConfig(this.mark).fontSizeList,o=void 0===r?[]:r;n.push({text:e.t("fontSize.default"),value:""}),o.forEach((function(t){if("string"==typeof t)n.push({text:t,value:t});else if("object"===Cd(t)){var e=t.name,r=t.value;n.push({text:e,value:r});}}));var i=this.getValue(t);return n.forEach((function(t){t.value===i?t.selected=!0:delete t.selected;})),n},n}($d),Gd=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.title=e.t("fontFamily.title"),n.iconSvg=Ko,n.mark="fontFamily",n.selectPanelWidth=150,n}return vo(n,t),n.prototype.getOptions=function(t){var n=[],r=t.getMenuConfig(this.mark).fontFamilyList,o=void 0===r?[]:r;n.push({text:e.t("fontFamily.default"),value:""}),o.forEach((function(t){if("string"==typeof t)n.push({text:t,value:t,styleForRenderMenuList:{"font-family":t}});else if("object"===Cd(t)){var e=t.name,r=t.value;n.push({text:e,value:r,styleForRenderMenuList:{"font-family":r}});}}));var i=this.getValue(t);return n.forEach((function(t){t.value===i?t.selected=!0:delete t.selected;})),n},n}($d);var Ud={renderStyle:function(t,e){var n=t,r=n.fontSize,o=n.fontFamily,i=e;return r&&au(i,{fontSize:r}),o&&au(i,{fontFamily:o}),i},styleToHtml:function(t,e){if(!r.Text.isText(t))return e;var n,o=t,i=o.fontSize,u=o.fontFamily;return i||u?((lo(e)||"span"!==fo(n=c.default(e)))&&(n=c.default("<span>"+e+"</span>")),i&&n.css("font-size",i),u&&n.css("font-family",u),so(n)):e},preParseHtml:[za],parseStyleHtml:function(t,e,n){var o=c.default(t);if(!r.Text.isText(e))return e;var i=e,u=n.getMenuConfig("fontSize").fontSizeList,a=void 0===u?[]:u,l=po(o,"font-size"),s=a.find((function(t){return t.value&&t.value===l}))||a.includes(l);l&&s&&(i.fontSize=l);var f=n.getMenuConfig("fontFamily").fontFamilyList,d=void 0===f?[]:f,p=po(o,"font-family").replace(/"/g,""),h=d.find((function(t){return t.value&&t.value===p}))||d.includes(p);return p&&h&&(i.fontFamily=p),i},menus:[{key:"fontSize",factory:function(){return new Wd},config:{fontSizeList:["12px",{name:"13px",value:"13px"},"14px","15px","16px","19px",{name:"22px",value:"22px"},"24px","29px","32px","40px","48px"]}},{key:"fontFamily",factory:function(){return new Gd},config:{fontFamilyList:["黑体",{name:"仿宋",value:"仿宋"},"楷体","标楷体","华文仿宋","华文楷体",{name:"宋体",value:"宋体"},"微软雅黑","Arial","Tahoma","Verdana","Times New Roman","Courier New"]}}]};var Xd={selector:"p,h1,h2,h3,h4,h5",preParseHtml:function(t){var e=c.default(t),n=po(e,"padding-left");return /\dem/.test(n)&&e.css("text-indent","2em"),/\dpx/.test(n)&&parseInt(n,10)%32==0&&e.css("text-indent","2em"),e[0]}};var Yd=function(){function t(){this.tag="button";}return t.prototype.getValue=function(t){var e=xo(r.Editor.nodes(t,{match:function(t){return !!t.indent},universal:!0}),1),n=e[0];return null==n?"":xo(n,1)[0].indent||""},t.prototype.isActive=function(t){return !1},t.prototype.getMatchNode=function(t){var n=xo(r.Editor.nodes(t,{match:function(t){var n=e.DomEditor.getNodeType(t);return "paragraph"===n||!!n.startsWith("header")},universal:!0,mode:"highest"}),1)[0];return null==n?null:n[0]},t}(),Jd=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.title=e.t("indent.decrease"),n.iconSvg=Qo,n}return vo(n,t),n.prototype.isDisabled=function(t){var e=this.getMatchNode(t);return null==e||!e.indent},n.prototype.exec=function(t,e){r.Transforms.setNodes(t,{indent:null},{match:function(t){return r.Element.isElement(t)}});},n}(Yd),Kd=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.title=e.t("indent.increase"),n.iconSvg=Zo,n}return vo(n,t),n.prototype.isDisabled=function(t){var e=this.getMatchNode(t);return null==e||!!e.indent},n.prototype.exec=function(t,e){r.Transforms.setNodes(t,{indent:"2em"},{match:function(t){return r.Element.isElement(t)},mode:"highest"});},n}(Yd),Qd={renderStyle:function(t,e){if(!r.Element.isElement(t))return e;var n=t.indent,o=e;return n&&au(o,{textIndent:n}),o},styleToHtml:function(t,e){if(!r.Element.isElement(t))return e;var n=t.indent;if(!n)return e;var o=c.default(e);return o.css("text-indent",n),so(o)},preParseHtml:[Xd],parseStyleHtml:function(t,e,n){var o=c.default(t);if(!r.Element.isElement(e))return e;var i=e,u=po(o,"text-indent"),a=parseInt(u,10);return u&&a>0&&(i.indent=u),i},menus:[{key:"indent",factory:function(){return new Kd}},{key:"delIndent",factory:function(){return new Jd}}]};var Zd=function(){function t(){this.tag="button";}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.getMatchNode=function(t){var n=xo(r.Editor.nodes(t,{match:function(t){var n=e.DomEditor.getNodeType(t);return "paragraph"===n||("blockquote"===n||!!n.startsWith("header"))},universal:!0,mode:"highest"}),1)[0];return null==n?null:n[0]},t.prototype.isDisabled=function(t){return null==t.selection||!!e.DomEditor.getSelectedElems(t).some((function(e){if(r.Editor.isVoid(t,e)&&r.Editor.isBlock(t,e))return !0;var n=e.type;return !!["pre","code"].includes(n)||void 0}))},t}(),tp=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.title=e.t("justify.left"),n.iconSvg=ti,n}return vo(n,t),n.prototype.exec=function(t,e){r.Transforms.setNodes(t,{textAlign:"left"},{match:function(e){return r.Element.isElement(e)&&!t.isInline(e)}});},n}(Zd),ep=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.title=e.t("justify.right"),n.iconSvg=ei,n}return vo(n,t),n.prototype.exec=function(t,e){r.Transforms.setNodes(t,{textAlign:"right"},{match:function(e){return r.Element.isElement(e)&&!t.isInline(e)}});},n}(Zd),np=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.title=e.t("justify.center"),n.iconSvg=ni,n}return vo(n,t),n.prototype.exec=function(t,e){r.Transforms.setNodes(t,{textAlign:"center"},{match:function(e){return r.Element.isElement(e)&&!t.isInline(e)}});},n}(Zd),rp=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.title=e.t("justify.justify"),n.iconSvg=ri,n}return vo(n,t),n.prototype.exec=function(t,e){r.Transforms.setNodes(t,{textAlign:"justify"},{match:function(e){return r.Element.isElement(e)&&!t.isInline(e)}});},n}(Zd),op={renderStyle:function(t,e){if(!r.Element.isElement(t))return e;var n=t.textAlign,o=e;return n&&au(o,{textAlign:n}),o},styleToHtml:function(t,e){if(!r.Element.isElement(t))return e;var n=t.textAlign;if(!n)return e;var o=c.default(e);return o.css("text-align",n),so(o)},parseStyleHtml:function(t,e,n){var o=c.default(t);if(!r.Element.isElement(e))return e;var i=e,u=po(o,"text-align");return u&&(i.textAlign=u),i},menus:[{key:"justifyLeft",factory:function(){return new tp}},{key:"justifyRight",factory:function(){return new ep}},{key:"justifyCenter",factory:function(){return new np}},{key:"justifyJustify",factory:function(){return new rp}}]};var ip=function(){function t(){this.title=e.t("lineHeight.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M964 788a8 8 0 0 1 8 8v98a8 8 0 0 1-8 8H438a8 8 0 0 1-8-8v-98a8 8 0 0 1 8-8h526zM198.93 144.306c6.668-5.798 16.774-5.094 22.573 1.574l122.26 140.582a16 16 0 0 1 3.927 10.5c0 8.836-7.164 16-16 16h-61.8a8 8 0 0 0-8 8v390.077h69.819a16 16 0 0 1 10.502 3.928c6.666 5.8 7.37 15.906 1.57 22.573L221.476 878.123a16 16 0 0 1-1.57 1.57c-6.668 5.8-16.774 5.097-22.574-1.57L75.051 737.538a16 16 0 0 1-3.928-10.5c0-8.837 7.163-16 16-16h69.822V312.96H87.127a16 16 0 0 1-10.502-3.928c-6.666-5.8-7.37-15.906-1.57-22.573l122.303-140.582a16 16 0 0 1 1.572-1.572zM964 465a8 8 0 0 1 8 8v98a8 8 0 0 1-8 8H438a8 8 0 0 1-8-8v-98a8 8 0 0 1 8-8h526z m0-323a8 8 0 0 1 8 8v98a8 8 0 0 1-8 8H438a8 8 0 0 1-8-8v-98a8 8 0 0 1 8-8h526z"></path></svg>',this.tag="select",this.width=80;}return t.prototype.getOptions=function(t){var n=[],r=t.getMenuConfig("lineHeight").lineHeightList,o=void 0===r?[]:r;n.push({text:e.t("lineHeight.default"),value:""}),o.forEach((function(t){n.push({text:t,value:t});}));var i=this.getValue(t);return n.forEach((function(t){t.value===i?t.selected=!0:delete t.selected;})),n},t.prototype.getMatchNode=function(t){var n=xo(r.Editor.nodes(t,{match:function(t){var n=e.DomEditor.getNodeType(t);return !!n.startsWith("header")||!!["paragraph","blockquote","list-item"].includes(n)},universal:!0,mode:"highest"}),1)[0];return null==n?null:n[0]},t.prototype.isActive=function(t){return !1},t.prototype.getValue=function(t){var e=this.getMatchNode(t);return null==e?"":r.Element.isElement(e)&&e.lineHeight||""},t.prototype.isDisabled=function(t){return null==t.selection||null==this.getMatchNode(t)},t.prototype.exec=function(t,e){r.Transforms.setNodes(t,{lineHeight:e.toString()},{mode:"highest"});},t}();var up={renderStyle:function(t,e){if(!r.Element.isElement(t))return e;var n=t.lineHeight,o=e;return n&&au(o,{lineHeight:n}),o},styleToHtml:function(t,e){if(!r.Element.isElement(t))return e;var n=t.lineHeight;if(!n)return e;var o=c.default(e);return o.css("line-height",n),so(o)},parseStyleHtml:function(t,e,n){var o=c.default(t);if(!r.Element.isElement(e))return e;var i=e,u=n.getMenuConfig("lineHeight").lineHeightList,a=void 0===u?[]:u,l=po(o,"line-height");return l&&a.includes(l)&&(i.lineHeight=l),i},menus:[{key:"lineHeight",factory:function(){return new ip},config:{lineHeightList:["1","1.15","1.5","2","2.5","3"]}}]},ap=function(){function t(){this.title=e.t("undo.redo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0.00032 576a510.72 510.72 0 0 0 173.344 384l84.672-96A383.136 383.136 0 0 1 128.00032 576C128.00032 363.936 299.93632 192 512.00032 192c106.048 0 202.048 42.976 271.52 112.48L640.00032 448h384V64l-149.984 149.984A510.272 510.272 0 0 0 512.00032 64C229.21632 64 0.00032 293.216 0.00032 576z"></path></svg>',this.tag="button";}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.isDisabled=function(t){return null==t.selection},t.prototype.exec=function(t,e){"function"==typeof t.redo&&t.redo();},t}(),cp=function(){function t(){this.title=e.t("undo.undo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M512 64A510.272 510.272 0 0 0 149.984 213.984L0.032 64v384h384L240.512 304.48A382.784 382.784 0 0 1 512.032 192c212.064 0 384 171.936 384 384 0 114.688-50.304 217.632-130.016 288l84.672 96a510.72 510.72 0 0 0 173.344-384c0-282.784-229.216-512-512-512z"></path></svg>',this.tag="button";}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.isDisabled=function(t){return null==t.selection},t.prototype.exec=function(t,e){"function"==typeof t.undo&&t.undo();},t}(),lp={menus:[{key:"redo",factory:function(){return new ap}},{key:"undo",factory:function(){return new cp}}]};var sp={type:"divider",renderElem:function(t,r,o){var i=e.DomEditor.isNodeSelected(o,t);return n.h("div",{props:{contentEditable:!1,className:"w-e-textarea-divider"},dataset:{selected:i?"true":""},style:{},on:{mousedown:function(t){return t.preventDefault()}}},[n.h("hr")])}};var fp={type:"divider",elemToHtml:function(t,e){return "<hr/>"}};var dp={selector:"hr:not([data-w-e-type])",parseElemHtml:function(t,e,n){return {type:"divider",children:[{text:""}]}}},pp=function(){function t(){this.title=e.t("divider.title"),this.iconSvg='<svg viewBox="0 0 1092 1024"><path d="M0 51.2m51.2 0l989.866667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-989.866667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M0 460.8m51.2 0l170.666667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-170.666667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M819.2 460.8m51.2 0l170.666667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-170.666667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M409.6 460.8m51.2 0l170.666667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-170.666667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path><path d="M0 870.4m51.2 0l989.866667 0q51.2 0 51.2 51.2l0 0q0 51.2-51.2 51.2l-989.866667 0q-51.2 0-51.2-51.2l0 0q0-51.2 51.2-51.2Z"></path></svg>',this.tag="button";}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.isDisabled=function(t){return null==t.selection||!!e.DomEditor.getSelectedElems(t).some((function(n){if(t.isVoid(n))return !0;var r=e.DomEditor.getNodeType(n);return "table"===r||("pre"===r||void 0)}))},t.prototype.exec=function(t,e){r.Transforms.insertNodes(t,{type:"divider",children:[{text:""}]},{mode:"highest"});},t}(),hp={renderElems:[sp],elemsToHtml:[fp],parseElemsHtml:[dp],menus:[{key:"divider",factory:function(){return new pp}}],editorPlugin:function(t){var n=t.isVoid,o=t.normalizeNode,i=t;return i.isVoid=function(t){return "divider"===t.type||n(t)},i.normalizeNode=function(t){var n=xo(t,2),u=n[0],a=n[1];if("divider"!==e.DomEditor.getNodeType(u))return o([u,a]);e.DomEditor.isLastNode(i,u)&&r.Transforms.insertNodes(i,e.DomEditor.genEmptyParagraph(),{at:[a[0]+1]});},i}},vp=dn.map;qe({target:"Array",proto:!0,forced:!hn("map")},{map:function(t){return vp(this,t,arguments.length>1?arguments[1]:void 0)}});var gp=D([].join),mp=V!=Object,yp=Lo("join",",");qe({target:"Array",proto:!0,forced:mp||!yp},{join:function(t){return gp(F(this),void 0===t?",":t)}});var bp=function(){function t(){this.title=e.t("codeBlock.title"),this.iconSvg='<svg viewBox="0 0 1280 1024"><path d="M832 736l96 96 320-320L928 192l-96 96 224 224zM448 288l-96-96L32 512l320 320 96-96-224-224zM701.312 150.528l69.472 18.944-192 704.032-69.472-18.944 192-704.032z"></path></svg>',this.tag="button";}return t.prototype.getSelectCodeElem=function(t){var n=e.DomEditor.getSelectedNodeByType(t,"code");if(null==n)return null;var r=e.DomEditor.getParentNode(t,n);return null==r||"pre"!==e.DomEditor.getNodeType(r)?null:n},t.prototype.getValue=function(t){var e=this.getSelectCodeElem(t);return null==e?"":e.language||""},t.prototype.isActive=function(t){return !!this.getSelectCodeElem(t)},t.prototype.isDisabled=function(t){if(null==t.selection)return !0;var n=e.DomEditor.getSelectedElems(t);return !!n.some((function(e){return t.isVoid(e)}))||!n.some((function(t){var n=e.DomEditor.getNodeType(t);if("pre"===n||"paragraph"===n)return !0}))},t.prototype.exec=function(t,e){this.isActive(t)?this.changeToPlainText(t):this.changeToCodeBlock(t,e.toString());},t.prototype.changeToPlainText=function(t){var e=this.getSelectCodeElem(t);if(null!=e){var n=r.Node.string(e);r.Transforms.removeNodes(t,{mode:"highest"});var o=n.split("\n").map((function(t){return {type:"paragraph",children:[{text:t}]}}));r.Transforms.insertNodes(t,o,{mode:"highest"});}},t.prototype.changeToCodeBlock=function(t,e){var n,o,i=[],u=r.Editor.nodes(t,{match:function(e){return t.children.includes(e)},universal:!0});try{for(var a=bo(u),c=a.next();!c.done;c=a.next()){var l=xo(c.value,1)[0];l&&i.push(r.Node.string(l));}}catch(t){n={error:t};}finally{try{c&&!c.done&&(o=a.return)&&o.call(a);}finally{if(n)throw n.error}}r.Transforms.removeNodes(t,{mode:"highest"});var s={type:"pre",children:[{type:"code",language:e,children:[{text:i.join("\n")}]}]};r.Transforms.insertNodes(t,s,{mode:"highest"});},t}(),xp={key:"codeBlock",factory:function(){return new bp}};qe({target:"String",proto:!0,forced:Mo("anchor")},{anchor:function(t){return To(this,"a","name",t)}}),ir("match",(function(t,e,n){return [function(e){var n=R(this),r=null==e?void 0:at(e,t);return r?E(r,e,n):new RegExp(e)[t](bn(n))},function(t){var r=Bt(this),o=bn(t),i=n(e,r,o);if(i.done)return i.value;if(!r.global)return xr(r,o);var u=r.unicode;r.lastIndex=0;for(var a,c=[],l=0;null!==(a=xr(r,o));){var s=bn(a[0]);c[l]=s,""===s&&(r.lastIndex=fr(o,we(r.lastIndex),u)),l++;}return 0===l?null:c}]}));var wp={menus:[xp],editorPlugin:function(t){var n=t.insertBreak,o=t.normalizeNode,i=t.insertData;t.insertNode;var u=t;return u.insertBreak=function(){var t=e.DomEditor.getSelectedNodeByType(u,"code");if(null!=t){var o=function(t,e){var n=e.selection;if(null==n)return "";var o=r.Node.string(t),i=n.anchor.offset,u=o.slice(0,i).split("\n"),a=u.length;return 0===a?"":u[a-1]}(t,u);if(o){var i=o.match(/^\s+/);if(null!=i&&null!=i[0]){var a=i[0];return void u.insertText("\n"+a)}}u.insertText("\n");}else n();},u.normalizeNode=function(t){var n=xo(t,2),i=n[0],a=n[1],c=e.DomEditor.getNodeType(i);("code"===c&&a.length<=1&&r.Transforms.setNodes(u,{type:"paragraph"},{at:a}),"pre"===c)&&(e.DomEditor.isLastNode(u,i)&&r.Transforms.insertNodes(u,e.DomEditor.genEmptyParagraph(),{at:[a[0]+1]}),"code"!==e.DomEditor.getNodeType(i.children[0])&&(r.Transforms.unwrapNodes(u),r.Transforms.setNodes(u,{type:"paragraph"},{mode:"highest"})));return o([i,a])},u.insertData=function(t){if(null!=e.DomEditor.getSelectedNodeByType(u,"code")){var n=t.getData("text/plain");r.Editor.insertText(u,n);}else i(t);},u},renderElems:[{type:"pre",renderElem:function(t,e,r){return n.jsx("pre",null,e)}},{type:"code",renderElem:function(t,e,r){return n.jsx("code",null,e)}}],elemsToHtml:[{type:"code",elemToHtml:function(t,e){return "<code>"+e+"</code>"}},{type:"pre",elemToHtml:function(t,e){return "<pre>"+e+"</pre>"}}],preParseHtml:[{selector:"pre>code",preParseHtml:function(t){var e=c.default(t);if("code"!==fo(e))return t;var n=e.find("xmp");if(0===n.length)return t;var r=n.text();return n.remove(),e.text(r),e[0]}}],parseElemsHtml:[{selector:"pre:not([data-w-e-type])>code",parseElemHtml:function(t,e,n){return {type:"code",language:"",children:[{text:c.default(t)[0].textContent||""}]}}},{selector:"pre:not([data-w-e-type])",parseElemHtml:function(t,n,r){var o=c.default(t);return 0===(n=n.filter((function(t){return "code"===e.DomEditor.getNodeType(t)}))).length&&(n=[{type:"code",language:"",children:[{text:o[0].textContent||""}]}]),{type:"pre",children:n.filter((function(t){return "code"===e.DomEditor.getNodeType(t)}))}}}]},Ep=function(){function t(){this.title=e.t("fullScreen.title"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M133.705143 335.433143V133.851429h201.581714a29.622857 29.622857 0 0 0 29.622857-29.549715V68.754286a29.622857 29.622857 0 0 0-29.622857-29.622857H61.732571A22.893714 22.893714 0 0 0 38.765714 62.025143V335.725714c0 16.310857 13.238857 29.622857 29.622857 29.622857h35.547429a29.842286 29.842286 0 0 0 29.696-29.842285zM690.980571 133.851429h201.581715v201.654857c0 16.310857 13.238857 29.549714 29.622857 29.549714h35.547428a29.622857 29.622857 0 0 0 29.549715-29.549714V61.952a22.893714 22.893714 0 0 0-22.820572-22.893714h-273.554285a29.622857 29.622857 0 0 0-29.549715 29.622857v35.547428c0 16.310857 13.238857 29.696 29.622857 29.696zM335.286857 892.781714H133.705143V691.2a29.622857 29.622857 0 0 0-29.622857-29.622857H68.534857a29.622857 29.622857 0 0 0-29.549714 29.622857v273.554286c0 12.653714 10.24 22.893714 22.820571 22.893714h273.554286a29.622857 29.622857 0 0 0 29.696-29.622857v-35.547429a29.769143 29.769143 0 0 0-29.769143-29.696z m557.348572-201.581714v201.581714H690.907429a29.622857 29.622857 0 0 0-29.622858 29.622857v35.547429c0 16.310857 13.238857 29.622857 29.622858 29.622857h273.554285c12.580571 0 22.893714-10.313143 22.893715-22.893714V691.2a29.622857 29.622857 0 0 0-29.622858-29.622857h-35.547428a29.622857 29.622857 0 0 0-29.696 29.622857z"></path></svg>',this.tag="button",this.alwaysEnable=!0;}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return t.isFullScreen},t.prototype.isDisabled=function(t){return !1},t.prototype.exec=function(t,e){t.isFullScreen?t.unFullScreen():t.fullScreen();},t}(),Sp={menus:[{key:"fullScreen",factory:function(){return new Ep}}]},kp=function(){function t(){this.title=e.t("common.enter"),this.iconSvg='<svg viewBox="0 0 1255 1024"><path d="M1095.111111 731.477333h-625.777778V1024L0 658.318222 469.333333 292.408889v292.636444h625.777778V0h156.444445v731.477333z"></path></svg>',this.tag="button";}return t.prototype.getValue=function(t){return ""},t.prototype.isActive=function(t){return !1},t.prototype.isDisabled=function(t){var e=t.selection;return null==e||!!r.Range.isExpanded(e)},t.prototype.exec=function(t,e){var n=t.selection;if(null!=n){var o=[n.anchor.path[0]];r.Transforms.insertNodes(t,{type:"paragraph",children:[{text:""}]},{at:o}),t.select(r.Editor.start(t,o));}},t}(),Tp=[hi,pu,Ud,Qd,op,up,ga,hp,Da,Pu,wp,Oa,nu,Eo,ba,lp,Sp,{menus:[{key:"enter",factory:function(){return new kp}}]}];t.default=Tp,t.insertImageNode=na,t.isInsertImageMenuDisabled=oa,t.updateImageNode=ra,Object.defineProperty(t,"__esModule",{value:!0});}));
  18528. });
  18529. var basicModules = /*@__PURE__*/getDefaultExportFromCjs(dist$5);
  18530. var dist$4 = createCommonjsModule$1(function (module, exports) {
  18531. !function(t,e){module.exports=e(dist$6,require$$2$1,require$$2,require$$1);}(commonjsGlobal,(function(t,e,r,n){function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=o(n);t.i18nAddResources("en",{listModule:{unOrderedList:"Unordered list",orderedList:"Ordered list"}}),t.i18nAddResources("zh-CN",{listModule:{unOrderedList:"无序列表",orderedList:"有序列表"}});var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{};function a(t){var e={exports:{}};return t(e,e.exports),e.exports}var c,f,l=function(t){return t&&t.Math==Math&&t},s=l("object"==typeof globalThis&&globalThis)||l("object"==typeof window&&window)||l("object"==typeof self&&self)||l("object"==typeof u&&u)||function(){return this}()||Function("return this")(),d=Function.prototype,v=d.bind,p=d.call,y=v&&v.bind(p),h=v?function(t){return t&&y(p,t)}:function(t){return t&&function(){return p.apply(t,arguments)}},g=function(t){try{return !!t()}catch(t){return !0}},b=h({}.toString),m=h("".slice),w=function(t){return m(b(t),8,-1)},x=s.Object,S=h("".split),O=g((function(){return !x("z").propertyIsEnumerable(0)}))?function(t){return "String"==w(t)?S(t,""):x(t)}:x,E=s.TypeError,T=function(t){if(null==t)throw E("Can't call method on "+t);return t},j=function(t){return O(T(t))},A=Object.defineProperty,I=function(t,e){try{A(s,t,{value:e,configurable:!0,writable:!0});}catch(r){s[t]=e;}return e},P="__core-js_shared__",R=s[P]||I(P,{}),L=a((function(t){(t.exports=function(t,e){return R[t]||(R[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});})),k=s.Object,M=function(t){return k(T(t))},N=h({}.hasOwnProperty),_=Object.hasOwn||function(t,e){return N(M(t),e)},z=0,D=Math.random(),C=h(1..toString),F=function(t){return "Symbol("+(void 0===t?"":t)+")_"+C(++z+D,36)},H=function(t){return "function"==typeof t},B=function(t){return H(t)?t:void 0},G=function(t,e){return arguments.length<2?B(s[t]):s[t]&&s[t][e]},$=G("navigator","userAgent")||"",V=s.process,W=s.Deno,U=V&&V.versions||W&&W.version,q=U&&U.v8;q&&(f=(c=q.split("."))[0]>0&&c[0]<4?1:+(c[0]+c[1])),!f&&$&&(!(c=$.match(/Edge\/(\d+)/))||c[1]>=74)&&(c=$.match(/Chrome\/(\d+)/))&&(f=+c[1]);var K,Y=f,X=!!Object.getOwnPropertySymbols&&!g((function(){var t=Symbol();return !String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Y&&Y<41})),J=X&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Q=L("wks"),Z=s.Symbol,tt=Z&&Z.for,et=J?Z:Z&&Z.withoutSetter||F,rt=function(t){if(!_(Q,t)||!X&&"string"!=typeof Q[t]){var e="Symbol."+t;X&&_(Z,t)?Q[t]=Z[t]:Q[t]=J&&tt?tt(e):et(e);}return Q[t]},nt=function(t){return "object"==typeof t?null!==t:H(t)},ot=s.String,it=s.TypeError,ut=function(t){if(nt(t))return t;throw it(ot(t)+" is not an object")},at=!g((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),ct=s.document,ft=nt(ct)&&nt(ct.createElement),lt=function(t){return ft?ct.createElement(t):{}},st=!at&&!g((function(){return 7!=Object.defineProperty(lt("div"),"a",{get:function(){return 7}}).a})),dt=Function.prototype.call,vt=dt.bind?dt.bind(dt):function(){return dt.apply(dt,arguments)},pt=h({}.isPrototypeOf),yt=s.Object,ht=J?function(t){return "symbol"==typeof t}:function(t){var e=G("Symbol");return H(e)&&pt(e.prototype,yt(t))},gt=s.String,bt=function(t){try{return gt(t)}catch(t){return "Object"}},mt=s.TypeError,wt=function(t){if(H(t))return t;throw mt(bt(t)+" is not a function")},xt=function(t,e){var r=t[e];return null==r?void 0:wt(r)},St=s.TypeError,Ot=s.TypeError,Et=rt("toPrimitive"),Tt=function(t,e){if(!nt(t)||ht(t))return t;var r,n=xt(t,Et);if(n){if(void 0===e&&(e="default"),r=vt(n,t,e),!nt(r)||ht(r))return r;throw Ot("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var r,n;if("string"===e&&H(r=t.toString)&&!nt(n=vt(r,t)))return n;if(H(r=t.valueOf)&&!nt(n=vt(r,t)))return n;if("string"!==e&&H(r=t.toString)&&!nt(n=vt(r,t)))return n;throw St("Can't convert object to primitive value")}(t,e)},jt=function(t){var e=Tt(t,"string");return ht(e)?e:e+""},At=s.TypeError,It=Object.defineProperty,Pt={f:at?It:function(t,e,r){if(ut(t),e=jt(e),ut(r),st)try{return It(t,e,r)}catch(t){}if("get"in r||"set"in r)throw At("Accessors not supported");return "value"in r&&(t[e]=r.value),t}},Rt=Math.ceil,Lt=Math.floor,kt=function(t){var e=+t;return e!=e||0===e?0:(e>0?Lt:Rt)(e)},Mt=Math.max,Nt=Math.min,_t=function(t,e){var r=kt(t);return r<0?Mt(r+e,0):Nt(r,e)},zt=Math.min,Dt=function(t){return t>0?zt(kt(t),9007199254740991):0},Ct=function(t){return Dt(t.length)},Ft=function(t){return function(e,r,n){var o,i=j(e),u=Ct(i),a=_t(n,u);if(t&&r!=r){for(;u>a;)if((o=i[a++])!=o)return !0}else for(;u>a;a++)if((t||a in i)&&i[a]===r)return t||a||0;return !t&&-1}},Ht={includes:Ft(!0),indexOf:Ft(!1)},Bt={},Gt=Ht.indexOf,$t=h([].push),Vt=function(t,e){var r,n=j(t),o=0,i=[];for(r in n)!_(Bt,r)&&_(n,r)&&$t(i,r);for(;e.length>o;)_(n,r=e[o++])&&(~Gt(i,r)||$t(i,r));return i},Wt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ut=Object.keys||function(t){return Vt(t,Wt)},qt=at?Object.defineProperties:function(t,e){ut(t);for(var r,n=j(e),o=Ut(e),i=o.length,u=0;i>u;)Pt.f(t,r=o[u++],n[r]);return t},Kt=G("document","documentElement"),Yt=L("keys"),Xt=function(t){return Yt[t]||(Yt[t]=F(t))},Jt=Xt("IE_PROTO"),Qt=function(){},Zt=function(t){return "<script>"+t+"</"+"script>"},te=function(t){t.write(Zt("")),t.close();var e=t.parentWindow.Object;return t=null,e},ee=function(){try{K=new ActiveXObject("htmlfile");}catch(t){}var t,e;ee="undefined"!=typeof document?document.domain&&K?te(K):((e=lt("iframe")).style.display="none",Kt.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(Zt("document.F=Object")),t.close(),t.F):te(K);for(var r=Wt.length;r--;)delete ee.prototype[Wt[r]];return ee()};Bt[Jt]=!0;var re=Object.create||function(t,e){var r;return null!==t?(Qt.prototype=ut(t),r=new Qt,Qt.prototype=null,r[Jt]=t):r=ee(),void 0===e?r:qt(r,e)},ne=rt("unscopables"),oe=Array.prototype;null==oe[ne]&&Pt.f(oe,ne,{configurable:!0,value:re(null)});var ie=function(t){oe[ne][t]=!0;},ue={},ae=h(Function.toString);H(R.inspectSource)||(R.inspectSource=function(t){return ae(t)});var ce,fe,le,se=R.inspectSource,de=s.WeakMap,ve=H(de)&&/native code/.test(se(de)),pe=function(t,e){return {enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},ye=at?function(t,e,r){return Pt.f(t,e,pe(1,r))}:function(t,e,r){return t[e]=r,t},he="Object already initialized",ge=s.TypeError,be=s.WeakMap;if(ve||R.state){var me=R.state||(R.state=new be),we=h(me.get),xe=h(me.has),Se=h(me.set);ce=function(t,e){if(xe(me,t))throw new ge(he);return e.facade=t,Se(me,t,e),e},fe=function(t){return we(me,t)||{}},le=function(t){return xe(me,t)};}else {var Oe=Xt("state");Bt[Oe]=!0,ce=function(t,e){if(_(t,Oe))throw new ge(he);return e.facade=t,ye(t,Oe,e),e},fe=function(t){return _(t,Oe)?t[Oe]:{}},le=function(t){return _(t,Oe)};}var Ee,Te,je,Ae={set:ce,get:fe,has:le,enforce:function(t){return le(t)?fe(t):ce(t,{})},getterFor:function(t){return function(e){var r;if(!nt(e)||(r=fe(e)).type!==t)throw ge("Incompatible receiver, "+t+" required");return r}}},Ie={}.propertyIsEnumerable,Pe=Object.getOwnPropertyDescriptor,Re={f:Pe&&!Ie.call({1:2},1)?function(t){var e=Pe(this,t);return !!e&&e.enumerable}:Ie},Le=Object.getOwnPropertyDescriptor,ke={f:at?Le:function(t,e){if(t=j(t),e=jt(e),st)try{return Le(t,e)}catch(t){}if(_(t,e))return pe(!vt(Re.f,t,e),t[e])}},Me=Function.prototype,Ne=at&&Object.getOwnPropertyDescriptor,_e=_(Me,"name"),ze={EXISTS:_e,PROPER:_e&&"something"===function(){}.name,CONFIGURABLE:_e&&(!at||at&&Ne(Me,"name").configurable)},De=a((function(t){var e=ze.CONFIGURABLE,r=Ae.get,n=Ae.enforce,o=String(String).split("String");(t.exports=function(t,r,i,u){var a,c=!!u&&!!u.unsafe,f=!!u&&!!u.enumerable,l=!!u&&!!u.noTargetGet,d=u&&void 0!==u.name?u.name:r;H(i)&&("Symbol("===String(d).slice(0,7)&&(d="["+String(d).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!_(i,"name")||e&&i.name!==d)&&ye(i,"name",d),(a=n(i)).source||(a.source=o.join("string"==typeof d?d:""))),t!==s?(c?!l&&t[r]&&(f=!0):delete t[r],f?t[r]=i:ye(t,r,i)):f?t[r]=i:I(r,i);})(Function.prototype,"toString",(function(){return H(this)&&r(this).source||se(this)}));})),Ce=Wt.concat("length","prototype"),Fe={f:Object.getOwnPropertyNames||function(t){return Vt(t,Ce)}},He={f:Object.getOwnPropertySymbols},Be=h([].concat),Ge=G("Reflect","ownKeys")||function(t){var e=Fe.f(ut(t)),r=He.f;return r?Be(e,r(t)):e},$e=function(t,e){for(var r=Ge(e),n=Pt.f,o=ke.f,i=0;i<r.length;i++){var u=r[i];_(t,u)||n(t,u,o(e,u));}},Ve=/#|\.prototype\./,We=function(t,e){var r=qe[Ue(t)];return r==Ye||r!=Ke&&(H(e)?g(e):!!e)},Ue=We.normalize=function(t){return String(t).replace(Ve,".").toLowerCase()},qe=We.data={},Ke=We.NATIVE="N",Ye=We.POLYFILL="P",Xe=We,Je=ke.f,Qe=function(t,e){var r,n,o,i,u,a=t.target,c=t.global,f=t.stat;if(r=c?s:f?s[a]||I(a,{}):(s[a]||{}).prototype)for(n in e){if(i=e[n],o=t.noTargetGet?(u=Je(r,n))&&u.value:r[n],!Xe(c?n:a+(f?".":"#")+n,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;$e(i,o);}(t.sham||o&&o.sham)&&ye(i,"sham",!0),De(r,n,i,t);}},Ze=!g((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),tr=Xt("IE_PROTO"),er=s.Object,rr=er.prototype,nr=Ze?er.getPrototypeOf:function(t){var e=M(t);if(_(e,tr))return e[tr];var r=e.constructor;return H(r)&&e instanceof r?r.prototype:e instanceof er?rr:null},or=rt("iterator"),ir=!1;[].keys&&("next"in(je=[].keys())?(Te=nr(nr(je)))!==Object.prototype&&(Ee=Te):ir=!0);var ur=null==Ee||g((function(){var t={};return Ee[or].call(t)!==t}));ur&&(Ee={}),H(Ee[or])||De(Ee,or,(function(){return this}));var ar={IteratorPrototype:Ee,BUGGY_SAFARI_ITERATORS:ir},cr=Pt.f,fr=rt("toStringTag"),lr=function(t,e,r){t&&!_(t=r?t:t.prototype,fr)&&cr(t,fr,{configurable:!0,value:e});},sr=ar.IteratorPrototype,dr=function(){return this},vr=s.String,pr=s.TypeError,yr=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{(t=h(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),e=r instanceof Array;}catch(t){}return function(r,n){return ut(r),function(t){if("object"==typeof t||H(t))return t;throw pr("Can't set "+vr(t)+" as a prototype")}(n),e?t(r,n):r.__proto__=n,r}}():void 0),hr=ze.PROPER,gr=ze.CONFIGURABLE,br=ar.IteratorPrototype,mr=ar.BUGGY_SAFARI_ITERATORS,wr=rt("iterator"),xr="keys",Sr="values",Or="entries",Er=function(){return this},Tr=function(t,e,r,n,o,i,u){!function(t,e,r,n){var o=e+" Iterator";t.prototype=re(sr,{next:pe(+!n,r)}),lr(t,o,!1),ue[o]=dr;}(r,e,n);var a,c,f,l=function(t){if(t===o&&y)return y;if(!mr&&t in v)return v[t];switch(t){case xr:case Sr:case Or:return function(){return new r(this,t)}}return function(){return new r(this)}},s=e+" Iterator",d=!1,v=t.prototype,p=v[wr]||v["@@iterator"]||o&&v[o],y=!mr&&p||l(o),h="Array"==e&&v.entries||p;if(h&&(a=nr(h.call(new t)))!==Object.prototype&&a.next&&(nr(a)!==br&&(yr?yr(a,br):H(a[wr])||De(a,wr,Er)),lr(a,s,!0)),hr&&o==Sr&&p&&p.name!==Sr&&(gr?ye(v,"name",Sr):(d=!0,y=function(){return vt(p,this)})),o)if(c={values:l(Sr),keys:i?y:l(xr),entries:l(Or)},u)for(f in c)(mr||d||!(f in v))&&De(v,f,c[f]);else Qe({target:e,proto:!0,forced:mr||d},c);return v[wr]!==y&&De(v,wr,y,{name:o}),ue[e]=y,c},jr="Array Iterator",Ar=Ae.set,Ir=Ae.getterFor(jr),Pr=Tr(Array,"Array",(function(t,e){Ar(this,{type:jr,target:j(t),index:0,kind:e});}),(function(){var t=Ir(this),e=t.target,r=t.kind,n=t.index++;return !e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values");ue.Arguments=ue.Array,ie("keys"),ie("values"),ie("entries");var Rr={};Rr[rt("toStringTag")]="z";var Lr="[object z]"===String(Rr),kr=rt("toStringTag"),Mr=s.Object,Nr="Arguments"==w(function(){return arguments}()),_r=Lr?w:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Mr(t),kr))?r:Nr?w(e):"Object"==(n=w(e))&&H(e.callee)?"Arguments":n},zr=Lr?{}.toString:function(){return "[object "+_r(this)+"]"};Lr||De(Object.prototype,"toString",zr,{unsafe:!0});var Dr=s.String,Cr=function(t){if("Symbol"===_r(t))throw TypeError("Cannot convert a Symbol value to a string");return Dr(t)},Fr=h("".charAt),Hr=h("".charCodeAt),Br=h("".slice),Gr=function(t){return function(e,r){var n,o,i=Cr(T(e)),u=kt(r),a=i.length;return u<0||u>=a?t?"":void 0:(n=Hr(i,u))<55296||n>56319||u+1===a||(o=Hr(i,u+1))<56320||o>57343?t?Fr(i,u):n:t?Br(i,u,u+2):o-56320+(n-55296<<10)+65536}},$r={codeAt:Gr(!1),charAt:Gr(!0)},Vr=$r.charAt,Wr="String Iterator",Ur=Ae.set,qr=Ae.getterFor(Wr);Tr(String,"String",(function(t){Ur(this,{type:Wr,string:Cr(t),index:0});}),(function(){var t,e=qr(this),r=e.string,n=e.index;return n>=r.length?{value:void 0,done:!0}:(t=Vr(r,n),e.index+=t.length,{value:t,done:!1})}));var Kr=function(t,e,r){for(var n in e)De(t,n,e[n],r);return t},Yr=s.Array,Xr=Math.max,Jr=Fe.f,Qr="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Zr=function(t){try{return Jr(t)}catch(t){return function(t,e,r){for(var n,o,i,u,a=Ct(t),c=_t(e,a),f=_t(void 0===r?a:r,a),l=Yr(Xr(f-c,0)),s=0;c<f;c++,s++)n=l,o=s,i=t[c],u=void 0,(u=jt(o))in n?Pt.f(n,u,pe(0,i)):n[u]=i;return l.length=s,l}(Qr)}},tn={f:function(t){return Qr&&"Window"==w(t)?Zr(t):Jr(j(t))}},en=g((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8});}})),rn=Object.isExtensible,nn=g((function(){rn(1);}))||en?function(t){return !!nt(t)&&((!en||"ArrayBuffer"!=w(t))&&(!rn||rn(t)))}:rn,on=!g((function(){return Object.isExtensible(Object.preventExtensions({}))})),un=a((function(t){var e=Pt.f,r=!1,n=F("meta"),o=0,i=function(t){e(t,n,{value:{objectID:"O"+o++,weakData:{}}});},u=t.exports={enable:function(){u.enable=function(){},r=!0;var t=Fe.f,e=h([].splice),o={};o[n]=1,t(o).length&&(Fe.f=function(r){for(var o=t(r),i=0,u=o.length;i<u;i++)if(o[i]===n){e(o,i,1);break}return o},Qe({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:tn.f}));},fastKey:function(t,e){if(!nt(t))return "symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!_(t,n)){if(!nn(t))return "F";if(!e)return "E";i(t);}return t[n].objectID},getWeakData:function(t,e){if(!_(t,n)){if(!nn(t))return !0;if(!e)return !1;i(t);}return t[n].weakData},onFreeze:function(t){return on&&r&&nn(t)&&!_(t,n)&&i(t),t}};Bt[n]=!0;})),an=h(h.bind),cn=function(t,e){return wt(t),void 0===e?t:an?an(t,e):function(){return t.apply(e,arguments)}},fn=rt("iterator"),ln=Array.prototype,sn=rt("iterator"),dn=function(t){if(null!=t)return xt(t,sn)||xt(t,"@@iterator")||ue[_r(t)]},vn=s.TypeError,pn=function(t,e,r){var n,o;ut(t);try{if(!(n=xt(t,"return"))){if("throw"===e)throw r;return r}n=vt(n,t);}catch(t){o=!0,n=t;}if("throw"===e)throw r;if(o)throw n;return ut(n),r},yn=s.TypeError,hn=function(t,e){this.stopped=t,this.result=e;},gn=hn.prototype,bn=function(t,e,r){var n,o,i,u,a,c,f,l,s=r&&r.that,d=!(!r||!r.AS_ENTRIES),v=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),y=cn(e,s),h=function(t){return n&&pn(n,"normal",t),new hn(!0,t)},g=function(t){return d?(ut(t),p?y(t[0],t[1],h):y(t[0],t[1])):p?y(t,h):y(t)};if(v)n=t;else {if(!(o=dn(t)))throw yn(bt(t)+" is not iterable");if(void 0!==(l=o)&&(ue.Array===l||ln[fn]===l)){for(i=0,u=Ct(t);u>i;i++)if((a=g(t[i]))&&pt(gn,a))return a;return new hn(!1)}n=function(t,e){var r=arguments.length<2?dn(t):e;if(wt(r))return ut(vt(r,t));throw vn(bt(t)+" is not iterable")}(t,o);}for(c=n.next;!(f=vt(c,n)).done;){try{a=g(f.value);}catch(t){pn(n,"throw",t);}if("object"==typeof a&&a&&pt(gn,a))return a}return new hn(!1)},mn=s.TypeError,wn=function(t,e){if(pt(e,t))return t;throw mn("Incorrect invocation")},xn=rt("iterator"),Sn=!1;try{var On=0,En={next:function(){return {done:!!On++}},return:function(){Sn=!0;}};En[xn]=function(){return this},Array.from(En,(function(){throw 2}));}catch(t){}var Tn=Array.isArray||function(t){return "Array"==w(t)},jn=function(){},An=[],In=G("Reflect","construct"),Pn=/^\s*(?:class|function)\b/,Rn=h(Pn.exec),Ln=!Pn.exec(jn),kn=function(t){if(!H(t))return !1;try{return In(jn,An,t),!0}catch(t){return !1}},Mn=!In||g((function(){var t;return kn(kn.call)||!kn(Object)||!kn((function(){t=!0;}))||t}))?function(t){if(!H(t))return !1;switch(_r(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return !1}return Ln||!!Rn(Pn,se(t))}:kn,Nn=rt("species"),_n=s.Array,zn=function(t,e){return new(function(t){var e;return Tn(t)&&(e=t.constructor,(Mn(e)&&(e===_n||Tn(e.prototype))||nt(e)&&null===(e=e[Nn]))&&(e=void 0)),void 0===e?_n:e}(t))(0===e?0:e)},Dn=h([].push),Cn=function(t){var e=1==t,r=2==t,n=3==t,o=4==t,i=6==t,u=7==t,a=5==t||i;return function(c,f,l,s){for(var d,v,p=M(c),y=O(p),h=cn(f,l),g=Ct(y),b=0,m=s||zn,w=e?m(c,g):r||u?m(c,0):void 0;g>b;b++)if((a||b in y)&&(v=h(d=y[b],b,p),t))if(e)w[b]=v;else if(v)switch(t){case 3:return !0;case 5:return d;case 6:return b;case 2:Dn(w,d);}else switch(t){case 4:return !1;case 7:Dn(w,d);}return i?-1:n||o?o:w}},Fn={forEach:Cn(0),map:Cn(1),filter:Cn(2),some:Cn(3),every:Cn(4),find:Cn(5),findIndex:Cn(6),filterReject:Cn(7)},Hn=un.getWeakData,Bn=Ae.set,Gn=Ae.getterFor,$n=Fn.find,Vn=Fn.findIndex,Wn=h([].splice),Un=0,qn=function(t){return t.frozen||(t.frozen=new Kn)},Kn=function(){this.entries=[];},Yn=function(t,e){return $n(t.entries,(function(t){return t[0]===e}))};Kn.prototype={get:function(t){var e=Yn(this,t);if(e)return e[1]},has:function(t){return !!Yn(this,t)},set:function(t,e){var r=Yn(this,t);r?r[1]=e:this.entries.push([t,e]);},delete:function(t){var e=Vn(this.entries,(function(e){return e[0]===t}));return ~e&&Wn(this.entries,e,1),!!~e}};var Xn,Jn={getConstructor:function(t,e,r,n){var o=t((function(t,o){wn(t,i),Bn(t,{type:e,id:Un++,frozen:void 0}),null!=o&&bn(o,t[n],{that:t,AS_ENTRIES:r});})),i=o.prototype,u=Gn(e),a=function(t,e,r){var n=u(t),o=Hn(ut(e),!0);return !0===o?qn(n).set(e,r):o[n.id]=r,t};return Kr(i,{delete:function(t){var e=u(this);if(!nt(t))return !1;var r=Hn(t);return !0===r?qn(e).delete(t):r&&_(r,e.id)&&delete r[e.id]},has:function(t){var e=u(this);if(!nt(t))return !1;var r=Hn(t);return !0===r?qn(e).has(t):r&&_(r,e.id)}}),Kr(i,r?{get:function(t){var e=u(this);if(nt(t)){var r=Hn(t);return !0===r?qn(e).get(t):r?r[e.id]:void 0}},set:function(t,e){return a(this,t,e)}}:{add:function(t){return a(this,t,!0)}}),o}},Qn=Ae.enforce,Zn=!s.ActiveXObject&&"ActiveXObject"in s,to=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},eo=function(t,e,r){var n=-1!==t.indexOf("Map"),o=-1!==t.indexOf("Weak"),i=n?"set":"add",u=s[t],a=u&&u.prototype,c=u,f={},l=function(t){var e=h(a[t]);De(a,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return !(o&&!nt(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return o&&!nt(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return !(o&&!nt(t))&&e(this,0===t?0:t)}:function(t,r){return e(this,0===t?0:t,r),this});};if(Xe(t,!H(u)||!(o||a.forEach&&!g((function(){(new u).entries().next();})))))c=r.getConstructor(e,t,n,i),un.enable();else if(Xe(t,!0)){var d=new c,v=d[i](o?{}:-0,1)!=d,p=g((function(){d.has(1);})),y=function(t,e){if(!e&&!Sn)return !1;var r=!1;try{var n={};n[xn]=function(){return {next:function(){return {done:r=!0}}}},t(n);}catch(t){}return r}((function(t){new u(t);})),b=!o&&g((function(){for(var t=new u,e=5;e--;)t[i](e,e);return !t.has(-0)}));y||((c=e((function(t,e){wn(t,a);var r=function(t,e,r){var n,o;return yr&&H(n=e.constructor)&&n!==r&&nt(o=n.prototype)&&o!==r.prototype&&yr(t,o),t}(new u,t,c);return null!=e&&bn(e,r[i],{that:r,AS_ENTRIES:n}),r}))).prototype=a,a.constructor=c),(p||b)&&(l("delete"),l("has"),n&&l("get")),(b||v)&&l(i),o&&a.clear&&delete a.clear;}return f[t]=c,Qe({global:!0,forced:c!=u},f),lr(c,t),o||r.setStrong(c,t,n),c}("WeakMap",to,Jn);if(ve&&Zn){Xn=Jn.getConstructor(to,"WeakMap",!0),un.enable();var ro=eo.prototype,no=h(ro.delete),oo=h(ro.has),io=h(ro.get),uo=h(ro.set);Kr(ro,{delete:function(t){if(nt(t)&&!nn(t)){var e=Qn(this);return e.frozen||(e.frozen=new Xn),no(this,t)||e.frozen.delete(t)}return no(this,t)},has:function(t){if(nt(t)&&!nn(t)){var e=Qn(this);return e.frozen||(e.frozen=new Xn),oo(this,t)||e.frozen.has(t)}return oo(this,t)},get:function(t){if(nt(t)&&!nn(t)){var e=Qn(this);return e.frozen||(e.frozen=new Xn),oo(this,t)?io(this,t):e.frozen.get(t)}return io(this,t)},set:function(t,e){if(nt(t)&&!nn(t)){var r=Qn(this);r.frozen||(r.frozen=new Xn),oo(this,t)?uo(this,t,e):r.frozen.set(t,e);}else uo(this,t,e);return this}});}var ao={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},co=lt("span").classList,fo=co&&co.constructor&&co.constructor.prototype,lo=fo===Object.prototype?void 0:fo,so=rt("iterator"),vo=rt("toStringTag"),po=Pr.values,yo=function(t,e){if(t){if(t[so]!==po)try{ye(t,so,po);}catch(e){t[so]=po;}if(t[vo]||ye(t,vo,e),ao[e])for(var r in Pr)if(t[r]!==Pr[r])try{ye(t,r,Pr[r]);}catch(e){t[r]=Pr[r];}}};for(var ho in ao)yo(s[ho]&&s[ho].prototype,ho);yo(lo,"DOMTokenList");var go=new WeakMap;var bo={type:"list-item",renderElem:function(n,o,i){go.set(n,i);var u=n,a=u.level,c=void 0===a?0:a,f=u.ordered,l={margin:"5px 0 5px "+20*c+"px"},s="";if(void 0!==f&&f){var d=function(r,n){var o=n,i=o.type,u=o.level,a=void 0===u?0:u,c=o.ordered,f=void 0!==c&&c;if(!f)return -1;var l=1,s=n,d=t.DomEditor.findPath(r,s);if(0===d[0])return 1;for(;d[0]>0;){var v=e.Path.previous(d),p=e.Editor.node(r,v);if(null==p)break;var y=p[0],h=y.level,g=void 0===h?0:h,b=y.type,m=y.ordered;if(b!==i)break;if(g<a)break;if(g===a){if(m!==f)break;l++;}s=y,d=v;}return l}(i,n);s=d+".";}else s=function(t){void 0===t&&(t=0);var e="";switch(t){case 0:e="•";break;case 1:e="◦";break;default:e="▪";}return e}(c);var v=function(t){var r,n=t.children||[],o=n.length;if(0===o)return "";for(var i=0;i<o&&!r;i++){var u=n[i];e.Text.isText(u)&&(r=u);}return null==r?"":r.color||""}(n);return r.jsx("div",{style:l},r.jsx("span",{contentEditable:!1,style:{marginRight:"0.5em",color:v},"data-w-e-reserve":!0},s),r.jsx("span",null,o))}},mo=function(t,e){return mo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e;}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);},mo(t,e)};
  18532. /*! *****************************************************************************
  18533. Copyright (c) Microsoft Corporation.
  18534. Permission to use, copy, modify, and/or distribute this software for any
  18535. purpose with or without fee is hereby granted.
  18536. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  18537. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  18538. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  18539. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  18540. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  18541. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  18542. PERFORMANCE OF THIS SOFTWARE.
  18543. ***************************************************************************** */function wo(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t;}mo(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r);}function xo(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return {next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function So(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value);}catch(t){o={error:t};}finally{try{n&&!n.done&&(r=i.return)&&r.call(i);}finally{if(o)throw o.error}}return u}function Oo(r){return e.Editor.nodes(r,{at:r.selection||void 0,match:function(e){return 1===t.DomEditor.findPath(r,e).length}})}var Eo=Ht.includes;Qe({target:"Array",proto:!0},{includes:function(t){return Eo(this,t,arguments.length>1?arguments[1]:void 0)}}),ie("includes");var To,jo,Ao=function(){var t=ut(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},Io=s.RegExp,Po=g((function(){var t=Io("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),Ro=Po||g((function(){return !Io("a","y").sticky})),Lo={BROKEN_CARET:Po||g((function(){var t=Io("^r","gy");return t.lastIndex=2,null!=t.exec("str")})),MISSED_STICKY:Ro,UNSUPPORTED_Y:Po},ko=s.RegExp,Mo=g((function(){var t=ko(".","s");return !(t.dotAll&&t.exec("\n")&&"s"===t.flags)})),No=s.RegExp,_o=g((function(){var t=No("(?<a>b)","g");return "b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})),zo=Ae.get,Do=L("native-string-replace",String.prototype.replace),Co=RegExp.prototype.exec,Fo=Co,Ho=h("".charAt),Bo=h("".indexOf),Go=h("".replace),$o=h("".slice),Vo=(jo=/b*/g,vt(Co,To=/a/,"a"),vt(Co,jo,"a"),0!==To.lastIndex||0!==jo.lastIndex),Wo=Lo.BROKEN_CARET,Uo=void 0!==/()??/.exec("")[1];(Vo||Uo||Wo||Mo||_o)&&(Fo=function(t){var e,r,n,o,i,u,a,c=this,f=zo(c),l=Cr(t),s=f.raw;if(s)return s.lastIndex=c.lastIndex,e=vt(Fo,s,l),c.lastIndex=s.lastIndex,e;var d=f.groups,v=Wo&&c.sticky,p=vt(Ao,c),y=c.source,h=0,g=l;if(v&&(p=Go(p,"y",""),-1===Bo(p,"g")&&(p+="g"),g=$o(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Ho(l,c.lastIndex-1))&&(y="(?: "+y+")",g=" "+g,h++),r=new RegExp("^(?:"+y+")",p)),Uo&&(r=new RegExp("^"+y+"$(?!\\s)",p)),Vo&&(n=c.lastIndex),o=vt(Co,v?r:c,g),v?o?(o.input=$o(o.input,h),o[0]=$o(o[0],h),o.index=c.lastIndex,c.lastIndex+=o[0].length):c.lastIndex=0:Vo&&o&&(c.lastIndex=c.global?o.index+o[0].length:n),Uo&&o&&o.length>1&&vt(Do,o[0],r,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(o[i]=void 0);})),o&&d)for(o.groups=u=re(null),i=0;i<d.length;i++)u[(a=d[i])[0]]=o[a[1]];return o});var qo=Fo;Qe({target:"RegExp",proto:!0,forced:/./.exec!==qo},{exec:qo});var Ko=function(){function r(){this.type="list-item",this.tag="button";}return r.prototype.getListNode=function(e){var r=this.type;return t.DomEditor.getSelectedNodeByType(e,r)},r.prototype.getValue=function(t){return ""},r.prototype.isActive=function(t){var e=this.getListNode(t);if(null==e)return !1;var r=e.ordered;return (void 0!==r&&r)===this.ordered},r.prototype.isDisabled=function(r){return null==r.selection||!!t.DomEditor.getSelectedElems(r).some((function(t){if(e.Editor.isVoid(r,t)&&e.Editor.isBlock(r,t))return !0;var n=t.type;return !!["pre","code","table"].includes(n)||void 0}))},r.prototype.exec=function(t,r){this.isActive(t)?e.Transforms.setNodes(t,{type:"paragraph",ordered:void 0,level:void 0}):e.Transforms.setNodes(t,{type:"list-item",ordered:this.ordered,indent:void 0});},r}(),Yo='<svg viewBox="0 0 1024 1024"><path d="M384 64h640v128H384V64z m0 384h640v128H384v-128z m0 384h640v128H384v-128zM0 128a128 128 0 1 1 256 0 128 128 0 0 1-256 0z m0 384a128 128 0 1 1 256 0 128 128 0 0 1-256 0z m0 384a128 128 0 1 1 256 0 128 128 0 0 1-256 0z"></path></svg>',Xo='<svg viewBox="0 0 1024 1024"><path d="M384 832h640v128H384z m0-384h640v128H384z m0-384h640v128H384zM192 0v256H128V64H64V0zM128 526.016v50.016h128v64H64v-146.016l128-60V384H64v-64h192v146.016zM256 704v320H64v-64h128v-64H64v-64h128v-64H64v-64z"></path></svg>',Jo=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.ordered=!1,r.title=t.t("listModule.unOrderedList"),r.iconSvg=Yo,r}return wo(r,e),r}(Ko),Qo=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.ordered=!0,r.title=t.t("listModule.orderedList"),r.iconSvg=Xo,r}return wo(r,e),r}(Ko),Zo={key:"bulletedList",factory:function(){return new Jo}},ti={key:"numberedList",factory:function(){return new Qo}};var ei=[];var ri,ni={type:"list-item",elemToHtml:function(r,n){var o="",i="",u=r.ordered,a=void 0!==u&&u?"ol":"ul",c=function(r){var n=go.get(r);if(null==n)return 0;var o=r,i=o.type,u=o.ordered,a=void 0!==u&&u,c=o.level,f=void 0===c?0:c,l=t.DomEditor.findPath(n,r);if(0===l[0])return f+1;var s=e.Path.previous(l),d=e.Editor.node(n,s);if(!d)return 0;var v=So(d,1)[0];if(t.DomEditor.getNodeType(v)!==i)return f+1;var p=v,y=p.ordered,h=void 0!==y&&y,g=p.level,b=void 0===g?0:g;return b<f?f-b:b>f?0:b===f?h===a?0:1:0}(r);if(c>0)for(var f=0;f<c;f++)o+="<"+a+">",ei.push(a);var l=function(r){var n=go.get(r);if(null==n)return 0;var o=r,i=o.type,u=o.ordered,a=void 0!==u&&u,c=o.level,f=void 0===c?0:c,l=t.DomEditor.findPath(n,r);if(l[0]===n.children.length-1)return f+1;var s=e.Path.next(l),d=e.Editor.node(n,s);if(!d)return 0;var v=So(d,1)[0];if(t.DomEditor.getNodeType(v)!==i)return f+1;var p=v,y=p.ordered,h=void 0!==y&&y,g=p.level,b=void 0===g?0:g;return b<f?f-b:b>f?0:b===f?h===a?0:1:0}(r);if(l>0)for(f=0;f<l;f++){i+="</"+ei.pop()+">";}return {html:"<li>"+n+"</li>",prefix:o,suffix:i}}},oi=rt("species"),ii=Fn.filter,ui=(ri="filter",Y>=51||!g((function(){var t=[];return (t.constructor={})[oi]=function(){return {foo:1}},1!==t[ri](Boolean).foo})));Qe({target:"Array",proto:!0,forced:!ui},{filter:function(t){return ii(this,t,arguments.length>1?arguments[1]:void 0)}});var ai=Function.prototype,ci=ai.apply,fi=ai.bind,li=ai.call,si="object"==typeof Reflect&&Reflect.apply||(fi?li.bind(ci):function(){return li.apply(ci,arguments)}),di=rt("species"),vi=RegExp.prototype,pi=$r.charAt,yi=function(t,e,r){return e+(r?pi(t,e).length:1)},hi=Math.floor,gi=h("".charAt),bi=h("".replace),mi=h("".slice),wi=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,xi=/\$([$&'`]|\d{1,2})/g,Si=function(t,e,r,n,o,i){var u=r+t.length,a=n.length,c=xi;return void 0!==o&&(o=M(o),c=wi),bi(i,c,(function(i,c){var f;switch(gi(c,0)){case"$":return "$";case"&":return t;case"`":return mi(e,0,r);case"'":return mi(e,u);case"<":f=o[mi(c,1,-1)];break;default:var l=+c;if(0===l)return i;if(l>a){var s=hi(l/10);return 0===s?i:s<=a?void 0===n[s-1]?gi(c,1):n[s-1]+gi(c,1):i}f=n[l-1];}return void 0===f?"":f}))},Oi=s.TypeError,Ei=function(t,e){var r=t.exec;if(H(r)){var n=vt(r,t,e);return null!==n&&ut(n),n}if("RegExp"===w(t))return vt(qo,t,e);throw Oi("RegExp#exec called on incompatible receiver")},Ti=rt("replace"),ji=Math.max,Ai=Math.min,Ii=h([].concat),Pi=h([].push),Ri=h("".indexOf),Li=h("".slice),ki="$0"==="a".replace(/./,"$0"),Mi=!!/./[Ti]&&""===/./[Ti]("a","$0");!function(t,e,r,n){var o=rt(t),i=!g((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),u=i&&!g((function(){var e=!1,r=/a/;return "split"===t&&((r={}).constructor={},r.constructor[di]=function(){return r},r.flags="",r[o]=/./[o]),r.exec=function(){return e=!0,null},r[o](""),!e}));if(!i||!u||r){var a=h(/./[o]),c=e(o,""[t],(function(t,e,r,n,o){var u=h(t),c=e.exec;return c===qo||c===vi.exec?i&&!o?{done:!0,value:a(e,r,n)}:{done:!0,value:u(r,e,n)}:{done:!1}}));De(String.prototype,t,c[0]),De(vi,o,c[1]);}n&&ye(vi[o],"sham",!0);}("replace",(function(t,e,r){var n=Mi?"$":"$0";return [function(t,r){var n=T(this),o=null==t?void 0:xt(t,Ti);return o?vt(o,t,n,r):vt(e,Cr(n),t,r)},function(t,o){var i=ut(this),u=Cr(t);if("string"==typeof o&&-1===Ri(o,n)&&-1===Ri(o,"$<")){var a=r(e,i,u,o);if(a.done)return a.value}var c=H(o);c||(o=Cr(o));var f=i.global;if(f){var l=i.unicode;i.lastIndex=0;}for(var s=[];;){var d=Ei(i,u);if(null===d)break;if(Pi(s,d),!f)break;""===Cr(d[0])&&(i.lastIndex=yi(u,Dt(i.lastIndex),l));}for(var v,p="",y=0,h=0;h<s.length;h++){for(var g=Cr((d=s[h])[0]),b=ji(Ai(kt(d.index),u.length),0),m=[],w=1;w<d.length;w++)Pi(m,void 0===(v=d[w])?v:String(v));var x=d.groups;if(c){var S=Ii([g],m,b,u);void 0!==x&&Pi(S,x);var O=Cr(si(o,void 0,S));}else O=Si(g,u,b,m,x,o);b>=y&&(p+=Li(u,y,b)+O,y=b+g.length);}return p+Li(u,y)}]}),!!g((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}))||!ki||Mi);var Ni=s.TypeError,_i=function(t,e,r,n,o,i,u,a){for(var c,f,l=o,s=0,d=!!u&&cn(u,a);s<n;){if(s in r){if(c=d?d(r[s],s,e):r[s],i>0&&Tn(c))f=Ct(c),l=_i(t,e,c,f,l,i-1)-1;else {if(l>=9007199254740991)throw Ni("Exceed the acceptable array length");t[l]=c;}l++;}s++;}return l},zi=_i;function Di(t){return t.length?t[0].tagName.toLowerCase():""}return Qe({target:"Array",proto:!0},{flat:function(){var t=arguments.length?arguments[0]:void 0,e=M(this),r=Ct(e),n=zn(e,0);return n.length=zi(n,e,e,r,0,void 0===t?1:kt(t)),n}}),ie("flat"),Qe({global:!0},{globalThis:s}),n.append&&(i.default.fn.append=n.append),n.attr&&(i.default.fn.attr=n.attr),n.parent&&(i.default.fn.parent=n.parent),{renderElems:[bo],editorPlugin:function(r){var n=r.deleteBackward,o=r.handleTab,i=r.normalizeNode,u=r;return u.deleteBackward=function(r){var o=u.selection;if(null!=o)if(e.Range.isExpanded(o))n(r);else {var i=t.DomEditor.getSelectedNodeByType(u,"list-item");if(null!=i)if(0!==o.focus.offset)n(r);else {var a=i.level,c=void 0===a?0:a;c>0?e.Transforms.setNodes(u,{level:c-1}):e.Transforms.setNodes(u,{type:"paragraph",ordered:void 0,level:void 0});}else n(r);}else n(r);},u.handleTab=function(){var r,n,i,a,c=u.selection;if(null!=c){if(e.Range.isCollapsed(c)){var f=t.DomEditor.getSelectedNodeByType(u,"list-item");if(null==f)return void o();if(0===c.focus.offset){var l=f.level,s=void 0===l?0:l;return void e.Transforms.setNodes(u,{level:s+1})}}if(e.Range.isExpanded(c)){var d=0,v=!1;try{for(var p=xo(Oo(u)),y=p.next();!y.done;y=p.next()){var h=So(y.value,1)[0];"list-item"===t.DomEditor.getNodeType(h)?d++:v=!0;}}catch(t){r={error:t};}finally{try{y&&!y.done&&(n=p.return)&&n.call(p);}finally{if(r)throw r.error}}if(v||d<=1)return void o();try{for(var g=xo(Oo(u)),b=g.next();!b.done;b=g.next()){var m=So(b.value,2),w=(h=m[0],m[1]),x=h.level;s=void 0===x?0:x;e.Transforms.setNodes(u,{level:s+1},{at:w});}}catch(t){i={error:t};}finally{try{b&&!b.done&&(a=g.return)&&a.call(g);}finally{if(i)throw i.error}}}else o();}else o();},u.normalizeNode=function(r){var n=So(r,2),o=n[0],a=n[1],c=t.DomEditor.getNodeType(o);return "bulleted-list"!==c&&"numbered-list"!==c||e.Transforms.unwrapNodes(u,{at:a}),i([o,a])},u},menus:[Zo,ti],elemsToHtml:[ni],parseElemsHtml:[{selector:"ul:not([data-w-e-type]),ol:not([data-w-e-type])",parseElemHtml:function(t,e,r){return e.flat(1/0)}},{selector:"li:not([data-w-e-type])",parseElemHtml:function(t,r,n){var o=i.default(t);0===(r=r.filter((function(t){return !!e.Text.isText(t)||!!n.isInline(t)}))).length&&(r=[{text:o.text().replace(/\s+/gm," ")}]);var u=function(t){return "ol"===Di(t.parent())}(o),a=function(t){for(var e=0,r=t.parent(),n=Di(r);"ul"===n||"ol"===n;)n=Di(r=r.parent()),e++;return e-1}(o);return {type:"list-item",ordered:u,level:a,children:r}}}]}}));
  18544. });
  18545. /**
  18546. * Lodash (Custom Build) <https://lodash.com/>
  18547. * Build: `lodash modularize exports="npm" -o ./`
  18548. * Copyright JS Foundation and other contributors <https://js.foundation/>
  18549. * Released under MIT license <https://lodash.com/license>
  18550. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18551. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18552. */
  18553. var lodash_isequal = createCommonjsModule$1(function (module, exports) {
  18554. /** Used as the size to enable large array optimizations. */
  18555. var LARGE_ARRAY_SIZE = 200;
  18556. /** Used to stand-in for `undefined` hash values. */
  18557. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18558. /** Used to compose bitmasks for value comparisons. */
  18559. var COMPARE_PARTIAL_FLAG = 1,
  18560. COMPARE_UNORDERED_FLAG = 2;
  18561. /** Used as references for various `Number` constants. */
  18562. var MAX_SAFE_INTEGER = 9007199254740991;
  18563. /** `Object#toString` result references. */
  18564. var argsTag = '[object Arguments]',
  18565. arrayTag = '[object Array]',
  18566. asyncTag = '[object AsyncFunction]',
  18567. boolTag = '[object Boolean]',
  18568. dateTag = '[object Date]',
  18569. errorTag = '[object Error]',
  18570. funcTag = '[object Function]',
  18571. genTag = '[object GeneratorFunction]',
  18572. mapTag = '[object Map]',
  18573. numberTag = '[object Number]',
  18574. nullTag = '[object Null]',
  18575. objectTag = '[object Object]',
  18576. promiseTag = '[object Promise]',
  18577. proxyTag = '[object Proxy]',
  18578. regexpTag = '[object RegExp]',
  18579. setTag = '[object Set]',
  18580. stringTag = '[object String]',
  18581. symbolTag = '[object Symbol]',
  18582. undefinedTag = '[object Undefined]',
  18583. weakMapTag = '[object WeakMap]';
  18584. var arrayBufferTag = '[object ArrayBuffer]',
  18585. dataViewTag = '[object DataView]',
  18586. float32Tag = '[object Float32Array]',
  18587. float64Tag = '[object Float64Array]',
  18588. int8Tag = '[object Int8Array]',
  18589. int16Tag = '[object Int16Array]',
  18590. int32Tag = '[object Int32Array]',
  18591. uint8Tag = '[object Uint8Array]',
  18592. uint8ClampedTag = '[object Uint8ClampedArray]',
  18593. uint16Tag = '[object Uint16Array]',
  18594. uint32Tag = '[object Uint32Array]';
  18595. /**
  18596. * Used to match `RegExp`
  18597. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18598. */
  18599. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  18600. /** Used to detect host constructors (Safari). */
  18601. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18602. /** Used to detect unsigned integer values. */
  18603. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18604. /** Used to identify `toStringTag` values of typed arrays. */
  18605. var typedArrayTags = {};
  18606. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18607. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18608. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18609. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18610. typedArrayTags[uint32Tag] = true;
  18611. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18612. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18613. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18614. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18615. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18616. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18617. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18618. typedArrayTags[weakMapTag] = false;
  18619. /** Detect free variable `global` from Node.js. */
  18620. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  18621. /** Detect free variable `self`. */
  18622. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18623. /** Used as a reference to the global object. */
  18624. var root = freeGlobal || freeSelf || Function('return this')();
  18625. /** Detect free variable `exports`. */
  18626. var freeExports = exports && !exports.nodeType && exports;
  18627. /** Detect free variable `module`. */
  18628. var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
  18629. /** Detect the popular CommonJS extension `module.exports`. */
  18630. var moduleExports = freeModule && freeModule.exports === freeExports;
  18631. /** Detect free variable `process` from Node.js. */
  18632. var freeProcess = moduleExports && freeGlobal.process;
  18633. /** Used to access faster Node.js helpers. */
  18634. var nodeUtil = (function() {
  18635. try {
  18636. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18637. } catch (e) {}
  18638. }());
  18639. /* Node.js helper references. */
  18640. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18641. /**
  18642. * A specialized version of `_.filter` for arrays without support for
  18643. * iteratee shorthands.
  18644. *
  18645. * @private
  18646. * @param {Array} [array] The array to iterate over.
  18647. * @param {Function} predicate The function invoked per iteration.
  18648. * @returns {Array} Returns the new filtered array.
  18649. */
  18650. function arrayFilter(array, predicate) {
  18651. var index = -1,
  18652. length = array == null ? 0 : array.length,
  18653. resIndex = 0,
  18654. result = [];
  18655. while (++index < length) {
  18656. var value = array[index];
  18657. if (predicate(value, index, array)) {
  18658. result[resIndex++] = value;
  18659. }
  18660. }
  18661. return result;
  18662. }
  18663. /**
  18664. * Appends the elements of `values` to `array`.
  18665. *
  18666. * @private
  18667. * @param {Array} array The array to modify.
  18668. * @param {Array} values The values to append.
  18669. * @returns {Array} Returns `array`.
  18670. */
  18671. function arrayPush(array, values) {
  18672. var index = -1,
  18673. length = values.length,
  18674. offset = array.length;
  18675. while (++index < length) {
  18676. array[offset + index] = values[index];
  18677. }
  18678. return array;
  18679. }
  18680. /**
  18681. * A specialized version of `_.some` for arrays without support for iteratee
  18682. * shorthands.
  18683. *
  18684. * @private
  18685. * @param {Array} [array] The array to iterate over.
  18686. * @param {Function} predicate The function invoked per iteration.
  18687. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18688. * else `false`.
  18689. */
  18690. function arraySome(array, predicate) {
  18691. var index = -1,
  18692. length = array == null ? 0 : array.length;
  18693. while (++index < length) {
  18694. if (predicate(array[index], index, array)) {
  18695. return true;
  18696. }
  18697. }
  18698. return false;
  18699. }
  18700. /**
  18701. * The base implementation of `_.times` without support for iteratee shorthands
  18702. * or max array length checks.
  18703. *
  18704. * @private
  18705. * @param {number} n The number of times to invoke `iteratee`.
  18706. * @param {Function} iteratee The function invoked per iteration.
  18707. * @returns {Array} Returns the array of results.
  18708. */
  18709. function baseTimes(n, iteratee) {
  18710. var index = -1,
  18711. result = Array(n);
  18712. while (++index < n) {
  18713. result[index] = iteratee(index);
  18714. }
  18715. return result;
  18716. }
  18717. /**
  18718. * The base implementation of `_.unary` without support for storing metadata.
  18719. *
  18720. * @private
  18721. * @param {Function} func The function to cap arguments for.
  18722. * @returns {Function} Returns the new capped function.
  18723. */
  18724. function baseUnary(func) {
  18725. return function(value) {
  18726. return func(value);
  18727. };
  18728. }
  18729. /**
  18730. * Checks if a `cache` value for `key` exists.
  18731. *
  18732. * @private
  18733. * @param {Object} cache The cache to query.
  18734. * @param {string} key The key of the entry to check.
  18735. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18736. */
  18737. function cacheHas(cache, key) {
  18738. return cache.has(key);
  18739. }
  18740. /**
  18741. * Gets the value at `key` of `object`.
  18742. *
  18743. * @private
  18744. * @param {Object} [object] The object to query.
  18745. * @param {string} key The key of the property to get.
  18746. * @returns {*} Returns the property value.
  18747. */
  18748. function getValue(object, key) {
  18749. return object == null ? undefined : object[key];
  18750. }
  18751. /**
  18752. * Converts `map` to its key-value pairs.
  18753. *
  18754. * @private
  18755. * @param {Object} map The map to convert.
  18756. * @returns {Array} Returns the key-value pairs.
  18757. */
  18758. function mapToArray(map) {
  18759. var index = -1,
  18760. result = Array(map.size);
  18761. map.forEach(function(value, key) {
  18762. result[++index] = [key, value];
  18763. });
  18764. return result;
  18765. }
  18766. /**
  18767. * Creates a unary function that invokes `func` with its argument transformed.
  18768. *
  18769. * @private
  18770. * @param {Function} func The function to wrap.
  18771. * @param {Function} transform The argument transform.
  18772. * @returns {Function} Returns the new function.
  18773. */
  18774. function overArg(func, transform) {
  18775. return function(arg) {
  18776. return func(transform(arg));
  18777. };
  18778. }
  18779. /**
  18780. * Converts `set` to an array of its values.
  18781. *
  18782. * @private
  18783. * @param {Object} set The set to convert.
  18784. * @returns {Array} Returns the values.
  18785. */
  18786. function setToArray(set) {
  18787. var index = -1,
  18788. result = Array(set.size);
  18789. set.forEach(function(value) {
  18790. result[++index] = value;
  18791. });
  18792. return result;
  18793. }
  18794. /** Used for built-in method references. */
  18795. var arrayProto = Array.prototype,
  18796. funcProto = Function.prototype,
  18797. objectProto = Object.prototype;
  18798. /** Used to detect overreaching core-js shims. */
  18799. var coreJsData = root['__core-js_shared__'];
  18800. /** Used to resolve the decompiled source of functions. */
  18801. var funcToString = funcProto.toString;
  18802. /** Used to check objects for own properties. */
  18803. var hasOwnProperty = objectProto.hasOwnProperty;
  18804. /** Used to detect methods masquerading as native. */
  18805. var maskSrcKey = (function() {
  18806. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  18807. return uid ? ('Symbol(src)_1.' + uid) : '';
  18808. }());
  18809. /**
  18810. * Used to resolve the
  18811. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  18812. * of values.
  18813. */
  18814. var nativeObjectToString = objectProto.toString;
  18815. /** Used to detect if a method is native. */
  18816. var reIsNative = RegExp('^' +
  18817. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  18818. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  18819. );
  18820. /** Built-in value references. */
  18821. var Buffer = moduleExports ? root.Buffer : undefined,
  18822. Symbol = root.Symbol,
  18823. Uint8Array = root.Uint8Array,
  18824. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  18825. splice = arrayProto.splice,
  18826. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  18827. /* Built-in method references for those with the same name as other `lodash` methods. */
  18828. var nativeGetSymbols = Object.getOwnPropertySymbols,
  18829. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  18830. nativeKeys = overArg(Object.keys, Object);
  18831. /* Built-in method references that are verified to be native. */
  18832. var DataView = getNative(root, 'DataView'),
  18833. Map = getNative(root, 'Map'),
  18834. Promise = getNative(root, 'Promise'),
  18835. Set = getNative(root, 'Set'),
  18836. WeakMap = getNative(root, 'WeakMap'),
  18837. nativeCreate = getNative(Object, 'create');
  18838. /** Used to detect maps, sets, and weakmaps. */
  18839. var dataViewCtorString = toSource(DataView),
  18840. mapCtorString = toSource(Map),
  18841. promiseCtorString = toSource(Promise),
  18842. setCtorString = toSource(Set),
  18843. weakMapCtorString = toSource(WeakMap);
  18844. /** Used to convert symbols to primitives and strings. */
  18845. var symbolProto = Symbol ? Symbol.prototype : undefined,
  18846. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  18847. /**
  18848. * Creates a hash object.
  18849. *
  18850. * @private
  18851. * @constructor
  18852. * @param {Array} [entries] The key-value pairs to cache.
  18853. */
  18854. function Hash(entries) {
  18855. var index = -1,
  18856. length = entries == null ? 0 : entries.length;
  18857. this.clear();
  18858. while (++index < length) {
  18859. var entry = entries[index];
  18860. this.set(entry[0], entry[1]);
  18861. }
  18862. }
  18863. /**
  18864. * Removes all key-value entries from the hash.
  18865. *
  18866. * @private
  18867. * @name clear
  18868. * @memberOf Hash
  18869. */
  18870. function hashClear() {
  18871. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  18872. this.size = 0;
  18873. }
  18874. /**
  18875. * Removes `key` and its value from the hash.
  18876. *
  18877. * @private
  18878. * @name delete
  18879. * @memberOf Hash
  18880. * @param {Object} hash The hash to modify.
  18881. * @param {string} key The key of the value to remove.
  18882. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  18883. */
  18884. function hashDelete(key) {
  18885. var result = this.has(key) && delete this.__data__[key];
  18886. this.size -= result ? 1 : 0;
  18887. return result;
  18888. }
  18889. /**
  18890. * Gets the hash value for `key`.
  18891. *
  18892. * @private
  18893. * @name get
  18894. * @memberOf Hash
  18895. * @param {string} key The key of the value to get.
  18896. * @returns {*} Returns the entry value.
  18897. */
  18898. function hashGet(key) {
  18899. var data = this.__data__;
  18900. if (nativeCreate) {
  18901. var result = data[key];
  18902. return result === HASH_UNDEFINED ? undefined : result;
  18903. }
  18904. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  18905. }
  18906. /**
  18907. * Checks if a hash value for `key` exists.
  18908. *
  18909. * @private
  18910. * @name has
  18911. * @memberOf Hash
  18912. * @param {string} key The key of the entry to check.
  18913. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18914. */
  18915. function hashHas(key) {
  18916. var data = this.__data__;
  18917. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  18918. }
  18919. /**
  18920. * Sets the hash `key` to `value`.
  18921. *
  18922. * @private
  18923. * @name set
  18924. * @memberOf Hash
  18925. * @param {string} key The key of the value to set.
  18926. * @param {*} value The value to set.
  18927. * @returns {Object} Returns the hash instance.
  18928. */
  18929. function hashSet(key, value) {
  18930. var data = this.__data__;
  18931. this.size += this.has(key) ? 0 : 1;
  18932. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  18933. return this;
  18934. }
  18935. // Add methods to `Hash`.
  18936. Hash.prototype.clear = hashClear;
  18937. Hash.prototype['delete'] = hashDelete;
  18938. Hash.prototype.get = hashGet;
  18939. Hash.prototype.has = hashHas;
  18940. Hash.prototype.set = hashSet;
  18941. /**
  18942. * Creates an list cache object.
  18943. *
  18944. * @private
  18945. * @constructor
  18946. * @param {Array} [entries] The key-value pairs to cache.
  18947. */
  18948. function ListCache(entries) {
  18949. var index = -1,
  18950. length = entries == null ? 0 : entries.length;
  18951. this.clear();
  18952. while (++index < length) {
  18953. var entry = entries[index];
  18954. this.set(entry[0], entry[1]);
  18955. }
  18956. }
  18957. /**
  18958. * Removes all key-value entries from the list cache.
  18959. *
  18960. * @private
  18961. * @name clear
  18962. * @memberOf ListCache
  18963. */
  18964. function listCacheClear() {
  18965. this.__data__ = [];
  18966. this.size = 0;
  18967. }
  18968. /**
  18969. * Removes `key` and its value from the list cache.
  18970. *
  18971. * @private
  18972. * @name delete
  18973. * @memberOf ListCache
  18974. * @param {string} key The key of the value to remove.
  18975. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  18976. */
  18977. function listCacheDelete(key) {
  18978. var data = this.__data__,
  18979. index = assocIndexOf(data, key);
  18980. if (index < 0) {
  18981. return false;
  18982. }
  18983. var lastIndex = data.length - 1;
  18984. if (index == lastIndex) {
  18985. data.pop();
  18986. } else {
  18987. splice.call(data, index, 1);
  18988. }
  18989. --this.size;
  18990. return true;
  18991. }
  18992. /**
  18993. * Gets the list cache value for `key`.
  18994. *
  18995. * @private
  18996. * @name get
  18997. * @memberOf ListCache
  18998. * @param {string} key The key of the value to get.
  18999. * @returns {*} Returns the entry value.
  19000. */
  19001. function listCacheGet(key) {
  19002. var data = this.__data__,
  19003. index = assocIndexOf(data, key);
  19004. return index < 0 ? undefined : data[index][1];
  19005. }
  19006. /**
  19007. * Checks if a list cache value for `key` exists.
  19008. *
  19009. * @private
  19010. * @name has
  19011. * @memberOf ListCache
  19012. * @param {string} key The key of the entry to check.
  19013. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19014. */
  19015. function listCacheHas(key) {
  19016. return assocIndexOf(this.__data__, key) > -1;
  19017. }
  19018. /**
  19019. * Sets the list cache `key` to `value`.
  19020. *
  19021. * @private
  19022. * @name set
  19023. * @memberOf ListCache
  19024. * @param {string} key The key of the value to set.
  19025. * @param {*} value The value to set.
  19026. * @returns {Object} Returns the list cache instance.
  19027. */
  19028. function listCacheSet(key, value) {
  19029. var data = this.__data__,
  19030. index = assocIndexOf(data, key);
  19031. if (index < 0) {
  19032. ++this.size;
  19033. data.push([key, value]);
  19034. } else {
  19035. data[index][1] = value;
  19036. }
  19037. return this;
  19038. }
  19039. // Add methods to `ListCache`.
  19040. ListCache.prototype.clear = listCacheClear;
  19041. ListCache.prototype['delete'] = listCacheDelete;
  19042. ListCache.prototype.get = listCacheGet;
  19043. ListCache.prototype.has = listCacheHas;
  19044. ListCache.prototype.set = listCacheSet;
  19045. /**
  19046. * Creates a map cache object to store key-value pairs.
  19047. *
  19048. * @private
  19049. * @constructor
  19050. * @param {Array} [entries] The key-value pairs to cache.
  19051. */
  19052. function MapCache(entries) {
  19053. var index = -1,
  19054. length = entries == null ? 0 : entries.length;
  19055. this.clear();
  19056. while (++index < length) {
  19057. var entry = entries[index];
  19058. this.set(entry[0], entry[1]);
  19059. }
  19060. }
  19061. /**
  19062. * Removes all key-value entries from the map.
  19063. *
  19064. * @private
  19065. * @name clear
  19066. * @memberOf MapCache
  19067. */
  19068. function mapCacheClear() {
  19069. this.size = 0;
  19070. this.__data__ = {
  19071. 'hash': new Hash,
  19072. 'map': new (Map || ListCache),
  19073. 'string': new Hash
  19074. };
  19075. }
  19076. /**
  19077. * Removes `key` and its value from the map.
  19078. *
  19079. * @private
  19080. * @name delete
  19081. * @memberOf MapCache
  19082. * @param {string} key The key of the value to remove.
  19083. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19084. */
  19085. function mapCacheDelete(key) {
  19086. var result = getMapData(this, key)['delete'](key);
  19087. this.size -= result ? 1 : 0;
  19088. return result;
  19089. }
  19090. /**
  19091. * Gets the map value for `key`.
  19092. *
  19093. * @private
  19094. * @name get
  19095. * @memberOf MapCache
  19096. * @param {string} key The key of the value to get.
  19097. * @returns {*} Returns the entry value.
  19098. */
  19099. function mapCacheGet(key) {
  19100. return getMapData(this, key).get(key);
  19101. }
  19102. /**
  19103. * Checks if a map value for `key` exists.
  19104. *
  19105. * @private
  19106. * @name has
  19107. * @memberOf MapCache
  19108. * @param {string} key The key of the entry to check.
  19109. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19110. */
  19111. function mapCacheHas(key) {
  19112. return getMapData(this, key).has(key);
  19113. }
  19114. /**
  19115. * Sets the map `key` to `value`.
  19116. *
  19117. * @private
  19118. * @name set
  19119. * @memberOf MapCache
  19120. * @param {string} key The key of the value to set.
  19121. * @param {*} value The value to set.
  19122. * @returns {Object} Returns the map cache instance.
  19123. */
  19124. function mapCacheSet(key, value) {
  19125. var data = getMapData(this, key),
  19126. size = data.size;
  19127. data.set(key, value);
  19128. this.size += data.size == size ? 0 : 1;
  19129. return this;
  19130. }
  19131. // Add methods to `MapCache`.
  19132. MapCache.prototype.clear = mapCacheClear;
  19133. MapCache.prototype['delete'] = mapCacheDelete;
  19134. MapCache.prototype.get = mapCacheGet;
  19135. MapCache.prototype.has = mapCacheHas;
  19136. MapCache.prototype.set = mapCacheSet;
  19137. /**
  19138. *
  19139. * Creates an array cache object to store unique values.
  19140. *
  19141. * @private
  19142. * @constructor
  19143. * @param {Array} [values] The values to cache.
  19144. */
  19145. function SetCache(values) {
  19146. var index = -1,
  19147. length = values == null ? 0 : values.length;
  19148. this.__data__ = new MapCache;
  19149. while (++index < length) {
  19150. this.add(values[index]);
  19151. }
  19152. }
  19153. /**
  19154. * Adds `value` to the array cache.
  19155. *
  19156. * @private
  19157. * @name add
  19158. * @memberOf SetCache
  19159. * @alias push
  19160. * @param {*} value The value to cache.
  19161. * @returns {Object} Returns the cache instance.
  19162. */
  19163. function setCacheAdd(value) {
  19164. this.__data__.set(value, HASH_UNDEFINED);
  19165. return this;
  19166. }
  19167. /**
  19168. * Checks if `value` is in the array cache.
  19169. *
  19170. * @private
  19171. * @name has
  19172. * @memberOf SetCache
  19173. * @param {*} value The value to search for.
  19174. * @returns {number} Returns `true` if `value` is found, else `false`.
  19175. */
  19176. function setCacheHas(value) {
  19177. return this.__data__.has(value);
  19178. }
  19179. // Add methods to `SetCache`.
  19180. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  19181. SetCache.prototype.has = setCacheHas;
  19182. /**
  19183. * Creates a stack cache object to store key-value pairs.
  19184. *
  19185. * @private
  19186. * @constructor
  19187. * @param {Array} [entries] The key-value pairs to cache.
  19188. */
  19189. function Stack(entries) {
  19190. var data = this.__data__ = new ListCache(entries);
  19191. this.size = data.size;
  19192. }
  19193. /**
  19194. * Removes all key-value entries from the stack.
  19195. *
  19196. * @private
  19197. * @name clear
  19198. * @memberOf Stack
  19199. */
  19200. function stackClear() {
  19201. this.__data__ = new ListCache;
  19202. this.size = 0;
  19203. }
  19204. /**
  19205. * Removes `key` and its value from the stack.
  19206. *
  19207. * @private
  19208. * @name delete
  19209. * @memberOf Stack
  19210. * @param {string} key The key of the value to remove.
  19211. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19212. */
  19213. function stackDelete(key) {
  19214. var data = this.__data__,
  19215. result = data['delete'](key);
  19216. this.size = data.size;
  19217. return result;
  19218. }
  19219. /**
  19220. * Gets the stack value for `key`.
  19221. *
  19222. * @private
  19223. * @name get
  19224. * @memberOf Stack
  19225. * @param {string} key The key of the value to get.
  19226. * @returns {*} Returns the entry value.
  19227. */
  19228. function stackGet(key) {
  19229. return this.__data__.get(key);
  19230. }
  19231. /**
  19232. * Checks if a stack value for `key` exists.
  19233. *
  19234. * @private
  19235. * @name has
  19236. * @memberOf Stack
  19237. * @param {string} key The key of the entry to check.
  19238. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19239. */
  19240. function stackHas(key) {
  19241. return this.__data__.has(key);
  19242. }
  19243. /**
  19244. * Sets the stack `key` to `value`.
  19245. *
  19246. * @private
  19247. * @name set
  19248. * @memberOf Stack
  19249. * @param {string} key The key of the value to set.
  19250. * @param {*} value The value to set.
  19251. * @returns {Object} Returns the stack cache instance.
  19252. */
  19253. function stackSet(key, value) {
  19254. var data = this.__data__;
  19255. if (data instanceof ListCache) {
  19256. var pairs = data.__data__;
  19257. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  19258. pairs.push([key, value]);
  19259. this.size = ++data.size;
  19260. return this;
  19261. }
  19262. data = this.__data__ = new MapCache(pairs);
  19263. }
  19264. data.set(key, value);
  19265. this.size = data.size;
  19266. return this;
  19267. }
  19268. // Add methods to `Stack`.
  19269. Stack.prototype.clear = stackClear;
  19270. Stack.prototype['delete'] = stackDelete;
  19271. Stack.prototype.get = stackGet;
  19272. Stack.prototype.has = stackHas;
  19273. Stack.prototype.set = stackSet;
  19274. /**
  19275. * Creates an array of the enumerable property names of the array-like `value`.
  19276. *
  19277. * @private
  19278. * @param {*} value The value to query.
  19279. * @param {boolean} inherited Specify returning inherited property names.
  19280. * @returns {Array} Returns the array of property names.
  19281. */
  19282. function arrayLikeKeys(value, inherited) {
  19283. var isArr = isArray(value),
  19284. isArg = !isArr && isArguments(value),
  19285. isBuff = !isArr && !isArg && isBuffer(value),
  19286. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  19287. skipIndexes = isArr || isArg || isBuff || isType,
  19288. result = skipIndexes ? baseTimes(value.length, String) : [],
  19289. length = result.length;
  19290. for (var key in value) {
  19291. if ((inherited || hasOwnProperty.call(value, key)) &&
  19292. !(skipIndexes && (
  19293. // Safari 9 has enumerable `arguments.length` in strict mode.
  19294. key == 'length' ||
  19295. // Node.js 0.10 has enumerable non-index properties on buffers.
  19296. (isBuff && (key == 'offset' || key == 'parent')) ||
  19297. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  19298. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  19299. // Skip index properties.
  19300. isIndex(key, length)
  19301. ))) {
  19302. result.push(key);
  19303. }
  19304. }
  19305. return result;
  19306. }
  19307. /**
  19308. * Gets the index at which the `key` is found in `array` of key-value pairs.
  19309. *
  19310. * @private
  19311. * @param {Array} array The array to inspect.
  19312. * @param {*} key The key to search for.
  19313. * @returns {number} Returns the index of the matched value, else `-1`.
  19314. */
  19315. function assocIndexOf(array, key) {
  19316. var length = array.length;
  19317. while (length--) {
  19318. if (eq(array[length][0], key)) {
  19319. return length;
  19320. }
  19321. }
  19322. return -1;
  19323. }
  19324. /**
  19325. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  19326. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  19327. * symbols of `object`.
  19328. *
  19329. * @private
  19330. * @param {Object} object The object to query.
  19331. * @param {Function} keysFunc The function to get the keys of `object`.
  19332. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  19333. * @returns {Array} Returns the array of property names and symbols.
  19334. */
  19335. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  19336. var result = keysFunc(object);
  19337. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  19338. }
  19339. /**
  19340. * The base implementation of `getTag` without fallbacks for buggy environments.
  19341. *
  19342. * @private
  19343. * @param {*} value The value to query.
  19344. * @returns {string} Returns the `toStringTag`.
  19345. */
  19346. function baseGetTag(value) {
  19347. if (value == null) {
  19348. return value === undefined ? undefinedTag : nullTag;
  19349. }
  19350. return (symToStringTag && symToStringTag in Object(value))
  19351. ? getRawTag(value)
  19352. : objectToString(value);
  19353. }
  19354. /**
  19355. * The base implementation of `_.isArguments`.
  19356. *
  19357. * @private
  19358. * @param {*} value The value to check.
  19359. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  19360. */
  19361. function baseIsArguments(value) {
  19362. return isObjectLike(value) && baseGetTag(value) == argsTag;
  19363. }
  19364. /**
  19365. * The base implementation of `_.isEqual` which supports partial comparisons
  19366. * and tracks traversed objects.
  19367. *
  19368. * @private
  19369. * @param {*} value The value to compare.
  19370. * @param {*} other The other value to compare.
  19371. * @param {boolean} bitmask The bitmask flags.
  19372. * 1 - Unordered comparison
  19373. * 2 - Partial comparison
  19374. * @param {Function} [customizer] The function to customize comparisons.
  19375. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  19376. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  19377. */
  19378. function baseIsEqual(value, other, bitmask, customizer, stack) {
  19379. if (value === other) {
  19380. return true;
  19381. }
  19382. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  19383. return value !== value && other !== other;
  19384. }
  19385. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  19386. }
  19387. /**
  19388. * A specialized version of `baseIsEqual` for arrays and objects which performs
  19389. * deep comparisons and tracks traversed objects enabling objects with circular
  19390. * references to be compared.
  19391. *
  19392. * @private
  19393. * @param {Object} object The object to compare.
  19394. * @param {Object} other The other object to compare.
  19395. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19396. * @param {Function} customizer The function to customize comparisons.
  19397. * @param {Function} equalFunc The function to determine equivalents of values.
  19398. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  19399. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19400. */
  19401. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  19402. var objIsArr = isArray(object),
  19403. othIsArr = isArray(other),
  19404. objTag = objIsArr ? arrayTag : getTag(object),
  19405. othTag = othIsArr ? arrayTag : getTag(other);
  19406. objTag = objTag == argsTag ? objectTag : objTag;
  19407. othTag = othTag == argsTag ? objectTag : othTag;
  19408. var objIsObj = objTag == objectTag,
  19409. othIsObj = othTag == objectTag,
  19410. isSameTag = objTag == othTag;
  19411. if (isSameTag && isBuffer(object)) {
  19412. if (!isBuffer(other)) {
  19413. return false;
  19414. }
  19415. objIsArr = true;
  19416. objIsObj = false;
  19417. }
  19418. if (isSameTag && !objIsObj) {
  19419. stack || (stack = new Stack);
  19420. return (objIsArr || isTypedArray(object))
  19421. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  19422. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  19423. }
  19424. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  19425. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  19426. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  19427. if (objIsWrapped || othIsWrapped) {
  19428. var objUnwrapped = objIsWrapped ? object.value() : object,
  19429. othUnwrapped = othIsWrapped ? other.value() : other;
  19430. stack || (stack = new Stack);
  19431. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  19432. }
  19433. }
  19434. if (!isSameTag) {
  19435. return false;
  19436. }
  19437. stack || (stack = new Stack);
  19438. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  19439. }
  19440. /**
  19441. * The base implementation of `_.isNative` without bad shim checks.
  19442. *
  19443. * @private
  19444. * @param {*} value The value to check.
  19445. * @returns {boolean} Returns `true` if `value` is a native function,
  19446. * else `false`.
  19447. */
  19448. function baseIsNative(value) {
  19449. if (!isObject(value) || isMasked(value)) {
  19450. return false;
  19451. }
  19452. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  19453. return pattern.test(toSource(value));
  19454. }
  19455. /**
  19456. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  19457. *
  19458. * @private
  19459. * @param {*} value The value to check.
  19460. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  19461. */
  19462. function baseIsTypedArray(value) {
  19463. return isObjectLike(value) &&
  19464. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  19465. }
  19466. /**
  19467. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  19468. *
  19469. * @private
  19470. * @param {Object} object The object to query.
  19471. * @returns {Array} Returns the array of property names.
  19472. */
  19473. function baseKeys(object) {
  19474. if (!isPrototype(object)) {
  19475. return nativeKeys(object);
  19476. }
  19477. var result = [];
  19478. for (var key in Object(object)) {
  19479. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  19480. result.push(key);
  19481. }
  19482. }
  19483. return result;
  19484. }
  19485. /**
  19486. * A specialized version of `baseIsEqualDeep` for arrays with support for
  19487. * partial deep comparisons.
  19488. *
  19489. * @private
  19490. * @param {Array} array The array to compare.
  19491. * @param {Array} other The other array to compare.
  19492. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19493. * @param {Function} customizer The function to customize comparisons.
  19494. * @param {Function} equalFunc The function to determine equivalents of values.
  19495. * @param {Object} stack Tracks traversed `array` and `other` objects.
  19496. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  19497. */
  19498. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  19499. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  19500. arrLength = array.length,
  19501. othLength = other.length;
  19502. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  19503. return false;
  19504. }
  19505. // Assume cyclic values are equal.
  19506. var stacked = stack.get(array);
  19507. if (stacked && stack.get(other)) {
  19508. return stacked == other;
  19509. }
  19510. var index = -1,
  19511. result = true,
  19512. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  19513. stack.set(array, other);
  19514. stack.set(other, array);
  19515. // Ignore non-index properties.
  19516. while (++index < arrLength) {
  19517. var arrValue = array[index],
  19518. othValue = other[index];
  19519. if (customizer) {
  19520. var compared = isPartial
  19521. ? customizer(othValue, arrValue, index, other, array, stack)
  19522. : customizer(arrValue, othValue, index, array, other, stack);
  19523. }
  19524. if (compared !== undefined) {
  19525. if (compared) {
  19526. continue;
  19527. }
  19528. result = false;
  19529. break;
  19530. }
  19531. // Recursively compare arrays (susceptible to call stack limits).
  19532. if (seen) {
  19533. if (!arraySome(other, function(othValue, othIndex) {
  19534. if (!cacheHas(seen, othIndex) &&
  19535. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  19536. return seen.push(othIndex);
  19537. }
  19538. })) {
  19539. result = false;
  19540. break;
  19541. }
  19542. } else if (!(
  19543. arrValue === othValue ||
  19544. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  19545. )) {
  19546. result = false;
  19547. break;
  19548. }
  19549. }
  19550. stack['delete'](array);
  19551. stack['delete'](other);
  19552. return result;
  19553. }
  19554. /**
  19555. * A specialized version of `baseIsEqualDeep` for comparing objects of
  19556. * the same `toStringTag`.
  19557. *
  19558. * **Note:** This function only supports comparing values with tags of
  19559. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  19560. *
  19561. * @private
  19562. * @param {Object} object The object to compare.
  19563. * @param {Object} other The other object to compare.
  19564. * @param {string} tag The `toStringTag` of the objects to compare.
  19565. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19566. * @param {Function} customizer The function to customize comparisons.
  19567. * @param {Function} equalFunc The function to determine equivalents of values.
  19568. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19569. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19570. */
  19571. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  19572. switch (tag) {
  19573. case dataViewTag:
  19574. if ((object.byteLength != other.byteLength) ||
  19575. (object.byteOffset != other.byteOffset)) {
  19576. return false;
  19577. }
  19578. object = object.buffer;
  19579. other = other.buffer;
  19580. case arrayBufferTag:
  19581. if ((object.byteLength != other.byteLength) ||
  19582. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  19583. return false;
  19584. }
  19585. return true;
  19586. case boolTag:
  19587. case dateTag:
  19588. case numberTag:
  19589. // Coerce booleans to `1` or `0` and dates to milliseconds.
  19590. // Invalid dates are coerced to `NaN`.
  19591. return eq(+object, +other);
  19592. case errorTag:
  19593. return object.name == other.name && object.message == other.message;
  19594. case regexpTag:
  19595. case stringTag:
  19596. // Coerce regexes to strings and treat strings, primitives and objects,
  19597. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  19598. // for more details.
  19599. return object == (other + '');
  19600. case mapTag:
  19601. var convert = mapToArray;
  19602. case setTag:
  19603. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  19604. convert || (convert = setToArray);
  19605. if (object.size != other.size && !isPartial) {
  19606. return false;
  19607. }
  19608. // Assume cyclic values are equal.
  19609. var stacked = stack.get(object);
  19610. if (stacked) {
  19611. return stacked == other;
  19612. }
  19613. bitmask |= COMPARE_UNORDERED_FLAG;
  19614. // Recursively compare objects (susceptible to call stack limits).
  19615. stack.set(object, other);
  19616. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  19617. stack['delete'](object);
  19618. return result;
  19619. case symbolTag:
  19620. if (symbolValueOf) {
  19621. return symbolValueOf.call(object) == symbolValueOf.call(other);
  19622. }
  19623. }
  19624. return false;
  19625. }
  19626. /**
  19627. * A specialized version of `baseIsEqualDeep` for objects with support for
  19628. * partial deep comparisons.
  19629. *
  19630. * @private
  19631. * @param {Object} object The object to compare.
  19632. * @param {Object} other The other object to compare.
  19633. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  19634. * @param {Function} customizer The function to customize comparisons.
  19635. * @param {Function} equalFunc The function to determine equivalents of values.
  19636. * @param {Object} stack Tracks traversed `object` and `other` objects.
  19637. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  19638. */
  19639. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  19640. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  19641. objProps = getAllKeys(object),
  19642. objLength = objProps.length,
  19643. othProps = getAllKeys(other),
  19644. othLength = othProps.length;
  19645. if (objLength != othLength && !isPartial) {
  19646. return false;
  19647. }
  19648. var index = objLength;
  19649. while (index--) {
  19650. var key = objProps[index];
  19651. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  19652. return false;
  19653. }
  19654. }
  19655. // Assume cyclic values are equal.
  19656. var stacked = stack.get(object);
  19657. if (stacked && stack.get(other)) {
  19658. return stacked == other;
  19659. }
  19660. var result = true;
  19661. stack.set(object, other);
  19662. stack.set(other, object);
  19663. var skipCtor = isPartial;
  19664. while (++index < objLength) {
  19665. key = objProps[index];
  19666. var objValue = object[key],
  19667. othValue = other[key];
  19668. if (customizer) {
  19669. var compared = isPartial
  19670. ? customizer(othValue, objValue, key, other, object, stack)
  19671. : customizer(objValue, othValue, key, object, other, stack);
  19672. }
  19673. // Recursively compare objects (susceptible to call stack limits).
  19674. if (!(compared === undefined
  19675. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  19676. : compared
  19677. )) {
  19678. result = false;
  19679. break;
  19680. }
  19681. skipCtor || (skipCtor = key == 'constructor');
  19682. }
  19683. if (result && !skipCtor) {
  19684. var objCtor = object.constructor,
  19685. othCtor = other.constructor;
  19686. // Non `Object` object instances with different constructors are not equal.
  19687. if (objCtor != othCtor &&
  19688. ('constructor' in object && 'constructor' in other) &&
  19689. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  19690. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  19691. result = false;
  19692. }
  19693. }
  19694. stack['delete'](object);
  19695. stack['delete'](other);
  19696. return result;
  19697. }
  19698. /**
  19699. * Creates an array of own enumerable property names and symbols of `object`.
  19700. *
  19701. * @private
  19702. * @param {Object} object The object to query.
  19703. * @returns {Array} Returns the array of property names and symbols.
  19704. */
  19705. function getAllKeys(object) {
  19706. return baseGetAllKeys(object, keys, getSymbols);
  19707. }
  19708. /**
  19709. * Gets the data for `map`.
  19710. *
  19711. * @private
  19712. * @param {Object} map The map to query.
  19713. * @param {string} key The reference key.
  19714. * @returns {*} Returns the map data.
  19715. */
  19716. function getMapData(map, key) {
  19717. var data = map.__data__;
  19718. return isKeyable(key)
  19719. ? data[typeof key == 'string' ? 'string' : 'hash']
  19720. : data.map;
  19721. }
  19722. /**
  19723. * Gets the native function at `key` of `object`.
  19724. *
  19725. * @private
  19726. * @param {Object} object The object to query.
  19727. * @param {string} key The key of the method to get.
  19728. * @returns {*} Returns the function if it's native, else `undefined`.
  19729. */
  19730. function getNative(object, key) {
  19731. var value = getValue(object, key);
  19732. return baseIsNative(value) ? value : undefined;
  19733. }
  19734. /**
  19735. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  19736. *
  19737. * @private
  19738. * @param {*} value The value to query.
  19739. * @returns {string} Returns the raw `toStringTag`.
  19740. */
  19741. function getRawTag(value) {
  19742. var isOwn = hasOwnProperty.call(value, symToStringTag),
  19743. tag = value[symToStringTag];
  19744. try {
  19745. value[symToStringTag] = undefined;
  19746. var unmasked = true;
  19747. } catch (e) {}
  19748. var result = nativeObjectToString.call(value);
  19749. if (unmasked) {
  19750. if (isOwn) {
  19751. value[symToStringTag] = tag;
  19752. } else {
  19753. delete value[symToStringTag];
  19754. }
  19755. }
  19756. return result;
  19757. }
  19758. /**
  19759. * Creates an array of the own enumerable symbols of `object`.
  19760. *
  19761. * @private
  19762. * @param {Object} object The object to query.
  19763. * @returns {Array} Returns the array of symbols.
  19764. */
  19765. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  19766. if (object == null) {
  19767. return [];
  19768. }
  19769. object = Object(object);
  19770. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  19771. return propertyIsEnumerable.call(object, symbol);
  19772. });
  19773. };
  19774. /**
  19775. * Gets the `toStringTag` of `value`.
  19776. *
  19777. * @private
  19778. * @param {*} value The value to query.
  19779. * @returns {string} Returns the `toStringTag`.
  19780. */
  19781. var getTag = baseGetTag;
  19782. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  19783. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  19784. (Map && getTag(new Map) != mapTag) ||
  19785. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  19786. (Set && getTag(new Set) != setTag) ||
  19787. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  19788. getTag = function(value) {
  19789. var result = baseGetTag(value),
  19790. Ctor = result == objectTag ? value.constructor : undefined,
  19791. ctorString = Ctor ? toSource(Ctor) : '';
  19792. if (ctorString) {
  19793. switch (ctorString) {
  19794. case dataViewCtorString: return dataViewTag;
  19795. case mapCtorString: return mapTag;
  19796. case promiseCtorString: return promiseTag;
  19797. case setCtorString: return setTag;
  19798. case weakMapCtorString: return weakMapTag;
  19799. }
  19800. }
  19801. return result;
  19802. };
  19803. }
  19804. /**
  19805. * Checks if `value` is a valid array-like index.
  19806. *
  19807. * @private
  19808. * @param {*} value The value to check.
  19809. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  19810. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  19811. */
  19812. function isIndex(value, length) {
  19813. length = length == null ? MAX_SAFE_INTEGER : length;
  19814. return !!length &&
  19815. (typeof value == 'number' || reIsUint.test(value)) &&
  19816. (value > -1 && value % 1 == 0 && value < length);
  19817. }
  19818. /**
  19819. * Checks if `value` is suitable for use as unique object key.
  19820. *
  19821. * @private
  19822. * @param {*} value The value to check.
  19823. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  19824. */
  19825. function isKeyable(value) {
  19826. var type = typeof value;
  19827. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  19828. ? (value !== '__proto__')
  19829. : (value === null);
  19830. }
  19831. /**
  19832. * Checks if `func` has its source masked.
  19833. *
  19834. * @private
  19835. * @param {Function} func The function to check.
  19836. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  19837. */
  19838. function isMasked(func) {
  19839. return !!maskSrcKey && (maskSrcKey in func);
  19840. }
  19841. /**
  19842. * Checks if `value` is likely a prototype object.
  19843. *
  19844. * @private
  19845. * @param {*} value The value to check.
  19846. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  19847. */
  19848. function isPrototype(value) {
  19849. var Ctor = value && value.constructor,
  19850. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  19851. return value === proto;
  19852. }
  19853. /**
  19854. * Converts `value` to a string using `Object.prototype.toString`.
  19855. *
  19856. * @private
  19857. * @param {*} value The value to convert.
  19858. * @returns {string} Returns the converted string.
  19859. */
  19860. function objectToString(value) {
  19861. return nativeObjectToString.call(value);
  19862. }
  19863. /**
  19864. * Converts `func` to its source code.
  19865. *
  19866. * @private
  19867. * @param {Function} func The function to convert.
  19868. * @returns {string} Returns the source code.
  19869. */
  19870. function toSource(func) {
  19871. if (func != null) {
  19872. try {
  19873. return funcToString.call(func);
  19874. } catch (e) {}
  19875. try {
  19876. return (func + '');
  19877. } catch (e) {}
  19878. }
  19879. return '';
  19880. }
  19881. /**
  19882. * Performs a
  19883. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19884. * comparison between two values to determine if they are equivalent.
  19885. *
  19886. * @static
  19887. * @memberOf _
  19888. * @since 4.0.0
  19889. * @category Lang
  19890. * @param {*} value The value to compare.
  19891. * @param {*} other The other value to compare.
  19892. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  19893. * @example
  19894. *
  19895. * var object = { 'a': 1 };
  19896. * var other = { 'a': 1 };
  19897. *
  19898. * _.eq(object, object);
  19899. * // => true
  19900. *
  19901. * _.eq(object, other);
  19902. * // => false
  19903. *
  19904. * _.eq('a', 'a');
  19905. * // => true
  19906. *
  19907. * _.eq('a', Object('a'));
  19908. * // => false
  19909. *
  19910. * _.eq(NaN, NaN);
  19911. * // => true
  19912. */
  19913. function eq(value, other) {
  19914. return value === other || (value !== value && other !== other);
  19915. }
  19916. /**
  19917. * Checks if `value` is likely an `arguments` object.
  19918. *
  19919. * @static
  19920. * @memberOf _
  19921. * @since 0.1.0
  19922. * @category Lang
  19923. * @param {*} value The value to check.
  19924. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  19925. * else `false`.
  19926. * @example
  19927. *
  19928. * _.isArguments(function() { return arguments; }());
  19929. * // => true
  19930. *
  19931. * _.isArguments([1, 2, 3]);
  19932. * // => false
  19933. */
  19934. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  19935. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  19936. !propertyIsEnumerable.call(value, 'callee');
  19937. };
  19938. /**
  19939. * Checks if `value` is classified as an `Array` object.
  19940. *
  19941. * @static
  19942. * @memberOf _
  19943. * @since 0.1.0
  19944. * @category Lang
  19945. * @param {*} value The value to check.
  19946. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  19947. * @example
  19948. *
  19949. * _.isArray([1, 2, 3]);
  19950. * // => true
  19951. *
  19952. * _.isArray(document.body.children);
  19953. * // => false
  19954. *
  19955. * _.isArray('abc');
  19956. * // => false
  19957. *
  19958. * _.isArray(_.noop);
  19959. * // => false
  19960. */
  19961. var isArray = Array.isArray;
  19962. /**
  19963. * Checks if `value` is array-like. A value is considered array-like if it's
  19964. * not a function and has a `value.length` that's an integer greater than or
  19965. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  19966. *
  19967. * @static
  19968. * @memberOf _
  19969. * @since 4.0.0
  19970. * @category Lang
  19971. * @param {*} value The value to check.
  19972. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  19973. * @example
  19974. *
  19975. * _.isArrayLike([1, 2, 3]);
  19976. * // => true
  19977. *
  19978. * _.isArrayLike(document.body.children);
  19979. * // => true
  19980. *
  19981. * _.isArrayLike('abc');
  19982. * // => true
  19983. *
  19984. * _.isArrayLike(_.noop);
  19985. * // => false
  19986. */
  19987. function isArrayLike(value) {
  19988. return value != null && isLength(value.length) && !isFunction(value);
  19989. }
  19990. /**
  19991. * Checks if `value` is a buffer.
  19992. *
  19993. * @static
  19994. * @memberOf _
  19995. * @since 4.3.0
  19996. * @category Lang
  19997. * @param {*} value The value to check.
  19998. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  19999. * @example
  20000. *
  20001. * _.isBuffer(new Buffer(2));
  20002. * // => true
  20003. *
  20004. * _.isBuffer(new Uint8Array(2));
  20005. * // => false
  20006. */
  20007. var isBuffer = nativeIsBuffer || stubFalse;
  20008. /**
  20009. * Performs a deep comparison between two values to determine if they are
  20010. * equivalent.
  20011. *
  20012. * **Note:** This method supports comparing arrays, array buffers, booleans,
  20013. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  20014. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  20015. * by their own, not inherited, enumerable properties. Functions and DOM
  20016. * nodes are compared by strict equality, i.e. `===`.
  20017. *
  20018. * @static
  20019. * @memberOf _
  20020. * @since 0.1.0
  20021. * @category Lang
  20022. * @param {*} value The value to compare.
  20023. * @param {*} other The other value to compare.
  20024. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  20025. * @example
  20026. *
  20027. * var object = { 'a': 1 };
  20028. * var other = { 'a': 1 };
  20029. *
  20030. * _.isEqual(object, other);
  20031. * // => true
  20032. *
  20033. * object === other;
  20034. * // => false
  20035. */
  20036. function isEqual(value, other) {
  20037. return baseIsEqual(value, other);
  20038. }
  20039. /**
  20040. * Checks if `value` is classified as a `Function` object.
  20041. *
  20042. * @static
  20043. * @memberOf _
  20044. * @since 0.1.0
  20045. * @category Lang
  20046. * @param {*} value The value to check.
  20047. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  20048. * @example
  20049. *
  20050. * _.isFunction(_);
  20051. * // => true
  20052. *
  20053. * _.isFunction(/abc/);
  20054. * // => false
  20055. */
  20056. function isFunction(value) {
  20057. if (!isObject(value)) {
  20058. return false;
  20059. }
  20060. // The use of `Object#toString` avoids issues with the `typeof` operator
  20061. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  20062. var tag = baseGetTag(value);
  20063. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  20064. }
  20065. /**
  20066. * Checks if `value` is a valid array-like length.
  20067. *
  20068. * **Note:** This method is loosely based on
  20069. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  20070. *
  20071. * @static
  20072. * @memberOf _
  20073. * @since 4.0.0
  20074. * @category Lang
  20075. * @param {*} value The value to check.
  20076. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  20077. * @example
  20078. *
  20079. * _.isLength(3);
  20080. * // => true
  20081. *
  20082. * _.isLength(Number.MIN_VALUE);
  20083. * // => false
  20084. *
  20085. * _.isLength(Infinity);
  20086. * // => false
  20087. *
  20088. * _.isLength('3');
  20089. * // => false
  20090. */
  20091. function isLength(value) {
  20092. return typeof value == 'number' &&
  20093. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  20094. }
  20095. /**
  20096. * Checks if `value` is the
  20097. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  20098. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  20099. *
  20100. * @static
  20101. * @memberOf _
  20102. * @since 0.1.0
  20103. * @category Lang
  20104. * @param {*} value The value to check.
  20105. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  20106. * @example
  20107. *
  20108. * _.isObject({});
  20109. * // => true
  20110. *
  20111. * _.isObject([1, 2, 3]);
  20112. * // => true
  20113. *
  20114. * _.isObject(_.noop);
  20115. * // => true
  20116. *
  20117. * _.isObject(null);
  20118. * // => false
  20119. */
  20120. function isObject(value) {
  20121. var type = typeof value;
  20122. return value != null && (type == 'object' || type == 'function');
  20123. }
  20124. /**
  20125. * Checks if `value` is object-like. A value is object-like if it's not `null`
  20126. * and has a `typeof` result of "object".
  20127. *
  20128. * @static
  20129. * @memberOf _
  20130. * @since 4.0.0
  20131. * @category Lang
  20132. * @param {*} value The value to check.
  20133. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  20134. * @example
  20135. *
  20136. * _.isObjectLike({});
  20137. * // => true
  20138. *
  20139. * _.isObjectLike([1, 2, 3]);
  20140. * // => true
  20141. *
  20142. * _.isObjectLike(_.noop);
  20143. * // => false
  20144. *
  20145. * _.isObjectLike(null);
  20146. * // => false
  20147. */
  20148. function isObjectLike(value) {
  20149. return value != null && typeof value == 'object';
  20150. }
  20151. /**
  20152. * Checks if `value` is classified as a typed array.
  20153. *
  20154. * @static
  20155. * @memberOf _
  20156. * @since 3.0.0
  20157. * @category Lang
  20158. * @param {*} value The value to check.
  20159. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  20160. * @example
  20161. *
  20162. * _.isTypedArray(new Uint8Array);
  20163. * // => true
  20164. *
  20165. * _.isTypedArray([]);
  20166. * // => false
  20167. */
  20168. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  20169. /**
  20170. * Creates an array of the own enumerable property names of `object`.
  20171. *
  20172. * **Note:** Non-object values are coerced to objects. See the
  20173. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  20174. * for more details.
  20175. *
  20176. * @static
  20177. * @since 0.1.0
  20178. * @memberOf _
  20179. * @category Object
  20180. * @param {Object} object The object to query.
  20181. * @returns {Array} Returns the array of property names.
  20182. * @example
  20183. *
  20184. * function Foo() {
  20185. * this.a = 1;
  20186. * this.b = 2;
  20187. * }
  20188. *
  20189. * Foo.prototype.c = 3;
  20190. *
  20191. * _.keys(new Foo);
  20192. * // => ['a', 'b'] (iteration order is not guaranteed)
  20193. *
  20194. * _.keys('hi');
  20195. * // => ['0', '1']
  20196. */
  20197. function keys(object) {
  20198. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  20199. }
  20200. /**
  20201. * This method returns a new empty array.
  20202. *
  20203. * @static
  20204. * @memberOf _
  20205. * @since 4.13.0
  20206. * @category Util
  20207. * @returns {Array} Returns the new empty array.
  20208. * @example
  20209. *
  20210. * var arrays = _.times(2, _.stubArray);
  20211. *
  20212. * console.log(arrays);
  20213. * // => [[], []]
  20214. *
  20215. * console.log(arrays[0] === arrays[1]);
  20216. * // => false
  20217. */
  20218. function stubArray() {
  20219. return [];
  20220. }
  20221. /**
  20222. * This method returns `false`.
  20223. *
  20224. * @static
  20225. * @memberOf _
  20226. * @since 4.13.0
  20227. * @category Util
  20228. * @returns {boolean} Returns `false`.
  20229. * @example
  20230. *
  20231. * _.times(2, _.stubFalse);
  20232. * // => [false, false]
  20233. */
  20234. function stubFalse() {
  20235. return false;
  20236. }
  20237. module.exports = isEqual;
  20238. });
  20239. var dist$3 = createCommonjsModule$1(function (module, exports) {
  20240. !function(t,e){module.exports=e(dist$6,require$$2$1,require$$2,lodash_throttle,require$$1,require$$4,lodash_isequal);}(commonjsGlobal,(function(t,e,n,r,o,i,a){function l(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=l(r),c=l(o),s=l(a);t.i18nAddResources("en",{tableModule:{deleteCol:"Delete column",deleteRow:"Delete row",deleteTable:"Delete table",widthAuto:"Width auto",insertCol:"Insert column",insertRow:"Insert row",insertTable:"Insert table",header:"Header"}}),t.i18nAddResources("zh-CN",{tableModule:{deleteCol:"删除列",deleteRow:"删除行",deleteTable:"删除表格",widthAuto:"宽度自适应",insertCol:"插入列",insertRow:"插入行",insertTable:"插入表格",header:"表头"}});var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{};function d(t){var e={exports:{}};return t(e,e.exports),e.exports}var p,v,h=function(t){return t&&t.Math==Math&&t},g=h("object"==typeof globalThis&&globalThis)||h("object"==typeof window&&window)||h("object"==typeof self&&self)||h("object"==typeof f&&f)||function(){return this}()||Function("return this")(),y=function(t){try{return !!t()}catch(t){return !0}},m=!y((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),b=Function.prototype.call,E=b.bind?b.bind(b):function(){return b.apply(b,arguments)},w={}.propertyIsEnumerable,x=Object.getOwnPropertyDescriptor,S={f:x&&!w.call({1:2},1)?function(t){var e=x(this,t);return !!e&&e.enumerable}:w},T=function(t,e){return {enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},D=Function.prototype,N=D.bind,P=D.call,M=N&&N.bind(P),R=N?function(t){return t&&M(P,t)}:function(t){return t&&function(){return P.apply(t,arguments)}},O=R({}.toString),H=R("".slice),V=function(t){return H(O(t),8,-1)},z=g.Object,j=R("".split),L=y((function(){return !z("z").propertyIsEnumerable(0)}))?function(t){return "String"==V(t)?j(t,""):z(t)}:z,A=g.TypeError,C=function(t){if(null==t)throw A("Can't call method on "+t);return t},I=function(t){return L(C(t))},k=function(t){return "function"==typeof t},B=function(t){return "object"==typeof t?null!==t:k(t)},$=function(t){return k(t)?t:void 0},F=function(t,e){return arguments.length<2?$(g[t]):g[t]&&g[t][e]},q=R({}.isPrototypeOf),G=F("navigator","userAgent")||"",_=g.process,W=g.Deno,U=_&&_.versions||W&&W.version,X=U&&U.v8;X&&(v=(p=X.split("."))[0]>0&&p[0]<4?1:+(p[0]+p[1])),!v&&G&&(!(p=G.match(/Edge\/(\d+)/))||p[1]>=74)&&(p=G.match(/Chrome\/(\d+)/))&&(v=+p[1]);var Y=v,K=!!Object.getOwnPropertySymbols&&!y((function(){var t=Symbol();return !String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Y&&Y<41})),J=K&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Q=g.Object,Z=J?function(t){return "symbol"==typeof t}:function(t){var e=F("Symbol");return k(e)&&q(e.prototype,Q(t))},tt=g.String,et=function(t){try{return tt(t)}catch(t){return "Object"}},nt=g.TypeError,rt=function(t){if(k(t))return t;throw nt(et(t)+" is not a function")},ot=function(t,e){var n=t[e];return null==n?void 0:rt(n)},it=g.TypeError,at=Object.defineProperty,lt=function(t,e){try{at(g,t,{value:e,configurable:!0,writable:!0});}catch(n){g[t]=e;}return e},ut="__core-js_shared__",ct=g[ut]||lt(ut,{}),st=d((function(t){(t.exports=function(t,e){return ct[t]||(ct[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});})),ft=g.Object,dt=function(t){return ft(C(t))},pt=R({}.hasOwnProperty),vt=Object.hasOwn||function(t,e){return pt(dt(t),e)},ht=0,gt=Math.random(),yt=R(1..toString),mt=function(t){return "Symbol("+(void 0===t?"":t)+")_"+yt(++ht+gt,36)},bt=st("wks"),Et=g.Symbol,wt=Et&&Et.for,xt=J?Et:Et&&Et.withoutSetter||mt,St=function(t){if(!vt(bt,t)||!K&&"string"!=typeof bt[t]){var e="Symbol."+t;K&&vt(Et,t)?bt[t]=Et[t]:bt[t]=J&&wt?wt(e):xt(e);}return bt[t]},Tt=g.TypeError,Dt=St("toPrimitive"),Nt=function(t,e){if(!B(t)||Z(t))return t;var n,r=ot(t,Dt);if(r){if(void 0===e&&(e="default"),n=E(r,t,e),!B(n)||Z(n))return n;throw Tt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,r;if("string"===e&&k(n=t.toString)&&!B(r=E(n,t)))return r;if(k(n=t.valueOf)&&!B(r=E(n,t)))return r;if("string"!==e&&k(n=t.toString)&&!B(r=E(n,t)))return r;throw it("Can't convert object to primitive value")}(t,e)},Pt=function(t){var e=Nt(t,"string");return Z(e)?e:e+""},Mt=g.document,Rt=B(Mt)&&B(Mt.createElement),Ot=function(t){return Rt?Mt.createElement(t):{}},Ht=!m&&!y((function(){return 7!=Object.defineProperty(Ot("div"),"a",{get:function(){return 7}}).a})),Vt=Object.getOwnPropertyDescriptor,zt={f:m?Vt:function(t,e){if(t=I(t),e=Pt(e),Ht)try{return Vt(t,e)}catch(t){}if(vt(t,e))return T(!E(S.f,t,e),t[e])}},jt=g.String,Lt=g.TypeError,At=function(t){if(B(t))return t;throw Lt(jt(t)+" is not an object")},Ct=g.TypeError,It=Object.defineProperty,kt={f:m?It:function(t,e,n){if(At(t),e=Pt(e),At(n),Ht)try{return It(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Ct("Accessors not supported");return "value"in n&&(t[e]=n.value),t}},Bt=m?function(t,e,n){return kt.f(t,e,T(1,n))}:function(t,e,n){return t[e]=n,t},$t=R(Function.toString);k(ct.inspectSource)||(ct.inspectSource=function(t){return $t(t)});var Ft,qt,Gt,_t=ct.inspectSource,Wt=g.WeakMap,Ut=k(Wt)&&/native code/.test(_t(Wt)),Xt=st("keys"),Yt=function(t){return Xt[t]||(Xt[t]=mt(t))},Kt={},Jt="Object already initialized",Qt=g.TypeError,Zt=g.WeakMap;if(Ut||ct.state){var te=ct.state||(ct.state=new Zt),ee=R(te.get),ne=R(te.has),re=R(te.set);Ft=function(t,e){if(ne(te,t))throw new Qt(Jt);return e.facade=t,re(te,t,e),e},qt=function(t){return ee(te,t)||{}},Gt=function(t){return ne(te,t)};}else {var oe=Yt("state");Kt[oe]=!0,Ft=function(t,e){if(vt(t,oe))throw new Qt(Jt);return e.facade=t,Bt(t,oe,e),e},qt=function(t){return vt(t,oe)?t[oe]:{}},Gt=function(t){return vt(t,oe)};}var ie={set:Ft,get:qt,has:Gt,enforce:function(t){return Gt(t)?qt(t):Ft(t,{})},getterFor:function(t){return function(e){var n;if(!B(e)||(n=qt(e)).type!==t)throw Qt("Incompatible receiver, "+t+" required");return n}}},ae=Function.prototype,le=m&&Object.getOwnPropertyDescriptor,ue=vt(ae,"name"),ce={EXISTS:ue,PROPER:ue&&"something"===function(){}.name,CONFIGURABLE:ue&&(!m||m&&le(ae,"name").configurable)},se=d((function(t){var e=ce.CONFIGURABLE,n=ie.get,r=ie.enforce,o=String(String).split("String");(t.exports=function(t,n,i,a){var l,u=!!a&&!!a.unsafe,c=!!a&&!!a.enumerable,s=!!a&&!!a.noTargetGet,f=a&&void 0!==a.name?a.name:n;k(i)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!vt(i,"name")||e&&i.name!==f)&&Bt(i,"name",f),(l=r(i)).source||(l.source=o.join("string"==typeof f?f:""))),t!==g?(u?!s&&t[n]&&(c=!0):delete t[n],c?t[n]=i:Bt(t,n,i)):c?t[n]=i:lt(n,i);})(Function.prototype,"toString",(function(){return k(this)&&n(this).source||_t(this)}));})),fe=Math.ceil,de=Math.floor,pe=function(t){var e=+t;return e!=e||0===e?0:(e>0?de:fe)(e)},ve=Math.max,he=Math.min,ge=function(t,e){var n=pe(t);return n<0?ve(n+e,0):he(n,e)},ye=Math.min,me=function(t){return t>0?ye(pe(t),9007199254740991):0},be=function(t){return me(t.length)},Ee=function(t){return function(e,n,r){var o,i=I(e),a=be(i),l=ge(r,a);if(t&&n!=n){for(;a>l;)if((o=i[l++])!=o)return !0}else for(;a>l;l++)if((t||l in i)&&i[l]===n)return t||l||0;return !t&&-1}},we={includes:Ee(!0),indexOf:Ee(!1)}.indexOf,xe=R([].push),Se=function(t,e){var n,r=I(t),o=0,i=[];for(n in r)!vt(Kt,n)&&vt(r,n)&&xe(i,n);for(;e.length>o;)vt(r,n=e[o++])&&(~we(i,n)||xe(i,n));return i},Te=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],De=Te.concat("length","prototype"),Ne={f:Object.getOwnPropertyNames||function(t){return Se(t,De)}},Pe={f:Object.getOwnPropertySymbols},Me=R([].concat),Re=F("Reflect","ownKeys")||function(t){var e=Ne.f(At(t)),n=Pe.f;return n?Me(e,n(t)):e},Oe=function(t,e){for(var n=Re(e),r=kt.f,o=zt.f,i=0;i<n.length;i++){var a=n[i];vt(t,a)||r(t,a,o(e,a));}},He=/#|\.prototype\./,Ve=function(t,e){var n=je[ze(t)];return n==Ae||n!=Le&&(k(e)?y(e):!!e)},ze=Ve.normalize=function(t){return String(t).replace(He,".").toLowerCase()},je=Ve.data={},Le=Ve.NATIVE="N",Ae=Ve.POLYFILL="P",Ce=Ve,Ie=zt.f,ke=function(t,e){var n,r,o,i,a,l=t.target,u=t.global,c=t.stat;if(n=u?g:c?g[l]||lt(l,{}):(g[l]||{}).prototype)for(r in e){if(i=e[r],o=t.noTargetGet?(a=Ie(n,r))&&a.value:n[r],!Ce(u?r:l+(c?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;Oe(i,o);}(t.sham||o&&o.sham)&&Bt(i,"sham",!0),se(n,r,i,t);}},Be={};Be[St("toStringTag")]="z";var $e,Fe="[object z]"===String(Be),qe=St("toStringTag"),Ge=g.Object,_e="Arguments"==V(function(){return arguments}()),We=Fe?V:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ge(t),qe))?n:_e?V(e):"Object"==(r=V(e))&&k(e.callee)?"Arguments":r},Ue=g.String,Xe=function(t){if("Symbol"===We(t))throw TypeError("Cannot convert a Symbol value to a string");return Ue(t)},Ye=/"/g,Ke=R("".replace);ke({target:"String",proto:!0,forced:($e="anchor",y((function(){var t=""[$e]('"');return t!==t.toLowerCase()||t.split('"').length>3})))},{anchor:function(t){return e="a",n="name",r=t,o=Xe(C(this)),i="<"+e,""!==n&&(i+=" "+n+'="'+Ke(Xe(r),Ye,"&quot;")+'"'),i+">"+o+"</"+e+">";var e,n,r,o,i;}});var Je,Qe=function(){var t=At(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},Ze=g.RegExp,tn=y((function(){var t=Ze("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),en=tn||y((function(){return !Ze("a","y").sticky})),nn={BROKEN_CARET:tn||y((function(){var t=Ze("^r","gy");return t.lastIndex=2,null!=t.exec("str")})),MISSED_STICKY:en,UNSUPPORTED_Y:tn},rn=Object.keys||function(t){return Se(t,Te)},on=m?Object.defineProperties:function(t,e){At(t);for(var n,r=I(e),o=rn(e),i=o.length,a=0;i>a;)kt.f(t,n=o[a++],r[n]);return t},an=F("document","documentElement"),ln=Yt("IE_PROTO"),un=function(){},cn=function(t){return "<script>"+t+"</"+"script>"},sn=function(t){t.write(cn("")),t.close();var e=t.parentWindow.Object;return t=null,e},fn=function(){try{Je=new ActiveXObject("htmlfile");}catch(t){}var t,e;fn="undefined"!=typeof document?document.domain&&Je?sn(Je):((e=Ot("iframe")).style.display="none",an.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(cn("document.F=Object")),t.close(),t.F):sn(Je);for(var n=Te.length;n--;)delete fn.prototype[Te[n]];return fn()};Kt[ln]=!0;var dn,pn,vn=Object.create||function(t,e){var n;return null!==t?(un.prototype=At(t),n=new un,un.prototype=null,n[ln]=t):n=fn(),void 0===e?n:on(n,e)},hn=g.RegExp,gn=y((function(){var t=hn(".","s");return !(t.dotAll&&t.exec("\n")&&"s"===t.flags)})),yn=g.RegExp,mn=y((function(){var t=yn("(?<a>b)","g");return "b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})),bn=ie.get,En=st("native-string-replace",String.prototype.replace),wn=RegExp.prototype.exec,xn=wn,Sn=R("".charAt),Tn=R("".indexOf),Dn=R("".replace),Nn=R("".slice),Pn=(pn=/b*/g,E(wn,dn=/a/,"a"),E(wn,pn,"a"),0!==dn.lastIndex||0!==pn.lastIndex),Mn=nn.BROKEN_CARET,Rn=void 0!==/()??/.exec("")[1];(Pn||Rn||Mn||gn||mn)&&(xn=function(t){var e,n,r,o,i,a,l,u=this,c=bn(u),s=Xe(t),f=c.raw;if(f)return f.lastIndex=u.lastIndex,e=E(xn,f,s),u.lastIndex=f.lastIndex,e;var d=c.groups,p=Mn&&u.sticky,v=E(Qe,u),h=u.source,g=0,y=s;if(p&&(v=Dn(v,"y",""),-1===Tn(v,"g")&&(v+="g"),y=Nn(s,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==Sn(s,u.lastIndex-1))&&(h="(?: "+h+")",y=" "+y,g++),n=new RegExp("^(?:"+h+")",v)),Rn&&(n=new RegExp("^"+h+"$(?!\\s)",v)),Pn&&(r=u.lastIndex),o=E(wn,p?n:u,y),p?o?(o.input=Nn(o.input,g),o[0]=Nn(o[0],g),o.index=u.lastIndex,u.lastIndex+=o[0].length):u.lastIndex=0:Pn&&o&&(u.lastIndex=u.global?o.index+o[0].length:r),Rn&&o&&o.length>1&&E(En,o[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(o[i]=void 0);})),o&&d)for(o.groups=a=vn(null),i=0;i<d.length;i++)a[(l=d[i])[0]]=o[l[1]];return o});var On=xn;ke({target:"RegExp",proto:!0,forced:/./.exec!==On},{exec:On});var Hn=Array.isArray||function(t){return "Array"==V(t)},Vn=function(){},zn=[],jn=F("Reflect","construct"),Ln=/^\s*(?:class|function)\b/,An=R(Ln.exec),Cn=!Ln.exec(Vn),In=function(t){if(!k(t))return !1;try{return jn(Vn,zn,t),!0}catch(t){return !1}},kn=!jn||y((function(){var t;return In(In.call)||!In(Object)||!In((function(){t=!0;}))||t}))?function(t){if(!k(t))return !1;switch(We(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return !1}return Cn||!!An(Ln,_t(t))}:In,Bn=function(t,e,n){var r=Pt(e);r in t?kt.f(t,r,T(0,n)):t[r]=n;},$n=St("species"),Fn=function(t){return Y>=51||!y((function(){var e=[];return (e.constructor={})[$n]=function(){return {foo:1}},1!==e[t](Boolean).foo}))},qn=R([].slice),Gn=Fn("slice"),_n=St("species"),Wn=g.Array,Un=Math.max;function Xn(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value);}catch(t){o={error:t};}finally{try{r&&!r.done&&(n=i.return)&&n.call(i);}finally{if(o)throw o.error}}return a}function Yn(n){var r=n.selection;if(null==r)return !1;var o=Xn(e.Editor.nodes(n,{match:function(e){return t.DomEditor.checkNodeType(e,"table-cell")}}),1)[0];if(o){var i=Xn(o,2)[1],a=e.Editor.start(n,i);if(e.Point.equals(r.anchor,a))return !0}return !1}function Kn(n,r){var o,i,a=e.Editor.nodes(n,{at:r,match:function(e){return "table"===t.DomEditor.getNodeType(e)}}),l=!1;try{for(var u=
  20241. /*! *****************************************************************************
  20242. Copyright (c) Microsoft Corporation.
  20243. Permission to use, copy, modify, and/or distribute this software for any
  20244. purpose with or without fee is hereby granted.
  20245. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  20246. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  20247. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  20248. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  20249. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  20250. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  20251. PERFORMANCE OF THIS SOFTWARE.
  20252. ***************************************************************************** */
  20253. function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return {next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(a),c=u.next();!c.done;c=u.next()){c.value;l=!0;}}catch(t){o={error:t};}finally{try{c&&!c.done&&(i=u.return)&&i.call(u);}finally{if(o)throw o.error}}return l}ke({target:"Array",proto:!0,forced:!Gn},{slice:function(t,e){var n,r,o,i=I(this),a=be(i),l=ge(t,a),u=ge(void 0===e?a:e,a);if(Hn(i)&&(n=i.constructor,(kn(n)&&(n===Wn||Hn(n.prototype))||B(n)&&null===(n=n[_n]))&&(n=void 0),n===Wn||void 0===n))return qn(i,l,u);for(r=new(void 0===n?Wn:n)(Un(u-l,0)),o=0;l<u;l++,o++)l in i&&Bn(r,o,i[l]);return r.length=o,r}});var Jn=R(R.bind),Qn=St("species"),Zn=g.Array,tr=function(t,e){return new(function(t){var e;return Hn(t)&&(e=t.constructor,(kn(e)&&(e===Zn||Hn(e.prototype))||B(e)&&null===(e=e[Qn]))&&(e=void 0)),void 0===e?Zn:e}(t))(0===e?0:e)},er=R([].push),nr=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,a=7==t,l=5==t||i;return function(u,c,s,f){for(var d,p,v=dt(u),h=L(v),g=function(t,e){return rt(t),void 0===e?t:Jn?Jn(t,e):function(){return t.apply(e,arguments)}}(c,s),y=be(h),m=0,b=f||tr,E=e?b(u,y):n||a?b(u,0):void 0;y>m;m++)if((l||m in h)&&(p=g(d=h[m],m,v),t))if(e)E[m]=p;else if(p)switch(t){case 3:return !0;case 5:return d;case 6:return m;case 2:er(E,d);}else switch(t){case 4:return !1;case 7:er(E,d);}return i?-1:r||o?o:E}},rr={forEach:nr(0),map:nr(1),filter:nr(2),some:nr(3),every:nr(4),find:nr(5),findIndex:nr(6),filterReject:nr(7)},or=rr.map;ke({target:"Array",proto:!0,forced:!Fn("map")},{map:function(t){return or(this,t,arguments.length>1?arguments[1]:void 0)}});var ir=Fe?{}.toString:function(){return "[object "+We(this)+"]"};function ar(t){var e=t.children||[];return 0===e.length?[]:(e[0]||{}).children||[]}function lr(t){return ar(t).every((function(t){return !!t.isHeader}))}Fe||se(Object.prototype,"toString",ir,{unsafe:!0});var ur=ce.PROPER,cr="toString",sr=RegExp.prototype,fr=sr.toString,dr=R(Qe),pr=y((function(){return "/a/b"!=fr.call({source:"a",flags:"b"})})),vr=ur&&fr.name!=cr;(pr||vr)&&se(RegExp.prototype,cr,(function(){var t=At(this),e=Xe(t.source),n=t.flags;return "/"+e+"/"+Xe(void 0===n&&q(sr,t)&&!("flags"in sr)?dr(t):n)}),{unsafe:!0});var hr=St("unscopables"),gr=Array.prototype;null==gr[hr]&&kt.f(gr,hr,{configurable:!0,value:vn(null)});var yr,mr=rr.find,br="find",Er=!0;br in[]&&Array(1).find((function(){Er=!1;})),ke({target:"Array",proto:!0,forced:Er},{find:function(t){return mr(this,t,arguments.length>1?arguments[1]:void 0)}}),yr=br,gr[hr][yr]=!0;var wr=Function.prototype,xr=wr.apply,Sr=wr.bind,Tr=wr.call,Dr="object"==typeof Reflect&&Reflect.apply||(Sr?Tr.bind(xr):function(){return Tr.apply(xr,arguments)}),Nr=St("species"),Pr=RegExp.prototype,Mr=function(t,e,n,r){var o=St(t),i=!y((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),a=i&&!y((function(){var e=!1,n=/a/;return "split"===t&&((n={}).constructor={},n.constructor[Nr]=function(){return n},n.flags="",n[o]=/./[o]),n.exec=function(){return e=!0,null},n[o](""),!e}));if(!i||!a||n){var l=R(/./[o]),u=e(o,""[t],(function(t,e,n,r,o){var a=R(t),u=e.exec;return u===On||u===Pr.exec?i&&!o?{done:!0,value:l(e,n,r)}:{done:!0,value:a(n,e,r)}:{done:!1}}));se(String.prototype,t,u[0]),se(Pr,o,u[1]);}r&&Bt(Pr[o],"sham",!0);},Rr=St("match"),Or=g.TypeError,Hr=St("species"),Vr=function(t,e){var n,r=At(t).constructor;return void 0===r||null==(n=At(r)[Hr])?e:function(t){if(kn(t))return t;throw Or(et(t)+" is not a constructor")}(n)},zr=R("".charAt),jr=R("".charCodeAt),Lr=R("".slice),Ar=function(t){return function(e,n){var r,o,i=Xe(C(e)),a=pe(n),l=i.length;return a<0||a>=l?t?"":void 0:(r=jr(i,a))<55296||r>56319||a+1===l||(o=jr(i,a+1))<56320||o>57343?t?zr(i,a):r:t?Lr(i,a,a+2):o-56320+(r-55296<<10)+65536}},Cr={codeAt:Ar(!1),charAt:Ar(!0)}.charAt,Ir=function(t,e,n){return e+(n?Cr(t,e).length:1)},kr=g.Array,Br=Math.max,$r=function(t,e,n){for(var r=be(t),o=ge(e,r),i=ge(void 0===n?r:n,r),a=kr(Br(i-o,0)),l=0;o<i;o++,l++)Bn(a,l,t[o]);return a.length=l,a},Fr=g.TypeError,qr=function(t,e){var n=t.exec;if(k(n)){var r=E(n,t,e);return null!==r&&At(r),r}if("RegExp"===V(t))return E(On,t,e);throw Fr("RegExp#exec called on incompatible receiver")},Gr=nn.UNSUPPORTED_Y,_r=4294967295,Wr=Math.min,Ur=[].push,Xr=R(/./.exec),Yr=R(Ur),Kr=R("".slice),Jr=!y((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));Mr("split",(function(t,e,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,n){var r,o,i=Xe(C(this)),a=void 0===n?_r:n>>>0;if(0===a)return [];if(void 0===t)return [i];if(!B(r=t)||!(void 0!==(o=r[Rr])?o:"RegExp"==V(r)))return E(e,i,t,a);for(var l,u,c,s=[],f=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),d=0,p=new RegExp(t.source,f+"g");(l=E(On,p,i))&&!((u=p.lastIndex)>d&&(Yr(s,Kr(i,d,l.index)),l.length>1&&l.index<i.length&&Dr(Ur,s,$r(l,1)),c=l[0].length,d=u,s.length>=a));)p.lastIndex===l.index&&p.lastIndex++;return d===i.length?!c&&Xr(p,"")||Yr(s,""):Yr(s,Kr(i,d)),s.length>a?$r(s,0,a):s}:"0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:E(e,this,t,n)}:e,[function(e,n){var o=C(this),i=null==e?void 0:ot(e,t);return i?E(i,e,o,n):E(r,Xe(o),e,n)},function(t,o){var i=At(this),a=Xe(t),l=n(r,i,a,o,r!==e);if(l.done)return l.value;var u=Vr(i,RegExp),c=i.unicode,s=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(Gr?"g":"y"),f=new u(Gr?"^(?:"+i.source+")":i,s),d=void 0===o?_r:o>>>0;if(0===d)return [];if(0===a.length)return null===qr(f,a)?[a]:[];for(var p=0,v=0,h=[];v<a.length;){f.lastIndex=Gr?0:v;var g,y=qr(f,Gr?Kr(a,v):a);if(null===y||(g=Wr(me(f.lastIndex+(Gr?v:0)),a.length))===p)v=Ir(a,v,c);else {if(Yr(h,Kr(a,p,v)),h.length===d)return h;for(var m=1;m<=y.length-1;m++)if(Yr(h,y[m]),h.length===d)return h;v=p=g;}}return Yr(h,Kr(a,p)),h}]}),!Jr,Gr);var Qr="\t\n\v\f\r                \u2028\u2029\ufeff",Zr=R("".replace),to="["+Qr+"]",eo=RegExp("^"+to+to+"*"),no=RegExp(to+to+"*$"),ro=function(t){return function(e){var n=Xe(C(e));return 1&t&&(n=Zr(n,eo,"")),2&t&&(n=Zr(n,no,"")),n}},oo={start:ro(1),end:ro(2),trim:ro(3)},io=ce.PROPER,ao=oo.trim;function lo(t){return t.length?t[0].tagName.toLowerCase():""}ke({target:"String",proto:!0,forced:function(t){return y((function(){return !!Qr[t]()||"​…᠎"!=="​…᠎"[t]()||io&&Qr[t].name!==t}))}("trim")},{trim:function(){return ao(this)}}),ke({global:!0},{globalThis:g}),o.append&&(c.default.fn.append=o.append),o.on&&(c.default.fn.on=o.on),o.focus&&(c.default.fn.focus=o.focus),o.attr&&(c.default.fn.attr=o.attr),o.val&&(c.default.fn.val=o.val),o.html&&(c.default.fn.html=o.html),o.dataset&&(c.default.fn.dataset=o.dataset),o.addClass&&(c.default.fn.addClass=o.addClass),o.removeClass&&(c.default.fn.removeClass=o.removeClass),o.children&&(c.default.fn.children=o.children),o.each&&(c.default.fn.each=o.each),o.find&&(c.default.fn.find=o.find);var uo=!1,co=0,so=0,fo=null,po=null,vo=c.default("body");function ho(t){uo=!1,po=null,fo=null,vo.off("mousemove",go),vo.off("mouseup",ho);}vo.on("mousedown",(function(t){var e=t.target;if(("TH"===e.tagName||"TD"===e.tagName)&&"col-resize"===e.style.cursor){e.style.cursor="auto",t.preventDefault(),uo=!0;var n=t.clientX;co=n;var r=e.getBoundingClientRect().width;so=r,vo.on("mousemove",go),vo.on("mouseup",ho);}}));var go=u.default((function(t){if(uo&&null!=po&&null!=fo){t.preventDefault();var n=t.clientX,r=so+(n-co);(r=Math.floor(100*r)/100)<30&&(r=30),e.Transforms.setNodes(po,{width:r.toString()},{at:fo});}}),100);var yo={type:"table",renderElem:function(r,o,i){var a=function(n,r){if(n.isDisabled())return !1;var o=n.selection;if(null==o)return !0;if(e.Range.isCollapsed(o))return !0;var i=o.anchor,a=o.focus,l=t.DomEditor.findPath(n,r),u=e.Editor.start(n,l),c=e.Editor.end(n,l),s=e.Point.compare(i,c)<=0&&e.Point.compare(i,u)>=0,f=e.Point.compare(a,c)<=0&&e.Point.compare(a,u)>=0;return !!(s&&f&&e.Path.equals(i.path.slice(0,3),a.path.slice(0,3)))}(i,r),l=r.width,u=void 0===l?"auto":l,c=t.DomEditor.isNodeSelected(i,r),s=ar(r),f=n.jsx("div",{className:"table-container","data-selected":c,on:{mousedown:function(n){if("DIV"===n.target.tagName&&n.preventDefault(),!i.isDisabled()){var o=t.DomEditor.findPath(i,r),a=e.Editor.start(i,o),l=i.selection;if(null!=l)l.anchor.path[0]!==o[0]&&i.select(a);else i.select(a);}}}},n.jsx("table",{width:u,contentEditable:a},n.jsx("colgroup",null,s.map((function(t){var e=t.width,r=void 0===e?"auto":e;return n.jsx("col",{width:r})}))),n.jsx("tbody",null,o)));return f}},mo={type:"table-row",renderElem:function(t,e,r){return n.jsx("tr",null,e)}},bo={type:"table-cell",renderElem:function(e,r,o){var i=function(e,n){var r=t.DomEditor.getParentNode(e,n);if(null==r)return !1;var o=t.DomEditor.getParentNode(e,r);return null!=o&&ar(o).some((function(t){return t===n}))}(o,e),a=e,l=a.colSpan,c=void 0===l?1:l,s=a.rowSpan,f=void 0===s?1:s,d=a.isHeader,p=void 0!==d&&d;if(!i)return n.jsx("td",{colSpan:c,rowSpan:f},r);var v=p?"th":"td",h=n.jsx(v,{colSpan:c,rowSpan:f,style:{borderRightWidth:"3px"},on:{mousemove:u.default((function(n){var r=this.elm;if(null!=r){var i=r.getBoundingClientRect(),a=i.left,l=i.width,u=i.top,c=i.height,s=n.clientX,f=n.clientY;if(!uo)s>a+l-5&&s<a+l&&(f>u&&f<u+c)?(r.style.cursor="col-resize",po=o,fo=t.DomEditor.findPath(o,e)):uo||(r.style.cursor="auto",po=null,fo=null);}}),100)}},r);return h}};var Eo={type:"table",elemToHtml:function(t,e){var n=t.width;return '<table style="width: '+(void 0===n?"auto":n)+';"><tbody>'+e+"</tbody></table>"}},wo={type:"table-row",elemToHtml:function(t,e){return "<tr>"+e+"</tr>"}},xo={type:"table-cell",elemToHtml:function(t,e){var n=t,r=n.colSpan,o=void 0===r?1:r,i=n.rowSpan,a=void 0===i?1:i,l=n.isHeader,u=void 0!==l&&l,c=n.width,s=u?"th":"td";return "<"+s+' colSpan="'+o+'" rowSpan="'+a+'" width="'+(void 0===c?"auto":c)+'">'+e+"</"+s+">"}};var So={selector:"table",preParseHtml:function(t){var e=c.default(t);if("table"!==lo(e))return t;var n=e.find("tbody");if(0===n.length)return t;var r=e.find("tr");return e.append(r),n.remove(),e[0]}},To=rr.filter;ke({target:"Array",proto:!0,forced:!Fn("filter")},{filter:function(t){return To(this,t,arguments.length>1?arguments[1]:void 0)}});var Do=Math.floor,No=R("".charAt),Po=R("".replace),Mo=R("".slice),Ro=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Oo=/\$([$&'`]|\d{1,2})/g,Ho=function(t,e,n,r,o,i){var a=n+t.length,l=r.length,u=Oo;return void 0!==o&&(o=dt(o),u=Ro),Po(i,u,(function(i,u){var c;switch(No(u,0)){case"$":return "$";case"&":return t;case"`":return Mo(e,0,n);case"'":return Mo(e,a);case"<":c=o[Mo(u,1,-1)];break;default:var s=+u;if(0===s)return i;if(s>l){var f=Do(s/10);return 0===f?i:f<=l?void 0===r[f-1]?No(u,1):r[f-1]+No(u,1):i}c=r[s-1];}return void 0===c?"":c}))},Vo=St("replace"),zo=Math.max,jo=Math.min,Lo=R([].concat),Ao=R([].push),Co=R("".indexOf),Io=R("".slice),ko="$0"==="a".replace(/./,"$0"),Bo=!!/./[Vo]&&""===/./[Vo]("a","$0");Mr("replace",(function(t,e,n){var r=Bo?"$":"$0";return [function(t,n){var r=C(this),o=null==t?void 0:ot(t,Vo);return o?E(o,t,r,n):E(e,Xe(r),t,n)},function(t,o){var i=At(this),a=Xe(t);if("string"==typeof o&&-1===Co(o,r)&&-1===Co(o,"$<")){var l=n(e,i,a,o);if(l.done)return l.value}var u=k(o);u||(o=Xe(o));var c=i.global;if(c){var s=i.unicode;i.lastIndex=0;}for(var f=[];;){var d=qr(i,a);if(null===d)break;if(Ao(f,d),!c)break;""===Xe(d[0])&&(i.lastIndex=Ir(a,me(i.lastIndex),s));}for(var p,v="",h=0,g=0;g<f.length;g++){for(var y=Xe((d=f[g])[0]),m=zo(jo(pe(d.index),a.length),0),b=[],E=1;E<d.length;E++)Ao(b,void 0===(p=d[E])?p:String(p));var w=d.groups;if(u){var x=Lo([y],b,m,a);void 0!==w&&Ao(x,w);var S=Xe(Dr(o,void 0,x));}else S=Ho(y,a,m,b,w,o);m>=h&&(v+=Io(a,h,m)+S,h=m+y.length);}return v+Io(a,h)}]}),!!y((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}))||!ko||Bo);var $o={selector:"td:not([data-w-e-type]),th:not([data-w-e-type])",parseElemHtml:function(t,n,r){var o=c.default(t);0===(n=n.filter((function(t){return !!e.Text.isText(t)||!!r.isInline(t)}))).length&&(n=[{text:o.text().replace(/\s+/gm," ")}]);var i=parseInt(o.attr("colSpan")||"1"),a=parseInt(o.attr("rowSpan")||"1"),l=o.attr("width")||"auto";return {type:"table-cell",isHeader:"th"===lo(o),colSpan:i,rowSpan:a,width:l,children:n}}};var Fo={selector:"tr:not([data-w-e-type])",parseElemHtml:function(e,n,r){return {type:"table-row",children:n.filter((function(e){return "table-cell"===t.DomEditor.getNodeType(e)}))}}};var qo={selector:"table:not([data-w-e-type])",parseElemHtml:function(e,n,r){var o=c.default(e),i="auto";return "100%"===function(t,e){for(var n="",r=(t.attr("style")||"").split(";"),o=r.length,i=0;i<o;i++){var a=r[i];if(a){var l=a.split(":");l[0].trim()===e&&(n=l[1].trim());}}return n}(o,"width")&&(i="100%"),"100%"===o.attr("width")&&(i="100%"),{type:"table",width:i,children:n.filter((function(e){return "table-row"===t.DomEditor.getNodeType(e)}))}}};var Go=function(){function n(){this.title=t.t("tableModule.insertTable"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M0 64v896h1024V64H0z m384 576v-192h256v192h-256z m256 64v192h-256v-192h256z m0-512v192h-256V192h256zM320 192v192H64V192h256z m-256 256h256v192H64v-192z m640 0h256v192h-256v-192z m0-64V192h256v192h-256zM64 704h256v192H64v-192z m640 192v-192h256v192h-256z"></path></svg>',this.tag="button",this.showDropPanel=!0,this.$content=null;}return n.prototype.getValue=function(t){return ""},n.prototype.isActive=function(t){return !1},n.prototype.exec=function(t,e){},n.prototype.isDisabled=function(n){var r=n.selection;return null==r||(!e.Range.isCollapsed(r)||!!t.DomEditor.getSelectedElems(n).some((function(e){var r=t.DomEditor.getNodeType(e);return "pre"===r||("table"===r||("list-item"===r||!!n.isVoid(e)))})))},n.prototype.getPanelContentElem=function(t){var e=this;if(this.$content)return this.$content[0];for(var n=c.default('<div class="w-e-panel-content-table"></div>'),r=c.default("<span>0 &times; 0</span>"),o=c.default("<table></table>"),i=0;i<10;i++){for(var a=c.default("<tr></tr>"),l=0;l<10;l++){var u=c.default("<td></td>");u.attr("data-x",l.toString()),u.attr("data-y",i.toString()),a.append(u),u.on("mouseenter",(function(t){var e=t.target;if(null!=e){var n=c.default(e).dataset(),i=n.x,a=n.y;r[0].innerHTML=i+1+" &times; "+(a+1),o.children().each((function(t){c.default(t).children().each((function(t){var e=c.default(t),n=e.dataset(),r=n.x,o=n.y;r<=i&&o<=a?e.addClass("active"):e.removeClass("active");}));}));}})),u.on("click",(function(n){n.preventDefault();var r=n.target;if(null!=r){var o=c.default(r).dataset(),i=o.x,a=o.y;e.insertTable(t,a+1,i+1);}}));}o.append(a);}return n.append(o),n.append(r),this.$content=n,n[0]},n.prototype.insertTable=function(n,r,o){var i=parseInt(r,10),a=parseInt(o,10);if(i&&a&&!(i<=0||a<=0)){t.DomEditor.isSelectedEmptyParagraph(n)&&e.Transforms.removeNodes(n,{mode:"highest"});var l=function(t,e){for(var n=[],r=0;r<t;r++){for(var o=[],i=0;i<e;i++){var a={type:"table-cell",children:[{text:""}]};0===r&&(a.isHeader=!0),o.push(a);}n.push({type:"table-row",children:o});}return {type:"table",width:"auto",children:n}}(i,a);e.Transforms.insertNodes(n,l,{mode:"highest"});}},n}(),_o=function(){function n(){this.title=t.t("tableModule.deleteTable"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M826.8032 356.5312c-19.328 0-36.3776 15.6928-36.3776 35.0464v524.2624c0 19.328-16 34.56-35.328 34.56H264.9344c-19.328 0-35.5072-15.3088-35.5072-34.56V390.0416c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.6928-33.5104 35.0464V915.712c0 57.9328 44.6208 108.288 102.528 108.288H755.2c57.9328 0 108.0832-50.4576 108.0832-108.288V391.4752c-0.1024-19.2512-17.1264-34.944-36.48-34.944z" p-id="9577"></path><path d="M437.1712 775.7568V390.6048c0-19.328-14.1568-35.0464-33.5104-35.0464s-33.5104 15.616-33.5104 35.0464v385.152c0 19.328 14.1568 35.0464 33.5104 35.0464s33.5104-15.7184 33.5104-35.0464zM649.7024 775.7568V390.6048c0-19.328-17.0496-35.0464-36.3776-35.0464s-36.3776 15.616-36.3776 35.0464v385.152c0 19.328 17.0496 35.0464 36.3776 35.0464s36.3776-15.7184 36.3776-35.0464zM965.0432 217.0368h-174.6176V145.5104c0-57.9328-47.2064-101.76-104.6528-101.76h-350.976c-57.8304 0-105.3952 43.8528-105.3952 101.76v71.5264H54.784c-19.4304 0-35.0464 14.1568-35.0464 33.5104 0 19.328 15.616 33.5104 35.0464 33.5104h910.3616c19.328 0 35.0464-14.1568 35.0464-33.5104 0-19.3536-15.6928-33.5104-35.1488-33.5104z m-247.3728 0H297.3952V145.5104c0-19.328 18.2016-34.7648 37.4272-34.7648h350.976c19.1488 0 31.872 15.1296 31.872 34.7648v71.5264z"></path></svg>',this.tag="button";}return n.prototype.getValue=function(t){return ""},n.prototype.isActive=function(t){return !1},n.prototype.isDisabled=function(e){return null==e.selection||null==t.DomEditor.getSelectedNodeByType(e,"table")},n.prototype.exec=function(t,n){this.isDisabled(t)||e.Transforms.removeNodes(t,{mode:"highest"});},n}(),Wo=function(){function n(){this.title=t.t("tableModule.insertRow"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M707.7888 521.0112h-147.456v-147.456H488.2432v147.456h-147.456v68.8128h147.456v147.456h72.0896v-147.456h147.456zM0 917.504V0h1048.576v917.504H0zM327.68 65.536H65.536v196.608H327.68V65.536z m327.68 0H393.216v196.608h262.144V65.536z m327.68 0h-262.144v196.608h262.144V65.536z m0 258.8672H65.536v462.0288H983.04V324.4032z"></path></svg>',this.tag="button";}return n.prototype.getValue=function(t){return ""},n.prototype.isActive=function(t){return !1},n.prototype.isDisabled=function(n){var r=n.selection;return null==r||(!e.Range.isCollapsed(r)||null==t.DomEditor.getSelectedNodeByType(n,"table"))},n.prototype.exec=function(n,r){if(!this.isDisabled(n)){var o=Xn(e.Editor.nodes(n,{match:function(e){return t.DomEditor.checkNodeType(e,"table-cell")},universal:!0}),1),i=Xn(o[0],2),a=i[0],l=i[1],u=t.DomEditor.getParentNode(n,a),c=(null==u?void 0:u.children.length)||0;if(0!==c){for(var s={type:"table-row",children:[]},f=0;f<c;f++){s.children.push({type:"table-cell",children:[{text:""}]});}var d=e.Path.parent(l),p=e.Path.next(d);e.Transforms.insertNodes(n,s,{at:p});}}},n}(),Uo=function(){function n(){this.title=t.t("tableModule.deleteRow"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M907.6736 586.5472L747.1104 425.984l163.84-163.84-78.6432-78.6432-163.84 163.84L507.904 186.7776 429.2608 262.144l163.84 163.84-167.1168 167.1168 78.6432 78.6432 167.1168-167.1168 160.5632 160.5632 75.3664-78.6432zM0 917.504V0h1048.576v917.504H0z m983.04-327.68h-22.9376l-65.536-65.536H983.04V327.68h-91.7504l65.536-65.536h26.2144V65.536H65.536v196.608h317.8496l65.536 65.536H65.536v196.608h380.1088l-65.536 65.536H65.536v196.608H983.04v-196.608z"></path></svg>',this.tag="button";}return n.prototype.getValue=function(t){return ""},n.prototype.isActive=function(t){return !1},n.prototype.isDisabled=function(n){var r=n.selection;return null==r||(!e.Range.isCollapsed(r)||null==t.DomEditor.getSelectedNodeByType(n,"table-row"))},n.prototype.exec=function(n,r){if(!this.isDisabled(n)){var o=Xn(e.Editor.nodes(n,{match:function(e){return t.DomEditor.checkNodeType(e,"table-row")},universal:!0}),1),i=Xn(o[0],2),a=i[0],l=i[1],u=t.DomEditor.getParentNode(n,a);((null==u?void 0:u.children.length)||0)<=1?e.Transforms.removeNodes(n,{mode:"highest"}):e.Transforms.removeNodes(n,{at:l});}},n}(),Xo={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Yo=Ot("span").classList,Ko=Yo&&Yo.constructor&&Yo.constructor.prototype,Jo=Ko===Object.prototype?void 0:Ko,Qo=rr.forEach,Zo=function(t,e){var n=[][t];return !!n&&y((function(){n.call(null,e||function(){throw 1},1);}))}("forEach"),ti=Zo?[].forEach:function(t){return Qo(this,t,arguments.length>1?arguments[1]:void 0)},ei=function(t){if(t&&t.forEach!==ti)try{Bt(t,"forEach",ti);}catch(e){t.forEach=ti;}};for(var ni in Xo)Xo[ni]&&ei(g[ni]&&g[ni].prototype);ei(Jo);var ri=function(){function n(){this.title=t.t("tableModule.insertCol"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M327.68 193.3312v186.7776H140.9024v91.7504H327.68v186.7776h88.4736V471.8592h190.0544V380.1088H416.1536V193.3312zM0 917.504V0h1048.576v917.504H0zM655.36 65.536H65.536v720.896H655.36V65.536z m327.68 0h-262.144v196.608h262.144V65.536z m0 262.144h-262.144v196.608h262.144V327.68z m0 262.144h-262.144v196.608h262.144v-196.608z"></path></svg>',this.tag="button";}return n.prototype.getValue=function(t){return ""},n.prototype.isActive=function(t){return !1},n.prototype.isDisabled=function(n){var r=n.selection;return null==r||(!e.Range.isCollapsed(r)||null==t.DomEditor.getSelectedNodeByType(n,"table"))},n.prototype.exec=function(n,r){if(!this.isDisabled(n)){var o=Xn(e.Editor.nodes(n,{match:function(e){return t.DomEditor.checkNodeType(e,"table-cell")},universal:!0}),1),i=Xn(o[0],2),a=i[0],l=i[1],u=t.DomEditor.getParentNode(n,a);if(null!=u){var c=t.DomEditor.getParentNode(n,u);if(null!=c)(c.children||[]).forEach((function(r,o){e.Element.isElement(r)&&(r.children||[]).forEach((function(r){var i=t.DomEditor.findPath(n,r);if(i.length===l.length&&s.default(i.slice(-1),l.slice(-1))){var a={type:"table-cell",children:[{text:""}]};0===o&&lr(c)&&(a.isHeader=!0),e.Transforms.insertNodes(n,a,{at:i});}}));}));}}},n}(),oi=function(){function n(){this.title=t.t("tableModule.deleteCol"),this.iconSvg='<svg viewBox="0 0 1048 1024"><path d="M327.68 510.976L393.216 445.44v-13.1072L327.68 366.7968V510.976z m327.68-78.4384l65.536-65.536V507.904L655.36 442.368v-9.8304z m393.216 484.9664V0H0v917.504h1048.576z m-65.536-131.072h-262.144v-52.4288l-13.1072 13.1072-52.4288-52.4288v91.7504H393.216v-91.7504l-52.4288 52.4288-13.1072-13.1072v52.4288H65.536V65.536H327.68v121.2416l36.0448-36.0448 29.4912 29.4912V62.2592h262.144V180.224l49.152-49.152 16.384 16.384V62.2592h262.144V786.432z m-294.912-108.1344l-160.5632-160.5632-167.1168 167.1168-78.6432-78.6432 167.1168-167.1168L288.3584 278.528l78.6432-78.6432 160.5632 160.5632 163.84-163.84 78.6432 78.6432-163.84 163.84 160.5632 160.5632-78.6432 78.6432z"></path></svg>',this.tag="button";}return n.prototype.getValue=function(t){return ""},n.prototype.isActive=function(t){return !1},n.prototype.isDisabled=function(n){var r=n.selection;return null==r||(!e.Range.isCollapsed(r)||null==t.DomEditor.getSelectedNodeByType(n,"table-cell"))},n.prototype.exec=function(n,r){if(!this.isDisabled(n)){var o=Xn(e.Editor.nodes(n,{match:function(e){return t.DomEditor.checkNodeType(e,"table-cell")},universal:!0}),1),i=Xn(o[0],2),a=i[0],l=i[1],u=t.DomEditor.getParentNode(n,a),c=(null==u?void 0:u.children.length)||0;if(!u||c<=1)e.Transforms.removeNodes(n,{mode:"highest"});else {var f=t.DomEditor.getParentNode(n,u);if(null!=f)(f.children||[]).forEach((function(r){e.Element.isElement(r)&&(r.children||[]).forEach((function(r){var o=t.DomEditor.findPath(n,r);o.length===l.length&&s.default(o.slice(-1),l.slice(-1))&&e.Transforms.removeNodes(n,{at:o});}));}));}}},n}(),ii=function(){function n(){this.title=t.t("tableModule.header"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M704 128l-64 0L384 128 320 128 0 128l0 256 0 64 0 192 0 64 0 256 320 0 64 0 256 0 64 0 320 0 0-256 0-64L1024 448 1024 384 1024 128 704 128zM640 640 384 640 384 448l256 0L640 640zM64 448l256 0 0 192L64 640 64 448zM320 896 64 896l0-192 256 0L320 896zM640 896 384 896l0-192 256 0L640 896zM960 896l-256 0 0-192 256 0L960 896zM960 640l-256 0L704 448l256 0L960 640z"></path></svg>',this.tag="button";}return n.prototype.getValue=function(e){var n=t.DomEditor.getSelectedNodeByType(e,"table");return null!=n&&lr(n)},n.prototype.isActive=function(t){return !!this.getValue(t)},n.prototype.isDisabled=function(n){var r=n.selection;return null==r||(!e.Range.isCollapsed(r)||null==t.DomEditor.getSelectedNodeByType(n,"table"))},n.prototype.exec=function(n,r){if(!this.isDisabled(n)){var o=!r,i=t.DomEditor.getSelectedNodeByType(n,"table");if(null!=i)ar(i).forEach((function(r){return e.Transforms.setNodes(n,{isHeader:o},{at:t.DomEditor.findPath(n,r)})}));}},n}(),ai=function(){function n(){this.title=t.t("tableModule.widthAuto"),this.iconSvg='<svg viewBox="0 0 1228 1024"><path d="M862.514337 563.200461H404.581995v121.753478a13.311987 13.311987 0 0 1-6.655993 11.468789 10.23999 10.23999 0 0 1-12.083188-1.433599l-204.799795-179.199821a13.721586 13.721586 0 0 1 0-20.479979l204.799795-179.302221a10.23999 10.23999 0 0 1 12.185588-1.535998 13.209587 13.209587 0 0 1 6.553593 11.673588v115.097485h457.932342V319.693504a11.571188 11.571188 0 0 1 18.841582-10.239989l204.799795 179.19982a13.721586 13.721586 0 0 1 0 20.47998l-204.799795 179.199821a10.23999 10.23999 0 0 1-12.185588 1.535998 13.311987 13.311987 0 0 1-6.655994-11.571188V563.200461zM136.499064 14.951409v993.893406a15.257585 15.257585 0 0 1-15.155185 15.052785H15.155185A15.155185 15.155185 0 0 1 0 1008.844815V14.951409a15.257585 15.257585 0 0 1 15.155185-15.052785h106.086294a15.155185 15.155185 0 0 1 15.257585 15.155185zM1228.798771 14.951409v993.893406a15.257585 15.257585 0 0 1-15.155185 15.052785h-106.188693a15.155185 15.155185 0 0 1-15.155185-15.052785V14.951409a15.257585 15.257585 0 0 1 15.155185-15.052785h106.086293A15.155185 15.155185 0 0 1 1228.798771 15.053809z"></path></svg>',this.tag="button";}return n.prototype.getValue=function(e){var n=t.DomEditor.getSelectedNodeByType(e,"table");return null!=n&&"100%"===n.width},n.prototype.isActive=function(t){return !!this.getValue(t)},n.prototype.isDisabled=function(n){var r=n.selection;return null==r||(!e.Range.isCollapsed(r)||null==t.DomEditor.getSelectedNodeByType(n,"table"))},n.prototype.exec=function(t,n){if(!this.isDisabled(t)){var r={width:n?"auto":"100%"};e.Transforms.setNodes(t,r,{mode:"highest"});}},n}(),li={renderElems:[yo,mo,bo],elemsToHtml:[Eo,wo,xo],preParseHtml:[So],parseElemsHtml:[$o,Fo,qo],menus:[{key:"insertTable",factory:function(){return new Go}},{key:"deleteTable",factory:function(){return new _o}},{key:"insertTableRow",factory:function(){return new Wo}},{key:"deleteTableRow",factory:function(){return new Uo}},{key:"insertTableCol",factory:function(){return new ri}},{key:"deleteTableCol",factory:function(){return new oi}},{key:"tableHeader",factory:function(){return new ii}},{key:"tableFullWidth",factory:function(){return new ai}}],editorPlugin:function(n){var r=n.insertBreak,o=n.deleteBackward,i=n.deleteForward,a=n.normalizeNode,l=n.insertData,u=n.handleTab,c=n.selectAll,s=n;return s.insertBreak=function(){null==t.DomEditor.getSelectedNodeByType(s,"table")?r():s.insertText("\n");},s.deleteBackward=function(t){if(!Yn(s)){var n=s.selection;if(n){var r=e.Editor.before(s,n);if(r){var i=Kn(s,r),a=Kn(s,n);if(i&&!a)return}}o(t);}},s.handleTab=function(){var r;if(t.DomEditor.getSelectedNodeByType(s,"table")){var o=e.Editor.above(n);t.DomEditor.checkNodeType(o[0],"table-cell")&&e.Transforms.select(n,o[1]);var i=e.Editor.next(n);if(i)i[0]&&i[0].text&&(i=null!==(r=e.Editor.above(n,{at:i[1]}))&&void 0!==r?r:i),e.Transforms.select(n,i[1]);else {var a=s.children||[],l=a.length;if(t.DomEditor.checkNodeType(a[l-1],"table")){var c=t.DomEditor.genEmptyParagraph();e.Transforms.insertNodes(s,c,{at:[l]}),s.handleTab();}}}else u();},s.deleteForward=function(t){Yn(s)||i(t);},s.normalizeNode=function(n){var r=Xn(n,2),o=r[0],i=r[1];if("table"!==t.DomEditor.getNodeType(o))return a([o,i]);if(t.DomEditor.isLastNode(s,o)){var l=t.DomEditor.genEmptyParagraph();e.Transforms.insertNodes(s,l,{at:[i[0]+1]});}},s.insertData=function(n){if(null!=t.DomEditor.getSelectedNodeByType(s,"table")){var r=n.getData("text/plain");"\n"===r||/<img[^>]+>/.test(n.getData("text/html"))?l(n):e.Editor.insertText(s,r);}else l(n);},s.selectAll=function(){var n=s.selection;if(null!=n){var r=t.DomEditor.getSelectedNodeByType(s,"table-cell");if(null!=r){var o=n.anchor,i=n.focus;if(e.Path.equals(o.path.slice(0,3),i.path.slice(0,3)))if(0!==e.Node.string(r).length){var a=t.DomEditor.findPath(s,r),l={anchor:e.Editor.start(s,a),focus:e.Editor.end(s,a)};s.select(l);}else c();else c();}else c();}else c();},s}};return li}));
  20254. });
  20255. var dist$2 = createCommonjsModule$1(function (module, exports) {
  20256. !function(t,e){module.exports=e(dist$6,require$$2$1,require$$2,require$$1,require$$4);}(commonjsGlobal,(function(t,e,n,r,o){function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=i(r);t.i18nAddResources("en",{videoModule:{delete:"Delete",uploadVideo:"Upload video",insertVideo:"Insert video",videoSrc:"Video source",videoSrcPlaceHolder:"Video file url, or third-party <iframe>",videoPoster:"Video poster",videoPosterPlaceHolder:"Poster image url",ok:"Ok",editSize:"Edit size",width:"Width",height:"Height"}}),t.i18nAddResources("zh-CN",{videoModule:{delete:"删除视频",uploadVideo:"上传视频",insertVideo:"插入视频",videoSrc:"视频地址",videoSrcPlaceHolder:"视频文件 url 或第三方 <iframe>",videoPoster:"视频封面",videoPosterPlaceHolder:"封面图片 url",ok:"确定",editSize:"修改尺寸",width:"宽度",height:"高度"}});
  20257. /*! *****************************************************************************
  20258. Copyright (c) Microsoft Corporation.
  20259. Permission to use, copy, modify, and/or distribute this software for any
  20260. purpose with or without fee is hereby granted.
  20261. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  20262. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  20263. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  20264. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  20265. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  20266. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  20267. PERFORMANCE OF THIS SOFTWARE.
  20268. ***************************************************************************** */
  20269. var a=function(){return a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},a.apply(this,arguments)};function c(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t));}catch(t){i(t);}}function a(t){try{c(r.throw(t));}catch(t){i(t);}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e);}))).then(u,a);}c((r=r.apply(t,e||[])).next());}))}function f(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u);}catch(t){i=[6,t],r=0;}finally{n=o=0;}if(5&i[0])throw i[1];return {value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function s(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return {next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)u.push(r.value);}catch(t){o={error:t};}finally{try{r&&!r.done&&(n=i.return)&&n.call(i);}finally{if(o)throw o.error}}return u}function d(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=s(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n});}),e);})(r,o,(e=t[n](e)).done,e.value);}))};}}var p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{};function v(t){var e={exports:{}};return t(e,e.exports),e.exports}var h,y,g=function(t){return t&&t.Math==Math&&t},m=g("object"==typeof globalThis&&globalThis)||g("object"==typeof window&&window)||g("object"==typeof self&&self)||g("object"==typeof p&&p)||function(){return this}()||Function("return this")(),b=function(t){try{return !!t()}catch(t){return !0}},w=!b((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),S=Function.prototype.call,x=S.bind?S.bind(S):function(){return S.apply(S,arguments)},E={}.propertyIsEnumerable,O=Object.getOwnPropertyDescriptor,j={f:O&&!E.call({1:2},1)?function(t){var e=O(this,t);return !!e&&e.enumerable}:E},I=function(t,e){return {enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},P=Function.prototype,T=P.bind,M=P.call,A=T&&T.bind(M),R=T?function(t){return t&&A(M,t)}:function(t){return t&&function(){return M.apply(t,arguments)}},k=R({}.toString),C=R("".slice),N=function(t){return C(k(t),8,-1)},L=m.Object,V=R("".split),D=b((function(){return !L("z").propertyIsEnumerable(0)}))?function(t){return "String"==N(t)?V(t,""):L(t)}:L,z=m.TypeError,F=function(t){if(null==t)throw z("Can't call method on "+t);return t},_=function(t){return D(F(t))},$=function(t){return "function"==typeof t},H=function(t){return "object"==typeof t?null!==t:$(t)},B=function(t){return $(t)?t:void 0},G=function(t,e){return arguments.length<2?B(m[t]):m[t]&&m[t][e]},W=R({}.isPrototypeOf),U=G("navigator","userAgent")||"",q=m.process,K=m.Deno,X=q&&q.versions||K&&K.version,Y=X&&X.v8;Y&&(y=(h=Y.split("."))[0]>0&&h[0]<4?1:+(h[0]+h[1])),!y&&U&&(!(h=U.match(/Edge\/(\d+)/))||h[1]>=74)&&(h=U.match(/Chrome\/(\d+)/))&&(y=+h[1]);var J=y,Q=!!Object.getOwnPropertySymbols&&!b((function(){var t=Symbol();return !String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&J&&J<41})),Z=Q&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,tt=m.Object,et=Z?function(t){return "symbol"==typeof t}:function(t){var e=G("Symbol");return $(e)&&W(e.prototype,tt(t))},nt=m.String,rt=function(t){try{return nt(t)}catch(t){return "Object"}},ot=m.TypeError,it=function(t){if($(t))return t;throw ot(rt(t)+" is not a function")},ut=function(t,e){var n=t[e];return null==n?void 0:it(n)},at=m.TypeError,ct=Object.defineProperty,ft=function(t,e){try{ct(m,t,{value:e,configurable:!0,writable:!0});}catch(n){m[t]=e;}return e},st="__core-js_shared__",lt=m[st]||ft(st,{}),dt=v((function(t){(t.exports=function(t,e){return lt[t]||(lt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});})),pt=m.Object,vt=function(t){return pt(F(t))},ht=R({}.hasOwnProperty),yt=Object.hasOwn||function(t,e){return ht(vt(t),e)},gt=0,mt=Math.random(),bt=R(1..toString),wt=function(t){return "Symbol("+(void 0===t?"":t)+")_"+bt(++gt+mt,36)},St=dt("wks"),xt=m.Symbol,Et=xt&&xt.for,Ot=Z?xt:xt&&xt.withoutSetter||wt,jt=function(t){if(!yt(St,t)||!Q&&"string"!=typeof St[t]){var e="Symbol."+t;Q&&yt(xt,t)?St[t]=xt[t]:St[t]=Z&&Et?Et(e):Ot(e);}return St[t]},It=m.TypeError,Pt=jt("toPrimitive"),Tt=function(t,e){if(!H(t)||et(t))return t;var n,r=ut(t,Pt);if(r){if(void 0===e&&(e="default"),n=x(r,t,e),!H(n)||et(n))return n;throw It("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,r;if("string"===e&&$(n=t.toString)&&!H(r=x(n,t)))return r;if($(n=t.valueOf)&&!H(r=x(n,t)))return r;if("string"!==e&&$(n=t.toString)&&!H(r=x(n,t)))return r;throw at("Can't convert object to primitive value")}(t,e)},Mt=function(t){var e=Tt(t,"string");return et(e)?e:e+""},At=m.document,Rt=H(At)&&H(At.createElement),kt=function(t){return Rt?At.createElement(t):{}},Ct=!w&&!b((function(){return 7!=Object.defineProperty(kt("div"),"a",{get:function(){return 7}}).a})),Nt=Object.getOwnPropertyDescriptor,Lt={f:w?Nt:function(t,e){if(t=_(t),e=Mt(e),Ct)try{return Nt(t,e)}catch(t){}if(yt(t,e))return I(!x(j.f,t,e),t[e])}},Vt=m.String,Dt=m.TypeError,zt=function(t){if(H(t))return t;throw Dt(Vt(t)+" is not an object")},Ft=m.TypeError,_t=Object.defineProperty,$t={f:w?_t:function(t,e,n){if(zt(t),e=Mt(e),zt(n),Ct)try{return _t(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Ft("Accessors not supported");return "value"in n&&(t[e]=n.value),t}},Ht=w?function(t,e,n){return $t.f(t,e,I(1,n))}:function(t,e,n){return t[e]=n,t},Bt=R(Function.toString);$(lt.inspectSource)||(lt.inspectSource=function(t){return Bt(t)});var Gt,Wt,Ut,qt=lt.inspectSource,Kt=m.WeakMap,Xt=$(Kt)&&/native code/.test(qt(Kt)),Yt=dt("keys"),Jt=function(t){return Yt[t]||(Yt[t]=wt(t))},Qt={},Zt="Object already initialized",te=m.TypeError,ee=m.WeakMap;if(Xt||lt.state){var ne=lt.state||(lt.state=new ee),re=R(ne.get),oe=R(ne.has),ie=R(ne.set);Gt=function(t,e){if(oe(ne,t))throw new te(Zt);return e.facade=t,ie(ne,t,e),e},Wt=function(t){return re(ne,t)||{}},Ut=function(t){return oe(ne,t)};}else {var ue=Jt("state");Qt[ue]=!0,Gt=function(t,e){if(yt(t,ue))throw new te(Zt);return e.facade=t,Ht(t,ue,e),e},Wt=function(t){return yt(t,ue)?t[ue]:{}},Ut=function(t){return yt(t,ue)};}var ae={set:Gt,get:Wt,has:Ut,enforce:function(t){return Ut(t)?Wt(t):Gt(t,{})},getterFor:function(t){return function(e){var n;if(!H(e)||(n=Wt(e)).type!==t)throw te("Incompatible receiver, "+t+" required");return n}}},ce=Function.prototype,fe=w&&Object.getOwnPropertyDescriptor,se=yt(ce,"name"),le={EXISTS:se,PROPER:se&&"something"===function(){}.name,CONFIGURABLE:se&&(!w||w&&fe(ce,"name").configurable)},de=v((function(t){var e=le.CONFIGURABLE,n=ae.get,r=ae.enforce,o=String(String).split("String");(t.exports=function(t,n,i,u){var a,c=!!u&&!!u.unsafe,f=!!u&&!!u.enumerable,s=!!u&&!!u.noTargetGet,l=u&&void 0!==u.name?u.name:n;$(i)&&("Symbol("===String(l).slice(0,7)&&(l="["+String(l).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!yt(i,"name")||e&&i.name!==l)&&Ht(i,"name",l),(a=r(i)).source||(a.source=o.join("string"==typeof l?l:""))),t!==m?(c?!s&&t[n]&&(f=!0):delete t[n],f?t[n]=i:Ht(t,n,i)):f?t[n]=i:ft(n,i);})(Function.prototype,"toString",(function(){return $(this)&&n(this).source||qt(this)}));})),pe=Math.ceil,ve=Math.floor,he=function(t){var e=+t;return e!=e||0===e?0:(e>0?ve:pe)(e)},ye=Math.max,ge=Math.min,me=function(t,e){var n=he(t);return n<0?ye(n+e,0):ge(n,e)},be=Math.min,we=function(t){return t>0?be(he(t),9007199254740991):0},Se=function(t){return we(t.length)},xe=function(t){return function(e,n,r){var o,i=_(e),u=Se(i),a=me(r,u);if(t&&n!=n){for(;u>a;)if((o=i[a++])!=o)return !0}else for(;u>a;a++)if((t||a in i)&&i[a]===n)return t||a||0;return !t&&-1}},Ee={includes:xe(!0),indexOf:xe(!1)},Oe=Ee.indexOf,je=R([].push),Ie=function(t,e){var n,r=_(t),o=0,i=[];for(n in r)!yt(Qt,n)&&yt(r,n)&&je(i,n);for(;e.length>o;)yt(r,n=e[o++])&&(~Oe(i,n)||je(i,n));return i},Pe=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Te=Pe.concat("length","prototype"),Me={f:Object.getOwnPropertyNames||function(t){return Ie(t,Te)}},Ae={f:Object.getOwnPropertySymbols},Re=R([].concat),ke=G("Reflect","ownKeys")||function(t){var e=Me.f(zt(t)),n=Ae.f;return n?Re(e,n(t)):e},Ce=function(t,e){for(var n=ke(e),r=$t.f,o=Lt.f,i=0;i<n.length;i++){var u=n[i];yt(t,u)||r(t,u,o(e,u));}},Ne=/#|\.prototype\./,Le=function(t,e){var n=De[Ve(t)];return n==Fe||n!=ze&&($(e)?b(e):!!e)},Ve=Le.normalize=function(t){return String(t).replace(Ne,".").toLowerCase()},De=Le.data={},ze=Le.NATIVE="N",Fe=Le.POLYFILL="P",_e=Le,$e=Lt.f,He=function(t,e){var n,r,o,i,u,a=t.target,c=t.global,f=t.stat;if(n=c?m:f?m[a]||ft(a,{}):(m[a]||{}).prototype)for(r in e){if(i=e[r],o=t.noTargetGet?(u=$e(n,r))&&u.value:n[r],!_e(c?r:a+(f?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;Ce(i,o);}(t.sham||o&&o.sham)&&Ht(i,"sham",!0),de(n,r,i,t);}},Be={};Be[jt("toStringTag")]="z";var Ge,We="[object z]"===String(Be),Ue=jt("toStringTag"),qe=m.Object,Ke="Arguments"==N(function(){return arguments}()),Xe=We?N:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=qe(t),Ue))?n:Ke?N(e):"Object"==(r=N(e))&&$(e.callee)?"Arguments":r},Ye=m.String,Je=function(t){if("Symbol"===Xe(t))throw TypeError("Cannot convert a Symbol value to a string");return Ye(t)},Qe="\t\n\v\f\r                \u2028\u2029\ufeff",Ze=R("".replace),tn="["+Qe+"]",en=RegExp("^"+tn+tn+"*"),nn=RegExp(tn+tn+"*$"),rn=function(t){return function(e){var n=Je(F(e));return 1&t&&(n=Ze(n,en,"")),2&t&&(n=Ze(n,nn,"")),n}},on={start:rn(1),end:rn(2),trim:rn(3)},un=le.PROPER,an=on.trim;function cn(t){return t.length?t[0].tagName.toLowerCase():""}function fn(t,e,n){void 0===e&&(e="auto"),void 0===n&&(n="auto");var r=u.default(t);return r.attr("width",e),r.attr("height",n),r[0].outerHTML}He({target:"String",proto:!0,forced:(Ge="trim",b((function(){return !!Qe[Ge]()||"​…᠎"!=="​…᠎"[Ge]()||un&&Qe[Ge].name!==Ge})))},{trim:function(){return an(this)}}),He({global:!0},{globalThis:m}),r.append&&(u.default.fn.append=r.append),r.on&&(u.default.fn.on=r.on),r.focus&&(u.default.fn.focus=r.focus),r.attr&&(u.default.fn.attr=r.attr),r.val&&(u.default.fn.val=r.val),r.html&&(u.default.fn.html=r.html),r.parent&&(u.default.fn.parent=r.parent),r.hasClass&&(u.default.fn.hasClass=r.hasClass),r.empty&&(u.default.fn.empty=r.empty);var sn={type:"video",renderElem:function(e,r,o){var i,u=e,a=u.src,c=void 0===a?"":a,f=u.poster,s=void 0===f?"":f,l=u.width,d=void 0===l?"auto":l,p=u.height,v=void 0===p?"auto":p,h=t.DomEditor.isNodeSelected(o,e);if(0===c.trim().indexOf("<iframe ")){var y=fn(c,d,v);i=n.jsx("div",{className:"w-e-textarea-video-container","data-selected":h?"true":"",innerHTML:y});}else {var g=n.jsx("video",{poster:s,controls:!0},n.jsx("source",{src:c,type:"video/mp4"}),"Sorry, your browser doesn't support embedded videos.\n 抱歉,浏览器不支持 video 视频");"auto"!==d&&(g.data.width=d),"auto"!==v&&(g.data.height=v),i=n.jsx("div",{className:"w-e-textarea-video-container","data-selected":h?"true":""},g);}return n.h("div",{props:{contentEditable:!1},on:{mousedown:function(t){return t.preventDefault()}}},i)}};var ln,dn={type:"video",elemToHtml:function(t,e){var n=t,r=n.src,o=void 0===r?"":r,i=n.poster,u=void 0===i?"":i,a=n.width,c=void 0===a?"auto":a,f=n.height,s=void 0===f?"auto":f,l='<div data-w-e-type="video" data-w-e-is-void>\n';return 0===o.trim().indexOf("<iframe ")?l+=fn(o,c,s):l+='<video poster="'+u+'" controls="true" width="'+c+'" height="'+s+'"><source src="'+o+'" type="video/mp4"/></video>',l+="\n</div>"}},pn=Object.keys||function(t){return Ie(t,Pe)},vn=w?Object.defineProperties:function(t,e){zt(t);for(var n,r=_(e),o=pn(e),i=o.length,u=0;i>u;)$t.f(t,n=o[u++],r[n]);return t},hn=G("document","documentElement"),yn=Jt("IE_PROTO"),gn=function(){},mn=function(t){return "<script>"+t+"</"+"script>"},bn=function(t){t.write(mn("")),t.close();var e=t.parentWindow.Object;return t=null,e},wn=function(){try{ln=new ActiveXObject("htmlfile");}catch(t){}var t,e;wn="undefined"!=typeof document?document.domain&&ln?bn(ln):((e=kt("iframe")).style.display="none",hn.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(mn("document.F=Object")),t.close(),t.F):bn(ln);for(var n=Pe.length;n--;)delete wn.prototype[Pe[n]];return wn()};Qt[yn]=!0;var Sn=Object.create||function(t,e){var n;return null!==t?(gn.prototype=zt(t),n=new gn,gn.prototype=null,n[yn]=t):n=wn(),void 0===e?n:vn(n,e)},xn=jt("unscopables"),En=Array.prototype;null==En[xn]&&$t.f(En,xn,{configurable:!0,value:Sn(null)});var On=function(t){En[xn][t]=!0;},jn=Ee.includes;He({target:"Array",proto:!0},{includes:function(t){return jn(this,t,arguments.length>1?arguments[1]:void 0)}}),On("includes");var In={selector:"iframe,video,p",preParseHtml:function(t){var e=u.default(t),n=e;if("p"===cn(e)){var r=e.children();if(1===r.length){var o=r[0],i=o.tagName.toLowerCase();["iframe","video"].includes(i)&&(n=u.default(o));}}var a=cn(n);if("iframe"!==a&&"video"!==a)return n[0];if("video"===n.parent().attr("data-w-e-type"))return n[0];var c=u.default('<div data-w-e-type="video" data-w-e-is-void></div>');return c.append(n),c[0]}},Pn=R(R.bind),Tn=function(t,e){return it(t),void 0===e?t:Pn?Pn(t,e):function(){return t.apply(e,arguments)}},Mn=Array.isArray||function(t){return "Array"==N(t)},An=function(){},Rn=[],kn=G("Reflect","construct"),Cn=/^\s*(?:class|function)\b/,Nn=R(Cn.exec),Ln=!Cn.exec(An),Vn=function(t){if(!$(t))return !1;try{return kn(An,Rn,t),!0}catch(t){return !1}},Dn=!kn||b((function(){var t;return Vn(Vn.call)||!Vn(Object)||!Vn((function(){t=!0;}))||t}))?function(t){if(!$(t))return !1;switch(Xe(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return !1}return Ln||!!Nn(Cn,qt(t))}:Vn,zn=jt("species"),Fn=m.Array,_n=function(t,e){return new(function(t){var e;return Mn(t)&&(e=t.constructor,(Dn(e)&&(e===Fn||Mn(e.prototype))||H(e)&&null===(e=e[zn]))&&(e=void 0)),void 0===e?Fn:e}(t))(0===e?0:e)},$n=R([].push),Hn=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,u=7==t,a=5==t||i;return function(c,f,s,l){for(var d,p,v=vt(c),h=D(v),y=Tn(f,s),g=Se(h),m=0,b=l||_n,w=e?b(c,g):n||u?b(c,0):void 0;g>m;m++)if((a||m in h)&&(p=y(d=h[m],m,v),t))if(e)w[m]=p;else if(p)switch(t){case 3:return !0;case 5:return d;case 6:return m;case 2:$n(w,d);}else switch(t){case 4:return !1;case 7:$n(w,d);}return i?-1:r||o?o:w}},Bn={forEach:Hn(0),map:Hn(1),filter:Hn(2),some:Hn(3),every:Hn(4),find:Hn(5),findIndex:Hn(6),filterReject:Hn(7)},Gn=Bn.find,Wn="find",Un=!0;Wn in[]&&Array(1).find((function(){Un=!1;})),He({target:"Array",proto:!0,forced:Un},{find:function(t){return Gn(this,t,arguments.length>1?arguments[1]:void 0)}}),On(Wn);var qn=We?{}.toString:function(){return "[object "+Xe(this)+"]"};function Kn(t,e,n,r){return void 0===e&&(e=""),void 0===n&&(n="auto"),void 0===r&&(r="auto"),{type:"video",src:t,poster:e,width:n,height:r,children:[{text:""}]}}We||de(Object.prototype,"toString",qn,{unsafe:!0});var Xn,Yn,Jn={selector:'div[data-w-e-type="video"]',parseElemHtml:function(t,e,n){var r=u.default(t),o="",i="",a="auto",c="auto",f=r.find("iframe");if(f.length>0)return a=f.attr("width")||"auto",c=f.attr("height")||"auto",Kn(o=f[0].outerHTML,i,a,c);var s=r.find("video");return (o=s.attr("src")||"")||s.length>0&&(o=s.find("source").attr("src")||""),a=s.attr("width")||"auto",c=s.attr("height")||"auto",Kn(o,i=s.attr("poster")||"",a,c)}},Qn=function(){var t=zt(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},Zn=m.RegExp,tr=b((function(){var t=Zn("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),er=tr||b((function(){return !Zn("a","y").sticky})),nr={BROKEN_CARET:tr||b((function(){var t=Zn("^r","gy");return t.lastIndex=2,null!=t.exec("str")})),MISSED_STICKY:er,UNSUPPORTED_Y:tr},rr=m.RegExp,or=b((function(){var t=rr(".","s");return !(t.dotAll&&t.exec("\n")&&"s"===t.flags)})),ir=m.RegExp,ur=b((function(){var t=ir("(?<a>b)","g");return "b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})),ar=ae.get,cr=dt("native-string-replace",String.prototype.replace),fr=RegExp.prototype.exec,sr=fr,lr=R("".charAt),dr=R("".indexOf),pr=R("".replace),vr=R("".slice),hr=(Yn=/b*/g,x(fr,Xn=/a/,"a"),x(fr,Yn,"a"),0!==Xn.lastIndex||0!==Yn.lastIndex),yr=nr.BROKEN_CARET,gr=void 0!==/()??/.exec("")[1];(hr||gr||yr||or||ur)&&(sr=function(t){var e,n,r,o,i,u,a,c=this,f=ar(c),s=Je(t),l=f.raw;if(l)return l.lastIndex=c.lastIndex,e=x(sr,l,s),c.lastIndex=l.lastIndex,e;var d=f.groups,p=yr&&c.sticky,v=x(Qn,c),h=c.source,y=0,g=s;if(p&&(v=pr(v,"y",""),-1===dr(v,"g")&&(v+="g"),g=vr(s,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==lr(s,c.lastIndex-1))&&(h="(?: "+h+")",g=" "+g,y++),n=new RegExp("^(?:"+h+")",v)),gr&&(n=new RegExp("^"+h+"$(?!\\s)",v)),hr&&(r=c.lastIndex),o=x(fr,p?n:c,g),p?o?(o.input=vr(o.input,y),o[0]=vr(o[0],y),o.index=c.lastIndex,c.lastIndex+=o[0].length):c.lastIndex=0:hr&&o&&(c.lastIndex=c.global?o.index+o[0].length:r),gr&&o&&o.length>1&&x(cr,o[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(o[i]=void 0);})),o&&d)for(o.groups=u=Sn(null),i=0;i<d.length;i++)u[(a=d[i])[0]]=o[a[1]];return o});var mr=sr;He({target:"RegExp",proto:!0,forced:/./.exec!==mr},{exec:mr});var br=Function.prototype,wr=br.apply,Sr=br.bind,xr=br.call,Er="object"==typeof Reflect&&Reflect.apply||(Sr?xr.bind(wr):function(){return xr.apply(wr,arguments)}),Or=jt("species"),jr=RegExp.prototype,Ir=R("".charAt),Pr=R("".charCodeAt),Tr=R("".slice),Mr=function(t){return function(e,n){var r,o,i=Je(F(e)),u=he(n),a=i.length;return u<0||u>=a?t?"":void 0:(r=Pr(i,u))<55296||r>56319||u+1===a||(o=Pr(i,u+1))<56320||o>57343?t?Ir(i,u):r:t?Tr(i,u,u+2):o-56320+(r-55296<<10)+65536}},Ar={codeAt:Mr(!1),charAt:Mr(!0)},Rr=Ar.charAt,kr=function(t,e,n){return e+(n?Rr(t,e).length:1)},Cr=Math.floor,Nr=R("".charAt),Lr=R("".replace),Vr=R("".slice),Dr=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,zr=/\$([$&'`]|\d{1,2})/g,Fr=function(t,e,n,r,o,i){var u=n+t.length,a=r.length,c=zr;return void 0!==o&&(o=vt(o),c=Dr),Lr(i,c,(function(i,c){var f;switch(Nr(c,0)){case"$":return "$";case"&":return t;case"`":return Vr(e,0,n);case"'":return Vr(e,u);case"<":f=o[Vr(c,1,-1)];break;default:var s=+c;if(0===s)return i;if(s>a){var l=Cr(s/10);return 0===l?i:l<=a?void 0===r[l-1]?Nr(c,1):r[l-1]+Nr(c,1):i}f=r[s-1];}return void 0===f?"":f}))},_r=m.TypeError,$r=function(t,e){var n=t.exec;if($(n)){var r=x(n,t,e);return null!==r&&zt(r),r}if("RegExp"===N(t))return x(mr,t,e);throw _r("RegExp#exec called on incompatible receiver")},Hr=jt("replace"),Br=Math.max,Gr=Math.min,Wr=R([].concat),Ur=R([].push),qr=R("".indexOf),Kr=R("".slice),Xr="$0"==="a".replace(/./,"$0"),Yr=!!/./[Hr]&&""===/./[Hr]("a","$0");function Jr(t){return void 0===t&&(t="r"),t+"-"+o.nanoid()}!function(t,e,n,r){var o=jt(t),i=!b((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),u=i&&!b((function(){var e=!1,n=/a/;return "split"===t&&((n={}).constructor={},n.constructor[Or]=function(){return n},n.flags="",n[o]=/./[o]),n.exec=function(){return e=!0,null},n[o](""),!e}));if(!i||!u||n){var a=R(/./[o]),c=e(o,""[t],(function(t,e,n,r,o){var u=R(t),c=e.exec;return c===mr||c===jr.exec?i&&!o?{done:!0,value:a(e,n,r)}:{done:!0,value:u(n,e,r)}:{done:!1}}));de(String.prototype,t,c[0]),de(jr,o,c[1]);}r&&Ht(jr[o],"sham",!0);}("replace",(function(t,e,n){var r=Yr?"$":"$0";return [function(t,n){var r=F(this),o=null==t?void 0:ut(t,Hr);return o?x(o,t,r,n):x(e,Je(r),t,n)},function(t,o){var i=zt(this),u=Je(t);if("string"==typeof o&&-1===qr(o,r)&&-1===qr(o,"$<")){var a=n(e,i,u,o);if(a.done)return a.value}var c=$(o);c||(o=Je(o));var f=i.global;if(f){var s=i.unicode;i.lastIndex=0;}for(var l=[];;){var d=$r(i,u);if(null===d)break;if(Ur(l,d),!f)break;""===Je(d[0])&&(i.lastIndex=kr(u,we(i.lastIndex),s));}for(var p,v="",h=0,y=0;y<l.length;y++){for(var g=Je((d=l[y])[0]),m=Br(Gr(he(d.index),u.length),0),b=[],w=1;w<d.length;w++)Ur(b,void 0===(p=d[w])?p:String(p));var S=d.groups;if(c){var x=Wr([g],b,m,u);void 0!==S&&Ur(x,S);var E=Je(Er(o,void 0,x));}else E=Fr(g,u,m,b,S,o);m>=h&&(v+=Kr(u,h,m)+E,h=m+g.length);}return v+Kr(u,h)}]}),!!b((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}))||!Xr||Yr);var Qr=m.Promise,Zr=function(t,e,n){for(var r in e)de(t,r,e[r],n);return t},to=m.String,eo=m.TypeError,no=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=R(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),e=n instanceof Array;}catch(t){}return function(n,r){return zt(n),function(t){if("object"==typeof t||$(t))return t;throw eo("Can't set "+to(t)+" as a prototype")}(r),e?t(n,r):n.__proto__=r,n}}():void 0),ro=$t.f,oo=jt("toStringTag"),io=function(t,e,n){t&&!yt(t=n?t:t.prototype,oo)&&ro(t,oo,{configurable:!0,value:e});},uo=jt("species"),ao=m.TypeError,co=function(t,e){if(W(e,t))return t;throw ao("Incorrect invocation")},fo={},so=jt("iterator"),lo=Array.prototype,po=jt("iterator"),vo=function(t){if(null!=t)return ut(t,po)||ut(t,"@@iterator")||fo[Xe(t)]},ho=m.TypeError,yo=function(t,e,n){var r,o;zt(t);try{if(!(r=ut(t,"return"))){if("throw"===e)throw n;return n}r=x(r,t);}catch(t){o=!0,r=t;}if("throw"===e)throw n;if(o)throw r;return zt(r),n},go=m.TypeError,mo=function(t,e){this.stopped=t,this.result=e;},bo=mo.prototype,wo=function(t,e,n){var r,o,i,u,a,c,f,s,l=n&&n.that,d=!(!n||!n.AS_ENTRIES),p=!(!n||!n.IS_ITERATOR),v=!(!n||!n.INTERRUPTED),h=Tn(e,l),y=function(t){return r&&yo(r,"normal",t),new mo(!0,t)},g=function(t){return d?(zt(t),v?h(t[0],t[1],y):h(t[0],t[1])):v?h(t,y):h(t)};if(p)r=t;else {if(!(o=vo(t)))throw go(rt(t)+" is not iterable");if(void 0!==(s=o)&&(fo.Array===s||lo[so]===s)){for(i=0,u=Se(t);u>i;i++)if((a=g(t[i]))&&W(bo,a))return a;return new mo(!1)}r=function(t,e){var n=arguments.length<2?vo(t):e;if(it(n))return zt(x(n,t));throw ho(rt(t)+" is not iterable")}(t,o);}for(c=r.next;!(f=x(c,r)).done;){try{a=g(f.value);}catch(t){yo(r,"throw",t);}if("object"==typeof a&&a&&W(bo,a))return a}return new mo(!1)},So=jt("iterator"),xo=!1;try{var Eo=0,Oo={next:function(){return {done:!!Eo++}},return:function(){xo=!0;}};Oo[So]=function(){return this},Array.from(Oo,(function(){throw 2}));}catch(t){}var jo,Io,Po,To,Mo=function(t,e){if(!e&&!xo)return !1;var n=!1;try{var r={};r[So]=function(){return {next:function(){return {done:n=!0}}}},t(r);}catch(t){}return n},Ao=m.TypeError,Ro=jt("species"),ko=function(t,e){var n,r=zt(t).constructor;return void 0===r||null==(n=zt(r)[Ro])?e:function(t){if(Dn(t))return t;throw Ao(rt(t)+" is not a constructor")}(n)},Co=R([].slice),No=/(?:ipad|iphone|ipod).*applewebkit/i.test(U),Lo="process"==N(m.process),Vo=m.setImmediate,Do=m.clearImmediate,zo=m.process,Fo=m.Dispatch,_o=m.Function,$o=m.MessageChannel,Ho=m.String,Bo=0,Go={},Wo="onreadystatechange";try{jo=m.location;}catch(t){}var Uo=function(t){if(yt(Go,t)){var e=Go[t];delete Go[t],e();}},qo=function(t){return function(){Uo(t);}},Ko=function(t){Uo(t.data);},Xo=function(t){m.postMessage(Ho(t),jo.protocol+"//"+jo.host);};Vo&&Do||(Vo=function(t){var e=Co(arguments,1);return Go[++Bo]=function(){Er($(t)?t:_o(t),void 0,e);},Io(Bo),Bo},Do=function(t){delete Go[t];},Lo?Io=function(t){zo.nextTick(qo(t));}:Fo&&Fo.now?Io=function(t){Fo.now(qo(t));}:$o&&!No?(To=(Po=new $o).port2,Po.port1.onmessage=Ko,Io=Tn(To.postMessage,To)):m.addEventListener&&$(m.postMessage)&&!m.importScripts&&jo&&"file:"!==jo.protocol&&!b(Xo)?(Io=Xo,m.addEventListener("message",Ko,!1)):Io=Wo in kt("script")?function(t){hn.appendChild(kt("script")).onreadystatechange=function(){hn.removeChild(this),Uo(t);};}:function(t){setTimeout(qo(t),0);});var Yo,Jo,Qo,Zo,ti,ei,ni,ri,oi={set:Vo,clear:Do},ii=/ipad|iphone|ipod/i.test(U)&&void 0!==m.Pebble,ui=/web0s(?!.*chrome)/i.test(U),ai=Lt.f,ci=oi.set,fi=m.MutationObserver||m.WebKitMutationObserver,si=m.document,li=m.process,di=m.Promise,pi=ai(m,"queueMicrotask"),vi=pi&&pi.value;vi||(Yo=function(){var t,e;for(Lo&&(t=li.domain)&&t.exit();Jo;){e=Jo.fn,Jo=Jo.next;try{e();}catch(t){throw Jo?Zo():Qo=void 0,t}}Qo=void 0,t&&t.enter();},No||Lo||ui||!fi||!si?!ii&&di&&di.resolve?((ni=di.resolve(void 0)).constructor=di,ri=Tn(ni.then,ni),Zo=function(){ri(Yo);}):Lo?Zo=function(){li.nextTick(Yo);}:(ci=Tn(ci,m),Zo=function(){ci(Yo);}):(ti=!0,ei=si.createTextNode(""),new fi(Yo).observe(ei,{characterData:!0}),Zo=function(){ei.data=ti=!ti;}));var hi,yi,gi,mi,bi=vi||function(t){var e={fn:t,next:void 0};Qo&&(Qo.next=e),Jo||(Jo=e,Zo()),Qo=e;},wi=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r;})),this.resolve=it(e),this.reject=it(n);},Si={f:function(t){return new wi(t)}},xi=function(t){try{return {error:!1,value:t()}}catch(t){return {error:!0,value:t}}},Ei="object"==typeof window,Oi=oi.set,ji=jt("species"),Ii="Promise",Pi=ae.getterFor(Ii),Ti=ae.set,Mi=ae.getterFor(Ii),Ai=Qr&&Qr.prototype,Ri=Qr,ki=Ai,Ci=m.TypeError,Ni=m.document,Li=m.process,Vi=Si.f,Di=Vi,zi=!!(Ni&&Ni.createEvent&&m.dispatchEvent),Fi=$(m.PromiseRejectionEvent),_i="unhandledrejection",$i=!1,Hi=_e(Ii,(function(){var t=qt(Ri),e=t!==String(Ri);if(!e&&66===J)return !0;if(J>=51&&/native code/.test(t))return !1;var n=new Ri((function(t){t(1);})),r=function(t){t((function(){}),(function(){}));};return (n.constructor={})[ji]=r,!($i=n.then((function(){}))instanceof r)||!e&&Ei&&!Fi})),Bi=Hi||!Mo((function(t){Ri.all(t).catch((function(){}));})),Gi=function(t){var e;return !(!H(t)||!$(e=t.then))&&e},Wi=function(t,e){if(!t.notified){t.notified=!0;var n=t.reactions;bi((function(){for(var r=t.value,o=1==t.state,i=0;n.length>i;){var u,a,c,f=n[i++],s=o?f.ok:f.fail,l=f.resolve,d=f.reject,p=f.domain;try{s?(o||(2===t.rejection&&Xi(t),t.rejection=1),!0===s?u=r:(p&&p.enter(),u=s(r),p&&(p.exit(),c=!0)),u===f.promise?d(Ci("Promise-chain cycle")):(a=Gi(u))?x(a,u,l,d):l(u)):d(r);}catch(t){p&&!c&&p.exit(),d(t);}}t.reactions=[],t.notified=!1,e&&!t.rejection&&qi(t);}));}},Ui=function(t,e,n){var r,o;zi?((r=Ni.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),m.dispatchEvent(r)):r={promise:e,reason:n},!Fi&&(o=m["on"+t])?o(r):t===_i&&function(t,e){var n=m.console;n&&n.error&&(1==arguments.length?n.error(t):n.error(t,e));}("Unhandled promise rejection",n);},qi=function(t){x(Oi,m,(function(){var e,n=t.facade,r=t.value;if(Ki(t)&&(e=xi((function(){Lo?Li.emit("unhandledRejection",r,n):Ui(_i,n,r);})),t.rejection=Lo||Ki(t)?2:1,e.error))throw e.value}));},Ki=function(t){return 1!==t.rejection&&!t.parent},Xi=function(t){x(Oi,m,(function(){var e=t.facade;Lo?Li.emit("rejectionHandled",e):Ui("rejectionhandled",e,t.value);}));},Yi=function(t,e,n){return function(r){t(e,r,n);}},Ji=function(t,e,n){t.done||(t.done=!0,n&&(t=n),t.value=e,t.state=2,Wi(t,!0));},Qi=function(t,e,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===e)throw Ci("Promise can't be resolved itself");var r=Gi(e);r?bi((function(){var n={done:!1};try{x(r,e,Yi(Qi,n,t),Yi(Ji,n,t));}catch(e){Ji(n,e,t);}})):(t.value=e,t.state=1,Wi(t,!1));}catch(e){Ji({done:!1},e,t);}}};if(Hi&&(ki=(Ri=function(t){co(this,ki),it(t),x(hi,this);var e=Pi(this);try{t(Yi(Qi,e),Yi(Ji,e));}catch(t){Ji(e,t);}}).prototype,(hi=function(t){Ti(this,{type:Ii,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0});}).prototype=Zr(ki,{then:function(t,e){var n=Mi(this),r=n.reactions,o=Vi(ko(this,Ri));return o.ok=!$(t)||t,o.fail=$(e)&&e,o.domain=Lo?Li.domain:void 0,n.parent=!0,r[r.length]=o,0!=n.state&&Wi(n,!1),o.promise},catch:function(t){return this.then(void 0,t)}}),yi=function(){var t=new hi,e=Pi(t);this.promise=t,this.resolve=Yi(Qi,e),this.reject=Yi(Ji,e);},Si.f=Vi=function(t){return t===Ri||t===gi?new yi(t):Di(t)},$(Qr)&&Ai!==Object.prototype)){mi=Ai.then,$i||(de(Ai,"then",(function(t,e){var n=this;return new Ri((function(t,e){x(mi,n,t,e);})).then(t,e)}),{unsafe:!0}),de(Ai,"catch",ki.catch,{unsafe:!0}));try{delete Ai.constructor;}catch(t){}no&&no(Ai,ki);}function Zi(t,n,r){return void 0===r&&(r=""),c(this,void 0,void 0,(function(){var o,i,u,a,c,s,l;return f(this,(function(f){switch(f.label){case 0:return n?(t.restoreSelection(),o=t.getMenuConfig("insertVideo"),i=o.onInsertedVideo,u=o.checkVideo,a=o.parseVideoSrc,[4,u(n,r)]):[2];case 1:return "string"==typeof(c=f.sent())?(t.alert(c,"error"),[2]):null==c?[2]:[4,a(n)];case 2:return 0!==(s=f.sent()).trim().indexOf("<iframe ")&&(s=s.replace(/</g,"&lt;").replace(/>/g,"&gt;")),l={type:"video",src:s,poster:r,children:[{text:""}]},Promise.resolve().then((function(){e.Transforms.insertNodes(t,l);})),i(l),[2]}}))}))}function tu(){return Jr("w-e-insert-video")}He({global:!0,wrap:!0,forced:Hi},{Promise:Ri}),io(Ri,Ii,!1),function(t){var e=G(t),n=$t.f;w&&e&&!e[uo]&&n(e,uo,{configurable:!0,get:function(){return this}});}(Ii),gi=G(Ii),He({target:Ii,stat:!0,forced:Hi},{reject:function(t){var e=Vi(this);return x(e.reject,void 0,t),e.promise}}),He({target:Ii,stat:!0,forced:Hi},{resolve:function(t){return function(t,e){if(zt(t),H(e)&&e.constructor===t)return e;var n=Si.f(t);return (0, n.resolve)(e),n.promise}(this,t)}}),He({target:Ii,stat:!0,forced:Bi},{all:function(t){var e=this,n=Vi(e),r=n.resolve,o=n.reject,i=xi((function(){var n=it(e.resolve),i=[],u=0,a=1;wo(t,(function(t){var c=u++,f=!1;a++,x(n,e,t).then((function(t){f||(f=!0,i[c]=t,--a||r(i));}),o);})),--a||r(i);}));return i.error&&o(i.value),n.promise},race:function(t){var e=this,n=Vi(e),r=n.reject,o=xi((function(){var o=it(e.resolve);wo(t,(function(t){x(o,e,t).then(n.resolve,r);}));}));return o.error&&r(o.value),n.promise}});var eu=function(){function n(){this.title=t.t("videoModule.insertVideo"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M981.184 160.096C837.568 139.456 678.848 128 512 128S186.432 139.456 42.816 160.096C15.296 267.808 0 386.848 0 512s15.264 244.16 42.816 351.904C186.464 884.544 345.152 896 512 896s325.568-11.456 469.184-32.096C1008.704 756.192 1024 637.152 1024 512s-15.264-244.16-42.816-351.904zM384 704V320l320 192-320 192z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=320,this.$content=null,this.srcInputId=tu(),this.posterInputId=tu(),this.buttonId=tu();}return n.prototype.getValue=function(t){return ""},n.prototype.isActive=function(t){return !1},n.prototype.exec=function(t,e){},n.prototype.isDisabled=function(n){var r=n.selection;return null==r||(!e.Range.isCollapsed(r)||!!t.DomEditor.getSelectedElems(n).some((function(e){var r=t.DomEditor.getNodeType(e);return "pre"===r||("list-item"===r||!!n.isVoid(e))})))},n.prototype.getModalPositionNode=function(t){return null},n.prototype.getModalContentElem=function(e){var n=this,r=this,o=r.srcInputId,i=r.posterInputId,a=r.buttonId,s=l(t.genModalInputElems(t.t("videoModule.videoSrc"),o,t.t("videoModule.videoSrcPlaceHolder")),2),d=s[0],p=s[1],v=l(t.genModalInputElems(t.t("videoModule.videoPoster"),i,t.t("videoModule.videoPosterPlaceHolder")),2),h=v[0],y=v[1],g=u.default(p),m=u.default(y),b=l(t.genModalButtonElems(a,t.t("videoModule.ok")),1)[0];if(null==this.$content){var w=u.default("<div></div>");w.on("click","#"+a,(function(t){return c(n,void 0,void 0,(function(){var n,r;return f(this,(function(u){switch(u.label){case 0:return t.preventDefault(),n=w.find("#"+o).val().trim(),r=w.find("#"+i).val().trim(),[4,Zi(e,n,r)];case 1:return u.sent(),e.hidePanelOrModal(),[2]}}))}))})),this.$content=w;}var S=this.$content;return S.empty(),S.append(d),S.append(h),S.append(b),g.val(""),m.val(""),setTimeout((function(){g.focus();})),S[0]},n}(),nu=R([].join),ru=D!=Object,ou=function(t,e){var n=[][t];return !!n&&b((function(){n.call(null,e||function(){throw 1},1);}))}("join",",");He({target:"Array",proto:!0,forced:ru||!ou},{join:function(t){return nu(_(this),void 0===t?",":t)}});var iu,uu,au,cu=!b((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),fu=Jt("IE_PROTO"),su=m.Object,lu=su.prototype,du=cu?su.getPrototypeOf:function(t){var e=vt(t);if(yt(e,fu))return e[fu];var n=e.constructor;return $(n)&&e instanceof n?n.prototype:e instanceof su?lu:null},pu=jt("iterator"),vu=!1;[].keys&&("next"in(au=[].keys())?(uu=du(du(au)))!==Object.prototype&&(iu=uu):vu=!0);var hu=null==iu||b((function(){var t={};return iu[pu].call(t)!==t}));hu&&(iu={}),$(iu[pu])||de(iu,pu,(function(){return this}));var yu={IteratorPrototype:iu,BUGGY_SAFARI_ITERATORS:vu},gu=yu.IteratorPrototype,mu=function(){return this},bu=le.PROPER,wu=le.CONFIGURABLE,Su=yu.IteratorPrototype,xu=yu.BUGGY_SAFARI_ITERATORS,Eu=jt("iterator"),Ou="keys",ju="values",Iu="entries",Pu=function(){return this},Tu=function(t,e,n,r,o,i,u){!function(t,e,n,r){var o=e+" Iterator";t.prototype=Sn(gu,{next:I(+!r,n)}),io(t,o,!1),fo[o]=mu;}(n,e,r);var a,c,f,s=function(t){if(t===o&&h)return h;if(!xu&&t in p)return p[t];switch(t){case Ou:case ju:case Iu:return function(){return new n(this,t)}}return function(){return new n(this)}},l=e+" Iterator",d=!1,p=t.prototype,v=p[Eu]||p["@@iterator"]||o&&p[o],h=!xu&&v||s(o),y="Array"==e&&p.entries||v;if(y&&(a=du(y.call(new t)))!==Object.prototype&&a.next&&(du(a)!==Su&&(no?no(a,Su):$(a[Eu])||de(a,Eu,Pu)),io(a,l,!0)),bu&&o==ju&&v&&v.name!==ju&&(wu?Ht(p,"name",ju):(d=!0,h=function(){return x(v,this)})),o)if(c={values:s(ju),keys:i?h:s(Ou),entries:s(Iu)},u)for(f in c)(xu||d||!(f in p))&&de(p,f,c[f]);else He({target:e,proto:!0,forced:xu||d},c);return p[Eu]!==h&&de(p,Eu,h,{name:o}),fo[e]=h,c},Mu="Array Iterator",Au=ae.set,Ru=ae.getterFor(Mu),ku=Tu(Array,"Array",(function(t,e){Au(this,{type:Mu,target:_(t),index:0,kind:e});}),(function(){var t=Ru(this),e=t.target,n=t.kind,r=t.index++;return !e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}}),"values");fo.Arguments=fo.Array,On("keys"),On("values"),On("entries");var Cu=Ar.charAt,Nu="String Iterator",Lu=ae.set,Vu=ae.getterFor(Nu);Tu(String,"String",(function(t){Lu(this,{type:Nu,string:Je(t),index:0});}),(function(){var t,e=Vu(this),n=e.string,r=e.index;return r>=n.length?{value:void 0,done:!0}:(t=Cu(n,r),e.index+=t.length,{value:t,done:!1})}));var Du=function(t,e,n){var r=Mt(e);r in t?$t.f(t,r,I(0,n)):t[r]=n;},zu=m.Array,Fu=Math.max,_u=Me.f,$u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Hu=function(t){try{return _u(t)}catch(t){return function(t,e,n){for(var r=Se(t),o=me(e,r),i=me(void 0===n?r:n,r),u=zu(Fu(i-o,0)),a=0;o<i;o++,a++)Du(u,a,t[o]);return u.length=a,u}($u)}},Bu={f:function(t){return $u&&"Window"==N(t)?Hu(t):_u(_(t))}},Gu=b((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8});}})),Wu=Object.isExtensible,Uu=b((function(){Wu(1);}))||Gu?function(t){return !!H(t)&&((!Gu||"ArrayBuffer"!=N(t))&&(!Wu||Wu(t)))}:Wu,qu=!b((function(){return Object.isExtensible(Object.preventExtensions({}))})),Ku=v((function(t){var e=$t.f,n=!1,r=wt("meta"),o=0,i=function(t){e(t,r,{value:{objectID:"O"+o++,weakData:{}}});},u=t.exports={enable:function(){u.enable=function(){},n=!0;var t=Me.f,e=R([].splice),o={};o[r]=1,t(o).length&&(Me.f=function(n){for(var o=t(n),i=0,u=o.length;i<u;i++)if(o[i]===r){e(o,i,1);break}return o},He({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Bu.f}));},fastKey:function(t,e){if(!H(t))return "symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!yt(t,r)){if(!Uu(t))return "F";if(!e)return "E";i(t);}return t[r].objectID},getWeakData:function(t,e){if(!yt(t,r)){if(!Uu(t))return !0;if(!e)return !1;i(t);}return t[r].weakData},onFreeze:function(t){return qu&&n&&Uu(t)&&!yt(t,r)&&i(t),t}};Qt[r]=!0;})),Xu=Ku.getWeakData,Yu=ae.set,Ju=ae.getterFor,Qu=Bn.find,Zu=Bn.findIndex,ta=R([].splice),ea=0,na=function(t){return t.frozen||(t.frozen=new ra)},ra=function(){this.entries=[];},oa=function(t,e){return Qu(t.entries,(function(t){return t[0]===e}))};ra.prototype={get:function(t){var e=oa(this,t);if(e)return e[1]},has:function(t){return !!oa(this,t)},set:function(t,e){var n=oa(this,t);n?n[1]=e:this.entries.push([t,e]);},delete:function(t){var e=Zu(this.entries,(function(e){return e[0]===t}));return ~e&&ta(this.entries,e,1),!!~e}};var ia,ua={getConstructor:function(t,e,n,r){var o=t((function(t,o){co(t,i),Yu(t,{type:e,id:ea++,frozen:void 0}),null!=o&&wo(o,t[r],{that:t,AS_ENTRIES:n});})),i=o.prototype,u=Ju(e),a=function(t,e,n){var r=u(t),o=Xu(zt(e),!0);return !0===o?na(r).set(e,n):o[r.id]=n,t};return Zr(i,{delete:function(t){var e=u(this);if(!H(t))return !1;var n=Xu(t);return !0===n?na(e).delete(t):n&&yt(n,e.id)&&delete n[e.id]},has:function(t){var e=u(this);if(!H(t))return !1;var n=Xu(t);return !0===n?na(e).has(t):n&&yt(n,e.id)}}),Zr(i,n?{get:function(t){var e=u(this);if(H(t)){var n=Xu(t);return !0===n?na(e).get(t):n?n[e.id]:void 0}},set:function(t,e){return a(this,t,e)}}:{add:function(t){return a(this,t,!0)}}),o}},aa=ae.enforce,ca=!m.ActiveXObject&&"ActiveXObject"in m,fa=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},sa=function(t,e,n){var r=-1!==t.indexOf("Map"),o=-1!==t.indexOf("Weak"),i=r?"set":"add",u=m[t],a=u&&u.prototype,c=u,f={},s=function(t){var e=R(a[t]);de(a,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return !(o&&!H(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return o&&!H(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return !(o&&!H(t))&&e(this,0===t?0:t)}:function(t,n){return e(this,0===t?0:t,n),this});};if(_e(t,!$(u)||!(o||a.forEach&&!b((function(){(new u).entries().next();})))))c=n.getConstructor(e,t,r,i),Ku.enable();else if(_e(t,!0)){var l=new c,d=l[i](o?{}:-0,1)!=l,p=b((function(){l.has(1);})),v=Mo((function(t){new u(t);})),h=!o&&b((function(){for(var t=new u,e=5;e--;)t[i](e,e);return !t.has(-0)}));v||((c=e((function(t,e){co(t,a);var n=function(t,e,n){var r,o;return no&&$(r=e.constructor)&&r!==n&&H(o=r.prototype)&&o!==n.prototype&&no(t,o),t}(new u,t,c);return null!=e&&wo(e,n[i],{that:n,AS_ENTRIES:r}),n}))).prototype=a,a.constructor=c),(p||h)&&(s("delete"),s("has"),r&&s("get")),(h||d)&&s(i),o&&a.clear&&delete a.clear;}return f[t]=c,He({global:!0,forced:c!=u},f),io(c,t),o||n.setStrong(c,t,r),c}("WeakMap",fa,ua);if(Xt&&ca){ia=ua.getConstructor(fa,"WeakMap",!0),Ku.enable();var la=sa.prototype,da=R(la.delete),pa=R(la.has),va=R(la.get),ha=R(la.set);Zr(la,{delete:function(t){if(H(t)&&!Uu(t)){var e=aa(this);return e.frozen||(e.frozen=new ia),da(this,t)||e.frozen.delete(t)}return da(this,t)},has:function(t){if(H(t)&&!Uu(t)){var e=aa(this);return e.frozen||(e.frozen=new ia),pa(this,t)||e.frozen.has(t)}return pa(this,t)},get:function(t){if(H(t)&&!Uu(t)){var e=aa(this);return e.frozen||(e.frozen=new ia),pa(this,t)?va(this,t):e.frozen.get(t)}return va(this,t)},set:function(t,e){if(H(t)&&!Uu(t)){var n=aa(this);n.frozen||(n.frozen=new ia),pa(this,t)?ha(this,t,e):n.frozen.set(t,e);}else ha(this,t,e);return this}});}var ya={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},ga=kt("span").classList,ma=ga&&ga.constructor&&ga.constructor.prototype,ba=ma===Object.prototype?void 0:ma,wa=jt("iterator"),Sa=jt("toStringTag"),xa=ku.values,Ea=function(t,e){if(t){if(t[wa]!==xa)try{Ht(t,wa,xa);}catch(e){t[wa]=xa;}if(t[Sa]||Ht(t,Sa,e),ya[e])for(var n in ku)if(t[n]!==ku[n])try{Ht(t,n,ku[n]);}catch(e){t[n]=ku[n];}}};for(var Oa in ya)Ea(m[Oa]&&m[Oa].prototype,Oa);Ea(ba,"DOMTokenList");var ja=le.EXISTS,Ia=$t.f,Pa=Function.prototype,Ta=R(Pa.toString),Ma=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Aa=R(Ma.exec);w&&!ja&&Ia(Pa,"name",{configurable:!0,get:function(){try{return Aa(Ma,Ta(this))[1]}catch(t){return ""}}});var Ra=jt("species"),ka=function(t){return J>=51||!b((function(){var e=[];return (e.constructor={})[Ra]=function(){return {foo:1}},1!==e[t](Boolean).foo}))}("slice"),Ca=jt("species"),Na=m.Array,La=Math.max;function Va(t){return t.getMenuConfig("uploadVideo")}He({target:"Array",proto:!0,forced:!ka},{slice:function(t,e){var n,r,o,i=_(this),u=Se(i),a=me(t,u),c=me(void 0===e?u:e,u);if(Mn(i)&&(n=i.constructor,(Dn(n)&&(n===Na||Mn(n.prototype))||H(n)&&null===(n=n[Ca]))&&(n=void 0),n===Na||void 0===n))return Co(i,a,c);for(r=new(void 0===n?Na:n)(La(c-a,0)),o=0;a<c;a++,o++)a in i&&Du(r,o,i[a]);return r.length=o,r}});var Da=new WeakMap;function za(e,n){return c(this,void 0,void 0,(function(){var r,o,i,u;return f(this,(function(c){switch(c.label){case 0:return r=function(e){var n=Da.get(e);if(null!=n)return n;var r=Va(e),o=r.onSuccess,i=r.onProgress,u=r.onFailed,c=r.customInsert,f=r.onError;return n=t.createUploader(a(a({},r),{onProgress:function(t){e.showProgressBar(t),i&&i(t);},onSuccess:function(t,n){if(c)return c(n,(function(t,n){return Zi(e,t,n)})),void o(t,n);var r=n.errno,i=void 0===r?1:r,a=n.data,f=void 0===a?{}:a;if(0===i){var s=f.url,l=void 0===s?"":s,d=f.poster;Zi(e,l,void 0===d?"":d),o(t,n);}else u(t,n);},onError:function(t,e,n){f(t,e,n);}})),Da.set(e,n),n}(e),o=n.name,i=n.type,u=n.size,r.addFile({name:o,type:i,size:u,data:n}),[4,r.upload()];case 1:return c.sent(),[2]}}))}))}var Fa=function(){function n(){this.title=t.t("videoModule.uploadVideo"),this.iconSvg='<svg viewBox="0 0 1056 1024"><path d="M805.902261 521.819882a251.441452 251.441452 0 0 0-251.011972 246.600033 251.051015 251.051015 0 1 0 502.023944 8.823877 253.237463 253.237463 0 0 0-251.011972-255.42391z m59.463561 240.001647v129.898403h-116.701631v-129.898403h-44.041298l101.279368-103.504859 101.279368 103.504859z" p-id="6802"></path><path d="M788.254507 0.000781H99.094092A98.663439 98.663439 0 0 0 0.001171 99.093701v590.067495a98.663439 98.663439 0 0 0 99.092921 99.092921h411.7549a266.434235 266.434235 0 0 1-2.186448-41.815807 275.843767 275.843767 0 0 1 275.180024-270.729042 270.650955 270.650955 0 0 1 103.504859 19.834201V99.093701A101.51363 101.51363 0 0 0 788.254507 0.000781zM295.054441 640.747004V147.507894l394.146189 246.600033z"></path></svg>',this.tag="button";}return n.prototype.getValue=function(t){return ""},n.prototype.isActive=function(t){return !1},n.prototype.exec=function(t,e){var n=this.getMenuConfig(t),r=n.allowedFileTypes,o=void 0===r?[]:r,i=n.customBrowseAndUpload;if(i)i((function(e,n){return Zi(t,e,n)}));else {var a="";o.length>0&&(a='accept="'+o.join(", ")+'"');var s=u.default("body"),l=u.default('<input type="file" '+a+" multiple/>");l.hide(),s.append(l),l.click(),l.on("change",(function(){var e=l[0].files;!function(t,e){var n,r;c(this,void 0,void 0,(function(){var o,i,u,a,c,s;return f(this,(function(f){switch(f.label){case 0:if(null==e)return [2];o=Array.prototype.slice.call(e),i=Va(t).customUpload,f.label=1;case 1:f.trys.push([1,9,10,15]),u=d(o),f.label=2;case 2:return [4,u.next()];case 3:return (a=f.sent()).done?[3,8]:(c=a.value,i?[4,i(c,(function(e,n){return Zi(t,e,n)}))]:[3,5]);case 4:return f.sent(),[3,7];case 5:return [4,za(t,c)];case 6:f.sent(),f.label=7;case 7:return [3,2];case 8:return [3,15];case 9:return s=f.sent(),n={error:s},[3,15];case 10:return f.trys.push([10,,13,14]),a&&!a.done&&(r=u.return)?[4,r.call(u)]:[3,12];case 11:f.sent(),f.label=12;case 12:return [3,14];case 13:if(n)throw n.error;return [7];case 14:return [7];case 15:return [2]}}))}));}(t,e);}));}},n.prototype.isDisabled=function(n){var r=n.selection;return null==r||(!e.Range.isCollapsed(r)||!!t.DomEditor.getSelectedElems(n).some((function(e){var r=t.DomEditor.getNodeType(e);return "pre"===r||("list-item"===r||!!n.isVoid(e))})))},n.prototype.getMenuConfig=function(t){return t.getMenuConfig("uploadVideo")},n}(),_a=le.PROPER,$a="toString",Ha=RegExp.prototype,Ba=Ha.toString,Ga=R(Qn),Wa=b((function(){return "/a/b"!=Ba.call({source:"a",flags:"b"})})),Ua=_a&&Ba.name!=$a;function qa(){return Jr("w-e-insert-video")}(Wa||Ua)&&de(RegExp.prototype,$a,(function(){var t=zt(this),e=Je(t.source),n=t.flags;return "/"+e+"/"+Je(void 0===n&&W(Ha,t)&&!("flags"in Ha)?Ga(t):n)}),{unsafe:!0});var Ka=function(){function n(){this.title=t.t("videoModule.editSize"),this.tag="button",this.showModal=!0,this.modalWidth=320,this.$content=null,this.widthInputId=qa(),this.heightInputId=qa(),this.buttonId=qa();}return n.prototype.getSelectedVideoNode=function(e){return t.DomEditor.getSelectedNodeByType(e,"video")},n.prototype.getValue=function(t){return ""},n.prototype.isActive=function(t){return !1},n.prototype.exec=function(t,e){},n.prototype.isDisabled=function(t){return null==t.selection||null==this.getSelectedVideoNode(t)},n.prototype.getModalPositionNode=function(t){return this.getSelectedVideoNode(t)},n.prototype.getModalContentElem=function(n){var r=this,o=r.widthInputId,i=r.heightInputId,a=r.buttonId,c=l(t.genModalInputElems(t.t("videoModule.width"),o,"auto"),2),f=c[0],s=c[1],d=u.default(s),p=l(t.genModalInputElems(t.t("videoModule.height"),i,"auto"),2),v=p[0],h=p[1],y=u.default(h),g=l(t.genModalButtonElems(a,t.t("videoModule.ok")),1)[0];if(null==this.$content){var m=u.default("<div></div>");m.on("click","#"+a,(function(r){r.preventDefault();var u=m.find("#"+o).val().trim(),a=m.find("#"+i).val().trim(),c=parseInt(u),f=parseInt(a),s=c?c.toString():"auto",l=f?f.toString():"auto";n.restoreSelection(),e.Transforms.setNodes(n,{width:s,height:l},{match:function(e){return t.DomEditor.checkNodeType(e,"video")}}),n.hidePanelOrModal();})),this.$content=m;}var b=this.$content;b.empty(),b.append(f),b.append(v),b.append(g);var w=this.getSelectedVideoNode(n);if(null==w)return b[0];var S=w.width,x=void 0===S?"auto":S,E=w.height,O=void 0===E?"auto":E;return d.val(x),y.val(O),setTimeout((function(){d.focus();})),b[0]},n}();var Xa={renderElems:[sn],elemsToHtml:[dn],preParseHtml:[In],parseElemsHtml:[Jn],menus:[{key:"insertVideo",factory:function(){return new eu},config:{onInsertedVideo:function(t){},checkVideo:function(t,e){return !0},parseVideoSrc:function(t){return t}}},{key:"uploadVideo",factory:function(){return new Fa},config:{server:"",fieldName:"wangeditor-uploaded-video",maxFileSize:10485760,maxNumberOfFiles:5,allowedFileTypes:["video/*"],meta:{},metaWithUrl:!1,withCredentials:!1,timeout:3e4,onBeforeUpload:function(t){return t},onProgress:function(t){},onSuccess:function(t,e){},onFailed:function(t,e){console.error("'"+t.name+"' upload failed",e);},onError:function(t,e,n){console.error("'"+t.name+" upload error",e,n);}}},{key:"editVideoSize",factory:function(){return new Ka}}],editorPlugin:function(n){var r=n.isVoid,o=n.normalizeNode,i=n;return i.isVoid=function(t){return "video"===t.type||r(t)},i.normalizeNode=function(n){var r=l(n,2),u=r[0],a=r[1];"video"===t.DomEditor.getNodeType(u)&&(t.DomEditor.isLastNode(i,u)&&e.Transforms.insertNodes(i,t.DomEditor.genEmptyParagraph(),{at:[a[0]+1]}));return o([u,a])},i}};return Xa}));
  20270. });
  20271. var dist$1 = createCommonjsModule$1(function (module, exports) {
  20272. !function(t,e){module.exports=e(dist$6,dist$5,require$$1);}(commonjsGlobal,(function(t,e,n){function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=r(n);t.i18nAddResources("en",{uploadImgModule:{uploadImage:"Upload Image",uploadError:"{{fileName}} upload error"}}),t.i18nAddResources("zh-CN",{uploadImgModule:{uploadImage:"上传图片",uploadError:"{{fileName}} 上传出错"}});var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{};function u(t){var e={exports:{}};return t(e,e.exports),e.exports}var a,c,f=function(t){return t&&t.Math==Math&&t},s=f("object"==typeof globalThis&&globalThis)||f("object"==typeof window&&window)||f("object"==typeof self&&self)||f("object"==typeof i&&i)||function(){return this}()||Function("return this")(),l=function(t){try{return !!t()}catch(t){return !0}},p=!l((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),d=Function.prototype.call,v=d.bind?d.bind(d):function(){return d.apply(d,arguments)},h={}.propertyIsEnumerable,y=Object.getOwnPropertyDescriptor,g={f:y&&!h.call({1:2},1)?function(t){var e=y(this,t);return !!e&&e.enumerable}:h},m=function(t,e){return {enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},b=Function.prototype,w=b.bind,x=b.call,S=w&&w.bind(x),O=w?function(t){return t&&S(x,t)}:function(t){return t&&function(){return x.apply(t,arguments)}},E=O({}.toString),j=O("".slice),I=function(t){return j(E(t),8,-1)},T=s.Object,A=O("".split),P=l((function(){return !T("z").propertyIsEnumerable(0)}))?function(t){return "String"==I(t)?A(t,""):T(t)}:T,R=s.TypeError,M=function(t){if(null==t)throw R("Can't call method on "+t);return t},k=function(t){return P(M(t))},L=function(t){return "function"==typeof t},F=function(t){return "object"==typeof t?null!==t:L(t)},C=function(t){return L(t)?t:void 0},N=function(t,e){return arguments.length<2?C(s[t]):s[t]&&s[t][e]},z=O({}.isPrototypeOf),_=N("navigator","userAgent")||"",D=s.process,U=s.Deno,G=D&&D.versions||U&&U.version,B=G&&G.v8;B&&(c=(a=B.split("."))[0]>0&&a[0]<4?1:+(a[0]+a[1])),!c&&_&&(!(a=_.match(/Edge\/(\d+)/))||a[1]>=74)&&(a=_.match(/Chrome\/(\d+)/))&&(c=+a[1]);var W=c,V=!!Object.getOwnPropertySymbols&&!l((function(){var t=Symbol();return !String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&W&&W<41})),H=V&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,q=s.Object,K=H?function(t){return "symbol"==typeof t}:function(t){var e=N("Symbol");return L(e)&&z(e.prototype,q(t))},Y=s.String,X=function(t){try{return Y(t)}catch(t){return "Object"}},$=s.TypeError,J=function(t){if(L(t))return t;throw $(X(t)+" is not a function")},Q=function(t,e){var n=t[e];return null==n?void 0:J(n)},Z=s.TypeError,tt=Object.defineProperty,et=function(t,e){try{tt(s,t,{value:e,configurable:!0,writable:!0});}catch(n){s[t]=e;}return e},nt="__core-js_shared__",rt=s[nt]||et(nt,{}),ot=u((function(t){(t.exports=function(t,e){return rt[t]||(rt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});})),it=s.Object,ut=function(t){return it(M(t))},at=O({}.hasOwnProperty),ct=Object.hasOwn||function(t,e){return at(ut(t),e)},ft=0,st=Math.random(),lt=O(1..toString),pt=function(t){return "Symbol("+(void 0===t?"":t)+")_"+lt(++ft+st,36)},dt=ot("wks"),vt=s.Symbol,ht=vt&&vt.for,yt=H?vt:vt&&vt.withoutSetter||pt,gt=function(t){if(!ct(dt,t)||!V&&"string"!=typeof dt[t]){var e="Symbol."+t;V&&ct(vt,t)?dt[t]=vt[t]:dt[t]=H&&ht?ht(e):yt(e);}return dt[t]},mt=s.TypeError,bt=gt("toPrimitive"),wt=function(t,e){if(!F(t)||K(t))return t;var n,r=Q(t,bt);if(r){if(void 0===e&&(e="default"),n=v(r,t,e),!F(n)||K(n))return n;throw mt("Can't convert object to primitive value")}return void 0===e&&(e="number"),function(t,e){var n,r;if("string"===e&&L(n=t.toString)&&!F(r=v(n,t)))return r;if(L(n=t.valueOf)&&!F(r=v(n,t)))return r;if("string"!==e&&L(n=t.toString)&&!F(r=v(n,t)))return r;throw Z("Can't convert object to primitive value")}(t,e)},xt=function(t){var e=wt(t,"string");return K(e)?e:e+""},St=s.document,Ot=F(St)&&F(St.createElement),Et=function(t){return Ot?St.createElement(t):{}},jt=!p&&!l((function(){return 7!=Object.defineProperty(Et("div"),"a",{get:function(){return 7}}).a})),It=Object.getOwnPropertyDescriptor,Tt={f:p?It:function(t,e){if(t=k(t),e=xt(e),jt)try{return It(t,e)}catch(t){}if(ct(t,e))return m(!v(g.f,t,e),t[e])}},At=s.String,Pt=s.TypeError,Rt=function(t){if(F(t))return t;throw Pt(At(t)+" is not an object")},Mt=s.TypeError,kt=Object.defineProperty,Lt={f:p?kt:function(t,e,n){if(Rt(t),e=xt(e),Rt(n),jt)try{return kt(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Mt("Accessors not supported");return "value"in n&&(t[e]=n.value),t}},Ft=p?function(t,e,n){return Lt.f(t,e,m(1,n))}:function(t,e,n){return t[e]=n,t},Ct=O(Function.toString);L(rt.inspectSource)||(rt.inspectSource=function(t){return Ct(t)});var Nt,zt,_t,Dt=rt.inspectSource,Ut=s.WeakMap,Gt=L(Ut)&&/native code/.test(Dt(Ut)),Bt=ot("keys"),Wt=function(t){return Bt[t]||(Bt[t]=pt(t))},Vt={},Ht="Object already initialized",qt=s.TypeError,Kt=s.WeakMap;if(Gt||rt.state){var Yt=rt.state||(rt.state=new Kt),Xt=O(Yt.get),$t=O(Yt.has),Jt=O(Yt.set);Nt=function(t,e){if($t(Yt,t))throw new qt(Ht);return e.facade=t,Jt(Yt,t,e),e},zt=function(t){return Xt(Yt,t)||{}},_t=function(t){return $t(Yt,t)};}else {var Qt=Wt("state");Vt[Qt]=!0,Nt=function(t,e){if(ct(t,Qt))throw new qt(Ht);return e.facade=t,Ft(t,Qt,e),e},zt=function(t){return ct(t,Qt)?t[Qt]:{}},_t=function(t){return ct(t,Qt)};}var Zt={set:Nt,get:zt,has:_t,enforce:function(t){return _t(t)?zt(t):Nt(t,{})},getterFor:function(t){return function(e){var n;if(!F(e)||(n=zt(e)).type!==t)throw qt("Incompatible receiver, "+t+" required");return n}}},te=Function.prototype,ee=p&&Object.getOwnPropertyDescriptor,ne=ct(te,"name"),re={EXISTS:ne,PROPER:ne&&"something"===function(){}.name,CONFIGURABLE:ne&&(!p||p&&ee(te,"name").configurable)},oe=u((function(t){var e=re.CONFIGURABLE,n=Zt.get,r=Zt.enforce,o=String(String).split("String");(t.exports=function(t,n,i,u){var a,c=!!u&&!!u.unsafe,f=!!u&&!!u.enumerable,l=!!u&&!!u.noTargetGet,p=u&&void 0!==u.name?u.name:n;L(i)&&("Symbol("===String(p).slice(0,7)&&(p="["+String(p).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!ct(i,"name")||e&&i.name!==p)&&Ft(i,"name",p),(a=r(i)).source||(a.source=o.join("string"==typeof p?p:""))),t!==s?(c?!l&&t[n]&&(f=!0):delete t[n],f?t[n]=i:Ft(t,n,i)):f?t[n]=i:et(n,i);})(Function.prototype,"toString",(function(){return L(this)&&n(this).source||Dt(this)}));})),ie=Math.ceil,ue=Math.floor,ae=function(t){var e=+t;return e!=e||0===e?0:(e>0?ue:ie)(e)},ce=Math.max,fe=Math.min,se=function(t,e){var n=ae(t);return n<0?ce(n+e,0):fe(n,e)},le=Math.min,pe=function(t){return t>0?le(ae(t),9007199254740991):0},de=function(t){return pe(t.length)},ve=function(t){return function(e,n,r){var o,i=k(e),u=de(i),a=se(r,u);if(t&&n!=n){for(;u>a;)if((o=i[a++])!=o)return !0}else for(;u>a;a++)if((t||a in i)&&i[a]===n)return t||a||0;return !t&&-1}},he={includes:ve(!0),indexOf:ve(!1)}.indexOf,ye=O([].push),ge=function(t,e){var n,r=k(t),o=0,i=[];for(n in r)!ct(Vt,n)&&ct(r,n)&&ye(i,n);for(;e.length>o;)ct(r,n=e[o++])&&(~he(i,n)||ye(i,n));return i},me=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],be=me.concat("length","prototype"),we={f:Object.getOwnPropertyNames||function(t){return ge(t,be)}},xe={f:Object.getOwnPropertySymbols},Se=O([].concat),Oe=N("Reflect","ownKeys")||function(t){var e=we.f(Rt(t)),n=xe.f;return n?Se(e,n(t)):e},Ee=function(t,e){for(var n=Oe(e),r=Lt.f,o=Tt.f,i=0;i<n.length;i++){var u=n[i];ct(t,u)||r(t,u,o(e,u));}},je=/#|\.prototype\./,Ie=function(t,e){var n=Ae[Te(t)];return n==Re||n!=Pe&&(L(e)?l(e):!!e)},Te=Ie.normalize=function(t){return String(t).replace(je,".").toLowerCase()},Ae=Ie.data={},Pe=Ie.NATIVE="N",Re=Ie.POLYFILL="P",Me=Ie,ke=Tt.f,Le=function(t,e){var n,r,o,i,u,a=t.target,c=t.global,f=t.stat;if(n=c?s:f?s[a]||et(a,{}):(s[a]||{}).prototype)for(r in e){if(i=e[r],o=t.noTargetGet?(u=ke(n,r))&&u.value:n[r],!Me(c?r:a+(f?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;Ee(i,o);}(t.sham||o&&o.sham)&&Ft(i,"sham",!0),oe(n,r,i,t);}},Fe=Array.isArray||function(t){return "Array"==I(t)},Ce={};Ce[gt("toStringTag")]="z";var Ne,ze="[object z]"===String(Ce),_e=gt("toStringTag"),De=s.Object,Ue="Arguments"==I(function(){return arguments}()),Ge=ze?I:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=De(t),_e))?n:Ue?I(e):"Object"==(r=I(e))&&L(e.callee)?"Arguments":r},Be=function(){},We=[],Ve=N("Reflect","construct"),He=/^\s*(?:class|function)\b/,qe=O(He.exec),Ke=!He.exec(Be),Ye=function(t){if(!L(t))return !1;try{return Ve(Be,We,t),!0}catch(t){return !1}},Xe=!Ve||l((function(){var t;return Ye(Ye.call)||!Ye(Object)||!Ye((function(){t=!0;}))||t}))?function(t){if(!L(t))return !1;switch(Ge(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return !1}return Ke||!!qe(He,Dt(t))}:Ye,$e=function(t,e,n){var r=xt(e);r in t?Lt.f(t,r,m(0,n)):t[r]=n;},Je=gt("species"),Qe=O([].slice),Ze=(Ne="slice",W>=51||!l((function(){var t=[];return (t.constructor={})[Je]=function(){return {foo:1}},1!==t[Ne](Boolean).foo}))),tn=gt("species"),en=s.Array,nn=Math.max;Le({target:"Array",proto:!0,forced:!Ze},{slice:function(t,e){var n,r,o,i=k(this),u=de(i),a=se(t,u),c=se(void 0===e?u:e,u);if(Fe(i)&&(n=i.constructor,(Xe(n)&&(n===en||Fe(n.prototype))||F(n)&&null===(n=n[tn]))&&(n=void 0),n===en||void 0===n))return Qe(i,a,c);for(r=new(void 0===n?en:n)(nn(c-a,0)),o=0;a<c;a++,o++)a in i&&$e(r,o,i[a]);return r.length=o,r}});var rn=ze?{}.toString:function(){return "[object "+Ge(this)+"]"};ze||oe(Object.prototype,"toString",rn,{unsafe:!0});var on,un=s.String,an=function(t){if("Symbol"===Ge(t))throw TypeError("Cannot convert a Symbol value to a string");return un(t)},cn=function(){var t=Rt(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},fn=s.RegExp,sn=l((function(){var t=fn("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),ln=sn||l((function(){return !fn("a","y").sticky})),pn={BROKEN_CARET:sn||l((function(){var t=fn("^r","gy");return t.lastIndex=2,null!=t.exec("str")})),MISSED_STICKY:ln,UNSUPPORTED_Y:sn},dn=Object.keys||function(t){return ge(t,me)},vn=p?Object.defineProperties:function(t,e){Rt(t);for(var n,r=k(e),o=dn(e),i=o.length,u=0;i>u;)Lt.f(t,n=o[u++],r[n]);return t},hn=N("document","documentElement"),yn=Wt("IE_PROTO"),gn=function(){},mn=function(t){return "<script>"+t+"</"+"script>"},bn=function(t){t.write(mn("")),t.close();var e=t.parentWindow.Object;return t=null,e},wn=function(){try{on=new ActiveXObject("htmlfile");}catch(t){}var t,e;wn="undefined"!=typeof document?document.domain&&on?bn(on):((e=Et("iframe")).style.display="none",hn.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(mn("document.F=Object")),t.close(),t.F):bn(on);for(var n=me.length;n--;)delete wn.prototype[me[n]];return wn()};Vt[yn]=!0;var xn,Sn,On=Object.create||function(t,e){var n;return null!==t?(gn.prototype=Rt(t),n=new gn,gn.prototype=null,n[yn]=t):n=wn(),void 0===e?n:vn(n,e)},En=s.RegExp,jn=l((function(){var t=En(".","s");return !(t.dotAll&&t.exec("\n")&&"s"===t.flags)})),In=s.RegExp,Tn=l((function(){var t=In("(?<a>b)","g");return "b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})),An=Zt.get,Pn=ot("native-string-replace",String.prototype.replace),Rn=RegExp.prototype.exec,Mn=Rn,kn=O("".charAt),Ln=O("".indexOf),Fn=O("".replace),Cn=O("".slice),Nn=(Sn=/b*/g,v(Rn,xn=/a/,"a"),v(Rn,Sn,"a"),0!==xn.lastIndex||0!==Sn.lastIndex),zn=pn.BROKEN_CARET,_n=void 0!==/()??/.exec("")[1];(Nn||_n||zn||jn||Tn)&&(Mn=function(t){var e,n,r,o,i,u,a,c=this,f=An(c),s=an(t),l=f.raw;if(l)return l.lastIndex=c.lastIndex,e=v(Mn,l,s),c.lastIndex=l.lastIndex,e;var p=f.groups,d=zn&&c.sticky,h=v(cn,c),y=c.source,g=0,m=s;if(d&&(h=Fn(h,"y",""),-1===Ln(h,"g")&&(h+="g"),m=Cn(s,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==kn(s,c.lastIndex-1))&&(y="(?: "+y+")",m=" "+m,g++),n=new RegExp("^(?:"+y+")",h)),_n&&(n=new RegExp("^"+y+"$(?!\\s)",h)),Nn&&(r=c.lastIndex),o=v(Rn,d?n:c,m),d?o?(o.input=Cn(o.input,g),o[0]=Cn(o[0],g),o.index=c.lastIndex,c.lastIndex+=o[0].length):c.lastIndex=0:Nn&&o&&(c.lastIndex=c.global?o.index+o[0].length:r),_n&&o&&o.length>1&&v(Pn,o[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(o[i]=void 0);})),o&&p)for(o.groups=u=On(null),i=0;i<p.length;i++)u[(a=p[i])[0]]=o[a[1]];return o});var Dn=Mn;Le({target:"RegExp",proto:!0,forced:/./.exec!==Dn},{exec:Dn});var Un=Function.prototype,Gn=Un.apply,Bn=Un.bind,Wn=Un.call,Vn="object"==typeof Reflect&&Reflect.apply||(Bn?Wn.bind(Gn):function(){return Wn.apply(Gn,arguments)}),Hn=gt("species"),qn=RegExp.prototype,Kn=gt("match"),Yn=s.TypeError,Xn=gt("species"),$n=function(t,e){var n,r=Rt(t).constructor;return void 0===r||null==(n=Rt(r)[Xn])?e:function(t){if(Xe(t))return t;throw Yn(X(t)+" is not a constructor")}(n)},Jn=O("".charAt),Qn=O("".charCodeAt),Zn=O("".slice),tr=function(t){return function(e,n){var r,o,i=an(M(e)),u=ae(n),a=i.length;return u<0||u>=a?t?"":void 0:(r=Qn(i,u))<55296||r>56319||u+1===a||(o=Qn(i,u+1))<56320||o>57343?t?Jn(i,u):r:t?Zn(i,u,u+2):o-56320+(r-55296<<10)+65536}},er={codeAt:tr(!1),charAt:tr(!0)},nr=er.charAt,rr=function(t,e,n){return e+(n?nr(t,e).length:1)},or=s.Array,ir=Math.max,ur=function(t,e,n){for(var r=de(t),o=se(e,r),i=se(void 0===n?r:n,r),u=or(ir(i-o,0)),a=0;o<i;o++,a++)$e(u,a,t[o]);return u.length=a,u},ar=s.TypeError,cr=function(t,e){var n=t.exec;if(L(n)){var r=v(n,t,e);return null!==r&&Rt(r),r}if("RegExp"===I(t))return v(Dn,t,e);throw ar("RegExp#exec called on incompatible receiver")},fr=pn.UNSUPPORTED_Y,sr=4294967295,lr=Math.min,pr=[].push,dr=O(/./.exec),vr=O(pr),hr=O("".slice),yr=!l((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));!function(t,e,n,r){var o=gt(t),i=!l((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),u=i&&!l((function(){var e=!1,n=/a/;return "split"===t&&((n={}).constructor={},n.constructor[Hn]=function(){return n},n.flags="",n[o]=/./[o]),n.exec=function(){return e=!0,null},n[o](""),!e}));if(!i||!u||n){var a=O(/./[o]),c=e(o,""[t],(function(t,e,n,r,o){var u=O(t),c=e.exec;return c===Dn||c===qn.exec?i&&!o?{done:!0,value:a(e,n,r)}:{done:!0,value:u(n,e,r)}:{done:!1}}));oe(String.prototype,t,c[0]),oe(qn,o,c[1]);}r&&Ft(qn[o],"sham",!0);}("split",(function(t,e,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,n){var r,o,i=an(M(this)),u=void 0===n?sr:n>>>0;if(0===u)return [];if(void 0===t)return [i];if(!F(r=t)||!(void 0!==(o=r[Kn])?o:"RegExp"==I(r)))return v(e,i,t,u);for(var a,c,f,s=[],l=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),p=0,d=new RegExp(t.source,l+"g");(a=v(Dn,d,i))&&!((c=d.lastIndex)>p&&(vr(s,hr(i,p,a.index)),a.length>1&&a.index<i.length&&Vn(pr,s,ur(a,1)),f=a[0].length,p=c,s.length>=u));)d.lastIndex===a.index&&d.lastIndex++;return p===i.length?!f&&dr(d,"")||vr(s,""):vr(s,hr(i,p)),s.length>u?ur(s,0,u):s}:"0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:v(e,this,t,n)}:e,[function(e,n){var o=M(this),i=null==e?void 0:Q(e,t);return i?v(i,e,o,n):v(r,an(o),e,n)},function(t,o){var i=Rt(this),u=an(t),a=n(r,i,u,o,r!==e);if(a.done)return a.value;var c=$n(i,RegExp),f=i.unicode,s=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(fr?"g":"y"),l=new c(fr?"^(?:"+i.source+")":i,s),p=void 0===o?sr:o>>>0;if(0===p)return [];if(0===u.length)return null===cr(l,u)?[u]:[];for(var d=0,v=0,h=[];v<u.length;){l.lastIndex=fr?0:v;var y,g=cr(l,fr?hr(u,v):u);if(null===g||(y=lr(pe(l.lastIndex+(fr?v:0)),u.length))===d)v=rr(u,v,f);else {if(vr(h,hr(u,d,v)),h.length===p)return h;for(var m=1;m<=g.length-1;m++)if(vr(h,g[m]),h.length===p)return h;v=d=y;}}return vr(h,hr(u,d)),h}]}),!yr,fr);
  20273. /*! *****************************************************************************
  20274. Copyright (c) Microsoft Corporation.
  20275. Permission to use, copy, modify, and/or distribute this software for any
  20276. purpose with or without fee is hereby granted.
  20277. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  20278. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  20279. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  20280. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  20281. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  20282. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  20283. PERFORMANCE OF THIS SOFTWARE.
  20284. ***************************************************************************** */
  20285. var gr=function(){return gr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},gr.apply(this,arguments)};function mr(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t));}catch(t){i(t);}}function a(t){try{c(r.throw(t));}catch(t){i(t);}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e);}))).then(u,a);}c((r=r.apply(t,e||[])).next());}))}function br(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u);}catch(t){i=[6,t],r=0;}finally{n=o=0;}if(5&i[0])throw i[1];return {value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function wr(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return {next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function xr(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=wr(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n});}),e);})(r,o,(e=t[n](e)).done,e.value);}))};}}var Sr=gt("unscopables"),Or=Array.prototype;null==Or[Sr]&&Lt.f(Or,Sr,{configurable:!0,value:On(null)});var Er,jr,Ir,Tr=function(t){Or[Sr][t]=!0;},Ar={},Pr=!l((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Rr=Wt("IE_PROTO"),Mr=s.Object,kr=Mr.prototype,Lr=Pr?Mr.getPrototypeOf:function(t){var e=ut(t);if(ct(e,Rr))return e[Rr];var n=e.constructor;return L(n)&&e instanceof n?n.prototype:e instanceof Mr?kr:null},Fr=gt("iterator"),Cr=!1;[].keys&&("next"in(Ir=[].keys())?(jr=Lr(Lr(Ir)))!==Object.prototype&&(Er=jr):Cr=!0);var Nr=null==Er||l((function(){var t={};return Er[Fr].call(t)!==t}));Nr&&(Er={}),L(Er[Fr])||oe(Er,Fr,(function(){return this}));var zr={IteratorPrototype:Er,BUGGY_SAFARI_ITERATORS:Cr},_r=Lt.f,Dr=gt("toStringTag"),Ur=function(t,e,n){t&&!ct(t=n?t:t.prototype,Dr)&&_r(t,Dr,{configurable:!0,value:e});},Gr=zr.IteratorPrototype,Br=function(){return this},Wr=s.String,Vr=s.TypeError,Hr=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=O(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),e=n instanceof Array;}catch(t){}return function(n,r){return Rt(n),function(t){if("object"==typeof t||L(t))return t;throw Vr("Can't set "+Wr(t)+" as a prototype")}(r),e?t(n,r):n.__proto__=r,n}}():void 0),qr=re.PROPER,Kr=re.CONFIGURABLE,Yr=zr.IteratorPrototype,Xr=zr.BUGGY_SAFARI_ITERATORS,$r=gt("iterator"),Jr="keys",Qr="values",Zr="entries",to=function(){return this},eo=function(t,e,n,r,o,i,u){!function(t,e,n,r){var o=e+" Iterator";t.prototype=On(Gr,{next:m(+!r,n)}),Ur(t,o,!1),Ar[o]=Br;}(n,e,r);var a,c,f,s=function(t){if(t===o&&y)return y;if(!Xr&&t in d)return d[t];switch(t){case Jr:case Qr:case Zr:return function(){return new n(this,t)}}return function(){return new n(this)}},l=e+" Iterator",p=!1,d=t.prototype,h=d[$r]||d["@@iterator"]||o&&d[o],y=!Xr&&h||s(o),g="Array"==e&&d.entries||h;if(g&&(a=Lr(g.call(new t)))!==Object.prototype&&a.next&&(Lr(a)!==Yr&&(Hr?Hr(a,Yr):L(a[$r])||oe(a,$r,to)),Ur(a,l,!0)),qr&&o==Qr&&h&&h.name!==Qr&&(Kr?Ft(d,"name",Qr):(p=!0,y=function(){return v(h,this)})),o)if(c={values:s(Qr),keys:i?y:s(Jr),entries:s(Zr)},u)for(f in c)(Xr||p||!(f in d))&&oe(d,f,c[f]);else Le({target:e,proto:!0,forced:Xr||p},c);return d[$r]!==y&&oe(d,$r,y,{name:o}),Ar[e]=y,c},no="Array Iterator",ro=Zt.set,oo=Zt.getterFor(no),io=eo(Array,"Array",(function(t,e){ro(this,{type:no,target:k(t),index:0,kind:e});}),(function(){var t=oo(this),e=t.target,n=t.kind,r=t.index++;return !e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}}),"values");Ar.Arguments=Ar.Array,Tr("keys"),Tr("values"),Tr("entries");var uo=er.charAt,ao="String Iterator",co=Zt.set,fo=Zt.getterFor(ao);eo(String,"String",(function(t){co(this,{type:ao,string:an(t),index:0});}),(function(){var t,e=fo(this),n=e.string,r=e.index;return r>=n.length?{value:void 0,done:!0}:(t=uo(n,r),e.index+=t.length,{value:t,done:!1})}));var so=function(t,e,n){for(var r in e)oe(t,r,e[r],n);return t},lo=we.f,po="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],vo={f:function(t){return po&&"Window"==I(t)?function(t){try{return lo(t)}catch(t){return ur(po)}}(t):lo(k(t))}},ho=l((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8});}})),yo=Object.isExtensible,go=l((function(){yo(1);}))||ho?function(t){return !!F(t)&&((!ho||"ArrayBuffer"!=I(t))&&(!yo||yo(t)))}:yo,mo=!l((function(){return Object.isExtensible(Object.preventExtensions({}))})),bo=u((function(t){var e=Lt.f,n=!1,r=pt("meta"),o=0,i=function(t){e(t,r,{value:{objectID:"O"+o++,weakData:{}}});},u=t.exports={enable:function(){u.enable=function(){},n=!0;var t=we.f,e=O([].splice),o={};o[r]=1,t(o).length&&(we.f=function(n){for(var o=t(n),i=0,u=o.length;i<u;i++)if(o[i]===r){e(o,i,1);break}return o},Le({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:vo.f}));},fastKey:function(t,e){if(!F(t))return "symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!ct(t,r)){if(!go(t))return "F";if(!e)return "E";i(t);}return t[r].objectID},getWeakData:function(t,e){if(!ct(t,r)){if(!go(t))return !0;if(!e)return !1;i(t);}return t[r].weakData},onFreeze:function(t){return mo&&n&&go(t)&&!ct(t,r)&&i(t),t}};Vt[r]=!0;})),wo=O(O.bind),xo=function(t,e){return J(t),void 0===e?t:wo?wo(t,e):function(){return t.apply(e,arguments)}},So=gt("iterator"),Oo=Array.prototype,Eo=gt("iterator"),jo=function(t){if(null!=t)return Q(t,Eo)||Q(t,"@@iterator")||Ar[Ge(t)]},Io=s.TypeError,To=function(t,e,n){var r,o;Rt(t);try{if(!(r=Q(t,"return"))){if("throw"===e)throw n;return n}r=v(r,t);}catch(t){o=!0,r=t;}if("throw"===e)throw n;if(o)throw r;return Rt(r),n},Ao=s.TypeError,Po=function(t,e){this.stopped=t,this.result=e;},Ro=Po.prototype,Mo=function(t,e,n){var r,o,i,u,a,c,f,s,l=n&&n.that,p=!(!n||!n.AS_ENTRIES),d=!(!n||!n.IS_ITERATOR),h=!(!n||!n.INTERRUPTED),y=xo(e,l),g=function(t){return r&&To(r,"normal",t),new Po(!0,t)},m=function(t){return p?(Rt(t),h?y(t[0],t[1],g):y(t[0],t[1])):h?y(t,g):y(t)};if(d)r=t;else {if(!(o=jo(t)))throw Ao(X(t)+" is not iterable");if(void 0!==(s=o)&&(Ar.Array===s||Oo[So]===s)){for(i=0,u=de(t);u>i;i++)if((a=m(t[i]))&&z(Ro,a))return a;return new Po(!1)}r=function(t,e){var n=arguments.length<2?jo(t):e;if(J(n))return Rt(v(n,t));throw Io(X(t)+" is not iterable")}(t,o);}for(c=r.next;!(f=v(c,r)).done;){try{a=m(f.value);}catch(t){To(r,"throw",t);}if("object"==typeof a&&a&&z(Ro,a))return a}return new Po(!1)},ko=s.TypeError,Lo=function(t,e){if(z(e,t))return t;throw ko("Incorrect invocation")},Fo=gt("iterator"),Co=!1;try{var No=0,zo={next:function(){return {done:!!No++}},return:function(){Co=!0;}};zo[Fo]=function(){return this},Array.from(zo,(function(){throw 2}));}catch(t){}var _o=function(t,e){if(!e&&!Co)return !1;var n=!1;try{var r={};r[Fo]=function(){return {next:function(){return {done:n=!0}}}},t(r);}catch(t){}return n},Do=gt("species"),Uo=s.Array,Go=function(t,e){return new(function(t){var e;return Fe(t)&&(e=t.constructor,(Xe(e)&&(e===Uo||Fe(e.prototype))||F(e)&&null===(e=e[Do]))&&(e=void 0)),void 0===e?Uo:e}(t))(0===e?0:e)},Bo=O([].push),Wo=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,u=7==t,a=5==t||i;return function(c,f,s,l){for(var p,d,v=ut(c),h=P(v),y=xo(f,s),g=de(h),m=0,b=l||Go,w=e?b(c,g):n||u?b(c,0):void 0;g>m;m++)if((a||m in h)&&(d=y(p=h[m],m,v),t))if(e)w[m]=d;else if(d)switch(t){case 3:return !0;case 5:return p;case 6:return m;case 2:Bo(w,p);}else switch(t){case 4:return !1;case 7:Bo(w,p);}return i?-1:r||o?o:w}},Vo={forEach:Wo(0),map:Wo(1),filter:Wo(2),some:Wo(3),every:Wo(4),find:Wo(5),findIndex:Wo(6),filterReject:Wo(7)},Ho=bo.getWeakData,qo=Zt.set,Ko=Zt.getterFor,Yo=Vo.find,Xo=Vo.findIndex,$o=O([].splice),Jo=0,Qo=function(t){return t.frozen||(t.frozen=new Zo)},Zo=function(){this.entries=[];},ti=function(t,e){return Yo(t.entries,(function(t){return t[0]===e}))};Zo.prototype={get:function(t){var e=ti(this,t);if(e)return e[1]},has:function(t){return !!ti(this,t)},set:function(t,e){var n=ti(this,t);n?n[1]=e:this.entries.push([t,e]);},delete:function(t){var e=Xo(this.entries,(function(e){return e[0]===t}));return ~e&&$o(this.entries,e,1),!!~e}};var ei,ni={getConstructor:function(t,e,n,r){var o=t((function(t,o){Lo(t,i),qo(t,{type:e,id:Jo++,frozen:void 0}),null!=o&&Mo(o,t[r],{that:t,AS_ENTRIES:n});})),i=o.prototype,u=Ko(e),a=function(t,e,n){var r=u(t),o=Ho(Rt(e),!0);return !0===o?Qo(r).set(e,n):o[r.id]=n,t};return so(i,{delete:function(t){var e=u(this);if(!F(t))return !1;var n=Ho(t);return !0===n?Qo(e).delete(t):n&&ct(n,e.id)&&delete n[e.id]},has:function(t){var e=u(this);if(!F(t))return !1;var n=Ho(t);return !0===n?Qo(e).has(t):n&&ct(n,e.id)}}),so(i,n?{get:function(t){var e=u(this);if(F(t)){var n=Ho(t);return !0===n?Qo(e).get(t):n?n[e.id]:void 0}},set:function(t,e){return a(this,t,e)}}:{add:function(t){return a(this,t,!0)}}),o}},ri=Zt.enforce,oi=!s.ActiveXObject&&"ActiveXObject"in s,ii=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},ui=function(t,e,n){var r=-1!==t.indexOf("Map"),o=-1!==t.indexOf("Weak"),i=r?"set":"add",u=s[t],a=u&&u.prototype,c=u,f={},p=function(t){var e=O(a[t]);oe(a,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return !(o&&!F(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return o&&!F(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return !(o&&!F(t))&&e(this,0===t?0:t)}:function(t,n){return e(this,0===t?0:t,n),this});};if(Me(t,!L(u)||!(o||a.forEach&&!l((function(){(new u).entries().next();})))))c=n.getConstructor(e,t,r,i),bo.enable();else if(Me(t,!0)){var d=new c,v=d[i](o?{}:-0,1)!=d,h=l((function(){d.has(1);})),y=_o((function(t){new u(t);})),g=!o&&l((function(){for(var t=new u,e=5;e--;)t[i](e,e);return !t.has(-0)}));y||((c=e((function(t,e){Lo(t,a);var n=function(t,e,n){var r,o;return Hr&&L(r=e.constructor)&&r!==n&&F(o=r.prototype)&&o!==n.prototype&&Hr(t,o),t}(new u,t,c);return null!=e&&Mo(e,n[i],{that:n,AS_ENTRIES:r}),n}))).prototype=a,a.constructor=c),(h||g)&&(p("delete"),p("has"),r&&p("get")),(g||v)&&p(i),o&&a.clear&&delete a.clear;}return f[t]=c,Le({global:!0,forced:c!=u},f),Ur(c,t),o||n.setStrong(c,t,r),c}("WeakMap",ii,ni);if(Gt&&oi){ei=ni.getConstructor(ii,"WeakMap",!0),bo.enable();var ai=ui.prototype,ci=O(ai.delete),fi=O(ai.has),si=O(ai.get),li=O(ai.set);so(ai,{delete:function(t){if(F(t)&&!go(t)){var e=ri(this);return e.frozen||(e.frozen=new ei),ci(this,t)||e.frozen.delete(t)}return ci(this,t)},has:function(t){if(F(t)&&!go(t)){var e=ri(this);return e.frozen||(e.frozen=new ei),fi(this,t)||e.frozen.has(t)}return fi(this,t)},get:function(t){if(F(t)&&!go(t)){var e=ri(this);return e.frozen||(e.frozen=new ei),fi(this,t)?si(this,t):e.frozen.get(t)}return si(this,t)},set:function(t,e){if(F(t)&&!go(t)){var n=ri(this);n.frozen||(n.frozen=new ei),fi(this,t)?li(this,t,e):n.frozen.set(t,e);}else li(this,t,e);return this}});}var pi={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},di=Et("span").classList,vi=di&&di.constructor&&di.constructor.prototype,hi=vi===Object.prototype?void 0:vi,yi=gt("iterator"),gi=gt("toStringTag"),mi=io.values,bi=function(t,e){if(t){if(t[yi]!==mi)try{Ft(t,yi,mi);}catch(e){t[yi]=mi;}if(t[gi]||Ft(t,gi,e),pi[e])for(var n in io)if(t[n]!==io[n])try{Ft(t,n,io[n]);}catch(e){t[n]=io[n];}}};for(var wi in pi)bi(s[wi]&&s[wi].prototype,wi);bi(hi,"DOMTokenList");var xi=function(t,e){var n=[][t];return !!n&&l((function(){n.call(null,e||function(){throw 1},1);}))},Si=Vo.forEach,Oi=xi("forEach")?[].forEach:function(t){return Si(this,t,arguments.length>1?arguments[1]:void 0)},Ei=function(t){if(t&&t.forEach!==Oi)try{Ft(t,"forEach",Oi);}catch(e){t.forEach=Oi;}};for(var ji in pi)pi[ji]&&Ei(s[ji]&&s[ji].prototype);Ei(hi);var Ii,Ti,Ai,Pi,Ri=s.Promise,Mi=gt("species"),ki=/(?:ipad|iphone|ipod).*applewebkit/i.test(_),Li="process"==I(s.process),Fi=s.setImmediate,Ci=s.clearImmediate,Ni=s.process,zi=s.Dispatch,_i=s.Function,Di=s.MessageChannel,Ui=s.String,Gi=0,Bi={},Wi="onreadystatechange";try{Ii=s.location;}catch(t){}var Vi=function(t){if(ct(Bi,t)){var e=Bi[t];delete Bi[t],e();}},Hi=function(t){return function(){Vi(t);}},qi=function(t){Vi(t.data);},Ki=function(t){s.postMessage(Ui(t),Ii.protocol+"//"+Ii.host);};Fi&&Ci||(Fi=function(t){var e=Qe(arguments,1);return Bi[++Gi]=function(){Vn(L(t)?t:_i(t),void 0,e);},Ti(Gi),Gi},Ci=function(t){delete Bi[t];},Li?Ti=function(t){Ni.nextTick(Hi(t));}:zi&&zi.now?Ti=function(t){zi.now(Hi(t));}:Di&&!ki?(Pi=(Ai=new Di).port2,Ai.port1.onmessage=qi,Ti=xo(Pi.postMessage,Pi)):s.addEventListener&&L(s.postMessage)&&!s.importScripts&&Ii&&"file:"!==Ii.protocol&&!l(Ki)?(Ti=Ki,s.addEventListener("message",qi,!1)):Ti=Wi in Et("script")?function(t){hn.appendChild(Et("script")).onreadystatechange=function(){hn.removeChild(this),Vi(t);};}:function(t){setTimeout(Hi(t),0);});var Yi,Xi,$i,Ji,Qi,Zi,tu,eu,nu={set:Fi,clear:Ci},ru=/ipad|iphone|ipod/i.test(_)&&void 0!==s.Pebble,ou=/web0s(?!.*chrome)/i.test(_),iu=Tt.f,uu=nu.set,au=s.MutationObserver||s.WebKitMutationObserver,cu=s.document,fu=s.process,su=s.Promise,lu=iu(s,"queueMicrotask"),pu=lu&&lu.value;pu||(Yi=function(){var t,e;for(Li&&(t=fu.domain)&&t.exit();Xi;){e=Xi.fn,Xi=Xi.next;try{e();}catch(t){throw Xi?Ji():$i=void 0,t}}$i=void 0,t&&t.enter();},ki||Li||ou||!au||!cu?!ru&&su&&su.resolve?((tu=su.resolve(void 0)).constructor=su,eu=xo(tu.then,tu),Ji=function(){eu(Yi);}):Li?Ji=function(){fu.nextTick(Yi);}:(uu=xo(uu,s),Ji=function(){uu(Yi);}):(Qi=!0,Zi=cu.createTextNode(""),new au(Yi).observe(Zi,{characterData:!0}),Ji=function(){Zi.data=Qi=!Qi;}));var du,vu,hu,yu,gu=pu||function(t){var e={fn:t,next:void 0};$i&&($i.next=e),Xi||(Xi=e,Ji()),$i=e;},mu=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r;})),this.resolve=J(e),this.reject=J(n);},bu={f:function(t){return new mu(t)}},wu=function(t){try{return {error:!1,value:t()}}catch(t){return {error:!0,value:t}}},xu="object"==typeof window,Su=nu.set,Ou=gt("species"),Eu="Promise",ju=Zt.getterFor(Eu),Iu=Zt.set,Tu=Zt.getterFor(Eu),Au=Ri&&Ri.prototype,Pu=Ri,Ru=Au,Mu=s.TypeError,ku=s.document,Lu=s.process,Fu=bu.f,Cu=Fu,Nu=!!(ku&&ku.createEvent&&s.dispatchEvent),zu=L(s.PromiseRejectionEvent),_u="unhandledrejection",Du=!1,Uu=Me(Eu,(function(){var t=Dt(Pu),e=t!==String(Pu);if(!e&&66===W)return !0;if(W>=51&&/native code/.test(t))return !1;var n=new Pu((function(t){t(1);})),r=function(t){t((function(){}),(function(){}));};return (n.constructor={})[Ou]=r,!(Du=n.then((function(){}))instanceof r)||!e&&xu&&!zu})),Gu=Uu||!_o((function(t){Pu.all(t).catch((function(){}));})),Bu=function(t){var e;return !(!F(t)||!L(e=t.then))&&e},Wu=function(t,e){if(!t.notified){t.notified=!0;var n=t.reactions;gu((function(){for(var r=t.value,o=1==t.state,i=0;n.length>i;){var u,a,c,f=n[i++],s=o?f.ok:f.fail,l=f.resolve,p=f.reject,d=f.domain;try{s?(o||(2===t.rejection&&Ku(t),t.rejection=1),!0===s?u=r:(d&&d.enter(),u=s(r),d&&(d.exit(),c=!0)),u===f.promise?p(Mu("Promise-chain cycle")):(a=Bu(u))?v(a,u,l,p):l(u)):p(r);}catch(t){d&&!c&&d.exit(),p(t);}}t.reactions=[],t.notified=!1,e&&!t.rejection&&Hu(t);}));}},Vu=function(t,e,n){var r,o;Nu?((r=ku.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),s.dispatchEvent(r)):r={promise:e,reason:n},!zu&&(o=s["on"+t])?o(r):t===_u&&function(t,e){var n=s.console;n&&n.error&&(1==arguments.length?n.error(t):n.error(t,e));}("Unhandled promise rejection",n);},Hu=function(t){v(Su,s,(function(){var e,n=t.facade,r=t.value;if(qu(t)&&(e=wu((function(){Li?Lu.emit("unhandledRejection",r,n):Vu(_u,n,r);})),t.rejection=Li||qu(t)?2:1,e.error))throw e.value}));},qu=function(t){return 1!==t.rejection&&!t.parent},Ku=function(t){v(Su,s,(function(){var e=t.facade;Li?Lu.emit("rejectionHandled",e):Vu("rejectionhandled",e,t.value);}));},Yu=function(t,e,n){return function(r){t(e,r,n);}},Xu=function(t,e,n){t.done||(t.done=!0,n&&(t=n),t.value=e,t.state=2,Wu(t,!0));},$u=function(t,e,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===e)throw Mu("Promise can't be resolved itself");var r=Bu(e);r?gu((function(){var n={done:!1};try{v(r,e,Yu($u,n,t),Yu(Xu,n,t));}catch(e){Xu(n,e,t);}})):(t.value=e,t.state=1,Wu(t,!1));}catch(e){Xu({done:!1},e,t);}}};if(Uu&&(Ru=(Pu=function(t){Lo(this,Ru),J(t),v(du,this);var e=ju(this);try{t(Yu($u,e),Yu(Xu,e));}catch(t){Xu(e,t);}}).prototype,(du=function(t){Iu(this,{type:Eu,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0});}).prototype=so(Ru,{then:function(t,e){var n=Tu(this),r=n.reactions,o=Fu($n(this,Pu));return o.ok=!L(t)||t,o.fail=L(e)&&e,o.domain=Li?Lu.domain:void 0,n.parent=!0,r[r.length]=o,0!=n.state&&Wu(n,!1),o.promise},catch:function(t){return this.then(void 0,t)}}),vu=function(){var t=new du,e=ju(t);this.promise=t,this.resolve=Yu($u,e),this.reject=Yu(Xu,e);},bu.f=Fu=function(t){return t===Pu||t===hu?new vu(t):Cu(t)},L(Ri)&&Au!==Object.prototype)){yu=Au.then,Du||(oe(Au,"then",(function(t,e){var n=this;return new Pu((function(t,e){v(yu,n,t,e);})).then(t,e)}),{unsafe:!0}),oe(Au,"catch",Ru.catch,{unsafe:!0}));try{delete Au.constructor;}catch(t){}Hr&&Hr(Au,Ru);}Le({global:!0,wrap:!0,forced:Uu},{Promise:Pu}),Ur(Pu,Eu,!1),function(t){var e=N(t),n=Lt.f;p&&e&&!e[Mi]&&n(e,Mi,{configurable:!0,get:function(){return this}});}(Eu),hu=N(Eu),Le({target:Eu,stat:!0,forced:Uu},{reject:function(t){var e=Fu(this);return v(e.reject,void 0,t),e.promise}}),Le({target:Eu,stat:!0,forced:Uu},{resolve:function(t){return function(t,e){if(Rt(t),F(e)&&e.constructor===t)return e;var n=bu.f(t);return (0, n.resolve)(e),n.promise}(this,t)}}),Le({target:Eu,stat:!0,forced:Gu},{all:function(t){var e=this,n=Fu(e),r=n.resolve,o=n.reject,i=wu((function(){var n=J(e.resolve),i=[],u=0,a=1;Mo(t,(function(t){var c=u++,f=!1;a++,v(n,e,t).then((function(t){f||(f=!0,i[c]=t,--a||r(i));}),o);})),--a||r(i);}));return i.error&&o(i.value),n.promise},race:function(t){var e=this,n=Fu(e),r=n.reject,o=wu((function(){var o=J(e.resolve);Mo(t,(function(t){v(o,e,t).then(n.resolve,r);}));}));return o.error&&r(o.value),n.promise}});var Ju=re.PROPER,Qu="toString",Zu=RegExp.prototype,ta=Zu.toString,ea=O(cn),na=l((function(){return "/a/b"!=ta.call({source:"a",flags:"b"})})),ra=Ju&&ta.name!=Qu;(na||ra)&&oe(RegExp.prototype,Qu,(function(){var t=Rt(this),e=an(t.source),n=t.flags;return "/"+e+"/"+an(void 0===n&&z(Zu,t)&&!("flags"in Zu)?ea(t):n)}),{unsafe:!0});var oa=re.EXISTS,ia=Lt.f,ua=Function.prototype,aa=O(ua.toString),ca=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,fa=O(ca.exec);p&&!oa&&ia(ua,"name",{configurable:!0,get:function(){try{return fa(ca,aa(this))[1]}catch(t){return ""}}});var sa=new WeakMap;function la(t){return t.getMenuConfig("uploadImage")}function pa(t,n){return mr(this,void 0,void 0,(function(){return br(this,(function(r){return [2,new Promise((function(r){var o=new FileReader;o.readAsDataURL(n),o.onload=function(){var i=o.result;if(i){var u=i.toString(),a=0===u.indexOf("data:image")?"":u;e.insertImageNode(t,u,n.name,a),r("ok");}};}))]}))}))}function da(n,r){return mr(this,void 0,void 0,(function(){var o,i,u,a;return br(this,(function(c){switch(c.label){case 0:return o=function(n){var r=sa.get(n);if(null!=r)return r;var o=la(n),i=o.onSuccess,u=o.onProgress,a=o.onFailed,c=o.customInsert,f=o.onError;return r=t.createUploader(gr(gr({},o),{onProgress:function(t){n.showProgressBar(t),u&&u(t);},onSuccess:function(t,r){if(c)return c(r,(function(t,r,o){return e.insertImageNode(n,t,r,o)})),void i(t,r);var o=r.errno,u=void 0===o?1:o,f=r.data,s=void 0===f?{}:f;if(0===u){if(Array.isArray(s))s.forEach((function(t){var r=t.url,o=void 0===r?"":r,i=t.alt,u=void 0===i?"":i,a=t.href,c=void 0===a?"":a;e.insertImageNode(n,o,u,c);}));else {var l=s.url,p=void 0===l?"":l,d=s.alt,v=void 0===d?"":d,h=s.href,y=void 0===h?"":h;e.insertImageNode(n,p,v,y);}i(t,r);}else a(t,r);},onError:function(t,e,n){f(t,e,n);}})),sa.set(n,r),r}(n),i=r.name,u=r.type,a=r.size,o.addFile({name:i,type:u,size:a,data:r}),[4,o.upload()];case 1:return c.sent(),[2]}}))}))}function va(t,n){var r,o;return mr(this,void 0,void 0,(function(){var i,u,a,c,f,s,l,p,d;return br(this,(function(v){switch(v.label){case 0:if(null==n)return [2];i=Array.prototype.slice.call(n),u=la(t),a=u.customUpload,c=u.base64LimitSize,v.label=1;case 1:v.trys.push([1,11,12,17]),f=xr(i),v.label=2;case 2:return [4,f.next()];case 3:return (s=v.sent()).done?[3,10]:(l=s.value,p=l.size,c&&p<=c?[4,pa(t,l)]:[3,5]);case 4:return v.sent(),[3,9];case 5:return a?[4,a(l,(function(n,r,o){return e.insertImageNode(t,n,r,o)}))]:[3,7];case 6:return v.sent(),[3,9];case 7:return [4,da(t,l)];case 8:v.sent(),v.label=9;case 9:return [3,2];case 10:return [3,17];case 11:return d=v.sent(),r={error:d},[3,17];case 12:return v.trys.push([12,,15,16]),s&&!s.done&&(o=f.return)?[4,o.call(f)]:[3,14];case 13:v.sent(),v.label=14;case 14:return [3,16];case 15:if(r)throw r.error;return [7];case 16:return [7];case 17:return [2]}}))}))}var ha=O([].join),ya=P!=Object,ga=xi("join",",");Le({target:"Array",proto:!0,forced:ya||!ga},{join:function(t){return ha(k(this),void 0===t?",":t)}});n.append&&(o.default.fn.append=n.append),n.on&&(o.default.fn.on=n.on),n.remove&&(o.default.fn.remove=n.remove),n.val&&(o.default.fn.val=n.val),n.click&&(o.default.fn.click=n.click),n.hide&&(o.default.fn.hide=n.hide);var ma=function(){function n(){this.title=t.t("uploadImgModule.uploadImage"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M828.708571 585.045333a48.761905 48.761905 0 0 0-48.737523 48.761905v18.529524l-72.143238-72.167619a135.972571 135.972571 0 0 0-191.585524 0l-34.133334 34.133333-120.880762-120.953905a138.898286 138.898286 0 0 0-191.585523 0l-72.167619 72.167619V292.400762a48.786286 48.786286 0 0 1 48.761904-48.761905h341.23581a48.737524 48.737524 0 0 0 34.474667-83.285333 48.737524 48.737524 0 0 0-34.474667-14.287238H146.236952A146.212571 146.212571 0 0 0 0 292.400762v585.289143A146.358857 146.358857 0 0 0 146.236952 1024h584.996572a146.212571 146.212571 0 0 0 146.236952-146.310095V633.807238a48.786286 48.786286 0 0 0-48.761905-48.761905zM146.261333 926.45181a48.737524 48.737524 0 0 1-48.761904-48.761905v-174.128762l141.409523-141.458286a38.497524 38.497524 0 0 1 53.126096 0l154.526476 154.624 209.627428 209.724953H146.236952z m633.734096-48.761905c-0.073143 9.337905-3.145143 18.383238-8.777143 25.843809l-219.843048-220.94019 34.133333-34.133334a37.546667 37.546667 0 0 1 53.613715 0l140.873143 141.897143V877.714286zM1009.615238 160.231619L863.329524 13.897143a48.737524 48.737524 0 0 0-16.091429-10.24c-11.849143-4.87619-25.161143-4.87619-37.059047 0a48.761905 48.761905 0 0 0-16.067048 10.24l-146.236952 146.334476a49.005714 49.005714 0 0 0 69.217523 69.241905l62.902858-63.390476v272.627809a48.761905 48.761905 0 1 0 97.475047 0V166.083048l62.902857 63.390476a48.737524 48.737524 0 0 0 69.217524 0 48.761905 48.761905 0 0 0 0-69.241905z"></path></svg>',this.tag="button";}return n.prototype.getValue=function(t){return ""},n.prototype.isActive=function(t){return !1},n.prototype.isDisabled=function(t){return e.isInsertImageMenuDisabled(t)},n.prototype.getMenuConfig=function(t){return t.getMenuConfig("uploadImage")},n.prototype.exec=function(t,n){var r=this.getMenuConfig(t),i=r.allowedFileTypes,u=void 0===i?[]:i,a=r.customBrowseAndUpload;if(a)a((function(n,r,o){return e.insertImageNode(t,n,r,o)}));else {var c="";u.length>0&&(c='accept="'+u.join(", ")+'"');var f=o.default("body"),s=o.default('<input type="file" '+c+" multiple/>");s.hide(),f.append(s),s.click(),s.on("change",(function(){var e=s[0].files;va(t,e);}));}},n}();var ba={menus:[{key:"uploadImage",factory:function(){return new ma},config:{server:"",fieldName:"wangeditor-uploaded-image",maxFileSize:2097152,maxNumberOfFiles:100,allowedFileTypes:["image/*"],meta:{},metaWithUrl:!1,withCredentials:!1,timeout:1e4,onBeforeUpload:function(t){return t},onProgress:function(t){},onSuccess:function(t,e){},onFailed:function(t,e){console.error("'"+t.name+"' upload failed",e);},onError:function(t,e,n){console.error("'"+t.name+"' upload error",n);},base64LimitSize:0}}],editorPlugin:function(t){var n=t.insertData,r=t;return r.insertData=function(o){if(e.isInsertImageMenuDisabled(r))n(o);else if(o.getData("text/plain"))n(o);else {var i=o.files;if(i.length<=0)n(o);else Array.prototype.slice.call(i).some((function(t){return "image"===function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)u.push(r.value);}catch(t){o={error:t};}finally{try{r&&!r.done&&(n=i.return)&&n.call(i);}finally{if(o)throw o.error}}return u}(t.type.split("/"),1)[0]}))?va(t,i):n(o);}},r}};return ba}));
  20286. });
  20287. var dist = createCommonjsModule$1(function (module, exports) {
  20288. !function(e,t){t(exports,dist$6,require$$1,require$$2$1);}(commonjsGlobal,(function(e,t,n,a){function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=r(n);t.i18nAddResources("en",{highLightModule:{selectLang:"Language"}}),t.i18nAddResources("zh-CN",{highLightModule:{selectLang:"选择语言"}});var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{};function o(e){var t={exports:{}};return e(t,t.exports),t.exports}var l,u,c=function(e){return e&&e.Math==Math&&e},d=c("object"==typeof globalThis&&globalThis)||c("object"==typeof window&&window)||c("object"==typeof self&&self)||c("object"==typeof s&&s)||function(){return this}()||Function("return this")(),p=Object.defineProperty,g=function(e,t){try{p(d,e,{value:t,configurable:!0,writable:!0});}catch(n){d[e]=t;}return t},f="__core-js_shared__",b=d[f]||g(f,{}),h=o((function(e){(e.exports=function(e,t){return b[e]||(b[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.19.3",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"});})),m=Function.prototype,y=m.bind,E=m.call,v=y&&y.bind(E),S=y?function(e){return e&&v(E,e)}:function(e){return e&&function(){return E.apply(e,arguments)}},w=d.TypeError,k=function(e){if(null==e)throw w("Can't call method on "+e);return e},A=d.Object,x=function(e){return A(k(e))},T=S({}.hasOwnProperty),_=Object.hasOwn||function(e,t){return T(x(e),t)},O=0,I=Math.random(),R=S(1..toString),N=function(e){return "Symbol("+(void 0===e?"":e)+")_"+R(++O+I,36)},L=function(e){return "function"==typeof e},P=function(e){return L(e)?e:void 0},C=function(e,t){return arguments.length<2?P(d[e]):d[e]&&d[e][t]},F=C("navigator","userAgent")||"",D=d.process,$=d.Deno,M=D&&D.versions||$&&$.version,B=M&&M.v8;B&&(u=(l=B.split("."))[0]>0&&l[0]<4?1:+(l[0]+l[1])),!u&&F&&(!(l=F.match(/Edge\/(\d+)/))||l[1]>=74)&&(l=F.match(/Chrome\/(\d+)/))&&(u=+l[1]);var U=u,j=function(e){try{return !!e()}catch(e){return !0}},z=!!Object.getOwnPropertySymbols&&!j((function(){var e=Symbol();return !String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&U&&U<41})),G=z&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,H=h("wks"),q=d.Symbol,Y=q&&q.for,W=G?q:q&&q.withoutSetter||N,X=function(e){if(!_(H,e)||!z&&"string"!=typeof H[e]){var t="Symbol."+e;z&&_(q,e)?H[e]=q[e]:H[e]=G&&Y?Y(t):W(t);}return H[e]},Z={};Z[X("toStringTag")]="z";var V="[object z]"===String(Z),K=!j((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),J=function(e){return "object"==typeof e?null!==e:L(e)},Q=d.document,ee=J(Q)&&J(Q.createElement),te=function(e){return ee?Q.createElement(e):{}},ne=!K&&!j((function(){return 7!=Object.defineProperty(te("div"),"a",{get:function(){return 7}}).a})),ae=d.String,re=d.TypeError,ie=function(e){if(J(e))return e;throw re(ae(e)+" is not an object")},se=Function.prototype.call,oe=se.bind?se.bind(se):function(){return se.apply(se,arguments)},le=S({}.isPrototypeOf),ue=d.Object,ce=G?function(e){return "symbol"==typeof e}:function(e){var t=C("Symbol");return L(t)&&le(t.prototype,ue(e))},de=d.String,pe=function(e){try{return de(e)}catch(e){return "Object"}},ge=d.TypeError,fe=function(e){if(L(e))return e;throw ge(pe(e)+" is not a function")},be=function(e,t){var n=e[t];return null==n?void 0:fe(n)},he=d.TypeError,me=d.TypeError,ye=X("toPrimitive"),Ee=function(e,t){if(!J(e)||ce(e))return e;var n,a=be(e,ye);if(a){if(void 0===t&&(t="default"),n=oe(a,e,t),!J(n)||ce(n))return n;throw me("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var n,a;if("string"===t&&L(n=e.toString)&&!J(a=oe(n,e)))return a;if(L(n=e.valueOf)&&!J(a=oe(n,e)))return a;if("string"!==t&&L(n=e.toString)&&!J(a=oe(n,e)))return a;throw he("Can't convert object to primitive value")}(e,t)},ve=function(e){var t=Ee(e,"string");return ce(t)?t:t+""},Se=d.TypeError,we=Object.defineProperty,ke={f:K?we:function(e,t,n){if(ie(e),t=ve(t),ie(n),ne)try{return we(e,t,n)}catch(e){}if("get"in n||"set"in n)throw Se("Accessors not supported");return "value"in n&&(e[t]=n.value),e}},Ae=function(e,t){return {enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},xe=K?function(e,t,n){return ke.f(e,t,Ae(1,n))}:function(e,t,n){return e[t]=n,e},Te=S(Function.toString);L(b.inspectSource)||(b.inspectSource=function(e){return Te(e)});var _e,Oe,Ie,Re=b.inspectSource,Ne=d.WeakMap,Le=L(Ne)&&/native code/.test(Re(Ne)),Pe=h("keys"),Ce=function(e){return Pe[e]||(Pe[e]=N(e))},Fe={},De="Object already initialized",$e=d.TypeError,Me=d.WeakMap;if(Le||b.state){var Be=b.state||(b.state=new Me),Ue=S(Be.get),je=S(Be.has),ze=S(Be.set);_e=function(e,t){if(je(Be,e))throw new $e(De);return t.facade=e,ze(Be,e,t),t},Oe=function(e){return Ue(Be,e)||{}},Ie=function(e){return je(Be,e)};}else {var Ge=Ce("state");Fe[Ge]=!0,_e=function(e,t){if(_(e,Ge))throw new $e(De);return t.facade=e,xe(e,Ge,t),t},Oe=function(e){return _(e,Ge)?e[Ge]:{}},Ie=function(e){return _(e,Ge)};}var He={set:_e,get:Oe,has:Ie,enforce:function(e){return Ie(e)?Oe(e):_e(e,{})},getterFor:function(e){return function(t){var n;if(!J(t)||(n=Oe(t)).type!==e)throw $e("Incompatible receiver, "+e+" required");return n}}},qe=Function.prototype,Ye=K&&Object.getOwnPropertyDescriptor,We=_(qe,"name"),Xe={EXISTS:We,PROPER:We&&"something"===function(){}.name,CONFIGURABLE:We&&(!K||K&&Ye(qe,"name").configurable)},Ze=o((function(e){var t=Xe.CONFIGURABLE,n=He.get,a=He.enforce,r=String(String).split("String");(e.exports=function(e,n,i,s){var o,l=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,c=!!s&&!!s.noTargetGet,p=s&&void 0!==s.name?s.name:n;L(i)&&("Symbol("===String(p).slice(0,7)&&(p="["+String(p).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!_(i,"name")||t&&i.name!==p)&&xe(i,"name",p),(o=a(i)).source||(o.source=r.join("string"==typeof p?p:""))),e!==d?(l?!c&&e[n]&&(u=!0):delete e[n],u?e[n]=i:xe(e,n,i)):u?e[n]=i:g(n,i);})(Function.prototype,"toString",(function(){return L(this)&&n(this).source||Re(this)}));})),Ve=S({}.toString),Ke=S("".slice),Je=function(e){return Ke(Ve(e),8,-1)},Qe=X("toStringTag"),et=d.Object,tt="Arguments"==Je(function(){return arguments}()),nt=V?Je:function(e){var t,n,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=et(e),Qe))?n:tt?Je(t):"Object"==(a=Je(t))&&L(t.callee)?"Arguments":a},at=V?{}.toString:function(){return "[object "+nt(this)+"]"};V||Ze(Object.prototype,"toString",at,{unsafe:!0});var rt,it,st={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},ot=te("span").classList,lt=ot&&ot.constructor&&ot.constructor.prototype,ut=lt===Object.prototype?void 0:lt,ct=S(S.bind),dt=d.Object,pt=S("".split),gt=j((function(){return !dt("z").propertyIsEnumerable(0)}))?function(e){return "String"==Je(e)?pt(e,""):dt(e)}:dt,ft=Math.ceil,bt=Math.floor,ht=function(e){var t=+e;return t!=t||0===t?0:(t>0?bt:ft)(t)},mt=Math.min,yt=function(e){return e>0?mt(ht(e),9007199254740991):0},Et=function(e){return yt(e.length)},vt=Array.isArray||function(e){return "Array"==Je(e)},St=function(){},wt=[],kt=C("Reflect","construct"),At=/^\s*(?:class|function)\b/,xt=S(At.exec),Tt=!At.exec(St),_t=function(e){if(!L(e))return !1;try{return kt(St,wt,e),!0}catch(e){return !1}},Ot=!kt||j((function(){var e;return _t(_t.call)||!_t(Object)||!_t((function(){e=!0;}))||e}))?function(e){if(!L(e))return !1;switch(nt(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return !1}return Tt||!!xt(At,Re(e))}:_t,It=X("species"),Rt=d.Array,Nt=function(e,t){return new(function(e){var t;return vt(e)&&(t=e.constructor,(Ot(t)&&(t===Rt||vt(t.prototype))||J(t)&&null===(t=t[It]))&&(t=void 0)),void 0===t?Rt:t}(e))(0===t?0:t)},Lt=S([].push),Pt=function(e){var t=1==e,n=2==e,a=3==e,r=4==e,i=6==e,s=7==e,o=5==e||i;return function(l,u,c,d){for(var p,g,f=x(l),b=gt(f),h=function(e,t){return fe(e),void 0===t?e:ct?ct(e,t):function(){return e.apply(t,arguments)}}(u,c),m=Et(b),y=0,E=d||Nt,v=t?E(l,m):n||s?E(l,0):void 0;m>y;y++)if((o||y in b)&&(g=h(p=b[y],y,f),e))if(t)v[y]=g;else if(g)switch(e){case 3:return !0;case 5:return p;case 6:return y;case 2:Lt(v,p);}else switch(e){case 4:return !1;case 7:Lt(v,p);}return i?-1:a||r?r:v}},Ct={forEach:Pt(0),map:Pt(1),filter:Pt(2),some:Pt(3),every:Pt(4),find:Pt(5),findIndex:Pt(6),filterReject:Pt(7)}.forEach,Ft=!!(it=[]["forEach"])&&j((function(){it.call(null,rt||function(){throw 1},1);}))?[].forEach:function(e){return Ct(this,e,arguments.length>1?arguments[1]:void 0)},Dt=function(e){if(e&&e.forEach!==Ft)try{xe(e,"forEach",Ft);}catch(t){e.forEach=Ft;}};for(var $t in st)st[$t]&&Dt(d[$t]&&d[$t].prototype);Dt(ut);var Mt={}.propertyIsEnumerable,Bt=Object.getOwnPropertyDescriptor,Ut={f:Bt&&!Mt.call({1:2},1)?function(e){var t=Bt(this,e);return !!t&&t.enumerable}:Mt},jt=function(e){return gt(k(e))},zt=Object.getOwnPropertyDescriptor,Gt={f:K?zt:function(e,t){if(e=jt(e),t=ve(t),ne)try{return zt(e,t)}catch(e){}if(_(e,t))return Ae(!oe(Ut.f,e,t),e[t])}},Ht=Math.max,qt=Math.min,Yt=function(e,t){var n=ht(e);return n<0?Ht(n+t,0):qt(n,t)},Wt=function(e){return function(t,n,a){var r,i=jt(t),s=Et(i),o=Yt(a,s);if(e&&n!=n){for(;s>o;)if((r=i[o++])!=r)return !0}else for(;s>o;o++)if((e||o in i)&&i[o]===n)return e||o||0;return !e&&-1}},Xt={includes:Wt(!0),indexOf:Wt(!1)}.indexOf,Zt=S([].push),Vt=function(e,t){var n,a=jt(e),r=0,i=[];for(n in a)!_(Fe,n)&&_(a,n)&&Zt(i,n);for(;t.length>r;)_(a,n=t[r++])&&(~Xt(i,n)||Zt(i,n));return i},Kt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Jt=Kt.concat("length","prototype"),Qt={f:Object.getOwnPropertyNames||function(e){return Vt(e,Jt)}},en={f:Object.getOwnPropertySymbols},tn=S([].concat),nn=C("Reflect","ownKeys")||function(e){var t=Qt.f(ie(e)),n=en.f;return n?tn(t,n(e)):t},an=function(e,t){for(var n=nn(t),a=ke.f,r=Gt.f,i=0;i<n.length;i++){var s=n[i];_(e,s)||a(e,s,r(t,s));}},rn=/#|\.prototype\./,sn=function(e,t){var n=ln[on(e)];return n==cn||n!=un&&(L(t)?j(t):!!t)},on=sn.normalize=function(e){return String(e).replace(rn,".").toLowerCase()},ln=sn.data={},un=sn.NATIVE="N",cn=sn.POLYFILL="P",dn=sn,pn=Gt.f,gn=function(e,t){var n,a,r,i,s,o=e.target,l=e.global,u=e.stat;if(n=l?d:u?d[o]||g(o,{}):(d[o]||{}).prototype)for(a in t){if(i=t[a],r=e.noTargetGet?(s=pn(n,a))&&s.value:n[a],!dn(l?a:o+(u?".":"#")+a,e.forced)&&void 0!==r){if(typeof i==typeof r)continue;an(i,r);}(e.sham||r&&r.sham)&&xe(i,"sham",!0),Ze(n,a,i,e);}},fn=Object.keys||function(e){return Vt(e,Kt)},bn=Object.assign,hn=Object.defineProperty,mn=S([].concat),yn=!bn||j((function(){if(K&&1!==bn({b:1},bn(hn({},"a",{enumerable:!0,get:function(){hn(this,"b",{value:3,enumerable:!1});}}),{b:2})).b)return !0;var e={},t={},n=Symbol(),a="abcdefghijklmnopqrst";return e[n]=7,a.split("").forEach((function(e){t[e]=e;})),7!=bn({},e)[n]||fn(bn({},t)).join("")!=a}))?function(e,t){for(var n=x(e),a=arguments.length,r=1,i=en.f,s=Ut.f;a>r;)for(var o,l=gt(arguments[r++]),u=i?mn(fn(l),i(l)):fn(l),c=u.length,d=0;c>d;)o=u[d++],K&&!oe(s,l,o)||(n[o]=l[o]);return n}:bn;gn({target:"Object",stat:!0,forced:Object.assign!==yn},{assign:yn});var En=o((function(e){var t=function(e){var t=/\blang(?:uage)?-([\w-]+)\b/i,n=0,a={},r={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var a,i;switch(n=n||{},r.util.type(t)){case"Object":if(i=r.util.objId(t),n[i])return n[i];for(var s in a={},n[i]=a,t)t.hasOwnProperty(s)&&(a[s]=e(t[s],n));return a;case"Array":return i=r.util.objId(t),n[i]?n[i]:(a=[],n[i]=a,t.forEach((function(t,r){a[r]=e(t,n);})),a);default:return t}},getLanguage:function(e){for(;e&&!t.test(e.className);)e=e.parentElement;return e?(e.className.match(t)||[,"none"])[1].toLowerCase():"none"},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(a){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(a.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var a="no-"+t;e;){var r=e.classList;if(r.contains(t))return !0;if(r.contains(a))return !1;e=e.parentElement;}return !!n}},languages:{plain:a,plaintext:a,text:a,txt:a,extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var a in t)n[a]=t[a];return n},insertBefore:function(e,t,n,a){var i=(a=a||r.languages)[e],s={};for(var o in i)if(i.hasOwnProperty(o)){if(o==t)for(var l in n)n.hasOwnProperty(l)&&(s[l]=n[l]);n.hasOwnProperty(o)||(s[o]=i[o]);}var u=a[e];return a[e]=s,r.languages.DFS(r.languages,(function(t,n){n===u&&t!=e&&(this[t]=s);})),s},DFS:function e(t,n,a,i){i=i||{};var s=r.util.objId;for(var o in t)if(t.hasOwnProperty(o)){n.call(t,o,t[o],a||o);var l=t[o],u=r.util.type(l);"Object"!==u||i[s(l)]?"Array"!==u||i[s(l)]||(i[s(l)]=!0,e(l,n,o,i)):(i[s(l)]=!0,e(l,n,null,i));}}},plugins:{},highlightAll:function(e,t){r.highlightAllUnder(document,e,t);},highlightAllUnder:function(e,t,n){var a={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",a),a.elements=Array.prototype.slice.apply(a.container.querySelectorAll(a.selector)),r.hooks.run("before-all-elements-highlight",a);for(var i,s=0;i=a.elements[s++];)r.highlightElement(i,!0===t,a.callback);},highlightElement:function(n,a,i){var s=r.util.getLanguage(n),o=r.languages[s];n.className=n.className.replace(t,"").replace(/\s+/g," ")+" language-"+s;var l=n.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&(l.className=l.className.replace(t,"").replace(/\s+/g," ")+" language-"+s);var u={element:n,language:s,grammar:o,code:n.textContent};function c(e){u.highlightedCode=e,r.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r.hooks.run("after-highlight",u),r.hooks.run("complete",u),i&&i.call(u.element);}if(r.hooks.run("before-sanity-check",u),(l=u.element.parentElement)&&"pre"===l.nodeName.toLowerCase()&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!u.code)return r.hooks.run("complete",u),void(i&&i.call(u.element));if(r.hooks.run("before-highlight",u),u.grammar)if(a&&e.Worker){var d=new Worker(r.filename);d.onmessage=function(e){c(e.data);},d.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}));}else c(r.highlight(u.code,u.grammar,u.language));else c(r.util.encode(u.code));},highlight:function(e,t,n){var a={code:e,grammar:t,language:n};return r.hooks.run("before-tokenize",a),a.tokens=r.tokenize(a.code,a.grammar),r.hooks.run("after-tokenize",a),i.stringify(r.util.encode(a.tokens),a.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var a in n)t[a]=n[a];delete t.rest;}var r=new l;return u(r,r.head,e),o(e,r,t,r.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(r)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t);},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var a,i=0;a=n[i++];)a(t);}},Token:i};function i(e,t,n,a){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length;}function s(e,t,n,a){e.lastIndex=t;var r=e.exec(n);if(r&&a&&r[1]){var i=r[1].length;r.index+=i,r[0]=r[0].slice(i);}return r}function o(e,t,n,a,l,d){for(var p in n)if(n.hasOwnProperty(p)&&n[p]){var g=n[p];g=Array.isArray(g)?g:[g];for(var f=0;f<g.length;++f){if(d&&d.cause==p+","+f)return;var b=g[f],h=b.inside,m=!!b.lookbehind,y=!!b.greedy,E=b.alias;if(y&&!b.pattern.global){var v=b.pattern.toString().match(/[imsuy]*$/)[0];b.pattern=RegExp(b.pattern.source,v+"g");}for(var S=b.pattern||b,w=a.next,k=l;w!==t.tail&&!(d&&k>=d.reach);k+=w.value.length,w=w.next){var A=w.value;if(t.length>e.length)return;if(!(A instanceof i)){var x,T=1;if(y){if(!(x=s(S,k,e,m)))break;var _=x.index,O=x.index+x[0].length,I=k;for(I+=w.value.length;_>=I;)I+=(w=w.next).value.length;if(k=I-=w.value.length,w.value instanceof i)continue;for(var R=w;R!==t.tail&&(I<O||"string"==typeof R.value);R=R.next)T++,I+=R.value.length;T--,A=e.slice(k,I),x.index-=k;}else if(!(x=s(S,0,A,m)))continue;_=x.index;var N=x[0],L=A.slice(0,_),P=A.slice(_+N.length),C=k+A.length;d&&C>d.reach&&(d.reach=C);var F=w.prev;if(L&&(F=u(t,F,L),k+=L.length),c(t,F,T),w=u(t,F,new i(p,h?r.tokenize(N,h):N,E,N)),P&&u(t,w,P),T>1){var D={cause:p+","+f,reach:C};o(e,t,n,w.prev,k,D),d&&D.reach>d.reach&&(d.reach=D.reach);}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0;}function u(e,t,n){var a=t.next,r={value:n,prev:t,next:a};return t.next=r,a.prev=r,e.length++,r}function c(e,t,n){for(var a=t.next,r=0;r<n&&a!==e.tail;r++)a=a.next;t.next=a,a.prev=t,e.length-=r;}if(e.Prism=r,i.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var a="";return t.forEach((function(t){a+=e(t,n);})),a}var i={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(i.classes,s):i.classes.push(s)),r.hooks.run("wrap",i);var o="";for(var l in i.attributes)o+=" "+l+'="'+(i.attributes[l]||"").replace(/"/g,"&quot;")+'"';return "<"+i.tag+' class="'+i.classes.join(" ")+'"'+o+">"+i.content+"</"+i.tag+">"},!e.document)return e.addEventListener?(r.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),a=n.language,i=n.code,s=n.immediateClose;e.postMessage(r.highlight(i,r.languages[a],a)),s&&e.close();}),!1),r):r;var d=r.util.currentScript();function p(){r.manual||r.highlightAll();}if(d&&(r.filename=d.src,d.hasAttribute("data-manual")&&(r.manual=!0)),!r.manual){var g=document.readyState;"loading"===g||"interactive"===g&&d&&d.defer?document.addEventListener("DOMContentLoaded",p):window.requestAnimationFrame?window.requestAnimationFrame(p):window.setTimeout(p,16);}return r}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});
  20289. /**
  20290. * Prism: Lightweight, robust, elegant syntax highlighting
  20291. *
  20292. * @license MIT <https://opensource.org/licenses/MIT>
  20293. * @author Lea Verou <https://lea.verou.me>
  20294. * @namespace
  20295. * @public
  20296. */e.exports&&(e.exports=t),void 0!==s&&(s.Prism=t),t.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},t.languages.markup.tag.inside["attr-value"].inside.entity=t.languages.markup.entity,t.languages.markup.doctype.inside["internal-subset"].inside=t.languages.markup,t.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"));})),Object.defineProperty(t.languages.markup.tag,"addInlined",{value:function(e,n){var a={};a["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:t.languages[n]},a.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:a}};r["language-"+n]={pattern:/[\s\S]+/,inside:t.languages[n]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},t.languages.insertBefore("markup","cdata",i);}}),Object.defineProperty(t.languages.markup.tag,"addAttribute",{value:function(e,n){t.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:t.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}});}}),t.languages.html=t.languages.markup,t.languages.mathml=t.languages.markup,t.languages.svg=t.languages.markup,t.languages.xml=t.languages.extend("markup",{}),t.languages.ssml=t.languages.xml,t.languages.atom=t.languages.xml,t.languages.rss=t.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"));}(t),t.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},t.languages.javascript=t.languages.extend("clike",{"class-name":[t.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),t.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,t.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:t.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:t.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:t.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:t.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:t.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),t.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:t.languages.javascript}},string:/[\s\S]+/}}}),t.languages.markup&&(t.languages.markup.tag.addInlined("script","javascript"),t.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),t.languages.js=t.languages.javascript,function(){if(void 0!==t&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},n="data-src-status",a="loading",r="loaded",i='pre[data-src]:not([data-src-status="loaded"]):not([data-src-status="loading"])',s=/\blang(?:uage)?-([\w-]+)\b/i;t.hooks.add("before-highlightall",(function(e){e.selector+=", "+i;})),t.hooks.add("before-sanity-check",(function(s){var o=s.element;if(o.matches(i)){s.code="",o.setAttribute(n,a);var u=o.appendChild(document.createElement("CODE"));u.textContent="Loading…";var c=o.getAttribute("data-src"),d=s.language;if("none"===d){var p=(/\.(\w+)$/.exec(c)||[,"none"])[1];d=e[p]||p;}l(u,d),l(o,d);var g=t.plugins.autoloader;g&&g.loadLanguages(d);var f=new XMLHttpRequest;f.open("GET",c,!0),f.onreadystatechange=function(){var e,a;4==f.readyState&&(f.status<400&&f.responseText?(o.setAttribute(n,r),u.textContent=f.responseText,t.highlightElement(u)):(o.setAttribute(n,"failed"),f.status>=400?u.textContent=(e=f.status,a=f.statusText,"✖ Error "+e+" while fetching file: "+a):u.textContent="✖ Error: File does not exist or is empty"));},f.send(null);}})),t.plugins.fileHighlight={highlight:function(e){for(var n,a=(e||document).querySelectorAll(i),r=0;n=a[r++];)t.highlightElement(n);}};var o=!1;t.fileHighlight=function(){o||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),o=!0),t.plugins.fileHighlight.highlight.apply(this,arguments);};}function l(e,t){var n=e.className;n=n.replace(s," ")+" language-"+t,e.className=n.replace(/\s+/g," ").trim();}}();}));!function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,a=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,r=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function i(e,t){return e=e.replace(/<S>/g,(function(){return n})).replace(/<BRACES>/g,(function(){return a})).replace(/<SPREAD>/g,(function(){return r})),RegExp(e,t)}r=i(r).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=i(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/i,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/i,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:i(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:i(/=<BRACES>/.source),inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx},alias:"language-javascript"}},e.languages.jsx.tag);var s=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(s).join(""):""},o=function(t){for(var n=[],a=0;a<t.length;a++){var r=t[a],i=!1;if("string"!=typeof r&&("tag"===r.type&&r.content[0]&&"tag"===r.content[0].type?"</"===r.content[0].content[0].content?n.length>0&&n[n.length-1].tagName===s(r.content[0].content[1])&&n.pop():"/>"===r.content[r.content.length-1].content||n.push({tagName:s(r.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===r.type&&"{"===r.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===r.type&&"}"===r.content?n[n.length-1].openedBraces--:i=!0),(i||"string"==typeof r)&&n.length>0&&0===n[n.length-1].openedBraces){var l=s(r);a<t.length-1&&("string"==typeof t[a+1]||"plain-text"===t[a+1].type)&&(l+=s(t[a+1]),t.splice(a+1,1)),a>0&&("string"==typeof t[a-1]||"plain-text"===t[a-1].type)&&(l=s(t[a-1])+l,t.splice(a-1,1),a--),t[a]=new e.Token("plain-text",l,null,l);}r.content&&"string"!=typeof r.content&&o(r.content);}};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||o(e.tokens);}));}(Prism),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|as|declare|implements|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter;var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript;}(Prism),Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"));})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var a={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};a["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var r={};r[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:a},Prism.languages.insertBefore("markup","cdata",r);}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}});}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|iota|nil|true|false)\b/,number:/(?:\b0x[a-f\d]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[-+]?\d+)?)i?/i,operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/}),delete Prism.languages.go["class-name"],function(e){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,n=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],a=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,r=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,i=/[{}\[\](),:;]/;e.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:t,variable:/\$+(?:\w+\b|(?=\{))/i,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:bool|boolean|int|integer|float|string|object|array)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:bool|int|float|string|object|array(?!\s*\()|mixed|self|static|callable|iterable|(?:null|false)(?=\s*\|))\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*[\w|]\|\s*)(?:null|false)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:bool|int|float|string|object|void|array(?!\s*\()|mixed|self|static|callable|iterable|(?:null|false)(?=\s*\|))\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?[\w|]\|\s*)(?:null|false)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:bool|int|float|string|object|void|array(?!\s*\()|mixed|iterable|(?:null|false)(?=\s*\|))\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:null|false)\b/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|match|new|or|parent|print|private|protected|public|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s+)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:a,operator:r,punctuation:i};var s={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:e.languages.php},o=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:s}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:s}}];e.languages.insertBefore("php","variable",{string:o,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:o,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,number:a,operator:r,punctuation:i}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),e.hooks.add("before-tokenize",(function(t){if(/<\?/.test(t.code)){e.languages["markup-templating"].buildPlaceholders(t,"php",/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/gi);}})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"php");}));}(Prism),Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:__attribute__|_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}},constant:/\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/}),delete Prism.languages.c.boolean,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},"string-interpolation":{pattern:/(?:f|rf|fr)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|rb|br)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/im,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:True|False|None)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python,function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(^|[^\w.])(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,a={pattern:RegExp(n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{"class-name":[a,{pattern:RegExp(n+/[A-Z]\w*(?=\s+\w+\s*[;,=()])/.source),lookbehind:!0,inside:a.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0}}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":a,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0,inside:{punctuation:/\./}}});}(Prism),function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char8_t|char16_t|char32_t|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|co_await|co_return|co_yield|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:true|false)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:module|import)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"]);}(Prism),function(e){function t(e,t){return e.replace(/<<(\d+)>>/g,(function(e,n){return "(?:"+t[+n]+")"}))}function n(e,n,a){return RegExp(t(e,n),a||"")}function a(e,t){for(var n=0;n<t;n++)e=e.replace(/<<self>>/g,(function(){return "(?:"+e+")"}));return e.replace(/<<self>>/g,"[^\\s\\S]")}var r="bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",i="class enum interface record struct",s="add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",o="abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield";function l(e){return "\\b(?:"+e.trim().replace(/ /g,"|")+")\\b"}var u=l(i),c=RegExp(l(r+" "+i+" "+s+" "+o)),d=l(i+" "+s+" "+o),p=l(r+" "+i+" "+o),g=a(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source,2),f=a(/\((?:[^()]|<<self>>)*\)/.source,2),b=/@?\b[A-Za-z_]\w*\b/.source,h=t(/<<0>>(?:\s*<<1>>)?/.source,[b,g]),m=t(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[d,h]),y=/\[\s*(?:,\s*)*\]/.source,E=t(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[m,y]),v=t(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[g,f,y]),S=t(/\(<<0>>+(?:,<<0>>+)+\)/.source,[v]),w=t(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[S,m,y]),k={keyword:c,punctuation:/[<>()?,.:[\]]/},A=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,x=/"(?:\\.|[^\\"\r\n])*"/.source,T=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;e.languages.csharp=e.languages.extend("clike",{string:[{pattern:n(/(^|[^$\\])<<0>>/.source,[T]),lookbehind:!0,greedy:!0},{pattern:n(/(^|[^@$\\])<<0>>/.source,[x]),lookbehind:!0,greedy:!0},{pattern:RegExp(A),greedy:!0,alias:"character"}],"class-name":[{pattern:n(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[m]),lookbehind:!0,inside:k},{pattern:n(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[b,w]),lookbehind:!0,inside:k},{pattern:n(/(\busing\s+)<<0>>(?=\s*=)/.source,[b]),lookbehind:!0},{pattern:n(/(\b<<0>>\s+)<<1>>/.source,[u,h]),lookbehind:!0,inside:k},{pattern:n(/(\bcatch\s*\(\s*)<<0>>/.source,[m]),lookbehind:!0,inside:k},{pattern:n(/(\bwhere\s+)<<0>>/.source,[b]),lookbehind:!0},{pattern:n(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[E]),lookbehind:!0,inside:k},{pattern:n(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[w,p,b]),inside:k}],keyword:c,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:ul|lu|[dflmu])?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),e.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),e.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:n(/([(,]\s*)<<0>>(?=\s*:)/.source,[b]),lookbehind:!0,alias:"punctuation"}}),e.languages.insertBefore("csharp","class-name",{namespace:{pattern:n(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[b]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:n(/(\b(?:default|typeof|sizeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[f]),lookbehind:!0,alias:"class-name",inside:k},"return-type":{pattern:n(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[w,m]),inside:k,alias:"class-name"},"constructor-invocation":{pattern:n(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[w]),lookbehind:!0,inside:k,alias:"class-name"},"generic-method":{pattern:n(/<<0>>\s*<<1>>(?=\s*\()/.source,[b,g]),inside:{function:n(/^<<0>>/.source,[b]),generic:{pattern:RegExp(g),alias:"class-name",inside:k}}},"type-list":{pattern:n(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[u,h,b,w,c.source,f,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:n(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[h,f]),lookbehind:!0,greedy:!0,inside:e.languages.csharp},keyword:c,"class-name":{pattern:RegExp(w),greedy:!0,inside:k},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var _=x+"|"+A,O=t(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[_]),I=a(t(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[O]),2),R=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,N=t(/<<0>>(?:\s*\(<<1>>*\))?/.source,[m,I]);e.languages.insertBefore("csharp","class-name",{attribute:{pattern:n(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[R,N]),lookbehind:!0,greedy:!0,inside:{target:{pattern:n(/^<<0>>(?=\s*:)/.source,[R]),alias:"keyword"},"attribute-arguments":{pattern:n(/\(<<0>>*\)/.source,[I]),inside:e.languages.csharp},"class-name":{pattern:RegExp(m),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var L=/:[^}\r\n]+/.source,P=a(t(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[O]),2),C=t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[P,L]),F=a(t(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source,[_]),2),D=t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[F,L]);function $(t,a){return {interpolation:{pattern:n(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[t]),lookbehind:!0,inside:{"format-string":{pattern:n(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[a,L]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:e.languages.csharp}}},string:/[\s\S]+/}}e.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:n(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[C]),lookbehind:!0,greedy:!0,inside:$(C,P)},{pattern:n(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[D]),lookbehind:!0,greedy:!0,inside:$(D,F)}]});}(Prism),Prism.languages.dotnet=Prism.languages.cs=Prism.languages.csharp,Prism.languages["visual-basic"]={comment:{pattern:/(?:['‘’]|REM\b)(?:[^\r\n_]|_(?:\r\n?|\n)?)*/i,inside:{keyword:/^REM/i}},directive:{pattern:/#(?:Const|Else|ElseIf|End|ExternalChecksum|ExternalSource|If|Region)(?:[^\S\r\n]_[^\S\r\n]*(?:\r\n?|\n)|.)+/i,alias:"comment",greedy:!0},string:{pattern:/\$?["“”](?:["“”]{2}|[^"“”])*["“”]C?/i,greedy:!0},date:{pattern:/#[^\S\r\n]*(?:\d+([/-])\d+\1\d+(?:[^\S\r\n]+(?:\d+[^\S\r\n]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[^\S\r\n]*(?:AM|PM))?))?|\d+[^\S\r\n]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[^\S\r\n]*(?:AM|PM))?)[^\S\r\n]*#/i,alias:"builtin"},number:/(?:(?:\b\d+(?:\.\d+)?|\.\d+)(?:E[+-]?\d+)?|&[HO][\dA-F]+)(?:U?[ILS]|[FRD])?/i,boolean:/\b(?:True|False|Nothing)\b/i,keyword:/\b(?:AddHandler|AddressOf|Alias|And(?:Also)?|As|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|C(?:Bool|Byte|Char|Date|Dbl|Dec|Int|Lng|Obj|SByte|Short|Sng|Str|Type|UInt|ULng|UShort)|Char|Class|Const|Continue|Currency|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else(?:If)?|End(?:If)?|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get(?:Type|XMLNamespace)?|Global|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|IsNot|Let|Lib|Like|Long|Loop|Me|Mod|Module|Must(?:Inherit|Override)|My(?:Base|Class)|Namespace|Narrowing|New|Next|Not(?:Inheritable|Overridable)?|Object|Of|On|Operator|Option(?:al)?|Or(?:Else)?|Out|Overloads|Overridable|Overrides|ParamArray|Partial|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|SByte|Select|Set|Shadows|Shared|short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TryCast|Type|TypeOf|U(?:Integer|Long|Short)|Using|Variant|Wend|When|While|Widening|With(?:Events)?|WriteOnly|Until|Xor)\b/i,operator:[/[+\-*/\\^<=>&#@$%!]/,{pattern:/([^\S\r\n])_(?=[^\S\r\n]*[\r\n])/,lookbehind:!0}],punctuation:/[{}().,:?]/},Prism.languages.vb=Prism.languages["visual-basic"],Prism.languages.vba=Prism.languages["visual-basic"],Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:S|ING)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:TRUE|FALSE|NULL)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|IN|ILIKE|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){e.languages.ruby=e.languages.extend("clike",{comment:[/#.*/,{pattern:/^=begin\s[\s\S]*?^=end/m,greedy:!0}],"class-name":{pattern:/(\b(?:class)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|protected|private|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/});var t={pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"tag"},rest:e.languages.ruby}};delete e.languages.ruby.function,e.languages.insertBefore("ruby","keyword",{regex:[{pattern:RegExp(/%r/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S])*\)/.source,/\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S])*\]/.source,/<(?:[^<>\\]|\\[\s\S])*>/.source].join("|")+")"+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:{pattern:/(^|[^:]):[a-zA-Z_]\w*(?:[?!]|\b)/,lookbehind:!0},"method-definition":{pattern:/(\bdef\s+)[\w.]+/,lookbehind:!0,inside:{function:/\w+$/,rest:e.languages.ruby}}}),e.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|Fixnum|Float|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,constant:/\b[A-Z]\w*(?:[?!]|\b)/}),e.languages.ruby.string=[{pattern:RegExp(/%[qQiIwWxs]?/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S])*\)/.source,/\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S])*\]/.source,/<(?:[^<>\\]|\\[\s\S])*>/.source].join("|")+")"),greedy:!0,inside:{interpolation:t}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|[a-z_]\w*$/i,alias:"symbol",inside:{punctuation:/^<<[-~]?/}},interpolation:t}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|[a-z_]\w*$/i,alias:"symbol",inside:{punctuation:/^<<[-~]?'|'$/}}}}],e.languages.rb=e.languages.ruby;}(Prism),Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ \t]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:true|false)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:true|false)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},Prism.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=Prism.languages.swift;})),function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|aptitude|apt-cache|apt-get|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|pwd|readonly|return|shift|test|times|trap|umask|unset|alias|bind|builtin|caller|command|declare|echo|enable|help|let|local|logout|mapfile|printf|read|readarray|source|type|typeset|ulimit|unalias|set|shopt)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var r=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],i=a.variable[1].inside,s=0;s<r.length;s++)i[r[s]]=e.languages.bash[r[s]];e.languages.shell=e.languages.bash;}(Prism),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(/<inner>/g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var a=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return a})),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"font-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+i+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+i+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(a),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(a),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n]);}));})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,a=t.length;n<a;n++){var r=t[n];if("code"===r.type){var i=r.content[1],s=r.content[3];if(i&&s&&"code-language"===i.type&&"code-block"===s.type&&"string"==typeof i.content){var o=i.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),l="language-"+(o=(/[a-z][\w-]*/i.exec(o)||[""])[0].toLowerCase());s.alias?"string"==typeof s.alias?s.alias=[s.alias,l]:s.alias.push(l):s.alias=[l];}}else e(r.content);}}(e.tokens);})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var n="",a=0,r=t.classes.length;a<r;a++){var i=t.classes[a],u=/language-(.+)/.exec(i);if(u){n=u[1];break}}var c=e.languages[n];if(c)t.content=e.highlight(function(e){var t=e.replace(s,"");return t=t.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var n;if("#"===(t=t.toLowerCase())[0])return n="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),l(n);var a=o[t];return a||e}))}(t.content),c,n);else if(n&&"none"!==n&&e.plugins.autoloader){var d="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=d,e.plugins.autoloader.loadLanguages(n,(function(){var t=document.getElementById(d);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n));}));}}}));var s=RegExp(e.languages.markup.tag.pattern.source,"gi"),o={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown;}(Prism),Prism.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/},Prism.languages.groovy=Prism.languages.extend("clike",{string:[{pattern:/("""|''')(?:[^\\]|\\[\s\S])*?\1|\$\/(?:[^/$]|\$(?:[/$]|(?![/$]))|\/(?!\$))*\/\$/,greedy:!0},{pattern:/(["'/])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0}],keyword:/\b(?:as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/,number:/\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?\d+)?)[glidf]?\b/i,operator:{pattern:/(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.\.(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/,lookbehind:!0},punctuation:/\.+|[{}[\];(),:$]/}),Prism.languages.insertBefore("groovy","string",{shebang:{pattern:/#!.+/,alias:"comment"}}),Prism.languages.insertBefore("groovy","punctuation",{"spock-block":/\b(?:setup|given|when|then|and|cleanup|expect|where):/}),Prism.languages.insertBefore("groovy","function",{annotation:{pattern:/(^|[^.])@\w+/,lookbehind:!0,alias:"punctuation"}}),Prism.hooks.add("wrap",(function(e){if("groovy"===e.language&&"string"===e.type){var t=e.content[0];if("'"!=t){var n=/([^\\])(?:\$(?:\{.*?\}|[\w.]+))/;"$"===t&&(n=/([^\$])(?:\$(?:\{.*?\}|[\w.]+))/),e.content=e.content.replace(/&lt;/g,"<").replace(/&amp;/g,"&"),e.content=Prism.highlight(e.content,{expression:{pattern:n,lookbehind:!0,inside:Prism.languages.groovy}}),e.classes.push("/"===t?"regex":"gstring");}}}));var vn=["comment","prolog","doctype","cdata","punctuation","namespace","property","tag","boolean","number","constant","symbol","deleted","selector","attr-name","string","builtin","inserted","operator","entity","url","string","atrule","attr-value","keyword","function","class-name","regex","important","variable","bold","italic","entity","char"];function Sn(e){return "string"==typeof e?e.length:"string"==typeof e.content?e.content.length:e.content.reduce((function(e,t){return e+Sn(t)}),0)}var wn,kn=d.String,An=function(e){if("Symbol"===nt(e))throw TypeError("Cannot convert a Symbol value to a string");return kn(e)},xn=function(){var e=ie(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},Tn=d.RegExp,_n=j((function(){var e=Tn("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),On=_n||j((function(){return !Tn("a","y").sticky})),In={BROKEN_CARET:_n||j((function(){var e=Tn("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:On,UNSUPPORTED_Y:_n},Rn=K?Object.defineProperties:function(e,t){ie(e);for(var n,a=jt(t),r=fn(t),i=r.length,s=0;i>s;)ke.f(e,n=r[s++],a[n]);return e},Nn=C("document","documentElement"),Ln=Ce("IE_PROTO"),Pn=function(){},Cn=function(e){return "<script>"+e+"</"+"script>"},Fn=function(e){e.write(Cn("")),e.close();var t=e.parentWindow.Object;return e=null,t},Dn=function(){try{wn=new ActiveXObject("htmlfile");}catch(e){}var e,t;Dn="undefined"!=typeof document?document.domain&&wn?Fn(wn):((t=te("iframe")).style.display="none",Nn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Cn("document.F=Object")),e.close(),e.F):Fn(wn);for(var n=Kt.length;n--;)delete Dn.prototype[Kt[n]];return Dn()};Fe[Ln]=!0;var $n,Mn,Bn=Object.create||function(e,t){var n;return null!==e?(Pn.prototype=ie(e),n=new Pn,Pn.prototype=null,n[Ln]=e):n=Dn(),void 0===t?n:Rn(n,t)},Un=d.RegExp,jn=j((function(){var e=Un(".","s");return !(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),zn=d.RegExp,Gn=j((function(){var e=zn("(?<a>b)","g");return "b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Hn=He.get,qn=h("native-string-replace",String.prototype.replace),Yn=RegExp.prototype.exec,Wn=Yn,Xn=S("".charAt),Zn=S("".indexOf),Vn=S("".replace),Kn=S("".slice),Jn=(Mn=/b*/g,oe(Yn,$n=/a/,"a"),oe(Yn,Mn,"a"),0!==$n.lastIndex||0!==Mn.lastIndex),Qn=In.BROKEN_CARET,ea=void 0!==/()??/.exec("")[1];(Jn||ea||Qn||jn||Gn)&&(Wn=function(e){var t,n,a,r,i,s,o,l=this,u=Hn(l),c=An(e),d=u.raw;if(d)return d.lastIndex=l.lastIndex,t=oe(Wn,d,c),l.lastIndex=d.lastIndex,t;var p=u.groups,g=Qn&&l.sticky,f=oe(xn,l),b=l.source,h=0,m=c;if(g&&(f=Vn(f,"y",""),-1===Zn(f,"g")&&(f+="g"),m=Kn(c,l.lastIndex),l.lastIndex>0&&(!l.multiline||l.multiline&&"\n"!==Xn(c,l.lastIndex-1))&&(b="(?: "+b+")",m=" "+m,h++),n=new RegExp("^(?:"+b+")",f)),ea&&(n=new RegExp("^"+b+"$(?!\\s)",f)),Jn&&(a=l.lastIndex),r=oe(Yn,g?n:l,m),g?r?(r.input=Kn(r.input,h),r[0]=Kn(r[0],h),r.index=l.lastIndex,l.lastIndex+=r[0].length):l.lastIndex=0:Jn&&r&&(l.lastIndex=l.global?r.index+r[0].length:a),ea&&r&&r.length>1&&oe(qn,r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0);})),r&&p)for(r.groups=s=Bn(null),i=0;i<p.length;i++)s[(o=p[i])[0]]=r[o[1]];return r});var ta=Wn;gn({target:"RegExp",proto:!0,forced:/./.exec!==ta},{exec:ta});var na=Function.prototype,aa=na.apply,ra=na.bind,ia=na.call,sa="object"==typeof Reflect&&Reflect.apply||(ra?ia.bind(aa):function(){return ia.apply(aa,arguments)}),oa=X("species"),la=RegExp.prototype,ua=X("match"),ca=d.TypeError,da=X("species"),pa=function(e,t){var n,a=ie(e).constructor;return void 0===a||null==(n=ie(a)[da])?t:function(e){if(Ot(e))return e;throw ca(pe(e)+" is not a constructor")}(n)},ga=S("".charAt),fa=S("".charCodeAt),ba=S("".slice),ha=function(e){return function(t,n){var a,r,i=An(k(t)),s=ht(n),o=i.length;return s<0||s>=o?e?"":void 0:(a=fa(i,s))<55296||a>56319||s+1===o||(r=fa(i,s+1))<56320||r>57343?e?ga(i,s):a:e?ba(i,s,s+2):r-56320+(a-55296<<10)+65536}},ma={codeAt:ha(!1),charAt:ha(!0)}.charAt,ya=function(e,t,n){return t+(n?ma(e,t).length:1)},Ea=d.Array,va=Math.max,Sa=function(e,t,n){for(var a,r,i,s,o=Et(e),l=Yt(t,o),u=Yt(void 0===n?o:n,o),c=Ea(va(u-l,0)),d=0;l<u;l++,d++)a=c,r=d,i=e[l],s=void 0,(s=ve(r))in a?ke.f(a,s,Ae(0,i)):a[s]=i;return c.length=d,c},wa=d.TypeError,ka=function(e,t){var n=e.exec;if(L(n)){var a=oe(n,e,t);return null!==a&&ie(a),a}if("RegExp"===Je(e))return oe(ta,e,t);throw wa("RegExp#exec called on incompatible receiver")},Aa=In.UNSUPPORTED_Y,xa=4294967295,Ta=Math.min,_a=[].push,Oa=S(/./.exec),Ia=S(_a),Ra=S("".slice),Na=!j((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));!function(e,t,n,a){var r=X(e),i=!j((function(){var t={};return t[r]=function(){return 7},7!=""[e](t)})),s=i&&!j((function(){var t=!1,n=/a/;return "split"===e&&((n={}).constructor={},n.constructor[oa]=function(){return n},n.flags="",n[r]=/./[r]),n.exec=function(){return t=!0,null},n[r](""),!t}));if(!i||!s||n){var o=S(/./[r]),l=t(r,""[e],(function(e,t,n,a,r){var s=S(e),l=t.exec;return l===ta||l===la.exec?i&&!r?{done:!0,value:o(t,n,a)}:{done:!0,value:s(n,t,a)}:{done:!1}}));Ze(String.prototype,e,l[0]),Ze(la,r,l[1]);}a&&xe(la[r],"sham",!0);}("split",(function(e,t,n){var a;return a="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var a,r,i=An(k(this)),s=void 0===n?xa:n>>>0;if(0===s)return [];if(void 0===e)return [i];if(!J(a=e)||!(void 0!==(r=a[ua])?r:"RegExp"==Je(a)))return oe(t,i,e,s);for(var o,l,u,c=[],d=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),p=0,g=new RegExp(e.source,d+"g");(o=oe(ta,g,i))&&!((l=g.lastIndex)>p&&(Ia(c,Ra(i,p,o.index)),o.length>1&&o.index<i.length&&sa(_a,c,Sa(o,1)),u=o[0].length,p=l,c.length>=s));)g.lastIndex===o.index&&g.lastIndex++;return p===i.length?!u&&Oa(g,"")||Ia(c,""):Ia(c,Ra(i,p)),c.length>s?Sa(c,0,s):c}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:oe(t,this,e,n)}:t,[function(t,n){var r=k(this),i=null==t?void 0:be(t,e);return i?oe(i,t,r,n):oe(a,An(r),t,n)},function(e,r){var i=ie(this),s=An(e),o=n(a,i,s,r,a!==t);if(o.done)return o.value;var l=pa(i,RegExp),u=i.unicode,c=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(Aa?"g":"y"),d=new l(Aa?"^(?:"+i.source+")":i,c),p=void 0===r?xa:r>>>0;if(0===p)return [];if(0===s.length)return null===ka(d,s)?[s]:[];for(var g=0,f=0,b=[];f<s.length;){d.lastIndex=Aa?0:f;var h,m=ka(d,Aa?Ra(s,f):s);if(null===m||(h=Ta(yt(d.lastIndex+(Aa?f:0)),s.length))===g)f=ya(s,f,u);else {if(Ia(b,Ra(s,g,f)),b.length===p)return b;for(var y=1;y<=m.length-1;y++)if(Ia(b,m[y]),b.length===p)return b;f=g=h;}}return Ia(b,Ra(s,g)),b}]}),!Na,Aa),gn({global:!0},{globalThis:d}),n.attr&&(i.default.fn.attr=n.attr);var La=Xe.PROPER,Pa="toString",Ca=RegExp.prototype,Fa=Ca.toString,Da=S(xn),$a=j((function(){return "/a/b"!=Fa.call({source:"a",flags:"b"})})),Ma=La&&Fa.name!=Pa;($a||Ma)&&Ze(RegExp.prototype,Pa,(function(){var e=ie(this),t=An(e.source),n=e.flags;return "/"+t+"/"+An(void 0===n&&le(Ca,e)&&!("flags"in Ca)?Da(e):n)}),{unsafe:!0});var Ba=function(){function e(){this.title=t.t("highLightModule.selectLang"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M64 64v896h896V64H64z m487.6 698.8c0 87.2-51.2 127-125.8 127-67.4 0-106.4-34.8-126.4-77l68.6-41.4c13.2 23.4 25.2 43.2 54.2 43.2 27.6 0 45.2-10.8 45.2-53V475.4h84.2v287.4z m199.2 127c-78.2 0-128.8-37.2-153.4-86l68.6-39.6c18 29.4 41.6 51.2 83 51.2 34.8 0 57.2-17.4 57.2-41.6 0-28.8-22.8-39-61.4-56l-21-9c-60.8-25.8-101-58.4-101-127 0-63.2 48.2-111.2 123.2-111.2 53.6 0 92 18.6 119.6 67.4L800 580c-14.4-25.8-30-36-54.2-36-24.6 0-40.2 15.6-40.2 36 0 25.2 15.6 35.4 51.8 51.2l21 9c71.6 30.6 111.8 62 111.8 132.4 0 75.6-59.6 117.2-139.4 117.2z"></path></svg>',this.tag="select",this.width=95,this.selectPanelWidth=115;}return e.prototype.getOptions=function(e){var t=[],n=e.getMenuConfig("codeSelectLang").codeLangs,a=void 0===n?[]:n;t.push({text:"plain text",value:""}),a.forEach((function(e){var n=e.text,a=e.value;t.push({text:n,value:a});}));var r=this.getValue(e);return t.forEach((function(e){e.value===r?e.selected=!0:delete e.selected;})),t},e.prototype.isActive=function(e){return !1},e.prototype.getValue=function(e){var t=this.getSelectCodeElem(e);if(null==t)return "";if(!a.Element.isElement(t))return "";var n=t.language.toString(),r=e.getMenuConfig("codeSelectLang").codeLangs;return (void 0===r?[]:r).some((function(e){return e.value===n}))?n:""},e.prototype.isDisabled=function(e){return null==e.selection||!this.getSelectCodeElem(e)},e.prototype.exec=function(e,n){if(null!=this.getSelectCodeElem(e)){var r={language:n.toString()};a.Transforms.setNodes(e,r,{match:function(e){return t.DomEditor.checkNodeType(e,"code")}});}},e.prototype.getSelectCodeElem=function(e){var n=t.DomEditor.getSelectedNodeByType(e,"code");if(null==n)return null;var r=t.DomEditor.getParentNode(e,n);return a.Element.isElement(r)?"pre"!==r.type?null:n:null},e}();var Ua={renderStyle:function(e,t){var n=e,a=t,r="";return vn.forEach((function(e){n[e]&&(r=e);})),r&&function(e,t){null==e.data&&(e.data={});var n=e.data;null==n.props&&(n.props={}),Object.assign(n.props,{className:t});}(a,r="token "+r),a},parseStyleHtml:function(e,n,r){var s=i.default(e);if(!a.Element.isElement(n))return n;if("code"!==t.DomEditor.getNodeType(n))return n;var o=n,l=s.attr("class")||"";return 0===l.indexOf("language-")?o.language=l.split("-")[1]||"":o.language=l.toLowerCase(),o},menus:[{key:"codeSelectLang",factory:function(){return new Ba},config:{codeLangs:[{text:"CSS",value:"css"},{text:"HTML",value:"html"},{text:"XML",value:"xml"},{text:"Javascript",value:"javascript"},{text:"Typescript",value:"typescript"},{text:"JSX",value:"jsx"},{text:"Go",value:"go"},{text:"PHP",value:"php"},{text:"C",value:"c"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C++",value:"cpp"},{text:"C#",value:"csharp"},{text:"Visual Basic",value:"visual-basic"},{text:"SQL",value:"sql"},{text:"Ruby",value:"ruby"},{text:"Swift",value:"swift"},{text:"Bash",value:"bash"},{text:"Lua",value:"lua"},{text:"Groovy",value:"groovy"},{text:"Markdown",value:"markdown"}]}}],elemsToHtml:[{type:"code",elemToHtml:function(e,t){var n=e.language,a=void 0===n?"":n;return "<code "+(a?'class="language-'+a+'"':"")+">"+t+"</code>"}}]},ja=/"/g,za=S("".replace);gn({target:"String",proto:!0,forced:function(e){return j((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))}("anchor")},{anchor:function(e){return t="a",n="name",a=e,r=An(k(this)),i="<"+t,""!==n&&(i+=" "+n+'="'+za(An(a),ja,"&quot;")+'"'),i+">"+r+"</"+t+">";var t,n,a,r,i;}});e.wangEditorCodeHighLightDecorate=function(e){var n,r,i,s=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(a=i.next()).done;)s.push(a.value);}catch(e){r={error:e};}finally{try{a&&!a.done&&(n=i.return)&&n.call(i);}finally{if(r)throw r.error}}return s}(e,2),o=s[0],l=s[1],u=[],c=function(e){if(!a.Text.isText(e))return null;var n=t.DomEditor.getParentNode(null,e);if(n&&"code"===t.DomEditor.getNodeType(n)){var r=t.DomEditor.getParentNode(null,n);if(r&&"pre"===t.DomEditor.getNodeType(r))return n}return null}(o);if(null==c)return u;var d=c.language,p=void 0===d?"":d;if(!p)return u;var g=function(e,t){if(!t)return [];var n=En.languages[t];return n?En.tokenize(e.text,n):[]}(o,p),f=0;try{for(var b=
  20297. /*! *****************************************************************************
  20298. Copyright (c) Microsoft Corporation.
  20299. Permission to use, copy, modify, and/or distribute this software for any
  20300. purpose with or without fee is hereby granted.
  20301. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  20302. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  20303. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  20304. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  20305. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  20306. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  20307. PERFORMANCE OF THIS SOFTWARE.
  20308. ***************************************************************************** */
  20309. function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return {next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(g),h=b.next();!h.done;h=b.next()){var m=h.value,y=f+Sn(m);"string"!=typeof m&&u.push(((i={})[m.type]=!0,i.anchor={path:l,offset:f},i.focus={path:l,offset:y},i)),f=y;}}catch(e){n={error:e};}finally{try{h&&!h.done&&(r=b.return)&&r.call(b);}finally{if(n)throw n.error}}return u},e.wangEditorCodeHighlightModule=Ua,Object.defineProperty(e,"__esModule",{value:!0});}));
  20310. });
  20311. /*! *****************************************************************************
  20312. Copyright (c) Microsoft Corporation.
  20313. Permission to use, copy, modify, and/or distribute this software for any
  20314. purpose with or without fee is hereby granted.
  20315. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  20316. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  20317. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  20318. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  20319. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  20320. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  20321. PERFORMANCE OF THIS SOFTWARE.
  20322. ***************************************************************************** */
  20323. var __assign = function() {
  20324. __assign = Object.assign || function __assign(t) {
  20325. for (var s, i = 1, n = arguments.length; i < n; i++) {
  20326. s = arguments[i];
  20327. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  20328. }
  20329. return t;
  20330. };
  20331. return __assign.apply(this, arguments);
  20332. };
  20333. /**
  20334. * @description Editor View class
  20335. * @author wangfupeng
  20336. */
  20337. var Boot = /** @class */ (function () {
  20338. function Boot() {
  20339. throw new Error('不能实例化\nCan not construct a instance');
  20340. }
  20341. Boot.setEditorConfig = function (newConfig) {
  20342. if (newConfig === void 0) { newConfig = {}; }
  20343. this.editorConfig = __assign(__assign({}, this.editorConfig), newConfig);
  20344. };
  20345. Boot.setSimpleEditorConfig = function (newConfig) {
  20346. if (newConfig === void 0) { newConfig = {}; }
  20347. this.simpleEditorConfig = __assign(__assign({}, this.simpleEditorConfig), newConfig);
  20348. };
  20349. Boot.setToolbarConfig = function (newConfig) {
  20350. if (newConfig === void 0) { newConfig = {}; }
  20351. this.toolbarConfig = __assign(__assign({}, this.toolbarConfig), newConfig);
  20352. };
  20353. Boot.setSimpleToolbarConfig = function (newConfig) {
  20354. if (newConfig === void 0) { newConfig = {}; }
  20355. this.simpleToolbarConfig = __assign(__assign({}, this.simpleToolbarConfig), newConfig);
  20356. };
  20357. Boot.registerPlugin = function (plugin) {
  20358. this.plugins.push(plugin);
  20359. };
  20360. // 注册 menu
  20361. // TODO 可在注册时传入配置,在开发文档中说明
  20362. Boot.registerMenu = function (menuConf, customConfig) {
  20363. dist$6.registerMenu(menuConf, customConfig);
  20364. };
  20365. // 注册 renderElem
  20366. Boot.registerRenderElem = function (renderElemConf) {
  20367. dist$6.registerRenderElemConf(renderElemConf);
  20368. };
  20369. // 注册 renderStyle
  20370. Boot.registerRenderStyle = function (fn) {
  20371. dist$6.registerStyleHandler(fn);
  20372. };
  20373. // 注册 elemToHtml
  20374. Boot.registerElemToHtml = function (elemToHtmlConf) {
  20375. dist$6.registerElemToHtmlConf(elemToHtmlConf);
  20376. };
  20377. // 注册 styleToHtml
  20378. Boot.registerStyleToHtml = function (fn) {
  20379. dist$6.registerStyleToHtmlHandler(fn);
  20380. };
  20381. // 注册 preParseHtml
  20382. Boot.registerPreParseHtml = function (preParseHtmlConf) {
  20383. dist$6.registerPreParseHtmlConf(preParseHtmlConf);
  20384. };
  20385. // 注册 parseElemHtml
  20386. Boot.registerParseElemHtml = function (parseElemHtmlConf) {
  20387. dist$6.registerParseElemHtmlConf(parseElemHtmlConf);
  20388. };
  20389. // 注册 parseStyleHtml
  20390. Boot.registerParseStyleHtml = function (fn) {
  20391. dist$6.registerParseStyleHtmlHandler(fn);
  20392. };
  20393. // 注册 module
  20394. Boot.registerModule = function (module) {
  20395. registerModule(module);
  20396. };
  20397. // editor 配置
  20398. Boot.editorConfig = {};
  20399. Boot.simpleEditorConfig = {};
  20400. //toolbar 配置
  20401. Boot.toolbarConfig = {};
  20402. Boot.simpleToolbarConfig = {};
  20403. // 注册插件
  20404. Boot.plugins = [];
  20405. return Boot;
  20406. }());
  20407. /**
  20408. * @description 注册 module
  20409. * @author wangfupeng
  20410. */
  20411. function registerModule(module) {
  20412. var menus = module.menus, renderElems = module.renderElems, renderStyle = module.renderStyle, elemsToHtml = module.elemsToHtml, styleToHtml = module.styleToHtml, preParseHtml = module.preParseHtml, parseElemsHtml = module.parseElemsHtml, parseStyleHtml = module.parseStyleHtml, editorPlugin = module.editorPlugin;
  20413. if (menus) {
  20414. menus.forEach(function (menu) { return Boot.registerMenu(menu); });
  20415. }
  20416. if (renderElems) {
  20417. renderElems.forEach(function (renderElemConf) { return Boot.registerRenderElem(renderElemConf); });
  20418. }
  20419. if (renderStyle) {
  20420. Boot.registerRenderStyle(renderStyle);
  20421. }
  20422. if (elemsToHtml) {
  20423. elemsToHtml.forEach(function (elemToHtmlConf) { return Boot.registerElemToHtml(elemToHtmlConf); });
  20424. }
  20425. if (styleToHtml) {
  20426. Boot.registerStyleToHtml(styleToHtml);
  20427. }
  20428. if (preParseHtml) {
  20429. preParseHtml.forEach(function (conf) { return Boot.registerPreParseHtml(conf); });
  20430. }
  20431. if (parseElemsHtml) {
  20432. parseElemsHtml.forEach(function (parseElemHtmlConf) { return Boot.registerParseElemHtml(parseElemHtmlConf); });
  20433. }
  20434. if (parseStyleHtml) {
  20435. Boot.registerParseStyleHtml(parseStyleHtml);
  20436. }
  20437. if (editorPlugin) {
  20438. Boot.registerPlugin(editorPlugin);
  20439. }
  20440. }
  20441. /**
  20442. * @description register builtin modules
  20443. * @author wangfupeng
  20444. */
  20445. basicModules.forEach(function (module) { return registerModule(module); });
  20446. registerModule(dist$4);
  20447. registerModule(dist$3);
  20448. registerModule(dist$2);
  20449. registerModule(dist$1);
  20450. registerModule(dist.wangEditorCodeHighlightModule);
  20451. /**
  20452. * @description svg tag
  20453. * @author wangfupeng
  20454. */
  20455. /**
  20456. * 【注意】svg 字符串的长度 ,否则会导致代码体积过大
  20457. * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
  20458. * 找不到再从 iconfont.com 搜索
  20459. */
  20460. // 缩进 right
  20461. var INDENT_RIGHT_SVG = '<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m384 192h640v128H384z m0 192h640v128H384z m0 192h640v128H384zM0 832h1024v128H0z m0-128V320l256 192z"></path></svg>';
  20462. // 左对齐
  20463. var JUSTIFY_LEFT_SVG = '<svg viewBox="0 0 1024 1024"><path d="M768 793.6v102.4H51.2v-102.4h716.8z m204.8-230.4v102.4H51.2v-102.4h921.6z m-204.8-230.4v102.4H51.2v-102.4h716.8zM972.8 102.4v102.4H51.2V102.4h921.6z"></path></svg>';
  20464. // 图片
  20465. var IMAGE_SVG = '<svg viewBox="0 0 1024 1024"><path d="M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z"></path></svg>';
  20466. // plus
  20467. var MORE_SVG = '<svg viewBox="0 0 1024 1024"><path d="M204.8 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path><path d="M505.6 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path><path d="M806.4 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path></svg>';
  20468. // 视频
  20469. var VIDEO_SVG = '<svg viewBox="0 0 1024 1024"><path d="M981.184 160.096C837.568 139.456 678.848 128 512 128S186.432 139.456 42.816 160.096C15.296 267.808 0 386.848 0 512s15.264 244.16 42.816 351.904C186.464 884.544 345.152 896 512 896s325.568-11.456 469.184-32.096C1008.704 756.192 1024 637.152 1024 512s-15.264-244.16-42.816-351.904zM384 704V320l320 192-320 192z"></path></svg>';
  20470. /**
  20471. * @description toolbar 配置
  20472. * @author wangfupeng
  20473. */
  20474. function genDefaultToolbarKeys() {
  20475. return [
  20476. 'headerSelect',
  20477. // 'header1',
  20478. // 'header2',
  20479. // 'header3',
  20480. 'blockquote',
  20481. '|',
  20482. 'bold',
  20483. 'underline',
  20484. 'italic',
  20485. {
  20486. key: 'group-more-style',
  20487. title: dist$6.t('editor.more'),
  20488. iconSvg: MORE_SVG,
  20489. menuKeys: ['through', 'code', 'sup', 'sub', 'clearStyle'],
  20490. },
  20491. 'color',
  20492. 'bgColor',
  20493. '|',
  20494. 'fontSize',
  20495. 'fontFamily',
  20496. 'lineHeight',
  20497. '|',
  20498. 'bulletedList',
  20499. 'numberedList',
  20500. 'todo',
  20501. {
  20502. key: 'group-justify',
  20503. title: dist$6.t('editor.justify'),
  20504. iconSvg: JUSTIFY_LEFT_SVG,
  20505. menuKeys: ['justifyLeft', 'justifyRight', 'justifyCenter', 'justifyJustify'],
  20506. },
  20507. {
  20508. key: 'group-indent',
  20509. title: dist$6.t('editor.indent'),
  20510. iconSvg: INDENT_RIGHT_SVG,
  20511. menuKeys: ['indent', 'delIndent'],
  20512. },
  20513. '|',
  20514. 'emotion',
  20515. 'insertLink',
  20516. // 'editLink',
  20517. // 'unLink',
  20518. // 'viewLink',
  20519. {
  20520. key: 'group-image',
  20521. title: dist$6.t('editor.image'),
  20522. iconSvg: IMAGE_SVG,
  20523. menuKeys: ['insertImage', 'uploadImage'],
  20524. },
  20525. // 'deleteImage',
  20526. // 'editImage',
  20527. // 'viewImageLink',
  20528. {
  20529. key: 'group-video',
  20530. title: dist$6.t('editor.video'),
  20531. iconSvg: VIDEO_SVG,
  20532. menuKeys: ['insertVideo', 'uploadVideo'],
  20533. },
  20534. // 'deleteVideo',
  20535. 'insertTable',
  20536. 'codeBlock',
  20537. // 'codeSelectLang',
  20538. 'divider',
  20539. // 'deleteTable',
  20540. '|',
  20541. 'undo',
  20542. 'redo',
  20543. '|',
  20544. 'fullScreen',
  20545. ];
  20546. }
  20547. function genSimpleToolbarKeys() {
  20548. return [
  20549. 'blockquote',
  20550. 'header1',
  20551. 'header2',
  20552. 'header3',
  20553. '|',
  20554. 'bold',
  20555. 'underline',
  20556. 'italic',
  20557. 'through',
  20558. 'color',
  20559. 'bgColor',
  20560. 'clearStyle',
  20561. '|',
  20562. 'bulletedList',
  20563. 'numberedList',
  20564. 'todo',
  20565. 'justifyLeft',
  20566. 'justifyRight',
  20567. 'justifyCenter',
  20568. '|',
  20569. 'insertLink',
  20570. {
  20571. key: 'group-image',
  20572. title: dist$6.t('editor.image'),
  20573. iconSvg: IMAGE_SVG,
  20574. menuKeys: ['insertImage', 'uploadImage'],
  20575. },
  20576. 'insertVideo',
  20577. 'insertTable',
  20578. 'codeBlock',
  20579. '|',
  20580. 'undo',
  20581. 'redo',
  20582. '|',
  20583. 'fullScreen',
  20584. ];
  20585. }
  20586. /**
  20587. * @description hoverbar 配置
  20588. * @author wangfupeng
  20589. */
  20590. var COMMON_HOVERBAR_KEYS = {
  20591. // key 即 element type
  20592. link: {
  20593. menuKeys: ['editLink', 'unLink', 'viewLink'],
  20594. },
  20595. image: {
  20596. menuKeys: [
  20597. 'imageWidth30',
  20598. 'imageWidth50',
  20599. 'imageWidth100',
  20600. 'editImage',
  20601. 'viewImageLink',
  20602. 'deleteImage',
  20603. ],
  20604. },
  20605. pre: {
  20606. menuKeys: ['enter', 'codeBlock', 'codeSelectLang'],
  20607. },
  20608. table: {
  20609. menuKeys: [
  20610. 'enter',
  20611. 'tableHeader',
  20612. 'tableFullWidth',
  20613. 'insertTableRow',
  20614. 'deleteTableRow',
  20615. 'insertTableCol',
  20616. 'deleteTableCol',
  20617. 'deleteTable',
  20618. ],
  20619. },
  20620. divider: {
  20621. menuKeys: ['enter'],
  20622. },
  20623. video: {
  20624. menuKeys: ['enter', 'editVideoSize'],
  20625. },
  20626. };
  20627. function genDefaultHoverbarKeys() {
  20628. return __assign(__assign({}, COMMON_HOVERBAR_KEYS), {
  20629. // 也可以自定义 match 来匹配元素,此时 key 就随意了
  20630. text: {
  20631. menuKeys: [
  20632. 'headerSelect',
  20633. 'insertLink',
  20634. 'bulletedList',
  20635. '|',
  20636. 'bold',
  20637. 'through',
  20638. 'color',
  20639. 'bgColor',
  20640. 'clearStyle',
  20641. ],
  20642. } });
  20643. }
  20644. function genSimpleHoverbarKeys() {
  20645. return COMMON_HOVERBAR_KEYS;
  20646. }
  20647. /**
  20648. * @description 获取编辑器默认配置
  20649. * @author wangfupeng
  20650. */
  20651. function getDefaultEditorConfig() {
  20652. return {
  20653. hoverbarKeys: genDefaultHoverbarKeys(),
  20654. };
  20655. }
  20656. function getSimpleEditorConfig() {
  20657. return {
  20658. hoverbarKeys: genSimpleHoverbarKeys(),
  20659. };
  20660. }
  20661. function getDefaultToolbarConfig() {
  20662. return {
  20663. toolbarKeys: genDefaultToolbarKeys(),
  20664. };
  20665. }
  20666. function getSimpleToolbarConfig() {
  20667. return {
  20668. toolbarKeys: genSimpleToolbarKeys(),
  20669. };
  20670. }
  20671. /**
  20672. * @description set default config
  20673. * @author wangfupeng
  20674. */
  20675. var defaultEditorConfig = getDefaultEditorConfig();
  20676. Boot.setEditorConfig(__assign(__assign({}, defaultEditorConfig), { decorate: dist.wangEditorCodeHighLightDecorate }));
  20677. var simpleEditorConfig = getSimpleEditorConfig();
  20678. Boot.setSimpleEditorConfig(__assign(__assign({}, simpleEditorConfig), { decorate: dist.wangEditorCodeHighLightDecorate }));
  20679. var defaultToolbarConfig = getDefaultToolbarConfig();
  20680. Boot.setToolbarConfig(defaultToolbarConfig);
  20681. var simpleToolbarConfig = getSimpleToolbarConfig();
  20682. Boot.setSimpleToolbarConfig(simpleToolbarConfig);
  20683. /**
  20684. * @description create
  20685. * @author wangfupeng
  20686. */
  20687. /**
  20688. * 创建 editor 实例
  20689. */
  20690. function createEditor(option) {
  20691. if (option === void 0) { option = {}; }
  20692. var _a = option.selector, selector = _a === void 0 ? '' : _a, _b = option.content, content = _b === void 0 ? [] : _b, html = option.html, _c = option.config, config = _c === void 0 ? {} : _c, _d = option.mode, mode = _d === void 0 ? 'default' : _d;
  20693. var globalConfig = mode === 'simple' ? Boot.simpleEditorConfig : Boot.editorConfig;
  20694. // 单独处理 hoverbarKeys
  20695. var newHoverbarKeys = __assign(__assign({}, (globalConfig.hoverbarKeys || {})), (config.hoverbarKeys || {}));
  20696. var editor = dist$6.coreCreateEditor({
  20697. selector: selector,
  20698. config: __assign(__assign(__assign({}, globalConfig), config), { hoverbarKeys: newHoverbarKeys }),
  20699. content: content,
  20700. html: html,
  20701. plugins: Boot.plugins,
  20702. });
  20703. return editor;
  20704. }
  20705. /**
  20706. * 创建 toolbar 实例
  20707. */
  20708. function createToolbar(option) {
  20709. var selector = option.selector, editor = option.editor, _a = option.config, config = _a === void 0 ? {} : _a, _b = option.mode, mode = _b === void 0 ? 'default' : _b;
  20710. if (!selector) {
  20711. throw new Error("Cannot find 'selector' when create toolbar");
  20712. }
  20713. var globalConfig = mode === 'simple' ? Boot.simpleToolbarConfig : Boot.toolbarConfig;
  20714. var toolbar = dist$6.coreCreateToolbar(editor, {
  20715. selector: selector,
  20716. config: __assign(__assign({}, globalConfig), config),
  20717. });
  20718. return toolbar;
  20719. }
  20720. /**
  20721. * @description editor entry
  20722. * @author wangfupeng
  20723. */
  20724. var index = {};
  20725. exports.Boot = Boot;
  20726. exports.DomEditor = dist$6.DomEditor;
  20727. exports.SlateEditor = Editor_1;
  20728. exports.SlateElement = Element_1;
  20729. exports.SlateLocation = Location_1;
  20730. exports.SlateNode = Node_1;
  20731. exports.SlatePath = Path_1;
  20732. exports.SlatePoint = Point_1;
  20733. exports.SlateRange = Range_1;
  20734. exports.SlateText = Text_1;
  20735. exports.SlateTransforms = Transforms_1;
  20736. exports.Toolbar = dist$6.Toolbar;
  20737. exports.createEditor = createEditor;
  20738. exports.createToolbar = createToolbar;
  20739. exports.createUploader = dist$6.createUploader;
  20740. exports["default"] = index;
  20741. exports.genModalButtonElems = dist$6.genModalButtonElems;
  20742. exports.genModalInputElems = dist$6.genModalInputElems;
  20743. exports.genModalTextareaElems = dist$6.genModalTextareaElems;
  20744. exports.i18nAddResources = dist$6.i18nAddResources;
  20745. exports.i18nChangeLanguage = dist$6.i18nChangeLanguage;
  20746. exports.i18nGetResources = dist$6.i18nGetResources;
  20747. exports.t = dist$6.t;
  20748. Object.defineProperty(exports, '__esModule', { value: true });
  20749. }));