123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129 |
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.wangEditor = {}));
- })(this, (function (exports) { 'use strict';
- /**
- * @description browser polyfill
- * @author wangfupeng
- */
- var _a;
- // @ts-nocheck
- // 必须是浏览器环境
- if (typeof global === 'undefined') {
- // 检查 IE 浏览器
- if ('ActiveXObject' in window) {
- var info = '抱歉,wangEditor V5+ 版本开始,不在支持 IE 浏览器';
- info += '\n Sorry, wangEditor V5+ versions do not support IE browser.';
- console.error(info);
- }
- globalThisPolyfill();
- AggregateErrorPolyfill();
- }
- else if (global && ((_a = global.navigator) === null || _a === void 0 ? void 0 : _a.userAgent.match('QQBrowser'))) {
- // 兼容 QQ 浏览器 AggregateError 报错
- globalThisPolyfill();
- AggregateErrorPolyfill();
- }
- function globalThisPolyfill() {
- // 部分浏览器不支持 globalThis
- if (typeof globalThis === 'undefined') {
- // @ts-ignore
- window.globalThis = window;
- }
- }
- function AggregateErrorPolyfill() {
- if (typeof AggregateError === 'undefined') {
- window.AggregateError = function (errors, msg) {
- var err = new Error(msg);
- err.errors = errors;
- return err;
- };
- }
- }
- /**
- * @description node polyfill
- * @author wangfupeng
- */
- // @ts-nocheck
- // 必须是 node 环境
- if (typeof global === 'object') {
- // 用于 nodejs ,避免报错
- var globalProperty = Object.getOwnPropertyDescriptor(global, 'window');
- // global.window 为空则直接写入
- // 部分框架下已经定义了global.window且是不可写属性
- if (!global.window || globalProperty.set) {
- global.window = global;
- global.requestAnimationFrame = function () { };
- global.navigator = {
- userAgent: '',
- };
- global.location = {
- hostname: '0.0.0.0',
- port: 0,
- protocol: 'http:',
- };
- global.btoa = function () { };
- global.crypto = {
- getRandomValues: function (buffer) {
- return nodeCrypto.randomFillSync(buffer);
- },
- };
- }
- if (global.document != null) {
- // SSR 环境下可能会报错 (issue 4409)
- if (global.document.getElementsByTagName == null) {
- global.document.getElementsByTagName = function () { return []; };
- }
- }
- }
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
- function getDefaultExportFromCjs (x) {
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
- }
- function createCommonjsModule$1(fn) {
- var module = { exports: {} };
- return fn(module, module.exports), module.exports;
- }
- /*!
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- function isObject$4(o) {
- return Object.prototype.toString.call(o) === '[object Object]';
- }
- function isPlainObject$2(o) {
- var ctor,prot;
- if (isObject$4(o) === false) return false;
- // If has modified constructor
- ctor = o.constructor;
- if (ctor === undefined) return true;
- // If has modified prototype
- prot = ctor.prototype;
- if (isObject$4(prot) === false) return false;
- // If constructor does not have an Object-specific method
- if (prot.hasOwnProperty('isPrototypeOf') === false) {
- return false;
- }
- // Most likely a plain Object
- return true;
- }
- var isPlainObject_2 = isPlainObject$2;
- var isPlainObject_1 = /*#__PURE__*/Object.defineProperty({
- isPlainObject: isPlainObject_2
- }, '__esModule', {value: true});
- var _ref;
- // Should be no imports here!
- // Some things that should be evaluated before all else...
- // We only want to know if non-polyfilled symbols are available
- var hasSymbol = typeof Symbol !== "undefined" && typeof
- /*#__PURE__*/
- Symbol("x") === "symbol";
- var hasMap = typeof Map !== "undefined";
- var hasSet = typeof Set !== "undefined";
- var hasProxies = typeof Proxy !== "undefined" && typeof Proxy.revocable !== "undefined" && typeof Reflect !== "undefined";
- /**
- * The sentinel value returned by producers to replace the draft with undefined.
- */
- var NOTHING = hasSymbol ?
- /*#__PURE__*/
- Symbol.for("immer-nothing") : (_ref = {}, _ref["immer-nothing"] = true, _ref);
- /**
- * To let Immer treat your class instances as plain immutable objects
- * (albeit with a custom prototype), you must define either an instance property
- * or a static property on each of your custom classes.
- *
- * Otherwise, your class instance will never be drafted, which means it won't be
- * safe to mutate in a produce callback.
- */
- var DRAFTABLE = hasSymbol ?
- /*#__PURE__*/
- Symbol.for("immer-draftable") : "__$immer_draftable";
- var DRAFT_STATE = hasSymbol ?
- /*#__PURE__*/
- Symbol.for("immer-state") : "__$immer_state"; // Even a polyfilled Symbol might provide Symbol.iterator
- var iteratorSymbol$1 = typeof Symbol != "undefined" && Symbol.iterator || "@@iterator";
- var errors = {
- 0: "Illegal state",
- 1: "Immer drafts cannot have computed properties",
- 2: "This object has been frozen and should not be mutated",
- 3: function _(data) {
- return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
- },
- 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
- 5: "Immer forbids circular references",
- 6: "The first or second argument to `produce` must be a function",
- 7: "The third argument to `produce` must be a function or undefined",
- 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object",
- 9: "First argument to `finishDraft` must be a draft returned by `createDraft`",
- 10: "The given draft is already finalized",
- 11: "Object.defineProperty() cannot be used on an Immer draft",
- 12: "Object.setPrototypeOf() cannot be used on an Immer draft",
- 13: "Immer only supports deleting array indices",
- 14: "Immer only supports setting array indices and the 'length' property",
- 15: function _(path) {
- return "Cannot apply patch, path doesn't resolve: " + path;
- },
- 16: 'Sets cannot have "replace" patches.',
- 17: function _(op) {
- return "Unsupported patch operation: " + op;
- },
- 18: function _(plugin) {
- return "The plugin for '" + plugin + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + plugin + "()` when initializing your application.";
- },
- 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",
- 21: function _(thing) {
- 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 + "'";
- },
- 22: function _(thing) {
- return "'current' expects a draft, got: " + thing;
- },
- 23: function _(thing) {
- return "'original' expects a draft, got: " + thing;
- },
- 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed"
- };
- function die(error) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- {
- var e = errors[error];
- var msg = !e ? "unknown error nr: " + error : typeof e === "function" ? e.apply(null, args) : e;
- throw new Error("[Immer] " + msg);
- }
- }
- /** Returns true if the given value is an Immer draft */
- function isDraft(value) {
- return !!value && !!value[DRAFT_STATE];
- }
- /** Returns true if the given value can be drafted by Immer */
- function isDraftable(value) {
- if (!value) return false;
- return isPlainObject$1(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE] || isMap(value) || isSet(value);
- }
- var objectCtorString =
- /*#__PURE__*/
- Object.prototype.constructor.toString();
- function isPlainObject$1(value) {
- if (!value || typeof value !== "object") return false;
- var proto = Object.getPrototypeOf(value);
- if (proto === null) {
- return true;
- }
- var Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
- if (Ctor === Object) return true;
- return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString;
- }
- function original(value) {
- if (!isDraft(value)) die(23, value);
- return value[DRAFT_STATE].base_;
- }
- var ownKeys$a = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) {
- return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));
- } :
- /* istanbul ignore next */
- Object.getOwnPropertyNames;
- var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(target) {
- // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274
- var res = {};
- ownKeys$a(target).forEach(function (key) {
- res[key] = Object.getOwnPropertyDescriptor(target, key);
- });
- return res;
- };
- function each$1(obj, iter, enumerableOnly) {
- if (enumerableOnly === void 0) {
- enumerableOnly = false;
- }
- if (getArchtype(obj) === 0
- /* Object */
- ) {
- (enumerableOnly ? Object.keys : ownKeys$a)(obj).forEach(function (key) {
- if (!enumerableOnly || typeof key !== "symbol") iter(key, obj[key], obj);
- });
- } else {
- obj.forEach(function (entry, index) {
- return iter(index, entry, obj);
- });
- }
- }
- function getArchtype(thing) {
- /* istanbul ignore next */
- var state = thing[DRAFT_STATE];
- return state ? state.type_ > 3 ? state.type_ - 4 // cause Object and Array map back from 4 and 5
- : state.type_ // others are the same
- : Array.isArray(thing) ? 1
- /* Array */
- : isMap(thing) ? 2
- /* Map */
- : isSet(thing) ? 3
- /* Set */
- : 0
- /* Object */
- ;
- }
- function has(thing, prop) {
- return getArchtype(thing) === 2
- /* Map */
- ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
- }
- function get(thing, prop) {
- // @ts-ignore
- return getArchtype(thing) === 2
- /* Map */
- ? thing.get(prop) : thing[prop];
- }
- function set(thing, propOrOldValue, value) {
- var t = getArchtype(thing);
- if (t === 2
- /* Map */
- ) thing.set(propOrOldValue, value);else if (t === 3
- /* Set */
- ) {
- thing.delete(propOrOldValue);
- thing.add(value);
- } else thing[propOrOldValue] = value;
- }
- function is$1(x, y) {
- // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
- if (x === y) {
- return x !== 0 || 1 / x === 1 / y;
- } else {
- return x !== x && y !== y;
- }
- }
- function isMap(target) {
- return hasMap && target instanceof Map;
- }
- function isSet(target) {
- return hasSet && target instanceof Set;
- }
- function latest(state) {
- return state.copy_ || state.base_;
- }
- function shallowCopy(base) {
- if (Array.isArray(base)) return Array.prototype.slice.call(base);
- var descriptors = getOwnPropertyDescriptors(base);
- delete descriptors[DRAFT_STATE];
- var keys = ownKeys$a(descriptors);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- var desc = descriptors[key];
- if (desc.writable === false) {
- desc.writable = true;
- desc.configurable = true;
- } // like object.assign, we will read any _own_, get/set accessors. This helps in dealing
- // with libraries that trap values, like mobx or vue
- // unlike object.assign, non-enumerables will be copied as well
- if (desc.get || desc.set) descriptors[key] = {
- configurable: true,
- writable: true,
- enumerable: desc.enumerable,
- value: base[key]
- };
- }
- return Object.create(Object.getPrototypeOf(base), descriptors);
- }
- function freeze(obj, deep) {
- if (deep === void 0) {
- deep = false;
- }
- if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj;
- if (getArchtype(obj) > 1
- /* Map or Set */
- ) {
- obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections;
- }
- Object.freeze(obj);
- if (deep) each$1(obj, function (key, value) {
- return freeze(value, true);
- }, true);
- return obj;
- }
- function dontMutateFrozenCollections() {
- die(2);
- }
- function isFrozen(obj) {
- if (obj == null || typeof obj !== "object") return true; // See #600, IE dies on non-objects in Object.isFrozen
- return Object.isFrozen(obj);
- }
- /** Plugin utilities */
- var plugins = {};
- function getPlugin(pluginKey) {
- var plugin = plugins[pluginKey];
- if (!plugin) {
- die(18, pluginKey);
- } // @ts-ignore
- return plugin;
- }
- function loadPlugin(pluginKey, implementation) {
- if (!plugins[pluginKey]) plugins[pluginKey] = implementation;
- }
- var currentScope;
- function getCurrentScope() {
- if ( !currentScope) die(0);
- return currentScope;
- }
- function createScope(parent_, immer_) {
- return {
- drafts_: [],
- parent_: parent_,
- immer_: immer_,
- // Whenever the modified draft contains a draft from another scope, we
- // need to prevent auto-freezing so the unowned draft can be finalized.
- canAutoFreeze_: true,
- unfinalizedDrafts_: 0
- };
- }
- function usePatchesInScope(scope, patchListener) {
- if (patchListener) {
- getPlugin("Patches"); // assert we have the plugin
- scope.patches_ = [];
- scope.inversePatches_ = [];
- scope.patchListener_ = patchListener;
- }
- }
- function revokeScope(scope) {
- leaveScope(scope);
- scope.drafts_.forEach(revokeDraft); // @ts-ignore
- scope.drafts_ = null;
- }
- function leaveScope(scope) {
- if (scope === currentScope) {
- currentScope = scope.parent_;
- }
- }
- function enterScope(immer) {
- return currentScope = createScope(currentScope, immer);
- }
- function revokeDraft(draft) {
- var state = draft[DRAFT_STATE];
- if (state.type_ === 0
- /* ProxyObject */
- || state.type_ === 1
- /* ProxyArray */
- ) state.revoke_();else state.revoked_ = true;
- }
- function processResult(result, scope) {
- scope.unfinalizedDrafts_ = scope.drafts_.length;
- var baseDraft = scope.drafts_[0];
- var isReplaced = result !== undefined && result !== baseDraft;
- if (!scope.immer_.useProxies_) getPlugin("ES5").willFinalizeES5_(scope, result, isReplaced);
- if (isReplaced) {
- if (baseDraft[DRAFT_STATE].modified_) {
- revokeScope(scope);
- die(4);
- }
- if (isDraftable(result)) {
- // Finalize the result in case it contains (or is) a subset of the draft.
- result = finalize(scope, result);
- if (!scope.parent_) maybeFreeze(scope, result);
- }
- if (scope.patches_) {
- getPlugin("Patches").generateReplacementPatches_(baseDraft[DRAFT_STATE], result, scope.patches_, scope.inversePatches_);
- }
- } else {
- // Finalize the base draft.
- result = finalize(scope, baseDraft, []);
- }
- revokeScope(scope);
- if (scope.patches_) {
- scope.patchListener_(scope.patches_, scope.inversePatches_);
- }
- return result !== NOTHING ? result : undefined;
- }
- function finalize(rootScope, value, path) {
- // Don't recurse in tho recursive data structures
- if (isFrozen(value)) return value;
- var state = value[DRAFT_STATE]; // A plain object, might need freezing, might contain drafts
- if (!state) {
- each$1(value, function (key, childValue) {
- return finalizeProperty(rootScope, state, value, key, childValue, path);
- }, true // See #590, don't recurse into non-enumerable of non drafted objects
- );
- return value;
- } // Never finalize drafts owned by another scope.
- if (state.scope_ !== rootScope) return value; // Unmodified draft, return the (frozen) original
- if (!state.modified_) {
- maybeFreeze(rootScope, state.base_, true);
- return state.base_;
- } // Not finalized yet, let's do that now
- if (!state.finalized_) {
- state.finalized_ = true;
- state.scope_.unfinalizedDrafts_--;
- var result = // For ES5, create a good copy from the draft first, with added keys and without deleted keys.
- state.type_ === 4
- /* ES5Object */
- || state.type_ === 5
- /* ES5Array */
- ? state.copy_ = shallowCopy(state.draft_) : state.copy_; // Finalize all children of the copy
- // For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628
- // Although the original test case doesn't seem valid anyway, so if this in the way we can turn the next line
- // back to each(result, ....)
- each$1(state.type_ === 3
- /* Set */
- ? new Set(result) : result, function (key, childValue) {
- return finalizeProperty(rootScope, state, result, key, childValue, path);
- }); // everything inside is frozen, we can freeze here
- maybeFreeze(rootScope, result, false); // first time finalizing, let's create those patches
- if (path && rootScope.patches_) {
- getPlugin("Patches").generatePatches_(state, path, rootScope.patches_, rootScope.inversePatches_);
- }
- }
- return state.copy_;
- }
- function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath) {
- if ( childValue === targetObject) die(5);
- if (isDraft(childValue)) {
- var path = rootPath && parentState && parentState.type_ !== 3
- /* Set */
- && // Set objects are atomic since they have no keys.
- !has(parentState.assigned_, prop) // Skip deep patches for assigned keys.
- ? rootPath.concat(prop) : undefined; // Drafts owned by `scope` are finalized here.
- var res = finalize(rootScope, childValue, path);
- set(targetObject, prop, res); // Drafts from another scope must prevented to be frozen
- // if we got a draft back from finalize, we're in a nested produce and shouldn't freeze
- if (isDraft(res)) {
- rootScope.canAutoFreeze_ = false;
- } else return;
- } // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.
- if (isDraftable(childValue) && !isFrozen(childValue)) {
- if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
- // optimization: if an object is not a draft, and we don't have to
- // deepfreeze everything, and we are sure that no drafts are left in the remaining object
- // cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.
- // This benefits especially adding large data tree's without further processing.
- // See add-data.js perf test
- return;
- }
- finalize(rootScope, childValue); // immer deep freezes plain objects, so if there is no parent state, we freeze as well
- if (!parentState || !parentState.scope_.parent_) maybeFreeze(rootScope, childValue);
- }
- }
- function maybeFreeze(scope, value, deep) {
- if (deep === void 0) {
- deep = false;
- }
- if (scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
- freeze(value, deep);
- }
- }
- /**
- * Returns a new draft of the `base` object.
- *
- * The second argument is the parent draft-state (used internally).
- */
- function createProxyProxy(base, parent) {
- var isArray = Array.isArray(base);
- var state = {
- type_: isArray ? 1
- /* ProxyArray */
- : 0
- /* ProxyObject */
- ,
- // Track which produce call this is associated with.
- scope_: parent ? parent.scope_ : getCurrentScope(),
- // True for both shallow and deep changes.
- modified_: false,
- // Used during finalization.
- finalized_: false,
- // Track which properties have been assigned (true) or deleted (false).
- assigned_: {},
- // The parent draft state.
- parent_: parent,
- // The base state.
- base_: base,
- // The base proxy.
- draft_: null,
- // The base copy with any updated values.
- copy_: null,
- // Called by the `produce` function.
- revoke_: null,
- isManual_: false
- }; // the traps must target something, a bit like the 'real' base.
- // but also, we need to be able to determine from the target what the relevant state is
- // (to avoid creating traps per instance to capture the state in closure,
- // and to avoid creating weird hidden properties as well)
- // So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)
- // Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb
- var target = state;
- var traps = objectTraps;
- if (isArray) {
- target = [state];
- traps = arrayTraps;
- }
- var _Proxy$revocable = Proxy.revocable(target, traps),
- revoke = _Proxy$revocable.revoke,
- proxy = _Proxy$revocable.proxy;
- state.draft_ = proxy;
- state.revoke_ = revoke;
- return proxy;
- }
- /**
- * Object drafts
- */
- var objectTraps = {
- get: function get(state, prop) {
- if (prop === DRAFT_STATE) return state;
- var source = latest(state);
- if (!has(source, prop)) {
- // non-existing or non-own property...
- return readPropFromProto(state, source, prop);
- }
- var value = source[prop];
- if (state.finalized_ || !isDraftable(value)) {
- return value;
- } // Check for existing draft in modified state.
- // Assigned values are never drafted. This catches any drafts we created, too.
- if (value === peek(state.base_, prop)) {
- prepareCopy(state);
- return state.copy_[prop] = createProxy(state.scope_.immer_, value, state);
- }
- return value;
- },
- has: function has(state, prop) {
- return prop in latest(state);
- },
- ownKeys: function ownKeys(state) {
- return Reflect.ownKeys(latest(state));
- },
- set: function set(state, prop
- /* strictly not, but helps TS */
- , value) {
- var desc = getDescriptorFromProto(latest(state), prop);
- if (desc === null || desc === void 0 ? void 0 : desc.set) {
- // special case: if this write is captured by a setter, we have
- // to trigger it with the correct context
- desc.set.call(state.draft_, value);
- return true;
- }
- if (!state.modified_) {
- // the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)
- // from setting an existing property with value undefined to undefined (which is not a change)
- var current = peek(latest(state), prop); // special case, if we assigning the original value to a draft, we can ignore the assignment
- var currentState = current === null || current === void 0 ? void 0 : current[DRAFT_STATE];
- if (currentState && currentState.base_ === value) {
- state.copy_[prop] = value;
- state.assigned_[prop] = false;
- return true;
- }
- if (is$1(value, current) && (value !== undefined || has(state.base_, prop))) return true;
- prepareCopy(state);
- markChanged(state);
- }
- if (state.copy_[prop] === value && // special case: NaN
- typeof value !== "number" && ( // special case: handle new props with value 'undefined'
- value !== undefined || prop in state.copy_)) return true; // @ts-ignore
- state.copy_[prop] = value;
- state.assigned_[prop] = true;
- return true;
- },
- deleteProperty: function deleteProperty(state, prop) {
- // The `undefined` check is a fast path for pre-existing keys.
- if (peek(state.base_, prop) !== undefined || prop in state.base_) {
- state.assigned_[prop] = false;
- prepareCopy(state);
- markChanged(state);
- } else {
- // if an originally not assigned property was deleted
- delete state.assigned_[prop];
- } // @ts-ignore
- if (state.copy_) delete state.copy_[prop];
- return true;
- },
- // Note: We never coerce `desc.value` into an Immer draft, because we can't make
- // the same guarantee in ES5 mode.
- getOwnPropertyDescriptor: function getOwnPropertyDescriptor(state, prop) {
- var owner = latest(state);
- var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
- if (!desc) return desc;
- return {
- writable: true,
- configurable: state.type_ !== 1
- /* ProxyArray */
- || prop !== "length",
- enumerable: desc.enumerable,
- value: owner[prop]
- };
- },
- defineProperty: function defineProperty() {
- die(11);
- },
- getPrototypeOf: function getPrototypeOf(state) {
- return Object.getPrototypeOf(state.base_);
- },
- setPrototypeOf: function setPrototypeOf() {
- die(12);
- }
- };
- /**
- * Array drafts
- */
- var arrayTraps = {};
- each$1(objectTraps, function (key, fn) {
- // @ts-ignore
- arrayTraps[key] = function () {
- arguments[0] = arguments[0][0];
- return fn.apply(this, arguments);
- };
- });
- arrayTraps.deleteProperty = function (state, prop) {
- if ( isNaN(parseInt(prop))) die(13);
- return objectTraps.deleteProperty.call(this, state[0], prop);
- };
- arrayTraps.set = function (state, prop, value) {
- if ( prop !== "length" && isNaN(parseInt(prop))) die(14);
- return objectTraps.set.call(this, state[0], prop, value, state[0]);
- }; // Access a property without creating an Immer draft.
- function peek(draft, prop) {
- var state = draft[DRAFT_STATE];
- var source = state ? latest(state) : draft;
- return source[prop];
- }
- function readPropFromProto(state, source, prop) {
- var _desc$get;
- var desc = getDescriptorFromProto(source, prop);
- return desc ? "value" in desc ? desc.value : // This is a very special case, if the prop is a getter defined by the
- // prototype, we should invoke it with the draft as context!
- (_desc$get = desc.get) === null || _desc$get === void 0 ? void 0 : _desc$get.call(state.draft_) : undefined;
- }
- function getDescriptorFromProto(source, prop) {
- // 'in' checks proto!
- if (!(prop in source)) return undefined;
- var proto = Object.getPrototypeOf(source);
- while (proto) {
- var desc = Object.getOwnPropertyDescriptor(proto, prop);
- if (desc) return desc;
- proto = Object.getPrototypeOf(proto);
- }
- return undefined;
- }
- function markChanged(state) {
- if (!state.modified_) {
- state.modified_ = true;
- if (state.parent_) {
- markChanged(state.parent_);
- }
- }
- }
- function prepareCopy(state) {
- if (!state.copy_) {
- state.copy_ = shallowCopy(state.base_);
- }
- }
- var Immer =
- /*#__PURE__*/
- function () {
- function Immer(config) {
- var _this = this;
- this.useProxies_ = hasProxies;
- this.autoFreeze_ = true;
- /**
- * The `produce` function takes a value and a "recipe function" (whose
- * return value often depends on the base state). The recipe function is
- * free to mutate its first argument however it wants. All mutations are
- * only ever applied to a __copy__ of the base state.
- *
- * Pass only a function to create a "curried producer" which relieves you
- * from passing the recipe function every time.
- *
- * Only plain objects and arrays are made mutable. All other objects are
- * considered uncopyable.
- *
- * Note: This function is __bound__ to its `Immer` instance.
- *
- * @param {any} base - the initial state
- * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
- * @param {Function} patchListener - optional function that will be called with all the patches produced here
- * @returns {any} a new state, or the initial state if nothing was modified
- */
- this.produce = function (base, recipe, patchListener) {
- // curried invocation
- if (typeof base === "function" && typeof recipe !== "function") {
- var defaultBase = recipe;
- recipe = base;
- var self = _this;
- return function curriedProduce(base) {
- var _this2 = this;
- if (base === void 0) {
- base = defaultBase;
- }
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- return self.produce(base, function (draft) {
- var _recipe;
- return (_recipe = recipe).call.apply(_recipe, [_this2, draft].concat(args));
- }); // prettier-ignore
- };
- }
- if (typeof recipe !== "function") die(6);
- if (patchListener !== undefined && typeof patchListener !== "function") die(7);
- var result; // Only plain objects, arrays, and "immerable classes" are drafted.
- if (isDraftable(base)) {
- var scope = enterScope(_this);
- var proxy = createProxy(_this, base, undefined);
- var hasError = true;
- try {
- result = recipe(proxy);
- hasError = false;
- } finally {
- // finally instead of catch + rethrow better preserves original stack
- if (hasError) revokeScope(scope);else leaveScope(scope);
- }
- if (typeof Promise !== "undefined" && result instanceof Promise) {
- return result.then(function (result) {
- usePatchesInScope(scope, patchListener);
- return processResult(result, scope);
- }, function (error) {
- revokeScope(scope);
- throw error;
- });
- }
- usePatchesInScope(scope, patchListener);
- return processResult(result, scope);
- } else if (!base || typeof base !== "object") {
- result = recipe(base);
- if (result === NOTHING) return undefined;
- if (result === undefined) result = base;
- if (_this.autoFreeze_) freeze(result, true);
- return result;
- } else die(21, base);
- };
- this.produceWithPatches = function (arg1, arg2, arg3) {
- if (typeof arg1 === "function") {
- return function (state) {
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- args[_key2 - 1] = arguments[_key2];
- }
- return _this.produceWithPatches(state, function (draft) {
- return arg1.apply(void 0, [draft].concat(args));
- });
- };
- }
- var patches, inversePatches;
- var nextState = _this.produce(arg1, arg2, function (p, ip) {
- patches = p;
- inversePatches = ip;
- });
- return [nextState, patches, inversePatches];
- };
- if (typeof (config === null || config === void 0 ? void 0 : config.useProxies) === "boolean") this.setUseProxies(config.useProxies);
- if (typeof (config === null || config === void 0 ? void 0 : config.autoFreeze) === "boolean") this.setAutoFreeze(config.autoFreeze);
- }
- var _proto = Immer.prototype;
- _proto.createDraft = function createDraft(base) {
- if (!isDraftable(base)) die(8);
- if (isDraft(base)) base = current(base);
- var scope = enterScope(this);
- var proxy = createProxy(this, base, undefined);
- proxy[DRAFT_STATE].isManual_ = true;
- leaveScope(scope);
- return proxy;
- };
- _proto.finishDraft = function finishDraft(draft, patchListener) {
- var state = draft && draft[DRAFT_STATE];
- {
- if (!state || !state.isManual_) die(9);
- if (state.finalized_) die(10);
- }
- var scope = state.scope_;
- usePatchesInScope(scope, patchListener);
- return processResult(undefined, scope);
- }
- /**
- * Pass true to automatically freeze all copies created by Immer.
- *
- * By default, auto-freezing is enabled.
- */
- ;
- _proto.setAutoFreeze = function setAutoFreeze(value) {
- this.autoFreeze_ = value;
- }
- /**
- * Pass true to use the ES2015 `Proxy` class when creating drafts, which is
- * always faster than using ES5 proxies.
- *
- * By default, feature detection is used, so calling this is rarely necessary.
- */
- ;
- _proto.setUseProxies = function setUseProxies(value) {
- if (value && !hasProxies) {
- die(20);
- }
- this.useProxies_ = value;
- };
- _proto.applyPatches = function applyPatches(base, patches) {
- // If a patch replaces the entire state, take that replacement as base
- // before applying patches
- var i;
- for (i = patches.length - 1; i >= 0; i--) {
- var patch = patches[i];
- if (patch.path.length === 0 && patch.op === "replace") {
- base = patch.value;
- break;
- }
- } // If there was a patch that replaced the entire state, start from the
- // patch after that.
- if (i > -1) {
- patches = patches.slice(i + 1);
- }
- var applyPatchesImpl = getPlugin("Patches").applyPatches_;
- if (isDraft(base)) {
- // N.B: never hits if some patch a replacement, patches are never drafts
- return applyPatchesImpl(base, patches);
- } // Otherwise, produce a copy of the base state.
- return this.produce(base, function (draft) {
- return applyPatchesImpl(draft, patches);
- });
- };
- return Immer;
- }();
- function createProxy(immer, value, parent) {
- // precondition: createProxy should be guarded by isDraftable, so we know we can safely draft
- 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);
- var scope = parent ? parent.scope_ : getCurrentScope();
- scope.drafts_.push(draft);
- return draft;
- }
- function current(value) {
- if (!isDraft(value)) die(22, value);
- return currentImpl(value);
- }
- function currentImpl(value) {
- if (!isDraftable(value)) return value;
- var state = value[DRAFT_STATE];
- var copy;
- var archType = getArchtype(value);
- if (state) {
- if (!state.modified_ && (state.type_ < 4 || !getPlugin("ES5").hasChanges_(state))) return state.base_; // Optimization: avoid generating new drafts during copying
- state.finalized_ = true;
- copy = copyHelper(value, archType);
- state.finalized_ = false;
- } else {
- copy = copyHelper(value, archType);
- }
- each$1(copy, function (key, childValue) {
- if (state && get(state.base_, key) === childValue) return; // no need to copy or search in something that didn't change
- set(copy, key, currentImpl(childValue));
- }); // In the future, we might consider freezing here, based on the current settings
- return archType === 3
- /* Set */
- ? new Set(copy) : copy;
- }
- function copyHelper(value, archType) {
- // creates a shallow copy, even if it is a map or set
- switch (archType) {
- case 2
- /* Map */
- :
- return new Map(value);
- case 3
- /* Set */
- :
- // Set will be cloned as array temporarily, so that we can replace individual items
- return Array.from(value);
- }
- return shallowCopy(value);
- }
- function enableES5() {
- function willFinalizeES5_(scope, result, isReplaced) {
- if (!isReplaced) {
- if (scope.patches_) {
- markChangesRecursively(scope.drafts_[0]);
- } // This is faster when we don't care about which attributes changed.
- markChangesSweep(scope.drafts_);
- } // When a child draft is returned, look for changes.
- else if (isDraft(result) && result[DRAFT_STATE].scope_ === scope) {
- markChangesSweep(scope.drafts_);
- }
- }
- function createES5Draft(isArray, base) {
- if (isArray) {
- var draft = new Array(base.length);
- for (var i = 0; i < base.length; i++) {
- Object.defineProperty(draft, "" + i, proxyProperty(i, true));
- }
- return draft;
- } else {
- var _descriptors = getOwnPropertyDescriptors(base);
- delete _descriptors[DRAFT_STATE];
- var keys = ownKeys$a(_descriptors);
- for (var _i = 0; _i < keys.length; _i++) {
- var key = keys[_i];
- _descriptors[key] = proxyProperty(key, isArray || !!_descriptors[key].enumerable);
- }
- return Object.create(Object.getPrototypeOf(base), _descriptors);
- }
- }
- function createES5Proxy_(base, parent) {
- var isArray = Array.isArray(base);
- var draft = createES5Draft(isArray, base);
- var state = {
- type_: isArray ? 5
- /* ES5Array */
- : 4
- /* ES5Object */
- ,
- scope_: parent ? parent.scope_ : getCurrentScope(),
- modified_: false,
- finalized_: false,
- assigned_: {},
- parent_: parent,
- // base is the object we are drafting
- base_: base,
- // draft is the draft object itself, that traps all reads and reads from either the base (if unmodified) or copy (if modified)
- draft_: draft,
- copy_: null,
- revoked_: false,
- isManual_: false
- };
- Object.defineProperty(draft, DRAFT_STATE, {
- value: state,
- // enumerable: false <- the default
- writable: true
- });
- return draft;
- } // property descriptors are recycled to make sure we don't create a get and set closure per property,
- // but share them all instead
- var descriptors = {};
- function proxyProperty(prop, enumerable) {
- var desc = descriptors[prop];
- if (desc) {
- desc.enumerable = enumerable;
- } else {
- descriptors[prop] = desc = {
- configurable: true,
- enumerable: enumerable,
- get: function get() {
- var state = this[DRAFT_STATE];
- assertUnrevoked(state); // @ts-ignore
- return objectTraps.get(state, prop);
- },
- set: function set(value) {
- var state = this[DRAFT_STATE];
- assertUnrevoked(state); // @ts-ignore
- objectTraps.set(state, prop, value);
- }
- };
- }
- return desc;
- } // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
- function markChangesSweep(drafts) {
- // The natural order of drafts in the `scope` array is based on when they
- // were accessed. By processing drafts in reverse natural order, we have a
- // better chance of processing leaf nodes first. When a leaf node is known to
- // have changed, we can avoid any traversal of its ancestor nodes.
- for (var i = drafts.length - 1; i >= 0; i--) {
- var state = drafts[i][DRAFT_STATE];
- if (!state.modified_) {
- switch (state.type_) {
- case 5
- /* ES5Array */
- :
- if (hasArrayChanges(state)) markChanged(state);
- break;
- case 4
- /* ES5Object */
- :
- if (hasObjectChanges(state)) markChanged(state);
- break;
- }
- }
- }
- }
- function markChangesRecursively(object) {
- if (!object || typeof object !== "object") return;
- var state = object[DRAFT_STATE];
- if (!state) return;
- var base_ = state.base_,
- draft_ = state.draft_,
- assigned_ = state.assigned_,
- type_ = state.type_;
- if (type_ === 4
- /* ES5Object */
- ) {
- // Look for added keys.
- // probably there is a faster way to detect changes, as sweep + recurse seems to do some
- // unnecessary work.
- // also: probably we can store the information we detect here, to speed up tree finalization!
- each$1(draft_, function (key) {
- if (key === DRAFT_STATE) return; // The `undefined` check is a fast path for pre-existing keys.
- if (base_[key] === undefined && !has(base_, key)) {
- assigned_[key] = true;
- markChanged(state);
- } else if (!assigned_[key]) {
- // Only untouched properties trigger recursion.
- markChangesRecursively(draft_[key]);
- }
- }); // Look for removed keys.
- each$1(base_, function (key) {
- // The `undefined` check is a fast path for pre-existing keys.
- if (draft_[key] === undefined && !has(draft_, key)) {
- assigned_[key] = false;
- markChanged(state);
- }
- });
- } else if (type_ === 5
- /* ES5Array */
- ) {
- if (hasArrayChanges(state)) {
- markChanged(state);
- assigned_.length = true;
- }
- if (draft_.length < base_.length) {
- for (var i = draft_.length; i < base_.length; i++) {
- assigned_[i] = false;
- }
- } else {
- for (var _i2 = base_.length; _i2 < draft_.length; _i2++) {
- assigned_[_i2] = true;
- }
- } // Minimum count is enough, the other parts has been processed.
- var min = Math.min(draft_.length, base_.length);
- for (var _i3 = 0; _i3 < min; _i3++) {
- // Only untouched indices trigger recursion.
- if (assigned_[_i3] === undefined) markChangesRecursively(draft_[_i3]);
- }
- }
- }
- function hasObjectChanges(state) {
- var base_ = state.base_,
- draft_ = state.draft_; // Search for added keys and changed keys. Start at the back, because
- // non-numeric keys are ordered by time of definition on the object.
- var keys = ownKeys$a(draft_);
- for (var i = keys.length - 1; i >= 0; i--) {
- var key = keys[i];
- if (key === DRAFT_STATE) continue;
- var baseValue = base_[key]; // The `undefined` check is a fast path for pre-existing keys.
- if (baseValue === undefined && !has(base_, key)) {
- return true;
- } // Once a base key is deleted, future changes go undetected, because its
- // descriptor is erased. This branch detects any missed changes.
- else {
- var value = draft_[key];
- var _state = value && value[DRAFT_STATE];
- if (_state ? _state.base_ !== baseValue : !is$1(value, baseValue)) {
- return true;
- }
- }
- } // At this point, no keys were added or changed.
- // Compare key count to determine if keys were deleted.
- var baseIsDraft = !!base_[DRAFT_STATE];
- return keys.length !== ownKeys$a(base_).length + (baseIsDraft ? 0 : 1); // + 1 to correct for DRAFT_STATE
- }
- function hasArrayChanges(state) {
- var draft_ = state.draft_;
- if (draft_.length !== state.base_.length) return true; // See #116
- // If we first shorten the length, our array interceptors will be removed.
- // If after that new items are added, result in the same original length,
- // those last items will have no intercepting property.
- // So if there is no own descriptor on the last position, we know that items were removed and added
- // N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
- // the last one
- var descriptor = Object.getOwnPropertyDescriptor(draft_, draft_.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
- 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
- return false;
- }
- function hasChanges_(state) {
- return state.type_ === 4
- /* ES5Object */
- ? hasObjectChanges(state) : hasArrayChanges(state);
- }
- function assertUnrevoked(state
- /*ES5State | MapState | SetState*/
- ) {
- if (state.revoked_) die(3, JSON.stringify(latest(state)));
- }
- loadPlugin("ES5", {
- createES5Proxy_: createES5Proxy_,
- willFinalizeES5_: willFinalizeES5_,
- hasChanges_: hasChanges_
- });
- }
- function enablePatches() {
- var REPLACE = "replace";
- var ADD = "add";
- var REMOVE = "remove";
- function generatePatches_(state, basePath, patches, inversePatches) {
- switch (state.type_) {
- case 0
- /* ProxyObject */
- :
- case 4
- /* ES5Object */
- :
- case 2
- /* Map */
- :
- return generatePatchesFromAssigned(state, basePath, patches, inversePatches);
- case 5
- /* ES5Array */
- :
- case 1
- /* ProxyArray */
- :
- return generateArrayPatches(state, basePath, patches, inversePatches);
- case 3
- /* Set */
- :
- return generateSetPatches(state, basePath, patches, inversePatches);
- }
- }
- function generateArrayPatches(state, basePath, patches, inversePatches) {
- var base_ = state.base_,
- assigned_ = state.assigned_;
- var copy_ = state.copy_; // Reduce complexity by ensuring `base` is never longer.
- if (copy_.length < base_.length) {
- var _ref = [copy_, base_];
- base_ = _ref[0];
- copy_ = _ref[1];
- var _ref2 = [inversePatches, patches];
- patches = _ref2[0];
- inversePatches = _ref2[1];
- } // Process replaced indices.
- for (var i = 0; i < base_.length; i++) {
- if (assigned_[i] && copy_[i] !== base_[i]) {
- var path = basePath.concat([i]);
- patches.push({
- op: REPLACE,
- path: path,
- // Need to maybe clone it, as it can in fact be the original value
- // due to the base/copy inversion at the start of this function
- value: clonePatchValueIfNeeded(copy_[i])
- });
- inversePatches.push({
- op: REPLACE,
- path: path,
- value: clonePatchValueIfNeeded(base_[i])
- });
- }
- } // Process added indices.
- for (var _i = base_.length; _i < copy_.length; _i++) {
- var _path = basePath.concat([_i]);
- patches.push({
- op: ADD,
- path: _path,
- // Need to maybe clone it, as it can in fact be the original value
- // due to the base/copy inversion at the start of this function
- value: clonePatchValueIfNeeded(copy_[_i])
- });
- }
- if (base_.length < copy_.length) {
- inversePatches.push({
- op: REPLACE,
- path: basePath.concat(["length"]),
- value: base_.length
- });
- }
- } // This is used for both Map objects and normal objects.
- function generatePatchesFromAssigned(state, basePath, patches, inversePatches) {
- var base_ = state.base_,
- copy_ = state.copy_;
- each$1(state.assigned_, function (key, assignedValue) {
- var origValue = get(base_, key);
- var value = get(copy_, key);
- var op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD;
- if (origValue === value && op === REPLACE) return;
- var path = basePath.concat(key);
- patches.push(op === REMOVE ? {
- op: op,
- path: path
- } : {
- op: op,
- path: path,
- value: value
- });
- inversePatches.push(op === ADD ? {
- op: REMOVE,
- path: path
- } : op === REMOVE ? {
- op: ADD,
- path: path,
- value: clonePatchValueIfNeeded(origValue)
- } : {
- op: REPLACE,
- path: path,
- value: clonePatchValueIfNeeded(origValue)
- });
- });
- }
- function generateSetPatches(state, basePath, patches, inversePatches) {
- var base_ = state.base_,
- copy_ = state.copy_;
- var i = 0;
- base_.forEach(function (value) {
- if (!copy_.has(value)) {
- var path = basePath.concat([i]);
- patches.push({
- op: REMOVE,
- path: path,
- value: value
- });
- inversePatches.unshift({
- op: ADD,
- path: path,
- value: value
- });
- }
- i++;
- });
- i = 0;
- copy_.forEach(function (value) {
- if (!base_.has(value)) {
- var path = basePath.concat([i]);
- patches.push({
- op: ADD,
- path: path,
- value: value
- });
- inversePatches.unshift({
- op: REMOVE,
- path: path,
- value: value
- });
- }
- i++;
- });
- }
- function generateReplacementPatches_(rootState, replacement, patches, inversePatches) {
- patches.push({
- op: REPLACE,
- path: [],
- value: replacement === NOTHING ? undefined : replacement
- });
- inversePatches.push({
- op: REPLACE,
- path: [],
- value: rootState.base_
- });
- }
- function applyPatches_(draft, patches) {
- patches.forEach(function (patch) {
- var path = patch.path,
- op = patch.op;
- var base = draft;
- for (var i = 0; i < path.length - 1; i++) {
- var parentType = getArchtype(base);
- var p = "" + path[i]; // See #738, avoid prototype pollution
- if ((parentType === 0
- /* Object */
- || parentType === 1
- /* Array */
- ) && (p === "__proto__" || p === "constructor")) die(24);
- if (typeof base === "function" && p === "prototype") die(24);
- base = get(base, p);
- if (typeof base !== "object") die(15, path.join("/"));
- }
- var type = getArchtype(base);
- var value = deepClonePatchValue(patch.value); // used to clone patch to ensure original patch is not modified, see #411
- var key = path[path.length - 1];
- switch (op) {
- case REPLACE:
- switch (type) {
- case 2
- /* Map */
- :
- return base.set(key, value);
- /* istanbul ignore next */
- case 3
- /* Set */
- :
- die(16);
- default:
- // if value is an object, then it's assigned by reference
- // in the following add or remove ops, the value field inside the patch will also be modifyed
- // so we use value from the cloned patch
- // @ts-ignore
- return base[key] = value;
- }
- case ADD:
- switch (type) {
- case 1
- /* Array */
- :
- return key === "-" ? base.push(value) : base.splice(key, 0, value);
- case 2
- /* Map */
- :
- return base.set(key, value);
- case 3
- /* Set */
- :
- return base.add(value);
- default:
- return base[key] = value;
- }
- case REMOVE:
- switch (type) {
- case 1
- /* Array */
- :
- return base.splice(key, 1);
- case 2
- /* Map */
- :
- return base.delete(key);
- case 3
- /* Set */
- :
- return base.delete(patch.value);
- default:
- return delete base[key];
- }
- default:
- die(17, op);
- }
- });
- return draft;
- }
- function deepClonePatchValue(obj) {
- if (!isDraftable(obj)) return obj;
- if (Array.isArray(obj)) return obj.map(deepClonePatchValue);
- if (isMap(obj)) return new Map(Array.from(obj.entries()).map(function (_ref3) {
- var k = _ref3[0],
- v = _ref3[1];
- return [k, deepClonePatchValue(v)];
- }));
- if (isSet(obj)) return new Set(Array.from(obj).map(deepClonePatchValue));
- var cloned = Object.create(Object.getPrototypeOf(obj));
- for (var key in obj) {
- cloned[key] = deepClonePatchValue(obj[key]);
- }
- if (has(obj, DRAFTABLE)) cloned[DRAFTABLE] = obj[DRAFTABLE];
- return cloned;
- }
- function clonePatchValueIfNeeded(obj) {
- if (isDraft(obj)) {
- return deepClonePatchValue(obj);
- } else return obj;
- }
- loadPlugin("Patches", {
- applyPatches_: applyPatches_,
- generatePatches_: generatePatches_,
- generateReplacementPatches_: generateReplacementPatches_
- });
- }
- // types only!
- function enableMapSet() {
- /* istanbul ignore next */
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- }; // Ugly hack to resolve #502 and inherit built in Map / Set
- function __extends(d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = ( // @ts-ignore
- __.prototype = b.prototype, new __());
- }
- var DraftMap = function (_super) {
- __extends(DraftMap, _super); // Create class manually, cause #502
- function DraftMap(target, parent) {
- this[DRAFT_STATE] = {
- type_: 2
- /* Map */
- ,
- parent_: parent,
- scope_: parent ? parent.scope_ : getCurrentScope(),
- modified_: false,
- finalized_: false,
- copy_: undefined,
- assigned_: undefined,
- base_: target,
- draft_: this,
- isManual_: false,
- revoked_: false
- };
- return this;
- }
- var p = DraftMap.prototype;
- Object.defineProperty(p, "size", {
- get: function get() {
- return latest(this[DRAFT_STATE]).size;
- } // enumerable: false,
- // configurable: true
- });
- p.has = function (key) {
- return latest(this[DRAFT_STATE]).has(key);
- };
- p.set = function (key, value) {
- var state = this[DRAFT_STATE];
- assertUnrevoked(state);
- if (!latest(state).has(key) || latest(state).get(key) !== value) {
- prepareMapCopy(state);
- markChanged(state);
- state.assigned_.set(key, true);
- state.copy_.set(key, value);
- state.assigned_.set(key, true);
- }
- return this;
- };
- p.delete = function (key) {
- if (!this.has(key)) {
- return false;
- }
- var state = this[DRAFT_STATE];
- assertUnrevoked(state);
- prepareMapCopy(state);
- markChanged(state);
- state.assigned_.set(key, false);
- state.copy_.delete(key);
- return true;
- };
- p.clear = function () {
- var state = this[DRAFT_STATE];
- assertUnrevoked(state);
- if (latest(state).size) {
- prepareMapCopy(state);
- markChanged(state);
- state.assigned_ = new Map();
- each$1(state.base_, function (key) {
- state.assigned_.set(key, false);
- });
- state.copy_.clear();
- }
- };
- p.forEach = function (cb, thisArg) {
- var _this = this;
- var state = this[DRAFT_STATE];
- latest(state).forEach(function (_value, key, _map) {
- cb.call(thisArg, _this.get(key), key, _this);
- });
- };
- p.get = function (key) {
- var state = this[DRAFT_STATE];
- assertUnrevoked(state);
- var value = latest(state).get(key);
- if (state.finalized_ || !isDraftable(value)) {
- return value;
- }
- if (value !== state.base_.get(key)) {
- return value; // either already drafted or reassigned
- } // despite what it looks, this creates a draft only once, see above condition
- var draft = createProxy(state.scope_.immer_, value, state);
- prepareMapCopy(state);
- state.copy_.set(key, draft);
- return draft;
- };
- p.keys = function () {
- return latest(this[DRAFT_STATE]).keys();
- };
- p.values = function () {
- var _this2 = this,
- _ref;
- var iterator = this.keys();
- return _ref = {}, _ref[iteratorSymbol$1] = function () {
- return _this2.values();
- }, _ref.next = function next() {
- var r = iterator.next();
- /* istanbul ignore next */
- if (r.done) return r;
- var value = _this2.get(r.value);
- return {
- done: false,
- value: value
- };
- }, _ref;
- };
- p.entries = function () {
- var _this3 = this,
- _ref2;
- var iterator = this.keys();
- return _ref2 = {}, _ref2[iteratorSymbol$1] = function () {
- return _this3.entries();
- }, _ref2.next = function next() {
- var r = iterator.next();
- /* istanbul ignore next */
- if (r.done) return r;
- var value = _this3.get(r.value);
- return {
- done: false,
- value: [r.value, value]
- };
- }, _ref2;
- };
- p[iteratorSymbol$1] = function () {
- return this.entries();
- };
- return DraftMap;
- }(Map);
- function proxyMap_(target, parent) {
- // @ts-ignore
- return new DraftMap(target, parent);
- }
- function prepareMapCopy(state) {
- if (!state.copy_) {
- state.assigned_ = new Map();
- state.copy_ = new Map(state.base_);
- }
- }
- var DraftSet = function (_super) {
- __extends(DraftSet, _super); // Create class manually, cause #502
- function DraftSet(target, parent) {
- this[DRAFT_STATE] = {
- type_: 3
- /* Set */
- ,
- parent_: parent,
- scope_: parent ? parent.scope_ : getCurrentScope(),
- modified_: false,
- finalized_: false,
- copy_: undefined,
- base_: target,
- draft_: this,
- drafts_: new Map(),
- revoked_: false,
- isManual_: false
- };
- return this;
- }
- var p = DraftSet.prototype;
- Object.defineProperty(p, "size", {
- get: function get() {
- return latest(this[DRAFT_STATE]).size;
- } // enumerable: true,
- });
- p.has = function (value) {
- var state = this[DRAFT_STATE];
- assertUnrevoked(state); // bit of trickery here, to be able to recognize both the value, and the draft of its value
- if (!state.copy_) {
- return state.base_.has(value);
- }
- if (state.copy_.has(value)) return true;
- if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value))) return true;
- return false;
- };
- p.add = function (value) {
- var state = this[DRAFT_STATE];
- assertUnrevoked(state);
- if (!this.has(value)) {
- prepareSetCopy(state);
- markChanged(state);
- state.copy_.add(value);
- }
- return this;
- };
- p.delete = function (value) {
- if (!this.has(value)) {
- return false;
- }
- var state = this[DRAFT_STATE];
- assertUnrevoked(state);
- prepareSetCopy(state);
- markChanged(state);
- return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) :
- /* istanbul ignore next */
- false);
- };
- p.clear = function () {
- var state = this[DRAFT_STATE];
- assertUnrevoked(state);
- if (latest(state).size) {
- prepareSetCopy(state);
- markChanged(state);
- state.copy_.clear();
- }
- };
- p.values = function () {
- var state = this[DRAFT_STATE];
- assertUnrevoked(state);
- prepareSetCopy(state);
- return state.copy_.values();
- };
- p.entries = function entries() {
- var state = this[DRAFT_STATE];
- assertUnrevoked(state);
- prepareSetCopy(state);
- return state.copy_.entries();
- };
- p.keys = function () {
- return this.values();
- };
- p[iteratorSymbol$1] = function () {
- return this.values();
- };
- p.forEach = function forEach(cb, thisArg) {
- var iterator = this.values();
- var result = iterator.next();
- while (!result.done) {
- cb.call(thisArg, result.value, result.value, this);
- result = iterator.next();
- }
- };
- return DraftSet;
- }(Set);
- function proxySet_(target, parent) {
- // @ts-ignore
- return new DraftSet(target, parent);
- }
- function prepareSetCopy(state) {
- if (!state.copy_) {
- // create drafts for all entries to preserve insertion order
- state.copy_ = new Set();
- state.base_.forEach(function (value) {
- if (isDraftable(value)) {
- var draft = createProxy(state.scope_.immer_, value, state);
- state.drafts_.set(value, draft);
- state.copy_.add(draft);
- } else {
- state.copy_.add(value);
- }
- });
- }
- }
- function assertUnrevoked(state
- /*ES5State | MapState | SetState*/
- ) {
- if (state.revoked_) die(3, JSON.stringify(latest(state)));
- }
- loadPlugin("MapSet", {
- proxyMap_: proxyMap_,
- proxySet_: proxySet_
- });
- }
- function enableAllPlugins() {
- enableES5();
- enableMapSet();
- enablePatches();
- }
- var immer$1 =
- /*#__PURE__*/
- new Immer();
- /**
- * The `produce` function takes a value and a "recipe function" (whose
- * return value often depends on the base state). The recipe function is
- * free to mutate its first argument however it wants. All mutations are
- * only ever applied to a __copy__ of the base state.
- *
- * Pass only a function to create a "curried producer" which relieves you
- * from passing the recipe function every time.
- *
- * Only plain objects and arrays are made mutable. All other objects are
- * considered uncopyable.
- *
- * Note: This function is __bound__ to its `Immer` instance.
- *
- * @param {any} base - the initial state
- * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
- * @param {Function} patchListener - optional function that will be called with all the patches produced here
- * @returns {any} a new state, or the initial state if nothing was modified
- */
- var produce = immer$1.produce;
- /**
- * Like `produce`, but `produceWithPatches` always returns a tuple
- * [nextState, patches, inversePatches] (instead of just the next state)
- */
- var produceWithPatches =
- /*#__PURE__*/
- immer$1.produceWithPatches.bind(immer$1);
- /**
- * Pass true to automatically freeze all copies created by Immer.
- *
- * Always freeze by default, even in production mode
- */
- var setAutoFreeze =
- /*#__PURE__*/
- immer$1.setAutoFreeze.bind(immer$1);
- /**
- * Pass true to use the ES2015 `Proxy` class when creating drafts, which is
- * always faster than using ES5 proxies.
- *
- * By default, feature detection is used, so calling this is rarely necessary.
- */
- var setUseProxies =
- /*#__PURE__*/
- immer$1.setUseProxies.bind(immer$1);
- /**
- * Apply an array of Immer patches to the first argument.
- *
- * This function is a producer, which means copy-on-write is in effect.
- */
- var applyPatches =
- /*#__PURE__*/
- immer$1.applyPatches.bind(immer$1);
- /**
- * Create an Immer draft from the given base state, which may be a draft itself.
- * The draft can be modified until you finalize it with the `finishDraft` function.
- */
- var createDraft =
- /*#__PURE__*/
- immer$1.createDraft.bind(immer$1);
- /**
- * Finalize an Immer draft from a `createDraft` call, returning the base state
- * (if no changes were made) or a modified copy. The draft must *not* be
- * mutated afterwards.
- *
- * Pass a function as the 2nd argument to generate Immer patches based on the
- * changes that were made.
- */
- var finishDraft =
- /*#__PURE__*/
- immer$1.finishDraft.bind(immer$1);
- /**
- * This function is actually a no-op, but can be used to cast an immutable type
- * to an draft type and make TypeScript happy
- *
- * @param value
- */
- function castDraft(value) {
- return value;
- }
- /**
- * This function is actually a no-op, but can be used to cast a mutable type
- * to an immutable type and make TypeScript happy
- * @param value
- */
- function castImmutable(value) {
- return value;
- }
- var Immer_1 = Immer;
- var applyPatches_1 = applyPatches;
- var castDraft_1 = castDraft;
- var castImmutable_1 = castImmutable;
- var createDraft_1 = createDraft;
- var current_1 = current;
- var _default$2 = produce;
- var enableAllPlugins_1 = enableAllPlugins;
- var enableES5_1 = enableES5;
- var enableMapSet_1 = enableMapSet;
- var enablePatches_1 = enablePatches;
- var finishDraft_1 = finishDraft;
- var freeze_1 = freeze;
- var immerable = DRAFTABLE;
- var isDraft_1 = isDraft;
- var isDraftable_1 = isDraftable;
- var nothing = NOTHING;
- var original_1 = original;
- var produce_1 = produce;
- var produceWithPatches_1 = produceWithPatches;
- var setAutoFreeze_1 = setAutoFreeze;
- var setUseProxies_1 = setUseProxies;
- var immer_cjs_development = /*#__PURE__*/Object.defineProperty({
- Immer: Immer_1,
- applyPatches: applyPatches_1,
- castDraft: castDraft_1,
- castImmutable: castImmutable_1,
- createDraft: createDraft_1,
- current: current_1,
- default: _default$2,
- enableAllPlugins: enableAllPlugins_1,
- enableES5: enableES5_1,
- enableMapSet: enableMapSet_1,
- enablePatches: enablePatches_1,
- finishDraft: finishDraft_1,
- freeze: freeze_1,
- immerable: immerable,
- isDraft: isDraft_1,
- isDraftable: isDraftable_1,
- nothing: nothing,
- original: original_1,
- produce: produce_1,
- produceWithPatches: produceWithPatches_1,
- setAutoFreeze: setAutoFreeze_1,
- setUseProxies: setUseProxies_1
- }, '__esModule', {value: true});
- var require$$1$1 = immer_cjs_development;
- var dist$8 = createCommonjsModule$1(function (module) {
- {
- module.exports = require$$1$1;
- }
- });
- var isPlainObject = isPlainObject_1;
- var immer = dist$8;
- function unwrapExports (x) {
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
- }
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
- var arrayLikeToArray = createCommonjsModule(function (module) {
- 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;
- }
- module.exports = _arrayLikeToArray;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- unwrapExports(arrayLikeToArray);
- var arrayWithoutHoles = createCommonjsModule(function (module) {
- function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) return arrayLikeToArray(arr);
- }
- module.exports = _arrayWithoutHoles;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- unwrapExports(arrayWithoutHoles);
- var iterableToArray = createCommonjsModule(function (module) {
- function _iterableToArray(iter) {
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
- }
- module.exports = _iterableToArray;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- unwrapExports(iterableToArray);
- var unsupportedIterableToArray = createCommonjsModule(function (module) {
- 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);
- }
- module.exports = _unsupportedIterableToArray;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- unwrapExports(unsupportedIterableToArray);
- var nonIterableSpread = createCommonjsModule(function (module) {
- function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- module.exports = _nonIterableSpread;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- unwrapExports(nonIterableSpread);
- var toConsumableArray = createCommonjsModule(function (module) {
- function _toConsumableArray(arr) {
- return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
- }
- module.exports = _toConsumableArray;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- var _toConsumableArray = unwrapExports(toConsumableArray);
- var arrayWithHoles = createCommonjsModule(function (module) {
- function _arrayWithHoles(arr) {
- if (Array.isArray(arr)) return arr;
- }
- module.exports = _arrayWithHoles;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- unwrapExports(arrayWithHoles);
- var iterableToArrayLimit = createCommonjsModule(function (module) {
- function _iterableToArrayLimit(arr, i) {
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
- if (_i == null) return;
- var _arr = [];
- var _n = true;
- var _d = false;
- var _s, _e;
- try {
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i && _arr.length === i) break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"] != null) _i["return"]();
- } finally {
- if (_d) throw _e;
- }
- }
- return _arr;
- }
- module.exports = _iterableToArrayLimit;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- unwrapExports(iterableToArrayLimit);
- var nonIterableRest = createCommonjsModule(function (module) {
- function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- module.exports = _nonIterableRest;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- unwrapExports(nonIterableRest);
- var slicedToArray = createCommonjsModule(function (module) {
- function _slicedToArray(arr, i) {
- return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
- }
- module.exports = _slicedToArray;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- var _slicedToArray = unwrapExports(slicedToArray);
- var defineProperty = createCommonjsModule(function (module) {
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- module.exports = _defineProperty;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- var _defineProperty = unwrapExports(defineProperty);
- var DIRTY_PATHS = new WeakMap();
- var FLUSHING = new WeakMap();
- var NORMALIZING = new WeakMap();
- var PATH_REFS = new WeakMap();
- var POINT_REFS = new WeakMap();
- var RANGE_REFS = new WeakMap();
- 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; }
- 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; }
- 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; } } }; }
- 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); }
- 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; }
- /**
- * Create a new Slate `Editor` object.
- */
- var createEditor$1 = function createEditor() {
- var editor = {
- children: [],
- operations: [],
- selection: null,
- marks: null,
- isInline: function isInline() {
- return false;
- },
- isVoid: function isVoid() {
- return false;
- },
- onChange: function onChange() {},
- apply: function apply(op) {
- var _iterator = _createForOfIteratorHelper$7(Editor.pathRefs(editor)),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var ref = _step.value;
- PathRef.transform(ref, op);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- var _iterator2 = _createForOfIteratorHelper$7(Editor.pointRefs(editor)),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var _ref = _step2.value;
- PointRef.transform(_ref, op);
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- var _iterator3 = _createForOfIteratorHelper$7(Editor.rangeRefs(editor)),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var _ref2 = _step3.value;
- RangeRef.transform(_ref2, op);
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- var set = new Set();
- var dirtyPaths = [];
- var add = function add(path) {
- if (path) {
- var key = path.join(',');
- if (!set.has(key)) {
- set.add(key);
- dirtyPaths.push(path);
- }
- }
- };
- var oldDirtyPaths = DIRTY_PATHS.get(editor) || [];
- var newDirtyPaths = getDirtyPaths(op);
- var _iterator4 = _createForOfIteratorHelper$7(oldDirtyPaths),
- _step4;
- try {
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
- var path = _step4.value;
- var newPath = Path.transform(path, op);
- add(newPath);
- }
- } catch (err) {
- _iterator4.e(err);
- } finally {
- _iterator4.f();
- }
- var _iterator5 = _createForOfIteratorHelper$7(newDirtyPaths),
- _step5;
- try {
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
- var _path = _step5.value;
- add(_path);
- }
- } catch (err) {
- _iterator5.e(err);
- } finally {
- _iterator5.f();
- }
- DIRTY_PATHS.set(editor, dirtyPaths);
- Transforms.transform(editor, op);
- editor.operations.push(op);
- Editor.normalize(editor); // Clear any formats applied to the cursor if the selection changes.
- if (op.type === 'set_selection') {
- editor.marks = null;
- }
- if (!FLUSHING.get(editor)) {
- FLUSHING.set(editor, true);
- Promise.resolve().then(function () {
- FLUSHING.set(editor, false);
- editor.onChange();
- editor.operations = [];
- });
- }
- },
- addMark: function addMark(key, value) {
- var selection = editor.selection;
- if (selection) {
- if (Range.isExpanded(selection)) {
- Transforms.setNodes(editor, _defineProperty({}, key, value), {
- match: Text.isText,
- split: true
- });
- } else {
- var marks = _objectSpread$9(_objectSpread$9({}, Editor.marks(editor) || {}), {}, _defineProperty({}, key, value));
- editor.marks = marks;
- if (!FLUSHING.get(editor)) {
- editor.onChange();
- }
- }
- }
- },
- deleteBackward: function deleteBackward(unit) {
- var selection = editor.selection;
- if (selection && Range.isCollapsed(selection)) {
- Transforms["delete"](editor, {
- unit: unit,
- reverse: true
- });
- }
- },
- deleteForward: function deleteForward(unit) {
- var selection = editor.selection;
- if (selection && Range.isCollapsed(selection)) {
- Transforms["delete"](editor, {
- unit: unit
- });
- }
- },
- deleteFragment: function deleteFragment(direction) {
- var selection = editor.selection;
- if (selection && Range.isExpanded(selection)) {
- Transforms["delete"](editor, {
- reverse: direction === 'backward'
- });
- }
- },
- getFragment: function getFragment() {
- var selection = editor.selection;
- if (selection) {
- return Node$1.fragment(editor, selection);
- }
- return [];
- },
- insertBreak: function insertBreak() {
- Transforms.splitNodes(editor, {
- always: true
- });
- },
- insertFragment: function insertFragment(fragment) {
- Transforms.insertFragment(editor, fragment);
- },
- insertNode: function insertNode(node) {
- Transforms.insertNodes(editor, node);
- },
- insertText: function insertText(text) {
- var selection = editor.selection,
- marks = editor.marks;
- if (selection) {
- if (marks) {
- var node = _objectSpread$9({
- text: text
- }, marks);
- Transforms.insertNodes(editor, node);
- } else {
- Transforms.insertText(editor, text);
- }
- editor.marks = null;
- }
- },
- normalizeNode: function normalizeNode(entry) {
- var _entry = _slicedToArray(entry, 2),
- node = _entry[0],
- path = _entry[1]; // There are no core normalizations for text nodes.
- if (Text.isText(node)) {
- return;
- } // Ensure that block and inline nodes have at least one text child.
- if (Element$1.isElement(node) && node.children.length === 0) {
- var child = {
- text: ''
- };
- Transforms.insertNodes(editor, child, {
- at: path.concat(0),
- voids: true
- });
- return;
- } // Determine whether the node should have block or inline children.
- 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
- // index that accounts for any added/removed nodes.
- var n = 0;
- for (var i = 0; i < node.children.length; i++, n++) {
- var currentNode = Node$1.get(editor, path);
- if (Text.isText(currentNode)) continue;
- var _child = node.children[i];
- var prev = currentNode.children[n - 1];
- var isLast = i === node.children.length - 1;
- var isInlineOrText = Text.isText(_child) || Element$1.isElement(_child) && editor.isInline(_child); // Only allow block nodes in the top-level children and parent blocks
- // that only contain block nodes. Similarly, only allow inline nodes in
- // other inline nodes, or parent blocks that only contain inlines and
- // text.
- if (isInlineOrText !== shouldHaveInlines) {
- Transforms.removeNodes(editor, {
- at: path.concat(n),
- voids: true
- });
- n--;
- } else if (Element$1.isElement(_child)) {
- // Ensure that inline nodes are surrounded by text nodes.
- if (editor.isInline(_child)) {
- if (prev == null || !Text.isText(prev)) {
- var newChild = {
- text: ''
- };
- Transforms.insertNodes(editor, newChild, {
- at: path.concat(n),
- voids: true
- });
- n++;
- } else if (isLast) {
- var _newChild = {
- text: ''
- };
- Transforms.insertNodes(editor, _newChild, {
- at: path.concat(n + 1),
- voids: true
- });
- n++;
- }
- }
- } else {
- // Merge adjacent text nodes that are empty or match.
- if (prev != null && Text.isText(prev)) {
- if (Text.equals(_child, prev, {
- loose: true
- })) {
- Transforms.mergeNodes(editor, {
- at: path.concat(n),
- voids: true
- });
- n--;
- } else if (prev.text === '') {
- Transforms.removeNodes(editor, {
- at: path.concat(n - 1),
- voids: true
- });
- n--;
- } else if (_child.text === '') {
- Transforms.removeNodes(editor, {
- at: path.concat(n),
- voids: true
- });
- n--;
- }
- }
- }
- }
- },
- removeMark: function removeMark(key) {
- var selection = editor.selection;
- if (selection) {
- if (Range.isExpanded(selection)) {
- Transforms.unsetNodes(editor, key, {
- match: Text.isText,
- split: true
- });
- } else {
- var marks = _objectSpread$9({}, Editor.marks(editor) || {});
- delete marks[key];
- editor.marks = marks;
- if (!FLUSHING.get(editor)) {
- editor.onChange();
- }
- }
- }
- }
- };
- return editor;
- };
- /**
- * Get the "dirty" paths generated from an operation.
- */
- var getDirtyPaths = function getDirtyPaths(op) {
- switch (op.type) {
- case 'insert_text':
- case 'remove_text':
- case 'set_node':
- {
- var path = op.path;
- return Path.levels(path);
- }
- case 'insert_node':
- {
- var node = op.node,
- _path2 = op.path;
- var levels = Path.levels(_path2);
- var descendants = Text.isText(node) ? [] : Array.from(Node$1.nodes(node), function (_ref3) {
- var _ref4 = _slicedToArray(_ref3, 2),
- p = _ref4[1];
- return _path2.concat(p);
- });
- return [].concat(_toConsumableArray(levels), _toConsumableArray(descendants));
- }
- case 'merge_node':
- {
- var _path3 = op.path;
- var ancestors = Path.ancestors(_path3);
- var previousPath = Path.previous(_path3);
- return [].concat(_toConsumableArray(ancestors), [previousPath]);
- }
- case 'move_node':
- {
- var _path4 = op.path,
- newPath = op.newPath;
- if (Path.equals(_path4, newPath)) {
- return [];
- }
- var oldAncestors = [];
- var newAncestors = [];
- var _iterator6 = _createForOfIteratorHelper$7(Path.ancestors(_path4)),
- _step6;
- try {
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
- var ancestor = _step6.value;
- var p = Path.transform(ancestor, op);
- oldAncestors.push(p);
- }
- } catch (err) {
- _iterator6.e(err);
- } finally {
- _iterator6.f();
- }
- var _iterator7 = _createForOfIteratorHelper$7(Path.ancestors(newPath)),
- _step7;
- try {
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
- var _ancestor = _step7.value;
- var _p = Path.transform(_ancestor, op);
- newAncestors.push(_p);
- }
- } catch (err) {
- _iterator7.e(err);
- } finally {
- _iterator7.f();
- }
- var newParent = newAncestors[newAncestors.length - 1];
- var newIndex = newPath[newPath.length - 1];
- var resultPath = newParent.concat(newIndex);
- return [].concat(oldAncestors, newAncestors, [resultPath]);
- }
- case 'remove_node':
- {
- var _path5 = op.path;
- var _ancestors = Path.ancestors(_path5);
- return _toConsumableArray(_ancestors);
- }
- case 'split_node':
- {
- var _path6 = op.path;
- var _levels = Path.levels(_path6);
- var nextPath = Path.next(_path6);
- return [].concat(_toConsumableArray(_levels), [nextPath]);
- }
- default:
- {
- return [];
- }
- }
- };
- var objectWithoutPropertiesLoose = createCommonjsModule(function (module) {
- function _objectWithoutPropertiesLoose(source, excluded) {
- if (source == null) return {};
- var target = {};
- var sourceKeys = Object.keys(source);
- var key, i;
- for (i = 0; i < sourceKeys.length; i++) {
- key = sourceKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- target[key] = source[key];
- }
- return target;
- }
- module.exports = _objectWithoutPropertiesLoose;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- unwrapExports(objectWithoutPropertiesLoose);
- var objectWithoutProperties = createCommonjsModule(function (module) {
- function _objectWithoutProperties(source, excluded) {
- if (source == null) return {};
- var target = objectWithoutPropertiesLoose(source, excluded);
- var key, i;
- if (Object.getOwnPropertySymbols) {
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
- for (i = 0; i < sourceSymbolKeys.length; i++) {
- key = sourceSymbolKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
- target[key] = source[key];
- }
- }
- return target;
- }
- module.exports = _objectWithoutProperties;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- });
- var _objectWithoutProperties = unwrapExports(objectWithoutProperties);
- 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; } } }; }
- 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); }
- 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; }
- // Character (grapheme cluster) boundaries are determined according to
- // the default grapheme cluster boundary specification, extended grapheme clusters variant[1].
- //
- // References:
- //
- // [1] https://www.unicode.org/reports/tr29/#Default_Grapheme_Cluster_Table
- // [2] https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt
- // [3] https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.html
- // [4] https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt
- /**
- * Get the distance to the end of the first character in a string of text.
- */
- var getCharacterDistance = function getCharacterDistance(str) {
- var isRTL = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var isLTR = !isRTL;
- var codepoints = isRTL ? codepointsIteratorRTL(str) : str;
- var left = CodepointType.None;
- var right = CodepointType.None;
- var distance = 0; // Evaluation of these conditions are deferred.
- var gb11 = null; // Is GB11 applicable?
- var gb12Or13 = null; // Is GB12 or GB13 applicable?
- var _iterator = _createForOfIteratorHelper$6(codepoints),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var _char = _step.value;
- var code = _char.codePointAt(0);
- if (!code) break;
- var type = getCodepointType(_char, code);
- var _ref = isLTR ? [right, type] : [type, left];
- var _ref2 = _slicedToArray(_ref, 2);
- left = _ref2[0];
- right = _ref2[1];
- if (intersects(left, CodepointType.ZWJ) && intersects(right, CodepointType.ExtPict)) {
- if (isLTR) {
- gb11 = endsWithEmojiZWJ(str.substring(0, distance));
- } else {
- gb11 = endsWithEmojiZWJ(str.substring(0, str.length - distance));
- }
- if (!gb11) break;
- }
- if (intersects(left, CodepointType.RI) && intersects(right, CodepointType.RI)) {
- if (gb12Or13 !== null) {
- gb12Or13 = !gb12Or13;
- } else {
- if (isLTR) {
- gb12Or13 = true;
- } else {
- gb12Or13 = endsWithOddNumberOfRIs(str.substring(0, str.length - distance));
- }
- }
- if (!gb12Or13) break;
- }
- if (left !== CodepointType.None && right !== CodepointType.None && isBoundaryPair(left, right)) {
- break;
- }
- distance += _char.length;
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- return distance || 1;
- };
- var SPACE = /\s/;
- 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]/;
- var CHAMELEON = /['\u2018\u2019]/;
- /**
- * Get the distance to the end of the first word in a string of text.
- */
- var getWordDistance = function getWordDistance(text) {
- var isRTL = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var dist = 0;
- var started = false;
- while (text.length > 0) {
- var charDist = getCharacterDistance(text, isRTL);
- var _splitByCharacterDist = splitByCharacterDistance(text, charDist, isRTL),
- _splitByCharacterDist2 = _slicedToArray(_splitByCharacterDist, 2),
- _char2 = _splitByCharacterDist2[0],
- remaining = _splitByCharacterDist2[1];
- if (isWordCharacter(_char2, remaining, isRTL)) {
- started = true;
- dist += charDist;
- } else if (!started) {
- dist += charDist;
- } else {
- break;
- }
- text = remaining;
- }
- return dist;
- };
- /**
- * Split a string in two parts at a given distance starting from the end when
- * `isRTL` is set to `true`.
- */
- var splitByCharacterDistance = function splitByCharacterDistance(str, dist, isRTL) {
- if (isRTL) {
- var at = str.length - dist;
- return [str.slice(at, str.length), str.slice(0, at)];
- }
- return [str.slice(0, dist), str.slice(dist)];
- };
- /**
- * Check if a character is a word character. The `remaining` argument is used
- * because sometimes you must read subsequent characters to truly determine it.
- */
- var isWordCharacter = function isWordCharacter(_char3, remaining) {
- var isRTL = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- if (SPACE.test(_char3)) {
- return false;
- } // Chameleons count as word characters as long as they're in a word, so
- // recurse to see if the next one is a word character or not.
- if (CHAMELEON.test(_char3)) {
- var charDist = getCharacterDistance(remaining, isRTL);
- var _splitByCharacterDist3 = splitByCharacterDistance(remaining, charDist, isRTL),
- _splitByCharacterDist4 = _slicedToArray(_splitByCharacterDist3, 2),
- nextChar = _splitByCharacterDist4[0],
- nextRemaining = _splitByCharacterDist4[1];
- if (isWordCharacter(nextChar, nextRemaining, isRTL)) {
- return true;
- }
- }
- if (PUNCTUATION.test(_char3)) {
- return false;
- }
- return true;
- };
- /**
- * Iterate on codepoints from right to left.
- */
- var codepointsIteratorRTL = function* codepointsIteratorRTL(str) {
- var end = str.length - 1;
- for (var i = 0; i < str.length; i++) {
- var char1 = str.charAt(end - i);
- if (isLowSurrogate(char1.charCodeAt(0))) {
- var char2 = str.charAt(end - i - 1);
- if (isHighSurrogate(char2.charCodeAt(0))) {
- yield char2 + char1;
- i++;
- continue;
- }
- }
- yield char1;
- }
- };
- /**
- * Is `charCode` a high surrogate.
- *
- * https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates
- */
- var isHighSurrogate = function isHighSurrogate(charCode) {
- return charCode >= 0xd800 && charCode <= 0xdbff;
- };
- /**
- * Is `charCode` a low surrogate.
- *
- * https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates
- */
- var isLowSurrogate = function isLowSurrogate(charCode) {
- return charCode >= 0xdc00 && charCode <= 0xdfff;
- };
- var CodepointType;
- (function (CodepointType) {
- CodepointType[CodepointType["None"] = 0] = "None";
- CodepointType[CodepointType["Extend"] = 1] = "Extend";
- CodepointType[CodepointType["ZWJ"] = 2] = "ZWJ";
- CodepointType[CodepointType["RI"] = 4] = "RI";
- CodepointType[CodepointType["Prepend"] = 8] = "Prepend";
- CodepointType[CodepointType["SpacingMark"] = 16] = "SpacingMark";
- CodepointType[CodepointType["L"] = 32] = "L";
- CodepointType[CodepointType["V"] = 64] = "V";
- CodepointType[CodepointType["T"] = 128] = "T";
- CodepointType[CodepointType["LV"] = 256] = "LV";
- CodepointType[CodepointType["LVT"] = 512] = "LVT";
- CodepointType[CodepointType["ExtPict"] = 1024] = "ExtPict";
- CodepointType[CodepointType["Any"] = 2048] = "Any";
- })(CodepointType || (CodepointType = {}));
- 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])$/;
- var rePrepend = /^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/;
- 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])$/;
- var reL = /^[\u1100-\u115F\uA960-\uA97C]$/;
- var reV = /^[\u1160-\u11A7\uD7B0-\uD7C6]$/;
- var reT = /^[\u11A8-\u11FF\uD7CB-\uD7FB]$/;
- 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]$/;
- 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]$/;
- 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])$/;
- var getCodepointType = function getCodepointType(_char4, code) {
- var type = CodepointType.Any;
- if (_char4.search(reExtend) !== -1) {
- type |= CodepointType.Extend;
- }
- if (code === 0x200d) {
- type |= CodepointType.ZWJ;
- }
- if (code >= 0x1f1e6 && code <= 0x1f1ff) {
- type |= CodepointType.RI;
- }
- if (_char4.search(rePrepend) !== -1) {
- type |= CodepointType.Prepend;
- }
- if (_char4.search(reSpacingMark) !== -1) {
- type |= CodepointType.SpacingMark;
- }
- if (_char4.search(reL) !== -1) {
- type |= CodepointType.L;
- }
- if (_char4.search(reV) !== -1) {
- type |= CodepointType.V;
- }
- if (_char4.search(reT) !== -1) {
- type |= CodepointType.T;
- }
- if (_char4.search(reLV) !== -1) {
- type |= CodepointType.LV;
- }
- if (_char4.search(reLVT) !== -1) {
- type |= CodepointType.LVT;
- }
- if (_char4.search(reExtPict) !== -1) {
- type |= CodepointType.ExtPict;
- }
- return type;
- };
- function intersects(x, y) {
- return (x & y) !== 0;
- }
- var NonBoundaryPairs = [// GB6
- [CodepointType.L, CodepointType.L | CodepointType.V | CodepointType.LV | CodepointType.LVT], // GB7
- [CodepointType.LV | CodepointType.V, CodepointType.V | CodepointType.T], // GB8
- [CodepointType.LVT | CodepointType.T, CodepointType.T], // GB9
- [CodepointType.Any, CodepointType.Extend | CodepointType.ZWJ], // GB9a
- [CodepointType.Any, CodepointType.SpacingMark], // GB9b
- [CodepointType.Prepend, CodepointType.Any], // GB11
- [CodepointType.ZWJ, CodepointType.ExtPict], // GB12 and GB13
- [CodepointType.RI, CodepointType.RI]];
- function isBoundaryPair(left, right) {
- return NonBoundaryPairs.findIndex(function (r) {
- return intersects(left, r[0]) && intersects(right, r[1]);
- }) === -1;
- }
- 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$/;
- var endsWithEmojiZWJ = function endsWithEmojiZWJ(str) {
- return str.search(endingEmojiZWJ) !== -1;
- };
- var endingRIs = /(?:\uD83C[\uDDE6-\uDDFF])+$/g;
- var endsWithOddNumberOfRIs = function endsWithOddNumberOfRIs(str) {
- var match = str.match(endingRIs);
- if (match === null) {
- return false;
- } else {
- // A RI is represented by a surrogate pair.
- var numRIs = match[0].length / 2;
- return numRIs % 2 === 1;
- }
- };
- /**
- * Shared the function with isElementType utility
- */
- var isElement = function isElement(value) {
- return isPlainObject.isPlainObject(value) && Node$1.isNodeList(value.children) && !Editor.isEditor(value);
- };
- var Element$1 = {
- /**
- * Check if a value implements the 'Ancestor' interface.
- */
- isAncestor: function isAncestor(value) {
- return isPlainObject.isPlainObject(value) && Node$1.isNodeList(value.children);
- },
- /**
- * Check if a value implements the `Element` interface.
- */
- isElement: isElement,
- /**
- * Check if a value is an array of `Element` objects.
- */
- isElementList: function isElementList(value) {
- return Array.isArray(value) && value.every(function (val) {
- return Element$1.isElement(val);
- });
- },
- /**
- * Check if a set of props is a partial of Element.
- */
- isElementProps: function isElementProps(props) {
- return props.children !== undefined;
- },
- /**
- * Check if a value implements the `Element` interface and has elementKey with selected value.
- * Default it check to `type` key value
- */
- isElementType: function isElementType(value, elementVal) {
- var elementKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'type';
- return isElement(value) && value[elementKey] === elementVal;
- },
- /**
- * Check if an element matches set of properties.
- *
- * Note: this checks custom properties, and it does not ensure that any
- * children are equivalent.
- */
- matches: function matches(element, props) {
- for (var key in props) {
- if (key === 'children') {
- continue;
- }
- if (element[key] !== props[key]) {
- return false;
- }
- }
- return true;
- }
- };
- var _excluded$4 = ["text"],
- _excluded2$3 = ["text"];
- 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; }
- 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; }
- 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; } } }; }
- 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); }
- 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; }
- var IS_EDITOR_CACHE = new WeakMap();
- var Editor = {
- /**
- * Get the ancestor above a location in the document.
- */
- above: function above(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$voids = options.voids,
- voids = _options$voids === void 0 ? false : _options$voids,
- _options$mode = options.mode,
- mode = _options$mode === void 0 ? 'lowest' : _options$mode,
- _options$at = options.at,
- at = _options$at === void 0 ? editor.selection : _options$at,
- match = options.match;
- if (!at) {
- return;
- }
- var path = Editor.path(editor, at);
- var reverse = mode === 'lowest';
- var _iterator = _createForOfIteratorHelper$5(Editor.levels(editor, {
- at: path,
- voids: voids,
- match: match,
- reverse: reverse
- })),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var _step$value = _slicedToArray(_step.value, 2),
- n = _step$value[0],
- p = _step$value[1];
- if (!Text.isText(n) && !Path.equals(path, p)) {
- return [n, p];
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- },
- /**
- * Add a custom property to the leaf text nodes in the current selection.
- *
- * If the selection is currently collapsed, the marks will be added to the
- * `editor.marks` property instead, and applied when text is inserted next.
- */
- addMark: function addMark(editor, key, value) {
- editor.addMark(key, value);
- },
- /**
- * Get the point after a location.
- */
- after: function after(editor, at) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var anchor = Editor.point(editor, at, {
- edge: 'end'
- });
- var focus = Editor.end(editor, []);
- var range = {
- anchor: anchor,
- focus: focus
- };
- var _options$distance = options.distance,
- distance = _options$distance === void 0 ? 1 : _options$distance;
- var d = 0;
- var target;
- var _iterator2 = _createForOfIteratorHelper$5(Editor.positions(editor, _objectSpread$8(_objectSpread$8({}, options), {}, {
- at: range
- }))),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var p = _step2.value;
- if (d > distance) {
- break;
- }
- if (d !== 0) {
- target = p;
- }
- d++;
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- return target;
- },
- /**
- * Get the point before a location.
- */
- before: function before(editor, at) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var anchor = Editor.start(editor, []);
- var focus = Editor.point(editor, at, {
- edge: 'start'
- });
- var range = {
- anchor: anchor,
- focus: focus
- };
- var _options$distance2 = options.distance,
- distance = _options$distance2 === void 0 ? 1 : _options$distance2;
- var d = 0;
- var target;
- var _iterator3 = _createForOfIteratorHelper$5(Editor.positions(editor, _objectSpread$8(_objectSpread$8({}, options), {}, {
- at: range,
- reverse: true
- }))),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var p = _step3.value;
- if (d > distance) {
- break;
- }
- if (d !== 0) {
- target = p;
- }
- d++;
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- return target;
- },
- /**
- * Delete content in the editor backward from the current selection.
- */
- deleteBackward: function deleteBackward(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$unit = options.unit,
- unit = _options$unit === void 0 ? 'character' : _options$unit;
- editor.deleteBackward(unit);
- },
- /**
- * Delete content in the editor forward from the current selection.
- */
- deleteForward: function deleteForward(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$unit2 = options.unit,
- unit = _options$unit2 === void 0 ? 'character' : _options$unit2;
- editor.deleteForward(unit);
- },
- /**
- * Delete the content in the current selection.
- */
- deleteFragment: function deleteFragment(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$direction = options.direction,
- direction = _options$direction === void 0 ? 'forward' : _options$direction;
- editor.deleteFragment(direction);
- },
- /**
- * Get the start and end points of a location.
- */
- edges: function edges(editor, at) {
- return [Editor.start(editor, at), Editor.end(editor, at)];
- },
- /**
- * Get the end point of a location.
- */
- end: function end(editor, at) {
- return Editor.point(editor, at, {
- edge: 'end'
- });
- },
- /**
- * Get the first node at a location.
- */
- first: function first(editor, at) {
- var path = Editor.path(editor, at, {
- edge: 'start'
- });
- return Editor.node(editor, path);
- },
- /**
- * Get the fragment at a location.
- */
- fragment: function fragment(editor, at) {
- var range = Editor.range(editor, at);
- var fragment = Node$1.fragment(editor, range);
- return fragment;
- },
- /**
- * Check if a node has block children.
- */
- hasBlocks: function hasBlocks(editor, element) {
- return element.children.some(function (n) {
- return Editor.isBlock(editor, n);
- });
- },
- /**
- * Check if a node has inline and text children.
- */
- hasInlines: function hasInlines(editor, element) {
- return element.children.some(function (n) {
- return Text.isText(n) || Editor.isInline(editor, n);
- });
- },
- /**
- * Check if a node has text children.
- */
- hasTexts: function hasTexts(editor, element) {
- return element.children.every(function (n) {
- return Text.isText(n);
- });
- },
- /**
- * Insert a block break at the current selection.
- *
- * If the selection is currently expanded, it will be deleted first.
- */
- insertBreak: function insertBreak(editor) {
- editor.insertBreak();
- },
- /**
- * Insert a fragment at the current selection.
- *
- * If the selection is currently expanded, it will be deleted first.
- */
- insertFragment: function insertFragment(editor, fragment) {
- editor.insertFragment(fragment);
- },
- /**
- * Insert a node at the current selection.
- *
- * If the selection is currently expanded, it will be deleted first.
- */
- insertNode: function insertNode(editor, node) {
- editor.insertNode(node);
- },
- /**
- * Insert text at the current selection.
- *
- * If the selection is currently expanded, it will be deleted first.
- */
- insertText: function insertText(editor, text) {
- editor.insertText(text);
- },
- /**
- * Check if a value is a block `Element` object.
- */
- isBlock: function isBlock(editor, value) {
- return Element$1.isElement(value) && !editor.isInline(value);
- },
- /**
- * Check if a value is an `Editor` object.
- */
- isEditor: function isEditor(value) {
- if (!isPlainObject.isPlainObject(value)) return false;
- var cachedIsEditor = IS_EDITOR_CACHE.get(value);
- if (cachedIsEditor !== undefined) {
- return cachedIsEditor;
- }
- 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);
- IS_EDITOR_CACHE.set(value, isEditor);
- return isEditor;
- },
- /**
- * Check if a point is the end point of a location.
- */
- isEnd: function isEnd(editor, point, at) {
- var end = Editor.end(editor, at);
- return Point.equals(point, end);
- },
- /**
- * Check if a point is an edge of a location.
- */
- isEdge: function isEdge(editor, point, at) {
- return Editor.isStart(editor, point, at) || Editor.isEnd(editor, point, at);
- },
- /**
- * Check if an element is empty, accounting for void nodes.
- */
- isEmpty: function isEmpty(editor, element) {
- var children = element.children;
- var _children = _slicedToArray(children, 1),
- first = _children[0];
- return children.length === 0 || children.length === 1 && Text.isText(first) && first.text === '' && !editor.isVoid(element);
- },
- /**
- * Check if a value is an inline `Element` object.
- */
- isInline: function isInline(editor, value) {
- return Element$1.isElement(value) && editor.isInline(value);
- },
- /**
- * Check if the editor is currently normalizing after each operation.
- */
- isNormalizing: function isNormalizing(editor) {
- var isNormalizing = NORMALIZING.get(editor);
- return isNormalizing === undefined ? true : isNormalizing;
- },
- /**
- * Check if a point is the start point of a location.
- */
- isStart: function isStart(editor, point, at) {
- // PERF: If the offset isn't `0` we know it's not the start.
- if (point.offset !== 0) {
- return false;
- }
- var start = Editor.start(editor, at);
- return Point.equals(point, start);
- },
- /**
- * Check if a value is a void `Element` object.
- */
- isVoid: function isVoid(editor, value) {
- return Element$1.isElement(value) && editor.isVoid(value);
- },
- /**
- * Get the last node at a location.
- */
- last: function last(editor, at) {
- var path = Editor.path(editor, at, {
- edge: 'end'
- });
- return Editor.node(editor, path);
- },
- /**
- * Get the leaf text node at a location.
- */
- leaf: function leaf(editor, at) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var path = Editor.path(editor, at, options);
- var node = Node$1.leaf(editor, path);
- return [node, path];
- },
- /**
- * Iterate through all of the levels at a location.
- */
- levels: function* levels(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$at2 = options.at,
- at = _options$at2 === void 0 ? editor.selection : _options$at2,
- _options$reverse = options.reverse,
- reverse = _options$reverse === void 0 ? false : _options$reverse,
- _options$voids2 = options.voids,
- voids = _options$voids2 === void 0 ? false : _options$voids2;
- var match = options.match;
- if (match == null) {
- match = function match() {
- return true;
- };
- }
- if (!at) {
- return;
- }
- var levels = [];
- var path = Editor.path(editor, at);
- var _iterator4 = _createForOfIteratorHelper$5(Node$1.levels(editor, path)),
- _step4;
- try {
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
- var _step4$value = _slicedToArray(_step4.value, 2),
- n = _step4$value[0],
- p = _step4$value[1];
- if (!match(n, p)) {
- continue;
- }
- levels.push([n, p]);
- if (!voids && Editor.isVoid(editor, n)) {
- break;
- }
- }
- } catch (err) {
- _iterator4.e(err);
- } finally {
- _iterator4.f();
- }
- if (reverse) {
- levels.reverse();
- }
- yield* levels;
- },
- /**
- * Get the marks that would be added to text at the current selection.
- */
- marks: function marks(editor) {
- var marks = editor.marks,
- selection = editor.selection;
- if (!selection) {
- return null;
- }
- if (marks) {
- return marks;
- }
- if (Range.isExpanded(selection)) {
- var _Editor$nodes = Editor.nodes(editor, {
- match: Text.isText
- }),
- _Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
- match = _Editor$nodes2[0];
- if (match) {
- var _match = _slicedToArray(match, 1),
- _node = _match[0];
- _node.text;
- var _rest = _objectWithoutProperties(_node, _excluded$4);
- return _rest;
- } else {
- return {};
- }
- }
- var anchor = selection.anchor;
- var path = anchor.path;
- var _Editor$leaf = Editor.leaf(editor, path),
- _Editor$leaf2 = _slicedToArray(_Editor$leaf, 1),
- node = _Editor$leaf2[0];
- if (anchor.offset === 0) {
- var prev = Editor.previous(editor, {
- at: path,
- match: Text.isText
- });
- var block = Editor.above(editor, {
- match: function match(n) {
- return Editor.isBlock(editor, n);
- }
- });
- if (prev && block) {
- var _prev = _slicedToArray(prev, 2),
- prevNode = _prev[0],
- prevPath = _prev[1];
- var _block = _slicedToArray(block, 2),
- blockPath = _block[1];
- if (Path.isAncestor(blockPath, prevPath)) {
- node = prevNode;
- }
- }
- }
- var _node2 = node;
- _node2.text;
- var rest = _objectWithoutProperties(_node2, _excluded2$3);
- return rest;
- },
- /**
- * Get the matching node in the branch of the document after a location.
- */
- next: function next(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$mode2 = options.mode,
- mode = _options$mode2 === void 0 ? 'lowest' : _options$mode2,
- _options$voids3 = options.voids,
- voids = _options$voids3 === void 0 ? false : _options$voids3;
- var match = options.match,
- _options$at3 = options.at,
- at = _options$at3 === void 0 ? editor.selection : _options$at3;
- if (!at) {
- return;
- }
- var pointAfterLocation = Editor.after(editor, at, {
- voids: voids
- });
- if (!pointAfterLocation) return;
- var _Editor$last = Editor.last(editor, []),
- _Editor$last2 = _slicedToArray(_Editor$last, 2),
- to = _Editor$last2[1];
- var span = [pointAfterLocation.path, to];
- if (Path.isPath(at) && at.length === 0) {
- throw new Error("Cannot get the next node from the root node!");
- }
- if (match == null) {
- if (Path.isPath(at)) {
- var _Editor$parent = Editor.parent(editor, at),
- _Editor$parent2 = _slicedToArray(_Editor$parent, 1),
- parent = _Editor$parent2[0];
- match = function match(n) {
- return parent.children.includes(n);
- };
- } else {
- match = function match() {
- return true;
- };
- }
- }
- var _Editor$nodes3 = Editor.nodes(editor, {
- at: span,
- match: match,
- mode: mode,
- voids: voids
- }),
- _Editor$nodes4 = _slicedToArray(_Editor$nodes3, 1),
- next = _Editor$nodes4[0];
- return next;
- },
- /**
- * Get the node at a location.
- */
- node: function node(editor, at) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var path = Editor.path(editor, at, options);
- var node = Node$1.get(editor, path);
- return [node, path];
- },
- /**
- * Iterate through all of the nodes in the Editor.
- */
- nodes: function* nodes(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$at4 = options.at,
- at = _options$at4 === void 0 ? editor.selection : _options$at4,
- _options$mode3 = options.mode,
- mode = _options$mode3 === void 0 ? 'all' : _options$mode3,
- _options$universal = options.universal,
- universal = _options$universal === void 0 ? false : _options$universal,
- _options$reverse2 = options.reverse,
- reverse = _options$reverse2 === void 0 ? false : _options$reverse2,
- _options$voids4 = options.voids,
- voids = _options$voids4 === void 0 ? false : _options$voids4;
- var match = options.match;
- if (!match) {
- match = function match() {
- return true;
- };
- }
- if (!at) {
- return;
- }
- var from;
- var to;
- if (Span.isSpan(at)) {
- from = at[0];
- to = at[1];
- } else {
- var first = Editor.path(editor, at, {
- edge: 'start'
- });
- var last = Editor.path(editor, at, {
- edge: 'end'
- });
- from = reverse ? last : first;
- to = reverse ? first : last;
- }
- var nodeEntries = Node$1.nodes(editor, {
- reverse: reverse,
- from: from,
- to: to,
- pass: function pass(_ref) {
- var _ref2 = _slicedToArray(_ref, 1),
- n = _ref2[0];
- return voids ? false : Editor.isVoid(editor, n);
- }
- });
- var matches = [];
- var hit;
- var _iterator5 = _createForOfIteratorHelper$5(nodeEntries),
- _step5;
- try {
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
- var _step5$value = _slicedToArray(_step5.value, 2),
- node = _step5$value[0],
- path = _step5$value[1];
- var isLower = hit && Path.compare(path, hit[1]) === 0; // In highest mode any node lower than the last hit is not a match.
- if (mode === 'highest' && isLower) {
- continue;
- }
- if (!match(node, path)) {
- // If we've arrived at a leaf text node that is not lower than the last
- // hit, then we've found a branch that doesn't include a match, which
- // means the match is not universal.
- if (universal && !isLower && Text.isText(node)) {
- return;
- } else {
- continue;
- }
- } // If there's a match and it's lower than the last, update the hit.
- if (mode === 'lowest' && isLower) {
- hit = [node, path];
- continue;
- } // In lowest mode we emit the last hit, once it's guaranteed lowest.
- var emit = mode === 'lowest' ? hit : [node, path];
- if (emit) {
- if (universal) {
- matches.push(emit);
- } else {
- yield emit;
- }
- }
- hit = [node, path];
- } // Since lowest is always emitting one behind, catch up at the end.
- } catch (err) {
- _iterator5.e(err);
- } finally {
- _iterator5.f();
- }
- if (mode === 'lowest' && hit) {
- if (universal) {
- matches.push(hit);
- } else {
- yield hit;
- }
- } // Universal defers to ensure that the match occurs in every branch, so we
- // yield all of the matches after iterating.
- if (universal) {
- yield* matches;
- }
- },
- /**
- * Normalize any dirty objects in the editor.
- */
- normalize: function normalize(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$force = options.force,
- force = _options$force === void 0 ? false : _options$force;
- var getDirtyPaths = function getDirtyPaths(editor) {
- return DIRTY_PATHS.get(editor) || [];
- };
- if (!Editor.isNormalizing(editor)) {
- return;
- }
- if (force) {
- var allPaths = Array.from(Node$1.nodes(editor), function (_ref3) {
- var _ref4 = _slicedToArray(_ref3, 2),
- p = _ref4[1];
- return p;
- });
- DIRTY_PATHS.set(editor, allPaths);
- }
- if (getDirtyPaths(editor).length === 0) {
- return;
- }
- Editor.withoutNormalizing(editor, function () {
- /*
- Fix dirty elements with no children.
- editor.normalizeNode() does fix this, but some normalization fixes also require it to work.
- Running an initial pass avoids the catch-22 race condition.
- */
- var _iterator6 = _createForOfIteratorHelper$5(getDirtyPaths(editor)),
- _step6;
- try {
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
- var _dirtyPath = _step6.value;
- if (Node$1.has(editor, _dirtyPath)) {
- var _entry = Editor.node(editor, _dirtyPath);
- var _entry2 = _slicedToArray(_entry, 2),
- node = _entry2[0],
- _ = _entry2[1];
- /*
- The default normalizer inserts an empty text node in this scenario, but it can be customised.
- So there is some risk here.
- As long as the normalizer only inserts child nodes for this case it is safe to do in any order;
- by definition adding children to an empty node can't cause other paths to change.
- */
- if (Element$1.isElement(node) && node.children.length === 0) {
- editor.normalizeNode(_entry);
- }
- }
- }
- } catch (err) {
- _iterator6.e(err);
- } finally {
- _iterator6.f();
- }
- var max = getDirtyPaths(editor).length * 42; // HACK: better way?
- var m = 0;
- while (getDirtyPaths(editor).length !== 0) {
- if (m > max) {
- 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 "));
- }
- var dirtyPath = getDirtyPaths(editor).pop(); // If the node doesn't exist in the tree, it does not need to be normalized.
- if (Node$1.has(editor, dirtyPath)) {
- var entry = Editor.node(editor, dirtyPath);
- editor.normalizeNode(entry);
- }
- m++;
- }
- });
- },
- /**
- * Get the parent node of a location.
- */
- parent: function parent(editor, at) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var path = Editor.path(editor, at, options);
- var parentPath = Path.parent(path);
- var entry = Editor.node(editor, parentPath);
- return entry;
- },
- /**
- * Get the path of a location.
- */
- path: function path(editor, at) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var depth = options.depth,
- edge = options.edge;
- if (Path.isPath(at)) {
- if (edge === 'start') {
- var _Node$first = Node$1.first(editor, at),
- _Node$first2 = _slicedToArray(_Node$first, 2),
- firstPath = _Node$first2[1];
- at = firstPath;
- } else if (edge === 'end') {
- var _Node$last = Node$1.last(editor, at),
- _Node$last2 = _slicedToArray(_Node$last, 2),
- lastPath = _Node$last2[1];
- at = lastPath;
- }
- }
- if (Range.isRange(at)) {
- if (edge === 'start') {
- at = Range.start(at);
- } else if (edge === 'end') {
- at = Range.end(at);
- } else {
- at = Path.common(at.anchor.path, at.focus.path);
- }
- }
- if (Point.isPoint(at)) {
- at = at.path;
- }
- if (depth != null) {
- at = at.slice(0, depth);
- }
- return at;
- },
- hasPath: function hasPath(editor, path) {
- return Node$1.has(editor, path);
- },
- /**
- * Create a mutable ref for a `Path` object, which will stay in sync as new
- * operations are applied to the editor.
- */
- pathRef: function pathRef(editor, path) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var _options$affinity = options.affinity,
- affinity = _options$affinity === void 0 ? 'forward' : _options$affinity;
- var ref = {
- current: path,
- affinity: affinity,
- unref: function unref() {
- var current = ref.current;
- var pathRefs = Editor.pathRefs(editor);
- pathRefs["delete"](ref);
- ref.current = null;
- return current;
- }
- };
- var refs = Editor.pathRefs(editor);
- refs.add(ref);
- return ref;
- },
- /**
- * Get the set of currently tracked path refs of the editor.
- */
- pathRefs: function pathRefs(editor) {
- var refs = PATH_REFS.get(editor);
- if (!refs) {
- refs = new Set();
- PATH_REFS.set(editor, refs);
- }
- return refs;
- },
- /**
- * Get the start or end point of a location.
- */
- point: function point(editor, at) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var _options$edge = options.edge,
- edge = _options$edge === void 0 ? 'start' : _options$edge;
- if (Path.isPath(at)) {
- var path;
- if (edge === 'end') {
- var _Node$last3 = Node$1.last(editor, at),
- _Node$last4 = _slicedToArray(_Node$last3, 2),
- lastPath = _Node$last4[1];
- path = lastPath;
- } else {
- var _Node$first3 = Node$1.first(editor, at),
- _Node$first4 = _slicedToArray(_Node$first3, 2),
- firstPath = _Node$first4[1];
- path = firstPath;
- }
- var node = Node$1.get(editor, path);
- if (!Text.isText(node)) {
- throw new Error("Cannot get the ".concat(edge, " point in the node at path [").concat(at, "] because it has no ").concat(edge, " text node."));
- }
- return {
- path: path,
- offset: edge === 'end' ? node.text.length : 0
- };
- }
- if (Range.isRange(at)) {
- var _Range$edges = Range.edges(at),
- _Range$edges2 = _slicedToArray(_Range$edges, 2),
- start = _Range$edges2[0],
- end = _Range$edges2[1];
- return edge === 'start' ? start : end;
- }
- return at;
- },
- /**
- * Create a mutable ref for a `Point` object, which will stay in sync as new
- * operations are applied to the editor.
- */
- pointRef: function pointRef(editor, point) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var _options$affinity2 = options.affinity,
- affinity = _options$affinity2 === void 0 ? 'forward' : _options$affinity2;
- var ref = {
- current: point,
- affinity: affinity,
- unref: function unref() {
- var current = ref.current;
- var pointRefs = Editor.pointRefs(editor);
- pointRefs["delete"](ref);
- ref.current = null;
- return current;
- }
- };
- var refs = Editor.pointRefs(editor);
- refs.add(ref);
- return ref;
- },
- /**
- * Get the set of currently tracked point refs of the editor.
- */
- pointRefs: function pointRefs(editor) {
- var refs = POINT_REFS.get(editor);
- if (!refs) {
- refs = new Set();
- POINT_REFS.set(editor, refs);
- }
- return refs;
- },
- /**
- * Return all the positions in `at` range where a `Point` can be placed.
- *
- * By default, moves forward by individual offsets at a time, but
- * the `unit` option can be used to to move by character, word, line, or block.
- *
- * The `reverse` option can be used to change iteration direction.
- *
- * Note: By default void nodes are treated as a single point and iteration
- * will not happen inside their content unless you pass in true for the
- * `voids` option, then iteration will occur.
- */
- positions: function* positions(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$at5 = options.at,
- at = _options$at5 === void 0 ? editor.selection : _options$at5,
- _options$unit3 = options.unit,
- unit = _options$unit3 === void 0 ? 'offset' : _options$unit3,
- _options$reverse3 = options.reverse,
- reverse = _options$reverse3 === void 0 ? false : _options$reverse3,
- _options$voids5 = options.voids,
- voids = _options$voids5 === void 0 ? false : _options$voids5;
- if (!at) {
- return;
- }
- /**
- * Algorithm notes:
- *
- * Each step `distance` is dynamic depending on the underlying text
- * and the `unit` specified. Each step, e.g., a line or word, may
- * span multiple text nodes, so we iterate through the text both on
- * two levels in step-sync:
- *
- * `leafText` stores the text on a text leaf level, and is advanced
- * through using the counters `leafTextOffset` and `leafTextRemaining`.
- *
- * `blockText` stores the text on a block level, and is shortened
- * by `distance` every time it is advanced.
- *
- * We only maintain a window of one blockText and one leafText because
- * a block node always appears before all of its leaf nodes.
- */
- var range = Editor.range(editor, at);
- var _Range$edges3 = Range.edges(range),
- _Range$edges4 = _slicedToArray(_Range$edges3, 2),
- start = _Range$edges4[0],
- end = _Range$edges4[1];
- var first = reverse ? end : start;
- var isNewBlock = false;
- var blockText = '';
- var distance = 0; // Distance for leafText to catch up to blockText.
- var leafTextRemaining = 0;
- var leafTextOffset = 0; // Iterate through all nodes in range, grabbing entire textual content
- // of block nodes in blockText, and text nodes in leafText.
- // Exploits the fact that nodes are sequenced in such a way that we first
- // encounter the block node, then all of its text nodes, so when iterating
- // through the blockText and leafText we just need to remember a window of
- // one block node and leaf node, respectively.
- var _iterator7 = _createForOfIteratorHelper$5(Editor.nodes(editor, {
- at: at,
- reverse: reverse,
- voids: voids
- })),
- _step7;
- try {
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
- var _step7$value = _slicedToArray(_step7.value, 2),
- node = _step7$value[0],
- path = _step7$value[1];
- /*
- * ELEMENT NODE - Yield position(s) for voids, collect blockText for blocks
- */
- if (Element$1.isElement(node)) {
- // Void nodes are a special case, so by default we will always
- // yield their first point. If the `voids` option is set to true,
- // then we will iterate over their content.
- if (!voids && editor.isVoid(node)) {
- yield Editor.start(editor, path);
- continue;
- } // Inline element nodes are ignored as they don't themselves
- // contribute to `blockText` or `leafText` - their parent and
- // children do.
- if (editor.isInline(node)) continue; // Block element node - set `blockText` to its text content.
- if (Editor.hasInlines(editor, node)) {
- // We always exhaust block nodes before encountering a new one:
- // console.assert(blockText === '',
- // `blockText='${blockText}' - `+
- // `not exhausted before new block node`, path)
- // Ensure range considered is capped to `range`, in the
- // start/end edge cases where block extends beyond range.
- // Equivalent to this, but presumably more performant:
- // blockRange = Editor.range(editor, ...Editor.edges(editor, path))
- // blockRange = Range.intersection(range, blockRange) // intersect
- // blockText = Editor.string(editor, blockRange, { voids })
- var e = Path.isAncestor(path, end.path) ? end : Editor.end(editor, path);
- var s = Path.isAncestor(path, start.path) ? start : Editor.start(editor, path);
- blockText = Editor.string(editor, {
- anchor: s,
- focus: e
- }, {
- voids: voids
- });
- isNewBlock = true;
- }
- }
- /*
- * TEXT LEAF NODE - Iterate through text content, yielding
- * positions every `distance` offset according to `unit`.
- */
- if (Text.isText(node)) {
- var isFirst = Path.equals(path, first.path); // Proof that we always exhaust text nodes before encountering a new one:
- // console.assert(leafTextRemaining <= 0,
- // `leafTextRemaining=${leafTextRemaining} - `+
- // `not exhausted before new leaf text node`, path)
- // Reset `leafText` counters for new text node.
- if (isFirst) {
- leafTextRemaining = reverse ? first.offset : node.text.length - first.offset;
- leafTextOffset = first.offset; // Works for reverse too.
- } else {
- leafTextRemaining = node.text.length;
- leafTextOffset = reverse ? leafTextRemaining : 0;
- } // Yield position at the start of node (potentially).
- if (isFirst || isNewBlock || unit === 'offset') {
- yield {
- path: path,
- offset: leafTextOffset
- };
- isNewBlock = false;
- } // Yield positions every (dynamically calculated) `distance` offset.
- while (true) {
- // If `leafText` has caught up with `blockText` (distance=0),
- // and if blockText is exhausted, break to get another block node,
- // otherwise advance blockText forward by the new `distance`.
- if (distance === 0) {
- if (blockText === '') break;
- distance = calcDistance(blockText, unit, reverse); // Split the string at the previously found distance and use the
- // remaining string for the next iteration.
- blockText = splitByCharacterDistance(blockText, distance, reverse)[1];
- } // Advance `leafText` by the current `distance`.
- leafTextOffset = reverse ? leafTextOffset - distance : leafTextOffset + distance;
- leafTextRemaining = leafTextRemaining - distance; // If `leafText` is exhausted, break to get a new leaf node
- // and set distance to the overflow amount, so we'll (maybe)
- // catch up to blockText in the next leaf text node.
- if (leafTextRemaining < 0) {
- distance = -leafTextRemaining;
- break;
- } // Successfully walked `distance` offsets through `leafText`
- // to catch up with `blockText`, so we can reset `distance`
- // and yield this position in this node.
- distance = 0;
- yield {
- path: path,
- offset: leafTextOffset
- };
- }
- }
- } // Proof that upon completion, we've exahusted both leaf and block text:
- // console.assert(leafTextRemaining <= 0, "leafText wasn't exhausted")
- // console.assert(blockText === '', "blockText wasn't exhausted")
- // Helper:
- // Return the distance in offsets for a step of size `unit` on given string.
- } catch (err) {
- _iterator7.e(err);
- } finally {
- _iterator7.f();
- }
- function calcDistance(text, unit, reverse) {
- if (unit === 'character') {
- return getCharacterDistance(text, reverse);
- } else if (unit === 'word') {
- return getWordDistance(text, reverse);
- } else if (unit === 'line' || unit === 'block') {
- return text.length;
- }
- return 1;
- }
- },
- /**
- * Get the matching node in the branch of the document before a location.
- */
- previous: function previous(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$mode4 = options.mode,
- mode = _options$mode4 === void 0 ? 'lowest' : _options$mode4,
- _options$voids6 = options.voids,
- voids = _options$voids6 === void 0 ? false : _options$voids6;
- var match = options.match,
- _options$at6 = options.at,
- at = _options$at6 === void 0 ? editor.selection : _options$at6;
- if (!at) {
- return;
- }
- var pointBeforeLocation = Editor.before(editor, at, {
- voids: voids
- });
- if (!pointBeforeLocation) {
- return;
- }
- var _Editor$first = Editor.first(editor, []),
- _Editor$first2 = _slicedToArray(_Editor$first, 2),
- to = _Editor$first2[1]; // The search location is from the start of the document to the path of
- // the point before the location passed in
- var span = [pointBeforeLocation.path, to];
- if (Path.isPath(at) && at.length === 0) {
- throw new Error("Cannot get the previous node from the root node!");
- }
- if (match == null) {
- if (Path.isPath(at)) {
- var _Editor$parent3 = Editor.parent(editor, at),
- _Editor$parent4 = _slicedToArray(_Editor$parent3, 1),
- parent = _Editor$parent4[0];
- match = function match(n) {
- return parent.children.includes(n);
- };
- } else {
- match = function match() {
- return true;
- };
- }
- }
- var _Editor$nodes5 = Editor.nodes(editor, {
- reverse: true,
- at: span,
- match: match,
- mode: mode,
- voids: voids
- }),
- _Editor$nodes6 = _slicedToArray(_Editor$nodes5, 1),
- previous = _Editor$nodes6[0];
- return previous;
- },
- /**
- * Get a range of a location.
- */
- range: function range(editor, at, to) {
- if (Range.isRange(at) && !to) {
- return at;
- }
- var start = Editor.start(editor, at);
- var end = Editor.end(editor, to || at);
- return {
- anchor: start,
- focus: end
- };
- },
- /**
- * Create a mutable ref for a `Range` object, which will stay in sync as new
- * operations are applied to the editor.
- */
- rangeRef: function rangeRef(editor, range) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var _options$affinity3 = options.affinity,
- affinity = _options$affinity3 === void 0 ? 'forward' : _options$affinity3;
- var ref = {
- current: range,
- affinity: affinity,
- unref: function unref() {
- var current = ref.current;
- var rangeRefs = Editor.rangeRefs(editor);
- rangeRefs["delete"](ref);
- ref.current = null;
- return current;
- }
- };
- var refs = Editor.rangeRefs(editor);
- refs.add(ref);
- return ref;
- },
- /**
- * Get the set of currently tracked range refs of the editor.
- */
- rangeRefs: function rangeRefs(editor) {
- var refs = RANGE_REFS.get(editor);
- if (!refs) {
- refs = new Set();
- RANGE_REFS.set(editor, refs);
- }
- return refs;
- },
- /**
- * Remove a custom property from all of the leaf text nodes in the current
- * selection.
- *
- * If the selection is currently collapsed, the removal will be stored on
- * `editor.marks` and applied to the text inserted next.
- */
- removeMark: function removeMark(editor, key) {
- editor.removeMark(key);
- },
- /**
- * Manually set if the editor should currently be normalizing.
- *
- * Note: Using this incorrectly can leave the editor in an invalid state.
- *
- */
- setNormalizing: function setNormalizing(editor, isNormalizing) {
- NORMALIZING.set(editor, isNormalizing);
- },
- /**
- * Get the start point of a location.
- */
- start: function start(editor, at) {
- return Editor.point(editor, at, {
- edge: 'start'
- });
- },
- /**
- * Get the text string content of a location.
- *
- * Note: by default the text of void nodes is considered to be an empty
- * string, regardless of content, unless you pass in true for the voids option
- */
- string: function string(editor, at) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var _options$voids7 = options.voids,
- voids = _options$voids7 === void 0 ? false : _options$voids7;
- var range = Editor.range(editor, at);
- var _Range$edges5 = Range.edges(range),
- _Range$edges6 = _slicedToArray(_Range$edges5, 2),
- start = _Range$edges6[0],
- end = _Range$edges6[1];
- var text = '';
- var _iterator8 = _createForOfIteratorHelper$5(Editor.nodes(editor, {
- at: range,
- match: Text.isText,
- voids: voids
- })),
- _step8;
- try {
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
- var _step8$value = _slicedToArray(_step8.value, 2),
- node = _step8$value[0],
- path = _step8$value[1];
- var t = node.text;
- if (Path.equals(path, end.path)) {
- t = t.slice(0, end.offset);
- }
- if (Path.equals(path, start.path)) {
- t = t.slice(start.offset);
- }
- text += t;
- }
- } catch (err) {
- _iterator8.e(err);
- } finally {
- _iterator8.f();
- }
- return text;
- },
- /**
- * Convert a range into a non-hanging one.
- */
- unhangRange: function unhangRange(editor, range) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var _options$voids8 = options.voids,
- voids = _options$voids8 === void 0 ? false : _options$voids8;
- var _Range$edges7 = Range.edges(range),
- _Range$edges8 = _slicedToArray(_Range$edges7, 2),
- start = _Range$edges8[0],
- end = _Range$edges8[1]; // PERF: exit early if we can guarantee that the range isn't hanging.
- if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range)) {
- return range;
- }
- var endBlock = Editor.above(editor, {
- at: end,
- match: function match(n) {
- return Editor.isBlock(editor, n);
- }
- });
- var blockPath = endBlock ? endBlock[1] : [];
- var first = Editor.start(editor, []);
- var before = {
- anchor: first,
- focus: end
- };
- var skip = true;
- var _iterator9 = _createForOfIteratorHelper$5(Editor.nodes(editor, {
- at: before,
- match: Text.isText,
- reverse: true,
- voids: voids
- })),
- _step9;
- try {
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
- var _step9$value = _slicedToArray(_step9.value, 2),
- node = _step9$value[0],
- path = _step9$value[1];
- if (skip) {
- skip = false;
- continue;
- }
- if (node.text !== '' || Path.isBefore(path, blockPath)) {
- end = {
- path: path,
- offset: node.text.length
- };
- break;
- }
- }
- } catch (err) {
- _iterator9.e(err);
- } finally {
- _iterator9.f();
- }
- return {
- anchor: start,
- focus: end
- };
- },
- /**
- * Match a void node in the current branch of the editor.
- */
- "void": function _void(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- return Editor.above(editor, _objectSpread$8(_objectSpread$8({}, options), {}, {
- match: function match(n) {
- return Editor.isVoid(editor, n);
- }
- }));
- },
- /**
- * Call a function, deferring normalization until after it completes.
- */
- withoutNormalizing: function withoutNormalizing(editor, fn) {
- var value = Editor.isNormalizing(editor);
- Editor.setNormalizing(editor, false);
- try {
- fn();
- } finally {
- Editor.setNormalizing(editor, value);
- }
- Editor.normalize(editor);
- }
- };
- var Location = {
- /**
- * Check if a value implements the `Location` interface.
- */
- isLocation: function isLocation(value) {
- return Path.isPath(value) || Point.isPoint(value) || Range.isRange(value);
- }
- };
- var Span = {
- /**
- * Check if a value implements the `Span` interface.
- */
- isSpan: function isSpan(value) {
- return Array.isArray(value) && value.length === 2 && value.every(Path.isPath);
- }
- };
- var _excluded$3 = ["children"],
- _excluded2$2 = ["text"];
- 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; } } }; }
- 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); }
- 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; }
- var IS_NODE_LIST_CACHE = new WeakMap();
- var Node$1 = {
- /**
- * Get the node at a specific path, asserting that it's an ancestor node.
- */
- ancestor: function ancestor(root, path) {
- var node = Node$1.get(root, path);
- if (Text.isText(node)) {
- throw new Error("Cannot get the ancestor node at path [".concat(path, "] because it refers to a text node instead: ").concat(node));
- }
- return node;
- },
- /**
- * Return a generator of all the ancestor nodes above a specific path.
- *
- * By default the order is bottom-up, from lowest to highest ancestor in
- * the tree, but you can pass the `reverse: true` option to go top-down.
- */
- ancestors: function* ancestors(root, path) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var _iterator = _createForOfIteratorHelper$4(Path.ancestors(path, options)),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var p = _step.value;
- var n = Node$1.ancestor(root, p);
- var entry = [n, p];
- yield entry;
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- },
- /**
- * Get the child of a node at a specific index.
- */
- child: function child(root, index) {
- if (Text.isText(root)) {
- throw new Error("Cannot get the child of a text node: ".concat(JSON.stringify(root)));
- }
- var c = root.children[index];
- if (c == null) {
- throw new Error("Cannot get child at index `".concat(index, "` in node: ").concat(JSON.stringify(root)));
- }
- return c;
- },
- /**
- * Iterate over the children of a node at a specific path.
- */
- children: function* children(root, path) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var _options$reverse = options.reverse,
- reverse = _options$reverse === void 0 ? false : _options$reverse;
- var ancestor = Node$1.ancestor(root, path);
- var children = ancestor.children;
- var index = reverse ? children.length - 1 : 0;
- while (reverse ? index >= 0 : index < children.length) {
- var child = Node$1.child(ancestor, index);
- var childPath = path.concat(index);
- yield [child, childPath];
- index = reverse ? index - 1 : index + 1;
- }
- },
- /**
- * Get an entry for the common ancesetor node of two paths.
- */
- common: function common(root, path, another) {
- var p = Path.common(path, another);
- var n = Node$1.get(root, p);
- return [n, p];
- },
- /**
- * Get the node at a specific path, asserting that it's a descendant node.
- */
- descendant: function descendant(root, path) {
- var node = Node$1.get(root, path);
- if (Editor.isEditor(node)) {
- throw new Error("Cannot get the descendant node at path [".concat(path, "] because it refers to the root editor node instead: ").concat(node));
- }
- return node;
- },
- /**
- * Return a generator of all the descendant node entries inside a root node.
- */
- descendants: function* descendants(root) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _iterator2 = _createForOfIteratorHelper$4(Node$1.nodes(root, options)),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var _step2$value = _slicedToArray(_step2.value, 2),
- node = _step2$value[0],
- path = _step2$value[1];
- if (path.length !== 0) {
- // NOTE: we have to coerce here because checking the path's length does
- // guarantee that `node` is not a `Editor`, but TypeScript doesn't know.
- yield [node, path];
- }
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- },
- /**
- * Return a generator of all the element nodes inside a root node. Each iteration
- * will return an `ElementEntry` tuple consisting of `[Element, Path]`. If the
- * root node is an element it will be included in the iteration as well.
- */
- elements: function* elements(root) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _iterator3 = _createForOfIteratorHelper$4(Node$1.nodes(root, options)),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var _step3$value = _slicedToArray(_step3.value, 2),
- node = _step3$value[0],
- path = _step3$value[1];
- if (Element$1.isElement(node)) {
- yield [node, path];
- }
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- },
- /**
- * Extract props from a Node.
- */
- extractProps: function extractProps(node) {
- if (Element$1.isAncestor(node)) {
- node.children;
- var properties = _objectWithoutProperties(node, _excluded$3);
- return properties;
- } else {
- node.text;
- var _properties = _objectWithoutProperties(node, _excluded2$2);
- return _properties;
- }
- },
- /**
- * Get the first node entry in a root node from a path.
- */
- first: function first(root, path) {
- var p = path.slice();
- var n = Node$1.get(root, p);
- while (n) {
- if (Text.isText(n) || n.children.length === 0) {
- break;
- } else {
- n = n.children[0];
- p.push(0);
- }
- }
- return [n, p];
- },
- /**
- * Get the sliced fragment represented by a range inside a root node.
- */
- fragment: function fragment(root, range) {
- if (Text.isText(root)) {
- throw new Error("Cannot get a fragment starting from a root text node: ".concat(JSON.stringify(root)));
- }
- var newRoot = immer.produce({
- children: root.children
- }, function (r) {
- var _Range$edges = Range.edges(range),
- _Range$edges2 = _slicedToArray(_Range$edges, 2),
- start = _Range$edges2[0],
- end = _Range$edges2[1];
- var nodeEntries = Node$1.nodes(r, {
- reverse: true,
- pass: function pass(_ref) {
- var _ref2 = _slicedToArray(_ref, 2),
- path = _ref2[1];
- return !Range.includes(range, path);
- }
- });
- var _iterator4 = _createForOfIteratorHelper$4(nodeEntries),
- _step4;
- try {
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
- var _step4$value = _slicedToArray(_step4.value, 2),
- path = _step4$value[1];
- if (!Range.includes(range, path)) {
- var parent = Node$1.parent(r, path);
- var index = path[path.length - 1];
- parent.children.splice(index, 1);
- }
- if (Path.equals(path, end.path)) {
- var leaf = Node$1.leaf(r, path);
- leaf.text = leaf.text.slice(0, end.offset);
- }
- if (Path.equals(path, start.path)) {
- var _leaf = Node$1.leaf(r, path);
- _leaf.text = _leaf.text.slice(start.offset);
- }
- }
- } catch (err) {
- _iterator4.e(err);
- } finally {
- _iterator4.f();
- }
- if (Editor.isEditor(r)) {
- r.selection = null;
- }
- });
- return newRoot.children;
- },
- /**
- * Get the descendant node referred to by a specific path. If the path is an
- * empty array, it refers to the root node itself.
- */
- get: function get(root, path) {
- var node = root;
- for (var i = 0; i < path.length; i++) {
- var p = path[i];
- if (Text.isText(node) || !node.children[p]) {
- throw new Error("Cannot find a descendant at path [".concat(path, "] in node: ").concat(JSON.stringify(root)));
- }
- node = node.children[p];
- }
- return node;
- },
- /**
- * Check if a descendant node exists at a specific path.
- */
- has: function has(root, path) {
- var node = root;
- for (var i = 0; i < path.length; i++) {
- var p = path[i];
- if (Text.isText(node) || !node.children[p]) {
- return false;
- }
- node = node.children[p];
- }
- return true;
- },
- /**
- * Check if a value implements the `Node` interface.
- */
- isNode: function isNode(value) {
- return Text.isText(value) || Element$1.isElement(value) || Editor.isEditor(value);
- },
- /**
- * Check if a value is a list of `Node` objects.
- */
- isNodeList: function isNodeList(value) {
- if (!Array.isArray(value)) {
- return false;
- }
- var cachedResult = IS_NODE_LIST_CACHE.get(value);
- if (cachedResult !== undefined) {
- return cachedResult;
- }
- var isNodeList = value.every(function (val) {
- return Node$1.isNode(val);
- });
- IS_NODE_LIST_CACHE.set(value, isNodeList);
- return isNodeList;
- },
- /**
- * Get the last node entry in a root node from a path.
- */
- last: function last(root, path) {
- var p = path.slice();
- var n = Node$1.get(root, p);
- while (n) {
- if (Text.isText(n) || n.children.length === 0) {
- break;
- } else {
- var i = n.children.length - 1;
- n = n.children[i];
- p.push(i);
- }
- }
- return [n, p];
- },
- /**
- * Get the node at a specific path, ensuring it's a leaf text node.
- */
- leaf: function leaf(root, path) {
- var node = Node$1.get(root, path);
- if (!Text.isText(node)) {
- throw new Error("Cannot get the leaf node at path [".concat(path, "] because it refers to a non-leaf node: ").concat(node));
- }
- return node;
- },
- /**
- * Return a generator of the in a branch of the tree, from a specific path.
- *
- * By default the order is top-down, from lowest to highest node in the tree,
- * but you can pass the `reverse: true` option to go bottom-up.
- */
- levels: function* levels(root, path) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var _iterator5 = _createForOfIteratorHelper$4(Path.levels(path, options)),
- _step5;
- try {
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
- var p = _step5.value;
- var n = Node$1.get(root, p);
- yield [n, p];
- }
- } catch (err) {
- _iterator5.e(err);
- } finally {
- _iterator5.f();
- }
- },
- /**
- * Check if a node matches a set of props.
- */
- matches: function matches(node, props) {
- return Element$1.isElement(node) && Element$1.isElementProps(props) && Element$1.matches(node, props) || Text.isText(node) && Text.isTextProps(props) && Text.matches(node, props);
- },
- /**
- * Return a generator of all the node entries of a root node. Each entry is
- * returned as a `[Node, Path]` tuple, with the path referring to the node's
- * position inside the root node.
- */
- nodes: function* nodes(root) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var pass = options.pass,
- _options$reverse2 = options.reverse,
- reverse = _options$reverse2 === void 0 ? false : _options$reverse2;
- var _options$from = options.from,
- from = _options$from === void 0 ? [] : _options$from,
- to = options.to;
- var visited = new Set();
- var p = [];
- var n = root;
- while (true) {
- if (to && (reverse ? Path.isBefore(p, to) : Path.isAfter(p, to))) {
- break;
- }
- if (!visited.has(n)) {
- yield [n, p];
- } // If we're allowed to go downward and we haven't descended yet, do.
- if (!visited.has(n) && !Text.isText(n) && n.children.length !== 0 && (pass == null || pass([n, p]) === false)) {
- visited.add(n);
- var nextIndex = reverse ? n.children.length - 1 : 0;
- if (Path.isAncestor(p, from)) {
- nextIndex = from[p.length];
- }
- p = p.concat(nextIndex);
- n = Node$1.get(root, p);
- continue;
- } // If we're at the root and we can't go down, we're done.
- if (p.length === 0) {
- break;
- } // If we're going forward...
- if (!reverse) {
- var newPath = Path.next(p);
- if (Node$1.has(root, newPath)) {
- p = newPath;
- n = Node$1.get(root, p);
- continue;
- }
- } // If we're going backward...
- if (reverse && p[p.length - 1] !== 0) {
- var _newPath = Path.previous(p);
- p = _newPath;
- n = Node$1.get(root, p);
- continue;
- } // Otherwise we're going upward...
- p = Path.parent(p);
- n = Node$1.get(root, p);
- visited.add(n);
- }
- },
- /**
- * Get the parent of a node at a specific path.
- */
- parent: function parent(root, path) {
- var parentPath = Path.parent(path);
- var p = Node$1.get(root, parentPath);
- if (Text.isText(p)) {
- throw new Error("Cannot get the parent of path [".concat(path, "] because it does not exist in the root."));
- }
- return p;
- },
- /**
- * Get the concatenated text string of a node's content.
- *
- * Note that this will not include spaces or line breaks between block nodes.
- * It is not a user-facing string, but a string for performing offset-related
- * computations for a node.
- */
- string: function string(node) {
- if (Text.isText(node)) {
- return node.text;
- } else {
- return node.children.map(Node$1.string).join('');
- }
- },
- /**
- * Return a generator of all leaf text nodes in a root node.
- */
- texts: function* texts(root) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _iterator6 = _createForOfIteratorHelper$4(Node$1.nodes(root, options)),
- _step6;
- try {
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
- var _step6$value = _slicedToArray(_step6.value, 2),
- node = _step6$value[0],
- path = _step6$value[1];
- if (Text.isText(node)) {
- yield [node, path];
- }
- }
- } catch (err) {
- _iterator6.e(err);
- } finally {
- _iterator6.f();
- }
- }
- };
- 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; }
- 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; }
- var Operation = {
- /**
- * Check of a value is a `NodeOperation` object.
- */
- isNodeOperation: function isNodeOperation(value) {
- return Operation.isOperation(value) && value.type.endsWith('_node');
- },
- /**
- * Check of a value is an `Operation` object.
- */
- isOperation: function isOperation(value) {
- if (!isPlainObject.isPlainObject(value)) {
- return false;
- }
- switch (value.type) {
- case 'insert_node':
- return Path.isPath(value.path) && Node$1.isNode(value.node);
- case 'insert_text':
- return typeof value.offset === 'number' && typeof value.text === 'string' && Path.isPath(value.path);
- case 'merge_node':
- return typeof value.position === 'number' && Path.isPath(value.path) && isPlainObject.isPlainObject(value.properties);
- case 'move_node':
- return Path.isPath(value.path) && Path.isPath(value.newPath);
- case 'remove_node':
- return Path.isPath(value.path) && Node$1.isNode(value.node);
- case 'remove_text':
- return typeof value.offset === 'number' && typeof value.text === 'string' && Path.isPath(value.path);
- case 'set_node':
- return Path.isPath(value.path) && isPlainObject.isPlainObject(value.properties) && isPlainObject.isPlainObject(value.newProperties);
- case 'set_selection':
- return value.properties === null && Range.isRange(value.newProperties) || value.newProperties === null && Range.isRange(value.properties) || isPlainObject.isPlainObject(value.properties) && isPlainObject.isPlainObject(value.newProperties);
- case 'split_node':
- return Path.isPath(value.path) && typeof value.position === 'number' && isPlainObject.isPlainObject(value.properties);
- default:
- return false;
- }
- },
- /**
- * Check if a value is a list of `Operation` objects.
- */
- isOperationList: function isOperationList(value) {
- return Array.isArray(value) && value.every(function (val) {
- return Operation.isOperation(val);
- });
- },
- /**
- * Check of a value is a `SelectionOperation` object.
- */
- isSelectionOperation: function isSelectionOperation(value) {
- return Operation.isOperation(value) && value.type.endsWith('_selection');
- },
- /**
- * Check of a value is a `TextOperation` object.
- */
- isTextOperation: function isTextOperation(value) {
- return Operation.isOperation(value) && value.type.endsWith('_text');
- },
- /**
- * Invert an operation, returning a new operation that will exactly undo the
- * original when applied.
- */
- inverse: function inverse(op) {
- switch (op.type) {
- case 'insert_node':
- {
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- type: 'remove_node'
- });
- }
- case 'insert_text':
- {
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- type: 'remove_text'
- });
- }
- case 'merge_node':
- {
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- type: 'split_node',
- path: Path.previous(op.path)
- });
- }
- case 'move_node':
- {
- var newPath = op.newPath,
- path = op.path; // PERF: in this case the move operation is a no-op anyways.
- if (Path.equals(newPath, path)) {
- return op;
- } // If the move happens completely within a single parent the path and
- // newPath are stable with respect to each other.
- if (Path.isSibling(path, newPath)) {
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- path: newPath,
- newPath: path
- });
- } // If the move does not happen within a single parent it is possible
- // for the move to impact the true path to the location where the node
- // was removed from and where it was inserted. We have to adjust for this
- // and find the original path. We can accomplish this (only in non-sibling)
- // moves by looking at the impact of the move operation on the node
- // after the original move path.
- var inversePath = Path.transform(path, op);
- var inverseNewPath = Path.transform(Path.next(path), op);
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- path: inversePath,
- newPath: inverseNewPath
- });
- }
- case 'remove_node':
- {
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- type: 'insert_node'
- });
- }
- case 'remove_text':
- {
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- type: 'insert_text'
- });
- }
- case 'set_node':
- {
- var properties = op.properties,
- newProperties = op.newProperties;
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- properties: newProperties,
- newProperties: properties
- });
- }
- case 'set_selection':
- {
- var _properties = op.properties,
- _newProperties = op.newProperties;
- if (_properties == null) {
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- properties: _newProperties,
- newProperties: null
- });
- } else if (_newProperties == null) {
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- properties: null,
- newProperties: _properties
- });
- } else {
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- properties: _newProperties,
- newProperties: _properties
- });
- }
- }
- case 'split_node':
- {
- return _objectSpread$7(_objectSpread$7({}, op), {}, {
- type: 'merge_node',
- path: Path.next(op.path)
- });
- }
- }
- }
- };
- var Path = {
- /**
- * Get a list of ancestor paths for a given path.
- *
- * The paths are sorted from deepest to shallowest ancestor. However, if the
- * `reverse: true` option is passed, they are reversed.
- */
- ancestors: function ancestors(path) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$reverse = options.reverse,
- reverse = _options$reverse === void 0 ? false : _options$reverse;
- var paths = Path.levels(path, options);
- if (reverse) {
- paths = paths.slice(1);
- } else {
- paths = paths.slice(0, -1);
- }
- return paths;
- },
- /**
- * Get the common ancestor path of two paths.
- */
- common: function common(path, another) {
- var common = [];
- for (var i = 0; i < path.length && i < another.length; i++) {
- var av = path[i];
- var bv = another[i];
- if (av !== bv) {
- break;
- }
- common.push(av);
- }
- return common;
- },
- /**
- * Compare a path to another, returning an integer indicating whether the path
- * was before, at, or after the other.
- *
- * Note: Two paths of unequal length can still receive a `0` result if one is
- * directly above or below the other. If you want exact matching, use
- * [[Path.equals]] instead.
- */
- compare: function compare(path, another) {
- var min = Math.min(path.length, another.length);
- for (var i = 0; i < min; i++) {
- if (path[i] < another[i]) return -1;
- if (path[i] > another[i]) return 1;
- }
- return 0;
- },
- /**
- * Check if a path ends after one of the indexes in another.
- */
- endsAfter: function endsAfter(path, another) {
- var i = path.length - 1;
- var as = path.slice(0, i);
- var bs = another.slice(0, i);
- var av = path[i];
- var bv = another[i];
- return Path.equals(as, bs) && av > bv;
- },
- /**
- * Check if a path ends at one of the indexes in another.
- */
- endsAt: function endsAt(path, another) {
- var i = path.length;
- var as = path.slice(0, i);
- var bs = another.slice(0, i);
- return Path.equals(as, bs);
- },
- /**
- * Check if a path ends before one of the indexes in another.
- */
- endsBefore: function endsBefore(path, another) {
- var i = path.length - 1;
- var as = path.slice(0, i);
- var bs = another.slice(0, i);
- var av = path[i];
- var bv = another[i];
- return Path.equals(as, bs) && av < bv;
- },
- /**
- * Check if a path is exactly equal to another.
- */
- equals: function equals(path, another) {
- return path.length === another.length && path.every(function (n, i) {
- return n === another[i];
- });
- },
- /**
- * Check if the path of previous sibling node exists
- */
- hasPrevious: function hasPrevious(path) {
- return path[path.length - 1] > 0;
- },
- /**
- * Check if a path is after another.
- */
- isAfter: function isAfter(path, another) {
- return Path.compare(path, another) === 1;
- },
- /**
- * Check if a path is an ancestor of another.
- */
- isAncestor: function isAncestor(path, another) {
- return path.length < another.length && Path.compare(path, another) === 0;
- },
- /**
- * Check if a path is before another.
- */
- isBefore: function isBefore(path, another) {
- return Path.compare(path, another) === -1;
- },
- /**
- * Check if a path is a child of another.
- */
- isChild: function isChild(path, another) {
- return path.length === another.length + 1 && Path.compare(path, another) === 0;
- },
- /**
- * Check if a path is equal to or an ancestor of another.
- */
- isCommon: function isCommon(path, another) {
- return path.length <= another.length && Path.compare(path, another) === 0;
- },
- /**
- * Check if a path is a descendant of another.
- */
- isDescendant: function isDescendant(path, another) {
- return path.length > another.length && Path.compare(path, another) === 0;
- },
- /**
- * Check if a path is the parent of another.
- */
- isParent: function isParent(path, another) {
- return path.length + 1 === another.length && Path.compare(path, another) === 0;
- },
- /**
- * Check is a value implements the `Path` interface.
- */
- isPath: function isPath(value) {
- return Array.isArray(value) && (value.length === 0 || typeof value[0] === 'number');
- },
- /**
- * Check if a path is a sibling of another.
- */
- isSibling: function isSibling(path, another) {
- if (path.length !== another.length) {
- return false;
- }
- var as = path.slice(0, -1);
- var bs = another.slice(0, -1);
- var al = path[path.length - 1];
- var bl = another[another.length - 1];
- return al !== bl && Path.equals(as, bs);
- },
- /**
- * Get a list of paths at every level down to a path. Note: this is the same
- * as `Path.ancestors`, but including the path itself.
- *
- * The paths are sorted from shallowest to deepest. However, if the `reverse:
- * true` option is passed, they are reversed.
- */
- levels: function levels(path) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$reverse2 = options.reverse,
- reverse = _options$reverse2 === void 0 ? false : _options$reverse2;
- var list = [];
- for (var i = 0; i <= path.length; i++) {
- list.push(path.slice(0, i));
- }
- if (reverse) {
- list.reverse();
- }
- return list;
- },
- /**
- * Given a path, get the path to the next sibling node.
- */
- next: function next(path) {
- if (path.length === 0) {
- throw new Error("Cannot get the next path of a root path [".concat(path, "], because it has no next index."));
- }
- var last = path[path.length - 1];
- return path.slice(0, -1).concat(last + 1);
- },
- /**
- * Given a path, return a new path referring to the parent node above it.
- */
- parent: function parent(path) {
- if (path.length === 0) {
- throw new Error("Cannot get the parent path of the root path [".concat(path, "]."));
- }
- return path.slice(0, -1);
- },
- /**
- * Given a path, get the path to the previous sibling node.
- */
- previous: function previous(path) {
- if (path.length === 0) {
- throw new Error("Cannot get the previous path of a root path [".concat(path, "], because it has no previous index."));
- }
- var last = path[path.length - 1];
- if (last <= 0) {
- throw new Error("Cannot get the previous path of a first child path [".concat(path, "] because it would result in a negative index."));
- }
- return path.slice(0, -1).concat(last - 1);
- },
- /**
- * Get a path relative to an ancestor.
- */
- relative: function relative(path, ancestor) {
- if (!Path.isAncestor(ancestor, path) && !Path.equals(path, ancestor)) {
- 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."));
- }
- return path.slice(ancestor.length);
- },
- /**
- * Transform a path by an operation.
- */
- transform: function transform(path, operation) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- return immer.produce(path, function (p) {
- var _options$affinity = options.affinity,
- affinity = _options$affinity === void 0 ? 'forward' : _options$affinity; // PERF: Exit early if the operation is guaranteed not to have an effect.
- if (!path || (path === null || path === void 0 ? void 0 : path.length) === 0) {
- return;
- }
- if (p === null) {
- return null;
- }
- switch (operation.type) {
- case 'insert_node':
- {
- var op = operation.path;
- if (Path.equals(op, p) || Path.endsBefore(op, p) || Path.isAncestor(op, p)) {
- p[op.length - 1] += 1;
- }
- break;
- }
- case 'remove_node':
- {
- var _op = operation.path;
- if (Path.equals(_op, p) || Path.isAncestor(_op, p)) {
- return null;
- } else if (Path.endsBefore(_op, p)) {
- p[_op.length - 1] -= 1;
- }
- break;
- }
- case 'merge_node':
- {
- var _op2 = operation.path,
- position = operation.position;
- if (Path.equals(_op2, p) || Path.endsBefore(_op2, p)) {
- p[_op2.length - 1] -= 1;
- } else if (Path.isAncestor(_op2, p)) {
- p[_op2.length - 1] -= 1;
- p[_op2.length] += position;
- }
- break;
- }
- case 'split_node':
- {
- var _op3 = operation.path,
- _position = operation.position;
- if (Path.equals(_op3, p)) {
- if (affinity === 'forward') {
- p[p.length - 1] += 1;
- } else if (affinity === 'backward') ; else {
- return null;
- }
- } else if (Path.endsBefore(_op3, p)) {
- p[_op3.length - 1] += 1;
- } else if (Path.isAncestor(_op3, p) && path[_op3.length] >= _position) {
- p[_op3.length - 1] += 1;
- p[_op3.length] -= _position;
- }
- break;
- }
- case 'move_node':
- {
- var _op4 = operation.path,
- onp = operation.newPath; // If the old and new path are the same, it's a no-op.
- if (Path.equals(_op4, onp)) {
- return;
- }
- if (Path.isAncestor(_op4, p) || Path.equals(_op4, p)) {
- var copy = onp.slice();
- if (Path.endsBefore(_op4, onp) && _op4.length < onp.length) {
- copy[_op4.length - 1] -= 1;
- }
- return copy.concat(p.slice(_op4.length));
- } else if (Path.isSibling(_op4, onp) && (Path.isAncestor(onp, p) || Path.equals(onp, p))) {
- if (Path.endsBefore(_op4, p)) {
- p[_op4.length - 1] -= 1;
- } else {
- p[_op4.length - 1] += 1;
- }
- } else if (Path.endsBefore(onp, p) || Path.equals(onp, p) || Path.isAncestor(onp, p)) {
- if (Path.endsBefore(_op4, p)) {
- p[_op4.length - 1] -= 1;
- }
- p[onp.length - 1] += 1;
- } else if (Path.endsBefore(_op4, p)) {
- if (Path.equals(onp, p)) {
- p[onp.length - 1] += 1;
- }
- p[_op4.length - 1] -= 1;
- }
- break;
- }
- }
- });
- }
- };
- var PathRef = {
- /**
- * Transform the path ref's current value by an operation.
- */
- transform: function transform(ref, op) {
- var current = ref.current,
- affinity = ref.affinity;
- if (current == null) {
- return;
- }
- var path = Path.transform(current, op, {
- affinity: affinity
- });
- ref.current = path;
- if (path == null) {
- ref.unref();
- }
- }
- };
- 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; }
- 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; }
- var Point = {
- /**
- * Compare a point to another, returning an integer indicating whether the
- * point was before, at, or after the other.
- */
- compare: function compare(point, another) {
- var result = Path.compare(point.path, another.path);
- if (result === 0) {
- if (point.offset < another.offset) return -1;
- if (point.offset > another.offset) return 1;
- return 0;
- }
- return result;
- },
- /**
- * Check if a point is after another.
- */
- isAfter: function isAfter(point, another) {
- return Point.compare(point, another) === 1;
- },
- /**
- * Check if a point is before another.
- */
- isBefore: function isBefore(point, another) {
- return Point.compare(point, another) === -1;
- },
- /**
- * Check if a point is exactly equal to another.
- */
- equals: function equals(point, another) {
- // PERF: ensure the offsets are equal first since they are cheaper to check.
- return point.offset === another.offset && Path.equals(point.path, another.path);
- },
- /**
- * Check if a value implements the `Point` interface.
- */
- isPoint: function isPoint(value) {
- return isPlainObject.isPlainObject(value) && typeof value.offset === 'number' && Path.isPath(value.path);
- },
- /**
- * Transform a point by an operation.
- */
- transform: function transform(point, op) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- return immer.produce(point, function (p) {
- if (p === null) {
- return null;
- }
- var _options$affinity = options.affinity,
- affinity = _options$affinity === void 0 ? 'forward' : _options$affinity;
- var path = p.path,
- offset = p.offset;
- switch (op.type) {
- case 'insert_node':
- case 'move_node':
- {
- p.path = Path.transform(path, op, options);
- break;
- }
- case 'insert_text':
- {
- if (Path.equals(op.path, path) && op.offset <= offset) {
- p.offset += op.text.length;
- }
- break;
- }
- case 'merge_node':
- {
- if (Path.equals(op.path, path)) {
- p.offset += op.position;
- }
- p.path = Path.transform(path, op, options);
- break;
- }
- case 'remove_text':
- {
- if (Path.equals(op.path, path) && op.offset <= offset) {
- p.offset -= Math.min(offset - op.offset, op.text.length);
- }
- break;
- }
- case 'remove_node':
- {
- if (Path.equals(op.path, path) || Path.isAncestor(op.path, path)) {
- return null;
- }
- p.path = Path.transform(path, op, options);
- break;
- }
- case 'split_node':
- {
- if (Path.equals(op.path, path)) {
- if (op.position === offset && affinity == null) {
- return null;
- } else if (op.position < offset || op.position === offset && affinity === 'forward') {
- p.offset -= op.position;
- p.path = Path.transform(path, op, _objectSpread$6(_objectSpread$6({}, options), {}, {
- affinity: 'forward'
- }));
- }
- } else {
- p.path = Path.transform(path, op, options);
- }
- break;
- }
- }
- });
- }
- };
- var PointRef = {
- /**
- * Transform the point ref's current value by an operation.
- */
- transform: function transform(ref, op) {
- var current = ref.current,
- affinity = ref.affinity;
- if (current == null) {
- return;
- }
- var point = Point.transform(current, op, {
- affinity: affinity
- });
- ref.current = point;
- if (point == null) {
- ref.unref();
- }
- }
- };
- var _excluded$2 = ["anchor", "focus"];
- 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; }
- 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; }
- var Range = {
- /**
- * Get the start and end points of a range, in the order in which they appear
- * in the document.
- */
- edges: function edges(range) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$reverse = options.reverse,
- reverse = _options$reverse === void 0 ? false : _options$reverse;
- var anchor = range.anchor,
- focus = range.focus;
- return Range.isBackward(range) === reverse ? [anchor, focus] : [focus, anchor];
- },
- /**
- * Get the end point of a range.
- */
- end: function end(range) {
- var _Range$edges = Range.edges(range),
- _Range$edges2 = _slicedToArray(_Range$edges, 2),
- end = _Range$edges2[1];
- return end;
- },
- /**
- * Check if a range is exactly equal to another.
- */
- equals: function equals(range, another) {
- return Point.equals(range.anchor, another.anchor) && Point.equals(range.focus, another.focus);
- },
- /**
- * Check if a range includes a path, a point or part of another range.
- */
- includes: function includes(range, target) {
- if (Range.isRange(target)) {
- if (Range.includes(range, target.anchor) || Range.includes(range, target.focus)) {
- return true;
- }
- var _Range$edges3 = Range.edges(range),
- _Range$edges4 = _slicedToArray(_Range$edges3, 2),
- rs = _Range$edges4[0],
- re = _Range$edges4[1];
- var _Range$edges5 = Range.edges(target),
- _Range$edges6 = _slicedToArray(_Range$edges5, 2),
- ts = _Range$edges6[0],
- te = _Range$edges6[1];
- return Point.isBefore(rs, ts) && Point.isAfter(re, te);
- }
- var _Range$edges7 = Range.edges(range),
- _Range$edges8 = _slicedToArray(_Range$edges7, 2),
- start = _Range$edges8[0],
- end = _Range$edges8[1];
- var isAfterStart = false;
- var isBeforeEnd = false;
- if (Point.isPoint(target)) {
- isAfterStart = Point.compare(target, start) >= 0;
- isBeforeEnd = Point.compare(target, end) <= 0;
- } else {
- isAfterStart = Path.compare(target, start.path) >= 0;
- isBeforeEnd = Path.compare(target, end.path) <= 0;
- }
- return isAfterStart && isBeforeEnd;
- },
- /**
- * Get the intersection of a range with another.
- */
- intersection: function intersection(range, another) {
- range.anchor;
- range.focus;
- var rest = _objectWithoutProperties(range, _excluded$2);
- var _Range$edges9 = Range.edges(range),
- _Range$edges10 = _slicedToArray(_Range$edges9, 2),
- s1 = _Range$edges10[0],
- e1 = _Range$edges10[1];
- var _Range$edges11 = Range.edges(another),
- _Range$edges12 = _slicedToArray(_Range$edges11, 2),
- s2 = _Range$edges12[0],
- e2 = _Range$edges12[1];
- var start = Point.isBefore(s1, s2) ? s2 : s1;
- var end = Point.isBefore(e1, e2) ? e1 : e2;
- if (Point.isBefore(end, start)) {
- return null;
- } else {
- return _objectSpread$5({
- anchor: start,
- focus: end
- }, rest);
- }
- },
- /**
- * Check if a range is backward, meaning that its anchor point appears in the
- * document _after_ its focus point.
- */
- isBackward: function isBackward(range) {
- var anchor = range.anchor,
- focus = range.focus;
- return Point.isAfter(anchor, focus);
- },
- /**
- * Check if a range is collapsed, meaning that both its anchor and focus
- * points refer to the exact same position in the document.
- */
- isCollapsed: function isCollapsed(range) {
- var anchor = range.anchor,
- focus = range.focus;
- return Point.equals(anchor, focus);
- },
- /**
- * Check if a range is expanded.
- *
- * This is the opposite of [[Range.isCollapsed]] and is provided for legibility.
- */
- isExpanded: function isExpanded(range) {
- return !Range.isCollapsed(range);
- },
- /**
- * Check if a range is forward.
- *
- * This is the opposite of [[Range.isBackward]] and is provided for legibility.
- */
- isForward: function isForward(range) {
- return !Range.isBackward(range);
- },
- /**
- * Check if a value implements the [[Range]] interface.
- */
- isRange: function isRange(value) {
- return isPlainObject.isPlainObject(value) && Point.isPoint(value.anchor) && Point.isPoint(value.focus);
- },
- /**
- * Iterate through all of the point entries in a range.
- */
- points: function* points(range) {
- yield [range.anchor, 'anchor'];
- yield [range.focus, 'focus'];
- },
- /**
- * Get the start point of a range.
- */
- start: function start(range) {
- var _Range$edges13 = Range.edges(range),
- _Range$edges14 = _slicedToArray(_Range$edges13, 1),
- start = _Range$edges14[0];
- return start;
- },
- /**
- * Transform a range by an operation.
- */
- transform: function transform(range, op) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- return immer.produce(range, function (r) {
- if (r === null) {
- return null;
- }
- var _options$affinity = options.affinity,
- affinity = _options$affinity === void 0 ? 'inward' : _options$affinity;
- var affinityAnchor;
- var affinityFocus;
- if (affinity === 'inward') {
- // If the range is collapsed, make sure to use the same affinity to
- // avoid the two points passing each other and expanding in the opposite
- // direction
- var isCollapsed = Range.isCollapsed(r);
- if (Range.isForward(r)) {
- affinityAnchor = 'forward';
- affinityFocus = isCollapsed ? affinityAnchor : 'backward';
- } else {
- affinityAnchor = 'backward';
- affinityFocus = isCollapsed ? affinityAnchor : 'forward';
- }
- } else if (affinity === 'outward') {
- if (Range.isForward(r)) {
- affinityAnchor = 'backward';
- affinityFocus = 'forward';
- } else {
- affinityAnchor = 'forward';
- affinityFocus = 'backward';
- }
- } else {
- affinityAnchor = affinity;
- affinityFocus = affinity;
- }
- var anchor = Point.transform(r.anchor, op, {
- affinity: affinityAnchor
- });
- var focus = Point.transform(r.focus, op, {
- affinity: affinityFocus
- });
- if (!anchor || !focus) {
- return null;
- }
- r.anchor = anchor;
- r.focus = focus;
- });
- }
- };
- var RangeRef = {
- /**
- * Transform the range ref's current value by an operation.
- */
- transform: function transform(ref, op) {
- var current = ref.current,
- affinity = ref.affinity;
- if (current == null) {
- return;
- }
- var path = Range.transform(current, op, {
- affinity: affinity
- });
- ref.current = path;
- if (path == null) {
- ref.unref();
- }
- }
- };
- /*
- Custom deep equal comparison for Slate nodes.
- We don't need general purpose deep equality;
- Slate only supports plain values, Arrays, and nested objects.
- Complex values nested inside Arrays are not supported.
- Slate objects are designed to be serialised, so
- missing keys are deliberately normalised to undefined.
- */
- var isDeepEqual = function isDeepEqual(node, another) {
- for (var key in node) {
- var a = node[key];
- var b = another[key];
- if (isPlainObject.isPlainObject(a) && isPlainObject.isPlainObject(b)) {
- if (!isDeepEqual(a, b)) return false;
- } else if (Array.isArray(a) && Array.isArray(b)) {
- if (a.length !== b.length) return false;
- for (var i = 0; i < a.length; i++) {
- if (a[i] !== b[i]) return false;
- }
- } else if (a !== b) {
- return false;
- }
- }
- /*
- Deep object equality is only necessary in one direction; in the reverse direction
- we are only looking for keys that are missing.
- As above, undefined keys are normalised to missing.
- */
- for (var _key in another) {
- if (node[_key] === undefined && another[_key] !== undefined) {
- return false;
- }
- }
- return true;
- };
- var _excluded$1 = ["text"],
- _excluded2$1 = ["anchor", "focus"];
- 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; } } }; }
- 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); }
- 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; }
- 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; }
- 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; }
- var Text = {
- /**
- * Check if two text nodes are equal.
- *
- * When loose is set, the text is not compared. This is
- * used to check whether sibling text nodes can be merged.
- */
- equals: function equals(text, another) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var _options$loose = options.loose,
- loose = _options$loose === void 0 ? false : _options$loose;
- function omitText(obj) {
- obj.text;
- var rest = _objectWithoutProperties(obj, _excluded$1);
- return rest;
- }
- return isDeepEqual(loose ? omitText(text) : text, loose ? omitText(another) : another);
- },
- /**
- * Check if a value implements the `Text` interface.
- */
- isText: function isText(value) {
- return isPlainObject.isPlainObject(value) && typeof value.text === 'string';
- },
- /**
- * Check if a value is a list of `Text` objects.
- */
- isTextList: function isTextList(value) {
- return Array.isArray(value) && value.every(function (val) {
- return Text.isText(val);
- });
- },
- /**
- * Check if some props are a partial of Text.
- */
- isTextProps: function isTextProps(props) {
- return props.text !== undefined;
- },
- /**
- * Check if an text matches set of properties.
- *
- * Note: this is for matching custom properties, and it does not ensure that
- * the `text` property are two nodes equal.
- */
- matches: function matches(text, props) {
- for (var key in props) {
- if (key === 'text') {
- continue;
- }
- if (!text.hasOwnProperty(key) || text[key] !== props[key]) {
- return false;
- }
- }
- return true;
- },
- /**
- * Get the leaves for a text node given decorations.
- */
- decorations: function decorations(node, _decorations) {
- var leaves = [_objectSpread$4({}, node)];
- var _iterator = _createForOfIteratorHelper$3(_decorations),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var dec = _step.value;
- var anchor = dec.anchor,
- focus = dec.focus,
- rest = _objectWithoutProperties(dec, _excluded2$1);
- var _Range$edges = Range.edges(dec),
- _Range$edges2 = _slicedToArray(_Range$edges, 2),
- start = _Range$edges2[0],
- end = _Range$edges2[1];
- var next = [];
- var o = 0;
- var _iterator2 = _createForOfIteratorHelper$3(leaves),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var leaf = _step2.value;
- var length = leaf.text.length;
- var offset = o;
- o += length; // If the range encompases the entire leaf, add the range.
- if (start.offset <= offset && end.offset >= o) {
- Object.assign(leaf, rest);
- next.push(leaf);
- continue;
- } // If the range expanded and match the leaf, or starts after, or ends before it, continue.
- if (start.offset !== end.offset && (start.offset === o || end.offset === offset) || start.offset > o || end.offset < offset || end.offset === offset && offset !== 0) {
- next.push(leaf);
- continue;
- } // Otherwise we need to split the leaf, at the start, end, or both,
- // and add the range to the middle intersecting section. Do the end
- // split first since we don't need to update the offset that way.
- var middle = leaf;
- var before = void 0;
- var after = void 0;
- if (end.offset < o) {
- var off = end.offset - offset;
- after = _objectSpread$4(_objectSpread$4({}, middle), {}, {
- text: middle.text.slice(off)
- });
- middle = _objectSpread$4(_objectSpread$4({}, middle), {}, {
- text: middle.text.slice(0, off)
- });
- }
- if (start.offset > offset) {
- var _off = start.offset - offset;
- before = _objectSpread$4(_objectSpread$4({}, middle), {}, {
- text: middle.text.slice(0, _off)
- });
- middle = _objectSpread$4(_objectSpread$4({}, middle), {}, {
- text: middle.text.slice(_off)
- });
- }
- Object.assign(middle, rest);
- if (before) {
- next.push(before);
- }
- next.push(middle);
- if (after) {
- next.push(after);
- }
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- leaves = next;
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- return leaves;
- }
- };
- 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; }
- 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; }
- 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; } } }; }
- 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); }
- 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; }
- var applyToDraft = function applyToDraft(editor, selection, op) {
- switch (op.type) {
- case 'insert_node':
- {
- var path = op.path,
- node = op.node;
- var parent = Node$1.parent(editor, path);
- var index = path[path.length - 1];
- if (index > parent.children.length) {
- throw new Error("Cannot apply an \"insert_node\" operation at path [".concat(path, "] because the destination is past the end of the node."));
- }
- parent.children.splice(index, 0, node);
- if (selection) {
- var _iterator = _createForOfIteratorHelper$2(Range.points(selection)),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var _step$value = _slicedToArray(_step.value, 2),
- point = _step$value[0],
- key = _step$value[1];
- selection[key] = Point.transform(point, op);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- }
- break;
- }
- case 'insert_text':
- {
- var _path = op.path,
- offset = op.offset,
- text = op.text;
- if (text.length === 0) break;
- var _node = Node$1.leaf(editor, _path);
- var before = _node.text.slice(0, offset);
- var after = _node.text.slice(offset);
- _node.text = before + text + after;
- if (selection) {
- var _iterator2 = _createForOfIteratorHelper$2(Range.points(selection)),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var _step2$value = _slicedToArray(_step2.value, 2),
- _point = _step2$value[0],
- _key = _step2$value[1];
- selection[_key] = Point.transform(_point, op);
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- }
- break;
- }
- case 'merge_node':
- {
- var _path2 = op.path;
- var _node2 = Node$1.get(editor, _path2);
- var prevPath = Path.previous(_path2);
- var prev = Node$1.get(editor, prevPath);
- var _parent = Node$1.parent(editor, _path2);
- var _index = _path2[_path2.length - 1];
- if (Text.isText(_node2) && Text.isText(prev)) {
- prev.text += _node2.text;
- } else if (!Text.isText(_node2) && !Text.isText(prev)) {
- var _prev$children;
- (_prev$children = prev.children).push.apply(_prev$children, _toConsumableArray(_node2.children));
- } else {
- throw new Error("Cannot apply a \"merge_node\" operation at path [".concat(_path2, "] to nodes of different interfaces: ").concat(_node2, " ").concat(prev));
- }
- _parent.children.splice(_index, 1);
- if (selection) {
- var _iterator3 = _createForOfIteratorHelper$2(Range.points(selection)),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var _step3$value = _slicedToArray(_step3.value, 2),
- _point2 = _step3$value[0],
- _key2 = _step3$value[1];
- selection[_key2] = Point.transform(_point2, op);
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- }
- break;
- }
- case 'move_node':
- {
- var _path3 = op.path,
- newPath = op.newPath;
- if (Path.isAncestor(_path3, newPath)) {
- throw new Error("Cannot move a path [".concat(_path3, "] to new path [").concat(newPath, "] because the destination is inside itself."));
- }
- var _node3 = Node$1.get(editor, _path3);
- var _parent2 = Node$1.parent(editor, _path3);
- var _index2 = _path3[_path3.length - 1]; // This is tricky, but since the `path` and `newPath` both refer to
- // the same snapshot in time, there's a mismatch. After either
- // removing the original position, the second step's path can be out
- // of date. So instead of using the `op.newPath` directly, we
- // transform `op.path` to ascertain what the `newPath` would be after
- // the operation was applied.
- _parent2.children.splice(_index2, 1);
- var truePath = Path.transform(_path3, op);
- var newParent = Node$1.get(editor, Path.parent(truePath));
- var newIndex = truePath[truePath.length - 1];
- newParent.children.splice(newIndex, 0, _node3);
- if (selection) {
- var _iterator4 = _createForOfIteratorHelper$2(Range.points(selection)),
- _step4;
- try {
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
- var _step4$value = _slicedToArray(_step4.value, 2),
- _point3 = _step4$value[0],
- _key3 = _step4$value[1];
- selection[_key3] = Point.transform(_point3, op);
- }
- } catch (err) {
- _iterator4.e(err);
- } finally {
- _iterator4.f();
- }
- }
- break;
- }
- case 'remove_node':
- {
- var _path4 = op.path;
- var _index3 = _path4[_path4.length - 1];
- var _parent3 = Node$1.parent(editor, _path4);
- _parent3.children.splice(_index3, 1); // Transform all of the points in the value, but if the point was in the
- // node that was removed we need to update the range or remove it.
- if (selection) {
- var _iterator5 = _createForOfIteratorHelper$2(Range.points(selection)),
- _step5;
- try {
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
- var _step5$value = _slicedToArray(_step5.value, 2),
- _point4 = _step5$value[0],
- _key4 = _step5$value[1];
- var result = Point.transform(_point4, op);
- if (selection != null && result != null) {
- selection[_key4] = result;
- } else {
- var _prev = void 0;
- var next = void 0;
- var _iterator6 = _createForOfIteratorHelper$2(Node$1.texts(editor)),
- _step6;
- try {
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
- var _step6$value = _slicedToArray(_step6.value, 2),
- n = _step6$value[0],
- p = _step6$value[1];
- if (Path.compare(p, _path4) === -1) {
- _prev = [n, p];
- } else {
- next = [n, p];
- break;
- }
- }
- } catch (err) {
- _iterator6.e(err);
- } finally {
- _iterator6.f();
- }
- var preferNext = false;
- if (_prev && next) {
- if (Path.equals(next[1], _path4)) {
- preferNext = !Path.hasPrevious(next[1]);
- } else {
- preferNext = Path.common(_prev[1], _path4).length < Path.common(next[1], _path4).length;
- }
- }
- if (_prev && !preferNext) {
- _point4.path = _prev[1];
- _point4.offset = _prev[0].text.length;
- } else if (next) {
- _point4.path = next[1];
- _point4.offset = 0;
- } else {
- selection = null;
- }
- }
- }
- } catch (err) {
- _iterator5.e(err);
- } finally {
- _iterator5.f();
- }
- }
- break;
- }
- case 'remove_text':
- {
- var _path5 = op.path,
- _offset = op.offset,
- _text = op.text;
- if (_text.length === 0) break;
- var _node4 = Node$1.leaf(editor, _path5);
- var _before = _node4.text.slice(0, _offset);
- var _after = _node4.text.slice(_offset + _text.length);
- _node4.text = _before + _after;
- if (selection) {
- var _iterator7 = _createForOfIteratorHelper$2(Range.points(selection)),
- _step7;
- try {
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
- var _step7$value = _slicedToArray(_step7.value, 2),
- _point5 = _step7$value[0],
- _key5 = _step7$value[1];
- selection[_key5] = Point.transform(_point5, op);
- }
- } catch (err) {
- _iterator7.e(err);
- } finally {
- _iterator7.f();
- }
- }
- break;
- }
- case 'set_node':
- {
- var _path6 = op.path,
- properties = op.properties,
- newProperties = op.newProperties;
- if (_path6.length === 0) {
- throw new Error("Cannot set properties on the root node!");
- }
- var _node5 = Node$1.get(editor, _path6);
- for (var _key6 in newProperties) {
- if (_key6 === 'children' || _key6 === 'text') {
- throw new Error("Cannot set the \"".concat(_key6, "\" property of nodes!"));
- }
- var value = newProperties[_key6];
- if (value == null) {
- delete _node5[_key6];
- } else {
- _node5[_key6] = value;
- }
- } // properties that were previously defined, but are now missing, must be deleted
- for (var _key7 in properties) {
- if (!newProperties.hasOwnProperty(_key7)) {
- delete _node5[_key7];
- }
- }
- break;
- }
- case 'set_selection':
- {
- var _newProperties = op.newProperties;
- if (_newProperties == null) {
- selection = _newProperties;
- } else {
- if (selection == null) {
- if (!Range.isRange(_newProperties)) {
- throw new Error("Cannot apply an incomplete \"set_selection\" operation properties ".concat(JSON.stringify(_newProperties), " when there is no current selection."));
- }
- selection = _objectSpread$3({}, _newProperties);
- }
- for (var _key8 in _newProperties) {
- var _value = _newProperties[_key8];
- if (_value == null) {
- if (_key8 === 'anchor' || _key8 === 'focus') {
- throw new Error("Cannot remove the \"".concat(_key8, "\" selection property"));
- }
- delete selection[_key8];
- } else {
- selection[_key8] = _value;
- }
- }
- }
- break;
- }
- case 'split_node':
- {
- var _path7 = op.path,
- position = op.position,
- _properties = op.properties;
- if (_path7.length === 0) {
- throw new Error("Cannot apply a \"split_node\" operation at path [".concat(_path7, "] because the root node cannot be split."));
- }
- var _node6 = Node$1.get(editor, _path7);
- var _parent4 = Node$1.parent(editor, _path7);
- var _index4 = _path7[_path7.length - 1];
- var newNode;
- if (Text.isText(_node6)) {
- var _before2 = _node6.text.slice(0, position);
- var _after2 = _node6.text.slice(position);
- _node6.text = _before2;
- newNode = _objectSpread$3(_objectSpread$3({}, _properties), {}, {
- text: _after2
- });
- } else {
- var _before3 = _node6.children.slice(0, position);
- var _after3 = _node6.children.slice(position);
- _node6.children = _before3;
- newNode = _objectSpread$3(_objectSpread$3({}, _properties), {}, {
- children: _after3
- });
- }
- _parent4.children.splice(_index4 + 1, 0, newNode);
- if (selection) {
- var _iterator8 = _createForOfIteratorHelper$2(Range.points(selection)),
- _step8;
- try {
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
- var _step8$value = _slicedToArray(_step8.value, 2),
- _point6 = _step8$value[0],
- _key9 = _step8$value[1];
- selection[_key9] = Point.transform(_point6, op);
- }
- } catch (err) {
- _iterator8.e(err);
- } finally {
- _iterator8.f();
- }
- }
- break;
- }
- }
- return selection;
- };
- var GeneralTransforms = {
- /**
- * Transform the editor by an operation.
- */
- transform: function transform(editor, op) {
- editor.children = immer.createDraft(editor.children);
- var selection = editor.selection && immer.createDraft(editor.selection);
- try {
- selection = applyToDraft(editor, selection, op);
- } finally {
- editor.children = immer.finishDraft(editor.children);
- if (selection) {
- editor.selection = immer.isDraft(selection) ? immer.finishDraft(selection) : selection;
- } else {
- editor.selection = null;
- }
- }
- }
- };
- var _excluded = ["text"],
- _excluded2 = ["children"];
- 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; }
- 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; }
- 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; } } }; }
- 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); }
- 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; }
- var NodeTransforms = {
- /**
- * Insert nodes at a specific location in the Editor.
- */
- insertNodes: function insertNodes(editor, nodes) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- Editor.withoutNormalizing(editor, function () {
- var _options$hanging = options.hanging,
- hanging = _options$hanging === void 0 ? false : _options$hanging,
- _options$voids = options.voids,
- voids = _options$voids === void 0 ? false : _options$voids,
- _options$mode = options.mode,
- mode = _options$mode === void 0 ? 'lowest' : _options$mode;
- var at = options.at,
- match = options.match,
- select = options.select;
- if (Node$1.isNode(nodes)) {
- nodes = [nodes];
- }
- if (nodes.length === 0) {
- return;
- }
- var _nodes = nodes,
- _nodes2 = _slicedToArray(_nodes, 1),
- node = _nodes2[0]; // By default, use the selection as the target location. But if there is
- // no selection, insert at the end of the document since that is such a
- // common use case when inserting from a non-selected state.
- if (!at) {
- if (editor.selection) {
- at = editor.selection;
- } else if (editor.children.length > 0) {
- at = Editor.end(editor, []);
- } else {
- at = [0];
- }
- select = true;
- }
- if (select == null) {
- select = false;
- }
- if (Range.isRange(at)) {
- if (!hanging) {
- at = Editor.unhangRange(editor, at);
- }
- if (Range.isCollapsed(at)) {
- at = at.anchor;
- } else {
- var _Range$edges = Range.edges(at),
- _Range$edges2 = _slicedToArray(_Range$edges, 2),
- end = _Range$edges2[1];
- var pointRef = Editor.pointRef(editor, end);
- Transforms["delete"](editor, {
- at: at
- });
- at = pointRef.unref();
- }
- }
- if (Point.isPoint(at)) {
- if (match == null) {
- if (Text.isText(node)) {
- match = function match(n) {
- return Text.isText(n);
- };
- } else if (editor.isInline(node)) {
- match = function match(n) {
- return Text.isText(n) || Editor.isInline(editor, n);
- };
- } else {
- match = function match(n) {
- return Editor.isBlock(editor, n);
- };
- }
- }
- var _Editor$nodes = Editor.nodes(editor, {
- at: at.path,
- match: match,
- mode: mode,
- voids: voids
- }),
- _Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
- entry = _Editor$nodes2[0];
- if (entry) {
- var _entry = _slicedToArray(entry, 2),
- _matchPath = _entry[1];
- var pathRef = Editor.pathRef(editor, _matchPath);
- var isAtEnd = Editor.isEnd(editor, at, _matchPath);
- Transforms.splitNodes(editor, {
- at: at,
- match: match,
- mode: mode,
- voids: voids
- });
- var path = pathRef.unref();
- at = isAtEnd ? Path.next(path) : path;
- } else {
- return;
- }
- }
- var parentPath = Path.parent(at);
- var index = at[at.length - 1];
- if (!voids && Editor["void"](editor, {
- at: parentPath
- })) {
- return;
- }
- var _iterator = _createForOfIteratorHelper$1(nodes),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var _node = _step.value;
- var _path = parentPath.concat(index);
- index++;
- editor.apply({
- type: 'insert_node',
- path: _path,
- node: _node
- });
- at = Path.next(at);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- at = Path.previous(at);
- if (select) {
- var point = Editor.end(editor, at);
- if (point) {
- Transforms.select(editor, point);
- }
- }
- });
- },
- /**
- * Lift nodes at a specific location upwards in the document tree, splitting
- * their parent in two if necessary.
- */
- liftNodes: function liftNodes(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- Editor.withoutNormalizing(editor, function () {
- var _options$at = options.at,
- at = _options$at === void 0 ? editor.selection : _options$at,
- _options$mode2 = options.mode,
- mode = _options$mode2 === void 0 ? 'lowest' : _options$mode2,
- _options$voids2 = options.voids,
- voids = _options$voids2 === void 0 ? false : _options$voids2;
- var match = options.match;
- if (match == null) {
- match = Path.isPath(at) ? matchPath(editor, at) : function (n) {
- return Editor.isBlock(editor, n);
- };
- }
- if (!at) {
- return;
- }
- var matches = Editor.nodes(editor, {
- at: at,
- match: match,
- mode: mode,
- voids: voids
- });
- var pathRefs = Array.from(matches, function (_ref) {
- var _ref2 = _slicedToArray(_ref, 2),
- p = _ref2[1];
- return Editor.pathRef(editor, p);
- });
- for (var _i = 0, _pathRefs = pathRefs; _i < _pathRefs.length; _i++) {
- var pathRef = _pathRefs[_i];
- var path = pathRef.unref();
- if (path.length < 2) {
- throw new Error("Cannot lift node at a path [".concat(path, "] because it has a depth of less than `2`."));
- }
- var parentNodeEntry = Editor.node(editor, Path.parent(path));
- var _parentNodeEntry = _slicedToArray(parentNodeEntry, 2),
- parent = _parentNodeEntry[0],
- parentPath = _parentNodeEntry[1];
- var index = path[path.length - 1];
- var length = parent.children.length;
- if (length === 1) {
- var toPath = Path.next(parentPath);
- Transforms.moveNodes(editor, {
- at: path,
- to: toPath,
- voids: voids
- });
- Transforms.removeNodes(editor, {
- at: parentPath,
- voids: voids
- });
- } else if (index === 0) {
- Transforms.moveNodes(editor, {
- at: path,
- to: parentPath,
- voids: voids
- });
- } else if (index === length - 1) {
- var _toPath = Path.next(parentPath);
- Transforms.moveNodes(editor, {
- at: path,
- to: _toPath,
- voids: voids
- });
- } else {
- var splitPath = Path.next(path);
- var _toPath2 = Path.next(parentPath);
- Transforms.splitNodes(editor, {
- at: splitPath,
- voids: voids
- });
- Transforms.moveNodes(editor, {
- at: path,
- to: _toPath2,
- voids: voids
- });
- }
- }
- });
- },
- /**
- * Merge a node at a location with the previous node of the same depth,
- * removing any empty containing nodes after the merge if necessary.
- */
- mergeNodes: function mergeNodes(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- Editor.withoutNormalizing(editor, function () {
- var match = options.match,
- _options$at2 = options.at,
- at = _options$at2 === void 0 ? editor.selection : _options$at2;
- var _options$hanging2 = options.hanging,
- hanging = _options$hanging2 === void 0 ? false : _options$hanging2,
- _options$voids3 = options.voids,
- voids = _options$voids3 === void 0 ? false : _options$voids3,
- _options$mode3 = options.mode,
- mode = _options$mode3 === void 0 ? 'lowest' : _options$mode3;
- if (!at) {
- return;
- }
- if (match == null) {
- if (Path.isPath(at)) {
- var _Editor$parent = Editor.parent(editor, at),
- _Editor$parent2 = _slicedToArray(_Editor$parent, 1),
- parent = _Editor$parent2[0];
- match = function match(n) {
- return parent.children.includes(n);
- };
- } else {
- match = function match(n) {
- return Editor.isBlock(editor, n);
- };
- }
- }
- if (!hanging && Range.isRange(at)) {
- at = Editor.unhangRange(editor, at);
- }
- if (Range.isRange(at)) {
- if (Range.isCollapsed(at)) {
- at = at.anchor;
- } else {
- var _Range$edges3 = Range.edges(at),
- _Range$edges4 = _slicedToArray(_Range$edges3, 2),
- end = _Range$edges4[1];
- var pointRef = Editor.pointRef(editor, end);
- Transforms["delete"](editor, {
- at: at
- });
- at = pointRef.unref();
- if (options.at == null) {
- Transforms.select(editor, at);
- }
- }
- }
- var _Editor$nodes3 = Editor.nodes(editor, {
- at: at,
- match: match,
- voids: voids,
- mode: mode
- }),
- _Editor$nodes4 = _slicedToArray(_Editor$nodes3, 1),
- current = _Editor$nodes4[0];
- var prev = Editor.previous(editor, {
- at: at,
- match: match,
- voids: voids,
- mode: mode
- });
- if (!current || !prev) {
- return;
- }
- var _current = _slicedToArray(current, 2),
- node = _current[0],
- path = _current[1];
- var _prev = _slicedToArray(prev, 2),
- prevNode = _prev[0],
- prevPath = _prev[1];
- if (path.length === 0 || prevPath.length === 0) {
- return;
- }
- var newPath = Path.next(prevPath);
- var commonPath = Path.common(path, prevPath);
- var isPreviousSibling = Path.isSibling(path, prevPath);
- var levels = Array.from(Editor.levels(editor, {
- at: path
- }), function (_ref3) {
- var _ref4 = _slicedToArray(_ref3, 1),
- n = _ref4[0];
- return n;
- }).slice(commonPath.length).slice(0, -1); // Determine if the merge will leave an ancestor of the path empty as a
- // result, in which case we'll want to remove it after merging.
- var emptyAncestor = Editor.above(editor, {
- at: path,
- mode: 'highest',
- match: function match(n) {
- return levels.includes(n) && hasSingleChildNest(editor, n);
- }
- });
- var emptyRef = emptyAncestor && Editor.pathRef(editor, emptyAncestor[1]);
- var properties;
- var position; // Ensure that the nodes are equivalent, and figure out what the position
- // and extra properties of the merge will be.
- if (Text.isText(node) && Text.isText(prevNode)) {
- node.text;
- var rest = _objectWithoutProperties(node, _excluded);
- position = prevNode.text.length;
- properties = rest;
- } else if (Element$1.isElement(node) && Element$1.isElement(prevNode)) {
- node.children;
- var _rest = _objectWithoutProperties(node, _excluded2);
- position = prevNode.children.length;
- properties = _rest;
- } else {
- 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)));
- } // If the node isn't already the next sibling of the previous node, move
- // it so that it is before merging.
- if (!isPreviousSibling) {
- Transforms.moveNodes(editor, {
- at: path,
- to: newPath,
- voids: voids
- });
- } // If there was going to be an empty ancestor of the node that was merged,
- // we remove it from the tree.
- if (emptyRef) {
- Transforms.removeNodes(editor, {
- at: emptyRef.current,
- voids: voids
- });
- } // If the target node that we're merging with is empty, remove it instead
- // of merging the two. This is a common rich text editor behavior to
- // prevent losing formatting when deleting entire nodes when you have a
- // hanging selection.
- // if prevNode is first child in parent,don't remove it.
- if (Element$1.isElement(prevNode) && Editor.isEmpty(editor, prevNode) || Text.isText(prevNode) && prevNode.text === '' && prevPath[prevPath.length - 1] !== 0) {
- Transforms.removeNodes(editor, {
- at: prevPath,
- voids: voids
- });
- } else {
- editor.apply({
- type: 'merge_node',
- path: newPath,
- position: position,
- properties: properties
- });
- }
- if (emptyRef) {
- emptyRef.unref();
- }
- });
- },
- /**
- * Move the nodes at a location to a new location.
- */
- moveNodes: function moveNodes(editor, options) {
- Editor.withoutNormalizing(editor, function () {
- var to = options.to,
- _options$at3 = options.at,
- at = _options$at3 === void 0 ? editor.selection : _options$at3,
- _options$mode4 = options.mode,
- mode = _options$mode4 === void 0 ? 'lowest' : _options$mode4,
- _options$voids4 = options.voids,
- voids = _options$voids4 === void 0 ? false : _options$voids4;
- var match = options.match;
- if (!at) {
- return;
- }
- if (match == null) {
- match = Path.isPath(at) ? matchPath(editor, at) : function (n) {
- return Editor.isBlock(editor, n);
- };
- }
- var toRef = Editor.pathRef(editor, to);
- var targets = Editor.nodes(editor, {
- at: at,
- match: match,
- mode: mode,
- voids: voids
- });
- var pathRefs = Array.from(targets, function (_ref5) {
- var _ref6 = _slicedToArray(_ref5, 2),
- p = _ref6[1];
- return Editor.pathRef(editor, p);
- });
- for (var _i2 = 0, _pathRefs2 = pathRefs; _i2 < _pathRefs2.length; _i2++) {
- var pathRef = _pathRefs2[_i2];
- var path = pathRef.unref();
- var newPath = toRef.current;
- if (path.length !== 0) {
- editor.apply({
- type: 'move_node',
- path: path,
- newPath: newPath
- });
- }
- if (toRef.current && Path.isSibling(newPath, path) && Path.isAfter(newPath, path)) {
- // When performing a sibling move to a later index, the path at the destination is shifted
- // to before the insertion point instead of after. To ensure our group of nodes are inserted
- // in the correct order we increment toRef to account for that
- toRef.current = Path.next(toRef.current);
- }
- }
- toRef.unref();
- });
- },
- /**
- * Remove the nodes at a specific location in the document.
- */
- removeNodes: function removeNodes(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- Editor.withoutNormalizing(editor, function () {
- var _options$hanging3 = options.hanging,
- hanging = _options$hanging3 === void 0 ? false : _options$hanging3,
- _options$voids5 = options.voids,
- voids = _options$voids5 === void 0 ? false : _options$voids5,
- _options$mode5 = options.mode,
- mode = _options$mode5 === void 0 ? 'lowest' : _options$mode5;
- var _options$at4 = options.at,
- at = _options$at4 === void 0 ? editor.selection : _options$at4,
- match = options.match;
- if (!at) {
- return;
- }
- if (match == null) {
- match = Path.isPath(at) ? matchPath(editor, at) : function (n) {
- return Editor.isBlock(editor, n);
- };
- }
- if (!hanging && Range.isRange(at)) {
- at = Editor.unhangRange(editor, at);
- }
- var depths = Editor.nodes(editor, {
- at: at,
- match: match,
- mode: mode,
- voids: voids
- });
- var pathRefs = Array.from(depths, function (_ref7) {
- var _ref8 = _slicedToArray(_ref7, 2),
- p = _ref8[1];
- return Editor.pathRef(editor, p);
- });
- for (var _i3 = 0, _pathRefs3 = pathRefs; _i3 < _pathRefs3.length; _i3++) {
- var pathRef = _pathRefs3[_i3];
- var path = pathRef.unref();
- if (path) {
- var _Editor$node = Editor.node(editor, path),
- _Editor$node2 = _slicedToArray(_Editor$node, 1),
- node = _Editor$node2[0];
- editor.apply({
- type: 'remove_node',
- path: path,
- node: node
- });
- }
- }
- });
- },
- /**
- * Set new properties on the nodes at a location.
- */
- setNodes: function setNodes(editor, props) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- Editor.withoutNormalizing(editor, function () {
- var match = options.match,
- _options$at5 = options.at,
- at = _options$at5 === void 0 ? editor.selection : _options$at5;
- var _options$hanging4 = options.hanging,
- hanging = _options$hanging4 === void 0 ? false : _options$hanging4,
- _options$mode6 = options.mode,
- mode = _options$mode6 === void 0 ? 'lowest' : _options$mode6,
- _options$split = options.split,
- split = _options$split === void 0 ? false : _options$split,
- _options$voids6 = options.voids,
- voids = _options$voids6 === void 0 ? false : _options$voids6;
- if (!at) {
- return;
- }
- if (match == null) {
- match = Path.isPath(at) ? matchPath(editor, at) : function (n) {
- return Editor.isBlock(editor, n);
- };
- }
- if (!hanging && Range.isRange(at)) {
- at = Editor.unhangRange(editor, at);
- }
- if (split && Range.isRange(at)) {
- if (Range.isCollapsed(at) && Editor.leaf(editor, at.anchor)[0].text.length > 0) {
- // If the range is collapsed in a non-empty node and 'split' is true, there's nothing to
- // set that won't get normalized away
- return;
- }
- var rangeRef = Editor.rangeRef(editor, at, {
- affinity: 'inward'
- });
- var _Range$edges5 = Range.edges(at),
- _Range$edges6 = _slicedToArray(_Range$edges5, 2),
- start = _Range$edges6[0],
- end = _Range$edges6[1];
- var splitMode = mode === 'lowest' ? 'lowest' : 'highest';
- var endAtEndOfNode = Editor.isEnd(editor, end, end.path);
- Transforms.splitNodes(editor, {
- at: end,
- match: match,
- mode: splitMode,
- voids: voids,
- always: !endAtEndOfNode
- });
- var startAtStartOfNode = Editor.isStart(editor, start, start.path);
- Transforms.splitNodes(editor, {
- at: start,
- match: match,
- mode: splitMode,
- voids: voids,
- always: !startAtStartOfNode
- });
- at = rangeRef.unref();
- if (options.at == null) {
- Transforms.select(editor, at);
- }
- }
- var _iterator2 = _createForOfIteratorHelper$1(Editor.nodes(editor, {
- at: at,
- match: match,
- mode: mode,
- voids: voids
- })),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var _step2$value = _slicedToArray(_step2.value, 2),
- node = _step2$value[0],
- path = _step2$value[1];
- var properties = {};
- var newProperties = {}; // You can't set properties on the editor node.
- if (path.length === 0) {
- continue;
- }
- var hasChanges = false;
- for (var k in props) {
- if (k === 'children' || k === 'text') {
- continue;
- }
- if (props[k] !== node[k]) {
- hasChanges = true; // Omit new properties from the old properties list
- if (node.hasOwnProperty(k)) properties[k] = node[k]; // Omit properties that have been removed from the new properties list
- if (props[k] != null) newProperties[k] = props[k];
- }
- }
- if (hasChanges) {
- editor.apply({
- type: 'set_node',
- path: path,
- properties: properties,
- newProperties: newProperties
- });
- }
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- });
- },
- /**
- * Split the nodes at a specific location.
- */
- splitNodes: function splitNodes(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- Editor.withoutNormalizing(editor, function () {
- var _options$mode7 = options.mode,
- mode = _options$mode7 === void 0 ? 'lowest' : _options$mode7,
- _options$voids7 = options.voids,
- voids = _options$voids7 === void 0 ? false : _options$voids7;
- var match = options.match,
- _options$at6 = options.at,
- at = _options$at6 === void 0 ? editor.selection : _options$at6,
- _options$height = options.height,
- height = _options$height === void 0 ? 0 : _options$height,
- _options$always = options.always,
- always = _options$always === void 0 ? false : _options$always;
- if (match == null) {
- match = function match(n) {
- return Editor.isBlock(editor, n);
- };
- }
- if (Range.isRange(at)) {
- at = deleteRange(editor, at);
- } // If the target is a path, the default height-skipping and position
- // counters need to account for us potentially splitting at a non-leaf.
- if (Path.isPath(at)) {
- var path = at;
- var point = Editor.point(editor, path);
- var _Editor$parent3 = Editor.parent(editor, path),
- _Editor$parent4 = _slicedToArray(_Editor$parent3, 1),
- parent = _Editor$parent4[0];
- match = function match(n) {
- return n === parent;
- };
- height = point.path.length - path.length + 1;
- at = point;
- always = true;
- }
- if (!at) {
- return;
- }
- var beforeRef = Editor.pointRef(editor, at, {
- affinity: 'backward'
- });
- var _Editor$nodes5 = Editor.nodes(editor, {
- at: at,
- match: match,
- mode: mode,
- voids: voids
- }),
- _Editor$nodes6 = _slicedToArray(_Editor$nodes5, 1),
- highest = _Editor$nodes6[0];
- if (!highest) {
- return;
- }
- var voidMatch = Editor["void"](editor, {
- at: at,
- mode: 'highest'
- });
- var nudge = 0;
- if (!voids && voidMatch) {
- var _voidMatch = _slicedToArray(voidMatch, 2),
- voidNode = _voidMatch[0],
- voidPath = _voidMatch[1];
- if (Element$1.isElement(voidNode) && editor.isInline(voidNode)) {
- var after = Editor.after(editor, voidPath);
- if (!after) {
- var text = {
- text: ''
- };
- var afterPath = Path.next(voidPath);
- Transforms.insertNodes(editor, text, {
- at: afterPath,
- voids: voids
- });
- after = Editor.point(editor, afterPath);
- }
- at = after;
- always = true;
- }
- var siblingHeight = at.path.length - voidPath.length;
- height = siblingHeight + 1;
- always = true;
- }
- var afterRef = Editor.pointRef(editor, at);
- var depth = at.path.length - height;
- var _highest = _slicedToArray(highest, 2),
- highestPath = _highest[1];
- var lowestPath = at.path.slice(0, depth);
- var position = height === 0 ? at.offset : at.path[depth] + nudge;
- var _iterator3 = _createForOfIteratorHelper$1(Editor.levels(editor, {
- at: lowestPath,
- reverse: true,
- voids: voids
- })),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var _step3$value = _slicedToArray(_step3.value, 2),
- node = _step3$value[0],
- _path2 = _step3$value[1];
- var split = false;
- if (_path2.length < highestPath.length || _path2.length === 0 || !voids && Editor.isVoid(editor, node)) {
- break;
- }
- var _point2 = beforeRef.current;
- var isEnd = Editor.isEnd(editor, _point2, _path2);
- if (always || !beforeRef || !Editor.isEdge(editor, _point2, _path2)) {
- split = true;
- var properties = Node$1.extractProps(node);
- editor.apply({
- type: 'split_node',
- path: _path2,
- position: position,
- properties: properties
- });
- }
- position = _path2[_path2.length - 1] + (split || isEnd ? 1 : 0);
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- if (options.at == null) {
- var _point = afterRef.current || Editor.end(editor, []);
- Transforms.select(editor, _point);
- }
- beforeRef.unref();
- afterRef.unref();
- });
- },
- /**
- * Unset properties on the nodes at a location.
- */
- unsetNodes: function unsetNodes(editor, props) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- if (!Array.isArray(props)) {
- props = [props];
- }
- var obj = {};
- var _iterator4 = _createForOfIteratorHelper$1(props),
- _step4;
- try {
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
- var key = _step4.value;
- obj[key] = null;
- }
- } catch (err) {
- _iterator4.e(err);
- } finally {
- _iterator4.f();
- }
- Transforms.setNodes(editor, obj, options);
- },
- /**
- * Unwrap the nodes at a location from a parent node, splitting the parent if
- * necessary to ensure that only the content in the range is unwrapped.
- */
- unwrapNodes: function unwrapNodes(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- Editor.withoutNormalizing(editor, function () {
- var _options$mode8 = options.mode,
- mode = _options$mode8 === void 0 ? 'lowest' : _options$mode8,
- _options$split2 = options.split,
- split = _options$split2 === void 0 ? false : _options$split2,
- _options$voids8 = options.voids,
- voids = _options$voids8 === void 0 ? false : _options$voids8;
- var _options$at7 = options.at,
- at = _options$at7 === void 0 ? editor.selection : _options$at7,
- match = options.match;
- if (!at) {
- return;
- }
- if (match == null) {
- match = Path.isPath(at) ? matchPath(editor, at) : function (n) {
- return Editor.isBlock(editor, n);
- };
- }
- if (Path.isPath(at)) {
- at = Editor.range(editor, at);
- }
- var rangeRef = Range.isRange(at) ? Editor.rangeRef(editor, at) : null;
- var matches = Editor.nodes(editor, {
- at: at,
- match: match,
- mode: mode,
- voids: voids
- });
- var pathRefs = Array.from(matches, function (_ref9) {
- var _ref10 = _slicedToArray(_ref9, 2),
- p = _ref10[1];
- return Editor.pathRef(editor, p);
- } // unwrapNode will call liftNode which does not support splitting the node when nested.
- // If we do not reverse the order and call it from top to the bottom, it will remove all blocks
- // that wrap target node. So we reverse the order.
- ).reverse();
- var _iterator5 = _createForOfIteratorHelper$1(pathRefs),
- _step5;
- try {
- var _loop = function _loop() {
- var pathRef = _step5.value;
- var path = pathRef.unref();
- var _Editor$node3 = Editor.node(editor, path),
- _Editor$node4 = _slicedToArray(_Editor$node3, 1),
- node = _Editor$node4[0];
- var range = Editor.range(editor, path);
- if (split && rangeRef) {
- range = Range.intersection(rangeRef.current, range);
- }
- Transforms.liftNodes(editor, {
- at: range,
- match: function match(n) {
- return Element$1.isAncestor(node) && node.children.includes(n);
- },
- voids: voids
- });
- };
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
- _loop();
- }
- } catch (err) {
- _iterator5.e(err);
- } finally {
- _iterator5.f();
- }
- if (rangeRef) {
- rangeRef.unref();
- }
- });
- },
- /**
- * Wrap the nodes at a location in a new container node, splitting the edges
- * of the range first to ensure that only the content in the range is wrapped.
- */
- wrapNodes: function wrapNodes(editor, element) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- Editor.withoutNormalizing(editor, function () {
- var _options$mode9 = options.mode,
- mode = _options$mode9 === void 0 ? 'lowest' : _options$mode9,
- _options$split3 = options.split,
- split = _options$split3 === void 0 ? false : _options$split3,
- _options$voids9 = options.voids,
- voids = _options$voids9 === void 0 ? false : _options$voids9;
- var match = options.match,
- _options$at8 = options.at,
- at = _options$at8 === void 0 ? editor.selection : _options$at8;
- if (!at) {
- return;
- }
- if (match == null) {
- if (Path.isPath(at)) {
- match = matchPath(editor, at);
- } else if (editor.isInline(element)) {
- match = function match(n) {
- return Editor.isInline(editor, n) || Text.isText(n);
- };
- } else {
- match = function match(n) {
- return Editor.isBlock(editor, n);
- };
- }
- }
- if (split && Range.isRange(at)) {
- var _Range$edges7 = Range.edges(at),
- _Range$edges8 = _slicedToArray(_Range$edges7, 2),
- start = _Range$edges8[0],
- end = _Range$edges8[1];
- var rangeRef = Editor.rangeRef(editor, at, {
- affinity: 'inward'
- });
- Transforms.splitNodes(editor, {
- at: end,
- match: match,
- voids: voids
- });
- Transforms.splitNodes(editor, {
- at: start,
- match: match,
- voids: voids
- });
- at = rangeRef.unref();
- if (options.at == null) {
- Transforms.select(editor, at);
- }
- }
- var roots = Array.from(Editor.nodes(editor, {
- at: at,
- match: editor.isInline(element) ? function (n) {
- return Editor.isBlock(editor, n);
- } : function (n) {
- return Editor.isEditor(n);
- },
- mode: 'lowest',
- voids: voids
- }));
- for (var _i4 = 0, _roots = roots; _i4 < _roots.length; _i4++) {
- var _roots$_i = _slicedToArray(_roots[_i4], 2),
- rootPath = _roots$_i[1];
- var a = Range.isRange(at) ? Range.intersection(at, Editor.range(editor, rootPath)) : at;
- if (!a) {
- continue;
- }
- var matches = Array.from(Editor.nodes(editor, {
- at: a,
- match: match,
- mode: mode,
- voids: voids
- }));
- if (matches.length > 0) {
- var _ret = function () {
- var _matches = _slicedToArray(matches, 1),
- first = _matches[0];
- var last = matches[matches.length - 1];
- var _first = _slicedToArray(first, 2),
- firstPath = _first[1];
- var _last = _slicedToArray(last, 2),
- lastPath = _last[1];
- if (firstPath.length === 0 && lastPath.length === 0) {
- // if there's no matching parent - usually means the node is an editor - don't do anything
- return "continue";
- }
- var commonPath = Path.equals(firstPath, lastPath) ? Path.parent(firstPath) : Path.common(firstPath, lastPath);
- var range = Editor.range(editor, firstPath, lastPath);
- var commonNodeEntry = Editor.node(editor, commonPath);
- var _commonNodeEntry = _slicedToArray(commonNodeEntry, 1),
- commonNode = _commonNodeEntry[0];
- var depth = commonPath.length + 1;
- var wrapperPath = Path.next(lastPath.slice(0, depth));
- var wrapper = _objectSpread$2(_objectSpread$2({}, element), {}, {
- children: []
- });
- Transforms.insertNodes(editor, wrapper, {
- at: wrapperPath,
- voids: voids
- });
- Transforms.moveNodes(editor, {
- at: range,
- match: function match(n) {
- return Element$1.isAncestor(commonNode) && commonNode.children.includes(n);
- },
- to: wrapperPath.concat(0),
- voids: voids
- });
- }();
- if (_ret === "continue") continue;
- }
- }
- });
- }
- };
- var hasSingleChildNest = function hasSingleChildNest(editor, node) {
- if (Element$1.isElement(node)) {
- var element = node;
- if (Editor.isVoid(editor, node)) {
- return true;
- } else if (element.children.length === 1) {
- return hasSingleChildNest(editor, element.children[0]);
- } else {
- return false;
- }
- } else if (Editor.isEditor(node)) {
- return false;
- } else {
- return true;
- }
- };
- /**
- * Convert a range into a point by deleting it's content.
- */
- var deleteRange = function deleteRange(editor, range) {
- if (Range.isCollapsed(range)) {
- return range.anchor;
- } else {
- var _Range$edges9 = Range.edges(range),
- _Range$edges10 = _slicedToArray(_Range$edges9, 2),
- end = _Range$edges10[1];
- var pointRef = Editor.pointRef(editor, end);
- Transforms["delete"](editor, {
- at: range
- });
- return pointRef.unref();
- }
- };
- var matchPath = function matchPath(editor, path) {
- var _Editor$node5 = Editor.node(editor, path),
- _Editor$node6 = _slicedToArray(_Editor$node5, 1),
- node = _Editor$node6[0];
- return function (n) {
- return n === node;
- };
- };
- 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; }
- 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; }
- var SelectionTransforms = {
- /**
- * Collapse the selection.
- */
- collapse: function collapse(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var _options$edge = options.edge,
- edge = _options$edge === void 0 ? 'anchor' : _options$edge;
- var selection = editor.selection;
- if (!selection) {
- return;
- } else if (edge === 'anchor') {
- Transforms.select(editor, selection.anchor);
- } else if (edge === 'focus') {
- Transforms.select(editor, selection.focus);
- } else if (edge === 'start') {
- var _Range$edges = Range.edges(selection),
- _Range$edges2 = _slicedToArray(_Range$edges, 1),
- start = _Range$edges2[0];
- Transforms.select(editor, start);
- } else if (edge === 'end') {
- var _Range$edges3 = Range.edges(selection),
- _Range$edges4 = _slicedToArray(_Range$edges3, 2),
- end = _Range$edges4[1];
- Transforms.select(editor, end);
- }
- },
- /**
- * Unset the selection.
- */
- deselect: function deselect(editor) {
- var selection = editor.selection;
- if (selection) {
- editor.apply({
- type: 'set_selection',
- properties: selection,
- newProperties: null
- });
- }
- },
- /**
- * Move the selection's point forward or backward.
- */
- move: function move(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var selection = editor.selection;
- var _options$distance = options.distance,
- distance = _options$distance === void 0 ? 1 : _options$distance,
- _options$unit = options.unit,
- unit = _options$unit === void 0 ? 'character' : _options$unit,
- _options$reverse = options.reverse,
- reverse = _options$reverse === void 0 ? false : _options$reverse;
- var _options$edge2 = options.edge,
- edge = _options$edge2 === void 0 ? null : _options$edge2;
- if (!selection) {
- return;
- }
- if (edge === 'start') {
- edge = Range.isBackward(selection) ? 'focus' : 'anchor';
- }
- if (edge === 'end') {
- edge = Range.isBackward(selection) ? 'anchor' : 'focus';
- }
- var anchor = selection.anchor,
- focus = selection.focus;
- var opts = {
- distance: distance,
- unit: unit
- };
- var props = {};
- if (edge == null || edge === 'anchor') {
- var point = reverse ? Editor.before(editor, anchor, opts) : Editor.after(editor, anchor, opts);
- if (point) {
- props.anchor = point;
- }
- }
- if (edge == null || edge === 'focus') {
- var _point = reverse ? Editor.before(editor, focus, opts) : Editor.after(editor, focus, opts);
- if (_point) {
- props.focus = _point;
- }
- }
- Transforms.setSelection(editor, props);
- },
- /**
- * Set the selection to a new value.
- */
- select: function select(editor, target) {
- var selection = editor.selection;
- target = Editor.range(editor, target);
- if (selection) {
- Transforms.setSelection(editor, target);
- return;
- }
- if (!Range.isRange(target)) {
- 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)));
- }
- editor.apply({
- type: 'set_selection',
- properties: selection,
- newProperties: target
- });
- },
- /**
- * Set new properties on one of the selection's points.
- */
- setPoint: function setPoint(editor, props) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var selection = editor.selection;
- var _options$edge3 = options.edge,
- edge = _options$edge3 === void 0 ? 'both' : _options$edge3;
- if (!selection) {
- return;
- }
- if (edge === 'start') {
- edge = Range.isBackward(selection) ? 'focus' : 'anchor';
- }
- if (edge === 'end') {
- edge = Range.isBackward(selection) ? 'anchor' : 'focus';
- }
- var anchor = selection.anchor,
- focus = selection.focus;
- var point = edge === 'anchor' ? anchor : focus;
- Transforms.setSelection(editor, _defineProperty({}, edge === 'anchor' ? 'anchor' : 'focus', _objectSpread$1(_objectSpread$1({}, point), props)));
- },
- /**
- * Set new properties on the selection.
- */
- setSelection: function setSelection(editor, props) {
- var selection = editor.selection;
- var oldProps = {};
- var newProps = {};
- if (!selection) {
- return;
- }
- for (var k in props) {
- 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]) {
- oldProps[k] = selection[k];
- newProps[k] = props[k];
- }
- }
- if (Object.keys(oldProps).length > 0) {
- editor.apply({
- type: 'set_selection',
- properties: oldProps,
- newProperties: newProps
- });
- }
- }
- };
- 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; } } }; }
- 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); }
- 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; }
- var TextTransforms = {
- /**
- * Delete content in the editor.
- */
- "delete": function _delete(editor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- Editor.withoutNormalizing(editor, function () {
- var _options$reverse = options.reverse,
- reverse = _options$reverse === void 0 ? false : _options$reverse,
- _options$unit = options.unit,
- unit = _options$unit === void 0 ? 'character' : _options$unit,
- _options$distance = options.distance,
- distance = _options$distance === void 0 ? 1 : _options$distance,
- _options$voids = options.voids,
- voids = _options$voids === void 0 ? false : _options$voids;
- var _options$at = options.at,
- at = _options$at === void 0 ? editor.selection : _options$at,
- _options$hanging = options.hanging,
- hanging = _options$hanging === void 0 ? false : _options$hanging;
- if (!at) {
- return;
- }
- if (Range.isRange(at) && Range.isCollapsed(at)) {
- at = at.anchor;
- }
- if (Point.isPoint(at)) {
- var furthestVoid = Editor["void"](editor, {
- at: at,
- mode: 'highest'
- });
- if (!voids && furthestVoid) {
- var _furthestVoid = _slicedToArray(furthestVoid, 2),
- voidPath = _furthestVoid[1];
- at = voidPath;
- } else {
- var opts = {
- unit: unit,
- distance: distance
- };
- var target = reverse ? Editor.before(editor, at, opts) || Editor.start(editor, []) : Editor.after(editor, at, opts) || Editor.end(editor, []);
- at = {
- anchor: at,
- focus: target
- };
- hanging = true;
- }
- }
- if (Path.isPath(at)) {
- Transforms.removeNodes(editor, {
- at: at,
- voids: voids
- });
- return;
- }
- if (Range.isCollapsed(at)) {
- return;
- }
- if (!hanging) {
- var _Range$edges = Range.edges(at),
- _Range$edges2 = _slicedToArray(_Range$edges, 2),
- _end = _Range$edges2[1];
- var endOfDoc = Editor.end(editor, []);
- if (!Point.equals(_end, endOfDoc)) {
- at = Editor.unhangRange(editor, at, {
- voids: voids
- });
- }
- }
- var _Range$edges3 = Range.edges(at),
- _Range$edges4 = _slicedToArray(_Range$edges3, 2),
- start = _Range$edges4[0],
- end = _Range$edges4[1];
- var startBlock = Editor.above(editor, {
- match: function match(n) {
- return Editor.isBlock(editor, n);
- },
- at: start,
- voids: voids
- });
- var endBlock = Editor.above(editor, {
- match: function match(n) {
- return Editor.isBlock(editor, n);
- },
- at: end,
- voids: voids
- });
- var isAcrossBlocks = startBlock && endBlock && !Path.equals(startBlock[1], endBlock[1]);
- var isSingleText = Path.equals(start.path, end.path);
- var startVoid = voids ? null : Editor["void"](editor, {
- at: start,
- mode: 'highest'
- });
- var endVoid = voids ? null : Editor["void"](editor, {
- at: end,
- mode: 'highest'
- }); // If the start or end points are inside an inline void, nudge them out.
- if (startVoid) {
- var before = Editor.before(editor, start);
- if (before && startBlock && Path.isAncestor(startBlock[1], before.path)) {
- start = before;
- }
- }
- if (endVoid) {
- var after = Editor.after(editor, end);
- if (after && endBlock && Path.isAncestor(endBlock[1], after.path)) {
- end = after;
- }
- } // Get the highest nodes that are completely inside the range, as well as
- // the start and end nodes.
- var matches = [];
- var lastPath;
- var _iterator = _createForOfIteratorHelper(Editor.nodes(editor, {
- at: at,
- voids: voids
- })),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var entry = _step.value;
- var _entry = _slicedToArray(entry, 2),
- _node2 = _entry[0],
- _path3 = _entry[1];
- if (lastPath && Path.compare(_path3, lastPath) === 0) {
- continue;
- }
- if (!voids && Editor.isVoid(editor, _node2) || !Path.isCommon(_path3, start.path) && !Path.isCommon(_path3, end.path)) {
- matches.push(entry);
- lastPath = _path3;
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- var pathRefs = Array.from(matches, function (_ref) {
- var _ref2 = _slicedToArray(_ref, 2),
- p = _ref2[1];
- return Editor.pathRef(editor, p);
- });
- var startRef = Editor.pointRef(editor, start);
- var endRef = Editor.pointRef(editor, end);
- if (!isSingleText && !startVoid) {
- var _point = startRef.current;
- var _Editor$leaf = Editor.leaf(editor, _point),
- _Editor$leaf2 = _slicedToArray(_Editor$leaf, 1),
- node = _Editor$leaf2[0];
- var path = _point.path;
- var _start = start,
- offset = _start.offset;
- var text = node.text.slice(offset);
- if (text.length > 0) editor.apply({
- type: 'remove_text',
- path: path,
- offset: offset,
- text: text
- });
- }
- for (var _i = 0, _pathRefs = pathRefs; _i < _pathRefs.length; _i++) {
- var pathRef = _pathRefs[_i];
- var _path = pathRef.unref();
- Transforms.removeNodes(editor, {
- at: _path,
- voids: voids
- });
- }
- if (!endVoid) {
- var _point2 = endRef.current;
- var _Editor$leaf3 = Editor.leaf(editor, _point2),
- _Editor$leaf4 = _slicedToArray(_Editor$leaf3, 1),
- _node = _Editor$leaf4[0];
- var _path2 = _point2.path;
- var _offset = isSingleText ? start.offset : 0;
- var _text = _node.text.slice(_offset, end.offset);
- if (_text.length > 0) editor.apply({
- type: 'remove_text',
- path: _path2,
- offset: _offset,
- text: _text
- });
- }
- if (!isSingleText && isAcrossBlocks && endRef.current && startRef.current) {
- Transforms.mergeNodes(editor, {
- at: endRef.current,
- hanging: true,
- voids: voids
- });
- }
- var point = reverse ? startRef.unref() || endRef.unref() : endRef.unref() || startRef.unref();
- if (options.at == null && point) {
- Transforms.select(editor, point);
- }
- });
- },
- /**
- * Insert a fragment at a specific location in the editor.
- */
- insertFragment: function insertFragment(editor, fragment) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- Editor.withoutNormalizing(editor, function () {
- var _options$hanging2 = options.hanging,
- hanging = _options$hanging2 === void 0 ? false : _options$hanging2,
- _options$voids2 = options.voids,
- voids = _options$voids2 === void 0 ? false : _options$voids2;
- var _options$at2 = options.at,
- at = _options$at2 === void 0 ? editor.selection : _options$at2;
- if (!fragment.length) {
- return;
- }
- if (!at) {
- return;
- } else if (Range.isRange(at)) {
- if (!hanging) {
- at = Editor.unhangRange(editor, at);
- }
- if (Range.isCollapsed(at)) {
- at = at.anchor;
- } else {
- var _Range$edges5 = Range.edges(at),
- _Range$edges6 = _slicedToArray(_Range$edges5, 2),
- end = _Range$edges6[1];
- if (!voids && Editor["void"](editor, {
- at: end
- })) {
- return;
- }
- var pointRef = Editor.pointRef(editor, end);
- Transforms["delete"](editor, {
- at: at
- });
- at = pointRef.unref();
- }
- } else if (Path.isPath(at)) {
- at = Editor.start(editor, at);
- }
- if (!voids && Editor["void"](editor, {
- at: at
- })) {
- return;
- } // If the insert point is at the edge of an inline node, move it outside
- // instead since it will need to be split otherwise.
- var inlineElementMatch = Editor.above(editor, {
- at: at,
- match: function match(n) {
- return Editor.isInline(editor, n);
- },
- mode: 'highest',
- voids: voids
- });
- if (inlineElementMatch) {
- var _inlineElementMatch = _slicedToArray(inlineElementMatch, 2),
- _inlinePath = _inlineElementMatch[1];
- if (Editor.isEnd(editor, at, _inlinePath)) {
- var after = Editor.after(editor, _inlinePath);
- at = after;
- } else if (Editor.isStart(editor, at, _inlinePath)) {
- var before = Editor.before(editor, _inlinePath);
- at = before;
- }
- }
- var blockMatch = Editor.above(editor, {
- match: function match(n) {
- return Editor.isBlock(editor, n);
- },
- at: at,
- voids: voids
- });
- var _blockMatch = _slicedToArray(blockMatch, 2),
- blockPath = _blockMatch[1];
- var isBlockStart = Editor.isStart(editor, at, blockPath);
- var isBlockEnd = Editor.isEnd(editor, at, blockPath);
- var isBlockEmpty = isBlockStart && isBlockEnd;
- var mergeStart = !isBlockStart || isBlockStart && isBlockEnd;
- var mergeEnd = !isBlockEnd;
- var _Node$first = Node$1.first({
- children: fragment
- }, []),
- _Node$first2 = _slicedToArray(_Node$first, 2),
- firstPath = _Node$first2[1];
- var _Node$last = Node$1.last({
- children: fragment
- }, []),
- _Node$last2 = _slicedToArray(_Node$last, 2),
- lastPath = _Node$last2[1];
- var matches = [];
- var matcher = function matcher(_ref3) {
- var _ref4 = _slicedToArray(_ref3, 2),
- n = _ref4[0],
- p = _ref4[1];
- var isRoot = p.length === 0;
- if (isRoot) {
- return false;
- }
- if (isBlockEmpty) {
- return true;
- }
- if (mergeStart && Path.isAncestor(p, firstPath) && Element$1.isElement(n) && !editor.isVoid(n) && !editor.isInline(n)) {
- return false;
- }
- if (mergeEnd && Path.isAncestor(p, lastPath) && Element$1.isElement(n) && !editor.isVoid(n) && !editor.isInline(n)) {
- return false;
- }
- return true;
- };
- var _iterator2 = _createForOfIteratorHelper(Node$1.nodes({
- children: fragment
- }, {
- pass: matcher
- })),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var entry = _step2.value;
- if (matcher(entry)) {
- matches.push(entry);
- }
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- var starts = [];
- var middles = [];
- var ends = [];
- var starting = true;
- var hasBlocks = false;
- for (var _i2 = 0, _matches = matches; _i2 < _matches.length; _i2++) {
- var _matches$_i = _slicedToArray(_matches[_i2], 1),
- node = _matches$_i[0];
- if (Element$1.isElement(node) && !editor.isInline(node)) {
- starting = false;
- hasBlocks = true;
- middles.push(node);
- } else if (starting) {
- starts.push(node);
- } else {
- ends.push(node);
- }
- }
- var _Editor$nodes = Editor.nodes(editor, {
- at: at,
- match: function match(n) {
- return Text.isText(n) || Editor.isInline(editor, n);
- },
- mode: 'highest',
- voids: voids
- }),
- _Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
- inlineMatch = _Editor$nodes2[0];
- var _inlineMatch = _slicedToArray(inlineMatch, 2),
- inlinePath = _inlineMatch[1];
- var isInlineStart = Editor.isStart(editor, at, inlinePath);
- var isInlineEnd = Editor.isEnd(editor, at, inlinePath);
- var middleRef = Editor.pathRef(editor, isBlockEnd ? Path.next(blockPath) : blockPath);
- var endRef = Editor.pathRef(editor, isInlineEnd ? Path.next(inlinePath) : inlinePath);
- var blockPathRef = Editor.pathRef(editor, blockPath);
- Transforms.splitNodes(editor, {
- at: at,
- match: function match(n) {
- return hasBlocks ? Editor.isBlock(editor, n) : Text.isText(n) || Editor.isInline(editor, n);
- },
- mode: hasBlocks ? 'lowest' : 'highest',
- voids: voids
- });
- var startRef = Editor.pathRef(editor, !isInlineStart || isInlineStart && isInlineEnd ? Path.next(inlinePath) : inlinePath);
- Transforms.insertNodes(editor, starts, {
- at: startRef.current,
- match: function match(n) {
- return Text.isText(n) || Editor.isInline(editor, n);
- },
- mode: 'highest',
- voids: voids
- });
- if (isBlockEmpty && middles.length) {
- Transforms["delete"](editor, {
- at: blockPathRef.unref(),
- voids: voids
- });
- }
- Transforms.insertNodes(editor, middles, {
- at: middleRef.current,
- match: function match(n) {
- return Editor.isBlock(editor, n);
- },
- mode: 'lowest',
- voids: voids
- });
- Transforms.insertNodes(editor, ends, {
- at: endRef.current,
- match: function match(n) {
- return Text.isText(n) || Editor.isInline(editor, n);
- },
- mode: 'highest',
- voids: voids
- });
- if (!options.at) {
- var path;
- if (ends.length > 0) {
- path = Path.previous(endRef.current);
- } else if (middles.length > 0) {
- path = Path.previous(middleRef.current);
- } else {
- path = Path.previous(startRef.current);
- }
- var _end2 = Editor.end(editor, path);
- Transforms.select(editor, _end2);
- }
- startRef.unref();
- middleRef.unref();
- endRef.unref();
- });
- },
- /**
- * Insert a string of text in the Editor.
- */
- insertText: function insertText(editor, text) {
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- Editor.withoutNormalizing(editor, function () {
- var _options$voids3 = options.voids,
- voids = _options$voids3 === void 0 ? false : _options$voids3;
- var _options$at3 = options.at,
- at = _options$at3 === void 0 ? editor.selection : _options$at3;
- if (!at) {
- return;
- }
- if (Path.isPath(at)) {
- at = Editor.range(editor, at);
- }
- if (Range.isRange(at)) {
- if (Range.isCollapsed(at)) {
- at = at.anchor;
- } else {
- var end = Range.end(at);
- if (!voids && Editor["void"](editor, {
- at: end
- })) {
- return;
- }
- var pointRef = Editor.pointRef(editor, end);
- Transforms["delete"](editor, {
- at: at,
- voids: voids
- });
- at = pointRef.unref();
- Transforms.setSelection(editor, {
- anchor: at,
- focus: at
- });
- }
- }
- if (!voids && Editor["void"](editor, {
- at: at
- })) {
- return;
- }
- var _at = at,
- path = _at.path,
- offset = _at.offset;
- if (text.length > 0) editor.apply({
- type: 'insert_text',
- path: path,
- offset: offset,
- text: text
- });
- });
- }
- };
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
- function _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; }
- var Transforms = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, GeneralTransforms), NodeTransforms), SelectionTransforms), TextTransforms);
- var Editor_1 = Editor;
- var Element_1 = Element$1;
- var Location_1 = Location;
- var Node_1 = Node$1;
- var Operation_1 = Operation;
- var Path_1 = Path;
- var PathRef_1 = PathRef;
- var Point_1 = Point;
- var PointRef_1 = PointRef;
- var Range_1 = Range;
- var RangeRef_1 = RangeRef;
- var Span_1 = Span;
- var Text_1 = Text;
- var Transforms_1 = Transforms;
- var createEditor_1 = createEditor$1;
- var dist$7 = /*#__PURE__*/Object.defineProperty({
- Editor: Editor_1,
- Element: Element_1,
- Location: Location_1,
- Node: Node_1,
- Operation: Operation_1,
- Path: Path_1,
- PathRef: PathRef_1,
- Point: Point_1,
- PointRef: PointRef_1,
- Range: Range_1,
- RangeRef: RangeRef_1,
- Span: Span_1,
- Text: Text_1,
- Transforms: Transforms_1,
- createEditor: createEditor_1
- }, '__esModule', {value: true});
- /**
- * lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
- /** `Object#toString` result references. */
- var argsTag$1 = '[object Arguments]',
- funcTag$1 = '[object Function]',
- genTag$1 = '[object GeneratorFunction]',
- mapTag = '[object Map]',
- objectTag = '[object Object]',
- promiseTag = '[object Promise]',
- setTag = '[object Set]',
- stringTag = '[object String]',
- weakMapTag = '[object WeakMap]';
- var dataViewTag = '[object DataView]';
- /**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
- /** Used to detect host constructors (Safari). */
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
- /** Used to detect unsigned integer values. */
- var reIsUint$1 = /^(?:0|[1-9]\d*)$/;
- /** Used to compose unicode character classes. */
- var rsAstralRange$1 = '\\ud800-\\udfff',
- rsComboMarksRange$1 = '\\u0300-\\u036f\\ufe20-\\ufe23',
- rsComboSymbolsRange$1 = '\\u20d0-\\u20f0',
- rsVarRange$1 = '\\ufe0e\\ufe0f';
- /** Used to compose unicode capture groups. */
- var rsAstral$1 = '[' + rsAstralRange$1 + ']',
- rsCombo$1 = '[' + rsComboMarksRange$1 + rsComboSymbolsRange$1 + ']',
- rsFitz$1 = '\\ud83c[\\udffb-\\udfff]',
- rsModifier$1 = '(?:' + rsCombo$1 + '|' + rsFitz$1 + ')',
- rsNonAstral$1 = '[^' + rsAstralRange$1 + ']',
- rsRegional$1 = '(?:\\ud83c[\\udde6-\\uddff]){2}',
- rsSurrPair$1 = '[\\ud800-\\udbff][\\udc00-\\udfff]',
- rsZWJ$1 = '\\u200d';
- /** Used to compose unicode regexes. */
- var reOptMod$1 = rsModifier$1 + '?',
- rsOptVar$1 = '[' + rsVarRange$1 + ']?',
- rsOptJoin$1 = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsOptVar$1 + reOptMod$1 + ')*',
- rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1,
- rsSymbol$1 = '(?:' + [rsNonAstral$1 + rsCombo$1 + '?', rsCombo$1, rsRegional$1, rsSurrPair$1, rsAstral$1].join('|') + ')';
- /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
- var reUnicode$1 = RegExp(rsFitz$1 + '(?=' + rsFitz$1 + ')|' + rsSymbol$1 + rsSeq$1, 'g');
- /** 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/). */
- var reHasUnicode$1 = RegExp('[' + rsZWJ$1 + rsAstralRange$1 + rsComboMarksRange$1 + rsComboSymbolsRange$1 + rsVarRange$1 + ']');
- /** Detect free variable `global` from Node.js. */
- var freeGlobal$3 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
- /** Detect free variable `self`. */
- var freeSelf$3 = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root$3 = freeGlobal$3 || freeSelf$3 || Function('return this')();
- /**
- * A specialized version of `_.map` for arrays without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- */
- function arrayMap(array, iteratee) {
- var index = -1,
- length = array ? array.length : 0,
- result = Array(length);
- while (++index < length) {
- result[index] = iteratee(array[index], index, array);
- }
- return result;
- }
- /**
- * Converts an ASCII `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */
- function asciiToArray$1(string) {
- return string.split('');
- }
- /**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
- function baseTimes$1(n, iteratee) {
- var index = -1,
- result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- /**
- * The base implementation of `_.values` and `_.valuesIn` which creates an
- * array of `object` property values corresponding to the property names
- * of `props`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array} props The property names to get values for.
- * @returns {Object} Returns the array of property values.
- */
- function baseValues(object, props) {
- return arrayMap(props, function(key) {
- return object[key];
- });
- }
- /**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */
- function getValue(object, key) {
- return object == null ? undefined : object[key];
- }
- /**
- * Checks if `string` contains Unicode symbols.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {boolean} Returns `true` if a symbol is found, else `false`.
- */
- function hasUnicode$1(string) {
- return reHasUnicode$1.test(string);
- }
- /**
- * Checks if `value` is a host object in IE < 9.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
- */
- function isHostObject(value) {
- // Many host objects are `Object` objects that can coerce to strings
- // despite having improperly defined `toString` methods.
- var result = false;
- if (value != null && typeof value.toString != 'function') {
- try {
- result = !!(value + '');
- } catch (e) {}
- }
- return result;
- }
- /**
- * Converts `iterator` to an array.
- *
- * @private
- * @param {Object} iterator The iterator to convert.
- * @returns {Array} Returns the converted array.
- */
- function iteratorToArray(iterator) {
- var data,
- result = [];
- while (!(data = iterator.next()).done) {
- result.push(data.value);
- }
- return result;
- }
- /**
- * Converts `map` to its key-value pairs.
- *
- * @private
- * @param {Object} map The map to convert.
- * @returns {Array} Returns the key-value pairs.
- */
- function mapToArray(map) {
- var index = -1,
- result = Array(map.size);
- map.forEach(function(value, key) {
- result[++index] = [key, value];
- });
- return result;
- }
- /**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */
- function overArg$1(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
- /**
- * Converts `set` to an array of its values.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the values.
- */
- function setToArray(set) {
- var index = -1,
- result = Array(set.size);
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
- }
- /**
- * Converts `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */
- function stringToArray$1(string) {
- return hasUnicode$1(string)
- ? unicodeToArray$1(string)
- : asciiToArray$1(string);
- }
- /**
- * Converts a Unicode `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */
- function unicodeToArray$1(string) {
- return string.match(reUnicode$1) || [];
- }
- /** Used for built-in method references. */
- var funcProto = Function.prototype,
- objectProto$4 = Object.prototype;
- /** Used to detect overreaching core-js shims. */
- var coreJsData = root$3['__core-js_shared__'];
- /** Used to detect methods masquerading as native. */
- var maskSrcKey = (function() {
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
- return uid ? ('Symbol(src)_1.' + uid) : '';
- }());
- /** Used to resolve the decompiled source of functions. */
- var funcToString = funcProto.toString;
- /** Used to check objects for own properties. */
- var hasOwnProperty$2 = objectProto$4.hasOwnProperty;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString$4 = objectProto$4.toString;
- /** Used to detect if a method is native. */
- var reIsNative = RegExp('^' +
- funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
- );
- /** Built-in value references. */
- var Symbol$2 = root$3.Symbol,
- iteratorSymbol = Symbol$2 ? Symbol$2.iterator : undefined,
- propertyIsEnumerable$1 = objectProto$4.propertyIsEnumerable;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeKeys$1 = overArg$1(Object.keys, Object);
- /* Built-in method references that are verified to be native. */
- var DataView = getNative(root$3, 'DataView'),
- Map$1 = getNative(root$3, 'Map'),
- Promise$1 = getNative(root$3, 'Promise'),
- Set$1 = getNative(root$3, 'Set'),
- WeakMap$1 = getNative(root$3, 'WeakMap');
- /** Used to detect maps, sets, and weakmaps. */
- var dataViewCtorString = toSource(DataView),
- mapCtorString = toSource(Map$1),
- promiseCtorString = toSource(Promise$1),
- setCtorString = toSource(Set$1),
- weakMapCtorString = toSource(WeakMap$1);
- /**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */
- function arrayLikeKeys$1(value, inherited) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- // Safari 9 makes `arguments.length` enumerable in strict mode.
- var result = (isArray$1(value) || isArguments$1(value))
- ? baseTimes$1(value.length, String)
- : [];
- var length = result.length,
- skipIndexes = !!length;
- for (var key in value) {
- if ((inherited || hasOwnProperty$2.call(value, key)) &&
- !(skipIndexes && (key == 'length' || isIndex$1(key, length)))) {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * The base implementation of `getTag`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- function baseGetTag(value) {
- return objectToString$4.call(value);
- }
- /**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */
- function baseIsNative(value) {
- if (!isObject$3(value) || isMasked(value)) {
- return false;
- }
- var pattern = (isFunction$1(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
- return pattern.test(toSource(value));
- }
- /**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function baseKeys$1(object) {
- if (!isPrototype$1(object)) {
- return nativeKeys$1(object);
- }
- var result = [];
- for (var key in Object(object)) {
- if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * Copies the values of `source` to `array`.
- *
- * @private
- * @param {Array} source The array to copy values from.
- * @param {Array} [array=[]] The array to copy values to.
- * @returns {Array} Returns `array`.
- */
- function copyArray(source, array) {
- var index = -1,
- length = source.length;
- array || (array = Array(length));
- while (++index < length) {
- array[index] = source[index];
- }
- return array;
- }
- /**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */
- function getNative(object, key) {
- var value = getValue(object, key);
- return baseIsNative(value) ? value : undefined;
- }
- /**
- * Gets the `toStringTag` of `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- var getTag = baseGetTag;
- // Fallback for data views, maps, sets, and weak maps in IE 11,
- // for data views in Edge < 14, and promises in Node.js.
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
- (Map$1 && getTag(new Map$1) != mapTag) ||
- (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
- (Set$1 && getTag(new Set$1) != setTag) ||
- (WeakMap$1 && getTag(new WeakMap$1) != weakMapTag)) {
- getTag = function(value) {
- var result = objectToString$4.call(value),
- Ctor = result == objectTag ? value.constructor : undefined,
- ctorString = Ctor ? toSource(Ctor) : undefined;
- if (ctorString) {
- switch (ctorString) {
- case dataViewCtorString: return dataViewTag;
- case mapCtorString: return mapTag;
- case promiseCtorString: return promiseTag;
- case setCtorString: return setTag;
- case weakMapCtorString: return weakMapTag;
- }
- }
- return result;
- };
- }
- /**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex$1(value, length) {
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
- return !!length &&
- (typeof value == 'number' || reIsUint$1.test(value)) &&
- (value > -1 && value % 1 == 0 && value < length);
- }
- /**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
- */
- function isMasked(func) {
- return !!maskSrcKey && (maskSrcKey in func);
- }
- /**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */
- function isPrototype$1(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$4;
- return value === proto;
- }
- /**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to process.
- * @returns {string} Returns the source code.
- */
- function toSource(func) {
- if (func != null) {
- try {
- return funcToString.call(func);
- } catch (e) {}
- try {
- return (func + '');
- } catch (e) {}
- }
- return '';
- }
- /**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
- function isArguments$1(value) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- return isArrayLikeObject$1(value) && hasOwnProperty$2.call(value, 'callee') &&
- (!propertyIsEnumerable$1.call(value, 'callee') || objectToString$4.call(value) == argsTag$1);
- }
- /**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */
- var isArray$1 = Array.isArray;
- /**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
- function isArrayLike$1(value) {
- return value != null && isLength$1(value.length) && !isFunction$1(value);
- }
- /**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object,
- * else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */
- function isArrayLikeObject$1(value) {
- return isObjectLike$4(value) && isArrayLike$1(value);
- }
- /**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
- function isFunction$1(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
- var tag = isObject$3(value) ? objectToString$4.call(value) : '';
- return tag == funcTag$1 || tag == genTag$1;
- }
- /**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
- function isLength$1(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
- }
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject$3(value) {
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
- }
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike$4(value) {
- return !!value && typeof value == 'object';
- }
- /**
- * Checks if `value` is classified as a `String` primitive or object.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a string, else `false`.
- * @example
- *
- * _.isString('abc');
- * // => true
- *
- * _.isString(1);
- * // => false
- */
- function isString(value) {
- return typeof value == 'string' ||
- (!isArray$1(value) && isObjectLike$4(value) && objectToString$4.call(value) == stringTag);
- }
- /**
- * Converts `value` to an array.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {Array} Returns the converted array.
- * @example
- *
- * _.toArray({ 'a': 1, 'b': 2 });
- * // => [1, 2]
- *
- * _.toArray('abc');
- * // => ['a', 'b', 'c']
- *
- * _.toArray(1);
- * // => []
- *
- * _.toArray(null);
- * // => []
- */
- function toArray(value) {
- if (!value) {
- return [];
- }
- if (isArrayLike$1(value)) {
- return isString(value) ? stringToArray$1(value) : copyArray(value);
- }
- if (iteratorSymbol && value[iteratorSymbol]) {
- return iteratorToArray(value[iteratorSymbol]());
- }
- var tag = getTag(value),
- func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
- return func(value);
- }
- /**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
- function keys$1(object) {
- return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys$1(object);
- }
- /**
- * Creates an array of the own enumerable string keyed property values of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property values.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.values(new Foo);
- * // => [1, 2] (iteration order is not guaranteed)
- *
- * _.values('hi');
- * // => ['h', 'i']
- */
- function values(object) {
- return object ? baseValues(object, keys$1(object)) : [];
- }
- var lodash_toarray = toArray;
- /**
- * SSR Window 3.0.0
- * Better handling for window object in SSR environment
- * https://github.com/nolimits4web/ssr-window
- *
- * Copyright 2020, Vladimir Kharlampidi
- *
- * Licensed under MIT
- *
- * Released on: November 9, 2020
- */
- var ssrWindow_umd = createCommonjsModule$1(function (module, exports) {
- (function (global, factory) {
- factory(exports) ;
- }(commonjsGlobal, (function (exports) {
- /* eslint-disable no-param-reassign */
- function isObject(obj) {
- return (obj !== null &&
- typeof obj === 'object' &&
- 'constructor' in obj &&
- obj.constructor === Object);
- }
- function extend(target, src) {
- if (target === void 0) { target = {}; }
- if (src === void 0) { src = {}; }
- Object.keys(src).forEach(function (key) {
- if (typeof target[key] === 'undefined')
- target[key] = src[key];
- else if (isObject(src[key]) &&
- isObject(target[key]) &&
- Object.keys(src[key]).length > 0) {
- extend(target[key], src[key]);
- }
- });
- }
- var ssrDocument = {
- body: {},
- addEventListener: function () { },
- removeEventListener: function () { },
- activeElement: {
- blur: function () { },
- nodeName: '',
- },
- querySelector: function () {
- return null;
- },
- querySelectorAll: function () {
- return [];
- },
- getElementById: function () {
- return null;
- },
- createEvent: function () {
- return {
- initEvent: function () { },
- };
- },
- createElement: function () {
- return {
- children: [],
- childNodes: [],
- style: {},
- setAttribute: function () { },
- getElementsByTagName: function () {
- return [];
- },
- };
- },
- createElementNS: function () {
- return {};
- },
- importNode: function () {
- return null;
- },
- location: {
- hash: '',
- host: '',
- hostname: '',
- href: '',
- origin: '',
- pathname: '',
- protocol: '',
- search: '',
- },
- };
- function getDocument() {
- var doc = typeof document !== 'undefined' ? document : {};
- extend(doc, ssrDocument);
- return doc;
- }
- var ssrWindow = {
- document: ssrDocument,
- navigator: {
- userAgent: '',
- },
- location: {
- hash: '',
- host: '',
- hostname: '',
- href: '',
- origin: '',
- pathname: '',
- protocol: '',
- search: '',
- },
- history: {
- replaceState: function () { },
- pushState: function () { },
- go: function () { },
- back: function () { },
- },
- CustomEvent: function CustomEvent() {
- return this;
- },
- addEventListener: function () { },
- removeEventListener: function () { },
- getComputedStyle: function () {
- return {
- getPropertyValue: function () {
- return '';
- },
- };
- },
- Image: function () { },
- Date: function () { },
- screen: {},
- setTimeout: function () { },
- clearTimeout: function () { },
- matchMedia: function () {
- return {};
- },
- requestAnimationFrame: function (callback) {
- if (typeof setTimeout === 'undefined') {
- callback();
- return null;
- }
- return setTimeout(callback, 0);
- },
- cancelAnimationFrame: function (id) {
- if (typeof setTimeout === 'undefined') {
- return;
- }
- clearTimeout(id);
- },
- };
- function getWindow() {
- var win = typeof window !== 'undefined' ? window : {};
- extend(win, ssrWindow);
- return win;
- }
- exports.extend = extend;
- exports.getDocument = getDocument;
- exports.getWindow = getWindow;
- exports.ssrDocument = ssrDocument;
- exports.ssrWindow = ssrWindow;
- Object.defineProperty(exports, '__esModule', { value: true });
- })));
- });
- /**
- * Dom7 3.0.0
- * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
- * https://framework7.io/docs/dom7.html
- *
- * Copyright 2020, Vladimir Kharlampidi
- *
- * Licensed under MIT
- *
- * Released on: November 9, 2020
- */
- function _inheritsLoose(subClass, superClass) {
- subClass.prototype = Object.create(superClass.prototype);
- subClass.prototype.constructor = subClass;
- subClass.__proto__ = superClass;
- }
- function _getPrototypeOf(o) {
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
- return o.__proto__ || Object.getPrototypeOf(o);
- };
- return _getPrototypeOf(o);
- }
- function _setPrototypeOf(o, p) {
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
- o.__proto__ = p;
- return o;
- };
- return _setPrototypeOf(o, p);
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
- if (Reflect.construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
- }
- function _construct(Parent, args, Class) {
- if (_isNativeReflectConstruct()) {
- _construct = Reflect.construct;
- } else {
- _construct = function _construct(Parent, args, Class) {
- var a = [null];
- a.push.apply(a, args);
- var Constructor = Function.bind.apply(Parent, a);
- var instance = new Constructor();
- if (Class) _setPrototypeOf(instance, Class.prototype);
- return instance;
- };
- }
- return _construct.apply(null, arguments);
- }
- function _isNativeFunction(fn) {
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
- }
- function _wrapNativeSuper(Class) {
- var _cache = typeof Map === "function" ? new Map() : undefined;
- _wrapNativeSuper = function _wrapNativeSuper(Class) {
- if (Class === null || !_isNativeFunction(Class)) return Class;
- if (typeof Class !== "function") {
- throw new TypeError("Super expression must either be null or a function");
- }
- if (typeof _cache !== "undefined") {
- if (_cache.has(Class)) return _cache.get(Class);
- _cache.set(Class, Wrapper);
- }
- function Wrapper() {
- return _construct(Class, arguments, _getPrototypeOf(this).constructor);
- }
- Wrapper.prototype = Object.create(Class.prototype, {
- constructor: {
- value: Wrapper,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- return _setPrototypeOf(Wrapper, Class);
- };
- return _wrapNativeSuper(Class);
- }
- function _assertThisInitialized(self) {
- if (self === void 0) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return self;
- }
- /* eslint-disable no-proto */
- function makeReactive(obj) {
- var proto = obj.__proto__;
- Object.defineProperty(obj, '__proto__', {
- get: function get() {
- return proto;
- },
- set: function set(value) {
- proto.__proto__ = value;
- }
- });
- }
- var Dom7 = /*#__PURE__*/function (_Array) {
- _inheritsLoose(Dom7, _Array);
- function Dom7(items) {
- var _this;
- _this = _Array.call.apply(_Array, [this].concat(items)) || this;
- makeReactive(_assertThisInitialized(_this));
- return _this;
- }
- return Dom7;
- }( /*#__PURE__*/_wrapNativeSuper(Array));
- function arrayFlat(arr) {
- if (arr === void 0) {
- arr = [];
- }
- var res = [];
- arr.forEach(function (el) {
- if (Array.isArray(el)) {
- res.push.apply(res, arrayFlat(el));
- } else {
- res.push(el);
- }
- });
- return res;
- }
- function arrayFilter(arr, callback) {
- return Array.prototype.filter.call(arr, callback);
- }
- function arrayUnique(arr) {
- var uniqueArray = [];
- for (var i = 0; i < arr.length; i += 1) {
- if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]);
- }
- return uniqueArray;
- }
- function toCamelCase(string) {
- return string.toLowerCase().replace(/-(.)/g, function (match, group) {
- return group.toUpperCase();
- });
- }
- function qsa(selector, context) {
- if (typeof selector !== 'string') {
- return [selector];
- }
- var a = [];
- var res = context.querySelectorAll(selector);
- for (var i = 0; i < res.length; i += 1) {
- a.push(res[i]);
- }
- return a;
- }
- function $(selector, context) {
- var window = ssrWindow_umd.getWindow();
- var document = ssrWindow_umd.getDocument();
- var arr = [];
- if (!context && selector instanceof Dom7) {
- return selector;
- }
- if (!selector) {
- return new Dom7(arr);
- }
- if (typeof selector === 'string') {
- var html = selector.trim();
- if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
- var toCreate = 'div';
- if (html.indexOf('<li') === 0) toCreate = 'ul';
- if (html.indexOf('<tr') === 0) toCreate = 'tbody';
- if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
- if (html.indexOf('<tbody') === 0) toCreate = 'table';
- if (html.indexOf('<option') === 0) toCreate = 'select';
- var tempParent = document.createElement(toCreate);
- tempParent.innerHTML = html;
- for (var i = 0; i < tempParent.childNodes.length; i += 1) {
- arr.push(tempParent.childNodes[i]);
- }
- } else {
- arr = qsa(selector.trim(), context || document);
- } // arr = qsa(selector, document);
- } else if (selector.nodeType || selector === window || selector === document) {
- arr.push(selector);
- } else if (Array.isArray(selector)) {
- if (selector instanceof Dom7) return selector;
- arr = selector;
- }
- return new Dom7(arrayUnique(arr));
- }
- $.fn = Dom7.prototype;
- function addClass() {
- for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {
- classes[_key] = arguments[_key];
- }
- var classNames = arrayFlat(classes.map(function (c) {
- return c.split(' ');
- }));
- this.forEach(function (el) {
- var _el$classList;
- (_el$classList = el.classList).add.apply(_el$classList, classNames);
- });
- return this;
- }
- function removeClass() {
- for (var _len2 = arguments.length, classes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- classes[_key2] = arguments[_key2];
- }
- var classNames = arrayFlat(classes.map(function (c) {
- return c.split(' ');
- }));
- this.forEach(function (el) {
- var _el$classList2;
- (_el$classList2 = el.classList).remove.apply(_el$classList2, classNames);
- });
- return this;
- }
- function toggleClass() {
- for (var _len3 = arguments.length, classes = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- classes[_key3] = arguments[_key3];
- }
- var classNames = arrayFlat(classes.map(function (c) {
- return c.split(' ');
- }));
- this.forEach(function (el) {
- classNames.forEach(function (className) {
- el.classList.toggle(className);
- });
- });
- }
- function hasClass() {
- for (var _len4 = arguments.length, classes = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
- classes[_key4] = arguments[_key4];
- }
- var classNames = arrayFlat(classes.map(function (c) {
- return c.split(' ');
- }));
- return arrayFilter(this, function (el) {
- return classNames.filter(function (className) {
- return el.classList.contains(className);
- }).length > 0;
- }).length > 0;
- }
- function attr(attrs, value) {
- if (arguments.length === 1 && typeof attrs === 'string') {
- // Get attr
- if (this[0]) return this[0].getAttribute(attrs);
- return undefined;
- } // Set attrs
- for (var i = 0; i < this.length; i += 1) {
- if (arguments.length === 2) {
- // String
- this[i].setAttribute(attrs, value);
- } else {
- // Object
- for (var attrName in attrs) {
- this[i][attrName] = attrs[attrName];
- this[i].setAttribute(attrName, attrs[attrName]);
- }
- }
- }
- return this;
- }
- function removeAttr(attr) {
- for (var i = 0; i < this.length; i += 1) {
- this[i].removeAttribute(attr);
- }
- return this;
- }
- function prop(props, value) {
- if (arguments.length === 1 && typeof props === 'string') {
- // Get prop
- if (this[0]) return this[0][props];
- } else {
- // Set props
- for (var i = 0; i < this.length; i += 1) {
- if (arguments.length === 2) {
- // String
- this[i][props] = value;
- } else {
- // Object
- for (var propName in props) {
- this[i][propName] = props[propName];
- }
- }
- }
- return this;
- }
- return this;
- }
- function data(key, value) {
- var el;
- if (typeof value === 'undefined') {
- el = this[0];
- if (!el) return undefined; // Get value
- if (el.dom7ElementDataStorage && key in el.dom7ElementDataStorage) {
- return el.dom7ElementDataStorage[key];
- }
- var dataKey = el.getAttribute("data-" + key);
- if (dataKey) {
- return dataKey;
- }
- return undefined;
- } // Set value
- for (var i = 0; i < this.length; i += 1) {
- el = this[i];
- if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};
- el.dom7ElementDataStorage[key] = value;
- }
- return this;
- }
- function removeData(key) {
- for (var i = 0; i < this.length; i += 1) {
- var el = this[i];
- if (el.dom7ElementDataStorage && el.dom7ElementDataStorage[key]) {
- el.dom7ElementDataStorage[key] = null;
- delete el.dom7ElementDataStorage[key];
- }
- }
- }
- function dataset() {
- var el = this[0];
- if (!el) return undefined;
- var dataset = {}; // eslint-disable-line
- if (el.dataset) {
- for (var dataKey in el.dataset) {
- dataset[dataKey] = el.dataset[dataKey];
- }
- } else {
- for (var i = 0; i < el.attributes.length; i += 1) {
- var _attr = el.attributes[i];
- if (_attr.name.indexOf('data-') >= 0) {
- dataset[toCamelCase(_attr.name.split('data-')[1])] = _attr.value;
- }
- }
- }
- for (var key in dataset) {
- 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;
- }
- return dataset;
- }
- function val(value) {
- if (typeof value === 'undefined') {
- // get value
- var el = this[0];
- if (!el) return undefined;
- if (el.multiple && el.nodeName.toLowerCase() === 'select') {
- var values = [];
- for (var i = 0; i < el.selectedOptions.length; i += 1) {
- values.push(el.selectedOptions[i].value);
- }
- return values;
- }
- return el.value;
- } // set value
- for (var _i = 0; _i < this.length; _i += 1) {
- var _el = this[_i];
- if (Array.isArray(value) && _el.multiple && _el.nodeName.toLowerCase() === 'select') {
- for (var j = 0; j < _el.options.length; j += 1) {
- _el.options[j].selected = value.indexOf(_el.options[j].value) >= 0;
- }
- } else {
- _el.value = value;
- }
- }
- return this;
- }
- function value(value) {
- return this.val(value);
- }
- function transform(transform) {
- for (var i = 0; i < this.length; i += 1) {
- this[i].style.transform = transform;
- }
- return this;
- }
- function transition(duration) {
- for (var i = 0; i < this.length; i += 1) {
- this[i].style.transitionDuration = typeof duration !== 'string' ? duration + "ms" : duration;
- }
- return this;
- }
- function on() {
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
- args[_key5] = arguments[_key5];
- }
- var eventType = args[0],
- targetSelector = args[1],
- listener = args[2],
- capture = args[3];
- if (typeof args[1] === 'function') {
- eventType = args[0];
- listener = args[1];
- capture = args[2];
- targetSelector = undefined;
- }
- if (!capture) capture = false;
- function handleLiveEvent(e) {
- var target = e.target;
- if (!target) return;
- var eventData = e.target.dom7EventData || [];
- if (eventData.indexOf(e) < 0) {
- eventData.unshift(e);
- }
- if ($(target).is(targetSelector)) listener.apply(target, eventData);else {
- var _parents = $(target).parents(); // eslint-disable-line
- for (var k = 0; k < _parents.length; k += 1) {
- if ($(_parents[k]).is(targetSelector)) listener.apply(_parents[k], eventData);
- }
- }
- }
- function handleEvent(e) {
- var eventData = e && e.target ? e.target.dom7EventData || [] : [];
- if (eventData.indexOf(e) < 0) {
- eventData.unshift(e);
- }
- listener.apply(this, eventData);
- }
- var events = eventType.split(' ');
- var j;
- for (var i = 0; i < this.length; i += 1) {
- var el = this[i];
- if (!targetSelector) {
- for (j = 0; j < events.length; j += 1) {
- var event = events[j];
- if (!el.dom7Listeners) el.dom7Listeners = {};
- if (!el.dom7Listeners[event]) el.dom7Listeners[event] = [];
- el.dom7Listeners[event].push({
- listener: listener,
- proxyListener: handleEvent
- });
- el.addEventListener(event, handleEvent, capture);
- }
- } else {
- // Live events
- for (j = 0; j < events.length; j += 1) {
- var _event = events[j];
- if (!el.dom7LiveListeners) el.dom7LiveListeners = {};
- if (!el.dom7LiveListeners[_event]) el.dom7LiveListeners[_event] = [];
- el.dom7LiveListeners[_event].push({
- listener: listener,
- proxyListener: handleLiveEvent
- });
- el.addEventListener(_event, handleLiveEvent, capture);
- }
- }
- }
- return this;
- }
- function off() {
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
- args[_key6] = arguments[_key6];
- }
- var eventType = args[0],
- targetSelector = args[1],
- listener = args[2],
- capture = args[3];
- if (typeof args[1] === 'function') {
- eventType = args[0];
- listener = args[1];
- capture = args[2];
- targetSelector = undefined;
- }
- if (!capture) capture = false;
- var events = eventType.split(' ');
- for (var i = 0; i < events.length; i += 1) {
- var event = events[i];
- for (var j = 0; j < this.length; j += 1) {
- var el = this[j];
- var handlers = void 0;
- if (!targetSelector && el.dom7Listeners) {
- handlers = el.dom7Listeners[event];
- } else if (targetSelector && el.dom7LiveListeners) {
- handlers = el.dom7LiveListeners[event];
- }
- if (handlers && handlers.length) {
- for (var k = handlers.length - 1; k >= 0; k -= 1) {
- var handler = handlers[k];
- if (listener && handler.listener === listener) {
- el.removeEventListener(event, handler.proxyListener, capture);
- handlers.splice(k, 1);
- } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
- el.removeEventListener(event, handler.proxyListener, capture);
- handlers.splice(k, 1);
- } else if (!listener) {
- el.removeEventListener(event, handler.proxyListener, capture);
- handlers.splice(k, 1);
- }
- }
- }
- }
- }
- return this;
- }
- function once() {
- var dom = this;
- for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
- args[_key7] = arguments[_key7];
- }
- var eventName = args[0],
- targetSelector = args[1],
- listener = args[2],
- capture = args[3];
- if (typeof args[1] === 'function') {
- eventName = args[0];
- listener = args[1];
- capture = args[2];
- targetSelector = undefined;
- }
- function onceHandler() {
- for (var _len8 = arguments.length, eventArgs = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
- eventArgs[_key8] = arguments[_key8];
- }
- listener.apply(this, eventArgs);
- dom.off(eventName, targetSelector, onceHandler, capture);
- if (onceHandler.dom7proxy) {
- delete onceHandler.dom7proxy;
- }
- }
- onceHandler.dom7proxy = listener;
- return dom.on(eventName, targetSelector, onceHandler, capture);
- }
- function trigger() {
- var window = ssrWindow_umd.getWindow();
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
- args[_key9] = arguments[_key9];
- }
- var events = args[0].split(' ');
- var eventData = args[1];
- for (var i = 0; i < events.length; i += 1) {
- var event = events[i];
- for (var j = 0; j < this.length; j += 1) {
- var el = this[j];
- if (window.CustomEvent) {
- var evt = new window.CustomEvent(event, {
- detail: eventData,
- bubbles: true,
- cancelable: true
- });
- el.dom7EventData = args.filter(function (data, dataIndex) {
- return dataIndex > 0;
- });
- el.dispatchEvent(evt);
- el.dom7EventData = [];
- delete el.dom7EventData;
- }
- }
- }
- return this;
- }
- function transitionEnd(callback) {
- var dom = this;
- function fireCallBack(e) {
- if (e.target !== this) return;
- callback.call(this, e);
- dom.off('transitionend', fireCallBack);
- }
- if (callback) {
- dom.on('transitionend', fireCallBack);
- }
- return this;
- }
- function animationEnd(callback) {
- var dom = this;
- function fireCallBack(e) {
- if (e.target !== this) return;
- callback.call(this, e);
- dom.off('animationend', fireCallBack);
- }
- if (callback) {
- dom.on('animationend', fireCallBack);
- }
- return this;
- }
- function width() {
- var window = ssrWindow_umd.getWindow();
- if (this[0] === window) {
- return window.innerWidth;
- }
- if (this.length > 0) {
- return parseFloat(this.css('width'));
- }
- return null;
- }
- function outerWidth(includeMargins) {
- if (this.length > 0) {
- if (includeMargins) {
- var _styles = this.styles();
- return this[0].offsetWidth + parseFloat(_styles.getPropertyValue('margin-right')) + parseFloat(_styles.getPropertyValue('margin-left'));
- }
- return this[0].offsetWidth;
- }
- return null;
- }
- function height() {
- var window = ssrWindow_umd.getWindow();
- if (this[0] === window) {
- return window.innerHeight;
- }
- if (this.length > 0) {
- return parseFloat(this.css('height'));
- }
- return null;
- }
- function outerHeight(includeMargins) {
- if (this.length > 0) {
- if (includeMargins) {
- var _styles2 = this.styles();
- return this[0].offsetHeight + parseFloat(_styles2.getPropertyValue('margin-top')) + parseFloat(_styles2.getPropertyValue('margin-bottom'));
- }
- return this[0].offsetHeight;
- }
- return null;
- }
- function offset() {
- if (this.length > 0) {
- var window = ssrWindow_umd.getWindow();
- var document = ssrWindow_umd.getDocument();
- var el = this[0];
- var box = el.getBoundingClientRect();
- var body = document.body;
- var clientTop = el.clientTop || body.clientTop || 0;
- var clientLeft = el.clientLeft || body.clientLeft || 0;
- var scrollTop = el === window ? window.scrollY : el.scrollTop;
- var scrollLeft = el === window ? window.scrollX : el.scrollLeft;
- return {
- top: box.top + scrollTop - clientTop,
- left: box.left + scrollLeft - clientLeft
- };
- }
- return null;
- }
- function hide() {
- for (var i = 0; i < this.length; i += 1) {
- this[i].style.display = 'none';
- }
- return this;
- }
- function show() {
- var window = ssrWindow_umd.getWindow();
- for (var i = 0; i < this.length; i += 1) {
- var el = this[i];
- if (el.style.display === 'none') {
- el.style.display = '';
- }
- if (window.getComputedStyle(el, null).getPropertyValue('display') === 'none') {
- // Still not visible
- el.style.display = 'block';
- }
- }
- return this;
- }
- function styles() {
- var window = ssrWindow_umd.getWindow();
- if (this[0]) return window.getComputedStyle(this[0], null);
- return {};
- }
- function css(props, value) {
- var window = ssrWindow_umd.getWindow();
- var i;
- if (arguments.length === 1) {
- if (typeof props === 'string') {
- // .css('width')
- if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
- } else {
- // .css({ width: '100px' })
- for (i = 0; i < this.length; i += 1) {
- for (var _prop in props) {
- this[i].style[_prop] = props[_prop];
- }
- }
- return this;
- }
- }
- if (arguments.length === 2 && typeof props === 'string') {
- // .css('width', '100px')
- for (i = 0; i < this.length; i += 1) {
- this[i].style[props] = value;
- }
- return this;
- }
- return this;
- }
- function each(callback) {
- if (!callback) return this;
- this.forEach(function (el, index) {
- callback.apply(el, [el, index]);
- });
- return this;
- }
- function filter(callback) {
- var result = arrayFilter(this, callback);
- return $(result);
- }
- function html(html) {
- if (typeof html === 'undefined') {
- return this[0] ? this[0].innerHTML : null;
- }
- for (var i = 0; i < this.length; i += 1) {
- this[i].innerHTML = html;
- }
- return this;
- }
- function text(text) {
- if (typeof text === 'undefined') {
- return this[0] ? this[0].textContent.trim() : null;
- }
- for (var i = 0; i < this.length; i += 1) {
- this[i].textContent = text;
- }
- return this;
- }
- function is(selector) {
- var window = ssrWindow_umd.getWindow();
- var document = ssrWindow_umd.getDocument();
- var el = this[0];
- var compareWith;
- var i;
- if (!el || typeof selector === 'undefined') return false;
- if (typeof selector === 'string') {
- if (el.matches) return el.matches(selector);
- if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
- if (el.msMatchesSelector) return el.msMatchesSelector(selector);
- compareWith = $(selector);
- for (i = 0; i < compareWith.length; i += 1) {
- if (compareWith[i] === el) return true;
- }
- return false;
- }
- if (selector === document) {
- return el === document;
- }
- if (selector === window) {
- return el === window;
- }
- if (selector.nodeType || selector instanceof Dom7) {
- compareWith = selector.nodeType ? [selector] : selector;
- for (i = 0; i < compareWith.length; i += 1) {
- if (compareWith[i] === el) return true;
- }
- return false;
- }
- return false;
- }
- function index$1() {
- var child = this[0];
- var i;
- if (child) {
- i = 0; // eslint-disable-next-line
- while ((child = child.previousSibling) !== null) {
- if (child.nodeType === 1) i += 1;
- }
- return i;
- }
- return undefined;
- }
- function eq(index) {
- if (typeof index === 'undefined') return this;
- var length = this.length;
- if (index > length - 1) {
- return $([]);
- }
- if (index < 0) {
- var returnIndex = length + index;
- if (returnIndex < 0) return $([]);
- return $([this[returnIndex]]);
- }
- return $([this[index]]);
- }
- function append() {
- var newChild;
- var document = ssrWindow_umd.getDocument();
- for (var k = 0; k < arguments.length; k += 1) {
- newChild = k < 0 || arguments.length <= k ? undefined : arguments[k];
- for (var i = 0; i < this.length; i += 1) {
- if (typeof newChild === 'string') {
- var tempDiv = document.createElement('div');
- tempDiv.innerHTML = newChild;
- while (tempDiv.firstChild) {
- this[i].appendChild(tempDiv.firstChild);
- }
- } else if (newChild instanceof Dom7) {
- for (var j = 0; j < newChild.length; j += 1) {
- this[i].appendChild(newChild[j]);
- }
- } else {
- this[i].appendChild(newChild);
- }
- }
- }
- return this;
- }
- function appendTo(parent) {
- $(parent).append(this);
- return this;
- }
- function prepend(newChild) {
- var document = ssrWindow_umd.getDocument();
- var i;
- var j;
- for (i = 0; i < this.length; i += 1) {
- if (typeof newChild === 'string') {
- var tempDiv = document.createElement('div');
- tempDiv.innerHTML = newChild;
- for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
- this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
- }
- } else if (newChild instanceof Dom7) {
- for (j = 0; j < newChild.length; j += 1) {
- this[i].insertBefore(newChild[j], this[i].childNodes[0]);
- }
- } else {
- this[i].insertBefore(newChild, this[i].childNodes[0]);
- }
- }
- return this;
- }
- function prependTo(parent) {
- $(parent).prepend(this);
- return this;
- }
- function insertBefore(selector) {
- var before = $(selector);
- for (var i = 0; i < this.length; i += 1) {
- if (before.length === 1) {
- before[0].parentNode.insertBefore(this[i], before[0]);
- } else if (before.length > 1) {
- for (var j = 0; j < before.length; j += 1) {
- before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
- }
- }
- }
- }
- function insertAfter(selector) {
- var after = $(selector);
- for (var i = 0; i < this.length; i += 1) {
- if (after.length === 1) {
- after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
- } else if (after.length > 1) {
- for (var j = 0; j < after.length; j += 1) {
- after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
- }
- }
- }
- }
- function next(selector) {
- if (this.length > 0) {
- if (selector) {
- if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
- return $([this[0].nextElementSibling]);
- }
- return $([]);
- }
- if (this[0].nextElementSibling) return $([this[0].nextElementSibling]);
- return $([]);
- }
- return $([]);
- }
- function nextAll(selector) {
- var nextEls = [];
- var el = this[0];
- if (!el) return $([]);
- while (el.nextElementSibling) {
- var _next = el.nextElementSibling; // eslint-disable-line
- if (selector) {
- if ($(_next).is(selector)) nextEls.push(_next);
- } else nextEls.push(_next);
- el = _next;
- }
- return $(nextEls);
- }
- function prev(selector) {
- if (this.length > 0) {
- var el = this[0];
- if (selector) {
- if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
- return $([el.previousElementSibling]);
- }
- return $([]);
- }
- if (el.previousElementSibling) return $([el.previousElementSibling]);
- return $([]);
- }
- return $([]);
- }
- function prevAll(selector) {
- var prevEls = [];
- var el = this[0];
- if (!el) return $([]);
- while (el.previousElementSibling) {
- var _prev = el.previousElementSibling; // eslint-disable-line
- if (selector) {
- if ($(_prev).is(selector)) prevEls.push(_prev);
- } else prevEls.push(_prev);
- el = _prev;
- }
- return $(prevEls);
- }
- function siblings(selector) {
- return this.nextAll(selector).add(this.prevAll(selector));
- }
- function parent(selector) {
- var parents = []; // eslint-disable-line
- for (var i = 0; i < this.length; i += 1) {
- if (this[i].parentNode !== null) {
- if (selector) {
- if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
- } else {
- parents.push(this[i].parentNode);
- }
- }
- }
- return $(parents);
- }
- function parents(selector) {
- var parents = []; // eslint-disable-line
- for (var i = 0; i < this.length; i += 1) {
- var _parent = this[i].parentNode; // eslint-disable-line
- while (_parent) {
- if (selector) {
- if ($(_parent).is(selector)) parents.push(_parent);
- } else {
- parents.push(_parent);
- }
- _parent = _parent.parentNode;
- }
- }
- return $(parents);
- }
- function closest(selector) {
- var closest = this; // eslint-disable-line
- if (typeof selector === 'undefined') {
- return $([]);
- }
- if (!closest.is(selector)) {
- closest = closest.parents(selector).eq(0);
- }
- return closest;
- }
- function find(selector) {
- var foundElements = [];
- for (var i = 0; i < this.length; i += 1) {
- var found = this[i].querySelectorAll(selector);
- for (var j = 0; j < found.length; j += 1) {
- foundElements.push(found[j]);
- }
- }
- return $(foundElements);
- }
- function children(selector) {
- var children = []; // eslint-disable-line
- for (var i = 0; i < this.length; i += 1) {
- var childNodes = this[i].children;
- for (var j = 0; j < childNodes.length; j += 1) {
- if (!selector || $(childNodes[j]).is(selector)) {
- children.push(childNodes[j]);
- }
- }
- }
- return $(children);
- }
- function remove() {
- for (var i = 0; i < this.length; i += 1) {
- if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
- }
- return this;
- }
- function detach() {
- return this.remove();
- }
- function add() {
- var dom = this;
- var i;
- var j;
- for (var _len10 = arguments.length, els = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
- els[_key10] = arguments[_key10];
- }
- for (i = 0; i < els.length; i += 1) {
- var toAdd = $(els[i]);
- for (j = 0; j < toAdd.length; j += 1) {
- dom.push(toAdd[j]);
- }
- }
- return dom;
- }
- function empty() {
- for (var i = 0; i < this.length; i += 1) {
- var el = this[i];
- if (el.nodeType === 1) {
- for (var j = 0; j < el.childNodes.length; j += 1) {
- if (el.childNodes[j].parentNode) {
- el.childNodes[j].parentNode.removeChild(el.childNodes[j]);
- }
- }
- el.textContent = '';
- }
- }
- return this;
- }
- function scrollTo() {
- var window = ssrWindow_umd.getWindow();
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var left = args[0],
- top = args[1],
- duration = args[2],
- easing = args[3],
- callback = args[4];
- if (args.length === 4 && typeof easing === 'function') {
- callback = easing;
- left = args[0];
- top = args[1];
- duration = args[2];
- callback = args[3];
- easing = args[4];
- }
- if (typeof easing === 'undefined') easing = 'swing';
- return this.each(function animate() {
- var el = this;
- var currentTop;
- var currentLeft;
- var maxTop;
- var maxLeft;
- var newTop;
- var newLeft;
- var scrollTop; // eslint-disable-line
- var scrollLeft; // eslint-disable-line
- var animateTop = top > 0 || top === 0;
- var animateLeft = left > 0 || left === 0;
- if (typeof easing === 'undefined') {
- easing = 'swing';
- }
- if (animateTop) {
- currentTop = el.scrollTop;
- if (!duration) {
- el.scrollTop = top;
- }
- }
- if (animateLeft) {
- currentLeft = el.scrollLeft;
- if (!duration) {
- el.scrollLeft = left;
- }
- }
- if (!duration) return;
- if (animateTop) {
- maxTop = el.scrollHeight - el.offsetHeight;
- newTop = Math.max(Math.min(top, maxTop), 0);
- }
- if (animateLeft) {
- maxLeft = el.scrollWidth - el.offsetWidth;
- newLeft = Math.max(Math.min(left, maxLeft), 0);
- }
- var startTime = null;
- if (animateTop && newTop === currentTop) animateTop = false;
- if (animateLeft && newLeft === currentLeft) animateLeft = false;
- function render(time) {
- if (time === void 0) {
- time = new Date().getTime();
- }
- if (startTime === null) {
- startTime = time;
- }
- var progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
- var easeProgress = easing === 'linear' ? progress : 0.5 - Math.cos(progress * Math.PI) / 2;
- var done;
- if (animateTop) scrollTop = currentTop + easeProgress * (newTop - currentTop);
- if (animateLeft) scrollLeft = currentLeft + easeProgress * (newLeft - currentLeft);
- if (animateTop && newTop > currentTop && scrollTop >= newTop) {
- el.scrollTop = newTop;
- done = true;
- }
- if (animateTop && newTop < currentTop && scrollTop <= newTop) {
- el.scrollTop = newTop;
- done = true;
- }
- if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) {
- el.scrollLeft = newLeft;
- done = true;
- }
- if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) {
- el.scrollLeft = newLeft;
- done = true;
- }
- if (done) {
- if (callback) callback();
- return;
- }
- if (animateTop) el.scrollTop = scrollTop;
- if (animateLeft) el.scrollLeft = scrollLeft;
- window.requestAnimationFrame(render);
- }
- window.requestAnimationFrame(render);
- });
- } // scrollTop(top, duration, easing, callback) {
- function scrollTop() {
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
- var top = args[0],
- duration = args[1],
- easing = args[2],
- callback = args[3];
- if (args.length === 3 && typeof easing === 'function') {
- top = args[0];
- duration = args[1];
- callback = args[2];
- easing = args[3];
- }
- var dom = this;
- if (typeof top === 'undefined') {
- if (dom.length > 0) return dom[0].scrollTop;
- return null;
- }
- return dom.scrollTo(undefined, top, duration, easing, callback);
- }
- function scrollLeft() {
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
- var left = args[0],
- duration = args[1],
- easing = args[2],
- callback = args[3];
- if (args.length === 3 && typeof easing === 'function') {
- left = args[0];
- duration = args[1];
- callback = args[2];
- easing = args[3];
- }
- var dom = this;
- if (typeof left === 'undefined') {
- if (dom.length > 0) return dom[0].scrollLeft;
- return null;
- }
- return dom.scrollTo(left, undefined, duration, easing, callback);
- }
- function animate(initialProps, initialParams) {
- var window = ssrWindow_umd.getWindow();
- var els = this;
- var a = {
- props: Object.assign({}, initialProps),
- params: Object.assign({
- duration: 300,
- easing: 'swing' // or 'linear'
- /* Callbacks
- begin(elements)
- complete(elements)
- progress(elements, complete, remaining, start, tweenValue)
- */
- }, initialParams),
- elements: els,
- animating: false,
- que: [],
- easingProgress: function easingProgress(easing, progress) {
- if (easing === 'swing') {
- return 0.5 - Math.cos(progress * Math.PI) / 2;
- }
- if (typeof easing === 'function') {
- return easing(progress);
- }
- return progress;
- },
- stop: function stop() {
- if (a.frameId) {
- window.cancelAnimationFrame(a.frameId);
- }
- a.animating = false;
- a.elements.each(function (el) {
- var element = el;
- delete element.dom7AnimateInstance;
- });
- a.que = [];
- },
- done: function done(complete) {
- a.animating = false;
- a.elements.each(function (el) {
- var element = el;
- delete element.dom7AnimateInstance;
- });
- if (complete) complete(els);
- if (a.que.length > 0) {
- var que = a.que.shift();
- a.animate(que[0], que[1]);
- }
- },
- animate: function animate(props, params) {
- if (a.animating) {
- a.que.push([props, params]);
- return a;
- }
- var elements = []; // Define & Cache Initials & Units
- a.elements.each(function (el, index) {
- var initialFullValue;
- var initialValue;
- var unit;
- var finalValue;
- var finalFullValue;
- if (!el.dom7AnimateInstance) a.elements[index].dom7AnimateInstance = a;
- elements[index] = {
- container: el
- };
- Object.keys(props).forEach(function (prop) {
- initialFullValue = window.getComputedStyle(el, null).getPropertyValue(prop).replace(',', '.');
- initialValue = parseFloat(initialFullValue);
- unit = initialFullValue.replace(initialValue, '');
- finalValue = parseFloat(props[prop]);
- finalFullValue = props[prop] + unit;
- elements[index][prop] = {
- initialFullValue: initialFullValue,
- initialValue: initialValue,
- unit: unit,
- finalValue: finalValue,
- finalFullValue: finalFullValue,
- currentValue: initialValue
- };
- });
- });
- var startTime = null;
- var time;
- var elementsDone = 0;
- var propsDone = 0;
- var done;
- var began = false;
- a.animating = true;
- function render() {
- time = new Date().getTime();
- var progress;
- var easeProgress; // let el;
- if (!began) {
- began = true;
- if (params.begin) params.begin(els);
- }
- if (startTime === null) {
- startTime = time;
- }
- if (params.progress) {
- // eslint-disable-next-line
- params.progress(els, Math.max(Math.min((time - startTime) / params.duration, 1), 0), startTime + params.duration - time < 0 ? 0 : startTime + params.duration - time, startTime);
- }
- elements.forEach(function (element) {
- var el = element;
- if (done || el.done) return;
- Object.keys(props).forEach(function (prop) {
- if (done || el.done) return;
- progress = Math.max(Math.min((time - startTime) / params.duration, 1), 0);
- easeProgress = a.easingProgress(params.easing, progress);
- var _el$prop = el[prop],
- initialValue = _el$prop.initialValue,
- finalValue = _el$prop.finalValue,
- unit = _el$prop.unit;
- el[prop].currentValue = initialValue + easeProgress * (finalValue - initialValue);
- var currentValue = el[prop].currentValue;
- if (finalValue > initialValue && currentValue >= finalValue || finalValue < initialValue && currentValue <= finalValue) {
- el.container.style[prop] = finalValue + unit;
- propsDone += 1;
- if (propsDone === Object.keys(props).length) {
- el.done = true;
- elementsDone += 1;
- }
- if (elementsDone === elements.length) {
- done = true;
- }
- }
- if (done) {
- a.done(params.complete);
- return;
- }
- el.container.style[prop] = currentValue + unit;
- });
- });
- if (done) return; // Then call
- a.frameId = window.requestAnimationFrame(render);
- }
- a.frameId = window.requestAnimationFrame(render);
- return a;
- }
- };
- if (a.elements.length === 0) {
- return els;
- }
- var animateInstance;
- for (var i = 0; i < a.elements.length; i += 1) {
- if (a.elements[i].dom7AnimateInstance) {
- animateInstance = a.elements[i].dom7AnimateInstance;
- } else a.elements[i].dom7AnimateInstance = a;
- }
- if (!animateInstance) {
- animateInstance = a;
- }
- if (initialProps === 'stop') {
- animateInstance.stop();
- } else {
- animateInstance.animate(a.props, a.params);
- }
- return els;
- }
- function stop() {
- var els = this;
- for (var i = 0; i < els.length; i += 1) {
- if (els[i].dom7AnimateInstance) {
- els[i].dom7AnimateInstance.stop();
- }
- }
- }
- var noTrigger = 'resize scroll'.split(' ');
- function shortcut(name) {
- function eventHandler() {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- if (typeof args[0] === 'undefined') {
- for (var i = 0; i < this.length; i += 1) {
- if (noTrigger.indexOf(name) < 0) {
- if (name in this[i]) this[i][name]();else {
- $(this[i]).trigger(name);
- }
- }
- }
- return this;
- }
- return this.on.apply(this, [name].concat(args));
- }
- return eventHandler;
- }
- var click = shortcut('click');
- var blur = shortcut('blur');
- var focus = shortcut('focus');
- var focusin = shortcut('focusin');
- var focusout = shortcut('focusout');
- var keyup = shortcut('keyup');
- var keydown = shortcut('keydown');
- var keypress = shortcut('keypress');
- var submit = shortcut('submit');
- var change = shortcut('change');
- var mousedown = shortcut('mousedown');
- var mousemove = shortcut('mousemove');
- var mouseup = shortcut('mouseup');
- var mouseenter = shortcut('mouseenter');
- var mouseleave = shortcut('mouseleave');
- var mouseout = shortcut('mouseout');
- var mouseover = shortcut('mouseover');
- var touchstart = shortcut('touchstart');
- var touchend = shortcut('touchend');
- var touchmove = shortcut('touchmove');
- var resize = shortcut('resize');
- var scroll = shortcut('scroll');
- var $_1 = $;
- var add_1 = add;
- var addClass_1 = addClass;
- var animate_1 = animate;
- var animationEnd_1 = animationEnd;
- var append_1 = append;
- var appendTo_1 = appendTo;
- var attr_1 = attr;
- var blur_1 = blur;
- var change_1 = change;
- var children_1 = children;
- var click_1 = click;
- var closest_1 = closest;
- var css_1 = css;
- var data_1 = data;
- var dataset_1 = dataset;
- var _default$1 = $;
- var detach_1 = detach;
- var each_1 = each;
- var empty_1 = empty;
- var eq_1 = eq;
- var filter_1 = filter;
- var find_1 = find;
- var focus_1 = focus;
- var focusin_1 = focusin;
- var focusout_1 = focusout;
- var hasClass_1 = hasClass;
- var height_1 = height;
- var hide_1 = hide;
- var html_1 = html;
- var index_1 = index$1;
- var insertAfter_1 = insertAfter;
- var insertBefore_1 = insertBefore;
- var is_1 = is;
- var keydown_1 = keydown;
- var keypress_1 = keypress;
- var keyup_1 = keyup;
- var mousedown_1 = mousedown;
- var mouseenter_1 = mouseenter;
- var mouseleave_1 = mouseleave;
- var mousemove_1 = mousemove;
- var mouseout_1 = mouseout;
- var mouseover_1 = mouseover;
- var mouseup_1 = mouseup;
- var next_1 = next;
- var nextAll_1 = nextAll;
- var off_1 = off;
- var offset_1 = offset;
- var on_1 = on;
- var once_1 = once;
- var outerHeight_1 = outerHeight;
- var outerWidth_1 = outerWidth;
- var parent_1 = parent;
- var parents_1 = parents;
- var prepend_1 = prepend;
- var prependTo_1 = prependTo;
- var prev_1 = prev;
- var prevAll_1 = prevAll;
- var prop_1 = prop;
- var remove_1 = remove;
- var removeAttr_1 = removeAttr;
- var removeClass_1 = removeClass;
- var removeData_1 = removeData;
- var resize_1 = resize;
- var scroll_1 = scroll;
- var scrollLeft_1 = scrollLeft;
- var scrollTo_1 = scrollTo;
- var scrollTop_1 = scrollTop;
- var show_1 = show;
- var siblings_1 = siblings;
- var stop_1 = stop;
- var styles_1 = styles;
- var submit_1 = submit;
- var text_1 = text;
- var toggleClass_1 = toggleClass;
- var touchend_1 = touchend;
- var touchmove_1 = touchmove;
- var touchstart_1 = touchstart;
- var transform_1 = transform;
- var transition_1 = transition;
- var transitionEnd_1 = transitionEnd;
- var trigger_1 = trigger;
- var val_1 = val;
- var value_1 = value;
- var width_1 = width;
- var dom7_cjs = /*#__PURE__*/Object.defineProperty({
- $: $_1,
- add: add_1,
- addClass: addClass_1,
- animate: animate_1,
- animationEnd: animationEnd_1,
- append: append_1,
- appendTo: appendTo_1,
- attr: attr_1,
- blur: blur_1,
- change: change_1,
- children: children_1,
- click: click_1,
- closest: closest_1,
- css: css_1,
- data: data_1,
- dataset: dataset_1,
- default: _default$1,
- detach: detach_1,
- each: each_1,
- empty: empty_1,
- eq: eq_1,
- filter: filter_1,
- find: find_1,
- focus: focus_1,
- focusin: focusin_1,
- focusout: focusout_1,
- hasClass: hasClass_1,
- height: height_1,
- hide: hide_1,
- html: html_1,
- index: index_1,
- insertAfter: insertAfter_1,
- insertBefore: insertBefore_1,
- is: is_1,
- keydown: keydown_1,
- keypress: keypress_1,
- keyup: keyup_1,
- mousedown: mousedown_1,
- mouseenter: mouseenter_1,
- mouseleave: mouseleave_1,
- mousemove: mousemove_1,
- mouseout: mouseout_1,
- mouseover: mouseover_1,
- mouseup: mouseup_1,
- next: next_1,
- nextAll: nextAll_1,
- off: off_1,
- offset: offset_1,
- on: on_1,
- once: once_1,
- outerHeight: outerHeight_1,
- outerWidth: outerWidth_1,
- parent: parent_1,
- parents: parents_1,
- prepend: prepend_1,
- prependTo: prependTo_1,
- prev: prev_1,
- prevAll: prevAll_1,
- prop: prop_1,
- remove: remove_1,
- removeAttr: removeAttr_1,
- removeClass: removeClass_1,
- removeData: removeData_1,
- resize: resize_1,
- scroll: scroll_1,
- scrollLeft: scrollLeft_1,
- scrollTo: scrollTo_1,
- scrollTop: scrollTop_1,
- show: show_1,
- siblings: siblings_1,
- stop: stop_1,
- styles: styles_1,
- submit: submit_1,
- text: text_1,
- toggleClass: toggleClass_1,
- touchend: touchend_1,
- touchmove: touchmove_1,
- touchstart: touchstart_1,
- transform: transform_1,
- transition: transition_1,
- transitionEnd: transitionEnd_1,
- trigger: trigger_1,
- val: val_1,
- value: value_1,
- width: width_1
- }, '__esModule', {value: true});
- /**
- * lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER = 9007199254740991;
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]',
- funcTag = '[object Function]',
- genTag = '[object GeneratorFunction]';
- /** Used to detect unsigned integer values. */
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- /**
- * A specialized version of `_.forEach` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns `array`.
- */
- function arrayEach(array, iteratee) {
- var index = -1,
- length = array ? array.length : 0;
- while (++index < length) {
- if (iteratee(array[index], index, array) === false) {
- break;
- }
- }
- return array;
- }
- /**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
- function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- /**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
- /** Used for built-in method references. */
- var objectProto$3 = Object.prototype;
- /** Used to check objects for own properties. */
- var hasOwnProperty$1 = objectProto$3.hasOwnProperty;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString$3 = objectProto$3.toString;
- /** Built-in value references. */
- var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeKeys = overArg(Object.keys, Object);
- /**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */
- function arrayLikeKeys(value, inherited) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- // Safari 9 makes `arguments.length` enumerable in strict mode.
- var result = (isArray(value) || isArguments(value))
- ? baseTimes(value.length, String)
- : [];
- var length = result.length,
- skipIndexes = !!length;
- for (var key in value) {
- if ((inherited || hasOwnProperty$1.call(value, key)) &&
- !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * The base implementation of `_.forEach` without support for iteratee shorthands.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array|Object} Returns `collection`.
- */
- var baseEach = createBaseEach(baseForOwn);
- /**
- * The base implementation of `baseForOwn` which iterates over `object`
- * properties returned by `keysFunc` and invokes `iteratee` for each property.
- * Iteratee functions may exit iteration early by explicitly returning `false`.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @returns {Object} Returns `object`.
- */
- var baseFor = createBaseFor();
- /**
- * The base implementation of `_.forOwn` without support for iteratee shorthands.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Object} Returns `object`.
- */
- function baseForOwn(object, iteratee) {
- return object && baseFor(object, iteratee, keys);
- }
- /**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function baseKeys(object) {
- if (!isPrototype(object)) {
- return nativeKeys(object);
- }
- var result = [];
- for (var key in Object(object)) {
- if (hasOwnProperty$1.call(object, key) && key != 'constructor') {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * Creates a `baseEach` or `baseEachRight` function.
- *
- * @private
- * @param {Function} eachFunc The function to iterate over a collection.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */
- function createBaseEach(eachFunc, fromRight) {
- return function(collection, iteratee) {
- if (collection == null) {
- return collection;
- }
- if (!isArrayLike(collection)) {
- return eachFunc(collection, iteratee);
- }
- var length = collection.length,
- index = fromRight ? length : -1,
- iterable = Object(collection);
- while ((fromRight ? index-- : ++index < length)) {
- if (iteratee(iterable[index], index, iterable) === false) {
- break;
- }
- }
- return collection;
- };
- }
- /**
- * Creates a base function for methods like `_.forIn` and `_.forOwn`.
- *
- * @private
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */
- function createBaseFor(fromRight) {
- return function(object, iteratee, keysFunc) {
- var index = -1,
- iterable = Object(object),
- props = keysFunc(object),
- length = props.length;
- while (length--) {
- var key = props[fromRight ? length : ++index];
- if (iteratee(iterable[key], key, iterable) === false) {
- break;
- }
- }
- return object;
- };
- }
- /**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex(value, length) {
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length &&
- (typeof value == 'number' || reIsUint.test(value)) &&
- (value > -1 && value % 1 == 0 && value < length);
- }
- /**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */
- function isPrototype(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
- return value === proto;
- }
- /**
- * Iterates over elements of `collection` and invokes `iteratee` for each element.
- * The iteratee is invoked with three arguments: (value, index|key, collection).
- * Iteratee functions may exit iteration early by explicitly returning `false`.
- *
- * **Note:** As with other "Collections" methods, objects with a "length"
- * property are iterated like arrays. To avoid this behavior use `_.forIn`
- * or `_.forOwn` for object iteration.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @alias each
- * @category Collection
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Array|Object} Returns `collection`.
- * @see _.forEachRight
- * @example
- *
- * _([1, 2]).forEach(function(value) {
- * console.log(value);
- * });
- * // => Logs `1` then `2`.
- *
- * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
- * console.log(key);
- * });
- * // => Logs 'a' then 'b' (iteration order is not guaranteed).
- */
- function forEach(collection, iteratee) {
- var func = isArray(collection) ? arrayEach : baseEach;
- return func(collection, typeof iteratee == 'function' ? iteratee : identity);
- }
- /**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
- function isArguments(value) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- return isArrayLikeObject(value) && hasOwnProperty$1.call(value, 'callee') &&
- (!propertyIsEnumerable.call(value, 'callee') || objectToString$3.call(value) == argsTag);
- }
- /**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */
- var isArray = Array.isArray;
- /**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
- function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
- }
- /**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object,
- * else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */
- function isArrayLikeObject(value) {
- return isObjectLike$3(value) && isArrayLike(value);
- }
- /**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
- function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
- var tag = isObject$2(value) ? objectToString$3.call(value) : '';
- return tag == funcTag || tag == genTag;
- }
- /**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
- function isLength(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject$2(value) {
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
- }
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike$3(value) {
- return !!value && typeof value == 'object';
- }
- /**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
- function keys(object) {
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
- }
- /**
- * This method returns the first argument it receives.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Util
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'a': 1 };
- *
- * console.log(_.identity(object) === object);
- * // => true
- */
- function identity(value) {
- return value;
- }
- var lodash_foreach = forEach;
- let urlAlphabet$1 =
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
- var urlAlphabet_1 = { urlAlphabet: urlAlphabet$1 };
- let { urlAlphabet } = urlAlphabet_1;
- {
- if (
- typeof navigator !== 'undefined' &&
- navigator.product === 'ReactNative' &&
- typeof crypto === 'undefined'
- ) {
- throw new Error(
- 'React Native does not have a built-in secure random generator. ' +
- 'If you don’t need unpredictable IDs use `nanoid/non-secure`. ' +
- 'For secure IDs, import `react-native-get-random-values` ' +
- 'before Nano ID.'
- )
- }
- if (typeof msCrypto !== 'undefined' && typeof crypto === 'undefined') {
- throw new Error(
- 'Import file with `if (!window.crypto) window.crypto = window.msCrypto`' +
- ' before importing Nano ID to fix IE 11 support'
- )
- }
- if (typeof crypto === 'undefined') {
- throw new Error(
- 'Your browser does not have secure random generator. ' +
- 'If you don’t need unpredictable IDs, you can use nanoid/non-secure.'
- )
- }
- }
- let random = bytes => crypto.getRandomValues(new Uint8Array(bytes));
- let customRandom = (alphabet, size, getRandom) => {
- let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1;
- let step = -~((1.6 * mask * size) / alphabet.length);
- return () => {
- let id = '';
- while (true) {
- let bytes = getRandom(step);
- let j = step;
- while (j--) {
- id += alphabet[bytes[j] & mask] || '';
- if (id.length === size) return id
- }
- }
- }
- };
- let customAlphabet = (alphabet, size) => customRandom(alphabet, size, random);
- let nanoid$2 = (size = 21) => {
- let id = '';
- let bytes = crypto.getRandomValues(new Uint8Array(size));
- while (size--) {
- let byte = bytes[size] & 63;
- if (byte < 36) {
- id += byte.toString(36);
- } else if (byte < 62) {
- id += (byte - 26).toString(36).toUpperCase();
- } else if (byte < 63) {
- id += '_';
- } else {
- id += '-';
- }
- }
- return id
- };
- var index_browser = { nanoid: nanoid$2, customAlphabet, customRandom, urlAlphabet, random };
- /**
- * lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */
- /** Used as the `TypeError` message for "Functions" methods. */
- var FUNC_ERROR_TEXT$1 = 'Expected a function';
- /** Used as references for various `Number` constants. */
- var NAN$1 = 0 / 0;
- /** `Object#toString` result references. */
- var symbolTag$2 = '[object Symbol]';
- /** Used to match leading and trailing whitespace. */
- var reTrim$1 = /^\s+|\s+$/g;
- /** Used to detect bad signed hexadecimal string values. */
- var reIsBadHex$1 = /^[-+]0x[0-9a-f]+$/i;
- /** Used to detect binary string values. */
- var reIsBinary$1 = /^0b[01]+$/i;
- /** Used to detect octal string values. */
- var reIsOctal$1 = /^0o[0-7]+$/i;
- /** Built-in method references without a dependency on `root`. */
- var freeParseInt$1 = parseInt;
- /** Detect free variable `global` from Node.js. */
- var freeGlobal$2 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
- /** Detect free variable `self`. */
- var freeSelf$2 = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root$2 = freeGlobal$2 || freeSelf$2 || Function('return this')();
- /** Used for built-in method references. */
- var objectProto$2 = Object.prototype;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString$2 = objectProto$2.toString;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeMax$1 = Math.max,
- nativeMin$1 = Math.min;
- /**
- * Gets the timestamp of the number of milliseconds that have elapsed since
- * the Unix epoch (1 January 1970 00:00:00 UTC).
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Date
- * @returns {number} Returns the timestamp.
- * @example
- *
- * _.defer(function(stamp) {
- * console.log(_.now() - stamp);
- * }, _.now());
- * // => Logs the number of milliseconds it took for the deferred invocation.
- */
- var now$1 = function() {
- return root$2.Date.now();
- };
- /**
- * Creates a debounced function that delays invoking `func` until after `wait`
- * milliseconds have elapsed since the last time the debounced function was
- * invoked. The debounced function comes with a `cancel` method to cancel
- * delayed `func` invocations and a `flush` method to immediately invoke them.
- * Provide `options` to indicate whether `func` should be invoked on the
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
- * with the last arguments provided to the debounced function. Subsequent
- * calls to the debounced function return the result of the last `func`
- * invocation.
- *
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
- * invoked on the trailing edge of the timeout only if the debounced function
- * is invoked more than once during the `wait` timeout.
- *
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
- *
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
- * for details over the differences between `_.debounce` and `_.throttle`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to debounce.
- * @param {number} [wait=0] The number of milliseconds to delay.
- * @param {Object} [options={}] The options object.
- * @param {boolean} [options.leading=false]
- * Specify invoking on the leading edge of the timeout.
- * @param {number} [options.maxWait]
- * The maximum time `func` is allowed to be delayed before it's invoked.
- * @param {boolean} [options.trailing=true]
- * Specify invoking on the trailing edge of the timeout.
- * @returns {Function} Returns the new debounced function.
- * @example
- *
- * // Avoid costly calculations while the window size is in flux.
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
- *
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
- * 'leading': true,
- * 'trailing': false
- * }));
- *
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
- * var source = new EventSource('/stream');
- * jQuery(source).on('message', debounced);
- *
- * // Cancel the trailing debounced invocation.
- * jQuery(window).on('popstate', debounced.cancel);
- */
- function debounce$2(func, wait, options) {
- var lastArgs,
- lastThis,
- maxWait,
- result,
- timerId,
- lastCallTime,
- lastInvokeTime = 0,
- leading = false,
- maxing = false,
- trailing = true;
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT$1);
- }
- wait = toNumber$1(wait) || 0;
- if (isObject$1(options)) {
- leading = !!options.leading;
- maxing = 'maxWait' in options;
- maxWait = maxing ? nativeMax$1(toNumber$1(options.maxWait) || 0, wait) : maxWait;
- trailing = 'trailing' in options ? !!options.trailing : trailing;
- }
- function invokeFunc(time) {
- var args = lastArgs,
- thisArg = lastThis;
- lastArgs = lastThis = undefined;
- lastInvokeTime = time;
- result = func.apply(thisArg, args);
- return result;
- }
- function leadingEdge(time) {
- // Reset any `maxWait` timer.
- lastInvokeTime = time;
- // Start the timer for the trailing edge.
- timerId = setTimeout(timerExpired, wait);
- // Invoke the leading edge.
- return leading ? invokeFunc(time) : result;
- }
- function remainingWait(time) {
- var timeSinceLastCall = time - lastCallTime,
- timeSinceLastInvoke = time - lastInvokeTime,
- result = wait - timeSinceLastCall;
- return maxing ? nativeMin$1(result, maxWait - timeSinceLastInvoke) : result;
- }
- function shouldInvoke(time) {
- var timeSinceLastCall = time - lastCallTime,
- timeSinceLastInvoke = time - lastInvokeTime;
- // Either this is the first call, activity has stopped and we're at the
- // trailing edge, the system time has gone backwards and we're treating
- // it as the trailing edge, or we've hit the `maxWait` limit.
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
- }
- function timerExpired() {
- var time = now$1();
- if (shouldInvoke(time)) {
- return trailingEdge(time);
- }
- // Restart the timer.
- timerId = setTimeout(timerExpired, remainingWait(time));
- }
- function trailingEdge(time) {
- timerId = undefined;
- // Only invoke if we have `lastArgs` which means `func` has been
- // debounced at least once.
- if (trailing && lastArgs) {
- return invokeFunc(time);
- }
- lastArgs = lastThis = undefined;
- return result;
- }
- function cancel() {
- if (timerId !== undefined) {
- clearTimeout(timerId);
- }
- lastInvokeTime = 0;
- lastArgs = lastCallTime = lastThis = timerId = undefined;
- }
- function flush() {
- return timerId === undefined ? result : trailingEdge(now$1());
- }
- function debounced() {
- var time = now$1(),
- isInvoking = shouldInvoke(time);
- lastArgs = arguments;
- lastThis = this;
- lastCallTime = time;
- if (isInvoking) {
- if (timerId === undefined) {
- return leadingEdge(lastCallTime);
- }
- if (maxing) {
- // Handle invocations in a tight loop.
- timerId = setTimeout(timerExpired, wait);
- return invokeFunc(lastCallTime);
- }
- }
- if (timerId === undefined) {
- timerId = setTimeout(timerExpired, wait);
- }
- return result;
- }
- debounced.cancel = cancel;
- debounced.flush = flush;
- return debounced;
- }
- /**
- * Creates a throttled function that only invokes `func` at most once per
- * every `wait` milliseconds. The throttled function comes with a `cancel`
- * method to cancel delayed `func` invocations and a `flush` method to
- * immediately invoke them. Provide `options` to indicate whether `func`
- * should be invoked on the leading and/or trailing edge of the `wait`
- * timeout. The `func` is invoked with the last arguments provided to the
- * throttled function. Subsequent calls to the throttled function return the
- * result of the last `func` invocation.
- *
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
- * invoked on the trailing edge of the timeout only if the throttled function
- * is invoked more than once during the `wait` timeout.
- *
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
- *
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
- * for details over the differences between `_.throttle` and `_.debounce`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to throttle.
- * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
- * @param {Object} [options={}] The options object.
- * @param {boolean} [options.leading=true]
- * Specify invoking on the leading edge of the timeout.
- * @param {boolean} [options.trailing=true]
- * Specify invoking on the trailing edge of the timeout.
- * @returns {Function} Returns the new throttled function.
- * @example
- *
- * // Avoid excessively updating the position while scrolling.
- * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
- *
- * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
- * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
- * jQuery(element).on('click', throttled);
- *
- * // Cancel the trailing throttled invocation.
- * jQuery(window).on('popstate', throttled.cancel);
- */
- function throttle(func, wait, options) {
- var leading = true,
- trailing = true;
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT$1);
- }
- if (isObject$1(options)) {
- leading = 'leading' in options ? !!options.leading : leading;
- trailing = 'trailing' in options ? !!options.trailing : trailing;
- }
- return debounce$2(func, wait, {
- 'leading': leading,
- 'maxWait': wait,
- 'trailing': trailing
- });
- }
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject$1(value) {
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
- }
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike$2(value) {
- return !!value && typeof value == 'object';
- }
- /**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */
- function isSymbol$2(value) {
- return typeof value == 'symbol' ||
- (isObjectLike$2(value) && objectToString$2.call(value) == symbolTag$2);
- }
- /**
- * Converts `value` to a number.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
- * @example
- *
- * _.toNumber(3.2);
- * // => 3.2
- *
- * _.toNumber(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toNumber(Infinity);
- * // => Infinity
- *
- * _.toNumber('3.2');
- * // => 3.2
- */
- function toNumber$1(value) {
- if (typeof value == 'number') {
- return value;
- }
- if (isSymbol$2(value)) {
- return NAN$1;
- }
- if (isObject$1(value)) {
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
- value = isObject$1(other) ? (other + '') : other;
- }
- if (typeof value != 'string') {
- return value === 0 ? value : +value;
- }
- value = value.replace(reTrim$1, '');
- var isBinary = reIsBinary$1.test(value);
- return (isBinary || reIsOctal$1.test(value))
- ? freeParseInt$1(value.slice(2), isBinary ? 2 : 8)
- : (reIsBadHex$1.test(value) ? NAN$1 : +value);
- }
- var lodash_throttle = throttle;
- var snabbdom_cjs = createCommonjsModule$1(function (module, exports) {
- Object.defineProperty(exports, '__esModule', { value: true });
- function createElement(tagName, options) {
- return document.createElement(tagName, options);
- }
- function createElementNS(namespaceURI, qualifiedName, options) {
- return document.createElementNS(namespaceURI, qualifiedName, options);
- }
- function createTextNode(text) {
- return document.createTextNode(text);
- }
- function createComment(text) {
- return document.createComment(text);
- }
- function insertBefore(parentNode, newNode, referenceNode) {
- parentNode.insertBefore(newNode, referenceNode);
- }
- function removeChild(node, child) {
- node.removeChild(child);
- }
- function appendChild(node, child) {
- node.appendChild(child);
- }
- function parentNode(node) {
- return node.parentNode;
- }
- function nextSibling(node) {
- return node.nextSibling;
- }
- function tagName(elm) {
- return elm.tagName;
- }
- function setTextContent(node, text) {
- node.textContent = text;
- }
- function getTextContent(node) {
- return node.textContent;
- }
- function isElement(node) {
- return node.nodeType === 1;
- }
- function isText(node) {
- return node.nodeType === 3;
- }
- function isComment(node) {
- return node.nodeType === 8;
- }
- const htmlDomApi = {
- createElement,
- createElementNS,
- createTextNode,
- createComment,
- insertBefore,
- removeChild,
- appendChild,
- parentNode,
- nextSibling,
- tagName,
- setTextContent,
- getTextContent,
- isElement,
- isText,
- isComment,
- };
- function vnode(sel, data, children, text, elm) {
- const key = data === undefined ? undefined : data.key;
- return { sel, data, children, text, elm, key };
- }
- const array = Array.isArray;
- function primitive(s) {
- return typeof s === "string" ||
- typeof s === "number" ||
- s instanceof String ||
- s instanceof Number;
- }
- function isUndef(s) {
- return s === undefined;
- }
- function isDef(s) {
- return s !== undefined;
- }
- const emptyNode = vnode("", {}, [], undefined, undefined);
- function sameVnode(vnode1, vnode2) {
- var _a, _b;
- const isSameKey = vnode1.key === vnode2.key;
- const isSameIs = ((_a = vnode1.data) === null || _a === void 0 ? void 0 : _a.is) === ((_b = vnode2.data) === null || _b === void 0 ? void 0 : _b.is);
- const isSameSel = vnode1.sel === vnode2.sel;
- return isSameSel && isSameKey && isSameIs;
- }
- function isVnode(vnode) {
- return vnode.sel !== undefined;
- }
- function createKeyToOldIdx(children, beginIdx, endIdx) {
- var _a;
- const map = {};
- for (let i = beginIdx; i <= endIdx; ++i) {
- const key = (_a = children[i]) === null || _a === void 0 ? void 0 : _a.key;
- if (key !== undefined) {
- map[key] = i;
- }
- }
- return map;
- }
- const hooks = [
- "create",
- "update",
- "remove",
- "destroy",
- "pre",
- "post",
- ];
- function init$1(modules, domApi) {
- const cbs = {
- create: [],
- update: [],
- remove: [],
- destroy: [],
- pre: [],
- post: [],
- };
- const api = domApi !== undefined ? domApi : htmlDomApi;
- for (const hook of hooks) {
- for (const module of modules) {
- const currentHook = module[hook];
- if (currentHook !== undefined) {
- cbs[hook].push(currentHook);
- }
- }
- }
- function emptyNodeAt(elm) {
- const id = elm.id ? "#" + elm.id : "";
- // elm.className doesn't return a string when elm is an SVG element inside a shadowRoot.
- // https://stackoverflow.com/questions/29454340/detecting-classname-of-svganimatedstring
- const classes = elm.getAttribute("class");
- const c = classes ? "." + classes.split(" ").join(".") : "";
- return vnode(api.tagName(elm).toLowerCase() + id + c, {}, [], undefined, elm);
- }
- function createRmCb(childElm, listeners) {
- return function rmCb() {
- if (--listeners === 0) {
- const parent = api.parentNode(childElm);
- api.removeChild(parent, childElm);
- }
- };
- }
- function createElm(vnode, insertedVnodeQueue) {
- var _a, _b;
- let i;
- let data = vnode.data;
- if (data !== undefined) {
- const init = (_a = data.hook) === null || _a === void 0 ? void 0 : _a.init;
- if (isDef(init)) {
- init(vnode);
- data = vnode.data;
- }
- }
- const children = vnode.children;
- const sel = vnode.sel;
- if (sel === "!") {
- if (isUndef(vnode.text)) {
- vnode.text = "";
- }
- vnode.elm = api.createComment(vnode.text);
- }
- else if (sel !== undefined) {
- // Parse selector
- const hashIdx = sel.indexOf("#");
- const dotIdx = sel.indexOf(".", hashIdx);
- const hash = hashIdx > 0 ? hashIdx : sel.length;
- const dot = dotIdx > 0 ? dotIdx : sel.length;
- const tag = hashIdx !== -1 || dotIdx !== -1
- ? sel.slice(0, Math.min(hash, dot))
- : sel;
- const elm = (vnode.elm =
- isDef(data) && isDef((i = data.ns))
- ? api.createElementNS(i, tag, data)
- : api.createElement(tag, data));
- if (hash < dot)
- elm.setAttribute("id", sel.slice(hash + 1, dot));
- if (dotIdx > 0)
- elm.setAttribute("class", sel.slice(dot + 1).replace(/\./g, " "));
- for (i = 0; i < cbs.create.length; ++i)
- cbs.create[i](emptyNode, vnode);
- if (array(children)) {
- for (i = 0; i < children.length; ++i) {
- const ch = children[i];
- if (ch != null) {
- api.appendChild(elm, createElm(ch, insertedVnodeQueue));
- }
- }
- }
- else if (primitive(vnode.text)) {
- api.appendChild(elm, api.createTextNode(vnode.text));
- }
- const hook = vnode.data.hook;
- if (isDef(hook)) {
- (_b = hook.create) === null || _b === void 0 ? void 0 : _b.call(hook, emptyNode, vnode);
- if (hook.insert) {
- insertedVnodeQueue.push(vnode);
- }
- }
- }
- else {
- vnode.elm = api.createTextNode(vnode.text);
- }
- return vnode.elm;
- }
- function addVnodes(parentElm, before, vnodes, startIdx, endIdx, insertedVnodeQueue) {
- for (; startIdx <= endIdx; ++startIdx) {
- const ch = vnodes[startIdx];
- if (ch != null) {
- api.insertBefore(parentElm, createElm(ch, insertedVnodeQueue), before);
- }
- }
- }
- function invokeDestroyHook(vnode) {
- var _a, _b;
- const data = vnode.data;
- if (data !== undefined) {
- (_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);
- for (let i = 0; i < cbs.destroy.length; ++i)
- cbs.destroy[i](vnode);
- if (vnode.children !== undefined) {
- for (let j = 0; j < vnode.children.length; ++j) {
- const child = vnode.children[j];
- if (child != null && typeof child !== "string") {
- invokeDestroyHook(child);
- }
- }
- }
- }
- }
- function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
- var _a, _b;
- for (; startIdx <= endIdx; ++startIdx) {
- let listeners;
- let rm;
- const ch = vnodes[startIdx];
- if (ch != null) {
- if (isDef(ch.sel)) {
- invokeDestroyHook(ch);
- listeners = cbs.remove.length + 1;
- rm = createRmCb(ch.elm, listeners);
- for (let i = 0; i < cbs.remove.length; ++i)
- cbs.remove[i](ch, rm);
- 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;
- if (isDef(removeHook)) {
- removeHook(ch, rm);
- }
- else {
- rm();
- }
- }
- else {
- // Text node
- api.removeChild(parentElm, ch.elm);
- }
- }
- }
- }
- function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue) {
- let oldStartIdx = 0;
- let newStartIdx = 0;
- let oldEndIdx = oldCh.length - 1;
- let oldStartVnode = oldCh[0];
- let oldEndVnode = oldCh[oldEndIdx];
- let newEndIdx = newCh.length - 1;
- let newStartVnode = newCh[0];
- let newEndVnode = newCh[newEndIdx];
- let oldKeyToIdx;
- let idxInOld;
- let elmToMove;
- let before;
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
- if (oldStartVnode == null) {
- oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
- }
- else if (oldEndVnode == null) {
- oldEndVnode = oldCh[--oldEndIdx];
- }
- else if (newStartVnode == null) {
- newStartVnode = newCh[++newStartIdx];
- }
- else if (newEndVnode == null) {
- newEndVnode = newCh[--newEndIdx];
- }
- else if (sameVnode(oldStartVnode, newStartVnode)) {
- patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
- oldStartVnode = oldCh[++oldStartIdx];
- newStartVnode = newCh[++newStartIdx];
- }
- else if (sameVnode(oldEndVnode, newEndVnode)) {
- patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
- oldEndVnode = oldCh[--oldEndIdx];
- newEndVnode = newCh[--newEndIdx];
- }
- else if (sameVnode(oldStartVnode, newEndVnode)) {
- // Vnode moved right
- patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
- api.insertBefore(parentElm, oldStartVnode.elm, api.nextSibling(oldEndVnode.elm));
- oldStartVnode = oldCh[++oldStartIdx];
- newEndVnode = newCh[--newEndIdx];
- }
- else if (sameVnode(oldEndVnode, newStartVnode)) {
- // Vnode moved left
- patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
- api.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
- oldEndVnode = oldCh[--oldEndIdx];
- newStartVnode = newCh[++newStartIdx];
- }
- else {
- if (oldKeyToIdx === undefined) {
- oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
- }
- idxInOld = oldKeyToIdx[newStartVnode.key];
- if (isUndef(idxInOld)) {
- // New element
- api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
- }
- else {
- elmToMove = oldCh[idxInOld];
- if (elmToMove.sel !== newStartVnode.sel) {
- api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
- }
- else {
- patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
- oldCh[idxInOld] = undefined;
- api.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
- }
- }
- newStartVnode = newCh[++newStartIdx];
- }
- }
- if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
- if (oldStartIdx > oldEndIdx) {
- before = newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].elm;
- addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
- }
- else {
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
- }
- }
- }
- function patchVnode(oldVnode, vnode, insertedVnodeQueue) {
- var _a, _b, _c, _d, _e;
- const hook = (_a = vnode.data) === null || _a === void 0 ? void 0 : _a.hook;
- (_b = hook === null || hook === void 0 ? void 0 : hook.prepatch) === null || _b === void 0 ? void 0 : _b.call(hook, oldVnode, vnode);
- const elm = (vnode.elm = oldVnode.elm);
- const oldCh = oldVnode.children;
- const ch = vnode.children;
- if (oldVnode === vnode)
- return;
- if (vnode.data !== undefined) {
- for (let i = 0; i < cbs.update.length; ++i)
- cbs.update[i](oldVnode, vnode);
- (_d = (_c = vnode.data.hook) === null || _c === void 0 ? void 0 : _c.update) === null || _d === void 0 ? void 0 : _d.call(_c, oldVnode, vnode);
- }
- if (isUndef(vnode.text)) {
- if (isDef(oldCh) && isDef(ch)) {
- if (oldCh !== ch)
- updateChildren(elm, oldCh, ch, insertedVnodeQueue);
- }
- else if (isDef(ch)) {
- if (isDef(oldVnode.text))
- api.setTextContent(elm, "");
- addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
- }
- else if (isDef(oldCh)) {
- removeVnodes(elm, oldCh, 0, oldCh.length - 1);
- }
- else if (isDef(oldVnode.text)) {
- api.setTextContent(elm, "");
- }
- }
- else if (oldVnode.text !== vnode.text) {
- if (isDef(oldCh)) {
- removeVnodes(elm, oldCh, 0, oldCh.length - 1);
- }
- api.setTextContent(elm, vnode.text);
- }
- (_e = hook === null || hook === void 0 ? void 0 : hook.postpatch) === null || _e === void 0 ? void 0 : _e.call(hook, oldVnode, vnode);
- }
- return function patch(oldVnode, vnode) {
- let i, elm, parent;
- const insertedVnodeQueue = [];
- for (i = 0; i < cbs.pre.length; ++i)
- cbs.pre[i]();
- if (!isVnode(oldVnode)) {
- oldVnode = emptyNodeAt(oldVnode);
- }
- if (sameVnode(oldVnode, vnode)) {
- patchVnode(oldVnode, vnode, insertedVnodeQueue);
- }
- else {
- elm = oldVnode.elm;
- parent = api.parentNode(elm);
- createElm(vnode, insertedVnodeQueue);
- if (parent !== null) {
- api.insertBefore(parent, vnode.elm, api.nextSibling(elm));
- removeVnodes(parent, [oldVnode], 0, 0);
- }
- }
- for (i = 0; i < insertedVnodeQueue.length; ++i) {
- insertedVnodeQueue[i].data.hook.insert(insertedVnodeQueue[i]);
- }
- for (i = 0; i < cbs.post.length; ++i)
- cbs.post[i]();
- return vnode;
- };
- }
- function addNS(data, children, sel) {
- data.ns = "http://www.w3.org/2000/svg";
- if (sel !== "foreignObject" && children !== undefined) {
- for (let i = 0; i < children.length; ++i) {
- const childData = children[i].data;
- if (childData !== undefined) {
- addNS(childData, children[i].children, children[i].sel);
- }
- }
- }
- }
- function h(sel, b, c) {
- let data = {};
- let children;
- let text;
- let i;
- if (c !== undefined) {
- if (b !== null) {
- data = b;
- }
- if (array(c)) {
- children = c;
- }
- else if (primitive(c)) {
- text = c.toString();
- }
- else if (c && c.sel) {
- children = [c];
- }
- }
- else if (b !== undefined && b !== null) {
- if (array(b)) {
- children = b;
- }
- else if (primitive(b)) {
- text = b.toString();
- }
- else if (b && b.sel) {
- children = [b];
- }
- else {
- data = b;
- }
- }
- if (children !== undefined) {
- for (i = 0; i < children.length; ++i) {
- if (primitive(children[i]))
- children[i] = vnode(undefined, undefined, undefined, children[i], undefined);
- }
- }
- if (sel[0] === "s" &&
- sel[1] === "v" &&
- sel[2] === "g" &&
- (sel.length === 3 || sel[3] === "." || sel[3] === "#")) {
- addNS(data, children, sel);
- }
- return vnode(sel, data, children, text, undefined);
- }
- function copyToThunk(vnode, thunk) {
- vnode.data.fn = thunk.data.fn;
- vnode.data.args = thunk.data.args;
- thunk.data = vnode.data;
- thunk.children = vnode.children;
- thunk.text = vnode.text;
- thunk.elm = vnode.elm;
- }
- function init(thunk) {
- const cur = thunk.data;
- const vnode = cur.fn(...cur.args);
- copyToThunk(vnode, thunk);
- }
- function prepatch(oldVnode, thunk) {
- let i;
- const old = oldVnode.data;
- const cur = thunk.data;
- const oldArgs = old.args;
- const args = cur.args;
- if (old.fn !== cur.fn || oldArgs.length !== args.length) {
- copyToThunk(cur.fn(...args), thunk);
- return;
- }
- for (i = 0; i < args.length; ++i) {
- if (oldArgs[i] !== args[i]) {
- copyToThunk(cur.fn(...args), thunk);
- return;
- }
- }
- copyToThunk(oldVnode, thunk);
- }
- const thunk = function thunk(sel, key, fn, args) {
- if (args === undefined) {
- args = fn;
- fn = key;
- key = undefined;
- }
- return h(sel, {
- key: key,
- hook: { init, prepatch },
- fn: fn,
- args: args,
- });
- };
- function pre(vnode, newVnode) {
- const attachData = vnode.data.attachData;
- // Copy created placeholder and real element from old vnode
- newVnode.data.attachData.placeholder = attachData.placeholder;
- newVnode.data.attachData.real = attachData.real;
- // Mount real element in vnode so the patch process operates on it
- vnode.elm = vnode.data.attachData.real;
- }
- function post(_, vnode) {
- // Mount dummy placeholder in vnode so potential reorders use it
- vnode.elm = vnode.data.attachData.placeholder;
- }
- function destroy(vnode) {
- // Remove placeholder
- if (vnode.elm !== undefined) {
- vnode.elm.parentNode.removeChild(vnode.elm);
- }
- // Remove real element from where it was inserted
- vnode.elm = vnode.data.attachData.real;
- }
- function create(_, vnode) {
- const real = vnode.elm;
- const attachData = vnode.data.attachData;
- const placeholder = document.createElement("span");
- // Replace actual element with dummy placeholder
- // Snabbdom will then insert placeholder instead
- vnode.elm = placeholder;
- attachData.target.appendChild(real);
- attachData.real = real;
- attachData.placeholder = placeholder;
- }
- function attachTo(target, vnode) {
- if (vnode.data === undefined)
- vnode.data = {};
- if (vnode.data.hook === undefined)
- vnode.data.hook = {};
- const data = vnode.data;
- const hook = vnode.data.hook;
- data.attachData = { target: target, placeholder: undefined, real: undefined };
- hook.create = create;
- hook.prepatch = pre;
- hook.postpatch = post;
- hook.destroy = destroy;
- return vnode;
- }
- function toVNode(node, domApi) {
- const api = domApi !== undefined ? domApi : htmlDomApi;
- let text;
- if (api.isElement(node)) {
- const id = node.id ? "#" + node.id : "";
- const cn = node.getAttribute("class");
- const c = cn ? "." + cn.split(" ").join(".") : "";
- const sel = api.tagName(node).toLowerCase() + id + c;
- const attrs = {};
- const children = [];
- let name;
- let i, n;
- const elmAttrs = node.attributes;
- const elmChildren = node.childNodes;
- for (i = 0, n = elmAttrs.length; i < n; i++) {
- name = elmAttrs[i].nodeName;
- if (name !== "id" && name !== "class") {
- attrs[name] = elmAttrs[i].nodeValue;
- }
- }
- for (i = 0, n = elmChildren.length; i < n; i++) {
- children.push(toVNode(elmChildren[i], domApi));
- }
- return vnode(sel, { attrs }, children, undefined, node);
- }
- else if (api.isText(node)) {
- text = api.getTextContent(node);
- return vnode(undefined, undefined, undefined, text, node);
- }
- else if (api.isComment(node)) {
- text = api.getTextContent(node);
- return vnode("!", {}, [], text, node);
- }
- else {
- return vnode("", {}, [], undefined, node);
- }
- }
- const xlinkNS = "http://www.w3.org/1999/xlink";
- const xmlNS = "http://www.w3.org/XML/1998/namespace";
- const colonChar = 58;
- const xChar = 120;
- function updateAttrs(oldVnode, vnode) {
- let key;
- const elm = vnode.elm;
- let oldAttrs = oldVnode.data.attrs;
- let attrs = vnode.data.attrs;
- if (!oldAttrs && !attrs)
- return;
- if (oldAttrs === attrs)
- return;
- oldAttrs = oldAttrs || {};
- attrs = attrs || {};
- // update modified attributes, add new attributes
- for (key in attrs) {
- const cur = attrs[key];
- const old = oldAttrs[key];
- if (old !== cur) {
- if (cur === true) {
- elm.setAttribute(key, "");
- }
- else if (cur === false) {
- elm.removeAttribute(key);
- }
- else {
- if (key.charCodeAt(0) !== xChar) {
- elm.setAttribute(key, cur);
- }
- else if (key.charCodeAt(3) === colonChar) {
- // Assume xml namespace
- elm.setAttributeNS(xmlNS, key, cur);
- }
- else if (key.charCodeAt(5) === colonChar) {
- // Assume xlink namespace
- elm.setAttributeNS(xlinkNS, key, cur);
- }
- else {
- elm.setAttribute(key, cur);
- }
- }
- }
- }
- // remove removed attributes
- // use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)
- // the other option is to remove all attributes with value == undefined
- for (key in oldAttrs) {
- if (!(key in attrs)) {
- elm.removeAttribute(key);
- }
- }
- }
- const attributesModule = {
- create: updateAttrs,
- update: updateAttrs,
- };
- function updateClass(oldVnode, vnode) {
- let cur;
- let name;
- const elm = vnode.elm;
- let oldClass = oldVnode.data.class;
- let klass = vnode.data.class;
- if (!oldClass && !klass)
- return;
- if (oldClass === klass)
- return;
- oldClass = oldClass || {};
- klass = klass || {};
- for (name in oldClass) {
- if (oldClass[name] && !Object.prototype.hasOwnProperty.call(klass, name)) {
- // was `true` and now not provided
- elm.classList.remove(name);
- }
- }
- for (name in klass) {
- cur = klass[name];
- if (cur !== oldClass[name]) {
- elm.classList[cur ? "add" : "remove"](name);
- }
- }
- }
- const classModule = { create: updateClass, update: updateClass };
- const CAPS_REGEX = /[A-Z]/g;
- function updateDataset(oldVnode, vnode) {
- const elm = vnode.elm;
- let oldDataset = oldVnode.data.dataset;
- let dataset = vnode.data.dataset;
- let key;
- if (!oldDataset && !dataset)
- return;
- if (oldDataset === dataset)
- return;
- oldDataset = oldDataset || {};
- dataset = dataset || {};
- const d = elm.dataset;
- for (key in oldDataset) {
- if (!dataset[key]) {
- if (d) {
- if (key in d) {
- delete d[key];
- }
- }
- else {
- elm.removeAttribute("data-" + key.replace(CAPS_REGEX, "-$&").toLowerCase());
- }
- }
- }
- for (key in dataset) {
- if (oldDataset[key] !== dataset[key]) {
- if (d) {
- d[key] = dataset[key];
- }
- else {
- elm.setAttribute("data-" + key.replace(CAPS_REGEX, "-$&").toLowerCase(), dataset[key]);
- }
- }
- }
- }
- const datasetModule = {
- create: updateDataset,
- update: updateDataset,
- };
- function invokeHandler(handler, vnode, event) {
- if (typeof handler === "function") {
- // call function handler
- handler.call(vnode, event, vnode);
- }
- else if (typeof handler === "object") {
- // call multiple handlers
- for (let i = 0; i < handler.length; i++) {
- invokeHandler(handler[i], vnode, event);
- }
- }
- }
- function handleEvent(event, vnode) {
- const name = event.type;
- const on = vnode.data.on;
- // call event handler(s) if exists
- if (on && on[name]) {
- invokeHandler(on[name], vnode, event);
- }
- }
- function createListener() {
- return function handler(event) {
- handleEvent(event, handler.vnode);
- };
- }
- function updateEventListeners(oldVnode, vnode) {
- const oldOn = oldVnode.data.on;
- const oldListener = oldVnode.listener;
- const oldElm = oldVnode.elm;
- const on = vnode && vnode.data.on;
- const elm = (vnode && vnode.elm);
- let name;
- // optimization for reused immutable handlers
- if (oldOn === on) {
- return;
- }
- // remove existing listeners which no longer used
- if (oldOn && oldListener) {
- // if element changed or deleted we remove all existing listeners unconditionally
- if (!on) {
- for (name in oldOn) {
- // remove listener if element was changed or existing listeners removed
- oldElm.removeEventListener(name, oldListener, false);
- }
- }
- else {
- for (name in oldOn) {
- // remove listener if existing listener removed
- if (!on[name]) {
- oldElm.removeEventListener(name, oldListener, false);
- }
- }
- }
- }
- // add new listeners which has not already attached
- if (on) {
- // reuse existing listener or create new
- const listener = (vnode.listener =
- oldVnode.listener || createListener());
- // update vnode for listener
- listener.vnode = vnode;
- // if element changed or added we add all needed listeners unconditionally
- if (!oldOn) {
- for (name in on) {
- // add listener if element was changed or new listeners added
- elm.addEventListener(name, listener, false);
- }
- }
- else {
- for (name in on) {
- // add listener if new listener added
- if (!oldOn[name]) {
- elm.addEventListener(name, listener, false);
- }
- }
- }
- }
- }
- const eventListenersModule = {
- create: updateEventListeners,
- update: updateEventListeners,
- destroy: updateEventListeners,
- };
- function updateProps(oldVnode, vnode) {
- let key;
- let cur;
- let old;
- const elm = vnode.elm;
- let oldProps = oldVnode.data.props;
- let props = vnode.data.props;
- if (!oldProps && !props)
- return;
- if (oldProps === props)
- return;
- oldProps = oldProps || {};
- props = props || {};
- for (key in props) {
- cur = props[key];
- old = oldProps[key];
- if (old !== cur && (key !== "value" || elm[key] !== cur)) {
- elm[key] = cur;
- }
- }
- }
- const propsModule = { create: updateProps, update: updateProps };
- // Bindig `requestAnimationFrame` like this fixes a bug in IE/Edge. See #360 and #409.
- const raf = (typeof window !== "undefined" &&
- window.requestAnimationFrame.bind(window)) ||
- setTimeout;
- const nextFrame = function (fn) {
- raf(function () {
- raf(fn);
- });
- };
- let reflowForced = false;
- function setNextFrame(obj, prop, val) {
- nextFrame(function () {
- obj[prop] = val;
- });
- }
- function updateStyle(oldVnode, vnode) {
- let cur;
- let name;
- const elm = vnode.elm;
- let oldStyle = oldVnode.data.style;
- let style = vnode.data.style;
- if (!oldStyle && !style)
- return;
- if (oldStyle === style)
- return;
- oldStyle = oldStyle || {};
- style = style || {};
- const oldHasDel = "delayed" in oldStyle;
- for (name in oldStyle) {
- if (!style[name]) {
- if (name[0] === "-" && name[1] === "-") {
- elm.style.removeProperty(name);
- }
- else {
- elm.style[name] = "";
- }
- }
- }
- for (name in style) {
- cur = style[name];
- if (name === "delayed" && style.delayed) {
- for (const name2 in style.delayed) {
- cur = style.delayed[name2];
- if (!oldHasDel || cur !== oldStyle.delayed[name2]) {
- setNextFrame(elm.style, name2, cur);
- }
- }
- }
- else if (name !== "remove" && cur !== oldStyle[name]) {
- if (name[0] === "-" && name[1] === "-") {
- elm.style.setProperty(name, cur);
- }
- else {
- elm.style[name] = cur;
- }
- }
- }
- }
- function applyDestroyStyle(vnode) {
- let style;
- let name;
- const elm = vnode.elm;
- const s = vnode.data.style;
- if (!s || !(style = s.destroy))
- return;
- for (name in style) {
- elm.style[name] = style[name];
- }
- }
- function applyRemoveStyle(vnode, rm) {
- const s = vnode.data.style;
- if (!s || !s.remove) {
- rm();
- return;
- }
- if (!reflowForced) {
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
- vnode.elm.offsetLeft;
- reflowForced = true;
- }
- let name;
- const elm = vnode.elm;
- let i = 0;
- const style = s.remove;
- let amount = 0;
- const applied = [];
- for (name in style) {
- applied.push(name);
- elm.style[name] = style[name];
- }
- const compStyle = getComputedStyle(elm);
- const props = compStyle["transition-property"].split(", ");
- for (; i < props.length; ++i) {
- if (applied.indexOf(props[i]) !== -1)
- amount++;
- }
- elm.addEventListener("transitionend", function (ev) {
- if (ev.target === elm)
- --amount;
- if (amount === 0)
- rm();
- });
- }
- function forceReflow() {
- reflowForced = false;
- }
- const styleModule = {
- pre: forceReflow,
- create: updateStyle,
- update: updateStyle,
- destroy: applyDestroyStyle,
- remove: applyRemoveStyle,
- };
- /* eslint-disable @typescript-eslint/no-namespace, import/export */
- function flattenAndFilter(children, flattened) {
- for (const child of children) {
- // filter out falsey children, except 0 since zero can be a valid value e.g inside a chart
- if (child !== undefined &&
- child !== null &&
- child !== false &&
- child !== "") {
- if (Array.isArray(child)) {
- flattenAndFilter(child, flattened);
- }
- else if (typeof child === "string" ||
- typeof child === "number" ||
- typeof child === "boolean") {
- flattened.push(vnode(undefined, undefined, undefined, String(child), undefined));
- }
- else {
- flattened.push(child);
- }
- }
- }
- return flattened;
- }
- /**
- * jsx/tsx compatible factory function
- * see: https://www.typescriptlang.org/docs/handbook/jsx.html#factory-functions
- */
- function jsx(tag, data, ...children) {
- const flatChildren = flattenAndFilter(children, []);
- if (typeof tag === "function") {
- // tag is a function component
- return tag(data, flatChildren);
- }
- else {
- if (flatChildren.length === 1 &&
- !flatChildren[0].sel &&
- flatChildren[0].text) {
- // only child is a simple text node, pass as text for a simpler vtree
- return h(tag, data, flatChildren[0].text);
- }
- else {
- return h(tag, data, flatChildren);
- }
- }
- }
- (function (jsx) {
- })(jsx || (jsx = {}));
- exports.array = array;
- exports.attachTo = attachTo;
- exports.attributesModule = attributesModule;
- exports.classModule = classModule;
- exports.datasetModule = datasetModule;
- exports.eventListenersModule = eventListenersModule;
- exports.h = h;
- exports.htmlDomApi = htmlDomApi;
- exports.init = init$1;
- exports.jsx = jsx;
- exports.primitive = primitive;
- exports.propsModule = propsModule;
- exports.styleModule = styleModule;
- exports.thunk = thunk;
- exports.toVNode = toVNode;
- exports.vnode = vnode;
- });
- /**
- * lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */
- /** Used as references for various `Number` constants. */
- var INFINITY = 1 / 0;
- /** `Object#toString` result references. */
- var symbolTag$1 = '[object Symbol]';
- /** Used to match words composed of alphanumeric characters. */
- var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
- /** Used to match Latin Unicode letters (excluding mathematical operators). */
- var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
- /** Used to compose unicode character classes. */
- var rsAstralRange = '\\ud800-\\udfff',
- rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
- rsComboSymbolsRange = '\\u20d0-\\u20f0',
- rsDingbatRange = '\\u2700-\\u27bf',
- rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
- rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
- rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
- rsPunctuationRange = '\\u2000-\\u206f',
- 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',
- rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
- rsVarRange = '\\ufe0e\\ufe0f',
- rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
- /** Used to compose unicode capture groups. */
- var rsApos = "['\u2019]",
- rsAstral = '[' + rsAstralRange + ']',
- rsBreak = '[' + rsBreakRange + ']',
- rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
- rsDigits = '\\d+',
- rsDingbat = '[' + rsDingbatRange + ']',
- rsLower = '[' + rsLowerRange + ']',
- rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
- rsFitz = '\\ud83c[\\udffb-\\udfff]',
- rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
- rsNonAstral = '[^' + rsAstralRange + ']',
- rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
- rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
- rsUpper = '[' + rsUpperRange + ']',
- rsZWJ = '\\u200d';
- /** Used to compose unicode regexes. */
- var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
- rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
- rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
- rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
- reOptMod = rsModifier + '?',
- rsOptVar = '[' + rsVarRange + ']?',
- rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
- rsSeq = rsOptVar + reOptMod + rsOptJoin,
- rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
- rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
- /** Used to match apostrophes. */
- var reApos = RegExp(rsApos, 'g');
- /**
- * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
- * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
- */
- var reComboMark = RegExp(rsCombo, 'g');
- /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
- var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
- /** Used to match complex or compound words. */
- var reUnicodeWord = RegExp([
- rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
- rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
- rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
- rsUpper + '+' + rsOptUpperContr,
- rsDigits,
- rsEmoji
- ].join('|'), 'g');
- /** 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/). */
- var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
- /** Used to detect strings that need a more robust regexp to match words. */
- 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 ]/;
- /** Used to map Latin Unicode letters to basic Latin letters. */
- var deburredLetters = {
- // Latin-1 Supplement block.
- '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
- '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
- '\xc7': 'C', '\xe7': 'c',
- '\xd0': 'D', '\xf0': 'd',
- '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
- '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
- '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
- '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
- '\xd1': 'N', '\xf1': 'n',
- '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
- '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
- '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
- '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
- '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
- '\xc6': 'Ae', '\xe6': 'ae',
- '\xde': 'Th', '\xfe': 'th',
- '\xdf': 'ss',
- // Latin Extended-A block.
- '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
- '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
- '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
- '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
- '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
- '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
- '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
- '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
- '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
- '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
- '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
- '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
- '\u0134': 'J', '\u0135': 'j',
- '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
- '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
- '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
- '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
- '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
- '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
- '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
- '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
- '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
- '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
- '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
- '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
- '\u0163': 't', '\u0165': 't', '\u0167': 't',
- '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
- '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
- '\u0174': 'W', '\u0175': 'w',
- '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
- '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
- '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
- '\u0132': 'IJ', '\u0133': 'ij',
- '\u0152': 'Oe', '\u0153': 'oe',
- '\u0149': "'n", '\u017f': 'ss'
- };
- /** Detect free variable `global` from Node.js. */
- var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
- /** Detect free variable `self`. */
- var freeSelf$1 = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root$1 = freeGlobal$1 || freeSelf$1 || Function('return this')();
- /**
- * A specialized version of `_.reduce` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {*} [accumulator] The initial value.
- * @param {boolean} [initAccum] Specify using the first element of `array` as
- * the initial value.
- * @returns {*} Returns the accumulated value.
- */
- function arrayReduce(array, iteratee, accumulator, initAccum) {
- var index = -1,
- length = array ? array.length : 0;
- if (initAccum && length) {
- accumulator = array[++index];
- }
- while (++index < length) {
- accumulator = iteratee(accumulator, array[index], index, array);
- }
- return accumulator;
- }
- /**
- * Converts an ASCII `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */
- function asciiToArray(string) {
- return string.split('');
- }
- /**
- * Splits an ASCII `string` into an array of its words.
- *
- * @private
- * @param {string} The string to inspect.
- * @returns {Array} Returns the words of `string`.
- */
- function asciiWords(string) {
- return string.match(reAsciiWord) || [];
- }
- /**
- * The base implementation of `_.propertyOf` without support for deep paths.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Function} Returns the new accessor function.
- */
- function basePropertyOf(object) {
- return function(key) {
- return object == null ? undefined : object[key];
- };
- }
- /**
- * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
- * letters to basic Latin letters.
- *
- * @private
- * @param {string} letter The matched letter to deburr.
- * @returns {string} Returns the deburred letter.
- */
- var deburrLetter = basePropertyOf(deburredLetters);
- /**
- * Checks if `string` contains Unicode symbols.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {boolean} Returns `true` if a symbol is found, else `false`.
- */
- function hasUnicode(string) {
- return reHasUnicode.test(string);
- }
- /**
- * Checks if `string` contains a word composed of Unicode symbols.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {boolean} Returns `true` if a word is found, else `false`.
- */
- function hasUnicodeWord(string) {
- return reHasUnicodeWord.test(string);
- }
- /**
- * Converts `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */
- function stringToArray(string) {
- return hasUnicode(string)
- ? unicodeToArray(string)
- : asciiToArray(string);
- }
- /**
- * Converts a Unicode `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */
- function unicodeToArray(string) {
- return string.match(reUnicode) || [];
- }
- /**
- * Splits a Unicode `string` into an array of its words.
- *
- * @private
- * @param {string} The string to inspect.
- * @returns {Array} Returns the words of `string`.
- */
- function unicodeWords(string) {
- return string.match(reUnicodeWord) || [];
- }
- /** Used for built-in method references. */
- var objectProto$1 = Object.prototype;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString$1 = objectProto$1.toString;
- /** Built-in value references. */
- var Symbol$1 = root$1.Symbol;
- /** Used to convert symbols to primitives and strings. */
- var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
- symbolToString = symbolProto ? symbolProto.toString : undefined;
- /**
- * The base implementation of `_.slice` without an iteratee call guard.
- *
- * @private
- * @param {Array} array The array to slice.
- * @param {number} [start=0] The start position.
- * @param {number} [end=array.length] The end position.
- * @returns {Array} Returns the slice of `array`.
- */
- function baseSlice(array, start, end) {
- var index = -1,
- length = array.length;
- if (start < 0) {
- start = -start > length ? 0 : (length + start);
- }
- end = end > length ? length : end;
- if (end < 0) {
- end += length;
- }
- length = start > end ? 0 : ((end - start) >>> 0);
- start >>>= 0;
- var result = Array(length);
- while (++index < length) {
- result[index] = array[index + start];
- }
- return result;
- }
- /**
- * The base implementation of `_.toString` which doesn't convert nullish
- * values to empty strings.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- */
- function baseToString(value) {
- // Exit early for strings to avoid a performance hit in some environments.
- if (typeof value == 'string') {
- return value;
- }
- if (isSymbol$1(value)) {
- return symbolToString ? symbolToString.call(value) : '';
- }
- var result = (value + '');
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
- }
- /**
- * Casts `array` to a slice if it's needed.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {number} start The start position.
- * @param {number} [end=array.length] The end position.
- * @returns {Array} Returns the cast slice.
- */
- function castSlice(array, start, end) {
- var length = array.length;
- end = end === undefined ? length : end;
- return (!start && end >= length) ? array : baseSlice(array, start, end);
- }
- /**
- * Creates a function like `_.lowerFirst`.
- *
- * @private
- * @param {string} methodName The name of the `String` case method to use.
- * @returns {Function} Returns the new case function.
- */
- function createCaseFirst(methodName) {
- return function(string) {
- string = toString(string);
- var strSymbols = hasUnicode(string)
- ? stringToArray(string)
- : undefined;
- var chr = strSymbols
- ? strSymbols[0]
- : string.charAt(0);
- var trailing = strSymbols
- ? castSlice(strSymbols, 1).join('')
- : string.slice(1);
- return chr[methodName]() + trailing;
- };
- }
- /**
- * Creates a function like `_.camelCase`.
- *
- * @private
- * @param {Function} callback The function to combine each word.
- * @returns {Function} Returns the new compounder function.
- */
- function createCompounder(callback) {
- return function(string) {
- return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
- };
- }
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike$1(value) {
- return !!value && typeof value == 'object';
- }
- /**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */
- function isSymbol$1(value) {
- return typeof value == 'symbol' ||
- (isObjectLike$1(value) && objectToString$1.call(value) == symbolTag$1);
- }
- /**
- * Converts `value` to a string. An empty string is returned for `null`
- * and `undefined` values. The sign of `-0` is preserved.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- * @example
- *
- * _.toString(null);
- * // => ''
- *
- * _.toString(-0);
- * // => '-0'
- *
- * _.toString([1, 2, 3]);
- * // => '1,2,3'
- */
- function toString(value) {
- return value == null ? '' : baseToString(value);
- }
- /**
- * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the camel cased string.
- * @example
- *
- * _.camelCase('Foo Bar');
- * // => 'fooBar'
- *
- * _.camelCase('--foo-bar--');
- * // => 'fooBar'
- *
- * _.camelCase('__FOO_BAR__');
- * // => 'fooBar'
- */
- var camelCase = createCompounder(function(result, word, index) {
- word = word.toLowerCase();
- return result + (index ? capitalize(word) : word);
- });
- /**
- * Converts the first character of `string` to upper case and the remaining
- * to lower case.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to capitalize.
- * @returns {string} Returns the capitalized string.
- * @example
- *
- * _.capitalize('FRED');
- * // => 'Fred'
- */
- function capitalize(string) {
- return upperFirst(toString(string).toLowerCase());
- }
- /**
- * Deburrs `string` by converting
- * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
- * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
- * letters to basic Latin letters and removing
- * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to deburr.
- * @returns {string} Returns the deburred string.
- * @example
- *
- * _.deburr('déjà vu');
- * // => 'deja vu'
- */
- function deburr(string) {
- string = toString(string);
- return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
- }
- /**
- * Converts the first character of `string` to upper case.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the converted string.
- * @example
- *
- * _.upperFirst('fred');
- * // => 'Fred'
- *
- * _.upperFirst('FRED');
- * // => 'FRED'
- */
- var upperFirst = createCaseFirst('toUpperCase');
- /**
- * Splits `string` into an array of its words.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to inspect.
- * @param {RegExp|string} [pattern] The pattern to match words.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Array} Returns the words of `string`.
- * @example
- *
- * _.words('fred, barney, & pebbles');
- * // => ['fred', 'barney', 'pebbles']
- *
- * _.words('fred, barney, & pebbles', /[^, ]+/g);
- * // => ['fred', 'barney', '&', 'pebbles']
- */
- function words(string, pattern, guard) {
- string = toString(string);
- pattern = guard ? undefined : pattern;
- if (pattern === undefined) {
- return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
- }
- return string.match(pattern) || [];
- }
- var lodash_camelcase = camelCase;
- /**
- * Constants.
- */
- var IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
- var MODIFIERS = {
- alt: 'altKey',
- control: 'ctrlKey',
- meta: 'metaKey',
- shift: 'shiftKey'
- };
- var ALIASES = {
- add: '+',
- break: 'pause',
- cmd: 'meta',
- command: 'meta',
- ctl: 'control',
- ctrl: 'control',
- del: 'delete',
- down: 'arrowdown',
- esc: 'escape',
- ins: 'insert',
- left: 'arrowleft',
- mod: IS_MAC ? 'meta' : 'control',
- opt: 'alt',
- option: 'alt',
- return: 'enter',
- right: 'arrowright',
- space: ' ',
- spacebar: ' ',
- up: 'arrowup',
- win: 'meta',
- windows: 'meta'
- };
- var CODES = {
- backspace: 8,
- tab: 9,
- enter: 13,
- shift: 16,
- control: 17,
- alt: 18,
- pause: 19,
- capslock: 20,
- escape: 27,
- ' ': 32,
- pageup: 33,
- pagedown: 34,
- end: 35,
- home: 36,
- arrowleft: 37,
- arrowup: 38,
- arrowright: 39,
- arrowdown: 40,
- insert: 45,
- delete: 46,
- meta: 91,
- numlock: 144,
- scrolllock: 145,
- ';': 186,
- '=': 187,
- ',': 188,
- '-': 189,
- '.': 190,
- '/': 191,
- '`': 192,
- '[': 219,
- '\\': 220,
- ']': 221,
- '\'': 222
- };
- for (var f = 1; f < 20; f++) {
- CODES['f' + f] = 111 + f;
- }
- /**
- * Is hotkey?
- */
- function isHotkey(hotkey, options, event) {
- if (options && !('byKey' in options)) {
- event = options;
- options = null;
- }
- if (!Array.isArray(hotkey)) {
- hotkey = [hotkey];
- }
- var array = hotkey.map(function (string) {
- return parseHotkey(string, options);
- });
- var check = function check(e) {
- return array.some(function (object) {
- return compareHotkey(object, e);
- });
- };
- var ret = event == null ? check : check(event);
- return ret;
- }
- function isCodeHotkey(hotkey, event) {
- return isHotkey(hotkey, event);
- }
- function isKeyHotkey(hotkey, event) {
- return isHotkey(hotkey, { byKey: true }, event);
- }
- /**
- * Parse.
- */
- function parseHotkey(hotkey, options) {
- var byKey = options && options.byKey;
- var ret = {};
- // Special case to handle the `+` key since we use it as a separator.
- hotkey = hotkey.replace('++', '+add');
- var values = hotkey.split('+');
- var length = values.length;
- // Ensure that all the modifiers are set to false unless the hotkey has them.
- for (var k in MODIFIERS) {
- ret[MODIFIERS[k]] = false;
- }
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
- try {
- for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var value = _step.value;
- var optional = value.endsWith('?') && value.length > 1;
- if (optional) {
- value = value.slice(0, -1);
- }
- var name = toKeyName(value);
- var modifier = MODIFIERS[name];
- if (value.length > 1 && !modifier && !ALIASES[value] && !CODES[name]) {
- throw new TypeError('Unknown modifier: "' + value + '"');
- }
- if (length === 1 || !modifier) {
- if (byKey) {
- ret.key = name;
- } else {
- ret.which = toKeyCode(value);
- }
- }
- if (modifier) {
- ret[modifier] = optional ? null : true;
- }
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- return ret;
- }
- /**
- * Compare.
- */
- function compareHotkey(object, event) {
- for (var key in object) {
- var expected = object[key];
- var actual = void 0;
- if (expected == null) {
- continue;
- }
- if (key === 'key' && event.key != null) {
- actual = event.key.toLowerCase();
- } else if (key === 'which') {
- actual = expected === 91 && event.which === 93 ? 91 : event.which;
- } else {
- actual = event[key];
- }
- if (actual == null && expected === false) {
- continue;
- }
- if (actual !== expected) {
- return false;
- }
- }
- return true;
- }
- /**
- * Utils.
- */
- function toKeyCode(name) {
- name = toKeyName(name);
- var code = CODES[name] || name.toUpperCase().charCodeAt(0);
- return code;
- }
- function toKeyName(name) {
- name = name.toLowerCase();
- name = ALIASES[name] || name;
- return name;
- }
- /**
- * Export.
- */
- var _default = isHotkey;
- var isHotkey_1 = isHotkey;
- var isCodeHotkey_1 = isCodeHotkey;
- var isKeyHotkey_1 = isKeyHotkey;
- var parseHotkey_1 = parseHotkey;
- var compareHotkey_1 = compareHotkey;
- var toKeyCode_1 = toKeyCode;
- var toKeyName_1 = toKeyName;
- var lib$4 = /*#__PURE__*/Object.defineProperty({
- default: _default,
- isHotkey: isHotkey_1,
- isCodeHotkey: isCodeHotkey_1,
- isKeyHotkey: isKeyHotkey_1,
- parseHotkey: parseHotkey_1,
- compareHotkey: compareHotkey_1,
- toKeyCode: toKeyCode_1,
- toKeyName: toKeyName_1
- }, '__esModule', {value: true});
- /**
- * lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */
- /** Used as the `TypeError` message for "Functions" methods. */
- var FUNC_ERROR_TEXT = 'Expected a function';
- /** Used as references for various `Number` constants. */
- var NAN = 0 / 0;
- /** `Object#toString` result references. */
- var symbolTag = '[object Symbol]';
- /** Used to match leading and trailing whitespace. */
- var reTrim = /^\s+|\s+$/g;
- /** Used to detect bad signed hexadecimal string values. */
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
- /** Used to detect binary string values. */
- var reIsBinary = /^0b[01]+$/i;
- /** Used to detect octal string values. */
- var reIsOctal = /^0o[0-7]+$/i;
- /** Built-in method references without a dependency on `root`. */
- var freeParseInt = parseInt;
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
- /** Detect free variable `self`. */
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root = freeGlobal || freeSelf || Function('return this')();
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString = objectProto.toString;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeMax = Math.max,
- nativeMin = Math.min;
- /**
- * Gets the timestamp of the number of milliseconds that have elapsed since
- * the Unix epoch (1 January 1970 00:00:00 UTC).
- *
- * @static
- * @memberOf _
- * @since 2.4.0
- * @category Date
- * @returns {number} Returns the timestamp.
- * @example
- *
- * _.defer(function(stamp) {
- * console.log(_.now() - stamp);
- * }, _.now());
- * // => Logs the number of milliseconds it took for the deferred invocation.
- */
- var now = function() {
- return root.Date.now();
- };
- /**
- * Creates a debounced function that delays invoking `func` until after `wait`
- * milliseconds have elapsed since the last time the debounced function was
- * invoked. The debounced function comes with a `cancel` method to cancel
- * delayed `func` invocations and a `flush` method to immediately invoke them.
- * Provide `options` to indicate whether `func` should be invoked on the
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
- * with the last arguments provided to the debounced function. Subsequent
- * calls to the debounced function return the result of the last `func`
- * invocation.
- *
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
- * invoked on the trailing edge of the timeout only if the debounced function
- * is invoked more than once during the `wait` timeout.
- *
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
- *
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
- * for details over the differences between `_.debounce` and `_.throttle`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Function
- * @param {Function} func The function to debounce.
- * @param {number} [wait=0] The number of milliseconds to delay.
- * @param {Object} [options={}] The options object.
- * @param {boolean} [options.leading=false]
- * Specify invoking on the leading edge of the timeout.
- * @param {number} [options.maxWait]
- * The maximum time `func` is allowed to be delayed before it's invoked.
- * @param {boolean} [options.trailing=true]
- * Specify invoking on the trailing edge of the timeout.
- * @returns {Function} Returns the new debounced function.
- * @example
- *
- * // Avoid costly calculations while the window size is in flux.
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
- *
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
- * 'leading': true,
- * 'trailing': false
- * }));
- *
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
- * var source = new EventSource('/stream');
- * jQuery(source).on('message', debounced);
- *
- * // Cancel the trailing debounced invocation.
- * jQuery(window).on('popstate', debounced.cancel);
- */
- function debounce$1(func, wait, options) {
- var lastArgs,
- lastThis,
- maxWait,
- result,
- timerId,
- lastCallTime,
- lastInvokeTime = 0,
- leading = false,
- maxing = false,
- trailing = true;
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- wait = toNumber(wait) || 0;
- if (isObject(options)) {
- leading = !!options.leading;
- maxing = 'maxWait' in options;
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
- trailing = 'trailing' in options ? !!options.trailing : trailing;
- }
- function invokeFunc(time) {
- var args = lastArgs,
- thisArg = lastThis;
- lastArgs = lastThis = undefined;
- lastInvokeTime = time;
- result = func.apply(thisArg, args);
- return result;
- }
- function leadingEdge(time) {
- // Reset any `maxWait` timer.
- lastInvokeTime = time;
- // Start the timer for the trailing edge.
- timerId = setTimeout(timerExpired, wait);
- // Invoke the leading edge.
- return leading ? invokeFunc(time) : result;
- }
- function remainingWait(time) {
- var timeSinceLastCall = time - lastCallTime,
- timeSinceLastInvoke = time - lastInvokeTime,
- result = wait - timeSinceLastCall;
- return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
- }
- function shouldInvoke(time) {
- var timeSinceLastCall = time - lastCallTime,
- timeSinceLastInvoke = time - lastInvokeTime;
- // Either this is the first call, activity has stopped and we're at the
- // trailing edge, the system time has gone backwards and we're treating
- // it as the trailing edge, or we've hit the `maxWait` limit.
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
- }
- function timerExpired() {
- var time = now();
- if (shouldInvoke(time)) {
- return trailingEdge(time);
- }
- // Restart the timer.
- timerId = setTimeout(timerExpired, remainingWait(time));
- }
- function trailingEdge(time) {
- timerId = undefined;
- // Only invoke if we have `lastArgs` which means `func` has been
- // debounced at least once.
- if (trailing && lastArgs) {
- return invokeFunc(time);
- }
- lastArgs = lastThis = undefined;
- return result;
- }
- function cancel() {
- if (timerId !== undefined) {
- clearTimeout(timerId);
- }
- lastInvokeTime = 0;
- lastArgs = lastCallTime = lastThis = timerId = undefined;
- }
- function flush() {
- return timerId === undefined ? result : trailingEdge(now());
- }
- function debounced() {
- var time = now(),
- isInvoking = shouldInvoke(time);
- lastArgs = arguments;
- lastThis = this;
- lastCallTime = time;
- if (isInvoking) {
- if (timerId === undefined) {
- return leadingEdge(lastCallTime);
- }
- if (maxing) {
- // Handle invocations in a tight loop.
- timerId = setTimeout(timerExpired, wait);
- return invokeFunc(lastCallTime);
- }
- }
- if (timerId === undefined) {
- timerId = setTimeout(timerExpired, wait);
- }
- return result;
- }
- debounced.cancel = cancel;
- debounced.flush = flush;
- return debounced;
- }
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject(value) {
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
- }
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike(value) {
- return !!value && typeof value == 'object';
- }
- /**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */
- function isSymbol(value) {
- return typeof value == 'symbol' ||
- (isObjectLike(value) && objectToString.call(value) == symbolTag);
- }
- /**
- * Converts `value` to a number.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
- * @example
- *
- * _.toNumber(3.2);
- * // => 3.2
- *
- * _.toNumber(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toNumber(Infinity);
- * // => Infinity
- *
- * _.toNumber('3.2');
- * // => 3.2
- */
- function toNumber(value) {
- if (typeof value == 'number') {
- return value;
- }
- if (isSymbol(value)) {
- return NAN;
- }
- if (isObject(value)) {
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
- value = isObject(other) ? (other + '') : other;
- }
- if (typeof value != 'string') {
- return value === 0 ? value : +value;
- }
- value = value.replace(reTrim, '');
- var isBinary = reIsBinary.test(value);
- return (isBinary || reIsOctal.test(value))
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
- : (reIsBadHex.test(value) ? NAN : +value);
- }
- var lodash_debounce = debounce$1;
- /**
- * lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */
- var lodash_clonedeep = createCommonjsModule$1(function (module, exports) {
- /** Used as the size to enable large array optimizations. */
- var LARGE_ARRAY_SIZE = 200;
- /** Used to stand-in for `undefined` hash values. */
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER = 9007199254740991;
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]',
- arrayTag = '[object Array]',
- boolTag = '[object Boolean]',
- dateTag = '[object Date]',
- errorTag = '[object Error]',
- funcTag = '[object Function]',
- genTag = '[object GeneratorFunction]',
- mapTag = '[object Map]',
- numberTag = '[object Number]',
- objectTag = '[object Object]',
- promiseTag = '[object Promise]',
- regexpTag = '[object RegExp]',
- setTag = '[object Set]',
- stringTag = '[object String]',
- symbolTag = '[object Symbol]',
- weakMapTag = '[object WeakMap]';
- var arrayBufferTag = '[object ArrayBuffer]',
- dataViewTag = '[object DataView]',
- float32Tag = '[object Float32Array]',
- float64Tag = '[object Float64Array]',
- int8Tag = '[object Int8Array]',
- int16Tag = '[object Int16Array]',
- int32Tag = '[object Int32Array]',
- uint8Tag = '[object Uint8Array]',
- uint8ClampedTag = '[object Uint8ClampedArray]',
- uint16Tag = '[object Uint16Array]',
- uint32Tag = '[object Uint32Array]';
- /**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
- /** Used to match `RegExp` flags from their coerced string values. */
- var reFlags = /\w*$/;
- /** Used to detect host constructors (Safari). */
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
- /** Used to detect unsigned integer values. */
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- /** Used to identify `toStringTag` values supported by `_.clone`. */
- var cloneableTags = {};
- cloneableTags[argsTag] = cloneableTags[arrayTag] =
- cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
- cloneableTags[boolTag] = cloneableTags[dateTag] =
- cloneableTags[float32Tag] = cloneableTags[float64Tag] =
- cloneableTags[int8Tag] = cloneableTags[int16Tag] =
- cloneableTags[int32Tag] = cloneableTags[mapTag] =
- cloneableTags[numberTag] = cloneableTags[objectTag] =
- cloneableTags[regexpTag] = cloneableTags[setTag] =
- cloneableTags[stringTag] = cloneableTags[symbolTag] =
- cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
- cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
- cloneableTags[errorTag] = cloneableTags[funcTag] =
- cloneableTags[weakMapTag] = false;
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
- /** Detect free variable `self`. */
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root = freeGlobal || freeSelf || Function('return this')();
- /** Detect free variable `exports`. */
- var freeExports = exports && !exports.nodeType && exports;
- /** Detect free variable `module`. */
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
- /** Detect the popular CommonJS extension `module.exports`. */
- var moduleExports = freeModule && freeModule.exports === freeExports;
- /**
- * Adds the key-value `pair` to `map`.
- *
- * @private
- * @param {Object} map The map to modify.
- * @param {Array} pair The key-value pair to add.
- * @returns {Object} Returns `map`.
- */
- function addMapEntry(map, pair) {
- // Don't return `map.set` because it's not chainable in IE 11.
- map.set(pair[0], pair[1]);
- return map;
- }
- /**
- * Adds `value` to `set`.
- *
- * @private
- * @param {Object} set The set to modify.
- * @param {*} value The value to add.
- * @returns {Object} Returns `set`.
- */
- function addSetEntry(set, value) {
- // Don't return `set.add` because it's not chainable in IE 11.
- set.add(value);
- return set;
- }
- /**
- * A specialized version of `_.forEach` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns `array`.
- */
- function arrayEach(array, iteratee) {
- var index = -1,
- length = array ? array.length : 0;
- while (++index < length) {
- if (iteratee(array[index], index, array) === false) {
- break;
- }
- }
- return array;
- }
- /**
- * Appends the elements of `values` to `array`.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {Array} values The values to append.
- * @returns {Array} Returns `array`.
- */
- function arrayPush(array, values) {
- var index = -1,
- length = values.length,
- offset = array.length;
- while (++index < length) {
- array[offset + index] = values[index];
- }
- return array;
- }
- /**
- * A specialized version of `_.reduce` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {*} [accumulator] The initial value.
- * @param {boolean} [initAccum] Specify using the first element of `array` as
- * the initial value.
- * @returns {*} Returns the accumulated value.
- */
- function arrayReduce(array, iteratee, accumulator, initAccum) {
- var index = -1,
- length = array ? array.length : 0;
- if (initAccum && length) {
- accumulator = array[++index];
- }
- while (++index < length) {
- accumulator = iteratee(accumulator, array[index], index, array);
- }
- return accumulator;
- }
- /**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
- function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- /**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */
- function getValue(object, key) {
- return object == null ? undefined : object[key];
- }
- /**
- * Checks if `value` is a host object in IE < 9.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
- */
- function isHostObject(value) {
- // Many host objects are `Object` objects that can coerce to strings
- // despite having improperly defined `toString` methods.
- var result = false;
- if (value != null && typeof value.toString != 'function') {
- try {
- result = !!(value + '');
- } catch (e) {}
- }
- return result;
- }
- /**
- * Converts `map` to its key-value pairs.
- *
- * @private
- * @param {Object} map The map to convert.
- * @returns {Array} Returns the key-value pairs.
- */
- function mapToArray(map) {
- var index = -1,
- result = Array(map.size);
- map.forEach(function(value, key) {
- result[++index] = [key, value];
- });
- return result;
- }
- /**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
- /**
- * Converts `set` to an array of its values.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the values.
- */
- function setToArray(set) {
- var index = -1,
- result = Array(set.size);
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
- }
- /** Used for built-in method references. */
- var arrayProto = Array.prototype,
- funcProto = Function.prototype,
- objectProto = Object.prototype;
- /** Used to detect overreaching core-js shims. */
- var coreJsData = root['__core-js_shared__'];
- /** Used to detect methods masquerading as native. */
- var maskSrcKey = (function() {
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
- return uid ? ('Symbol(src)_1.' + uid) : '';
- }());
- /** Used to resolve the decompiled source of functions. */
- var funcToString = funcProto.toString;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString = objectProto.toString;
- /** Used to detect if a method is native. */
- var reIsNative = RegExp('^' +
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
- );
- /** Built-in value references. */
- var Buffer = moduleExports ? root.Buffer : undefined,
- Symbol = root.Symbol,
- Uint8Array = root.Uint8Array,
- getPrototype = overArg(Object.getPrototypeOf, Object),
- objectCreate = Object.create,
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
- splice = arrayProto.splice;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeGetSymbols = Object.getOwnPropertySymbols,
- nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
- nativeKeys = overArg(Object.keys, Object);
- /* Built-in method references that are verified to be native. */
- var DataView = getNative(root, 'DataView'),
- Map = getNative(root, 'Map'),
- Promise = getNative(root, 'Promise'),
- Set = getNative(root, 'Set'),
- WeakMap = getNative(root, 'WeakMap'),
- nativeCreate = getNative(Object, 'create');
- /** Used to detect maps, sets, and weakmaps. */
- var dataViewCtorString = toSource(DataView),
- mapCtorString = toSource(Map),
- promiseCtorString = toSource(Promise),
- setCtorString = toSource(Set),
- weakMapCtorString = toSource(WeakMap);
- /** Used to convert symbols to primitives and strings. */
- var symbolProto = Symbol ? Symbol.prototype : undefined,
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
- /**
- * Creates a hash object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function Hash(entries) {
- var index = -1,
- length = entries ? entries.length : 0;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- /**
- * Removes all key-value entries from the hash.
- *
- * @private
- * @name clear
- * @memberOf Hash
- */
- function hashClear() {
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
- }
- /**
- * Removes `key` and its value from the hash.
- *
- * @private
- * @name delete
- * @memberOf Hash
- * @param {Object} hash The hash to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function hashDelete(key) {
- return this.has(key) && delete this.__data__[key];
- }
- /**
- * Gets the hash value for `key`.
- *
- * @private
- * @name get
- * @memberOf Hash
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function hashGet(key) {
- var data = this.__data__;
- if (nativeCreate) {
- var result = data[key];
- return result === HASH_UNDEFINED ? undefined : result;
- }
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
- }
- /**
- * Checks if a hash value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Hash
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function hashHas(key) {
- var data = this.__data__;
- return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
- }
- /**
- * Sets the hash `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Hash
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the hash instance.
- */
- function hashSet(key, value) {
- var data = this.__data__;
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
- return this;
- }
- // Add methods to `Hash`.
- Hash.prototype.clear = hashClear;
- Hash.prototype['delete'] = hashDelete;
- Hash.prototype.get = hashGet;
- Hash.prototype.has = hashHas;
- Hash.prototype.set = hashSet;
- /**
- * Creates an list cache object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function ListCache(entries) {
- var index = -1,
- length = entries ? entries.length : 0;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- /**
- * Removes all key-value entries from the list cache.
- *
- * @private
- * @name clear
- * @memberOf ListCache
- */
- function listCacheClear() {
- this.__data__ = [];
- }
- /**
- * Removes `key` and its value from the list cache.
- *
- * @private
- * @name delete
- * @memberOf ListCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function listCacheDelete(key) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
- if (index < 0) {
- return false;
- }
- var lastIndex = data.length - 1;
- if (index == lastIndex) {
- data.pop();
- } else {
- splice.call(data, index, 1);
- }
- return true;
- }
- /**
- * Gets the list cache value for `key`.
- *
- * @private
- * @name get
- * @memberOf ListCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function listCacheGet(key) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
- return index < 0 ? undefined : data[index][1];
- }
- /**
- * Checks if a list cache value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf ListCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function listCacheHas(key) {
- return assocIndexOf(this.__data__, key) > -1;
- }
- /**
- * Sets the list cache `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf ListCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the list cache instance.
- */
- function listCacheSet(key, value) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
- if (index < 0) {
- data.push([key, value]);
- } else {
- data[index][1] = value;
- }
- return this;
- }
- // Add methods to `ListCache`.
- ListCache.prototype.clear = listCacheClear;
- ListCache.prototype['delete'] = listCacheDelete;
- ListCache.prototype.get = listCacheGet;
- ListCache.prototype.has = listCacheHas;
- ListCache.prototype.set = listCacheSet;
- /**
- * Creates a map cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function MapCache(entries) {
- var index = -1,
- length = entries ? entries.length : 0;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- /**
- * Removes all key-value entries from the map.
- *
- * @private
- * @name clear
- * @memberOf MapCache
- */
- function mapCacheClear() {
- this.__data__ = {
- 'hash': new Hash,
- 'map': new (Map || ListCache),
- 'string': new Hash
- };
- }
- /**
- * Removes `key` and its value from the map.
- *
- * @private
- * @name delete
- * @memberOf MapCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function mapCacheDelete(key) {
- return getMapData(this, key)['delete'](key);
- }
- /**
- * Gets the map value for `key`.
- *
- * @private
- * @name get
- * @memberOf MapCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function mapCacheGet(key) {
- return getMapData(this, key).get(key);
- }
- /**
- * Checks if a map value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf MapCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function mapCacheHas(key) {
- return getMapData(this, key).has(key);
- }
- /**
- * Sets the map `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf MapCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the map cache instance.
- */
- function mapCacheSet(key, value) {
- getMapData(this, key).set(key, value);
- return this;
- }
- // Add methods to `MapCache`.
- MapCache.prototype.clear = mapCacheClear;
- MapCache.prototype['delete'] = mapCacheDelete;
- MapCache.prototype.get = mapCacheGet;
- MapCache.prototype.has = mapCacheHas;
- MapCache.prototype.set = mapCacheSet;
- /**
- * Creates a stack cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function Stack(entries) {
- this.__data__ = new ListCache(entries);
- }
- /**
- * Removes all key-value entries from the stack.
- *
- * @private
- * @name clear
- * @memberOf Stack
- */
- function stackClear() {
- this.__data__ = new ListCache;
- }
- /**
- * Removes `key` and its value from the stack.
- *
- * @private
- * @name delete
- * @memberOf Stack
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function stackDelete(key) {
- return this.__data__['delete'](key);
- }
- /**
- * Gets the stack value for `key`.
- *
- * @private
- * @name get
- * @memberOf Stack
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function stackGet(key) {
- return this.__data__.get(key);
- }
- /**
- * Checks if a stack value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Stack
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function stackHas(key) {
- return this.__data__.has(key);
- }
- /**
- * Sets the stack `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Stack
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the stack cache instance.
- */
- function stackSet(key, value) {
- var cache = this.__data__;
- if (cache instanceof ListCache) {
- var pairs = cache.__data__;
- if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
- pairs.push([key, value]);
- return this;
- }
- cache = this.__data__ = new MapCache(pairs);
- }
- cache.set(key, value);
- return this;
- }
- // Add methods to `Stack`.
- Stack.prototype.clear = stackClear;
- Stack.prototype['delete'] = stackDelete;
- Stack.prototype.get = stackGet;
- Stack.prototype.has = stackHas;
- Stack.prototype.set = stackSet;
- /**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */
- function arrayLikeKeys(value, inherited) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- // Safari 9 makes `arguments.length` enumerable in strict mode.
- var result = (isArray(value) || isArguments(value))
- ? baseTimes(value.length, String)
- : [];
- var length = result.length,
- skipIndexes = !!length;
- for (var key in value) {
- if ((inherited || hasOwnProperty.call(value, key)) &&
- !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * for equality comparisons.
- *
- * @private
- * @param {Object} object The object to modify.
- * @param {string} key The key of the property to assign.
- * @param {*} value The value to assign.
- */
- function assignValue(object, key, value) {
- var objValue = object[key];
- if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
- (value === undefined && !(key in object))) {
- object[key] = value;
- }
- }
- /**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */
- function assocIndexOf(array, key) {
- var length = array.length;
- while (length--) {
- if (eq(array[length][0], key)) {
- return length;
- }
- }
- return -1;
- }
- /**
- * The base implementation of `_.assign` without support for multiple sources
- * or `customizer` functions.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @returns {Object} Returns `object`.
- */
- function baseAssign(object, source) {
- return object && copyObject(source, keys(source), object);
- }
- /**
- * The base implementation of `_.clone` and `_.cloneDeep` which tracks
- * traversed objects.
- *
- * @private
- * @param {*} value The value to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @param {boolean} [isFull] Specify a clone including symbols.
- * @param {Function} [customizer] The function to customize cloning.
- * @param {string} [key] The key of `value`.
- * @param {Object} [object] The parent object of `value`.
- * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
- * @returns {*} Returns the cloned value.
- */
- function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
- var result;
- if (customizer) {
- result = object ? customizer(value, key, object, stack) : customizer(value);
- }
- if (result !== undefined) {
- return result;
- }
- if (!isObject(value)) {
- return value;
- }
- var isArr = isArray(value);
- if (isArr) {
- result = initCloneArray(value);
- if (!isDeep) {
- return copyArray(value, result);
- }
- } else {
- var tag = getTag(value),
- isFunc = tag == funcTag || tag == genTag;
- if (isBuffer(value)) {
- return cloneBuffer(value, isDeep);
- }
- if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
- if (isHostObject(value)) {
- return object ? value : {};
- }
- result = initCloneObject(isFunc ? {} : value);
- if (!isDeep) {
- return copySymbols(value, baseAssign(result, value));
- }
- } else {
- if (!cloneableTags[tag]) {
- return object ? value : {};
- }
- result = initCloneByTag(value, tag, baseClone, isDeep);
- }
- }
- // Check for circular references and return its corresponding clone.
- stack || (stack = new Stack);
- var stacked = stack.get(value);
- if (stacked) {
- return stacked;
- }
- stack.set(value, result);
- if (!isArr) {
- var props = isFull ? getAllKeys(value) : keys(value);
- }
- arrayEach(props || value, function(subValue, key) {
- if (props) {
- key = subValue;
- subValue = value[key];
- }
- // Recursively populate clone (susceptible to call stack limits).
- assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
- });
- return result;
- }
- /**
- * The base implementation of `_.create` without support for assigning
- * properties to the created object.
- *
- * @private
- * @param {Object} prototype The object to inherit from.
- * @returns {Object} Returns the new object.
- */
- function baseCreate(proto) {
- return isObject(proto) ? objectCreate(proto) : {};
- }
- /**
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
- * symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
- * @returns {Array} Returns the array of property names and symbols.
- */
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
- var result = keysFunc(object);
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
- }
- /**
- * The base implementation of `getTag`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- function baseGetTag(value) {
- return objectToString.call(value);
- }
- /**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */
- function baseIsNative(value) {
- if (!isObject(value) || isMasked(value)) {
- return false;
- }
- var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
- return pattern.test(toSource(value));
- }
- /**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function baseKeys(object) {
- if (!isPrototype(object)) {
- return nativeKeys(object);
- }
- var result = [];
- for (var key in Object(object)) {
- if (hasOwnProperty.call(object, key) && key != 'constructor') {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * Creates a clone of `buffer`.
- *
- * @private
- * @param {Buffer} buffer The buffer to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Buffer} Returns the cloned buffer.
- */
- function cloneBuffer(buffer, isDeep) {
- if (isDeep) {
- return buffer.slice();
- }
- var result = new buffer.constructor(buffer.length);
- buffer.copy(result);
- return result;
- }
- /**
- * Creates a clone of `arrayBuffer`.
- *
- * @private
- * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
- * @returns {ArrayBuffer} Returns the cloned array buffer.
- */
- function cloneArrayBuffer(arrayBuffer) {
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
- new Uint8Array(result).set(new Uint8Array(arrayBuffer));
- return result;
- }
- /**
- * Creates a clone of `dataView`.
- *
- * @private
- * @param {Object} dataView The data view to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the cloned data view.
- */
- function cloneDataView(dataView, isDeep) {
- var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
- }
- /**
- * Creates a clone of `map`.
- *
- * @private
- * @param {Object} map The map to clone.
- * @param {Function} cloneFunc The function to clone values.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the cloned map.
- */
- function cloneMap(map, isDeep, cloneFunc) {
- var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
- return arrayReduce(array, addMapEntry, new map.constructor);
- }
- /**
- * Creates a clone of `regexp`.
- *
- * @private
- * @param {Object} regexp The regexp to clone.
- * @returns {Object} Returns the cloned regexp.
- */
- function cloneRegExp(regexp) {
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
- result.lastIndex = regexp.lastIndex;
- return result;
- }
- /**
- * Creates a clone of `set`.
- *
- * @private
- * @param {Object} set The set to clone.
- * @param {Function} cloneFunc The function to clone values.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the cloned set.
- */
- function cloneSet(set, isDeep, cloneFunc) {
- var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
- return arrayReduce(array, addSetEntry, new set.constructor);
- }
- /**
- * Creates a clone of the `symbol` object.
- *
- * @private
- * @param {Object} symbol The symbol object to clone.
- * @returns {Object} Returns the cloned symbol object.
- */
- function cloneSymbol(symbol) {
- return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
- }
- /**
- * Creates a clone of `typedArray`.
- *
- * @private
- * @param {Object} typedArray The typed array to clone.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the cloned typed array.
- */
- function cloneTypedArray(typedArray, isDeep) {
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
- }
- /**
- * Copies the values of `source` to `array`.
- *
- * @private
- * @param {Array} source The array to copy values from.
- * @param {Array} [array=[]] The array to copy values to.
- * @returns {Array} Returns `array`.
- */
- function copyArray(source, array) {
- var index = -1,
- length = source.length;
- array || (array = Array(length));
- while (++index < length) {
- array[index] = source[index];
- }
- return array;
- }
- /**
- * Copies properties of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy properties from.
- * @param {Array} props The property identifiers to copy.
- * @param {Object} [object={}] The object to copy properties to.
- * @param {Function} [customizer] The function to customize copied values.
- * @returns {Object} Returns `object`.
- */
- function copyObject(source, props, object, customizer) {
- object || (object = {});
- var index = -1,
- length = props.length;
- while (++index < length) {
- var key = props[index];
- var newValue = customizer
- ? customizer(object[key], source[key], key, object, source)
- : undefined;
- assignValue(object, key, newValue === undefined ? source[key] : newValue);
- }
- return object;
- }
- /**
- * Copies own symbol properties of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy symbols from.
- * @param {Object} [object={}] The object to copy symbols to.
- * @returns {Object} Returns `object`.
- */
- function copySymbols(source, object) {
- return copyObject(source, getSymbols(source), object);
- }
- /**
- * Creates an array of own enumerable property names and symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names and symbols.
- */
- function getAllKeys(object) {
- return baseGetAllKeys(object, keys, getSymbols);
- }
- /**
- * Gets the data for `map`.
- *
- * @private
- * @param {Object} map The map to query.
- * @param {string} key The reference key.
- * @returns {*} Returns the map data.
- */
- function getMapData(map, key) {
- var data = map.__data__;
- return isKeyable(key)
- ? data[typeof key == 'string' ? 'string' : 'hash']
- : data.map;
- }
- /**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */
- function getNative(object, key) {
- var value = getValue(object, key);
- return baseIsNative(value) ? value : undefined;
- }
- /**
- * Creates an array of the own enumerable symbol properties of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of symbols.
- */
- var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
- /**
- * Gets the `toStringTag` of `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- var getTag = baseGetTag;
- // Fallback for data views, maps, sets, and weak maps in IE 11,
- // for data views in Edge < 14, and promises in Node.js.
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
- (Map && getTag(new Map) != mapTag) ||
- (Promise && getTag(Promise.resolve()) != promiseTag) ||
- (Set && getTag(new Set) != setTag) ||
- (WeakMap && getTag(new WeakMap) != weakMapTag)) {
- getTag = function(value) {
- var result = objectToString.call(value),
- Ctor = result == objectTag ? value.constructor : undefined,
- ctorString = Ctor ? toSource(Ctor) : undefined;
- if (ctorString) {
- switch (ctorString) {
- case dataViewCtorString: return dataViewTag;
- case mapCtorString: return mapTag;
- case promiseCtorString: return promiseTag;
- case setCtorString: return setTag;
- case weakMapCtorString: return weakMapTag;
- }
- }
- return result;
- };
- }
- /**
- * Initializes an array clone.
- *
- * @private
- * @param {Array} array The array to clone.
- * @returns {Array} Returns the initialized clone.
- */
- function initCloneArray(array) {
- var length = array.length,
- result = array.constructor(length);
- // Add properties assigned by `RegExp#exec`.
- if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
- result.index = array.index;
- result.input = array.input;
- }
- return result;
- }
- /**
- * Initializes an object clone.
- *
- * @private
- * @param {Object} object The object to clone.
- * @returns {Object} Returns the initialized clone.
- */
- function initCloneObject(object) {
- return (typeof object.constructor == 'function' && !isPrototype(object))
- ? baseCreate(getPrototype(object))
- : {};
- }
- /**
- * Initializes an object clone based on its `toStringTag`.
- *
- * **Note:** This function only supports cloning values with tags of
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
- *
- * @private
- * @param {Object} object The object to clone.
- * @param {string} tag The `toStringTag` of the object to clone.
- * @param {Function} cloneFunc The function to clone values.
- * @param {boolean} [isDeep] Specify a deep clone.
- * @returns {Object} Returns the initialized clone.
- */
- function initCloneByTag(object, tag, cloneFunc, isDeep) {
- var Ctor = object.constructor;
- switch (tag) {
- case arrayBufferTag:
- return cloneArrayBuffer(object);
- case boolTag:
- case dateTag:
- return new Ctor(+object);
- case dataViewTag:
- return cloneDataView(object, isDeep);
- case float32Tag: case float64Tag:
- case int8Tag: case int16Tag: case int32Tag:
- case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
- return cloneTypedArray(object, isDeep);
- case mapTag:
- return cloneMap(object, isDeep, cloneFunc);
- case numberTag:
- case stringTag:
- return new Ctor(object);
- case regexpTag:
- return cloneRegExp(object);
- case setTag:
- return cloneSet(object, isDeep, cloneFunc);
- case symbolTag:
- return cloneSymbol(object);
- }
- }
- /**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex(value, length) {
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length &&
- (typeof value == 'number' || reIsUint.test(value)) &&
- (value > -1 && value % 1 == 0 && value < length);
- }
- /**
- * Checks if `value` is suitable for use as unique object key.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
- */
- function isKeyable(value) {
- var type = typeof value;
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
- ? (value !== '__proto__')
- : (value === null);
- }
- /**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
- */
- function isMasked(func) {
- return !!maskSrcKey && (maskSrcKey in func);
- }
- /**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */
- function isPrototype(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
- return value === proto;
- }
- /**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to process.
- * @returns {string} Returns the source code.
- */
- function toSource(func) {
- if (func != null) {
- try {
- return funcToString.call(func);
- } catch (e) {}
- try {
- return (func + '');
- } catch (e) {}
- }
- return '';
- }
- /**
- * This method is like `_.clone` except that it recursively clones `value`.
- *
- * @static
- * @memberOf _
- * @since 1.0.0
- * @category Lang
- * @param {*} value The value to recursively clone.
- * @returns {*} Returns the deep cloned value.
- * @see _.clone
- * @example
- *
- * var objects = [{ 'a': 1 }, { 'b': 2 }];
- *
- * var deep = _.cloneDeep(objects);
- * console.log(deep[0] === objects[0]);
- * // => false
- */
- function cloneDeep(value) {
- return baseClone(value, true, true);
- }
- /**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */
- function eq(value, other) {
- return value === other || (value !== value && other !== other);
- }
- /**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
- function isArguments(value) {
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
- return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
- (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
- }
- /**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */
- var isArray = Array.isArray;
- /**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
- function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
- }
- /**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object,
- * else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */
- function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
- }
- /**
- * Checks if `value` is a buffer.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
- * @example
- *
- * _.isBuffer(new Buffer(2));
- * // => true
- *
- * _.isBuffer(new Uint8Array(2));
- * // => false
- */
- var isBuffer = nativeIsBuffer || stubFalse;
- /**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
- function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
- var tag = isObject(value) ? objectToString.call(value) : '';
- return tag == funcTag || tag == genTag;
- }
- /**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
- function isLength(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject(value) {
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
- }
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike(value) {
- return !!value && typeof value == 'object';
- }
- /**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
- function keys(object) {
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
- }
- /**
- * This method returns a new empty array.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {Array} Returns the new empty array.
- * @example
- *
- * var arrays = _.times(2, _.stubArray);
- *
- * console.log(arrays);
- * // => [[], []]
- *
- * console.log(arrays[0] === arrays[1]);
- * // => false
- */
- function stubArray() {
- return [];
- }
- /**
- * This method returns `false`.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {boolean} Returns `false`.
- * @example
- *
- * _.times(2, _.stubFalse);
- * // => [false, false]
- */
- function stubFalse() {
- return false;
- }
- module.exports = cloneDeep;
- });
- var hasProperty = function has(object, key) {
- return Object.prototype.hasOwnProperty.call(object, key);
- };
- var _apply;
- 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; }
- var id$8 = 0;
- function _classPrivateFieldLooseKey$8(name) { return "__private_" + id$8++ + "_" + name; }
- function insertReplacement(source, rx, replacement) {
- const newParts = [];
- source.forEach(chunk => {
- // When the source contains multiple placeholders for interpolation,
- // we should ignore chunks that are not strings, because those
- // can be JSX objects and will be otherwise incorrectly turned into strings.
- // Without this condition we’d get this: [object Object] hello [object Object] my <button>
- if (typeof chunk !== 'string') {
- return newParts.push(chunk);
- }
- return rx[Symbol.split](chunk).forEach((raw, i, list) => {
- if (raw !== '') {
- newParts.push(raw);
- } // Interlace with the `replacement` value
- if (i < list.length - 1) {
- newParts.push(replacement);
- }
- });
- });
- return newParts;
- }
- /**
- * Takes a string with placeholder variables like `%{smart_count} file selected`
- * and replaces it with values from options `{smart_count: 5}`
- *
- * @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
- * taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
- *
- * @param {string} phrase that needs interpolation, with placeholders
- * @param {object} options with values that will be used to replace placeholders
- * @returns {any[]} interpolated
- */
- function interpolate(phrase, options) {
- const dollarRegex = /\$/g;
- const dollarBillsYall = '$$$$';
- let interpolated = [phrase];
- if (options == null) return interpolated;
- for (const arg of Object.keys(options)) {
- if (arg !== '_') {
- // Ensure replacement value is escaped to prevent special $-prefixed
- // regex replace tokens. the "$$$$" is needed because each "$" needs to
- // be escaped with "$" itself, and we need two in the resulting output.
- let replacement = options[arg];
- if (typeof replacement === 'string') {
- replacement = dollarRegex[Symbol.replace](replacement, dollarBillsYall);
- } // We create a new `RegExp` each time instead of using a more-efficient
- // string replace so that the same argument can be replaced multiple times
- // in the same phrase.
- interpolated = insertReplacement(interpolated, new RegExp(`%\\{${arg}\\}`, 'g'), replacement);
- }
- }
- return interpolated;
- }
- /**
- * Translates strings with interpolation & pluralization support.
- * Extensible with custom dictionaries and pluralization functions.
- *
- * Borrows heavily from and inspired by Polyglot https://github.com/airbnb/polyglot.js,
- * basically a stripped-down version of it. Differences: pluralization functions are not hardcoded
- * and can be easily added among with dictionaries, nested objects are used for pluralization
- * as opposed to `||||` delimeter
- *
- * Usage example: `translator.translate('files_chosen', {smart_count: 3})`
- */
- var Translator_1 = (_apply = /*#__PURE__*/_classPrivateFieldLooseKey$8("apply"), class Translator {
- /**
- * @param {object|Array<object>} locales - locale or list of locales.
- */
- constructor(locales) {
- Object.defineProperty(this, _apply, {
- value: _apply2
- });
- this.locale = {
- strings: {},
- pluralize(n) {
- if (n === 1) {
- return 0;
- }
- return 1;
- }
- };
- if (Array.isArray(locales)) {
- locales.forEach(_classPrivateFieldLooseBase$8(this, _apply)[_apply], this);
- } else {
- _classPrivateFieldLooseBase$8(this, _apply)[_apply](locales);
- }
- }
- /**
- * Public translate method
- *
- * @param {string} key
- * @param {object} options with values that will be used later to replace placeholders in string
- * @returns {string} translated (and interpolated)
- */
- translate(key, options) {
- return this.translateArray(key, options).join('');
- }
- /**
- * Get a translation and return the translated and interpolated parts as an array.
- *
- * @param {string} key
- * @param {object} options with values that will be used to replace placeholders
- * @returns {Array} The translated and interpolated parts, in order.
- */
- translateArray(key, options) {
- if (!hasProperty(this.locale.strings, key)) {
- throw new Error(`missing string: ${key}`);
- }
- const string = this.locale.strings[key];
- const hasPluralForms = typeof string === 'object';
- if (hasPluralForms) {
- if (options && typeof options.smart_count !== 'undefined') {
- const plural = this.locale.pluralize(options.smart_count);
- return interpolate(string[plural], options);
- }
- throw new Error('Attempted to use a string with plural forms, but no value was given for %{smart_count}');
- }
- return interpolate(string, options);
- }
- });
- function _apply2(locale) {
- if (!(locale != null && locale.strings)) {
- return;
- }
- const prevLocale = this.locale;
- this.locale = { ...prevLocale,
- strings: { ...prevLocale.strings,
- ...locale.strings
- }
- };
- this.locale.pluralize = locale.pluralize || prevLocale.pluralize;
- }
- /**
- * Create an event emitter with namespaces
- * @name createNamespaceEmitter
- * @example
- * var emitter = require('./index')()
- *
- * emitter.on('*', function () {
- * console.log('all events emitted', this.event)
- * })
- *
- * emitter.on('example', function () {
- * console.log('example event emitted')
- * })
- */
- var namespaceEmitter = function createNamespaceEmitter () {
- var emitter = {};
- var _fns = emitter._fns = {};
- /**
- * 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 `:`
- * @name emit
- * @param {String} event – the name of the event, with optional namespace
- * @param {...*} data – up to 6 arguments that are passed to the event listener
- * @example
- * emitter.emit('example')
- * emitter.emit('demo:test')
- * emitter.emit('data', { example: true}, 'a string', 1)
- */
- emitter.emit = function emit (event, arg1, arg2, arg3, arg4, arg5, arg6) {
- var toEmit = getListeners(event);
- if (toEmit.length) {
- emitAll(event, toEmit, [arg1, arg2, arg3, arg4, arg5, arg6]);
- }
- };
- /**
- * Create en event listener.
- * @name on
- * @param {String} event
- * @param {Function} fn
- * @example
- * emitter.on('example', function () {})
- * emitter.on('demo', function () {})
- */
- emitter.on = function on (event, fn) {
- if (!_fns[event]) {
- _fns[event] = [];
- }
- _fns[event].push(fn);
- };
- /**
- * Create en event listener that fires once.
- * @name once
- * @param {String} event
- * @param {Function} fn
- * @example
- * emitter.once('example', function () {})
- * emitter.once('demo', function () {})
- */
- emitter.once = function once (event, fn) {
- function one () {
- fn.apply(this, arguments);
- emitter.off(event, one);
- }
- this.on(event, one);
- };
- /**
- * 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.
- * You must be explicit about what will be unsubscribed: `emitter.off('demo')` will unsubscribe an `emitter.on('demo')` listener,
- * `emitter.off('demo:example')` will unsubscribe an `emitter.on('demo:example')` listener
- * @name off
- * @param {String} event
- * @param {Function} [fn] – the specific handler
- * @example
- * emitter.off('example')
- * emitter.off('demo', function () {})
- */
- emitter.off = function off (event, fn) {
- var keep = [];
- if (event && fn) {
- var fns = this._fns[event];
- var i = 0;
- var l = fns ? fns.length : 0;
- for (i; i < l; i++) {
- if (fns[i] !== fn) {
- keep.push(fns[i]);
- }
- }
- }
- keep.length ? this._fns[event] = keep : delete this._fns[event];
- };
- function getListeners (e) {
- var out = _fns[e] ? _fns[e] : [];
- var idx = e.indexOf(':');
- var args = (idx === -1) ? [e] : [e.substring(0, idx), e.substring(idx + 1)];
- var keys = Object.keys(_fns);
- var i = 0;
- var l = keys.length;
- for (i; i < l; i++) {
- var key = keys[i];
- if (key === '*') {
- out = out.concat(_fns[key]);
- }
- if (args.length === 2 && args[0] === key) {
- out = out.concat(_fns[key]);
- break
- }
- }
- return out
- }
- function emitAll (e, fns, args) {
- var i = 0;
- var l = fns.length;
- for (i; i < l; i++) {
- if (!fns[i]) break
- fns[i].event = e;
- fns[i].apply(fns[i], args);
- }
- }
- return emitter
- };
- // Adapted from https://github.com/Flet/prettier-bytes/
- // Changing 1000 bytes to 1024, so we can keep uppercase KB vs kB
- // ISC License (c) Dan Flettre https://github.com/Flet/prettier-bytes/blob/master/LICENSE
- var prettierBytes = function prettierBytes (num) {
- if (typeof num !== 'number' || isNaN(num)) {
- throw new TypeError('Expected a number, got ' + typeof num)
- }
- var neg = num < 0;
- var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
- if (neg) {
- num = -num;
- }
- if (num < 1) {
- return (neg ? '-' : '') + num + ' B'
- }
- var exponent = Math.min(Math.floor(Math.log(num) / Math.log(1024)), units.length - 1);
- num = Number(num / Math.pow(1024, exponent));
- var unit = units[exponent];
- if (num >= 10 || num % 1 === 0) {
- // Do not show decimals when the number is two-digit, or if the number has no
- // decimal component.
- return (neg ? '-' : '') + num.toFixed(0) + ' ' + unit
- } else {
- return (neg ? '-' : '') + num.toFixed(1) + ' ' + unit
- }
- };
- /* jshint node: true */
- /**
- # wildcard
- Very simple wildcard matching, which is designed to provide the same
- functionality that is found in the
- [eve](https://github.com/adobe-webplatform/eve) eventing library.
- ## Usage
- It works with strings:
- <<< examples/strings.js
- Arrays:
- <<< examples/arrays.js
- Objects (matching against keys):
- <<< examples/objects.js
- While the library works in Node, if you are are looking for file-based
- wildcard matching then you should have a look at:
- <https://github.com/isaacs/node-glob>
- **/
- function WildcardMatcher(text, separator) {
- this.text = text = text || '';
- this.hasWild = ~text.indexOf('*');
- this.separator = separator;
- this.parts = text.split(separator);
- }
- WildcardMatcher.prototype.match = function(input) {
- var matches = true;
- var parts = this.parts;
- var ii;
- var partsCount = parts.length;
- var testParts;
- if (typeof input == 'string' || input instanceof String) {
- if (!this.hasWild && this.text != input) {
- matches = false;
- } else {
- testParts = (input || '').split(this.separator);
- for (ii = 0; matches && ii < partsCount; ii++) {
- if (parts[ii] === '*') {
- continue;
- } else if (ii < testParts.length) {
- matches = parts[ii] === testParts[ii];
- } else {
- matches = false;
- }
- }
- // If matches, then return the component parts
- matches = matches && testParts;
- }
- }
- else if (typeof input.splice == 'function') {
- matches = [];
- for (ii = input.length; ii--; ) {
- if (this.match(input[ii])) {
- matches[matches.length] = input[ii];
- }
- }
- }
- else if (typeof input == 'object') {
- matches = {};
- for (var key in input) {
- if (this.match(key)) {
- matches[key] = input[key];
- }
- }
- }
- return matches;
- };
- var wildcard = function(text, test, separator) {
- var matcher = new WildcardMatcher(text, separator || /[\/\.]/);
- if (typeof test != 'undefined') {
- return matcher.match(test);
- }
- return matcher;
- };
- var reMimePartSplit = /[\/\+\.]/;
- /**
- # mime-match
- A simple function to checker whether a target mime type matches a mime-type
- pattern (e.g. image/jpeg matches image/jpeg OR image/*).
- ## Example Usage
- <<< example.js
- **/
- var mimeMatch = function(target, pattern) {
- function test(pattern) {
- var result = wildcard(pattern, target, reMimePartSplit);
- // ensure that we have a valid mime type (should have two parts)
- return result && result.length >= 2;
- }
- return pattern ? test(pattern.split(';')[0]) : test;
- };
- 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; }
- var id$7 = 0;
- function _classPrivateFieldLooseKey$7(name) { return "__private_" + id$7++ + "_" + name; }
- var _publish = /*#__PURE__*/_classPrivateFieldLooseKey$7("publish");
- /**
- * Default store that keeps state in a simple object.
- */
- class DefaultStore {
- constructor() {
- Object.defineProperty(this, _publish, {
- value: _publish2
- });
- this.state = {};
- this.callbacks = [];
- }
- getState() {
- return this.state;
- }
- setState(patch) {
- const prevState = { ...this.state
- };
- const nextState = { ...this.state,
- ...patch
- };
- this.state = nextState;
- _classPrivateFieldLooseBase$7(this, _publish)[_publish](prevState, nextState, patch);
- }
- subscribe(listener) {
- this.callbacks.push(listener);
- return () => {
- // Remove the listener.
- this.callbacks.splice(this.callbacks.indexOf(listener), 1);
- };
- }
- }
- function _publish2() {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- this.callbacks.forEach(listener => {
- listener(...args);
- });
- }
- DefaultStore.VERSION = "2.0.3";
- var lib$3 = function defaultStore() {
- return new DefaultStore();
- };
- /**
- * Takes a full filename string and returns an object {name, extension}
- *
- * @param {string} fullFileName
- * @returns {object} {name, extension}
- */
- var getFileNameAndExtension = function getFileNameAndExtension(fullFileName) {
- const lastDot = fullFileName.lastIndexOf('.'); // these count as no extension: "no-dot", "trailing-dot."
- if (lastDot === -1 || lastDot === fullFileName.length - 1) {
- return {
- name: fullFileName,
- extension: undefined
- };
- }
- return {
- name: fullFileName.slice(0, lastDot),
- extension: fullFileName.slice(lastDot + 1)
- };
- };
- // ___Why not add the mime-types package?
- // It's 19.7kB gzipped, and we only need mime types for well-known extensions (for file previews).
- // ___Where to take new extensions from?
- // https://github.com/jshttp/mime-db/blob/master/db.json
- var mimeTypes = {
- md: 'text/markdown',
- markdown: 'text/markdown',
- mp4: 'video/mp4',
- mp3: 'audio/mp3',
- svg: 'image/svg+xml',
- jpg: 'image/jpeg',
- png: 'image/png',
- gif: 'image/gif',
- heic: 'image/heic',
- heif: 'image/heif',
- yaml: 'text/yaml',
- yml: 'text/yaml',
- csv: 'text/csv',
- tsv: 'text/tab-separated-values',
- tab: 'text/tab-separated-values',
- avi: 'video/x-msvideo',
- mks: 'video/x-matroska',
- mkv: 'video/x-matroska',
- mov: 'video/quicktime',
- doc: 'application/msword',
- docm: 'application/vnd.ms-word.document.macroenabled.12',
- docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
- dot: 'application/msword',
- dotm: 'application/vnd.ms-word.template.macroenabled.12',
- dotx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
- xla: 'application/vnd.ms-excel',
- xlam: 'application/vnd.ms-excel.addin.macroenabled.12',
- xlc: 'application/vnd.ms-excel',
- xlf: 'application/x-xliff+xml',
- xlm: 'application/vnd.ms-excel',
- xls: 'application/vnd.ms-excel',
- xlsb: 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
- xlsm: 'application/vnd.ms-excel.sheet.macroenabled.12',
- xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
- xlt: 'application/vnd.ms-excel',
- xltm: 'application/vnd.ms-excel.template.macroenabled.12',
- xltx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
- xlw: 'application/vnd.ms-excel',
- txt: 'text/plain',
- text: 'text/plain',
- conf: 'text/plain',
- log: 'text/plain',
- pdf: 'application/pdf',
- zip: 'application/zip',
- '7z': 'application/x-7z-compressed',
- rar: 'application/x-rar-compressed',
- tar: 'application/x-tar',
- gz: 'application/gzip',
- dmg: 'application/x-apple-diskimage'
- };
- var getFileType = function getFileType(file) {
- var _getFileNameAndExtens;
- if (file.type) return file.type;
- const fileExtension = file.name ? (_getFileNameAndExtens = getFileNameAndExtension(file.name).extension) == null ? void 0 : _getFileNameAndExtens.toLowerCase() : null;
- if (fileExtension && fileExtension in mimeTypes) {
- // else, see if we can map extension to a mime type
- return mimeTypes[fileExtension];
- } // if all fails, fall back to a generic byte stream type
- return 'application/octet-stream';
- };
- function encodeCharacter(character) {
- return character.charCodeAt(0).toString(32);
- }
- function encodeFilename(name) {
- let suffix = '';
- return name.replace(/[^A-Z0-9]/ig, character => {
- suffix += `-${encodeCharacter(character)}`;
- return '/';
- }) + suffix;
- }
- /**
- * Takes a file object and turns it into fileID, by converting file.name to lowercase,
- * removing extra characters and adding type, size and lastModified
- *
- * @param {object} file
- * @returns {string} the fileID
- */
- var generateFileID = function generateFileID(file) {
- // It's tempting to do `[items].filter(Boolean).join('-')` here, but that
- // is slower! simple string concatenation is fast
- let id = 'uppy';
- if (typeof file.name === 'string') {
- id += `-${encodeFilename(file.name.toLowerCase())}`;
- }
- if (file.type !== undefined) {
- id += `-${file.type}`;
- }
- if (file.meta && typeof file.meta.relativePath === 'string') {
- id += `-${encodeFilename(file.meta.relativePath.toLowerCase())}`;
- }
- if (file.data.size !== undefined) {
- id += `-${file.data.size}`;
- }
- if (file.data.lastModified !== undefined) {
- id += `-${file.data.lastModified}`;
- }
- return id;
- };
- // Edge 15.x does not fire 'progress' events on uploads.
- // See https://github.com/transloadit/uppy/issues/945
- // And https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12224510/
- var supportsUploadProgress = function supportsUploadProgress(userAgent) {
- // Allow passing in userAgent for tests
- if (userAgent == null) {
- userAgent = typeof navigator !== 'undefined' ? navigator.userAgent : null;
- } // Assume it works because basically everything supports progress events.
- if (!userAgent) return true;
- const m = /Edge\/(\d+\.\d+)/.exec(userAgent);
- if (!m) return true;
- const edgeVersion = m[1];
- let [major, minor] = edgeVersion.split('.');
- major = parseInt(major, 10);
- minor = parseInt(minor, 10); // Worked before:
- // Edge 40.15063.0.0
- // Microsoft EdgeHTML 15.15063
- if (major < 15 || major === 15 && minor < 15063) {
- return true;
- } // Fixed in:
- // Microsoft EdgeHTML 18.18218
- if (major > 18 || major === 18 && minor >= 18218) {
- return true;
- } // other versions don't work.
- return false;
- };
- var getFileName = function getFileName(fileType, fileDescriptor) {
- if (fileDescriptor.name) {
- return fileDescriptor.name;
- }
- if (fileType.split('/')[0] === 'image') {
- return `${fileType.split('/')[0]}.${fileType.split('/')[1]}`;
- }
- return 'noname';
- };
- /**
- * Adds zero to strings shorter than two characters.
- *
- * @param {number} number
- * @returns {string}
- */
- function pad(number) {
- return number < 10 ? `0${number}` : number.toString();
- }
- /**
- * Returns a timestamp in the format of `hours:minutes:seconds`
- */
- var getTimeStamp = function getTimeStamp() {
- const date = new Date();
- const hours = pad(date.getHours());
- const minutes = pad(date.getMinutes());
- const seconds = pad(date.getSeconds());
- return `${hours}:${minutes}:${seconds}`;
- };
- /* eslint-disable no-console */
- // Swallow all logs, except errors.
- // default if logger is not set or debug: false
- const justErrorsLogger$1 = {
- debug: () => {},
- warn: () => {},
- error: function () {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- return console.error(`[Uppy] [${getTimeStamp()}]`, ...args);
- }
- }; // Print logs to console with namespace + timestamp,
- // set by logger: Uppy.debugLogger or debug: true
- const debugLogger$2 = {
- debug: function () {
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
- return console.debug(`[Uppy] [${getTimeStamp()}]`, ...args);
- },
- warn: function () {
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
- return console.warn(`[Uppy] [${getTimeStamp()}]`, ...args);
- },
- error: function () {
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
- args[_key4] = arguments[_key4];
- }
- return console.error(`[Uppy] [${getTimeStamp()}]`, ...args);
- }
- };
- var loggers = {
- justErrorsLogger: justErrorsLogger$1,
- debugLogger: debugLogger$2
- };
- var locale$1 = {
- strings: {
- addBulkFilesFailed: {
- 0: 'Failed to add %{smart_count} file due to an internal error',
- 1: 'Failed to add %{smart_count} files due to internal errors'
- },
- youCanOnlyUploadX: {
- 0: 'You can only upload %{smart_count} file',
- 1: 'You can only upload %{smart_count} files'
- },
- youHaveToAtLeastSelectX: {
- 0: 'You have to select at least %{smart_count} file',
- 1: 'You have to select at least %{smart_count} files'
- },
- exceedsSize: '%{file} exceeds maximum allowed size of %{size}',
- missingRequiredMetaField: 'Missing required meta fields',
- missingRequiredMetaFieldOnFile: 'Missing required meta fields in %{fileName}',
- inferiorSize: 'This file is smaller than the allowed size of %{size}',
- youCanOnlyUploadFileTypes: 'You can only upload: %{types}',
- noMoreFilesAllowed: 'Cannot add more files',
- noDuplicates: "Cannot add the duplicate file '%{fileName}', it already exists",
- companionError: 'Connection with Companion failed',
- authAborted: 'Authentication aborted',
- companionUnauthorizeHint: 'To unauthorize to your %{provider} account, please go to %{url}',
- failedToUpload: 'Failed to upload %{file}',
- noInternetConnection: 'No Internet connection',
- connectedToInternet: 'Connected to the Internet',
- // Strings for remote providers
- noFilesFound: 'You have no files or folders here',
- selectX: {
- 0: 'Select %{smart_count}',
- 1: 'Select %{smart_count}'
- },
- allFilesFromFolderNamed: 'All files from folder %{name}',
- openFolderNamed: 'Open folder %{name}',
- cancel: 'Cancel',
- logOut: 'Log out',
- filter: 'Filter',
- resetFilter: 'Reset filter',
- loading: 'Loading...',
- authenticateWithTitle: 'Please authenticate with %{pluginName} to select files',
- authenticateWith: 'Connect to %{pluginName}',
- signInWithGoogle: 'Sign in with Google',
- searchImages: 'Search for images',
- enterTextToSearch: 'Enter text to search for images',
- backToSearch: 'Back to Search',
- emptyFolderAdded: 'No files were added from empty folder',
- folderAlreadyAdded: 'The folder "%{folder}" was already added',
- folderAdded: {
- 0: 'Added %{smart_count} file from %{folder}',
- 1: 'Added %{smart_count} files from %{folder}'
- }
- }
- };
- var require$$4 = index_browser;
- /* global AggregateError */
- let _Symbol$for$1, _Symbol$for2$1;
- 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; }
- var id$6 = 0;
- function _classPrivateFieldLooseKey$6(name) { return "__private_" + id$6++ + "_" + name; }
- const {
- nanoid: nanoid$1
- } = require$$4;
- const {
- justErrorsLogger,
- debugLogger: debugLogger$1
- } = loggers;
- // Exported from here.
- class RestrictionError extends Error {
- constructor() {
- super(...arguments);
- this.isRestriction = true;
- }
- }
- if (typeof AggregateError === 'undefined') {
- // eslint-disable-next-line no-global-assign
- globalThis.AggregateError = class AggregateError extends Error {
- constructor(errors, message) {
- super(message);
- this.errors = errors;
- }
- };
- }
- class AggregateRestrictionError extends AggregateError {
- constructor() {
- super(...arguments);
- this.isRestriction = true;
- }
- }
- /**
- * Uppy Core module.
- * Manages plugins, state updates, acts as an event bus,
- * adds/removes files and metadata.
- */
- var _plugins = /*#__PURE__*/_classPrivateFieldLooseKey$6("plugins");
- var _storeUnsubscribe = /*#__PURE__*/_classPrivateFieldLooseKey$6("storeUnsubscribe");
- var _emitter$2 = /*#__PURE__*/_classPrivateFieldLooseKey$6("emitter");
- var _preProcessors = /*#__PURE__*/_classPrivateFieldLooseKey$6("preProcessors");
- var _uploaders = /*#__PURE__*/_classPrivateFieldLooseKey$6("uploaders");
- var _postProcessors = /*#__PURE__*/_classPrivateFieldLooseKey$6("postProcessors");
- var _checkRestrictions = /*#__PURE__*/_classPrivateFieldLooseKey$6("checkRestrictions");
- var _checkMinNumberOfFiles = /*#__PURE__*/_classPrivateFieldLooseKey$6("checkMinNumberOfFiles");
- var _checkRequiredMetaFieldsOnFile = /*#__PURE__*/_classPrivateFieldLooseKey$6("checkRequiredMetaFieldsOnFile");
- var _checkRequiredMetaFields = /*#__PURE__*/_classPrivateFieldLooseKey$6("checkRequiredMetaFields");
- var _showOrLogErrorAndThrow = /*#__PURE__*/_classPrivateFieldLooseKey$6("showOrLogErrorAndThrow");
- var _assertNewUploadAllowed = /*#__PURE__*/_classPrivateFieldLooseKey$6("assertNewUploadAllowed");
- var _checkAndCreateFileStateObject = /*#__PURE__*/_classPrivateFieldLooseKey$6("checkAndCreateFileStateObject");
- var _startIfAutoProceed = /*#__PURE__*/_classPrivateFieldLooseKey$6("startIfAutoProceed");
- var _addListeners = /*#__PURE__*/_classPrivateFieldLooseKey$6("addListeners");
- var _updateOnlineStatus = /*#__PURE__*/_classPrivateFieldLooseKey$6("updateOnlineStatus");
- var _createUpload = /*#__PURE__*/_classPrivateFieldLooseKey$6("createUpload");
- var _getUpload = /*#__PURE__*/_classPrivateFieldLooseKey$6("getUpload");
- var _removeUpload = /*#__PURE__*/_classPrivateFieldLooseKey$6("removeUpload");
- var _runUpload = /*#__PURE__*/_classPrivateFieldLooseKey$6("runUpload");
- _Symbol$for$1 = Symbol.for('uppy test: getPlugins');
- _Symbol$for2$1 = Symbol.for('uppy test: createUpload');
- class Uppy {
- // eslint-disable-next-line global-require
- /** @type {Record<string, BasePlugin[]>} */
- /**
- * Instantiate Uppy
- *
- * @param {object} opts — Uppy options
- */
- constructor(_opts) {
- Object.defineProperty(this, _runUpload, {
- value: _runUpload2
- });
- Object.defineProperty(this, _removeUpload, {
- value: _removeUpload2
- });
- Object.defineProperty(this, _getUpload, {
- value: _getUpload2
- });
- Object.defineProperty(this, _createUpload, {
- value: _createUpload2
- });
- Object.defineProperty(this, _addListeners, {
- value: _addListeners2
- });
- Object.defineProperty(this, _startIfAutoProceed, {
- value: _startIfAutoProceed2
- });
- Object.defineProperty(this, _checkAndCreateFileStateObject, {
- value: _checkAndCreateFileStateObject2
- });
- Object.defineProperty(this, _assertNewUploadAllowed, {
- value: _assertNewUploadAllowed2
- });
- Object.defineProperty(this, _showOrLogErrorAndThrow, {
- value: _showOrLogErrorAndThrow2
- });
- Object.defineProperty(this, _checkRequiredMetaFields, {
- value: _checkRequiredMetaFields2
- });
- Object.defineProperty(this, _checkRequiredMetaFieldsOnFile, {
- value: _checkRequiredMetaFieldsOnFile2
- });
- Object.defineProperty(this, _checkMinNumberOfFiles, {
- value: _checkMinNumberOfFiles2
- });
- Object.defineProperty(this, _checkRestrictions, {
- value: _checkRestrictions2
- });
- Object.defineProperty(this, _plugins, {
- writable: true,
- value: Object.create(null)
- });
- Object.defineProperty(this, _storeUnsubscribe, {
- writable: true,
- value: void 0
- });
- Object.defineProperty(this, _emitter$2, {
- writable: true,
- value: namespaceEmitter()
- });
- Object.defineProperty(this, _preProcessors, {
- writable: true,
- value: new Set()
- });
- Object.defineProperty(this, _uploaders, {
- writable: true,
- value: new Set()
- });
- Object.defineProperty(this, _postProcessors, {
- writable: true,
- value: new Set()
- });
- Object.defineProperty(this, _updateOnlineStatus, {
- writable: true,
- value: this.updateOnlineStatus.bind(this)
- });
- this.defaultLocale = locale$1;
- const defaultOptions = {
- id: 'uppy',
- autoProceed: false,
- /**
- * @deprecated The method should not be used
- */
- allowMultipleUploads: true,
- allowMultipleUploadBatches: true,
- debug: false,
- restrictions: {
- maxFileSize: null,
- minFileSize: null,
- maxTotalFileSize: null,
- maxNumberOfFiles: null,
- minNumberOfFiles: null,
- allowedFileTypes: null,
- requiredMetaFields: []
- },
- meta: {},
- onBeforeFileAdded: currentFile => currentFile,
- onBeforeUpload: files => files,
- store: lib$3(),
- logger: justErrorsLogger,
- infoTimeout: 5000
- }; // Merge default options with the ones set by user,
- // making sure to merge restrictions too
- this.opts = { ...defaultOptions,
- ..._opts,
- restrictions: { ...defaultOptions.restrictions,
- ...(_opts && _opts.restrictions)
- }
- }; // Support debug: true for backwards-compatability, unless logger is set in opts
- // opts instead of this.opts to avoid comparing objects — we set logger: justErrorsLogger in defaultOptions
- if (_opts && _opts.logger && _opts.debug) {
- 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');
- } else if (_opts && _opts.debug) {
- this.opts.logger = debugLogger$1;
- }
- this.log(`Using Core v${this.constructor.VERSION}`);
- if (this.opts.restrictions.allowedFileTypes && this.opts.restrictions.allowedFileTypes !== null && !Array.isArray(this.opts.restrictions.allowedFileTypes)) {
- throw new TypeError('`restrictions.allowedFileTypes` must be an array');
- }
- this.i18nInit(); // ___Why throttle at 500ms?
- // - We must throttle at >250ms for superfocus in Dashboard to work well
- // (because animation takes 0.25s, and we want to wait for all animations to be over before refocusing).
- // [Practical Check]: if thottle is at 100ms, then if you are uploading a file,
- // and click 'ADD MORE FILES', - focus won't activate in Firefox.
- // - We must throttle at around >500ms to avoid performance lags.
- // [Practical Check] Firefox, try to upload a big file for a prolonged period of time. Laptop will start to heat up.
- this.calculateProgress = lodash_throttle(this.calculateProgress.bind(this), 500, {
- leading: true,
- trailing: true
- });
- this.store = this.opts.store;
- this.setState({
- plugins: {},
- files: {},
- currentUploads: {},
- allowNewUpload: true,
- capabilities: {
- uploadProgress: supportsUploadProgress(),
- individualCancellation: true,
- resumableUploads: false
- },
- totalProgress: 0,
- meta: { ...this.opts.meta
- },
- info: [],
- recoveredState: null
- });
- _classPrivateFieldLooseBase$6(this, _storeUnsubscribe)[_storeUnsubscribe] = this.store.subscribe((prevState, nextState, patch) => {
- this.emit('state-update', prevState, nextState, patch);
- this.updateAll(nextState);
- }); // Exposing uppy object on window for debugging and testing
- if (this.opts.debug && typeof window !== 'undefined') {
- window[this.opts.id] = this;
- }
- _classPrivateFieldLooseBase$6(this, _addListeners)[_addListeners]();
- }
- emit(event) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- _classPrivateFieldLooseBase$6(this, _emitter$2)[_emitter$2].emit(event, ...args);
- }
- on(event, callback) {
- _classPrivateFieldLooseBase$6(this, _emitter$2)[_emitter$2].on(event, callback);
- return this;
- }
- once(event, callback) {
- _classPrivateFieldLooseBase$6(this, _emitter$2)[_emitter$2].once(event, callback);
- return this;
- }
- off(event, callback) {
- _classPrivateFieldLooseBase$6(this, _emitter$2)[_emitter$2].off(event, callback);
- return this;
- }
- /**
- * Iterate on all plugins and run `update` on them.
- * Called each time state changes.
- *
- */
- updateAll(state) {
- this.iteratePlugins(plugin => {
- plugin.update(state);
- });
- }
- /**
- * Updates state with a patch
- *
- * @param {object} patch {foo: 'bar'}
- */
- setState(patch) {
- this.store.setState(patch);
- }
- /**
- * Returns current state.
- *
- * @returns {object}
- */
- getState() {
- return this.store.getState();
- }
- /**
- * Back compat for when uppy.state is used instead of uppy.getState().
- *
- * @deprecated
- */
- get state() {
- // Here, state is a non-enumerable property.
- return this.getState();
- }
- /**
- * Shorthand to set state for a specific file.
- */
- setFileState(fileID, state) {
- if (!this.getState().files[fileID]) {
- throw new Error(`Can’t set state for ${fileID} (the file could have been removed)`);
- }
- this.setState({
- files: { ...this.getState().files,
- [fileID]: { ...this.getState().files[fileID],
- ...state
- }
- }
- });
- }
- i18nInit() {
- const translator = new Translator_1([this.defaultLocale, this.opts.locale]);
- this.i18n = translator.translate.bind(translator);
- this.i18nArray = translator.translateArray.bind(translator);
- this.locale = translator.locale;
- }
- setOptions(newOpts) {
- this.opts = { ...this.opts,
- ...newOpts,
- restrictions: { ...this.opts.restrictions,
- ...(newOpts && newOpts.restrictions)
- }
- };
- if (newOpts.meta) {
- this.setMeta(newOpts.meta);
- }
- this.i18nInit();
- if (newOpts.locale) {
- this.iteratePlugins(plugin => {
- plugin.setOptions();
- });
- } // Note: this is not the preact `setState`, it's an internal function that has the same name.
- this.setState(); // so that UI re-renders with new options
- }
- resetProgress() {
- const defaultProgress = {
- percentage: 0,
- bytesUploaded: 0,
- uploadComplete: false,
- uploadStarted: null
- };
- const files = { ...this.getState().files
- };
- const updatedFiles = {};
- Object.keys(files).forEach(fileID => {
- const updatedFile = { ...files[fileID]
- };
- updatedFile.progress = { ...updatedFile.progress,
- ...defaultProgress
- };
- updatedFiles[fileID] = updatedFile;
- });
- this.setState({
- files: updatedFiles,
- totalProgress: 0
- });
- this.emit('reset-progress');
- }
- addPreProcessor(fn) {
- _classPrivateFieldLooseBase$6(this, _preProcessors)[_preProcessors].add(fn);
- }
- removePreProcessor(fn) {
- return _classPrivateFieldLooseBase$6(this, _preProcessors)[_preProcessors].delete(fn);
- }
- addPostProcessor(fn) {
- _classPrivateFieldLooseBase$6(this, _postProcessors)[_postProcessors].add(fn);
- }
- removePostProcessor(fn) {
- return _classPrivateFieldLooseBase$6(this, _postProcessors)[_postProcessors].delete(fn);
- }
- addUploader(fn) {
- _classPrivateFieldLooseBase$6(this, _uploaders)[_uploaders].add(fn);
- }
- removeUploader(fn) {
- return _classPrivateFieldLooseBase$6(this, _uploaders)[_uploaders].delete(fn);
- }
- setMeta(data) {
- const updatedMeta = { ...this.getState().meta,
- ...data
- };
- const updatedFiles = { ...this.getState().files
- };
- Object.keys(updatedFiles).forEach(fileID => {
- updatedFiles[fileID] = { ...updatedFiles[fileID],
- meta: { ...updatedFiles[fileID].meta,
- ...data
- }
- };
- });
- this.log('Adding metadata:');
- this.log(data);
- this.setState({
- meta: updatedMeta,
- files: updatedFiles
- });
- }
- setFileMeta(fileID, data) {
- const updatedFiles = { ...this.getState().files
- };
- if (!updatedFiles[fileID]) {
- this.log('Was trying to set metadata for a file that has been removed: ', fileID);
- return;
- }
- const newMeta = { ...updatedFiles[fileID].meta,
- ...data
- };
- updatedFiles[fileID] = { ...updatedFiles[fileID],
- meta: newMeta
- };
- this.setState({
- files: updatedFiles
- });
- }
- /**
- * Get a file object.
- *
- * @param {string} fileID The ID of the file object to return.
- */
- getFile(fileID) {
- return this.getState().files[fileID];
- }
- /**
- * Get all files in an array.
- */
- getFiles() {
- const {
- files
- } = this.getState();
- return Object.values(files);
- }
- getObjectOfFilesPerState() {
- const {
- files: filesObject,
- totalProgress,
- error
- } = this.getState();
- const files = Object.values(filesObject);
- const inProgressFiles = files.filter(_ref => {
- let {
- progress
- } = _ref;
- return !progress.uploadComplete && progress.uploadStarted;
- });
- const newFiles = files.filter(file => !file.progress.uploadStarted);
- const startedFiles = files.filter(file => file.progress.uploadStarted || file.progress.preprocess || file.progress.postprocess);
- const uploadStartedFiles = files.filter(file => file.progress.uploadStarted);
- const pausedFiles = files.filter(file => file.isPaused);
- const completeFiles = files.filter(file => file.progress.uploadComplete);
- const erroredFiles = files.filter(file => file.error);
- const inProgressNotPausedFiles = inProgressFiles.filter(file => !file.isPaused);
- const processingFiles = files.filter(file => file.progress.preprocess || file.progress.postprocess);
- return {
- newFiles,
- startedFiles,
- uploadStartedFiles,
- pausedFiles,
- completeFiles,
- erroredFiles,
- inProgressFiles,
- inProgressNotPausedFiles,
- processingFiles,
- isUploadStarted: uploadStartedFiles.length > 0,
- isAllComplete: totalProgress === 100 && completeFiles.length === files.length && processingFiles.length === 0,
- isAllErrored: !!error && erroredFiles.length === files.length,
- isAllPaused: inProgressFiles.length !== 0 && pausedFiles.length === inProgressFiles.length,
- isUploadInProgress: inProgressFiles.length > 0,
- isSomeGhost: files.some(file => file.isGhost)
- };
- }
- /**
- * A public wrapper for _checkRestrictions — checks if a file passes a set of restrictions.
- * For use in UI pluigins (like Providers), to disallow selecting files that won’t pass restrictions.
- *
- * @param {object} file object to check
- * @param {Array} [files] array to check maxNumberOfFiles and maxTotalFileSize
- * @returns {object} { result: true/false, reason: why file didn’t pass restrictions }
- */
- validateRestrictions(file, files) {
- try {
- _classPrivateFieldLooseBase$6(this, _checkRestrictions)[_checkRestrictions](file, files);
- return {
- result: true
- };
- } catch (err) {
- return {
- result: false,
- reason: err.message
- };
- }
- }
- /**
- * Check if file passes a set of restrictions set in options: maxFileSize, minFileSize,
- * maxNumberOfFiles and allowedFileTypes.
- *
- * @param {object} file object to check
- * @param {Array} [files] array to check maxNumberOfFiles and maxTotalFileSize
- * @private
- */
- checkIfFileAlreadyExists(fileID) {
- const {
- files
- } = this.getState();
- if (files[fileID] && !files[fileID].isGhost) {
- return true;
- }
- return false;
- }
- /**
- * Create a file state object based on user-provided `addFile()` options.
- *
- * Note this is extremely side-effectful and should only be done when a file state object
- * will be added to state immediately afterward!
- *
- * The `files` value is passed in because it may be updated by the caller without updating the store.
- */
- /**
- * Add a new file to `state.files`. This will run `onBeforeFileAdded`,
- * try to guess file type in a clever way, check file against restrictions,
- * and start an upload if `autoProceed === true`.
- *
- * @param {object} file object to add
- * @returns {string} id for the added file
- */
- addFile(file) {
- _classPrivateFieldLooseBase$6(this, _assertNewUploadAllowed)[_assertNewUploadAllowed](file);
- const {
- files
- } = this.getState();
- let newFile = _classPrivateFieldLooseBase$6(this, _checkAndCreateFileStateObject)[_checkAndCreateFileStateObject](files, file); // Users are asked to re-select recovered files without data,
- // and to keep the progress, meta and everthing else, we only replace said data
- if (files[newFile.id] && files[newFile.id].isGhost) {
- newFile = { ...files[newFile.id],
- data: file.data,
- isGhost: false
- };
- this.log(`Replaced the blob in the restored ghost file: ${newFile.name}, ${newFile.id}`);
- }
- this.setState({
- files: { ...files,
- [newFile.id]: newFile
- }
- });
- this.emit('file-added', newFile);
- this.emit('files-added', [newFile]);
- this.log(`Added file: ${newFile.name}, ${newFile.id}, mime type: ${newFile.type}`);
- _classPrivateFieldLooseBase$6(this, _startIfAutoProceed)[_startIfAutoProceed]();
- return newFile.id;
- }
- /**
- * Add multiple files to `state.files`. See the `addFile()` documentation.
- *
- * If an error occurs while adding a file, it is logged and the user is notified.
- * This is good for UI plugins, but not for programmatic use.
- * Programmatic users should usually still use `addFile()` on individual files.
- */
- addFiles(fileDescriptors) {
- _classPrivateFieldLooseBase$6(this, _assertNewUploadAllowed)[_assertNewUploadAllowed](); // create a copy of the files object only once
- const files = { ...this.getState().files
- };
- const newFiles = [];
- const errors = [];
- for (let i = 0; i < fileDescriptors.length; i++) {
- try {
- let newFile = _classPrivateFieldLooseBase$6(this, _checkAndCreateFileStateObject)[_checkAndCreateFileStateObject](files, fileDescriptors[i]); // Users are asked to re-select recovered files without data,
- // and to keep the progress, meta and everthing else, we only replace said data
- if (files[newFile.id] && files[newFile.id].isGhost) {
- newFile = { ...files[newFile.id],
- data: fileDescriptors[i].data,
- isGhost: false
- };
- this.log(`Replaced blob in a ghost file: ${newFile.name}, ${newFile.id}`);
- }
- files[newFile.id] = newFile;
- newFiles.push(newFile);
- } catch (err) {
- if (!err.isRestriction) {
- errors.push(err);
- }
- }
- }
- this.setState({
- files
- });
- newFiles.forEach(newFile => {
- this.emit('file-added', newFile);
- });
- this.emit('files-added', newFiles);
- if (newFiles.length > 5) {
- this.log(`Added batch of ${newFiles.length} files`);
- } else {
- Object.keys(newFiles).forEach(fileID => {
- this.log(`Added file: ${newFiles[fileID].name}\n id: ${newFiles[fileID].id}\n type: ${newFiles[fileID].type}`);
- });
- }
- if (newFiles.length > 0) {
- _classPrivateFieldLooseBase$6(this, _startIfAutoProceed)[_startIfAutoProceed]();
- }
- if (errors.length > 0) {
- let message = 'Multiple errors occurred while adding files:\n';
- errors.forEach(subError => {
- message += `\n * ${subError.message}`;
- });
- this.info({
- message: this.i18n('addBulkFilesFailed', {
- smart_count: errors.length
- }),
- details: message
- }, 'error', this.opts.infoTimeout);
- if (typeof AggregateError === 'function') {
- throw new AggregateError(errors, message);
- } else {
- const err = new Error(message);
- err.errors = errors;
- throw err;
- }
- }
- }
- removeFiles(fileIDs, reason) {
- const {
- files,
- currentUploads
- } = this.getState();
- const updatedFiles = { ...files
- };
- const updatedUploads = { ...currentUploads
- };
- const removedFiles = Object.create(null);
- fileIDs.forEach(fileID => {
- if (files[fileID]) {
- removedFiles[fileID] = files[fileID];
- delete updatedFiles[fileID];
- }
- }); // Remove files from the `fileIDs` list in each upload.
- function fileIsNotRemoved(uploadFileID) {
- return removedFiles[uploadFileID] === undefined;
- }
- Object.keys(updatedUploads).forEach(uploadID => {
- const newFileIDs = currentUploads[uploadID].fileIDs.filter(fileIsNotRemoved); // Remove the upload if no files are associated with it anymore.
- if (newFileIDs.length === 0) {
- delete updatedUploads[uploadID];
- return;
- }
- updatedUploads[uploadID] = { ...currentUploads[uploadID],
- fileIDs: newFileIDs
- };
- });
- const stateUpdate = {
- currentUploads: updatedUploads,
- files: updatedFiles
- }; // If all files were removed - allow new uploads,
- // and clear recoveredState
- if (Object.keys(updatedFiles).length === 0) {
- stateUpdate.allowNewUpload = true;
- stateUpdate.error = null;
- stateUpdate.recoveredState = null;
- }
- this.setState(stateUpdate);
- this.calculateTotalProgress();
- const removedFileIDs = Object.keys(removedFiles);
- removedFileIDs.forEach(fileID => {
- this.emit('file-removed', removedFiles[fileID], reason);
- });
- if (removedFileIDs.length > 5) {
- this.log(`Removed ${removedFileIDs.length} files`);
- } else {
- this.log(`Removed files: ${removedFileIDs.join(', ')}`);
- }
- }
- removeFile(fileID, reason) {
- if (reason === void 0) {
- reason = null;
- }
- this.removeFiles([fileID], reason);
- }
- pauseResume(fileID) {
- if (!this.getState().capabilities.resumableUploads || this.getFile(fileID).uploadComplete) {
- return undefined;
- }
- const wasPaused = this.getFile(fileID).isPaused || false;
- const isPaused = !wasPaused;
- this.setFileState(fileID, {
- isPaused
- });
- this.emit('upload-pause', fileID, isPaused);
- return isPaused;
- }
- pauseAll() {
- const updatedFiles = { ...this.getState().files
- };
- const inProgressUpdatedFiles = Object.keys(updatedFiles).filter(file => {
- return !updatedFiles[file].progress.uploadComplete && updatedFiles[file].progress.uploadStarted;
- });
- inProgressUpdatedFiles.forEach(file => {
- const updatedFile = { ...updatedFiles[file],
- isPaused: true
- };
- updatedFiles[file] = updatedFile;
- });
- this.setState({
- files: updatedFiles
- });
- this.emit('pause-all');
- }
- resumeAll() {
- const updatedFiles = { ...this.getState().files
- };
- const inProgressUpdatedFiles = Object.keys(updatedFiles).filter(file => {
- return !updatedFiles[file].progress.uploadComplete && updatedFiles[file].progress.uploadStarted;
- });
- inProgressUpdatedFiles.forEach(file => {
- const updatedFile = { ...updatedFiles[file],
- isPaused: false,
- error: null
- };
- updatedFiles[file] = updatedFile;
- });
- this.setState({
- files: updatedFiles
- });
- this.emit('resume-all');
- }
- retryAll() {
- const updatedFiles = { ...this.getState().files
- };
- const filesToRetry = Object.keys(updatedFiles).filter(file => {
- return updatedFiles[file].error;
- });
- filesToRetry.forEach(file => {
- const updatedFile = { ...updatedFiles[file],
- isPaused: false,
- error: null
- };
- updatedFiles[file] = updatedFile;
- });
- this.setState({
- files: updatedFiles,
- error: null
- });
- this.emit('retry-all', filesToRetry);
- if (filesToRetry.length === 0) {
- return Promise.resolve({
- successful: [],
- failed: []
- });
- }
- const uploadID = _classPrivateFieldLooseBase$6(this, _createUpload)[_createUpload](filesToRetry, {
- forceAllowNewUpload: true // create new upload even if allowNewUpload: false
- });
- return _classPrivateFieldLooseBase$6(this, _runUpload)[_runUpload](uploadID);
- }
- cancelAll() {
- this.emit('cancel-all');
- const {
- files
- } = this.getState();
- const fileIDs = Object.keys(files);
- if (fileIDs.length) {
- this.removeFiles(fileIDs, 'cancel-all');
- }
- this.setState({
- totalProgress: 0,
- error: null,
- recoveredState: null
- });
- }
- retryUpload(fileID) {
- this.setFileState(fileID, {
- error: null,
- isPaused: false
- });
- this.emit('upload-retry', fileID);
- const uploadID = _classPrivateFieldLooseBase$6(this, _createUpload)[_createUpload]([fileID], {
- forceAllowNewUpload: true // create new upload even if allowNewUpload: false
- });
- return _classPrivateFieldLooseBase$6(this, _runUpload)[_runUpload](uploadID);
- }
- reset() {
- this.cancelAll();
- }
- logout() {
- this.iteratePlugins(plugin => {
- if (plugin.provider && plugin.provider.logout) {
- plugin.provider.logout();
- }
- });
- }
- calculateProgress(file, data) {
- if (!this.getFile(file.id)) {
- this.log(`Not setting progress for a file that has been removed: ${file.id}`);
- return;
- } // bytesTotal may be null or zero; in that case we can't divide by it
- const canHavePercentage = Number.isFinite(data.bytesTotal) && data.bytesTotal > 0;
- this.setFileState(file.id, {
- progress: { ...this.getFile(file.id).progress,
- bytesUploaded: data.bytesUploaded,
- bytesTotal: data.bytesTotal,
- percentage: canHavePercentage ? Math.round(data.bytesUploaded / data.bytesTotal * 100) : 0
- }
- });
- this.calculateTotalProgress();
- }
- calculateTotalProgress() {
- // calculate total progress, using the number of files currently uploading,
- // multiplied by 100 and the summ of individual progress of each file
- const files = this.getFiles();
- const inProgress = files.filter(file => {
- return file.progress.uploadStarted || file.progress.preprocess || file.progress.postprocess;
- });
- if (inProgress.length === 0) {
- this.emit('progress', 0);
- this.setState({
- totalProgress: 0
- });
- return;
- }
- const sizedFiles = inProgress.filter(file => file.progress.bytesTotal != null);
- const unsizedFiles = inProgress.filter(file => file.progress.bytesTotal == null);
- if (sizedFiles.length === 0) {
- const progressMax = inProgress.length * 100;
- const currentProgress = unsizedFiles.reduce((acc, file) => {
- return acc + file.progress.percentage;
- }, 0);
- const totalProgress = Math.round(currentProgress / progressMax * 100);
- this.setState({
- totalProgress
- });
- return;
- }
- let totalSize = sizedFiles.reduce((acc, file) => {
- return acc + file.progress.bytesTotal;
- }, 0);
- const averageSize = totalSize / sizedFiles.length;
- totalSize += averageSize * unsizedFiles.length;
- let uploadedSize = 0;
- sizedFiles.forEach(file => {
- uploadedSize += file.progress.bytesUploaded;
- });
- unsizedFiles.forEach(file => {
- uploadedSize += averageSize * (file.progress.percentage || 0) / 100;
- });
- let totalProgress = totalSize === 0 ? 0 : Math.round(uploadedSize / totalSize * 100); // hot fix, because:
- // uploadedSize ended up larger than totalSize, resulting in 1325% total
- if (totalProgress > 100) {
- totalProgress = 100;
- }
- this.setState({
- totalProgress
- });
- this.emit('progress', totalProgress);
- }
- /**
- * Registers listeners for all global actions, like:
- * `error`, `file-removed`, `upload-progress`
- */
- updateOnlineStatus() {
- const online = typeof window.navigator.onLine !== 'undefined' ? window.navigator.onLine : true;
- if (!online) {
- this.emit('is-offline');
- this.info(this.i18n('noInternetConnection'), 'error', 0);
- this.wasOffline = true;
- } else {
- this.emit('is-online');
- if (this.wasOffline) {
- this.emit('back-online');
- this.info(this.i18n('connectedToInternet'), 'success', 3000);
- this.wasOffline = false;
- }
- }
- }
- getID() {
- return this.opts.id;
- }
- /**
- * Registers a plugin with Core.
- *
- * @param {object} Plugin object
- * @param {object} [opts] object with options to be passed to Plugin
- * @returns {object} self for chaining
- */
- // eslint-disable-next-line no-shadow
- use(Plugin, opts) {
- if (typeof Plugin !== 'function') {
- const msg = `Expected a plugin class, but got ${Plugin === null ? 'null' : typeof Plugin}.` + ' Please verify that the plugin was imported and spelled correctly.';
- throw new TypeError(msg);
- } // Instantiate
- const plugin = new Plugin(this, opts);
- const pluginId = plugin.id;
- if (!pluginId) {
- throw new Error('Your plugin must have an id');
- }
- if (!plugin.type) {
- throw new Error('Your plugin must have a type');
- }
- const existsPluginAlready = this.getPlugin(pluginId);
- if (existsPluginAlready) {
- 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.';
- throw new Error(msg);
- }
- if (Plugin.VERSION) {
- this.log(`Using ${pluginId} v${Plugin.VERSION}`);
- }
- if (plugin.type in _classPrivateFieldLooseBase$6(this, _plugins)[_plugins]) {
- _classPrivateFieldLooseBase$6(this, _plugins)[_plugins][plugin.type].push(plugin);
- } else {
- _classPrivateFieldLooseBase$6(this, _plugins)[_plugins][plugin.type] = [plugin];
- }
- plugin.install();
- return this;
- }
- /**
- * Find one Plugin by name.
- *
- * @param {string} id plugin id
- * @returns {BasePlugin|undefined}
- */
- getPlugin(id) {
- for (const plugins of Object.values(_classPrivateFieldLooseBase$6(this, _plugins)[_plugins])) {
- const foundPlugin = plugins.find(plugin => plugin.id === id);
- if (foundPlugin != null) return foundPlugin;
- }
- return undefined;
- }
- [_Symbol$for$1](type) {
- return _classPrivateFieldLooseBase$6(this, _plugins)[_plugins][type];
- }
- /**
- * Iterate through all `use`d plugins.
- *
- * @param {Function} method that will be run on each plugin
- */
- iteratePlugins(method) {
- Object.values(_classPrivateFieldLooseBase$6(this, _plugins)[_plugins]).flat(1).forEach(method);
- }
- /**
- * Uninstall and remove a plugin.
- *
- * @param {object} instance The plugin instance to remove.
- */
- removePlugin(instance) {
- this.log(`Removing plugin ${instance.id}`);
- this.emit('plugin-remove', instance);
- if (instance.uninstall) {
- instance.uninstall();
- }
- const list = _classPrivateFieldLooseBase$6(this, _plugins)[_plugins][instance.type]; // list.indexOf failed here, because Vue3 converted the plugin instance
- // to a Proxy object, which failed the strict comparison test:
- // obj !== objProxy
- const index = list.findIndex(item => item.id === instance.id);
- if (index !== -1) {
- list.splice(index, 1);
- }
- const state = this.getState();
- const updatedState = {
- plugins: { ...state.plugins,
- [instance.id]: undefined
- }
- };
- this.setState(updatedState);
- }
- /**
- * Uninstall all plugins and close down this Uppy instance.
- */
- close() {
- this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`);
- this.reset();
- _classPrivateFieldLooseBase$6(this, _storeUnsubscribe)[_storeUnsubscribe]();
- this.iteratePlugins(plugin => {
- this.removePlugin(plugin);
- });
- if (typeof window !== 'undefined' && window.removeEventListener) {
- window.removeEventListener('online', _classPrivateFieldLooseBase$6(this, _updateOnlineStatus)[_updateOnlineStatus]);
- window.removeEventListener('offline', _classPrivateFieldLooseBase$6(this, _updateOnlineStatus)[_updateOnlineStatus]);
- }
- }
- hideInfo() {
- const {
- info
- } = this.getState();
- this.setState({
- info: info.slice(1)
- });
- this.emit('info-hidden');
- }
- /**
- * Set info message in `state.info`, so that UI plugins like `Informer`
- * can display the message.
- *
- * @param {string | object} message Message to be displayed by the informer
- * @param {string} [type]
- * @param {number} [duration]
- */
- info(message, type, duration) {
- if (type === void 0) {
- type = 'info';
- }
- if (duration === void 0) {
- duration = 3000;
- }
- const isComplexMessage = typeof message === 'object';
- this.setState({
- info: [...this.getState().info, {
- type,
- message: isComplexMessage ? message.message : message,
- details: isComplexMessage ? message.details : null
- }]
- });
- setTimeout(() => this.hideInfo(), duration);
- this.emit('info-visible');
- }
- /**
- * Passes messages to a function, provided in `opts.logger`.
- * If `opts.logger: Uppy.debugLogger` or `opts.debug: true`, logs to the browser console.
- *
- * @param {string|object} message to log
- * @param {string} [type] optional `error` or `warning`
- */
- log(message, type) {
- const {
- logger
- } = this.opts;
- switch (type) {
- case 'error':
- logger.error(message);
- break;
- case 'warning':
- logger.warn(message);
- break;
- default:
- logger.debug(message);
- break;
- }
- }
- /**
- * Restore an upload by its ID.
- */
- restore(uploadID) {
- this.log(`Core: attempting to restore upload "${uploadID}"`);
- if (!this.getState().currentUploads[uploadID]) {
- _classPrivateFieldLooseBase$6(this, _removeUpload)[_removeUpload](uploadID);
- return Promise.reject(new Error('Nonexistent upload'));
- }
- return _classPrivateFieldLooseBase$6(this, _runUpload)[_runUpload](uploadID);
- }
- /**
- * Create an upload for a bunch of files.
- *
- * @param {Array<string>} fileIDs File IDs to include in this upload.
- * @returns {string} ID of this upload.
- */
- [_Symbol$for2$1]() {
- return _classPrivateFieldLooseBase$6(this, _createUpload)[_createUpload](...arguments);
- }
- /**
- * Add data to an upload's result object.
- *
- * @param {string} uploadID The ID of the upload.
- * @param {object} data Data properties to add to the result object.
- */
- addResultData(uploadID, data) {
- if (!_classPrivateFieldLooseBase$6(this, _getUpload)[_getUpload](uploadID)) {
- this.log(`Not setting result for an upload that has been removed: ${uploadID}`);
- return;
- }
- const {
- currentUploads
- } = this.getState();
- const currentUpload = { ...currentUploads[uploadID],
- result: { ...currentUploads[uploadID].result,
- ...data
- }
- };
- this.setState({
- currentUploads: { ...currentUploads,
- [uploadID]: currentUpload
- }
- });
- }
- /**
- * Remove an upload, eg. if it has been canceled or completed.
- *
- * @param {string} uploadID The ID of the upload.
- */
- /**
- * Start an upload for all the files that are not currently being uploaded.
- *
- * @returns {Promise}
- */
- upload() {
- var _classPrivateFieldLoo;
- if (!((_classPrivateFieldLoo = _classPrivateFieldLooseBase$6(this, _plugins)[_plugins].uploader) != null && _classPrivateFieldLoo.length)) {
- this.log('No uploader type plugins are used', 'warning');
- }
- let {
- files
- } = this.getState();
- const onBeforeUploadResult = this.opts.onBeforeUpload(files);
- if (onBeforeUploadResult === false) {
- return Promise.reject(new Error('Not starting the upload because onBeforeUpload returned false'));
- }
- if (onBeforeUploadResult && typeof onBeforeUploadResult === 'object') {
- files = onBeforeUploadResult; // Updating files in state, because uploader plugins receive file IDs,
- // and then fetch the actual file object from state
- this.setState({
- files
- });
- }
- return Promise.resolve().then(() => {
- _classPrivateFieldLooseBase$6(this, _checkMinNumberOfFiles)[_checkMinNumberOfFiles](files);
- _classPrivateFieldLooseBase$6(this, _checkRequiredMetaFields)[_checkRequiredMetaFields](files);
- }).catch(err => {
- _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](err);
- }).then(() => {
- const {
- currentUploads
- } = this.getState(); // get a list of files that are currently assigned to uploads
- const currentlyUploadingFiles = Object.values(currentUploads).flatMap(curr => curr.fileIDs);
- const waitingFileIDs = [];
- Object.keys(files).forEach(fileID => {
- const file = this.getFile(fileID); // if the file hasn't started uploading and hasn't already been assigned to an upload..
- if (!file.progress.uploadStarted && currentlyUploadingFiles.indexOf(fileID) === -1) {
- waitingFileIDs.push(file.id);
- }
- });
- const uploadID = _classPrivateFieldLooseBase$6(this, _createUpload)[_createUpload](waitingFileIDs);
- return _classPrivateFieldLooseBase$6(this, _runUpload)[_runUpload](uploadID);
- }).catch(err => {
- _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](err, {
- showInformer: false
- });
- });
- }
- }
- function _checkRestrictions2(file, files) {
- if (files === void 0) {
- files = this.getFiles();
- }
- const {
- maxFileSize,
- minFileSize,
- maxTotalFileSize,
- maxNumberOfFiles,
- allowedFileTypes
- } = this.opts.restrictions;
- if (maxNumberOfFiles) {
- if (files.length + 1 > maxNumberOfFiles) {
- throw new RestrictionError(`${this.i18n('youCanOnlyUploadX', {
- smart_count: maxNumberOfFiles
- })}`);
- }
- }
- if (allowedFileTypes) {
- const isCorrectFileType = allowedFileTypes.some(type => {
- // check if this is a mime-type
- if (type.indexOf('/') > -1) {
- if (!file.type) return false;
- return mimeMatch(file.type.replace(/;.*?$/, ''), type);
- } // otherwise this is likely an extension
- if (type[0] === '.' && file.extension) {
- return file.extension.toLowerCase() === type.substr(1).toLowerCase();
- }
- return false;
- });
- if (!isCorrectFileType) {
- const allowedFileTypesString = allowedFileTypes.join(', ');
- throw new RestrictionError(this.i18n('youCanOnlyUploadFileTypes', {
- types: allowedFileTypesString
- }));
- }
- } // We can't check maxTotalFileSize if the size is unknown.
- if (maxTotalFileSize && file.size != null) {
- let totalFilesSize = 0;
- totalFilesSize += file.size;
- files.forEach(f => {
- totalFilesSize += f.size;
- });
- if (totalFilesSize > maxTotalFileSize) {
- throw new RestrictionError(this.i18n('exceedsSize', {
- size: prettierBytes(maxTotalFileSize),
- file: file.name
- }));
- }
- } // We can't check maxFileSize if the size is unknown.
- if (maxFileSize && file.size != null) {
- if (file.size > maxFileSize) {
- throw new RestrictionError(this.i18n('exceedsSize', {
- size: prettierBytes(maxFileSize),
- file: file.name
- }));
- }
- } // We can't check minFileSize if the size is unknown.
- if (minFileSize && file.size != null) {
- if (file.size < minFileSize) {
- throw new RestrictionError(this.i18n('inferiorSize', {
- size: prettierBytes(minFileSize)
- }));
- }
- }
- }
- function _checkMinNumberOfFiles2(files) {
- const {
- minNumberOfFiles
- } = this.opts.restrictions;
- if (Object.keys(files).length < minNumberOfFiles) {
- throw new RestrictionError(`${this.i18n('youHaveToAtLeastSelectX', {
- smart_count: minNumberOfFiles
- })}`);
- }
- }
- function _checkRequiredMetaFieldsOnFile2(file) {
- const {
- requiredMetaFields
- } = this.opts.restrictions;
- const {
- hasOwnProperty
- } = Object.prototype;
- const errors = [];
- const missingFields = [];
- for (let i = 0; i < requiredMetaFields.length; i++) {
- if (!hasOwnProperty.call(file.meta, requiredMetaFields[i]) || file.meta[requiredMetaFields[i]] === '') {
- const err = new RestrictionError(`${this.i18n('missingRequiredMetaFieldOnFile', {
- fileName: file.name
- })}`);
- errors.push(err);
- missingFields.push(requiredMetaFields[i]);
- _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](err, {
- file,
- showInformer: false,
- throwErr: false
- });
- }
- }
- this.setFileState(file.id, {
- missingRequiredMetaFields: missingFields
- });
- return errors;
- }
- function _checkRequiredMetaFields2(files) {
- const errors = Object.keys(files).flatMap(fileID => {
- const file = this.getFile(fileID);
- return _classPrivateFieldLooseBase$6(this, _checkRequiredMetaFieldsOnFile)[_checkRequiredMetaFieldsOnFile](file);
- });
- if (errors.length) {
- throw new AggregateRestrictionError(errors, `${this.i18n('missingRequiredMetaField')}`);
- }
- }
- function _showOrLogErrorAndThrow2(err, _temp) {
- let {
- showInformer = true,
- file = null,
- throwErr = true
- } = _temp === void 0 ? {} : _temp;
- const message = typeof err === 'object' ? err.message : err;
- const details = typeof err === 'object' && err.details ? err.details : ''; // Restriction errors should be logged, but not as errors,
- // as they are expected and shown in the UI.
- let logMessageWithDetails = message;
- if (details) {
- logMessageWithDetails += ` ${details}`;
- }
- if (err.isRestriction) {
- this.log(logMessageWithDetails);
- this.emit('restriction-failed', file, err);
- } else {
- this.log(logMessageWithDetails, 'error');
- } // Sometimes informer has to be shown manually by the developer,
- // for example, in `onBeforeFileAdded`.
- if (showInformer) {
- this.info({
- message,
- details
- }, 'error', this.opts.infoTimeout);
- }
- if (throwErr) {
- throw typeof err === 'object' ? err : new Error(err);
- }
- }
- function _assertNewUploadAllowed2(file) {
- const {
- allowNewUpload
- } = this.getState();
- if (allowNewUpload === false) {
- _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](new RestrictionError(this.i18n('noMoreFilesAllowed')), {
- file
- });
- }
- }
- function _checkAndCreateFileStateObject2(files, fileDescriptor) {
- const fileType = getFileType(fileDescriptor);
- const fileName = getFileName(fileType, fileDescriptor);
- const fileExtension = getFileNameAndExtension(fileName).extension;
- const isRemote = Boolean(fileDescriptor.isRemote);
- const fileID = generateFileID({ ...fileDescriptor,
- type: fileType
- });
- if (this.checkIfFileAlreadyExists(fileID)) {
- const error = new RestrictionError(this.i18n('noDuplicates', {
- fileName
- }));
- _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](error, {
- file: fileDescriptor
- });
- }
- const meta = fileDescriptor.meta || {};
- meta.name = fileName;
- meta.type = fileType; // `null` means the size is unknown.
- const size = Number.isFinite(fileDescriptor.data.size) ? fileDescriptor.data.size : null;
- let newFile = {
- source: fileDescriptor.source || '',
- id: fileID,
- name: fileName,
- extension: fileExtension || '',
- meta: { ...this.getState().meta,
- ...meta
- },
- type: fileType,
- data: fileDescriptor.data,
- progress: {
- percentage: 0,
- bytesUploaded: 0,
- bytesTotal: size,
- uploadComplete: false,
- uploadStarted: null
- },
- size,
- isRemote,
- remote: fileDescriptor.remote || '',
- preview: fileDescriptor.preview
- };
- const onBeforeFileAddedResult = this.opts.onBeforeFileAdded(newFile, files);
- if (onBeforeFileAddedResult === false) {
- // Don’t show UI info for this error, as it should be done by the developer
- _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](new RestrictionError('Cannot add the file because onBeforeFileAdded returned false.'), {
- showInformer: false,
- fileDescriptor
- });
- } else if (typeof onBeforeFileAddedResult === 'object' && onBeforeFileAddedResult !== null) {
- newFile = onBeforeFileAddedResult;
- }
- try {
- const filesArray = Object.keys(files).map(i => files[i]);
- _classPrivateFieldLooseBase$6(this, _checkRestrictions)[_checkRestrictions](newFile, filesArray);
- } catch (err) {
- _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](err, {
- file: newFile
- });
- }
- return newFile;
- }
- function _startIfAutoProceed2() {
- if (this.opts.autoProceed && !this.scheduledAutoProceed) {
- this.scheduledAutoProceed = setTimeout(() => {
- this.scheduledAutoProceed = null;
- this.upload().catch(err => {
- if (!err.isRestriction) {
- this.log(err.stack || err.message || err);
- }
- });
- }, 4);
- }
- }
- function _addListeners2() {
- /**
- * @param {Error} error
- * @param {object} [file]
- * @param {object} [response]
- */
- const errorHandler = (error, file, response) => {
- let errorMsg = error.message || 'Unknown error';
- if (error.details) {
- errorMsg += ` ${error.details}`;
- }
- this.setState({
- error: errorMsg
- });
- if (file != null && file.id in this.getState().files) {
- this.setFileState(file.id, {
- error: errorMsg,
- response
- });
- }
- };
- this.on('error', errorHandler);
- this.on('upload-error', (file, error, response) => {
- errorHandler(error, file, response);
- if (typeof error === 'object' && error.message) {
- const newError = new Error(error.message);
- newError.details = error.message;
- if (error.details) {
- newError.details += ` ${error.details}`;
- }
- newError.message = this.i18n('failedToUpload', {
- file: file.name
- });
- _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](newError, {
- throwErr: false
- });
- } else {
- _classPrivateFieldLooseBase$6(this, _showOrLogErrorAndThrow)[_showOrLogErrorAndThrow](error, {
- throwErr: false
- });
- }
- });
- this.on('upload', () => {
- this.setState({
- error: null
- });
- });
- this.on('upload-started', file => {
- if (!this.getFile(file.id)) {
- this.log(`Not setting progress for a file that has been removed: ${file.id}`);
- return;
- }
- this.setFileState(file.id, {
- progress: {
- uploadStarted: Date.now(),
- uploadComplete: false,
- percentage: 0,
- bytesUploaded: 0,
- bytesTotal: file.size
- }
- });
- });
- this.on('upload-progress', this.calculateProgress);
- this.on('upload-success', (file, uploadResp) => {
- if (!this.getFile(file.id)) {
- this.log(`Not setting progress for a file that has been removed: ${file.id}`);
- return;
- }
- const currentProgress = this.getFile(file.id).progress;
- this.setFileState(file.id, {
- progress: { ...currentProgress,
- postprocess: _classPrivateFieldLooseBase$6(this, _postProcessors)[_postProcessors].size > 0 ? {
- mode: 'indeterminate'
- } : null,
- uploadComplete: true,
- percentage: 100,
- bytesUploaded: currentProgress.bytesTotal
- },
- response: uploadResp,
- uploadURL: uploadResp.uploadURL,
- isPaused: false
- }); // Remote providers sometimes don't tell us the file size,
- // but we can know how many bytes we uploaded once the upload is complete.
- if (file.size == null) {
- this.setFileState(file.id, {
- size: uploadResp.bytesUploaded || currentProgress.bytesTotal
- });
- }
- this.calculateTotalProgress();
- });
- this.on('preprocess-progress', (file, progress) => {
- if (!this.getFile(file.id)) {
- this.log(`Not setting progress for a file that has been removed: ${file.id}`);
- return;
- }
- this.setFileState(file.id, {
- progress: { ...this.getFile(file.id).progress,
- preprocess: progress
- }
- });
- });
- this.on('preprocess-complete', file => {
- if (!this.getFile(file.id)) {
- this.log(`Not setting progress for a file that has been removed: ${file.id}`);
- return;
- }
- const files = { ...this.getState().files
- };
- files[file.id] = { ...files[file.id],
- progress: { ...files[file.id].progress
- }
- };
- delete files[file.id].progress.preprocess;
- this.setState({
- files
- });
- });
- this.on('postprocess-progress', (file, progress) => {
- if (!this.getFile(file.id)) {
- this.log(`Not setting progress for a file that has been removed: ${file.id}`);
- return;
- }
- this.setFileState(file.id, {
- progress: { ...this.getState().files[file.id].progress,
- postprocess: progress
- }
- });
- });
- this.on('postprocess-complete', file => {
- if (!this.getFile(file.id)) {
- this.log(`Not setting progress for a file that has been removed: ${file.id}`);
- return;
- }
- const files = { ...this.getState().files
- };
- files[file.id] = { ...files[file.id],
- progress: { ...files[file.id].progress
- }
- };
- delete files[file.id].progress.postprocess;
- this.setState({
- files
- });
- });
- this.on('restored', () => {
- // Files may have changed--ensure progress is still accurate.
- this.calculateTotalProgress();
- });
- this.on('dashboard:file-edit-complete', file => {
- if (file) {
- _classPrivateFieldLooseBase$6(this, _checkRequiredMetaFieldsOnFile)[_checkRequiredMetaFieldsOnFile](file);
- }
- }); // show informer if offline
- if (typeof window !== 'undefined' && window.addEventListener) {
- window.addEventListener('online', _classPrivateFieldLooseBase$6(this, _updateOnlineStatus)[_updateOnlineStatus]);
- window.addEventListener('offline', _classPrivateFieldLooseBase$6(this, _updateOnlineStatus)[_updateOnlineStatus]);
- setTimeout(_classPrivateFieldLooseBase$6(this, _updateOnlineStatus)[_updateOnlineStatus], 3000);
- }
- }
- function _createUpload2(fileIDs, opts) {
- if (opts === void 0) {
- opts = {};
- }
- // uppy.retryAll sets this to true — when retrying we want to ignore `allowNewUpload: false`
- const {
- forceAllowNewUpload = false
- } = opts;
- const {
- allowNewUpload,
- currentUploads
- } = this.getState();
- if (!allowNewUpload && !forceAllowNewUpload) {
- throw new Error('Cannot create a new upload: already uploading.');
- }
- const uploadID = nanoid$1();
- this.emit('upload', {
- id: uploadID,
- fileIDs
- });
- this.setState({
- allowNewUpload: this.opts.allowMultipleUploadBatches !== false && this.opts.allowMultipleUploads !== false,
- currentUploads: { ...currentUploads,
- [uploadID]: {
- fileIDs,
- step: 0,
- result: {}
- }
- }
- });
- return uploadID;
- }
- function _getUpload2(uploadID) {
- const {
- currentUploads
- } = this.getState();
- return currentUploads[uploadID];
- }
- function _removeUpload2(uploadID) {
- const currentUploads = { ...this.getState().currentUploads
- };
- delete currentUploads[uploadID];
- this.setState({
- currentUploads
- });
- }
- async function _runUpload2(uploadID) {
- let {
- currentUploads
- } = this.getState();
- let currentUpload = currentUploads[uploadID];
- const restoreStep = currentUpload.step || 0;
- const steps = [..._classPrivateFieldLooseBase$6(this, _preProcessors)[_preProcessors], ..._classPrivateFieldLooseBase$6(this, _uploaders)[_uploaders], ..._classPrivateFieldLooseBase$6(this, _postProcessors)[_postProcessors]];
- try {
- for (let step = restoreStep; step < steps.length; step++) {
- if (!currentUpload) {
- break;
- }
- const fn = steps[step];
- const updatedUpload = { ...currentUpload,
- step
- };
- this.setState({
- currentUploads: { ...currentUploads,
- [uploadID]: updatedUpload
- }
- }); // TODO give this the `updatedUpload` object as its only parameter maybe?
- // Otherwise when more metadata may be added to the upload this would keep getting more parameters
- await fn(updatedUpload.fileIDs, uploadID); // Update currentUpload value in case it was modified asynchronously.
- currentUploads = this.getState().currentUploads;
- currentUpload = currentUploads[uploadID];
- }
- } catch (err) {
- this.emit('error', err);
- _classPrivateFieldLooseBase$6(this, _removeUpload)[_removeUpload](uploadID);
- throw err;
- } // Set result data.
- if (currentUpload) {
- // Mark postprocessing step as complete if necessary; this addresses a case where we might get
- // stuck in the postprocessing UI while the upload is fully complete.
- // If the postprocessing steps do not do any work, they may not emit postprocessing events at
- // all, and never mark the postprocessing as complete. This is fine on its own but we
- // introduced code in the @uppy/core upload-success handler to prepare postprocessing progress
- // state if any postprocessors are registered. That is to avoid a "flash of completed state"
- // before the postprocessing plugins can emit events.
- //
- // So, just in case an upload with postprocessing plugins *has* completed *without* emitting
- // postprocessing completion, we do it instead.
- currentUpload.fileIDs.forEach(fileID => {
- const file = this.getFile(fileID);
- if (file && file.progress.postprocess) {
- this.emit('postprocess-complete', file);
- }
- });
- const files = currentUpload.fileIDs.map(fileID => this.getFile(fileID));
- const successful = files.filter(file => !file.error);
- const failed = files.filter(file => file.error);
- await this.addResultData(uploadID, {
- successful,
- failed,
- uploadID
- }); // Update currentUpload value in case it was modified asynchronously.
- currentUploads = this.getState().currentUploads;
- currentUpload = currentUploads[uploadID];
- } // Emit completion events.
- // This is in a separate function so that the `currentUploads` variable
- // always refers to the latest state. In the handler right above it refers
- // to an outdated object without the `.result` property.
- let result;
- if (currentUpload) {
- result = currentUpload.result;
- this.emit('complete', result);
- _classPrivateFieldLooseBase$6(this, _removeUpload)[_removeUpload](uploadID);
- }
- if (result == null) {
- this.log(`Not setting result for an upload that has been removed: ${uploadID}`);
- }
- return result;
- }
- Uppy.VERSION = "2.1.3";
- var Uppy_1$1 = Uppy;
- var preact = createCommonjsModule$1(function (module, exports) {
- 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};
- });
- /**
- * Check if an object is a DOM element. Duck-typing based on `nodeType`.
- *
- * @param {*} obj
- */
- var isDOMElement = function isDOMElement(obj) {
- return (obj == null ? void 0 : obj.nodeType) === Node.ELEMENT_NODE;
- };
- /**
- * Find a DOM element.
- *
- * @param {Node|string} element
- * @returns {Node|null}
- */
- var findDOMElement = function findDOMElement(element, context) {
- if (context === void 0) {
- context = document;
- }
- if (typeof element === 'string') {
- return context.querySelector(element);
- }
- if (isDOMElement(element)) {
- return element;
- }
- return null;
- };
- /**
- * Core plugin logic that all plugins share.
- *
- * BasePlugin does not contain DOM rendering so it can be used for plugins
- * without a user interface.
- *
- * See `Plugin` for the extended version with Preact rendering for interfaces.
- */
- var BasePlugin_1$1 = class BasePlugin {
- constructor(uppy, opts) {
- if (opts === void 0) {
- opts = {};
- }
- this.uppy = uppy;
- this.opts = opts;
- }
- getPluginState() {
- const {
- plugins
- } = this.uppy.getState();
- return plugins[this.id] || {};
- }
- setPluginState(update) {
- const {
- plugins
- } = this.uppy.getState();
- this.uppy.setState({
- plugins: { ...plugins,
- [this.id]: { ...plugins[this.id],
- ...update
- }
- }
- });
- }
- setOptions(newOpts) {
- this.opts = { ...this.opts,
- ...newOpts
- };
- this.setPluginState(); // so that UI re-renders with new options
- this.i18nInit();
- }
- i18nInit() {
- const translator = new Translator_1([this.defaultLocale, this.uppy.locale, this.opts.locale]);
- this.i18n = translator.translate.bind(translator);
- this.i18nArray = translator.translateArray.bind(translator);
- this.setPluginState(); // so that UI re-renders and we see the updated locale
- }
- /**
- * Extendable methods
- * ==================
- * These methods are here to serve as an overview of the extendable methods as well as
- * making them not conditional in use, such as `if (this.afterUpdate)`.
- */
- // eslint-disable-next-line class-methods-use-this
- addTarget() {
- throw new Error('Extend the addTarget method to add your plugin to another plugin\'s target');
- } // eslint-disable-next-line class-methods-use-this
- install() {} // eslint-disable-next-line class-methods-use-this
- uninstall() {}
- /**
- * Called when plugin is mounted, whether in DOM or into another plugin.
- * Needed because sometimes plugins are mounted separately/after `install`,
- * so this.el and this.parent might not be available in `install`.
- * This is the case with @uppy/react plugins, for example.
- */
- render() {
- throw new Error('Extend the render method to add your plugin to a DOM element');
- } // eslint-disable-next-line class-methods-use-this
- update() {} // Called after every state update, after everything's mounted. Debounced.
- // eslint-disable-next-line class-methods-use-this
- afterUpdate() {}
- };
- 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; }
- var id$5 = 0;
- function _classPrivateFieldLooseKey$5(name) { return "__private_" + id$5++ + "_" + name; }
- const {
- render
- } = preact;
- /**
- * Defer a frequent call to the microtask queue.
- *
- * @param {() => T} fn
- * @returns {Promise<T>}
- */
- function debounce(fn) {
- let calling = null;
- let latestArgs = null;
- return function () {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- latestArgs = args;
- if (!calling) {
- calling = Promise.resolve().then(() => {
- calling = null; // At this point `args` may be different from the most
- // recent state, if multiple calls happened since this task
- // was queued. So we use the `latestArgs`, which definitely
- // is the most recent call.
- return fn(...latestArgs);
- });
- }
- return calling;
- };
- }
- /**
- * UIPlugin is the extended version of BasePlugin to incorporate rendering with Preact.
- * Use this for plugins that need a user interface.
- *
- * For plugins without an user interface, see BasePlugin.
- */
- var _updateUI = /*#__PURE__*/_classPrivateFieldLooseKey$5("updateUI");
- class UIPlugin extends BasePlugin_1$1 {
- constructor() {
- super(...arguments);
- Object.defineProperty(this, _updateUI, {
- writable: true,
- value: void 0
- });
- }
- /**
- * Check if supplied `target` is a DOM element or an `object`.
- * If it’s an object — target is a plugin, and we search `plugins`
- * for a plugin with same name and return its target.
- */
- mount(target, plugin) {
- const callerPluginName = plugin.id;
- const targetElement = findDOMElement(target);
- if (targetElement) {
- this.isTargetDOMEl = true; // When target is <body> with a single <div> element,
- // Preact thinks it’s the Uppy root element in there when doing a diff,
- // and destroys it. So we are creating a fragment (could be empty div)
- const uppyRootElement = document.createDocumentFragment(); // API for plugins that require a synchronous rerender.
- _classPrivateFieldLooseBase$5(this, _updateUI)[_updateUI] = debounce(state => {
- // plugin could be removed, but this.rerender is debounced below,
- // so it could still be called even after uppy.removePlugin or uppy.close
- // hence the check
- if (!this.uppy.getPlugin(this.id)) return;
- render(this.render(state), uppyRootElement);
- this.afterUpdate();
- });
- this.uppy.log(`Installing ${callerPluginName} to a DOM element '${target}'`);
- if (this.opts.replaceTargetContent) {
- // Doing render(h(null), targetElement), which should have been
- // a better way, since because the component might need to do additional cleanup when it is removed,
- // stopped working — Preact just adds null into target, not replacing
- targetElement.innerHTML = '';
- }
- render(this.render(this.uppy.getState()), uppyRootElement);
- this.el = uppyRootElement.firstElementChild;
- targetElement.appendChild(uppyRootElement);
- this.onMount();
- return this.el;
- }
- let targetPlugin;
- if (typeof target === 'object' && target instanceof UIPlugin) {
- // Targeting a plugin *instance*
- targetPlugin = target;
- } else if (typeof target === 'function') {
- // Targeting a plugin type
- const Target = target; // Find the target plugin instance.
- this.uppy.iteratePlugins(p => {
- if (p instanceof Target) {
- targetPlugin = p;
- return false;
- }
- });
- }
- if (targetPlugin) {
- this.uppy.log(`Installing ${callerPluginName} to ${targetPlugin.id}`);
- this.parent = targetPlugin;
- this.el = targetPlugin.addTarget(plugin);
- this.onMount();
- return this.el;
- }
- this.uppy.log(`Not installing ${callerPluginName}`);
- let message = `Invalid target option given to ${callerPluginName}.`;
- if (typeof target === 'function') {
- 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.';
- } else {
- 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.';
- }
- throw new Error(message);
- }
- update(state) {
- if (this.el != null) {
- var _classPrivateFieldLoo, _classPrivateFieldLoo2;
- (_classPrivateFieldLoo = (_classPrivateFieldLoo2 = _classPrivateFieldLooseBase$5(this, _updateUI))[_updateUI]) == null ? void 0 : _classPrivateFieldLoo.call(_classPrivateFieldLoo2, state);
- }
- }
- unmount() {
- if (this.isTargetDOMEl) {
- var _this$el;
- (_this$el = this.el) == null ? void 0 : _this$el.remove();
- }
- this.onUnmount();
- } // eslint-disable-next-line class-methods-use-this
- onMount() {} // eslint-disable-next-line class-methods-use-this
- onUnmount() {}
- }
- var UIPlugin_1$1 = UIPlugin;
- const {
- debugLogger
- } = loggers;
- var lib$2 = Uppy_1$1;
- var Uppy_1 = Uppy_1$1;
- var UIPlugin_1 = UIPlugin_1$1;
- var BasePlugin_1 = BasePlugin_1$1;
- var debugLogger_1 = debugLogger;
- lib$2.Uppy = Uppy_1;
- lib$2.UIPlugin = UIPlugin_1;
- lib$2.BasePlugin = BasePlugin_1;
- lib$2.debugLogger = debugLogger_1;
- class NetworkError extends Error {
- constructor(error, xhr) {
- if (xhr === void 0) {
- xhr = null;
- }
- super(`This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.`);
- this.cause = error;
- this.isNetworkError = true;
- this.request = xhr;
- }
- }
- var NetworkError_1 = NetworkError;
- /**
- * Wrapper around window.fetch that throws a NetworkError when appropriate
- */
- var fetchWithNetworkError = function fetchWithNetworkError() {
- return fetch(...arguments).catch(err => {
- if (err.name === 'AbortError') {
- throw err;
- } else {
- throw new NetworkError_1(err);
- }
- });
- };
- class AuthError extends Error {
- constructor() {
- super('Authorization required');
- this.name = 'AuthError';
- this.isAuthError = true;
- }
- }
- var AuthError_1 = AuthError;
- var _class$1, _getPostResponseFunc, _getUrl, _errorHandler, _temp$1;
- 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; }
- var id$4 = 0;
- function _classPrivateFieldLooseKey$4(name) { return "__private_" + id$4++ + "_" + name; }
- // Remove the trailing slash so we can always safely append /xyz.
- function stripSlash(url) {
- return url.replace(/\/$/, '');
- }
- async function handleJSONResponse(res) {
- if (res.status === 401) {
- throw new AuthError_1();
- }
- const jsonPromise = res.json();
- if (res.status < 200 || res.status > 300) {
- let errMsg = `Failed request with status: ${res.status}. ${res.statusText}`;
- try {
- const errData = await jsonPromise;
- errMsg = errData.message ? `${errMsg} message: ${errData.message}` : errMsg;
- errMsg = errData.requestId ? `${errMsg} request-Id: ${errData.requestId}` : errMsg;
- } finally {
- // eslint-disable-next-line no-unsafe-finally
- throw new Error(errMsg);
- }
- }
- return jsonPromise;
- }
- var RequestClient_1 = (_temp$1 = (_getPostResponseFunc = /*#__PURE__*/_classPrivateFieldLooseKey$4("getPostResponseFunc"), _getUrl = /*#__PURE__*/_classPrivateFieldLooseKey$4("getUrl"), _errorHandler = /*#__PURE__*/_classPrivateFieldLooseKey$4("errorHandler"), _class$1 = class RequestClient {
- // eslint-disable-next-line global-require
- constructor(uppy, opts) {
- Object.defineProperty(this, _errorHandler, {
- value: _errorHandler2
- });
- Object.defineProperty(this, _getUrl, {
- value: _getUrl2
- });
- Object.defineProperty(this, _getPostResponseFunc, {
- writable: true,
- value: skip => response => skip ? response : this.onReceiveResponse(response)
- });
- this.uppy = uppy;
- this.opts = opts;
- this.onReceiveResponse = this.onReceiveResponse.bind(this);
- this.allowedHeaders = ['accept', 'content-type', 'uppy-auth-token'];
- this.preflightDone = false;
- }
- get hostname() {
- const {
- companion
- } = this.uppy.getState();
- const host = this.opts.companionUrl;
- return stripSlash(companion && companion[host] ? companion[host] : host);
- }
- headers() {
- const userHeaders = this.opts.companionHeaders || {};
- return Promise.resolve({ ...RequestClient.defaultHeaders,
- ...userHeaders
- });
- }
- onReceiveResponse(response) {
- const state = this.uppy.getState();
- const companion = state.companion || {};
- const host = this.opts.companionUrl;
- const {
- headers
- } = response; // Store the self-identified domain name for the Companion instance we just hit.
- if (headers.has('i-am') && headers.get('i-am') !== companion[host]) {
- this.uppy.setState({
- companion: { ...companion,
- [host]: headers.get('i-am')
- }
- });
- }
- return response;
- }
- preflight(path) {
- if (this.preflightDone) {
- return Promise.resolve(this.allowedHeaders.slice());
- }
- return fetch(_classPrivateFieldLooseBase$4(this, _getUrl)[_getUrl](path), {
- method: 'OPTIONS'
- }).then(response => {
- if (response.headers.has('access-control-allow-headers')) {
- this.allowedHeaders = response.headers.get('access-control-allow-headers').split(',').map(headerName => headerName.trim().toLowerCase());
- }
- this.preflightDone = true;
- return this.allowedHeaders.slice();
- }).catch(err => {
- this.uppy.log(`[CompanionClient] unable to make preflight request ${err}`, 'warning');
- this.preflightDone = true;
- return this.allowedHeaders.slice();
- });
- }
- preflightAndHeaders(path) {
- return Promise.all([this.preflight(path), this.headers()]).then(_ref => {
- let [allowedHeaders, headers] = _ref;
- // filter to keep only allowed Headers
- Object.keys(headers).forEach(header => {
- if (!allowedHeaders.includes(header.toLowerCase())) {
- this.uppy.log(`[CompanionClient] excluding disallowed header ${header}`);
- delete headers[header]; // eslint-disable-line no-param-reassign
- }
- });
- return headers;
- });
- }
- get(path, skipPostResponse) {
- const method = 'get';
- return this.preflightAndHeaders(path).then(headers => fetchWithNetworkError(_classPrivateFieldLooseBase$4(this, _getUrl)[_getUrl](path), {
- method,
- headers,
- credentials: this.opts.companionCookiesRule || 'same-origin'
- })).then(_classPrivateFieldLooseBase$4(this, _getPostResponseFunc)[_getPostResponseFunc](skipPostResponse)).then(handleJSONResponse).catch(_classPrivateFieldLooseBase$4(this, _errorHandler)[_errorHandler](method, path));
- }
- post(path, data, skipPostResponse) {
- const method = 'post';
- return this.preflightAndHeaders(path).then(headers => fetchWithNetworkError(_classPrivateFieldLooseBase$4(this, _getUrl)[_getUrl](path), {
- method,
- headers,
- credentials: this.opts.companionCookiesRule || 'same-origin',
- body: JSON.stringify(data)
- })).then(_classPrivateFieldLooseBase$4(this, _getPostResponseFunc)[_getPostResponseFunc](skipPostResponse)).then(handleJSONResponse).catch(_classPrivateFieldLooseBase$4(this, _errorHandler)[_errorHandler](method, path));
- }
- delete(path, data, skipPostResponse) {
- const method = 'delete';
- return this.preflightAndHeaders(path).then(headers => fetchWithNetworkError(`${this.hostname}/${path}`, {
- method,
- headers,
- credentials: this.opts.companionCookiesRule || 'same-origin',
- body: data ? JSON.stringify(data) : null
- })).then(_classPrivateFieldLooseBase$4(this, _getPostResponseFunc)[_getPostResponseFunc](skipPostResponse)).then(handleJSONResponse).catch(_classPrivateFieldLooseBase$4(this, _errorHandler)[_errorHandler](method, path));
- }
- }), _class$1.VERSION = "2.0.4", _class$1.defaultHeaders = {
- Accept: 'application/json',
- 'Content-Type': 'application/json',
- 'Uppy-Versions': `@uppy/companion-client=${_class$1.VERSION}`
- }, _temp$1);
- function _getUrl2(url) {
- if (/^(https?:|)\/\//.test(url)) {
- return url;
- }
- return `${this.hostname}/${url}`;
- }
- function _errorHandler2(method, path) {
- return err => {
- var _err;
- if (!((_err = err) != null && _err.isAuthError)) {
- const error = new Error(`Could not ${method} ${_classPrivateFieldLooseBase$4(this, _getUrl)[_getUrl](path)}`);
- error.cause = err;
- err = error; // eslint-disable-line no-param-reassign
- }
- return Promise.reject(err);
- };
- }
- /**
- * This module serves as an Async wrapper for LocalStorage
- */
- var setItem = (key, value) => {
- return new Promise(resolve => {
- localStorage.setItem(key, value);
- resolve();
- });
- };
- var getItem = key => {
- return Promise.resolve(localStorage.getItem(key));
- };
- var removeItem = key => {
- return new Promise(resolve => {
- localStorage.removeItem(key);
- resolve();
- });
- };
- var tokenStorage = {
- setItem: setItem,
- getItem: getItem,
- removeItem: removeItem
- };
- const getName$1 = id => {
- return id.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');
- };
- var Provider_1 = class Provider extends RequestClient_1 {
- constructor(uppy, opts) {
- super(uppy, opts);
- this.provider = opts.provider;
- this.id = this.provider;
- this.name = this.opts.name || getName$1(this.id);
- this.pluginId = this.opts.pluginId;
- this.tokenKey = `companion-${this.pluginId}-auth-token`;
- this.companionKeysParams = this.opts.companionKeysParams;
- this.preAuthToken = null;
- }
- headers() {
- return Promise.all([super.headers(), this.getAuthToken()]).then(_ref => {
- let [headers, token] = _ref;
- const authHeaders = {};
- if (token) {
- authHeaders['uppy-auth-token'] = token;
- }
- if (this.companionKeysParams) {
- authHeaders['uppy-credentials-params'] = btoa(JSON.stringify({
- params: this.companionKeysParams
- }));
- }
- return { ...headers,
- ...authHeaders
- };
- });
- }
- onReceiveResponse(response) {
- response = super.onReceiveResponse(response);
- const plugin = this.uppy.getPlugin(this.pluginId);
- const oldAuthenticated = plugin.getPluginState().authenticated;
- const authenticated = oldAuthenticated ? response.status !== 401 : response.status < 400;
- plugin.setPluginState({
- authenticated
- });
- return response;
- }
- setAuthToken(token) {
- return this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey, token);
- }
- getAuthToken() {
- return this.uppy.getPlugin(this.pluginId).storage.getItem(this.tokenKey);
- }
- authUrl(queries) {
- if (queries === void 0) {
- queries = {};
- }
- if (this.preAuthToken) {
- queries.uppyPreAuthToken = this.preAuthToken;
- }
- return `${this.hostname}/${this.id}/connect?${new URLSearchParams(queries)}`;
- }
- fileUrl(id) {
- return `${this.hostname}/${this.id}/get/${id}`;
- }
- fetchPreAuthToken() {
- if (!this.companionKeysParams) {
- return Promise.resolve();
- }
- return this.post(`${this.id}/preauth/`, {
- params: this.companionKeysParams
- }).then(res => {
- this.preAuthToken = res.token;
- }).catch(err => {
- this.uppy.log(`[CompanionClient] unable to fetch preAuthToken ${err}`, 'warning');
- });
- }
- list(directory) {
- return this.get(`${this.id}/list/${directory || ''}`);
- }
- logout() {
- return this.get(`${this.id}/logout`).then(response => Promise.all([response, this.uppy.getPlugin(this.pluginId).storage.removeItem(this.tokenKey)])).then(_ref2 => {
- let [response] = _ref2;
- return response;
- });
- }
- static initPlugin(plugin, opts, defaultOpts) {
- plugin.type = 'acquirer';
- plugin.files = [];
- if (defaultOpts) {
- plugin.opts = { ...defaultOpts,
- ...opts
- };
- }
- if (opts.serverUrl || opts.serverPattern) {
- 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.`');
- }
- if (opts.companionAllowedHosts) {
- const pattern = opts.companionAllowedHosts; // validate companionAllowedHosts param
- if (typeof pattern !== 'string' && !Array.isArray(pattern) && !(pattern instanceof RegExp)) {
- throw new TypeError(`${plugin.id}: the option "companionAllowedHosts" must be one of string, Array, RegExp`);
- }
- plugin.opts.companionAllowedHosts = pattern;
- } else if (/^(?!https?:\/\/).*$/i.test(opts.companionUrl)) {
- // does not start with https://
- plugin.opts.companionAllowedHosts = `https://${opts.companionUrl.replace(/^\/\//, '')}`;
- } else {
- plugin.opts.companionAllowedHosts = new URL(opts.companionUrl).origin;
- }
- plugin.storage = plugin.opts.storage || tokenStorage;
- }
- };
- const getName = id => {
- return id.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');
- };
- var SearchProvider_1 = class SearchProvider extends RequestClient_1 {
- constructor(uppy, opts) {
- super(uppy, opts);
- this.provider = opts.provider;
- this.id = this.provider;
- this.name = this.opts.name || getName(this.id);
- this.pluginId = this.opts.pluginId;
- }
- fileUrl(id) {
- return `${this.hostname}/search/${this.id}/get/${id}`;
- }
- search(text, queries) {
- queries = queries ? `&${queries}` : '';
- return this.get(`search/${this.id}/list?q=${encodeURIComponent(text)}${queries}`);
- }
- };
- var _queued, _emitter$1, _isOpen, _socket, _handleMessage;
- let _Symbol$for, _Symbol$for2;
- 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; }
- var id$3 = 0;
- function _classPrivateFieldLooseKey$3(name) { return "__private_" + id$3++ + "_" + name; }
- 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 {
- constructor(opts) {
- Object.defineProperty(this, _queued, {
- writable: true,
- value: []
- });
- Object.defineProperty(this, _emitter$1, {
- writable: true,
- value: namespaceEmitter()
- });
- Object.defineProperty(this, _isOpen, {
- writable: true,
- value: false
- });
- Object.defineProperty(this, _socket, {
- writable: true,
- value: void 0
- });
- Object.defineProperty(this, _handleMessage, {
- writable: true,
- value: e => {
- try {
- const message = JSON.parse(e.data);
- this.emit(message.action, message.payload);
- } catch (err) {
- // TODO: use a more robust error handler.
- console.log(err); // eslint-disable-line no-console
- }
- }
- });
- this.opts = opts;
- if (!opts || opts.autoOpen !== false) {
- this.open();
- }
- }
- get isOpen() {
- return _classPrivateFieldLooseBase$3(this, _isOpen)[_isOpen];
- }
- [_Symbol$for]() {
- return _classPrivateFieldLooseBase$3(this, _socket)[_socket];
- }
- [_Symbol$for2]() {
- return _classPrivateFieldLooseBase$3(this, _queued)[_queued];
- }
- open() {
- _classPrivateFieldLooseBase$3(this, _socket)[_socket] = new WebSocket(this.opts.target);
- _classPrivateFieldLooseBase$3(this, _socket)[_socket].onopen = () => {
- _classPrivateFieldLooseBase$3(this, _isOpen)[_isOpen] = true;
- while (_classPrivateFieldLooseBase$3(this, _queued)[_queued].length > 0 && _classPrivateFieldLooseBase$3(this, _isOpen)[_isOpen]) {
- const first = _classPrivateFieldLooseBase$3(this, _queued)[_queued].shift();
- this.send(first.action, first.payload);
- }
- };
- _classPrivateFieldLooseBase$3(this, _socket)[_socket].onclose = () => {
- _classPrivateFieldLooseBase$3(this, _isOpen)[_isOpen] = false;
- };
- _classPrivateFieldLooseBase$3(this, _socket)[_socket].onmessage = _classPrivateFieldLooseBase$3(this, _handleMessage)[_handleMessage];
- }
- close() {
- var _classPrivateFieldLoo;
- (_classPrivateFieldLoo = _classPrivateFieldLooseBase$3(this, _socket)[_socket]) == null ? void 0 : _classPrivateFieldLoo.close();
- }
- send(action, payload) {
- // attach uuid
- if (!_classPrivateFieldLooseBase$3(this, _isOpen)[_isOpen]) {
- _classPrivateFieldLooseBase$3(this, _queued)[_queued].push({
- action,
- payload
- });
- return;
- }
- _classPrivateFieldLooseBase$3(this, _socket)[_socket].send(JSON.stringify({
- action,
- payload
- }));
- }
- on(action, handler) {
- _classPrivateFieldLooseBase$3(this, _emitter$1)[_emitter$1].on(action, handler);
- }
- emit(action, payload) {
- _classPrivateFieldLooseBase$3(this, _emitter$1)[_emitter$1].emit(action, payload);
- }
- once(action, handler) {
- _classPrivateFieldLooseBase$3(this, _emitter$1)[_emitter$1].once(action, handler);
- }
- });
- /**
- * Manages communications with Companion
- */
- var lib$1 = {
- RequestClient: RequestClient_1,
- Provider: Provider_1,
- SearchProvider: SearchProvider_1,
- Socket: Socket$1
- };
- function emitSocketProgress(uploader, progressData, file) {
- const {
- progress,
- bytesUploaded,
- bytesTotal
- } = progressData;
- if (progress) {
- uploader.uppy.log(`Upload progress: ${progress}`);
- uploader.uppy.emit('upload-progress', file, {
- uploader,
- bytesUploaded,
- bytesTotal
- });
- }
- }
- var emitSocketProgress_1 = lodash_throttle(emitSocketProgress, 300, {
- leading: true,
- trailing: true
- });
- var getSocketHost = function getSocketHost(url) {
- // get the host domain
- const regex = /^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i;
- const host = regex.exec(url)[1];
- const socketProtocol = /^http:\/\//i.test(url) ? 'ws' : 'wss';
- return `${socketProtocol}://${host}`;
- };
- var settle = function settle(promises) {
- const resolutions = [];
- const rejections = [];
- function resolved(value) {
- resolutions.push(value);
- }
- function rejected(error) {
- rejections.push(error);
- }
- const wait = Promise.all(promises.map(promise => promise.then(resolved, rejected)));
- return wait.then(() => {
- return {
- successful: resolutions,
- failed: rejections
- };
- });
- };
- var _emitter, _events;
- 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; }
- var id$2 = 0;
- function _classPrivateFieldLooseKey$2(name) { return "__private_" + id$2++ + "_" + name; }
- /**
- * Create a wrapper around an event emitter with a `remove` method to remove
- * all events that were added using the wrapped emitter.
- */
- var EventTracker_1 = (_emitter = /*#__PURE__*/_classPrivateFieldLooseKey$2("emitter"), _events = /*#__PURE__*/_classPrivateFieldLooseKey$2("events"), class EventTracker {
- constructor(emitter) {
- Object.defineProperty(this, _emitter, {
- writable: true,
- value: void 0
- });
- Object.defineProperty(this, _events, {
- writable: true,
- value: []
- });
- _classPrivateFieldLooseBase$2(this, _emitter)[_emitter] = emitter;
- }
- on(event, fn) {
- _classPrivateFieldLooseBase$2(this, _events)[_events].push([event, fn]);
- return _classPrivateFieldLooseBase$2(this, _emitter)[_emitter].on(event, fn);
- }
- remove() {
- for (const [event, fn] of _classPrivateFieldLooseBase$2(this, _events)[_events].splice(0)) {
- _classPrivateFieldLooseBase$2(this, _emitter)[_emitter].off(event, fn);
- }
- }
- });
- 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; }
- var id$1 = 0;
- function _classPrivateFieldLooseKey$1(name) { return "__private_" + id$1++ + "_" + name; }
- var _aliveTimer = /*#__PURE__*/_classPrivateFieldLooseKey$1("aliveTimer");
- var _isDone = /*#__PURE__*/_classPrivateFieldLooseKey$1("isDone");
- var _onTimedOut = /*#__PURE__*/_classPrivateFieldLooseKey$1("onTimedOut");
- var _timeout = /*#__PURE__*/_classPrivateFieldLooseKey$1("timeout");
- /**
- * Helper to abort upload requests if there has not been any progress for `timeout` ms.
- * Create an instance using `timer = new ProgressTimeout(10000, onTimeout)`
- * Call `timer.progress()` to signal that there has been progress of any kind.
- * Call `timer.done()` when the upload has completed.
- */
- class ProgressTimeout {
- constructor(timeout, timeoutHandler) {
- Object.defineProperty(this, _aliveTimer, {
- writable: true,
- value: void 0
- });
- Object.defineProperty(this, _isDone, {
- writable: true,
- value: false
- });
- Object.defineProperty(this, _onTimedOut, {
- writable: true,
- value: void 0
- });
- Object.defineProperty(this, _timeout, {
- writable: true,
- value: void 0
- });
- _classPrivateFieldLooseBase$1(this, _timeout)[_timeout] = timeout;
- _classPrivateFieldLooseBase$1(this, _onTimedOut)[_onTimedOut] = timeoutHandler;
- }
- progress() {
- // Some browsers fire another progress event when the upload is
- // cancelled, so we have to ignore progress after the timer was
- // told to stop.
- if (_classPrivateFieldLooseBase$1(this, _isDone)[_isDone]) return;
- if (_classPrivateFieldLooseBase$1(this, _timeout)[_timeout] > 0) {
- clearTimeout(_classPrivateFieldLooseBase$1(this, _aliveTimer)[_aliveTimer]);
- _classPrivateFieldLooseBase$1(this, _aliveTimer)[_aliveTimer] = setTimeout(_classPrivateFieldLooseBase$1(this, _onTimedOut)[_onTimedOut], _classPrivateFieldLooseBase$1(this, _timeout)[_timeout]);
- }
- }
- done() {
- if (!_classPrivateFieldLooseBase$1(this, _isDone)[_isDone]) {
- clearTimeout(_classPrivateFieldLooseBase$1(this, _aliveTimer)[_aliveTimer]);
- _classPrivateFieldLooseBase$1(this, _aliveTimer)[_aliveTimer] = null;
- _classPrivateFieldLooseBase$1(this, _isDone)[_isDone] = true;
- }
- }
- }
- var ProgressTimeout_1 = ProgressTimeout;
- function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
- var id = 0;
- function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }
- function createCancelError() {
- return new Error('Cancelled');
- }
- var _activeRequests = /*#__PURE__*/_classPrivateFieldLooseKey("activeRequests");
- var _queuedHandlers = /*#__PURE__*/_classPrivateFieldLooseKey("queuedHandlers");
- var _call = /*#__PURE__*/_classPrivateFieldLooseKey("call");
- var _queueNext = /*#__PURE__*/_classPrivateFieldLooseKey("queueNext");
- var _next = /*#__PURE__*/_classPrivateFieldLooseKey("next");
- var _queue = /*#__PURE__*/_classPrivateFieldLooseKey("queue");
- var _dequeue = /*#__PURE__*/_classPrivateFieldLooseKey("dequeue");
- class RateLimitedQueue$1 {
- constructor(limit) {
- Object.defineProperty(this, _dequeue, {
- value: _dequeue2
- });
- Object.defineProperty(this, _queue, {
- value: _queue2
- });
- Object.defineProperty(this, _next, {
- value: _next2
- });
- Object.defineProperty(this, _queueNext, {
- value: _queueNext2
- });
- Object.defineProperty(this, _call, {
- value: _call2
- });
- Object.defineProperty(this, _activeRequests, {
- writable: true,
- value: 0
- });
- Object.defineProperty(this, _queuedHandlers, {
- writable: true,
- value: []
- });
- if (typeof limit !== 'number' || limit === 0) {
- this.limit = Infinity;
- } else {
- this.limit = limit;
- }
- }
- run(fn, queueOptions) {
- if (_classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] < this.limit) {
- return _classPrivateFieldLooseBase(this, _call)[_call](fn);
- }
- return _classPrivateFieldLooseBase(this, _queue)[_queue](fn, queueOptions);
- }
- wrapPromiseFunction(fn, queueOptions) {
- var _this = this;
- return function () {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- let queuedRequest;
- const outerPromise = new Promise((resolve, reject) => {
- queuedRequest = _this.run(() => {
- let cancelError;
- let innerPromise;
- try {
- innerPromise = Promise.resolve(fn(...args));
- } catch (err) {
- innerPromise = Promise.reject(err);
- }
- innerPromise.then(result => {
- if (cancelError) {
- reject(cancelError);
- } else {
- queuedRequest.done();
- resolve(result);
- }
- }, err => {
- if (cancelError) {
- reject(cancelError);
- } else {
- queuedRequest.done();
- reject(err);
- }
- });
- return () => {
- cancelError = createCancelError();
- };
- }, queueOptions);
- });
- outerPromise.abort = () => {
- queuedRequest.abort();
- };
- return outerPromise;
- };
- }
- }
- function _call2(fn) {
- _classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] += 1;
- let done = false;
- let cancelActive;
- try {
- cancelActive = fn();
- } catch (err) {
- _classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] -= 1;
- throw err;
- }
- return {
- abort: () => {
- if (done) return;
- done = true;
- _classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] -= 1;
- cancelActive();
- _classPrivateFieldLooseBase(this, _queueNext)[_queueNext]();
- },
- done: () => {
- if (done) return;
- done = true;
- _classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] -= 1;
- _classPrivateFieldLooseBase(this, _queueNext)[_queueNext]();
- }
- };
- }
- function _queueNext2() {
- // Do it soon but not immediately, this allows clearing out the entire queue synchronously
- // one by one without continuously _advancing_ it (and starting new tasks before immediately
- // aborting them)
- queueMicrotask(() => _classPrivateFieldLooseBase(this, _next)[_next]());
- }
- function _next2() {
- if (_classPrivateFieldLooseBase(this, _activeRequests)[_activeRequests] >= this.limit) {
- return;
- }
- if (_classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].length === 0) {
- return;
- } // Dispatch the next request, and update the abort/done handlers
- // so that cancelling it does the Right Thing (and doesn't just try
- // to dequeue an already-running request).
- const next = _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].shift();
- const handler = _classPrivateFieldLooseBase(this, _call)[_call](next.fn);
- next.abort = handler.abort;
- next.done = handler.done;
- }
- function _queue2(fn, options) {
- if (options === void 0) {
- options = {};
- }
- const handler = {
- fn,
- priority: options.priority || 0,
- abort: () => {
- _classPrivateFieldLooseBase(this, _dequeue)[_dequeue](handler);
- },
- done: () => {
- throw new Error('Cannot mark a queued request as done: this indicates a bug');
- }
- };
- const index = _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].findIndex(other => {
- return handler.priority > other.priority;
- });
- if (index === -1) {
- _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].push(handler);
- } else {
- _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].splice(index, 0, handler);
- }
- return handler;
- }
- function _dequeue2(handler) {
- const index = _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].indexOf(handler);
- if (index !== -1) {
- _classPrivateFieldLooseBase(this, _queuedHandlers)[_queuedHandlers].splice(index, 1);
- }
- }
- var RateLimitedQueue_1 = {
- RateLimitedQueue: RateLimitedQueue$1,
- internalRateLimitedQueue: Symbol('__queue')
- };
- function isNetworkError(xhr) {
- if (!xhr) {
- return false;
- }
- return xhr.readyState !== 0 && xhr.readyState !== 4 || xhr.status === 0;
- }
- var isNetworkError_1 = isNetworkError;
- var locale = {
- strings: {
- // Shown in the Informer if an upload is being canceled because it stalled for too long.
- timedOut: 'Upload stalled for %{seconds} seconds, aborting.'
- }
- };
- var _class, _temp;
- const {
- nanoid
- } = require$$4;
- const {
- Provider,
- RequestClient,
- Socket
- } = lib$1;
- const {
- RateLimitedQueue,
- internalRateLimitedQueue
- } = RateLimitedQueue_1;
- function buildResponseError(xhr, err) {
- let error = err; // No error message
- if (!error) error = new Error('Upload error'); // Got an error message string
- if (typeof error === 'string') error = new Error(error); // Got something else
- if (!(error instanceof Error)) {
- error = Object.assign(new Error('Upload error'), {
- data: error
- });
- }
- if (isNetworkError_1(xhr)) {
- error = new NetworkError_1(error, xhr);
- return error;
- }
- error.request = xhr;
- return error;
- }
- /**
- * Set `data.type` in the blob to `file.meta.type`,
- * because we might have detected a more accurate file type in Uppy
- * https://stackoverflow.com/a/50875615
- *
- * @param {object} file File object with `data`, `size` and `meta` properties
- * @returns {object} blob updated with the new `type` set from `file.meta.type`
- */
- function setTypeInBlob(file) {
- const dataWithUpdatedType = file.data.slice(0, file.data.size, file.meta.type);
- return dataWithUpdatedType;
- }
- var lib = (_temp = _class = class XHRUpload extends BasePlugin_1$1 {
- // eslint-disable-next-line global-require
- constructor(uppy, opts) {
- super(uppy, opts);
- this.type = 'uploader';
- this.id = this.opts.id || 'XHRUpload';
- this.title = 'XHRUpload';
- this.defaultLocale = locale; // Default options
- const defaultOptions = {
- formData: true,
- fieldName: opts.bundle ? 'files[]' : 'file',
- method: 'post',
- metaFields: null,
- responseUrlFieldName: 'url',
- bundle: false,
- headers: {},
- timeout: 30 * 1000,
- limit: 5,
- withCredentials: false,
- responseType: '',
- /**
- * @typedef respObj
- * @property {string} responseText
- * @property {number} status
- * @property {string} statusText
- * @property {object.<string, string>} headers
- *
- * @param {string} responseText the response body string
- * @param {XMLHttpRequest | respObj} response the response object (XHR or similar)
- */
- getResponseData(responseText) {
- let parsedResponse = {};
- try {
- parsedResponse = JSON.parse(responseText);
- } catch (err) {
- uppy.log(err);
- }
- return parsedResponse;
- },
- /**
- *
- * @param {string} responseText the response body string
- * @param {XMLHttpRequest | respObj} response the response object (XHR or similar)
- */
- getResponseError(_, response) {
- let error = new Error('Upload error');
- if (isNetworkError_1(response)) {
- error = new NetworkError_1(error, response);
- }
- return error;
- },
- /**
- * Check if the response from the upload endpoint indicates that the upload was successful.
- *
- * @param {number} status the response status code
- */
- validateStatus(status) {
- return status >= 200 && status < 300;
- }
- };
- this.opts = { ...defaultOptions,
- ...opts
- };
- this.i18nInit();
- this.handleUpload = this.handleUpload.bind(this); // Simultaneous upload limiting is shared across all uploads with this plugin.
- if (internalRateLimitedQueue in this.opts) {
- this.requests = this.opts[internalRateLimitedQueue];
- } else {
- this.requests = new RateLimitedQueue(this.opts.limit);
- }
- if (this.opts.bundle && !this.opts.formData) {
- throw new Error('`opts.formData` must be true when `opts.bundle` is enabled.');
- }
- this.uploaderEvents = Object.create(null);
- }
- getOptions(file) {
- const overrides = this.uppy.getState().xhrUpload;
- const {
- headers
- } = this.opts;
- const opts = { ...this.opts,
- ...(overrides || {}),
- ...(file.xhrUpload || {}),
- headers: {}
- }; // Support for `headers` as a function, only in the XHRUpload settings.
- // Options set by other plugins in Uppy state or on the files themselves are still merged in afterward.
- //
- // ```js
- // headers: (file) => ({ expires: file.meta.expires })
- // ```
- if (typeof headers === 'function') {
- opts.headers = headers(file);
- } else {
- Object.assign(opts.headers, this.opts.headers);
- }
- if (overrides) {
- Object.assign(opts.headers, overrides.headers);
- }
- if (file.xhrUpload) {
- Object.assign(opts.headers, file.xhrUpload.headers);
- }
- return opts;
- } // eslint-disable-next-line class-methods-use-this
- addMetadata(formData, meta, opts) {
- const metaFields = Array.isArray(opts.metaFields) ? opts.metaFields : Object.keys(meta); // Send along all fields by default.
- metaFields.forEach(item => {
- formData.append(item, meta[item]);
- });
- }
- createFormDataUpload(file, opts) {
- const formPost = new FormData();
- this.addMetadata(formPost, file.meta, opts);
- const dataWithUpdatedType = setTypeInBlob(file);
- if (file.name) {
- formPost.append(opts.fieldName, dataWithUpdatedType, file.meta.name);
- } else {
- formPost.append(opts.fieldName, dataWithUpdatedType);
- }
- return formPost;
- }
- createBundledUpload(files, opts) {
- const formPost = new FormData();
- const {
- meta
- } = this.uppy.getState();
- this.addMetadata(formPost, meta, opts);
- files.forEach(file => {
- const options = this.getOptions(file);
- const dataWithUpdatedType = setTypeInBlob(file);
- if (file.name) {
- formPost.append(options.fieldName, dataWithUpdatedType, file.name);
- } else {
- formPost.append(options.fieldName, dataWithUpdatedType);
- }
- });
- return formPost;
- }
- upload(file, current, total) {
- const opts = this.getOptions(file);
- this.uppy.log(`uploading ${current} of ${total}`);
- return new Promise((resolve, reject) => {
- this.uppy.emit('upload-started', file);
- const data = opts.formData ? this.createFormDataUpload(file, opts) : file.data;
- const xhr = new XMLHttpRequest();
- this.uploaderEvents[file.id] = new EventTracker_1(this.uppy);
- const timer = new ProgressTimeout_1(opts.timeout, () => {
- xhr.abort();
- queuedRequest.done();
- const error = new Error(this.i18n('timedOut', {
- seconds: Math.ceil(opts.timeout / 1000)
- }));
- this.uppy.emit('upload-error', file, error);
- reject(error);
- });
- const id = nanoid();
- xhr.upload.addEventListener('loadstart', () => {
- this.uppy.log(`[XHRUpload] ${id} started`);
- });
- xhr.upload.addEventListener('progress', ev => {
- this.uppy.log(`[XHRUpload] ${id} progress: ${ev.loaded} / ${ev.total}`); // Begin checking for timeouts when progress starts, instead of loading,
- // to avoid timing out requests on browser concurrency queue
- timer.progress();
- if (ev.lengthComputable) {
- this.uppy.emit('upload-progress', file, {
- uploader: this,
- bytesUploaded: ev.loaded,
- bytesTotal: ev.total
- });
- }
- });
- xhr.addEventListener('load', ev => {
- this.uppy.log(`[XHRUpload] ${id} finished`);
- timer.done();
- queuedRequest.done();
- if (this.uploaderEvents[file.id]) {
- this.uploaderEvents[file.id].remove();
- this.uploaderEvents[file.id] = null;
- }
- if (opts.validateStatus(ev.target.status, xhr.responseText, xhr)) {
- const body = opts.getResponseData(xhr.responseText, xhr);
- const uploadURL = body[opts.responseUrlFieldName];
- const uploadResp = {
- status: ev.target.status,
- body,
- uploadURL
- };
- this.uppy.emit('upload-success', file, uploadResp);
- if (uploadURL) {
- this.uppy.log(`Download ${file.name} from ${uploadURL}`);
- }
- return resolve(file);
- }
- const body = opts.getResponseData(xhr.responseText, xhr);
- const error = buildResponseError(xhr, opts.getResponseError(xhr.responseText, xhr));
- const response = {
- status: ev.target.status,
- body
- };
- this.uppy.emit('upload-error', file, error, response);
- return reject(error);
- });
- xhr.addEventListener('error', () => {
- this.uppy.log(`[XHRUpload] ${id} errored`);
- timer.done();
- queuedRequest.done();
- if (this.uploaderEvents[file.id]) {
- this.uploaderEvents[file.id].remove();
- this.uploaderEvents[file.id] = null;
- }
- const error = buildResponseError(xhr, opts.getResponseError(xhr.responseText, xhr));
- this.uppy.emit('upload-error', file, error);
- return reject(error);
- });
- xhr.open(opts.method.toUpperCase(), opts.endpoint, true); // IE10 does not allow setting `withCredentials` and `responseType`
- // before `open()` is called.
- xhr.withCredentials = opts.withCredentials;
- if (opts.responseType !== '') {
- xhr.responseType = opts.responseType;
- }
- const queuedRequest = this.requests.run(() => {
- this.uppy.emit('upload-started', file); // When using an authentication system like JWT, the bearer token goes as a header. This
- // header needs to be fresh each time the token is refreshed so computing and setting the
- // headers just before the upload starts enables this kind of authentication to work properly.
- // Otherwise, half-way through the list of uploads the token could be stale and the upload would fail.
- const currentOpts = this.getOptions(file);
- Object.keys(currentOpts.headers).forEach(header => {
- xhr.setRequestHeader(header, currentOpts.headers[header]);
- });
- xhr.send(data);
- return () => {
- timer.done();
- xhr.abort();
- };
- });
- this.onFileRemove(file.id, () => {
- queuedRequest.abort();
- reject(new Error('File removed'));
- });
- this.onCancelAll(file.id, () => {
- queuedRequest.abort();
- reject(new Error('Upload cancelled'));
- });
- });
- }
- uploadRemote(file) {
- const opts = this.getOptions(file);
- return new Promise((resolve, reject) => {
- this.uppy.emit('upload-started', file);
- const fields = {};
- const metaFields = Array.isArray(opts.metaFields) ? opts.metaFields // Send along all fields by default.
- : Object.keys(file.meta);
- metaFields.forEach(name => {
- fields[name] = file.meta[name];
- });
- const Client = file.remote.providerOptions.provider ? Provider : RequestClient;
- const client = new Client(this.uppy, file.remote.providerOptions);
- client.post(file.remote.url, { ...file.remote.body,
- endpoint: opts.endpoint,
- size: file.data.size,
- fieldname: opts.fieldName,
- metadata: fields,
- httpMethod: opts.method,
- useFormData: opts.formData,
- headers: opts.headers
- }).then(res => {
- const {
- token
- } = res;
- const host = getSocketHost(file.remote.companionUrl);
- const socket = new Socket({
- target: `${host}/api/${token}`,
- autoOpen: false
- });
- this.uploaderEvents[file.id] = new EventTracker_1(this.uppy);
- this.onFileRemove(file.id, () => {
- socket.send('cancel', {});
- queuedRequest.abort();
- resolve(`upload ${file.id} was removed`);
- });
- this.onCancelAll(file.id, () => {
- socket.send('cancel', {});
- queuedRequest.abort();
- resolve(`upload ${file.id} was canceled`);
- });
- this.onRetry(file.id, () => {
- socket.send('pause', {});
- socket.send('resume', {});
- });
- this.onRetryAll(file.id, () => {
- socket.send('pause', {});
- socket.send('resume', {});
- });
- socket.on('progress', progressData => emitSocketProgress_1(this, progressData, file));
- socket.on('success', data => {
- const body = opts.getResponseData(data.response.responseText, data.response);
- const uploadURL = body[opts.responseUrlFieldName];
- const uploadResp = {
- status: data.response.status,
- body,
- uploadURL
- };
- this.uppy.emit('upload-success', file, uploadResp);
- queuedRequest.done();
- if (this.uploaderEvents[file.id]) {
- this.uploaderEvents[file.id].remove();
- this.uploaderEvents[file.id] = null;
- }
- return resolve();
- });
- socket.on('error', errData => {
- const resp = errData.response;
- const error = resp ? opts.getResponseError(resp.responseText, resp) : Object.assign(new Error(errData.error.message), {
- cause: errData.error
- });
- this.uppy.emit('upload-error', file, error);
- queuedRequest.done();
- if (this.uploaderEvents[file.id]) {
- this.uploaderEvents[file.id].remove();
- this.uploaderEvents[file.id] = null;
- }
- reject(error);
- });
- const queuedRequest = this.requests.run(() => {
- socket.open();
- if (file.isPaused) {
- socket.send('pause', {});
- }
- return () => socket.close();
- });
- }).catch(err => {
- this.uppy.emit('upload-error', file, err);
- reject(err);
- });
- });
- }
- uploadBundle(files) {
- return new Promise((resolve, reject) => {
- const {
- endpoint
- } = this.opts;
- const {
- method
- } = this.opts;
- const optsFromState = this.uppy.getState().xhrUpload;
- const formData = this.createBundledUpload(files, { ...this.opts,
- ...(optsFromState || {})
- });
- const xhr = new XMLHttpRequest();
- const timer = new ProgressTimeout_1(this.opts.timeout, () => {
- xhr.abort();
- const error = new Error(this.i18n('timedOut', {
- seconds: Math.ceil(this.opts.timeout / 1000)
- }));
- emitError(error);
- reject(error);
- });
- const emitError = error => {
- files.forEach(file => {
- this.uppy.emit('upload-error', file, error);
- });
- };
- xhr.upload.addEventListener('loadstart', () => {
- this.uppy.log('[XHRUpload] started uploading bundle');
- timer.progress();
- });
- xhr.upload.addEventListener('progress', ev => {
- timer.progress();
- if (!ev.lengthComputable) return;
- files.forEach(file => {
- this.uppy.emit('upload-progress', file, {
- uploader: this,
- bytesUploaded: ev.loaded / ev.total * file.size,
- bytesTotal: file.size
- });
- });
- });
- xhr.addEventListener('load', ev => {
- timer.done();
- if (this.opts.validateStatus(ev.target.status, xhr.responseText, xhr)) {
- const body = this.opts.getResponseData(xhr.responseText, xhr);
- const uploadResp = {
- status: ev.target.status,
- body
- };
- files.forEach(file => {
- this.uppy.emit('upload-success', file, uploadResp);
- });
- return resolve();
- }
- const error = this.opts.getResponseError(xhr.responseText, xhr) || new Error('Upload error');
- error.request = xhr;
- emitError(error);
- return reject(error);
- });
- xhr.addEventListener('error', () => {
- timer.done();
- const error = this.opts.getResponseError(xhr.responseText, xhr) || new Error('Upload error');
- emitError(error);
- return reject(error);
- });
- this.uppy.on('cancel-all', () => {
- timer.done();
- xhr.abort();
- });
- xhr.open(method.toUpperCase(), endpoint, true); // IE10 does not allow setting `withCredentials` and `responseType`
- // before `open()` is called.
- xhr.withCredentials = this.opts.withCredentials;
- if (this.opts.responseType !== '') {
- xhr.responseType = this.opts.responseType;
- }
- Object.keys(this.opts.headers).forEach(header => {
- xhr.setRequestHeader(header, this.opts.headers[header]);
- });
- xhr.send(formData);
- files.forEach(file => {
- this.uppy.emit('upload-started', file);
- });
- });
- }
- uploadFiles(files) {
- const promises = files.map((file, i) => {
- const current = parseInt(i, 10) + 1;
- const total = files.length;
- if (file.error) {
- return Promise.reject(new Error(file.error));
- }
- if (file.isRemote) {
- return this.uploadRemote(file, current, total);
- }
- return this.upload(file, current, total);
- });
- return settle(promises);
- }
- onFileRemove(fileID, cb) {
- this.uploaderEvents[fileID].on('file-removed', file => {
- if (fileID === file.id) cb(file.id);
- });
- }
- onRetry(fileID, cb) {
- this.uploaderEvents[fileID].on('upload-retry', targetFileID => {
- if (fileID === targetFileID) {
- cb();
- }
- });
- }
- onRetryAll(fileID, cb) {
- this.uploaderEvents[fileID].on('retry-all', () => {
- if (!this.uppy.getFile(fileID)) return;
- cb();
- });
- }
- onCancelAll(fileID, cb) {
- this.uploaderEvents[fileID].on('cancel-all', () => {
- if (!this.uppy.getFile(fileID)) return;
- cb();
- });
- }
- handleUpload(fileIDs) {
- if (fileIDs.length === 0) {
- this.uppy.log('[XHRUpload] No files to upload!');
- return Promise.resolve();
- } // No limit configured by the user, and no RateLimitedQueue passed in by a "parent" plugin
- // (basically just AwsS3) using the internal symbol
- if (this.opts.limit === 0 && !this.opts[internalRateLimitedQueue]) {
- 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');
- }
- this.uppy.log('[XHRUpload] Uploading...');
- const files = fileIDs.map(fileID => this.uppy.getFile(fileID));
- if (this.opts.bundle) {
- // if bundle: true, we don’t support remote uploads
- const isSomeFileRemote = files.some(file => file.isRemote);
- if (isSomeFileRemote) {
- throw new Error('Can’t upload remote files when the `bundle: true` option is set');
- }
- if (typeof this.opts.headers === 'function') {
- throw new TypeError('`headers` may not be a function when the `bundle: true` option is set');
- }
- return this.uploadBundle(files);
- }
- return this.uploadFiles(files).then(() => null);
- }
- install() {
- if (this.opts.bundle) {
- const {
- capabilities
- } = this.uppy.getState();
- this.uppy.setState({
- capabilities: { ...capabilities,
- individualCancellation: false
- }
- });
- }
- this.uppy.addUploader(this.handleUpload);
- }
- uninstall() {
- if (this.opts.bundle) {
- const {
- capabilities
- } = this.uppy.getState();
- this.uppy.setState({
- capabilities: { ...capabilities,
- individualCancellation: true
- }
- });
- }
- this.uppy.removeUploader(this.handleUpload);
- }
- }, _class.VERSION = "2.0.6", _temp);
- var require$$2$1 = dist$7;
- var require$$1 = dom7_cjs;
- var require$$2 = snabbdom_cjs;
- var dist$6 = createCommonjsModule$1(function (module, exports) {
- !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);}));
- /*!
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- 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)&>(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,""")+'"'),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))&>(p,u,l[u]);else _n({target:t,proto:!0,forced:Oo||d},l);return p[Co]!==g&>(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);
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- var 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," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™")}(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(/ /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(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/®/g,"®").replace(/©/g,"©").replace(/™/g,"™").replace(/"/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={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};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});}));
- });
- /**
- * @description i18n en
- * @author wangfupeng
- */
- var enResources = {
- editor: {
- more: 'More',
- justify: 'Justify',
- indent: 'Indent',
- image: 'Image',
- video: 'Video',
- },
- };
- /**
- * @description i18n zh-CN
- * @author wangfupeng
- */
- var zhResources = {
- editor: {
- more: '更多',
- justify: '对齐',
- indent: '缩进',
- image: '图片',
- video: '视频',
- },
- };
- /**
- * @description i18n entry
- * @author wangfupeng
- */
- dist$6.i18nAddResources('en', enResources);
- dist$6.i18nAddResources('zh-CN', zhResources);
- var dist$5 = createCommonjsModule$1(function (module, exports) {
- !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)};
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */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,""")+'"'),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,"<").replace(/>/g,">")}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});}));
- });
- var basicModules = /*@__PURE__*/getDefaultExportFromCjs(dist$5);
- var dist$4 = createCommonjsModule$1(function (module, exports) {
- !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)};
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */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}}}]}}));
- });
- /**
- * Lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright JS Foundation and other contributors <https://js.foundation/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */
- var lodash_isequal = createCommonjsModule$1(function (module, exports) {
- /** Used as the size to enable large array optimizations. */
- var LARGE_ARRAY_SIZE = 200;
- /** Used to stand-in for `undefined` hash values. */
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
- /** Used to compose bitmasks for value comparisons. */
- var COMPARE_PARTIAL_FLAG = 1,
- COMPARE_UNORDERED_FLAG = 2;
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER = 9007199254740991;
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]',
- arrayTag = '[object Array]',
- asyncTag = '[object AsyncFunction]',
- boolTag = '[object Boolean]',
- dateTag = '[object Date]',
- errorTag = '[object Error]',
- funcTag = '[object Function]',
- genTag = '[object GeneratorFunction]',
- mapTag = '[object Map]',
- numberTag = '[object Number]',
- nullTag = '[object Null]',
- objectTag = '[object Object]',
- promiseTag = '[object Promise]',
- proxyTag = '[object Proxy]',
- regexpTag = '[object RegExp]',
- setTag = '[object Set]',
- stringTag = '[object String]',
- symbolTag = '[object Symbol]',
- undefinedTag = '[object Undefined]',
- weakMapTag = '[object WeakMap]';
- var arrayBufferTag = '[object ArrayBuffer]',
- dataViewTag = '[object DataView]',
- float32Tag = '[object Float32Array]',
- float64Tag = '[object Float64Array]',
- int8Tag = '[object Int8Array]',
- int16Tag = '[object Int16Array]',
- int32Tag = '[object Int32Array]',
- uint8Tag = '[object Uint8Array]',
- uint8ClampedTag = '[object Uint8ClampedArray]',
- uint16Tag = '[object Uint16Array]',
- uint32Tag = '[object Uint32Array]';
- /**
- * Used to match `RegExp`
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
- */
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
- /** Used to detect host constructors (Safari). */
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
- /** Used to detect unsigned integer values. */
- var reIsUint = /^(?:0|[1-9]\d*)$/;
- /** Used to identify `toStringTag` values of typed arrays. */
- var typedArrayTags = {};
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
- typedArrayTags[uint32Tag] = true;
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
- typedArrayTags[mapTag] = typedArrayTags[numberTag] =
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
- typedArrayTags[setTag] = typedArrayTags[stringTag] =
- typedArrayTags[weakMapTag] = false;
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
- /** Detect free variable `self`. */
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root = freeGlobal || freeSelf || Function('return this')();
- /** Detect free variable `exports`. */
- var freeExports = exports && !exports.nodeType && exports;
- /** Detect free variable `module`. */
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
- /** Detect the popular CommonJS extension `module.exports`. */
- var moduleExports = freeModule && freeModule.exports === freeExports;
- /** Detect free variable `process` from Node.js. */
- var freeProcess = moduleExports && freeGlobal.process;
- /** Used to access faster Node.js helpers. */
- var nodeUtil = (function() {
- try {
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
- } catch (e) {}
- }());
- /* Node.js helper references. */
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
- /**
- * A specialized version of `_.filter` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {Array} Returns the new filtered array.
- */
- function arrayFilter(array, predicate) {
- var index = -1,
- length = array == null ? 0 : array.length,
- resIndex = 0,
- result = [];
- while (++index < length) {
- var value = array[index];
- if (predicate(value, index, array)) {
- result[resIndex++] = value;
- }
- }
- return result;
- }
- /**
- * Appends the elements of `values` to `array`.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {Array} values The values to append.
- * @returns {Array} Returns `array`.
- */
- function arrayPush(array, values) {
- var index = -1,
- length = values.length,
- offset = array.length;
- while (++index < length) {
- array[offset + index] = values[index];
- }
- return array;
- }
- /**
- * A specialized version of `_.some` for arrays without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if any element passes the predicate check,
- * else `false`.
- */
- function arraySome(array, predicate) {
- var index = -1,
- length = array == null ? 0 : array.length;
- while (++index < length) {
- if (predicate(array[index], index, array)) {
- return true;
- }
- }
- return false;
- }
- /**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
- function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
- /**
- * The base implementation of `_.unary` without support for storing metadata.
- *
- * @private
- * @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new capped function.
- */
- function baseUnary(func) {
- return function(value) {
- return func(value);
- };
- }
- /**
- * Checks if a `cache` value for `key` exists.
- *
- * @private
- * @param {Object} cache The cache to query.
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function cacheHas(cache, key) {
- return cache.has(key);
- }
- /**
- * Gets the value at `key` of `object`.
- *
- * @private
- * @param {Object} [object] The object to query.
- * @param {string} key The key of the property to get.
- * @returns {*} Returns the property value.
- */
- function getValue(object, key) {
- return object == null ? undefined : object[key];
- }
- /**
- * Converts `map` to its key-value pairs.
- *
- * @private
- * @param {Object} map The map to convert.
- * @returns {Array} Returns the key-value pairs.
- */
- function mapToArray(map) {
- var index = -1,
- result = Array(map.size);
- map.forEach(function(value, key) {
- result[++index] = [key, value];
- });
- return result;
- }
- /**
- * Creates a unary function that invokes `func` with its argument transformed.
- *
- * @private
- * @param {Function} func The function to wrap.
- * @param {Function} transform The argument transform.
- * @returns {Function} Returns the new function.
- */
- function overArg(func, transform) {
- return function(arg) {
- return func(transform(arg));
- };
- }
- /**
- * Converts `set` to an array of its values.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the values.
- */
- function setToArray(set) {
- var index = -1,
- result = Array(set.size);
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
- }
- /** Used for built-in method references. */
- var arrayProto = Array.prototype,
- funcProto = Function.prototype,
- objectProto = Object.prototype;
- /** Used to detect overreaching core-js shims. */
- var coreJsData = root['__core-js_shared__'];
- /** Used to resolve the decompiled source of functions. */
- var funcToString = funcProto.toString;
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /** Used to detect methods masquerading as native. */
- var maskSrcKey = (function() {
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
- return uid ? ('Symbol(src)_1.' + uid) : '';
- }());
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var nativeObjectToString = objectProto.toString;
- /** Used to detect if a method is native. */
- var reIsNative = RegExp('^' +
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
- );
- /** Built-in value references. */
- var Buffer = moduleExports ? root.Buffer : undefined,
- Symbol = root.Symbol,
- Uint8Array = root.Uint8Array,
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
- splice = arrayProto.splice,
- symToStringTag = Symbol ? Symbol.toStringTag : undefined;
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeGetSymbols = Object.getOwnPropertySymbols,
- nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
- nativeKeys = overArg(Object.keys, Object);
- /* Built-in method references that are verified to be native. */
- var DataView = getNative(root, 'DataView'),
- Map = getNative(root, 'Map'),
- Promise = getNative(root, 'Promise'),
- Set = getNative(root, 'Set'),
- WeakMap = getNative(root, 'WeakMap'),
- nativeCreate = getNative(Object, 'create');
- /** Used to detect maps, sets, and weakmaps. */
- var dataViewCtorString = toSource(DataView),
- mapCtorString = toSource(Map),
- promiseCtorString = toSource(Promise),
- setCtorString = toSource(Set),
- weakMapCtorString = toSource(WeakMap);
- /** Used to convert symbols to primitives and strings. */
- var symbolProto = Symbol ? Symbol.prototype : undefined,
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
- /**
- * Creates a hash object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function Hash(entries) {
- var index = -1,
- length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- /**
- * Removes all key-value entries from the hash.
- *
- * @private
- * @name clear
- * @memberOf Hash
- */
- function hashClear() {
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
- this.size = 0;
- }
- /**
- * Removes `key` and its value from the hash.
- *
- * @private
- * @name delete
- * @memberOf Hash
- * @param {Object} hash The hash to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function hashDelete(key) {
- var result = this.has(key) && delete this.__data__[key];
- this.size -= result ? 1 : 0;
- return result;
- }
- /**
- * Gets the hash value for `key`.
- *
- * @private
- * @name get
- * @memberOf Hash
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function hashGet(key) {
- var data = this.__data__;
- if (nativeCreate) {
- var result = data[key];
- return result === HASH_UNDEFINED ? undefined : result;
- }
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
- }
- /**
- * Checks if a hash value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Hash
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function hashHas(key) {
- var data = this.__data__;
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
- }
- /**
- * Sets the hash `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Hash
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the hash instance.
- */
- function hashSet(key, value) {
- var data = this.__data__;
- this.size += this.has(key) ? 0 : 1;
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
- return this;
- }
- // Add methods to `Hash`.
- Hash.prototype.clear = hashClear;
- Hash.prototype['delete'] = hashDelete;
- Hash.prototype.get = hashGet;
- Hash.prototype.has = hashHas;
- Hash.prototype.set = hashSet;
- /**
- * Creates an list cache object.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function ListCache(entries) {
- var index = -1,
- length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- /**
- * Removes all key-value entries from the list cache.
- *
- * @private
- * @name clear
- * @memberOf ListCache
- */
- function listCacheClear() {
- this.__data__ = [];
- this.size = 0;
- }
- /**
- * Removes `key` and its value from the list cache.
- *
- * @private
- * @name delete
- * @memberOf ListCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function listCacheDelete(key) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
- if (index < 0) {
- return false;
- }
- var lastIndex = data.length - 1;
- if (index == lastIndex) {
- data.pop();
- } else {
- splice.call(data, index, 1);
- }
- --this.size;
- return true;
- }
- /**
- * Gets the list cache value for `key`.
- *
- * @private
- * @name get
- * @memberOf ListCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function listCacheGet(key) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
- return index < 0 ? undefined : data[index][1];
- }
- /**
- * Checks if a list cache value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf ListCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function listCacheHas(key) {
- return assocIndexOf(this.__data__, key) > -1;
- }
- /**
- * Sets the list cache `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf ListCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the list cache instance.
- */
- function listCacheSet(key, value) {
- var data = this.__data__,
- index = assocIndexOf(data, key);
- if (index < 0) {
- ++this.size;
- data.push([key, value]);
- } else {
- data[index][1] = value;
- }
- return this;
- }
- // Add methods to `ListCache`.
- ListCache.prototype.clear = listCacheClear;
- ListCache.prototype['delete'] = listCacheDelete;
- ListCache.prototype.get = listCacheGet;
- ListCache.prototype.has = listCacheHas;
- ListCache.prototype.set = listCacheSet;
- /**
- * Creates a map cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function MapCache(entries) {
- var index = -1,
- length = entries == null ? 0 : entries.length;
- this.clear();
- while (++index < length) {
- var entry = entries[index];
- this.set(entry[0], entry[1]);
- }
- }
- /**
- * Removes all key-value entries from the map.
- *
- * @private
- * @name clear
- * @memberOf MapCache
- */
- function mapCacheClear() {
- this.size = 0;
- this.__data__ = {
- 'hash': new Hash,
- 'map': new (Map || ListCache),
- 'string': new Hash
- };
- }
- /**
- * Removes `key` and its value from the map.
- *
- * @private
- * @name delete
- * @memberOf MapCache
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function mapCacheDelete(key) {
- var result = getMapData(this, key)['delete'](key);
- this.size -= result ? 1 : 0;
- return result;
- }
- /**
- * Gets the map value for `key`.
- *
- * @private
- * @name get
- * @memberOf MapCache
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function mapCacheGet(key) {
- return getMapData(this, key).get(key);
- }
- /**
- * Checks if a map value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf MapCache
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function mapCacheHas(key) {
- return getMapData(this, key).has(key);
- }
- /**
- * Sets the map `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf MapCache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the map cache instance.
- */
- function mapCacheSet(key, value) {
- var data = getMapData(this, key),
- size = data.size;
- data.set(key, value);
- this.size += data.size == size ? 0 : 1;
- return this;
- }
- // Add methods to `MapCache`.
- MapCache.prototype.clear = mapCacheClear;
- MapCache.prototype['delete'] = mapCacheDelete;
- MapCache.prototype.get = mapCacheGet;
- MapCache.prototype.has = mapCacheHas;
- MapCache.prototype.set = mapCacheSet;
- /**
- *
- * Creates an array cache object to store unique values.
- *
- * @private
- * @constructor
- * @param {Array} [values] The values to cache.
- */
- function SetCache(values) {
- var index = -1,
- length = values == null ? 0 : values.length;
- this.__data__ = new MapCache;
- while (++index < length) {
- this.add(values[index]);
- }
- }
- /**
- * Adds `value` to the array cache.
- *
- * @private
- * @name add
- * @memberOf SetCache
- * @alias push
- * @param {*} value The value to cache.
- * @returns {Object} Returns the cache instance.
- */
- function setCacheAdd(value) {
- this.__data__.set(value, HASH_UNDEFINED);
- return this;
- }
- /**
- * Checks if `value` is in the array cache.
- *
- * @private
- * @name has
- * @memberOf SetCache
- * @param {*} value The value to search for.
- * @returns {number} Returns `true` if `value` is found, else `false`.
- */
- function setCacheHas(value) {
- return this.__data__.has(value);
- }
- // Add methods to `SetCache`.
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
- SetCache.prototype.has = setCacheHas;
- /**
- * Creates a stack cache object to store key-value pairs.
- *
- * @private
- * @constructor
- * @param {Array} [entries] The key-value pairs to cache.
- */
- function Stack(entries) {
- var data = this.__data__ = new ListCache(entries);
- this.size = data.size;
- }
- /**
- * Removes all key-value entries from the stack.
- *
- * @private
- * @name clear
- * @memberOf Stack
- */
- function stackClear() {
- this.__data__ = new ListCache;
- this.size = 0;
- }
- /**
- * Removes `key` and its value from the stack.
- *
- * @private
- * @name delete
- * @memberOf Stack
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function stackDelete(key) {
- var data = this.__data__,
- result = data['delete'](key);
- this.size = data.size;
- return result;
- }
- /**
- * Gets the stack value for `key`.
- *
- * @private
- * @name get
- * @memberOf Stack
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function stackGet(key) {
- return this.__data__.get(key);
- }
- /**
- * Checks if a stack value for `key` exists.
- *
- * @private
- * @name has
- * @memberOf Stack
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function stackHas(key) {
- return this.__data__.has(key);
- }
- /**
- * Sets the stack `key` to `value`.
- *
- * @private
- * @name set
- * @memberOf Stack
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the stack cache instance.
- */
- function stackSet(key, value) {
- var data = this.__data__;
- if (data instanceof ListCache) {
- var pairs = data.__data__;
- if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
- pairs.push([key, value]);
- this.size = ++data.size;
- return this;
- }
- data = this.__data__ = new MapCache(pairs);
- }
- data.set(key, value);
- this.size = data.size;
- return this;
- }
- // Add methods to `Stack`.
- Stack.prototype.clear = stackClear;
- Stack.prototype['delete'] = stackDelete;
- Stack.prototype.get = stackGet;
- Stack.prototype.has = stackHas;
- Stack.prototype.set = stackSet;
- /**
- * Creates an array of the enumerable property names of the array-like `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @param {boolean} inherited Specify returning inherited property names.
- * @returns {Array} Returns the array of property names.
- */
- function arrayLikeKeys(value, inherited) {
- var isArr = isArray(value),
- isArg = !isArr && isArguments(value),
- isBuff = !isArr && !isArg && isBuffer(value),
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
- skipIndexes = isArr || isArg || isBuff || isType,
- result = skipIndexes ? baseTimes(value.length, String) : [],
- length = result.length;
- for (var key in value) {
- if ((inherited || hasOwnProperty.call(value, key)) &&
- !(skipIndexes && (
- // Safari 9 has enumerable `arguments.length` in strict mode.
- key == 'length' ||
- // Node.js 0.10 has enumerable non-index properties on buffers.
- (isBuff && (key == 'offset' || key == 'parent')) ||
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
- // Skip index properties.
- isIndex(key, length)
- ))) {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */
- function assocIndexOf(array, key) {
- var length = array.length;
- while (length--) {
- if (eq(array[length][0], key)) {
- return length;
- }
- }
- return -1;
- }
- /**
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
- * symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
- * @returns {Array} Returns the array of property names and symbols.
- */
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
- var result = keysFunc(object);
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
- }
- /**
- * The base implementation of `getTag` without fallbacks for buggy environments.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- function baseGetTag(value) {
- if (value == null) {
- return value === undefined ? undefinedTag : nullTag;
- }
- return (symToStringTag && symToStringTag in Object(value))
- ? getRawTag(value)
- : objectToString(value);
- }
- /**
- * The base implementation of `_.isArguments`.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- */
- function baseIsArguments(value) {
- return isObjectLike(value) && baseGetTag(value) == argsTag;
- }
- /**
- * The base implementation of `_.isEqual` which supports partial comparisons
- * and tracks traversed objects.
- *
- * @private
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @param {boolean} bitmask The bitmask flags.
- * 1 - Unordered comparison
- * 2 - Partial comparison
- * @param {Function} [customizer] The function to customize comparisons.
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- */
- function baseIsEqual(value, other, bitmask, customizer, stack) {
- if (value === other) {
- return true;
- }
- if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
- return value !== value && other !== other;
- }
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
- }
- /**
- * A specialized version of `baseIsEqual` for arrays and objects which performs
- * deep comparisons and tracks traversed objects enabling objects with circular
- * references to be compared.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
- * @param {Function} customizer The function to customize comparisons.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
- var objIsArr = isArray(object),
- othIsArr = isArray(other),
- objTag = objIsArr ? arrayTag : getTag(object),
- othTag = othIsArr ? arrayTag : getTag(other);
- objTag = objTag == argsTag ? objectTag : objTag;
- othTag = othTag == argsTag ? objectTag : othTag;
- var objIsObj = objTag == objectTag,
- othIsObj = othTag == objectTag,
- isSameTag = objTag == othTag;
- if (isSameTag && isBuffer(object)) {
- if (!isBuffer(other)) {
- return false;
- }
- objIsArr = true;
- objIsObj = false;
- }
- if (isSameTag && !objIsObj) {
- stack || (stack = new Stack);
- return (objIsArr || isTypedArray(object))
- ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
- : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
- }
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
- othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
- if (objIsWrapped || othIsWrapped) {
- var objUnwrapped = objIsWrapped ? object.value() : object,
- othUnwrapped = othIsWrapped ? other.value() : other;
- stack || (stack = new Stack);
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
- }
- }
- if (!isSameTag) {
- return false;
- }
- stack || (stack = new Stack);
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
- }
- /**
- * The base implementation of `_.isNative` without bad shim checks.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function,
- * else `false`.
- */
- function baseIsNative(value) {
- if (!isObject(value) || isMasked(value)) {
- return false;
- }
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
- return pattern.test(toSource(value));
- }
- /**
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- */
- function baseIsTypedArray(value) {
- return isObjectLike(value) &&
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
- }
- /**
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function baseKeys(object) {
- if (!isPrototype(object)) {
- return nativeKeys(object);
- }
- var result = [];
- for (var key in Object(object)) {
- if (hasOwnProperty.call(object, key) && key != 'constructor') {
- result.push(key);
- }
- }
- return result;
- }
- /**
- * A specialized version of `baseIsEqualDeep` for arrays with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Array} array The array to compare.
- * @param {Array} other The other array to compare.
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
- * @param {Function} customizer The function to customize comparisons.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Object} stack Tracks traversed `array` and `other` objects.
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
- */
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
- arrLength = array.length,
- othLength = other.length;
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
- return false;
- }
- // Assume cyclic values are equal.
- var stacked = stack.get(array);
- if (stacked && stack.get(other)) {
- return stacked == other;
- }
- var index = -1,
- result = true,
- seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
- stack.set(array, other);
- stack.set(other, array);
- // Ignore non-index properties.
- while (++index < arrLength) {
- var arrValue = array[index],
- othValue = other[index];
- if (customizer) {
- var compared = isPartial
- ? customizer(othValue, arrValue, index, other, array, stack)
- : customizer(arrValue, othValue, index, array, other, stack);
- }
- if (compared !== undefined) {
- if (compared) {
- continue;
- }
- result = false;
- break;
- }
- // Recursively compare arrays (susceptible to call stack limits).
- if (seen) {
- if (!arraySome(other, function(othValue, othIndex) {
- if (!cacheHas(seen, othIndex) &&
- (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
- return seen.push(othIndex);
- }
- })) {
- result = false;
- break;
- }
- } else if (!(
- arrValue === othValue ||
- equalFunc(arrValue, othValue, bitmask, customizer, stack)
- )) {
- result = false;
- break;
- }
- }
- stack['delete'](array);
- stack['delete'](other);
- return result;
- }
- /**
- * A specialized version of `baseIsEqualDeep` for comparing objects of
- * the same `toStringTag`.
- *
- * **Note:** This function only supports comparing values with tags of
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {string} tag The `toStringTag` of the objects to compare.
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
- * @param {Function} customizer The function to customize comparisons.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Object} stack Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
- switch (tag) {
- case dataViewTag:
- if ((object.byteLength != other.byteLength) ||
- (object.byteOffset != other.byteOffset)) {
- return false;
- }
- object = object.buffer;
- other = other.buffer;
- case arrayBufferTag:
- if ((object.byteLength != other.byteLength) ||
- !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
- return false;
- }
- return true;
- case boolTag:
- case dateTag:
- case numberTag:
- // Coerce booleans to `1` or `0` and dates to milliseconds.
- // Invalid dates are coerced to `NaN`.
- return eq(+object, +other);
- case errorTag:
- return object.name == other.name && object.message == other.message;
- case regexpTag:
- case stringTag:
- // Coerce regexes to strings and treat strings, primitives and objects,
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
- // for more details.
- return object == (other + '');
- case mapTag:
- var convert = mapToArray;
- case setTag:
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
- convert || (convert = setToArray);
- if (object.size != other.size && !isPartial) {
- return false;
- }
- // Assume cyclic values are equal.
- var stacked = stack.get(object);
- if (stacked) {
- return stacked == other;
- }
- bitmask |= COMPARE_UNORDERED_FLAG;
- // Recursively compare objects (susceptible to call stack limits).
- stack.set(object, other);
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
- stack['delete'](object);
- return result;
- case symbolTag:
- if (symbolValueOf) {
- return symbolValueOf.call(object) == symbolValueOf.call(other);
- }
- }
- return false;
- }
- /**
- * A specialized version of `baseIsEqualDeep` for objects with support for
- * partial deep comparisons.
- *
- * @private
- * @param {Object} object The object to compare.
- * @param {Object} other The other object to compare.
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
- * @param {Function} customizer The function to customize comparisons.
- * @param {Function} equalFunc The function to determine equivalents of values.
- * @param {Object} stack Tracks traversed `object` and `other` objects.
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
- */
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
- objProps = getAllKeys(object),
- objLength = objProps.length,
- othProps = getAllKeys(other),
- othLength = othProps.length;
- if (objLength != othLength && !isPartial) {
- return false;
- }
- var index = objLength;
- while (index--) {
- var key = objProps[index];
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
- return false;
- }
- }
- // Assume cyclic values are equal.
- var stacked = stack.get(object);
- if (stacked && stack.get(other)) {
- return stacked == other;
- }
- var result = true;
- stack.set(object, other);
- stack.set(other, object);
- var skipCtor = isPartial;
- while (++index < objLength) {
- key = objProps[index];
- var objValue = object[key],
- othValue = other[key];
- if (customizer) {
- var compared = isPartial
- ? customizer(othValue, objValue, key, other, object, stack)
- : customizer(objValue, othValue, key, object, other, stack);
- }
- // Recursively compare objects (susceptible to call stack limits).
- if (!(compared === undefined
- ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
- : compared
- )) {
- result = false;
- break;
- }
- skipCtor || (skipCtor = key == 'constructor');
- }
- if (result && !skipCtor) {
- var objCtor = object.constructor,
- othCtor = other.constructor;
- // Non `Object` object instances with different constructors are not equal.
- if (objCtor != othCtor &&
- ('constructor' in object && 'constructor' in other) &&
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
- result = false;
- }
- }
- stack['delete'](object);
- stack['delete'](other);
- return result;
- }
- /**
- * Creates an array of own enumerable property names and symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names and symbols.
- */
- function getAllKeys(object) {
- return baseGetAllKeys(object, keys, getSymbols);
- }
- /**
- * Gets the data for `map`.
- *
- * @private
- * @param {Object} map The map to query.
- * @param {string} key The reference key.
- * @returns {*} Returns the map data.
- */
- function getMapData(map, key) {
- var data = map.__data__;
- return isKeyable(key)
- ? data[typeof key == 'string' ? 'string' : 'hash']
- : data.map;
- }
- /**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */
- function getNative(object, key) {
- var value = getValue(object, key);
- return baseIsNative(value) ? value : undefined;
- }
- /**
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the raw `toStringTag`.
- */
- function getRawTag(value) {
- var isOwn = hasOwnProperty.call(value, symToStringTag),
- tag = value[symToStringTag];
- try {
- value[symToStringTag] = undefined;
- var unmasked = true;
- } catch (e) {}
- var result = nativeObjectToString.call(value);
- if (unmasked) {
- if (isOwn) {
- value[symToStringTag] = tag;
- } else {
- delete value[symToStringTag];
- }
- }
- return result;
- }
- /**
- * Creates an array of the own enumerable symbols of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of symbols.
- */
- var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
- if (object == null) {
- return [];
- }
- object = Object(object);
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
- return propertyIsEnumerable.call(object, symbol);
- });
- };
- /**
- * Gets the `toStringTag` of `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
- var getTag = baseGetTag;
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
- (Map && getTag(new Map) != mapTag) ||
- (Promise && getTag(Promise.resolve()) != promiseTag) ||
- (Set && getTag(new Set) != setTag) ||
- (WeakMap && getTag(new WeakMap) != weakMapTag)) {
- getTag = function(value) {
- var result = baseGetTag(value),
- Ctor = result == objectTag ? value.constructor : undefined,
- ctorString = Ctor ? toSource(Ctor) : '';
- if (ctorString) {
- switch (ctorString) {
- case dataViewCtorString: return dataViewTag;
- case mapCtorString: return mapTag;
- case promiseCtorString: return promiseTag;
- case setCtorString: return setTag;
- case weakMapCtorString: return weakMapTag;
- }
- }
- return result;
- };
- }
- /**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex(value, length) {
- length = length == null ? MAX_SAFE_INTEGER : length;
- return !!length &&
- (typeof value == 'number' || reIsUint.test(value)) &&
- (value > -1 && value % 1 == 0 && value < length);
- }
- /**
- * Checks if `value` is suitable for use as unique object key.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
- */
- function isKeyable(value) {
- var type = typeof value;
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
- ? (value !== '__proto__')
- : (value === null);
- }
- /**
- * Checks if `func` has its source masked.
- *
- * @private
- * @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
- */
- function isMasked(func) {
- return !!maskSrcKey && (maskSrcKey in func);
- }
- /**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */
- function isPrototype(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
- return value === proto;
- }
- /**
- * Converts `value` to a string using `Object.prototype.toString`.
- *
- * @private
- * @param {*} value The value to convert.
- * @returns {string} Returns the converted string.
- */
- function objectToString(value) {
- return nativeObjectToString.call(value);
- }
- /**
- * Converts `func` to its source code.
- *
- * @private
- * @param {Function} func The function to convert.
- * @returns {string} Returns the source code.
- */
- function toSource(func) {
- if (func != null) {
- try {
- return funcToString.call(func);
- } catch (e) {}
- try {
- return (func + '');
- } catch (e) {}
- }
- return '';
- }
- /**
- * Performs a
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
- * comparison between two values to determine if they are equivalent.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.eq(object, object);
- * // => true
- *
- * _.eq(object, other);
- * // => false
- *
- * _.eq('a', 'a');
- * // => true
- *
- * _.eq('a', Object('a'));
- * // => false
- *
- * _.eq(NaN, NaN);
- * // => true
- */
- function eq(value, other) {
- return value === other || (value !== value && other !== other);
- }
- /**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
- * else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
- return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
- !propertyIsEnumerable.call(value, 'callee');
- };
- /**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */
- var isArray = Array.isArray;
- /**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
- function isArrayLike(value) {
- return value != null && isLength(value.length) && !isFunction(value);
- }
- /**
- * Checks if `value` is a buffer.
- *
- * @static
- * @memberOf _
- * @since 4.3.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
- * @example
- *
- * _.isBuffer(new Buffer(2));
- * // => true
- *
- * _.isBuffer(new Uint8Array(2));
- * // => false
- */
- var isBuffer = nativeIsBuffer || stubFalse;
- /**
- * Performs a deep comparison between two values to determine if they are
- * equivalent.
- *
- * **Note:** This method supports comparing arrays, array buffers, booleans,
- * date objects, error objects, maps, numbers, `Object` objects, regexes,
- * sets, strings, symbols, and typed arrays. `Object` objects are compared
- * by their own, not inherited, enumerable properties. Functions and DOM
- * nodes are compared by strict equality, i.e. `===`.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to compare.
- * @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
- * @example
- *
- * var object = { 'a': 1 };
- * var other = { 'a': 1 };
- *
- * _.isEqual(object, other);
- * // => true
- *
- * object === other;
- * // => false
- */
- function isEqual(value, other) {
- return baseIsEqual(value, other);
- }
- /**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
- function isFunction(value) {
- if (!isObject(value)) {
- return false;
- }
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
- var tag = baseGetTag(value);
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
- }
- /**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This method is loosely based on
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
- function isLength(value) {
- return typeof value == 'number' &&
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
- /**
- * Checks if `value` is the
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @since 0.1.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject(value) {
- var type = typeof value;
- return value != null && (type == 'object' || type == 'function');
- }
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike(value) {
- return value != null && typeof value == 'object';
- }
- /**
- * Checks if `value` is classified as a typed array.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
- * @example
- *
- * _.isTypedArray(new Uint8Array);
- * // => true
- *
- * _.isTypedArray([]);
- * // => false
- */
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
- /**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @since 0.1.0
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
- function keys(object) {
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
- }
- /**
- * This method returns a new empty array.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {Array} Returns the new empty array.
- * @example
- *
- * var arrays = _.times(2, _.stubArray);
- *
- * console.log(arrays);
- * // => [[], []]
- *
- * console.log(arrays[0] === arrays[1]);
- * // => false
- */
- function stubArray() {
- return [];
- }
- /**
- * This method returns `false`.
- *
- * @static
- * @memberOf _
- * @since 4.13.0
- * @category Util
- * @returns {boolean} Returns `false`.
- * @example
- *
- * _.times(2, _.stubFalse);
- * // => [false, false]
- */
- function stubFalse() {
- return false;
- }
- module.exports = isEqual;
- });
- var dist$3 = createCommonjsModule$1(function (module, exports) {
- !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,""")+'"'),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=
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- 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 × 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+" × "+(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}));
- });
- var dist$2 = createCommonjsModule$1(function (module, exports) {
- !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:"高度"}});
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- var 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,"<").replace(/>/g,">")),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}));
- });
- var dist$1 = createCommonjsModule$1(function (module, exports) {
- !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);
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- var 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}));
- });
- var dist = createCommonjsModule$1(function (module, exports) {
- !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,"&").replace(/</g,"<").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,""")+'"';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:{});
- /**
- * Prism: Lightweight, robust, elegant syntax highlighting
- *
- * @license MIT <https://opensource.org/licenses/MIT>
- * @author Lea Verou <https://lea.verou.me>
- * @namespace
- * @public
- */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(/&/,"&"));})),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(/&/,"&"));})),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(/</g,"<").replace(/&/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,""")+'"'),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=
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- 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});}));
- });
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- var __assign = function() {
- __assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
- /**
- * @description Editor View class
- * @author wangfupeng
- */
- var Boot = /** @class */ (function () {
- function Boot() {
- throw new Error('不能实例化\nCan not construct a instance');
- }
- Boot.setEditorConfig = function (newConfig) {
- if (newConfig === void 0) { newConfig = {}; }
- this.editorConfig = __assign(__assign({}, this.editorConfig), newConfig);
- };
- Boot.setSimpleEditorConfig = function (newConfig) {
- if (newConfig === void 0) { newConfig = {}; }
- this.simpleEditorConfig = __assign(__assign({}, this.simpleEditorConfig), newConfig);
- };
- Boot.setToolbarConfig = function (newConfig) {
- if (newConfig === void 0) { newConfig = {}; }
- this.toolbarConfig = __assign(__assign({}, this.toolbarConfig), newConfig);
- };
- Boot.setSimpleToolbarConfig = function (newConfig) {
- if (newConfig === void 0) { newConfig = {}; }
- this.simpleToolbarConfig = __assign(__assign({}, this.simpleToolbarConfig), newConfig);
- };
- Boot.registerPlugin = function (plugin) {
- this.plugins.push(plugin);
- };
- // 注册 menu
- // TODO 可在注册时传入配置,在开发文档中说明
- Boot.registerMenu = function (menuConf, customConfig) {
- dist$6.registerMenu(menuConf, customConfig);
- };
- // 注册 renderElem
- Boot.registerRenderElem = function (renderElemConf) {
- dist$6.registerRenderElemConf(renderElemConf);
- };
- // 注册 renderStyle
- Boot.registerRenderStyle = function (fn) {
- dist$6.registerStyleHandler(fn);
- };
- // 注册 elemToHtml
- Boot.registerElemToHtml = function (elemToHtmlConf) {
- dist$6.registerElemToHtmlConf(elemToHtmlConf);
- };
- // 注册 styleToHtml
- Boot.registerStyleToHtml = function (fn) {
- dist$6.registerStyleToHtmlHandler(fn);
- };
- // 注册 preParseHtml
- Boot.registerPreParseHtml = function (preParseHtmlConf) {
- dist$6.registerPreParseHtmlConf(preParseHtmlConf);
- };
- // 注册 parseElemHtml
- Boot.registerParseElemHtml = function (parseElemHtmlConf) {
- dist$6.registerParseElemHtmlConf(parseElemHtmlConf);
- };
- // 注册 parseStyleHtml
- Boot.registerParseStyleHtml = function (fn) {
- dist$6.registerParseStyleHtmlHandler(fn);
- };
- // 注册 module
- Boot.registerModule = function (module) {
- registerModule(module);
- };
- // editor 配置
- Boot.editorConfig = {};
- Boot.simpleEditorConfig = {};
- //toolbar 配置
- Boot.toolbarConfig = {};
- Boot.simpleToolbarConfig = {};
- // 注册插件
- Boot.plugins = [];
- return Boot;
- }());
- /**
- * @description 注册 module
- * @author wangfupeng
- */
- function registerModule(module) {
- 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;
- if (menus) {
- menus.forEach(function (menu) { return Boot.registerMenu(menu); });
- }
- if (renderElems) {
- renderElems.forEach(function (renderElemConf) { return Boot.registerRenderElem(renderElemConf); });
- }
- if (renderStyle) {
- Boot.registerRenderStyle(renderStyle);
- }
- if (elemsToHtml) {
- elemsToHtml.forEach(function (elemToHtmlConf) { return Boot.registerElemToHtml(elemToHtmlConf); });
- }
- if (styleToHtml) {
- Boot.registerStyleToHtml(styleToHtml);
- }
- if (preParseHtml) {
- preParseHtml.forEach(function (conf) { return Boot.registerPreParseHtml(conf); });
- }
- if (parseElemsHtml) {
- parseElemsHtml.forEach(function (parseElemHtmlConf) { return Boot.registerParseElemHtml(parseElemHtmlConf); });
- }
- if (parseStyleHtml) {
- Boot.registerParseStyleHtml(parseStyleHtml);
- }
- if (editorPlugin) {
- Boot.registerPlugin(editorPlugin);
- }
- }
- /**
- * @description register builtin modules
- * @author wangfupeng
- */
- basicModules.forEach(function (module) { return registerModule(module); });
- registerModule(dist$4);
- registerModule(dist$3);
- registerModule(dist$2);
- registerModule(dist$1);
- registerModule(dist.wangEditorCodeHighlightModule);
- /**
- * @description svg tag
- * @author wangfupeng
- */
- /**
- * 【注意】svg 字符串的长度 ,否则会导致代码体积过大
- * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
- * 找不到再从 iconfont.com 搜索
- */
- // 缩进 right
- 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>';
- // 左对齐
- 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>';
- // 图片
- 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>';
- // plus
- 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>';
- // 视频
- 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>';
- /**
- * @description toolbar 配置
- * @author wangfupeng
- */
- function genDefaultToolbarKeys() {
- return [
- 'headerSelect',
- // 'header1',
- // 'header2',
- // 'header3',
- 'blockquote',
- '|',
- 'bold',
- 'underline',
- 'italic',
- {
- key: 'group-more-style',
- title: dist$6.t('editor.more'),
- iconSvg: MORE_SVG,
- menuKeys: ['through', 'code', 'sup', 'sub', 'clearStyle'],
- },
- 'color',
- 'bgColor',
- '|',
- 'fontSize',
- 'fontFamily',
- 'lineHeight',
- '|',
- 'bulletedList',
- 'numberedList',
- 'todo',
- {
- key: 'group-justify',
- title: dist$6.t('editor.justify'),
- iconSvg: JUSTIFY_LEFT_SVG,
- menuKeys: ['justifyLeft', 'justifyRight', 'justifyCenter', 'justifyJustify'],
- },
- {
- key: 'group-indent',
- title: dist$6.t('editor.indent'),
- iconSvg: INDENT_RIGHT_SVG,
- menuKeys: ['indent', 'delIndent'],
- },
- '|',
- 'emotion',
- 'insertLink',
- // 'editLink',
- // 'unLink',
- // 'viewLink',
- {
- key: 'group-image',
- title: dist$6.t('editor.image'),
- iconSvg: IMAGE_SVG,
- menuKeys: ['insertImage', 'uploadImage'],
- },
- // 'deleteImage',
- // 'editImage',
- // 'viewImageLink',
- {
- key: 'group-video',
- title: dist$6.t('editor.video'),
- iconSvg: VIDEO_SVG,
- menuKeys: ['insertVideo', 'uploadVideo'],
- },
- // 'deleteVideo',
- 'insertTable',
- 'codeBlock',
- // 'codeSelectLang',
- 'divider',
- // 'deleteTable',
- '|',
- 'undo',
- 'redo',
- '|',
- 'fullScreen',
- ];
- }
- function genSimpleToolbarKeys() {
- return [
- 'blockquote',
- 'header1',
- 'header2',
- 'header3',
- '|',
- 'bold',
- 'underline',
- 'italic',
- 'through',
- 'color',
- 'bgColor',
- 'clearStyle',
- '|',
- 'bulletedList',
- 'numberedList',
- 'todo',
- 'justifyLeft',
- 'justifyRight',
- 'justifyCenter',
- '|',
- 'insertLink',
- {
- key: 'group-image',
- title: dist$6.t('editor.image'),
- iconSvg: IMAGE_SVG,
- menuKeys: ['insertImage', 'uploadImage'],
- },
- 'insertVideo',
- 'insertTable',
- 'codeBlock',
- '|',
- 'undo',
- 'redo',
- '|',
- 'fullScreen',
- ];
- }
- /**
- * @description hoverbar 配置
- * @author wangfupeng
- */
- var COMMON_HOVERBAR_KEYS = {
- // key 即 element type
- link: {
- menuKeys: ['editLink', 'unLink', 'viewLink'],
- },
- image: {
- menuKeys: [
- 'imageWidth30',
- 'imageWidth50',
- 'imageWidth100',
- 'editImage',
- 'viewImageLink',
- 'deleteImage',
- ],
- },
- pre: {
- menuKeys: ['enter', 'codeBlock', 'codeSelectLang'],
- },
- table: {
- menuKeys: [
- 'enter',
- 'tableHeader',
- 'tableFullWidth',
- 'insertTableRow',
- 'deleteTableRow',
- 'insertTableCol',
- 'deleteTableCol',
- 'deleteTable',
- ],
- },
- divider: {
- menuKeys: ['enter'],
- },
- video: {
- menuKeys: ['enter', 'editVideoSize'],
- },
- };
- function genDefaultHoverbarKeys() {
- return __assign(__assign({}, COMMON_HOVERBAR_KEYS), {
- // 也可以自定义 match 来匹配元素,此时 key 就随意了
- text: {
- menuKeys: [
- 'headerSelect',
- 'insertLink',
- 'bulletedList',
- '|',
- 'bold',
- 'through',
- 'color',
- 'bgColor',
- 'clearStyle',
- ],
- } });
- }
- function genSimpleHoverbarKeys() {
- return COMMON_HOVERBAR_KEYS;
- }
- /**
- * @description 获取编辑器默认配置
- * @author wangfupeng
- */
- function getDefaultEditorConfig() {
- return {
- hoverbarKeys: genDefaultHoverbarKeys(),
- };
- }
- function getSimpleEditorConfig() {
- return {
- hoverbarKeys: genSimpleHoverbarKeys(),
- };
- }
- function getDefaultToolbarConfig() {
- return {
- toolbarKeys: genDefaultToolbarKeys(),
- };
- }
- function getSimpleToolbarConfig() {
- return {
- toolbarKeys: genSimpleToolbarKeys(),
- };
- }
- /**
- * @description set default config
- * @author wangfupeng
- */
- var defaultEditorConfig = getDefaultEditorConfig();
- Boot.setEditorConfig(__assign(__assign({}, defaultEditorConfig), { decorate: dist.wangEditorCodeHighLightDecorate }));
- var simpleEditorConfig = getSimpleEditorConfig();
- Boot.setSimpleEditorConfig(__assign(__assign({}, simpleEditorConfig), { decorate: dist.wangEditorCodeHighLightDecorate }));
- var defaultToolbarConfig = getDefaultToolbarConfig();
- Boot.setToolbarConfig(defaultToolbarConfig);
- var simpleToolbarConfig = getSimpleToolbarConfig();
- Boot.setSimpleToolbarConfig(simpleToolbarConfig);
- /**
- * @description create
- * @author wangfupeng
- */
- /**
- * 创建 editor 实例
- */
- function createEditor(option) {
- if (option === void 0) { option = {}; }
- 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;
- var globalConfig = mode === 'simple' ? Boot.simpleEditorConfig : Boot.editorConfig;
- // 单独处理 hoverbarKeys
- var newHoverbarKeys = __assign(__assign({}, (globalConfig.hoverbarKeys || {})), (config.hoverbarKeys || {}));
- var editor = dist$6.coreCreateEditor({
- selector: selector,
- config: __assign(__assign(__assign({}, globalConfig), config), { hoverbarKeys: newHoverbarKeys }),
- content: content,
- html: html,
- plugins: Boot.plugins,
- });
- return editor;
- }
- /**
- * 创建 toolbar 实例
- */
- function createToolbar(option) {
- var selector = option.selector, editor = option.editor, _a = option.config, config = _a === void 0 ? {} : _a, _b = option.mode, mode = _b === void 0 ? 'default' : _b;
- if (!selector) {
- throw new Error("Cannot find 'selector' when create toolbar");
- }
- var globalConfig = mode === 'simple' ? Boot.simpleToolbarConfig : Boot.toolbarConfig;
- var toolbar = dist$6.coreCreateToolbar(editor, {
- selector: selector,
- config: __assign(__assign({}, globalConfig), config),
- });
- return toolbar;
- }
- /**
- * @description editor entry
- * @author wangfupeng
- */
- var index = {};
- exports.Boot = Boot;
- exports.DomEditor = dist$6.DomEditor;
- exports.SlateEditor = Editor_1;
- exports.SlateElement = Element_1;
- exports.SlateLocation = Location_1;
- exports.SlateNode = Node_1;
- exports.SlatePath = Path_1;
- exports.SlatePoint = Point_1;
- exports.SlateRange = Range_1;
- exports.SlateText = Text_1;
- exports.SlateTransforms = Transforms_1;
- exports.Toolbar = dist$6.Toolbar;
- exports.createEditor = createEditor;
- exports.createToolbar = createToolbar;
- exports.createUploader = dist$6.createUploader;
- exports["default"] = index;
- exports.genModalButtonElems = dist$6.genModalButtonElems;
- exports.genModalInputElems = dist$6.genModalInputElems;
- exports.genModalTextareaElems = dist$6.genModalTextareaElems;
- exports.i18nAddResources = dist$6.i18nAddResources;
- exports.i18nChangeLanguage = dist$6.i18nChangeLanguage;
- exports.i18nGetResources = dist$6.i18nGetResources;
- exports.t = dist$6.t;
- Object.defineProperty(exports, '__esModule', { value: true });
- }));
|