| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201 |
- /**
- * Parse JavaScript SDK v3.5.1
- *
- * The source tree of this library can be found at
- * https://github.com/ParsePlatform/Parse-SDK-JS
- */
- (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Parse = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.track = track;
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- /**
- * Parse.Analytics provides an interface to Parse's logging and analytics
- * backend.
- *
- * @class Parse.Analytics
- * @static
- * @hideconstructor
- */
- /**
- * Tracks the occurrence of a custom event with additional dimensions.
- * Parse will store a data point at the time of invocation with the given
- * event name.
- *
- * Dimensions will allow segmentation of the occurrences of this custom
- * event. Keys and values should be {@code String}s, and will throw
- * otherwise.
- *
- * To track a user signup along with additional metadata, consider the
- * following:
- * <pre>
- * var dimensions = {
- * gender: 'm',
- * source: 'web',
- * dayType: 'weekend'
- * };
- * Parse.Analytics.track('signup', dimensions);
- * </pre>
- *
- * There is a default limit of 8 dimensions per event tracked.
- *
- * @function track
- * @name Parse.Analytics.track
- * @param {string} name The name of the custom event to report to Parse as
- * having happened.
- * @param {object} dimensions The dictionary of information by which to
- * segment this event.
- * @returns {Promise} A promise that is resolved when the round-trip
- * to the server completes.
- */
- function track(name
- /*: string*/
- , dimensions
- /*: { [key: string]: string }*/
- )
- /*: Promise*/
- {
- name = name || '';
- name = name.replace(/^\s*/, '');
- name = name.replace(/\s*$/, '');
- if (name.length === 0) {
- throw new TypeError('A name for the custom event must be provided');
- }
- for (var _key in dimensions) {
- if (typeof _key !== 'string' || typeof dimensions[_key] !== 'string') {
- throw new TypeError('track() dimensions expects keys and values of type "string".');
- }
- }
- return _CoreManager.default.getAnalyticsController().track(name, dimensions);
- }
- var DefaultController = {
- track: function (name, dimensions) {
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request('POST', 'events/' + name, {
- dimensions: dimensions
- });
- }
- };
- _CoreManager.default.setAnalyticsController(DefaultController);
- },{"./CoreManager":4,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],2:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ParseUser = _interopRequireDefault(_dereq_("./ParseUser"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow-weak
- */
- var uuidv4 = _dereq_('./uuid');
- var registered = false;
- /**
- * Provides utility functions for working with Anonymously logged-in users. <br />
- * Anonymous users have some unique characteristics:
- * <ul>
- * <li>Anonymous users don't need a user name or password.</li>
- * <ul>
- * <li>Once logged out, an anonymous user cannot be recovered.</li>
- * </ul>
- * <li>signUp converts an anonymous user to a standard user with the given username and password.</li>
- * <ul>
- * <li>Data associated with the anonymous user is retained.</li>
- * </ul>
- * <li>logIn switches users without converting the anonymous user.</li>
- * <ul>
- * <li>Data associated with the anonymous user will be lost.</li>
- * </ul>
- * <li>Service logIn (e.g. Facebook, Twitter) will attempt to convert
- * the anonymous user into a standard user by linking it to the service.</li>
- * <ul>
- * <li>If a user already exists that is linked to the service, it will instead switch to the existing user.</li>
- * </ul>
- * <li>Service linking (e.g. Facebook, Twitter) will convert the anonymous user
- * into a standard user by linking it to the service.</li>
- * </ul>
- *
- * @class Parse.AnonymousUtils
- * @static
- */
- var AnonymousUtils = {
- /**
- * Gets whether the user has their account linked to anonymous user.
- *
- * @function isLinked
- * @name Parse.AnonymousUtils.isLinked
- * @param {Parse.User} user User to check for.
- * The user must be logged in on this device.
- * @returns {boolean} <code>true</code> if the user has their account
- * linked to an anonymous user.
- * @static
- */
- isLinked: function (user
- /*: ParseUser*/
- ) {
- var provider = this._getAuthProvider();
- return user._isLinked(provider.getAuthType());
- },
- /**
- * Logs in a user Anonymously.
- *
- * @function logIn
- * @name Parse.AnonymousUtils.logIn
- * @param {object} options MasterKey / SessionToken.
- * @returns {Promise} Logged in user
- * @static
- */
- logIn: function (options
- /*:: ?: RequestOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- var provider = this._getAuthProvider();
- return _ParseUser.default.logInWith(provider.getAuthType(), provider.getAuthData(), options);
- },
- /**
- * Links Anonymous User to an existing PFUser.
- *
- * @function link
- * @name Parse.AnonymousUtils.link
- * @param {Parse.User} user User to link. This must be the current user.
- * @param {object} options MasterKey / SessionToken.
- * @returns {Promise} Linked with User
- * @static
- */
- link: function (user
- /*: ParseUser*/
- , options
- /*:: ?: RequestOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- var provider = this._getAuthProvider();
- return user.linkWith(provider.getAuthType(), provider.getAuthData(), options);
- },
- /**
- * Returns true if Authentication Provider has been registered for use.
- *
- * @function isRegistered
- * @name Parse.AnonymousUtils.isRegistered
- * @returns {boolean}
- * @static
- */
- isRegistered: function ()
- /*: boolean*/
- {
- return registered;
- },
- _getAuthProvider: function () {
- var provider = {
- restoreAuthentication: function () {
- return true;
- },
- getAuthType: function () {
- return 'anonymous';
- },
- getAuthData: function () {
- return {
- authData: {
- id: uuidv4()
- }
- };
- }
- };
- if (!registered) {
- _ParseUser.default._registerAuthenticationProvider(provider);
- registered = true;
- }
- return provider;
- }
- };
- var _default = AnonymousUtils;
- exports.default = _default;
- },{"./ParseUser":35,"./uuid":54,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],3:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getJobStatus = getJobStatus;
- exports.getJobsData = getJobsData;
- exports.run = run;
- exports.startJob = startJob;
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _decode = _interopRequireDefault(_dereq_("./decode"));
- var _encode = _interopRequireDefault(_dereq_("./encode"));
- var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
- var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- /**
- * Contains functions for calling and declaring
- * <a href="/docs/cloud_code_guide#functions">cloud functions</a>.
- * <p><strong><em>
- * Some functions are only available from Cloud Code.
- * </em></strong></p>
- *
- * @class Parse.Cloud
- * @static
- * @hideconstructor
- */
- /**
- * Makes a call to a cloud function.
- *
- * @function run
- * @name Parse.Cloud.run
- * @param {string} name The function name.
- * @param {object} data The parameters to send to the cloud function.
- * @param {object} options
- * @returns {Promise} A promise that will be resolved with the result
- * of the function.
- */
- function run(name
- /*: string*/
- , data
- /*: mixed*/
- , options
- /*: RequestOptions*/
- )
- /*: Promise<mixed>*/
- {
- options = options || {};
- if (typeof name !== 'string' || name.length === 0) {
- throw new TypeError('Cloud function name must be a string.');
- }
- var requestOptions = {};
- if (options.useMasterKey) {
- requestOptions.useMasterKey = options.useMasterKey;
- }
- if (options.sessionToken) {
- requestOptions.sessionToken = options.sessionToken;
- }
- if (options.context && (0, _typeof2.default)(options.context) === 'object') {
- requestOptions.context = options.context;
- }
- return _CoreManager.default.getCloudController().run(name, data, requestOptions);
- }
- /**
- * Gets data for the current set of cloud jobs.
- *
- * @function getJobsData
- * @name Parse.Cloud.getJobsData
- * @returns {Promise} A promise that will be resolved with the result
- * of the function.
- */
- function getJobsData()
- /*: Promise<Object>*/
- {
- return _CoreManager.default.getCloudController().getJobsData({
- useMasterKey: true
- });
- }
- /**
- * Starts a given cloud job, which will process asynchronously.
- *
- * @function startJob
- * @name Parse.Cloud.startJob
- * @param {string} name The function name.
- * @param {object} data The parameters to send to the cloud function.
- * @returns {Promise} A promise that will be resolved with the jobStatusId
- * of the job.
- */
- function startJob(name
- /*: string*/
- , data
- /*: mixed*/
- )
- /*: Promise<string>*/
- {
- if (typeof name !== 'string' || name.length === 0) {
- throw new TypeError('Cloud job name must be a string.');
- }
- return _CoreManager.default.getCloudController().startJob(name, data, {
- useMasterKey: true
- });
- }
- /**
- * Gets job status by Id
- *
- * @function getJobStatus
- * @name Parse.Cloud.getJobStatus
- * @param {string} jobStatusId The Id of Job Status.
- * @returns {Parse.Object} Status of Job.
- */
- function getJobStatus(jobStatusId
- /*: string*/
- )
- /*: Promise<ParseObject>*/
- {
- var query = new _ParseQuery.default('_JobStatus');
- return query.get(jobStatusId, {
- useMasterKey: true
- });
- }
- var DefaultController = {
- run: function (name, data, options
- /*: RequestOptions*/
- ) {
- var RESTController = _CoreManager.default.getRESTController();
- var payload = (0, _encode.default)(data, true);
- var request = RESTController.request('POST', 'functions/' + name, payload, options);
- return request.then(function (res) {
- if ((0, _typeof2.default)(res) === 'object' && (0, _keys.default)(res).length > 0 && !res.hasOwnProperty('result')) {
- throw new _ParseError.default(_ParseError.default.INVALID_JSON, 'The server returned an invalid response.');
- }
- var decoded = (0, _decode.default)(res);
- if (decoded && decoded.hasOwnProperty('result')) {
- return _promise.default.resolve(decoded.result);
- }
- return _promise.default.resolve(undefined);
- });
- },
- getJobsData: function (options
- /*: RequestOptions*/
- ) {
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request('GET', 'cloud_code/jobs/data', null, options);
- },
- startJob: function (name, data, options
- /*: RequestOptions*/
- ) {
- var RESTController = _CoreManager.default.getRESTController();
- var payload = (0, _encode.default)(data, true);
- return RESTController.request('POST', 'jobs/' + name, payload, options);
- }
- };
- _CoreManager.default.setCloudController(DefaultController);
- },{"./CoreManager":4,"./ParseError":22,"./ParseObject":27,"./ParseQuery":30,"./decode":45,"./encode":46,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],4:[function(_dereq_,module,exports){
- (function (process){(function (){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
- var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
- /*
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- /*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
- /*:: import type ParseFile from './ParseFile';*/
- /*:: import type { FileSource } from './ParseFile';*/
- /*:: import type { Op } from './ParseOp';*/
- /*:: import type ParseObject from './ParseObject';*/
- /*:: import type { QueryJSON } from './ParseQuery';*/
- /*:: import type ParseUser from './ParseUser';*/
- /*:: import type { AuthData } from './ParseUser';*/
- /*:: import type { PushData } from './Push';*/
- /*:: import type { RequestOptions, FullOptions } from './RESTController';*/
- /*:: type AnalyticsController = {
- track: (name: string, dimensions: { [key: string]: string }) => Promise,
- };*/
- /*:: type CloudController = {
- run: (name: string, data: mixed, options: RequestOptions) => Promise,
- getJobsData: (options: RequestOptions) => Promise,
- startJob: (name: string, data: mixed, options: RequestOptions) => Promise,
- };*/
- /*:: type ConfigController = {
- current: () => Promise,
- get: () => Promise,
- save: (attrs: { [key: string]: any }) => Promise,
- };*/
- /*:: type CryptoController = {
- encrypt: (obj: any, secretKey: string) => string,
- decrypt: (encryptedText: string, secretKey: any) => string,
- };*/
- /*:: type FileController = {
- saveFile: (name: string, source: FileSource, options: FullOptions) => Promise,
- saveBase64: (name: string, source: FileSource, options: FullOptions) => Promise,
- download: (uri: string) => Promise,
- };*/
- /*:: type InstallationController = {
- currentInstallationId: () => Promise,
- };*/
- /*:: type ObjectController = {
- fetch: (
- object: ParseObject | Array<ParseObject>,
- forceFetch: boolean,
- options: RequestOptions
- ) => Promise,
- save: (object: ParseObject | Array<ParseObject | ParseFile>, options: RequestOptions) => Promise,
- destroy: (object: ParseObject | Array<ParseObject>, options: RequestOptions) => Promise,
- };*/
- /*:: type ObjectStateController = {
- getState: (obj: any) => ?State,
- initializeState: (obj: any, initial?: State) => State,
- removeState: (obj: any) => ?State,
- getServerData: (obj: any) => AttributeMap,
- setServerData: (obj: any, attributes: AttributeMap) => void,
- getPendingOps: (obj: any) => Array<OpsMap>,
- setPendingOp: (obj: any, attr: string, op: ?Op) => void,
- pushPendingState: (obj: any) => void,
- popPendingState: (obj: any) => OpsMap,
- mergeFirstPendingState: (obj: any) => void,
- getObjectCache: (obj: any) => ObjectCache,
- estimateAttribute: (obj: any, attr: string) => mixed,
- estimateAttributes: (obj: any) => AttributeMap,
- commitServerChanges: (obj: any, changes: AttributeMap) => void,
- enqueueTask: (obj: any, task: () => Promise) => Promise,
- clearAllState: () => void,
- duplicateState: (source: any, dest: any) => void,
- };*/
- /*:: type PushController = {
- send: (data: PushData) => Promise,
- };*/
- /*:: type QueryController = {
- find: (className: string, params: QueryJSON, options: RequestOptions) => Promise,
- aggregate: (className: string, params: any, options: RequestOptions) => Promise,
- };*/
- /*:: type RESTController = {
- request: (method: string, path: string, data: mixed, options: RequestOptions) => Promise,
- ajax: (method: string, url: string, data: any, headers?: any, options: FullOptions) => Promise,
- };*/
- /*:: type SchemaController = {
- purge: (className: string) => Promise,
- get: (className: string, options: RequestOptions) => Promise,
- delete: (className: string, options: RequestOptions) => Promise,
- create: (className: string, params: any, options: RequestOptions) => Promise,
- update: (className: string, params: any, options: RequestOptions) => Promise,
- send(className: string, method: string, params: any, options: RequestOptions): Promise,
- };*/
- /*:: type SessionController = {
- getSession: (token: RequestOptions) => Promise,
- };*/
- /*:: type StorageController =
- | {
- async: 0,
- getItem: (path: string) => ?string,
- setItem: (path: string, value: string) => void,
- removeItem: (path: string) => void,
- getItemAsync?: (path: string) => Promise,
- setItemAsync?: (path: string, value: string) => Promise,
- removeItemAsync?: (path: string) => Promise,
- clear: () => void,
- }
- | {
- async: 1,
- getItem?: (path: string) => ?string,
- setItem?: (path: string, value: string) => void,
- removeItem?: (path: string) => void,
- getItemAsync: (path: string) => Promise,
- setItemAsync: (path: string, value: string) => Promise,
- removeItemAsync: (path: string) => Promise,
- clear: () => void,
- };*/
- /*:: type LocalDatastoreController = {
- fromPinWithName: (name: string) => ?any,
- pinWithName: (name: string, objects: any) => void,
- unPinWithName: (name: string) => void,
- getAllContents: () => ?any,
- clear: () => void,
- };*/
- /*:: type UserController = {
- setCurrentUser: (user: ParseUser) => Promise,
- currentUser: () => ?ParseUser,
- currentUserAsync: () => Promise,
- signUp: (user: ParseUser, attrs: AttributeMap, options: RequestOptions) => Promise,
- logIn: (user: ParseUser, options: RequestOptions) => Promise,
- become: (options: RequestOptions) => Promise,
- hydrate: (userJSON: AttributeMap) => Promise,
- logOut: (options: RequestOptions) => Promise,
- me: (options: RequestOptions) => Promise,
- requestPasswordReset: (email: string, options: RequestOptions) => Promise,
- updateUserOnDisk: (user: ParseUser) => Promise,
- upgradeToRevocableSession: (user: ParseUser, options: RequestOptions) => Promise,
- linkWith: (user: ParseUser, authData: AuthData) => Promise,
- removeUserFromDisk: () => Promise,
- verifyPassword: (username: string, password: string, options: RequestOptions) => Promise,
- requestEmailVerification: (email: string, options: RequestOptions) => Promise,
- };*/
- /*:: type HooksController = {
- get: (type: string, functionName?: string, triggerName?: string) => Promise,
- create: (hook: mixed) => Promise,
- delete: (hook: mixed) => Promise,
- update: (hook: mixed) => Promise,
- send: (method: string, path: string, body?: mixed) => Promise,
- };*/
- /*:: type WebSocketController = {
- onopen: () => void,
- onmessage: (message: any) => void,
- onclose: () => void,
- onerror: (error: any) => void,
- send: (data: any) => void,
- close: () => void,
- };*/
- /*:: type Config = {
- AnalyticsController?: AnalyticsController,
- CloudController?: CloudController,
- ConfigController?: ConfigController,
- FileController?: FileController,
- InstallationController?: InstallationController,
- ObjectController?: ObjectController,
- ObjectStateController?: ObjectStateController,
- PushController?: PushController,
- QueryController?: QueryController,
- RESTController?: RESTController,
- SchemaController?: SchemaController,
- SessionController?: SessionController,
- StorageController?: StorageController,
- LocalDatastoreController?: LocalDatastoreController,
- UserController?: UserController,
- HooksController?: HooksController,
- WebSocketController?: WebSocketController,
- };*/
- var config
- /*: Config & { [key: string]: mixed }*/
- = {
- // Defaults
- IS_NODE: typeof process !== 'undefined' && !!process.versions && !!process.versions.node && !process.versions.electron,
- REQUEST_ATTEMPT_LIMIT: 5,
- REQUEST_BATCH_SIZE: 20,
- REQUEST_HEADERS: {},
- SERVER_URL: 'https://api.parse.com/1',
- SERVER_AUTH_TYPE: null,
- SERVER_AUTH_TOKEN: null,
- LIVEQUERY_SERVER_URL: null,
- ENCRYPTED_KEY: null,
- VERSION: 'js' + "3.5.1",
- APPLICATION_ID: null,
- JAVASCRIPT_KEY: null,
- MASTER_KEY: null,
- USE_MASTER_KEY: false,
- PERFORM_USER_REWRITE: true,
- FORCE_REVOCABLE_SESSION: false,
- ENCRYPTED_USER: false,
- IDEMPOTENCY: false,
- ALLOW_CUSTOM_OBJECT_ID: false
- };
- function requireMethods(name
- /*: string*/
- , methods
- /*: Array<string>*/
- , controller
- /*: any*/
- ) {
- (0, _forEach.default)(methods).call(methods, function (func) {
- if (typeof controller[func] !== 'function') {
- var _context;
- throw new Error((0, _concat.default)(_context = "".concat(name, " must implement ")).call(_context, func, "()"));
- }
- });
- }
- module.exports = {
- get: function (key
- /*: string*/
- )
- /*: any*/
- {
- if (config.hasOwnProperty(key)) {
- return config[key];
- }
- throw new Error('Configuration key not found: ' + key);
- },
- set: function (key
- /*: string*/
- , value
- /*: any*/
- )
- /*: void*/
- {
- config[key] = value;
- },
- /* Specialized Controller Setters/Getters */
- setAnalyticsController: function (controller
- /*: AnalyticsController*/
- ) {
- requireMethods('AnalyticsController', ['track'], controller);
- config['AnalyticsController'] = controller;
- },
- getAnalyticsController: function ()
- /*: AnalyticsController*/
- {
- return config['AnalyticsController'];
- },
- setCloudController: function (controller
- /*: CloudController*/
- ) {
- requireMethods('CloudController', ['run', 'getJobsData', 'startJob'], controller);
- config['CloudController'] = controller;
- },
- getCloudController: function ()
- /*: CloudController*/
- {
- return config['CloudController'];
- },
- setConfigController: function (controller
- /*: ConfigController*/
- ) {
- requireMethods('ConfigController', ['current', 'get', 'save'], controller);
- config['ConfigController'] = controller;
- },
- getConfigController: function ()
- /*: ConfigController*/
- {
- return config['ConfigController'];
- },
- setCryptoController: function (controller
- /*: CryptoController*/
- ) {
- requireMethods('CryptoController', ['encrypt', 'decrypt'], controller);
- config['CryptoController'] = controller;
- },
- getCryptoController: function ()
- /*: CryptoController*/
- {
- return config['CryptoController'];
- },
- setFileController: function (controller
- /*: FileController*/
- ) {
- requireMethods('FileController', ['saveFile', 'saveBase64'], controller);
- config['FileController'] = controller;
- },
- getFileController: function ()
- /*: FileController*/
- {
- return config['FileController'];
- },
- setInstallationController: function (controller
- /*: InstallationController*/
- ) {
- requireMethods('InstallationController', ['currentInstallationId'], controller);
- config['InstallationController'] = controller;
- },
- getInstallationController: function ()
- /*: InstallationController*/
- {
- return config['InstallationController'];
- },
- setObjectController: function (controller
- /*: ObjectController*/
- ) {
- requireMethods('ObjectController', ['save', 'fetch', 'destroy'], controller);
- config['ObjectController'] = controller;
- },
- getObjectController: function ()
- /*: ObjectController*/
- {
- return config['ObjectController'];
- },
- setObjectStateController: function (controller
- /*: ObjectStateController*/
- ) {
- requireMethods('ObjectStateController', ['getState', 'initializeState', 'removeState', 'getServerData', 'setServerData', 'getPendingOps', 'setPendingOp', 'pushPendingState', 'popPendingState', 'mergeFirstPendingState', 'getObjectCache', 'estimateAttribute', 'estimateAttributes', 'commitServerChanges', 'enqueueTask', 'clearAllState'], controller);
- config['ObjectStateController'] = controller;
- },
- getObjectStateController: function ()
- /*: ObjectStateController*/
- {
- return config['ObjectStateController'];
- },
- setPushController: function (controller
- /*: PushController*/
- ) {
- requireMethods('PushController', ['send'], controller);
- config['PushController'] = controller;
- },
- getPushController: function ()
- /*: PushController*/
- {
- return config['PushController'];
- },
- setQueryController: function (controller
- /*: QueryController*/
- ) {
- requireMethods('QueryController', ['find', 'aggregate'], controller);
- config['QueryController'] = controller;
- },
- getQueryController: function ()
- /*: QueryController*/
- {
- return config['QueryController'];
- },
- setRESTController: function (controller
- /*: RESTController*/
- ) {
- requireMethods('RESTController', ['request', 'ajax'], controller);
- config['RESTController'] = controller;
- },
- getRESTController: function ()
- /*: RESTController*/
- {
- return config['RESTController'];
- },
- setSchemaController: function (controller
- /*: SchemaController*/
- ) {
- requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send', 'purge'], controller);
- config['SchemaController'] = controller;
- },
- getSchemaController: function ()
- /*: SchemaController*/
- {
- return config['SchemaController'];
- },
- setSessionController: function (controller
- /*: SessionController*/
- ) {
- requireMethods('SessionController', ['getSession'], controller);
- config['SessionController'] = controller;
- },
- getSessionController: function ()
- /*: SessionController*/
- {
- return config['SessionController'];
- },
- setStorageController: function (controller
- /*: StorageController*/
- ) {
- if (controller.async) {
- requireMethods('An async StorageController', ['getItemAsync', 'setItemAsync', 'removeItemAsync', 'getAllKeysAsync'], controller);
- } else {
- requireMethods('A synchronous StorageController', ['getItem', 'setItem', 'removeItem', 'getAllKeys'], controller);
- }
- config['StorageController'] = controller;
- },
- setLocalDatastoreController: function (controller
- /*: LocalDatastoreController*/
- ) {
- requireMethods('LocalDatastoreController', ['pinWithName', 'fromPinWithName', 'unPinWithName', 'getAllContents', 'clear'], controller);
- config['LocalDatastoreController'] = controller;
- },
- getLocalDatastoreController: function ()
- /*: LocalDatastoreController*/
- {
- return config['LocalDatastoreController'];
- },
- setLocalDatastore: function (store
- /*: any*/
- ) {
- config['LocalDatastore'] = store;
- },
- getLocalDatastore: function () {
- return config['LocalDatastore'];
- },
- getStorageController: function ()
- /*: StorageController*/
- {
- return config['StorageController'];
- },
- setAsyncStorage: function (storage
- /*: any*/
- ) {
- config['AsyncStorage'] = storage;
- },
- getAsyncStorage: function () {
- return config['AsyncStorage'];
- },
- setWebSocketController: function (controller
- /*: WebSocketController*/
- ) {
- config['WebSocketController'] = controller;
- },
- getWebSocketController: function ()
- /*: WebSocketController*/
- {
- return config['WebSocketController'];
- },
- setUserController: function (controller
- /*: UserController*/
- ) {
- requireMethods('UserController', ['setCurrentUser', 'currentUser', 'currentUserAsync', 'signUp', 'logIn', 'become', 'logOut', 'me', 'requestPasswordReset', 'upgradeToRevocableSession', 'requestEmailVerification', 'verifyPassword', 'linkWith'], controller);
- config['UserController'] = controller;
- },
- getUserController: function ()
- /*: UserController*/
- {
- return config['UserController'];
- },
- setLiveQueryController: function (controller
- /*: any*/
- ) {
- requireMethods('LiveQueryController', ['setDefaultLiveQueryClient', 'getDefaultLiveQueryClient', '_clearCachedDefaultClient'], controller);
- config['LiveQueryController'] = controller;
- },
- getLiveQueryController: function ()
- /*: any*/
- {
- return config['LiveQueryController'];
- },
- setHooksController: function (controller
- /*: HooksController*/
- ) {
- requireMethods('HooksController', ['create', 'get', 'update', 'remove'], controller);
- config['HooksController'] = controller;
- },
- getHooksController: function ()
- /*: HooksController*/
- {
- return config['HooksController'];
- }
- };
- }).call(this)}).call(this,_dereq_('_process'))
- },{"@babel/runtime-corejs3/core-js-stable/instance/concat":58,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"_process":145}],5:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
- var AES;
- var ENC;
- AES = _dereq_('crypto-js/aes');
- ENC = _dereq_('crypto-js/enc-utf8');
- var CryptoJS;
- var CryptoController = {
- encrypt: function (obj
- /*: any*/
- , secretKey
- /*: string*/
- )
- /*: ?string*/
- {
- var encrypted = AES.encrypt((0, _stringify.default)(obj), secretKey);
- return encrypted.toString();
- },
- decrypt: function (encryptedText
- /*: string*/
- , secretKey
- /*: string*/
- )
- /*: ?string*/
- {
- var decryptedStr = AES.decrypt(encryptedText, secretKey).toString(ENC);
- return decryptedStr;
- }
- };
- module.exports = CryptoController;
- },{"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"crypto-js/aes":596,"crypto-js/enc-utf8":600}],6:[function(_dereq_,module,exports){
- "use strict";
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * This is a simple wrapper to unify EventEmitter implementations across platforms.
- */
- module.exports = _dereq_('events').EventEmitter;
- var EventEmitter;
- },{"events":605}],7:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
- var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
- var _Promise = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
- var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
- var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
- var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
- var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
- var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
- var _find = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find"));
- var _setInterval2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/set-interval"));
- var _toConsumableArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/toConsumableArray"));
- var _findIndex = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
- var _splice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/splice"));
- var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
- var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
- var _Storage = _interopRequireDefault(_dereq_("./Storage"));
- function _regeneratorRuntime() {
- "use strict";
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
- _regeneratorRuntime = function () {
- return exports;
- };
- var exports = {},
- Op = Object.prototype,
- hasOwn = Op.hasOwnProperty,
- $Symbol = "function" == typeof _Symbol ? _Symbol : {},
- iteratorSymbol = $Symbol.iterator || "@@iterator",
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- return _Object$defineProperty(obj, key, {
- value: value,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }), obj[key];
- }
- try {
- define({}, "");
- } catch (err) {
- define = function (obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
- generator = _Object$create(protoGenerator.prototype),
- context = new Context(tryLocsList || []);
- return generator._invoke = function (innerFn, self, context) {
- var state = "suspendedStart";
- return function (method, arg) {
- if ("executing" === state) throw new Error("Generator is already running");
- if ("completed" === state) {
- if ("throw" === method) throw arg;
- return doneResult();
- }
- for (context.method = method, context.arg = arg;;) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
- if ("suspendedStart" === state) throw state = "completed", context.arg;
- context.dispatchException(context.arg);
- } else "return" === context.method && context.abrupt("return", context.arg);
- state = "executing";
- var record = tryCatch(innerFn, self, context);
- if ("normal" === record.type) {
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
- return {
- value: record.arg,
- done: context.done
- };
- }
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
- }
- };
- }(innerFn, self, context), generator;
- }
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- exports.wrap = wrap;
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = _Object$getPrototypeOf,
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
- function defineIteratorMethods(prototype) {
- var _context9;
- _forEachInstanceProperty(_context9 = ["next", "throw", "return"]).call(_context9, function (method) {
- define(prototype, method, function (arg) {
- return this._invoke(method, arg);
- });
- });
- }
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if ("throw" !== record.type) {
- var result = record.arg,
- value = result.value;
- return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
- result.value = unwrapped, resolve(result);
- }, function (error) {
- return invoke("throw", error, resolve, reject);
- });
- }
- reject(record.arg);
- }
- var previousPromise;
- this._invoke = function (method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (undefined === method) {
- if (context.delegate = null, "throw" === context.method) {
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
- var info = record.arg;
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
- }
- function pushTryEntry(locs) {
- var entry = {
- tryLoc: locs[0]
- };
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal", delete record.arg, entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{
- tryLoc: "root"
- }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
- }
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) return iteratorMethod.call(iterable);
- if ("function" == typeof iterable.next) return iterable;
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- for (; ++i < iterable.length;) {
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
- }
- return next.value = undefined, next.done = !0, next;
- };
- return next.next = next;
- }
- }
- return {
- next: doneResult
- };
- }
- function doneResult() {
- return {
- value: undefined,
- done: !0
- };
- }
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
- var ctor = "function" == typeof genFun && genFun.constructor;
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
- }, exports.mark = function (genFun) {
- return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
- }, exports.awrap = function (arg) {
- return {
- __await: arg
- };
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- void 0 === PromiseImpl && (PromiseImpl = _Promise);
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
- return this;
- }), define(Gp, "toString", function () {
- return "[object Generator]";
- }), exports.keys = function (object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- return _reverseInstanceProperty(keys).call(keys), function next() {
- for (; keys.length;) {
- var key = keys.pop();
- if (key in object) return next.value = key, next.done = !1, next;
- }
- return next.done = !0, next;
- };
- }, exports.values = values, Context.prototype = {
- constructor: Context,
- reset: function (skipTempReset) {
- var _context10;
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context10 = this.tryEntries).call(_context10, resetTryEntry), !skipTempReset) for (var name in this) {
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
- }
- },
- stop: function () {
- this.done = !0;
- var rootRecord = this.tryEntries[0].completion;
- if ("throw" === rootRecord.type) throw rootRecord.arg;
- return this.rval;
- },
- dispatchException: function (exception) {
- if (this.done) throw exception;
- var context = this;
- function handle(loc, caught) {
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i],
- record = entry.completion;
- if ("root" === entry.tryLoc) return handle("end");
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc"),
- hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- } else {
- if (!hasFinally) throw new Error("try statement without catch or finally");
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- }
- }
- }
- },
- abrupt: function (type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
- var record = finallyEntry ? finallyEntry.completion : {};
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
- },
- complete: function (record, afterLoc) {
- if ("throw" === record.type) throw record.arg;
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
- },
- finish: function (finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
- }
- },
- catch: function (tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if ("throw" === record.type) {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function (iterable, resultName, nextLoc) {
- return this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
- }
- }, exports;
- }
- var QUEUE_KEY = 'Parse/Eventually/Queue';
- var queueCache = [];
- var dirtyCache = true;
- var polling = undefined;
- /**
- * Provides utility functions to queue objects that will be
- * saved to the server at a later date.
- *
- * @class Parse.EventuallyQueue
- * @static
- */
- var EventuallyQueue = {
- /**
- * Add object to queue with save operation.
- *
- * @function save
- * @name Parse.EventuallyQueue.save
- * @param {ParseObject} object Parse.Object to be saved eventually
- * @param {object} [serverOptions] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Object.html#save Parse.Object.save} options.
- * @returns {Promise} A promise that is fulfilled if object is added to queue.
- * @static
- * @see Parse.Object#saveEventually
- */
- save: function (object
- /*: ParseObject*/
- )
- /*: Promise*/
- {
- var serverOptions
- /*: SaveOptions*/
- = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- return this.enqueue('save', object, serverOptions);
- },
- /**
- * Add object to queue with save operation.
- *
- * @function destroy
- * @name Parse.EventuallyQueue.destroy
- * @param {ParseObject} object Parse.Object to be destroyed eventually
- * @param {object} [serverOptions] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Object.html#destroy Parse.Object.destroy} options
- * @returns {Promise} A promise that is fulfilled if object is added to queue.
- * @static
- * @see Parse.Object#destroyEventually
- */
- destroy: function (object
- /*: ParseObject*/
- )
- /*: Promise*/
- {
- var serverOptions
- /*: RequestOptions*/
- = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- return this.enqueue('destroy', object, serverOptions);
- },
- /**
- * Generate unique identifier to avoid duplicates and maintain previous state.
- *
- * @param {string} action save / destroy
- * @param {object} object Parse.Object to be queued
- * @returns {string}
- * @static
- * @ignore
- */
- generateQueueId: function (action
- /*: string*/
- , object
- /*: ParseObject*/
- )
- /*: string*/
- {
- object._getId();
- var className = object.className,
- id = object.id,
- _localId = object._localId;
- var uniqueId = object.get('hash') || _localId;
- return [action, className, id, uniqueId].join('_');
- },
- /**
- * Build queue object and add to queue.
- *
- * @param {string} action save / destroy
- * @param {object} object Parse.Object to be queued
- * @param {object} [serverOptions]
- * @returns {Promise} A promise that is fulfilled if object is added to queue.
- * @static
- * @ignore
- */
- enqueue: function (action
- /*: string*/
- , object
- /*: ParseObject*/
- , serverOptions
- /*: SaveOptions | RequestOptions*/
- )
- /*: Promise*/
- {
- var _this = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
- var queueData, queueId, index, prop;
- return _regeneratorRuntime().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _context.next = 2;
- return _this.getQueue();
- case 2:
- queueData = _context.sent;
- queueId = _this.generateQueueId(action, object);
- index = _this.queueItemExists(queueData, queueId);
- if (index > -1) {
- // Add cached values to new object if they don't exist
- for (prop in queueData[index].object) {
- if (typeof object.get(prop) === 'undefined') {
- object.set(prop, queueData[index].object[prop]);
- }
- }
- } else {
- index = queueData.length;
- }
- queueData[index] = {
- queueId: queueId,
- action: action,
- object: object.toJSON(),
- serverOptions: serverOptions,
- id: object.id,
- className: object.className,
- hash: object.get('hash'),
- createdAt: new Date()
- };
- return _context.abrupt("return", _this.setQueue(queueData));
- case 8:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
- }))();
- },
- store: function store(data) {
- return _Storage.default.setItemAsync(QUEUE_KEY, (0, _stringify.default)(data));
- },
- load: function load() {
- return _Storage.default.getItemAsync(QUEUE_KEY);
- },
- /**
- * Sets the in-memory queue from local storage and returns.
- *
- * @function getQueue
- * @name Parse.EventuallyQueue.getQueue
- * @returns {Promise<Array>}
- * @static
- */
- getQueue: function getQueue()
- /*: Promise<Array>*/
- {
- var _this2 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- if (!dirtyCache) {
- _context2.next = 10;
- break;
- }
- _context2.t0 = JSON;
- _context2.next = 4;
- return _this2.load();
- case 4:
- _context2.t1 = _context2.sent;
- if (_context2.t1) {
- _context2.next = 7;
- break;
- }
- _context2.t1 = '[]';
- case 7:
- _context2.t2 = _context2.t1;
- queueCache = _context2.t0.parse.call(_context2.t0, _context2.t2);
- dirtyCache = false;
- case 10:
- return _context2.abrupt("return", queueCache);
- case 11:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
- }))();
- },
- /**
- * Saves the queue to local storage
- *
- * @param {Queue} queue Queue containing Parse.Object data.
- * @returns {Promise} A promise that is fulfilled when queue is stored.
- * @static
- * @ignore
- */
- setQueue: function setQueue(queue
- /*: Queue*/
- )
- /*: Promise<void>*/
- {
- queueCache = queue;
- return this.store(queueCache);
- },
- /**
- * Removes Parse.Object data from queue.
- *
- * @param {string} queueId Unique identifier for Parse.Object data.
- * @returns {Promise} A promise that is fulfilled when queue is stored.
- * @static
- * @ignore
- */
- remove: function remove(queueId
- /*: string*/
- )
- /*: Promise<void>*/
- {
- var _this3 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
- var queueData, index;
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- _context3.next = 2;
- return _this3.getQueue();
- case 2:
- queueData = _context3.sent;
- index = _this3.queueItemExists(queueData, queueId);
- if (!(index > -1)) {
- _context3.next = 8;
- break;
- }
- (0, _splice.default)(queueData).call(queueData, index, 1);
- _context3.next = 8;
- return _this3.setQueue(queueData);
- case 8:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3);
- }))();
- },
- /**
- * Removes all objects from queue.
- *
- * @function clear
- * @name Parse.EventuallyQueue.clear
- * @returns {Promise} A promise that is fulfilled when queue is cleared.
- * @static
- */
- clear: function clear()
- /*: Promise*/
- {
- queueCache = [];
- return this.store([]);
- },
- /**
- * Return the index of a queueId in the queue. Returns -1 if not found.
- *
- * @param {Queue} queue Queue containing Parse.Object data.
- * @param {string} queueId Unique identifier for Parse.Object data.
- * @returns {number}
- * @static
- * @ignore
- */
- queueItemExists: function queueItemExists(queue
- /*: Queue*/
- , queueId
- /*: string*/
- )
- /*: number*/
- {
- return (0, _findIndex.default)(queue).call(queue, function (data) {
- return data.queueId === queueId;
- });
- },
- /**
- * Return the number of objects in the queue.
- *
- * @function length
- * @name Parse.EventuallyQueue.length
- * @returns {number}
- * @static
- */
- length: function length()
- /*: number*/
- {
- var _this4 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
- var queueData;
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- _context4.next = 2;
- return _this4.getQueue();
- case 2:
- queueData = _context4.sent;
- return _context4.abrupt("return", queueData.length);
- case 4:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4);
- }))();
- },
- /**
- * Sends the queue to the server.
- *
- * @function sendQueue
- * @name Parse.EventuallyQueue.sendQueue
- * @returns {Promise<boolean>} Returns true if queue was sent successfully.
- * @static
- */
- sendQueue: function sendQueue()
- /*: Promise<boolean>*/
- {
- var _this5 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
- var queue, queueData, i, queueObject, id, hash, className, ObjectType;
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- _context5.next = 2;
- return _this5.getQueue();
- case 2:
- queue = _context5.sent;
- queueData = (0, _toConsumableArray2.default)(queue);
- if (!(queueData.length === 0)) {
- _context5.next = 6;
- break;
- }
- return _context5.abrupt("return", false);
- case 6:
- i = 0;
- case 7:
- if (!(i < queueData.length)) {
- _context5.next = 26;
- break;
- }
- queueObject = queueData[i];
- id = queueObject.id, hash = queueObject.hash, className = queueObject.className;
- ObjectType = _ParseObject.default.extend(className);
- if (!id) {
- _context5.next = 16;
- break;
- }
- _context5.next = 14;
- return _this5.process.byId(ObjectType, queueObject);
- case 14:
- _context5.next = 23;
- break;
- case 16:
- if (!hash) {
- _context5.next = 21;
- break;
- }
- _context5.next = 19;
- return _this5.process.byHash(ObjectType, queueObject);
- case 19:
- _context5.next = 23;
- break;
- case 21:
- _context5.next = 23;
- return _this5.process.create(ObjectType, queueObject);
- case 23:
- i += 1;
- _context5.next = 7;
- break;
- case 26:
- return _context5.abrupt("return", true);
- case 27:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5);
- }))();
- },
- /**
- * Build queue object and add to queue.
- *
- * @param {ParseObject} object Parse.Object to be processed
- * @param {QueueObject} queueObject Parse.Object data from the queue
- * @returns {Promise} A promise that is fulfilled when operation is performed.
- * @static
- * @ignore
- */
- sendQueueCallback: function sendQueueCallback(object
- /*: ParseObject*/
- , queueObject
- /*: QueueObject*/
- )
- /*: Promise<void>*/
- {
- var _this6 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- if (object) {
- _context6.next = 2;
- break;
- }
- return _context6.abrupt("return", _this6.remove(queueObject.queueId));
- case 2:
- _context6.t0 = queueObject.action;
- _context6.next = _context6.t0 === 'save' ? 5 : _context6.t0 === 'destroy' ? 20 : 33;
- break;
- case 5:
- if (!(typeof object.updatedAt !== 'undefined' && object.updatedAt > new Date(queueObject.object.createdAt))) {
- _context6.next = 7;
- break;
- }
- return _context6.abrupt("return", _this6.remove(queueObject.queueId));
- case 7:
- _context6.prev = 7;
- _context6.next = 10;
- return object.save(queueObject.object, queueObject.serverOptions);
- case 10:
- _context6.next = 12;
- return _this6.remove(queueObject.queueId);
- case 12:
- _context6.next = 19;
- break;
- case 14:
- _context6.prev = 14;
- _context6.t1 = _context6["catch"](7);
- if (!(_context6.t1.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
- _context6.next = 19;
- break;
- }
- _context6.next = 19;
- return _this6.remove(queueObject.queueId);
- case 19:
- return _context6.abrupt("break", 33);
- case 20:
- _context6.prev = 20;
- _context6.next = 23;
- return object.destroy(queueObject.serverOptions);
- case 23:
- _context6.next = 25;
- return _this6.remove(queueObject.queueId);
- case 25:
- _context6.next = 32;
- break;
- case 27:
- _context6.prev = 27;
- _context6.t2 = _context6["catch"](20);
- if (!(_context6.t2.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
- _context6.next = 32;
- break;
- }
- _context6.next = 32;
- return _this6.remove(queueObject.queueId);
- case 32:
- return _context6.abrupt("break", 33);
- case 33:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6, null, [[7, 14], [20, 27]]);
- }))();
- },
- /**
- * Start polling server for network connection.
- * Will send queue if connection is established.
- *
- * @function poll
- * @name Parse.EventuallyQueue.poll
- * @param [ms] Milliseconds to ping the server. Default 2000ms
- * @static
- */
- poll: function poll() {
- var _this7 = this;
- var ms
- /*: number*/
- = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2000;
- if (polling) {
- return;
- }
- polling = (0, _setInterval2.default)(function () {
- var RESTController = _CoreManager.default.getRESTController();
- RESTController.request('GET', 'health').then(function (_ref) {
- var status = _ref.status;
- if (status === 'ok') {
- _this7.stopPoll();
- return _this7.sendQueue();
- }
- }).catch(function (e) {
- return e;
- });
- }, ms);
- },
- /**
- * Turns off polling.
- *
- * @function stopPoll
- * @name Parse.EventuallyQueue.stopPoll
- * @static
- */
- stopPoll: function stopPoll() {
- clearInterval(polling);
- polling = undefined;
- },
- /**
- * Return true if pinging the server.
- *
- * @function isPolling
- * @name Parse.EventuallyQueue.isPolling
- * @returns {boolean}
- * @static
- */
- isPolling: function isPolling()
- /*: boolean*/
- {
- return !!polling;
- },
- _setPolling: function _setPolling(flag
- /*: boolean*/
- ) {
- polling = flag;
- },
- process: {
- create: function create(ObjectType, queueObject) {
- var object = new ObjectType();
- return EventuallyQueue.sendQueueCallback(object, queueObject);
- },
- byId: function byId(ObjectType, queueObject) {
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
- var sessionToken, query, results;
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- sessionToken = queueObject.serverOptions.sessionToken;
- query = new _ParseQuery.default(ObjectType);
- query.equalTo('objectId', queueObject.id);
- _context7.next = 5;
- return (0, _find.default)(query).call(query, {
- sessionToken: sessionToken
- });
- case 5:
- results = _context7.sent;
- return _context7.abrupt("return", EventuallyQueue.sendQueueCallback(results[0], queueObject));
- case 7:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee7);
- }))();
- },
- byHash: function byHash(ObjectType, queueObject) {
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
- var sessionToken, query, results;
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
- while (1) {
- switch (_context8.prev = _context8.next) {
- case 0:
- sessionToken = queueObject.serverOptions.sessionToken;
- query = new _ParseQuery.default(ObjectType);
- query.equalTo('hash', queueObject.hash);
- _context8.next = 5;
- return (0, _find.default)(query).call(query, {
- sessionToken: sessionToken
- });
- case 5:
- results = _context8.sent;
- if (!(results.length > 0)) {
- _context8.next = 8;
- break;
- }
- return _context8.abrupt("return", EventuallyQueue.sendQueueCallback(results[0], queueObject));
- case 8:
- return _context8.abrupt("return", EventuallyQueue.process.create(ObjectType, queueObject));
- case 9:
- case "end":
- return _context8.stop();
- }
- }
- }, _callee8);
- }))();
- }
- }
- };
- module.exports = EventuallyQueue;
- },{"./CoreManager":4,"./ParseObject":27,"./ParseQuery":30,"./Storage":39,"@babel/runtime-corejs3/core-js-stable/instance/find":63,"@babel/runtime-corejs3/core-js-stable/instance/find-index":62,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/reverse":70,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/instance/splice":73,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/object/create":80,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":88,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":90,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/set-interval":94,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/helpers/asyncToGenerator":120,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/toConsumableArray":139,"@babel/runtime-corejs3/helpers/typeof":140}],8:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ParseUser = _interopRequireDefault(_dereq_("./ParseUser"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow-weak
- */
- /* global FB */
- var initialized = false;
- var requestedPermissions;
- var initOptions;
- var provider = {
- authenticate: function (options) {
- var _this = this;
- if (typeof FB === 'undefined') {
- options.error(this, 'Facebook SDK not found.');
- }
- FB.login(function (response) {
- if (response.authResponse) {
- if (options.success) {
- options.success(_this, {
- id: response.authResponse.userID,
- access_token: response.authResponse.accessToken,
- expiration_date: new Date(response.authResponse.expiresIn * 1000 + new Date().getTime()).toJSON()
- });
- }
- } else {
- if (options.error) {
- options.error(_this, response);
- }
- }
- }, {
- scope: requestedPermissions
- });
- },
- restoreAuthentication: function (authData) {
- if (authData) {
- var newOptions = {};
- if (initOptions) {
- for (var key in initOptions) {
- newOptions[key] = initOptions[key];
- }
- } // Suppress checks for login status from the browser.
- newOptions.status = false; // If the user doesn't match the one known by the FB SDK, log out.
- // Most of the time, the users will match -- it's only in cases where
- // the FB SDK knows of a different user than the one being restored
- // from a Parse User that logged in with username/password.
- var existingResponse = FB.getAuthResponse();
- if (existingResponse && existingResponse.userID !== authData.id) {
- FB.logout();
- }
- FB.init(newOptions);
- }
- return true;
- },
- getAuthType: function () {
- return 'facebook';
- },
- deauthenticate: function () {
- this.restoreAuthentication(null);
- }
- };
- /**
- * Provides a set of utilities for using Parse with Facebook.
- *
- * @class Parse.FacebookUtils
- * @static
- * @hideconstructor
- */
- var FacebookUtils = {
- /**
- * Initializes Parse Facebook integration. Call this function after you
- * have loaded the Facebook Javascript SDK with the same parameters
- * as you would pass to<code>
- * <a href=
- * "https://developers.facebook.com/docs/reference/javascript/FB.init/">
- * FB.init()</a></code>. Parse.FacebookUtils will invoke FB.init() for you
- * with these arguments.
- *
- * @function init
- * @name Parse.FacebookUtils.init
- * @param {object} options Facebook options argument as described here:
- * <a href=
- * "https://developers.facebook.com/docs/reference/javascript/FB.init/">
- * FB.init()</a>. The status flag will be coerced to 'false' because it
- * interferes with Parse Facebook integration. Call FB.getLoginStatus()
- * explicitly if this behavior is required by your application.
- */
- init: function (options) {
- if (typeof FB === 'undefined') {
- throw new Error('The Facebook JavaScript SDK must be loaded before calling init.');
- }
- initOptions = {};
- if (options) {
- for (var key in options) {
- initOptions[key] = options[key];
- }
- }
- if (initOptions.status && typeof console !== 'undefined') {
- var warn = console.warn || console.log || function () {}; // eslint-disable-line no-console
- warn.call(console, 'The "status" flag passed into' + ' FB.init, when set to true, can interfere with Parse Facebook' + ' integration, so it has been suppressed. Please call' + ' FB.getLoginStatus() explicitly if you require this behavior.');
- }
- initOptions.status = false;
- FB.init(initOptions);
- _ParseUser.default._registerAuthenticationProvider(provider);
- initialized = true;
- },
- /**
- * Gets whether the user has their account linked to Facebook.
- *
- * @function isLinked
- * @name Parse.FacebookUtils.isLinked
- * @param {Parse.User} user User to check for a facebook link.
- * The user must be logged in on this device.
- * @returns {boolean} <code>true</code> if the user has their account
- * linked to Facebook.
- */
- isLinked: function (user) {
- return user._isLinked('facebook');
- },
- /**
- * Logs in a user using Facebook. This method delegates to the Facebook
- * SDK to authenticate the user, and then automatically logs in (or
- * creates, in the case where it is a new user) a Parse.User.
- *
- * Standard API:
- *
- * <code>logIn(permission: string, authData: Object);</code>
- *
- * Advanced API: Used for handling your own oAuth tokens
- * {@link https://docs.parseplatform.org/rest/guide/#linking-users}
- *
- * <code>logIn(authData: Object, options?: Object);</code>
- *
- * @function logIn
- * @name Parse.FacebookUtils.logIn
- * @param {(string | object)} permissions The permissions required for Facebook
- * log in. This is a comma-separated string of permissions.
- * Alternatively, supply a Facebook authData object as described in our
- * REST API docs if you want to handle getting facebook auth tokens
- * yourself.
- * @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string
- * @returns {Promise}
- */
- logIn: function (permissions, options) {
- if (!permissions || typeof permissions === 'string') {
- if (!initialized) {
- throw new Error('You must initialize FacebookUtils before calling logIn.');
- }
- requestedPermissions = permissions;
- return _ParseUser.default.logInWith('facebook', options);
- }
- return _ParseUser.default.logInWith('facebook', {
- authData: permissions
- }, options);
- },
- /**
- * Links Facebook to an existing PFUser. This method delegates to the
- * Facebook SDK to authenticate the user, and then automatically links
- * the account to the Parse.User.
- *
- * Standard API:
- *
- * <code>link(user: Parse.User, permission: string, authData?: Object);</code>
- *
- * Advanced API: Used for handling your own oAuth tokens
- * {@link https://docs.parseplatform.org/rest/guide/#linking-users}
- *
- * <code>link(user: Parse.User, authData: Object, options?: FullOptions);</code>
- *
- * @function link
- * @name Parse.FacebookUtils.link
- * @param {Parse.User} user User to link to Facebook. This must be the
- * current user.
- * @param {(string | object)} permissions The permissions required for Facebook
- * log in. This is a comma-separated string of permissions.
- * Alternatively, supply a Facebook authData object as described in our
- * REST API docs if you want to handle getting facebook auth tokens
- * yourself.
- * @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string
- * @returns {Promise}
- */
- link: function (user, permissions, options) {
- if (!permissions || typeof permissions === 'string') {
- if (!initialized) {
- throw new Error('You must initialize FacebookUtils before calling link.');
- }
- requestedPermissions = permissions;
- return user.linkWith('facebook', options);
- }
- return user.linkWith('facebook', {
- authData: permissions
- }, options);
- },
- /**
- * Unlinks the Parse.User from a Facebook account.
- *
- * @function unlink
- * @name Parse.FacebookUtils.unlink
- * @param {Parse.User} user User to unlink from Facebook. This must be the
- * current user.
- * @param {object} options Standard options object with success and error
- * callbacks.
- * @returns {Promise}
- */
- unlink: function (user, options) {
- if (!initialized) {
- throw new Error('You must initialize FacebookUtils before calling unlink.');
- }
- return user._unlinkFrom('facebook', options);
- },
- // Used for testing purposes
- _getAuthProvider: function () {
- return provider;
- }
- };
- var _default = FacebookUtils;
- exports.default = _default;
- },{"./ParseUser":35,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],9:[function(_dereq_,module,exports){
- "use strict";
- var _keysInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/keys");
- var _idbKeyval = _dereq_("idb-keyval");
- /**
- * @flow
- */
- /* global window */
- if (typeof window !== 'undefined' && window.indexedDB) {
- var ParseStore = (0, _idbKeyval.createStore)('parseDB', 'parseStore');
- var IndexedDBStorageController = {
- async: 1,
- getItemAsync: function (path
- /*: string*/
- ) {
- return (0, _idbKeyval.get)(path, ParseStore);
- },
- setItemAsync: function (path
- /*: string*/
- , value
- /*: string*/
- ) {
- return (0, _idbKeyval.set)(path, value, ParseStore);
- },
- removeItemAsync: function (path
- /*: string*/
- ) {
- return (0, _idbKeyval.del)(path, ParseStore);
- },
- getAllKeysAsync: function () {
- return (0, _keysInstanceProperty(_idbKeyval))(ParseStore);
- },
- clear: function () {
- return (0, _idbKeyval.clear)(ParseStore);
- }
- };
- module.exports = IndexedDBStorageController;
- } else {
- // IndexedDB not supported
- module.exports = undefined;
- }
- },{"@babel/runtime-corejs3/core-js-stable/instance/keys":67,"idb-keyval":606}],10:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _Storage = _interopRequireDefault(_dereq_("./Storage"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- var uuidv4 = _dereq_('./uuid');
- var iidCache = null;
- var InstallationController = {
- currentInstallationId: function ()
- /*: Promise<string>*/
- {
- if (typeof iidCache === 'string') {
- return _promise.default.resolve(iidCache);
- }
- var path = _Storage.default.generatePath('installationId');
- return _Storage.default.getItemAsync(path).then(function (iid) {
- if (!iid) {
- iid = uuidv4();
- return _Storage.default.setItemAsync(path, iid).then(function () {
- iidCache = iid;
- return iid;
- });
- }
- iidCache = iid;
- return iid;
- });
- },
- _clearCache: function () {
- iidCache = null;
- },
- _setInstallationIdCache: function (iid
- /*: string*/
- ) {
- iidCache = iid;
- }
- };
- module.exports = InstallationController;
- },{"./Storage":39,"./uuid":54,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],11:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Array$isArray = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
- var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
- var _Array$from = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
- var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
- var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _bind = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/bind"));
- var _setTimeout2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/set-timeout"));
- var _values = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/values"));
- var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
- var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
- var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/keys"));
- var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/map"));
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _assertThisInitialized2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/assertThisInitialized"));
- var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
- var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
- var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _EventEmitter2 = _interopRequireDefault(_dereq_("./EventEmitter"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- var _LiveQuerySubscription = _interopRequireDefault(_dereq_("./LiveQuerySubscription"));
- var _promiseUtils = _dereq_("./promiseUtils");
- function _createForOfIteratorHelper(o, allowArrayLike) {
- var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || 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 () {};
- return {
- s: F,
- n: function () {
- if (i >= o.length) return {
- done: true
- };
- return {
- done: false,
- value: o[i++]
- };
- },
- e: function (_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 () {
- it = it.call(o);
- },
- n: function () {
- var step = it.next();
- normalCompletion = step.done;
- return step;
- },
- e: function (_e2) {
- didErr = true;
- err = _e2;
- },
- f: function () {
- try {
- if (!normalCompletion && it.return != null) it.return();
- } finally {
- if (didErr) throw err;
- }
- }
- };
- }
- function _unsupportedIterableToArray(o, minLen) {
- var _context6;
- if (!o) return;
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
- var n = _sliceInstanceProperty(_context6 = Object.prototype.toString.call(o)).call(_context6, 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;
- }
- function _createSuper(Derived) {
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
- return function () {
- var Super = (0, _getPrototypeOf2.default)(Derived),
- result;
- if (hasNativeReflectConstruct) {
- var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
- result = _Reflect$construct(Super, arguments, NewTarget);
- } else {
- result = Super.apply(this, arguments);
- }
- return (0, _possibleConstructorReturn2.default)(this, result);
- };
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
- if (_Reflect$construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
- } // The LiveQuery client inner state
- var CLIENT_STATE = {
- INITIALIZED: 'initialized',
- CONNECTING: 'connecting',
- CONNECTED: 'connected',
- CLOSED: 'closed',
- RECONNECTING: 'reconnecting',
- DISCONNECTED: 'disconnected'
- }; // The event type the LiveQuery client should sent to server
- var OP_TYPES = {
- CONNECT: 'connect',
- SUBSCRIBE: 'subscribe',
- UNSUBSCRIBE: 'unsubscribe',
- ERROR: 'error'
- }; // The event we get back from LiveQuery server
- var OP_EVENTS = {
- CONNECTED: 'connected',
- SUBSCRIBED: 'subscribed',
- UNSUBSCRIBED: 'unsubscribed',
- ERROR: 'error',
- CREATE: 'create',
- UPDATE: 'update',
- ENTER: 'enter',
- LEAVE: 'leave',
- DELETE: 'delete'
- }; // The event the LiveQuery client should emit
- var CLIENT_EMMITER_TYPES = {
- CLOSE: 'close',
- ERROR: 'error',
- OPEN: 'open'
- }; // The event the LiveQuery subscription should emit
- var SUBSCRIPTION_EMMITER_TYPES = {
- OPEN: 'open',
- CLOSE: 'close',
- ERROR: 'error',
- CREATE: 'create',
- UPDATE: 'update',
- ENTER: 'enter',
- LEAVE: 'leave',
- DELETE: 'delete'
- };
- var generateInterval = function (k) {
- return Math.random() * Math.min(30, Math.pow(2, k) - 1) * 1000;
- };
- /**
- * Creates a new LiveQueryClient.
- * Extends events.EventEmitter
- * <a href="https://nodejs.org/api/events.html#events_class_eventemitter">cloud functions</a>.
- *
- * A wrapper of a standard WebSocket client. We add several useful methods to
- * help you connect/disconnect to LiveQueryServer, subscribe/unsubscribe a ParseQuery easily.
- *
- * javascriptKey and masterKey are used for verifying the LiveQueryClient when it tries
- * to connect to the LiveQuery server
- *
- * We expose three events to help you monitor the status of the LiveQueryClient.
- *
- * <pre>
- * let Parse = require('parse/node');
- * let LiveQueryClient = Parse.LiveQueryClient;
- * let client = new LiveQueryClient({
- * applicationId: '',
- * serverURL: '',
- * javascriptKey: '',
- * masterKey: ''
- * });
- * </pre>
- *
- * Open - When we establish the WebSocket connection to the LiveQuery server, you'll get this event.
- * <pre>
- * client.on('open', () => {
- *
- * });</pre>
- *
- * Close - When we lose the WebSocket connection to the LiveQuery server, you'll get this event.
- * <pre>
- * client.on('close', () => {
- *
- * });</pre>
- *
- * Error - When some network error or LiveQuery server error happens, you'll get this event.
- * <pre>
- * client.on('error', (error) => {
- *
- * });</pre>
- *
- * @alias Parse.LiveQueryClient
- */
- var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
- (0, _inherits2.default)(LiveQueryClient, _EventEmitter);
- var _super = _createSuper(LiveQueryClient);
- /**
- * @param {object} options
- * @param {string} options.applicationId - applicationId of your Parse app
- * @param {string} options.serverURL - <b>the URL of your LiveQuery server</b>
- * @param {string} options.javascriptKey (optional)
- * @param {string} options.masterKey (optional) Your Parse Master Key. (Node.js only!)
- * @param {string} options.sessionToken (optional)
- * @param {string} options.installationId (optional)
- */
- function LiveQueryClient(_ref) {
- var _this;
- var applicationId = _ref.applicationId,
- serverURL = _ref.serverURL,
- javascriptKey = _ref.javascriptKey,
- masterKey = _ref.masterKey,
- sessionToken = _ref.sessionToken,
- installationId = _ref.installationId;
- (0, _classCallCheck2.default)(this, LiveQueryClient);
- _this = _super.call(this);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "attempts", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "id", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "requestId", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "applicationId", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "serverURL", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "javascriptKey", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "masterKey", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sessionToken", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "installationId", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "additionalProperties", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "connectPromise", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "subscriptions", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "socket", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", void 0);
- if (!serverURL || (0, _indexOf.default)(serverURL).call(serverURL, 'ws') !== 0) {
- throw new Error('You need to set a proper Parse LiveQuery server url before using LiveQueryClient');
- }
- _this.reconnectHandle = null;
- _this.attempts = 1;
- _this.id = 0;
- _this.requestId = 1;
- _this.serverURL = serverURL;
- _this.applicationId = applicationId;
- _this.javascriptKey = javascriptKey || undefined;
- _this.masterKey = masterKey || undefined;
- _this.sessionToken = sessionToken || undefined;
- _this.installationId = installationId || undefined;
- _this.additionalProperties = true;
- _this.connectPromise = (0, _promiseUtils.resolvingPromise)();
- _this.subscriptions = new _map.default();
- _this.state = CLIENT_STATE.INITIALIZED; // adding listener so process does not crash
- // best practice is for developer to register their own listener
- _this.on('error', function () {});
- return _this;
- }
- (0, _createClass2.default)(LiveQueryClient, [{
- key: "shouldOpen",
- value: function ()
- /*: any*/
- {
- return this.state === CLIENT_STATE.INITIALIZED || this.state === CLIENT_STATE.DISCONNECTED;
- }
- /**
- * Subscribes to a ParseQuery
- *
- * If you provide the sessionToken, when the LiveQuery server gets ParseObject's
- * updates from parse server, it'll try to check whether the sessionToken fulfills
- * the ParseObject's ACL. The LiveQuery server will only send updates to clients whose
- * sessionToken is fit for the ParseObject's ACL. You can check the LiveQuery protocol
- * <a href="https://github.com/parse-community/parse-server/wiki/Parse-LiveQuery-Protocol-Specification">here</a> for more details. The subscription you get is the same subscription you get
- * from our Standard API.
- *
- * @param {object} query - the ParseQuery you want to subscribe to
- * @param {string} sessionToken (optional)
- * @returns {LiveQuerySubscription} subscription
- */
- }, {
- key: "subscribe",
- value: function (query
- /*: Object*/
- , sessionToken
- /*: ?string*/
- )
- /*: LiveQuerySubscription*/
- {
- var _this2 = this;
- if (!query) {
- return;
- }
- var className = query.className;
- var queryJSON = query.toJSON();
- var where = queryJSON.where;
- var fields = (0, _keys.default)(queryJSON) ? (0, _keys.default)(queryJSON).split(',') : undefined;
- var subscribeRequest = {
- op: OP_TYPES.SUBSCRIBE,
- requestId: this.requestId,
- query: {
- className: className,
- where: where,
- fields: fields
- }
- };
- if (sessionToken) {
- subscribeRequest.sessionToken = sessionToken;
- }
- var subscription = new _LiveQuerySubscription.default(this.requestId, query, sessionToken);
- this.subscriptions.set(this.requestId, subscription);
- this.requestId += 1;
- this.connectPromise.then(function () {
- _this2.socket.send((0, _stringify.default)(subscribeRequest));
- });
- return subscription;
- }
- /**
- * After calling unsubscribe you'll stop receiving events from the subscription object.
- *
- * @param {object} subscription - subscription you would like to unsubscribe from.
- */
- }, {
- key: "unsubscribe",
- value: function (subscription
- /*: Object*/
- ) {
- var _this3 = this;
- if (!subscription) {
- return;
- }
- this.subscriptions.delete(subscription.id);
- var unsubscribeRequest = {
- op: OP_TYPES.UNSUBSCRIBE,
- requestId: subscription.id
- };
- this.connectPromise.then(function () {
- _this3.socket.send((0, _stringify.default)(unsubscribeRequest));
- });
- }
- /**
- * After open is called, the LiveQueryClient will try to send a connect request
- * to the LiveQuery server.
- *
- */
- }, {
- key: "open",
- value: function () {
- var _this4 = this;
- var WebSocketImplementation = _CoreManager.default.getWebSocketController();
- if (!WebSocketImplementation) {
- this.emit(CLIENT_EMMITER_TYPES.ERROR, 'Can not find WebSocket implementation');
- return;
- }
- if (this.state !== CLIENT_STATE.RECONNECTING) {
- this.state = CLIENT_STATE.CONNECTING;
- }
- this.socket = new WebSocketImplementation(this.serverURL); // Bind WebSocket callbacks
- this.socket.onopen = function () {
- _this4._handleWebSocketOpen();
- };
- this.socket.onmessage = function (event) {
- _this4._handleWebSocketMessage(event);
- };
- this.socket.onclose = function () {
- _this4._handleWebSocketClose();
- };
- this.socket.onerror = function (error) {
- _this4._handleWebSocketError(error);
- };
- }
- }, {
- key: "resubscribe",
- value: function () {
- var _context,
- _this5 = this;
- (0, _forEach.default)(_context = this.subscriptions).call(_context, function (subscription, requestId) {
- var query = subscription.query;
- var queryJSON = query.toJSON();
- var where = queryJSON.where;
- var fields = (0, _keys.default)(queryJSON) ? (0, _keys.default)(queryJSON).split(',') : undefined;
- var className = query.className;
- var sessionToken = subscription.sessionToken;
- var subscribeRequest = {
- op: OP_TYPES.SUBSCRIBE,
- requestId: requestId,
- query: {
- className: className,
- where: where,
- fields: fields
- }
- };
- if (sessionToken) {
- subscribeRequest.sessionToken = sessionToken;
- }
- _this5.connectPromise.then(function () {
- _this5.socket.send((0, _stringify.default)(subscribeRequest));
- });
- });
- }
- /**
- * This method will close the WebSocket connection to this LiveQueryClient,
- * cancel the auto reconnect and unsubscribe all subscriptions based on it.
- *
- */
- }, {
- key: "close",
- value: function () {
- var _context2;
- if (this.state === CLIENT_STATE.INITIALIZED || this.state === CLIENT_STATE.DISCONNECTED) {
- return;
- }
- this.state = CLIENT_STATE.DISCONNECTED;
- this.socket.close(); // Notify each subscription about the close
- var _iterator = _createForOfIteratorHelper((0, _values.default)(_context2 = this.subscriptions).call(_context2)),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var subscription = _step.value;
- subscription.subscribed = false;
- subscription.emit(SUBSCRIPTION_EMMITER_TYPES.CLOSE);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- this._handleReset();
- this.emit(CLIENT_EMMITER_TYPES.CLOSE);
- } // ensure we start with valid state if connect is called again after close
- }, {
- key: "_handleReset",
- value: function () {
- this.attempts = 1;
- this.id = 0;
- this.requestId = 1;
- this.connectPromise = (0, _promiseUtils.resolvingPromise)();
- this.subscriptions = new _map.default();
- }
- }, {
- key: "_handleWebSocketOpen",
- value: function () {
- this.attempts = 1;
- var connectRequest = {
- op: OP_TYPES.CONNECT,
- applicationId: this.applicationId,
- javascriptKey: this.javascriptKey,
- masterKey: this.masterKey,
- sessionToken: this.sessionToken
- };
- if (this.additionalProperties) {
- connectRequest.installationId = this.installationId;
- }
- this.socket.send((0, _stringify.default)(connectRequest));
- }
- }, {
- key: "_handleWebSocketMessage",
- value: function (event
- /*: any*/
- ) {
- var data = event.data;
- if (typeof data === 'string') {
- data = JSON.parse(data);
- }
- var subscription = null;
- if (data.requestId) {
- subscription = this.subscriptions.get(data.requestId);
- }
- var response = {
- clientId: data.clientId,
- installationId: data.installationId
- };
- switch (data.op) {
- case OP_EVENTS.CONNECTED:
- if (this.state === CLIENT_STATE.RECONNECTING) {
- this.resubscribe();
- }
- this.emit(CLIENT_EMMITER_TYPES.OPEN);
- this.id = data.clientId;
- this.connectPromise.resolve();
- this.state = CLIENT_STATE.CONNECTED;
- break;
- case OP_EVENTS.SUBSCRIBED:
- if (subscription) {
- subscription.subscribed = true;
- subscription.subscribePromise.resolve();
- (0, _setTimeout2.default)(function () {
- return subscription.emit(SUBSCRIPTION_EMMITER_TYPES.OPEN, response);
- }, 200);
- }
- break;
- case OP_EVENTS.ERROR:
- if (data.requestId) {
- if (subscription) {
- subscription.subscribePromise.resolve();
- (0, _setTimeout2.default)(function () {
- return subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, data.error);
- }, 200);
- }
- } else {
- this.emit(CLIENT_EMMITER_TYPES.ERROR, data.error);
- }
- if (data.error === 'Additional properties not allowed') {
- this.additionalProperties = false;
- }
- if (data.reconnect) {
- this._handleReconnect();
- }
- break;
- case OP_EVENTS.UNSUBSCRIBED:
- // We have already deleted subscription in unsubscribe(), do nothing here
- break;
- default:
- {
- // create, update, enter, leave, delete cases
- if (!subscription) {
- break;
- }
- var override = false;
- if (data.original) {
- override = true;
- delete data.original.__type; // Check for removed fields
- for (var field in data.original) {
- if (!(field in data.object)) {
- data.object[field] = undefined;
- }
- }
- data.original = _ParseObject.default.fromJSON(data.original, false);
- }
- delete data.object.__type;
- var parseObject = _ParseObject.default.fromJSON(data.object, !(subscription.query && subscription.query._select) ? override : false);
- if (data.original) {
- subscription.emit(data.op, parseObject, data.original, response);
- } else {
- subscription.emit(data.op, parseObject, response);
- }
- var localDatastore = _CoreManager.default.getLocalDatastore();
- if (override && localDatastore.isEnabled) {
- localDatastore._updateObjectIfPinned(parseObject).then(function () {});
- }
- }
- }
- }
- }, {
- key: "_handleWebSocketClose",
- value: function () {
- var _context3;
- if (this.state === CLIENT_STATE.DISCONNECTED) {
- return;
- }
- this.state = CLIENT_STATE.CLOSED;
- this.emit(CLIENT_EMMITER_TYPES.CLOSE); // Notify each subscription about the close
- var _iterator2 = _createForOfIteratorHelper((0, _values.default)(_context3 = this.subscriptions).call(_context3)),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var subscription = _step2.value;
- subscription.emit(SUBSCRIPTION_EMMITER_TYPES.CLOSE);
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- this._handleReconnect();
- }
- }, {
- key: "_handleWebSocketError",
- value: function (error
- /*: any*/
- ) {
- var _context4;
- this.emit(CLIENT_EMMITER_TYPES.ERROR, error);
- var _iterator3 = _createForOfIteratorHelper((0, _values.default)(_context4 = this.subscriptions).call(_context4)),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var subscription = _step3.value;
- subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, error);
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- this._handleReconnect();
- }
- }, {
- key: "_handleReconnect",
- value: function () {
- var _context5,
- _this6 = this; // if closed or currently reconnecting we stop attempting to reconnect
- if (this.state === CLIENT_STATE.DISCONNECTED) {
- return;
- }
- this.state = CLIENT_STATE.RECONNECTING;
- var time = generateInterval(this.attempts); // handle case when both close/error occur at frequent rates we ensure we do not reconnect unnecessarily.
- // we're unable to distinguish different between close/error when we're unable to reconnect therefore
- // we try to reconnect in both cases
- // server side ws and browser WebSocket behave differently in when close/error get triggered
- if (this.reconnectHandle) {
- clearTimeout(this.reconnectHandle);
- }
- this.reconnectHandle = (0, _setTimeout2.default)((0, _bind.default)(_context5 = function () {
- _this6.attempts++;
- _this6.connectPromise = (0, _promiseUtils.resolvingPromise)();
- _this6.open();
- }).call(_context5, this), time);
- }
- }]);
- return LiveQueryClient;
- }(_EventEmitter2.default);
- _CoreManager.default.setWebSocketController(typeof WebSocket === 'function' || (typeof WebSocket === "undefined" ? "undefined" : (0, _typeof2.default)(WebSocket)) === 'object' ? WebSocket : null);
- var _default = LiveQueryClient;
- exports.default = _default;
- },{"./CoreManager":4,"./EventEmitter":6,"./LiveQuerySubscription":12,"./ParseObject":27,"./promiseUtils":51,"@babel/runtime-corejs3/core-js-stable/array/from":55,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/bind":57,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/instance/keys":67,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/instance/values":75,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/map":77,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/core-js-stable/set-timeout":95,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/core-js/get-iterator-method":101,"@babel/runtime-corejs3/helpers/assertThisInitialized":119,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/getPrototypeOf":126,"@babel/runtime-corejs3/helpers/inherits":127,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":135,"@babel/runtime-corejs3/helpers/typeof":140}],12:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
- var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
- var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
- var _EventEmitter2 = _interopRequireDefault(_dereq_("./EventEmitter"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _promiseUtils = _dereq_("./promiseUtils");
- function _createSuper(Derived) {
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
- return function () {
- var Super = (0, _getPrototypeOf2.default)(Derived),
- result;
- if (hasNativeReflectConstruct) {
- var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
- result = _Reflect$construct(Super, arguments, NewTarget);
- } else {
- result = Super.apply(this, arguments);
- }
- return (0, _possibleConstructorReturn2.default)(this, result);
- };
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
- if (_Reflect$construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
- }
- /**
- * Creates a new LiveQuery Subscription.
- * Extends events.EventEmitter
- * <a href="https://nodejs.org/api/events.html#events_class_eventemitter">cloud functions</a>.
- *
- * <p>Response Object - Contains data from the client that made the request
- * <ul>
- * <li>clientId</li>
- * <li>installationId - requires Parse Server 4.0.0+</li>
- * </ul>
- * </p>
- *
- * <p>Open Event - When you call query.subscribe(), we send a subscribe request to
- * the LiveQuery server, when we get the confirmation from the LiveQuery server,
- * this event will be emitted. When the client loses WebSocket connection to the
- * LiveQuery server, we will try to auto reconnect the LiveQuery server. If we
- * reconnect the LiveQuery server and successfully resubscribe the ParseQuery,
- * you'll also get this event.
- *
- * <pre>
- * subscription.on('open', (response) => {
- *
- * });</pre></p>
- *
- * <p>Create Event - When a new ParseObject is created and it fulfills the ParseQuery you subscribe,
- * you'll get this event. The object is the ParseObject which is created.
- *
- * <pre>
- * subscription.on('create', (object, response) => {
- *
- * });</pre></p>
- *
- * <p>Update Event - When an existing ParseObject (original) which fulfills the ParseQuery you subscribe
- * is updated (The ParseObject fulfills the ParseQuery before and after changes),
- * you'll get this event. The object is the ParseObject which is updated.
- * Its content is the latest value of the ParseObject.
- *
- * Parse-Server 3.1.3+ Required for original object parameter
- *
- * <pre>
- * subscription.on('update', (object, original, response) => {
- *
- * });</pre></p>
- *
- * <p>Enter Event - When an existing ParseObject's (original) old value doesn't fulfill the ParseQuery
- * but its new value fulfills the ParseQuery, you'll get this event. The object is the
- * ParseObject which enters the ParseQuery. Its content is the latest value of the ParseObject.
- *
- * Parse-Server 3.1.3+ Required for original object parameter
- *
- * <pre>
- * subscription.on('enter', (object, original, response) => {
- *
- * });</pre></p>
- *
- *
- * <p>Update Event - When an existing ParseObject's old value fulfills the ParseQuery but its new value
- * doesn't fulfill the ParseQuery, you'll get this event. The object is the ParseObject
- * which leaves the ParseQuery. Its content is the latest value of the ParseObject.
- *
- * <pre>
- * subscription.on('leave', (object, response) => {
- *
- * });</pre></p>
- *
- *
- * <p>Delete Event - When an existing ParseObject which fulfills the ParseQuery is deleted, you'll
- * get this event. The object is the ParseObject which is deleted.
- *
- * <pre>
- * subscription.on('delete', (object, response) => {
- *
- * });</pre></p>
- *
- *
- * <p>Close Event - When the client loses the WebSocket connection to the LiveQuery
- * server and we stop receiving events, you'll get this event.
- *
- * <pre>
- * subscription.on('close', () => {
- *
- * });</pre></p>
- *
- * @alias Parse.LiveQuerySubscription
- */
- var Subscription = /*#__PURE__*/function (_EventEmitter) {
- (0, _inherits2.default)(Subscription, _EventEmitter);
- var _super = _createSuper(Subscription);
- /*
- * @param {string} id - subscription id
- * @param {string} query - query to subscribe to
- * @param {string} sessionToken - optional session token
- */
- function Subscription(id, query, sessionToken) {
- var _this;
- (0, _classCallCheck2.default)(this, Subscription);
- _this = _super.call(this);
- _this.id = id;
- _this.query = query;
- _this.sessionToken = sessionToken;
- _this.subscribePromise = (0, _promiseUtils.resolvingPromise)();
- _this.subscribed = false; // adding listener so process does not crash
- // best practice is for developer to register their own listener
- _this.on('error', function () {});
- return _this;
- }
- /**
- * Close the subscription
- *
- * @returns {Promise}
- */
- (0, _createClass2.default)(Subscription, [{
- key: "unsubscribe",
- value: function ()
- /*: Promise*/
- {
- var _this2 = this;
- return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient().then(function (liveQueryClient) {
- liveQueryClient.unsubscribe(_this2);
- _this2.emit('close');
- });
- }
- }]);
- return Subscription;
- }(_EventEmitter2.default);
- var _default = Subscription;
- exports.default = _default;
- },{"./CoreManager":4,"./EventEmitter":6,"./promiseUtils":51,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/getPrototypeOf":126,"@babel/runtime-corejs3/helpers/inherits":127,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":135}],13:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
- var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
- var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
- var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
- var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
- var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
- var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Array$isArray2 = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
- var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
- var _Array$from2 = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
- var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
- var _find = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find"));
- var _from = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/from"));
- var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _regenerator = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/regenerator"));
- var _keys2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/keys"));
- var _startsWith = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
- var _keys3 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
- var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
- var _filter = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter"));
- var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
- var _set = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/set"));
- var _toConsumableArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/toConsumableArray"));
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
- var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
- var _LocalDatastoreUtils = _dereq_("./LocalDatastoreUtils");
- function _regeneratorRuntime() {
- "use strict";
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
- _regeneratorRuntime = function () {
- return exports;
- };
- var exports = {},
- Op = Object.prototype,
- hasOwn = Op.hasOwnProperty,
- $Symbol = "function" == typeof _Symbol ? _Symbol : {},
- iteratorSymbol = $Symbol.iterator || "@@iterator",
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- return _Object$defineProperty(obj, key, {
- value: value,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }), obj[key];
- }
- try {
- define({}, "");
- } catch (err) {
- define = function (obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
- generator = _Object$create(protoGenerator.prototype),
- context = new Context(tryLocsList || []);
- return generator._invoke = function (innerFn, self, context) {
- var state = "suspendedStart";
- return function (method, arg) {
- if ("executing" === state) throw new Error("Generator is already running");
- if ("completed" === state) {
- if ("throw" === method) throw arg;
- return doneResult();
- }
- for (context.method = method, context.arg = arg;;) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
- if ("suspendedStart" === state) throw state = "completed", context.arg;
- context.dispatchException(context.arg);
- } else "return" === context.method && context.abrupt("return", context.arg);
- state = "executing";
- var record = tryCatch(innerFn, self, context);
- if ("normal" === record.type) {
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
- return {
- value: record.arg,
- done: context.done
- };
- }
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
- }
- };
- }(innerFn, self, context), generator;
- }
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- exports.wrap = wrap;
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = _Object$getPrototypeOf,
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
- function defineIteratorMethods(prototype) {
- var _context19;
- _forEachInstanceProperty(_context19 = ["next", "throw", "return"]).call(_context19, function (method) {
- define(prototype, method, function (arg) {
- return this._invoke(method, arg);
- });
- });
- }
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if ("throw" !== record.type) {
- var result = record.arg,
- value = result.value;
- return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
- result.value = unwrapped, resolve(result);
- }, function (error) {
- return invoke("throw", error, resolve, reject);
- });
- }
- reject(record.arg);
- }
- var previousPromise;
- this._invoke = function (method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (undefined === method) {
- if (context.delegate = null, "throw" === context.method) {
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
- var info = record.arg;
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
- }
- function pushTryEntry(locs) {
- var entry = {
- tryLoc: locs[0]
- };
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal", delete record.arg, entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{
- tryLoc: "root"
- }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
- }
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) return iteratorMethod.call(iterable);
- if ("function" == typeof iterable.next) return iterable;
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- for (; ++i < iterable.length;) {
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
- }
- return next.value = undefined, next.done = !0, next;
- };
- return next.next = next;
- }
- }
- return {
- next: doneResult
- };
- }
- function doneResult() {
- return {
- value: undefined,
- done: !0
- };
- }
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
- var ctor = "function" == typeof genFun && genFun.constructor;
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
- }, exports.mark = function (genFun) {
- return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
- }, exports.awrap = function (arg) {
- return {
- __await: arg
- };
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- void 0 === PromiseImpl && (PromiseImpl = _Promise2);
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
- return this;
- }), define(Gp, "toString", function () {
- return "[object Generator]";
- }), exports.keys = function (object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- return _reverseInstanceProperty(keys).call(keys), function next() {
- for (; keys.length;) {
- var key = keys.pop();
- if (key in object) return next.value = key, next.done = !1, next;
- }
- return next.done = !0, next;
- };
- }, exports.values = values, Context.prototype = {
- constructor: Context,
- reset: function (skipTempReset) {
- var _context20;
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context20 = this.tryEntries).call(_context20, resetTryEntry), !skipTempReset) for (var name in this) {
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
- }
- },
- stop: function () {
- this.done = !0;
- var rootRecord = this.tryEntries[0].completion;
- if ("throw" === rootRecord.type) throw rootRecord.arg;
- return this.rval;
- },
- dispatchException: function (exception) {
- if (this.done) throw exception;
- var context = this;
- function handle(loc, caught) {
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i],
- record = entry.completion;
- if ("root" === entry.tryLoc) return handle("end");
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc"),
- hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- } else {
- if (!hasFinally) throw new Error("try statement without catch or finally");
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- }
- }
- }
- },
- abrupt: function (type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
- var record = finallyEntry ? finallyEntry.completion : {};
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
- },
- complete: function (record, afterLoc) {
- if ("throw" === record.type) throw record.arg;
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
- },
- finish: function (finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
- }
- },
- catch: function (tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if ("throw" === record.type) {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function (iterable, resultName, nextLoc) {
- return this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
- }
- }, exports;
- }
- function _createForOfIteratorHelper(o, allowArrayLike) {
- var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
- if (!it) {
- if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it) o = it;
- var i = 0;
- var F = function () {};
- return {
- s: F,
- n: function () {
- if (i >= o.length) return {
- done: true
- };
- return {
- done: false,
- value: o[i++]
- };
- },
- e: function (_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 () {
- it = it.call(o);
- },
- n: function () {
- var step = it.next();
- normalCompletion = step.done;
- return step;
- },
- e: function (_e2) {
- didErr = true;
- err = _e2;
- },
- f: function () {
- try {
- if (!normalCompletion && it.return != null) it.return();
- } finally {
- if (didErr) throw err;
- }
- }
- };
- }
- function _unsupportedIterableToArray(o, minLen) {
- var _context18;
- if (!o) return;
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
- var n = _sliceInstanceProperty(_context18 = Object.prototype.toString.call(o)).call(_context18, 8, -1);
- if (n === "Object" && o.constructor) n = o.constructor.name;
- if (n === "Map" || n === "Set") return _Array$from2(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;
- }
- /**
- * Provides a local datastore which can be used to store and retrieve <code>Parse.Object</code>. <br />
- * To enable this functionality, call <code>Parse.enableLocalDatastore()</code>.
- *
- * Pin object to add to local datastore
- *
- * <pre>await object.pin();</pre>
- * <pre>await object.pinWithName('pinName');</pre>
- *
- * Query pinned objects
- *
- * <pre>query.fromLocalDatastore();</pre>
- * <pre>query.fromPin();</pre>
- * <pre>query.fromPinWithName();</pre>
- *
- * <pre>const localObjects = await query.find();</pre>
- *
- * @class Parse.LocalDatastore
- * @static
- */
- var LocalDatastore = {
- isEnabled: false,
- isSyncing: false,
- fromPinWithName: function (name
- /*: string*/
- )
- /*: Promise<Array<Object>>*/
- {
- var controller = _CoreManager.default.getLocalDatastoreController();
- return controller.fromPinWithName(name);
- },
- pinWithName: function (name
- /*: string*/
- , value
- /*: any*/
- )
- /*: Promise<void>*/
- {
- var controller = _CoreManager.default.getLocalDatastoreController();
- return controller.pinWithName(name, value);
- },
- unPinWithName: function (name
- /*: string*/
- )
- /*: Promise<void>*/
- {
- var controller = _CoreManager.default.getLocalDatastoreController();
- return controller.unPinWithName(name);
- },
- _getAllContents: function ()
- /*: Promise<Object>*/
- {
- var controller = _CoreManager.default.getLocalDatastoreController();
- return controller.getAllContents();
- },
- // Use for testing
- _getRawStorage: function ()
- /*: Promise<Object>*/
- {
- var controller = _CoreManager.default.getLocalDatastoreController();
- return controller.getRawStorage();
- },
- _clear: function ()
- /*: Promise<void>*/
- {
- var controller = _CoreManager.default.getLocalDatastoreController();
- return controller.clear();
- },
- // Pin the object and children recursively
- // Saves the object and children key to Pin Name
- _handlePinAllWithName: function (name
- /*: string*/
- , objects
- /*: Array<ParseObject>*/
- )
- /*: Promise<void>*/
- {
- var _this = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
- var _context;
- var pinName, toPinPromises, objectKeys, _iterator, _step, parent, children, parentKey, json, objectKey, fromPinPromise, _yield$Promise$all, _yield$Promise$all2, pinned, toPin;
- return _regeneratorRuntime().wrap(function _callee$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- pinName = _this.getPinName(name);
- toPinPromises = [];
- objectKeys = [];
- _iterator = _createForOfIteratorHelper(objects);
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- parent = _step.value;
- children = _this._getChildren(parent);
- parentKey = _this.getKeyForObject(parent);
- json = parent._toFullJSON(undefined, true);
- if (parent._localId) {
- json._localId = parent._localId;
- }
- children[parentKey] = json;
- for (objectKey in children) {
- objectKeys.push(objectKey);
- toPinPromises.push(_this.pinWithName(objectKey, [children[objectKey]]));
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- fromPinPromise = _this.fromPinWithName(pinName);
- _context2.next = 8;
- return _promise.default.all([fromPinPromise, toPinPromises]);
- case 8:
- _yield$Promise$all = _context2.sent;
- _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
- pinned = _yield$Promise$all2[0];
- toPin = (0, _toConsumableArray2.default)(new _set.default((0, _concat.default)(_context = []).call(_context, (0, _toConsumableArray2.default)(pinned || []), objectKeys)));
- return _context2.abrupt("return", _this.pinWithName(pinName, toPin));
- case 13:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee);
- }))();
- },
- // Removes object and children keys from pin name
- // Keeps the object and children pinned
- _handleUnPinAllWithName: function _handleUnPinAllWithName(name
- /*: string*/
- , objects
- /*: Array<ParseObject>*/
- ) {
- var _this2 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
- var localDatastore, pinName, promises, objectKeys, _iterator2, _step2, _objectKeys, _context3, parent, children, parentKey, pinned, _iterator3, _step3, objectKey, hasReference, key, pinnedObjects;
- return _regeneratorRuntime().wrap(function _callee2$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- _context4.next = 2;
- return _this2._getAllContents();
- case 2:
- localDatastore = _context4.sent;
- pinName = _this2.getPinName(name);
- promises = [];
- objectKeys = [];
- _iterator2 = _createForOfIteratorHelper(objects);
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- parent = _step2.value;
- children = _this2._getChildren(parent);
- parentKey = _this2.getKeyForObject(parent);
- (_objectKeys = objectKeys).push.apply(_objectKeys, (0, _concat.default)(_context3 = [parentKey]).call(_context3, (0, _toConsumableArray2.default)((0, _keys3.default)(children))));
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- objectKeys = (0, _toConsumableArray2.default)(new _set.default(objectKeys));
- pinned = localDatastore[pinName] || [];
- pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
- return !(0, _includes.default)(objectKeys).call(objectKeys, item);
- });
- if (pinned.length == 0) {
- promises.push(_this2.unPinWithName(pinName));
- delete localDatastore[pinName];
- } else {
- promises.push(_this2.pinWithName(pinName, pinned));
- localDatastore[pinName] = pinned;
- }
- _iterator3 = _createForOfIteratorHelper(objectKeys);
- _context4.prev = 13;
- _iterator3.s();
- case 15:
- if ((_step3 = _iterator3.n()).done) {
- _context4.next = 31;
- break;
- }
- objectKey = _step3.value;
- hasReference = false;
- _context4.t0 = (0, _keys2.default)(_regenerator.default).call(_regenerator.default, localDatastore);
- case 19:
- if ((_context4.t1 = _context4.t0()).done) {
- _context4.next = 28;
- break;
- }
- key = _context4.t1.value;
- if (!(key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX))) {
- _context4.next = 26;
- break;
- }
- pinnedObjects = localDatastore[key] || [];
- if (!(0, _includes.default)(pinnedObjects).call(pinnedObjects, objectKey)) {
- _context4.next = 26;
- break;
- }
- hasReference = true;
- return _context4.abrupt("break", 28);
- case 26:
- _context4.next = 19;
- break;
- case 28:
- if (!hasReference) {
- promises.push(_this2.unPinWithName(objectKey));
- }
- case 29:
- _context4.next = 15;
- break;
- case 31:
- _context4.next = 36;
- break;
- case 33:
- _context4.prev = 33;
- _context4.t2 = _context4["catch"](13);
- _iterator3.e(_context4.t2);
- case 36:
- _context4.prev = 36;
- _iterator3.f();
- return _context4.finish(36);
- case 39:
- return _context4.abrupt("return", _promise.default.all(promises));
- case 40:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee2, null, [[13, 33, 36, 39]]);
- }))();
- },
- // Retrieve all pointer fields from object recursively
- _getChildren: function _getChildren(object
- /*: ParseObject*/
- ) {
- var encountered = {};
- var json = object._toFullJSON(undefined, true);
- for (var key in json) {
- if (json[key] && json[key].__type && json[key].__type === 'Object') {
- this._traverse(json[key], encountered);
- }
- }
- return encountered;
- },
- _traverse: function _traverse(object
- /*: any*/
- , encountered
- /*: any*/
- ) {
- if (!object.objectId) {
- return;
- } else {
- var objectKey = this.getKeyForObject(object);
- if (encountered[objectKey]) {
- return;
- }
- encountered[objectKey] = object;
- }
- for (var key in object) {
- var json = object[key];
- if (!object[key]) {
- json = object;
- }
- if (json.__type && json.__type === 'Object') {
- this._traverse(json, encountered);
- }
- }
- },
- // Transform keys in pin name to objects
- _serializeObjectsFromPinName: function _serializeObjectsFromPinName(name
- /*: string*/
- ) {
- var _this3 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
- var _context5, _concatInstanceProper, _context6;
- var localDatastore, allObjects, key, pinName, pinned, promises, objects;
- return _regeneratorRuntime().wrap(function _callee3$(_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- _context7.next = 2;
- return _this3._getAllContents();
- case 2:
- localDatastore = _context7.sent;
- allObjects = [];
- for (key in localDatastore) {
- if ((0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.OBJECT_PREFIX)) {
- allObjects.push(localDatastore[key][0]);
- }
- }
- if (name) {
- _context7.next = 7;
- break;
- }
- return _context7.abrupt("return", allObjects);
- case 7:
- pinName = _this3.getPinName(name);
- pinned = localDatastore[pinName];
- if ((0, _isArray.default)(pinned)) {
- _context7.next = 11;
- break;
- }
- return _context7.abrupt("return", []);
- case 11:
- promises = (0, _map.default)(pinned).call(pinned, function (objectKey) {
- return _this3.fromPinWithName(objectKey);
- });
- _context7.next = 14;
- return _promise.default.all(promises);
- case 14:
- objects = _context7.sent;
- objects = (_concatInstanceProper = (0, _concat.default)(_context5 = [])).call.apply(_concatInstanceProper, (0, _concat.default)(_context6 = [_context5]).call(_context6, (0, _toConsumableArray2.default)(objects)));
- return _context7.abrupt("return", (0, _filter.default)(objects).call(objects, function (object) {
- return object != null;
- }));
- case 17:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee3);
- }))();
- },
- // Replaces object pointers with pinned pointers
- // The object pointers may contain old data
- // Uses Breadth First Search Algorithm
- _serializeObject: function _serializeObject(objectKey
- /*: string*/
- , localDatastore
- /*: any*/
- ) {
- var _this4 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
- var LDS, root, queue, meta, uniqueId, nodeId, subTreeRoot, field, value, key, pointer;
- return _regeneratorRuntime().wrap(function _callee4$(_context8) {
- while (1) {
- switch (_context8.prev = _context8.next) {
- case 0:
- LDS = localDatastore;
- if (LDS) {
- _context8.next = 5;
- break;
- }
- _context8.next = 4;
- return _this4._getAllContents();
- case 4:
- LDS = _context8.sent;
- case 5:
- if (!(!LDS[objectKey] || LDS[objectKey].length === 0)) {
- _context8.next = 7;
- break;
- }
- return _context8.abrupt("return", null);
- case 7:
- root = LDS[objectKey][0];
- queue = [];
- meta = {};
- uniqueId = 0;
- meta[uniqueId] = root;
- queue.push(uniqueId);
- while (queue.length !== 0) {
- nodeId = queue.shift();
- subTreeRoot = meta[nodeId];
- for (field in subTreeRoot) {
- value = subTreeRoot[field];
- if (value.__type && value.__type === 'Object') {
- key = _this4.getKeyForObject(value);
- if (LDS[key] && LDS[key].length > 0) {
- pointer = LDS[key][0];
- uniqueId++;
- meta[uniqueId] = pointer;
- subTreeRoot[field] = pointer;
- queue.push(uniqueId);
- }
- }
- }
- }
- return _context8.abrupt("return", root);
- case 15:
- case "end":
- return _context8.stop();
- }
- }
- }, _callee4);
- }))();
- },
- // Called when an object is save / fetched
- // Update object pin value
- _updateObjectIfPinned: function _updateObjectIfPinned(object
- /*: ParseObject*/
- )
- /*: Promise<void>*/
- {
- var _this5 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
- var objectKey, pinned;
- return _regeneratorRuntime().wrap(function _callee5$(_context9) {
- while (1) {
- switch (_context9.prev = _context9.next) {
- case 0:
- if (_this5.isEnabled) {
- _context9.next = 2;
- break;
- }
- return _context9.abrupt("return");
- case 2:
- objectKey = _this5.getKeyForObject(object);
- _context9.next = 5;
- return _this5.fromPinWithName(objectKey);
- case 5:
- pinned = _context9.sent;
- if (!(!pinned || pinned.length === 0)) {
- _context9.next = 8;
- break;
- }
- return _context9.abrupt("return");
- case 8:
- return _context9.abrupt("return", _this5.pinWithName(objectKey, [object._toFullJSON()]));
- case 9:
- case "end":
- return _context9.stop();
- }
- }
- }, _callee5);
- }))();
- },
- // Called when object is destroyed
- // Unpin object and remove all references from pin names
- // TODO: Destroy children?
- _destroyObjectIfPinned: function _destroyObjectIfPinned(object
- /*: ParseObject*/
- ) {
- var _this6 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
- var localDatastore, objectKey, pin, promises, key, pinned;
- return _regeneratorRuntime().wrap(function _callee6$(_context10) {
- while (1) {
- switch (_context10.prev = _context10.next) {
- case 0:
- if (_this6.isEnabled) {
- _context10.next = 2;
- break;
- }
- return _context10.abrupt("return");
- case 2:
- _context10.next = 4;
- return _this6._getAllContents();
- case 4:
- localDatastore = _context10.sent;
- objectKey = _this6.getKeyForObject(object);
- pin = localDatastore[objectKey];
- if (pin) {
- _context10.next = 9;
- break;
- }
- return _context10.abrupt("return");
- case 9:
- promises = [_this6.unPinWithName(objectKey)];
- delete localDatastore[objectKey];
- for (key in localDatastore) {
- if (key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX)) {
- pinned = localDatastore[key] || [];
- if ((0, _includes.default)(pinned).call(pinned, objectKey)) {
- pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
- return item !== objectKey;
- });
- if (pinned.length == 0) {
- promises.push(_this6.unPinWithName(key));
- delete localDatastore[key];
- } else {
- promises.push(_this6.pinWithName(key, pinned));
- localDatastore[key] = pinned;
- }
- }
- }
- }
- return _context10.abrupt("return", _promise.default.all(promises));
- case 13:
- case "end":
- return _context10.stop();
- }
- }
- }, _callee6);
- }))();
- },
- // Update pin and references of the unsaved object
- _updateLocalIdForObject: function _updateLocalIdForObject(localId
- /*: string*/
- , object
- /*: ParseObject*/
- ) {
- var _this7 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
- var _context11, _context12;
- var localKey, objectKey, unsaved, promises, localDatastore, key, pinned;
- return _regeneratorRuntime().wrap(function _callee7$(_context13) {
- while (1) {
- switch (_context13.prev = _context13.next) {
- case 0:
- if (_this7.isEnabled) {
- _context13.next = 2;
- break;
- }
- return _context13.abrupt("return");
- case 2:
- localKey = (0, _concat.default)(_context11 = (0, _concat.default)(_context12 = "".concat(_LocalDatastoreUtils.OBJECT_PREFIX)).call(_context12, object.className, "_")).call(_context11, localId);
- objectKey = _this7.getKeyForObject(object);
- _context13.next = 6;
- return _this7.fromPinWithName(localKey);
- case 6:
- unsaved = _context13.sent;
- if (!(!unsaved || unsaved.length === 0)) {
- _context13.next = 9;
- break;
- }
- return _context13.abrupt("return");
- case 9:
- promises = [_this7.unPinWithName(localKey), _this7.pinWithName(objectKey, unsaved)];
- _context13.next = 12;
- return _this7._getAllContents();
- case 12:
- localDatastore = _context13.sent;
- for (key in localDatastore) {
- if (key === _LocalDatastoreUtils.DEFAULT_PIN || (0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.PIN_PREFIX)) {
- pinned = localDatastore[key] || [];
- if ((0, _includes.default)(pinned).call(pinned, localKey)) {
- pinned = (0, _filter.default)(pinned).call(pinned, function (item) {
- return item !== localKey;
- });
- pinned.push(objectKey);
- promises.push(_this7.pinWithName(key, pinned));
- localDatastore[key] = pinned;
- }
- }
- }
- return _context13.abrupt("return", _promise.default.all(promises));
- case 15:
- case "end":
- return _context13.stop();
- }
- }
- }, _callee7);
- }))();
- },
- /**
- * Updates Local Datastore from Server
- *
- * <pre>
- * await Parse.LocalDatastore.updateFromServer();
- * </pre>
- *
- * @function updateFromServer
- * @name Parse.LocalDatastore.updateFromServer
- * @static
- */
- updateFromServer: function updateFromServer() {
- var _this8 = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
- var _context14;
- var localDatastore, keys, key, pointersHash, _i, _keys, _key, _key$split, _key$split2, className, objectId, queryPromises, responses, objects, pinPromises;
- return _regeneratorRuntime().wrap(function _callee8$(_context15) {
- while (1) {
- switch (_context15.prev = _context15.next) {
- case 0:
- if (!(!_this8.checkIfEnabled() || _this8.isSyncing)) {
- _context15.next = 2;
- break;
- }
- return _context15.abrupt("return");
- case 2:
- _context15.next = 4;
- return _this8._getAllContents();
- case 4:
- localDatastore = _context15.sent;
- keys = [];
- for (key in localDatastore) {
- if ((0, _startsWith.default)(key).call(key, _LocalDatastoreUtils.OBJECT_PREFIX)) {
- keys.push(key);
- }
- }
- if (!(keys.length === 0)) {
- _context15.next = 9;
- break;
- }
- return _context15.abrupt("return");
- case 9:
- _this8.isSyncing = true;
- pointersHash = {};
- _i = 0, _keys = keys;
- case 12:
- if (!(_i < _keys.length)) {
- _context15.next = 23;
- break;
- }
- _key = _keys[_i]; // Ignore the OBJECT_PREFIX
- _key$split = _key.split('_'), _key$split2 = (0, _slicedToArray2.default)(_key$split, 4), className = _key$split2[2], objectId = _key$split2[3]; // User key is split into [ 'Parse', 'LDS', '', 'User', 'objectId' ]
- if (_key.split('_').length === 5 && _key.split('_')[3] === 'User') {
- className = '_User';
- objectId = _key.split('_')[4];
- }
- if (!(0, _startsWith.default)(objectId).call(objectId, 'local')) {
- _context15.next = 18;
- break;
- }
- return _context15.abrupt("continue", 20);
- case 18:
- if (!(className in pointersHash)) {
- pointersHash[className] = new _set.default();
- }
- pointersHash[className].add(objectId);
- case 20:
- _i++;
- _context15.next = 12;
- break;
- case 23:
- queryPromises = (0, _map.default)(_context14 = (0, _keys3.default)(pointersHash)).call(_context14, function (className) {
- var objectIds = (0, _from.default)(pointersHash[className]);
- var query = new _ParseQuery.default(className);
- query.limit(objectIds.length);
- if (objectIds.length === 1) {
- query.equalTo('objectId', objectIds[0]);
- } else {
- query.containedIn('objectId', objectIds);
- }
- return (0, _find.default)(query).call(query);
- });
- _context15.prev = 24;
- _context15.next = 27;
- return _promise.default.all(queryPromises);
- case 27:
- responses = _context15.sent;
- objects = (0, _concat.default)([]).apply([], responses);
- pinPromises = (0, _map.default)(objects).call(objects, function (object) {
- var objectKey = _this8.getKeyForObject(object);
- return _this8.pinWithName(objectKey, object._toFullJSON());
- });
- _context15.next = 32;
- return _promise.default.all(pinPromises);
- case 32:
- _this8.isSyncing = false;
- _context15.next = 39;
- break;
- case 35:
- _context15.prev = 35;
- _context15.t0 = _context15["catch"](24);
- console.error('Error syncing LocalDatastore: ', _context15.t0);
- _this8.isSyncing = false;
- case 39:
- case "end":
- return _context15.stop();
- }
- }
- }, _callee8, null, [[24, 35]]);
- }))();
- },
- getKeyForObject: function getKeyForObject(object
- /*: any*/
- ) {
- var _context16, _context17;
- var objectId = object.objectId || object._getId();
- return (0, _concat.default)(_context16 = (0, _concat.default)(_context17 = "".concat(_LocalDatastoreUtils.OBJECT_PREFIX)).call(_context17, object.className, "_")).call(_context16, objectId);
- },
- getPinName: function getPinName(pinName
- /*: ?string*/
- ) {
- if (!pinName || pinName === _LocalDatastoreUtils.DEFAULT_PIN) {
- return _LocalDatastoreUtils.DEFAULT_PIN;
- }
- return _LocalDatastoreUtils.PIN_PREFIX + pinName;
- },
- checkIfEnabled: function checkIfEnabled() {
- if (!this.isEnabled) {
- console.error('Parse.enableLocalDatastore() must be called first');
- }
- return this.isEnabled;
- }
- };
- module.exports = LocalDatastore;
- _CoreManager.default.setLocalDatastoreController(_dereq_('./LocalDatastoreController'));
- _CoreManager.default.setLocalDatastore(LocalDatastore);
- },{"./CoreManager":4,"./LocalDatastoreController":14,"./LocalDatastoreUtils":15,"./ParseQuery":30,"@babel/runtime-corejs3/core-js-stable/array/from":55,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/concat":58,"@babel/runtime-corejs3/core-js-stable/instance/filter":61,"@babel/runtime-corejs3/core-js-stable/instance/find":63,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/includes":65,"@babel/runtime-corejs3/core-js-stable/instance/keys":67,"@babel/runtime-corejs3/core-js-stable/instance/map":68,"@babel/runtime-corejs3/core-js-stable/instance/reverse":70,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/instance/starts-with":74,"@babel/runtime-corejs3/core-js-stable/object/create":80,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":88,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":90,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/set":96,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/core-js/get-iterator-method":101,"@babel/runtime-corejs3/helpers/asyncToGenerator":120,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/slicedToArray":137,"@babel/runtime-corejs3/helpers/toConsumableArray":139,"@babel/runtime-corejs3/helpers/typeof":140,"@babel/runtime-corejs3/regenerator":144}],14:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Array$isArray = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
- var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
- var _Array$from = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
- var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
- var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
- var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
- var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
- var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
- var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
- var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
- var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
- var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _reduce = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
- var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
- var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
- var _LocalDatastoreUtils = _dereq_("./LocalDatastoreUtils");
- var _Storage = _interopRequireDefault(_dereq_("./Storage"));
- function _createForOfIteratorHelper(o, allowArrayLike) {
- var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || 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 () {};
- return {
- s: F,
- n: function () {
- if (i >= o.length) return {
- done: true
- };
- return {
- done: false,
- value: o[i++]
- };
- },
- e: function (_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 () {
- it = it.call(o);
- },
- n: function () {
- var step = it.next();
- normalCompletion = step.done;
- return step;
- },
- e: function (_e2) {
- didErr = true;
- err = _e2;
- },
- f: function () {
- try {
- if (!normalCompletion && it.return != null) it.return();
- } finally {
- if (didErr) throw err;
- }
- }
- };
- }
- function _unsupportedIterableToArray(o, minLen) {
- var _context9;
- if (!o) return;
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
- var n = _sliceInstanceProperty(_context9 = Object.prototype.toString.call(o)).call(_context9, 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;
- }
- function _regeneratorRuntime() {
- "use strict";
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
- _regeneratorRuntime = function () {
- return exports;
- };
- var exports = {},
- Op = Object.prototype,
- hasOwn = Op.hasOwnProperty,
- $Symbol = "function" == typeof _Symbol ? _Symbol : {},
- iteratorSymbol = $Symbol.iterator || "@@iterator",
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- return _Object$defineProperty(obj, key, {
- value: value,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }), obj[key];
- }
- try {
- define({}, "");
- } catch (err) {
- define = function (obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
- generator = _Object$create(protoGenerator.prototype),
- context = new Context(tryLocsList || []);
- return generator._invoke = function (innerFn, self, context) {
- var state = "suspendedStart";
- return function (method, arg) {
- if ("executing" === state) throw new Error("Generator is already running");
- if ("completed" === state) {
- if ("throw" === method) throw arg;
- return doneResult();
- }
- for (context.method = method, context.arg = arg;;) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
- if ("suspendedStart" === state) throw state = "completed", context.arg;
- context.dispatchException(context.arg);
- } else "return" === context.method && context.abrupt("return", context.arg);
- state = "executing";
- var record = tryCatch(innerFn, self, context);
- if ("normal" === record.type) {
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
- return {
- value: record.arg,
- done: context.done
- };
- }
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
- }
- };
- }(innerFn, self, context), generator;
- }
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- exports.wrap = wrap;
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = _Object$getPrototypeOf,
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
- function defineIteratorMethods(prototype) {
- var _context7;
- _forEachInstanceProperty(_context7 = ["next", "throw", "return"]).call(_context7, function (method) {
- define(prototype, method, function (arg) {
- return this._invoke(method, arg);
- });
- });
- }
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if ("throw" !== record.type) {
- var result = record.arg,
- value = result.value;
- return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
- result.value = unwrapped, resolve(result);
- }, function (error) {
- return invoke("throw", error, resolve, reject);
- });
- }
- reject(record.arg);
- }
- var previousPromise;
- this._invoke = function (method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (undefined === method) {
- if (context.delegate = null, "throw" === context.method) {
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
- var info = record.arg;
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
- }
- function pushTryEntry(locs) {
- var entry = {
- tryLoc: locs[0]
- };
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal", delete record.arg, entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{
- tryLoc: "root"
- }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
- }
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) return iteratorMethod.call(iterable);
- if ("function" == typeof iterable.next) return iterable;
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- for (; ++i < iterable.length;) {
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
- }
- return next.value = undefined, next.done = !0, next;
- };
- return next.next = next;
- }
- }
- return {
- next: doneResult
- };
- }
- function doneResult() {
- return {
- value: undefined,
- done: !0
- };
- }
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
- var ctor = "function" == typeof genFun && genFun.constructor;
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
- }, exports.mark = function (genFun) {
- return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
- }, exports.awrap = function (arg) {
- return {
- __await: arg
- };
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- void 0 === PromiseImpl && (PromiseImpl = _Promise2);
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
- return this;
- }), define(Gp, "toString", function () {
- return "[object Generator]";
- }), exports.keys = function (object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- return _reverseInstanceProperty(keys).call(keys), function next() {
- for (; keys.length;) {
- var key = keys.pop();
- if (key in object) return next.value = key, next.done = !1, next;
- }
- return next.done = !0, next;
- };
- }, exports.values = values, Context.prototype = {
- constructor: Context,
- reset: function (skipTempReset) {
- var _context8;
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context8 = this.tryEntries).call(_context8, resetTryEntry), !skipTempReset) for (var name in this) {
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
- }
- },
- stop: function () {
- this.done = !0;
- var rootRecord = this.tryEntries[0].completion;
- if ("throw" === rootRecord.type) throw rootRecord.arg;
- return this.rval;
- },
- dispatchException: function (exception) {
- if (this.done) throw exception;
- var context = this;
- function handle(loc, caught) {
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i],
- record = entry.completion;
- if ("root" === entry.tryLoc) return handle("end");
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc"),
- hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- } else {
- if (!hasFinally) throw new Error("try statement without catch or finally");
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- }
- }
- }
- },
- abrupt: function (type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
- var record = finallyEntry ? finallyEntry.completion : {};
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
- },
- complete: function (record, afterLoc) {
- if ("throw" === record.type) throw record.arg;
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
- },
- finish: function (finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
- }
- },
- catch: function (tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if ("throw" === record.type) {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function (iterable, resultName, nextLoc) {
- return this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
- }
- }, exports;
- }
- var LocalDatastoreController = {
- fromPinWithName: function (name
- /*: string*/
- )
- /*: Array<Object>*/
- {
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
- var values, objects;
- return _regeneratorRuntime().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _context.next = 2;
- return _Storage.default.getItemAsync(name);
- case 2:
- values = _context.sent;
- if (values) {
- _context.next = 5;
- break;
- }
- return _context.abrupt("return", []);
- case 5:
- objects = JSON.parse(values);
- return _context.abrupt("return", objects);
- case 7:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
- }))();
- },
- pinWithName: function pinWithName(name
- /*: string*/
- , value
- /*: any*/
- ) {
- var values = (0, _stringify.default)(value);
- return _Storage.default.setItemAsync(name, values);
- },
- unPinWithName: function unPinWithName(name
- /*: string*/
- ) {
- return _Storage.default.removeItemAsync(name);
- },
- getAllContents: function getAllContents()
- /*: Object*/
- {
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
- var keys;
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- _context3.next = 2;
- return _Storage.default.getAllKeysAsync();
- case 2:
- keys = _context3.sent;
- return _context3.abrupt("return", (0, _reduce.default)(keys).call(keys, /*#__PURE__*/function () {
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(previousPromise, key) {
- var LDS, value;
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- _context2.next = 2;
- return previousPromise;
- case 2:
- LDS = _context2.sent;
- if (!(0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
- _context2.next = 8;
- break;
- }
- _context2.next = 6;
- return _Storage.default.getItemAsync(key);
- case 6:
- value = _context2.sent;
- try {
- LDS[key] = JSON.parse(value);
- } catch (error) {
- console.error('Error getAllContents: ', error);
- }
- case 8:
- return _context2.abrupt("return", LDS);
- case 9:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
- }));
- return function (_x, _x2) {
- return _ref.apply(this, arguments);
- };
- }(), _promise.default.resolve({})));
- case 4:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3);
- }))();
- },
- // Used for testing
- getRawStorage: function getRawStorage()
- /*: Object*/
- {
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
- var keys;
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- _context5.next = 2;
- return _Storage.default.getAllKeysAsync();
- case 2:
- keys = _context5.sent;
- return _context5.abrupt("return", (0, _reduce.default)(keys).call(keys, /*#__PURE__*/function () {
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(previousPromise, key) {
- var LDS, value;
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- _context4.next = 2;
- return previousPromise;
- case 2:
- LDS = _context4.sent;
- _context4.next = 5;
- return _Storage.default.getItemAsync(key);
- case 5:
- value = _context4.sent;
- LDS[key] = value;
- return _context4.abrupt("return", LDS);
- case 8:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4);
- }));
- return function (_x3, _x4) {
- return _ref2.apply(this, arguments);
- };
- }(), _promise.default.resolve({})));
- case 4:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5);
- }))();
- },
- clear: function clear()
- /*: Promise*/
- {
- var _this = this;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
- var keys, toRemove, _iterator, _step, key, promises;
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- _context6.next = 2;
- return _Storage.default.getAllKeysAsync();
- case 2:
- keys = _context6.sent;
- toRemove = [];
- _iterator = _createForOfIteratorHelper(keys);
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- key = _step.value;
- if ((0, _LocalDatastoreUtils.isLocalDatastoreKey)(key)) {
- toRemove.push(key);
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- promises = (0, _map.default)(toRemove).call(toRemove, _this.unPinWithName);
- return _context6.abrupt("return", _promise.default.all(promises));
- case 8:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6);
- }))();
- }
- };
- module.exports = LocalDatastoreController;
- },{"./LocalDatastoreUtils":15,"./Storage":39,"@babel/runtime-corejs3/core-js-stable/array/from":55,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/map":68,"@babel/runtime-corejs3/core-js-stable/instance/reduce":69,"@babel/runtime-corejs3/core-js-stable/instance/reverse":70,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/object/create":80,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":88,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":90,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/core-js/get-iterator-method":101,"@babel/runtime-corejs3/helpers/asyncToGenerator":120,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],15:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.PIN_PREFIX = exports.OBJECT_PREFIX = exports.DEFAULT_PIN = void 0;
- exports.isLocalDatastoreKey = isLocalDatastoreKey;
- var _startsWith = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- * @private
- */
- var DEFAULT_PIN = '_default';
- exports.DEFAULT_PIN = DEFAULT_PIN;
- var PIN_PREFIX = 'parsePin_';
- exports.PIN_PREFIX = PIN_PREFIX;
- var OBJECT_PREFIX = 'Parse_LDS_';
- exports.OBJECT_PREFIX = OBJECT_PREFIX;
- function isLocalDatastoreKey(key
- /*: string*/
- )
- /*: boolean*/
- {
- return !!(key && (key === DEFAULT_PIN || (0, _startsWith.default)(key).call(key, PIN_PREFIX) || (0, _startsWith.default)(key).call(key, OBJECT_PREFIX)));
- }
- },{"@babel/runtime-corejs3/core-js-stable/instance/starts-with":74,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],16:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
- var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
- var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
- var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
- var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
- var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
- var _Object$keys = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.commitServerChanges = commitServerChanges;
- exports.defaultState = defaultState;
- exports.estimateAttribute = estimateAttribute;
- exports.estimateAttributes = estimateAttributes;
- exports.mergeFirstPendingState = mergeFirstPendingState;
- exports.popPendingState = popPendingState;
- exports.pushPendingState = pushPendingState;
- exports.setPendingOp = setPendingOp;
- exports.setServerData = setServerData;
- var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
- var _encode = _interopRequireDefault(_dereq_("./encode"));
- var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
- var _TaskQueue = _interopRequireDefault(_dereq_("./TaskQueue"));
- var _ParseOp = _dereq_("./ParseOp");
- function ownKeys(object, enumerableOnly) {
- var keys = _Object$keys(object);
- if (_Object$getOwnPropertySymbols) {
- var symbols = _Object$getOwnPropertySymbols(object);
- enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, 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 _context, _context2;
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) {
- (0, _defineProperty2.default)(target, key, source[key]);
- }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) {
- _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function defaultState()
- /*: State*/
- {
- return {
- serverData: {},
- pendingOps: [{}],
- objectCache: {},
- tasks: new _TaskQueue.default(),
- existed: false
- };
- }
- function setServerData(serverData
- /*: AttributeMap*/
- , attributes
- /*: AttributeMap*/
- ) {
- for (var _attr in attributes) {
- if (typeof attributes[_attr] !== 'undefined') {
- serverData[_attr] = attributes[_attr];
- } else {
- delete serverData[_attr];
- }
- }
- }
- function setPendingOp(pendingOps
- /*: Array<OpsMap>*/
- , attr
- /*: string*/
- , op
- /*: ?Op*/
- ) {
- var last = pendingOps.length - 1;
- if (op) {
- pendingOps[last][attr] = op;
- } else {
- delete pendingOps[last][attr];
- }
- }
- function pushPendingState(pendingOps
- /*: Array<OpsMap>*/
- ) {
- pendingOps.push({});
- }
- function popPendingState(pendingOps
- /*: Array<OpsMap>*/
- )
- /*: OpsMap*/
- {
- var first = pendingOps.shift();
- if (!pendingOps.length) {
- pendingOps[0] = {};
- }
- return first;
- }
- function mergeFirstPendingState(pendingOps
- /*: Array<OpsMap>*/
- ) {
- var first = popPendingState(pendingOps);
- var next = pendingOps[0];
- for (var _attr2 in first) {
- if (next[_attr2] && first[_attr2]) {
- var merged = next[_attr2].mergeWith(first[_attr2]);
- if (merged) {
- next[_attr2] = merged;
- }
- } else {
- next[_attr2] = first[_attr2];
- }
- }
- }
- function estimateAttribute(serverData
- /*: AttributeMap*/
- , pendingOps
- /*: Array<OpsMap>*/
- , className
- /*: string*/
- , id
- /*: ?string*/
- , attr
- /*: string*/
- )
- /*: mixed*/
- {
- var value = serverData[attr];
- for (var i = 0; i < pendingOps.length; i++) {
- if (pendingOps[i][attr]) {
- if (pendingOps[i][attr] instanceof _ParseOp.RelationOp) {
- if (id) {
- value = pendingOps[i][attr].applyTo(value, {
- className: className,
- id: id
- }, attr);
- }
- } else {
- value = pendingOps[i][attr].applyTo(value);
- }
- }
- }
- return value;
- }
- function estimateAttributes(serverData
- /*: AttributeMap*/
- , pendingOps
- /*: Array<OpsMap>*/
- , className
- /*: string*/
- , id
- /*: ?string*/
- )
- /*: AttributeMap*/
- {
- var data = {};
- for (var attr in serverData) {
- data[attr] = serverData[attr];
- }
- for (var i = 0; i < pendingOps.length; i++) {
- for (attr in pendingOps[i]) {
- if (pendingOps[i][attr] instanceof _ParseOp.RelationOp) {
- if (id) {
- data[attr] = pendingOps[i][attr].applyTo(data[attr], {
- className: className,
- id: id
- }, attr);
- }
- } else {
- if ((0, _includes.default)(attr).call(attr, '.')) {
- // convert a.b.c into { a: { b: { c: value } } }
- var fields = attr.split('.');
- var first = fields[0];
- var last = fields[fields.length - 1];
- data[first] = _objectSpread({}, serverData[first]);
- var object = _objectSpread({}, data);
- for (var _i = 0; _i < fields.length - 1; _i++) {
- var key = fields[_i];
- if (!(key in object)) {
- object[key] = {};
- }
- object = object[key];
- }
- object[last] = pendingOps[i][attr].applyTo(object[last]);
- } else {
- data[attr] = pendingOps[i][attr].applyTo(data[attr]);
- }
- }
- }
- }
- return data;
- }
- function nestedSet(obj, key, value) {
- var path = key.split('.');
- for (var i = 0; i < path.length - 1; i++) {
- if (!(path[i] in obj)) obj[path[i]] = {};
- obj = obj[path[i]];
- }
- if (typeof value === 'undefined') {
- delete obj[path[path.length - 1]];
- } else {
- obj[path[path.length - 1]] = value;
- }
- }
- function commitServerChanges(serverData
- /*: AttributeMap*/
- , objectCache
- /*: ObjectCache*/
- , changes
- /*: AttributeMap*/
- ) {
- for (var _attr3 in changes) {
- var val = changes[_attr3];
- nestedSet(serverData, _attr3, val);
- if (val && (0, _typeof2.default)(val) === 'object' && !(val instanceof _ParseObject.default) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
- var json = (0, _encode.default)(val, false, true);
- objectCache[_attr3] = (0, _stringify.default)(json);
- }
- }
- }
- },{"./ParseFile":23,"./ParseObject":27,"./ParseOp":28,"./ParseRelation":31,"./TaskQueue":41,"./encode":46,"@babel/runtime-corejs3/core-js-stable/instance/filter":61,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/includes":65,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/object/define-properties":81,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":85,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":86,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":87,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],17:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Array$isArray2 = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
- var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
- var _Array$from = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
- var _sliceInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
- var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
- var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
- var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
- var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _isInteger = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/number/is-integer"));
- var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
- var _slice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice"));
- var _filter = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter"));
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- function _createForOfIteratorHelper(o, allowArrayLike) {
- var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
- if (!it) {
- if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it) o = it;
- var i = 0;
- var F = function () {};
- return {
- s: F,
- n: function () {
- if (i >= o.length) return {
- done: true
- };
- return {
- done: false,
- value: o[i++]
- };
- },
- e: function (_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 () {
- it = it.call(o);
- },
- n: function () {
- var step = it.next();
- normalCompletion = step.done;
- return step;
- },
- e: function (_e2) {
- didErr = true;
- err = _e2;
- },
- f: function () {
- try {
- if (!normalCompletion && it.return != null) it.return();
- } finally {
- if (didErr) throw err;
- }
- }
- };
- }
- function _unsupportedIterableToArray(o, minLen) {
- var _context6;
- if (!o) return;
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
- var n = _sliceInstanceProperty2(_context6 = Object.prototype.toString.call(o)).call(_context6, 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 equalObjects = _dereq_('./equals').default;
- var decode = _dereq_('./decode').default;
- var ParseError = _dereq_('./ParseError').default;
- var ParsePolygon = _dereq_('./ParsePolygon').default;
- var ParseGeoPoint = _dereq_('./ParseGeoPoint').default;
- /**
- * contains -- Determines if an object is contained in a list with special handling for Parse pointers.
- *
- * @param haystack
- * @param needle
- * @private
- * @returns {boolean}
- */
- function contains(haystack, needle) {
- if (needle && needle.__type && (needle.__type === 'Pointer' || needle.__type === 'Object')) {
- for (var i in haystack) {
- var ptr = haystack[i];
- if (typeof ptr === 'string' && ptr === needle.objectId) {
- return true;
- }
- if (ptr.className === needle.className && ptr.objectId === needle.objectId) {
- return true;
- }
- }
- return false;
- }
- return (0, _indexOf.default)(haystack).call(haystack, needle) > -1;
- }
- function transformObject(object) {
- if (object._toFullJSON) {
- return object._toFullJSON();
- }
- return object;
- }
- /**
- * matchesQuery -- Determines if an object would be returned by a Parse Query
- * It's a lightweight, where-clause only implementation of a full query engine.
- * Since we find queries that match objects, rather than objects that match
- * queries, we can avoid building a full-blown query tool.
- *
- * @param className
- * @param object
- * @param objects
- * @param query
- * @private
- * @returns {boolean}
- */
- function matchesQuery(className, object, objects, query) {
- if (object.className !== className) {
- return false;
- }
- var obj = object;
- var q = query;
- if (object.toJSON) {
- obj = object.toJSON();
- }
- if (query.toJSON) {
- q = query.toJSON().where;
- }
- obj.className = className;
- for (var field in q) {
- if (!matchesKeyConstraints(className, obj, objects, field, q[field])) {
- return false;
- }
- }
- return true;
- }
- function equalObjectsGeneric(obj, compareTo, eqlFn) {
- if ((0, _isArray.default)(obj)) {
- for (var i = 0; i < obj.length; i++) {
- if (eqlFn(obj[i], compareTo)) {
- return true;
- }
- }
- return false;
- }
- return eqlFn(obj, compareTo);
- }
- /**
- * @typedef RelativeTimeToDateResult
- * @property {string} status The conversion status, `error` if conversion failed or
- * `success` if conversion succeeded.
- * @property {string} info The error message if conversion failed, or the relative
- * time indication (`past`, `present`, `future`) if conversion succeeded.
- * @property {Date|undefined} result The converted date, or `undefined` if conversion
- * failed.
- */
- /**
- * Converts human readable relative date string, for example, 'in 10 days' to a date
- * relative to now.
- *
- * @param {string} text The text to convert.
- * @param {Date} [now=new Date()] The date from which add or subtract. Default is now.
- * @returns {RelativeTimeToDateResult}
- */
- function relativeTimeToDate(text) {
- var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();
- text = text.toLowerCase();
- var parts = text.split(' '); // Filter out whitespace
- parts = (0, _filter.default)(parts).call(parts, function (part) {
- return part !== '';
- });
- var future = parts[0] === 'in';
- var past = parts[parts.length - 1] === 'ago';
- if (!future && !past && text !== 'now') {
- return {
- status: 'error',
- info: "Time should either start with 'in' or end with 'ago'"
- };
- }
- if (future && past) {
- return {
- status: 'error',
- info: "Time cannot have both 'in' and 'ago'"
- };
- } // strip the 'ago' or 'in'
- if (future) {
- parts = (0, _slice.default)(parts).call(parts, 1);
- } else {
- // past
- parts = (0, _slice.default)(parts).call(parts, 0, parts.length - 1);
- }
- if (parts.length % 2 !== 0 && text !== 'now') {
- return {
- status: 'error',
- info: 'Invalid time string. Dangling unit or number.'
- };
- }
- var pairs = [];
- while (parts.length) {
- pairs.push([parts.shift(), parts.shift()]);
- }
- var seconds = 0;
- for (var _i = 0, _pairs = pairs; _i < _pairs.length; _i++) {
- var _pairs$_i = (0, _slicedToArray2.default)(_pairs[_i], 2),
- num = _pairs$_i[0],
- interval = _pairs$_i[1];
- var val = Number(num);
- if (!(0, _isInteger.default)(val)) {
- return {
- status: 'error',
- info: "'".concat(num, "' is not an integer.")
- };
- }
- switch (interval) {
- case 'yr':
- case 'yrs':
- case 'year':
- case 'years':
- seconds += val * 31536000; // 365 * 24 * 60 * 60
- break;
- case 'wk':
- case 'wks':
- case 'week':
- case 'weeks':
- seconds += val * 604800; // 7 * 24 * 60 * 60
- break;
- case 'd':
- case 'day':
- case 'days':
- seconds += val * 86400; // 24 * 60 * 60
- break;
- case 'hr':
- case 'hrs':
- case 'hour':
- case 'hours':
- seconds += val * 3600; // 60 * 60
- break;
- case 'min':
- case 'mins':
- case 'minute':
- case 'minutes':
- seconds += val * 60;
- break;
- case 'sec':
- case 'secs':
- case 'second':
- case 'seconds':
- seconds += val;
- break;
- default:
- return {
- status: 'error',
- info: "Invalid interval: '".concat(interval, "'")
- };
- }
- }
- var milliseconds = seconds * 1000;
- if (future) {
- return {
- status: 'success',
- info: 'future',
- result: new Date(now.valueOf() + milliseconds)
- };
- } else if (past) {
- return {
- status: 'success',
- info: 'past',
- result: new Date(now.valueOf() - milliseconds)
- };
- } else {
- return {
- status: 'success',
- info: 'present',
- result: new Date(now.valueOf())
- };
- }
- }
- /**
- * Determines whether an object matches a single key's constraints
- *
- * @param className
- * @param object
- * @param objects
- * @param key
- * @param constraints
- * @private
- * @returns {boolean}
- */
- function matchesKeyConstraints(className, object, objects, key, constraints) {
- if (constraints === null) {
- return false;
- }
- if ((0, _indexOf.default)(key).call(key, '.') >= 0) {
- // Key references a subobject
- var keyComponents = key.split('.');
- var subObjectKey = keyComponents[0];
- var keyRemainder = (0, _slice.default)(keyComponents).call(keyComponents, 1).join('.');
- return matchesKeyConstraints(className, object[subObjectKey] || {}, objects, keyRemainder, constraints);
- }
- var i;
- if (key === '$or') {
- for (i = 0; i < constraints.length; i++) {
- if (matchesQuery(className, object, objects, constraints[i])) {
- return true;
- }
- }
- return false;
- }
- if (key === '$and') {
- for (i = 0; i < constraints.length; i++) {
- if (!matchesQuery(className, object, objects, constraints[i])) {
- return false;
- }
- }
- return true;
- }
- if (key === '$nor') {
- for (i = 0; i < constraints.length; i++) {
- if (matchesQuery(className, object, objects, constraints[i])) {
- return false;
- }
- }
- return true;
- }
- if (key === '$relatedTo') {
- // Bail! We can't handle relational queries locally
- return false;
- }
- if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(key)) {
- throw new ParseError(ParseError.INVALID_KEY_NAME, "Invalid Key: ".concat(key));
- } // Equality (or Array contains) cases
- if ((0, _typeof2.default)(constraints) !== 'object') {
- if ((0, _isArray.default)(object[key])) {
- var _context;
- return (0, _indexOf.default)(_context = object[key]).call(_context, constraints) > -1;
- }
- return object[key] === constraints;
- }
- var compareTo;
- if (constraints.__type) {
- if (constraints.__type === 'Pointer') {
- return equalObjectsGeneric(object[key], constraints, function (obj, ptr) {
- return typeof obj !== 'undefined' && ptr.className === obj.className && ptr.objectId === obj.objectId;
- });
- }
- return equalObjectsGeneric(decode(object[key]), decode(constraints), equalObjects);
- } // More complex cases
- for (var condition in constraints) {
- compareTo = constraints[condition];
- if (compareTo.__type) {
- compareTo = decode(compareTo);
- } // is it a $relativeTime? convert to date
- if (compareTo['$relativeTime']) {
- var parserResult = relativeTimeToDate(compareTo['$relativeTime']);
- if (parserResult.status !== 'success') {
- var _context2;
- throw new ParseError(ParseError.INVALID_JSON, (0, _concat.default)(_context2 = "bad $relativeTime (".concat(key, ") value. ")).call(_context2, parserResult.info));
- }
- compareTo = parserResult.result;
- } // Compare Date Object or Date String
- if (toString.call(compareTo) === '[object Date]' || typeof compareTo === 'string' && new Date(compareTo) !== 'Invalid Date' && !isNaN(new Date(compareTo))) {
- object[key] = new Date(object[key].iso ? object[key].iso : object[key]);
- }
- switch (condition) {
- case '$lt':
- if (object[key] >= compareTo) {
- return false;
- }
- break;
- case '$lte':
- if (object[key] > compareTo) {
- return false;
- }
- break;
- case '$gt':
- if (object[key] <= compareTo) {
- return false;
- }
- break;
- case '$gte':
- if (object[key] < compareTo) {
- return false;
- }
- break;
- case '$ne':
- if (equalObjects(object[key], compareTo)) {
- return false;
- }
- break;
- case '$in':
- if (!contains(compareTo, object[key])) {
- return false;
- }
- break;
- case '$nin':
- if (contains(compareTo, object[key])) {
- return false;
- }
- break;
- case '$all':
- for (i = 0; i < compareTo.length; i++) {
- var _context3;
- if ((0, _indexOf.default)(_context3 = object[key]).call(_context3, compareTo[i]) < 0) {
- return false;
- }
- }
- break;
- case '$exists':
- {
- var propertyExists = typeof object[key] !== 'undefined';
- var existenceIsRequired = constraints['$exists'];
- if (typeof constraints['$exists'] !== 'boolean') {
- // The SDK will never submit a non-boolean for $exists, but if someone
- // tries to submit a non-boolean for $exits outside the SDKs, just ignore it.
- break;
- }
- if (!propertyExists && existenceIsRequired || propertyExists && !existenceIsRequired) {
- return false;
- }
- break;
- }
- case '$regex':
- {
- if ((0, _typeof2.default)(compareTo) === 'object') {
- return compareTo.test(object[key]);
- } // JS doesn't support perl-style escaping
- var expString = '';
- var escapeEnd = -2;
- var escapeStart = (0, _indexOf.default)(compareTo).call(compareTo, '\\Q');
- while (escapeStart > -1) {
- // Add the unescaped portion
- expString += compareTo.substring(escapeEnd + 2, escapeStart);
- escapeEnd = (0, _indexOf.default)(compareTo).call(compareTo, '\\E', escapeStart);
- if (escapeEnd > -1) {
- expString += compareTo.substring(escapeStart + 2, escapeEnd).replace(/\\\\\\\\E/g, '\\E').replace(/\W/g, '\\$&');
- }
- escapeStart = (0, _indexOf.default)(compareTo).call(compareTo, '\\Q', escapeEnd);
- }
- expString += compareTo.substring(Math.max(escapeStart, escapeEnd + 2));
- var modifiers = constraints.$options || '';
- modifiers = modifiers.replace('x', '').replace('s', ''); // Parse Server / Mongo support x and s modifiers but JS RegExp doesn't
- var exp = new RegExp(expString, modifiers);
- if (!exp.test(object[key])) {
- return false;
- }
- break;
- }
- case '$nearSphere':
- {
- if (!compareTo || !object[key]) {
- return false;
- }
- var distance = compareTo.radiansTo(object[key]);
- var max = constraints.$maxDistance || Infinity;
- return distance <= max;
- }
- case '$within':
- {
- if (!compareTo || !object[key]) {
- return false;
- }
- var southWest = compareTo.$box[0];
- var northEast = compareTo.$box[1];
- if (southWest.latitude > northEast.latitude || southWest.longitude > northEast.longitude) {
- // Invalid box, crosses the date line
- return false;
- }
- return object[key].latitude > southWest.latitude && object[key].latitude < northEast.latitude && object[key].longitude > southWest.longitude && object[key].longitude < northEast.longitude;
- }
- case '$options':
- // Not a query type, but a way to add options to $regex. Ignore and
- // avoid the default
- break;
- case '$maxDistance':
- // Not a query type, but a way to add a cap to $nearSphere. Ignore and
- // avoid the default
- break;
- case '$select':
- {
- var subQueryObjects = (0, _filter.default)(objects).call(objects, function (obj, index, arr) {
- return matchesQuery(compareTo.query.className, obj, arr, compareTo.query.where);
- });
- for (var _i2 = 0; _i2 < subQueryObjects.length; _i2 += 1) {
- var subObject = transformObject(subQueryObjects[_i2]);
- return equalObjects(object[key], subObject[compareTo.key]);
- }
- return false;
- }
- case '$dontSelect':
- {
- var _subQueryObjects = (0, _filter.default)(objects).call(objects, function (obj, index, arr) {
- return matchesQuery(compareTo.query.className, obj, arr, compareTo.query.where);
- });
- for (var _i3 = 0; _i3 < _subQueryObjects.length; _i3 += 1) {
- var _subObject = transformObject(_subQueryObjects[_i3]);
- return !equalObjects(object[key], _subObject[compareTo.key]);
- }
- return false;
- }
- case '$inQuery':
- {
- var _subQueryObjects2 = (0, _filter.default)(objects).call(objects, function (obj, index, arr) {
- return matchesQuery(compareTo.className, obj, arr, compareTo.where);
- });
- for (var _i4 = 0; _i4 < _subQueryObjects2.length; _i4 += 1) {
- var _subObject2 = transformObject(_subQueryObjects2[_i4]);
- if (object[key].className === _subObject2.className && object[key].objectId === _subObject2.objectId) {
- return true;
- }
- }
- return false;
- }
- case '$notInQuery':
- {
- var _subQueryObjects3 = (0, _filter.default)(objects).call(objects, function (obj, index, arr) {
- return matchesQuery(compareTo.className, obj, arr, compareTo.where);
- });
- for (var _i5 = 0; _i5 < _subQueryObjects3.length; _i5 += 1) {
- var _subObject3 = transformObject(_subQueryObjects3[_i5]);
- if (object[key].className === _subObject3.className && object[key].objectId === _subObject3.objectId) {
- return false;
- }
- }
- return true;
- }
- case '$containedBy':
- {
- var _iterator = _createForOfIteratorHelper(object[key]),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var value = _step.value;
- if (!contains(compareTo, value)) {
- return false;
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- return true;
- }
- case '$geoWithin':
- {
- if (compareTo.$polygon) {
- var _context4;
- var points = (0, _map.default)(_context4 = compareTo.$polygon).call(_context4, function (geoPoint) {
- return [geoPoint.latitude, geoPoint.longitude];
- });
- var polygon = new ParsePolygon(points);
- return polygon.containsPoint(object[key]);
- }
- if (compareTo.$centerSphere) {
- var _compareTo$$centerSph = (0, _slicedToArray2.default)(compareTo.$centerSphere, 2),
- WGS84Point = _compareTo$$centerSph[0],
- maxDistance = _compareTo$$centerSph[1];
- var centerPoint = new ParseGeoPoint({
- latitude: WGS84Point[1],
- longitude: WGS84Point[0]
- });
- var point = new ParseGeoPoint(object[key]);
- var _distance = point.radiansTo(centerPoint);
- return _distance <= maxDistance;
- }
- break;
- }
- case '$geoIntersects':
- {
- var _polygon = new ParsePolygon(object[key].coordinates);
- var _point = new ParseGeoPoint(compareTo.$point);
- return _polygon.containsPoint(_point);
- }
- default:
- return false;
- }
- }
- return true;
- }
- function validateQuery(query
- /*: any*/
- ) {
- var _context5;
- var q = query;
- if (query.toJSON) {
- q = query.toJSON().where;
- }
- var specialQuerykeys = ['$and', '$or', '$nor', '_rperm', '_wperm', '_perishable_token', '_email_verify_token', '_email_verify_token_expires_at', '_account_lockout_expires_at', '_failed_login_count'];
- (0, _forEach.default)(_context5 = (0, _keys.default)(q)).call(_context5, function (key) {
- if (q && q[key] && q[key].$regex) {
- if (typeof q[key].$options === 'string') {
- if (!q[key].$options.match(/^[imxs]+$/)) {
- throw new ParseError(ParseError.INVALID_QUERY, "Bad $options value for query: ".concat(q[key].$options));
- }
- }
- }
- if ((0, _indexOf.default)(specialQuerykeys).call(specialQuerykeys, key) < 0 && !key.match(/^[a-zA-Z][a-zA-Z0-9_\.]*$/)) {
- throw new ParseError(ParseError.INVALID_KEY_NAME, "Invalid key name: ".concat(key));
- }
- });
- }
- var OfflineQuery = {
- matchesQuery: matchesQuery,
- validateQuery: validateQuery
- };
- module.exports = OfflineQuery;
- },{"./ParseError":22,"./ParseGeoPoint":24,"./ParsePolygon":29,"./decode":45,"./equals":47,"@babel/runtime-corejs3/core-js-stable/array/from":55,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/concat":58,"@babel/runtime-corejs3/core-js-stable/instance/filter":61,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/instance/map":68,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/number/is-integer":78,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/core-js/get-iterator-method":101,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/slicedToArray":137,"@babel/runtime-corejs3/helpers/typeof":140}],18:[function(_dereq_,module,exports){
- (function (process){(function (){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
- var _WeakMap = _dereq_("@babel/runtime-corejs3/core-js-stable/weak-map");
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _decode = _interopRequireDefault(_dereq_("./decode"));
- var _encode = _interopRequireDefault(_dereq_("./encode"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _CryptoController = _interopRequireDefault(_dereq_("./CryptoController"));
- var _EventuallyQueue = _interopRequireDefault(_dereq_("./EventuallyQueue"));
- var _InstallationController = _interopRequireDefault(_dereq_("./InstallationController"));
- var ParseOp = _interopRequireWildcard(_dereq_("./ParseOp"));
- var _RESTController = _interopRequireDefault(_dereq_("./RESTController"));
- function _getRequireWildcardCache(nodeInterop) {
- if (typeof _WeakMap !== "function") return null;
- var cacheBabelInterop = new _WeakMap();
- var cacheNodeInterop = new _WeakMap();
- return (_getRequireWildcardCache = function (nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
- }
- function _interopRequireWildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) {
- return obj;
- }
- if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
- return {
- default: obj
- };
- }
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) {
- return cache.get(obj);
- }
- var newObj = {};
- for (var key in obj) {
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) {
- _Object$defineProperty(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
- newObj.default = obj;
- if (cache) {
- cache.set(obj, newObj);
- }
- return newObj;
- }
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
- /**
- * Contains all Parse API classes and functions.
- *
- * @static
- * @global
- * @class
- * @hideconstructor
- */
- var Parse = {
- /**
- * Call this method first to set up your authentication tokens for Parse.
- *
- * @param {string} applicationId Your Parse Application ID.
- * @param {string} [javaScriptKey] Your Parse JavaScript Key (Not needed for parse-server)
- * @param {string} [masterKey] Your Parse Master Key. (Node.js only!)
- * @static
- */
- initialize: function (applicationId
- /*: string*/
- , javaScriptKey
- /*: string*/
- ) {
- if ("browser" === 'browser' && _CoreManager.default.get('IS_NODE') && !process.env.SERVER_RENDERING) {
- /* eslint-disable no-console */
- console.log("It looks like you're using the browser version of the SDK in a " + "node.js environment. You should require('parse/node') instead.");
- /* eslint-enable no-console */
- }
- Parse._initialize(applicationId, javaScriptKey);
- },
- _initialize: function (applicationId
- /*: string*/
- , javaScriptKey
- /*: string*/
- , masterKey
- /*: string*/
- ) {
- _CoreManager.default.set('APPLICATION_ID', applicationId);
- _CoreManager.default.set('JAVASCRIPT_KEY', javaScriptKey);
- _CoreManager.default.set('MASTER_KEY', masterKey);
- _CoreManager.default.set('USE_MASTER_KEY', false);
- },
- /**
- * Call this method to set your AsyncStorage engine
- * Starting Parse@1.11, the ParseSDK do not provide a React AsyncStorage as the ReactNative module
- * is not provided at a stable path and changes over versions.
- *
- * @param {AsyncStorage} storage a react native async storage.
- * @static
- */
- setAsyncStorage: function (storage
- /*: any*/
- ) {
- _CoreManager.default.setAsyncStorage(storage);
- },
- /**
- * Call this method to set your LocalDatastoreStorage engine
- * If using React-Native use {@link Parse.setAsyncStorage Parse.setAsyncStorage()}
- *
- * @param {LocalDatastoreController} controller a data storage.
- * @static
- */
- setLocalDatastoreController: function (controller
- /*: any*/
- ) {
- _CoreManager.default.setLocalDatastoreController(controller);
- },
- /**
- * Returns information regarding the current server's health
- *
- * @returns {Promise}
- * @static
- */
- getServerHealth: function () {
- return _CoreManager.default.getRESTController().request('GET', 'health');
- },
- /**
- * @member {string} Parse.applicationId
- * @static
- */
- set applicationId(value) {
- _CoreManager.default.set('APPLICATION_ID', value);
- },
- get applicationId() {
- return _CoreManager.default.get('APPLICATION_ID');
- },
- /**
- * @member {string} Parse.javaScriptKey
- * @static
- */
- set javaScriptKey(value) {
- _CoreManager.default.set('JAVASCRIPT_KEY', value);
- },
- get javaScriptKey() {
- return _CoreManager.default.get('JAVASCRIPT_KEY');
- },
- /**
- * @member {string} Parse.masterKey
- * @static
- */
- set masterKey(value) {
- _CoreManager.default.set('MASTER_KEY', value);
- },
- get masterKey() {
- return _CoreManager.default.get('MASTER_KEY');
- },
- /**
- * @member {string} Parse.serverURL
- * @static
- */
- set serverURL(value) {
- _CoreManager.default.set('SERVER_URL', value);
- },
- get serverURL() {
- return _CoreManager.default.get('SERVER_URL');
- },
- /**
- * @member {string} Parse.serverAuthToken
- * @static
- */
- set serverAuthToken(value) {
- _CoreManager.default.set('SERVER_AUTH_TOKEN', value);
- },
- get serverAuthToken() {
- return _CoreManager.default.get('SERVER_AUTH_TOKEN');
- },
- /**
- * @member {string} Parse.serverAuthType
- * @static
- */
- set serverAuthType(value) {
- _CoreManager.default.set('SERVER_AUTH_TYPE', value);
- },
- get serverAuthType() {
- return _CoreManager.default.get('SERVER_AUTH_TYPE');
- },
- /**
- * @member {string} Parse.liveQueryServerURL
- * @static
- */
- set liveQueryServerURL(value) {
- _CoreManager.default.set('LIVEQUERY_SERVER_URL', value);
- },
- get liveQueryServerURL() {
- return _CoreManager.default.get('LIVEQUERY_SERVER_URL');
- },
- /**
- * @member {string} Parse.encryptedUser
- * @static
- */
- set encryptedUser(value) {
- _CoreManager.default.set('ENCRYPTED_USER', value);
- },
- get encryptedUser() {
- return _CoreManager.default.get('ENCRYPTED_USER');
- },
- /**
- * @member {string} Parse.secret
- * @static
- */
- set secret(value) {
- _CoreManager.default.set('ENCRYPTED_KEY', value);
- },
- get secret() {
- return _CoreManager.default.get('ENCRYPTED_KEY');
- },
- /**
- * @member {boolean} Parse.idempotency
- * @static
- */
- set idempotency(value) {
- _CoreManager.default.set('IDEMPOTENCY', value);
- },
- get idempotency() {
- return _CoreManager.default.get('IDEMPOTENCY');
- },
- /**
- * @member {boolean} Parse.allowCustomObjectId
- * @static
- */
- set allowCustomObjectId(value) {
- _CoreManager.default.set('ALLOW_CUSTOM_OBJECT_ID', value);
- },
- get allowCustomObjectId() {
- return _CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID');
- }
- };
- Parse.ACL = _dereq_('./ParseACL').default;
- Parse.Analytics = _dereq_('./Analytics');
- Parse.AnonymousUtils = _dereq_('./AnonymousUtils').default;
- Parse.Cloud = _dereq_('./Cloud');
- Parse.CLP = _dereq_('./ParseCLP').default;
- Parse.CoreManager = _dereq_('./CoreManager');
- Parse.Config = _dereq_('./ParseConfig').default;
- Parse.Error = _dereq_('./ParseError').default;
- Parse.EventuallyQueue = _EventuallyQueue.default;
- Parse.FacebookUtils = _dereq_('./FacebookUtils').default;
- Parse.File = _dereq_('./ParseFile').default;
- Parse.GeoPoint = _dereq_('./ParseGeoPoint').default;
- Parse.Polygon = _dereq_('./ParsePolygon').default;
- Parse.Installation = _dereq_('./ParseInstallation').default;
- Parse.LocalDatastore = _dereq_('./LocalDatastore');
- Parse.Object = _dereq_('./ParseObject').default;
- Parse.Op = {
- Set: ParseOp.SetOp,
- Unset: ParseOp.UnsetOp,
- Increment: ParseOp.IncrementOp,
- Add: ParseOp.AddOp,
- Remove: ParseOp.RemoveOp,
- AddUnique: ParseOp.AddUniqueOp,
- Relation: ParseOp.RelationOp
- };
- Parse.Push = _dereq_('./Push');
- Parse.Query = _dereq_('./ParseQuery').default;
- Parse.Relation = _dereq_('./ParseRelation').default;
- Parse.Role = _dereq_('./ParseRole').default;
- Parse.Schema = _dereq_('./ParseSchema').default;
- Parse.Session = _dereq_('./ParseSession').default;
- Parse.Storage = _dereq_('./Storage');
- Parse.User = _dereq_('./ParseUser').default;
- Parse.LiveQuery = _dereq_('./ParseLiveQuery').default;
- Parse.LiveQueryClient = _dereq_('./LiveQueryClient').default;
- Parse.IndexedDB = _dereq_('./IndexedDBStorageController');
- Parse._request = function () {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- return _CoreManager.default.getRESTController().request.apply(null, args);
- };
- Parse._ajax = function () {
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
- return _CoreManager.default.getRESTController().ajax.apply(null, args);
- }; // We attempt to match the signatures of the legacy versions of these methods
- Parse._decode = function (_, value) {
- return (0, _decode.default)(value);
- };
- Parse._encode = function (value, _, disallowObjects) {
- return (0, _encode.default)(value, disallowObjects);
- };
- Parse._getInstallationId = function () {
- return _CoreManager.default.getInstallationController().currentInstallationId();
- };
- /**
- * Enable pinning in your application.
- * This must be called after `Parse.initialize` in your application.
- *
- * @param [polling] Allow pinging the server /health endpoint. Default true
- * @param [ms] Milliseconds to ping the server. Default 2000ms
- * @static
- */
- Parse.enableLocalDatastore = function () {
- var polling = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
- var ms
- /*: number*/
- = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2000;
- if (!Parse.applicationId) {
- console.log("'enableLocalDataStore' must be called after 'initialize'");
- return;
- }
- if (!Parse.LocalDatastore.isEnabled) {
- Parse.LocalDatastore.isEnabled = true;
- if (polling) {
- _EventuallyQueue.default.poll(ms);
- }
- }
- };
- /**
- * Flag that indicates whether Local Datastore is enabled.
- *
- * @static
- * @returns {boolean}
- */
- Parse.isLocalDatastoreEnabled = function () {
- return Parse.LocalDatastore.isEnabled;
- };
- /**
- * Gets all contents from Local Datastore
- *
- * <pre>
- * await Parse.dumpLocalDatastore();
- * </pre>
- *
- * @static
- * @returns {object}
- */
- Parse.dumpLocalDatastore = function () {
- if (!Parse.LocalDatastore.isEnabled) {
- console.log('Parse.enableLocalDatastore() must be called first'); // eslint-disable-line no-console
- return _promise.default.resolve({});
- } else {
- return Parse.LocalDatastore._getAllContents();
- }
- };
- /**
- * Enable the current user encryption.
- * This must be called before login any user.
- *
- * @static
- */
- Parse.enableEncryptedUser = function () {
- Parse.encryptedUser = true;
- };
- /**
- * Flag that indicates whether Encrypted User is enabled.
- *
- * @static
- * @returns {boolean}
- */
- Parse.isEncryptedUserEnabled = function () {
- return Parse.encryptedUser;
- };
- _CoreManager.default.setCryptoController(_CryptoController.default);
- _CoreManager.default.setInstallationController(_InstallationController.default);
- _CoreManager.default.setRESTController(_RESTController.default);
- // For legacy requires, of the form `var Parse = require('parse').Parse`
- Parse.Parse = Parse;
- module.exports = Parse;
- }).call(this)}).call(this,_dereq_('_process'))
- },{"./Analytics":1,"./AnonymousUtils":2,"./Cloud":3,"./CoreManager":4,"./CryptoController":5,"./EventuallyQueue":7,"./FacebookUtils":8,"./IndexedDBStorageController":9,"./InstallationController":10,"./LiveQueryClient":11,"./LocalDatastore":13,"./ParseACL":19,"./ParseCLP":20,"./ParseConfig":21,"./ParseError":22,"./ParseFile":23,"./ParseGeoPoint":24,"./ParseInstallation":25,"./ParseLiveQuery":26,"./ParseObject":27,"./ParseOp":28,"./ParsePolygon":29,"./ParseQuery":30,"./ParseRelation":31,"./ParseRole":32,"./ParseSchema":33,"./ParseSession":34,"./ParseUser":35,"./Push":36,"./RESTController":37,"./Storage":39,"./decode":45,"./encode":46,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":85,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/weak-map":98,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140,"_process":145}],19:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _ParseRole = _interopRequireDefault(_dereq_("./ParseRole"));
- var _ParseUser = _interopRequireDefault(_dereq_("./ParseUser"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- var PUBLIC_KEY = '*';
- /**
- * Creates a new ACL.
- * If no argument is given, the ACL has no permissions for anyone.
- * If the argument is a Parse.User, the ACL will have read and write
- * permission for only that user.
- * If the argument is any other JSON object, that object will be interpretted
- * as a serialized ACL created with toJSON().
- *
- * <p>An ACL, or Access Control List can be added to any
- * <code>Parse.Object</code> to restrict access to only a subset of users
- * of your application.</p>
- *
- * @alias Parse.ACL
- */
- var ParseACL = /*#__PURE__*/function () {
- /**
- * @param {(Parse.User | object)} arg1 The user to initialize the ACL for
- */
- function ParseACL(arg1
- /*: ParseUser | ByIdMap*/
- ) {
- (0, _classCallCheck2.default)(this, ParseACL);
- (0, _defineProperty2.default)(this, "permissionsById", void 0);
- this.permissionsById = {};
- if (arg1 && (0, _typeof2.default)(arg1) === 'object') {
- if (arg1 instanceof _ParseUser.default) {
- this.setReadAccess(arg1, true);
- this.setWriteAccess(arg1, true);
- } else {
- for (var _userId in arg1) {
- var accessList = arg1[_userId];
- this.permissionsById[_userId] = {};
- for (var _permission in accessList) {
- var allowed = accessList[_permission];
- if (_permission !== 'read' && _permission !== 'write') {
- throw new TypeError('Tried to create an ACL with an invalid permission type.');
- }
- if (typeof allowed !== 'boolean') {
- throw new TypeError('Tried to create an ACL with an invalid permission value.');
- }
- this.permissionsById[_userId][_permission] = allowed;
- }
- }
- }
- } else if (typeof arg1 === 'function') {
- throw new TypeError('ParseACL constructed with a function. Did you forget ()?');
- }
- }
- /**
- * Returns a JSON-encoded version of the ACL.
- *
- * @returns {object}
- */
- (0, _createClass2.default)(ParseACL, [{
- key: "toJSON",
- value: function ()
- /*: ByIdMap*/
- {
- var permissions = {};
- for (var p in this.permissionsById) {
- permissions[p] = this.permissionsById[p];
- }
- return permissions;
- }
- /**
- * Returns whether this ACL is equal to another object
- *
- * @param {ParseACL} other The other object's ACL to compare to
- * @returns {boolean}
- */
- }, {
- key: "equals",
- value: function (other
- /*: ParseACL*/
- )
- /*: boolean*/
- {
- if (!(other instanceof ParseACL)) {
- return false;
- }
- var users = (0, _keys.default)(this.permissionsById);
- var otherUsers = (0, _keys.default)(other.permissionsById);
- if (users.length !== otherUsers.length) {
- return false;
- }
- for (var u in this.permissionsById) {
- if (!other.permissionsById[u]) {
- return false;
- }
- if (this.permissionsById[u].read !== other.permissionsById[u].read) {
- return false;
- }
- if (this.permissionsById[u].write !== other.permissionsById[u].write) {
- return false;
- }
- }
- return true;
- }
- }, {
- key: "_setAccess",
- value: function (accessType
- /*: string*/
- , userId
- /*: ParseUser | ParseRole | string*/
- , allowed
- /*: boolean*/
- ) {
- if (userId instanceof _ParseUser.default) {
- userId = userId.id;
- } else if (userId instanceof _ParseRole.default) {
- var name = userId.getName();
- if (!name) {
- throw new TypeError('Role must have a name');
- }
- userId = 'role:' + name;
- }
- if (typeof userId !== 'string') {
- throw new TypeError('userId must be a string.');
- }
- if (typeof allowed !== 'boolean') {
- throw new TypeError('allowed must be either true or false.');
- }
- var permissions = this.permissionsById[userId];
- if (!permissions) {
- if (!allowed) {
- // The user already doesn't have this permission, so no action is needed
- return;
- } else {
- permissions = {};
- this.permissionsById[userId] = permissions;
- }
- }
- if (allowed) {
- this.permissionsById[userId][accessType] = true;
- } else {
- delete permissions[accessType];
- if ((0, _keys.default)(permissions).length === 0) {
- delete this.permissionsById[userId];
- }
- }
- }
- }, {
- key: "_getAccess",
- value: function (accessType
- /*: string*/
- , userId
- /*: ParseUser | ParseRole | string*/
- )
- /*: boolean*/
- {
- if (userId instanceof _ParseUser.default) {
- userId = userId.id;
- if (!userId) {
- throw new Error('Cannot get access for a ParseUser without an ID');
- }
- } else if (userId instanceof _ParseRole.default) {
- var name = userId.getName();
- if (!name) {
- throw new TypeError('Role must have a name');
- }
- userId = 'role:' + name;
- }
- var permissions = this.permissionsById[userId];
- if (!permissions) {
- return false;
- }
- return !!permissions[accessType];
- }
- /**
- * Sets whether the given user is allowed to read this object.
- *
- * @param userId An instance of Parse.User or its objectId.
- * @param {boolean} allowed Whether that user should have read access.
- */
- }, {
- key: "setReadAccess",
- value: function (userId
- /*: ParseUser | ParseRole | string*/
- , allowed
- /*: boolean*/
- ) {
- this._setAccess('read', userId, allowed);
- }
- /**
- * Get whether the given user id is *explicitly* allowed to read this object.
- * Even if this returns false, the user may still be able to access it if
- * getPublicReadAccess returns true or a role that the user belongs to has
- * write access.
- *
- * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
- * @returns {boolean}
- */
- }, {
- key: "getReadAccess",
- value: function (userId
- /*: ParseUser | ParseRole | string*/
- )
- /*: boolean*/
- {
- return this._getAccess('read', userId);
- }
- /**
- * Sets whether the given user id is allowed to write this object.
- *
- * @param userId An instance of Parse.User or its objectId, or a Parse.Role..
- * @param {boolean} allowed Whether that user should have write access.
- */
- }, {
- key: "setWriteAccess",
- value: function (userId
- /*: ParseUser | ParseRole | string*/
- , allowed
- /*: boolean*/
- ) {
- this._setAccess('write', userId, allowed);
- }
- /**
- * Gets whether the given user id is *explicitly* allowed to write this object.
- * Even if this returns false, the user may still be able to write it if
- * getPublicWriteAccess returns true or a role that the user belongs to has
- * write access.
- *
- * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
- * @returns {boolean}
- */
- }, {
- key: "getWriteAccess",
- value: function (userId
- /*: ParseUser | ParseRole | string*/
- )
- /*: boolean*/
- {
- return this._getAccess('write', userId);
- }
- /**
- * Sets whether the public is allowed to read this object.
- *
- * @param {boolean} allowed
- */
- }, {
- key: "setPublicReadAccess",
- value: function (allowed
- /*: boolean*/
- ) {
- this.setReadAccess(PUBLIC_KEY, allowed);
- }
- /**
- * Gets whether the public is allowed to read this object.
- *
- * @returns {boolean}
- */
- }, {
- key: "getPublicReadAccess",
- value: function ()
- /*: boolean*/
- {
- return this.getReadAccess(PUBLIC_KEY);
- }
- /**
- * Sets whether the public is allowed to write this object.
- *
- * @param {boolean} allowed
- */
- }, {
- key: "setPublicWriteAccess",
- value: function (allowed
- /*: boolean*/
- ) {
- this.setWriteAccess(PUBLIC_KEY, allowed);
- }
- /**
- * Gets whether the public is allowed to write this object.
- *
- * @returns {boolean}
- */
- }, {
- key: "getPublicWriteAccess",
- value: function ()
- /*: boolean*/
- {
- return this.getWriteAccess(PUBLIC_KEY);
- }
- /**
- * Gets whether users belonging to the given role are allowed
- * to read this object. Even if this returns false, the role may
- * still be able to write it if a parent role has read access.
- *
- * @param role The name of the role, or a Parse.Role object.
- * @returns {boolean} true if the role has read access. false otherwise.
- * @throws {TypeError} If role is neither a Parse.Role nor a String.
- */
- }, {
- key: "getRoleReadAccess",
- value: function (role
- /*: ParseRole | string*/
- )
- /*: boolean*/
- {
- if (role instanceof _ParseRole.default) {
- // Normalize to the String name
- role = role.getName();
- }
- if (typeof role !== 'string') {
- throw new TypeError('role must be a ParseRole or a String');
- }
- return this.getReadAccess('role:' + role);
- }
- /**
- * Gets whether users belonging to the given role are allowed
- * to write this object. Even if this returns false, the role may
- * still be able to write it if a parent role has write access.
- *
- * @param role The name of the role, or a Parse.Role object.
- * @returns {boolean} true if the role has write access. false otherwise.
- * @throws {TypeError} If role is neither a Parse.Role nor a String.
- */
- }, {
- key: "getRoleWriteAccess",
- value: function (role
- /*: ParseRole | string*/
- )
- /*: boolean*/
- {
- if (role instanceof _ParseRole.default) {
- // Normalize to the String name
- role = role.getName();
- }
- if (typeof role !== 'string') {
- throw new TypeError('role must be a ParseRole or a String');
- }
- return this.getWriteAccess('role:' + role);
- }
- /**
- * Sets whether users belonging to the given role are allowed
- * to read this object.
- *
- * @param role The name of the role, or a Parse.Role object.
- * @param {boolean} allowed Whether the given role can read this object.
- * @throws {TypeError} If role is neither a Parse.Role nor a String.
- */
- }, {
- key: "setRoleReadAccess",
- value: function (role
- /*: ParseRole | string*/
- , allowed
- /*: boolean*/
- ) {
- if (role instanceof _ParseRole.default) {
- // Normalize to the String name
- role = role.getName();
- }
- if (typeof role !== 'string') {
- throw new TypeError('role must be a ParseRole or a String');
- }
- this.setReadAccess('role:' + role, allowed);
- }
- /**
- * Sets whether users belonging to the given role are allowed
- * to write this object.
- *
- * @param role The name of the role, or a Parse.Role object.
- * @param {boolean} allowed Whether the given role can write this object.
- * @throws {TypeError} If role is neither a Parse.Role nor a String.
- */
- }, {
- key: "setRoleWriteAccess",
- value: function (role
- /*: ParseRole | string*/
- , allowed
- /*: boolean*/
- ) {
- if (role instanceof _ParseRole.default) {
- // Normalize to the String name
- role = role.getName();
- }
- if (typeof role !== 'string') {
- throw new TypeError('role must be a ParseRole or a String');
- }
- this.setWriteAccess('role:' + role, allowed);
- }
- }]);
- return ParseACL;
- }();
- var _default = ParseACL;
- exports.default = _default;
- },{"./ParseRole":32,"./ParseUser":35,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],20:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
- var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
- var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
- var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
- var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
- var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
- var _Object$keys2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
- var _Array$isArray2 = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
- var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
- var _Array$from = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
- var _sliceInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
- var _slice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice"));
- var _assign = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/assign"));
- var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
- var _entries = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/entries"));
- var _every = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/every"));
- var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/map"));
- var _ParseRole = _interopRequireDefault(_dereq_("./ParseRole"));
- var _ParseUser = _interopRequireDefault(_dereq_("./ParseUser"));
- function ownKeys(object, enumerableOnly) {
- var keys = _Object$keys2(object);
- if (_Object$getOwnPropertySymbols) {
- var symbols = _Object$getOwnPropertySymbols(object);
- enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, 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 _context3, _context4;
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) {
- (0, _defineProperty2.default)(target, key, source[key]);
- }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) {
- _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _createForOfIteratorHelper(o, allowArrayLike) {
- var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
- if (!it) {
- if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it) o = it;
- var i = 0;
- var F = function () {};
- return {
- s: F,
- n: function () {
- if (i >= o.length) return {
- done: true
- };
- return {
- done: false,
- value: o[i++]
- };
- },
- e: function (_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 () {
- it = it.call(o);
- },
- n: function () {
- var step = it.next();
- normalCompletion = step.done;
- return step;
- },
- e: function (_e2) {
- didErr = true;
- err = _e2;
- },
- f: function () {
- try {
- if (!normalCompletion && it.return != null) it.return();
- } finally {
- if (didErr) throw err;
- }
- }
- };
- }
- function _unsupportedIterableToArray(o, minLen) {
- var _context2;
- if (!o) return;
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
- var n = _sliceInstanceProperty2(_context2 = Object.prototype.toString.call(o)).call(_context2, 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 PUBLIC_KEY = '*';
- var VALID_PERMISSIONS
- /*: Map<string, UsersMap>*/
- = new _map.default();
- VALID_PERMISSIONS.set('get', {});
- VALID_PERMISSIONS.set('find', {});
- VALID_PERMISSIONS.set('count', {});
- VALID_PERMISSIONS.set('create', {});
- VALID_PERMISSIONS.set('update', {});
- VALID_PERMISSIONS.set('delete', {});
- VALID_PERMISSIONS.set('addField', {});
- var VALID_PERMISSIONS_EXTENDED
- /*: Map<string, UsersMap>*/
- = new _map.default();
- VALID_PERMISSIONS_EXTENDED.set('protectedFields', {});
- /**
- * Creates a new CLP.
- * If no argument is given, the CLP has no permissions for anyone.
- * If the argument is a Parse.User or Parse.Role, the CLP will have read and write
- * permission for only that user or role.
- * If the argument is any other JSON object, that object will be interpretted
- * as a serialized CLP created with toJSON().
- *
- * <p>A CLP, or Class Level Permissions can be added to any
- * <code>Parse.Schema</code> to restrict access to only a subset of users
- * of your application.</p>
- *
- * <p>
- * For get/count/find/create/update/delete/addField using the following functions:
- *
- * Entity is type Parse.User or Parse.Role or string
- * Role is type Parse.Role or Name of Parse.Role
- *
- * getGetRequiresAuthentication()
- * setGetRequiresAuthentication(allowed: boolean)
- * getGetPointerFields()
- * setGetPointerFields(pointerFields: string[])
- * getGetAccess(entity: Entity)
- * setGetAccess(entity: Entity, allowed: boolean)
- * getPublicGetAccess()
- * setPublicGetAccess(allowed: boolean)
- * getRoleGetAccess(role: Role)
- * setRoleGetAccess(role: Role, allowed: boolean)
- * getFindRequiresAuthentication()
- * setFindRequiresAuthentication(allowed: boolean)
- * getFindPointerFields()
- * setFindPointerFields(pointerFields: string[])
- * getFindAccess(entity: Entity)
- * setFindAccess(entity: Entity, allowed: boolean)
- * getPublicFindAccess()
- * setPublicFindAccess(allowed: boolean)
- * getRoleFindAccess(role: Role)
- * setRoleFindAccess(role: Role, allowed: boolean)
- * getCountRequiresAuthentication()
- * setCountRequiresAuthentication(allowed: boolean)
- * getCountPointerFields()
- * setCountPointerFields(pointerFields: string[])
- * getCountAccess(entity: Entity)
- * setCountAccess(entity: Entity, allowed: boolean)
- * getPublicCountAccess()
- * setPublicCountAccess(allowed: boolean)
- * getRoleCountAccess(role: Role)
- * setRoleCountAccess(role: Role, allowed: boolean)
- * getCreateRequiresAuthentication()
- * setCreateRequiresAuthentication(allowed: boolean)
- * getCreatePointerFields()
- * setCreatePointerFields(pointerFields: string[])
- * getCreateAccess(entity: Entity)
- * setCreateAccess(entity: Entity, allowed: boolean)
- * getPublicCreateAccess()
- * setPublicCreateAccess(allowed: Boolean)
- * getRoleCreateAccess(role: Role)
- * setRoleCreateAccess(role: Role, allowed: boolean)
- * getUpdateRequiresAuthentication()
- * setUpdateRequiresAuthentication(allowed: boolean)
- * getUpdatePointerFields()
- * setUpdatePointerFields(pointerFields: string[])
- * getUpdateAccess(entity: Entity)
- * setUpdateAccess(entity: Entity, allowed: boolean)
- * getPublicUpdateAccess()
- * setPublicUpdateAccess(allowed: boolean)
- * getRoleUpdateAccess(role: Role)
- * setRoleUpdateAccess(role: Role, allowed: boolean)
- * getDeleteRequiresAuthentication()
- * setDeleteRequiresAuthentication(allowed: boolean)
- * getDeletePointerFields()
- * setDeletePointerFields(pointerFields: string[])
- * getDeleteAccess(entity: Entity)
- * setDeleteAccess(entity: Entity, allowed: boolean)
- * getPublicDeleteAccess()
- * setPublicDeleteAccess(allowed: boolean)
- * getRoleDeleteAccess(role: Role)
- * setRoleDeleteAccess(role: Role, allowed: boolean)
- * getAddFieldRequiresAuthentication()
- * setAddFieldRequiresAuthentication(allowed: boolean)
- * getAddFieldPointerFields()
- * setAddFieldPointerFields(pointerFields: string[])
- * getAddFieldAccess(entity: Entity)
- * setAddFieldAccess(entity: Entity, allowed: boolean)
- * getPublicAddFieldAccess()
- * setPublicAddFieldAccess(allowed: boolean)
- * getRoleAddFieldAccess(role: Role)
- * setRoleAddFieldAccess(role: Role, allowed: boolean)
- * </p>
- *
- * @alias Parse.CLP
- */
- var ParseCLP = /*#__PURE__*/function () {
- /**
- * @param {(Parse.User | Parse.Role | object)} userId The user to initialize the CLP for
- */
- function ParseCLP(userId
- /*: ParseUser | ParseRole | PermissionsMap*/
- ) {
- var _this = this;
- (0, _classCallCheck2.default)(this, ParseCLP);
- (0, _defineProperty2.default)(this, "permissionsMap", void 0);
- this.permissionsMap = {}; // Initialize permissions Map with default permissions
- var _iterator = _createForOfIteratorHelper((0, _entries.default)(VALID_PERMISSIONS).call(VALID_PERMISSIONS)),
- _step;
- try {
- var _loop = function _loop() {
- var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
- operation = _step$value[0],
- group = _step$value[1];
- _this.permissionsMap[operation] = (0, _assign.default)({}, group);
- var action = operation.charAt(0).toUpperCase() + (0, _slice.default)(operation).call(operation, 1);
- _this["get".concat(action, "RequiresAuthentication")] = function () {
- return this._getAccess(operation, 'requiresAuthentication');
- };
- _this["set".concat(action, "RequiresAuthentication")] = function (allowed) {
- this._setAccess(operation, 'requiresAuthentication', allowed);
- };
- _this["get".concat(action, "PointerFields")] = function () {
- return this._getAccess(operation, 'pointerFields', false);
- };
- _this["set".concat(action, "PointerFields")] = function (pointerFields) {
- this._setArrayAccess(operation, 'pointerFields', pointerFields);
- };
- _this["get".concat(action, "Access")] = function (entity) {
- return this._getAccess(operation, entity);
- };
- _this["set".concat(action, "Access")] = function (entity, allowed) {
- this._setAccess(operation, entity, allowed);
- };
- _this["getPublic".concat(action, "Access")] = function () {
- return this["get".concat(action, "Access")](PUBLIC_KEY);
- };
- _this["setPublic".concat(action, "Access")] = function (allowed) {
- this["set".concat(action, "Access")](PUBLIC_KEY, allowed);
- };
- _this["getRole".concat(action, "Access")] = function (role) {
- return this["get".concat(action, "Access")](this._getRoleName(role));
- };
- _this["setRole".concat(action, "Access")] = function (role, allowed) {
- this["set".concat(action, "Access")](this._getRoleName(role), allowed);
- };
- };
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- _loop();
- } // Initialize permissions Map with default extended permissions
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- var _iterator2 = _createForOfIteratorHelper((0, _entries.default)(VALID_PERMISSIONS_EXTENDED).call(VALID_PERMISSIONS_EXTENDED)),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var _step2$value = (0, _slicedToArray2.default)(_step2.value, 2),
- operation = _step2$value[0],
- group = _step2$value[1];
- this.permissionsMap[operation] = (0, _assign.default)({}, group);
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- if (userId && (0, _typeof2.default)(userId) === 'object') {
- if (userId instanceof _ParseUser.default) {
- this.setReadAccess(userId, true);
- this.setWriteAccess(userId, true);
- } else if (userId instanceof _ParseRole.default) {
- this.setRoleReadAccess(userId, true);
- this.setRoleWriteAccess(userId, true);
- } else {
- for (var _permission in userId) {
- var _context;
- var users = userId[_permission];
- var isValidPermission = !!VALID_PERMISSIONS.get(_permission);
- var isValidPermissionExtended = !!VALID_PERMISSIONS_EXTENDED.get(_permission);
- var isValidGroupPermission = (0, _includes.default)(_context = ['readUserFields', 'writeUserFields']).call(_context, _permission);
- if (typeof _permission !== 'string' || !(isValidPermission || isValidPermissionExtended || isValidGroupPermission)) {
- throw new TypeError('Tried to create an CLP with an invalid permission type.');
- }
- if (isValidGroupPermission) {
- if ((0, _every.default)(users).call(users, function (pointer) {
- return typeof pointer === 'string';
- })) {
- this.permissionsMap[_permission] = users;
- continue;
- } else {
- throw new TypeError('Tried to create an CLP with an invalid permission value.');
- }
- }
- for (var user in users) {
- var allowed = users[user];
- if (typeof allowed !== 'boolean' && !isValidPermissionExtended && user !== 'pointerFields') {
- throw new TypeError('Tried to create an CLP with an invalid permission value.');
- }
- this.permissionsMap[_permission][user] = allowed;
- }
- }
- }
- } else if (typeof userId === 'function') {
- throw new TypeError('ParseCLP constructed with a function. Did you forget ()?');
- }
- }
- /**
- * Returns a JSON-encoded version of the CLP.
- *
- * @returns {object}
- */
- (0, _createClass2.default)(ParseCLP, [{
- key: "toJSON",
- value: function toJSON()
- /*: PermissionsMap*/
- {
- return _objectSpread({}, this.permissionsMap);
- }
- /**
- * Returns whether this CLP is equal to another object
- *
- * @param other The other object to compare to
- * @returns {boolean}
- */
- }, {
- key: "equals",
- value: function equals(other
- /*: ParseCLP*/
- )
- /*: boolean*/
- {
- if (!(other instanceof ParseCLP)) {
- return false;
- }
- var permissions = (0, _keys.default)(this.permissionsMap);
- var otherPermissions = (0, _keys.default)(other.permissionsMap);
- if (permissions.length !== otherPermissions.length) {
- return false;
- }
- for (var _permission2 in this.permissionsMap) {
- if (!other.permissionsMap[_permission2]) {
- return false;
- }
- var users = (0, _keys.default)(this.permissionsMap[_permission2]);
- var otherUsers = (0, _keys.default)(other.permissionsMap[_permission2]);
- if (users.length !== otherUsers.length) {
- return false;
- }
- for (var user in this.permissionsMap[_permission2]) {
- if (!other.permissionsMap[_permission2][user]) {
- return false;
- }
- if (this.permissionsMap[_permission2][user] !== other.permissionsMap[_permission2][user]) {
- return false;
- }
- }
- }
- return true;
- }
- }, {
- key: "_getRoleName",
- value: function _getRoleName(role
- /*: ParseRole | string*/
- )
- /*: string*/
- {
- var name = role;
- if (role instanceof _ParseRole.default) {
- // Normalize to the String name
- name = role.getName();
- }
- if (typeof name !== 'string') {
- throw new TypeError('role must be a Parse.Role or a String');
- }
- return "role:".concat(name);
- }
- }, {
- key: "_parseEntity",
- value: function _parseEntity(entity
- /*: Entity*/
- ) {
- var userId = entity;
- if (userId instanceof _ParseUser.default) {
- userId = userId.id;
- if (!userId) {
- throw new Error('Cannot get access for a Parse.User without an id.');
- }
- } else if (userId instanceof _ParseRole.default) {
- userId = this._getRoleName(userId);
- }
- if (typeof userId !== 'string') {
- throw new TypeError('userId must be a string.');
- }
- return userId;
- }
- }, {
- key: "_setAccess",
- value: function _setAccess(permission
- /*: string*/
- , userId
- /*: Entity*/
- , allowed
- /*: boolean*/
- ) {
- userId = this._parseEntity(userId);
- if (typeof allowed !== 'boolean') {
- throw new TypeError('allowed must be either true or false.');
- }
- var permissions = this.permissionsMap[permission][userId];
- if (!permissions) {
- if (!allowed) {
- // The user already doesn't have this permission, so no action is needed
- return;
- } else {
- this.permissionsMap[permission][userId] = {};
- }
- }
- if (allowed) {
- this.permissionsMap[permission][userId] = true;
- } else {
- delete this.permissionsMap[permission][userId];
- }
- }
- }, {
- key: "_getAccess",
- value: function _getAccess(permission
- /*: string*/
- , userId
- /*: Entity*/
- )
- /*: boolean | string[]*/
- {
- var returnBoolean = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
- userId = this._parseEntity(userId);
- var permissions = this.permissionsMap[permission][userId];
- if (returnBoolean) {
- if (!permissions) {
- return false;
- }
- return !!this.permissionsMap[permission][userId];
- }
- return permissions;
- }
- }, {
- key: "_setArrayAccess",
- value: function _setArrayAccess(permission
- /*: string*/
- , userId
- /*: Entity*/
- , fields
- /*: string*/
- ) {
- userId = this._parseEntity(userId);
- var permissions = this.permissionsMap[permission][userId];
- if (!permissions) {
- this.permissionsMap[permission][userId] = [];
- }
- if (!fields || (0, _isArray.default)(fields) && fields.length === 0) {
- delete this.permissionsMap[permission][userId];
- } else if ((0, _isArray.default)(fields) && (0, _every.default)(fields).call(fields, function (field) {
- return typeof field === 'string';
- })) {
- this.permissionsMap[permission][userId] = fields;
- } else {
- throw new TypeError('fields must be an array of strings or undefined.');
- }
- }
- }, {
- key: "_setGroupPointerPermission",
- value: function _setGroupPointerPermission(operation
- /*: string*/
- , pointerFields
- /*: string[]*/
- ) {
- var fields = this.permissionsMap[operation];
- if (!fields) {
- this.permissionsMap[operation] = [];
- }
- if (!pointerFields || (0, _isArray.default)(pointerFields) && pointerFields.length === 0) {
- delete this.permissionsMap[operation];
- } else if ((0, _isArray.default)(pointerFields) && (0, _every.default)(pointerFields).call(pointerFields, function (field) {
- return typeof field === 'string';
- })) {
- this.permissionsMap[operation] = pointerFields;
- } else {
- throw new TypeError("".concat(operation, ".pointerFields must be an array of strings or undefined."));
- }
- }
- }, {
- key: "_getGroupPointerPermissions",
- value: function _getGroupPointerPermissions(operation
- /*: string*/
- )
- /*: string[]*/
- {
- return this.permissionsMap[operation];
- }
- /**
- * Sets user pointer fields to allow permission for get/count/find operations.
- *
- * @param {string[]} pointerFields User pointer fields
- */
- }, {
- key: "setReadUserFields",
- value: function setReadUserFields(pointerFields
- /*: string[]*/
- ) {
- this._setGroupPointerPermission('readUserFields', pointerFields);
- }
- /**
- * @returns {string[]} User pointer fields
- */
- }, {
- key: "getReadUserFields",
- value: function getReadUserFields()
- /*: string[]*/
- {
- return this._getGroupPointerPermissions('readUserFields');
- }
- /**
- * Sets user pointer fields to allow permission for create/delete/update/addField operations
- *
- * @param {string[]} pointerFields User pointer fields
- */
- }, {
- key: "setWriteUserFields",
- value: function setWriteUserFields(pointerFields
- /*: string[]*/
- ) {
- this._setGroupPointerPermission('writeUserFields', pointerFields);
- }
- /**
- * @returns {string[]} User pointer fields
- */
- }, {
- key: "getWriteUserFields",
- value: function getWriteUserFields()
- /*: string[]*/
- {
- return this._getGroupPointerPermissions('writeUserFields');
- }
- /**
- * Sets whether the given user is allowed to retrieve fields from this class.
- *
- * @param userId An instance of Parse.User or its objectId.
- * @param {string[]} fields fields to be protected
- */
- }, {
- key: "setProtectedFields",
- value: function setProtectedFields(userId
- /*: Entity*/
- , fields
- /*: string[]*/
- ) {
- this._setArrayAccess('protectedFields', userId, fields);
- }
- /**
- * Returns array of fields are accessable to this user.
- *
- * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
- * @returns {string[]}
- */
- }, {
- key: "getProtectedFields",
- value: function getProtectedFields(userId
- /*: Entity*/
- )
- /*: string[]*/
- {
- return this._getAccess('protectedFields', userId, false);
- }
- /**
- * Sets whether the given user is allowed to read from this class.
- *
- * @param userId An instance of Parse.User or its objectId.
- * @param {boolean} allowed whether that user should have read access.
- */
- }, {
- key: "setReadAccess",
- value: function setReadAccess(userId
- /*: Entity*/
- , allowed
- /*: boolean*/
- ) {
- this._setAccess('find', userId, allowed);
- this._setAccess('get', userId, allowed);
- this._setAccess('count', userId, allowed);
- }
- /**
- * Get whether the given user id is *explicitly* allowed to read from this class.
- * Even if this returns false, the user may still be able to access it if
- * getPublicReadAccess returns true or a role that the user belongs to has
- * write access.
- *
- * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
- * @returns {boolean}
- */
- }, {
- key: "getReadAccess",
- value: function getReadAccess(userId
- /*: Entity*/
- )
- /*: boolean*/
- {
- return this._getAccess('find', userId) && this._getAccess('get', userId) && this._getAccess('count', userId);
- }
- /**
- * Sets whether the given user id is allowed to write to this class.
- *
- * @param userId An instance of Parse.User or its objectId, or a Parse.Role..
- * @param {boolean} allowed Whether that user should have write access.
- */
- }, {
- key: "setWriteAccess",
- value: function setWriteAccess(userId
- /*: Entity*/
- , allowed
- /*: boolean*/
- ) {
- this._setAccess('create', userId, allowed);
- this._setAccess('update', userId, allowed);
- this._setAccess('delete', userId, allowed);
- this._setAccess('addField', userId, allowed);
- }
- /**
- * Gets whether the given user id is *explicitly* allowed to write to this class.
- * Even if this returns false, the user may still be able to write it if
- * getPublicWriteAccess returns true or a role that the user belongs to has
- * write access.
- *
- * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
- * @returns {boolean}
- */
- }, {
- key: "getWriteAccess",
- value: function getWriteAccess(userId
- /*: Entity*/
- )
- /*: boolean*/
- {
- return this._getAccess('create', userId) && this._getAccess('update', userId) && this._getAccess('delete', userId) && this._getAccess('addField', userId);
- }
- /**
- * Sets whether the public is allowed to read from this class.
- *
- * @param {boolean} allowed
- */
- }, {
- key: "setPublicReadAccess",
- value: function setPublicReadAccess(allowed
- /*: boolean*/
- ) {
- this.setReadAccess(PUBLIC_KEY, allowed);
- }
- /**
- * Gets whether the public is allowed to read from this class.
- *
- * @returns {boolean}
- */
- }, {
- key: "getPublicReadAccess",
- value: function getPublicReadAccess()
- /*: boolean*/
- {
- return this.getReadAccess(PUBLIC_KEY);
- }
- /**
- * Sets whether the public is allowed to write to this class.
- *
- * @param {boolean} allowed
- */
- }, {
- key: "setPublicWriteAccess",
- value: function setPublicWriteAccess(allowed
- /*: boolean*/
- ) {
- this.setWriteAccess(PUBLIC_KEY, allowed);
- }
- /**
- * Gets whether the public is allowed to write to this class.
- *
- * @returns {boolean}
- */
- }, {
- key: "getPublicWriteAccess",
- value: function getPublicWriteAccess()
- /*: boolean*/
- {
- return this.getWriteAccess(PUBLIC_KEY);
- }
- /**
- * Sets whether the public is allowed to protect fields in this class.
- *
- * @param {string[]} fields
- */
- }, {
- key: "setPublicProtectedFields",
- value: function setPublicProtectedFields(fields
- /*: string[]*/
- ) {
- this.setProtectedFields(PUBLIC_KEY, fields);
- }
- /**
- * Gets whether the public is allowed to read fields from this class.
- *
- * @returns {string[]}
- */
- }, {
- key: "getPublicProtectedFields",
- value: function getPublicProtectedFields()
- /*: string[]*/
- {
- return this.getProtectedFields(PUBLIC_KEY);
- }
- /**
- * Gets whether users belonging to the given role are allowed
- * to read from this class. Even if this returns false, the role may
- * still be able to write it if a parent role has read access.
- *
- * @param role The name of the role, or a Parse.Role object.
- * @returns {boolean} true if the role has read access. false otherwise.
- * @throws {TypeError} If role is neither a Parse.Role nor a String.
- */
- }, {
- key: "getRoleReadAccess",
- value: function getRoleReadAccess(role
- /*: ParseRole | string*/
- )
- /*: boolean*/
- {
- return this.getReadAccess(this._getRoleName(role));
- }
- /**
- * Gets whether users belonging to the given role are allowed
- * to write to this user. Even if this returns false, the role may
- * still be able to write it if a parent role has write access.
- *
- * @param role The name of the role, or a Parse.Role object.
- * @returns {boolean} true if the role has write access. false otherwise.
- * @throws {TypeError} If role is neither a Parse.Role nor a String.
- */
- }, {
- key: "getRoleWriteAccess",
- value: function getRoleWriteAccess(role
- /*: ParseRole | string*/
- )
- /*: boolean*/
- {
- return this.getWriteAccess(this._getRoleName(role));
- }
- /**
- * Sets whether users belonging to the given role are allowed
- * to read from this class.
- *
- * @param role The name of the role, or a Parse.Role object.
- * @param {boolean} allowed Whether the given role can read this object.
- * @throws {TypeError} If role is neither a Parse.Role nor a String.
- */
- }, {
- key: "setRoleReadAccess",
- value: function setRoleReadAccess(role
- /*: ParseRole | string*/
- , allowed
- /*: boolean*/
- ) {
- this.setReadAccess(this._getRoleName(role), allowed);
- }
- /**
- * Sets whether users belonging to the given role are allowed
- * to write to this class.
- *
- * @param role The name of the role, or a Parse.Role object.
- * @param {boolean} allowed Whether the given role can write this object.
- * @throws {TypeError} If role is neither a Parse.Role nor a String.
- */
- }, {
- key: "setRoleWriteAccess",
- value: function setRoleWriteAccess(role
- /*: ParseRole | string*/
- , allowed
- /*: boolean*/
- ) {
- this.setWriteAccess(this._getRoleName(role), allowed);
- }
- /**
- * Gets whether users belonging to the given role are allowed
- * to count to this user. Even if this returns false, the role may
- * still be able to count it if a parent role has count access.
- *
- * @param role The name of the role, or a Parse.Role object.
- * @returns {string[]}
- * @throws {TypeError} If role is neither a Parse.Role nor a String.
- */
- }, {
- key: "getRoleProtectedFields",
- value: function getRoleProtectedFields(role
- /*: ParseRole | string*/
- )
- /*: string[]*/
- {
- return this.getProtectedFields(this._getRoleName(role));
- }
- /**
- * Sets whether users belonging to the given role are allowed
- * to set access field in this class.
- *
- * @param role The name of the role, or a Parse.Role object.
- * @param {string[]} fields Fields to be protected by Role.
- * @throws {TypeError} If role is neither a Parse.Role nor a String.
- */
- }, {
- key: "setRoleProtectedFields",
- value: function setRoleProtectedFields(role
- /*: ParseRole | string*/
- , fields
- /*: string[]*/
- ) {
- this.setProtectedFields(this._getRoleName(role), fields);
- }
- }]);
- return ParseCLP;
- }();
- var _default = ParseCLP;
- exports.default = _default;
- },{"./ParseRole":32,"./ParseUser":35,"@babel/runtime-corejs3/core-js-stable/array/from":55,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/entries":59,"@babel/runtime-corejs3/core-js-stable/instance/every":60,"@babel/runtime-corejs3/core-js-stable/instance/filter":61,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/includes":65,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/map":77,"@babel/runtime-corejs3/core-js-stable/object/assign":79,"@babel/runtime-corejs3/core-js-stable/object/define-properties":81,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":85,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":86,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":87,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/core-js/get-iterator-method":101,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/slicedToArray":137,"@babel/runtime-corejs3/helpers/typeof":140}],21:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _decode = _interopRequireDefault(_dereq_("./decode"));
- var _encode = _interopRequireDefault(_dereq_("./encode"));
- var _escape2 = _interopRequireDefault(_dereq_("./escape"));
- var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
- var _Storage = _interopRequireDefault(_dereq_("./Storage"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- /**
- * Parse.Config is a local representation of configuration data that
- * can be set from the Parse dashboard.
- *
- * @alias Parse.Config
- */
- var ParseConfig = /*#__PURE__*/function () {
- function ParseConfig() {
- (0, _classCallCheck2.default)(this, ParseConfig);
- (0, _defineProperty2.default)(this, "attributes", void 0);
- (0, _defineProperty2.default)(this, "_escapedAttributes", void 0);
- this.attributes = {};
- this._escapedAttributes = {};
- }
- /**
- * Gets the value of an attribute.
- *
- * @param {string} attr The name of an attribute.
- * @returns {*}
- */
- (0, _createClass2.default)(ParseConfig, [{
- key: "get",
- value: function (attr
- /*: string*/
- )
- /*: any*/
- {
- return this.attributes[attr];
- }
- /**
- * Gets the HTML-escaped value of an attribute.
- *
- * @param {string} attr The name of an attribute.
- * @returns {string}
- */
- }, {
- key: "escape",
- value: function (attr
- /*: string*/
- )
- /*: string*/
- {
- var html = this._escapedAttributes[attr];
- if (html) {
- return html;
- }
- var val = this.attributes[attr];
- var escaped = '';
- if (val != null) {
- escaped = (0, _escape2.default)(val.toString());
- }
- this._escapedAttributes[attr] = escaped;
- return escaped;
- }
- /**
- * Retrieves the most recently-fetched configuration object, either from
- * memory or from local storage if necessary.
- *
- * @static
- * @returns {Parse.Config} The most recently-fetched Parse.Config if it
- * exists, else an empty Parse.Config.
- */
- }], [{
- key: "current",
- value: function () {
- var controller = _CoreManager.default.getConfigController();
- return controller.current();
- }
- /**
- * Gets a new configuration object from the server.
- *
- * @static
- * @param {object} options
- * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * </ul>
- * @returns {Promise} A promise that is resolved with a newly-created
- * configuration object when the get completes.
- */
- }, {
- key: "get",
- value: function () {
- var options
- /*: RequestOptions*/
- = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var controller = _CoreManager.default.getConfigController();
- return controller.get(options);
- }
- /**
- * Save value keys to the server.
- *
- * @static
- * @param {object} attrs The config parameters and values.
- * @param {object} masterKeyOnlyFlags The flags that define whether config parameters listed
- * in `attrs` should be retrievable only by using the master key.
- * For example: `param1: true` makes `param1` only retrievable by using the master key.
- * If a parameter is not provided or set to `false`, it can be retrieved without
- * using the master key.
- * @returns {Promise} A promise that is resolved with a newly-created
- * configuration object or with the current with the update.
- */
- }, {
- key: "save",
- value: function (attrs
- /*: { [key: string]: any }*/
- , masterKeyOnlyFlags
- /*: { [key: string]: any }*/
- ) {
- var controller = _CoreManager.default.getConfigController(); //To avoid a mismatch with the local and the cloud config we get a new version
- return controller.save(attrs, masterKeyOnlyFlags).then(function () {
- return controller.get({
- useMasterKey: true
- });
- }, function (error) {
- return _promise.default.reject(error);
- });
- }
- /**
- * Used for testing
- *
- * @private
- */
- }, {
- key: "_clearCache",
- value: function () {
- currentConfig = null;
- }
- }]);
- return ParseConfig;
- }();
- var currentConfig = null;
- var CURRENT_CONFIG_KEY = 'currentConfig';
- function decodePayload(data) {
- try {
- var json = JSON.parse(data);
- if (json && (0, _typeof2.default)(json) === 'object') {
- return (0, _decode.default)(json);
- }
- } catch (e) {
- return null;
- }
- }
- var DefaultController = {
- current: function () {
- if (currentConfig) {
- return currentConfig;
- }
- var config = new ParseConfig();
- var storagePath = _Storage.default.generatePath(CURRENT_CONFIG_KEY);
- if (!_Storage.default.async()) {
- var configData = _Storage.default.getItem(storagePath);
- if (configData) {
- var attributes = decodePayload(configData);
- if (attributes) {
- config.attributes = attributes;
- currentConfig = config;
- }
- }
- return config;
- } // Return a promise for async storage controllers
- return _Storage.default.getItemAsync(storagePath).then(function (configData) {
- if (configData) {
- var _attributes = decodePayload(configData);
- if (_attributes) {
- config.attributes = _attributes;
- currentConfig = config;
- }
- }
- return config;
- });
- },
- get: function () {
- var options
- /*: RequestOptions*/
- = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request('GET', 'config', {}, options).then(function (response) {
- if (!response || !response.params) {
- var error = new _ParseError.default(_ParseError.default.INVALID_JSON, 'Config JSON response invalid.');
- return _promise.default.reject(error);
- }
- var config = new ParseConfig();
- config.attributes = {};
- for (var attr in response.params) {
- config.attributes[attr] = (0, _decode.default)(response.params[attr]);
- }
- currentConfig = config;
- return _Storage.default.setItemAsync(_Storage.default.generatePath(CURRENT_CONFIG_KEY), (0, _stringify.default)(response.params)).then(function () {
- return config;
- });
- });
- },
- save: function (attrs
- /*: { [key: string]: any }*/
- , masterKeyOnlyFlags
- /*: { [key: string]: any }*/
- ) {
- var RESTController = _CoreManager.default.getRESTController();
- var encodedAttrs = {};
- for (var _key in attrs) {
- encodedAttrs[_key] = (0, _encode.default)(attrs[_key]);
- }
- return RESTController.request('PUT', 'config', {
- params: encodedAttrs,
- masterKeyOnly: masterKeyOnlyFlags
- }, {
- useMasterKey: true
- }).then(function (response) {
- if (response && response.result) {
- return _promise.default.resolve();
- } else {
- var error = new _ParseError.default(_ParseError.default.INTERNAL_SERVER_ERROR, 'Error occured updating Config.');
- return _promise.default.reject(error);
- }
- });
- }
- };
- _CoreManager.default.setConfigController(DefaultController);
- var _default = ParseConfig;
- exports.default = _default;
- },{"./CoreManager":4,"./ParseError":22,"./Storage":39,"./decode":45,"./encode":46,"./escape":48,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],22:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
- _Object$defineProperty2(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _defineProperty = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _assertThisInitialized2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/assertThisInitialized"));
- var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
- var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
- var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
- var _wrapNativeSuper2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/wrapNativeSuper"));
- function _createSuper(Derived) {
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
- return function () {
- var Super = (0, _getPrototypeOf2.default)(Derived),
- result;
- if (hasNativeReflectConstruct) {
- var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
- result = _Reflect$construct(Super, arguments, NewTarget);
- } else {
- result = Super.apply(this, arguments);
- }
- return (0, _possibleConstructorReturn2.default)(this, result);
- };
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
- if (_Reflect$construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
- }
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
- /**
- * Constructs a new Parse.Error object with the given code and message.
- *
- * @alias Parse.Error
- */
- var ParseError = /*#__PURE__*/function (_Error) {
- (0, _inherits2.default)(ParseError, _Error);
- var _super = _createSuper(ParseError);
- /**
- * @param {number} code An error code constant from <code>Parse.Error</code>.
- * @param {string} message A detailed description of the error.
- */
- function ParseError(code, message) {
- var _this;
- (0, _classCallCheck2.default)(this, ParseError);
- _this = _super.call(this, message);
- _this.code = code;
- (0, _defineProperty.default)((0, _assertThisInitialized2.default)(_this), 'message', {
- enumerable: true,
- value: message
- });
- return _this;
- }
- (0, _createClass2.default)(ParseError, [{
- key: "toString",
- value: function () {
- return 'ParseError: ' + this.code + ' ' + this.message;
- }
- }]);
- return ParseError;
- }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
- /**
- * Error code indicating some error other than those enumerated here.
- *
- * @property {number} OTHER_CAUSE
- * @static
- */
- ParseError.OTHER_CAUSE = -1;
- /**
- * Error code indicating that something has gone wrong with the server.
- *
- * @property {number} INTERNAL_SERVER_ERROR
- * @static
- */
- ParseError.INTERNAL_SERVER_ERROR = 1;
- /**
- * Error code indicating the connection to the Parse servers failed.
- *
- * @property {number} CONNECTION_FAILED
- * @static
- */
- ParseError.CONNECTION_FAILED = 100;
- /**
- * Error code indicating the specified object doesn't exist.
- *
- * @property {number} OBJECT_NOT_FOUND
- * @static
- */
- ParseError.OBJECT_NOT_FOUND = 101;
- /**
- * Error code indicating you tried to query with a datatype that doesn't
- * support it, like exact matching an array or object.
- *
- * @property {number} INVALID_QUERY
- * @static
- */
- ParseError.INVALID_QUERY = 102;
- /**
- * Error code indicating a missing or invalid classname. Classnames are
- * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
- * only valid characters.
- *
- * @property {number} INVALID_CLASS_NAME
- * @static
- */
- ParseError.INVALID_CLASS_NAME = 103;
- /**
- * Error code indicating an unspecified object id.
- *
- * @property {number} MISSING_OBJECT_ID
- * @static
- */
- ParseError.MISSING_OBJECT_ID = 104;
- /**
- * Error code indicating an invalid key name. Keys are case-sensitive. They
- * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
- *
- * @property {number} INVALID_KEY_NAME
- * @static
- */
- ParseError.INVALID_KEY_NAME = 105;
- /**
- * Error code indicating a malformed pointer. You should not see this unless
- * you have been mucking about changing internal Parse code.
- *
- * @property {number} INVALID_POINTER
- * @static
- */
- ParseError.INVALID_POINTER = 106;
- /**
- * Error code indicating that badly formed JSON was received upstream. This
- * either indicates you have done something unusual with modifying how
- * things encode to JSON, or the network is failing badly.
- *
- * @property {number} INVALID_JSON
- * @static
- */
- ParseError.INVALID_JSON = 107;
- /**
- * Error code indicating that the feature you tried to access is only
- * available internally for testing purposes.
- *
- * @property {number} COMMAND_UNAVAILABLE
- * @static
- */
- ParseError.COMMAND_UNAVAILABLE = 108;
- /**
- * You must call Parse.initialize before using the Parse library.
- *
- * @property {number} NOT_INITIALIZED
- * @static
- */
- ParseError.NOT_INITIALIZED = 109;
- /**
- * Error code indicating that a field was set to an inconsistent type.
- *
- * @property {number} INCORRECT_TYPE
- * @static
- */
- ParseError.INCORRECT_TYPE = 111;
- /**
- * Error code indicating an invalid channel name. A channel name is either
- * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
- * characters and starts with a letter.
- *
- * @property {number} INVALID_CHANNEL_NAME
- * @static
- */
- ParseError.INVALID_CHANNEL_NAME = 112;
- /**
- * Error code indicating that push is misconfigured.
- *
- * @property {number} PUSH_MISCONFIGURED
- * @static
- */
- ParseError.PUSH_MISCONFIGURED = 115;
- /**
- * Error code indicating that the object is too large.
- *
- * @property {number} OBJECT_TOO_LARGE
- * @static
- */
- ParseError.OBJECT_TOO_LARGE = 116;
- /**
- * Error code indicating that the operation isn't allowed for clients.
- *
- * @property {number} OPERATION_FORBIDDEN
- * @static
- */
- ParseError.OPERATION_FORBIDDEN = 119;
- /**
- * Error code indicating the result was not found in the cache.
- *
- * @property {number} CACHE_MISS
- * @static
- */
- ParseError.CACHE_MISS = 120;
- /**
- * Error code indicating that an invalid key was used in a nested
- * JSONObject.
- *
- * @property {number} INVALID_NESTED_KEY
- * @static
- */
- ParseError.INVALID_NESTED_KEY = 121;
- /**
- * Error code indicating that an invalid filename was used for ParseFile.
- * A valid file name contains only a-zA-Z0-9_. characters and is between 1
- * and 128 characters.
- *
- * @property {number} INVALID_FILE_NAME
- * @static
- */
- ParseError.INVALID_FILE_NAME = 122;
- /**
- * Error code indicating an invalid ACL was provided.
- *
- * @property {number} INVALID_ACL
- * @static
- */
- ParseError.INVALID_ACL = 123;
- /**
- * Error code indicating that the request timed out on the server. Typically
- * this indicates that the request is too expensive to run.
- *
- * @property {number} TIMEOUT
- * @static
- */
- ParseError.TIMEOUT = 124;
- /**
- * Error code indicating that the email address was invalid.
- *
- * @property {number} INVALID_EMAIL_ADDRESS
- * @static
- */
- ParseError.INVALID_EMAIL_ADDRESS = 125;
- /**
- * Error code indicating a missing content type.
- *
- * @property {number} MISSING_CONTENT_TYPE
- * @static
- */
- ParseError.MISSING_CONTENT_TYPE = 126;
- /**
- * Error code indicating a missing content length.
- *
- * @property {number} MISSING_CONTENT_LENGTH
- * @static
- */
- ParseError.MISSING_CONTENT_LENGTH = 127;
- /**
- * Error code indicating an invalid content length.
- *
- * @property {number} INVALID_CONTENT_LENGTH
- * @static
- */
- ParseError.INVALID_CONTENT_LENGTH = 128;
- /**
- * Error code indicating a file that was too large.
- *
- * @property {number} FILE_TOO_LARGE
- * @static
- */
- ParseError.FILE_TOO_LARGE = 129;
- /**
- * Error code indicating an error saving a file.
- *
- * @property {number} FILE_SAVE_ERROR
- * @static
- */
- ParseError.FILE_SAVE_ERROR = 130;
- /**
- * Error code indicating that a unique field was given a value that is
- * already taken.
- *
- * @property {number} DUPLICATE_VALUE
- * @static
- */
- ParseError.DUPLICATE_VALUE = 137;
- /**
- * Error code indicating that a role's name is invalid.
- *
- * @property {number} INVALID_ROLE_NAME
- * @static
- */
- ParseError.INVALID_ROLE_NAME = 139;
- /**
- * Error code indicating that an application quota was exceeded. Upgrade to
- * resolve.
- *
- * @property {number} EXCEEDED_QUOTA
- * @static
- */
- ParseError.EXCEEDED_QUOTA = 140;
- /**
- * Error code indicating that a Cloud Code script failed.
- *
- * @property {number} SCRIPT_FAILED
- * @static
- */
- ParseError.SCRIPT_FAILED = 141;
- /**
- * Error code indicating that a Cloud Code validation failed.
- *
- * @property {number} VALIDATION_ERROR
- * @static
- */
- ParseError.VALIDATION_ERROR = 142;
- /**
- * Error code indicating that invalid image data was provided.
- *
- * @property {number} INVALID_IMAGE_DATA
- * @static
- */
- ParseError.INVALID_IMAGE_DATA = 143;
- /**
- * Error code indicating an unsaved file.
- *
- * @property {number} UNSAVED_FILE_ERROR
- * @static
- */
- ParseError.UNSAVED_FILE_ERROR = 151;
- /**
- * Error code indicating an invalid push time.
- *
- * @property {number} INVALID_PUSH_TIME_ERROR
- * @static
- */
- ParseError.INVALID_PUSH_TIME_ERROR = 152;
- /**
- * Error code indicating an error deleting a file.
- *
- * @property {number} FILE_DELETE_ERROR
- * @static
- */
- ParseError.FILE_DELETE_ERROR = 153;
- /**
- * Error code indicating an error deleting an unnamed file.
- *
- * @property {number} FILE_DELETE_UNNAMED_ERROR
- * @static
- */
- ParseError.FILE_DELETE_UNNAMED_ERROR = 161;
- /**
- * Error code indicating that the application has exceeded its request
- * limit.
- *
- * @property {number} REQUEST_LIMIT_EXCEEDED
- * @static
- */
- ParseError.REQUEST_LIMIT_EXCEEDED = 155;
- /**
- * Error code indicating that the request was a duplicate and has been discarded due to
- * idempotency rules.
- *
- * @property {number} DUPLICATE_REQUEST
- * @static
- */
- ParseError.DUPLICATE_REQUEST = 159;
- /**
- * Error code indicating an invalid event name.
- *
- * @property {number} INVALID_EVENT_NAME
- * @static
- */
- ParseError.INVALID_EVENT_NAME = 160;
- /**
- * Error code indicating that a field had an invalid value.
- *
- * @property {number} INVALID_VALUE
- * @static
- */
- ParseError.INVALID_VALUE = 162;
- /**
- * Error code indicating that the username is missing or empty.
- *
- * @property {number} USERNAME_MISSING
- * @static
- */
- ParseError.USERNAME_MISSING = 200;
- /**
- * Error code indicating that the password is missing or empty.
- *
- * @property {number} PASSWORD_MISSING
- * @static
- */
- ParseError.PASSWORD_MISSING = 201;
- /**
- * Error code indicating that the username has already been taken.
- *
- * @property {number} USERNAME_TAKEN
- * @static
- */
- ParseError.USERNAME_TAKEN = 202;
- /**
- * Error code indicating that the email has already been taken.
- *
- * @property {number} EMAIL_TAKEN
- * @static
- */
- ParseError.EMAIL_TAKEN = 203;
- /**
- * Error code indicating that the email is missing, but must be specified.
- *
- * @property {number} EMAIL_MISSING
- * @static
- */
- ParseError.EMAIL_MISSING = 204;
- /**
- * Error code indicating that a user with the specified email was not found.
- *
- * @property {number} EMAIL_NOT_FOUND
- * @static
- */
- ParseError.EMAIL_NOT_FOUND = 205;
- /**
- * Error code indicating that a user object without a valid session could
- * not be altered.
- *
- * @property {number} SESSION_MISSING
- * @static
- */
- ParseError.SESSION_MISSING = 206;
- /**
- * Error code indicating that a user can only be created through signup.
- *
- * @property {number} MUST_CREATE_USER_THROUGH_SIGNUP
- * @static
- */
- ParseError.MUST_CREATE_USER_THROUGH_SIGNUP = 207;
- /**
- * Error code indicating that an an account being linked is already linked
- * to another user.
- *
- * @property {number} ACCOUNT_ALREADY_LINKED
- * @static
- */
- ParseError.ACCOUNT_ALREADY_LINKED = 208;
- /**
- * Error code indicating that the current session token is invalid.
- *
- * @property {number} INVALID_SESSION_TOKEN
- * @static
- */
- ParseError.INVALID_SESSION_TOKEN = 209;
- /**
- * Error code indicating an error enabling or verifying MFA
- *
- * @property {number} MFA_ERROR
- * @static
- */
- ParseError.MFA_ERROR = 210;
- /**
- * Error code indicating that a valid MFA token must be provided
- *
- * @property {number} MFA_TOKEN_REQUIRED
- * @static
- */
- ParseError.MFA_TOKEN_REQUIRED = 211;
- /**
- * Error code indicating that a user cannot be linked to an account because
- * that account's id could not be found.
- *
- * @property {number} LINKED_ID_MISSING
- * @static
- */
- ParseError.LINKED_ID_MISSING = 250;
- /**
- * Error code indicating that a user with a linked (e.g. Facebook) account
- * has an invalid session.
- *
- * @property {number} INVALID_LINKED_SESSION
- * @static
- */
- ParseError.INVALID_LINKED_SESSION = 251;
- /**
- * Error code indicating that a service being linked (e.g. Facebook or
- * Twitter) is unsupported.
- *
- * @property {number} UNSUPPORTED_SERVICE
- * @static
- */
- ParseError.UNSUPPORTED_SERVICE = 252;
- /**
- * Error code indicating an invalid operation occured on schema
- *
- * @property {number} INVALID_SCHEMA_OPERATION
- * @static
- */
- ParseError.INVALID_SCHEMA_OPERATION = 255;
- /**
- * Error code indicating that there were multiple errors. Aggregate errors
- * have an "errors" property, which is an array of error objects with more
- * detail about each error that occurred.
- *
- * @property {number} AGGREGATE_ERROR
- * @static
- */
- ParseError.AGGREGATE_ERROR = 600;
- /**
- * Error code indicating the client was unable to read an input file.
- *
- * @property {number} FILE_READ_ERROR
- * @static
- */
- ParseError.FILE_READ_ERROR = 601;
- /**
- * Error code indicating a real error code is unavailable because
- * we had to use an XDomainRequest object to allow CORS requests in
- * Internet Explorer, which strips the body from HTTP responses that have
- * a non-2XX status code.
- *
- * @property {number} X_DOMAIN_REQUEST
- * @static
- */
- ParseError.X_DOMAIN_REQUEST = 602;
- var _default = ParseError;
- exports.default = _default;
- },{"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/helpers/assertThisInitialized":119,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/getPrototypeOf":126,"@babel/runtime-corejs3/helpers/inherits":127,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":135,"@babel/runtime-corejs3/helpers/wrapNativeSuper":142}],23:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
- var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
- var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
- var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
- var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
- var _Object$keys2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
- var _sliceInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
- var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
- var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
- var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
- var _typeof3 = _dereq_("@babel/runtime-corejs3/helpers/typeof");
- var _forEachInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
- var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
- var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
- var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
- var _slice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice"));
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- function ownKeys(object, enumerableOnly) {
- var keys = _Object$keys2(object);
- if (_Object$getOwnPropertySymbols) {
- var symbols = _Object$getOwnPropertySymbols(object);
- enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, 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 _context10, _context11;
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? _forEachInstanceProperty2(_context10 = ownKeys(Object(source), !0)).call(_context10, function (key) {
- (0, _defineProperty2.default)(target, key, source[key]);
- }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context11 = ownKeys(Object(source))).call(_context11, function (key) {
- _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- function _regeneratorRuntime() {
- "use strict";
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
- _regeneratorRuntime = function () {
- return exports;
- };
- var exports = {},
- Op = Object.prototype,
- hasOwn = Op.hasOwnProperty,
- $Symbol = "function" == typeof _Symbol ? _Symbol : {},
- iteratorSymbol = $Symbol.iterator || "@@iterator",
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- return _Object$defineProperty(obj, key, {
- value: value,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }), obj[key];
- }
- try {
- define({}, "");
- } catch (err) {
- define = function (obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
- generator = _Object$create(protoGenerator.prototype),
- context = new Context(tryLocsList || []);
- return generator._invoke = function (innerFn, self, context) {
- var state = "suspendedStart";
- return function (method, arg) {
- if ("executing" === state) throw new Error("Generator is already running");
- if ("completed" === state) {
- if ("throw" === method) throw arg;
- return doneResult();
- }
- for (context.method = method, context.arg = arg;;) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
- if ("suspendedStart" === state) throw state = "completed", context.arg;
- context.dispatchException(context.arg);
- } else "return" === context.method && context.abrupt("return", context.arg);
- state = "executing";
- var record = tryCatch(innerFn, self, context);
- if ("normal" === record.type) {
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
- return {
- value: record.arg,
- done: context.done
- };
- }
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
- }
- };
- }(innerFn, self, context), generator;
- }
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- exports.wrap = wrap;
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = _Object$getPrototypeOf,
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
- function defineIteratorMethods(prototype) {
- var _context8;
- _forEachInstanceProperty2(_context8 = ["next", "throw", "return"]).call(_context8, function (method) {
- define(prototype, method, function (arg) {
- return this._invoke(method, arg);
- });
- });
- }
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if ("throw" !== record.type) {
- var result = record.arg,
- value = result.value;
- return value && "object" == _typeof3(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
- result.value = unwrapped, resolve(result);
- }, function (error) {
- return invoke("throw", error, resolve, reject);
- });
- }
- reject(record.arg);
- }
- var previousPromise;
- this._invoke = function (method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (undefined === method) {
- if (context.delegate = null, "throw" === context.method) {
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
- var info = record.arg;
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
- }
- function pushTryEntry(locs) {
- var entry = {
- tryLoc: locs[0]
- };
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal", delete record.arg, entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{
- tryLoc: "root"
- }], _forEachInstanceProperty2(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
- }
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) return iteratorMethod.call(iterable);
- if ("function" == typeof iterable.next) return iterable;
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- for (; ++i < iterable.length;) {
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
- }
- return next.value = undefined, next.done = !0, next;
- };
- return next.next = next;
- }
- }
- return {
- next: doneResult
- };
- }
- function doneResult() {
- return {
- value: undefined,
- done: !0
- };
- }
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
- var ctor = "function" == typeof genFun && genFun.constructor;
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
- }, exports.mark = function (genFun) {
- return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
- }, exports.awrap = function (arg) {
- return {
- __await: arg
- };
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- void 0 === PromiseImpl && (PromiseImpl = _Promise2);
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
- return this;
- }), define(Gp, "toString", function () {
- return "[object Generator]";
- }), exports.keys = function (object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- return _reverseInstanceProperty(keys).call(keys), function next() {
- for (; keys.length;) {
- var key = keys.pop();
- if (key in object) return next.value = key, next.done = !1, next;
- }
- return next.done = !0, next;
- };
- }, exports.values = values, Context.prototype = {
- constructor: Context,
- reset: function (skipTempReset) {
- var _context9;
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context9 = this.tryEntries).call(_context9, resetTryEntry), !skipTempReset) for (var name in this) {
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty2(name).call(name, 1)) && (this[name] = undefined);
- }
- },
- stop: function () {
- this.done = !0;
- var rootRecord = this.tryEntries[0].completion;
- if ("throw" === rootRecord.type) throw rootRecord.arg;
- return this.rval;
- },
- dispatchException: function (exception) {
- if (this.done) throw exception;
- var context = this;
- function handle(loc, caught) {
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i],
- record = entry.completion;
- if ("root" === entry.tryLoc) return handle("end");
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc"),
- hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- } else {
- if (!hasFinally) throw new Error("try statement without catch or finally");
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- }
- }
- }
- },
- abrupt: function (type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
- var record = finallyEntry ? finallyEntry.completion : {};
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
- },
- complete: function (record, afterLoc) {
- if ("throw" === record.type) throw record.arg;
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
- },
- finish: function (finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
- }
- },
- catch: function (tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if ("throw" === record.type) {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function (iterable, resultName, nextLoc) {
- return this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
- }
- }, exports;
- }
- var ParseError = _dereq_('./ParseError').default;
- var XHR = null;
- if (typeof XMLHttpRequest !== 'undefined') {
- XHR = XMLHttpRequest;
- }
- /*:: type Base64 = { base64: string };*/
- /*:: type Uri = { uri: string };*/
- /*:: type FileData = Array<number> | Base64 | Blob | Uri;*/
- /*:: export type FileSource =
- | {
- format: 'file',
- file: Blob,
- type: string,
- }
- | {
- format: 'base64',
- base64: string,
- type: string,
- }
- | {
- format: 'uri',
- uri: string,
- type: string,
- };*/
- function b64Digit(number
- /*: number*/
- )
- /*: string*/
- {
- if (number < 26) {
- return String.fromCharCode(65 + number);
- }
- if (number < 52) {
- return String.fromCharCode(97 + (number - 26));
- }
- if (number < 62) {
- return String.fromCharCode(48 + (number - 52));
- }
- if (number === 62) {
- return '+';
- }
- if (number === 63) {
- return '/';
- }
- throw new TypeError('Tried to encode large digit ' + number + ' in base64.');
- }
- /**
- * A Parse.File is a local representation of a file that is saved to the Parse
- * cloud.
- *
- * @alias Parse.File
- */
- var ParseFile = /*#__PURE__*/function () {
- /**
- * @param name {String} The file's name. This will be prefixed by a unique
- * value once the file has finished saving. The file name must begin with
- * an alphanumeric character, and consist of alphanumeric characters,
- * periods, spaces, underscores, or dashes.
- * @param data {Array} The data for the file, as either:
- * 1. an Array of byte value Numbers, or
- * 2. an Object like { base64: "..." } with a base64-encoded String.
- * 3. an Object like { uri: "..." } with a uri String.
- * 4. a File object selected with a file upload control. (3) only works
- * in Firefox 3.6+, Safari 6.0.2+, Chrome 7+, and IE 10+.
- * For example:
- * <pre>
- * var fileUploadControl = $("#profilePhotoFileUpload")[0];
- * if (fileUploadControl.files.length > 0) {
- * var file = fileUploadControl.files[0];
- * var name = "photo.jpg";
- * var parseFile = new Parse.File(name, file);
- * parseFile.save().then(function() {
- * // The file has been saved to Parse.
- * }, function(error) {
- * // The file either could not be read, or could not be saved to Parse.
- * });
- * }</pre>
- * @param type {String} Optional Content-Type header to use for the file. If
- * this is omitted, the content type will be inferred from the name's
- * extension.
- * @param metadata {Object} Optional key value pairs to be stored with file object
- * @param tags {Object} Optional key value pairs to be stored with file object
- */
- function ParseFile(name
- /*: string*/
- , data
- /*:: ?: FileData*/
- , type
- /*:: ?: string*/
- , metadata
- /*:: ?: Object*/
- , tags
- /*:: ?: Object*/
- ) {
- (0, _classCallCheck2.default)(this, ParseFile);
- (0, _defineProperty2.default)(this, "_name", void 0);
- (0, _defineProperty2.default)(this, "_url", void 0);
- (0, _defineProperty2.default)(this, "_source", void 0);
- (0, _defineProperty2.default)(this, "_previousSave", void 0);
- (0, _defineProperty2.default)(this, "_data", void 0);
- (0, _defineProperty2.default)(this, "_requestTask", void 0);
- (0, _defineProperty2.default)(this, "_metadata", void 0);
- (0, _defineProperty2.default)(this, "_tags", void 0);
- var specifiedType = type || '';
- this._name = name;
- this._metadata = metadata || {};
- this._tags = tags || {};
- if (data !== undefined) {
- if ((0, _isArray.default)(data)) {
- this._data = ParseFile.encodeBase64(data);
- this._source = {
- format: 'base64',
- base64: this._data,
- type: specifiedType
- };
- } else if (typeof Blob !== 'undefined' && data instanceof Blob) {
- this._source = {
- format: 'file',
- file: data,
- type: specifiedType
- };
- } else if (data && typeof data.uri === 'string' && data.uri !== undefined) {
- this._source = {
- format: 'uri',
- uri: data.uri,
- type: specifiedType
- };
- } else if (data && typeof data.base64 === 'string') {
- var _context, _context2, _context3;
- var base64 = (0, _slice.default)(_context = data.base64.split(',')).call(_context, -1)[0];
- var dataType = specifiedType || (0, _slice.default)(_context2 = (0, _slice.default)(_context3 = data.base64.split(';')).call(_context3, 0, 1)[0].split(':')).call(_context2, 1, 2)[0] || 'text/plain';
- this._data = base64;
- this._source = {
- format: 'base64',
- base64: base64,
- type: dataType
- };
- } else {
- throw new TypeError('Cannot create a Parse.File with that data.');
- }
- }
- }
- /**
- * Return the data for the file, downloading it if not already present.
- * Data is present if initialized with Byte Array, Base64 or Saved with Uri.
- * Data is cleared if saved with File object selected with a file upload control
- *
- * @returns {Promise} Promise that is resolve with base64 data
- */
- (0, _createClass2.default)(ParseFile, [{
- key: "getData",
- value: function () {
- var _getData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
- var _this = this;
- var options, controller, result;
- return _regeneratorRuntime().wrap(function (_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- if (!this._data) {
- _context4.next = 2;
- break;
- }
- return _context4.abrupt("return", this._data);
- case 2:
- if (this._url) {
- _context4.next = 4;
- break;
- }
- throw new Error('Cannot retrieve data for unsaved ParseFile.');
- case 4:
- options = {
- requestTask: function (task) {
- return _this._requestTask = task;
- }
- };
- controller = _CoreManager.default.getFileController();
- _context4.next = 8;
- return controller.download(this._url, options);
- case 8:
- result = _context4.sent;
- this._data = result.base64;
- return _context4.abrupt("return", this._data);
- case 11:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee, this);
- }));
- function getData() {
- return _getData.apply(this, arguments);
- }
- return getData;
- }()
- /**
- * Gets the name of the file. Before save is called, this is the filename
- * given by the user. After save is called, that name gets prefixed with a
- * unique identifier.
- *
- * @returns {string}
- */
- }, {
- key: "name",
- value: function ()
- /*: string*/
- {
- return this._name;
- }
- /**
- * Gets the url of the file. It is only available after you save the file or
- * after you get the file from a Parse.Object.
- *
- * @param {object} options An object to specify url options
- * @returns {string}
- */
- }, {
- key: "url",
- value: function (options
- /*:: ?: { forceSecure?: boolean }*/
- )
- /*: ?string*/
- {
- options = options || {};
- if (!this._url) {
- return;
- }
- if (options.forceSecure) {
- return this._url.replace(/^http:\/\//i, 'https://');
- } else {
- return this._url;
- }
- }
- /**
- * Gets the metadata of the file.
- *
- * @returns {object}
- */
- }, {
- key: "metadata",
- value: function ()
- /*: Object*/
- {
- return this._metadata;
- }
- /**
- * Gets the tags of the file.
- *
- * @returns {object}
- */
- }, {
- key: "tags",
- value: function ()
- /*: Object*/
- {
- return this._tags;
- }
- /**
- * Saves the file to the Parse cloud.
- *
- * @param {object} options
- * * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>progress: In Browser only, callback for upload progress. For example:
- * <pre>
- * let parseFile = new Parse.File(name, file);
- * parseFile.save({
- * progress: (progressValue, loaded, total, { type }) => {
- * if (type === "upload" && progressValue !== null) {
- * // Update the UI using progressValue
- * }
- * }
- * });
- * </pre>
- * </ul>
- * @returns {Promise} Promise that is resolved when the save finishes.
- */
- }, {
- key: "save",
- value: function (options
- /*:: ?: FullOptions*/
- ) {
- var _this2 = this;
- options = options || {};
- options.requestTask = function (task) {
- return _this2._requestTask = task;
- };
- options.metadata = this._metadata;
- options.tags = this._tags;
- var controller = _CoreManager.default.getFileController();
- if (!this._previousSave) {
- if (this._source.format === 'file') {
- this._previousSave = controller.saveFile(this._name, this._source, options).then(function (res) {
- _this2._name = res.name;
- _this2._url = res.url;
- _this2._data = null;
- _this2._requestTask = null;
- return _this2;
- });
- } else if (this._source.format === 'uri') {
- this._previousSave = controller.download(this._source.uri, options).then(function (result) {
- if (!(result && result.base64)) {
- return {};
- }
- var newSource = {
- format: 'base64',
- base64: result.base64,
- type: result.contentType
- };
- _this2._data = result.base64;
- _this2._requestTask = null;
- return controller.saveBase64(_this2._name, newSource, options);
- }).then(function (res) {
- _this2._name = res.name;
- _this2._url = res.url;
- _this2._requestTask = null;
- return _this2;
- });
- } else {
- this._previousSave = controller.saveBase64(this._name, this._source, options).then(function (res) {
- _this2._name = res.name;
- _this2._url = res.url;
- _this2._requestTask = null;
- return _this2;
- });
- }
- }
- if (this._previousSave) {
- return this._previousSave;
- }
- }
- /**
- * Aborts the request if it has already been sent.
- */
- }, {
- key: "cancel",
- value: function () {
- if (this._requestTask && typeof this._requestTask.abort === 'function') {
- this._requestTask.abort();
- }
- this._requestTask = null;
- }
- /**
- * Deletes the file from the Parse cloud.
- * In Cloud Code and Node only with Master Key.
- *
- * @param {object} options
- * * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <pre>
- * @returns {Promise} Promise that is resolved when the delete finishes.
- */
- }, {
- key: "destroy",
- value: function () {
- var _this3 = this;
- var options
- /*:: ?: FullOptions*/
- = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- if (!this._name) {
- throw new ParseError(ParseError.FILE_DELETE_UNNAMED_ERROR, 'Cannot delete an unnamed file.');
- }
- var destroyOptions = {
- useMasterKey: true
- };
- if (options.hasOwnProperty('useMasterKey')) {
- destroyOptions.useMasterKey = options.useMasterKey;
- }
- var controller = _CoreManager.default.getFileController();
- return controller.deleteFile(this._name, destroyOptions).then(function () {
- _this3._data = null;
- _this3._requestTask = null;
- return _this3;
- });
- }
- }, {
- key: "toJSON",
- value: function ()
- /*: { name: ?string, url: ?string }*/
- {
- return {
- __type: 'File',
- name: this._name,
- url: this._url
- };
- }
- }, {
- key: "equals",
- value: function (other
- /*: mixed*/
- )
- /*: boolean*/
- {
- if (this === other) {
- return true;
- } // Unsaved Files are never equal, since they will be saved to different URLs
- return other instanceof ParseFile && this.name() === other.name() && this.url() === other.url() && typeof this.url() !== 'undefined';
- }
- /**
- * Sets metadata to be saved with file object. Overwrites existing metadata
- *
- * @param {object} metadata Key value pairs to be stored with file object
- */
- }, {
- key: "setMetadata",
- value: function (metadata
- /*: any*/
- ) {
- var _this4 = this;
- if (metadata && (0, _typeof2.default)(metadata) === 'object') {
- var _context5;
- (0, _forEach.default)(_context5 = (0, _keys.default)(metadata)).call(_context5, function (key) {
- _this4.addMetadata(key, metadata[key]);
- });
- }
- }
- /**
- * Sets metadata to be saved with file object. Adds to existing metadata.
- *
- * @param {string} key key to store the metadata
- * @param {*} value metadata
- */
- }, {
- key: "addMetadata",
- value: function (key
- /*: string*/
- , value
- /*: any*/
- ) {
- if (typeof key === 'string') {
- this._metadata[key] = value;
- }
- }
- /**
- * Sets tags to be saved with file object. Overwrites existing tags
- *
- * @param {object} tags Key value pairs to be stored with file object
- */
- }, {
- key: "setTags",
- value: function (tags
- /*: any*/
- ) {
- var _this5 = this;
- if (tags && (0, _typeof2.default)(tags) === 'object') {
- var _context6;
- (0, _forEach.default)(_context6 = (0, _keys.default)(tags)).call(_context6, function (key) {
- _this5.addTag(key, tags[key]);
- });
- }
- }
- /**
- * Sets tags to be saved with file object. Adds to existing tags.
- *
- * @param {string} key key to store tags
- * @param {*} value tag
- */
- }, {
- key: "addTag",
- value: function (key
- /*: string*/
- , value
- /*: string*/
- ) {
- if (typeof key === 'string') {
- this._tags[key] = value;
- }
- }
- }], [{
- key: "fromJSON",
- value: function (obj)
- /*: ParseFile*/
- {
- if (obj.__type !== 'File') {
- throw new TypeError('JSON object does not represent a ParseFile');
- }
- var file = new ParseFile(obj.name);
- file._url = obj.url;
- return file;
- }
- }, {
- key: "encodeBase64",
- value: function (bytes
- /*: Array<number>*/
- )
- /*: string*/
- {
- var chunks = [];
- chunks.length = Math.ceil(bytes.length / 3);
- for (var i = 0; i < chunks.length; i++) {
- var b1 = bytes[i * 3];
- var b2 = bytes[i * 3 + 1] || 0;
- var b3 = bytes[i * 3 + 2] || 0;
- var has2 = i * 3 + 1 < bytes.length;
- var has3 = i * 3 + 2 < bytes.length;
- chunks[i] = [b64Digit(b1 >> 2 & 0x3f), b64Digit(b1 << 4 & 0x30 | b2 >> 4 & 0x0f), has2 ? b64Digit(b2 << 2 & 0x3c | b3 >> 6 & 0x03) : '=', has3 ? b64Digit(b3 & 0x3f) : '='].join('');
- }
- return chunks.join('');
- }
- }]);
- return ParseFile;
- }();
- var DefaultController = {
- saveFile: function () {
- var _saveFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(name
- /*: string*/
- , source
- /*: FileSource*/
- , options
- /*:: ?: FullOptions*/
- ) {
- var base64Data, _base64Data$split, _base64Data$split2, first, second, data, newSource;
- return _regeneratorRuntime().wrap(function _callee2$(_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- if (!(source.format !== 'file')) {
- _context7.next = 2;
- break;
- }
- throw new Error('saveFile can only be used with File-type sources.');
- case 2:
- _context7.next = 4;
- return new _promise.default(function (res, rej) {
- // eslint-disable-next-line no-undef
- var reader = new FileReader();
- reader.onload = function () {
- return res(reader.result);
- };
- reader.onerror = function (error) {
- return rej(error);
- };
- reader.readAsDataURL(source.file);
- });
- case 4:
- base64Data = _context7.sent; // we only want the data after the comma
- // For example: "data:application/pdf;base64,JVBERi0xLjQKJ..." we would only want "JVBERi0xLjQKJ..."
- _base64Data$split = base64Data.split(','), _base64Data$split2 = (0, _slicedToArray2.default)(_base64Data$split, 2), first = _base64Data$split2[0], second = _base64Data$split2[1]; // in the event there is no 'data:application/pdf;base64,' at the beginning of the base64 string
- // use the entire string instead
- data = second ? second : first;
- newSource = {
- format: 'base64',
- base64: data,
- type: source.type || (source.file ? source.file.type : null)
- };
- _context7.next = 10;
- return DefaultController.saveBase64(name, newSource, options);
- case 10:
- return _context7.abrupt("return", _context7.sent);
- case 11:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee2);
- }));
- function saveFile(_x, _x2, _x3) {
- return _saveFile.apply(this, arguments);
- }
- return saveFile;
- }(),
- saveBase64: function saveBase64(name
- /*: string*/
- , source
- /*: FileSource*/
- , options
- /*:: ?: FullOptions*/
- ) {
- if (source.format !== 'base64') {
- throw new Error('saveBase64 can only be used with Base64-type sources.');
- }
- var data
- /*: { base64: any, _ContentType?: any, fileData: Object }*/
- = {
- base64: source.base64,
- fileData: {
- metadata: _objectSpread({}, options.metadata),
- tags: _objectSpread({}, options.tags)
- }
- };
- delete options.metadata;
- delete options.tags;
- if (source.type) {
- data._ContentType = source.type;
- }
- var path = 'files/' + name;
- return _CoreManager.default.getRESTController().request('POST', path, data, options);
- },
- download: function download(uri, options) {
- if (XHR) {
- return this.downloadAjax(uri, options);
- } else {
- return _promise.default.reject('Cannot make a request: No definition of XMLHttpRequest was found.');
- }
- },
- downloadAjax: function downloadAjax(uri, options) {
- return new _promise.default(function (resolve, reject) {
- var xhr = new XHR();
- xhr.open('GET', uri, true);
- xhr.responseType = 'arraybuffer';
- xhr.onerror = function (e) {
- reject(e);
- };
- xhr.onreadystatechange = function () {
- if (xhr.readyState !== xhr.DONE) {
- return;
- }
- if (!this.response) {
- return resolve({});
- }
- var bytes = new Uint8Array(this.response);
- resolve({
- base64: ParseFile.encodeBase64(bytes),
- contentType: xhr.getResponseHeader('content-type')
- });
- };
- options.requestTask(xhr);
- xhr.send();
- });
- },
- deleteFile: function deleteFile(name
- /*: string*/
- , options
- /*:: ?: FullOptions*/
- ) {
- var headers = {
- 'X-Parse-Application-ID': _CoreManager.default.get('APPLICATION_ID')
- };
- if (options.useMasterKey) {
- headers['X-Parse-Master-Key'] = _CoreManager.default.get('MASTER_KEY');
- }
- var url = _CoreManager.default.get('SERVER_URL');
- if (url[url.length - 1] !== '/') {
- url += '/';
- }
- url += 'files/' + name;
- return _CoreManager.default.getRESTController().ajax('DELETE', url, '', headers).catch(function (response) {
- // TODO: return JSON object in server
- if (!response || response === 'SyntaxError: Unexpected end of JSON input') {
- return _promise.default.resolve();
- } else {
- return _CoreManager.default.getRESTController().handleError(response);
- }
- });
- },
- _setXHR: function _setXHR(xhr
- /*: any*/
- ) {
- XHR = xhr;
- },
- _getXHR: function _getXHR() {
- return XHR;
- }
- };
- _CoreManager.default.setFileController(DefaultController);
- var _default = ParseFile;
- exports.default = _default;
- exports.b64Digit = b64Digit;
- },{"./CoreManager":4,"./ParseError":22,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/filter":61,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/instance/reverse":70,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/object/create":80,"@babel/runtime-corejs3/core-js-stable/object/define-properties":81,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":85,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":86,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":87,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":88,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":90,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/helpers/asyncToGenerator":120,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/slicedToArray":137,"@babel/runtime-corejs3/helpers/typeof":140}],24:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- /**
- * Creates a new GeoPoint with any of the following forms:<br>
- * <pre>
- * new GeoPoint(otherGeoPoint)
- * new GeoPoint(30, 30)
- * new GeoPoint([30, 30])
- * new GeoPoint({latitude: 30, longitude: 30})
- * new GeoPoint() // defaults to (0, 0)
- * </pre>
- * <p>Represents a latitude / longitude point that may be associated
- * with a key in a ParseObject or used as a reference point for geo queries.
- * This allows proximity-based queries on the key.</p>
- *
- * <p>Only one key in a class may contain a GeoPoint.</p>
- *
- * <p>Example:<pre>
- * var point = new Parse.GeoPoint(30.0, -20.0);
- * var object = new Parse.Object("PlaceObject");
- * object.set("location", point);
- * object.save();</pre></p>
- *
- * @alias Parse.GeoPoint
- */
- /* global navigator */
- var ParseGeoPoint = /*#__PURE__*/function () {
- /**
- * @param {(number[] | object | number)} arg1 Either a list of coordinate pairs, an object with `latitude`, `longitude`, or the latitude or the point.
- * @param {number} arg2 The longitude of the GeoPoint
- */
- function ParseGeoPoint(arg1
- /*: Array<number> | { latitude: number, longitude: number } | number*/
- , arg2
- /*:: ?: number*/
- ) {
- (0, _classCallCheck2.default)(this, ParseGeoPoint);
- (0, _defineProperty2.default)(this, "_latitude", void 0);
- (0, _defineProperty2.default)(this, "_longitude", void 0);
- if ((0, _isArray.default)(arg1)) {
- ParseGeoPoint._validate(arg1[0], arg1[1]);
- this._latitude = arg1[0];
- this._longitude = arg1[1];
- } else if ((0, _typeof2.default)(arg1) === 'object') {
- ParseGeoPoint._validate(arg1.latitude, arg1.longitude);
- this._latitude = arg1.latitude;
- this._longitude = arg1.longitude;
- } else if (arg1 !== undefined && arg2 !== undefined) {
- ParseGeoPoint._validate(arg1, arg2);
- this._latitude = arg1;
- this._longitude = arg2;
- } else {
- this._latitude = 0;
- this._longitude = 0;
- }
- }
- /**
- * North-south portion of the coordinate, in range [-90, 90].
- * Throws an exception if set out of range in a modern browser.
- *
- * @property {number} latitude
- * @returns {number}
- */
- (0, _createClass2.default)(ParseGeoPoint, [{
- key: "latitude",
- get: function ()
- /*: number*/
- {
- return this._latitude;
- },
- set: function (val
- /*: number*/
- ) {
- ParseGeoPoint._validate(val, this.longitude);
- this._latitude = val;
- }
- /**
- * East-west portion of the coordinate, in range [-180, 180].
- * Throws if set out of range in a modern browser.
- *
- * @property {number} longitude
- * @returns {number}
- */
- }, {
- key: "longitude",
- get: function ()
- /*: number*/
- {
- return this._longitude;
- },
- set: function (val
- /*: number*/
- ) {
- ParseGeoPoint._validate(this.latitude, val);
- this._longitude = val;
- }
- /**
- * Returns a JSON representation of the GeoPoint, suitable for Parse.
- *
- * @returns {object}
- */
- }, {
- key: "toJSON",
- value: function ()
- /*: { __type: string, latitude: number, longitude: number }*/
- {
- ParseGeoPoint._validate(this._latitude, this._longitude);
- return {
- __type: 'GeoPoint',
- latitude: this._latitude,
- longitude: this._longitude
- };
- }
- }, {
- key: "equals",
- value: function (other
- /*: mixed*/
- )
- /*: boolean*/
- {
- return other instanceof ParseGeoPoint && this.latitude === other.latitude && this.longitude === other.longitude;
- }
- /**
- * Returns the distance from this GeoPoint to another in radians.
- *
- * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
- * @returns {number}
- */
- }, {
- key: "radiansTo",
- value: function (point
- /*: ParseGeoPoint*/
- )
- /*: number*/
- {
- var d2r = Math.PI / 180.0;
- var lat1rad = this.latitude * d2r;
- var long1rad = this.longitude * d2r;
- var lat2rad = point.latitude * d2r;
- var long2rad = point.longitude * d2r;
- var sinDeltaLatDiv2 = Math.sin((lat1rad - lat2rad) / 2);
- var sinDeltaLongDiv2 = Math.sin((long1rad - long2rad) / 2); // Square of half the straight line chord distance between both points.
- var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
- a = Math.min(1.0, a);
- return 2 * Math.asin(Math.sqrt(a));
- }
- /**
- * Returns the distance from this GeoPoint to another in kilometers.
- *
- * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
- * @returns {number}
- */
- }, {
- key: "kilometersTo",
- value: function (point
- /*: ParseGeoPoint*/
- )
- /*: number*/
- {
- return this.radiansTo(point) * 6371.0;
- }
- /**
- * Returns the distance from this GeoPoint to another in miles.
- *
- * @param {Parse.GeoPoint} point the other Parse.GeoPoint.
- * @returns {number}
- */
- }, {
- key: "milesTo",
- value: function (point
- /*: ParseGeoPoint*/
- )
- /*: number*/
- {
- return this.radiansTo(point) * 3958.8;
- }
- /*
- * Throws an exception if the given lat-long is out of bounds.
- */
- }], [{
- key: "_validate",
- value: function (latitude
- /*: number*/
- , longitude
- /*: number*/
- ) {
- if (isNaN(latitude) || isNaN(longitude) || typeof latitude !== 'number' || typeof longitude !== 'number') {
- throw new TypeError('GeoPoint latitude and longitude must be valid numbers');
- }
- if (latitude < -90.0) {
- throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' < -90.0.');
- }
- if (latitude > 90.0) {
- throw new TypeError('GeoPoint latitude out of bounds: ' + latitude + ' > 90.0.');
- }
- if (longitude < -180.0) {
- throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' < -180.0.');
- }
- if (longitude > 180.0) {
- throw new TypeError('GeoPoint longitude out of bounds: ' + longitude + ' > 180.0.');
- }
- }
- /**
- * Creates a GeoPoint with the user's current location, if available.
- *
- * @static
- * @returns {Parse.GeoPoint} User's current location
- */
- }, {
- key: "current",
- value: function () {
- return navigator.geolocation.getCurrentPosition(function (location) {
- return new ParseGeoPoint(location.coords.latitude, location.coords.longitude);
- });
- }
- }]);
- return ParseGeoPoint;
- }();
- var _default = ParseGeoPoint;
- exports.default = _default;
- },{"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],25:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
- var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
- var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
- var _ParseObject2 = _interopRequireDefault(_dereq_("./ParseObject"));
- function _createSuper(Derived) {
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
- return function () {
- var Super = (0, _getPrototypeOf2.default)(Derived),
- result;
- if (hasNativeReflectConstruct) {
- var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
- result = _Reflect$construct(Super, arguments, NewTarget);
- } else {
- result = Super.apply(this, arguments);
- }
- return (0, _possibleConstructorReturn2.default)(this, result);
- };
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
- if (_Reflect$construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
- }
- var Installation = /*#__PURE__*/function (_ParseObject) {
- (0, _inherits2.default)(Installation, _ParseObject);
- var _super = _createSuper(Installation);
- function Installation(attributes
- /*: ?AttributeMap*/
- ) {
- var _this;
- (0, _classCallCheck2.default)(this, Installation);
- _this = _super.call(this, '_Installation');
- if (attributes && (0, _typeof2.default)(attributes) === 'object') {
- if (!_this.set(attributes || {})) {
- throw new Error("Can't create an invalid Installation");
- }
- }
- return _this;
- }
- return (0, _createClass2.default)(Installation);
- }(_ParseObject2.default);
- exports.default = Installation;
- _ParseObject2.default.registerSubclass('_Installation', Installation);
- },{"./ParseObject":27,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/getPrototypeOf":126,"@babel/runtime-corejs3/helpers/inherits":127,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":135,"@babel/runtime-corejs3/helpers/typeof":140}],26:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
- var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
- var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
- var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
- var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
- var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
- var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
- var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
- var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
- var _EventEmitter = _interopRequireDefault(_dereq_("./EventEmitter"));
- var _LiveQueryClient = _interopRequireDefault(_dereq_("./LiveQueryClient"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- function _regeneratorRuntime() {
- "use strict";
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
- _regeneratorRuntime = function () {
- return exports;
- };
- var exports = {},
- Op = Object.prototype,
- hasOwn = Op.hasOwnProperty,
- $Symbol = "function" == typeof _Symbol ? _Symbol : {},
- iteratorSymbol = $Symbol.iterator || "@@iterator",
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- return _Object$defineProperty(obj, key, {
- value: value,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }), obj[key];
- }
- try {
- define({}, "");
- } catch (err) {
- define = function (obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
- generator = _Object$create(protoGenerator.prototype),
- context = new Context(tryLocsList || []);
- return generator._invoke = function (innerFn, self, context) {
- var state = "suspendedStart";
- return function (method, arg) {
- if ("executing" === state) throw new Error("Generator is already running");
- if ("completed" === state) {
- if ("throw" === method) throw arg;
- return doneResult();
- }
- for (context.method = method, context.arg = arg;;) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
- if ("suspendedStart" === state) throw state = "completed", context.arg;
- context.dispatchException(context.arg);
- } else "return" === context.method && context.abrupt("return", context.arg);
- state = "executing";
- var record = tryCatch(innerFn, self, context);
- if ("normal" === record.type) {
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
- return {
- value: record.arg,
- done: context.done
- };
- }
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
- }
- };
- }(innerFn, self, context), generator;
- }
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- exports.wrap = wrap;
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = _Object$getPrototypeOf,
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
- function defineIteratorMethods(prototype) {
- var _context4;
- _forEachInstanceProperty(_context4 = ["next", "throw", "return"]).call(_context4, function (method) {
- define(prototype, method, function (arg) {
- return this._invoke(method, arg);
- });
- });
- }
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if ("throw" !== record.type) {
- var result = record.arg,
- value = result.value;
- return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
- result.value = unwrapped, resolve(result);
- }, function (error) {
- return invoke("throw", error, resolve, reject);
- });
- }
- reject(record.arg);
- }
- var previousPromise;
- this._invoke = function (method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (undefined === method) {
- if (context.delegate = null, "throw" === context.method) {
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
- var info = record.arg;
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
- }
- function pushTryEntry(locs) {
- var entry = {
- tryLoc: locs[0]
- };
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal", delete record.arg, entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{
- tryLoc: "root"
- }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
- }
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) return iteratorMethod.call(iterable);
- if ("function" == typeof iterable.next) return iterable;
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- for (; ++i < iterable.length;) {
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
- }
- return next.value = undefined, next.done = !0, next;
- };
- return next.next = next;
- }
- }
- return {
- next: doneResult
- };
- }
- function doneResult() {
- return {
- value: undefined,
- done: !0
- };
- }
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
- var ctor = "function" == typeof genFun && genFun.constructor;
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
- }, exports.mark = function (genFun) {
- return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
- }, exports.awrap = function (arg) {
- return {
- __await: arg
- };
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- void 0 === PromiseImpl && (PromiseImpl = _Promise2);
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
- return this;
- }), define(Gp, "toString", function () {
- return "[object Generator]";
- }), exports.keys = function (object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- return _reverseInstanceProperty(keys).call(keys), function next() {
- for (; keys.length;) {
- var key = keys.pop();
- if (key in object) return next.value = key, next.done = !1, next;
- }
- return next.done = !0, next;
- };
- }, exports.values = values, Context.prototype = {
- constructor: Context,
- reset: function (skipTempReset) {
- var _context5;
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context5 = this.tryEntries).call(_context5, resetTryEntry), !skipTempReset) for (var name in this) {
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
- }
- },
- stop: function () {
- this.done = !0;
- var rootRecord = this.tryEntries[0].completion;
- if ("throw" === rootRecord.type) throw rootRecord.arg;
- return this.rval;
- },
- dispatchException: function (exception) {
- if (this.done) throw exception;
- var context = this;
- function handle(loc, caught) {
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i],
- record = entry.completion;
- if ("root" === entry.tryLoc) return handle("end");
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc"),
- hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- } else {
- if (!hasFinally) throw new Error("try statement without catch or finally");
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- }
- }
- }
- },
- abrupt: function (type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
- var record = finallyEntry ? finallyEntry.completion : {};
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
- },
- complete: function (record, afterLoc) {
- if ("throw" === record.type) throw record.arg;
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
- },
- finish: function (finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
- }
- },
- catch: function (tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if ("throw" === record.type) {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function (iterable, resultName, nextLoc) {
- return this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
- }
- }, exports;
- }
- function getLiveQueryClient()
- /*: LiveQueryClient*/
- {
- return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
- }
- /**
- * We expose three events to help you monitor the status of the WebSocket connection:
- *
- * <p>Open - When we establish the WebSocket connection to the LiveQuery server, you'll get this event.
- *
- * <pre>
- * Parse.LiveQuery.on('open', () => {
- *
- * });</pre></p>
- *
- * <p>Close - When we lose the WebSocket connection to the LiveQuery server, you'll get this event.
- *
- * <pre>
- * Parse.LiveQuery.on('close', () => {
- *
- * });</pre></p>
- *
- * <p>Error - When some network error or LiveQuery server error happens, you'll get this event.
- *
- * <pre>
- * Parse.LiveQuery.on('error', (error) => {
- *
- * });</pre></p>
- *
- * @class Parse.LiveQuery
- * @static
- */
- var LiveQuery = new _EventEmitter.default();
- /**
- * After open is called, the LiveQuery will try to send a connect request
- * to the LiveQuery server.
- */
- LiveQuery.open = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
- var liveQueryClient;
- return _regeneratorRuntime().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _context.next = 2;
- return getLiveQueryClient();
- case 2:
- liveQueryClient = _context.sent;
- liveQueryClient.open();
- case 4:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
- }));
- /**
- * When you're done using LiveQuery, you can call Parse.LiveQuery.close().
- * This function will close the WebSocket connection to the LiveQuery server,
- * cancel the auto reconnect, and unsubscribe all subscriptions based on it.
- * If you call query.subscribe() after this, we'll create a new WebSocket
- * connection to the LiveQuery server.
- */
- LiveQuery.close = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
- var liveQueryClient;
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- _context2.next = 2;
- return getLiveQueryClient();
- case 2:
- liveQueryClient = _context2.sent;
- liveQueryClient.close();
- case 4:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
- })); // Register a default onError callback to make sure we do not crash on error
- LiveQuery.on('error', function () {});
- var _default = LiveQuery;
- exports.default = _default;
- var defaultLiveQueryClient;
- var DefaultLiveQueryController = {
- setDefaultLiveQueryClient: function setDefaultLiveQueryClient(liveQueryClient
- /*: LiveQueryClient*/
- ) {
- defaultLiveQueryClient = liveQueryClient;
- },
- getDefaultLiveQueryClient: function getDefaultLiveQueryClient()
- /*: Promise<LiveQueryClient>*/
- {
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
- var _yield$Promise$all, _yield$Promise$all2, currentUser, installationId, sessionToken, liveQueryServerURL, serverURL, protocol, host, applicationId, javascriptKey, masterKey;
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- if (!defaultLiveQueryClient) {
- _context3.next = 2;
- break;
- }
- return _context3.abrupt("return", defaultLiveQueryClient);
- case 2:
- _context3.next = 4;
- return _promise.default.all([_CoreManager.default.getUserController().currentUserAsync(), _CoreManager.default.getInstallationController().currentInstallationId()]);
- case 4:
- _yield$Promise$all = _context3.sent;
- _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
- currentUser = _yield$Promise$all2[0];
- installationId = _yield$Promise$all2[1];
- sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
- liveQueryServerURL = _CoreManager.default.get('LIVEQUERY_SERVER_URL');
- if (!(liveQueryServerURL && (0, _indexOf.default)(liveQueryServerURL).call(liveQueryServerURL, 'ws') !== 0)) {
- _context3.next = 12;
- break;
- }
- throw new Error('You need to set a proper Parse LiveQuery server url before using LiveQueryClient');
- case 12:
- // If we can not find Parse.liveQueryServerURL, we try to extract it from Parse.serverURL
- if (!liveQueryServerURL) {
- serverURL = _CoreManager.default.get('SERVER_URL');
- protocol = (0, _indexOf.default)(serverURL).call(serverURL, 'https') === 0 ? 'wss://' : 'ws://';
- host = serverURL.replace(/^https?:\/\//, '');
- liveQueryServerURL = protocol + host;
- _CoreManager.default.set('LIVEQUERY_SERVER_URL', liveQueryServerURL);
- }
- applicationId = _CoreManager.default.get('APPLICATION_ID');
- javascriptKey = _CoreManager.default.get('JAVASCRIPT_KEY');
- masterKey = _CoreManager.default.get('MASTER_KEY');
- defaultLiveQueryClient = new _LiveQueryClient.default({
- applicationId: applicationId,
- serverURL: liveQueryServerURL,
- javascriptKey: javascriptKey,
- masterKey: masterKey,
- sessionToken: sessionToken,
- installationId: installationId
- });
- defaultLiveQueryClient.on('error', function (error) {
- LiveQuery.emit('error', error);
- });
- defaultLiveQueryClient.on('open', function () {
- LiveQuery.emit('open');
- });
- defaultLiveQueryClient.on('close', function () {
- LiveQuery.emit('close');
- });
- return _context3.abrupt("return", defaultLiveQueryClient);
- case 21:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3);
- }))();
- },
- _clearCachedDefaultClient: function _clearCachedDefaultClient() {
- defaultLiveQueryClient = null;
- }
- };
- _CoreManager.default.setLiveQueryController(DefaultLiveQueryController);
- },{"./CoreManager":4,"./EventEmitter":6,"./LiveQueryClient":11,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/instance/reverse":70,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/object/create":80,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":88,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":90,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/helpers/asyncToGenerator":120,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/slicedToArray":137,"@babel/runtime-corejs3/helpers/typeof":140}],27:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _WeakMap = _dereq_("@babel/runtime-corejs3/core-js-stable/weak-map");
- var _Array$isArray2 = _dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array");
- var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
- var _Array$from = _dereq_("@babel/runtime-corejs3/core-js-stable/array/from");
- var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
- var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
- var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
- var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
- var _typeof3 = _dereq_("@babel/runtime-corejs3/helpers/typeof");
- var _Object$getPrototypeOf2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
- var _Object$create2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
- var _Object$defineProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
- var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
- var _forEachInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
- var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
- var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
- var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
- var _Object$keys2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
- _Object$defineProperty2(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
- var _find = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
- var _create = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/create"));
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
- var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
- var _getPrototypeOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of"));
- var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
- var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
- var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
- var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
- var _freeze = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/freeze"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _defineProperty3 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _canBeSerialized = _interopRequireDefault(_dereq_("./canBeSerialized"));
- var _decode = _interopRequireDefault(_dereq_("./decode"));
- var _encode = _interopRequireDefault(_dereq_("./encode"));
- var _escape2 = _interopRequireDefault(_dereq_("./escape"));
- var _EventuallyQueue = _interopRequireDefault(_dereq_("./EventuallyQueue"));
- var _ParseACL = _interopRequireDefault(_dereq_("./ParseACL"));
- var _parseDate = _interopRequireDefault(_dereq_("./parseDate"));
- var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
- var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
- var _promiseUtils = _dereq_("./promiseUtils");
- var _LocalDatastoreUtils = _dereq_("./LocalDatastoreUtils");
- var _ParseOp = _dereq_("./ParseOp");
- var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
- var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
- var SingleInstanceStateController = _interopRequireWildcard(_dereq_("./SingleInstanceStateController"));
- var _unique = _interopRequireDefault(_dereq_("./unique"));
- var UniqueInstanceStateController = _interopRequireWildcard(_dereq_("./UniqueInstanceStateController"));
- var _unsavedChildren = _interopRequireDefault(_dereq_("./unsavedChildren"));
- function _getRequireWildcardCache(nodeInterop) {
- if (typeof _WeakMap !== "function") return null;
- var cacheBabelInterop = new _WeakMap();
- var cacheNodeInterop = new _WeakMap();
- return (_getRequireWildcardCache = function (nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
- }
- function _interopRequireWildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) {
- return obj;
- }
- if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") {
- return {
- default: obj
- };
- }
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) {
- return cache.get(obj);
- }
- var newObj = {};
- for (var key in obj) {
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = _Object$defineProperty2 && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) {
- _Object$defineProperty2(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
- newObj.default = obj;
- if (cache) {
- cache.set(obj, newObj);
- }
- return newObj;
- }
- function _createForOfIteratorHelper(o, allowArrayLike) {
- var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
- if (!it) {
- if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it) o = it;
- var i = 0;
- var F = function () {};
- return {
- s: F,
- n: function () {
- if (i >= o.length) return {
- done: true
- };
- return {
- done: false,
- value: o[i++]
- };
- },
- e: function (_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 () {
- it = it.call(o);
- },
- n: function () {
- var step = it.next();
- normalCompletion = step.done;
- return step;
- },
- e: function (_e2) {
- didErr = true;
- err = _e2;
- },
- f: function () {
- try {
- if (!normalCompletion && it.return != null) it.return();
- } finally {
- if (didErr) throw err;
- }
- }
- };
- }
- function _unsupportedIterableToArray(o, minLen) {
- var _context20;
- if (!o) return;
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
- var n = _sliceInstanceProperty(_context20 = Object.prototype.toString.call(o)).call(_context20, 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;
- }
- function _regeneratorRuntime() {
- "use strict";
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
- _regeneratorRuntime = function () {
- return exports;
- };
- var exports = {},
- Op = Object.prototype,
- hasOwn = Op.hasOwnProperty,
- $Symbol = "function" == typeof _Symbol ? _Symbol : {},
- iteratorSymbol = $Symbol.iterator || "@@iterator",
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- return _Object$defineProperty2(obj, key, {
- value: value,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }), obj[key];
- }
- try {
- define({}, "");
- } catch (err) {
- define = function (obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
- generator = _Object$create2(protoGenerator.prototype),
- context = new Context(tryLocsList || []);
- return generator._invoke = function (innerFn, self, context) {
- var state = "suspendedStart";
- return function (method, arg) {
- if ("executing" === state) throw new Error("Generator is already running");
- if ("completed" === state) {
- if ("throw" === method) throw arg;
- return doneResult();
- }
- for (context.method = method, context.arg = arg;;) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
- if ("suspendedStart" === state) throw state = "completed", context.arg;
- context.dispatchException(context.arg);
- } else "return" === context.method && context.abrupt("return", context.arg);
- state = "executing";
- var record = tryCatch(innerFn, self, context);
- if ("normal" === record.type) {
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
- return {
- value: record.arg,
- done: context.done
- };
- }
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
- }
- };
- }(innerFn, self, context), generator;
- }
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- exports.wrap = wrap;
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = _Object$getPrototypeOf2,
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create2(IteratorPrototype);
- function defineIteratorMethods(prototype) {
- var _context18;
- _forEachInstanceProperty2(_context18 = ["next", "throw", "return"]).call(_context18, function (method) {
- define(prototype, method, function (arg) {
- return this._invoke(method, arg);
- });
- });
- }
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if ("throw" !== record.type) {
- var result = record.arg,
- value = result.value;
- return value && "object" == _typeof3(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
- result.value = unwrapped, resolve(result);
- }, function (error) {
- return invoke("throw", error, resolve, reject);
- });
- }
- reject(record.arg);
- }
- var previousPromise;
- this._invoke = function (method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (undefined === method) {
- if (context.delegate = null, "throw" === context.method) {
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
- var info = record.arg;
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
- }
- function pushTryEntry(locs) {
- var entry = {
- tryLoc: locs[0]
- };
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal", delete record.arg, entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{
- tryLoc: "root"
- }], _forEachInstanceProperty2(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
- }
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) return iteratorMethod.call(iterable);
- if ("function" == typeof iterable.next) return iterable;
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- for (; ++i < iterable.length;) {
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
- }
- return next.value = undefined, next.done = !0, next;
- };
- return next.next = next;
- }
- }
- return {
- next: doneResult
- };
- }
- function doneResult() {
- return {
- value: undefined,
- done: !0
- };
- }
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
- var ctor = "function" == typeof genFun && genFun.constructor;
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
- }, exports.mark = function (genFun) {
- return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create2(Gp), genFun;
- }, exports.awrap = function (arg) {
- return {
- __await: arg
- };
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- void 0 === PromiseImpl && (PromiseImpl = _Promise2);
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
- return this;
- }), define(Gp, "toString", function () {
- return "[object Generator]";
- }), exports.keys = function (object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- return _reverseInstanceProperty(keys).call(keys), function next() {
- for (; keys.length;) {
- var key = keys.pop();
- if (key in object) return next.value = key, next.done = !1, next;
- }
- return next.done = !0, next;
- };
- }, exports.values = values, Context.prototype = {
- constructor: Context,
- reset: function (skipTempReset) {
- var _context19;
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context19 = this.tryEntries).call(_context19, resetTryEntry), !skipTempReset) for (var name in this) {
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
- }
- },
- stop: function () {
- this.done = !0;
- var rootRecord = this.tryEntries[0].completion;
- if ("throw" === rootRecord.type) throw rootRecord.arg;
- return this.rval;
- },
- dispatchException: function (exception) {
- if (this.done) throw exception;
- var context = this;
- function handle(loc, caught) {
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i],
- record = entry.completion;
- if ("root" === entry.tryLoc) return handle("end");
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc"),
- hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- } else {
- if (!hasFinally) throw new Error("try statement without catch or finally");
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- }
- }
- }
- },
- abrupt: function (type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
- var record = finallyEntry ? finallyEntry.completion : {};
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
- },
- complete: function (record, afterLoc) {
- if ("throw" === record.type) throw record.arg;
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
- },
- finish: function (finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
- }
- },
- catch: function (tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if ("throw" === record.type) {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function (iterable, resultName, nextLoc) {
- return this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
- }
- }, exports;
- }
- function ownKeys(object, enumerableOnly) {
- var keys = _Object$keys2(object);
- if (_Object$getOwnPropertySymbols) {
- var symbols = _Object$getOwnPropertySymbols(object);
- enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, 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 _context16, _context17;
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? _forEachInstanceProperty2(_context16 = ownKeys(Object(source), !0)).call(_context16, function (key) {
- (0, _defineProperty3.default)(target, key, source[key]);
- }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context17 = ownKeys(Object(source))).call(_context17, function (key) {
- _Object$defineProperty2(target, key, _Object$getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- var uuidv4 = _dereq_('./uuid');
- /*:: export type Pointer = {
- __type: string,
- className: string,
- objectId: string,
- };*/
- /*:: type SaveParams = {
- method: string,
- path: string,
- body: AttributeMap,
- };*/
- /*:: export type SaveOptions = FullOptions & {
- cascadeSave?: boolean,
- context?: AttributeMap,
- };*/
- // Mapping of class names to constructors, so we can populate objects from the
- // server with appropriate subclasses of ParseObject
- var classMap = {}; // Global counter for generating unique Ids for non-single-instance objects
- var objectCount = 0; // On web clients, objects are single-instance: any two objects with the same Id
- // will have the same attributes. However, this may be dangerous default
- // behavior in a server scenario
- var singleInstance = !_CoreManager.default.get('IS_NODE');
- if (singleInstance) {
- _CoreManager.default.setObjectStateController(SingleInstanceStateController);
- } else {
- _CoreManager.default.setObjectStateController(UniqueInstanceStateController);
- }
- function getServerUrlPath() {
- var serverUrl = _CoreManager.default.get('SERVER_URL');
- if (serverUrl[serverUrl.length - 1] !== '/') {
- serverUrl += '/';
- }
- var url = serverUrl.replace(/https?:\/\//, '');
- return url.substr((0, _indexOf.default)(url).call(url, '/'));
- }
- /**
- * Creates a new model with defined attributes.
- *
- * <p>You won't normally call this method directly. It is recommended that
- * you use a subclass of <code>Parse.Object</code> instead, created by calling
- * <code>extend</code>.</p>
- *
- * <p>However, if you don't want to use a subclass, or aren't sure which
- * subclass is appropriate, you can use this form:<pre>
- * var object = new Parse.Object("ClassName");
- * </pre>
- * That is basically equivalent to:<pre>
- * var MyClass = Parse.Object.extend("ClassName");
- * var object = new MyClass();
- * </pre></p>
- *
- * @alias Parse.Object
- */
- var ParseObject = /*#__PURE__*/function () {
- /**
- * @param {string} className The class name for the object
- * @param {object} attributes The initial set of data to store in the object.
- * @param {object} options The options for this object instance.
- */
- function ParseObject(className
- /*: ?string | { className: string, [attr: string]: mixed }*/
- , attributes
- /*:: ?: { [attr: string]: mixed }*/
- , options
- /*:: ?: { ignoreValidation: boolean }*/
- ) {
- (0, _classCallCheck2.default)(this, ParseObject);
- (0, _defineProperty3.default)(this, "id", void 0);
- (0, _defineProperty3.default)(this, "_localId", void 0);
- (0, _defineProperty3.default)(this, "_objCount", void 0);
- (0, _defineProperty3.default)(this, "className", void 0); // Enable legacy initializers
- if (typeof this.initialize === 'function') {
- this.initialize.apply(this, arguments);
- }
- var toSet = null;
- this._objCount = objectCount++;
- if (typeof className === 'string') {
- this.className = className;
- if (attributes && (0, _typeof2.default)(attributes) === 'object') {
- toSet = attributes;
- }
- } else if (className && (0, _typeof2.default)(className) === 'object') {
- this.className = className.className;
- toSet = {};
- for (var _attr in className) {
- if (_attr !== 'className') {
- toSet[_attr] = className[_attr];
- }
- }
- if (attributes && (0, _typeof2.default)(attributes) === 'object') {
- options = attributes;
- }
- }
- if (toSet && !this.set(toSet, options)) {
- throw new Error("Can't create an invalid Parse Object");
- }
- }
- /**
- * The ID of this object, unique within its class.
- *
- * @property {string} id
- */
- (0, _createClass2.default)(ParseObject, [{
- key: "attributes",
- get:
- /** Prototype getters / setters **/
- function ()
- /*: AttributeMap*/
- {
- var stateController = _CoreManager.default.getObjectStateController();
- return (0, _freeze.default)(stateController.estimateAttributes(this._getStateIdentifier()));
- }
- /**
- * The first time this object was saved on the server.
- *
- * @property {Date} createdAt
- * @returns {Date}
- */
- }, {
- key: "createdAt",
- get: function ()
- /*: ?Date*/
- {
- return this._getServerData().createdAt;
- }
- /**
- * The last time this object was updated on the server.
- *
- * @property {Date} updatedAt
- * @returns {Date}
- */
- }, {
- key: "updatedAt",
- get: function ()
- /*: ?Date*/
- {
- return this._getServerData().updatedAt;
- }
- /** Private methods **/
- /**
- * Returns a local or server Id used uniquely identify this object
- *
- * @returns {string}
- */
- }, {
- key: "_getId",
- value: function ()
- /*: string*/
- {
- if (typeof this.id === 'string') {
- return this.id;
- }
- if (typeof this._localId === 'string') {
- return this._localId;
- }
- var localId = 'local' + uuidv4();
- this._localId = localId;
- return localId;
- }
- /**
- * Returns a unique identifier used to pull data from the State Controller.
- *
- * @returns {Parse.Object|object}
- */
- }, {
- key: "_getStateIdentifier",
- value: function ()
- /*: ParseObject | { id: string, className: string }*/
- {
- if (singleInstance) {
- var id = this.id;
- if (!id) {
- id = this._getId();
- }
- return {
- id: id,
- className: this.className
- };
- } else {
- return this;
- }
- }
- }, {
- key: "_getServerData",
- value: function ()
- /*: AttributeMap*/
- {
- var stateController = _CoreManager.default.getObjectStateController();
- return stateController.getServerData(this._getStateIdentifier());
- }
- }, {
- key: "_clearServerData",
- value: function () {
- var serverData = this._getServerData();
- var unset = {};
- for (var _attr2 in serverData) {
- unset[_attr2] = undefined;
- }
- var stateController = _CoreManager.default.getObjectStateController();
- stateController.setServerData(this._getStateIdentifier(), unset);
- }
- }, {
- key: "_getPendingOps",
- value: function ()
- /*: Array<OpsMap>*/
- {
- var stateController = _CoreManager.default.getObjectStateController();
- return stateController.getPendingOps(this._getStateIdentifier());
- }
- /**
- * @param {Array<string>} [keysToClear] - if specified, only ops matching
- * these fields will be cleared
- */
- }, {
- key: "_clearPendingOps",
- value: function (keysToClear
- /*:: ?: Array<string>*/
- ) {
- var pending = this._getPendingOps();
- var latest = pending[pending.length - 1];
- var keys = keysToClear || (0, _keys.default)(latest);
- (0, _forEach.default)(keys).call(keys, function (key) {
- delete latest[key];
- });
- }
- }, {
- key: "_getDirtyObjectAttributes",
- value: function ()
- /*: AttributeMap*/
- {
- var attributes = this.attributes;
- var stateController = _CoreManager.default.getObjectStateController();
- var objectCache = stateController.getObjectCache(this._getStateIdentifier());
- var dirty = {};
- for (var _attr3 in attributes) {
- var val = attributes[_attr3];
- if (val && (0, _typeof2.default)(val) === 'object' && !(val instanceof ParseObject) && !(val instanceof _ParseFile.default) && !(val instanceof _ParseRelation.default)) {
- // Due to the way browsers construct maps, the key order will not change
- // unless the object is changed
- try {
- var json = (0, _encode.default)(val, false, true);
- var stringified = (0, _stringify.default)(json);
- if (objectCache[_attr3] !== stringified) {
- dirty[_attr3] = val;
- }
- } catch (e) {
- // Error occurred, possibly by a nested unsaved pointer in a mutable container
- // No matter how it happened, it indicates a change in the attribute
- dirty[_attr3] = val;
- }
- }
- }
- return dirty;
- }
- }, {
- key: "_toFullJSON",
- value: function (seen
- /*:: ?: Array<any>*/
- , offline
- /*:: ?: boolean*/
- )
- /*: AttributeMap*/
- {
- var json
- /*: { [key: string]: mixed }*/
- = this.toJSON(seen, offline);
- json.__type = 'Object';
- json.className = this.className;
- return json;
- }
- }, {
- key: "_getSaveJSON",
- value: function ()
- /*: AttributeMap*/
- {
- var pending = this._getPendingOps();
- var dirtyObjects = this._getDirtyObjectAttributes();
- var json = {};
- for (var attr in dirtyObjects) {
- var isDotNotation = false;
- for (var i = 0; i < pending.length; i += 1) {
- for (var field in pending[i]) {
- // Dot notation operations are handled later
- if ((0, _includes.default)(field).call(field, '.')) {
- var fieldName = field.split('.')[0];
- if (fieldName === attr) {
- isDotNotation = true;
- break;
- }
- }
- }
- }
- if (!isDotNotation) {
- json[attr] = new _ParseOp.SetOp(dirtyObjects[attr]).toJSON();
- }
- }
- for (attr in pending[0]) {
- json[attr] = pending[0][attr].toJSON();
- }
- return json;
- }
- }, {
- key: "_getSaveParams",
- value: function ()
- /*: SaveParams*/
- {
- var method = this.id ? 'PUT' : 'POST';
- var body = this._getSaveJSON();
- var path = 'classes/' + this.className;
- if (_CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID')) {
- if (!this.createdAt) {
- method = 'POST';
- body.objectId = this.id;
- } else {
- method = 'PUT';
- path += '/' + this.id;
- }
- } else if (this.id) {
- path += '/' + this.id;
- } else if (this.className === '_User') {
- path = 'users';
- }
- return {
- method: method,
- body: body,
- path: path
- };
- }
- }, {
- key: "_finishFetch",
- value: function (serverData
- /*: AttributeMap*/
- ) {
- if (!this.id && serverData.objectId) {
- this.id = serverData.objectId;
- }
- var stateController = _CoreManager.default.getObjectStateController();
- stateController.initializeState(this._getStateIdentifier());
- var decoded = {};
- for (var _attr4 in serverData) {
- if (_attr4 === 'ACL') {
- decoded[_attr4] = new _ParseACL.default(serverData[_attr4]);
- } else if (_attr4 !== 'objectId') {
- decoded[_attr4] = (0, _decode.default)(serverData[_attr4]);
- if (decoded[_attr4] instanceof _ParseRelation.default) {
- decoded[_attr4]._ensureParentAndKey(this, _attr4);
- }
- }
- }
- if (decoded.createdAt && typeof decoded.createdAt === 'string') {
- decoded.createdAt = (0, _parseDate.default)(decoded.createdAt);
- }
- if (decoded.updatedAt && typeof decoded.updatedAt === 'string') {
- decoded.updatedAt = (0, _parseDate.default)(decoded.updatedAt);
- }
- if (!decoded.updatedAt && decoded.createdAt) {
- decoded.updatedAt = decoded.createdAt;
- }
- stateController.commitServerChanges(this._getStateIdentifier(), decoded);
- }
- }, {
- key: "_setExisted",
- value: function (existed
- /*: boolean*/
- ) {
- var stateController = _CoreManager.default.getObjectStateController();
- var state = stateController.getState(this._getStateIdentifier());
- if (state) {
- state.existed = existed;
- }
- }
- }, {
- key: "_migrateId",
- value: function (serverId
- /*: string*/
- ) {
- if (this._localId && serverId) {
- if (singleInstance) {
- var stateController = _CoreManager.default.getObjectStateController();
- var oldState = stateController.removeState(this._getStateIdentifier());
- this.id = serverId;
- delete this._localId;
- if (oldState) {
- stateController.initializeState(this._getStateIdentifier(), oldState);
- }
- } else {
- this.id = serverId;
- delete this._localId;
- }
- }
- }
- }, {
- key: "_handleSaveResponse",
- value: function (response
- /*: AttributeMap*/
- , status
- /*: number*/
- ) {
- var changes = {};
- var stateController = _CoreManager.default.getObjectStateController();
- var pending = stateController.popPendingState(this._getStateIdentifier());
- for (var attr in pending) {
- if (pending[attr] instanceof _ParseOp.RelationOp) {
- changes[attr] = pending[attr].applyTo(undefined, this, attr);
- } else if (!(attr in response)) {
- // Only SetOps and UnsetOps should not come back with results
- changes[attr] = pending[attr].applyTo(undefined);
- }
- }
- for (attr in response) {
- if ((attr === 'createdAt' || attr === 'updatedAt') && typeof response[attr] === 'string') {
- changes[attr] = (0, _parseDate.default)(response[attr]);
- } else if (attr === 'ACL') {
- changes[attr] = new _ParseACL.default(response[attr]);
- } else if (attr !== 'objectId') {
- var val = (0, _decode.default)(response[attr]);
- if (val && (0, _getPrototypeOf.default)(val) === Object.prototype) {
- changes[attr] = _objectSpread(_objectSpread({}, this.attributes[attr]), val);
- } else {
- changes[attr] = val;
- }
- if (changes[attr] instanceof _ParseOp.UnsetOp) {
- changes[attr] = undefined;
- }
- }
- }
- if (changes.createdAt && !changes.updatedAt) {
- changes.updatedAt = changes.createdAt;
- }
- this._migrateId(response.objectId);
- if (status !== 201) {
- this._setExisted(true);
- }
- stateController.commitServerChanges(this._getStateIdentifier(), changes);
- }
- }, {
- key: "_handleSaveError",
- value: function () {
- var stateController = _CoreManager.default.getObjectStateController();
- stateController.mergeFirstPendingState(this._getStateIdentifier());
- }
- }, {
- key: "initialize",
- value:
- /** Public methods **/
- function () {// NOOP
- }
- /**
- * Returns a JSON version of the object suitable for saving to Parse.
- *
- * @param seen
- * @param offline
- * @returns {object}
- */
- }, {
- key: "toJSON",
- value: function (seen
- /*: Array<any> | void*/
- , offline
- /*:: ?: boolean*/
- )
- /*: AttributeMap*/
- {
- var seenEntry = this.id ? this.className + ':' + this.id : this;
- seen = seen || [seenEntry];
- var json = {};
- var attrs = this.attributes;
- for (var _attr5 in attrs) {
- if ((_attr5 === 'createdAt' || _attr5 === 'updatedAt') && attrs[_attr5].toJSON) {
- json[_attr5] = attrs[_attr5].toJSON();
- } else {
- json[_attr5] = (0, _encode.default)(attrs[_attr5], false, false, seen, offline);
- }
- }
- var pending = this._getPendingOps();
- for (var _attr6 in pending[0]) {
- json[_attr6] = pending[0][_attr6].toJSON(offline);
- }
- if (this.id) {
- json.objectId = this.id;
- }
- return json;
- }
- /**
- * Determines whether this ParseObject is equal to another ParseObject
- *
- * @param {object} other - An other object ot compare
- * @returns {boolean}
- */
- }, {
- key: "equals",
- value: function (other
- /*: mixed*/
- )
- /*: boolean*/
- {
- if (this === other) {
- return true;
- }
- return other instanceof ParseObject && this.className === other.className && this.id === other.id && typeof this.id !== 'undefined';
- }
- /**
- * Returns true if this object has been modified since its last
- * save/refresh. If an attribute is specified, it returns true only if that
- * particular attribute has been modified since the last save/refresh.
- *
- * @param {string} attr An attribute name (optional).
- * @returns {boolean}
- */
- }, {
- key: "dirty",
- value: function (attr
- /*:: ?: string*/
- )
- /*: boolean*/
- {
- if (!this.id) {
- return true;
- }
- var pendingOps = this._getPendingOps();
- var dirtyObjects = this._getDirtyObjectAttributes();
- if (attr) {
- if (dirtyObjects.hasOwnProperty(attr)) {
- return true;
- }
- for (var i = 0; i < pendingOps.length; i++) {
- if (pendingOps[i].hasOwnProperty(attr)) {
- return true;
- }
- }
- return false;
- }
- if ((0, _keys.default)(pendingOps[0]).length !== 0) {
- return true;
- }
- if ((0, _keys.default)(dirtyObjects).length !== 0) {
- return true;
- }
- return false;
- }
- /**
- * Returns an array of keys that have been modified since last save/refresh
- *
- * @returns {string[]}
- */
- }, {
- key: "dirtyKeys",
- value: function ()
- /*: Array<string>*/
- {
- var pendingOps = this._getPendingOps();
- var keys = {};
- for (var i = 0; i < pendingOps.length; i++) {
- for (var _attr7 in pendingOps[i]) {
- keys[_attr7] = true;
- }
- }
- var dirtyObjects = this._getDirtyObjectAttributes();
- for (var _attr8 in dirtyObjects) {
- keys[_attr8] = true;
- }
- return (0, _keys.default)(keys);
- }
- /**
- * Returns true if the object has been fetched.
- *
- * @returns {boolean}
- */
- }, {
- key: "isDataAvailable",
- value: function ()
- /*: boolean*/
- {
- var serverData = this._getServerData();
- return !!(0, _keys.default)(serverData).length;
- }
- /**
- * Gets a Pointer referencing this Object.
- *
- * @returns {Pointer}
- */
- }, {
- key: "toPointer",
- value: function ()
- /*: Pointer*/
- {
- if (!this.id) {
- throw new Error('Cannot create a pointer to an unsaved ParseObject');
- }
- return {
- __type: 'Pointer',
- className: this.className,
- objectId: this.id
- };
- }
- /**
- * Gets a Pointer referencing this Object.
- *
- * @returns {Pointer}
- */
- }, {
- key: "toOfflinePointer",
- value: function ()
- /*: Pointer*/
- {
- if (!this._localId) {
- throw new Error('Cannot create a offline pointer to a saved ParseObject');
- }
- return {
- __type: 'Object',
- className: this.className,
- _localId: this._localId
- };
- }
- /**
- * Gets the value of an attribute.
- *
- * @param {string} attr The string name of an attribute.
- * @returns {*}
- */
- }, {
- key: "get",
- value: function (attr
- /*: string*/
- )
- /*: mixed*/
- {
- return this.attributes[attr];
- }
- /**
- * Gets a relation on the given class for the attribute.
- *
- * @param {string} attr The attribute to get the relation for.
- * @returns {Parse.Relation}
- */
- }, {
- key: "relation",
- value: function (attr
- /*: string*/
- )
- /*: ParseRelation*/
- {
- var value = this.get(attr);
- if (value) {
- if (!(value instanceof _ParseRelation.default)) {
- throw new Error('Called relation() on non-relation field ' + attr);
- }
- value._ensureParentAndKey(this, attr);
- return value;
- }
- return new _ParseRelation.default(this, attr);
- }
- /**
- * Gets the HTML-escaped value of an attribute.
- *
- * @param {string} attr The string name of an attribute.
- * @returns {string}
- */
- }, {
- key: "escape",
- value: function (attr
- /*: string*/
- )
- /*: string*/
- {
- var val = this.attributes[attr];
- if (val == null) {
- return '';
- }
- if (typeof val !== 'string') {
- if (typeof val.toString !== 'function') {
- return '';
- }
- val = val.toString();
- }
- return (0, _escape2.default)(val);
- }
- /**
- * Returns <code>true</code> if the attribute contains a value that is not
- * null or undefined.
- *
- * @param {string} attr The string name of the attribute.
- * @returns {boolean}
- */
- }, {
- key: "has",
- value: function (attr
- /*: string*/
- )
- /*: boolean*/
- {
- var attributes = this.attributes;
- if (attributes.hasOwnProperty(attr)) {
- return attributes[attr] != null;
- }
- return false;
- }
- /**
- * Sets a hash of model attributes on the object.
- *
- * <p>You can call it with an object containing keys and values, with one
- * key and value, or dot notation. For example:<pre>
- * gameTurn.set({
- * player: player1,
- * diceRoll: 2
- * }, {
- * error: function(gameTurnAgain, error) {
- * // The set failed validation.
- * }
- * });
- *
- * game.set("currentPlayer", player2, {
- * error: function(gameTurnAgain, error) {
- * // The set failed validation.
- * }
- * });
- *
- * game.set("finished", true);</pre></p>
- *
- * game.set("player.score", 10);</pre></p>
- *
- * @param {(string|object)} key The key to set.
- * @param {(string|object)} value The value to give it.
- * @param {object} options A set of options for the set.
- * The only supported option is <code>error</code>.
- * @returns {(ParseObject|boolean)} true if the set succeeded.
- */
- }, {
- key: "set",
- value: function (key
- /*: mixed*/
- , value
- /*: mixed*/
- , options
- /*:: ?: mixed*/
- )
- /*: ParseObject | boolean*/
- {
- var changes = {};
- var newOps = {};
- if (key && (0, _typeof2.default)(key) === 'object') {
- changes = key;
- options = value;
- } else if (typeof key === 'string') {
- changes[key] = value;
- } else {
- return this;
- }
- options = options || {};
- var readonly = [];
- if (typeof this.constructor.readOnlyAttributes === 'function') {
- readonly = (0, _concat.default)(readonly).call(readonly, this.constructor.readOnlyAttributes());
- }
- for (var k in changes) {
- if (k === 'createdAt' || k === 'updatedAt') {
- // This property is read-only, but for legacy reasons we silently
- // ignore it
- continue;
- }
- if ((0, _indexOf.default)(readonly).call(readonly, k) > -1) {
- throw new Error('Cannot modify readonly attribute: ' + k);
- }
- if (options.unset) {
- newOps[k] = new _ParseOp.UnsetOp();
- } else if (changes[k] instanceof _ParseOp.Op) {
- newOps[k] = changes[k];
- } else if (changes[k] && (0, _typeof2.default)(changes[k]) === 'object' && typeof changes[k].__op === 'string') {
- newOps[k] = (0, _ParseOp.opFromJSON)(changes[k]);
- } else if (k === 'objectId' || k === 'id') {
- if (typeof changes[k] === 'string') {
- this.id = changes[k];
- }
- } else if (k === 'ACL' && (0, _typeof2.default)(changes[k]) === 'object' && !(changes[k] instanceof _ParseACL.default)) {
- newOps[k] = new _ParseOp.SetOp(new _ParseACL.default(changes[k]));
- } else if (changes[k] instanceof _ParseRelation.default) {
- var relation = new _ParseRelation.default(this, k);
- relation.targetClassName = changes[k].targetClassName;
- newOps[k] = new _ParseOp.SetOp(relation);
- } else {
- newOps[k] = new _ParseOp.SetOp(changes[k]);
- }
- }
- var currentAttributes = this.attributes; // Calculate new values
- var newValues = {};
- for (var _attr9 in newOps) {
- if (newOps[_attr9] instanceof _ParseOp.RelationOp) {
- newValues[_attr9] = newOps[_attr9].applyTo(currentAttributes[_attr9], this, _attr9);
- } else if (!(newOps[_attr9] instanceof _ParseOp.UnsetOp)) {
- newValues[_attr9] = newOps[_attr9].applyTo(currentAttributes[_attr9]);
- }
- } // Validate changes
- if (!options.ignoreValidation) {
- var validation = this.validate(newValues);
- if (validation) {
- if (typeof options.error === 'function') {
- options.error(this, validation);
- }
- return false;
- }
- } // Consolidate Ops
- var pendingOps = this._getPendingOps();
- var last = pendingOps.length - 1;
- var stateController = _CoreManager.default.getObjectStateController();
- for (var _attr10 in newOps) {
- var nextOp = newOps[_attr10].mergeWith(pendingOps[last][_attr10]);
- stateController.setPendingOp(this._getStateIdentifier(), _attr10, nextOp);
- }
- return this;
- }
- /**
- * Remove an attribute from the model. This is a noop if the attribute doesn't
- * exist.
- *
- * @param {string} attr The string name of an attribute.
- * @param options
- * @returns {(ParseObject | boolean)}
- */
- }, {
- key: "unset",
- value: function (attr
- /*: string*/
- , options
- /*:: ?: { [opt: string]: mixed }*/
- )
- /*: ParseObject | boolean*/
- {
- options = options || {};
- options.unset = true;
- return this.set(attr, null, options);
- }
- /**
- * Atomically increments the value of the given attribute the next time the
- * object is saved. If no amount is specified, 1 is used by default.
- *
- * @param attr {String} The key.
- * @param amount {Number} The amount to increment by (optional).
- * @returns {(ParseObject|boolean)}
- */
- }, {
- key: "increment",
- value: function (attr
- /*: string*/
- , amount
- /*:: ?: number*/
- )
- /*: ParseObject | boolean*/
- {
- if (typeof amount === 'undefined') {
- amount = 1;
- }
- if (typeof amount !== 'number') {
- throw new Error('Cannot increment by a non-numeric amount.');
- }
- return this.set(attr, new _ParseOp.IncrementOp(amount));
- }
- /**
- * Atomically decrements the value of the given attribute the next time the
- * object is saved. If no amount is specified, 1 is used by default.
- *
- * @param attr {String} The key.
- * @param amount {Number} The amount to decrement by (optional).
- * @returns {(ParseObject | boolean)}
- */
- }, {
- key: "decrement",
- value: function (attr
- /*: string*/
- , amount
- /*:: ?: number*/
- )
- /*: ParseObject | boolean*/
- {
- if (typeof amount === 'undefined') {
- amount = 1;
- }
- if (typeof amount !== 'number') {
- throw new Error('Cannot decrement by a non-numeric amount.');
- }
- return this.set(attr, new _ParseOp.IncrementOp(amount * -1));
- }
- /**
- * Atomically add an object to the end of the array associated with a given
- * key.
- *
- * @param attr {String} The key.
- * @param item {} The item to add.
- * @returns {(ParseObject | boolean)}
- */
- }, {
- key: "add",
- value: function (attr
- /*: string*/
- , item
- /*: mixed*/
- )
- /*: ParseObject | boolean*/
- {
- return this.set(attr, new _ParseOp.AddOp([item]));
- }
- /**
- * Atomically add the objects to the end of the array associated with a given
- * key.
- *
- * @param attr {String} The key.
- * @param items {Object[]} The items to add.
- * @returns {(ParseObject | boolean)}
- */
- }, {
- key: "addAll",
- value: function (attr
- /*: string*/
- , items
- /*: Array<mixed>*/
- )
- /*: ParseObject | boolean*/
- {
- return this.set(attr, new _ParseOp.AddOp(items));
- }
- /**
- * Atomically add an object to the array associated with a given key, only
- * if it is not already present in the array. The position of the insert is
- * not guaranteed.
- *
- * @param attr {String} The key.
- * @param item {} The object to add.
- * @returns {(ParseObject | boolean)}
- */
- }, {
- key: "addUnique",
- value: function (attr
- /*: string*/
- , item
- /*: mixed*/
- )
- /*: ParseObject | boolean*/
- {
- return this.set(attr, new _ParseOp.AddUniqueOp([item]));
- }
- /**
- * Atomically add the objects to the array associated with a given key, only
- * if it is not already present in the array. The position of the insert is
- * not guaranteed.
- *
- * @param attr {String} The key.
- * @param items {Object[]} The objects to add.
- * @returns {(ParseObject | boolean)}
- */
- }, {
- key: "addAllUnique",
- value: function (attr
- /*: string*/
- , items
- /*: Array<mixed>*/
- )
- /*: ParseObject | boolean*/
- {
- return this.set(attr, new _ParseOp.AddUniqueOp(items));
- }
- /**
- * Atomically remove all instances of an object from the array associated
- * with a given key.
- *
- * @param attr {String} The key.
- * @param item {} The object to remove.
- * @returns {(ParseObject | boolean)}
- */
- }, {
- key: "remove",
- value: function (attr
- /*: string*/
- , item
- /*: mixed*/
- )
- /*: ParseObject | boolean*/
- {
- return this.set(attr, new _ParseOp.RemoveOp([item]));
- }
- /**
- * Atomically remove all instances of the objects from the array associated
- * with a given key.
- *
- * @param attr {String} The key.
- * @param items {Object[]} The object to remove.
- * @returns {(ParseObject | boolean)}
- */
- }, {
- key: "removeAll",
- value: function (attr
- /*: string*/
- , items
- /*: Array<mixed>*/
- )
- /*: ParseObject | boolean*/
- {
- return this.set(attr, new _ParseOp.RemoveOp(items));
- }
- /**
- * Returns an instance of a subclass of Parse.Op describing what kind of
- * modification has been performed on this field since the last time it was
- * saved. For example, after calling object.increment("x"), calling
- * object.op("x") would return an instance of Parse.Op.Increment.
- *
- * @param attr {String} The key.
- * @returns {Parse.Op} The operation, or undefined if none.
- */
- }, {
- key: "op",
- value: function (attr
- /*: string*/
- )
- /*: ?Op*/
- {
- var pending = this._getPendingOps();
- for (var i = pending.length; i--;) {
- if (pending[i][attr]) {
- return pending[i][attr];
- }
- }
- }
- /**
- * Creates a new model with identical attributes to this one.
- *
- * @returns {Parse.Object}
- */
- }, {
- key: "clone",
- value: function clone()
- /*: any*/
- {
- var clone = new this.constructor(this.className);
- var attributes = this.attributes;
- if (typeof this.constructor.readOnlyAttributes === 'function') {
- var readonly = this.constructor.readOnlyAttributes() || []; // Attributes are frozen, so we have to rebuild an object,
- // rather than delete readonly keys
- var copy = {};
- for (var a in attributes) {
- if ((0, _indexOf.default)(readonly).call(readonly, a) < 0) {
- copy[a] = attributes[a];
- }
- }
- attributes = copy;
- }
- if (clone.set) {
- clone.set(attributes);
- }
- return clone;
- }
- /**
- * Creates a new instance of this object. Not to be confused with clone()
- *
- * @returns {Parse.Object}
- */
- }, {
- key: "newInstance",
- value: function ()
- /*: any*/
- {
- var clone = new this.constructor(this.className);
- clone.id = this.id;
- if (singleInstance) {
- // Just return an object with the right id
- return clone;
- }
- var stateController = _CoreManager.default.getObjectStateController();
- if (stateController) {
- stateController.duplicateState(this._getStateIdentifier(), clone._getStateIdentifier());
- }
- return clone;
- }
- /**
- * Returns true if this object has never been saved to Parse.
- *
- * @returns {boolean}
- */
- }, {
- key: "isNew",
- value: function ()
- /*: boolean*/
- {
- return !this.id;
- }
- /**
- * Returns true if this object was created by the Parse server when the
- * object might have already been there (e.g. in the case of a Facebook
- * login)
- *
- * @returns {boolean}
- */
- }, {
- key: "existed",
- value: function ()
- /*: boolean*/
- {
- if (!this.id) {
- return false;
- }
- var stateController = _CoreManager.default.getObjectStateController();
- var state = stateController.getState(this._getStateIdentifier());
- if (state) {
- return state.existed;
- }
- return false;
- }
- /**
- * Returns true if this object exists on the Server
- *
- * @param {object} options
- * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * </ul>
- * @returns {Promise<boolean>} A boolean promise that is fulfilled if object exists.
- */
- }, {
- key: "exists",
- value: function () {
- var _exists = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options
- /*:: ?: RequestOptions*/
- ) {
- var query;
- return _regeneratorRuntime().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- if (this.id) {
- _context.next = 2;
- break;
- }
- return _context.abrupt("return", false);
- case 2:
- _context.prev = 2;
- query = new _ParseQuery.default(this.className);
- _context.next = 6;
- return query.get(this.id, options);
- case 6:
- return _context.abrupt("return", true);
- case 9:
- _context.prev = 9;
- _context.t0 = _context["catch"](2);
- if (!(_context.t0.code === _ParseError.default.OBJECT_NOT_FOUND)) {
- _context.next = 13;
- break;
- }
- return _context.abrupt("return", false);
- case 13:
- throw _context.t0;
- case 14:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this, [[2, 9]]);
- }));
- function exists(_x) {
- return _exists.apply(this, arguments);
- }
- return exists;
- }()
- /**
- * Checks if the model is currently in a valid state.
- *
- * @returns {boolean}
- */
- }, {
- key: "isValid",
- value: function isValid()
- /*: boolean*/
- {
- return !this.validate(this.attributes);
- }
- /**
- * You should not call this function directly unless you subclass
- * <code>Parse.Object</code>, in which case you can override this method
- * to provide additional validation on <code>set</code> and
- * <code>save</code>. Your implementation should return
- *
- * @param {object} attrs The current data to validate.
- * @returns {Parse.Error|boolean} False if the data is valid. An error object otherwise.
- * @see Parse.Object#set
- */
- }, {
- key: "validate",
- value: function validate(attrs
- /*: AttributeMap*/
- )
- /*: ParseError | boolean*/
- {
- if (attrs.hasOwnProperty('ACL') && !(attrs.ACL instanceof _ParseACL.default)) {
- return new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'ACL must be a Parse ACL.');
- }
- for (var _key in attrs) {
- if (!/^[A-Za-z][0-9A-Za-z_.]*$/.test(_key)) {
- return new _ParseError.default(_ParseError.default.INVALID_KEY_NAME);
- }
- }
- return false;
- }
- /**
- * Returns the ACL for this object.
- *
- * @returns {Parse.ACL} An instance of Parse.ACL.
- * @see Parse.Object#get
- */
- }, {
- key: "getACL",
- value: function getACL()
- /*: ?ParseACL*/
- {
- var acl = this.get('ACL');
- if (acl instanceof _ParseACL.default) {
- return acl;
- }
- return null;
- }
- /**
- * Sets the ACL to be used for this object.
- *
- * @param {Parse.ACL} acl An instance of Parse.ACL.
- * @param {object} options
- * @returns {(ParseObject | boolean)} Whether the set passed validation.
- * @see Parse.Object#set
- */
- }, {
- key: "setACL",
- value: function setACL(acl
- /*: ParseACL*/
- , options
- /*:: ?: mixed*/
- )
- /*: ParseObject | boolean*/
- {
- return this.set('ACL', acl, options);
- }
- /**
- * Clears any (or specific) changes to this object made since the last call to save()
- *
- * @param {string} [keys] - specify which fields to revert
- */
- }, {
- key: "revert",
- value: function revert()
- /*: void*/
- {
- var keysToRevert;
- for (var _len = arguments.length, keys = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
- keys[_key2] = arguments[_key2];
- }
- if (keys.length) {
- keysToRevert = [];
- var _iterator = _createForOfIteratorHelper(keys),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var _key3 = _step.value;
- if (typeof _key3 === 'string') {
- keysToRevert.push(_key3);
- } else {
- throw new Error('Parse.Object#revert expects either no, or a list of string, arguments.');
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- }
- this._clearPendingOps(keysToRevert);
- }
- /**
- * Clears all attributes on a model
- *
- * @returns {(ParseObject | boolean)}
- */
- }, {
- key: "clear",
- value: function clear()
- /*: ParseObject | boolean*/
- {
- var attributes = this.attributes;
- var erasable = {};
- var readonly = ['createdAt', 'updatedAt'];
- if (typeof this.constructor.readOnlyAttributes === 'function') {
- readonly = (0, _concat.default)(readonly).call(readonly, this.constructor.readOnlyAttributes());
- }
- for (var _attr11 in attributes) {
- if ((0, _indexOf.default)(readonly).call(readonly, _attr11) < 0) {
- erasable[_attr11] = true;
- }
- }
- return this.set(erasable, {
- unset: true
- });
- }
- /**
- * Fetch the model from the server. If the server's representation of the
- * model differs from its current attributes, they will be overriden.
- *
- * @param {object} options
- * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>include: The name(s) of the key(s) to include. Can be a string, an array of strings,
- * or an array of array of strings.
- * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
- * </ul>
- * @returns {Promise} A promise that is fulfilled when the fetch
- * completes.
- */
- }, {
- key: "fetch",
- value: function fetch(options
- /*: RequestOptions*/
- )
- /*: Promise*/
- {
- options = options || {};
- var fetchOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- fetchOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('sessionToken')) {
- fetchOptions.sessionToken = options.sessionToken;
- }
- if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
- fetchOptions.context = options.context;
- }
- if (options.hasOwnProperty('include')) {
- fetchOptions.include = [];
- if ((0, _isArray.default)(options.include)) {
- var _context2;
- (0, _forEach.default)(_context2 = options.include).call(_context2, function (key) {
- if ((0, _isArray.default)(key)) {
- var _context3;
- fetchOptions.include = (0, _concat.default)(_context3 = fetchOptions.include).call(_context3, key);
- } else {
- fetchOptions.include.push(key);
- }
- });
- } else {
- fetchOptions.include.push(options.include);
- }
- }
- var controller = _CoreManager.default.getObjectController();
- return controller.fetch(this, true, fetchOptions);
- }
- /**
- * Fetch the model from the server. If the server's representation of the
- * model differs from its current attributes, they will be overriden.
- *
- * Includes nested Parse.Objects for the provided key. You can use dot
- * notation to specify which fields in the included object are also fetched.
- *
- * @param {string | Array<string | Array<string>>} keys The name(s) of the key(s) to include.
- * @param {object} options
- * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * </ul>
- * @returns {Promise} A promise that is fulfilled when the fetch
- * completes.
- */
- }, {
- key: "fetchWithInclude",
- value: function fetchWithInclude(keys
- /*: String | Array<string | Array<string>>*/
- , options
- /*: RequestOptions*/
- )
- /*: Promise*/
- {
- options = options || {};
- options.include = keys;
- return this.fetch(options);
- }
- /**
- * Saves this object to the server at some unspecified time in the future,
- * even if Parse is currently inaccessible.
- *
- * Use this when you may not have a solid network connection, and don't need to know when the save completes.
- * If there is some problem with the object such that it can't be saved, it will be silently discarded.
- *
- * Objects saved with this method will be stored locally in an on-disk cache until they can be delivered to Parse.
- * They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection is
- * available. Objects saved this way will persist even after the app is closed, in which case they will be sent the
- * next time the app is opened.
- *
- * @param {object} [options]
- * Used to pass option parameters to method if arg1 and arg2 were both passed as strings.
- * Valid options are:
- * <ul>
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
- * <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
- * </ul>
- * @returns {Promise} A promise that is fulfilled when the save
- * completes.
- */
- }, {
- key: "saveEventually",
- value: function () {
- var _saveEventually = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options
- /*: SaveOptions*/
- ) {
- return _regeneratorRuntime().wrap(function _callee2$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- _context4.prev = 0;
- _context4.next = 3;
- return this.save(null, options);
- case 3:
- _context4.next = 11;
- break;
- case 5:
- _context4.prev = 5;
- _context4.t0 = _context4["catch"](0);
- if (!(_context4.t0.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
- _context4.next = 11;
- break;
- }
- _context4.next = 10;
- return _EventuallyQueue.default.save(this, options);
- case 10:
- _EventuallyQueue.default.poll();
- case 11:
- return _context4.abrupt("return", this);
- case 12:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee2, this, [[0, 5]]);
- }));
- function saveEventually(_x2) {
- return _saveEventually.apply(this, arguments);
- }
- return saveEventually;
- }()
- /**
- * Set a hash of model attributes, and save the model to the server.
- * updatedAt will be updated when the request returns.
- * You can either call it as:<pre>
- * object.save();</pre>
- * or<pre>
- * object.save(attrs);</pre>
- * or<pre>
- * object.save(null, options);</pre>
- * or<pre>
- * object.save(attrs, options);</pre>
- * or<pre>
- * object.save(key, value);</pre>
- * or<pre>
- * object.save(key, value, options);</pre>
- *
- * Example 1: <pre>
- * gameTurn.save({
- * player: "Jake Cutter",
- * diceRoll: 2
- * }).then(function(gameTurnAgain) {
- * // The save was successful.
- * }, function(error) {
- * // The save failed. Error is an instance of Parse.Error.
- * });</pre>
- *
- * Example 2: <pre>
- * gameTurn.save("player", "Jake Cutter");</pre>
- *
- * @param {string | object | null} [arg1]
- * Valid options are:<ul>
- * <li>`Object` - Key/value pairs to update on the object.</li>
- * <li>`String` Key - Key of attribute to update (requires arg2 to also be string)</li>
- * <li>`null` - Passing null for arg1 allows you to save the object with options passed in arg2.</li>
- * </ul>
- * @param {string | object} [arg2]
- * <ul>
- * <li>`String` Value - If arg1 was passed as a key, arg2 is the value that should be set on that key.</li>
- * <li>`Object` Options - Valid options are:
- * <ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
- * <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
- * </ul>
- * </li>
- * </ul>
- * @param {object} [arg3]
- * Used to pass option parameters to method if arg1 and arg2 were both passed as strings.
- * Valid options are:
- * <ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>cascadeSave: If `false`, nested objects will not be saved (default is `true`).
- * <li>context: A dictionary that is accessible in Cloud Code `beforeSave` and `afterSave` triggers.
- * </ul>
- * @returns {Promise} A promise that is fulfilled when the save
- * completes.
- */
- }, {
- key: "save",
- value: function save(arg1
- /*: ?string | { [attr: string]: mixed }*/
- , arg2
- /*: SaveOptions | mixed*/
- , arg3
- /*:: ?: SaveOptions*/
- )
- /*: Promise*/
- {
- var _this = this;
- var attrs;
- var options;
- if ((0, _typeof2.default)(arg1) === 'object' || typeof arg1 === 'undefined') {
- attrs = arg1;
- if ((0, _typeof2.default)(arg2) === 'object') {
- options = arg2;
- }
- } else {
- attrs = {};
- attrs[arg1] = arg2;
- options = arg3;
- }
- if (attrs) {
- var validation = this.validate(attrs);
- if (validation) {
- return _promise.default.reject(validation);
- }
- this.set(attrs, options);
- }
- options = options || {};
- var saveOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- saveOptions.useMasterKey = !!options.useMasterKey;
- }
- if (options.hasOwnProperty('sessionToken') && typeof options.sessionToken === 'string') {
- saveOptions.sessionToken = options.sessionToken;
- }
- if (options.hasOwnProperty('installationId') && typeof options.installationId === 'string') {
- saveOptions.installationId = options.installationId;
- }
- if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
- saveOptions.context = options.context;
- }
- var controller = _CoreManager.default.getObjectController();
- var unsaved = options.cascadeSave !== false ? (0, _unsavedChildren.default)(this) : null;
- return controller.save(unsaved, saveOptions).then(function () {
- return controller.save(_this, saveOptions);
- });
- }
- /**
- * Deletes this object from the server at some unspecified time in the future,
- * even if Parse is currently inaccessible.
- *
- * Use this when you may not have a solid network connection,
- * and don't need to know when the delete completes. If there is some problem with the object
- * such that it can't be deleted, the request will be silently discarded.
- *
- * Delete instructions made with this method will be stored locally in an on-disk cache until they can be transmitted
- * to Parse. They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection
- * is available. Delete requests will persist even after the app is closed, in which case they will be sent the
- * next time the app is opened.
- *
- * @param {object} [options]
- * Valid options are:<ul>
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
- * </ul>
- * @returns {Promise} A promise that is fulfilled when the destroy
- * completes.
- */
- }, {
- key: "destroyEventually",
- value: function () {
- var _destroyEventually = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options
- /*: RequestOptions*/
- ) {
- return _regeneratorRuntime().wrap(function _callee3$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- _context5.prev = 0;
- _context5.next = 3;
- return this.destroy(options);
- case 3:
- _context5.next = 11;
- break;
- case 5:
- _context5.prev = 5;
- _context5.t0 = _context5["catch"](0);
- if (!(_context5.t0.message === 'XMLHttpRequest failed: "Unable to connect to the Parse API"')) {
- _context5.next = 11;
- break;
- }
- _context5.next = 10;
- return _EventuallyQueue.default.destroy(this, options);
- case 10:
- _EventuallyQueue.default.poll();
- case 11:
- return _context5.abrupt("return", this);
- case 12:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee3, this, [[0, 5]]);
- }));
- function destroyEventually(_x3) {
- return _destroyEventually.apply(this, arguments);
- }
- return destroyEventually;
- }()
- /**
- * Destroy this model on the server if it was already persisted.
- *
- * @param {object} options
- * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>context: A dictionary that is accessible in Cloud Code `beforeDelete` and `afterDelete` triggers.
- * </ul>
- * @returns {Promise} A promise that is fulfilled when the destroy
- * completes.
- */
- }, {
- key: "destroy",
- value: function destroy(options
- /*: RequestOptions*/
- )
- /*: Promise*/
- {
- options = options || {};
- var destroyOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- destroyOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('sessionToken')) {
- destroyOptions.sessionToken = options.sessionToken;
- }
- if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
- destroyOptions.context = options.context;
- }
- if (!this.id) {
- return _promise.default.resolve();
- }
- return _CoreManager.default.getObjectController().destroy(this, destroyOptions);
- }
- /**
- * Asynchronously stores the object and every object it points to in the local datastore,
- * recursively, using a default pin name: _default.
- *
- * If those other objects have not been fetched from Parse, they will not be stored.
- * However, if they have changed data, all the changes will be retained.
- *
- * <pre>
- * await object.pin();
- * </pre>
- *
- * To retrieve object:
- * <code>query.fromLocalDatastore()</code> or <code>query.fromPin()</code>
- *
- * @returns {Promise} A promise that is fulfilled when the pin completes.
- */
- }, {
- key: "pin",
- value: function pin()
- /*: Promise<void>*/
- {
- return ParseObject.pinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, [this]);
- }
- /**
- * Asynchronously removes the object and every object it points to in the local datastore,
- * recursively, using a default pin name: _default.
- *
- * <pre>
- * await object.unPin();
- * </pre>
- *
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
- */
- }, {
- key: "unPin",
- value: function unPin()
- /*: Promise<void>*/
- {
- return ParseObject.unPinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, [this]);
- }
- /**
- * Asynchronously returns if the object is pinned
- *
- * <pre>
- * const isPinned = await object.isPinned();
- * </pre>
- *
- * @returns {Promise<boolean>} A boolean promise that is fulfilled if object is pinned.
- */
- }, {
- key: "isPinned",
- value: function () {
- var _isPinned = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
- var localDatastore, objectKey, pin;
- return _regeneratorRuntime().wrap(function _callee4$(_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- localDatastore = _CoreManager.default.getLocalDatastore();
- if (localDatastore.isEnabled) {
- _context6.next = 3;
- break;
- }
- return _context6.abrupt("return", _promise.default.reject('Parse.enableLocalDatastore() must be called first'));
- case 3:
- objectKey = localDatastore.getKeyForObject(this);
- _context6.next = 6;
- return localDatastore.fromPinWithName(objectKey);
- case 6:
- pin = _context6.sent;
- return _context6.abrupt("return", pin.length > 0);
- case 8:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee4, this);
- }));
- function isPinned() {
- return _isPinned.apply(this, arguments);
- }
- return isPinned;
- }()
- /**
- * Asynchronously stores the objects and every object they point to in the local datastore, recursively.
- *
- * If those other objects have not been fetched from Parse, they will not be stored.
- * However, if they have changed data, all the changes will be retained.
- *
- * <pre>
- * await object.pinWithName(name);
- * </pre>
- *
- * To retrieve object:
- * <code>query.fromLocalDatastore()</code> or <code>query.fromPinWithName(name)</code>
- *
- * @param {string} name Name of Pin.
- * @returns {Promise} A promise that is fulfilled when the pin completes.
- */
- }, {
- key: "pinWithName",
- value: function pinWithName(name
- /*: string*/
- )
- /*: Promise<void>*/
- {
- return ParseObject.pinAllWithName(name, [this]);
- }
- /**
- * Asynchronously removes the object and every object it points to in the local datastore, recursively.
- *
- * <pre>
- * await object.unPinWithName(name);
- * </pre>
- *
- * @param {string} name Name of Pin.
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
- */
- }, {
- key: "unPinWithName",
- value: function unPinWithName(name
- /*: string*/
- )
- /*: Promise<void>*/
- {
- return ParseObject.unPinAllWithName(name, [this]);
- }
- /**
- * Asynchronously loads data from the local datastore into this object.
- *
- * <pre>
- * await object.fetchFromLocalDatastore();
- * </pre>
- *
- * You can create an unfetched pointer with <code>Parse.Object.createWithoutData()</code>
- * and then call <code>fetchFromLocalDatastore()</code> on it.
- *
- * @returns {Promise} A promise that is fulfilled when the fetch completes.
- */
- }, {
- key: "fetchFromLocalDatastore",
- value: function () {
- var _fetchFromLocalDatastore = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
- var localDatastore, objectKey, pinned, result;
- return _regeneratorRuntime().wrap(function _callee5$(_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- localDatastore = _CoreManager.default.getLocalDatastore();
- if (localDatastore.isEnabled) {
- _context7.next = 3;
- break;
- }
- throw new Error('Parse.enableLocalDatastore() must be called first');
- case 3:
- objectKey = localDatastore.getKeyForObject(this);
- _context7.next = 6;
- return localDatastore._serializeObject(objectKey);
- case 6:
- pinned = _context7.sent;
- if (pinned) {
- _context7.next = 9;
- break;
- }
- throw new Error('Cannot fetch an unsaved ParseObject');
- case 9:
- result = ParseObject.fromJSON(pinned);
- this._finishFetch(result.toJSON());
- return _context7.abrupt("return", this);
- case 12:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee5, this);
- }));
- function fetchFromLocalDatastore() {
- return _fetchFromLocalDatastore.apply(this, arguments);
- }
- return fetchFromLocalDatastore;
- }()
- /** Static methods **/
- }], [{
- key: "_getClassMap",
- value: function _getClassMap() {
- return classMap;
- }
- }, {
- key: "_clearAllState",
- value: function _clearAllState() {
- var stateController = _CoreManager.default.getObjectStateController();
- stateController.clearAllState();
- }
- /**
- * Fetches the given list of Parse.Object.
- * If any error is encountered, stops and calls the error handler.
- *
- * <pre>
- * Parse.Object.fetchAll([object1, object2, ...])
- * .then((list) => {
- * // All the objects were fetched.
- * }, (error) => {
- * // An error occurred while fetching one of the objects.
- * });
- * </pre>
- *
- * @param {Array} list A list of <code>Parse.Object</code>.
- * @param {object} options
- * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>include: The name(s) of the key(s) to include. Can be a string, an array of strings,
- * or an array of array of strings.
- * </ul>
- * @static
- * @returns {Parse.Object[]}
- */
- }, {
- key: "fetchAll",
- value: function fetchAll(list
- /*: Array<ParseObject>*/
- ) {
- var options
- /*: RequestOptions*/
- = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var queryOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- queryOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('sessionToken')) {
- queryOptions.sessionToken = options.sessionToken;
- }
- if (options.hasOwnProperty('include')) {
- queryOptions.include = ParseObject.handleIncludeOptions(options);
- }
- return _CoreManager.default.getObjectController().fetch(list, true, queryOptions);
- }
- /**
- * Fetches the given list of Parse.Object.
- *
- * Includes nested Parse.Objects for the provided key. You can use dot
- * notation to specify which fields in the included object are also fetched.
- *
- * If any error is encountered, stops and calls the error handler.
- *
- * <pre>
- * Parse.Object.fetchAllWithInclude([object1, object2, ...], [pointer1, pointer2, ...])
- * .then((list) => {
- * // All the objects were fetched.
- * }, (error) => {
- * // An error occurred while fetching one of the objects.
- * });
- * </pre>
- *
- * @param {Array} list A list of <code>Parse.Object</code>.
- * @param {string | Array<string | Array<string>>} keys The name(s) of the key(s) to include.
- * @param {object} options
- * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * </ul>
- * @static
- * @returns {Parse.Object[]}
- */
- }, {
- key: "fetchAllWithInclude",
- value: function fetchAllWithInclude(list
- /*: Array<ParseObject>*/
- , keys
- /*: String | Array<string | Array<string>>*/
- , options
- /*: RequestOptions*/
- ) {
- options = options || {};
- options.include = keys;
- return ParseObject.fetchAll(list, options);
- }
- /**
- * Fetches the given list of Parse.Object if needed.
- * If any error is encountered, stops and calls the error handler.
- *
- * Includes nested Parse.Objects for the provided key. You can use dot
- * notation to specify which fields in the included object are also fetched.
- *
- * If any error is encountered, stops and calls the error handler.
- *
- * <pre>
- * Parse.Object.fetchAllIfNeededWithInclude([object1, object2, ...], [pointer1, pointer2, ...])
- * .then((list) => {
- * // All the objects were fetched.
- * }, (error) => {
- * // An error occurred while fetching one of the objects.
- * });
- * </pre>
- *
- * @param {Array} list A list of <code>Parse.Object</code>.
- * @param {string | Array<string | Array<string>>} keys The name(s) of the key(s) to include.
- * @param {object} options
- * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * </ul>
- * @static
- * @returns {Parse.Object[]}
- */
- }, {
- key: "fetchAllIfNeededWithInclude",
- value: function fetchAllIfNeededWithInclude(list
- /*: Array<ParseObject>*/
- , keys
- /*: String | Array<string | Array<string>>*/
- , options
- /*: RequestOptions*/
- ) {
- options = options || {};
- options.include = keys;
- return ParseObject.fetchAllIfNeeded(list, options);
- }
- /**
- * Fetches the given list of Parse.Object if needed.
- * If any error is encountered, stops and calls the error handler.
- *
- * <pre>
- * Parse.Object.fetchAllIfNeeded([object1, ...])
- * .then((list) => {
- * // Objects were fetched and updated.
- * }, (error) => {
- * // An error occurred while fetching one of the objects.
- * });
- * </pre>
- *
- * @param {Array} list A list of <code>Parse.Object</code>.
- * @param {object} options
- * @static
- * @returns {Parse.Object[]}
- */
- }, {
- key: "fetchAllIfNeeded",
- value: function fetchAllIfNeeded(list
- /*: Array<ParseObject>*/
- , options) {
- options = options || {};
- var queryOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- queryOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('sessionToken')) {
- queryOptions.sessionToken = options.sessionToken;
- }
- if (options.hasOwnProperty('include')) {
- queryOptions.include = ParseObject.handleIncludeOptions(options);
- }
- return _CoreManager.default.getObjectController().fetch(list, false, queryOptions);
- }
- }, {
- key: "handleIncludeOptions",
- value: function handleIncludeOptions(options) {
- var include = [];
- if ((0, _isArray.default)(options.include)) {
- var _context8;
- (0, _forEach.default)(_context8 = options.include).call(_context8, function (key) {
- if ((0, _isArray.default)(key)) {
- include = (0, _concat.default)(include).call(include, key);
- } else {
- include.push(key);
- }
- });
- } else {
- include.push(options.include);
- }
- return include;
- }
- /**
- * Destroy the given list of models on the server if it was already persisted.
- *
- * <p>Unlike saveAll, if an error occurs while deleting an individual model,
- * this method will continue trying to delete the rest of the models if
- * possible, except in the case of a fatal error like a connection error.
- *
- * <p>In particular, the Parse.Error object returned in the case of error may
- * be one of two types:
- *
- * <ul>
- * <li>A Parse.Error.AGGREGATE_ERROR. This object's "errors" property is an
- * array of other Parse.Error objects. Each error object in this array
- * has an "object" property that references the object that could not be
- * deleted (for instance, because that object could not be found).</li>
- * <li>A non-aggregate Parse.Error. This indicates a serious error that
- * caused the delete operation to be aborted partway through (for
- * instance, a connection failure in the middle of the delete).</li>
- * </ul>
- *
- * <pre>
- * Parse.Object.destroyAll([object1, object2, ...])
- * .then((list) => {
- * // All the objects were deleted.
- * }, (error) => {
- * // An error occurred while deleting one or more of the objects.
- * // If this is an aggregate error, then we can inspect each error
- * // object individually to determine the reason why a particular
- * // object was not deleted.
- * if (error.code === Parse.Error.AGGREGATE_ERROR) {
- * for (var i = 0; i < error.errors.length; i++) {
- * console.log("Couldn't delete " + error.errors[i].object.id +
- * "due to " + error.errors[i].message);
- * }
- * } else {
- * console.log("Delete aborted because of " + error.message);
- * }
- * });
- * </pre>
- *
- * @param {Array} list A list of <code>Parse.Object</code>.
- * @param {object} options
- * @static
- * @returns {Promise} A promise that is fulfilled when the destroyAll
- * completes.
- */
- }, {
- key: "destroyAll",
- value: function destroyAll(list
- /*: Array<ParseObject>*/
- ) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var destroyOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- destroyOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('sessionToken')) {
- destroyOptions.sessionToken = options.sessionToken;
- }
- if (options.hasOwnProperty('batchSize') && typeof options.batchSize === 'number') {
- destroyOptions.batchSize = options.batchSize;
- }
- if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
- destroyOptions.context = options.context;
- }
- return _CoreManager.default.getObjectController().destroy(list, destroyOptions);
- }
- /**
- * Saves the given list of Parse.Object.
- * If any error is encountered, stops and calls the error handler.
- *
- * <pre>
- * Parse.Object.saveAll([object1, object2, ...])
- * .then((list) => {
- * // All the objects were saved.
- * }, (error) => {
- * // An error occurred while saving one of the objects.
- * });
- * </pre>
- *
- * @param {Array} list A list of <code>Parse.Object</code>.
- * @param {object} options
- * @static
- * @returns {Parse.Object[]}
- */
- }, {
- key: "saveAll",
- value: function saveAll(list
- /*: Array<ParseObject>*/
- ) {
- var options
- /*: RequestOptions*/
- = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var saveOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- saveOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('sessionToken')) {
- saveOptions.sessionToken = options.sessionToken;
- }
- if (options.hasOwnProperty('batchSize') && typeof options.batchSize === 'number') {
- saveOptions.batchSize = options.batchSize;
- }
- if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
- saveOptions.context = options.context;
- }
- return _CoreManager.default.getObjectController().save(list, saveOptions);
- }
- /**
- * Creates a reference to a subclass of Parse.Object with the given id. This
- * does not exist on Parse.Object, only on subclasses.
- *
- * <p>A shortcut for: <pre>
- * var Foo = Parse.Object.extend("Foo");
- * var pointerToFoo = new Foo();
- * pointerToFoo.id = "myObjectId";
- * </pre>
- *
- * @param {string} id The ID of the object to create a reference to.
- * @static
- * @returns {Parse.Object} A Parse.Object reference.
- */
- }, {
- key: "createWithoutData",
- value: function createWithoutData(id
- /*: string*/
- ) {
- var obj = new this();
- obj.id = id;
- return obj;
- }
- /**
- * Creates a new instance of a Parse Object from a JSON representation.
- *
- * @param {object} json The JSON map of the Object's data
- * @param {boolean} override In single instance mode, all old server data
- * is overwritten if this is set to true
- * @param {boolean} dirty Whether the Parse.Object should set JSON keys to dirty
- * @static
- * @returns {Parse.Object} A Parse.Object reference
- */
- }, {
- key: "fromJSON",
- value: function fromJSON(json
- /*: any*/
- , override
- /*:: ?: boolean*/
- , dirty
- /*:: ?: boolean*/
- ) {
- if (!json.className) {
- throw new Error('Cannot create an object without a className');
- }
- var constructor = classMap[json.className];
- var o = constructor ? new constructor(json.className) : new ParseObject(json.className);
- var otherAttributes = {};
- for (var _attr12 in json) {
- if (_attr12 !== 'className' && _attr12 !== '__type') {
- otherAttributes[_attr12] = json[_attr12];
- if (dirty) {
- o.set(_attr12, json[_attr12]);
- }
- }
- }
- if (override) {
- // id needs to be set before clearServerData can work
- if (otherAttributes.objectId) {
- o.id = otherAttributes.objectId;
- }
- var preserved = null;
- if (typeof o._preserveFieldsOnFetch === 'function') {
- preserved = o._preserveFieldsOnFetch();
- }
- o._clearServerData();
- if (preserved) {
- o._finishFetch(preserved);
- }
- }
- o._finishFetch(otherAttributes);
- if (json.objectId) {
- o._setExisted(true);
- }
- return o;
- }
- /**
- * Registers a subclass of Parse.Object with a specific class name.
- * When objects of that class are retrieved from a query, they will be
- * instantiated with this subclass.
- * This is only necessary when using ES6 subclassing.
- *
- * @param {string} className The class name of the subclass
- * @param {Function} constructor The subclass
- */
- }, {
- key: "registerSubclass",
- value: function registerSubclass(className
- /*: string*/
- , constructor
- /*: any*/
- ) {
- if (typeof className !== 'string') {
- throw new TypeError('The first argument must be a valid class name.');
- }
- if (typeof constructor === 'undefined') {
- throw new TypeError('You must supply a subclass constructor.');
- }
- if (typeof constructor !== 'function') {
- throw new TypeError('You must register the subclass constructor. ' + 'Did you attempt to register an instance of the subclass?');
- }
- classMap[className] = constructor;
- if (!constructor.className) {
- constructor.className = className;
- }
- }
- /**
- * Unegisters a subclass of Parse.Object with a specific class name.
- *
- * @param {string} className The class name of the subclass
- */
- }, {
- key: "unregisterSubclass",
- value: function unregisterSubclass(className
- /*: string*/
- ) {
- if (typeof className !== 'string') {
- throw new TypeError('The first argument must be a valid class name.');
- }
- delete classMap[className];
- }
- /**
- * Creates a new subclass of Parse.Object for the given Parse class name.
- *
- * <p>Every extension of a Parse class will inherit from the most recent
- * previous extension of that class. When a Parse.Object is automatically
- * created by parsing JSON, it will use the most recent extension of that
- * class.</p>
- *
- * <p>You should call either:<pre>
- * var MyClass = Parse.Object.extend("MyClass", {
- * <i>Instance methods</i>,
- * initialize: function(attrs, options) {
- * this.someInstanceProperty = [],
- * <i>Other instance properties</i>
- * }
- * }, {
- * <i>Class properties</i>
- * });</pre>
- * or, for Backbone compatibility:<pre>
- * var MyClass = Parse.Object.extend({
- * className: "MyClass",
- * <i>Instance methods</i>,
- * initialize: function(attrs, options) {
- * this.someInstanceProperty = [],
- * <i>Other instance properties</i>
- * }
- * }, {
- * <i>Class properties</i>
- * });</pre></p>
- *
- * @param {string} className The name of the Parse class backing this model.
- * @param {object} protoProps Instance properties to add to instances of the
- * class returned from this method.
- * @param {object} classProps Class properties to add the class returned from
- * this method.
- * @returns {Parse.Object} A new subclass of Parse.Object.
- */
- }, {
- key: "extend",
- value: function extend(className
- /*: any*/
- , protoProps
- /*: any*/
- , classProps
- /*: any*/
- ) {
- if (typeof className !== 'string') {
- if (className && typeof className.className === 'string') {
- return ParseObject.extend(className.className, className, protoProps);
- } else {
- throw new Error("Parse.Object.extend's first argument should be the className.");
- }
- }
- var adjustedClassName = className;
- if (adjustedClassName === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
- adjustedClassName = '_User';
- }
- var parentProto = ParseObject.prototype;
- if (this.hasOwnProperty('__super__') && this.__super__) {
- parentProto = this.prototype;
- } else if (classMap[adjustedClassName]) {
- parentProto = classMap[adjustedClassName].prototype;
- }
- var ParseObjectSubclass = function ParseObjectSubclass(attributes, options) {
- this.className = adjustedClassName;
- this._objCount = objectCount++; // Enable legacy initializers
- if (typeof this.initialize === 'function') {
- this.initialize.apply(this, arguments);
- }
- if (attributes && (0, _typeof2.default)(attributes) === 'object') {
- if (!this.set(attributes || {}, options)) {
- throw new Error("Can't create an invalid Parse Object");
- }
- }
- };
- ParseObjectSubclass.className = adjustedClassName;
- ParseObjectSubclass.__super__ = parentProto;
- ParseObjectSubclass.prototype = (0, _create.default)(parentProto, {
- constructor: {
- value: ParseObjectSubclass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (protoProps) {
- for (var prop in protoProps) {
- if (prop !== 'className') {
- (0, _defineProperty2.default)(ParseObjectSubclass.prototype, prop, {
- value: protoProps[prop],
- enumerable: false,
- writable: true,
- configurable: true
- });
- }
- }
- }
- if (classProps) {
- for (var _prop in classProps) {
- if (_prop !== 'className') {
- (0, _defineProperty2.default)(ParseObjectSubclass, _prop, {
- value: classProps[_prop],
- enumerable: false,
- writable: true,
- configurable: true
- });
- }
- }
- }
- ParseObjectSubclass.extend = function (name, protoProps, classProps) {
- if (typeof name === 'string') {
- return ParseObject.extend.call(ParseObjectSubclass, name, protoProps, classProps);
- }
- return ParseObject.extend.call(ParseObjectSubclass, adjustedClassName, name, protoProps);
- };
- ParseObjectSubclass.createWithoutData = ParseObject.createWithoutData;
- classMap[adjustedClassName] = ParseObjectSubclass;
- return ParseObjectSubclass;
- }
- /**
- * Enable single instance objects, where any local objects with the same Id
- * share the same attributes, and stay synchronized with each other.
- * This is disabled by default in server environments, since it can lead to
- * security issues.
- *
- * @static
- */
- }, {
- key: "enableSingleInstance",
- value: function enableSingleInstance() {
- singleInstance = true;
- _CoreManager.default.setObjectStateController(SingleInstanceStateController);
- }
- /**
- * Disable single instance objects, where any local objects with the same Id
- * share the same attributes, and stay synchronized with each other.
- * When disabled, you can have two instances of the same object in memory
- * without them sharing attributes.
- *
- * @static
- */
- }, {
- key: "disableSingleInstance",
- value: function disableSingleInstance() {
- singleInstance = false;
- _CoreManager.default.setObjectStateController(UniqueInstanceStateController);
- }
- /**
- * Asynchronously stores the objects and every object they point to in the local datastore,
- * recursively, using a default pin name: _default.
- *
- * If those other objects have not been fetched from Parse, they will not be stored.
- * However, if they have changed data, all the changes will be retained.
- *
- * <pre>
- * await Parse.Object.pinAll([...]);
- * </pre>
- *
- * To retrieve object:
- * <code>query.fromLocalDatastore()</code> or <code>query.fromPin()</code>
- *
- * @param {Array} objects A list of <code>Parse.Object</code>.
- * @returns {Promise} A promise that is fulfilled when the pin completes.
- * @static
- */
- }, {
- key: "pinAll",
- value: function pinAll(objects
- /*: Array<ParseObject>*/
- )
- /*: Promise<void>*/
- {
- var localDatastore = _CoreManager.default.getLocalDatastore();
- if (!localDatastore.isEnabled) {
- return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
- }
- return ParseObject.pinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, objects);
- }
- /**
- * Asynchronously stores the objects and every object they point to in the local datastore, recursively.
- *
- * If those other objects have not been fetched from Parse, they will not be stored.
- * However, if they have changed data, all the changes will be retained.
- *
- * <pre>
- * await Parse.Object.pinAllWithName(name, [obj1, obj2, ...]);
- * </pre>
- *
- * To retrieve object:
- * <code>query.fromLocalDatastore()</code> or <code>query.fromPinWithName(name)</code>
- *
- * @param {string} name Name of Pin.
- * @param {Array} objects A list of <code>Parse.Object</code>.
- * @returns {Promise} A promise that is fulfilled when the pin completes.
- * @static
- */
- }, {
- key: "pinAllWithName",
- value: function pinAllWithName(name
- /*: string*/
- , objects
- /*: Array<ParseObject>*/
- )
- /*: Promise<void>*/
- {
- var localDatastore = _CoreManager.default.getLocalDatastore();
- if (!localDatastore.isEnabled) {
- return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
- }
- return localDatastore._handlePinAllWithName(name, objects);
- }
- /**
- * Asynchronously removes the objects and every object they point to in the local datastore,
- * recursively, using a default pin name: _default.
- *
- * <pre>
- * await Parse.Object.unPinAll([...]);
- * </pre>
- *
- * @param {Array} objects A list of <code>Parse.Object</code>.
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
- * @static
- */
- }, {
- key: "unPinAll",
- value: function unPinAll(objects
- /*: Array<ParseObject>*/
- )
- /*: Promise<void>*/
- {
- var localDatastore = _CoreManager.default.getLocalDatastore();
- if (!localDatastore.isEnabled) {
- return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
- }
- return ParseObject.unPinAllWithName(_LocalDatastoreUtils.DEFAULT_PIN, objects);
- }
- /**
- * Asynchronously removes the objects and every object they point to in the local datastore, recursively.
- *
- * <pre>
- * await Parse.Object.unPinAllWithName(name, [obj1, obj2, ...]);
- * </pre>
- *
- * @param {string} name Name of Pin.
- * @param {Array} objects A list of <code>Parse.Object</code>.
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
- * @static
- */
- }, {
- key: "unPinAllWithName",
- value: function unPinAllWithName(name
- /*: string*/
- , objects
- /*: Array<ParseObject>*/
- )
- /*: Promise<void>*/
- {
- var localDatastore = _CoreManager.default.getLocalDatastore();
- if (!localDatastore.isEnabled) {
- return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
- }
- return localDatastore._handleUnPinAllWithName(name, objects);
- }
- /**
- * Asynchronously removes all objects in the local datastore using a default pin name: _default.
- *
- * <pre>
- * await Parse.Object.unPinAllObjects();
- * </pre>
- *
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
- * @static
- */
- }, {
- key: "unPinAllObjects",
- value: function unPinAllObjects()
- /*: Promise<void>*/
- {
- var localDatastore = _CoreManager.default.getLocalDatastore();
- if (!localDatastore.isEnabled) {
- return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
- }
- return localDatastore.unPinWithName(_LocalDatastoreUtils.DEFAULT_PIN);
- }
- /**
- * Asynchronously removes all objects with the specified pin name.
- * Deletes the pin name also.
- *
- * <pre>
- * await Parse.Object.unPinAllObjectsWithName(name);
- * </pre>
- *
- * @param {string} name Name of Pin.
- * @returns {Promise} A promise that is fulfilled when the unPin completes.
- * @static
- */
- }, {
- key: "unPinAllObjectsWithName",
- value: function unPinAllObjectsWithName(name
- /*: string*/
- )
- /*: Promise<void>*/
- {
- var localDatastore = _CoreManager.default.getLocalDatastore();
- if (!localDatastore.isEnabled) {
- return _promise.default.reject('Parse.enableLocalDatastore() must be called first');
- }
- return localDatastore.unPinWithName(_LocalDatastoreUtils.PIN_PREFIX + name);
- }
- }]);
- return ParseObject;
- }();
- var DefaultController = {
- fetch: function fetch(target
- /*: ParseObject | Array<ParseObject>*/
- , forceFetch
- /*: boolean*/
- , options
- /*: RequestOptions*/
- )
- /*: Promise<Array<void> | ParseObject>*/
- {
- var localDatastore = _CoreManager.default.getLocalDatastore();
- if ((0, _isArray.default)(target)) {
- if (target.length < 1) {
- return _promise.default.resolve([]);
- }
- var objs = [];
- var ids = [];
- var className = null;
- var results = [];
- var error = null;
- (0, _forEach.default)(target).call(target, function (el) {
- if (error) {
- return;
- }
- if (!className) {
- className = el.className;
- }
- if (className !== el.className) {
- error = new _ParseError.default(_ParseError.default.INVALID_CLASS_NAME, 'All objects should be of the same class');
- }
- if (!el.id) {
- error = new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'All objects must have an ID');
- }
- if (forceFetch || !el.isDataAvailable()) {
- ids.push(el.id);
- objs.push(el);
- }
- results.push(el);
- });
- if (error) {
- return _promise.default.reject(error);
- }
- var query = new _ParseQuery.default(className);
- query.containedIn('objectId', ids);
- if (options && options.include) {
- query.include(options.include);
- }
- query._limit = ids.length;
- return (0, _find.default)(query).call(query, options).then( /*#__PURE__*/function () {
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(objects) {
- var idMap, i, obj, _i, _obj, id, _iterator2, _step2, object;
- return _regeneratorRuntime().wrap(function _callee6$(_context9) {
- while (1) {
- switch (_context9.prev = _context9.next) {
- case 0:
- idMap = {};
- (0, _forEach.default)(objects).call(objects, function (o) {
- idMap[o.id] = o;
- });
- i = 0;
- case 3:
- if (!(i < objs.length)) {
- _context9.next = 11;
- break;
- }
- obj = objs[i];
- if (!(!obj || !obj.id || !idMap[obj.id])) {
- _context9.next = 8;
- break;
- }
- if (!forceFetch) {
- _context9.next = 8;
- break;
- }
- return _context9.abrupt("return", _promise.default.reject(new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'All objects must exist on the server.')));
- case 8:
- i++;
- _context9.next = 3;
- break;
- case 11:
- if (!singleInstance) {
- // If single instance objects are disabled, we need to replace the
- for (_i = 0; _i < results.length; _i++) {
- _obj = results[_i];
- if (_obj && _obj.id && idMap[_obj.id]) {
- id = _obj.id;
- _obj._finishFetch(idMap[id].toJSON());
- results[_i] = idMap[id];
- }
- }
- }
- _iterator2 = _createForOfIteratorHelper(results);
- _context9.prev = 13;
- _iterator2.s();
- case 15:
- if ((_step2 = _iterator2.n()).done) {
- _context9.next = 21;
- break;
- }
- object = _step2.value;
- _context9.next = 19;
- return localDatastore._updateObjectIfPinned(object);
- case 19:
- _context9.next = 15;
- break;
- case 21:
- _context9.next = 26;
- break;
- case 23:
- _context9.prev = 23;
- _context9.t0 = _context9["catch"](13);
- _iterator2.e(_context9.t0);
- case 26:
- _context9.prev = 26;
- _iterator2.f();
- return _context9.finish(26);
- case 29:
- return _context9.abrupt("return", _promise.default.resolve(results));
- case 30:
- case "end":
- return _context9.stop();
- }
- }
- }, _callee6, null, [[13, 23, 26, 29]]);
- }));
- return function (_x4) {
- return _ref.apply(this, arguments);
- };
- }());
- } else if (target instanceof ParseObject) {
- if (!target.id) {
- return _promise.default.reject(new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'Object does not have an ID'));
- }
- var RESTController = _CoreManager.default.getRESTController();
- var params = {};
- if (options && options.include) {
- params.include = options.include.join();
- }
- return RESTController.request('GET', 'classes/' + target.className + '/' + target._getId(), params, options).then( /*#__PURE__*/function () {
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(response) {
- return _regeneratorRuntime().wrap(function _callee7$(_context10) {
- while (1) {
- switch (_context10.prev = _context10.next) {
- case 0:
- target._clearPendingOps();
- target._clearServerData();
- target._finishFetch(response);
- _context10.next = 5;
- return localDatastore._updateObjectIfPinned(target);
- case 5:
- return _context10.abrupt("return", target);
- case 6:
- case "end":
- return _context10.stop();
- }
- }
- }, _callee7);
- }));
- return function (_x5) {
- return _ref2.apply(this, arguments);
- };
- }());
- }
- return _promise.default.resolve();
- },
- destroy: function destroy(target
- /*: ParseObject | Array<ParseObject>*/
- , options
- /*: RequestOptions*/
- )
- /*: Promise<Array<void> | ParseObject>*/
- {
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
- var batchSize, localDatastore, RESTController, batches, deleteCompleted, errors;
- return _regeneratorRuntime().wrap(function _callee10$(_context13) {
- while (1) {
- switch (_context13.prev = _context13.next) {
- case 0:
- batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
- localDatastore = _CoreManager.default.getLocalDatastore();
- RESTController = _CoreManager.default.getRESTController();
- if (!(0, _isArray.default)(target)) {
- _context13.next = 15;
- break;
- }
- if (!(target.length < 1)) {
- _context13.next = 6;
- break;
- }
- return _context13.abrupt("return", _promise.default.resolve([]));
- case 6:
- batches = [[]];
- (0, _forEach.default)(target).call(target, function (obj) {
- if (!obj.id) {
- return;
- }
- batches[batches.length - 1].push(obj);
- if (batches[batches.length - 1].length >= batchSize) {
- batches.push([]);
- }
- });
- if (batches[batches.length - 1].length === 0) {
- // If the last batch is empty, remove it
- batches.pop();
- }
- deleteCompleted = _promise.default.resolve();
- errors = [];
- (0, _forEach.default)(batches).call(batches, function (batch) {
- deleteCompleted = deleteCompleted.then(function () {
- return RESTController.request('POST', 'batch', {
- requests: (0, _map.default)(batch).call(batch, function (obj) {
- return {
- method: 'DELETE',
- path: getServerUrlPath() + 'classes/' + obj.className + '/' + obj._getId(),
- body: {}
- };
- })
- }, options).then(function (results) {
- for (var i = 0; i < results.length; i++) {
- if (results[i] && results[i].hasOwnProperty('error')) {
- var err = new _ParseError.default(results[i].error.code, results[i].error.error);
- err.object = batch[i];
- errors.push(err);
- }
- }
- });
- });
- });
- return _context13.abrupt("return", deleteCompleted.then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
- var aggregate, _iterator3, _step3, object;
- return _regeneratorRuntime().wrap(function _callee8$(_context11) {
- while (1) {
- switch (_context11.prev = _context11.next) {
- case 0:
- if (!errors.length) {
- _context11.next = 4;
- break;
- }
- aggregate = new _ParseError.default(_ParseError.default.AGGREGATE_ERROR);
- aggregate.errors = errors;
- return _context11.abrupt("return", _promise.default.reject(aggregate));
- case 4:
- _iterator3 = _createForOfIteratorHelper(target);
- _context11.prev = 5;
- _iterator3.s();
- case 7:
- if ((_step3 = _iterator3.n()).done) {
- _context11.next = 13;
- break;
- }
- object = _step3.value;
- _context11.next = 11;
- return localDatastore._destroyObjectIfPinned(object);
- case 11:
- _context11.next = 7;
- break;
- case 13:
- _context11.next = 18;
- break;
- case 15:
- _context11.prev = 15;
- _context11.t0 = _context11["catch"](5);
- _iterator3.e(_context11.t0);
- case 18:
- _context11.prev = 18;
- _iterator3.f();
- return _context11.finish(18);
- case 21:
- return _context11.abrupt("return", _promise.default.resolve(target));
- case 22:
- case "end":
- return _context11.stop();
- }
- }
- }, _callee8, null, [[5, 15, 18, 21]]);
- }))));
- case 15:
- if (!(target instanceof ParseObject)) {
- _context13.next = 17;
- break;
- }
- return _context13.abrupt("return", RESTController.request('DELETE', 'classes/' + target.className + '/' + target._getId(), {}, options).then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
- return _regeneratorRuntime().wrap(function _callee9$(_context12) {
- while (1) {
- switch (_context12.prev = _context12.next) {
- case 0:
- _context12.next = 2;
- return localDatastore._destroyObjectIfPinned(target);
- case 2:
- return _context12.abrupt("return", _promise.default.resolve(target));
- case 3:
- case "end":
- return _context12.stop();
- }
- }
- }, _callee9);
- }))));
- case 17:
- return _context13.abrupt("return", _promise.default.resolve(target));
- case 18:
- case "end":
- return _context13.stop();
- }
- }
- }, _callee10);
- }))();
- },
- save: function save(target
- /*: ParseObject | Array<ParseObject | ParseFile>*/
- , options
- /*: RequestOptions*/
- ) {
- var batchSize = options && options.batchSize ? options.batchSize : _CoreManager.default.get('REQUEST_BATCH_SIZE');
- var localDatastore = _CoreManager.default.getLocalDatastore();
- var mapIdForPin = {};
- var RESTController = _CoreManager.default.getRESTController();
- var stateController = _CoreManager.default.getObjectStateController();
- var allowCustomObjectId = _CoreManager.default.get('ALLOW_CUSTOM_OBJECT_ID');
- options = options || {};
- options.returnStatus = options.returnStatus || true;
- if ((0, _isArray.default)(target)) {
- if (target.length < 1) {
- return _promise.default.resolve([]);
- }
- var unsaved = (0, _concat.default)(target).call(target);
- for (var i = 0; i < target.length; i++) {
- if (target[i] instanceof ParseObject) {
- unsaved = (0, _concat.default)(unsaved).call(unsaved, (0, _unsavedChildren.default)(target[i], true));
- }
- }
- unsaved = (0, _unique.default)(unsaved);
- var filesSaved
- /*: Array<ParseFile>*/
- = [];
- var pending
- /*: Array<ParseObject>*/
- = [];
- (0, _forEach.default)(unsaved).call(unsaved, function (el) {
- if (el instanceof _ParseFile.default) {
- filesSaved.push(el.save(options));
- } else if (el instanceof ParseObject) {
- pending.push(el);
- }
- });
- return _promise.default.all(filesSaved).then(function () {
- var objectError = null;
- return (0, _promiseUtils.continueWhile)(function () {
- return pending.length > 0;
- }, function () {
- var batch = [];
- var nextPending = [];
- (0, _forEach.default)(pending).call(pending, function (el) {
- if (allowCustomObjectId && Object.prototype.hasOwnProperty.call(el, 'id') && !el.id) {
- throw new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'objectId must not be empty or null');
- }
- if (batch.length < batchSize && (0, _canBeSerialized.default)(el)) {
- batch.push(el);
- } else {
- nextPending.push(el);
- }
- });
- pending = nextPending;
- if (batch.length < 1) {
- return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
- } // Queue up tasks for each object in the batch.
- // When every task is ready, the API request will execute
- var batchReturned = new _promiseUtils.resolvingPromise();
- var batchReady = [];
- var batchTasks = [];
- (0, _forEach.default)(batch).call(batch, function (obj, index) {
- var ready = new _promiseUtils.resolvingPromise();
- batchReady.push(ready);
- var task = function task() {
- ready.resolve();
- return batchReturned.then(function (responses) {
- if (responses[index].hasOwnProperty('success')) {
- var objectId = responses[index].success.objectId;
- var status = responses[index]._status;
- delete responses[index]._status;
- mapIdForPin[objectId] = obj._localId;
- obj._handleSaveResponse(responses[index].success, status);
- } else {
- if (!objectError && responses[index].hasOwnProperty('error')) {
- var serverError = responses[index].error;
- objectError = new _ParseError.default(serverError.code, serverError.error); // Cancel the rest of the save
- pending = [];
- }
- obj._handleSaveError();
- }
- });
- };
- stateController.pushPendingState(obj._getStateIdentifier());
- batchTasks.push(stateController.enqueueTask(obj._getStateIdentifier(), task));
- });
- (0, _promiseUtils.when)(batchReady).then(function () {
- // Kick off the batch request
- return RESTController.request('POST', 'batch', {
- requests: (0, _map.default)(batch).call(batch, function (obj) {
- var params = obj._getSaveParams();
- params.path = getServerUrlPath() + params.path;
- return params;
- })
- }, options);
- }).then(batchReturned.resolve, function (error) {
- batchReturned.reject(new _ParseError.default(_ParseError.default.INCORRECT_TYPE, error.message));
- });
- return (0, _promiseUtils.when)(batchTasks);
- }).then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
- var _iterator4, _step4, object;
- return _regeneratorRuntime().wrap(function _callee11$(_context14) {
- while (1) {
- switch (_context14.prev = _context14.next) {
- case 0:
- if (!objectError) {
- _context14.next = 2;
- break;
- }
- return _context14.abrupt("return", _promise.default.reject(objectError));
- case 2:
- _iterator4 = _createForOfIteratorHelper(target);
- _context14.prev = 3;
- _iterator4.s();
- case 5:
- if ((_step4 = _iterator4.n()).done) {
- _context14.next = 13;
- break;
- }
- object = _step4.value;
- _context14.next = 9;
- return localDatastore._updateLocalIdForObject(mapIdForPin[object.id], object);
- case 9:
- _context14.next = 11;
- return localDatastore._updateObjectIfPinned(object);
- case 11:
- _context14.next = 5;
- break;
- case 13:
- _context14.next = 18;
- break;
- case 15:
- _context14.prev = 15;
- _context14.t0 = _context14["catch"](3);
- _iterator4.e(_context14.t0);
- case 18:
- _context14.prev = 18;
- _iterator4.f();
- return _context14.finish(18);
- case 21:
- return _context14.abrupt("return", _promise.default.resolve(target));
- case 22:
- case "end":
- return _context14.stop();
- }
- }
- }, _callee11, null, [[3, 15, 18, 21]]);
- })));
- });
- } else if (target instanceof ParseObject) {
- if (allowCustomObjectId && Object.prototype.hasOwnProperty.call(target, 'id') && !target.id) {
- throw new _ParseError.default(_ParseError.default.MISSING_OBJECT_ID, 'objectId must not be empty or null');
- } // generate _localId in case if cascadeSave=false
- target._getId();
- var localId = target._localId; // copying target lets Flow guarantee the pointer isn't modified elsewhere
- var targetCopy = target;
- var task = function task() {
- var params = targetCopy._getSaveParams();
- return RESTController.request(params.method, params.path, params.body, options).then(function (response) {
- var status = response._status;
- delete response._status;
- targetCopy._handleSaveResponse(response, status);
- }, function (error) {
- targetCopy._handleSaveError();
- return _promise.default.reject(error);
- });
- };
- stateController.pushPendingState(target._getStateIdentifier());
- return stateController.enqueueTask(target._getStateIdentifier(), task).then( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
- return _regeneratorRuntime().wrap(function _callee12$(_context15) {
- while (1) {
- switch (_context15.prev = _context15.next) {
- case 0:
- _context15.next = 2;
- return localDatastore._updateLocalIdForObject(localId, target);
- case 2:
- _context15.next = 4;
- return localDatastore._updateObjectIfPinned(target);
- case 4:
- return _context15.abrupt("return", target);
- case 5:
- case "end":
- return _context15.stop();
- }
- }
- }, _callee12);
- })), function (error) {
- return _promise.default.reject(error);
- });
- }
- return _promise.default.resolve();
- }
- };
- _CoreManager.default.setObjectController(DefaultController);
- var _default = ParseObject;
- exports.default = _default;
- },{"./CoreManager":4,"./EventuallyQueue":7,"./LocalDatastoreUtils":15,"./ParseACL":19,"./ParseError":22,"./ParseFile":23,"./ParseOp":28,"./ParseQuery":30,"./ParseRelation":31,"./SingleInstanceStateController":38,"./UniqueInstanceStateController":42,"./canBeSerialized":44,"./decode":45,"./encode":46,"./escape":48,"./parseDate":50,"./promiseUtils":51,"./unique":52,"./unsavedChildren":53,"./uuid":54,"@babel/runtime-corejs3/core-js-stable/array/from":55,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/concat":58,"@babel/runtime-corejs3/core-js-stable/instance/filter":61,"@babel/runtime-corejs3/core-js-stable/instance/find":63,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/includes":65,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/instance/map":68,"@babel/runtime-corejs3/core-js-stable/instance/reverse":70,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/object/create":80,"@babel/runtime-corejs3/core-js-stable/object/define-properties":81,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/freeze":84,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":85,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":86,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":87,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":88,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":90,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/core-js-stable/weak-map":98,"@babel/runtime-corejs3/core-js/get-iterator-method":101,"@babel/runtime-corejs3/helpers/asyncToGenerator":120,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],28:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.UnsetOp = exports.SetOp = exports.RemoveOp = exports.RelationOp = exports.Op = exports.IncrementOp = exports.AddUniqueOp = exports.AddOp = void 0;
- exports.opFromJSON = opFromJSON;
- var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
- var _splice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/splice"));
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
- var _assertThisInitialized2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/assertThisInitialized"));
- var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
- var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
- var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _arrayContainsObject = _interopRequireDefault(_dereq_("./arrayContainsObject"));
- var _decode = _interopRequireDefault(_dereq_("./decode"));
- var _encode = _interopRequireDefault(_dereq_("./encode"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
- var _unique = _interopRequireDefault(_dereq_("./unique"));
- function _createSuper(Derived) {
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
- return function () {
- var Super = (0, _getPrototypeOf2.default)(Derived),
- result;
- if (hasNativeReflectConstruct) {
- var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
- result = _Reflect$construct(Super, arguments, NewTarget);
- } else {
- result = Super.apply(this, arguments);
- }
- return (0, _possibleConstructorReturn2.default)(this, result);
- };
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
- if (_Reflect$construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
- }
- function opFromJSON(json
- /*: { [key: string]: any }*/
- )
- /*: ?Op*/
- {
- if (!json || !json.__op) {
- return null;
- }
- switch (json.__op) {
- case 'Delete':
- return new UnsetOp();
- case 'Increment':
- return new IncrementOp(json.amount);
- case 'Add':
- return new AddOp((0, _decode.default)(json.objects));
- case 'AddUnique':
- return new AddUniqueOp((0, _decode.default)(json.objects));
- case 'Remove':
- return new RemoveOp((0, _decode.default)(json.objects));
- case 'AddRelation':
- {
- var toAdd = (0, _decode.default)(json.objects);
- if (!(0, _isArray.default)(toAdd)) {
- return new RelationOp([], []);
- }
- return new RelationOp(toAdd, []);
- }
- case 'RemoveRelation':
- {
- var toRemove = (0, _decode.default)(json.objects);
- if (!(0, _isArray.default)(toRemove)) {
- return new RelationOp([], []);
- }
- return new RelationOp([], toRemove);
- }
- case 'Batch':
- {
- var _toAdd = [];
- var _toRemove = [];
- for (var i = 0; i < json.ops.length; i++) {
- if (json.ops[i].__op === 'AddRelation') {
- _toAdd = (0, _concat.default)(_toAdd).call(_toAdd, (0, _decode.default)(json.ops[i].objects));
- } else if (json.ops[i].__op === 'RemoveRelation') {
- _toRemove = (0, _concat.default)(_toRemove).call(_toRemove, (0, _decode.default)(json.ops[i].objects));
- }
- }
- return new RelationOp(_toAdd, _toRemove);
- }
- }
- return null;
- }
- var Op = /*#__PURE__*/function () {
- function Op() {
- (0, _classCallCheck2.default)(this, Op);
- }
- (0, _createClass2.default)(Op, [{
- key: "applyTo",
- value: // Empty parent class
- function ()
- /*: mixed*/
- {}
- /* eslint-disable-line no-unused-vars */
- }, {
- key: "mergeWith",
- value: function ()
- /*: ?Op*/
- {}
- /* eslint-disable-line no-unused-vars */
- }, {
- key: "toJSON",
- value: function ()
- /*: mixed*/
- {}
- }]);
- return Op;
- }();
- exports.Op = Op;
- var SetOp = /*#__PURE__*/function (_Op) {
- (0, _inherits2.default)(SetOp, _Op);
- var _super = _createSuper(SetOp);
- function SetOp(value
- /*: mixed*/
- ) {
- var _this;
- (0, _classCallCheck2.default)(this, SetOp);
- _this = _super.call(this);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_value", void 0);
- _this._value = value;
- return _this;
- }
- (0, _createClass2.default)(SetOp, [{
- key: "applyTo",
- value: function ()
- /*: mixed*/
- {
- return this._value;
- }
- }, {
- key: "mergeWith",
- value: function ()
- /*: SetOp*/
- {
- return new SetOp(this._value);
- }
- }, {
- key: "toJSON",
- value: function (offline
- /*:: ?: boolean*/
- ) {
- return (0, _encode.default)(this._value, false, true, undefined, offline);
- }
- }]);
- return SetOp;
- }(Op);
- exports.SetOp = SetOp;
- var UnsetOp = /*#__PURE__*/function (_Op2) {
- (0, _inherits2.default)(UnsetOp, _Op2);
- var _super2 = _createSuper(UnsetOp);
- function UnsetOp() {
- (0, _classCallCheck2.default)(this, UnsetOp);
- return _super2.apply(this, arguments);
- }
- (0, _createClass2.default)(UnsetOp, [{
- key: "applyTo",
- value: function () {
- return undefined;
- }
- }, {
- key: "mergeWith",
- value: function ()
- /*: UnsetOp*/
- {
- return new UnsetOp();
- }
- }, {
- key: "toJSON",
- value: function ()
- /*: { __op: string }*/
- {
- return {
- __op: 'Delete'
- };
- }
- }]);
- return UnsetOp;
- }(Op);
- exports.UnsetOp = UnsetOp;
- var IncrementOp = /*#__PURE__*/function (_Op3) {
- (0, _inherits2.default)(IncrementOp, _Op3);
- var _super3 = _createSuper(IncrementOp);
- function IncrementOp(amount
- /*: number*/
- ) {
- var _this2;
- (0, _classCallCheck2.default)(this, IncrementOp);
- _this2 = _super3.call(this);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "_amount", void 0);
- if (typeof amount !== 'number') {
- throw new TypeError('Increment Op must be initialized with a numeric amount.');
- }
- _this2._amount = amount;
- return _this2;
- }
- (0, _createClass2.default)(IncrementOp, [{
- key: "applyTo",
- value: function (value
- /*: ?mixed*/
- )
- /*: number*/
- {
- if (typeof value === 'undefined') {
- return this._amount;
- }
- if (typeof value !== 'number') {
- throw new TypeError('Cannot increment a non-numeric value.');
- }
- return this._amount + value;
- }
- }, {
- key: "mergeWith",
- value: function (previous
- /*: Op*/
- )
- /*: Op*/
- {
- if (!previous) {
- return this;
- }
- if (previous instanceof SetOp) {
- return new SetOp(this.applyTo(previous._value));
- }
- if (previous instanceof UnsetOp) {
- return new SetOp(this._amount);
- }
- if (previous instanceof IncrementOp) {
- return new IncrementOp(this.applyTo(previous._amount));
- }
- throw new Error('Cannot merge Increment Op with the previous Op');
- }
- }, {
- key: "toJSON",
- value: function ()
- /*: { __op: string, amount: number }*/
- {
- return {
- __op: 'Increment',
- amount: this._amount
- };
- }
- }]);
- return IncrementOp;
- }(Op);
- exports.IncrementOp = IncrementOp;
- var AddOp = /*#__PURE__*/function (_Op4) {
- (0, _inherits2.default)(AddOp, _Op4);
- var _super4 = _createSuper(AddOp);
- function AddOp(value
- /*: mixed | Array<mixed>*/
- ) {
- var _this3;
- (0, _classCallCheck2.default)(this, AddOp);
- _this3 = _super4.call(this);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this3), "_value", void 0);
- _this3._value = (0, _isArray.default)(value) ? value : [value];
- return _this3;
- }
- (0, _createClass2.default)(AddOp, [{
- key: "applyTo",
- value: function (value
- /*: mixed*/
- )
- /*: Array<mixed>*/
- {
- if (value == null) {
- return this._value;
- }
- if ((0, _isArray.default)(value)) {
- return (0, _concat.default)(value).call(value, this._value);
- }
- throw new Error('Cannot add elements to a non-array value');
- }
- }, {
- key: "mergeWith",
- value: function (previous
- /*: Op*/
- )
- /*: Op*/
- {
- if (!previous) {
- return this;
- }
- if (previous instanceof SetOp) {
- return new SetOp(this.applyTo(previous._value));
- }
- if (previous instanceof UnsetOp) {
- return new SetOp(this._value);
- }
- if (previous instanceof AddOp) {
- return new AddOp(this.applyTo(previous._value));
- }
- throw new Error('Cannot merge Add Op with the previous Op');
- }
- }, {
- key: "toJSON",
- value: function ()
- /*: { __op: string, objects: mixed }*/
- {
- return {
- __op: 'Add',
- objects: (0, _encode.default)(this._value, false, true)
- };
- }
- }]);
- return AddOp;
- }(Op);
- exports.AddOp = AddOp;
- var AddUniqueOp = /*#__PURE__*/function (_Op5) {
- (0, _inherits2.default)(AddUniqueOp, _Op5);
- var _super5 = _createSuper(AddUniqueOp);
- function AddUniqueOp(value
- /*: mixed | Array<mixed>*/
- ) {
- var _this4;
- (0, _classCallCheck2.default)(this, AddUniqueOp);
- _this4 = _super5.call(this);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this4), "_value", void 0);
- _this4._value = (0, _unique.default)((0, _isArray.default)(value) ? value : [value]);
- return _this4;
- }
- (0, _createClass2.default)(AddUniqueOp, [{
- key: "applyTo",
- value: function (value
- /*: mixed | Array<mixed>*/
- )
- /*: Array<mixed>*/
- {
- if (value == null) {
- return this._value || [];
- }
- if ((0, _isArray.default)(value)) {
- var _context;
- var toAdd = [];
- (0, _forEach.default)(_context = this._value).call(_context, function (v) {
- if (v instanceof _ParseObject.default) {
- if (!(0, _arrayContainsObject.default)(value, v)) {
- toAdd.push(v);
- }
- } else {
- if ((0, _indexOf.default)(value).call(value, v) < 0) {
- toAdd.push(v);
- }
- }
- });
- return (0, _concat.default)(value).call(value, toAdd);
- }
- throw new Error('Cannot add elements to a non-array value');
- }
- }, {
- key: "mergeWith",
- value: function (previous
- /*: Op*/
- )
- /*: Op*/
- {
- if (!previous) {
- return this;
- }
- if (previous instanceof SetOp) {
- return new SetOp(this.applyTo(previous._value));
- }
- if (previous instanceof UnsetOp) {
- return new SetOp(this._value);
- }
- if (previous instanceof AddUniqueOp) {
- return new AddUniqueOp(this.applyTo(previous._value));
- }
- throw new Error('Cannot merge AddUnique Op with the previous Op');
- }
- }, {
- key: "toJSON",
- value: function ()
- /*: { __op: string, objects: mixed }*/
- {
- return {
- __op: 'AddUnique',
- objects: (0, _encode.default)(this._value, false, true)
- };
- }
- }]);
- return AddUniqueOp;
- }(Op);
- exports.AddUniqueOp = AddUniqueOp;
- var RemoveOp = /*#__PURE__*/function (_Op6) {
- (0, _inherits2.default)(RemoveOp, _Op6);
- var _super6 = _createSuper(RemoveOp);
- function RemoveOp(value
- /*: mixed | Array<mixed>*/
- ) {
- var _this5;
- (0, _classCallCheck2.default)(this, RemoveOp);
- _this5 = _super6.call(this);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this5), "_value", void 0);
- _this5._value = (0, _unique.default)((0, _isArray.default)(value) ? value : [value]);
- return _this5;
- }
- (0, _createClass2.default)(RemoveOp, [{
- key: "applyTo",
- value: function (value
- /*: mixed | Array<mixed>*/
- )
- /*: Array<mixed>*/
- {
- if (value == null) {
- return [];
- }
- if ((0, _isArray.default)(value)) {
- // var i = value.indexOf(this._value);
- var removed = (0, _concat.default)(value).call(value, []);
- for (var i = 0; i < this._value.length; i++) {
- var index = (0, _indexOf.default)(removed).call(removed, this._value[i]);
- while (index > -1) {
- (0, _splice.default)(removed).call(removed, index, 1);
- index = (0, _indexOf.default)(removed).call(removed, this._value[i]);
- }
- if (this._value[i] instanceof _ParseObject.default && this._value[i].id) {
- for (var j = 0; j < removed.length; j++) {
- if (removed[j] instanceof _ParseObject.default && this._value[i].id === removed[j].id) {
- (0, _splice.default)(removed).call(removed, j, 1);
- j--;
- }
- }
- }
- }
- return removed;
- }
- throw new Error('Cannot remove elements from a non-array value');
- }
- }, {
- key: "mergeWith",
- value: function (previous
- /*: Op*/
- )
- /*: Op*/
- {
- if (!previous) {
- return this;
- }
- if (previous instanceof SetOp) {
- return new SetOp(this.applyTo(previous._value));
- }
- if (previous instanceof UnsetOp) {
- return new UnsetOp();
- }
- if (previous instanceof RemoveOp) {
- var _context2;
- var uniques = (0, _concat.default)(_context2 = previous._value).call(_context2, []);
- for (var i = 0; i < this._value.length; i++) {
- if (this._value[i] instanceof _ParseObject.default) {
- if (!(0, _arrayContainsObject.default)(uniques, this._value[i])) {
- uniques.push(this._value[i]);
- }
- } else {
- if ((0, _indexOf.default)(uniques).call(uniques, this._value[i]) < 0) {
- uniques.push(this._value[i]);
- }
- }
- }
- return new RemoveOp(uniques);
- }
- throw new Error('Cannot merge Remove Op with the previous Op');
- }
- }, {
- key: "toJSON",
- value: function ()
- /*: { __op: string, objects: mixed }*/
- {
- return {
- __op: 'Remove',
- objects: (0, _encode.default)(this._value, false, true)
- };
- }
- }]);
- return RemoveOp;
- }(Op);
- exports.RemoveOp = RemoveOp;
- var RelationOp = /*#__PURE__*/function (_Op7) {
- (0, _inherits2.default)(RelationOp, _Op7);
- var _super7 = _createSuper(RelationOp);
- function RelationOp(adds
- /*: Array<ParseObject | string>*/
- , removes
- /*: Array<ParseObject | string>*/
- ) {
- var _this6;
- (0, _classCallCheck2.default)(this, RelationOp);
- _this6 = _super7.call(this);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "_targetClassName", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "relationsToAdd", void 0);
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this6), "relationsToRemove", void 0);
- _this6._targetClassName = null;
- if ((0, _isArray.default)(adds)) {
- _this6.relationsToAdd = (0, _unique.default)((0, _map.default)(adds).call(adds, _this6._extractId, (0, _assertThisInitialized2.default)(_this6)));
- }
- if ((0, _isArray.default)(removes)) {
- _this6.relationsToRemove = (0, _unique.default)((0, _map.default)(removes).call(removes, _this6._extractId, (0, _assertThisInitialized2.default)(_this6)));
- }
- return _this6;
- }
- (0, _createClass2.default)(RelationOp, [{
- key: "_extractId",
- value: function (obj
- /*: string | ParseObject*/
- )
- /*: string*/
- {
- if (typeof obj === 'string') {
- return obj;
- }
- if (!obj.id) {
- throw new Error('You cannot add or remove an unsaved Parse Object from a relation');
- }
- if (!this._targetClassName) {
- this._targetClassName = obj.className;
- }
- if (this._targetClassName !== obj.className) {
- throw new Error('Tried to create a Relation with 2 different object types: ' + this._targetClassName + ' and ' + obj.className + '.');
- }
- return obj.id;
- }
- }, {
- key: "applyTo",
- value: function (value
- /*: mixed*/
- , object
- /*:: ?: { className: string, id: ?string }*/
- , key
- /*:: ?: string*/
- )
- /*: ?ParseRelation*/
- {
- if (!value) {
- var _context3;
- if (!object || !key) {
- throw new Error('Cannot apply a RelationOp without either a previous value, or an object and a key');
- }
- var parent = new _ParseObject.default(object.className);
- if (object.id && (0, _indexOf.default)(_context3 = object.id).call(_context3, 'local') === 0) {
- parent._localId = object.id;
- } else if (object.id) {
- parent.id = object.id;
- }
- var relation = new _ParseRelation.default(parent, key);
- relation.targetClassName = this._targetClassName;
- return relation;
- }
- if (value instanceof _ParseRelation.default) {
- if (this._targetClassName) {
- if (value.targetClassName) {
- if (this._targetClassName !== value.targetClassName) {
- throw new Error('Related object must be a ' + value.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
- }
- } else {
- value.targetClassName = this._targetClassName;
- }
- }
- return value;
- } else {
- throw new Error('Relation cannot be applied to a non-relation field');
- }
- }
- }, {
- key: "mergeWith",
- value: function (previous
- /*: Op*/
- )
- /*: Op*/
- {
- if (!previous) {
- return this;
- } else if (previous instanceof UnsetOp) {
- throw new Error('You cannot modify a relation after deleting it.');
- } else if (previous instanceof SetOp && previous._value instanceof _ParseRelation.default) {
- return this;
- } else if (previous instanceof RelationOp) {
- var _context4, _context5, _context6, _context7, _context8, _context9;
- if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
- throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + (this._targetClassName || 'null') + ' was passed in.');
- }
- var newAdd = (0, _concat.default)(_context4 = previous.relationsToAdd).call(_context4, []);
- (0, _forEach.default)(_context5 = this.relationsToRemove).call(_context5, function (r) {
- var index = (0, _indexOf.default)(newAdd).call(newAdd, r);
- if (index > -1) {
- (0, _splice.default)(newAdd).call(newAdd, index, 1);
- }
- });
- (0, _forEach.default)(_context6 = this.relationsToAdd).call(_context6, function (r) {
- var index = (0, _indexOf.default)(newAdd).call(newAdd, r);
- if (index < 0) {
- newAdd.push(r);
- }
- });
- var newRemove = (0, _concat.default)(_context7 = previous.relationsToRemove).call(_context7, []);
- (0, _forEach.default)(_context8 = this.relationsToAdd).call(_context8, function (r) {
- var index = (0, _indexOf.default)(newRemove).call(newRemove, r);
- if (index > -1) {
- (0, _splice.default)(newRemove).call(newRemove, index, 1);
- }
- });
- (0, _forEach.default)(_context9 = this.relationsToRemove).call(_context9, function (r) {
- var index = (0, _indexOf.default)(newRemove).call(newRemove, r);
- if (index < 0) {
- newRemove.push(r);
- }
- });
- var newRelation = new RelationOp(newAdd, newRemove);
- newRelation._targetClassName = this._targetClassName;
- return newRelation;
- }
- throw new Error('Cannot merge Relation Op with the previous Op');
- }
- }, {
- key: "toJSON",
- value: function ()
- /*: { __op?: string, objects?: mixed, ops?: mixed }*/
- {
- var _this7 = this;
- var idToPointer = function (id) {
- return {
- __type: 'Pointer',
- className: _this7._targetClassName,
- objectId: id
- };
- };
- var adds = null;
- var removes = null;
- var pointers = null;
- if (this.relationsToAdd.length > 0) {
- var _context10;
- pointers = (0, _map.default)(_context10 = this.relationsToAdd).call(_context10, idToPointer);
- adds = {
- __op: 'AddRelation',
- objects: pointers
- };
- }
- if (this.relationsToRemove.length > 0) {
- var _context11;
- pointers = (0, _map.default)(_context11 = this.relationsToRemove).call(_context11, idToPointer);
- removes = {
- __op: 'RemoveRelation',
- objects: pointers
- };
- }
- if (adds && removes) {
- return {
- __op: 'Batch',
- ops: [adds, removes]
- };
- }
- return adds || removes || {};
- }
- }]);
- return RelationOp;
- }(Op);
- exports.RelationOp = RelationOp;
- },{"./ParseObject":27,"./ParseRelation":31,"./arrayContainsObject":43,"./decode":45,"./encode":46,"./unique":52,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/concat":58,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/instance/map":68,"@babel/runtime-corejs3/core-js-stable/instance/splice":73,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/helpers/assertThisInitialized":119,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/getPrototypeOf":126,"@babel/runtime-corejs3/helpers/inherits":127,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":135}],29:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _ParseGeoPoint = _interopRequireDefault(_dereq_("./ParseGeoPoint"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- /**
- * Creates a new Polygon with any of the following forms:<br>
- * <pre>
- * new Polygon([[0,0],[0,1],[1,1],[1,0]])
- * new Polygon([GeoPoint, GeoPoint, GeoPoint])
- * </pre>
- *
- * <p>Represents a coordinates that may be associated
- * with a key in a ParseObject or used as a reference point for geo queries.
- * This allows proximity-based queries on the key.</p>
- *
- * <p>Example:<pre>
- * var polygon = new Parse.Polygon([[0,0],[0,1],[1,1],[1,0]]);
- * var object = new Parse.Object("PlaceObject");
- * object.set("area", polygon);
- * object.save();</pre></p>
- *
- * @alias Parse.Polygon
- */
- var ParsePolygon = /*#__PURE__*/function () {
- /**
- * @param {(number[][] | Parse.GeoPoint[])} coordinates An Array of coordinate pairs
- */
- function ParsePolygon(coordinates
- /*: Array<Array<number>> | Array<ParseGeoPoint>*/
- ) {
- (0, _classCallCheck2.default)(this, ParsePolygon);
- (0, _defineProperty2.default)(this, "_coordinates", void 0);
- this._coordinates = ParsePolygon._validate(coordinates);
- }
- /**
- * Coordinates value for this Polygon.
- * Throws an exception if not valid type.
- *
- * @property {(number[][] | Parse.GeoPoint[])} coordinates list of coordinates
- * @returns {number[][]}
- */
- (0, _createClass2.default)(ParsePolygon, [{
- key: "coordinates",
- get: function ()
- /*: Array<Array<number>>*/
- {
- return this._coordinates;
- },
- set: function (coords
- /*: Array<Array<number>> | Array<ParseGeoPoint>*/
- ) {
- this._coordinates = ParsePolygon._validate(coords);
- }
- /**
- * Returns a JSON representation of the Polygon, suitable for Parse.
- *
- * @returns {object}
- */
- }, {
- key: "toJSON",
- value: function ()
- /*: { __type: string, coordinates: Array<Array<number>> }*/
- {
- ParsePolygon._validate(this._coordinates);
- return {
- __type: 'Polygon',
- coordinates: this._coordinates
- };
- }
- /**
- * Checks if two polygons are equal
- *
- * @param {(Parse.Polygon | object)} other
- * @returns {boolean}
- */
- }, {
- key: "equals",
- value: function (other
- /*: mixed*/
- )
- /*: boolean*/
- {
- if (!(other instanceof ParsePolygon) || this.coordinates.length !== other.coordinates.length) {
- return false;
- }
- var isEqual = true;
- for (var i = 1; i < this._coordinates.length; i += 1) {
- if (this._coordinates[i][0] != other.coordinates[i][0] || this._coordinates[i][1] != other.coordinates[i][1]) {
- isEqual = false;
- break;
- }
- }
- return isEqual;
- }
- /**
- *
- * @param {Parse.GeoPoint} point
- * @returns {boolean} Returns if the point is contained in the polygon
- */
- }, {
- key: "containsPoint",
- value: function (point
- /*: ParseGeoPoint*/
- )
- /*: boolean*/
- {
- var minX = this._coordinates[0][0];
- var maxX = this._coordinates[0][0];
- var minY = this._coordinates[0][1];
- var maxY = this._coordinates[0][1];
- for (var i = 1; i < this._coordinates.length; i += 1) {
- var p = this._coordinates[i];
- minX = Math.min(p[0], minX);
- maxX = Math.max(p[0], maxX);
- minY = Math.min(p[1], minY);
- maxY = Math.max(p[1], maxY);
- }
- var outside = point.latitude < minX || point.latitude > maxX || point.longitude < minY || point.longitude > maxY;
- if (outside) {
- return false;
- }
- var inside = false;
- for (var _i = 0, j = this._coordinates.length - 1; _i < this._coordinates.length; j = _i++) {
- var startX = this._coordinates[_i][0];
- var startY = this._coordinates[_i][1];
- var endX = this._coordinates[j][0];
- var endY = this._coordinates[j][1];
- var intersect = startY > point.longitude != endY > point.longitude && point.latitude < (endX - startX) * (point.longitude - startY) / (endY - startY) + startX;
- if (intersect) {
- inside = !inside;
- }
- }
- return inside;
- }
- /**
- * Validates that the list of coordinates can form a valid polygon
- *
- * @param {Array} coords the list of coordinates to validate as a polygon
- * @throws {TypeError}
- * @returns {number[][]} Array of coordinates if validated.
- */
- }], [{
- key: "_validate",
- value: function (coords
- /*: Array<Array<number>> | Array<ParseGeoPoint>*/
- )
- /*: Array<Array<number>>*/
- {
- if (!(0, _isArray.default)(coords)) {
- throw new TypeError('Coordinates must be an Array');
- }
- if (coords.length < 3) {
- throw new TypeError('Polygon must have at least 3 GeoPoints or Points');
- }
- var points = [];
- for (var i = 0; i < coords.length; i += 1) {
- var coord = coords[i];
- var geoPoint = void 0;
- if (coord instanceof _ParseGeoPoint.default) {
- geoPoint = coord;
- } else if ((0, _isArray.default)(coord) && coord.length === 2) {
- geoPoint = new _ParseGeoPoint.default(coord[0], coord[1]);
- } else {
- throw new TypeError('Coordinates must be an Array of GeoPoints or Points');
- }
- points.push([geoPoint.latitude, geoPoint.longitude]);
- }
- return points;
- }
- }]);
- return ParsePolygon;
- }();
- var _default = ParsePolygon;
- exports.default = _default;
- },{"./ParseGeoPoint":24,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],30:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _sliceInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
- var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
- var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
- var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
- var _typeof3 = _dereq_("@babel/runtime-corejs3/helpers/typeof");
- var _forEachInstanceProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
- var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
- var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _entries = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/entries"));
- var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _toConsumableArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/toConsumableArray"));
- var _find = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/find"));
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _splice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/splice"));
- var _sort = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/sort"));
- var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
- var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
- var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/keys"));
- var _filter2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter"));
- var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
- var _map2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _slice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice"));
- var _keys2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _encode = _interopRequireDefault(_dereq_("./encode"));
- var _promiseUtils = _dereq_("./promiseUtils");
- var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
- var _ParseGeoPoint = _interopRequireDefault(_dereq_("./ParseGeoPoint"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- var _OfflineQuery = _interopRequireDefault(_dereq_("./OfflineQuery"));
- var _LocalDatastoreUtils = _dereq_("./LocalDatastoreUtils");
- function _regeneratorRuntime() {
- "use strict";
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
- _regeneratorRuntime = function () {
- return exports;
- };
- var exports = {},
- Op = Object.prototype,
- hasOwn = Op.hasOwnProperty,
- $Symbol = "function" == typeof _Symbol ? _Symbol : {},
- iteratorSymbol = $Symbol.iterator || "@@iterator",
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- return _Object$defineProperty(obj, key, {
- value: value,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }), obj[key];
- }
- try {
- define({}, "");
- } catch (err) {
- define = function (obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
- generator = _Object$create(protoGenerator.prototype),
- context = new Context(tryLocsList || []);
- return generator._invoke = function (innerFn, self, context) {
- var state = "suspendedStart";
- return function (method, arg) {
- if ("executing" === state) throw new Error("Generator is already running");
- if ("completed" === state) {
- if ("throw" === method) throw arg;
- return doneResult();
- }
- for (context.method = method, context.arg = arg;;) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
- if ("suspendedStart" === state) throw state = "completed", context.arg;
- context.dispatchException(context.arg);
- } else "return" === context.method && context.abrupt("return", context.arg);
- state = "executing";
- var record = tryCatch(innerFn, self, context);
- if ("normal" === record.type) {
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
- return {
- value: record.arg,
- done: context.done
- };
- }
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
- }
- };
- }(innerFn, self, context), generator;
- }
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- exports.wrap = wrap;
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = _Object$getPrototypeOf,
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
- function defineIteratorMethods(prototype) {
- var _context23;
- _forEachInstanceProperty2(_context23 = ["next", "throw", "return"]).call(_context23, function (method) {
- define(prototype, method, function (arg) {
- return this._invoke(method, arg);
- });
- });
- }
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if ("throw" !== record.type) {
- var result = record.arg,
- value = result.value;
- return value && "object" == _typeof3(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
- result.value = unwrapped, resolve(result);
- }, function (error) {
- return invoke("throw", error, resolve, reject);
- });
- }
- reject(record.arg);
- }
- var previousPromise;
- this._invoke = function (method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (undefined === method) {
- if (context.delegate = null, "throw" === context.method) {
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
- var info = record.arg;
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
- }
- function pushTryEntry(locs) {
- var entry = {
- tryLoc: locs[0]
- };
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal", delete record.arg, entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{
- tryLoc: "root"
- }], _forEachInstanceProperty2(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
- }
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) return iteratorMethod.call(iterable);
- if ("function" == typeof iterable.next) return iterable;
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- for (; ++i < iterable.length;) {
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
- }
- return next.value = undefined, next.done = !0, next;
- };
- return next.next = next;
- }
- }
- return {
- next: doneResult
- };
- }
- function doneResult() {
- return {
- value: undefined,
- done: !0
- };
- }
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
- var ctor = "function" == typeof genFun && genFun.constructor;
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
- }, exports.mark = function (genFun) {
- return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
- }, exports.awrap = function (arg) {
- return {
- __await: arg
- };
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- void 0 === PromiseImpl && (PromiseImpl = _Promise2);
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
- return this;
- }), define(Gp, "toString", function () {
- return "[object Generator]";
- }), exports.keys = function (object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- return _reverseInstanceProperty(keys).call(keys), function next() {
- for (; keys.length;) {
- var key = keys.pop();
- if (key in object) return next.value = key, next.done = !1, next;
- }
- return next.done = !0, next;
- };
- }, exports.values = values, Context.prototype = {
- constructor: Context,
- reset: function (skipTempReset) {
- var _context24;
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context24 = this.tryEntries).call(_context24, resetTryEntry), !skipTempReset) for (var name in this) {
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty2(name).call(name, 1)) && (this[name] = undefined);
- }
- },
- stop: function () {
- this.done = !0;
- var rootRecord = this.tryEntries[0].completion;
- if ("throw" === rootRecord.type) throw rootRecord.arg;
- return this.rval;
- },
- dispatchException: function (exception) {
- if (this.done) throw exception;
- var context = this;
- function handle(loc, caught) {
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i],
- record = entry.completion;
- if ("root" === entry.tryLoc) return handle("end");
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc"),
- hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- } else {
- if (!hasFinally) throw new Error("try statement without catch or finally");
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- }
- }
- }
- },
- abrupt: function (type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
- var record = finallyEntry ? finallyEntry.completion : {};
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
- },
- complete: function (record, afterLoc) {
- if ("throw" === record.type) throw record.arg;
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
- },
- finish: function (finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
- }
- },
- catch: function (tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if ("throw" === record.type) {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function (iterable, resultName, nextLoc) {
- return this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
- }
- }, exports;
- }
- /**
- * Converts a string into a regex that matches it.
- * Surrounding with \Q .. \E does this, we just need to escape any \E's in
- * the text separately.
- *
- * @param s
- * @private
- * @returns {string}
- */
- function quote(s
- /*: string*/
- )
- /*: string*/
- {
- return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
- }
- /**
- * Extracts the class name from queries. If not all queries have the same
- * class name an error will be thrown.
- *
- * @param queries
- * @private
- * @returns {string}
- */
- function _getClassNameFromQueries(queries
- /*: Array<ParseQuery>*/
- )
- /*: ?string*/
- {
- var className = null;
- (0, _forEach.default)(queries).call(queries, function (q) {
- if (!className) {
- className = q.className;
- }
- if (className !== q.className) {
- throw new Error('All queries must be for the same class.');
- }
- });
- return className;
- }
- /*
- * Handles pre-populating the result data of a query with select fields,
- * making sure that the data object contains keys for all objects that have
- * been requested with a select, so that our cached state updates correctly.
- */
- function handleSelectResult(data
- /*: any*/
- , select
- /*: Array<string>*/
- ) {
- var serverDataMask = {};
- (0, _forEach.default)(select).call(select, function (field) {
- var hasSubObjectSelect = (0, _indexOf.default)(field).call(field, '.') !== -1;
- if (!hasSubObjectSelect && !data.hasOwnProperty(field)) {
- // this field was selected, but is missing from the retrieved data
- data[field] = undefined;
- } else if (hasSubObjectSelect) {
- // this field references a sub-object,
- // so we need to walk down the path components
- var pathComponents = field.split('.');
- var _obj = data;
- var serverMask = serverDataMask;
- (0, _forEach.default)(pathComponents).call(pathComponents, function (component, index, arr) {
- // add keys if the expected data is missing
- if (_obj && !_obj.hasOwnProperty(component)) {
- _obj[component] = undefined;
- }
- if (_obj && (0, _typeof2.default)(_obj) === 'object') {
- _obj = _obj[component];
- } //add this path component to the server mask so we can fill it in later if needed
- if (index < arr.length - 1) {
- if (!serverMask[component]) {
- serverMask[component] = {};
- }
- serverMask = serverMask[component];
- }
- });
- }
- });
- if ((0, _keys2.default)(serverDataMask).length > 0) {
- // When selecting from sub-objects, we don't want to blow away the missing
- // information that we may have retrieved before. We've already added any
- // missing selected keys to sub-objects, but we still need to add in the
- // data for any previously retrieved sub-objects that were not selected.
- var serverData = _CoreManager.default.getObjectStateController().getServerData({
- id: data.objectId,
- className: data.className
- });
- copyMissingDataWithMask(serverData, data, serverDataMask, false);
- }
- }
- function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
- //copy missing elements at this level
- if (copyThisLevel) {
- for (var _key in src) {
- if (src.hasOwnProperty(_key) && !dest.hasOwnProperty(_key)) {
- dest[_key] = src[_key];
- }
- }
- }
- for (var _key2 in mask) {
- if (dest[_key2] !== undefined && dest[_key2] !== null && src !== undefined && src !== null) {
- //traverse into objects as needed
- copyMissingDataWithMask(src[_key2], dest[_key2], mask[_key2], true);
- }
- }
- }
- function handleOfflineSort(a, b, sorts) {
- var order = sorts[0];
- var operator = (0, _slice.default)(order).call(order, 0, 1);
- var isDescending = operator === '-';
- if (isDescending) {
- order = order.substring(1);
- }
- if (order === '_created_at') {
- order = 'createdAt';
- }
- if (order === '_updated_at') {
- order = 'updatedAt';
- }
- if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(order) || order === 'password') {
- throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, "Invalid Key: ".concat(order));
- }
- var field1 = a.get(order);
- var field2 = b.get(order);
- if (field1 < field2) {
- return isDescending ? 1 : -1;
- }
- if (field1 > field2) {
- return isDescending ? -1 : 1;
- }
- if (sorts.length > 1) {
- var remainingSorts = (0, _slice.default)(sorts).call(sorts, 1);
- return handleOfflineSort(a, b, remainingSorts);
- }
- return 0;
- }
- /**
- * Creates a new parse Parse.Query for the given Parse.Object subclass.
- *
- * <p>Parse.Query defines a query that is used to fetch Parse.Objects. The
- * most common use case is finding all objects that match a query through the
- * <code>find</code> method. for example, this sample code fetches all objects
- * of class <code>myclass</code>. it calls a different function depending on
- * whether the fetch succeeded or not.
- *
- * <pre>
- * var query = new Parse.Query(myclass);
- * query.find().then((results) => {
- * // results is an array of parse.object.
- * }).catch((error) => {
- * // error is an instance of parse.error.
- * });</pre></p>
- *
- * <p>a Parse.Query can also be used to retrieve a single object whose id is
- * known, through the get method. for example, this sample code fetches an
- * object of class <code>myclass</code> and id <code>myid</code>. it calls a
- * different function depending on whether the fetch succeeded or not.
- *
- * <pre>
- * var query = new Parse.Query(myclass);
- * query.get(myid).then((object) => {
- * // object is an instance of parse.object.
- * }).catch((error) => {
- * // error is an instance of parse.error.
- * });</pre></p>
- *
- * <p>a Parse.Query can also be used to count the number of objects that match
- * the query without retrieving all of those objects. for example, this
- * sample code counts the number of objects of the class <code>myclass</code>
- * <pre>
- * var query = new Parse.Query(myclass);
- * query.count().then((number) => {
- * // there are number instances of myclass.
- * }).catch((error) => {
- * // error is an instance of Parse.Error.
- * });</pre></p>
- *
- * @alias Parse.Query
- */
- var ParseQuery = /*#__PURE__*/function () {
- /**
- * @property {string} className
- */
- /**
- * @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.
- */
- function ParseQuery(objectClass
- /*: string | ParseObject*/
- ) {
- (0, _classCallCheck2.default)(this, ParseQuery);
- (0, _defineProperty2.default)(this, "className", void 0);
- (0, _defineProperty2.default)(this, "_where", void 0);
- (0, _defineProperty2.default)(this, "_include", void 0);
- (0, _defineProperty2.default)(this, "_exclude", void 0);
- (0, _defineProperty2.default)(this, "_select", void 0);
- (0, _defineProperty2.default)(this, "_limit", void 0);
- (0, _defineProperty2.default)(this, "_skip", void 0);
- (0, _defineProperty2.default)(this, "_count", void 0);
- (0, _defineProperty2.default)(this, "_order", void 0);
- (0, _defineProperty2.default)(this, "_readPreference", void 0);
- (0, _defineProperty2.default)(this, "_includeReadPreference", void 0);
- (0, _defineProperty2.default)(this, "_subqueryReadPreference", void 0);
- (0, _defineProperty2.default)(this, "_queriesLocalDatastore", void 0);
- (0, _defineProperty2.default)(this, "_localDatastorePinName", void 0);
- (0, _defineProperty2.default)(this, "_extraOptions", void 0);
- (0, _defineProperty2.default)(this, "_hint", void 0);
- (0, _defineProperty2.default)(this, "_explain", void 0);
- (0, _defineProperty2.default)(this, "_xhrRequest", void 0);
- if (typeof objectClass === 'string') {
- if (objectClass === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
- this.className = '_User';
- } else {
- this.className = objectClass;
- }
- } else if (objectClass instanceof _ParseObject.default) {
- this.className = objectClass.className;
- } else if (typeof objectClass === 'function') {
- if (typeof objectClass.className === 'string') {
- this.className = objectClass.className;
- } else {
- var _obj2 = new objectClass();
- this.className = _obj2.className;
- }
- } else {
- throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
- }
- this._where = {};
- this._include = [];
- this._exclude = [];
- this._count = false;
- this._limit = -1; // negative limit is not sent in the server request
- this._skip = 0;
- this._readPreference = null;
- this._includeReadPreference = null;
- this._subqueryReadPreference = null;
- this._queriesLocalDatastore = false;
- this._localDatastorePinName = null;
- this._extraOptions = {};
- this._xhrRequest = {
- task: null,
- onchange: function () {}
- };
- }
- /**
- * Adds constraint that at least one of the passed in queries matches.
- *
- * @param {Array} queries
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- (0, _createClass2.default)(ParseQuery, [{
- key: "_orQuery",
- value: function (queries
- /*: Array<ParseQuery>*/
- )
- /*: ParseQuery*/
- {
- var queryJSON = (0, _map2.default)(queries).call(queries, function (q) {
- return q.toJSON().where;
- });
- this._where.$or = queryJSON;
- return this;
- }
- /**
- * Adds constraint that all of the passed in queries match.
- *
- * @param {Array} queries
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "_andQuery",
- value: function (queries
- /*: Array<ParseQuery>*/
- )
- /*: ParseQuery*/
- {
- var queryJSON = (0, _map2.default)(queries).call(queries, function (q) {
- return q.toJSON().where;
- });
- this._where.$and = queryJSON;
- return this;
- }
- /**
- * Adds constraint that none of the passed in queries match.
- *
- * @param {Array} queries
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "_norQuery",
- value: function (queries
- /*: Array<ParseQuery>*/
- )
- /*: ParseQuery*/
- {
- var queryJSON = (0, _map2.default)(queries).call(queries, function (q) {
- return q.toJSON().where;
- });
- this._where.$nor = queryJSON;
- return this;
- }
- /**
- * Helper for condition queries
- *
- * @param key
- * @param condition
- * @param value
- * @returns {Parse.Query}
- */
- }, {
- key: "_addCondition",
- value: function (key
- /*: string*/
- , condition
- /*: string*/
- , value
- /*: mixed*/
- )
- /*: ParseQuery*/
- {
- if (!this._where[key] || typeof this._where[key] === 'string') {
- this._where[key] = {};
- }
- this._where[key][condition] = (0, _encode.default)(value, false, true);
- return this;
- }
- /**
- * Converts string for regular expression at the beginning
- *
- * @param string
- * @returns {string}
- */
- }, {
- key: "_regexStartWith",
- value: function (string
- /*: string*/
- )
- /*: string*/
- {
- return '^' + quote(string);
- }
- }, {
- key: "_handleOfflineQuery",
- value: function () {
- var _handleOfflineQuery2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params
- /*: any*/
- ) {
- var _context,
- _this2 = this;
- var localDatastore, objects, results, keys, alwaysSelectedKeys, sorts, count, limit;
- return _regeneratorRuntime().wrap(function (_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- _OfflineQuery.default.validateQuery(this);
- localDatastore = _CoreManager.default.getLocalDatastore();
- _context3.next = 4;
- return localDatastore._serializeObjectsFromPinName(this._localDatastorePinName);
- case 4:
- objects = _context3.sent;
- results = (0, _filter2.default)(_context = (0, _map2.default)(objects).call(objects, function (json, index, arr) {
- var object = _ParseObject.default.fromJSON(json, false);
- if (json._localId && !json.objectId) {
- object._localId = json._localId;
- }
- if (!_OfflineQuery.default.matchesQuery(_this2.className, object, arr, _this2)) {
- return null;
- }
- return object;
- })).call(_context, function (object) {
- return object !== null;
- });
- if ((0, _keys.default)(params)) {
- keys = (0, _keys.default)(params).split(',');
- alwaysSelectedKeys = ['className', 'objectId', 'createdAt', 'updatedAt', 'ACL'];
- keys = (0, _concat.default)(keys).call(keys, alwaysSelectedKeys);
- results = (0, _map2.default)(results).call(results, function (object) {
- var _context2;
- var json = object._toFullJSON();
- (0, _forEach.default)(_context2 = (0, _keys2.default)(json)).call(_context2, function (key) {
- if (!(0, _includes.default)(keys).call(keys, key)) {
- delete json[key];
- }
- });
- return _ParseObject.default.fromJSON(json, false);
- });
- }
- if (params.order) {
- sorts = params.order.split(',');
- (0, _sort.default)(results).call(results, function (a, b) {
- return handleOfflineSort(a, b, sorts);
- });
- } // count total before applying limit/skip
- if (params.count) {
- count = results.length; // total count from response
- }
- if (params.skip) {
- if (params.skip >= results.length) {
- results = [];
- } else {
- results = (0, _splice.default)(results).call(results, params.skip, results.length);
- }
- }
- limit = results.length;
- if (params.limit !== 0 && params.limit < results.length) {
- limit = params.limit;
- }
- results = (0, _splice.default)(results).call(results, 0, limit);
- if (!(typeof count === 'number')) {
- _context3.next = 15;
- break;
- }
- return _context3.abrupt("return", {
- results: results,
- count: count
- });
- case 15:
- return _context3.abrupt("return", results);
- case 16:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee, this);
- }));
- function _handleOfflineQuery() {
- return _handleOfflineQuery2.apply(this, arguments);
- }
- return _handleOfflineQuery;
- }()
- /**
- * Returns a JSON representation of this query.
- *
- * @returns {object} The JSON representation of the query.
- */
- }, {
- key: "toJSON",
- value: function ()
- /*: QueryJSON*/
- {
- var params
- /*: QueryJSON*/
- = {
- where: this._where
- };
- if (this._include.length) {
- params.include = this._include.join(',');
- }
- if (this._exclude.length) {
- params.excludeKeys = this._exclude.join(',');
- }
- if (this._select) {
- params.keys = this._select.join(',');
- }
- if (this._count) {
- params.count = 1;
- }
- if (this._limit >= 0) {
- params.limit = this._limit;
- }
- if (this._skip > 0) {
- params.skip = this._skip;
- }
- if (this._order) {
- params.order = this._order.join(',');
- }
- if (this._readPreference) {
- params.readPreference = this._readPreference;
- }
- if (this._includeReadPreference) {
- params.includeReadPreference = this._includeReadPreference;
- }
- if (this._subqueryReadPreference) {
- params.subqueryReadPreference = this._subqueryReadPreference;
- }
- if (this._hint) {
- params.hint = this._hint;
- }
- if (this._explain) {
- params.explain = true;
- }
- for (var _key3 in this._extraOptions) {
- params[_key3] = this._extraOptions[_key3];
- }
- return params;
- }
- /**
- * Return a query with conditions from json, can be useful to send query from server side to client
- * Not static, all query conditions was set before calling this method will be deleted.
- * For example on the server side we have
- * var query = new Parse.Query("className");
- * query.equalTo(key: value);
- * query.limit(100);
- * ... (others queries)
- * Create JSON representation of Query Object
- * var jsonFromServer = query.fromJSON();
- *
- * On client side getting query:
- * var query = new Parse.Query("className");
- * query.fromJSON(jsonFromServer);
- *
- * and continue to query...
- * query.skip(100).find().then(...);
- *
- * @param {QueryJSON} json from Parse.Query.toJSON() method
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "withJSON",
- value: function (json
- /*: QueryJSON*/
- )
- /*: ParseQuery*/
- {
- if (json.where) {
- this._where = json.where;
- }
- if (json.include) {
- this._include = json.include.split(',');
- }
- if ((0, _keys.default)(json)) {
- this._select = (0, _keys.default)(json).split(',');
- }
- if (json.excludeKeys) {
- this._exclude = json.excludeKeys.split(',');
- }
- if (json.count) {
- this._count = json.count === 1;
- }
- if (json.limit) {
- this._limit = json.limit;
- }
- if (json.skip) {
- this._skip = json.skip;
- }
- if (json.order) {
- this._order = json.order.split(',');
- }
- if (json.readPreference) {
- this._readPreference = json.readPreference;
- }
- if (json.includeReadPreference) {
- this._includeReadPreference = json.includeReadPreference;
- }
- if (json.subqueryReadPreference) {
- this._subqueryReadPreference = json.subqueryReadPreference;
- }
- if (json.hint) {
- this._hint = json.hint;
- }
- if (json.explain) {
- this._explain = !!json.explain;
- }
- for (var _key4 in json) {
- if (json.hasOwnProperty(_key4)) {
- var _context4;
- if ((0, _indexOf.default)(_context4 = ['where', 'include', 'keys', 'count', 'limit', 'skip', 'order', 'readPreference', 'includeReadPreference', 'subqueryReadPreference', 'hint', 'explain']).call(_context4, _key4) === -1) {
- this._extraOptions[_key4] = json[_key4];
- }
- }
- }
- return this;
- }
- /**
- * Static method to restore Parse.Query by json representation
- * Internally calling Parse.Query.withJSON
- *
- * @param {string} className
- * @param {QueryJSON} json from Parse.Query.toJSON() method
- * @returns {Parse.Query} new created query
- */
- }, {
- key: "get",
- value:
- /**
- * Constructs a Parse.Object whose id is already known by fetching data from
- * the server. Unlike the <code>first</code> method, it never returns undefined.
- *
- * @param {string} objectId The id of the object to be fetched.
- * @param {object} options
- * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
- * <li>json: Return raw json without converting to Parse.Object
- * </ul>
- *
- * @returns {Promise} A promise that is resolved with the result when
- * the query completes.
- */
- function (objectId
- /*: string*/
- , options
- /*:: ?: FullOptions*/
- )
- /*: Promise<ParseObject>*/
- {
- this.equalTo('objectId', objectId);
- var firstOptions = {};
- if (options && options.hasOwnProperty('useMasterKey')) {
- firstOptions.useMasterKey = options.useMasterKey;
- }
- if (options && options.hasOwnProperty('sessionToken')) {
- firstOptions.sessionToken = options.sessionToken;
- }
- if (options && options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
- firstOptions.context = options.context;
- }
- if (options && options.hasOwnProperty('json')) {
- firstOptions.json = options.json;
- }
- return this.first(firstOptions).then(function (response) {
- if (response) {
- return response;
- }
- var errorObject = new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'Object not found.');
- return _promise.default.reject(errorObject);
- });
- }
- /**
- * Retrieves a list of ParseObjects that satisfy this query.
- *
- * @param {object} options Valid options
- * are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
- * <li>json: Return raw json without converting to Parse.Object
- * </ul>
- *
- * @returns {Promise} A promise that is resolved with the results when
- * the query completes.
- */
- }, {
- key: "find",
- value: function (options
- /*:: ?: FullOptions*/
- )
- /*: Promise<Array<ParseObject>>*/
- {
- var _this3 = this;
- options = options || {};
- var findOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- findOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('sessionToken')) {
- findOptions.sessionToken = options.sessionToken;
- }
- if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
- findOptions.context = options.context;
- }
- this._setRequestTask(findOptions);
- var controller = _CoreManager.default.getQueryController();
- var select = this._select;
- if (this._queriesLocalDatastore) {
- return this._handleOfflineQuery(this.toJSON());
- }
- return (0, _find.default)(controller).call(controller, this.className, this.toJSON(), findOptions).then(function (response) {
- var _context5; // Return generic object when explain is used
- if (_this3._explain) {
- return response.results;
- }
- var results = (0, _map2.default)(_context5 = response.results).call(_context5, function (data) {
- // In cases of relations, the server may send back a className
- // on the top level of the payload
- var override = response.className || _this3.className;
- if (!data.className) {
- data.className = override;
- } // Make sure the data object contains keys for all objects that
- // have been requested with a select, so that our cached state
- // updates correctly.
- if (select) {
- handleSelectResult(data, select);
- }
- if (options.json) {
- return data;
- } else {
- return _ParseObject.default.fromJSON(data, !select);
- }
- });
- var count = response.count;
- if (typeof count === 'number') {
- return {
- results: results,
- count: count
- };
- } else {
- return results;
- }
- });
- }
- /**
- * Retrieves a complete list of ParseObjects that satisfy this query.
- * Using `eachBatch` under the hood to fetch all the valid objects.
- *
- * @param {object} options Valid options are:<ul>
- * <li>batchSize: How many objects to yield in each batch (default: 100)
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * </ul>
- * @returns {Promise} A promise that is resolved with the results when
- * the query completes.
- */
- }, {
- key: "findAll",
- value: function () {
- var _findAll = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options
- /*:: ?: BatchOptions*/
- ) {
- var result;
- return _regeneratorRuntime().wrap(function _callee2$(_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- result
- /*: ParseObject[]*/
- = [];
- _context7.next = 3;
- return this.eachBatch(function (objects
- /*: ParseObject[]*/
- ) {
- var _context6;
- result = (0, _concat.default)(_context6 = []).call(_context6, (0, _toConsumableArray2.default)(result), (0, _toConsumableArray2.default)(objects));
- }, options);
- case 3:
- return _context7.abrupt("return", result);
- case 4:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee2, this);
- }));
- function findAll(_x2) {
- return _findAll.apply(this, arguments);
- }
- return findAll;
- }()
- /**
- * Counts the number of objects that match this query.
- *
- * @param {object} options
- * Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * </ul>
- *
- * @returns {Promise} A promise that is resolved with the count when
- * the query completes.
- */
- }, {
- key: "count",
- value: function count(options
- /*:: ?: FullOptions*/
- )
- /*: Promise<number>*/
- {
- options = options || {};
- var findOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- findOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('sessionToken')) {
- findOptions.sessionToken = options.sessionToken;
- }
- this._setRequestTask(findOptions);
- var controller = _CoreManager.default.getQueryController();
- var params = this.toJSON();
- params.limit = 0;
- params.count = 1;
- return (0, _find.default)(controller).call(controller, this.className, params, findOptions).then(function (result) {
- return result.count;
- });
- }
- /**
- * Executes a distinct query and returns unique values
- *
- * @param {string} key A field to find distinct values
- * @param {object} options
- * Valid options are:<ul>
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * </ul>
- *
- * @returns {Promise} A promise that is resolved with the query completes.
- */
- }, {
- key: "distinct",
- value: function distinct(key
- /*: string*/
- , options
- /*:: ?: FullOptions*/
- )
- /*: Promise<Array<mixed>>*/
- {
- options = options || {};
- var distinctOptions = {};
- distinctOptions.useMasterKey = true;
- if (options.hasOwnProperty('sessionToken')) {
- distinctOptions.sessionToken = options.sessionToken;
- }
- this._setRequestTask(distinctOptions);
- var controller = _CoreManager.default.getQueryController();
- var params = {
- distinct: key,
- where: this._where,
- hint: this._hint
- };
- return controller.aggregate(this.className, params, distinctOptions).then(function (results) {
- return results.results;
- });
- }
- /**
- * Executes an aggregate query and returns aggregate results
- *
- * @param {(Array|object)} pipeline Array or Object of stages to process query
- * @param {object} options Valid options are:<ul>
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * </ul>
- *
- * @returns {Promise} A promise that is resolved with the query completes.
- */
- }, {
- key: "aggregate",
- value: function aggregate(pipeline
- /*: mixed*/
- , options
- /*:: ?: FullOptions*/
- )
- /*: Promise<Array<mixed>>*/
- {
- options = options || {};
- var aggregateOptions = {};
- aggregateOptions.useMasterKey = true;
- if (options.hasOwnProperty('sessionToken')) {
- aggregateOptions.sessionToken = options.sessionToken;
- }
- this._setRequestTask(aggregateOptions);
- var controller = _CoreManager.default.getQueryController();
- if (!(0, _isArray.default)(pipeline) && (0, _typeof2.default)(pipeline) !== 'object') {
- throw new Error('Invalid pipeline must be Array or Object');
- }
- if ((0, _keys2.default)(this._where || {}).length) {
- if (!(0, _isArray.default)(pipeline)) {
- pipeline = [pipeline];
- }
- pipeline.unshift({
- match: this._where
- });
- }
- var params = {
- pipeline: pipeline,
- hint: this._hint,
- explain: this._explain,
- readPreference: this._readPreference
- };
- return controller.aggregate(this.className, params, aggregateOptions).then(function (results) {
- return results.results;
- });
- }
- /**
- * Retrieves at most one Parse.Object that satisfies this query.
- *
- * Returns the object if there is one, otherwise undefined.
- *
- * @param {object} options Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
- * <li>json: Return raw json without converting to Parse.Object
- * </ul>
- *
- * @returns {Promise} A promise that is resolved with the object when
- * the query completes.
- */
- }, {
- key: "first",
- value: function first(options
- /*:: ?: FullOptions*/
- )
- /*: Promise<ParseObject | void>*/
- {
- var _this4 = this;
- options = options || {};
- var findOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- findOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('sessionToken')) {
- findOptions.sessionToken = options.sessionToken;
- }
- if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
- findOptions.context = options.context;
- }
- this._setRequestTask(findOptions);
- var controller = _CoreManager.default.getQueryController();
- var params = this.toJSON();
- params.limit = 1;
- var select = this._select;
- if (this._queriesLocalDatastore) {
- return this._handleOfflineQuery(params).then(function (objects) {
- if (!objects[0]) {
- return undefined;
- }
- return objects[0];
- });
- }
- return (0, _find.default)(controller).call(controller, this.className, params, findOptions).then(function (response) {
- var objects = response.results;
- if (!objects[0]) {
- return undefined;
- }
- if (!objects[0].className) {
- objects[0].className = _this4.className;
- } // Make sure the data object contains keys for all objects that
- // have been requested with a select, so that our cached state
- // updates correctly.
- if (select) {
- handleSelectResult(objects[0], select);
- }
- if (options.json) {
- return objects[0];
- } else {
- return _ParseObject.default.fromJSON(objects[0], !select);
- }
- });
- }
- /**
- * Iterates over objects matching a query, calling a callback for each batch.
- * If the callback returns a promise, the iteration will not continue until
- * that promise has been fulfilled. If the callback returns a rejected
- * promise, then iteration will stop with that error. The items are processed
- * in an unspecified order. The query may not have any sort order, and may
- * not use limit or skip.
- *
- * @param {Function} callback Callback that will be called with each result
- * of the query.
- * @param {object} options Valid options are:<ul>
- * <li>batchSize: How many objects to yield in each batch (default: 100)
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
- * </ul>
- * @returns {Promise} A promise that will be fulfilled once the
- * iteration has completed.
- */
- }, {
- key: "eachBatch",
- value: function eachBatch(callback
- /*: (objs: Array<ParseObject>) => Promise<*>*/
- , options
- /*:: ?: BatchOptions*/
- )
- /*: Promise<void>*/
- {
- var _context8;
- options = options || {};
- if (this._order || this._skip || this._limit >= 0) {
- var error = 'Cannot iterate on a query with sort, skip, or limit.';
- return _promise.default.reject(error);
- }
- var query = new ParseQuery(this.className);
- query._limit = options.batchSize || 100;
- query._include = (0, _map2.default)(_context8 = this._include).call(_context8, function (i) {
- return i;
- });
- if (this._select) {
- var _context9;
- query._select = (0, _map2.default)(_context9 = this._select).call(_context9, function (s) {
- return s;
- });
- }
- query._hint = this._hint;
- query._where = {};
- for (var _attr in this._where) {
- var val = this._where[_attr];
- if ((0, _isArray.default)(val)) {
- query._where[_attr] = (0, _map2.default)(val).call(val, function (v) {
- return v;
- });
- } else if (val && (0, _typeof2.default)(val) === 'object') {
- var conditionMap = {};
- query._where[_attr] = conditionMap;
- for (var cond in val) {
- conditionMap[cond] = val[cond];
- }
- } else {
- query._where[_attr] = val;
- }
- }
- query.ascending('objectId');
- var findOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- findOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('sessionToken')) {
- findOptions.sessionToken = options.sessionToken;
- }
- if (options.hasOwnProperty('context') && (0, _typeof2.default)(options.context) === 'object') {
- findOptions.context = options.context;
- }
- if (options.hasOwnProperty('json')) {
- findOptions.json = options.json;
- }
- var finished = false;
- var previousResults = [];
- return (0, _promiseUtils.continueWhile)(function () {
- return !finished;
- }, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
- var _yield$Promise$all, _yield$Promise$all2, results;
- return _regeneratorRuntime().wrap(function _callee3$(_context10) {
- while (1) {
- switch (_context10.prev = _context10.next) {
- case 0:
- _context10.next = 2;
- return _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);
- case 2:
- _yield$Promise$all = _context10.sent;
- _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
- results = _yield$Promise$all2[0];
- if (!(results.length >= query._limit)) {
- _context10.next = 10;
- break;
- }
- query.greaterThan('objectId', results[results.length - 1].id);
- previousResults = results;
- _context10.next = 17;
- break;
- case 10:
- if (!(results.length > 0)) {
- _context10.next = 16;
- break;
- }
- _context10.next = 13;
- return _promise.default.resolve(callback(results));
- case 13:
- finished = true;
- _context10.next = 17;
- break;
- case 16:
- finished = true;
- case 17:
- case "end":
- return _context10.stop();
- }
- }
- }, _callee3);
- })));
- }
- /**
- * Iterates over each result of a query, calling a callback for each one. If
- * the callback returns a promise, the iteration will not continue until
- * that promise has been fulfilled. If the callback returns a rejected
- * promise, then iteration will stop with that error. The items are
- * processed in an unspecified order. The query may not have any sort order,
- * and may not use limit or skip.
- *
- * @param {Function} callback Callback that will be called with each result
- * of the query.
- * @param {object} options Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * <li>json: Return raw json without converting to Parse.Object
- * </ul>
- * @returns {Promise} A promise that will be fulfilled once the
- * iteration has completed.
- */
- }, {
- key: "each",
- value: function each(callback
- /*: (obj: ParseObject) => any*/
- , options
- /*:: ?: BatchOptions*/
- )
- /*: Promise<void>*/
- {
- return this.eachBatch(function (results) {
- var callbacksDone = _promise.default.resolve();
- (0, _forEach.default)(results).call(results, function (result) {
- callbacksDone = callbacksDone.then(function () {
- return callback(result);
- });
- });
- return callbacksDone;
- }, options);
- }
- /**
- * Adds a hint to force index selection. (https://docs.mongodb.com/manual/reference/operator/meta/hint/)
- *
- * @param {(string|object)} value String or Object of index that should be used when executing query
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "hint",
- value: function hint(value
- /*: mixed*/
- )
- /*: ParseQuery*/
- {
- if (typeof value === 'undefined') {
- delete this._hint;
- }
- this._hint = value;
- return this;
- }
- /**
- * Investigates the query execution plan. Useful for optimizing queries. (https://docs.mongodb.com/manual/reference/operator/meta/explain/)
- *
- * @param {boolean} explain Used to toggle the information on the query plan.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "explain",
- value: function explain()
- /*: ParseQuery*/
- {
- var _explain
- /*: boolean*/
- = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
- if (typeof _explain !== 'boolean') {
- throw new Error('You can only set explain to a boolean value');
- }
- this._explain = _explain;
- return this;
- }
- /**
- * Iterates over each result of a query, calling a callback for each one. If
- * the callback returns a promise, the iteration will not continue until
- * that promise has been fulfilled. If the callback returns a rejected
- * promise, then iteration will stop with that error. The items are
- * processed in an unspecified order. The query may not have any sort order,
- * and may not use limit or skip.
- *
- * @param {Function} callback Callback <ul>
- * <li>currentObject: The current Parse.Object being processed in the array.</li>
- * <li>index: The index of the current Parse.Object being processed in the array.</li>
- * <li>query: The query map was called upon.</li>
- * </ul>
- *
- * @param {object} options Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * </ul>
- * @returns {Promise} A promise that will be fulfilled once the
- * iteration has completed.
- */
- }, {
- key: "map",
- value: function () {
- var _map = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(callback
- /*: (currentObject: ParseObject, index: number, query: ParseQuery) => any*/
- , options
- /*:: ?: BatchOptions*/
- ) {
- var _this5 = this;
- var array, index;
- return _regeneratorRuntime().wrap(function _callee4$(_context11) {
- while (1) {
- switch (_context11.prev = _context11.next) {
- case 0:
- array = [];
- index = 0;
- _context11.next = 4;
- return this.each(function (object) {
- return _promise.default.resolve(callback(object, index, _this5)).then(function (result) {
- array.push(result);
- index += 1;
- });
- }, options);
- case 4:
- return _context11.abrupt("return", array);
- case 5:
- case "end":
- return _context11.stop();
- }
- }
- }, _callee4, this);
- }));
- function map(_x3, _x4) {
- return _map.apply(this, arguments);
- }
- return map;
- }()
- /**
- * Iterates over each result of a query, calling a callback for each one. If
- * the callback returns a promise, the iteration will not continue until
- * that promise has been fulfilled. If the callback returns a rejected
- * promise, then iteration will stop with that error. The items are
- * processed in an unspecified order. The query may not have any sort order,
- * and may not use limit or skip.
- *
- * @param {Function} callback Callback <ul>
- * <li>accumulator: The accumulator accumulates the callback's return values. It is the accumulated value previously returned in the last invocation of the callback.</li>
- * <li>currentObject: The current Parse.Object being processed in the array.</li>
- * <li>index: The index of the current Parse.Object being processed in the array.</li>
- * </ul>
- * @param {*} initialValue A value to use as the first argument to the first call of the callback. If no initialValue is supplied, the first object in the query will be used and skipped.
- * @param {object} options Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * </ul>
- * @returns {Promise} A promise that will be fulfilled once the
- * iteration has completed.
- */
- }, {
- key: "reduce",
- value: function () {
- var _reduce = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(callback
- /*: (accumulator: any, currentObject: ParseObject, index: number) => any*/
- , initialValue
- /*: any*/
- , options
- /*:: ?: BatchOptions*/
- ) {
- var accumulator, index;
- return _regeneratorRuntime().wrap(function _callee5$(_context12) {
- while (1) {
- switch (_context12.prev = _context12.next) {
- case 0:
- accumulator = initialValue;
- index = 0;
- _context12.next = 4;
- return this.each(function (object) {
- // If no initial value was given, we take the first object from the query
- // as the initial value and don't call the callback with it.
- if (index === 0 && initialValue === undefined) {
- accumulator = object;
- index += 1;
- return;
- }
- return _promise.default.resolve(callback(accumulator, object, index)).then(function (result) {
- accumulator = result;
- index += 1;
- });
- }, options);
- case 4:
- if (!(index === 0 && initialValue === undefined)) {
- _context12.next = 6;
- break;
- }
- throw new TypeError('Reducing empty query result set with no initial value');
- case 6:
- return _context12.abrupt("return", accumulator);
- case 7:
- case "end":
- return _context12.stop();
- }
- }
- }, _callee5, this);
- }));
- function reduce(_x5, _x6, _x7) {
- return _reduce.apply(this, arguments);
- }
- return reduce;
- }()
- /**
- * Iterates over each result of a query, calling a callback for each one. If
- * the callback returns a promise, the iteration will not continue until
- * that promise has been fulfilled. If the callback returns a rejected
- * promise, then iteration will stop with that error. The items are
- * processed in an unspecified order. The query may not have any sort order,
- * and may not use limit or skip.
- *
- * @param {Function} callback Callback <ul>
- * <li>currentObject: The current Parse.Object being processed in the array.</li>
- * <li>index: The index of the current Parse.Object being processed in the array.</li>
- * <li>query: The query filter was called upon.</li>
- * </ul>
- *
- * @param {object} options Valid options are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * <li>sessionToken: A valid session token, used for making a request on
- * behalf of a specific user.
- * </ul>
- * @returns {Promise} A promise that will be fulfilled once the
- * iteration has completed.
- */
- }, {
- key: "filter",
- value: function () {
- var _filter = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(callback
- /*: (currentObject: ParseObject, index: number, query: ParseQuery) => boolean*/
- , options
- /*:: ?: BatchOptions*/
- ) {
- var _this6 = this;
- var array, index;
- return _regeneratorRuntime().wrap(function _callee6$(_context13) {
- while (1) {
- switch (_context13.prev = _context13.next) {
- case 0:
- array = [];
- index = 0;
- _context13.next = 4;
- return this.each(function (object) {
- return _promise.default.resolve(callback(object, index, _this6)).then(function (flag) {
- if (flag) {
- array.push(object);
- }
- index += 1;
- });
- }, options);
- case 4:
- return _context13.abrupt("return", array);
- case 5:
- case "end":
- return _context13.stop();
- }
- }
- }, _callee6, this);
- }));
- function filter(_x8, _x9) {
- return _filter.apply(this, arguments);
- }
- return filter;
- }()
- /** Query Conditions **/
- /**
- * Adds a constraint to the query that requires a particular key's value to
- * be equal to the provided value.
- *
- * @param {string} key The key to check.
- * @param value The value that the Parse.Object must contain.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "equalTo",
- value: function equalTo(key
- /*: string | { [key: string]: any }*/
- , value
- /*: ?mixed*/
- )
- /*: ParseQuery*/
- {
- var _this7 = this;
- if (key && (0, _typeof2.default)(key) === 'object') {
- var _context14;
- (0, _forEach.default)(_context14 = (0, _entries.default)(key)).call(_context14, function (_ref2) {
- var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
- k = _ref3[0],
- val = _ref3[1];
- return _this7.equalTo(k, val);
- });
- return this;
- }
- if (typeof value === 'undefined') {
- return this.doesNotExist(key);
- }
- this._where[key] = (0, _encode.default)(value, false, true);
- return this;
- }
- /**
- * Adds a constraint to the query that requires a particular key's value to
- * be not equal to the provided value.
- *
- * @param {string} key The key to check.
- * @param value The value that must not be equalled.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "notEqualTo",
- value: function notEqualTo(key
- /*: string | { [key: string]: any }*/
- , value
- /*: ?mixed*/
- )
- /*: ParseQuery*/
- {
- var _this8 = this;
- if (key && (0, _typeof2.default)(key) === 'object') {
- var _context15;
- (0, _forEach.default)(_context15 = (0, _entries.default)(key)).call(_context15, function (_ref4) {
- var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
- k = _ref5[0],
- val = _ref5[1];
- return _this8.notEqualTo(k, val);
- });
- return this;
- }
- return this._addCondition(key, '$ne', value);
- }
- /**
- * Adds a constraint to the query that requires a particular key's value to
- * be less than the provided value.
- *
- * @param {string} key The key to check.
- * @param value The value that provides an upper bound.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "lessThan",
- value: function lessThan(key
- /*: string*/
- , value
- /*: mixed*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$lt', value);
- }
- /**
- * Adds a constraint to the query that requires a particular key's value to
- * be greater than the provided value.
- *
- * @param {string} key The key to check.
- * @param value The value that provides an lower bound.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "greaterThan",
- value: function greaterThan(key
- /*: string*/
- , value
- /*: mixed*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$gt', value);
- }
- /**
- * Adds a constraint to the query that requires a particular key's value to
- * be less than or equal to the provided value.
- *
- * @param {string} key The key to check.
- * @param value The value that provides an upper bound.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "lessThanOrEqualTo",
- value: function lessThanOrEqualTo(key
- /*: string*/
- , value
- /*: mixed*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$lte', value);
- }
- /**
- * Adds a constraint to the query that requires a particular key's value to
- * be greater than or equal to the provided value.
- *
- * @param {string} key The key to check.
- * @param {*} value The value that provides an lower bound.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "greaterThanOrEqualTo",
- value: function greaterThanOrEqualTo(key
- /*: string*/
- , value
- /*: mixed*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$gte', value);
- }
- /**
- * Adds a constraint to the query that requires a particular key's value to
- * be contained in the provided list of values.
- *
- * @param {string} key The key to check.
- * @param {*} value The values that will match.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "containedIn",
- value: function containedIn(key
- /*: string*/
- , value
- /*: mixed*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$in', value);
- }
- /**
- * Adds a constraint to the query that requires a particular key's value to
- * not be contained in the provided list of values.
- *
- * @param {string} key The key to check.
- * @param {*} value The values that will not match.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "notContainedIn",
- value: function notContainedIn(key
- /*: string*/
- , value
- /*: mixed*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$nin', value);
- }
- /**
- * Adds a constraint to the query that requires a particular key's value to
- * be contained by the provided list of values. Get objects where all array elements match.
- *
- * @param {string} key The key to check.
- * @param {Array} values The values that will match.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "containedBy",
- value: function containedBy(key
- /*: string*/
- , values
- /*: Array<mixed>*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$containedBy', values);
- }
- /**
- * Adds a constraint to the query that requires a particular key's value to
- * contain each one of the provided list of values.
- *
- * @param {string} key The key to check. This key's value must be an array.
- * @param {Array} values The values that will match.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "containsAll",
- value: function containsAll(key
- /*: string*/
- , values
- /*: Array<mixed>*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$all', values);
- }
- /**
- * Adds a constraint to the query that requires a particular key's value to
- * contain each one of the provided list of values starting with given strings.
- *
- * @param {string} key The key to check. This key's value must be an array.
- * @param {Array<string>} values The string values that will match as starting string.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "containsAllStartingWith",
- value: function containsAllStartingWith(key
- /*: string*/
- , values
- /*: Array<string>*/
- )
- /*: ParseQuery*/
- {
- var _this = this;
- if (!(0, _isArray.default)(values)) {
- values = [values];
- }
- var regexObject = (0, _map2.default)(values).call(values, function (value) {
- return {
- $regex: _this._regexStartWith(value)
- };
- });
- return this.containsAll(key, regexObject);
- }
- /**
- * Adds a constraint for finding objects that contain the given key.
- *
- * @param {string} key The key that should exist.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "exists",
- value: function exists(key
- /*: string*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$exists', true);
- }
- /**
- * Adds a constraint for finding objects that do not contain a given key.
- *
- * @param {string} key The key that should not exist
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "doesNotExist",
- value: function doesNotExist(key
- /*: string*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$exists', false);
- }
- /**
- * Adds a regular expression constraint for finding string values that match
- * the provided regular expression.
- * This may be slow for large datasets.
- *
- * @param {string} key The key that the string to match is stored in.
- * @param {RegExp} regex The regular expression pattern to match.
- * @param {string} modifiers The regular expression mode.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "matches",
- value: function matches(key
- /*: string*/
- , regex
- /*: RegExp*/
- , modifiers
- /*: string*/
- )
- /*: ParseQuery*/
- {
- this._addCondition(key, '$regex', regex);
- if (!modifiers) {
- modifiers = '';
- }
- if (regex.ignoreCase) {
- modifiers += 'i';
- }
- if (regex.multiline) {
- modifiers += 'm';
- }
- if (modifiers.length) {
- this._addCondition(key, '$options', modifiers);
- }
- return this;
- }
- /**
- * Adds a constraint that requires that a key's value matches a Parse.Query
- * constraint.
- *
- * @param {string} key The key that the contains the object to match the
- * query.
- * @param {Parse.Query} query The query that should match.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "matchesQuery",
- value: function matchesQuery(key
- /*: string*/
- , query
- /*: ParseQuery*/
- )
- /*: ParseQuery*/
- {
- var queryJSON = query.toJSON();
- queryJSON.className = query.className;
- return this._addCondition(key, '$inQuery', queryJSON);
- }
- /**
- * Adds a constraint that requires that a key's value not matches a
- * Parse.Query constraint.
- *
- * @param {string} key The key that the contains the object to match the
- * query.
- * @param {Parse.Query} query The query that should not match.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "doesNotMatchQuery",
- value: function doesNotMatchQuery(key
- /*: string*/
- , query
- /*: ParseQuery*/
- )
- /*: ParseQuery*/
- {
- var queryJSON = query.toJSON();
- queryJSON.className = query.className;
- return this._addCondition(key, '$notInQuery', queryJSON);
- }
- /**
- * Adds a constraint that requires that a key's value matches a value in
- * an object returned by a different Parse.Query.
- *
- * @param {string} key The key that contains the value that is being
- * matched.
- * @param {string} queryKey The key in the objects returned by the query to
- * match against.
- * @param {Parse.Query} query The query to run.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "matchesKeyInQuery",
- value: function matchesKeyInQuery(key
- /*: string*/
- , queryKey
- /*: string*/
- , query
- /*: ParseQuery*/
- )
- /*: ParseQuery*/
- {
- var queryJSON = query.toJSON();
- queryJSON.className = query.className;
- return this._addCondition(key, '$select', {
- key: queryKey,
- query: queryJSON
- });
- }
- /**
- * Adds a constraint that requires that a key's value not match a value in
- * an object returned by a different Parse.Query.
- *
- * @param {string} key The key that contains the value that is being
- * excluded.
- * @param {string} queryKey The key in the objects returned by the query to
- * match against.
- * @param {Parse.Query} query The query to run.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "doesNotMatchKeyInQuery",
- value: function doesNotMatchKeyInQuery(key
- /*: string*/
- , queryKey
- /*: string*/
- , query
- /*: ParseQuery*/
- )
- /*: ParseQuery*/
- {
- var queryJSON = query.toJSON();
- queryJSON.className = query.className;
- return this._addCondition(key, '$dontSelect', {
- key: queryKey,
- query: queryJSON
- });
- }
- /**
- * Adds a constraint for finding string values that contain a provided
- * string. This may be slow for large datasets.
- *
- * @param {string} key The key that the string to match is stored in.
- * @param {string} substring The substring that the value must contain.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "contains",
- value: function contains(key
- /*: string*/
- , substring
- /*: string*/
- )
- /*: ParseQuery*/
- {
- if (typeof substring !== 'string') {
- throw new Error('The value being searched for must be a string.');
- }
- return this._addCondition(key, '$regex', quote(substring));
- }
- /**
- * Adds a constraint for finding string values that contain a provided
- * string. This may be slow for large datasets. Requires Parse-Server > 2.5.0
- *
- * In order to sort you must use select and ascending ($score is required)
- * <pre>
- * query.fullText('field', 'term');
- * query.ascending('$score');
- * query.select('$score');
- * </pre>
- *
- * To retrieve the weight / rank
- * <pre>
- * object->get('score');
- * </pre>
- *
- * You can define optionals by providing an object as a third parameter
- * <pre>
- * query.fullText('field', 'term', { language: 'es', diacriticSensitive: true });
- * </pre>
- *
- * @param {string} key The key that the string to match is stored in.
- * @param {string} value The string to search
- * @param {object} options (Optional)
- * @param {string} options.language The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer.
- * @param {boolean} options.caseSensitive A boolean flag to enable or disable case sensitive search.
- * @param {boolean} options.diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "fullText",
- value: function fullText(key
- /*: string*/
- , value
- /*: string*/
- , options
- /*: ?Object*/
- )
- /*: ParseQuery*/
- {
- options = options || {};
- if (!key) {
- throw new Error('A key is required.');
- }
- if (!value) {
- throw new Error('A search term is required');
- }
- if (typeof value !== 'string') {
- throw new Error('The value being searched for must be a string.');
- }
- var fullOptions = {};
- fullOptions.$term = value;
- for (var option in options) {
- switch (option) {
- case 'language':
- fullOptions.$language = options[option];
- break;
- case 'caseSensitive':
- fullOptions.$caseSensitive = options[option];
- break;
- case 'diacriticSensitive':
- fullOptions.$diacriticSensitive = options[option];
- break;
- default:
- throw new Error("Unknown option: ".concat(option));
- }
- }
- return this._addCondition(key, '$text', {
- $search: fullOptions
- });
- }
- /**
- * Method to sort the full text search by text score
- *
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "sortByTextScore",
- value: function sortByTextScore() {
- this.ascending('$score');
- this.select(['$score']);
- return this;
- }
- /**
- * Adds a constraint for finding string values that start with a provided
- * string. This query will use the backend index, so it will be fast even
- * for large datasets.
- *
- * @param {string} key The key that the string to match is stored in.
- * @param {string} prefix The substring that the value must start with.
- * @param {string} modifiers The regular expression mode.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "startsWith",
- value: function startsWith(key
- /*: string*/
- , prefix
- /*: string*/
- , modifiers
- /*: string*/
- )
- /*: ParseQuery*/
- {
- if (typeof prefix !== 'string') {
- throw new Error('The value being searched for must be a string.');
- }
- return this.matches(key, this._regexStartWith(prefix), modifiers);
- }
- /**
- * Adds a constraint for finding string values that end with a provided
- * string. This will be slow for large datasets.
- *
- * @param {string} key The key that the string to match is stored in.
- * @param {string} suffix The substring that the value must end with.
- * @param {string} modifiers The regular expression mode.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "endsWith",
- value: function endsWith(key
- /*: string*/
- , suffix
- /*: string*/
- , modifiers
- /*: string*/
- )
- /*: ParseQuery*/
- {
- if (typeof suffix !== 'string') {
- throw new Error('The value being searched for must be a string.');
- }
- return this.matches(key, quote(suffix) + '$', modifiers);
- }
- /**
- * Adds a proximity based constraint for finding objects with key point
- * values near the point given.
- *
- * @param {string} key The key that the Parse.GeoPoint is stored in.
- * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "near",
- value: function near(key
- /*: string*/
- , point
- /*: ParseGeoPoint*/
- )
- /*: ParseQuery*/
- {
- if (!(point instanceof _ParseGeoPoint.default)) {
- // Try to cast it as a GeoPoint
- point = new _ParseGeoPoint.default(point);
- }
- return this._addCondition(key, '$nearSphere', point);
- }
- /**
- * Adds a proximity based constraint for finding objects with key point
- * values near the point given and within the maximum distance given.
- *
- * @param {string} key The key that the Parse.GeoPoint is stored in.
- * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
- * @param {number} maxDistance Maximum distance (in radians) of results to return.
- * @param {boolean} sorted A Bool value that is true if results should be
- * sorted by distance ascending, false is no sorting is required,
- * defaults to true.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "withinRadians",
- value: function withinRadians(key
- /*: string*/
- , point
- /*: ParseGeoPoint*/
- , maxDistance
- /*: number*/
- , sorted
- /*: boolean*/
- )
- /*: ParseQuery*/
- {
- if (sorted || sorted === undefined) {
- this.near(key, point);
- return this._addCondition(key, '$maxDistance', maxDistance);
- } else {
- return this._addCondition(key, '$geoWithin', {
- $centerSphere: [[point.longitude, point.latitude], maxDistance]
- });
- }
- }
- /**
- * Adds a proximity based constraint for finding objects with key point
- * values near the point given and within the maximum distance given.
- * Radius of earth used is 3958.8 miles.
- *
- * @param {string} key The key that the Parse.GeoPoint is stored in.
- * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
- * @param {number} maxDistance Maximum distance (in miles) of results to return.
- * @param {boolean} sorted A Bool value that is true if results should be
- * sorted by distance ascending, false is no sorting is required,
- * defaults to true.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "withinMiles",
- value: function withinMiles(key
- /*: string*/
- , point
- /*: ParseGeoPoint*/
- , maxDistance
- /*: number*/
- , sorted
- /*: boolean*/
- )
- /*: ParseQuery*/
- {
- return this.withinRadians(key, point, maxDistance / 3958.8, sorted);
- }
- /**
- * Adds a proximity based constraint for finding objects with key point
- * values near the point given and within the maximum distance given.
- * Radius of earth used is 6371.0 kilometers.
- *
- * @param {string} key The key that the Parse.GeoPoint is stored in.
- * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.
- * @param {number} maxDistance Maximum distance (in kilometers) of results to return.
- * @param {boolean} sorted A Bool value that is true if results should be
- * sorted by distance ascending, false is no sorting is required,
- * defaults to true.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "withinKilometers",
- value: function withinKilometers(key
- /*: string*/
- , point
- /*: ParseGeoPoint*/
- , maxDistance
- /*: number*/
- , sorted
- /*: boolean*/
- )
- /*: ParseQuery*/
- {
- return this.withinRadians(key, point, maxDistance / 6371.0, sorted);
- }
- /**
- * Adds a constraint to the query that requires a particular key's
- * coordinates be contained within a given rectangular geographic bounding
- * box.
- *
- * @param {string} key The key to be constrained.
- * @param {Parse.GeoPoint} southwest
- * The lower-left inclusive corner of the box.
- * @param {Parse.GeoPoint} northeast
- * The upper-right inclusive corner of the box.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "withinGeoBox",
- value: function withinGeoBox(key
- /*: string*/
- , southwest
- /*: ParseGeoPoint*/
- , northeast
- /*: ParseGeoPoint*/
- )
- /*: ParseQuery*/
- {
- if (!(southwest instanceof _ParseGeoPoint.default)) {
- southwest = new _ParseGeoPoint.default(southwest);
- }
- if (!(northeast instanceof _ParseGeoPoint.default)) {
- northeast = new _ParseGeoPoint.default(northeast);
- }
- this._addCondition(key, '$within', {
- $box: [southwest, northeast]
- });
- return this;
- }
- /**
- * Adds a constraint to the query that requires a particular key's
- * coordinates be contained within and on the bounds of a given polygon.
- * Supports closed and open (last point is connected to first) paths
- *
- * Polygon must have at least 3 points
- *
- * @param {string} key The key to be constrained.
- * @param {Array} points Array of Coordinates / GeoPoints
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "withinPolygon",
- value: function withinPolygon(key
- /*: string*/
- , points
- /*: Array<Array<number>>*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$geoWithin', {
- $polygon: points
- });
- }
- /**
- * Add a constraint to the query that requires a particular key's
- * coordinates that contains a ParseGeoPoint
- *
- * @param {string} key The key to be constrained.
- * @param {Parse.GeoPoint} point
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "polygonContains",
- value: function polygonContains(key
- /*: string*/
- , point
- /*: ParseGeoPoint*/
- )
- /*: ParseQuery*/
- {
- return this._addCondition(key, '$geoIntersects', {
- $point: point
- });
- }
- /** Query Orderings **/
- /**
- * Sorts the results in ascending order by the given key.
- *
- * @param {(string|string[])} keys The key to order by, which is a
- * string of comma separated values, or an Array of keys, or multiple keys.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "ascending",
- value: function ascending()
- /*: ParseQuery*/
- {
- this._order = [];
- for (var _len = arguments.length, keys = new Array(_len), _key5 = 0; _key5 < _len; _key5++) {
- keys[_key5] = arguments[_key5];
- }
- return this.addAscending.apply(this, keys);
- }
- /**
- * Sorts the results in ascending order by the given key,
- * but can also add secondary sort descriptors without overwriting _order.
- *
- * @param {(string|string[])} keys The key to order by, which is a
- * string of comma separated values, or an Array of keys, or multiple keys.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "addAscending",
- value: function addAscending()
- /*: ParseQuery*/
- {
- var _this9 = this;
- if (!this._order) {
- this._order = [];
- }
- for (var _len2 = arguments.length, keys = new Array(_len2), _key6 = 0; _key6 < _len2; _key6++) {
- keys[_key6] = arguments[_key6];
- }
- (0, _forEach.default)(keys).call(keys, function (key) {
- var _context16;
- if ((0, _isArray.default)(key)) {
- key = key.join();
- }
- _this9._order = (0, _concat.default)(_context16 = _this9._order).call(_context16, key.replace(/\s/g, '').split(','));
- });
- return this;
- }
- /**
- * Sorts the results in descending order by the given key.
- *
- * @param {(string|string[])} keys The key to order by, which is a
- * string of comma separated values, or an Array of keys, or multiple keys.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "descending",
- value: function descending()
- /*: ParseQuery*/
- {
- this._order = [];
- for (var _len3 = arguments.length, keys = new Array(_len3), _key7 = 0; _key7 < _len3; _key7++) {
- keys[_key7] = arguments[_key7];
- }
- return this.addDescending.apply(this, keys);
- }
- /**
- * Sorts the results in descending order by the given key,
- * but can also add secondary sort descriptors without overwriting _order.
- *
- * @param {(string|string[])} keys The key to order by, which is a
- * string of comma separated values, or an Array of keys, or multiple keys.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "addDescending",
- value: function addDescending()
- /*: ParseQuery*/
- {
- var _this10 = this;
- if (!this._order) {
- this._order = [];
- }
- for (var _len4 = arguments.length, keys = new Array(_len4), _key8 = 0; _key8 < _len4; _key8++) {
- keys[_key8] = arguments[_key8];
- }
- (0, _forEach.default)(keys).call(keys, function (key) {
- var _context17, _context18;
- if ((0, _isArray.default)(key)) {
- key = key.join();
- }
- _this10._order = (0, _concat.default)(_context17 = _this10._order).call(_context17, (0, _map2.default)(_context18 = key.replace(/\s/g, '').split(',')).call(_context18, function (k) {
- return '-' + k;
- }));
- });
- return this;
- }
- /** Query Options **/
- /**
- * Sets the number of results to skip before returning any results.
- * This is useful for pagination.
- * Default is to skip zero results.
- *
- * @param {number} n the number of results to skip.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "skip",
- value: function skip(n
- /*: number*/
- )
- /*: ParseQuery*/
- {
- if (typeof n !== 'number' || n < 0) {
- throw new Error('You can only skip by a positive number');
- }
- this._skip = n;
- return this;
- }
- /**
- * Sets the limit of the number of results to return. The default limit is 100.
- *
- * @param {number} n the number of results to limit to.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "limit",
- value: function limit(n
- /*: number*/
- )
- /*: ParseQuery*/
- {
- if (typeof n !== 'number') {
- throw new Error('You can only set the limit to a numeric value');
- }
- this._limit = n;
- return this;
- }
- /**
- * Sets the flag to include with response the total number of objects satisfying this query,
- * despite limits/skip. Might be useful for pagination.
- * Note that result of this query will be wrapped as an object with
- * `results`: holding {ParseObject} array and `count`: integer holding total number
- *
- * @param {boolean} includeCount false - disable, true - enable.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "withCount",
- value: function withCount()
- /*: ParseQuery*/
- {
- var includeCount
- /*: boolean*/
- = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
- if (typeof includeCount !== 'boolean') {
- throw new Error('You can only set withCount to a boolean value');
- }
- this._count = includeCount;
- return this;
- }
- /**
- * Includes nested Parse.Objects for the provided key. You can use dot
- * notation to specify which fields in the included object are also fetched.
- *
- * You can include all nested Parse.Objects by passing in '*'.
- * Requires Parse Server 3.0.0+
- * <pre>query.include('*');</pre>
- *
- * @param {...string|Array<string>} keys The name(s) of the key(s) to include.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "include",
- value: function include()
- /*: ParseQuery*/
- {
- var _this11 = this;
- for (var _len5 = arguments.length, keys = new Array(_len5), _key9 = 0; _key9 < _len5; _key9++) {
- keys[_key9] = arguments[_key9];
- }
- (0, _forEach.default)(keys).call(keys, function (key) {
- if ((0, _isArray.default)(key)) {
- var _context19;
- _this11._include = (0, _concat.default)(_context19 = _this11._include).call(_context19, key);
- } else {
- _this11._include.push(key);
- }
- });
- return this;
- }
- /**
- * Includes all nested Parse.Objects one level deep.
- *
- * Requires Parse Server 3.0.0+
- *
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "includeAll",
- value: function includeAll()
- /*: ParseQuery*/
- {
- return this.include('*');
- }
- /**
- * Restricts the fields of the returned Parse.Objects to include only the
- * provided keys. If this is called multiple times, then all of the keys
- * specified in each of the calls will be included.
- *
- * @param {...string|Array<string>} keys The name(s) of the key(s) to include.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "select",
- value: function select()
- /*: ParseQuery*/
- {
- var _this12 = this;
- if (!this._select) {
- this._select = [];
- }
- for (var _len6 = arguments.length, keys = new Array(_len6), _key10 = 0; _key10 < _len6; _key10++) {
- keys[_key10] = arguments[_key10];
- }
- (0, _forEach.default)(keys).call(keys, function (key) {
- if ((0, _isArray.default)(key)) {
- var _context20;
- _this12._select = (0, _concat.default)(_context20 = _this12._select).call(_context20, key);
- } else {
- _this12._select.push(key);
- }
- });
- return this;
- }
- /**
- * Restricts the fields of the returned Parse.Objects to all keys except the
- * provided keys. Exclude takes precedence over select and include.
- *
- * Requires Parse Server 3.6.0+
- *
- * @param {...string|Array<string>} keys The name(s) of the key(s) to exclude.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "exclude",
- value: function exclude()
- /*: ParseQuery*/
- {
- var _this13 = this;
- for (var _len7 = arguments.length, keys = new Array(_len7), _key11 = 0; _key11 < _len7; _key11++) {
- keys[_key11] = arguments[_key11];
- }
- (0, _forEach.default)(keys).call(keys, function (key) {
- if ((0, _isArray.default)(key)) {
- var _context21;
- _this13._exclude = (0, _concat.default)(_context21 = _this13._exclude).call(_context21, key);
- } else {
- _this13._exclude.push(key);
- }
- });
- return this;
- }
- /**
- * Changes the read preference that the backend will use when performing the query to the database.
- *
- * @param {string} readPreference The read preference for the main query.
- * @param {string} includeReadPreference The read preference for the queries to include pointers.
- * @param {string} subqueryReadPreference The read preference for the sub queries.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "readPreference",
- value: function readPreference(_readPreference
- /*: string*/
- , includeReadPreference
- /*:: ?: string*/
- , subqueryReadPreference
- /*:: ?: string*/
- )
- /*: ParseQuery*/
- {
- this._readPreference = _readPreference;
- this._includeReadPreference = includeReadPreference;
- this._subqueryReadPreference = subqueryReadPreference;
- return this;
- }
- /**
- * Subscribe this query to get liveQuery updates
- *
- * @param {string} sessionToken (optional) Defaults to the currentUser
- * @returns {Promise<LiveQuerySubscription>} Returns the liveQuerySubscription, it's an event emitter
- * which can be used to get liveQuery updates.
- */
- }, {
- key: "subscribe",
- value: function () {
- var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(sessionToken
- /*:: ?: string*/
- ) {
- var currentUser, liveQueryClient, subscription;
- return _regeneratorRuntime().wrap(function _callee7$(_context22) {
- while (1) {
- switch (_context22.prev = _context22.next) {
- case 0:
- _context22.next = 2;
- return _CoreManager.default.getUserController().currentUserAsync();
- case 2:
- currentUser = _context22.sent;
- if (!sessionToken) {
- sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
- }
- _context22.next = 6;
- return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
- case 6:
- liveQueryClient = _context22.sent;
- if (liveQueryClient.shouldOpen()) {
- liveQueryClient.open();
- }
- subscription = liveQueryClient.subscribe(this, sessionToken);
- return _context22.abrupt("return", subscription.subscribePromise.then(function () {
- return subscription;
- }));
- case 10:
- case "end":
- return _context22.stop();
- }
- }
- }, _callee7, this);
- }));
- function subscribe(_x10) {
- return _subscribe.apply(this, arguments);
- }
- return subscribe;
- }()
- /**
- * Constructs a Parse.Query that is the OR of the passed in queries. For
- * example:
- * <pre>var compoundQuery = Parse.Query.or(query1, query2, query3);</pre>
- *
- * will create a compoundQuery that is an or of the query1, query2, and
- * query3.
- *
- * @param {...Parse.Query} queries The list of queries to OR.
- * @static
- * @returns {Parse.Query} The query that is the OR of the passed in queries.
- */
- }, {
- key: "fromNetwork",
- value:
- /**
- * Change the source of this query to the server.
- *
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- function fromNetwork()
- /*: ParseQuery*/
- {
- this._queriesLocalDatastore = false;
- this._localDatastorePinName = null;
- return this;
- }
- /**
- * Changes the source of this query to all pinned objects.
- *
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "fromLocalDatastore",
- value: function fromLocalDatastore()
- /*: ParseQuery*/
- {
- return this.fromPinWithName(null);
- }
- /**
- * Changes the source of this query to the default group of pinned objects.
- *
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "fromPin",
- value: function fromPin()
- /*: ParseQuery*/
- {
- return this.fromPinWithName(_LocalDatastoreUtils.DEFAULT_PIN);
- }
- /**
- * Changes the source of this query to a specific group of pinned objects.
- *
- * @param {string} name The name of query source.
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "fromPinWithName",
- value: function fromPinWithName(name
- /*:: ?: string*/
- )
- /*: ParseQuery*/
- {
- var localDatastore = _CoreManager.default.getLocalDatastore();
- if (localDatastore.checkIfEnabled()) {
- this._queriesLocalDatastore = true;
- this._localDatastorePinName = name;
- }
- return this;
- }
- /**
- * Cancels the current network request (if any is running).
- *
- * @returns {Parse.Query} Returns the query, so you can chain this call.
- */
- }, {
- key: "cancel",
- value: function cancel()
- /*: ParseQuery*/
- {
- var _this14 = this;
- if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
- this._xhrRequest.task._aborted = true;
- this._xhrRequest.task.abort();
- this._xhrRequest.task = null;
- this._xhrRequest.onchange = function () {};
- return this;
- }
- return this._xhrRequest.onchange = function () {
- return _this14.cancel();
- };
- }
- }, {
- key: "_setRequestTask",
- value: function _setRequestTask(options) {
- var _this15 = this;
- options.requestTask = function (task) {
- _this15._xhrRequest.task = task;
- _this15._xhrRequest.onchange();
- };
- }
- }], [{
- key: "fromJSON",
- value: function fromJSON(className
- /*: string*/
- , json
- /*: QueryJSON*/
- )
- /*: ParseQuery*/
- {
- var query = new ParseQuery(className);
- return query.withJSON(json);
- }
- }, {
- key: "or",
- value: function or()
- /*: ParseQuery*/
- {
- for (var _len8 = arguments.length, queries = new Array(_len8), _key12 = 0; _key12 < _len8; _key12++) {
- queries[_key12] = arguments[_key12];
- }
- var className = _getClassNameFromQueries(queries);
- var query = new ParseQuery(className);
- query._orQuery(queries);
- return query;
- }
- /**
- * Constructs a Parse.Query that is the AND of the passed in queries. For
- * example:
- * <pre>var compoundQuery = Parse.Query.and(query1, query2, query3);</pre>
- *
- * will create a compoundQuery that is an and of the query1, query2, and
- * query3.
- *
- * @param {...Parse.Query} queries The list of queries to AND.
- * @static
- * @returns {Parse.Query} The query that is the AND of the passed in queries.
- */
- }, {
- key: "and",
- value: function and()
- /*: ParseQuery*/
- {
- for (var _len9 = arguments.length, queries = new Array(_len9), _key13 = 0; _key13 < _len9; _key13++) {
- queries[_key13] = arguments[_key13];
- }
- var className = _getClassNameFromQueries(queries);
- var query = new ParseQuery(className);
- query._andQuery(queries);
- return query;
- }
- /**
- * Constructs a Parse.Query that is the NOR of the passed in queries. For
- * example:
- * <pre>const compoundQuery = Parse.Query.nor(query1, query2, query3);</pre>
- *
- * will create a compoundQuery that is a nor of the query1, query2, and
- * query3.
- *
- * @param {...Parse.Query} queries The list of queries to NOR.
- * @static
- * @returns {Parse.Query} The query that is the NOR of the passed in queries.
- */
- }, {
- key: "nor",
- value: function nor()
- /*: ParseQuery*/
- {
- for (var _len10 = arguments.length, queries = new Array(_len10), _key14 = 0; _key14 < _len10; _key14++) {
- queries[_key14] = arguments[_key14];
- }
- var className = _getClassNameFromQueries(queries);
- var query = new ParseQuery(className);
- query._norQuery(queries);
- return query;
- }
- }]);
- return ParseQuery;
- }();
- var DefaultController = {
- find: function find(className
- /*: string*/
- , params
- /*: QueryJSON*/
- , options
- /*: RequestOptions*/
- )
- /*: Promise<Array<ParseObject>>*/
- {
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request('GET', 'classes/' + className, params, options);
- },
- aggregate: function aggregate(className
- /*: string*/
- , params
- /*: any*/
- , options
- /*: RequestOptions*/
- )
- /*: Promise<Array<mixed>>*/
- {
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request('GET', 'aggregate/' + className, params, options);
- }
- };
- _CoreManager.default.setQueryController(DefaultController);
- var _default = ParseQuery;
- exports.default = _default;
- },{"./CoreManager":4,"./LocalDatastoreUtils":15,"./OfflineQuery":17,"./ParseError":22,"./ParseGeoPoint":24,"./ParseObject":27,"./encode":46,"./promiseUtils":51,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/concat":58,"@babel/runtime-corejs3/core-js-stable/instance/filter":61,"@babel/runtime-corejs3/core-js-stable/instance/find":63,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/includes":65,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/instance/keys":67,"@babel/runtime-corejs3/core-js-stable/instance/map":68,"@babel/runtime-corejs3/core-js-stable/instance/reverse":70,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/instance/sort":72,"@babel/runtime-corejs3/core-js-stable/instance/splice":73,"@babel/runtime-corejs3/core-js-stable/object/create":80,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/entries":83,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":88,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":90,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/helpers/asyncToGenerator":120,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/slicedToArray":137,"@babel/runtime-corejs3/helpers/toConsumableArray":139,"@babel/runtime-corejs3/helpers/typeof":140}],31:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _ParseOp = _dereq_("./ParseOp");
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- /**
- * Creates a new Relation for the given parent object and key. This
- * constructor should rarely be used directly, but rather created by
- * Parse.Object.relation.
- *
- * <p>
- * A class that is used to access all of the children of a many-to-many
- * relationship. Each instance of Parse.Relation is associated with a
- * particular parent object and key.
- * </p>
- *
- * @alias Parse.Relation
- */
- var ParseRelation = /*#__PURE__*/function () {
- /**
- * @param {Parse.Object} parent The parent of this relation.
- * @param {string} key The key for this relation on the parent.
- */
- function ParseRelation(parent
- /*: ?ParseObject*/
- , key
- /*: ?string*/
- ) {
- (0, _classCallCheck2.default)(this, ParseRelation);
- (0, _defineProperty2.default)(this, "parent", void 0);
- (0, _defineProperty2.default)(this, "key", void 0);
- (0, _defineProperty2.default)(this, "targetClassName", void 0);
- this.parent = parent;
- this.key = key;
- this.targetClassName = null;
- }
- /*
- * Makes sure that this relation has the right parent and key.
- */
- (0, _createClass2.default)(ParseRelation, [{
- key: "_ensureParentAndKey",
- value: function (parent
- /*: ParseObject*/
- , key
- /*: string*/
- ) {
- this.key = this.key || key;
- if (this.key !== key) {
- throw new Error('Internal Error. Relation retrieved from two different keys.');
- }
- if (this.parent) {
- if (this.parent.className !== parent.className) {
- throw new Error('Internal Error. Relation retrieved from two different Objects.');
- }
- if (this.parent.id) {
- if (this.parent.id !== parent.id) {
- throw new Error('Internal Error. Relation retrieved from two different Objects.');
- }
- } else if (parent.id) {
- this.parent = parent;
- }
- } else {
- this.parent = parent;
- }
- }
- /**
- * Adds a Parse.Object or an array of Parse.Objects to the relation.
- *
- * @param {(Parse.Object|Array)} objects The item or items to add.
- * @returns {Parse.Object} The parent of the relation.
- */
- }, {
- key: "add",
- value: function (objects
- /*: ParseObject | Array<ParseObject | string>*/
- )
- /*: ParseObject*/
- {
- if (!(0, _isArray.default)(objects)) {
- objects = [objects];
- }
- var change = new _ParseOp.RelationOp(objects, []);
- var parent = this.parent;
- if (!parent) {
- throw new Error('Cannot add to a Relation without a parent');
- }
- if (objects.length === 0) {
- return parent;
- }
- parent.set(this.key, change);
- this.targetClassName = change._targetClassName;
- return parent;
- }
- /**
- * Removes a Parse.Object or an array of Parse.Objects from this relation.
- *
- * @param {(Parse.Object|Array)} objects The item or items to remove.
- */
- }, {
- key: "remove",
- value: function (objects
- /*: ParseObject | Array<ParseObject | string>*/
- ) {
- if (!(0, _isArray.default)(objects)) {
- objects = [objects];
- }
- var change = new _ParseOp.RelationOp([], objects);
- if (!this.parent) {
- throw new Error('Cannot remove from a Relation without a parent');
- }
- if (objects.length === 0) {
- return;
- }
- this.parent.set(this.key, change);
- this.targetClassName = change._targetClassName;
- }
- /**
- * Returns a JSON version of the object suitable for saving to disk.
- *
- * @returns {object} JSON representation of Relation
- */
- }, {
- key: "toJSON",
- value: function ()
- /*: { __type: 'Relation', className: ?string }*/
- {
- return {
- __type: 'Relation',
- className: this.targetClassName
- };
- }
- /**
- * Returns a Parse.Query that is limited to objects in this
- * relation.
- *
- * @returns {Parse.Query} Relation Query
- */
- }, {
- key: "query",
- value: function query()
- /*: ParseQuery*/
- {
- var query;
- var parent = this.parent;
- if (!parent) {
- throw new Error('Cannot construct a query for a Relation without a parent');
- }
- if (!this.targetClassName) {
- query = new _ParseQuery.default(parent.className);
- query._extraOptions.redirectClassNameForKey = this.key;
- } else {
- query = new _ParseQuery.default(this.targetClassName);
- }
- query._addCondition('$relatedTo', 'object', {
- __type: 'Pointer',
- className: parent.className,
- objectId: parent.id
- });
- query._addCondition('$relatedTo', 'key', this.key);
- return query;
- }
- }]);
- return ParseRelation;
- }();
- var _default = ParseRelation;
- exports.default = _default;
- },{"./ParseObject":27,"./ParseOp":28,"./ParseQuery":30,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],32:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _get2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/get"));
- var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
- var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
- var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
- var _ParseACL = _interopRequireDefault(_dereq_("./ParseACL"));
- var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
- var _ParseObject2 = _interopRequireDefault(_dereq_("./ParseObject"));
- function _createSuper(Derived) {
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
- return function () {
- var Super = (0, _getPrototypeOf2.default)(Derived),
- result;
- if (hasNativeReflectConstruct) {
- var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
- result = _Reflect$construct(Super, arguments, NewTarget);
- } else {
- result = Super.apply(this, arguments);
- }
- return (0, _possibleConstructorReturn2.default)(this, result);
- };
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
- if (_Reflect$construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
- }
- /**
- * Represents a Role on the Parse server. Roles represent groupings of
- * Users for the purposes of granting permissions (e.g. specifying an ACL
- * for an Object). Roles are specified by their sets of child users and
- * child roles, all of which are granted any permissions that the parent
- * role has.
- *
- * <p>Roles must have a name (which cannot be changed after creation of the
- * role), and must specify an ACL.</p>
- *
- * @alias Parse.Role
- * @augments Parse.Object
- */
- var ParseRole = /*#__PURE__*/function (_ParseObject) {
- (0, _inherits2.default)(ParseRole, _ParseObject);
- var _super = _createSuper(ParseRole);
- /**
- * @param {string} name The name of the Role to create.
- * @param {Parse.ACL} acl The ACL for this role. Roles must have an ACL.
- * A Parse.Role is a local representation of a role persisted to the Parse
- * cloud.
- */
- function ParseRole(name
- /*: string*/
- , acl
- /*: ParseACL*/
- ) {
- var _this;
- (0, _classCallCheck2.default)(this, ParseRole);
- _this = _super.call(this, '_Role');
- if (typeof name === 'string' && acl instanceof _ParseACL.default) {
- _this.setName(name);
- _this.setACL(acl);
- }
- return _this;
- }
- /**
- * Gets the name of the role. You can alternatively call role.get("name")
- *
- * @returns {string} the name of the role.
- */
- (0, _createClass2.default)(ParseRole, [{
- key: "getName",
- value: function ()
- /*: ?string*/
- {
- var name = this.get('name');
- if (name == null || typeof name === 'string') {
- return name;
- }
- return '';
- }
- /**
- * Sets the name for a role. This value must be set before the role has
- * been saved to the server, and cannot be set once the role has been
- * saved.
- *
- * <p>
- * A role's name can only contain alphanumeric characters, _, -, and
- * spaces.
- * </p>
- *
- * <p>This is equivalent to calling role.set("name", name)</p>
- *
- * @param {string} name The name of the role.
- * @param {object} options Standard options object with success and error
- * callbacks.
- * @returns {(ParseObject|boolean)} true if the set succeeded.
- */
- }, {
- key: "setName",
- value: function (name
- /*: string*/
- , options
- /*:: ?: mixed*/
- )
- /*: ParseObject | boolean*/
- {
- this._validateName(name);
- return this.set('name', name, options);
- }
- /**
- * Gets the Parse.Relation for the Parse.Users that are direct
- * children of this role. These users are granted any privileges that this
- * role has been granted (e.g. read or write access through ACLs). You can
- * add or remove users from the role through this relation.
- *
- * <p>This is equivalent to calling role.relation("users")</p>
- *
- * @returns {Parse.Relation} the relation for the users belonging to this
- * role.
- */
- }, {
- key: "getUsers",
- value: function ()
- /*: ParseRelation*/
- {
- return this.relation('users');
- }
- /**
- * Gets the Parse.Relation for the Parse.Roles that are direct
- * children of this role. These roles' users are granted any privileges that
- * this role has been granted (e.g. read or write access through ACLs). You
- * can add or remove child roles from this role through this relation.
- *
- * <p>This is equivalent to calling role.relation("roles")</p>
- *
- * @returns {Parse.Relation} the relation for the roles belonging to this
- * role.
- */
- }, {
- key: "getRoles",
- value: function ()
- /*: ParseRelation*/
- {
- return this.relation('roles');
- }
- }, {
- key: "_validateName",
- value: function (newName) {
- if (typeof newName !== 'string') {
- throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name must be a String.");
- }
- if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
- throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name can be only contain alphanumeric characters, _, " + '-, and spaces.');
- }
- }
- }, {
- key: "validate",
- value: function (attrs
- /*: AttributeMap*/
- , options
- /*:: ?: mixed*/
- )
- /*: ParseError | boolean*/
- {
- var isInvalid = (0, _get2.default)((0, _getPrototypeOf2.default)(ParseRole.prototype), "validate", this).call(this, attrs, options);
- if (isInvalid) {
- return isInvalid;
- }
- if ('name' in attrs && attrs.name !== this.getName()) {
- var newName = attrs.name;
- if (this.id && this.id !== attrs.objectId) {
- // Check to see if the objectId being set matches this.id
- // This happens during a fetch -- the id is set before calling fetch
- // Let the name be set in this case
- return new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
- }
- try {
- this._validateName(newName);
- } catch (e) {
- return e;
- }
- }
- return false;
- }
- }]);
- return ParseRole;
- }(_ParseObject2.default);
- _ParseObject2.default.registerSubclass('_Role', ParseRole);
- var _default = ParseRole;
- exports.default = _default;
- },{"./ParseACL":19,"./ParseError":22,"./ParseObject":27,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/get":125,"@babel/runtime-corejs3/helpers/getPrototypeOf":126,"@babel/runtime-corejs3/helpers/inherits":127,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":135}],33:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- var _ParseCLP = _interopRequireDefault(_dereq_("./ParseCLP"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
- /*:: type FieldOptions = {
- required: boolean,
- defaultValue: mixed,
- };*/
- /**
- * A Parse.Schema object is for handling schema data from Parse.
- * <p>All the schemas methods require MasterKey.
- *
- * When adding fields, you may set required and default values. (Requires Parse Server 3.7.0+)
- *
- * <pre>
- * const options = { required: true, defaultValue: 'hello world' };
- * const schema = new Parse.Schema('MyClass');
- * schema.addString('field', options);
- * schema.addIndex('index_name', { 'field': 1 });
- * schema.save();
- * </pre>
- * </p>
- *
- * @alias Parse.Schema
- */
- var ParseSchema = /*#__PURE__*/function () {
- /**
- * @param {string} className Parse Class string.
- */
- function ParseSchema(className
- /*: string*/
- ) {
- (0, _classCallCheck2.default)(this, ParseSchema);
- (0, _defineProperty2.default)(this, "className", void 0);
- (0, _defineProperty2.default)(this, "_fields", void 0);
- (0, _defineProperty2.default)(this, "_indexes", void 0);
- (0, _defineProperty2.default)(this, "_clp", void 0);
- if (typeof className === 'string') {
- if (className === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
- this.className = '_User';
- } else {
- this.className = className;
- }
- }
- this._fields = {};
- this._indexes = {};
- }
- /**
- * Static method to get all schemas
- *
- * @returns {Promise} A promise that is resolved with the result when
- * the query completes.
- */
- (0, _createClass2.default)(ParseSchema, [{
- key: "get",
- value:
- /**
- * Get the Schema from Parse
- *
- * @returns {Promise} A promise that is resolved with the result when
- * the query completes.
- */
- function () {
- this.assertClassName();
- var controller = _CoreManager.default.getSchemaController();
- return controller.get(this.className).then(function (response) {
- if (!response) {
- throw new Error('Schema not found.');
- }
- return response;
- });
- }
- /**
- * Create a new Schema on Parse
- *
- * @returns {Promise} A promise that is resolved with the result when
- * the query completes.
- */
- }, {
- key: "save",
- value: function () {
- this.assertClassName();
- var controller = _CoreManager.default.getSchemaController();
- var params = {
- className: this.className,
- fields: this._fields,
- indexes: this._indexes,
- classLevelPermissions: this._clp
- };
- return controller.create(this.className, params);
- }
- /**
- * Update a Schema on Parse
- *
- * @returns {Promise} A promise that is resolved with the result when
- * the query completes.
- */
- }, {
- key: "update",
- value: function () {
- this.assertClassName();
- var controller = _CoreManager.default.getSchemaController();
- var params = {
- className: this.className,
- fields: this._fields,
- indexes: this._indexes,
- classLevelPermissions: this._clp
- };
- this._fields = {};
- this._indexes = {};
- return controller.update(this.className, params);
- }
- /**
- * Removing a Schema from Parse
- * Can only be used on Schema without objects
- *
- * @returns {Promise} A promise that is resolved with the result when
- * the query completes.
- */
- }, {
- key: "delete",
- value: function () {
- this.assertClassName();
- var controller = _CoreManager.default.getSchemaController();
- return controller.delete(this.className);
- }
- /**
- * Removes all objects from a Schema (class) in Parse.
- * EXERCISE CAUTION, running this will delete all objects for this schema and cannot be reversed
- *
- * @returns {Promise} A promise that is resolved with the result when
- * the query completes.
- */
- }, {
- key: "purge",
- value: function () {
- this.assertClassName();
- var controller = _CoreManager.default.getSchemaController();
- return controller.purge(this.className);
- }
- /**
- * Assert if ClassName has been filled
- *
- * @private
- */
- }, {
- key: "assertClassName",
- value: function () {
- if (!this.className) {
- throw new Error('You must set a Class Name before making any request.');
- }
- }
- /**
- * Sets Class Level Permissions when creating / updating a Schema.
- * EXERCISE CAUTION, running this may override CLP for this schema and cannot be reversed
- *
- * @param {object | Parse.CLP} clp Class Level Permissions
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "setCLP",
- value: function (clp
- /*: PermissionsMap | ParseCLP*/
- ) {
- if (clp instanceof _ParseCLP.default) {
- this._clp = clp.toJSON();
- } else {
- this._clp = clp;
- }
- return this;
- }
- /**
- * Adding a Field to Create / Update a Schema
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {string} type Can be a (String|Number|Boolean|Date|Parse.File|Parse.GeoPoint|Array|Object|Pointer|Parse.Relation)
- * @param {object} options
- * Valid options are:<ul>
- * <li>required: If field is not set, save operation fails (Requires Parse Server 3.7.0+)
- * <li>defaultValue: If field is not set, a default value is selected (Requires Parse Server 3.7.0+)
- * <li>targetClass: Required if type is Pointer or Parse.Relation
- * </ul>
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addField",
- value: function (name
- /*: string*/
- , type
- /*: string*/
- ) {
- var options
- /*: FieldOptions*/
- = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- type = type || 'String';
- if (!name) {
- throw new Error('field name may not be null.');
- }
- if ((0, _indexOf.default)(FIELD_TYPES).call(FIELD_TYPES, type) === -1) {
- throw new Error("".concat(type, " is not a valid type."));
- }
- if (type === 'Pointer') {
- return this.addPointer(name, options.targetClass, options);
- }
- if (type === 'Relation') {
- return this.addRelation(name, options.targetClass, options);
- }
- var fieldOptions = {
- type: type
- };
- if (typeof options.required === 'boolean') {
- fieldOptions.required = options.required;
- }
- if (options.defaultValue !== undefined) {
- fieldOptions.defaultValue = options.defaultValue;
- }
- if (type === 'Date') {
- if (options && options.defaultValue) {
- fieldOptions.defaultValue = {
- __type: 'Date',
- iso: new Date(options.defaultValue)
- };
- }
- }
- this._fields[name] = fieldOptions;
- return this;
- }
- /**
- * Adding an Index to Create / Update a Schema
- *
- * @param {string} name Name of the index
- * @param {object} index { field: value }
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- *
- * <pre>
- * schema.addIndex('index_name', { 'field': 1 });
- * </pre>
- */
- }, {
- key: "addIndex",
- value: function (name
- /*: string*/
- , index
- /*: any*/
- ) {
- if (!name) {
- throw new Error('index name may not be null.');
- }
- if (!index) {
- throw new Error('index may not be null.');
- }
- this._indexes[name] = index;
- return this;
- }
- /**
- * Adding String Field
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addString",
- value: function (name
- /*: string*/
- , options
- /*: FieldOptions*/
- ) {
- return this.addField(name, 'String', options);
- }
- /**
- * Adding Number Field
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addNumber",
- value: function (name
- /*: string*/
- , options
- /*: FieldOptions*/
- ) {
- return this.addField(name, 'Number', options);
- }
- /**
- * Adding Boolean Field
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addBoolean",
- value: function (name
- /*: string*/
- , options
- /*: FieldOptions*/
- ) {
- return this.addField(name, 'Boolean', options);
- }
- /**
- * Adding Date Field
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addDate",
- value: function (name
- /*: string*/
- , options
- /*: FieldOptions*/
- ) {
- return this.addField(name, 'Date', options);
- }
- /**
- * Adding File Field
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addFile",
- value: function (name
- /*: string*/
- , options
- /*: FieldOptions*/
- ) {
- return this.addField(name, 'File', options);
- }
- /**
- * Adding GeoPoint Field
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addGeoPoint",
- value: function (name
- /*: string*/
- , options
- /*: FieldOptions*/
- ) {
- return this.addField(name, 'GeoPoint', options);
- }
- /**
- * Adding Polygon Field
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addPolygon",
- value: function (name
- /*: string*/
- , options
- /*: FieldOptions*/
- ) {
- return this.addField(name, 'Polygon', options);
- }
- /**
- * Adding Array Field
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addArray",
- value: function (name
- /*: string*/
- , options
- /*: FieldOptions*/
- ) {
- return this.addField(name, 'Array', options);
- }
- /**
- * Adding Object Field
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addObject",
- value: function (name
- /*: string*/
- , options
- /*: FieldOptions*/
- ) {
- return this.addField(name, 'Object', options);
- }
- /**
- * Adding Pointer Field
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {string} targetClass Name of the target Pointer Class
- * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addPointer",
- value: function (name
- /*: string*/
- , targetClass
- /*: string*/
- ) {
- var options
- /*: FieldOptions*/
- = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- if (!name) {
- throw new Error('field name may not be null.');
- }
- if (!targetClass) {
- throw new Error('You need to set the targetClass of the Pointer.');
- }
- var fieldOptions = {
- type: 'Pointer',
- targetClass: targetClass
- };
- if (typeof options.required === 'boolean') {
- fieldOptions.required = options.required;
- }
- if (options.defaultValue !== undefined) {
- fieldOptions.defaultValue = options.defaultValue;
- if (options.defaultValue instanceof _ParseObject.default) {
- fieldOptions.defaultValue = options.defaultValue.toPointer();
- }
- }
- this._fields[name] = fieldOptions;
- return this;
- }
- /**
- * Adding Relation Field
- *
- * @param {string} name Name of the field that will be created on Parse
- * @param {string} targetClass Name of the target Pointer Class
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "addRelation",
- value: function (name
- /*: string*/
- , targetClass
- /*: string*/
- ) {
- if (!name) {
- throw new Error('field name may not be null.');
- }
- if (!targetClass) {
- throw new Error('You need to set the targetClass of the Relation.');
- }
- this._fields[name] = {
- type: 'Relation',
- targetClass: targetClass
- };
- return this;
- }
- /**
- * Deleting a Field to Update on a Schema
- *
- * @param {string} name Name of the field
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "deleteField",
- value: function (name
- /*: string*/
- ) {
- this._fields[name] = {
- __op: 'Delete'
- };
- return this;
- }
- /**
- * Deleting an Index to Update on a Schema
- *
- * @param {string} name Name of the field
- * @returns {Parse.Schema} Returns the schema, so you can chain this call.
- */
- }, {
- key: "deleteIndex",
- value: function (name
- /*: string*/
- ) {
- this._indexes[name] = {
- __op: 'Delete'
- };
- return this;
- }
- }], [{
- key: "all",
- value: function () {
- var controller = _CoreManager.default.getSchemaController();
- return controller.get('').then(function (response) {
- if (response.results.length === 0) {
- throw new Error('Schema not found.');
- }
- return response.results;
- });
- }
- }]);
- return ParseSchema;
- }();
- var DefaultController = {
- send: function (className
- /*: string*/
- , method
- /*: string*/
- )
- /*: Promise*/
- {
- var params
- /*: any*/
- = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request(method, "schemas/".concat(className), params, {
- useMasterKey: true
- });
- },
- get: function (className
- /*: string*/
- )
- /*: Promise*/
- {
- return this.send(className, 'GET');
- },
- create: function (className
- /*: string*/
- , params
- /*: any*/
- )
- /*: Promise*/
- {
- return this.send(className, 'POST', params);
- },
- update: function (className
- /*: string*/
- , params
- /*: any*/
- )
- /*: Promise*/
- {
- return this.send(className, 'PUT', params);
- },
- delete: function (className
- /*: string*/
- )
- /*: Promise*/
- {
- return this.send(className, 'DELETE');
- },
- purge: function (className
- /*: string*/
- )
- /*: Promise*/
- {
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request('DELETE', "purge/".concat(className), {}, {
- useMasterKey: true
- });
- }
- };
- _CoreManager.default.setSchemaController(DefaultController);
- var _default = ParseSchema;
- exports.default = _default;
- },{"./CoreManager":4,"./ParseCLP":20,"./ParseObject":27,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],34:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
- var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
- var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _isRevocableSession = _interopRequireDefault(_dereq_("./isRevocableSession"));
- var _ParseObject2 = _interopRequireDefault(_dereq_("./ParseObject"));
- var _ParseUser = _interopRequireDefault(_dereq_("./ParseUser"));
- function _createSuper(Derived) {
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
- return function () {
- var Super = (0, _getPrototypeOf2.default)(Derived),
- result;
- if (hasNativeReflectConstruct) {
- var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
- result = _Reflect$construct(Super, arguments, NewTarget);
- } else {
- result = Super.apply(this, arguments);
- }
- return (0, _possibleConstructorReturn2.default)(this, result);
- };
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
- if (_Reflect$construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
- }
- /**
- * <p>A Parse.Session object is a local representation of a revocable session.
- * This class is a subclass of a Parse.Object, and retains the same
- * functionality of a Parse.Object.</p>
- *
- * @alias Parse.Session
- * @augments Parse.Object
- */
- var ParseSession = /*#__PURE__*/function (_ParseObject) {
- (0, _inherits2.default)(ParseSession, _ParseObject);
- var _super = _createSuper(ParseSession);
- /**
- * @param {object} attributes The initial set of data to store in the user.
- */
- function ParseSession(attributes
- /*: ?AttributeMap*/
- ) {
- var _this;
- (0, _classCallCheck2.default)(this, ParseSession);
- _this = _super.call(this, '_Session');
- if (attributes && (0, _typeof2.default)(attributes) === 'object') {
- if (!_this.set(attributes || {})) {
- throw new Error("Can't create an invalid Session");
- }
- }
- return _this;
- }
- /**
- * Returns the session token string.
- *
- * @returns {string}
- */
- (0, _createClass2.default)(ParseSession, [{
- key: "getSessionToken",
- value: function ()
- /*: string*/
- {
- var token = this.get('sessionToken');
- if (typeof token === 'string') {
- return token;
- }
- return '';
- }
- }], [{
- key: "readOnlyAttributes",
- value: function () {
- return ['createdWith', 'expiresAt', 'installationId', 'restricted', 'sessionToken', 'user'];
- }
- /**
- * Retrieves the Session object for the currently logged in session.
- *
- * @param {object} options useMasterKey
- * @static
- * @returns {Promise} A promise that is resolved with the Parse.Session
- * object after it has been fetched. If there is no current user, the
- * promise will be rejected.
- */
- }, {
- key: "current",
- value: function (options
- /*: FullOptions*/
- ) {
- options = options || {};
- var controller = _CoreManager.default.getSessionController();
- var sessionOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- sessionOptions.useMasterKey = options.useMasterKey;
- }
- return _ParseUser.default.currentAsync().then(function (user) {
- if (!user) {
- return _promise.default.reject('There is no current user.');
- }
- sessionOptions.sessionToken = user.getSessionToken();
- return controller.getSession(sessionOptions);
- });
- }
- /**
- * Determines whether the current session token is revocable.
- * This method is useful for migrating Express.js or Node.js web apps to
- * use revocable sessions. If you are migrating an app that uses the Parse
- * SDK in the browser only, please use Parse.User.enableRevocableSession()
- * instead, so that sessions can be automatically upgraded.
- *
- * @static
- * @returns {boolean}
- */
- }, {
- key: "isCurrentSessionRevocable",
- value: function ()
- /*: boolean*/
- {
- var currentUser = _ParseUser.default.current();
- if (currentUser) {
- return (0, _isRevocableSession.default)(currentUser.getSessionToken() || '');
- }
- return false;
- }
- }]);
- return ParseSession;
- }(_ParseObject2.default);
- _ParseObject2.default.registerSubclass('_Session', ParseSession);
- var DefaultController = {
- getSession: function (options
- /*: RequestOptions*/
- )
- /*: Promise<ParseSession>*/
- {
- var RESTController = _CoreManager.default.getRESTController();
- var session = new ParseSession();
- return RESTController.request('GET', 'sessions/me', {}, options).then(function (sessionData) {
- session._finishFetch(sessionData);
- session._setExisted(true);
- return session;
- });
- }
- };
- _CoreManager.default.setSessionController(DefaultController);
- var _default = ParseSession;
- exports.default = _default;
- },{"./CoreManager":4,"./ParseObject":27,"./ParseUser":35,"./isRevocableSession":49,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/getPrototypeOf":126,"@babel/runtime-corejs3/helpers/inherits":127,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":135,"@babel/runtime-corejs3/helpers/typeof":140}],35:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
- var _reverseInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/reverse");
- var _Promise2 = _dereq_("@babel/runtime-corejs3/core-js-stable/promise");
- var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
- var _typeof3 = _dereq_("@babel/runtime-corejs3/helpers/typeof");
- var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
- var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
- var _Object$create = _dereq_("@babel/runtime-corejs3/core-js-stable/object/create");
- var _Object$defineProperty2 = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js-stable/symbol");
- var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js-stable/reflect/construct");
- _Object$defineProperty2(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
- var _defineProperty = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property"));
- var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _get2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/get"));
- var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
- var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
- var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _isRevocableSession = _interopRequireDefault(_dereq_("./isRevocableSession"));
- var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
- var _ParseObject2 = _interopRequireDefault(_dereq_("./ParseObject"));
- var _ParseSession = _interopRequireDefault(_dereq_("./ParseSession"));
- var _Storage = _interopRequireDefault(_dereq_("./Storage"));
- function _regeneratorRuntime() {
- "use strict";
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
- _regeneratorRuntime = function () {
- return exports;
- };
- var exports = {},
- Op = Object.prototype,
- hasOwn = Op.hasOwnProperty,
- $Symbol = "function" == typeof _Symbol ? _Symbol : {},
- iteratorSymbol = $Symbol.iterator || "@@iterator",
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- return _Object$defineProperty2(obj, key, {
- value: value,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }), obj[key];
- }
- try {
- define({}, "");
- } catch (err) {
- define = function (obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
- generator = _Object$create(protoGenerator.prototype),
- context = new Context(tryLocsList || []);
- return generator._invoke = function (innerFn, self, context) {
- var state = "suspendedStart";
- return function (method, arg) {
- if ("executing" === state) throw new Error("Generator is already running");
- if ("completed" === state) {
- if ("throw" === method) throw arg;
- return doneResult();
- }
- for (context.method = method, context.arg = arg;;) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
- if ("suspendedStart" === state) throw state = "completed", context.arg;
- context.dispatchException(context.arg);
- } else "return" === context.method && context.abrupt("return", context.arg);
- state = "executing";
- var record = tryCatch(innerFn, self, context);
- if ("normal" === record.type) {
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
- return {
- value: record.arg,
- done: context.done
- };
- }
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
- }
- };
- }(innerFn, self, context), generator;
- }
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- exports.wrap = wrap;
- var ContinueSentinel = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = _Object$getPrototypeOf,
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype);
- function defineIteratorMethods(prototype) {
- var _context7;
- _forEachInstanceProperty(_context7 = ["next", "throw", "return"]).call(_context7, function (method) {
- define(prototype, method, function (arg) {
- return this._invoke(method, arg);
- });
- });
- }
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if ("throw" !== record.type) {
- var result = record.arg,
- value = result.value;
- return value && "object" == _typeof3(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
- result.value = unwrapped, resolve(result);
- }, function (error) {
- return invoke("throw", error, resolve, reject);
- });
- }
- reject(record.arg);
- }
- var previousPromise;
- this._invoke = function (method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- };
- }
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (undefined === method) {
- if (context.delegate = null, "throw" === context.method) {
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
- var info = record.arg;
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
- }
- function pushTryEntry(locs) {
- var entry = {
- tryLoc: locs[0]
- };
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal", delete record.arg, entry.completion = record;
- }
- function Context(tryLocsList) {
- this.tryEntries = [{
- tryLoc: "root"
- }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0);
- }
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) return iteratorMethod.call(iterable);
- if ("function" == typeof iterable.next) return iterable;
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- for (; ++i < iterable.length;) {
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
- }
- return next.value = undefined, next.done = !0, next;
- };
- return next.next = next;
- }
- }
- return {
- next: doneResult
- };
- }
- function doneResult() {
- return {
- value: undefined,
- done: !0
- };
- }
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
- var ctor = "function" == typeof genFun && genFun.constructor;
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
- }, exports.mark = function (genFun) {
- return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun;
- }, exports.awrap = function (arg) {
- return {
- __await: arg
- };
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- void 0 === PromiseImpl && (PromiseImpl = _Promise2);
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
- return this;
- }), define(Gp, "toString", function () {
- return "[object Generator]";
- }), exports.keys = function (object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- return _reverseInstanceProperty(keys).call(keys), function next() {
- for (; keys.length;) {
- var key = keys.pop();
- if (key in object) return next.value = key, next.done = !1, next;
- }
- return next.done = !0, next;
- };
- }, exports.values = values, Context.prototype = {
- constructor: Context,
- reset: function (skipTempReset) {
- var _context8;
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context8 = this.tryEntries).call(_context8, resetTryEntry), !skipTempReset) for (var name in this) {
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined);
- }
- },
- stop: function () {
- this.done = !0;
- var rootRecord = this.tryEntries[0].completion;
- if ("throw" === rootRecord.type) throw rootRecord.arg;
- return this.rval;
- },
- dispatchException: function (exception) {
- if (this.done) throw exception;
- var context = this;
- function handle(loc, caught) {
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i],
- record = entry.completion;
- if ("root" === entry.tryLoc) return handle("end");
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc"),
- hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
- } else {
- if (!hasFinally) throw new Error("try statement without catch or finally");
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
- }
- }
- }
- },
- abrupt: function (type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
- var record = finallyEntry ? finallyEntry.completion : {};
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
- },
- complete: function (record, afterLoc) {
- if ("throw" === record.type) throw record.arg;
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
- },
- finish: function (finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
- }
- },
- catch: function (tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if ("throw" === record.type) {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- throw new Error("illegal catch attempt");
- },
- delegateYield: function (iterable, resultName, nextLoc) {
- return this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
- }
- }, exports;
- }
- function _createSuper(Derived) {
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
- return function () {
- var Super = (0, _getPrototypeOf2.default)(Derived),
- result;
- if (hasNativeReflectConstruct) {
- var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
- result = _Reflect$construct(Super, arguments, NewTarget);
- } else {
- result = Super.apply(this, arguments);
- }
- return (0, _possibleConstructorReturn2.default)(this, result);
- };
- }
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
- if (_Reflect$construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
- }
- var CURRENT_USER_KEY = 'currentUser';
- var canUseCurrentUser = !_CoreManager.default.get('IS_NODE');
- var currentUserCacheMatchesDisk = false;
- var currentUserCache = null;
- var authProviders = {};
- /**
- * <p>A Parse.User object is a local representation of a user persisted to the
- * Parse cloud. This class is a subclass of a Parse.Object, and retains the
- * same functionality of a Parse.Object, but also extends it with various
- * user specific methods, like authentication, signing up, and validation of
- * uniqueness.</p>
- *
- * @alias Parse.User
- * @augments Parse.Object
- */
- var ParseUser = /*#__PURE__*/function (_ParseObject) {
- (0, _inherits2.default)(ParseUser, _ParseObject);
- var _super = _createSuper(ParseUser);
- /**
- * @param {object} attributes The initial set of data to store in the user.
- */
- function ParseUser(attributes
- /*: ?AttributeMap*/
- ) {
- var _this;
- (0, _classCallCheck2.default)(this, ParseUser);
- _this = _super.call(this, '_User');
- if (attributes && (0, _typeof2.default)(attributes) === 'object') {
- if (!_this.set(attributes || {})) {
- throw new Error("Can't create an invalid Parse User");
- }
- }
- return _this;
- }
- /**
- * Request a revocable session token to replace the older style of token.
- *
- * @param {object} options
- * @returns {Promise} A promise that is resolved when the replacement
- * token has been fetched.
- */
- (0, _createClass2.default)(ParseUser, [{
- key: "_upgradeToRevocableSession",
- value: function (options
- /*: RequestOptions*/
- )
- /*: Promise<void>*/
- {
- options = options || {};
- var upgradeOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- upgradeOptions.useMasterKey = options.useMasterKey;
- }
- var controller = _CoreManager.default.getUserController();
- return controller.upgradeToRevocableSession(this, upgradeOptions);
- }
- /**
- * Parse allows you to link your users with {@link https://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication 3rd party authentication}, enabling
- * your users to sign up or log into your application using their existing identities.
- * Since 2.9.0
- *
- * @see {@link https://docs.parseplatform.org/js/guide/#linking-users Linking Users}
- * @param {string | AuthProvider} provider Name of auth provider or {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
- * @param {object} options
- * <ul>
- * <li>If provider is string, options is {@link http://docs.parseplatform.org/parse-server/guide/#supported-3rd-party-authentications authData}
- * <li>If provider is AuthProvider, options is saveOpts
- * </ul>
- * @param {object} saveOpts useMasterKey / sessionToken
- * @returns {Promise} A promise that is fulfilled with the user is linked
- */
- }, {
- key: "linkWith",
- value: function (provider
- /*: any*/
- , options
- /*: { authData?: AuthData }*/
- )
- /*: Promise<ParseUser>*/
- {
- var _this2 = this;
- var saveOpts
- /*:: ?: FullOptions*/
- = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- saveOpts.sessionToken = saveOpts.sessionToken || this.getSessionToken() || '';
- var authType;
- if (typeof provider === 'string') {
- authType = provider;
- if (authProviders[provider]) {
- provider = authProviders[provider];
- } else {
- var authProvider = {
- restoreAuthentication: function () {
- return true;
- },
- getAuthType: function () {
- return authType;
- }
- };
- authProviders[authProvider.getAuthType()] = authProvider;
- provider = authProvider;
- }
- } else {
- authType = provider.getAuthType();
- }
- if (options && options.hasOwnProperty('authData')) {
- var authData = this.get('authData') || {};
- if ((0, _typeof2.default)(authData) !== 'object') {
- throw new Error('Invalid type: authData field should be an object');
- }
- authData[authType] = options.authData;
- var controller = _CoreManager.default.getUserController();
- return controller.linkWith(this, authData, saveOpts);
- } else {
- return new _promise.default(function (resolve, reject) {
- provider.authenticate({
- success: function (provider, result) {
- var opts = {};
- opts.authData = result;
- _this2.linkWith(provider, opts, saveOpts).then(function () {
- resolve(_this2);
- }, function (error) {
- reject(error);
- });
- },
- error: function (provider, _error) {
- reject(_error);
- }
- });
- });
- }
- }
- /**
- * @param provider
- * @param options
- * @param saveOpts
- * @deprecated since 2.9.0 see {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
- * @returns {Promise}
- */
- }, {
- key: "_linkWith",
- value: function (provider
- /*: any*/
- , options
- /*: { authData?: AuthData }*/
- )
- /*: Promise<ParseUser>*/
- {
- var saveOpts
- /*:: ?: FullOptions*/
- = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- return this.linkWith(provider, options, saveOpts);
- }
- /**
- * Synchronizes auth data for a provider (e.g. puts the access token in the
- * right place to be used by the Facebook SDK).
- *
- * @param provider
- */
- }, {
- key: "_synchronizeAuthData",
- value: function (provider
- /*: string*/
- ) {
- if (!this.isCurrent() || !provider) {
- return;
- }
- var authType;
- if (typeof provider === 'string') {
- authType = provider;
- provider = authProviders[authType];
- } else {
- authType = provider.getAuthType();
- }
- var authData = this.get('authData');
- if (!provider || !authData || (0, _typeof2.default)(authData) !== 'object') {
- return;
- }
- var success = provider.restoreAuthentication(authData[authType]);
- if (!success) {
- this._unlinkFrom(provider);
- }
- }
- /**
- * Synchronizes authData for all providers.
- */
- }, {
- key: "_synchronizeAllAuthData",
- value: function () {
- var authData = this.get('authData');
- if ((0, _typeof2.default)(authData) !== 'object') {
- return;
- }
- for (var _key in authData) {
- this._synchronizeAuthData(_key);
- }
- }
- /**
- * Removes null values from authData (which exist temporarily for unlinking)
- */
- }, {
- key: "_cleanupAuthData",
- value: function () {
- if (!this.isCurrent()) {
- return;
- }
- var authData = this.get('authData');
- if ((0, _typeof2.default)(authData) !== 'object') {
- return;
- }
- for (var _key2 in authData) {
- if (!authData[_key2]) {
- delete authData[_key2];
- }
- }
- }
- /**
- * Unlinks a user from a service.
- *
- * @param {string | AuthProvider} provider Name of auth provider or {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
- * @param {object} options MasterKey / SessionToken
- * @returns {Promise} A promise that is fulfilled when the unlinking
- * finishes.
- */
- }, {
- key: "_unlinkFrom",
- value: function (provider
- /*: any*/
- , options
- /*:: ?: FullOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- var _this3 = this;
- return this.linkWith(provider, {
- authData: null
- }, options).then(function () {
- _this3._synchronizeAuthData(provider);
- return _promise.default.resolve(_this3);
- });
- }
- /**
- * Checks whether a user is linked to a service.
- *
- * @param {object} provider service to link to
- * @returns {boolean} true if link was successful
- */
- }, {
- key: "_isLinked",
- value: function (provider
- /*: any*/
- )
- /*: boolean*/
- {
- var authType;
- if (typeof provider === 'string') {
- authType = provider;
- } else {
- authType = provider.getAuthType();
- }
- var authData = this.get('authData') || {};
- if ((0, _typeof2.default)(authData) !== 'object') {
- return false;
- }
- return !!authData[authType];
- }
- /**
- * Deauthenticates all providers.
- */
- }, {
- key: "_logOutWithAll",
- value: function () {
- var authData = this.get('authData');
- if ((0, _typeof2.default)(authData) !== 'object') {
- return;
- }
- for (var _key3 in authData) {
- this._logOutWith(_key3);
- }
- }
- /**
- * Deauthenticates a single provider (e.g. removing access tokens from the
- * Facebook SDK).
- *
- * @param {object} provider service to logout of
- */
- }, {
- key: "_logOutWith",
- value: function (provider
- /*: any*/
- ) {
- if (!this.isCurrent()) {
- return;
- }
- if (typeof provider === 'string') {
- provider = authProviders[provider];
- }
- if (provider && provider.deauthenticate) {
- provider.deauthenticate();
- }
- }
- /**
- * Class instance method used to maintain specific keys when a fetch occurs.
- * Used to ensure that the session token is not lost.
- *
- * @returns {object} sessionToken
- */
- }, {
- key: "_preserveFieldsOnFetch",
- value: function ()
- /*: AttributeMap*/
- {
- return {
- sessionToken: this.get('sessionToken')
- };
- }
- /**
- * Returns true if <code>current</code> would return this user.
- *
- * @returns {boolean} true if user is cached on disk
- */
- }, {
- key: "isCurrent",
- value: function ()
- /*: boolean*/
- {
- var current = ParseUser.current();
- return !!current && current.id === this.id;
- }
- /**
- * Returns true if <code>current</code> would return this user.
- *
- * @returns {Promise<boolean>} true if user is cached on disk
- */
- }, {
- key: "isCurrentAsync",
- value: function () {
- var _isCurrentAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
- var current;
- return _regeneratorRuntime().wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _context.next = 2;
- return ParseUser.currentAsync();
- case 2:
- current = _context.sent;
- return _context.abrupt("return", !!current && current.id === this.id);
- case 4:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function isCurrentAsync() {
- return _isCurrentAsync.apply(this, arguments);
- }
- return isCurrentAsync;
- }()
- /**
- * Returns get("username").
- *
- * @returns {string}
- */
- }, {
- key: "getUsername",
- value: function getUsername()
- /*: ?string*/
- {
- var username = this.get('username');
- if (username == null || typeof username === 'string') {
- return username;
- }
- return '';
- }
- /**
- * Calls set("username", username, options) and returns the result.
- *
- * @param {string} username
- */
- }, {
- key: "setUsername",
- value: function setUsername(username
- /*: string*/
- ) {
- // Strip anonymity
- var authData = this.get('authData');
- if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
- // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
- authData.anonymous = null;
- }
- this.set('username', username);
- }
- /**
- * Calls set("password", password, options) and returns the result.
- *
- * @param {string} password User's Password
- */
- }, {
- key: "setPassword",
- value: function setPassword(password
- /*: string*/
- ) {
- this.set('password', password);
- }
- /**
- * Returns get("email").
- *
- * @returns {string} User's Email
- */
- }, {
- key: "getEmail",
- value: function getEmail()
- /*: ?string*/
- {
- var email = this.get('email');
- if (email == null || typeof email === 'string') {
- return email;
- }
- return '';
- }
- /**
- * Calls set("email", email) and returns the result.
- *
- * @param {string} email
- * @returns {boolean}
- */
- }, {
- key: "setEmail",
- value: function setEmail(email
- /*: string*/
- ) {
- return this.set('email', email);
- }
- /**
- * Returns the session token for this user, if the user has been logged in,
- * or if it is the result of a query with the master key. Otherwise, returns
- * undefined.
- *
- * @returns {string} the session token, or undefined
- */
- }, {
- key: "getSessionToken",
- value: function getSessionToken()
- /*: ?string*/
- {
- var token = this.get('sessionToken');
- if (token == null || typeof token === 'string') {
- return token;
- }
- return '';
- }
- /**
- * Checks whether this user is the current user and has been authenticated.
- *
- * @returns {boolean} whether this user is the current user and is logged in.
- */
- }, {
- key: "authenticated",
- value: function authenticated()
- /*: boolean*/
- {
- var current = ParseUser.current();
- return !!this.get('sessionToken') && !!current && current.id === this.id;
- }
- /**
- * Signs up a new user. You should call this instead of save for
- * new Parse.Users. This will create a new Parse.User on the server, and
- * also persist the session on disk so that you can access the user using
- * <code>current</code>.
- *
- * <p>A username and password must be set before calling signUp.</p>
- *
- * @param {object} attrs Extra fields to set on the new user, or null.
- * @param {object} options
- * @returns {Promise} A promise that is fulfilled when the signup
- * finishes.
- */
- }, {
- key: "signUp",
- value: function signUp(attrs
- /*: AttributeMap*/
- , options
- /*:: ?: FullOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- options = options || {};
- var signupOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- signupOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('installationId')) {
- signupOptions.installationId = options.installationId;
- }
- if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
- signupOptions.context = options.context;
- }
- var controller = _CoreManager.default.getUserController();
- return controller.signUp(this, attrs, signupOptions);
- }
- /**
- * Logs in a Parse.User. On success, this saves the session to disk,
- * so you can retrieve the currently logged in user using
- * <code>current</code>.
- *
- * <p>A username and password must be set before calling logIn.</p>
- *
- * @param {object} options
- * @returns {Promise} A promise that is fulfilled with the user when
- * the login is complete.
- */
- }, {
- key: "logIn",
- value: function logIn(options
- /*:: ?: FullOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- options = options || {};
- var loginOptions = {
- usePost: true
- };
- if (options.hasOwnProperty('useMasterKey')) {
- loginOptions.useMasterKey = options.useMasterKey;
- }
- if (options.hasOwnProperty('installationId')) {
- loginOptions.installationId = options.installationId;
- }
- if (options.hasOwnProperty('usePost')) {
- loginOptions.usePost = options.usePost;
- }
- var controller = _CoreManager.default.getUserController();
- return controller.logIn(this, loginOptions);
- }
- /**
- * Wrap the default save behavior with functionality to save to local
- * storage if this is current user.
- *
- * @param {...any} args
- * @returns {Promise}
- */
- }, {
- key: "save",
- value: function () {
- var _save = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
- var _len,
- args,
- _key4,
- current,
- _args2 = arguments;
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- for (_len = _args2.length, args = new Array(_len), _key4 = 0; _key4 < _len; _key4++) {
- args[_key4] = _args2[_key4];
- }
- _context2.next = 3;
- return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "save", this).apply(this, args);
- case 3:
- _context2.next = 5;
- return this.isCurrentAsync();
- case 5:
- current = _context2.sent;
- if (!current) {
- _context2.next = 8;
- break;
- }
- return _context2.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
- case 8:
- return _context2.abrupt("return", this);
- case 9:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
- function save() {
- return _save.apply(this, arguments);
- }
- return save;
- }()
- /**
- * Wrap the default destroy behavior with functionality that logs out
- * the current user when it is destroyed
- *
- * @param {...any} args
- * @returns {Parse.User}
- */
- }, {
- key: "destroy",
- value: function () {
- var _destroy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
- var _len2,
- args,
- _key5,
- current,
- _args3 = arguments;
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- for (_len2 = _args3.length, args = new Array(_len2), _key5 = 0; _key5 < _len2; _key5++) {
- args[_key5] = _args3[_key5];
- }
- _context3.next = 3;
- return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "destroy", this).apply(this, args);
- case 3:
- _context3.next = 5;
- return this.isCurrentAsync();
- case 5:
- current = _context3.sent;
- if (!current) {
- _context3.next = 8;
- break;
- }
- return _context3.abrupt("return", _CoreManager.default.getUserController().removeUserFromDisk());
- case 8:
- return _context3.abrupt("return", this);
- case 9:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, this);
- }));
- function destroy() {
- return _destroy.apply(this, arguments);
- }
- return destroy;
- }()
- /**
- * Wrap the default fetch behavior with functionality to save to local
- * storage if this is current user.
- *
- * @param {...any} args
- * @returns {Parse.User}
- */
- }, {
- key: "fetch",
- value: function () {
- var _fetch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
- var _len3,
- args,
- _key6,
- current,
- _args4 = arguments;
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- for (_len3 = _args4.length, args = new Array(_len3), _key6 = 0; _key6 < _len3; _key6++) {
- args[_key6] = _args4[_key6];
- }
- _context4.next = 3;
- return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "fetch", this).apply(this, args);
- case 3:
- _context4.next = 5;
- return this.isCurrentAsync();
- case 5:
- current = _context4.sent;
- if (!current) {
- _context4.next = 8;
- break;
- }
- return _context4.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
- case 8:
- return _context4.abrupt("return", this);
- case 9:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4, this);
- }));
- function fetch() {
- return _fetch.apply(this, arguments);
- }
- return fetch;
- }()
- /**
- * Wrap the default fetchWithInclude behavior with functionality to save to local
- * storage if this is current user.
- *
- * @param {...any} args
- * @returns {Parse.User}
- */
- }, {
- key: "fetchWithInclude",
- value: function () {
- var _fetchWithInclude = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
- var _len4,
- args,
- _key7,
- current,
- _args5 = arguments;
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- for (_len4 = _args5.length, args = new Array(_len4), _key7 = 0; _key7 < _len4; _key7++) {
- args[_key7] = _args5[_key7];
- }
- _context5.next = 3;
- return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseUser.prototype), "fetchWithInclude", this).apply(this, args);
- case 3:
- _context5.next = 5;
- return this.isCurrentAsync();
- case 5:
- current = _context5.sent;
- if (!current) {
- _context5.next = 8;
- break;
- }
- return _context5.abrupt("return", _CoreManager.default.getUserController().updateUserOnDisk(this));
- case 8:
- return _context5.abrupt("return", this);
- case 9:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5, this);
- }));
- function fetchWithInclude() {
- return _fetchWithInclude.apply(this, arguments);
- }
- return fetchWithInclude;
- }()
- /**
- * Verify whether a given password is the password of the current user.
- *
- * @param {string} password A password to be verified
- * @param {object} options
- * @returns {Promise} A promise that is fulfilled with a user
- * when the password is correct.
- */
- }, {
- key: "verifyPassword",
- value: function verifyPassword(password
- /*: string*/
- , options
- /*:: ?: RequestOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- var username = this.getUsername() || '';
- return ParseUser.verifyPassword(username, password, options);
- }
- }], [{
- key: "readOnlyAttributes",
- value: function readOnlyAttributes() {
- return ['sessionToken'];
- }
- /**
- * Adds functionality to the existing Parse.User class.
- *
- * @param {object} protoProps A set of properties to add to the prototype
- * @param {object} classProps A set of static properties to add to the class
- * @static
- * @returns {Parse.User} The newly extended Parse.User class
- */
- }, {
- key: "extend",
- value: function extend(protoProps
- /*: { [prop: string]: any }*/
- , classProps
- /*: { [prop: string]: any }*/
- ) {
- if (protoProps) {
- for (var _prop in protoProps) {
- if (_prop !== 'className') {
- (0, _defineProperty.default)(ParseUser.prototype, _prop, {
- value: protoProps[_prop],
- enumerable: false,
- writable: true,
- configurable: true
- });
- }
- }
- }
- if (classProps) {
- for (var _prop2 in classProps) {
- if (_prop2 !== 'className') {
- (0, _defineProperty.default)(ParseUser, _prop2, {
- value: classProps[_prop2],
- enumerable: false,
- writable: true,
- configurable: true
- });
- }
- }
- }
- return ParseUser;
- }
- /**
- * Retrieves the currently logged in ParseUser with a valid session,
- * either from memory or localStorage, if necessary.
- *
- * @static
- * @returns {Parse.Object} The currently logged in Parse.User.
- */
- }, {
- key: "current",
- value: function current()
- /*: ?ParseUser*/
- {
- if (!canUseCurrentUser) {
- return null;
- }
- var controller = _CoreManager.default.getUserController();
- return controller.currentUser();
- }
- /**
- * Retrieves the currently logged in ParseUser from asynchronous Storage.
- *
- * @static
- * @returns {Promise} A Promise that is resolved with the currently
- * logged in Parse User
- */
- }, {
- key: "currentAsync",
- value: function currentAsync()
- /*: Promise<?ParseUser>*/
- {
- if (!canUseCurrentUser) {
- return _promise.default.resolve(null);
- }
- var controller = _CoreManager.default.getUserController();
- return controller.currentUserAsync();
- }
- /**
- * Signs up a new user with a username (or email) and password.
- * This will create a new Parse.User on the server, and also persist the
- * session in localStorage so that you can access the user using
- * {@link #current}.
- *
- * @param {string} username The username (or email) to sign up with.
- * @param {string} password The password to sign up with.
- * @param {object} attrs Extra fields to set on the new user.
- * @param {object} options
- * @static
- * @returns {Promise} A promise that is fulfilled with the user when
- * the signup completes.
- */
- }, {
- key: "signUp",
- value: function signUp(username
- /*: string*/
- , password
- /*: string*/
- , attrs
- /*: AttributeMap*/
- , options
- /*:: ?: FullOptions*/
- ) {
- attrs = attrs || {};
- attrs.username = username;
- attrs.password = password;
- var user = new this(attrs);
- return user.signUp({}, options);
- }
- /**
- * Logs in a user with a username (or email) and password. On success, this
- * saves the session to disk, so you can retrieve the currently logged in
- * user using <code>current</code>.
- *
- * @param {string} username The username (or email) to log in with.
- * @param {string} password The password to log in with.
- * @param {object} options
- * @static
- * @returns {Promise} A promise that is fulfilled with the user when
- * the login completes.
- */
- }, {
- key: "logIn",
- value: function logIn(username
- /*: string*/
- , password
- /*: string*/
- , options
- /*:: ?: FullOptions*/
- ) {
- if (typeof username !== 'string') {
- return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
- } else if (typeof password !== 'string') {
- return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
- }
- var user = new this();
- user._finishFetch({
- username: username,
- password: password
- });
- return user.logIn(options);
- }
- /**
- * Logs in a user with a session token. On success, this saves the session
- * to disk, so you can retrieve the currently logged in user using
- * <code>current</code>.
- *
- * @param {string} sessionToken The sessionToken to log in with.
- * @param {object} options
- * @static
- * @returns {Promise} A promise that is fulfilled with the user when
- * the login completes.
- */
- }, {
- key: "become",
- value: function become(sessionToken
- /*: string*/
- , options
- /*:: ?: RequestOptions*/
- ) {
- if (!canUseCurrentUser) {
- throw new Error('It is not memory-safe to become a user in a server environment');
- }
- options = options || {};
- var becomeOptions
- /*: RequestOptions*/
- = {
- sessionToken: sessionToken
- };
- if (options.hasOwnProperty('useMasterKey')) {
- becomeOptions.useMasterKey = options.useMasterKey;
- }
- var controller = _CoreManager.default.getUserController();
- var user = new this();
- return controller.become(user, becomeOptions);
- }
- /**
- * Retrieves a user with a session token.
- *
- * @param {string} sessionToken The sessionToken to get user with.
- * @param {object} options
- * @static
- * @returns {Promise} A promise that is fulfilled with the user is fetched.
- */
- }, {
- key: "me",
- value: function me(sessionToken
- /*: string*/
- ) {
- var options
- /*:: ?: RequestOptions*/
- = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var controller = _CoreManager.default.getUserController();
- var meOptions
- /*: RequestOptions*/
- = {
- sessionToken: sessionToken
- };
- if (options.useMasterKey) {
- meOptions.useMasterKey = options.useMasterKey;
- }
- var user = new this();
- return controller.me(user, meOptions);
- }
- /**
- * Logs in a user with a session token. On success, this saves the session
- * to disk, so you can retrieve the currently logged in user using
- * <code>current</code>. If there is no session token the user will not logged in.
- *
- * @param {object} userJSON The JSON map of the User's data
- * @static
- * @returns {Promise} A promise that is fulfilled with the user when
- * the login completes.
- */
- }, {
- key: "hydrate",
- value: function hydrate(userJSON
- /*: AttributeMap*/
- ) {
- var controller = _CoreManager.default.getUserController();
- var user = new this();
- return controller.hydrate(user, userJSON);
- }
- /**
- * Static version of {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
- *
- * @param provider
- * @param options
- * @param saveOpts
- * @static
- * @returns {Promise}
- */
- }, {
- key: "logInWith",
- value: function logInWith(provider
- /*: any*/
- , options
- /*: { authData?: AuthData }*/
- , saveOpts
- /*:: ?: FullOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- var user = new this();
- return user.linkWith(provider, options, saveOpts);
- }
- /**
- * Logs out the currently logged in user session. This will remove the
- * session from disk, log out of linked services, and future calls to
- * <code>current</code> will return <code>null</code>.
- *
- * @param {object} options
- * @static
- * @returns {Promise} A promise that is resolved when the session is
- * destroyed on the server.
- */
- }, {
- key: "logOut",
- value: function logOut() {
- var options
- /*: RequestOptions*/
- = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var controller = _CoreManager.default.getUserController();
- return controller.logOut(options);
- }
- /**
- * Requests a password reset email to be sent to the specified email address
- * associated with the user account. This email allows the user to securely
- * reset their password on the Parse site.
- *
- * @param {string} email The email address associated with the user that
- * forgot their password.
- * @param {object} options
- * @static
- * @returns {Promise}
- */
- }, {
- key: "requestPasswordReset",
- value: function requestPasswordReset(email
- /*: string*/
- , options
- /*:: ?: RequestOptions*/
- ) {
- options = options || {};
- var requestOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- requestOptions.useMasterKey = options.useMasterKey;
- }
- var controller = _CoreManager.default.getUserController();
- return controller.requestPasswordReset(email, requestOptions);
- }
- /**
- * Request an email verification.
- *
- * @param {string} email The email address associated with the user that
- * needs to verify their email.
- * @param {object} options
- * @static
- * @returns {Promise}
- */
- }, {
- key: "requestEmailVerification",
- value: function requestEmailVerification(email
- /*: string*/
- , options
- /*:: ?: RequestOptions*/
- ) {
- options = options || {};
- var requestOptions = {};
- if (options.hasOwnProperty('useMasterKey')) {
- requestOptions.useMasterKey = options.useMasterKey;
- }
- var controller = _CoreManager.default.getUserController();
- return controller.requestEmailVerification(email, requestOptions);
- }
- /**
- * Verify whether a given password is the password of the current user.
- *
- * @param {string} username A username to be used for identificaiton
- * @param {string} password A password to be verified
- * @param {object} options
- * @static
- * @returns {Promise} A promise that is fulfilled with a user
- * when the password is correct.
- */
- }, {
- key: "verifyPassword",
- value: function verifyPassword(username
- /*: string*/
- , password
- /*: string*/
- , options
- /*:: ?: RequestOptions*/
- ) {
- if (typeof username !== 'string') {
- return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
- }
- if (typeof password !== 'string') {
- return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
- }
- options = options || {};
- var verificationOption = {};
- if (options.hasOwnProperty('useMasterKey')) {
- verificationOption.useMasterKey = options.useMasterKey;
- }
- var controller = _CoreManager.default.getUserController();
- return controller.verifyPassword(username, password, verificationOption);
- }
- /**
- * Allow someone to define a custom User class without className
- * being rewritten to _User. The default behavior is to rewrite
- * User to _User for legacy reasons. This allows developers to
- * override that behavior.
- *
- * @param {boolean} isAllowed Whether or not to allow custom User class
- * @static
- */
- }, {
- key: "allowCustomUserClass",
- value: function allowCustomUserClass(isAllowed
- /*: boolean*/
- ) {
- _CoreManager.default.set('PERFORM_USER_REWRITE', !isAllowed);
- }
- /**
- * Allows a legacy application to start using revocable sessions. If the
- * current session token is not revocable, a request will be made for a new,
- * revocable session.
- * It is not necessary to call this method from cloud code unless you are
- * handling user signup or login from the server side. In a cloud code call,
- * this function will not attempt to upgrade the current token.
- *
- * @param {object} options
- * @static
- * @returns {Promise} A promise that is resolved when the process has
- * completed. If a replacement session token is requested, the promise
- * will be resolved after a new token has been fetched.
- */
- }, {
- key: "enableRevocableSession",
- value: function enableRevocableSession(options
- /*:: ?: RequestOptions*/
- ) {
- options = options || {};
- _CoreManager.default.set('FORCE_REVOCABLE_SESSION', true);
- if (canUseCurrentUser) {
- var current = ParseUser.current();
- if (current) {
- return current._upgradeToRevocableSession(options);
- }
- }
- return _promise.default.resolve();
- }
- /**
- * Enables the use of become or the current user in a server
- * environment. These features are disabled by default, since they depend on
- * global objects that are not memory-safe for most servers.
- *
- * @static
- */
- }, {
- key: "enableUnsafeCurrentUser",
- value: function enableUnsafeCurrentUser() {
- canUseCurrentUser = true;
- }
- /**
- * Disables the use of become or the current user in any environment.
- * These features are disabled on servers by default, since they depend on
- * global objects that are not memory-safe for most servers.
- *
- * @static
- */
- }, {
- key: "disableUnsafeCurrentUser",
- value: function disableUnsafeCurrentUser() {
- canUseCurrentUser = false;
- }
- /**
- * When registering users with {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith} a basic auth provider
- * is automatically created for you.
- *
- * For advanced authentication, you can register an Auth provider to
- * implement custom authentication, deauthentication.
- *
- * @param provider
- * @see {@link https://parseplatform.org/Parse-SDK-JS/api/master/AuthProvider.html AuthProvider}
- * @see {@link https://docs.parseplatform.org/js/guide/#custom-authentication-module Custom Authentication Module}
- * @static
- */
- }, {
- key: "_registerAuthenticationProvider",
- value: function _registerAuthenticationProvider(provider
- /*: any*/
- ) {
- authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider.
- ParseUser.currentAsync().then(function (current) {
- if (current) {
- current._synchronizeAuthData(provider.getAuthType());
- }
- });
- }
- /**
- * @param provider
- * @param options
- * @param saveOpts
- * @deprecated since 2.9.0 see {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#logInWith logInWith}
- * @static
- * @returns {Promise}
- */
- }, {
- key: "_logInWith",
- value: function _logInWith(provider
- /*: any*/
- , options
- /*: { authData?: AuthData }*/
- , saveOpts
- /*:: ?: FullOptions*/
- ) {
- var user = new this();
- return user.linkWith(provider, options, saveOpts);
- }
- }, {
- key: "_clearCache",
- value: function _clearCache() {
- currentUserCache = null;
- currentUserCacheMatchesDisk = false;
- }
- }, {
- key: "_setCurrentUserCache",
- value: function _setCurrentUserCache(user
- /*: ParseUser*/
- ) {
- currentUserCache = user;
- }
- }]);
- return ParseUser;
- }(_ParseObject2.default);
- _ParseObject2.default.registerSubclass('_User', ParseUser);
- var DefaultController = {
- updateUserOnDisk: function updateUserOnDisk(user) {
- var path = _Storage.default.generatePath(CURRENT_USER_KEY);
- var json = user.toJSON();
- delete json.password;
- json.className = '_User';
- var userData = (0, _stringify.default)(json);
- if (_CoreManager.default.get('ENCRYPTED_USER')) {
- var crypto = _CoreManager.default.getCryptoController();
- userData = crypto.encrypt(json, _CoreManager.default.get('ENCRYPTED_KEY'));
- }
- return _Storage.default.setItemAsync(path, userData).then(function () {
- return user;
- });
- },
- removeUserFromDisk: function removeUserFromDisk() {
- var path = _Storage.default.generatePath(CURRENT_USER_KEY);
- currentUserCacheMatchesDisk = true;
- currentUserCache = null;
- return _Storage.default.removeItemAsync(path);
- },
- setCurrentUser: function setCurrentUser(user) {
- currentUserCache = user;
- user._cleanupAuthData();
- user._synchronizeAllAuthData();
- return DefaultController.updateUserOnDisk(user);
- },
- currentUser: function currentUser()
- /*: ?ParseUser*/
- {
- if (currentUserCache) {
- return currentUserCache;
- }
- if (currentUserCacheMatchesDisk) {
- return null;
- }
- if (_Storage.default.async()) {
- throw new Error('Cannot call currentUser() when using a platform with an async ' + 'storage system. Call currentUserAsync() instead.');
- }
- var path = _Storage.default.generatePath(CURRENT_USER_KEY);
- var userData = _Storage.default.getItem(path);
- currentUserCacheMatchesDisk = true;
- if (!userData) {
- currentUserCache = null;
- return null;
- }
- if (_CoreManager.default.get('ENCRYPTED_USER')) {
- var crypto = _CoreManager.default.getCryptoController();
- userData = crypto.decrypt(userData, _CoreManager.default.get('ENCRYPTED_KEY'));
- }
- userData = JSON.parse(userData);
- if (!userData.className) {
- userData.className = '_User';
- }
- if (userData._id) {
- if (userData.objectId !== userData._id) {
- userData.objectId = userData._id;
- }
- delete userData._id;
- }
- if (userData._sessionToken) {
- userData.sessionToken = userData._sessionToken;
- delete userData._sessionToken;
- }
- var current = _ParseObject2.default.fromJSON(userData);
- currentUserCache = current;
- current._synchronizeAllAuthData();
- return current;
- },
- currentUserAsync: function currentUserAsync()
- /*: Promise<?ParseUser>*/
- {
- if (currentUserCache) {
- return _promise.default.resolve(currentUserCache);
- }
- if (currentUserCacheMatchesDisk) {
- return _promise.default.resolve(null);
- }
- var path = _Storage.default.generatePath(CURRENT_USER_KEY);
- return _Storage.default.getItemAsync(path).then(function (userData) {
- currentUserCacheMatchesDisk = true;
- if (!userData) {
- currentUserCache = null;
- return _promise.default.resolve(null);
- }
- if (_CoreManager.default.get('ENCRYPTED_USER')) {
- var crypto = _CoreManager.default.getCryptoController();
- userData = crypto.decrypt(userData.toString(), _CoreManager.default.get('ENCRYPTED_KEY'));
- }
- userData = JSON.parse(userData);
- if (!userData.className) {
- userData.className = '_User';
- }
- if (userData._id) {
- if (userData.objectId !== userData._id) {
- userData.objectId = userData._id;
- }
- delete userData._id;
- }
- if (userData._sessionToken) {
- userData.sessionToken = userData._sessionToken;
- delete userData._sessionToken;
- }
- var current = _ParseObject2.default.fromJSON(userData);
- currentUserCache = current;
- current._synchronizeAllAuthData();
- return _promise.default.resolve(current);
- });
- },
- signUp: function signUp(user
- /*: ParseUser*/
- , attrs
- /*: AttributeMap*/
- , options
- /*: RequestOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- var username = attrs && attrs.username || user.get('username');
- var password = attrs && attrs.password || user.get('password');
- if (!username || !username.length) {
- return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Cannot sign up user with an empty username.'));
- }
- if (!password || !password.length) {
- return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Cannot sign up user with an empty password.'));
- }
- return user.save(attrs, options).then(function () {
- // Clear the password field
- user._finishFetch({
- password: undefined
- });
- if (canUseCurrentUser) {
- return DefaultController.setCurrentUser(user);
- }
- return user;
- });
- },
- logIn: function logIn(user
- /*: ParseUser*/
- , options
- /*: RequestOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- var RESTController = _CoreManager.default.getRESTController();
- var stateController = _CoreManager.default.getObjectStateController();
- var auth = {
- username: user.get('username'),
- password: user.get('password')
- };
- return RESTController.request(options.usePost ? 'POST' : 'GET', 'login', auth, options).then(function (response) {
- user._migrateId(response.objectId);
- user._setExisted(true);
- stateController.setPendingOp(user._getStateIdentifier(), 'username', undefined);
- stateController.setPendingOp(user._getStateIdentifier(), 'password', undefined);
- response.password = undefined;
- user._finishFetch(response);
- if (!canUseCurrentUser) {
- // We can't set the current user, so just return the one we logged in
- return _promise.default.resolve(user);
- }
- return DefaultController.setCurrentUser(user);
- });
- },
- become: function become(user
- /*: ParseUser*/
- , options
- /*: RequestOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request('GET', 'users/me', {}, options).then(function (response) {
- user._finishFetch(response);
- user._setExisted(true);
- return DefaultController.setCurrentUser(user);
- });
- },
- hydrate: function hydrate(user
- /*: ParseUser*/
- , userJSON
- /*: AttributeMap*/
- )
- /*: Promise<ParseUser>*/
- {
- user._finishFetch(userJSON);
- user._setExisted(true);
- if (userJSON.sessionToken && canUseCurrentUser) {
- return DefaultController.setCurrentUser(user);
- } else {
- return _promise.default.resolve(user);
- }
- },
- me: function me(user
- /*: ParseUser*/
- , options
- /*: RequestOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request('GET', 'users/me', {}, options).then(function (response) {
- user._finishFetch(response);
- user._setExisted(true);
- return user;
- });
- },
- logOut: function logOut(options
- /*: RequestOptions*/
- )
- /*: Promise<ParseUser>*/
- {
- var RESTController = _CoreManager.default.getRESTController();
- if (options.sessionToken) {
- return RESTController.request('POST', 'logout', {}, options);
- }
- return DefaultController.currentUserAsync().then(function (currentUser) {
- var path = _Storage.default.generatePath(CURRENT_USER_KEY);
- var promise = _Storage.default.removeItemAsync(path);
- if (currentUser !== null) {
- var currentSession = currentUser.getSessionToken();
- if (currentSession && (0, _isRevocableSession.default)(currentSession)) {
- promise = promise.then(function () {
- return RESTController.request('POST', 'logout', {}, {
- sessionToken: currentSession
- });
- });
- }
- currentUser._logOutWithAll();
- currentUser._finishFetch({
- sessionToken: undefined
- });
- }
- currentUserCacheMatchesDisk = true;
- currentUserCache = null;
- return promise;
- });
- },
- requestPasswordReset: function requestPasswordReset(email
- /*: string*/
- , options
- /*: RequestOptions*/
- ) {
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request('POST', 'requestPasswordReset', {
- email: email
- }, options);
- },
- upgradeToRevocableSession: function upgradeToRevocableSession(user
- /*: ParseUser*/
- , options
- /*: RequestOptions*/
- ) {
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
- var token, RESTController, result, session, current;
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- token = user.getSessionToken();
- if (token) {
- _context6.next = 3;
- break;
- }
- return _context6.abrupt("return", _promise.default.reject(new _ParseError.default(_ParseError.default.SESSION_MISSING, 'Cannot upgrade a user with no session token')));
- case 3:
- options.sessionToken = token;
- RESTController = _CoreManager.default.getRESTController();
- _context6.next = 7;
- return RESTController.request('POST', 'upgradeToRevocableSession', {}, options);
- case 7:
- result = _context6.sent;
- session = new _ParseSession.default();
- session._finishFetch(result);
- user._finishFetch({
- sessionToken: session.getSessionToken()
- });
- _context6.next = 13;
- return user.isCurrentAsync();
- case 13:
- current = _context6.sent;
- if (!current) {
- _context6.next = 16;
- break;
- }
- return _context6.abrupt("return", DefaultController.setCurrentUser(user));
- case 16:
- return _context6.abrupt("return", _promise.default.resolve(user));
- case 17:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6);
- }))();
- },
- linkWith: function linkWith(user
- /*: ParseUser*/
- , authData
- /*: AuthData*/
- , options
- /*: FullOptions*/
- ) {
- return user.save({
- authData: authData
- }, options).then(function () {
- if (canUseCurrentUser) {
- return DefaultController.setCurrentUser(user);
- }
- return user;
- });
- },
- verifyPassword: function verifyPassword(username
- /*: string*/
- , password
- /*: string*/
- , options
- /*: RequestOptions*/
- ) {
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request('GET', 'verifyPassword', {
- username: username,
- password: password
- }, options);
- },
- requestEmailVerification: function requestEmailVerification(email
- /*: string*/
- , options
- /*: RequestOptions*/
- ) {
- var RESTController = _CoreManager.default.getRESTController();
- return RESTController.request('POST', 'verificationEmailRequest', {
- email: email
- }, options);
- }
- };
- _CoreManager.default.setUserController(DefaultController);
- var _default = ParseUser;
- exports.default = _default;
- },{"./CoreManager":4,"./ParseError":22,"./ParseObject":27,"./ParseSession":34,"./Storage":39,"./isRevocableSession":49,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/reverse":70,"@babel/runtime-corejs3/core-js-stable/instance/slice":71,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/object/create":80,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-prototype-of":88,"@babel/runtime-corejs3/core-js-stable/object/set-prototype-of":90,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/reflect/construct":93,"@babel/runtime-corejs3/core-js-stable/symbol":97,"@babel/runtime-corejs3/helpers/asyncToGenerator":120,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/get":125,"@babel/runtime-corejs3/helpers/getPrototypeOf":126,"@babel/runtime-corejs3/helpers/inherits":127,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":135,"@babel/runtime-corejs3/helpers/typeof":140}],36:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getPushStatus = getPushStatus;
- exports.send = send;
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _ParseQuery = _interopRequireDefault(_dereq_("./ParseQuery"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- /**
- * Contains functions to deal with Push in Parse.
- *
- * @class Parse.Push
- * @static
- * @hideconstructor
- */
- /**
- * Sends a push notification.
- * **Available in Cloud Code only.**
- *
- * See {@link https://docs.parseplatform.org/js/guide/#push-notifications Push Notification Guide}
- *
- * @function send
- * @name Parse.Push.send
- * @param {object} data - The data of the push notification. Valid fields
- * are:
- * <ol>
- * <li>channels - An Array of channels to push to.</li>
- * <li>push_time - A Date object for when to send the push.</li>
- * <li>expiration_time - A Date object for when to expire
- * the push.</li>
- * <li>expiration_interval - The seconds from now to expire the push.</li>
- * <li>where - A Parse.Query over Parse.Installation that is used to match
- * a set of installations to push to.</li>
- * <li>data - The data to send as part of the push.</li>
- * <ol>
- * @param {object} options Valid options
- * are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * </ul>
- * @returns {Promise} A promise that is fulfilled when the push request
- * completes.
- */
- function send(data
- /*: PushData*/
- )
- /*: Promise*/
- {
- var options
- /*:: ?: FullOptions*/
- = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (data.where && data.where instanceof _ParseQuery.default) {
- data.where = data.where.toJSON().where;
- }
- if (data.push_time && (0, _typeof2.default)(data.push_time) === 'object') {
- data.push_time = data.push_time.toJSON();
- }
- if (data.expiration_time && (0, _typeof2.default)(data.expiration_time) === 'object') {
- data.expiration_time = data.expiration_time.toJSON();
- }
- if (data.expiration_time && data.expiration_interval) {
- throw new Error('expiration_time and expiration_interval cannot both be set.');
- }
- var pushOptions = {
- useMasterKey: true
- };
- if (options.hasOwnProperty('useMasterKey')) {
- pushOptions.useMasterKey = options.useMasterKey;
- }
- return _CoreManager.default.getPushController().send(data, pushOptions);
- }
- /**
- * Gets push status by Id
- *
- * @function getPushStatus
- * @name Parse.Push.getPushStatus
- * @param {string} pushStatusId The Id of Push Status.
- * @param {object} options Valid options
- * are:<ul>
- * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
- * be used for this request.
- * </ul>
- * @returns {Parse.Object} Status of Push.
- */
- function getPushStatus(pushStatusId
- /*: string*/
- )
- /*: Promise<string>*/
- {
- var options
- /*:: ?: FullOptions*/
- = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var pushOptions = {
- useMasterKey: true
- };
- if (options.hasOwnProperty('useMasterKey')) {
- pushOptions.useMasterKey = options.useMasterKey;
- }
- var query = new _ParseQuery.default('_PushStatus');
- return query.get(pushStatusId, pushOptions);
- }
- var DefaultController = {
- send: function (data
- /*: PushData*/
- , options
- /*:: ?: FullOptions*/
- ) {
- return _CoreManager.default.getRESTController().request('POST', 'push', data, options);
- }
- };
- _CoreManager.default.setPushController(DefaultController);
- },{"./CoreManager":4,"./ParseQuery":30,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],37:[function(_dereq_,module,exports){
- (function (process){(function (){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _Object$defineProperties = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-properties");
- var _Object$getOwnPropertyDescriptors = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
- var _forEachInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each");
- var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
- var _filterInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/filter");
- var _Object$getOwnPropertySymbols = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
- var _Object$keys = _dereq_("@babel/runtime-corejs3/core-js-stable/object/keys");
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _setTimeout2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/set-timeout"));
- var _includes = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/includes"));
- var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- var _ParseError = _interopRequireDefault(_dereq_("./ParseError"));
- var _promiseUtils = _dereq_("./promiseUtils");
- function ownKeys(object, enumerableOnly) {
- var keys = _Object$keys(object);
- if (_Object$getOwnPropertySymbols) {
- var symbols = _Object$getOwnPropertySymbols(object);
- enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, 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 _context4, _context5;
- var source = null != arguments[i] ? arguments[i] : {};
- i % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) {
- (0, _defineProperty2.default)(target, key, source[key]);
- }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context5 = ownKeys(Object(source))).call(_context5, function (key) {
- _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
- });
- }
- return target;
- }
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- /* global XMLHttpRequest, XDomainRequest */
- var uuidv4 = _dereq_('./uuid');
- var XHR = null;
- if (typeof XMLHttpRequest !== 'undefined') {
- XHR = XMLHttpRequest;
- }
- var useXDomainRequest = false;
- if (typeof XDomainRequest !== 'undefined' && !('withCredentials' in new XMLHttpRequest())) {
- useXDomainRequest = true;
- }
- function ajaxIE9(method
- /*: string*/
- , url
- /*: string*/
- , data
- /*: any*/
- , headers
- /*:: ?: any*/
- , options
- /*:: ?: FullOptions*/
- ) {
- return new _promise.default(function (resolve, reject) {
- var xdr = new XDomainRequest();
- xdr.onload = function () {
- var response;
- try {
- response = JSON.parse(xdr.responseText);
- } catch (e) {
- reject(e);
- }
- if (response) {
- resolve({
- response: response
- });
- }
- };
- xdr.onerror = xdr.ontimeout = function () {
- // Let's fake a real error message.
- var fakeResponse = {
- responseText: (0, _stringify.default)({
- code: _ParseError.default.X_DOMAIN_REQUEST,
- error: "IE's XDomainRequest does not supply error info."
- })
- };
- reject(fakeResponse);
- };
- xdr.onprogress = function () {
- if (options && typeof options.progress === 'function') {
- options.progress(xdr.responseText);
- }
- };
- xdr.open(method, url);
- xdr.send(data);
- if (options && typeof options.requestTask === 'function') {
- options.requestTask(xdr);
- }
- });
- }
- var RESTController = {
- ajax: function (method
- /*: string*/
- , url
- /*: string*/
- , data
- /*: any*/
- , headers
- /*:: ?: any*/
- , options
- /*:: ?: FullOptions*/
- ) {
- var _context;
- if (useXDomainRequest) {
- return ajaxIE9(method, url, data, headers, options);
- }
- var promise = (0, _promiseUtils.resolvingPromise)();
- var isIdempotent = _CoreManager.default.get('IDEMPOTENCY') && (0, _includes.default)(_context = ['POST', 'PUT']).call(_context, method);
- var requestId = isIdempotent ? uuidv4() : '';
- var attempts = 0;
- (function dispatch() {
- if (XHR == null) {
- throw new Error('Cannot make a request: No definition of XMLHttpRequest was found.');
- }
- var handled = false;
- var xhr = new XHR();
- xhr.onreadystatechange = function () {
- if (xhr.readyState !== 4 || handled || xhr._aborted) {
- return;
- }
- handled = true;
- if (xhr.status >= 200 && xhr.status < 300) {
- var response;
- try {
- response = JSON.parse(xhr.responseText);
- if (typeof xhr.getResponseHeader === 'function') {
- var _context2, _context3;
- if ((0, _includes.default)(_context2 = xhr.getAllResponseHeaders() || '').call(_context2, 'x-parse-job-status-id: ')) {
- response = xhr.getResponseHeader('x-parse-job-status-id');
- }
- if ((0, _includes.default)(_context3 = xhr.getAllResponseHeaders() || '').call(_context3, 'x-parse-push-status-id: ')) {
- response = xhr.getResponseHeader('x-parse-push-status-id');
- }
- }
- } catch (e) {
- promise.reject(e.toString());
- }
- if (response) {
- promise.resolve({
- response: response,
- status: xhr.status,
- xhr: xhr
- });
- }
- } else if (xhr.status >= 500 || xhr.status === 0) {
- // retry on 5XX or node-xmlhttprequest error
- if (++attempts < _CoreManager.default.get('REQUEST_ATTEMPT_LIMIT')) {
- // Exponentially-growing random delay
- var delay = Math.round(Math.random() * 125 * Math.pow(2, attempts));
- (0, _setTimeout2.default)(dispatch, delay);
- } else if (xhr.status === 0) {
- promise.reject('Unable to connect to the Parse API');
- } else {
- // After the retry limit is reached, fail
- promise.reject(xhr);
- }
- } else {
- promise.reject(xhr);
- }
- };
- headers = headers || {};
- if (typeof headers['Content-Type'] !== 'string') {
- headers['Content-Type'] = 'text/plain'; // Avoid pre-flight
- }
- if (_CoreManager.default.get('IS_NODE')) {
- headers['User-Agent'] = 'Parse/' + _CoreManager.default.get('VERSION') + ' (NodeJS ' + process.versions.node + ')';
- }
- if (isIdempotent) {
- headers['X-Parse-Request-Id'] = requestId;
- }
- if (_CoreManager.default.get('SERVER_AUTH_TYPE') && _CoreManager.default.get('SERVER_AUTH_TOKEN')) {
- headers['Authorization'] = _CoreManager.default.get('SERVER_AUTH_TYPE') + ' ' + _CoreManager.default.get('SERVER_AUTH_TOKEN');
- }
- var customHeaders = _CoreManager.default.get('REQUEST_HEADERS');
- for (var key in customHeaders) {
- headers[key] = customHeaders[key];
- }
- function handleProgress(type, event) {
- if (options && typeof options.progress === 'function') {
- if (event.lengthComputable) {
- options.progress(event.loaded / event.total, event.loaded, event.total, {
- type: type
- });
- } else {
- options.progress(null, null, null, {
- type: type
- });
- }
- }
- }
- xhr.onprogress = function (event) {
- handleProgress('download', event);
- };
- if (xhr.upload) {
- xhr.upload.onprogress = function (event) {
- handleProgress('upload', event);
- };
- }
- xhr.open(method, url, true);
- for (var h in headers) {
- xhr.setRequestHeader(h, headers[h]);
- }
- xhr.onabort = function () {
- promise.resolve({
- response: {
- results: []
- },
- status: 0,
- xhr: xhr
- });
- };
- xhr.send(data);
- if (options && typeof options.requestTask === 'function') {
- options.requestTask(xhr);
- }
- })();
- return promise;
- },
- request: function request(method
- /*: string*/
- , path
- /*: string*/
- , data
- /*: mixed*/
- , options
- /*:: ?: RequestOptions*/
- ) {
- options = options || {};
- var url = _CoreManager.default.get('SERVER_URL');
- if (url[url.length - 1] !== '/') {
- url += '/';
- }
- url += path;
- var payload = {};
- if (data && (0, _typeof2.default)(data) === 'object') {
- for (var k in data) {
- payload[k] = data[k];
- }
- } // Add context
- var context = options.context;
- if (context !== undefined) {
- payload._context = context;
- }
- if (method !== 'POST') {
- payload._method = method;
- method = 'POST';
- }
- payload._ApplicationId = _CoreManager.default.get('APPLICATION_ID');
- var jsKey = _CoreManager.default.get('JAVASCRIPT_KEY');
- if (jsKey) {
- payload._JavaScriptKey = jsKey;
- }
- payload._ClientVersion = _CoreManager.default.get('VERSION');
- var useMasterKey = options.useMasterKey;
- if (typeof useMasterKey === 'undefined') {
- useMasterKey = _CoreManager.default.get('USE_MASTER_KEY');
- }
- if (useMasterKey) {
- if (_CoreManager.default.get('MASTER_KEY')) {
- delete payload._JavaScriptKey;
- payload._MasterKey = _CoreManager.default.get('MASTER_KEY');
- } else {
- throw new Error('Cannot use the Master Key, it has not been provided.');
- }
- }
- if (_CoreManager.default.get('FORCE_REVOCABLE_SESSION')) {
- payload._RevocableSession = '1';
- }
- var installationId = options.installationId;
- var installationIdPromise;
- if (installationId && typeof installationId === 'string') {
- installationIdPromise = _promise.default.resolve(installationId);
- } else {
- var installationController = _CoreManager.default.getInstallationController();
- installationIdPromise = installationController.currentInstallationId();
- }
- return installationIdPromise.then(function (iid) {
- payload._InstallationId = iid;
- var userController = _CoreManager.default.getUserController();
- if (options && typeof options.sessionToken === 'string') {
- return _promise.default.resolve(options.sessionToken);
- } else if (userController) {
- return userController.currentUserAsync().then(function (user) {
- if (user) {
- return _promise.default.resolve(user.getSessionToken());
- }
- return _promise.default.resolve(null);
- });
- }
- return _promise.default.resolve(null);
- }).then(function (token) {
- if (token) {
- payload._SessionToken = token;
- }
- var payloadString = (0, _stringify.default)(payload);
- return RESTController.ajax(method, url, payloadString, {}, options).then(function (_ref) {
- var response = _ref.response,
- status = _ref.status;
- if (options.returnStatus) {
- return _objectSpread(_objectSpread({}, response), {}, {
- _status: status
- });
- } else {
- return response;
- }
- });
- }).catch(RESTController.handleError);
- },
- handleError: function handleError(response) {
- // Transform the error into an instance of ParseError by trying to parse
- // the error string as JSON
- var error;
- if (response && response.responseText) {
- try {
- var errorJSON = JSON.parse(response.responseText);
- error = new _ParseError.default(errorJSON.code, errorJSON.error);
- } catch (e) {
- // If we fail to parse the error text, that's okay.
- error = new _ParseError.default(_ParseError.default.INVALID_JSON, 'Received an error with invalid JSON from Parse: ' + response.responseText);
- }
- } else {
- var message = response.message ? response.message : response;
- error = new _ParseError.default(_ParseError.default.CONNECTION_FAILED, 'XMLHttpRequest failed: ' + (0, _stringify.default)(message));
- }
- return _promise.default.reject(error);
- },
- _setXHR: function _setXHR(xhr
- /*: any*/
- ) {
- XHR = xhr;
- },
- _getXHR: function _getXHR() {
- return XHR;
- }
- };
- module.exports = RESTController;
- }).call(this)}).call(this,_dereq_('_process'))
- },{"./CoreManager":4,"./ParseError":22,"./promiseUtils":51,"./uuid":54,"@babel/runtime-corejs3/core-js-stable/instance/filter":61,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/includes":65,"@babel/runtime-corejs3/core-js-stable/json/stringify":76,"@babel/runtime-corejs3/core-js-stable/object/define-properties":81,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":85,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors":86,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols":87,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/core-js-stable/set-timeout":95,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140,"_process":145}],38:[function(_dereq_,module,exports){
- "use strict";
- var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
- var _WeakMap = _dereq_("@babel/runtime-corejs3/core-js-stable/weak-map");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.clearAllState = clearAllState;
- exports.commitServerChanges = commitServerChanges;
- exports.duplicateState = duplicateState;
- exports.enqueueTask = enqueueTask;
- exports.estimateAttribute = estimateAttribute;
- exports.estimateAttributes = estimateAttributes;
- exports.getObjectCache = getObjectCache;
- exports.getPendingOps = getPendingOps;
- exports.getServerData = getServerData;
- exports.getState = getState;
- exports.initializeState = initializeState;
- exports.mergeFirstPendingState = mergeFirstPendingState;
- exports.popPendingState = popPendingState;
- exports.pushPendingState = pushPendingState;
- exports.removeState = removeState;
- exports.setPendingOp = setPendingOp;
- exports.setServerData = setServerData;
- var ObjectStateMutations = _interopRequireWildcard(_dereq_("./ObjectStateMutations"));
- function _getRequireWildcardCache(nodeInterop) {
- if (typeof _WeakMap !== "function") return null;
- var cacheBabelInterop = new _WeakMap();
- var cacheNodeInterop = new _WeakMap();
- return (_getRequireWildcardCache = function (nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
- }
- function _interopRequireWildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) {
- return obj;
- }
- if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
- return {
- default: obj
- };
- }
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) {
- return cache.get(obj);
- }
- var newObj = {};
- for (var key in obj) {
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) {
- _Object$defineProperty(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
- newObj.default = obj;
- if (cache) {
- cache.set(obj, newObj);
- }
- return newObj;
- }
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- var objectState
- /*: {
- [className: string]: {
- [id: string]: State,
- },
- }*/
- = {};
- function getState(obj
- /*: ObjectIdentifier*/
- )
- /*: ?State*/
- {
- var classData = objectState[obj.className];
- if (classData) {
- return classData[obj.id] || null;
- }
- return null;
- }
- function initializeState(obj
- /*: ObjectIdentifier*/
- , initial
- /*:: ?: State*/
- )
- /*: State*/
- {
- var state = getState(obj);
- if (state) {
- return state;
- }
- if (!objectState[obj.className]) {
- objectState[obj.className] = {};
- }
- if (!initial) {
- initial = ObjectStateMutations.defaultState();
- }
- state = objectState[obj.className][obj.id] = initial;
- return state;
- }
- function removeState(obj
- /*: ObjectIdentifier*/
- )
- /*: ?State*/
- {
- var state = getState(obj);
- if (state === null) {
- return null;
- }
- delete objectState[obj.className][obj.id];
- return state;
- }
- function getServerData(obj
- /*: ObjectIdentifier*/
- )
- /*: AttributeMap*/
- {
- var state = getState(obj);
- if (state) {
- return state.serverData;
- }
- return {};
- }
- function setServerData(obj
- /*: ObjectIdentifier*/
- , attributes
- /*: AttributeMap*/
- ) {
- var serverData = initializeState(obj).serverData;
- ObjectStateMutations.setServerData(serverData, attributes);
- }
- function getPendingOps(obj
- /*: ObjectIdentifier*/
- )
- /*: Array<OpsMap>*/
- {
- var state = getState(obj);
- if (state) {
- return state.pendingOps;
- }
- return [{}];
- }
- function setPendingOp(obj
- /*: ObjectIdentifier*/
- , attr
- /*: string*/
- , op
- /*: ?Op*/
- ) {
- var pendingOps = initializeState(obj).pendingOps;
- ObjectStateMutations.setPendingOp(pendingOps, attr, op);
- }
- function pushPendingState(obj
- /*: ObjectIdentifier*/
- ) {
- var pendingOps = initializeState(obj).pendingOps;
- ObjectStateMutations.pushPendingState(pendingOps);
- }
- function popPendingState(obj
- /*: ObjectIdentifier*/
- )
- /*: OpsMap*/
- {
- var pendingOps = initializeState(obj).pendingOps;
- return ObjectStateMutations.popPendingState(pendingOps);
- }
- function mergeFirstPendingState(obj
- /*: ObjectIdentifier*/
- ) {
- var pendingOps = getPendingOps(obj);
- ObjectStateMutations.mergeFirstPendingState(pendingOps);
- }
- function getObjectCache(obj
- /*: ObjectIdentifier*/
- )
- /*: ObjectCache*/
- {
- var state = getState(obj);
- if (state) {
- return state.objectCache;
- }
- return {};
- }
- function estimateAttribute(obj
- /*: ObjectIdentifier*/
- , attr
- /*: string*/
- )
- /*: mixed*/
- {
- var serverData = getServerData(obj);
- var pendingOps = getPendingOps(obj);
- return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj.className, obj.id, attr);
- }
- function estimateAttributes(obj
- /*: ObjectIdentifier*/
- )
- /*: AttributeMap*/
- {
- var serverData = getServerData(obj);
- var pendingOps = getPendingOps(obj);
- return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj.className, obj.id);
- }
- function commitServerChanges(obj
- /*: ObjectIdentifier*/
- , changes
- /*: AttributeMap*/
- ) {
- var state = initializeState(obj);
- ObjectStateMutations.commitServerChanges(state.serverData, state.objectCache, changes);
- }
- function enqueueTask(obj
- /*: ObjectIdentifier*/
- , task
- /*: () => Promise*/
- )
- /*: Promise*/
- {
- var state = initializeState(obj);
- return state.tasks.enqueue(task);
- }
- function clearAllState() {
- objectState = {};
- }
- function duplicateState(source
- /*: { id: string }*/
- , dest
- /*: { id: string }*/
- ) {
- dest.id = source.id;
- }
- },{"./ObjectStateMutations":16,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":85,"@babel/runtime-corejs3/core-js-stable/weak-map":98,"@babel/runtime-corejs3/helpers/typeof":140}],39:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
- var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- var Storage = {
- async: function ()
- /*: boolean*/
- {
- var controller = _CoreManager.default.getStorageController();
- return !!controller.async;
- },
- getItem: function (path
- /*: string*/
- )
- /*: ?string*/
- {
- var controller = _CoreManager.default.getStorageController();
- if (controller.async === 1) {
- throw new Error('Synchronous storage is not supported by the current storage controller');
- }
- return controller.getItem(path);
- },
- getItemAsync: function (path
- /*: string*/
- )
- /*: Promise<string>*/
- {
- var controller = _CoreManager.default.getStorageController();
- if (controller.async === 1) {
- return controller.getItemAsync(path);
- }
- return _promise.default.resolve(controller.getItem(path));
- },
- setItem: function (path
- /*: string*/
- , value
- /*: string*/
- )
- /*: void*/
- {
- var controller = _CoreManager.default.getStorageController();
- if (controller.async === 1) {
- throw new Error('Synchronous storage is not supported by the current storage controller');
- }
- return controller.setItem(path, value);
- },
- setItemAsync: function (path
- /*: string*/
- , value
- /*: string*/
- )
- /*: Promise<void>*/
- {
- var controller = _CoreManager.default.getStorageController();
- if (controller.async === 1) {
- return controller.setItemAsync(path, value);
- }
- return _promise.default.resolve(controller.setItem(path, value));
- },
- removeItem: function (path
- /*: string*/
- )
- /*: void*/
- {
- var controller = _CoreManager.default.getStorageController();
- if (controller.async === 1) {
- throw new Error('Synchronous storage is not supported by the current storage controller');
- }
- return controller.removeItem(path);
- },
- removeItemAsync: function (path
- /*: string*/
- )
- /*: Promise<void>*/
- {
- var controller = _CoreManager.default.getStorageController();
- if (controller.async === 1) {
- return controller.removeItemAsync(path);
- }
- return _promise.default.resolve(controller.removeItem(path));
- },
- getAllKeys: function ()
- /*: Array<string>*/
- {
- var controller = _CoreManager.default.getStorageController();
- if (controller.async === 1) {
- throw new Error('Synchronous storage is not supported by the current storage controller');
- }
- return controller.getAllKeys();
- },
- getAllKeysAsync: function ()
- /*: Promise<Array<string>>*/
- {
- var controller = _CoreManager.default.getStorageController();
- if (controller.async === 1) {
- return controller.getAllKeysAsync();
- }
- return _promise.default.resolve(controller.getAllKeys());
- },
- generatePath: function (path
- /*: string*/
- )
- /*: string*/
- {
- if (!_CoreManager.default.get('APPLICATION_ID')) {
- throw new Error('You need to call Parse.initialize before using Parse.');
- }
- if (typeof path !== 'string') {
- throw new Error('Tried to get a Storage path that was not a String.');
- }
- if (path[0] === '/') {
- path = path.substr(1);
- }
- return 'Parse/' + _CoreManager.default.get('APPLICATION_ID') + '/' + path;
- },
- _clear: function () {
- var controller = _CoreManager.default.getStorageController();
- if (controller.hasOwnProperty('clear')) {
- controller.clear();
- }
- }
- };
- module.exports = Storage;
- _CoreManager.default.setStorageController(_dereq_('./StorageController.browser'));
- },{"./CoreManager":4,"./StorageController.browser":40,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],40:[function(_dereq_,module,exports){
- "use strict";
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- * @private
- */
- /* global localStorage */
- var StorageController = {
- async: 0,
- getItem: function (path
- /*: string*/
- )
- /*: ?string*/
- {
- return localStorage.getItem(path);
- },
- setItem: function (path
- /*: string*/
- , value
- /*: string*/
- ) {
- try {
- localStorage.setItem(path, value);
- } catch (e) {
- // Quota exceeded, possibly due to Safari Private Browsing mode
- console.log(e.message);
- }
- },
- removeItem: function (path
- /*: string*/
- ) {
- localStorage.removeItem(path);
- },
- getAllKeys: function () {
- var keys = [];
- for (var i = 0; i < localStorage.length; i += 1) {
- keys.push(localStorage.key(i));
- }
- return keys;
- },
- clear: function () {
- localStorage.clear();
- }
- };
- module.exports = StorageController;
- },{}],41:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
- var _defineProperty2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/defineProperty"));
- var _promiseUtils = _dereq_("./promiseUtils");
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- var TaskQueue = /*#__PURE__*/function () {
- function TaskQueue() {
- (0, _classCallCheck2.default)(this, TaskQueue);
- (0, _defineProperty2.default)(this, "queue", void 0);
- this.queue = [];
- }
- (0, _createClass2.default)(TaskQueue, [{
- key: "enqueue",
- value: function (task
- /*: () => Promise*/
- )
- /*: Promise*/
- {
- var _this = this;
- var taskComplete = new _promiseUtils.resolvingPromise();
- this.queue.push({
- task: task,
- _completion: taskComplete
- });
- if (this.queue.length === 1) {
- task().then(function () {
- _this._dequeue();
- taskComplete.resolve();
- }, function (error) {
- _this._dequeue();
- taskComplete.reject(error);
- });
- }
- return taskComplete;
- }
- }, {
- key: "_dequeue",
- value: function () {
- var _this2 = this;
- this.queue.shift();
- if (this.queue.length) {
- var next = this.queue[0];
- next.task().then(function () {
- _this2._dequeue();
- next._completion.resolve();
- }, function (error) {
- _this2._dequeue();
- next._completion.reject(error);
- });
- }
- }
- }]);
- return TaskQueue;
- }();
- module.exports = TaskQueue;
- },{"./promiseUtils":51,"@babel/runtime-corejs3/helpers/classCallCheck":121,"@babel/runtime-corejs3/helpers/createClass":123,"@babel/runtime-corejs3/helpers/defineProperty":124,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],42:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- var _typeof = _dereq_("@babel/runtime-corejs3/helpers/typeof");
- var _WeakMap2 = _dereq_("@babel/runtime-corejs3/core-js-stable/weak-map");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.clearAllState = clearAllState;
- exports.commitServerChanges = commitServerChanges;
- exports.duplicateState = duplicateState;
- exports.enqueueTask = enqueueTask;
- exports.estimateAttribute = estimateAttribute;
- exports.estimateAttributes = estimateAttributes;
- exports.getObjectCache = getObjectCache;
- exports.getPendingOps = getPendingOps;
- exports.getServerData = getServerData;
- exports.getState = getState;
- exports.initializeState = initializeState;
- exports.mergeFirstPendingState = mergeFirstPendingState;
- exports.popPendingState = popPendingState;
- exports.pushPendingState = pushPendingState;
- exports.removeState = removeState;
- exports.setPendingOp = setPendingOp;
- exports.setServerData = setServerData;
- var _weakMap = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/weak-map"));
- var ObjectStateMutations = _interopRequireWildcard(_dereq_("./ObjectStateMutations"));
- var _TaskQueue = _interopRequireDefault(_dereq_("./TaskQueue"));
- function _getRequireWildcardCache(nodeInterop) {
- if (typeof _WeakMap2 !== "function") return null;
- var cacheBabelInterop = new _WeakMap2();
- var cacheNodeInterop = new _WeakMap2();
- return (_getRequireWildcardCache = function (nodeInterop) {
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
- })(nodeInterop);
- }
- function _interopRequireWildcard(obj, nodeInterop) {
- if (!nodeInterop && obj && obj.__esModule) {
- return obj;
- }
- if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
- return {
- default: obj
- };
- }
- var cache = _getRequireWildcardCache(nodeInterop);
- if (cache && cache.has(obj)) {
- return cache.get(obj);
- }
- var newObj = {};
- for (var key in obj) {
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = _Object$defineProperty && _Object$getOwnPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
- if (desc && (desc.get || desc.set)) {
- _Object$defineProperty(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
- newObj.default = obj;
- if (cache) {
- cache.set(obj, newObj);
- }
- return newObj;
- }
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- var objectState = new _weakMap.default();
- function getState(obj
- /*: ParseObject*/
- )
- /*: ?State*/
- {
- var classData = objectState.get(obj);
- return classData || null;
- }
- function initializeState(obj
- /*: ParseObject*/
- , initial
- /*:: ?: State*/
- )
- /*: State*/
- {
- var state = getState(obj);
- if (state) {
- return state;
- }
- if (!initial) {
- initial = {
- serverData: {},
- pendingOps: [{}],
- objectCache: {},
- tasks: new _TaskQueue.default(),
- existed: false
- };
- }
- state = initial;
- objectState.set(obj, state);
- return state;
- }
- function removeState(obj
- /*: ParseObject*/
- )
- /*: ?State*/
- {
- var state = getState(obj);
- if (state === null) {
- return null;
- }
- objectState.delete(obj);
- return state;
- }
- function getServerData(obj
- /*: ParseObject*/
- )
- /*: AttributeMap*/
- {
- var state = getState(obj);
- if (state) {
- return state.serverData;
- }
- return {};
- }
- function setServerData(obj
- /*: ParseObject*/
- , attributes
- /*: AttributeMap*/
- ) {
- var serverData = initializeState(obj).serverData;
- ObjectStateMutations.setServerData(serverData, attributes);
- }
- function getPendingOps(obj
- /*: ParseObject*/
- )
- /*: Array<OpsMap>*/
- {
- var state = getState(obj);
- if (state) {
- return state.pendingOps;
- }
- return [{}];
- }
- function setPendingOp(obj
- /*: ParseObject*/
- , attr
- /*: string*/
- , op
- /*: ?Op*/
- ) {
- var pendingOps = initializeState(obj).pendingOps;
- ObjectStateMutations.setPendingOp(pendingOps, attr, op);
- }
- function pushPendingState(obj
- /*: ParseObject*/
- ) {
- var pendingOps = initializeState(obj).pendingOps;
- ObjectStateMutations.pushPendingState(pendingOps);
- }
- function popPendingState(obj
- /*: ParseObject*/
- )
- /*: OpsMap*/
- {
- var pendingOps = initializeState(obj).pendingOps;
- return ObjectStateMutations.popPendingState(pendingOps);
- }
- function mergeFirstPendingState(obj
- /*: ParseObject*/
- ) {
- var pendingOps = getPendingOps(obj);
- ObjectStateMutations.mergeFirstPendingState(pendingOps);
- }
- function getObjectCache(obj
- /*: ParseObject*/
- )
- /*: ObjectCache*/
- {
- var state = getState(obj);
- if (state) {
- return state.objectCache;
- }
- return {};
- }
- function estimateAttribute(obj
- /*: ParseObject*/
- , attr
- /*: string*/
- )
- /*: mixed*/
- {
- var serverData = getServerData(obj);
- var pendingOps = getPendingOps(obj);
- return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj.className, obj.id, attr);
- }
- function estimateAttributes(obj
- /*: ParseObject*/
- )
- /*: AttributeMap*/
- {
- var serverData = getServerData(obj);
- var pendingOps = getPendingOps(obj);
- return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj.className, obj.id);
- }
- function commitServerChanges(obj
- /*: ParseObject*/
- , changes
- /*: AttributeMap*/
- ) {
- var state = initializeState(obj);
- ObjectStateMutations.commitServerChanges(state.serverData, state.objectCache, changes);
- }
- function enqueueTask(obj
- /*: ParseObject*/
- , task
- /*: () => Promise*/
- )
- /*: Promise*/
- {
- var state = initializeState(obj);
- return state.tasks.enqueue(task);
- }
- function duplicateState(source
- /*: ParseObject*/
- , dest
- /*: ParseObject*/
- )
- /*: void*/
- {
- var oldState = initializeState(source);
- var newState = initializeState(dest);
- for (var key in oldState.serverData) {
- newState.serverData[key] = oldState.serverData[key];
- }
- for (var index = 0; index < oldState.pendingOps.length; index++) {
- for (var _key in oldState.pendingOps[index]) {
- newState.pendingOps[index][_key] = oldState.pendingOps[index][_key];
- }
- }
- for (var _key2 in oldState.objectCache) {
- newState.objectCache[_key2] = oldState.objectCache[_key2];
- }
- newState.existed = oldState.existed;
- }
- function clearAllState() {
- objectState = new _weakMap.default();
- }
- },{"./ObjectStateMutations":16,"./TaskQueue":41,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor":85,"@babel/runtime-corejs3/core-js-stable/weak-map":98,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],43:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = arrayContainsObject;
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- function arrayContainsObject(array
- /*: Array<any>*/
- , object
- /*: ParseObject*/
- )
- /*: boolean*/
- {
- if ((0, _indexOf.default)(array).call(array, object) > -1) {
- return true;
- }
- for (var i = 0; i < array.length; i++) {
- if (array[i] instanceof _ParseObject.default && array[i].className === object.className && array[i]._getId() === object._getId()) {
- return true;
- }
- }
- return false;
- }
- },{"./ParseObject":27,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],44:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = canBeSerialized;
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- function canBeSerialized(obj
- /*: ParseObject*/
- )
- /*: boolean*/
- {
- if (!(obj instanceof _ParseObject.default)) {
- return true;
- }
- var attributes = obj.attributes;
- for (var attr in attributes) {
- var val = attributes[attr];
- if (!canBeSerializedHelper(val)) {
- return false;
- }
- }
- return true;
- }
- function canBeSerializedHelper(value
- /*: any*/
- )
- /*: boolean*/
- {
- if ((0, _typeof2.default)(value) !== 'object') {
- return true;
- }
- if (value instanceof _ParseRelation.default) {
- return true;
- }
- if (value instanceof _ParseObject.default) {
- return !!value.id;
- }
- if (value instanceof _ParseFile.default) {
- if (value.url()) {
- return true;
- }
- return false;
- }
- if ((0, _isArray.default)(value)) {
- for (var i = 0; i < value.length; i++) {
- if (!canBeSerializedHelper(value[i])) {
- return false;
- }
- }
- return true;
- }
- for (var k in value) {
- if (!canBeSerializedHelper(value[k])) {
- return false;
- }
- }
- return true;
- }
- },{"./ParseFile":23,"./ParseObject":27,"./ParseRelation":31,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],45:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = decode;
- var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _ParseACL = _interopRequireDefault(_dereq_("./ParseACL"));
- var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
- var _ParseGeoPoint = _interopRequireDefault(_dereq_("./ParseGeoPoint"));
- var _ParsePolygon = _interopRequireDefault(_dereq_("./ParsePolygon"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- var _ParseOp = _dereq_("./ParseOp");
- var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- // eslint-disable-line no-unused-vars
- function decode(value
- /*: any*/
- )
- /*: any*/
- {
- if (value === null || (0, _typeof2.default)(value) !== 'object' || value instanceof Date) {
- return value;
- }
- if ((0, _isArray.default)(value)) {
- var dup = [];
- (0, _forEach.default)(value).call(value, function (v, i) {
- dup[i] = decode(v);
- });
- return dup;
- }
- if (typeof value.__op === 'string') {
- return (0, _ParseOp.opFromJSON)(value);
- }
- if (value.__type === 'Pointer' && value.className) {
- return _ParseObject.default.fromJSON(value);
- }
- if (value.__type === 'Object' && value.className) {
- return _ParseObject.default.fromJSON(value);
- }
- if (value.__type === 'Relation') {
- // The parent and key fields will be populated by the parent
- var relation = new _ParseRelation.default(null, null);
- relation.targetClassName = value.className;
- return relation;
- }
- if (value.__type === 'Date') {
- return new Date(value.iso);
- }
- if (value.__type === 'File') {
- return _ParseFile.default.fromJSON(value);
- }
- if (value.__type === 'GeoPoint') {
- return new _ParseGeoPoint.default({
- latitude: value.latitude,
- longitude: value.longitude
- });
- }
- if (value.__type === 'Polygon') {
- return new _ParsePolygon.default(value.coordinates);
- }
- var copy = {};
- for (var k in value) {
- copy[k] = decode(value[k]);
- }
- return copy;
- }
- },{"./ParseACL":19,"./ParseFile":23,"./ParseGeoPoint":24,"./ParseObject":27,"./ParseOp":28,"./ParsePolygon":29,"./ParseRelation":31,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],46:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = _default;
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _map = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/map"));
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
- var _startsWith = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
- var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- var _ParseACL = _interopRequireDefault(_dereq_("./ParseACL"));
- var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
- var _ParseGeoPoint = _interopRequireDefault(_dereq_("./ParseGeoPoint"));
- var _ParsePolygon = _interopRequireDefault(_dereq_("./ParsePolygon"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- var _ParseOp = _dereq_("./ParseOp");
- var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- function encode(value
- /*: mixed*/
- , disallowObjects
- /*: boolean*/
- , forcePointers
- /*: boolean*/
- , seen
- /*: Array<mixed>*/
- , offline
- /*: boolean*/
- )
- /*: any*/
- {
- if (value instanceof _ParseObject.default) {
- if (disallowObjects) {
- throw new Error('Parse Objects not allowed here');
- }
- var seenEntry = value.id ? value.className + ':' + value.id : value;
- if (forcePointers || !seen || (0, _indexOf.default)(seen).call(seen, seenEntry) > -1 || value.dirty() || (0, _keys.default)(value._getServerData()).length < 1) {
- var _context;
- if (offline && (0, _startsWith.default)(_context = value._getId()).call(_context, 'local')) {
- return value.toOfflinePointer();
- }
- return value.toPointer();
- }
- seen = (0, _concat.default)(seen).call(seen, seenEntry);
- return value._toFullJSON(seen, offline);
- }
- if (value instanceof _ParseOp.Op || value instanceof _ParseACL.default || value instanceof _ParseGeoPoint.default || value instanceof _ParsePolygon.default || value instanceof _ParseRelation.default) {
- return value.toJSON();
- }
- if (value instanceof _ParseFile.default) {
- if (!value.url()) {
- throw new Error('Tried to encode an unsaved file.');
- }
- return value.toJSON();
- }
- if (Object.prototype.toString.call(value) === '[object Date]') {
- if (isNaN(value)) {
- throw new Error('Tried to encode an invalid date.');
- }
- return {
- __type: 'Date',
- iso: value
- /*: any*/
- .toJSON()
- };
- }
- if (Object.prototype.toString.call(value) === '[object RegExp]' && typeof value.source === 'string') {
- return value.source;
- }
- if ((0, _isArray.default)(value)) {
- return (0, _map.default)(value).call(value, function (v) {
- return encode(v, disallowObjects, forcePointers, seen, offline);
- });
- }
- if (value && (0, _typeof2.default)(value) === 'object') {
- var output = {};
- for (var k in value) {
- output[k] = encode(value[k], disallowObjects, forcePointers, seen, offline);
- }
- return output;
- }
- return value;
- }
- function _default(value
- /*: mixed*/
- , disallowObjects
- /*:: ?: boolean*/
- , forcePointers
- /*:: ?: boolean*/
- , seen
- /*:: ?: Array<mixed>*/
- , offline
- /*:: ?: boolean*/
- )
- /*: any*/
- {
- return encode(value, !!disallowObjects, !!forcePointers, seen || [], offline);
- }
- },{"./ParseACL":19,"./ParseFile":23,"./ParseGeoPoint":24,"./ParseObject":27,"./ParseOp":28,"./ParsePolygon":29,"./ParseRelation":31,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/concat":58,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/instance/map":68,"@babel/runtime-corejs3/core-js-stable/instance/starts-with":74,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],47:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = equals;
- var _keys = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/object/keys"));
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _ParseACL = _interopRequireDefault(_dereq_("./ParseACL"));
- var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
- var _ParseGeoPoint = _interopRequireDefault(_dereq_("./ParseGeoPoint"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
- function equals(a, b) {
- var toString = Object.prototype.toString;
- if (toString.call(a) === '[object Date]' || toString.call(b) === '[object Date]') {
- var dateA = new Date(a);
- var dateB = new Date(b);
- return +dateA === +dateB;
- }
- if ((0, _typeof2.default)(a) !== (0, _typeof2.default)(b)) {
- return false;
- }
- if (!a || (0, _typeof2.default)(a) !== 'object') {
- // a is a primitive
- return a === b;
- }
- if ((0, _isArray.default)(a) || (0, _isArray.default)(b)) {
- if (!(0, _isArray.default)(a) || !(0, _isArray.default)(b)) {
- return false;
- }
- if (a.length !== b.length) {
- return false;
- }
- for (var i = a.length; i--;) {
- if (!equals(a[i], b[i])) {
- return false;
- }
- }
- return true;
- }
- if (a instanceof _ParseACL.default || a instanceof _ParseFile.default || a instanceof _ParseGeoPoint.default || a instanceof _ParseObject.default) {
- return a.equals(b);
- }
- if (b instanceof _ParseObject.default) {
- if (a.__type === 'Object' || a.__type === 'Pointer') {
- return a.objectId === b.id && a.className === b.className;
- }
- }
- if ((0, _keys.default)(a).length !== (0, _keys.default)(b).length) {
- return false;
- }
- for (var k in a) {
- if (!equals(a[k], b[k])) {
- return false;
- }
- }
- return true;
- }
- },{"./ParseACL":19,"./ParseFile":23,"./ParseGeoPoint":24,"./ParseObject":27,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/object/keys":89,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],48:[function(_dereq_,module,exports){
- "use strict";
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = escape;
- /*
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- var encoded = {
- '&': '&',
- '<': '<',
- '>': '>',
- '/': '/',
- "'": ''',
- '"': '"'
- };
- function escape(str
- /*: string*/
- )
- /*: string*/
- {
- return str.replace(/[&<>\/'"]/g, function (char) {
- return encoded[char];
- });
- }
- },{"@babel/runtime-corejs3/core-js-stable/object/define-property":82}],49:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = isRevocableSession;
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- function isRevocableSession(token
- /*: string*/
- )
- /*: boolean*/
- {
- return (0, _indexOf.default)(token).call(token, 'r:') > -1;
- }
- },{"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],50:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = parseDate;
- var _parseInt2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/parse-int"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- function parseDate(iso8601
- /*: string*/
- )
- /*: ?Date*/
- {
- var regexp = new RegExp('^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2})' + 'T' + '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})' + '(.([0-9]+))?' + 'Z$');
- var match = regexp.exec(iso8601);
- if (!match) {
- return null;
- }
- var year = (0, _parseInt2.default)(match[1]) || 0;
- var month = ((0, _parseInt2.default)(match[2]) || 1) - 1;
- var day = (0, _parseInt2.default)(match[3]) || 0;
- var hour = (0, _parseInt2.default)(match[4]) || 0;
- var minute = (0, _parseInt2.default)(match[5]) || 0;
- var second = (0, _parseInt2.default)(match[6]) || 0;
- var milli = (0, _parseInt2.default)(match[8]) || 0;
- return new Date(Date.UTC(year, month, day, hour, minute, second, milli));
- }
- },{"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/parse-int":91,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],51:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.continueWhile = continueWhile;
- exports.resolvingPromise = resolvingPromise;
- exports.when = when;
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise")); // Create Deferred Promise
- function resolvingPromise() {
- var res;
- var rej;
- var promise = new _promise.default(function (resolve, reject) {
- res = resolve;
- rej = reject;
- });
- promise.resolve = res;
- promise.reject = rej;
- return promise;
- }
- function when(promises) {
- var objects;
- var arrayArgument = (0, _isArray.default)(promises);
- if (arrayArgument) {
- objects = promises;
- } else {
- objects = arguments;
- }
- var total = objects.length;
- var hadError = false;
- var results = [];
- var returnValue = arrayArgument ? [results] : results;
- var errors = [];
- results.length = objects.length;
- errors.length = objects.length;
- if (total === 0) {
- return _promise.default.resolve(returnValue);
- }
- var promise = new resolvingPromise();
- var resolveOne = function () {
- total--;
- if (total <= 0) {
- if (hadError) {
- promise.reject(errors);
- } else {
- promise.resolve(returnValue);
- }
- }
- };
- var chain = function (object, index) {
- if (object && typeof object.then === 'function') {
- object.then(function (result) {
- results[index] = result;
- resolveOne();
- }, function (error) {
- errors[index] = error;
- hadError = true;
- resolveOne();
- });
- } else {
- results[index] = object;
- resolveOne();
- }
- };
- for (var i = 0; i < objects.length; i++) {
- chain(objects[i], i);
- }
- return promise;
- }
- function continueWhile(test, emitter) {
- if (test()) {
- return emitter().then(function () {
- return continueWhile(test, emitter);
- });
- }
- return _promise.default.resolve();
- }
- },{"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/core-js-stable/promise":92,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],52:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = unique;
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
- var _arrayContainsObject = _interopRequireDefault(_dereq_("./arrayContainsObject"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- function unique
- /*:: <T>*/
- (arr
- /*: Array<T>*/
- )
- /*: Array<T>*/
- {
- var uniques = [];
- (0, _forEach.default)(arr).call(arr, function (value) {
- if (value instanceof _ParseObject.default) {
- if (!(0, _arrayContainsObject.default)(uniques, value)) {
- uniques.push(value);
- }
- } else {
- if ((0, _indexOf.default)(uniques).call(uniques, value) < 0) {
- uniques.push(value);
- }
- }
- });
- return uniques;
- }
- },{"./ParseObject":27,"./arrayContainsObject":43,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/interopRequireDefault":128}],53:[function(_dereq_,module,exports){
- "use strict";
- var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
- _Object$defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = unsavedChildren;
- var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
- var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
- var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
- var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
- var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
- var _ParseFile = _interopRequireDefault(_dereq_("./ParseFile"));
- var _ParseObject = _interopRequireDefault(_dereq_("./ParseObject"));
- var _ParseRelation = _interopRequireDefault(_dereq_("./ParseRelation"));
- /**
- * Copyright (c) 2015-present, Parse, LLC.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @flow
- */
- /**
- * Return an array of unsaved children, which are either Parse Objects or Files.
- * If it encounters any dirty Objects without Ids, it will throw an exception.
- *
- * @param {Parse.Object} obj
- * @param {boolean} allowDeepUnsaved
- * @returns {Array}
- */
- function unsavedChildren(obj
- /*: ParseObject*/
- , allowDeepUnsaved
- /*:: ?: boolean*/
- )
- /*: Array<ParseFile | ParseObject>*/
- {
- var encountered = {
- objects: {},
- files: []
- };
- var identifier = obj.className + ':' + obj._getId();
- encountered.objects[identifier] = obj.dirty() ? obj : true;
- var attributes = obj.attributes;
- for (var attr in attributes) {
- if ((0, _typeof2.default)(attributes[attr]) === 'object') {
- traverse(attributes[attr], encountered, false, !!allowDeepUnsaved);
- }
- }
- var unsaved = [];
- for (var id in encountered.objects) {
- if (id !== identifier && encountered.objects[id] !== true) {
- unsaved.push(encountered.objects[id]);
- }
- }
- return (0, _concat.default)(unsaved).call(unsaved, encountered.files);
- }
- function traverse(obj
- /*: ParseObject*/
- , encountered
- /*: EncounterMap*/
- , shouldThrow
- /*: boolean*/
- , allowDeepUnsaved
- /*: boolean*/
- ) {
- if (obj instanceof _ParseObject.default) {
- if (!obj.id && shouldThrow) {
- throw new Error('Cannot create a pointer to an unsaved Object.');
- }
- var _identifier = obj.className + ':' + obj._getId();
- if (!encountered.objects[_identifier]) {
- encountered.objects[_identifier] = obj.dirty() ? obj : true;
- var attributes = obj.attributes;
- for (var attr in attributes) {
- if ((0, _typeof2.default)(attributes[attr]) === 'object') {
- traverse(attributes[attr], encountered, !allowDeepUnsaved, allowDeepUnsaved);
- }
- }
- }
- return;
- }
- if (obj instanceof _ParseFile.default) {
- var _context;
- if (!obj.url() && (0, _indexOf.default)(_context = encountered.files).call(_context, obj) < 0) {
- encountered.files.push(obj);
- }
- return;
- }
- if (obj instanceof _ParseRelation.default) {
- return;
- }
- if ((0, _isArray.default)(obj)) {
- (0, _forEach.default)(obj).call(obj, function (el) {
- if ((0, _typeof2.default)(el) === 'object') {
- traverse(el, encountered, shouldThrow, allowDeepUnsaved);
- }
- });
- }
- for (var k in obj) {
- if ((0, _typeof2.default)(obj[k]) === 'object') {
- traverse(obj[k], encountered, shouldThrow, allowDeepUnsaved);
- }
- }
- }
- },{"./ParseFile":23,"./ParseObject":27,"./ParseRelation":31,"@babel/runtime-corejs3/core-js-stable/array/is-array":56,"@babel/runtime-corejs3/core-js-stable/instance/concat":58,"@babel/runtime-corejs3/core-js-stable/instance/for-each":64,"@babel/runtime-corejs3/core-js-stable/instance/index-of":66,"@babel/runtime-corejs3/core-js-stable/object/define-property":82,"@babel/runtime-corejs3/helpers/interopRequireDefault":128,"@babel/runtime-corejs3/helpers/typeof":140}],54:[function(_dereq_,module,exports){
- "use strict";
- var uuid = null;
- uuid = _dereq_('uuid/v4');
- module.exports = uuid;
- },{"uuid/v4":610}],55:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/array/from");
- },{"core-js-pure/stable/array/from":545}],56:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/array/is-array");
- },{"core-js-pure/stable/array/is-array":546}],57:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/bind");
- },{"core-js-pure/stable/instance/bind":552}],58:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/concat");
- },{"core-js-pure/stable/instance/concat":553}],59:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/entries");
- },{"core-js-pure/stable/instance/entries":554}],60:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/every");
- },{"core-js-pure/stable/instance/every":555}],61:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/filter");
- },{"core-js-pure/stable/instance/filter":556}],62:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/find-index");
- },{"core-js-pure/stable/instance/find-index":557}],63:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/find");
- },{"core-js-pure/stable/instance/find":558}],64:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/for-each");
- },{"core-js-pure/stable/instance/for-each":559}],65:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/includes");
- },{"core-js-pure/stable/instance/includes":560}],66:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/index-of");
- },{"core-js-pure/stable/instance/index-of":561}],67:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/keys");
- },{"core-js-pure/stable/instance/keys":562}],68:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/map");
- },{"core-js-pure/stable/instance/map":563}],69:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/reduce");
- },{"core-js-pure/stable/instance/reduce":564}],70:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/reverse");
- },{"core-js-pure/stable/instance/reverse":565}],71:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/slice");
- },{"core-js-pure/stable/instance/slice":566}],72:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/sort");
- },{"core-js-pure/stable/instance/sort":567}],73:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/splice");
- },{"core-js-pure/stable/instance/splice":568}],74:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/starts-with");
- },{"core-js-pure/stable/instance/starts-with":569}],75:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/instance/values");
- },{"core-js-pure/stable/instance/values":570}],76:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/json/stringify");
- },{"core-js-pure/stable/json/stringify":571}],77:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/map");
- },{"core-js-pure/stable/map":572}],78:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/number/is-integer");
- },{"core-js-pure/stable/number/is-integer":573}],79:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/assign");
- },{"core-js-pure/stable/object/assign":574}],80:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/create");
- },{"core-js-pure/stable/object/create":575}],81:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/define-properties");
- },{"core-js-pure/stable/object/define-properties":576}],82:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/define-property");
- },{"core-js-pure/stable/object/define-property":577}],83:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/entries");
- },{"core-js-pure/stable/object/entries":578}],84:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/freeze");
- },{"core-js-pure/stable/object/freeze":579}],85:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/get-own-property-descriptor");
- },{"core-js-pure/stable/object/get-own-property-descriptor":580}],86:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/get-own-property-descriptors");
- },{"core-js-pure/stable/object/get-own-property-descriptors":581}],87:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/get-own-property-symbols");
- },{"core-js-pure/stable/object/get-own-property-symbols":582}],88:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/get-prototype-of");
- },{"core-js-pure/stable/object/get-prototype-of":583}],89:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/keys");
- },{"core-js-pure/stable/object/keys":584}],90:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/object/set-prototype-of");
- },{"core-js-pure/stable/object/set-prototype-of":585}],91:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/parse-int");
- },{"core-js-pure/stable/parse-int":586}],92:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/promise");
- },{"core-js-pure/stable/promise":587}],93:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/reflect/construct");
- },{"core-js-pure/stable/reflect/construct":588}],94:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/set-interval");
- },{"core-js-pure/stable/set-interval":590}],95:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/set-timeout");
- },{"core-js-pure/stable/set-timeout":591}],96:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/set");
- },{"core-js-pure/stable/set":592}],97:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/symbol");
- },{"core-js-pure/stable/symbol":593}],98:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/stable/weak-map");
- },{"core-js-pure/stable/weak-map":595}],99:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/array/from");
- },{"core-js-pure/features/array/from":224}],100:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/array/is-array");
- },{"core-js-pure/features/array/is-array":225}],101:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/get-iterator-method");
- },{"core-js-pure/features/get-iterator-method":226}],102:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/instance/bind");
- },{"core-js-pure/features/instance/bind":227}],103:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/instance/index-of");
- },{"core-js-pure/features/instance/index-of":228}],104:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/instance/slice");
- },{"core-js-pure/features/instance/slice":229}],105:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/map");
- },{"core-js-pure/features/map":230}],106:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/object/create");
- },{"core-js-pure/features/object/create":231}],107:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/object/define-property");
- },{"core-js-pure/features/object/define-property":232}],108:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/object/get-own-property-descriptor");
- },{"core-js-pure/features/object/get-own-property-descriptor":233}],109:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/object/get-prototype-of");
- },{"core-js-pure/features/object/get-prototype-of":234}],110:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/object/set-prototype-of");
- },{"core-js-pure/features/object/set-prototype-of":235}],111:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/promise");
- },{"core-js-pure/features/promise":236}],112:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/reflect/construct");
- },{"core-js-pure/features/reflect/construct":237}],113:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/reflect/get");
- },{"core-js-pure/features/reflect/get":238}],114:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/symbol");
- },{"core-js-pure/features/symbol":239}],115:[function(_dereq_,module,exports){
- module.exports = _dereq_("core-js-pure/features/symbol/iterator");
- },{"core-js-pure/features/symbol/iterator":240}],116:[function(_dereq_,module,exports){
- 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.__esModule = true, module.exports["default"] = module.exports;
- },{}],117:[function(_dereq_,module,exports){
- var _Array$isArray = _dereq_("@babel/runtime-corejs3/core-js/array/is-array");
- function _arrayWithHoles(arr) {
- if (_Array$isArray(arr)) return arr;
- }
- module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"@babel/runtime-corejs3/core-js/array/is-array":100}],118:[function(_dereq_,module,exports){
- var _Array$isArray = _dereq_("@babel/runtime-corejs3/core-js/array/is-array");
- var arrayLikeToArray = _dereq_("./arrayLikeToArray.js");
- function _arrayWithoutHoles(arr) {
- if (_Array$isArray(arr)) return arrayLikeToArray(arr);
- }
- module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"./arrayLikeToArray.js":116,"@babel/runtime-corejs3/core-js/array/is-array":100}],119:[function(_dereq_,module,exports){
- function _assertThisInitialized(self) {
- if (self === void 0) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return self;
- }
- module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{}],120:[function(_dereq_,module,exports){
- var _Promise = _dereq_("@babel/runtime-corejs3/core-js/promise");
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
- try {
- var info = gen[key](arg);
- var value = info.value;
- } catch (error) {
- reject(error);
- return;
- }
- if (info.done) {
- resolve(value);
- } else {
- _Promise.resolve(value).then(_next, _throw);
- }
- }
- function _asyncToGenerator(fn) {
- return function () {
- var self = this,
- args = arguments;
- return new _Promise(function (resolve, reject) {
- var gen = fn.apply(self, args);
- function _next(value) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
- }
- function _throw(err) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
- }
- _next(undefined);
- });
- };
- }
- module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"@babel/runtime-corejs3/core-js/promise":111}],121:[function(_dereq_,module,exports){
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{}],122:[function(_dereq_,module,exports){
- var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js/reflect/construct");
- var _bindInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js/instance/bind");
- var setPrototypeOf = _dereq_("./setPrototypeOf.js");
- var isNativeReflectConstruct = _dereq_("./isNativeReflectConstruct.js");
- function _construct(Parent, args, Class) {
- if (isNativeReflectConstruct()) {
- module.exports = _construct = _Reflect$construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
- } else {
- module.exports = _construct = function _construct(Parent, args, Class) {
- var a = [null];
- a.push.apply(a, args);
- var Constructor = _bindInstanceProperty(Function).apply(Parent, a);
- var instance = new Constructor();
- if (Class) setPrototypeOf(instance, Class.prototype);
- return instance;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- }
- return _construct.apply(null, arguments);
- }
- module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"./isNativeReflectConstruct.js":130,"./setPrototypeOf.js":136,"@babel/runtime-corejs3/core-js/instance/bind":102,"@babel/runtime-corejs3/core-js/reflect/construct":112}],123:[function(_dereq_,module,exports){
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js/object/define-property");
- function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- _Object$defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- _Object$defineProperty(Constructor, "prototype", {
- writable: false
- });
- return Constructor;
- }
- module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"@babel/runtime-corejs3/core-js/object/define-property":107}],124:[function(_dereq_,module,exports){
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js/object/define-property");
- 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.__esModule = true, module.exports["default"] = module.exports;
- },{"@babel/runtime-corejs3/core-js/object/define-property":107}],125:[function(_dereq_,module,exports){
- var _Reflect$get = _dereq_("@babel/runtime-corejs3/core-js/reflect/get");
- var _Object$getOwnPropertyDescriptor = _dereq_("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor");
- var superPropBase = _dereq_("./superPropBase.js");
- function _get() {
- if (typeof Reflect !== "undefined" && _Reflect$get) {
- module.exports = _get = _Reflect$get, module.exports.__esModule = true, module.exports["default"] = module.exports;
- } else {
- module.exports = _get = function _get(target, property, receiver) {
- var base = superPropBase(target, property);
- if (!base) return;
- var desc = _Object$getOwnPropertyDescriptor(base, property);
- if (desc.get) {
- return desc.get.call(arguments.length < 3 ? target : receiver);
- }
- return desc.value;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- }
- return _get.apply(this, arguments);
- }
- module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"./superPropBase.js":138,"@babel/runtime-corejs3/core-js/object/get-own-property-descriptor":108,"@babel/runtime-corejs3/core-js/reflect/get":113}],126:[function(_dereq_,module,exports){
- var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js/object/set-prototype-of");
- var _Object$getPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js/object/get-prototype-of");
- function _getPrototypeOf(o) {
- module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _Object$getPrototypeOf : function _getPrototypeOf(o) {
- return o.__proto__ || _Object$getPrototypeOf(o);
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _getPrototypeOf(o);
- }
- module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"@babel/runtime-corejs3/core-js/object/get-prototype-of":109,"@babel/runtime-corejs3/core-js/object/set-prototype-of":110}],127:[function(_dereq_,module,exports){
- var _Object$create = _dereq_("@babel/runtime-corejs3/core-js/object/create");
- var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js/object/define-property");
- var setPrototypeOf = _dereq_("./setPrototypeOf.js");
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function");
- }
- subClass.prototype = _Object$create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- writable: true,
- configurable: true
- }
- });
- _Object$defineProperty(subClass, "prototype", {
- writable: false
- });
- if (superClass) setPrototypeOf(subClass, superClass);
- }
- module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"./setPrototypeOf.js":136,"@babel/runtime-corejs3/core-js/object/create":106,"@babel/runtime-corejs3/core-js/object/define-property":107}],128:[function(_dereq_,module,exports){
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- "default": obj
- };
- }
- module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{}],129:[function(_dereq_,module,exports){
- var _indexOfInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js/instance/index-of");
- function _isNativeFunction(fn) {
- var _context;
- return _indexOfInstanceProperty(_context = Function.toString.call(fn)).call(_context, "[native code]") !== -1;
- }
- module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"@babel/runtime-corejs3/core-js/instance/index-of":103}],130:[function(_dereq_,module,exports){
- var _Reflect$construct = _dereq_("@babel/runtime-corejs3/core-js/reflect/construct");
- function _isNativeReflectConstruct() {
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
- if (_Reflect$construct.sham) return false;
- if (typeof Proxy === "function") return true;
- try {
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
- return true;
- } catch (e) {
- return false;
- }
- }
- module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"@babel/runtime-corejs3/core-js/reflect/construct":112}],131:[function(_dereq_,module,exports){
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js/symbol");
- var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
- var _Array$from = _dereq_("@babel/runtime-corejs3/core-js/array/from");
- function _iterableToArray(iter) {
- if (typeof _Symbol !== "undefined" && _getIteratorMethod(iter) != null || iter["@@iterator"] != null) return _Array$from(iter);
- }
- module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"@babel/runtime-corejs3/core-js/array/from":99,"@babel/runtime-corejs3/core-js/get-iterator-method":101,"@babel/runtime-corejs3/core-js/symbol":114}],132:[function(_dereq_,module,exports){
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js/symbol");
- var _getIteratorMethod = _dereq_("@babel/runtime-corejs3/core-js/get-iterator-method");
- function _iterableToArrayLimit(arr, i) {
- var _i = arr == null ? null : typeof _Symbol !== "undefined" && _getIteratorMethod(arr) || 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.__esModule = true, module.exports["default"] = module.exports;
- },{"@babel/runtime-corejs3/core-js/get-iterator-method":101,"@babel/runtime-corejs3/core-js/symbol":114}],133:[function(_dereq_,module,exports){
- 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.__esModule = true, module.exports["default"] = module.exports;
- },{}],134:[function(_dereq_,module,exports){
- 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.__esModule = true, module.exports["default"] = module.exports;
- },{}],135:[function(_dereq_,module,exports){
- var _typeof = _dereq_("./typeof.js")["default"];
- var assertThisInitialized = _dereq_("./assertThisInitialized.js");
- function _possibleConstructorReturn(self, call) {
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
- return call;
- } else if (call !== void 0) {
- throw new TypeError("Derived constructors may only return object or undefined");
- }
- return assertThisInitialized(self);
- }
- module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"./assertThisInitialized.js":119,"./typeof.js":140}],136:[function(_dereq_,module,exports){
- var _Object$setPrototypeOf = _dereq_("@babel/runtime-corejs3/core-js/object/set-prototype-of");
- function _setPrototypeOf(o, p) {
- module.exports = _setPrototypeOf = _Object$setPrototypeOf || function _setPrototypeOf(o, p) {
- o.__proto__ = p;
- return o;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _setPrototypeOf(o, p);
- }
- module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"@babel/runtime-corejs3/core-js/object/set-prototype-of":110}],137:[function(_dereq_,module,exports){
- var arrayWithHoles = _dereq_("./arrayWithHoles.js");
- var iterableToArrayLimit = _dereq_("./iterableToArrayLimit.js");
- var unsupportedIterableToArray = _dereq_("./unsupportedIterableToArray.js");
- var nonIterableRest = _dereq_("./nonIterableRest.js");
- function _slicedToArray(arr, i) {
- return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
- }
- module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"./arrayWithHoles.js":117,"./iterableToArrayLimit.js":132,"./nonIterableRest.js":133,"./unsupportedIterableToArray.js":141}],138:[function(_dereq_,module,exports){
- var getPrototypeOf = _dereq_("./getPrototypeOf.js");
- function _superPropBase(object, property) {
- while (!Object.prototype.hasOwnProperty.call(object, property)) {
- object = getPrototypeOf(object);
- if (object === null) break;
- }
- return object;
- }
- module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"./getPrototypeOf.js":126}],139:[function(_dereq_,module,exports){
- var arrayWithoutHoles = _dereq_("./arrayWithoutHoles.js");
- var iterableToArray = _dereq_("./iterableToArray.js");
- var unsupportedIterableToArray = _dereq_("./unsupportedIterableToArray.js");
- var nonIterableSpread = _dereq_("./nonIterableSpread.js");
- function _toConsumableArray(arr) {
- return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
- }
- module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"./arrayWithoutHoles.js":118,"./iterableToArray.js":131,"./nonIterableSpread.js":134,"./unsupportedIterableToArray.js":141}],140:[function(_dereq_,module,exports){
- var _Symbol = _dereq_("@babel/runtime-corejs3/core-js/symbol");
- var _Symbol$iterator = _dereq_("@babel/runtime-corejs3/core-js/symbol/iterator");
- function _typeof(obj) {
- "@babel/helpers - typeof";
- return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && "function" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
- }
- module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"@babel/runtime-corejs3/core-js/symbol":114,"@babel/runtime-corejs3/core-js/symbol/iterator":115}],141:[function(_dereq_,module,exports){
- var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js/instance/slice");
- var _Array$from = _dereq_("@babel/runtime-corejs3/core-js/array/from");
- var arrayLikeToArray = _dereq_("./arrayLikeToArray.js");
- function _unsupportedIterableToArray(o, minLen) {
- var _context;
- if (!o) return;
- if (typeof o === "string") return arrayLikeToArray(o, minLen);
- var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 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.__esModule = true, module.exports["default"] = module.exports;
- },{"./arrayLikeToArray.js":116,"@babel/runtime-corejs3/core-js/array/from":99,"@babel/runtime-corejs3/core-js/instance/slice":104}],142:[function(_dereq_,module,exports){
- var _Map = _dereq_("@babel/runtime-corejs3/core-js/map");
- var _Object$create = _dereq_("@babel/runtime-corejs3/core-js/object/create");
- var getPrototypeOf = _dereq_("./getPrototypeOf.js");
- var setPrototypeOf = _dereq_("./setPrototypeOf.js");
- var isNativeFunction = _dereq_("./isNativeFunction.js");
- var construct = _dereq_("./construct.js");
- function _wrapNativeSuper(Class) {
- var _cache = typeof _Map === "function" ? new _Map() : undefined;
- module.exports = _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);
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _wrapNativeSuper(Class);
- }
- module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports;
- },{"./construct.js":122,"./getPrototypeOf.js":126,"./isNativeFunction.js":129,"./setPrototypeOf.js":136,"@babel/runtime-corejs3/core-js/map":105,"@babel/runtime-corejs3/core-js/object/create":106}],143:[function(_dereq_,module,exports){
- /**
- * Copyright (c) 2014-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var runtime = (function (exports) {
- "use strict";
- var Op = Object.prototype;
- var hasOwn = Op.hasOwnProperty;
- var undefined; // More compressible than void 0.
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- return obj[key];
- }
- try {
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
- define({}, "");
- } catch (err) {
- define = function(obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
- var generator = Object.create(protoGenerator.prototype);
- var context = new Context(tryLocsList || []);
- // The ._invoke method unifies the implementations of the .next,
- // .throw, and .return methods.
- generator._invoke = makeInvokeMethod(innerFn, self, context);
- return generator;
- }
- exports.wrap = wrap;
- // Try/catch helper to minimize deoptimizations. Returns a completion
- // record like context.tryEntries[i].completion. This interface could
- // have been (and was previously) designed to take a closure to be
- // invoked without arguments, but in all the cases we care about we
- // already have an existing method we want to call, so there's no need
- // to create a new function object. We can even get away with assuming
- // the method takes exactly one argument, since that happens to be true
- // in every case, so we don't have to touch the arguments object. The
- // only additional allocation required is the completion record, which
- // has a stable shape and so hopefully should be cheap to allocate.
- function tryCatch(fn, obj, arg) {
- try {
- return { type: "normal", arg: fn.call(obj, arg) };
- } catch (err) {
- return { type: "throw", arg: err };
- }
- }
- var GenStateSuspendedStart = "suspendedStart";
- var GenStateSuspendedYield = "suspendedYield";
- var GenStateExecuting = "executing";
- var GenStateCompleted = "completed";
- // Returning this object from the innerFn has the same effect as
- // breaking out of the dispatch switch statement.
- var ContinueSentinel = {};
- // Dummy constructor functions that we use as the .constructor and
- // .constructor.prototype properties for functions that return Generator
- // objects. For full spec compliance, you may wish to configure your
- // minifier not to mangle the names of these two functions.
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- // This is a polyfill for %IteratorPrototype% for environments that
- // don't natively support it.
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = Object.getPrototypeOf;
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- if (NativeIteratorPrototype &&
- NativeIteratorPrototype !== Op &&
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
- // This environment has a native %IteratorPrototype%; use it instead
- // of the polyfill.
- IteratorPrototype = NativeIteratorPrototype;
- }
- var Gp = GeneratorFunctionPrototype.prototype =
- Generator.prototype = Object.create(IteratorPrototype);
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
- define(Gp, "constructor", GeneratorFunctionPrototype);
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
- GeneratorFunction.displayName = define(
- GeneratorFunctionPrototype,
- toStringTagSymbol,
- "GeneratorFunction"
- );
- // Helper for defining the .next, .throw, and .return methods of the
- // Iterator interface in terms of a single ._invoke method.
- function defineIteratorMethods(prototype) {
- ["next", "throw", "return"].forEach(function(method) {
- define(prototype, method, function(arg) {
- return this._invoke(method, arg);
- });
- });
- }
- exports.isGeneratorFunction = function(genFun) {
- var ctor = typeof genFun === "function" && genFun.constructor;
- return ctor
- ? ctor === GeneratorFunction ||
- // For the native GeneratorFunction constructor, the best we can
- // do is to check its .name property.
- (ctor.displayName || ctor.name) === "GeneratorFunction"
- : false;
- };
- exports.mark = function(genFun) {
- if (Object.setPrototypeOf) {
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
- } else {
- genFun.__proto__ = GeneratorFunctionPrototype;
- define(genFun, toStringTagSymbol, "GeneratorFunction");
- }
- genFun.prototype = Object.create(Gp);
- return genFun;
- };
- // Within the body of any async function, `await x` is transformed to
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
- // meant to be awaited.
- exports.awrap = function(arg) {
- return { __await: arg };
- };
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if (record.type === "throw") {
- reject(record.arg);
- } else {
- var result = record.arg;
- var value = result.value;
- if (value &&
- typeof value === "object" &&
- hasOwn.call(value, "__await")) {
- return PromiseImpl.resolve(value.__await).then(function(value) {
- invoke("next", value, resolve, reject);
- }, function(err) {
- invoke("throw", err, resolve, reject);
- });
- }
- return PromiseImpl.resolve(value).then(function(unwrapped) {
- // When a yielded Promise is resolved, its final value becomes
- // the .value of the Promise<{value,done}> result for the
- // current iteration.
- result.value = unwrapped;
- resolve(result);
- }, function(error) {
- // If a rejected Promise was yielded, throw the rejection back
- // into the async generator function so it can be handled there.
- return invoke("throw", error, resolve, reject);
- });
- }
- }
- var previousPromise;
- function enqueue(method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function(resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise =
- // If enqueue has been called before, then we want to wait until
- // all previous Promises have been resolved before calling invoke,
- // so that results are always delivered in the correct order. If
- // enqueue has not been called before, then it is important to
- // call invoke immediately, without waiting on a callback to fire,
- // so that the async generator function has the opportunity to do
- // any necessary setup in a predictable way. This predictability
- // is why the Promise constructor synchronously invokes its
- // executor callback, and why async functions synchronously
- // execute code before the first await. Since we implement simple
- // async functions in terms of async generators, it is especially
- // important to get this right, even though it requires care.
- previousPromise ? previousPromise.then(
- callInvokeWithMethodAndArg,
- // Avoid propagating failures to Promises returned by later
- // invocations of the iterator.
- callInvokeWithMethodAndArg
- ) : callInvokeWithMethodAndArg();
- }
- // Define the unified helper method that is used to implement .next,
- // .throw, and .return (see defineIteratorMethods).
- this._invoke = enqueue;
- }
- defineIteratorMethods(AsyncIterator.prototype);
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- });
- exports.AsyncIterator = AsyncIterator;
- // Note that simple async functions are implemented on top of
- // AsyncIterator objects; they just return a Promise for the value of
- // the final result produced by the iterator.
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- if (PromiseImpl === void 0) PromiseImpl = Promise;
- var iter = new AsyncIterator(
- wrap(innerFn, outerFn, self, tryLocsList),
- PromiseImpl
- );
- return exports.isGeneratorFunction(outerFn)
- ? iter // If outerFn is a generator, return the full iterator.
- : iter.next().then(function(result) {
- return result.done ? result.value : iter.next();
- });
- };
- function makeInvokeMethod(innerFn, self, context) {
- var state = GenStateSuspendedStart;
- return function invoke(method, arg) {
- if (state === GenStateExecuting) {
- throw new Error("Generator is already running");
- }
- if (state === GenStateCompleted) {
- if (method === "throw") {
- throw arg;
- }
- // Be forgiving, per 25.3.3.3.3 of the spec:
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
- return doneResult();
- }
- context.method = method;
- context.arg = arg;
- while (true) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if (context.method === "next") {
- // Setting context._sent for legacy support of Babel's
- // function.sent implementation.
- context.sent = context._sent = context.arg;
- } else if (context.method === "throw") {
- if (state === GenStateSuspendedStart) {
- state = GenStateCompleted;
- throw context.arg;
- }
- context.dispatchException(context.arg);
- } else if (context.method === "return") {
- context.abrupt("return", context.arg);
- }
- state = GenStateExecuting;
- var record = tryCatch(innerFn, self, context);
- if (record.type === "normal") {
- // If an exception is thrown from innerFn, we leave state ===
- // GenStateExecuting and loop back for another invocation.
- state = context.done
- ? GenStateCompleted
- : GenStateSuspendedYield;
- if (record.arg === ContinueSentinel) {
- continue;
- }
- return {
- value: record.arg,
- done: context.done
- };
- } else if (record.type === "throw") {
- state = GenStateCompleted;
- // Dispatch the exception by looping back around to the
- // context.dispatchException(context.arg) call above.
- context.method = "throw";
- context.arg = record.arg;
- }
- }
- };
- }
- // Call delegate.iterator[context.method](context.arg) and handle the
- // result, either by returning a { value, done } result from the
- // delegate iterator, or by modifying context.method and context.arg,
- // setting context.delegate to null, and returning the ContinueSentinel.
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (method === undefined) {
- // A .throw or .return when the delegate iterator has no .throw
- // method always terminates the yield* loop.
- context.delegate = null;
- if (context.method === "throw") {
- // Note: ["return"] must be used for ES3 parsing compatibility.
- if (delegate.iterator["return"]) {
- // If the delegate iterator has a return method, give it a
- // chance to clean up.
- context.method = "return";
- context.arg = undefined;
- maybeInvokeDelegate(delegate, context);
- if (context.method === "throw") {
- // If maybeInvokeDelegate(context) changed context.method from
- // "return" to "throw", let that override the TypeError below.
- return ContinueSentinel;
- }
- }
- context.method = "throw";
- context.arg = new TypeError(
- "The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if (record.type === "throw") {
- context.method = "throw";
- context.arg = record.arg;
- context.delegate = null;
- return ContinueSentinel;
- }
- var info = record.arg;
- if (! info) {
- context.method = "throw";
- context.arg = new TypeError("iterator result is not an object");
- context.delegate = null;
- return ContinueSentinel;
- }
- if (info.done) {
- // Assign the result of the finished delegate to the temporary
- // variable specified by delegate.resultName (see delegateYield).
- context[delegate.resultName] = info.value;
- // Resume execution at the desired location (see delegateYield).
- context.next = delegate.nextLoc;
- // If context.method was "throw" but the delegate handled the
- // exception, let the outer generator proceed normally. If
- // context.method was "next", forget context.arg since it has been
- // "consumed" by the delegate iterator. If context.method was
- // "return", allow the original .return call to continue in the
- // outer generator.
- if (context.method !== "return") {
- context.method = "next";
- context.arg = undefined;
- }
- } else {
- // Re-yield the result returned by the delegate method.
- return info;
- }
- // The delegate iterator is finished, so forget it and continue with
- // the outer generator.
- context.delegate = null;
- return ContinueSentinel;
- }
- // Define Generator.prototype.{next,throw,return} in terms of the
- // unified ._invoke helper method.
- defineIteratorMethods(Gp);
- define(Gp, toStringTagSymbol, "Generator");
- // A Generator should always return itself as the iterator object when the
- // @@iterator function is called on it. Some browsers' implementations of the
- // iterator prototype chain incorrectly implement this, causing the Generator
- // object to not be returned from this call. This ensures that doesn't happen.
- // See https://github.com/facebook/regenerator/issues/274 for more details.
- define(Gp, iteratorSymbol, function() {
- return this;
- });
- define(Gp, "toString", function() {
- return "[object Generator]";
- });
- function pushTryEntry(locs) {
- var entry = { tryLoc: locs[0] };
- if (1 in locs) {
- entry.catchLoc = locs[1];
- }
- if (2 in locs) {
- entry.finallyLoc = locs[2];
- entry.afterLoc = locs[3];
- }
- this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal";
- delete record.arg;
- entry.completion = record;
- }
- function Context(tryLocsList) {
- // The root entry object (effectively a try statement without a catch
- // or a finally block) gives us a place to store values thrown from
- // locations where there is no enclosing try statement.
- this.tryEntries = [{ tryLoc: "root" }];
- tryLocsList.forEach(pushTryEntry, this);
- this.reset(true);
- }
- exports.keys = function(object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- keys.reverse();
- // Rather than returning an object with a next method, we keep
- // things simple and return the next function itself.
- return function next() {
- while (keys.length) {
- var key = keys.pop();
- if (key in object) {
- next.value = key;
- next.done = false;
- return next;
- }
- }
- // To avoid creating an additional object, we just hang the .value
- // and .done properties off the next function object itself. This
- // also ensures that the minifier will not anonymize the function.
- next.done = true;
- return next;
- };
- };
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) {
- return iteratorMethod.call(iterable);
- }
- if (typeof iterable.next === "function") {
- return iterable;
- }
- if (!isNaN(iterable.length)) {
- var i = -1, next = function next() {
- while (++i < iterable.length) {
- if (hasOwn.call(iterable, i)) {
- next.value = iterable[i];
- next.done = false;
- return next;
- }
- }
- next.value = undefined;
- next.done = true;
- return next;
- };
- return next.next = next;
- }
- }
- // Return an iterator with no values.
- return { next: doneResult };
- }
- exports.values = values;
- function doneResult() {
- return { value: undefined, done: true };
- }
- Context.prototype = {
- constructor: Context,
- reset: function(skipTempReset) {
- this.prev = 0;
- this.next = 0;
- // Resetting context._sent for legacy support of Babel's
- // function.sent implementation.
- this.sent = this._sent = undefined;
- this.done = false;
- this.delegate = null;
- this.method = "next";
- this.arg = undefined;
- this.tryEntries.forEach(resetTryEntry);
- if (!skipTempReset) {
- for (var name in this) {
- // Not sure about the optimal order of these conditions:
- if (name.charAt(0) === "t" &&
- hasOwn.call(this, name) &&
- !isNaN(+name.slice(1))) {
- this[name] = undefined;
- }
- }
- }
- },
- stop: function() {
- this.done = true;
- var rootEntry = this.tryEntries[0];
- var rootRecord = rootEntry.completion;
- if (rootRecord.type === "throw") {
- throw rootRecord.arg;
- }
- return this.rval;
- },
- dispatchException: function(exception) {
- if (this.done) {
- throw exception;
- }
- var context = this;
- function handle(loc, caught) {
- record.type = "throw";
- record.arg = exception;
- context.next = loc;
- if (caught) {
- // If the dispatched exception was caught by a catch block,
- // then let that catch block handle the exception normally.
- context.method = "next";
- context.arg = undefined;
- }
- return !! caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- var record = entry.completion;
- if (entry.tryLoc === "root") {
- // Exception thrown outside of any try block that could handle
- // it, so set the completion value of the entire function to
- // throw the exception.
- return handle("end");
- }
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc");
- var hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- } else if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- }
- } else if (hasFinally) {
- if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else {
- throw new Error("try statement without catch or finally");
- }
- }
- }
- },
- abrupt: function(type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev &&
- hasOwn.call(entry, "finallyLoc") &&
- this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- if (finallyEntry &&
- (type === "break" ||
- type === "continue") &&
- finallyEntry.tryLoc <= arg &&
- arg <= finallyEntry.finallyLoc) {
- // Ignore the finally entry if control is not jumping to a
- // location outside the try/catch block.
- finallyEntry = null;
- }
- var record = finallyEntry ? finallyEntry.completion : {};
- record.type = type;
- record.arg = arg;
- if (finallyEntry) {
- this.method = "next";
- this.next = finallyEntry.finallyLoc;
- return ContinueSentinel;
- }
- return this.complete(record);
- },
- complete: function(record, afterLoc) {
- if (record.type === "throw") {
- throw record.arg;
- }
- if (record.type === "break" ||
- record.type === "continue") {
- this.next = record.arg;
- } else if (record.type === "return") {
- this.rval = this.arg = record.arg;
- this.method = "return";
- this.next = "end";
- } else if (record.type === "normal" && afterLoc) {
- this.next = afterLoc;
- }
- return ContinueSentinel;
- },
- finish: function(finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) {
- this.complete(entry.completion, entry.afterLoc);
- resetTryEntry(entry);
- return ContinueSentinel;
- }
- }
- },
- "catch": function(tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if (record.type === "throw") {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- // The context.catch method must only be called with a location
- // argument that corresponds to a known catch block.
- throw new Error("illegal catch attempt");
- },
- delegateYield: function(iterable, resultName, nextLoc) {
- this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- };
- if (this.method === "next") {
- // Deliberately forget the last sent value so that we don't
- // accidentally pass it on to the delegate.
- this.arg = undefined;
- }
- return ContinueSentinel;
- }
- };
- // Regardless of whether this script is executing as a CommonJS module
- // or not, return the runtime object so that we can declare the variable
- // regeneratorRuntime in the outer scope, which allows this module to be
- // injected easily by `bin/regenerator --include-runtime script.js`.
- return exports;
- }(
- // If this script is executing as a CommonJS module, use module.exports
- // as the regeneratorRuntime namespace. Otherwise create a new empty
- // object. Either way, the resulting object will be used to initialize
- // the regeneratorRuntime variable at the top of this file.
- typeof module === "object" ? module.exports : {}
- ));
- try {
- regeneratorRuntime = runtime;
- } catch (accidentalStrictMode) {
- // This module should not be running in strict mode, so the above
- // assignment should always work unless something is misconfigured. Just
- // in case runtime.js accidentally runs in strict mode, in modern engines
- // we can explicitly access globalThis. In older engines we can escape
- // strict mode using a global Function call. This could conceivably fail
- // if a Content Security Policy forbids using Function, but in that case
- // the proper solution is to fix the accidental strict mode problem. If
- // you've misconfigured your bundler to force strict mode and applied a
- // CSP to forbid Function, and you're not willing to fix either of those
- // problems, please detail your unique predicament in a GitHub issue.
- if (typeof globalThis === "object") {
- globalThis.regeneratorRuntime = runtime;
- } else {
- Function("r", "regeneratorRuntime = r")(runtime);
- }
- }
- },{}],144:[function(_dereq_,module,exports){
- module.exports = _dereq_("regenerator-runtime");
- },{"regenerator-runtime":143}],145:[function(_dereq_,module,exports){
- },{}],146:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/array/from');
- module.exports = parent;
- },{"../../stable/array/from":545}],147:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/array/is-array');
- module.exports = parent;
- },{"../../stable/array/is-array":546}],148:[function(_dereq_,module,exports){
- var parent = _dereq_('../stable/get-iterator-method');
- module.exports = parent;
- },{"../stable/get-iterator-method":551}],149:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/instance/bind');
- module.exports = parent;
- },{"../../stable/instance/bind":552}],150:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/instance/index-of');
- module.exports = parent;
- },{"../../stable/instance/index-of":561}],151:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/instance/slice');
- module.exports = parent;
- },{"../../stable/instance/slice":566}],152:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/map');
- module.exports = parent;
- },{"../../stable/map":572}],153:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/object/create');
- module.exports = parent;
- },{"../../stable/object/create":575}],154:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/object/define-property');
- module.exports = parent;
- },{"../../stable/object/define-property":577}],155:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/object/get-own-property-descriptor');
- module.exports = parent;
- },{"../../stable/object/get-own-property-descriptor":580}],156:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/object/get-prototype-of');
- module.exports = parent;
- },{"../../stable/object/get-prototype-of":583}],157:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/object/set-prototype-of');
- module.exports = parent;
- },{"../../stable/object/set-prototype-of":585}],158:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/promise');
- module.exports = parent;
- },{"../../stable/promise":587}],159:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/reflect/construct');
- module.exports = parent;
- },{"../../stable/reflect/construct":588}],160:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/reflect/get');
- module.exports = parent;
- },{"../../stable/reflect/get":589}],161:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/symbol');
- module.exports = parent;
- },{"../../stable/symbol":593}],162:[function(_dereq_,module,exports){
- var parent = _dereq_('../../stable/symbol/iterator');
- module.exports = parent;
- },{"../../stable/symbol/iterator":594}],163:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.string.iterator');
- _dereq_('../../modules/es.array.from');
- var path = _dereq_('../../internals/path');
- module.exports = path.Array.from;
- },{"../../internals/path":390,"../../modules/es.array.from":439,"../../modules/es.string.iterator":487}],164:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.array.is-array');
- var path = _dereq_('../../internals/path');
- module.exports = path.Array.isArray;
- },{"../../internals/path":390,"../../modules/es.array.is-array":442}],165:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.concat');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').concat;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.concat":433}],166:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.iterator');
- _dereq_('../../../modules/es.object.to-string');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').entries;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.iterator":443,"../../../modules/es.object.to-string":469}],167:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.every');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').every;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.every":434}],168:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.filter');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').filter;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.filter":435}],169:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.find-index');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').findIndex;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.find-index":436}],170:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.find');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').find;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.find":437}],171:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.for-each');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').forEach;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.for-each":438}],172:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.includes');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').includes;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.includes":440}],173:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.index-of');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').indexOf;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.index-of":441}],174:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.iterator');
- _dereq_('../../../modules/es.object.to-string');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').keys;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.iterator":443,"../../../modules/es.object.to-string":469}],175:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.map');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').map;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.map":444}],176:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.reduce');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').reduce;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.reduce":445}],177:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.reverse');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').reverse;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.reverse":446}],178:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.slice');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').slice;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.slice":447}],179:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.sort');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').sort;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.sort":448}],180:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.splice');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').splice;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.splice":449}],181:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.array.iterator');
- _dereq_('../../../modules/es.object.to-string');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Array').values;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.array.iterator":443,"../../../modules/es.object.to-string":469}],182:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.function.bind');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('Function').bind;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.function.bind":450}],183:[function(_dereq_,module,exports){
- _dereq_('../modules/es.array.iterator');
- _dereq_('../modules/es.string.iterator');
- var getIteratorMethod = _dereq_('../internals/get-iterator-method');
- module.exports = getIteratorMethod;
- },{"../internals/get-iterator-method":329,"../modules/es.array.iterator":443,"../modules/es.string.iterator":487}],184:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../function/virtual/bind');
- var FunctionPrototype = Function.prototype;
- module.exports = function (it) {
- var own = it.bind;
- return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../function/virtual/bind":182}],185:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/concat');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.concat;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/concat":165}],186:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/every');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.every;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.every) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/every":167}],187:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/filter');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.filter;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/filter":168}],188:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/find-index');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.findIndex;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.findIndex) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/find-index":169}],189:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/find');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.find;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/find":170}],190:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var arrayMethod = _dereq_('../array/virtual/includes');
- var stringMethod = _dereq_('../string/virtual/includes');
- var ArrayPrototype = Array.prototype;
- var StringPrototype = String.prototype;
- module.exports = function (it) {
- var own = it.includes;
- if (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes)) return arrayMethod;
- if (typeof it == 'string' || it === StringPrototype || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes)) {
- return stringMethod;
- } return own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/includes":172,"../string/virtual/includes":219}],191:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/index-of');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.indexOf;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/index-of":173}],192:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/map');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.map;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/map":175}],193:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/reduce');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.reduce;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/reduce":176}],194:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/reverse');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.reverse;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reverse) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/reverse":177}],195:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/slice');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.slice;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/slice":178}],196:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/sort');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.sort;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.sort) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/sort":179}],197:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/splice');
- var ArrayPrototype = Array.prototype;
- module.exports = function (it) {
- var own = it.splice;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.splice) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../array/virtual/splice":180}],198:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../string/virtual/starts-with');
- var StringPrototype = String.prototype;
- module.exports = function (it) {
- var own = it.startsWith;
- return typeof it == 'string' || it === StringPrototype
- || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.startsWith) ? method : own;
- };
- },{"../../internals/object-is-prototype-of":381,"../string/virtual/starts-with":220}],199:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.json.stringify');
- var path = _dereq_('../../internals/path');
- var apply = _dereq_('../../internals/function-apply');
- // eslint-disable-next-line es-x/no-json -- safe
- if (!path.JSON) path.JSON = { stringify: JSON.stringify };
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- module.exports = function stringify(it, replacer, space) {
- return apply(path.JSON.stringify, null, arguments);
- };
- },{"../../internals/function-apply":321,"../../internals/path":390,"../../modules/es.json.stringify":451}],200:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.array.iterator');
- _dereq_('../../modules/es.map');
- _dereq_('../../modules/es.object.to-string');
- _dereq_('../../modules/es.string.iterator');
- var path = _dereq_('../../internals/path');
- module.exports = path.Map;
- },{"../../internals/path":390,"../../modules/es.array.iterator":443,"../../modules/es.map":454,"../../modules/es.object.to-string":469,"../../modules/es.string.iterator":487}],201:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.number.is-integer');
- var path = _dereq_('../../internals/path');
- module.exports = path.Number.isInteger;
- },{"../../internals/path":390,"../../modules/es.number.is-integer":456}],202:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.object.assign');
- var path = _dereq_('../../internals/path');
- module.exports = path.Object.assign;
- },{"../../internals/path":390,"../../modules/es.object.assign":457}],203:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.object.create');
- var path = _dereq_('../../internals/path');
- var Object = path.Object;
- module.exports = function create(P, D) {
- return Object.create(P, D);
- };
- },{"../../internals/path":390,"../../modules/es.object.create":458}],204:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.object.define-properties');
- var path = _dereq_('../../internals/path');
- var Object = path.Object;
- var defineProperties = module.exports = function defineProperties(T, D) {
- return Object.defineProperties(T, D);
- };
- if (Object.defineProperties.sham) defineProperties.sham = true;
- },{"../../internals/path":390,"../../modules/es.object.define-properties":459}],205:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.object.define-property');
- var path = _dereq_('../../internals/path');
- var Object = path.Object;
- var defineProperty = module.exports = function defineProperty(it, key, desc) {
- return Object.defineProperty(it, key, desc);
- };
- if (Object.defineProperty.sham) defineProperty.sham = true;
- },{"../../internals/path":390,"../../modules/es.object.define-property":460}],206:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.object.entries');
- var path = _dereq_('../../internals/path');
- module.exports = path.Object.entries;
- },{"../../internals/path":390,"../../modules/es.object.entries":461}],207:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.object.freeze');
- var path = _dereq_('../../internals/path');
- module.exports = path.Object.freeze;
- },{"../../internals/path":390,"../../modules/es.object.freeze":462}],208:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.object.get-own-property-descriptor');
- var path = _dereq_('../../internals/path');
- var Object = path.Object;
- var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
- return Object.getOwnPropertyDescriptor(it, key);
- };
- if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
- },{"../../internals/path":390,"../../modules/es.object.get-own-property-descriptor":463}],209:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.object.get-own-property-descriptors');
- var path = _dereq_('../../internals/path');
- module.exports = path.Object.getOwnPropertyDescriptors;
- },{"../../internals/path":390,"../../modules/es.object.get-own-property-descriptors":464}],210:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.symbol');
- var path = _dereq_('../../internals/path');
- module.exports = path.Object.getOwnPropertySymbols;
- },{"../../internals/path":390,"../../modules/es.symbol":496}],211:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.object.get-prototype-of');
- var path = _dereq_('../../internals/path');
- module.exports = path.Object.getPrototypeOf;
- },{"../../internals/path":390,"../../modules/es.object.get-prototype-of":466}],212:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.object.keys');
- var path = _dereq_('../../internals/path');
- module.exports = path.Object.keys;
- },{"../../internals/path":390,"../../modules/es.object.keys":467}],213:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.object.set-prototype-of');
- var path = _dereq_('../../internals/path');
- module.exports = path.Object.setPrototypeOf;
- },{"../../internals/path":390,"../../modules/es.object.set-prototype-of":468}],214:[function(_dereq_,module,exports){
- _dereq_('../modules/es.parse-int');
- var path = _dereq_('../internals/path');
- module.exports = path.parseInt;
- },{"../internals/path":390,"../modules/es.parse-int":470}],215:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.aggregate-error');
- _dereq_('../../modules/es.array.iterator');
- _dereq_('../../modules/es.object.to-string');
- _dereq_('../../modules/es.promise');
- _dereq_('../../modules/es.promise.all-settled');
- _dereq_('../../modules/es.promise.any');
- _dereq_('../../modules/es.promise.finally');
- _dereq_('../../modules/es.string.iterator');
- var path = _dereq_('../../internals/path');
- module.exports = path.Promise;
- },{"../../internals/path":390,"../../modules/es.aggregate-error":432,"../../modules/es.array.iterator":443,"../../modules/es.object.to-string":469,"../../modules/es.promise":477,"../../modules/es.promise.all-settled":471,"../../modules/es.promise.any":473,"../../modules/es.promise.finally":476,"../../modules/es.string.iterator":487}],216:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.reflect.construct');
- var path = _dereq_('../../internals/path');
- module.exports = path.Reflect.construct;
- },{"../../internals/path":390,"../../modules/es.reflect.construct":481}],217:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.reflect.get');
- var path = _dereq_('../../internals/path');
- module.exports = path.Reflect.get;
- },{"../../internals/path":390,"../../modules/es.reflect.get":482}],218:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.array.iterator');
- _dereq_('../../modules/es.object.to-string');
- _dereq_('../../modules/es.set');
- _dereq_('../../modules/es.string.iterator');
- var path = _dereq_('../../internals/path');
- module.exports = path.Set;
- },{"../../internals/path":390,"../../modules/es.array.iterator":443,"../../modules/es.object.to-string":469,"../../modules/es.set":485,"../../modules/es.string.iterator":487}],219:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.string.includes');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('String').includes;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.string.includes":486}],220:[function(_dereq_,module,exports){
- _dereq_('../../../modules/es.string.starts-with');
- var entryVirtual = _dereq_('../../../internals/entry-virtual');
- module.exports = entryVirtual('String').startsWith;
- },{"../../../internals/entry-virtual":314,"../../../modules/es.string.starts-with":488}],221:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.array.concat');
- _dereq_('../../modules/es.object.to-string');
- _dereq_('../../modules/es.symbol');
- _dereq_('../../modules/es.symbol.async-iterator');
- _dereq_('../../modules/es.symbol.description');
- _dereq_('../../modules/es.symbol.has-instance');
- _dereq_('../../modules/es.symbol.is-concat-spreadable');
- _dereq_('../../modules/es.symbol.iterator');
- _dereq_('../../modules/es.symbol.match');
- _dereq_('../../modules/es.symbol.match-all');
- _dereq_('../../modules/es.symbol.replace');
- _dereq_('../../modules/es.symbol.search');
- _dereq_('../../modules/es.symbol.species');
- _dereq_('../../modules/es.symbol.split');
- _dereq_('../../modules/es.symbol.to-primitive');
- _dereq_('../../modules/es.symbol.to-string-tag');
- _dereq_('../../modules/es.symbol.unscopables');
- _dereq_('../../modules/es.json.to-string-tag');
- _dereq_('../../modules/es.math.to-string-tag');
- _dereq_('../../modules/es.reflect.to-string-tag');
- var path = _dereq_('../../internals/path');
- module.exports = path.Symbol;
- },{"../../internals/path":390,"../../modules/es.array.concat":433,"../../modules/es.json.to-string-tag":452,"../../modules/es.math.to-string-tag":455,"../../modules/es.object.to-string":469,"../../modules/es.reflect.to-string-tag":483,"../../modules/es.symbol":496,"../../modules/es.symbol.async-iterator":489,"../../modules/es.symbol.description":491,"../../modules/es.symbol.has-instance":493,"../../modules/es.symbol.is-concat-spreadable":494,"../../modules/es.symbol.iterator":495,"../../modules/es.symbol.match":499,"../../modules/es.symbol.match-all":498,"../../modules/es.symbol.replace":500,"../../modules/es.symbol.search":501,"../../modules/es.symbol.species":502,"../../modules/es.symbol.split":503,"../../modules/es.symbol.to-primitive":504,"../../modules/es.symbol.to-string-tag":505,"../../modules/es.symbol.unscopables":506}],222:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.array.iterator');
- _dereq_('../../modules/es.object.to-string');
- _dereq_('../../modules/es.string.iterator');
- _dereq_('../../modules/es.symbol.iterator');
- var WrappedWellKnownSymbolModule = _dereq_('../../internals/well-known-symbol-wrapped');
- module.exports = WrappedWellKnownSymbolModule.f('iterator');
- },{"../../internals/well-known-symbol-wrapped":428,"../../modules/es.array.iterator":443,"../../modules/es.object.to-string":469,"../../modules/es.string.iterator":487,"../../modules/es.symbol.iterator":495}],223:[function(_dereq_,module,exports){
- _dereq_('../../modules/es.array.iterator');
- _dereq_('../../modules/es.object.to-string');
- _dereq_('../../modules/es.weak-map');
- var path = _dereq_('../../internals/path');
- module.exports = path.WeakMap;
- },{"../../internals/path":390,"../../modules/es.array.iterator":443,"../../modules/es.object.to-string":469,"../../modules/es.weak-map":508}],224:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/array/from');
- },{"../../full/array/from":241}],225:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/array/is-array');
- },{"../../full/array/is-array":242}],226:[function(_dereq_,module,exports){
- module.exports = _dereq_('../full/get-iterator-method');
- },{"../full/get-iterator-method":243}],227:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/instance/bind');
- },{"../../full/instance/bind":244}],228:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/instance/index-of');
- },{"../../full/instance/index-of":245}],229:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/instance/slice');
- },{"../../full/instance/slice":246}],230:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/map');
- },{"../../full/map":247}],231:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/object/create');
- },{"../../full/object/create":248}],232:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/object/define-property');
- },{"../../full/object/define-property":249}],233:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/object/get-own-property-descriptor');
- },{"../../full/object/get-own-property-descriptor":250}],234:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/object/get-prototype-of');
- },{"../../full/object/get-prototype-of":251}],235:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/object/set-prototype-of');
- },{"../../full/object/set-prototype-of":252}],236:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/promise');
- },{"../../full/promise":253}],237:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/reflect/construct');
- },{"../../full/reflect/construct":254}],238:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/reflect/get');
- },{"../../full/reflect/get":255}],239:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/symbol');
- },{"../../full/symbol":256}],240:[function(_dereq_,module,exports){
- module.exports = _dereq_('../../full/symbol/iterator');
- },{"../../full/symbol/iterator":257}],241:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/array/from');
- module.exports = parent;
- },{"../../actual/array/from":146}],242:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/array/is-array');
- module.exports = parent;
- },{"../../actual/array/is-array":147}],243:[function(_dereq_,module,exports){
- var parent = _dereq_('../actual/get-iterator-method');
- module.exports = parent;
- },{"../actual/get-iterator-method":148}],244:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/instance/bind');
- module.exports = parent;
- },{"../../actual/instance/bind":149}],245:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/instance/index-of');
- module.exports = parent;
- },{"../../actual/instance/index-of":150}],246:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/instance/slice');
- module.exports = parent;
- },{"../../actual/instance/slice":151}],247:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/map');
- _dereq_('../../modules/esnext.map.from');
- _dereq_('../../modules/esnext.map.of');
- _dereq_('../../modules/esnext.map.delete-all');
- _dereq_('../../modules/esnext.map.emplace');
- _dereq_('../../modules/esnext.map.every');
- _dereq_('../../modules/esnext.map.filter');
- _dereq_('../../modules/esnext.map.find');
- _dereq_('../../modules/esnext.map.find-key');
- _dereq_('../../modules/esnext.map.group-by');
- _dereq_('../../modules/esnext.map.includes');
- _dereq_('../../modules/esnext.map.key-by');
- _dereq_('../../modules/esnext.map.key-of');
- _dereq_('../../modules/esnext.map.map-keys');
- _dereq_('../../modules/esnext.map.map-values');
- _dereq_('../../modules/esnext.map.merge');
- _dereq_('../../modules/esnext.map.reduce');
- _dereq_('../../modules/esnext.map.some');
- _dereq_('../../modules/esnext.map.update');
- // TODO: remove from `core-js@4`
- _dereq_('../../modules/esnext.map.upsert');
- // TODO: remove from `core-js@4`
- _dereq_('../../modules/esnext.map.update-or-insert');
- module.exports = parent;
- },{"../../actual/map":152,"../../modules/esnext.map.delete-all":510,"../../modules/esnext.map.emplace":511,"../../modules/esnext.map.every":512,"../../modules/esnext.map.filter":513,"../../modules/esnext.map.find":515,"../../modules/esnext.map.find-key":514,"../../modules/esnext.map.from":516,"../../modules/esnext.map.group-by":517,"../../modules/esnext.map.includes":518,"../../modules/esnext.map.key-by":519,"../../modules/esnext.map.key-of":520,"../../modules/esnext.map.map-keys":521,"../../modules/esnext.map.map-values":522,"../../modules/esnext.map.merge":523,"../../modules/esnext.map.of":524,"../../modules/esnext.map.reduce":525,"../../modules/esnext.map.some":526,"../../modules/esnext.map.update":528,"../../modules/esnext.map.update-or-insert":527,"../../modules/esnext.map.upsert":529}],248:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/object/create');
- module.exports = parent;
- },{"../../actual/object/create":153}],249:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/object/define-property');
- module.exports = parent;
- },{"../../actual/object/define-property":154}],250:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/object/get-own-property-descriptor');
- module.exports = parent;
- },{"../../actual/object/get-own-property-descriptor":155}],251:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/object/get-prototype-of');
- module.exports = parent;
- },{"../../actual/object/get-prototype-of":156}],252:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/object/set-prototype-of');
- module.exports = parent;
- },{"../../actual/object/set-prototype-of":157}],253:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/promise');
- _dereq_('../../modules/esnext.aggregate-error');
- // TODO: Remove from `core-js@4`
- _dereq_('../../modules/esnext.promise.all-settled');
- _dereq_('../../modules/esnext.promise.try');
- _dereq_('../../modules/esnext.promise.any');
- module.exports = parent;
- },{"../../actual/promise":158,"../../modules/esnext.aggregate-error":509,"../../modules/esnext.promise.all-settled":530,"../../modules/esnext.promise.any":531,"../../modules/esnext.promise.try":532}],254:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/reflect/construct');
- module.exports = parent;
- },{"../../actual/reflect/construct":159}],255:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/reflect/get');
- module.exports = parent;
- },{"../../actual/reflect/get":160}],256:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/symbol');
- _dereq_('../../modules/esnext.symbol.async-dispose');
- _dereq_('../../modules/esnext.symbol.dispose');
- _dereq_('../../modules/esnext.symbol.matcher');
- _dereq_('../../modules/esnext.symbol.metadata-key');
- _dereq_('../../modules/esnext.symbol.observable');
- // TODO: Remove from `core-js@4`
- _dereq_('../../modules/esnext.symbol.metadata');
- _dereq_('../../modules/esnext.symbol.pattern-match');
- _dereq_('../../modules/esnext.symbol.replace-all');
- module.exports = parent;
- },{"../../actual/symbol":161,"../../modules/esnext.symbol.async-dispose":533,"../../modules/esnext.symbol.dispose":534,"../../modules/esnext.symbol.matcher":535,"../../modules/esnext.symbol.metadata":537,"../../modules/esnext.symbol.metadata-key":536,"../../modules/esnext.symbol.observable":538,"../../modules/esnext.symbol.pattern-match":539,"../../modules/esnext.symbol.replace-all":540}],257:[function(_dereq_,module,exports){
- var parent = _dereq_('../../actual/symbol/iterator');
- module.exports = parent;
- },{"../../actual/symbol/iterator":162}],258:[function(_dereq_,module,exports){
- var isCallable = _dereq_('../internals/is-callable');
- var tryToString = _dereq_('../internals/try-to-string');
- var $TypeError = TypeError;
- // `Assert: IsCallable(argument) is true`
- module.exports = function (argument) {
- if (isCallable(argument)) return argument;
- throw $TypeError(tryToString(argument) + ' is not a function');
- };
- },{"../internals/is-callable":346,"../internals/try-to-string":421}],259:[function(_dereq_,module,exports){
- var isConstructor = _dereq_('../internals/is-constructor');
- var tryToString = _dereq_('../internals/try-to-string');
- var $TypeError = TypeError;
- // `Assert: IsConstructor(argument) is true`
- module.exports = function (argument) {
- if (isConstructor(argument)) return argument;
- throw $TypeError(tryToString(argument) + ' is not a constructor');
- };
- },{"../internals/is-constructor":347,"../internals/try-to-string":421}],260:[function(_dereq_,module,exports){
- var isCallable = _dereq_('../internals/is-callable');
- var $String = String;
- var $TypeError = TypeError;
- module.exports = function (argument) {
- if (typeof argument == 'object' || isCallable(argument)) return argument;
- throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
- };
- },{"../internals/is-callable":346}],261:[function(_dereq_,module,exports){
- module.exports = function () { /* empty */ };
- },{}],262:[function(_dereq_,module,exports){
- var isPrototypeOf = _dereq_('../internals/object-is-prototype-of');
- var $TypeError = TypeError;
- module.exports = function (it, Prototype) {
- if (isPrototypeOf(Prototype, it)) return it;
- throw $TypeError('Incorrect invocation');
- };
- },{"../internals/object-is-prototype-of":381}],263:[function(_dereq_,module,exports){
- var isObject = _dereq_('../internals/is-object');
- var $String = String;
- var $TypeError = TypeError;
- // `Assert: Type(argument) is Object`
- module.exports = function (argument) {
- if (isObject(argument)) return argument;
- throw $TypeError($String(argument) + ' is not an object');
- };
- },{"../internals/is-object":352}],264:[function(_dereq_,module,exports){
- // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it
- var fails = _dereq_('../internals/fails');
- module.exports = fails(function () {
- if (typeof ArrayBuffer == 'function') {
- var buffer = new ArrayBuffer(8);
- // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe
- if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
- }
- });
- },{"../internals/fails":319}],265:[function(_dereq_,module,exports){
- 'use strict';
- var $forEach = _dereq_('../internals/array-iteration').forEach;
- var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
- var STRICT_METHOD = arrayMethodIsStrict('forEach');
- // `Array.prototype.forEach` method implementation
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
- module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
- return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
- } : [].forEach;
- },{"../internals/array-iteration":268,"../internals/array-method-is-strict":270}],266:[function(_dereq_,module,exports){
- 'use strict';
- var bind = _dereq_('../internals/function-bind-context');
- var call = _dereq_('../internals/function-call');
- var toObject = _dereq_('../internals/to-object');
- var callWithSafeIterationClosing = _dereq_('../internals/call-with-safe-iteration-closing');
- var isArrayIteratorMethod = _dereq_('../internals/is-array-iterator-method');
- var isConstructor = _dereq_('../internals/is-constructor');
- var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
- var createProperty = _dereq_('../internals/create-property');
- var getIterator = _dereq_('../internals/get-iterator');
- var getIteratorMethod = _dereq_('../internals/get-iterator-method');
- var $Array = Array;
- // `Array.from` method implementation
- // https://tc39.es/ecma262/#sec-array.from
- module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
- var O = toObject(arrayLike);
- var IS_CONSTRUCTOR = isConstructor(this);
- var argumentsLength = arguments.length;
- var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
- var mapping = mapfn !== undefined;
- if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
- var iteratorMethod = getIteratorMethod(O);
- var index = 0;
- var length, result, step, iterator, next, value;
- // if the target is not iterable or it's an array with the default iterator - use a simple case
- if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
- iterator = getIterator(O, iteratorMethod);
- next = iterator.next;
- result = IS_CONSTRUCTOR ? new this() : [];
- for (;!(step = call(next, iterator)).done; index++) {
- value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
- createProperty(result, index, value);
- }
- } else {
- length = lengthOfArrayLike(O);
- result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
- for (;length > index; index++) {
- value = mapping ? mapfn(O[index], index) : O[index];
- createProperty(result, index, value);
- }
- }
- result.length = index;
- return result;
- };
- },{"../internals/call-with-safe-iteration-closing":278,"../internals/create-property":294,"../internals/function-bind-context":322,"../internals/function-call":325,"../internals/get-iterator":330,"../internals/get-iterator-method":329,"../internals/is-array-iterator-method":344,"../internals/is-constructor":347,"../internals/length-of-array-like":362,"../internals/to-object":416}],267:[function(_dereq_,module,exports){
- var toIndexedObject = _dereq_('../internals/to-indexed-object');
- var toAbsoluteIndex = _dereq_('../internals/to-absolute-index');
- var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
- // `Array.prototype.{ indexOf, includes }` methods implementation
- var createMethod = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIndexedObject($this);
- var length = lengthOfArrayLike(O);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare -- NaN check
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare -- NaN check
- if (value != value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- } else for (;length > index; index++) {
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
- } return !IS_INCLUDES && -1;
- };
- };
- module.exports = {
- // `Array.prototype.includes` method
- // https://tc39.es/ecma262/#sec-array.prototype.includes
- includes: createMethod(true),
- // `Array.prototype.indexOf` method
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
- indexOf: createMethod(false)
- };
- },{"../internals/length-of-array-like":362,"../internals/to-absolute-index":412,"../internals/to-indexed-object":413}],268:[function(_dereq_,module,exports){
- var bind = _dereq_('../internals/function-bind-context');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var IndexedObject = _dereq_('../internals/indexed-object');
- var toObject = _dereq_('../internals/to-object');
- var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
- var arraySpeciesCreate = _dereq_('../internals/array-species-create');
- var push = uncurryThis([].push);
- // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
- var createMethod = function (TYPE) {
- var IS_MAP = TYPE == 1;
- var IS_FILTER = TYPE == 2;
- var IS_SOME = TYPE == 3;
- var IS_EVERY = TYPE == 4;
- var IS_FIND_INDEX = TYPE == 6;
- var IS_FILTER_REJECT = TYPE == 7;
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- return function ($this, callbackfn, that, specificCreate) {
- var O = toObject($this);
- var self = IndexedObject(O);
- var boundFunction = bind(callbackfn, that);
- var length = lengthOfArrayLike(self);
- var index = 0;
- var create = specificCreate || arraySpeciesCreate;
- var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
- var value, result;
- for (;length > index; index++) if (NO_HOLES || index in self) {
- value = self[index];
- result = boundFunction(value, index, O);
- if (TYPE) {
- if (IS_MAP) target[index] = result; // map
- else if (result) switch (TYPE) {
- case 3: return true; // some
- case 5: return value; // find
- case 6: return index; // findIndex
- case 2: push(target, value); // filter
- } else switch (TYPE) {
- case 4: return false; // every
- case 7: push(target, value); // filterReject
- }
- }
- }
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
- };
- };
- module.exports = {
- // `Array.prototype.forEach` method
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
- forEach: createMethod(0),
- // `Array.prototype.map` method
- // https://tc39.es/ecma262/#sec-array.prototype.map
- map: createMethod(1),
- // `Array.prototype.filter` method
- // https://tc39.es/ecma262/#sec-array.prototype.filter
- filter: createMethod(2),
- // `Array.prototype.some` method
- // https://tc39.es/ecma262/#sec-array.prototype.some
- some: createMethod(3),
- // `Array.prototype.every` method
- // https://tc39.es/ecma262/#sec-array.prototype.every
- every: createMethod(4),
- // `Array.prototype.find` method
- // https://tc39.es/ecma262/#sec-array.prototype.find
- find: createMethod(5),
- // `Array.prototype.findIndex` method
- // https://tc39.es/ecma262/#sec-array.prototype.findIndex
- findIndex: createMethod(6),
- // `Array.prototype.filterReject` method
- // https://github.com/tc39/proposal-array-filtering
- filterReject: createMethod(7)
- };
- },{"../internals/array-species-create":277,"../internals/function-bind-context":322,"../internals/function-uncurry-this":327,"../internals/indexed-object":339,"../internals/length-of-array-like":362,"../internals/to-object":416}],269:[function(_dereq_,module,exports){
- var fails = _dereq_('../internals/fails');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var V8_VERSION = _dereq_('../internals/engine-v8-version');
- var SPECIES = wellKnownSymbol('species');
- module.exports = function (METHOD_NAME) {
- // We can't use this feature detection in V8 since it causes
- // deoptimization and serious performance degradation
- // https://github.com/zloirock/core-js/issues/677
- return V8_VERSION >= 51 || !fails(function () {
- var array = [];
- var constructor = array.constructor = {};
- constructor[SPECIES] = function () {
- return { foo: 1 };
- };
- return array[METHOD_NAME](Boolean).foo !== 1;
- });
- };
- },{"../internals/engine-v8-version":312,"../internals/fails":319,"../internals/well-known-symbol":429}],270:[function(_dereq_,module,exports){
- 'use strict';
- var fails = _dereq_('../internals/fails');
- module.exports = function (METHOD_NAME, argument) {
- var method = [][METHOD_NAME];
- return !!method && fails(function () {
- // eslint-disable-next-line no-useless-call -- required for testing
- method.call(null, argument || function () { return 1; }, 1);
- });
- };
- },{"../internals/fails":319}],271:[function(_dereq_,module,exports){
- var aCallable = _dereq_('../internals/a-callable');
- var toObject = _dereq_('../internals/to-object');
- var IndexedObject = _dereq_('../internals/indexed-object');
- var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
- var $TypeError = TypeError;
- // `Array.prototype.{ reduce, reduceRight }` methods implementation
- var createMethod = function (IS_RIGHT) {
- return function (that, callbackfn, argumentsLength, memo) {
- aCallable(callbackfn);
- var O = toObject(that);
- var self = IndexedObject(O);
- var length = lengthOfArrayLike(O);
- var index = IS_RIGHT ? length - 1 : 0;
- var i = IS_RIGHT ? -1 : 1;
- if (argumentsLength < 2) while (true) {
- if (index in self) {
- memo = self[index];
- index += i;
- break;
- }
- index += i;
- if (IS_RIGHT ? index < 0 : length <= index) {
- throw $TypeError('Reduce of empty array with no initial value');
- }
- }
- for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
- memo = callbackfn(memo, self[index], index, O);
- }
- return memo;
- };
- };
- module.exports = {
- // `Array.prototype.reduce` method
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
- left: createMethod(false),
- // `Array.prototype.reduceRight` method
- // https://tc39.es/ecma262/#sec-array.prototype.reduceright
- right: createMethod(true)
- };
- },{"../internals/a-callable":258,"../internals/indexed-object":339,"../internals/length-of-array-like":362,"../internals/to-object":416}],272:[function(_dereq_,module,exports){
- 'use strict';
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var isArray = _dereq_('../internals/is-array');
- var $TypeError = TypeError;
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // Safari < 13 does not throw an error in this case
- var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
- // makes no sense without proper strict mode support
- if (this !== undefined) return true;
- try {
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
- Object.defineProperty([], 'length', { writable: false }).length = 1;
- } catch (error) {
- return error instanceof TypeError;
- }
- }();
- module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
- if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
- throw $TypeError('Cannot set read only .length');
- } return O.length = length;
- } : function (O, length) {
- return O.length = length;
- };
- },{"../internals/descriptors":299,"../internals/is-array":345}],273:[function(_dereq_,module,exports){
- var toAbsoluteIndex = _dereq_('../internals/to-absolute-index');
- var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
- var createProperty = _dereq_('../internals/create-property');
- var $Array = Array;
- var max = Math.max;
- module.exports = function (O, start, end) {
- var length = lengthOfArrayLike(O);
- var k = toAbsoluteIndex(start, length);
- var fin = toAbsoluteIndex(end === undefined ? length : end, length);
- var result = $Array(max(fin - k, 0));
- for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
- result.length = n;
- return result;
- };
- },{"../internals/create-property":294,"../internals/length-of-array-like":362,"../internals/to-absolute-index":412}],274:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- module.exports = uncurryThis([].slice);
- },{"../internals/function-uncurry-this":327}],275:[function(_dereq_,module,exports){
- var arraySlice = _dereq_('../internals/array-slice-simple');
- var floor = Math.floor;
- var mergeSort = function (array, comparefn) {
- var length = array.length;
- var middle = floor(length / 2);
- return length < 8 ? insertionSort(array, comparefn) : merge(
- array,
- mergeSort(arraySlice(array, 0, middle), comparefn),
- mergeSort(arraySlice(array, middle), comparefn),
- comparefn
- );
- };
- var insertionSort = function (array, comparefn) {
- var length = array.length;
- var i = 1;
- var element, j;
- while (i < length) {
- j = i;
- element = array[i];
- while (j && comparefn(array[j - 1], element) > 0) {
- array[j] = array[--j];
- }
- if (j !== i++) array[j] = element;
- } return array;
- };
- var merge = function (array, left, right, comparefn) {
- var llength = left.length;
- var rlength = right.length;
- var lindex = 0;
- var rindex = 0;
- while (lindex < llength || rindex < rlength) {
- array[lindex + rindex] = (lindex < llength && rindex < rlength)
- ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
- : lindex < llength ? left[lindex++] : right[rindex++];
- } return array;
- };
- module.exports = mergeSort;
- },{"../internals/array-slice-simple":273}],276:[function(_dereq_,module,exports){
- var isArray = _dereq_('../internals/is-array');
- var isConstructor = _dereq_('../internals/is-constructor');
- var isObject = _dereq_('../internals/is-object');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var SPECIES = wellKnownSymbol('species');
- var $Array = Array;
- // a part of `ArraySpeciesCreate` abstract operation
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
- module.exports = function (originalArray) {
- var C;
- if (isArray(originalArray)) {
- C = originalArray.constructor;
- // cross-realm fallback
- if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
- else if (isObject(C)) {
- C = C[SPECIES];
- if (C === null) C = undefined;
- }
- } return C === undefined ? $Array : C;
- };
- },{"../internals/is-array":345,"../internals/is-constructor":347,"../internals/is-object":352,"../internals/well-known-symbol":429}],277:[function(_dereq_,module,exports){
- var arraySpeciesConstructor = _dereq_('../internals/array-species-constructor');
- // `ArraySpeciesCreate` abstract operation
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
- module.exports = function (originalArray, length) {
- return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
- };
- },{"../internals/array-species-constructor":276}],278:[function(_dereq_,module,exports){
- var anObject = _dereq_('../internals/an-object');
- var iteratorClose = _dereq_('../internals/iterator-close');
- // call something on iterator step with safe closing on error
- module.exports = function (iterator, fn, value, ENTRIES) {
- try {
- return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
- } catch (error) {
- iteratorClose(iterator, 'throw', error);
- }
- };
- },{"../internals/an-object":263,"../internals/iterator-close":357}],279:[function(_dereq_,module,exports){
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var ITERATOR = wellKnownSymbol('iterator');
- var SAFE_CLOSING = false;
- try {
- var called = 0;
- var iteratorWithReturn = {
- next: function () {
- return { done: !!called++ };
- },
- 'return': function () {
- SAFE_CLOSING = true;
- }
- };
- iteratorWithReturn[ITERATOR] = function () {
- return this;
- };
- // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
- Array.from(iteratorWithReturn, function () { throw 2; });
- } catch (error) { /* empty */ }
- module.exports = function (exec, SKIP_CLOSING) {
- if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
- var ITERATION_SUPPORT = false;
- try {
- var object = {};
- object[ITERATOR] = function () {
- return {
- next: function () {
- return { done: ITERATION_SUPPORT = true };
- }
- };
- };
- exec(object);
- } catch (error) { /* empty */ }
- return ITERATION_SUPPORT;
- };
- },{"../internals/well-known-symbol":429}],280:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var toString = uncurryThis({}.toString);
- var stringSlice = uncurryThis(''.slice);
- module.exports = function (it) {
- return stringSlice(toString(it), 8, -1);
- };
- },{"../internals/function-uncurry-this":327}],281:[function(_dereq_,module,exports){
- var TO_STRING_TAG_SUPPORT = _dereq_('../internals/to-string-tag-support');
- var isCallable = _dereq_('../internals/is-callable');
- var classofRaw = _dereq_('../internals/classof-raw');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- var $Object = Object;
- // ES3 wrong here
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
- // fallback for IE11 Script Access Denied error
- var tryGet = function (it, key) {
- try {
- return it[key];
- } catch (error) { /* empty */ }
- };
- // getting tag from ES6+ `Object.prototype.toString`
- module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
- var O, tag, result;
- return it === undefined ? 'Undefined' : it === null ? 'Null'
- // @@toStringTag case
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
- // builtinTag case
- : CORRECT_ARGUMENTS ? classofRaw(O)
- // ES3 arguments fallback
- : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
- };
- },{"../internals/classof-raw":280,"../internals/is-callable":346,"../internals/to-string-tag-support":419,"../internals/well-known-symbol":429}],282:[function(_dereq_,module,exports){
- 'use strict';
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var anObject = _dereq_('../internals/an-object');
- // https://github.com/tc39/collection-methods
- module.exports = function deleteAll(/* ...elements */) {
- var collection = anObject(this);
- var remover = aCallable(collection['delete']);
- var allDeleted = true;
- var wasDeleted;
- for (var k = 0, len = arguments.length; k < len; k++) {
- wasDeleted = call(remover, collection, arguments[k]);
- allDeleted = allDeleted && wasDeleted;
- }
- return !!allDeleted;
- };
- },{"../internals/a-callable":258,"../internals/an-object":263,"../internals/function-call":325}],283:[function(_dereq_,module,exports){
- 'use strict';
- // https://tc39.github.io/proposal-setmap-offrom/
- var bind = _dereq_('../internals/function-bind-context');
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var aConstructor = _dereq_('../internals/a-constructor');
- var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
- var iterate = _dereq_('../internals/iterate');
- var push = [].push;
- module.exports = function from(source /* , mapFn, thisArg */) {
- var length = arguments.length;
- var mapFn = length > 1 ? arguments[1] : undefined;
- var mapping, array, n, boundFunction;
- aConstructor(this);
- mapping = mapFn !== undefined;
- if (mapping) aCallable(mapFn);
- if (isNullOrUndefined(source)) return new this();
- array = [];
- if (mapping) {
- n = 0;
- boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined);
- iterate(source, function (nextItem) {
- call(push, array, boundFunction(nextItem, n++));
- });
- } else {
- iterate(source, push, { that: array });
- }
- return new this(array);
- };
- },{"../internals/a-callable":258,"../internals/a-constructor":259,"../internals/function-bind-context":322,"../internals/function-call":325,"../internals/is-null-or-undefined":351,"../internals/iterate":356}],284:[function(_dereq_,module,exports){
- 'use strict';
- var arraySlice = _dereq_('../internals/array-slice');
- // https://tc39.github.io/proposal-setmap-offrom/
- module.exports = function of() {
- return new this(arraySlice(arguments));
- };
- },{"../internals/array-slice":274}],285:[function(_dereq_,module,exports){
- 'use strict';
- var defineProperty = _dereq_('../internals/object-define-property').f;
- var create = _dereq_('../internals/object-create');
- var defineBuiltIns = _dereq_('../internals/define-built-ins');
- var bind = _dereq_('../internals/function-bind-context');
- var anInstance = _dereq_('../internals/an-instance');
- var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
- var iterate = _dereq_('../internals/iterate');
- var defineIterator = _dereq_('../internals/iterator-define');
- var createIterResultObject = _dereq_('../internals/create-iter-result-object');
- var setSpecies = _dereq_('../internals/set-species');
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var fastKey = _dereq_('../internals/internal-metadata').fastKey;
- var InternalStateModule = _dereq_('../internals/internal-state');
- var setInternalState = InternalStateModule.set;
- var internalStateGetterFor = InternalStateModule.getterFor;
- module.exports = {
- getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
- var Constructor = wrapper(function (that, iterable) {
- anInstance(that, Prototype);
- setInternalState(that, {
- type: CONSTRUCTOR_NAME,
- index: create(null),
- first: undefined,
- last: undefined,
- size: 0
- });
- if (!DESCRIPTORS) that.size = 0;
- if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
- });
- var Prototype = Constructor.prototype;
- var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
- var define = function (that, key, value) {
- var state = getInternalState(that);
- var entry = getEntry(that, key);
- var previous, index;
- // change existing entry
- if (entry) {
- entry.value = value;
- // create new entry
- } else {
- state.last = entry = {
- index: index = fastKey(key, true),
- key: key,
- value: value,
- previous: previous = state.last,
- next: undefined,
- removed: false
- };
- if (!state.first) state.first = entry;
- if (previous) previous.next = entry;
- if (DESCRIPTORS) state.size++;
- else that.size++;
- // add to index
- if (index !== 'F') state.index[index] = entry;
- } return that;
- };
- var getEntry = function (that, key) {
- var state = getInternalState(that);
- // fast case
- var index = fastKey(key);
- var entry;
- if (index !== 'F') return state.index[index];
- // frozen object case
- for (entry = state.first; entry; entry = entry.next) {
- if (entry.key == key) return entry;
- }
- };
- defineBuiltIns(Prototype, {
- // `{ Map, Set }.prototype.clear()` methods
- // https://tc39.es/ecma262/#sec-map.prototype.clear
- // https://tc39.es/ecma262/#sec-set.prototype.clear
- clear: function clear() {
- var that = this;
- var state = getInternalState(that);
- var data = state.index;
- var entry = state.first;
- while (entry) {
- entry.removed = true;
- if (entry.previous) entry.previous = entry.previous.next = undefined;
- delete data[entry.index];
- entry = entry.next;
- }
- state.first = state.last = undefined;
- if (DESCRIPTORS) state.size = 0;
- else that.size = 0;
- },
- // `{ Map, Set }.prototype.delete(key)` methods
- // https://tc39.es/ecma262/#sec-map.prototype.delete
- // https://tc39.es/ecma262/#sec-set.prototype.delete
- 'delete': function (key) {
- var that = this;
- var state = getInternalState(that);
- var entry = getEntry(that, key);
- if (entry) {
- var next = entry.next;
- var prev = entry.previous;
- delete state.index[entry.index];
- entry.removed = true;
- if (prev) prev.next = next;
- if (next) next.previous = prev;
- if (state.first == entry) state.first = next;
- if (state.last == entry) state.last = prev;
- if (DESCRIPTORS) state.size--;
- else that.size--;
- } return !!entry;
- },
- // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
- // https://tc39.es/ecma262/#sec-map.prototype.foreach
- // https://tc39.es/ecma262/#sec-set.prototype.foreach
- forEach: function forEach(callbackfn /* , that = undefined */) {
- var state = getInternalState(this);
- var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- var entry;
- while (entry = entry ? entry.next : state.first) {
- boundFunction(entry.value, entry.key, this);
- // revert to the last existing entry
- while (entry && entry.removed) entry = entry.previous;
- }
- },
- // `{ Map, Set}.prototype.has(key)` methods
- // https://tc39.es/ecma262/#sec-map.prototype.has
- // https://tc39.es/ecma262/#sec-set.prototype.has
- has: function has(key) {
- return !!getEntry(this, key);
- }
- });
- defineBuiltIns(Prototype, IS_MAP ? {
- // `Map.prototype.get(key)` method
- // https://tc39.es/ecma262/#sec-map.prototype.get
- get: function get(key) {
- var entry = getEntry(this, key);
- return entry && entry.value;
- },
- // `Map.prototype.set(key, value)` method
- // https://tc39.es/ecma262/#sec-map.prototype.set
- set: function set(key, value) {
- return define(this, key === 0 ? 0 : key, value);
- }
- } : {
- // `Set.prototype.add(value)` method
- // https://tc39.es/ecma262/#sec-set.prototype.add
- add: function add(value) {
- return define(this, value = value === 0 ? 0 : value, value);
- }
- });
- if (DESCRIPTORS) defineProperty(Prototype, 'size', {
- get: function () {
- return getInternalState(this).size;
- }
- });
- return Constructor;
- },
- setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
- var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
- var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
- var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
- // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
- // https://tc39.es/ecma262/#sec-map.prototype.entries
- // https://tc39.es/ecma262/#sec-map.prototype.keys
- // https://tc39.es/ecma262/#sec-map.prototype.values
- // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
- // https://tc39.es/ecma262/#sec-set.prototype.entries
- // https://tc39.es/ecma262/#sec-set.prototype.keys
- // https://tc39.es/ecma262/#sec-set.prototype.values
- // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
- defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
- setInternalState(this, {
- type: ITERATOR_NAME,
- target: iterated,
- state: getInternalCollectionState(iterated),
- kind: kind,
- last: undefined
- });
- }, function () {
- var state = getInternalIteratorState(this);
- var kind = state.kind;
- var entry = state.last;
- // revert to the last existing entry
- while (entry && entry.removed) entry = entry.previous;
- // get next entry
- if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
- // or finish the iteration
- state.target = undefined;
- return createIterResultObject(undefined, true);
- }
- // return step by kind
- if (kind == 'keys') return createIterResultObject(entry.key, false);
- if (kind == 'values') return createIterResultObject(entry.value, false);
- return createIterResultObject([entry.key, entry.value], false);
- }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
- // `{ Map, Set }.prototype[@@species]` accessors
- // https://tc39.es/ecma262/#sec-get-map-@@species
- // https://tc39.es/ecma262/#sec-get-set-@@species
- setSpecies(CONSTRUCTOR_NAME);
- }
- };
- },{"../internals/an-instance":262,"../internals/create-iter-result-object":291,"../internals/define-built-ins":296,"../internals/descriptors":299,"../internals/function-bind-context":322,"../internals/internal-metadata":342,"../internals/internal-state":343,"../internals/is-null-or-undefined":351,"../internals/iterate":356,"../internals/iterator-define":359,"../internals/object-create":372,"../internals/object-define-property":374,"../internals/set-species":400}],286:[function(_dereq_,module,exports){
- 'use strict';
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var defineBuiltIns = _dereq_('../internals/define-built-ins');
- var getWeakData = _dereq_('../internals/internal-metadata').getWeakData;
- var anInstance = _dereq_('../internals/an-instance');
- var anObject = _dereq_('../internals/an-object');
- var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
- var isObject = _dereq_('../internals/is-object');
- var iterate = _dereq_('../internals/iterate');
- var ArrayIterationModule = _dereq_('../internals/array-iteration');
- var hasOwn = _dereq_('../internals/has-own-property');
- var InternalStateModule = _dereq_('../internals/internal-state');
- var setInternalState = InternalStateModule.set;
- var internalStateGetterFor = InternalStateModule.getterFor;
- var find = ArrayIterationModule.find;
- var findIndex = ArrayIterationModule.findIndex;
- var splice = uncurryThis([].splice);
- var id = 0;
- // fallback for uncaught frozen keys
- var uncaughtFrozenStore = function (store) {
- return store.frozen || (store.frozen = new UncaughtFrozenStore());
- };
- var UncaughtFrozenStore = function () {
- this.entries = [];
- };
- var findUncaughtFrozen = function (store, key) {
- return find(store.entries, function (it) {
- return it[0] === key;
- });
- };
- UncaughtFrozenStore.prototype = {
- get: function (key) {
- var entry = findUncaughtFrozen(this, key);
- if (entry) return entry[1];
- },
- has: function (key) {
- return !!findUncaughtFrozen(this, key);
- },
- set: function (key, value) {
- var entry = findUncaughtFrozen(this, key);
- if (entry) entry[1] = value;
- else this.entries.push([key, value]);
- },
- 'delete': function (key) {
- var index = findIndex(this.entries, function (it) {
- return it[0] === key;
- });
- if (~index) splice(this.entries, index, 1);
- return !!~index;
- }
- };
- module.exports = {
- getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
- var Constructor = wrapper(function (that, iterable) {
- anInstance(that, Prototype);
- setInternalState(that, {
- type: CONSTRUCTOR_NAME,
- id: id++,
- frozen: undefined
- });
- if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
- });
- var Prototype = Constructor.prototype;
- var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
- var define = function (that, key, value) {
- var state = getInternalState(that);
- var data = getWeakData(anObject(key), true);
- if (data === true) uncaughtFrozenStore(state).set(key, value);
- else data[state.id] = value;
- return that;
- };
- defineBuiltIns(Prototype, {
- // `{ WeakMap, WeakSet }.prototype.delete(key)` methods
- // https://tc39.es/ecma262/#sec-weakmap.prototype.delete
- // https://tc39.es/ecma262/#sec-weakset.prototype.delete
- 'delete': function (key) {
- var state = getInternalState(this);
- if (!isObject(key)) return false;
- var data = getWeakData(key);
- if (data === true) return uncaughtFrozenStore(state)['delete'](key);
- return data && hasOwn(data, state.id) && delete data[state.id];
- },
- // `{ WeakMap, WeakSet }.prototype.has(key)` methods
- // https://tc39.es/ecma262/#sec-weakmap.prototype.has
- // https://tc39.es/ecma262/#sec-weakset.prototype.has
- has: function has(key) {
- var state = getInternalState(this);
- if (!isObject(key)) return false;
- var data = getWeakData(key);
- if (data === true) return uncaughtFrozenStore(state).has(key);
- return data && hasOwn(data, state.id);
- }
- });
- defineBuiltIns(Prototype, IS_MAP ? {
- // `WeakMap.prototype.get(key)` method
- // https://tc39.es/ecma262/#sec-weakmap.prototype.get
- get: function get(key) {
- var state = getInternalState(this);
- if (isObject(key)) {
- var data = getWeakData(key);
- if (data === true) return uncaughtFrozenStore(state).get(key);
- return data ? data[state.id] : undefined;
- }
- },
- // `WeakMap.prototype.set(key, value)` method
- // https://tc39.es/ecma262/#sec-weakmap.prototype.set
- set: function set(key, value) {
- return define(this, key, value);
- }
- } : {
- // `WeakSet.prototype.add(value)` method
- // https://tc39.es/ecma262/#sec-weakset.prototype.add
- add: function add(value) {
- return define(this, value, true);
- }
- });
- return Constructor;
- }
- };
- },{"../internals/an-instance":262,"../internals/an-object":263,"../internals/array-iteration":268,"../internals/define-built-ins":296,"../internals/function-uncurry-this":327,"../internals/has-own-property":334,"../internals/internal-metadata":342,"../internals/internal-state":343,"../internals/is-null-or-undefined":351,"../internals/is-object":352,"../internals/iterate":356}],287:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var global = _dereq_('../internals/global');
- var InternalMetadataModule = _dereq_('../internals/internal-metadata');
- var fails = _dereq_('../internals/fails');
- var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
- var iterate = _dereq_('../internals/iterate');
- var anInstance = _dereq_('../internals/an-instance');
- var isCallable = _dereq_('../internals/is-callable');
- var isObject = _dereq_('../internals/is-object');
- var setToStringTag = _dereq_('../internals/set-to-string-tag');
- var defineProperty = _dereq_('../internals/object-define-property').f;
- var forEach = _dereq_('../internals/array-iteration').forEach;
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var InternalStateModule = _dereq_('../internals/internal-state');
- var setInternalState = InternalStateModule.set;
- var internalStateGetterFor = InternalStateModule.getterFor;
- module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
- var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
- var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
- var ADDER = IS_MAP ? 'set' : 'add';
- var NativeConstructor = global[CONSTRUCTOR_NAME];
- var NativePrototype = NativeConstructor && NativeConstructor.prototype;
- var exported = {};
- var Constructor;
- if (!DESCRIPTORS || !isCallable(NativeConstructor)
- || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
- ) {
- // create collection constructor
- Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
- InternalMetadataModule.enable();
- } else {
- Constructor = wrapper(function (target, iterable) {
- setInternalState(anInstance(target, Prototype), {
- type: CONSTRUCTOR_NAME,
- collection: new NativeConstructor()
- });
- if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
- });
- var Prototype = Constructor.prototype;
- var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
- forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
- var IS_ADDER = KEY == 'add' || KEY == 'set';
- if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
- createNonEnumerableProperty(Prototype, KEY, function (a, b) {
- var collection = getInternalState(this).collection;
- if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
- var result = collection[KEY](a === 0 ? 0 : a, b);
- return IS_ADDER ? this : result;
- });
- }
- });
- IS_WEAK || defineProperty(Prototype, 'size', {
- configurable: true,
- get: function () {
- return getInternalState(this).collection.size;
- }
- });
- }
- setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
- exported[CONSTRUCTOR_NAME] = Constructor;
- $({ global: true, forced: true }, exported);
- if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
- return Constructor;
- };
- },{"../internals/an-instance":262,"../internals/array-iteration":268,"../internals/create-non-enumerable-property":292,"../internals/descriptors":299,"../internals/export":318,"../internals/fails":319,"../internals/global":333,"../internals/internal-metadata":342,"../internals/internal-state":343,"../internals/is-callable":346,"../internals/is-object":352,"../internals/iterate":356,"../internals/object-define-property":374,"../internals/set-to-string-tag":401}],288:[function(_dereq_,module,exports){
- var hasOwn = _dereq_('../internals/has-own-property');
- var ownKeys = _dereq_('../internals/own-keys');
- var getOwnPropertyDescriptorModule = _dereq_('../internals/object-get-own-property-descriptor');
- var definePropertyModule = _dereq_('../internals/object-define-property');
- module.exports = function (target, source, exceptions) {
- var keys = ownKeys(source);
- var defineProperty = definePropertyModule.f;
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
- }
- }
- };
- },{"../internals/has-own-property":334,"../internals/object-define-property":374,"../internals/object-get-own-property-descriptor":375,"../internals/own-keys":389}],289:[function(_dereq_,module,exports){
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var MATCH = wellKnownSymbol('match');
- module.exports = function (METHOD_NAME) {
- var regexp = /./;
- try {
- '/./'[METHOD_NAME](regexp);
- } catch (error1) {
- try {
- regexp[MATCH] = false;
- return '/./'[METHOD_NAME](regexp);
- } catch (error2) { /* empty */ }
- } return false;
- };
- },{"../internals/well-known-symbol":429}],290:[function(_dereq_,module,exports){
- var fails = _dereq_('../internals/fails');
- module.exports = !fails(function () {
- function F() { /* empty */ }
- F.prototype.constructor = null;
- // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
- return Object.getPrototypeOf(new F()) !== F.prototype;
- });
- },{"../internals/fails":319}],291:[function(_dereq_,module,exports){
- // `CreateIterResultObject` abstract operation
- // https://tc39.es/ecma262/#sec-createiterresultobject
- module.exports = function (value, done) {
- return { value: value, done: done };
- };
- },{}],292:[function(_dereq_,module,exports){
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var definePropertyModule = _dereq_('../internals/object-define-property');
- var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
- module.exports = DESCRIPTORS ? function (object, key, value) {
- return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
- } : function (object, key, value) {
- object[key] = value;
- return object;
- };
- },{"../internals/create-property-descriptor":293,"../internals/descriptors":299,"../internals/object-define-property":374}],293:[function(_dereq_,module,exports){
- module.exports = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
- };
- },{}],294:[function(_dereq_,module,exports){
- 'use strict';
- var toPropertyKey = _dereq_('../internals/to-property-key');
- var definePropertyModule = _dereq_('../internals/object-define-property');
- var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
- module.exports = function (object, key, value) {
- var propertyKey = toPropertyKey(key);
- if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
- else object[propertyKey] = value;
- };
- },{"../internals/create-property-descriptor":293,"../internals/object-define-property":374,"../internals/to-property-key":418}],295:[function(_dereq_,module,exports){
- var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
- module.exports = function (target, key, value, options) {
- if (options && options.enumerable) target[key] = value;
- else createNonEnumerableProperty(target, key, value);
- return target;
- };
- },{"../internals/create-non-enumerable-property":292}],296:[function(_dereq_,module,exports){
- var defineBuiltIn = _dereq_('../internals/define-built-in');
- module.exports = function (target, src, options) {
- for (var key in src) {
- if (options && options.unsafe && target[key]) target[key] = src[key];
- else defineBuiltIn(target, key, src[key], options);
- } return target;
- };
- },{"../internals/define-built-in":295}],297:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
- var defineProperty = Object.defineProperty;
- module.exports = function (key, value) {
- try {
- defineProperty(global, key, { value: value, configurable: true, writable: true });
- } catch (error) {
- global[key] = value;
- } return value;
- };
- },{"../internals/global":333}],298:[function(_dereq_,module,exports){
- 'use strict';
- var tryToString = _dereq_('../internals/try-to-string');
- var $TypeError = TypeError;
- module.exports = function (O, P) {
- if (!delete O[P]) throw $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
- };
- },{"../internals/try-to-string":421}],299:[function(_dereq_,module,exports){
- var fails = _dereq_('../internals/fails');
- // Detect IE8's incomplete defineProperty implementation
- module.exports = !fails(function () {
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
- });
- },{"../internals/fails":319}],300:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- var isObject = _dereq_('../internals/is-object');
- var document = global.document;
- // typeof document.createElement is 'object' in old IE
- var EXISTS = isObject(document) && isObject(document.createElement);
- module.exports = function (it) {
- return EXISTS ? document.createElement(it) : {};
- };
- },{"../internals/global":333,"../internals/is-object":352}],301:[function(_dereq_,module,exports){
- var $TypeError = TypeError;
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
- module.exports = function (it) {
- if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
- return it;
- };
- },{}],302:[function(_dereq_,module,exports){
- // iterable DOM collections
- // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
- module.exports = {
- 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
- };
- },{}],303:[function(_dereq_,module,exports){
- var userAgent = _dereq_('../internals/engine-user-agent');
- var firefox = userAgent.match(/firefox\/(\d+)/i);
- module.exports = !!firefox && +firefox[1];
- },{"../internals/engine-user-agent":311}],304:[function(_dereq_,module,exports){
- var IS_DENO = _dereq_('../internals/engine-is-deno');
- var IS_NODE = _dereq_('../internals/engine-is-node');
- module.exports = !IS_DENO && !IS_NODE
- && typeof window == 'object'
- && typeof document == 'object';
- },{"../internals/engine-is-deno":305,"../internals/engine-is-node":309}],305:[function(_dereq_,module,exports){
- /* global Deno -- Deno case */
- module.exports = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
- },{}],306:[function(_dereq_,module,exports){
- var UA = _dereq_('../internals/engine-user-agent');
- module.exports = /MSIE|Trident/.test(UA);
- },{"../internals/engine-user-agent":311}],307:[function(_dereq_,module,exports){
- var userAgent = _dereq_('../internals/engine-user-agent');
- var global = _dereq_('../internals/global');
- module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
- },{"../internals/engine-user-agent":311,"../internals/global":333}],308:[function(_dereq_,module,exports){
- var userAgent = _dereq_('../internals/engine-user-agent');
- module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
- },{"../internals/engine-user-agent":311}],309:[function(_dereq_,module,exports){
- var classof = _dereq_('../internals/classof-raw');
- var global = _dereq_('../internals/global');
- module.exports = classof(global.process) == 'process';
- },{"../internals/classof-raw":280,"../internals/global":333}],310:[function(_dereq_,module,exports){
- var userAgent = _dereq_('../internals/engine-user-agent');
- module.exports = /web0s(?!.*chrome)/i.test(userAgent);
- },{"../internals/engine-user-agent":311}],311:[function(_dereq_,module,exports){
- var getBuiltIn = _dereq_('../internals/get-built-in');
- module.exports = getBuiltIn('navigator', 'userAgent') || '';
- },{"../internals/get-built-in":328}],312:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- var userAgent = _dereq_('../internals/engine-user-agent');
- var process = global.process;
- var Deno = global.Deno;
- var versions = process && process.versions || Deno && Deno.version;
- var v8 = versions && versions.v8;
- var match, version;
- if (v8) {
- match = v8.split('.');
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
- // but their correct versions are not interesting for us
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
- }
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
- // so check `userAgent` even if `.v8` exists, but 0
- if (!version && userAgent) {
- match = userAgent.match(/Edge\/(\d+)/);
- if (!match || match[1] >= 74) {
- match = userAgent.match(/Chrome\/(\d+)/);
- if (match) version = +match[1];
- }
- }
- module.exports = version;
- },{"../internals/engine-user-agent":311,"../internals/global":333}],313:[function(_dereq_,module,exports){
- var userAgent = _dereq_('../internals/engine-user-agent');
- var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
- module.exports = !!webkit && +webkit[1];
- },{"../internals/engine-user-agent":311}],314:[function(_dereq_,module,exports){
- var path = _dereq_('../internals/path');
- module.exports = function (CONSTRUCTOR) {
- return path[CONSTRUCTOR + 'Prototype'];
- };
- },{"../internals/path":390}],315:[function(_dereq_,module,exports){
- // IE8- don't enum bug keys
- module.exports = [
- 'constructor',
- 'hasOwnProperty',
- 'isPrototypeOf',
- 'propertyIsEnumerable',
- 'toLocaleString',
- 'toString',
- 'valueOf'
- ];
- },{}],316:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var $Error = Error;
- var replace = uncurryThis(''.replace);
- var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
- var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
- var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
- module.exports = function (stack, dropEntries) {
- if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
- while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
- } return stack;
- };
- },{"../internals/function-uncurry-this":327}],317:[function(_dereq_,module,exports){
- var fails = _dereq_('../internals/fails');
- var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
- module.exports = !fails(function () {
- var error = Error('a');
- if (!('stack' in error)) return true;
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
- Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
- return error.stack !== 7;
- });
- },{"../internals/create-property-descriptor":293,"../internals/fails":319}],318:[function(_dereq_,module,exports){
- 'use strict';
- var global = _dereq_('../internals/global');
- var apply = _dereq_('../internals/function-apply');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var isCallable = _dereq_('../internals/is-callable');
- var getOwnPropertyDescriptor = _dereq_('../internals/object-get-own-property-descriptor').f;
- var isForced = _dereq_('../internals/is-forced');
- var path = _dereq_('../internals/path');
- var bind = _dereq_('../internals/function-bind-context');
- var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
- var hasOwn = _dereq_('../internals/has-own-property');
- var wrapConstructor = function (NativeConstructor) {
- var Wrapper = function (a, b, c) {
- if (this instanceof Wrapper) {
- switch (arguments.length) {
- case 0: return new NativeConstructor();
- case 1: return new NativeConstructor(a);
- case 2: return new NativeConstructor(a, b);
- } return new NativeConstructor(a, b, c);
- } return apply(NativeConstructor, this, arguments);
- };
- Wrapper.prototype = NativeConstructor.prototype;
- return Wrapper;
- };
- /*
- options.target - name of the target object
- options.global - target is the global object
- options.stat - export as static methods of target
- options.proto - export as prototype methods of target
- options.real - real prototype method for the `pure` version
- options.forced - export even if the native feature is available
- options.bind - bind methods to the target, required for the `pure` version
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
- options.sham - add a flag to not completely full polyfills
- options.enumerable - export as enumerable property
- options.dontCallGetSet - prevent calling a getter on target
- options.name - the .name of the function if it does not match the key
- */
- module.exports = function (options, source) {
- var TARGET = options.target;
- var GLOBAL = options.global;
- var STATIC = options.stat;
- var PROTO = options.proto;
- var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;
- var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET];
- var targetPrototype = target.prototype;
- var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
- var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
- for (key in source) {
- FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
- // contains in native
- USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key);
- targetProperty = target[key];
- if (USE_NATIVE) if (options.dontCallGetSet) {
- descriptor = getOwnPropertyDescriptor(nativeSource, key);
- nativeProperty = descriptor && descriptor.value;
- } else nativeProperty = nativeSource[key];
- // export native or implementation
- sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];
- if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;
- // bind timers to global for call from export context
- if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global);
- // wrap global constructors for prevent changs in this version
- else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
- // make static versions for prototype methods
- else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty);
- // default case
- else resultProperty = sourceProperty;
- // add a flag to not completely full polyfills
- if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
- createNonEnumerableProperty(resultProperty, 'sham', true);
- }
- createNonEnumerableProperty(target, key, resultProperty);
- if (PROTO) {
- VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
- if (!hasOwn(path, VIRTUAL_PROTOTYPE)) {
- createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
- }
- // export virtual prototype methods
- createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty);
- // export real prototype methods
- if (options.real && targetPrototype && !targetPrototype[key]) {
- createNonEnumerableProperty(targetPrototype, key, sourceProperty);
- }
- }
- }
- };
- },{"../internals/create-non-enumerable-property":292,"../internals/function-apply":321,"../internals/function-bind-context":322,"../internals/function-uncurry-this":327,"../internals/global":333,"../internals/has-own-property":334,"../internals/is-callable":346,"../internals/is-forced":349,"../internals/object-get-own-property-descriptor":375,"../internals/path":390}],319:[function(_dereq_,module,exports){
- module.exports = function (exec) {
- try {
- return !!exec();
- } catch (error) {
- return true;
- }
- };
- },{}],320:[function(_dereq_,module,exports){
- var fails = _dereq_('../internals/fails');
- module.exports = !fails(function () {
- // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing
- return Object.isExtensible(Object.preventExtensions({}));
- });
- },{"../internals/fails":319}],321:[function(_dereq_,module,exports){
- var NATIVE_BIND = _dereq_('../internals/function-bind-native');
- var FunctionPrototype = Function.prototype;
- var apply = FunctionPrototype.apply;
- var call = FunctionPrototype.call;
- // eslint-disable-next-line es-x/no-reflect -- safe
- module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
- return call.apply(apply, arguments);
- });
- },{"../internals/function-bind-native":323}],322:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var aCallable = _dereq_('../internals/a-callable');
- var NATIVE_BIND = _dereq_('../internals/function-bind-native');
- var bind = uncurryThis(uncurryThis.bind);
- // optional / simple context binding
- module.exports = function (fn, that) {
- aCallable(fn);
- return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
- return fn.apply(that, arguments);
- };
- };
- },{"../internals/a-callable":258,"../internals/function-bind-native":323,"../internals/function-uncurry-this":327}],323:[function(_dereq_,module,exports){
- var fails = _dereq_('../internals/fails');
- module.exports = !fails(function () {
- // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
- var test = (function () { /* empty */ }).bind();
- // eslint-disable-next-line no-prototype-builtins -- safe
- return typeof test != 'function' || test.hasOwnProperty('prototype');
- });
- },{"../internals/fails":319}],324:[function(_dereq_,module,exports){
- 'use strict';
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var aCallable = _dereq_('../internals/a-callable');
- var isObject = _dereq_('../internals/is-object');
- var hasOwn = _dereq_('../internals/has-own-property');
- var arraySlice = _dereq_('../internals/array-slice');
- var NATIVE_BIND = _dereq_('../internals/function-bind-native');
- var $Function = Function;
- var concat = uncurryThis([].concat);
- var join = uncurryThis([].join);
- var factories = {};
- var construct = function (C, argsLength, args) {
- if (!hasOwn(factories, argsLength)) {
- for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
- factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');
- } return factories[argsLength](C, args);
- };
- // `Function.prototype.bind` method implementation
- // https://tc39.es/ecma262/#sec-function.prototype.bind
- module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {
- var F = aCallable(this);
- var Prototype = F.prototype;
- var partArgs = arraySlice(arguments, 1);
- var boundFunction = function bound(/* args... */) {
- var args = concat(partArgs, arraySlice(arguments));
- return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);
- };
- if (isObject(Prototype)) boundFunction.prototype = Prototype;
- return boundFunction;
- };
- },{"../internals/a-callable":258,"../internals/array-slice":274,"../internals/function-bind-native":323,"../internals/function-uncurry-this":327,"../internals/has-own-property":334,"../internals/is-object":352}],325:[function(_dereq_,module,exports){
- var NATIVE_BIND = _dereq_('../internals/function-bind-native');
- var call = Function.prototype.call;
- module.exports = NATIVE_BIND ? call.bind(call) : function () {
- return call.apply(call, arguments);
- };
- },{"../internals/function-bind-native":323}],326:[function(_dereq_,module,exports){
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var hasOwn = _dereq_('../internals/has-own-property');
- var FunctionPrototype = Function.prototype;
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
- var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
- var EXISTS = hasOwn(FunctionPrototype, 'name');
- // additional protection from minified / mangled / dropped function names
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
- module.exports = {
- EXISTS: EXISTS,
- PROPER: PROPER,
- CONFIGURABLE: CONFIGURABLE
- };
- },{"../internals/descriptors":299,"../internals/has-own-property":334}],327:[function(_dereq_,module,exports){
- var NATIVE_BIND = _dereq_('../internals/function-bind-native');
- var FunctionPrototype = Function.prototype;
- var bind = FunctionPrototype.bind;
- var call = FunctionPrototype.call;
- var uncurryThis = NATIVE_BIND && bind.bind(call, call);
- module.exports = NATIVE_BIND ? function (fn) {
- return fn && uncurryThis(fn);
- } : function (fn) {
- return fn && function () {
- return call.apply(fn, arguments);
- };
- };
- },{"../internals/function-bind-native":323}],328:[function(_dereq_,module,exports){
- var path = _dereq_('../internals/path');
- var global = _dereq_('../internals/global');
- var isCallable = _dereq_('../internals/is-callable');
- var aFunction = function (variable) {
- return isCallable(variable) ? variable : undefined;
- };
- module.exports = function (namespace, method) {
- return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
- : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
- };
- },{"../internals/global":333,"../internals/is-callable":346,"../internals/path":390}],329:[function(_dereq_,module,exports){
- var classof = _dereq_('../internals/classof');
- var getMethod = _dereq_('../internals/get-method');
- var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
- var Iterators = _dereq_('../internals/iterators');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var ITERATOR = wellKnownSymbol('iterator');
- module.exports = function (it) {
- if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)
- || getMethod(it, '@@iterator')
- || Iterators[classof(it)];
- };
- },{"../internals/classof":281,"../internals/get-method":332,"../internals/is-null-or-undefined":351,"../internals/iterators":361,"../internals/well-known-symbol":429}],330:[function(_dereq_,module,exports){
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var anObject = _dereq_('../internals/an-object');
- var tryToString = _dereq_('../internals/try-to-string');
- var getIteratorMethod = _dereq_('../internals/get-iterator-method');
- var $TypeError = TypeError;
- module.exports = function (argument, usingIterator) {
- var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
- if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
- throw $TypeError(tryToString(argument) + ' is not iterable');
- };
- },{"../internals/a-callable":258,"../internals/an-object":263,"../internals/function-call":325,"../internals/get-iterator-method":329,"../internals/try-to-string":421}],331:[function(_dereq_,module,exports){
- var getIterator = _dereq_('../internals/get-iterator');
- module.exports = getIterator;
- },{"../internals/get-iterator":330}],332:[function(_dereq_,module,exports){
- var aCallable = _dereq_('../internals/a-callable');
- var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
- // `GetMethod` abstract operation
- // https://tc39.es/ecma262/#sec-getmethod
- module.exports = function (V, P) {
- var func = V[P];
- return isNullOrUndefined(func) ? undefined : aCallable(func);
- };
- },{"../internals/a-callable":258,"../internals/is-null-or-undefined":351}],333:[function(_dereq_,module,exports){
- (function (global){(function (){
- var check = function (it) {
- return it && it.Math == Math && it;
- };
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- module.exports =
- // eslint-disable-next-line es-x/no-global-this -- safe
- check(typeof globalThis == 'object' && globalThis) ||
- check(typeof window == 'object' && window) ||
- // eslint-disable-next-line no-restricted-globals -- safe
- check(typeof self == 'object' && self) ||
- check(typeof global == 'object' && global) ||
- // eslint-disable-next-line no-new-func -- fallback
- (function () { return this; })() || Function('return this')();
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{}],334:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var toObject = _dereq_('../internals/to-object');
- var hasOwnProperty = uncurryThis({}.hasOwnProperty);
- // `HasOwnProperty` abstract operation
- // https://tc39.es/ecma262/#sec-hasownproperty
- // eslint-disable-next-line es-x/no-object-hasown -- safe
- module.exports = Object.hasOwn || function hasOwn(it, key) {
- return hasOwnProperty(toObject(it), key);
- };
- },{"../internals/function-uncurry-this":327,"../internals/to-object":416}],335:[function(_dereq_,module,exports){
- module.exports = {};
- },{}],336:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- module.exports = function (a, b) {
- var console = global.console;
- if (console && console.error) {
- arguments.length == 1 ? console.error(a) : console.error(a, b);
- }
- };
- },{"../internals/global":333}],337:[function(_dereq_,module,exports){
- var getBuiltIn = _dereq_('../internals/get-built-in');
- module.exports = getBuiltIn('document', 'documentElement');
- },{"../internals/get-built-in":328}],338:[function(_dereq_,module,exports){
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var fails = _dereq_('../internals/fails');
- var createElement = _dereq_('../internals/document-create-element');
- // Thanks to IE8 for its funny defineProperty
- module.exports = !DESCRIPTORS && !fails(function () {
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
- return Object.defineProperty(createElement('div'), 'a', {
- get: function () { return 7; }
- }).a != 7;
- });
- },{"../internals/descriptors":299,"../internals/document-create-element":300,"../internals/fails":319}],339:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var fails = _dereq_('../internals/fails');
- var classof = _dereq_('../internals/classof-raw');
- var $Object = Object;
- var split = uncurryThis(''.split);
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
- module.exports = fails(function () {
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
- // eslint-disable-next-line no-prototype-builtins -- safe
- return !$Object('z').propertyIsEnumerable(0);
- }) ? function (it) {
- return classof(it) == 'String' ? split(it, '') : $Object(it);
- } : $Object;
- },{"../internals/classof-raw":280,"../internals/fails":319,"../internals/function-uncurry-this":327}],340:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var isCallable = _dereq_('../internals/is-callable');
- var store = _dereq_('../internals/shared-store');
- var functionToString = uncurryThis(Function.toString);
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
- if (!isCallable(store.inspectSource)) {
- store.inspectSource = function (it) {
- return functionToString(it);
- };
- }
- module.exports = store.inspectSource;
- },{"../internals/function-uncurry-this":327,"../internals/is-callable":346,"../internals/shared-store":403}],341:[function(_dereq_,module,exports){
- var isObject = _dereq_('../internals/is-object');
- var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
- // `InstallErrorCause` abstract operation
- // https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
- module.exports = function (O, options) {
- if (isObject(options) && 'cause' in options) {
- createNonEnumerableProperty(O, 'cause', options.cause);
- }
- };
- },{"../internals/create-non-enumerable-property":292,"../internals/is-object":352}],342:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var hiddenKeys = _dereq_('../internals/hidden-keys');
- var isObject = _dereq_('../internals/is-object');
- var hasOwn = _dereq_('../internals/has-own-property');
- var defineProperty = _dereq_('../internals/object-define-property').f;
- var getOwnPropertyNamesModule = _dereq_('../internals/object-get-own-property-names');
- var getOwnPropertyNamesExternalModule = _dereq_('../internals/object-get-own-property-names-external');
- var isExtensible = _dereq_('../internals/object-is-extensible');
- var uid = _dereq_('../internals/uid');
- var FREEZING = _dereq_('../internals/freezing');
- var REQUIRED = false;
- var METADATA = uid('meta');
- var id = 0;
- var setMetadata = function (it) {
- defineProperty(it, METADATA, { value: {
- objectID: 'O' + id++, // object ID
- weakData: {} // weak collections IDs
- } });
- };
- var fastKey = function (it, create) {
- // return a primitive with prefix
- if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
- if (!hasOwn(it, METADATA)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return 'F';
- // not necessary to add metadata
- if (!create) return 'E';
- // add missing metadata
- setMetadata(it);
- // return object ID
- } return it[METADATA].objectID;
- };
- var getWeakData = function (it, create) {
- if (!hasOwn(it, METADATA)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return true;
- // not necessary to add metadata
- if (!create) return false;
- // add missing metadata
- setMetadata(it);
- // return the store of weak collections IDs
- } return it[METADATA].weakData;
- };
- // add metadata on freeze-family methods calling
- var onFreeze = function (it) {
- if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
- return it;
- };
- var enable = function () {
- meta.enable = function () { /* empty */ };
- REQUIRED = true;
- var getOwnPropertyNames = getOwnPropertyNamesModule.f;
- var splice = uncurryThis([].splice);
- var test = {};
- test[METADATA] = 1;
- // prevent exposing of metadata key
- if (getOwnPropertyNames(test).length) {
- getOwnPropertyNamesModule.f = function (it) {
- var result = getOwnPropertyNames(it);
- for (var i = 0, length = result.length; i < length; i++) {
- if (result[i] === METADATA) {
- splice(result, i, 1);
- break;
- }
- } return result;
- };
- $({ target: 'Object', stat: true, forced: true }, {
- getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
- });
- }
- };
- var meta = module.exports = {
- enable: enable,
- fastKey: fastKey,
- getWeakData: getWeakData,
- onFreeze: onFreeze
- };
- hiddenKeys[METADATA] = true;
- },{"../internals/export":318,"../internals/freezing":320,"../internals/function-uncurry-this":327,"../internals/has-own-property":334,"../internals/hidden-keys":335,"../internals/is-object":352,"../internals/object-define-property":374,"../internals/object-get-own-property-names":377,"../internals/object-get-own-property-names-external":376,"../internals/object-is-extensible":380,"../internals/uid":422}],343:[function(_dereq_,module,exports){
- var NATIVE_WEAK_MAP = _dereq_('../internals/weak-map-basic-detection');
- var global = _dereq_('../internals/global');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var isObject = _dereq_('../internals/is-object');
- var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
- var hasOwn = _dereq_('../internals/has-own-property');
- var shared = _dereq_('../internals/shared-store');
- var sharedKey = _dereq_('../internals/shared-key');
- var hiddenKeys = _dereq_('../internals/hidden-keys');
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
- var TypeError = global.TypeError;
- var WeakMap = global.WeakMap;
- var set, get, has;
- var enforce = function (it) {
- return has(it) ? get(it) : set(it, {});
- };
- var getterFor = function (TYPE) {
- return function (it) {
- var state;
- if (!isObject(it) || (state = get(it)).type !== TYPE) {
- throw TypeError('Incompatible receiver, ' + TYPE + ' required');
- } return state;
- };
- };
- if (NATIVE_WEAK_MAP || shared.state) {
- var store = shared.state || (shared.state = new WeakMap());
- var wmget = uncurryThis(store.get);
- var wmhas = uncurryThis(store.has);
- var wmset = uncurryThis(store.set);
- set = function (it, metadata) {
- if (wmhas(store, it)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
- metadata.facade = it;
- wmset(store, it, metadata);
- return metadata;
- };
- get = function (it) {
- return wmget(store, it) || {};
- };
- has = function (it) {
- return wmhas(store, it);
- };
- } else {
- var STATE = sharedKey('state');
- hiddenKeys[STATE] = true;
- set = function (it, metadata) {
- if (hasOwn(it, STATE)) throw TypeError(OBJECT_ALREADY_INITIALIZED);
- metadata.facade = it;
- createNonEnumerableProperty(it, STATE, metadata);
- return metadata;
- };
- get = function (it) {
- return hasOwn(it, STATE) ? it[STATE] : {};
- };
- has = function (it) {
- return hasOwn(it, STATE);
- };
- }
- module.exports = {
- set: set,
- get: get,
- has: has,
- enforce: enforce,
- getterFor: getterFor
- };
- },{"../internals/create-non-enumerable-property":292,"../internals/function-uncurry-this":327,"../internals/global":333,"../internals/has-own-property":334,"../internals/hidden-keys":335,"../internals/is-object":352,"../internals/shared-key":402,"../internals/shared-store":403,"../internals/weak-map-basic-detection":426}],344:[function(_dereq_,module,exports){
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var Iterators = _dereq_('../internals/iterators');
- var ITERATOR = wellKnownSymbol('iterator');
- var ArrayPrototype = Array.prototype;
- // check on default Array iterator
- module.exports = function (it) {
- return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
- };
- },{"../internals/iterators":361,"../internals/well-known-symbol":429}],345:[function(_dereq_,module,exports){
- var classof = _dereq_('../internals/classof-raw');
- // `IsArray` abstract operation
- // https://tc39.es/ecma262/#sec-isarray
- // eslint-disable-next-line es-x/no-array-isarray -- safe
- module.exports = Array.isArray || function isArray(argument) {
- return classof(argument) == 'Array';
- };
- },{"../internals/classof-raw":280}],346:[function(_dereq_,module,exports){
- // `IsCallable` abstract operation
- // https://tc39.es/ecma262/#sec-iscallable
- module.exports = function (argument) {
- return typeof argument == 'function';
- };
- },{}],347:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var fails = _dereq_('../internals/fails');
- var isCallable = _dereq_('../internals/is-callable');
- var classof = _dereq_('../internals/classof');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var inspectSource = _dereq_('../internals/inspect-source');
- var noop = function () { /* empty */ };
- var empty = [];
- var construct = getBuiltIn('Reflect', 'construct');
- var constructorRegExp = /^\s*(?:class|function)\b/;
- var exec = uncurryThis(constructorRegExp.exec);
- var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
- var isConstructorModern = function isConstructor(argument) {
- if (!isCallable(argument)) return false;
- try {
- construct(noop, empty, argument);
- return true;
- } catch (error) {
- return false;
- }
- };
- var isConstructorLegacy = function isConstructor(argument) {
- if (!isCallable(argument)) return false;
- switch (classof(argument)) {
- case 'AsyncFunction':
- case 'GeneratorFunction':
- case 'AsyncGeneratorFunction': return false;
- }
- try {
- // we can't check .prototype since constructors produced by .bind haven't it
- // `Function#toString` throws on some built-it function in some legacy engines
- // (for example, `DOMQuad` and similar in FF41-)
- return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
- } catch (error) {
- return true;
- }
- };
- isConstructorLegacy.sham = true;
- // `IsConstructor` abstract operation
- // https://tc39.es/ecma262/#sec-isconstructor
- module.exports = !construct || fails(function () {
- var called;
- return isConstructorModern(isConstructorModern.call)
- || !isConstructorModern(Object)
- || !isConstructorModern(function () { called = true; })
- || called;
- }) ? isConstructorLegacy : isConstructorModern;
- },{"../internals/classof":281,"../internals/fails":319,"../internals/function-uncurry-this":327,"../internals/get-built-in":328,"../internals/inspect-source":340,"../internals/is-callable":346}],348:[function(_dereq_,module,exports){
- var hasOwn = _dereq_('../internals/has-own-property');
- module.exports = function (descriptor) {
- return descriptor !== undefined && (hasOwn(descriptor, 'value') || hasOwn(descriptor, 'writable'));
- };
- },{"../internals/has-own-property":334}],349:[function(_dereq_,module,exports){
- var fails = _dereq_('../internals/fails');
- var isCallable = _dereq_('../internals/is-callable');
- var replacement = /#|\.prototype\./;
- var isForced = function (feature, detection) {
- var value = data[normalize(feature)];
- return value == POLYFILL ? true
- : value == NATIVE ? false
- : isCallable(detection) ? fails(detection)
- : !!detection;
- };
- var normalize = isForced.normalize = function (string) {
- return String(string).replace(replacement, '.').toLowerCase();
- };
- var data = isForced.data = {};
- var NATIVE = isForced.NATIVE = 'N';
- var POLYFILL = isForced.POLYFILL = 'P';
- module.exports = isForced;
- },{"../internals/fails":319,"../internals/is-callable":346}],350:[function(_dereq_,module,exports){
- var isObject = _dereq_('../internals/is-object');
- var floor = Math.floor;
- // `IsIntegralNumber` abstract operation
- // https://tc39.es/ecma262/#sec-isintegralnumber
- // eslint-disable-next-line es-x/no-number-isinteger -- safe
- module.exports = Number.isInteger || function isInteger(it) {
- return !isObject(it) && isFinite(it) && floor(it) === it;
- };
- },{"../internals/is-object":352}],351:[function(_dereq_,module,exports){
- // we can't use just `it == null` since of `document.all` special case
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
- module.exports = function (it) {
- return it === null || it === undefined;
- };
- },{}],352:[function(_dereq_,module,exports){
- var isCallable = _dereq_('../internals/is-callable');
- var documentAll = typeof document == 'object' && document.all;
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
- var SPECIAL_DOCUMENT_ALL = typeof documentAll == 'undefined' && documentAll !== undefined;
- module.exports = SPECIAL_DOCUMENT_ALL ? function (it) {
- return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;
- } : function (it) {
- return typeof it == 'object' ? it !== null : isCallable(it);
- };
- },{"../internals/is-callable":346}],353:[function(_dereq_,module,exports){
- module.exports = true;
- },{}],354:[function(_dereq_,module,exports){
- var isObject = _dereq_('../internals/is-object');
- var classof = _dereq_('../internals/classof-raw');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var MATCH = wellKnownSymbol('match');
- // `IsRegExp` abstract operation
- // https://tc39.es/ecma262/#sec-isregexp
- module.exports = function (it) {
- var isRegExp;
- return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
- };
- },{"../internals/classof-raw":280,"../internals/is-object":352,"../internals/well-known-symbol":429}],355:[function(_dereq_,module,exports){
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var isCallable = _dereq_('../internals/is-callable');
- var isPrototypeOf = _dereq_('../internals/object-is-prototype-of');
- var USE_SYMBOL_AS_UID = _dereq_('../internals/use-symbol-as-uid');
- var $Object = Object;
- module.exports = USE_SYMBOL_AS_UID ? function (it) {
- return typeof it == 'symbol';
- } : function (it) {
- var $Symbol = getBuiltIn('Symbol');
- return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
- };
- },{"../internals/get-built-in":328,"../internals/is-callable":346,"../internals/object-is-prototype-of":381,"../internals/use-symbol-as-uid":423}],356:[function(_dereq_,module,exports){
- var bind = _dereq_('../internals/function-bind-context');
- var call = _dereq_('../internals/function-call');
- var anObject = _dereq_('../internals/an-object');
- var tryToString = _dereq_('../internals/try-to-string');
- var isArrayIteratorMethod = _dereq_('../internals/is-array-iterator-method');
- var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
- var isPrototypeOf = _dereq_('../internals/object-is-prototype-of');
- var getIterator = _dereq_('../internals/get-iterator');
- var getIteratorMethod = _dereq_('../internals/get-iterator-method');
- var iteratorClose = _dereq_('../internals/iterator-close');
- var $TypeError = TypeError;
- var Result = function (stopped, result) {
- this.stopped = stopped;
- this.result = result;
- };
- var ResultPrototype = Result.prototype;
- module.exports = function (iterable, unboundFunction, options) {
- var that = options && options.that;
- var AS_ENTRIES = !!(options && options.AS_ENTRIES);
- var IS_RECORD = !!(options && options.IS_RECORD);
- var IS_ITERATOR = !!(options && options.IS_ITERATOR);
- var INTERRUPTED = !!(options && options.INTERRUPTED);
- var fn = bind(unboundFunction, that);
- var iterator, iterFn, index, length, result, next, step;
- var stop = function (condition) {
- if (iterator) iteratorClose(iterator, 'normal', condition);
- return new Result(true, condition);
- };
- var callFn = function (value) {
- if (AS_ENTRIES) {
- anObject(value);
- return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
- } return INTERRUPTED ? fn(value, stop) : fn(value);
- };
- if (IS_RECORD) {
- iterator = iterable.iterator;
- } else if (IS_ITERATOR) {
- iterator = iterable;
- } else {
- iterFn = getIteratorMethod(iterable);
- if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
- // optimisation for array iterators
- if (isArrayIteratorMethod(iterFn)) {
- for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
- result = callFn(iterable[index]);
- if (result && isPrototypeOf(ResultPrototype, result)) return result;
- } return new Result(false);
- }
- iterator = getIterator(iterable, iterFn);
- }
- next = IS_RECORD ? iterable.next : iterator.next;
- while (!(step = call(next, iterator)).done) {
- try {
- result = callFn(step.value);
- } catch (error) {
- iteratorClose(iterator, 'throw', error);
- }
- if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
- } return new Result(false);
- };
- },{"../internals/an-object":263,"../internals/function-bind-context":322,"../internals/function-call":325,"../internals/get-iterator":330,"../internals/get-iterator-method":329,"../internals/is-array-iterator-method":344,"../internals/iterator-close":357,"../internals/length-of-array-like":362,"../internals/object-is-prototype-of":381,"../internals/try-to-string":421}],357:[function(_dereq_,module,exports){
- var call = _dereq_('../internals/function-call');
- var anObject = _dereq_('../internals/an-object');
- var getMethod = _dereq_('../internals/get-method');
- module.exports = function (iterator, kind, value) {
- var innerResult, innerError;
- anObject(iterator);
- try {
- innerResult = getMethod(iterator, 'return');
- if (!innerResult) {
- if (kind === 'throw') throw value;
- return value;
- }
- innerResult = call(innerResult, iterator);
- } catch (error) {
- innerError = true;
- innerResult = error;
- }
- if (kind === 'throw') throw value;
- if (innerError) throw innerResult;
- anObject(innerResult);
- return value;
- };
- },{"../internals/an-object":263,"../internals/function-call":325,"../internals/get-method":332}],358:[function(_dereq_,module,exports){
- 'use strict';
- var IteratorPrototype = _dereq_('../internals/iterators-core').IteratorPrototype;
- var create = _dereq_('../internals/object-create');
- var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
- var setToStringTag = _dereq_('../internals/set-to-string-tag');
- var Iterators = _dereq_('../internals/iterators');
- var returnThis = function () { return this; };
- module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
- var TO_STRING_TAG = NAME + ' Iterator';
- IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
- setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
- Iterators[TO_STRING_TAG] = returnThis;
- return IteratorConstructor;
- };
- },{"../internals/create-property-descriptor":293,"../internals/iterators":361,"../internals/iterators-core":360,"../internals/object-create":372,"../internals/set-to-string-tag":401}],359:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var call = _dereq_('../internals/function-call');
- var IS_PURE = _dereq_('../internals/is-pure');
- var FunctionName = _dereq_('../internals/function-name');
- var isCallable = _dereq_('../internals/is-callable');
- var createIteratorConstructor = _dereq_('../internals/iterator-create-constructor');
- var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
- var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
- var setToStringTag = _dereq_('../internals/set-to-string-tag');
- var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
- var defineBuiltIn = _dereq_('../internals/define-built-in');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var Iterators = _dereq_('../internals/iterators');
- var IteratorsCore = _dereq_('../internals/iterators-core');
- var PROPER_FUNCTION_NAME = FunctionName.PROPER;
- var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
- var IteratorPrototype = IteratorsCore.IteratorPrototype;
- var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
- var ITERATOR = wellKnownSymbol('iterator');
- var KEYS = 'keys';
- var VALUES = 'values';
- var ENTRIES = 'entries';
- var returnThis = function () { return this; };
- module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
- createIteratorConstructor(IteratorConstructor, NAME, next);
- var getIterationMethod = function (KIND) {
- if (KIND === DEFAULT && defaultIterator) return defaultIterator;
- if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
- switch (KIND) {
- case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
- case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
- case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
- } return function () { return new IteratorConstructor(this); };
- };
- var TO_STRING_TAG = NAME + ' Iterator';
- var INCORRECT_VALUES_NAME = false;
- var IterablePrototype = Iterable.prototype;
- var nativeIterator = IterablePrototype[ITERATOR]
- || IterablePrototype['@@iterator']
- || DEFAULT && IterablePrototype[DEFAULT];
- var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
- var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
- var CurrentIteratorPrototype, methods, KEY;
- // fix native
- if (anyNativeIterator) {
- CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
- if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
- if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
- if (setPrototypeOf) {
- setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
- } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
- defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
- }
- }
- // Set @@toStringTag to native iterators
- setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
- if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
- }
- }
- // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
- if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
- if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
- createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
- } else {
- INCORRECT_VALUES_NAME = true;
- defaultIterator = function values() { return call(nativeIterator, this); };
- }
- }
- // export additional methods
- if (DEFAULT) {
- methods = {
- values: getIterationMethod(VALUES),
- keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
- entries: getIterationMethod(ENTRIES)
- };
- if (FORCED) for (KEY in methods) {
- if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
- defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
- }
- } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
- }
- // define iterator
- if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
- defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
- }
- Iterators[NAME] = defaultIterator;
- return methods;
- };
- },{"../internals/create-non-enumerable-property":292,"../internals/define-built-in":295,"../internals/export":318,"../internals/function-call":325,"../internals/function-name":326,"../internals/is-callable":346,"../internals/is-pure":353,"../internals/iterator-create-constructor":358,"../internals/iterators":361,"../internals/iterators-core":360,"../internals/object-get-prototype-of":379,"../internals/object-set-prototype-of":385,"../internals/set-to-string-tag":401,"../internals/well-known-symbol":429}],360:[function(_dereq_,module,exports){
- 'use strict';
- var fails = _dereq_('../internals/fails');
- var isCallable = _dereq_('../internals/is-callable');
- var isObject = _dereq_('../internals/is-object');
- var create = _dereq_('../internals/object-create');
- var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
- var defineBuiltIn = _dereq_('../internals/define-built-in');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var IS_PURE = _dereq_('../internals/is-pure');
- var ITERATOR = wellKnownSymbol('iterator');
- var BUGGY_SAFARI_ITERATORS = false;
- // `%IteratorPrototype%` object
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
- var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
- /* eslint-disable es-x/no-array-prototype-keys -- safe */
- if ([].keys) {
- arrayIterator = [].keys();
- // Safari 8 has buggy iterators w/o `next`
- if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
- else {
- PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
- if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
- }
- }
- var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {
- var test = {};
- // FF44- legacy iterators case
- return IteratorPrototype[ITERATOR].call(test) !== test;
- });
- if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
- else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
- // `%IteratorPrototype%[@@iterator]()` method
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
- if (!isCallable(IteratorPrototype[ITERATOR])) {
- defineBuiltIn(IteratorPrototype, ITERATOR, function () {
- return this;
- });
- }
- module.exports = {
- IteratorPrototype: IteratorPrototype,
- BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
- };
- },{"../internals/define-built-in":295,"../internals/fails":319,"../internals/is-callable":346,"../internals/is-object":352,"../internals/is-pure":353,"../internals/object-create":372,"../internals/object-get-prototype-of":379,"../internals/well-known-symbol":429}],361:[function(_dereq_,module,exports){
- arguments[4][335][0].apply(exports,arguments)
- },{"dup":335}],362:[function(_dereq_,module,exports){
- var toLength = _dereq_('../internals/to-length');
- // `LengthOfArrayLike` abstract operation
- // https://tc39.es/ecma262/#sec-lengthofarraylike
- module.exports = function (obj) {
- return toLength(obj.length);
- };
- },{"../internals/to-length":415}],363:[function(_dereq_,module,exports){
- 'use strict';
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var anObject = _dereq_('../internals/an-object');
- // `Map.prototype.emplace` method
- // https://github.com/thumbsupep/proposal-upsert
- module.exports = function emplace(key, handler) {
- var map = anObject(this);
- var get = aCallable(map.get);
- var has = aCallable(map.has);
- var set = aCallable(map.set);
- var value, inserted;
- if (call(has, map, key)) {
- value = call(get, map, key);
- if ('update' in handler) {
- value = handler.update(value, key, map);
- call(set, map, key, value);
- } return value;
- }
- inserted = handler.insert(key, map);
- call(set, map, key, inserted);
- return inserted;
- };
- },{"../internals/a-callable":258,"../internals/an-object":263,"../internals/function-call":325}],364:[function(_dereq_,module,exports){
- 'use strict';
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var isCallable = _dereq_('../internals/is-callable');
- var anObject = _dereq_('../internals/an-object');
- var $TypeError = TypeError;
- // `Map.prototype.upsert` method
- // https://github.com/thumbsupep/proposal-upsert
- module.exports = function upsert(key, updateFn /* , insertFn */) {
- var map = anObject(this);
- var get = aCallable(map.get);
- var has = aCallable(map.has);
- var set = aCallable(map.set);
- var insertFn = arguments.length > 2 ? arguments[2] : undefined;
- var value;
- if (!isCallable(updateFn) && !isCallable(insertFn)) {
- throw $TypeError('At least one callback required');
- }
- if (call(has, map, key)) {
- value = call(get, map, key);
- if (isCallable(updateFn)) {
- value = updateFn(value);
- call(set, map, key, value);
- }
- } else if (isCallable(insertFn)) {
- value = insertFn();
- call(set, map, key, value);
- } return value;
- };
- },{"../internals/a-callable":258,"../internals/an-object":263,"../internals/function-call":325,"../internals/is-callable":346}],365:[function(_dereq_,module,exports){
- var ceil = Math.ceil;
- var floor = Math.floor;
- // `Math.trunc` method
- // https://tc39.es/ecma262/#sec-math.trunc
- // eslint-disable-next-line es-x/no-math-trunc -- safe
- module.exports = Math.trunc || function trunc(x) {
- var n = +x;
- return (n > 0 ? floor : ceil)(n);
- };
- },{}],366:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- var bind = _dereq_('../internals/function-bind-context');
- var getOwnPropertyDescriptor = _dereq_('../internals/object-get-own-property-descriptor').f;
- var macrotask = _dereq_('../internals/task').set;
- var IS_IOS = _dereq_('../internals/engine-is-ios');
- var IS_IOS_PEBBLE = _dereq_('../internals/engine-is-ios-pebble');
- var IS_WEBOS_WEBKIT = _dereq_('../internals/engine-is-webos-webkit');
- var IS_NODE = _dereq_('../internals/engine-is-node');
- var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
- var document = global.document;
- var process = global.process;
- var Promise = global.Promise;
- // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
- var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
- var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
- var flush, head, last, notify, toggle, node, promise, then;
- // modern engines have queueMicrotask method
- if (!queueMicrotask) {
- flush = function () {
- var parent, fn;
- if (IS_NODE && (parent = process.domain)) parent.exit();
- while (head) {
- fn = head.fn;
- head = head.next;
- try {
- fn();
- } catch (error) {
- if (head) notify();
- else last = undefined;
- throw error;
- }
- } last = undefined;
- if (parent) parent.enter();
- };
- // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
- // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
- if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
- toggle = true;
- node = document.createTextNode('');
- new MutationObserver(flush).observe(node, { characterData: true });
- notify = function () {
- node.data = toggle = !toggle;
- };
- // environments with maybe non-completely correct, but existent Promise
- } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
- // Promise.resolve without an argument throws an error in LG WebOS 2
- promise = Promise.resolve(undefined);
- // workaround of WebKit ~ iOS Safari 10.1 bug
- promise.constructor = Promise;
- then = bind(promise.then, promise);
- notify = function () {
- then(flush);
- };
- // Node.js without promises
- } else if (IS_NODE) {
- notify = function () {
- process.nextTick(flush);
- };
- // for other environments - macrotask based on:
- // - setImmediate
- // - MessageChannel
- // - window.postMessage
- // - onreadystatechange
- // - setTimeout
- } else {
- // strange IE + webpack dev server bug - use .bind(global)
- macrotask = bind(macrotask, global);
- notify = function () {
- macrotask(flush);
- };
- }
- }
- module.exports = queueMicrotask || function (fn) {
- var task = { fn: fn, next: undefined };
- if (last) last.next = task;
- if (!head) {
- head = task;
- notify();
- } last = task;
- };
- },{"../internals/engine-is-ios":308,"../internals/engine-is-ios-pebble":307,"../internals/engine-is-node":309,"../internals/engine-is-webos-webkit":310,"../internals/function-bind-context":322,"../internals/global":333,"../internals/object-get-own-property-descriptor":375,"../internals/task":411}],367:[function(_dereq_,module,exports){
- 'use strict';
- var aCallable = _dereq_('../internals/a-callable');
- var $TypeError = TypeError;
- var PromiseCapability = function (C) {
- var resolve, reject;
- this.promise = new C(function ($$resolve, $$reject) {
- if (resolve !== undefined || reject !== undefined) throw $TypeError('Bad Promise constructor');
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = aCallable(resolve);
- this.reject = aCallable(reject);
- };
- // `NewPromiseCapability` abstract operation
- // https://tc39.es/ecma262/#sec-newpromisecapability
- module.exports.f = function (C) {
- return new PromiseCapability(C);
- };
- },{"../internals/a-callable":258}],368:[function(_dereq_,module,exports){
- var toString = _dereq_('../internals/to-string');
- module.exports = function (argument, $default) {
- return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
- };
- },{"../internals/to-string":420}],369:[function(_dereq_,module,exports){
- var isRegExp = _dereq_('../internals/is-regexp');
- var $TypeError = TypeError;
- module.exports = function (it) {
- if (isRegExp(it)) {
- throw $TypeError("The method doesn't accept regular expressions");
- } return it;
- };
- },{"../internals/is-regexp":354}],370:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- var fails = _dereq_('../internals/fails');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var toString = _dereq_('../internals/to-string');
- var trim = _dereq_('../internals/string-trim').trim;
- var whitespaces = _dereq_('../internals/whitespaces');
- var $parseInt = global.parseInt;
- var Symbol = global.Symbol;
- var ITERATOR = Symbol && Symbol.iterator;
- var hex = /^[+-]?0x/i;
- var exec = uncurryThis(hex.exec);
- var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22
- // MS Edge 18- broken with boxed symbols
- || (ITERATOR && !fails(function () { $parseInt(Object(ITERATOR)); }));
- // `parseInt` method
- // https://tc39.es/ecma262/#sec-parseint-string-radix
- module.exports = FORCED ? function parseInt(string, radix) {
- var S = trim(toString(string));
- return $parseInt(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
- } : $parseInt;
- },{"../internals/fails":319,"../internals/function-uncurry-this":327,"../internals/global":333,"../internals/string-trim":407,"../internals/to-string":420,"../internals/whitespaces":430}],371:[function(_dereq_,module,exports){
- 'use strict';
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var call = _dereq_('../internals/function-call');
- var fails = _dereq_('../internals/fails');
- var objectKeys = _dereq_('../internals/object-keys');
- var getOwnPropertySymbolsModule = _dereq_('../internals/object-get-own-property-symbols');
- var propertyIsEnumerableModule = _dereq_('../internals/object-property-is-enumerable');
- var toObject = _dereq_('../internals/to-object');
- var IndexedObject = _dereq_('../internals/indexed-object');
- // eslint-disable-next-line es-x/no-object-assign -- safe
- var $assign = Object.assign;
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
- var defineProperty = Object.defineProperty;
- var concat = uncurryThis([].concat);
- // `Object.assign` method
- // https://tc39.es/ecma262/#sec-object.assign
- module.exports = !$assign || fails(function () {
- // should have correct order of operations (Edge bug)
- if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
- enumerable: true,
- get: function () {
- defineProperty(this, 'b', {
- value: 3,
- enumerable: false
- });
- }
- }), { b: 2 })).b !== 1) return true;
- // should work with symbols and should have deterministic property order (V8 bug)
- var A = {};
- var B = {};
- // eslint-disable-next-line es-x/no-symbol -- safe
- var symbol = Symbol();
- var alphabet = 'abcdefghijklmnopqrst';
- A[symbol] = 7;
- alphabet.split('').forEach(function (chr) { B[chr] = chr; });
- return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
- }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
- var T = toObject(target);
- var argumentsLength = arguments.length;
- var index = 1;
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
- var propertyIsEnumerable = propertyIsEnumerableModule.f;
- while (argumentsLength > index) {
- var S = IndexedObject(arguments[index++]);
- var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
- var length = keys.length;
- var j = 0;
- var key;
- while (length > j) {
- key = keys[j++];
- if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
- }
- } return T;
- } : $assign;
- },{"../internals/descriptors":299,"../internals/fails":319,"../internals/function-call":325,"../internals/function-uncurry-this":327,"../internals/indexed-object":339,"../internals/object-get-own-property-symbols":378,"../internals/object-keys":383,"../internals/object-property-is-enumerable":384,"../internals/to-object":416}],372:[function(_dereq_,module,exports){
- /* global ActiveXObject -- old IE, WSH */
- var anObject = _dereq_('../internals/an-object');
- var definePropertiesModule = _dereq_('../internals/object-define-properties');
- var enumBugKeys = _dereq_('../internals/enum-bug-keys');
- var hiddenKeys = _dereq_('../internals/hidden-keys');
- var html = _dereq_('../internals/html');
- var documentCreateElement = _dereq_('../internals/document-create-element');
- var sharedKey = _dereq_('../internals/shared-key');
- var GT = '>';
- var LT = '<';
- var PROTOTYPE = 'prototype';
- var SCRIPT = 'script';
- var IE_PROTO = sharedKey('IE_PROTO');
- var EmptyConstructor = function () { /* empty */ };
- var scriptTag = function (content) {
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
- };
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
- var NullProtoObjectViaActiveX = function (activeXDocument) {
- activeXDocument.write(scriptTag(''));
- activeXDocument.close();
- var temp = activeXDocument.parentWindow.Object;
- activeXDocument = null; // avoid memory leak
- return temp;
- };
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
- var NullProtoObjectViaIFrame = function () {
- // Thrash, waste and sodomy: IE GC bug
- var iframe = documentCreateElement('iframe');
- var JS = 'java' + SCRIPT + ':';
- var iframeDocument;
- iframe.style.display = 'none';
- html.appendChild(iframe);
- // https://github.com/zloirock/core-js/issues/475
- iframe.src = String(JS);
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(scriptTag('document.F=Object'));
- iframeDocument.close();
- return iframeDocument.F;
- };
- // Check for document.domain and active x support
- // No need to use active x approach when document.domain is not set
- // see https://github.com/es-shims/es5-shim/issues/150
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
- // avoid IE GC bug
- var activeXDocument;
- var NullProtoObject = function () {
- try {
- activeXDocument = new ActiveXObject('htmlfile');
- } catch (error) { /* ignore */ }
- NullProtoObject = typeof document != 'undefined'
- ? document.domain && activeXDocument
- ? NullProtoObjectViaActiveX(activeXDocument) // old IE
- : NullProtoObjectViaIFrame()
- : NullProtoObjectViaActiveX(activeXDocument); // WSH
- var length = enumBugKeys.length;
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
- return NullProtoObject();
- };
- hiddenKeys[IE_PROTO] = true;
- // `Object.create` method
- // https://tc39.es/ecma262/#sec-object.create
- // eslint-disable-next-line es-x/no-object-create -- safe
- module.exports = Object.create || function create(O, Properties) {
- var result;
- if (O !== null) {
- EmptyConstructor[PROTOTYPE] = anObject(O);
- result = new EmptyConstructor();
- EmptyConstructor[PROTOTYPE] = null;
- // add "__proto__" for Object.getPrototypeOf polyfill
- result[IE_PROTO] = O;
- } else result = NullProtoObject();
- return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
- };
- },{"../internals/an-object":263,"../internals/document-create-element":300,"../internals/enum-bug-keys":315,"../internals/hidden-keys":335,"../internals/html":337,"../internals/object-define-properties":373,"../internals/shared-key":402}],373:[function(_dereq_,module,exports){
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var V8_PROTOTYPE_DEFINE_BUG = _dereq_('../internals/v8-prototype-define-bug');
- var definePropertyModule = _dereq_('../internals/object-define-property');
- var anObject = _dereq_('../internals/an-object');
- var toIndexedObject = _dereq_('../internals/to-indexed-object');
- var objectKeys = _dereq_('../internals/object-keys');
- // `Object.defineProperties` method
- // https://tc39.es/ecma262/#sec-object.defineproperties
- // eslint-disable-next-line es-x/no-object-defineproperties -- safe
- exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
- anObject(O);
- var props = toIndexedObject(Properties);
- var keys = objectKeys(Properties);
- var length = keys.length;
- var index = 0;
- var key;
- while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
- return O;
- };
- },{"../internals/an-object":263,"../internals/descriptors":299,"../internals/object-define-property":374,"../internals/object-keys":383,"../internals/to-indexed-object":413,"../internals/v8-prototype-define-bug":424}],374:[function(_dereq_,module,exports){
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var IE8_DOM_DEFINE = _dereq_('../internals/ie8-dom-define');
- var V8_PROTOTYPE_DEFINE_BUG = _dereq_('../internals/v8-prototype-define-bug');
- var anObject = _dereq_('../internals/an-object');
- var toPropertyKey = _dereq_('../internals/to-property-key');
- var $TypeError = TypeError;
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
- var $defineProperty = Object.defineProperty;
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- var ENUMERABLE = 'enumerable';
- var CONFIGURABLE = 'configurable';
- var WRITABLE = 'writable';
- // `Object.defineProperty` method
- // https://tc39.es/ecma262/#sec-object.defineproperty
- exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPropertyKey(P);
- anObject(Attributes);
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
- var current = $getOwnPropertyDescriptor(O, P);
- if (current && current[WRITABLE]) {
- O[P] = Attributes.value;
- Attributes = {
- configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
- writable: false
- };
- }
- } return $defineProperty(O, P, Attributes);
- } : $defineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPropertyKey(P);
- anObject(Attributes);
- if (IE8_DOM_DEFINE) try {
- return $defineProperty(O, P, Attributes);
- } catch (error) { /* empty */ }
- if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
- };
- },{"../internals/an-object":263,"../internals/descriptors":299,"../internals/ie8-dom-define":338,"../internals/to-property-key":418,"../internals/v8-prototype-define-bug":424}],375:[function(_dereq_,module,exports){
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var call = _dereq_('../internals/function-call');
- var propertyIsEnumerableModule = _dereq_('../internals/object-property-is-enumerable');
- var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
- var toIndexedObject = _dereq_('../internals/to-indexed-object');
- var toPropertyKey = _dereq_('../internals/to-property-key');
- var hasOwn = _dereq_('../internals/has-own-property');
- var IE8_DOM_DEFINE = _dereq_('../internals/ie8-dom-define');
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
- exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
- O = toIndexedObject(O);
- P = toPropertyKey(P);
- if (IE8_DOM_DEFINE) try {
- return $getOwnPropertyDescriptor(O, P);
- } catch (error) { /* empty */ }
- if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
- };
- },{"../internals/create-property-descriptor":293,"../internals/descriptors":299,"../internals/function-call":325,"../internals/has-own-property":334,"../internals/ie8-dom-define":338,"../internals/object-property-is-enumerable":384,"../internals/to-indexed-object":413,"../internals/to-property-key":418}],376:[function(_dereq_,module,exports){
- /* eslint-disable es-x/no-object-getownpropertynames -- safe */
- var classof = _dereq_('../internals/classof-raw');
- var toIndexedObject = _dereq_('../internals/to-indexed-object');
- var $getOwnPropertyNames = _dereq_('../internals/object-get-own-property-names').f;
- var arraySlice = _dereq_('../internals/array-slice-simple');
- var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
- ? Object.getOwnPropertyNames(window) : [];
- var getWindowNames = function (it) {
- try {
- return $getOwnPropertyNames(it);
- } catch (error) {
- return arraySlice(windowNames);
- }
- };
- // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
- module.exports.f = function getOwnPropertyNames(it) {
- return windowNames && classof(it) == 'Window'
- ? getWindowNames(it)
- : $getOwnPropertyNames(toIndexedObject(it));
- };
- },{"../internals/array-slice-simple":273,"../internals/classof-raw":280,"../internals/object-get-own-property-names":377,"../internals/to-indexed-object":413}],377:[function(_dereq_,module,exports){
- var internalObjectKeys = _dereq_('../internals/object-keys-internal');
- var enumBugKeys = _dereq_('../internals/enum-bug-keys');
- var hiddenKeys = enumBugKeys.concat('length', 'prototype');
- // `Object.getOwnPropertyNames` method
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
- // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
- exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
- return internalObjectKeys(O, hiddenKeys);
- };
- },{"../internals/enum-bug-keys":315,"../internals/object-keys-internal":382}],378:[function(_dereq_,module,exports){
- // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
- exports.f = Object.getOwnPropertySymbols;
- },{}],379:[function(_dereq_,module,exports){
- var hasOwn = _dereq_('../internals/has-own-property');
- var isCallable = _dereq_('../internals/is-callable');
- var toObject = _dereq_('../internals/to-object');
- var sharedKey = _dereq_('../internals/shared-key');
- var CORRECT_PROTOTYPE_GETTER = _dereq_('../internals/correct-prototype-getter');
- var IE_PROTO = sharedKey('IE_PROTO');
- var $Object = Object;
- var ObjectPrototype = $Object.prototype;
- // `Object.getPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.getprototypeof
- // eslint-disable-next-line es-x/no-object-getprototypeof -- safe
- module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
- var object = toObject(O);
- if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
- var constructor = object.constructor;
- if (isCallable(constructor) && object instanceof constructor) {
- return constructor.prototype;
- } return object instanceof $Object ? ObjectPrototype : null;
- };
- },{"../internals/correct-prototype-getter":290,"../internals/has-own-property":334,"../internals/is-callable":346,"../internals/shared-key":402,"../internals/to-object":416}],380:[function(_dereq_,module,exports){
- var fails = _dereq_('../internals/fails');
- var isObject = _dereq_('../internals/is-object');
- var classof = _dereq_('../internals/classof-raw');
- var ARRAY_BUFFER_NON_EXTENSIBLE = _dereq_('../internals/array-buffer-non-extensible');
- // eslint-disable-next-line es-x/no-object-isextensible -- safe
- var $isExtensible = Object.isExtensible;
- var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
- // `Object.isExtensible` method
- // https://tc39.es/ecma262/#sec-object.isextensible
- module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {
- if (!isObject(it)) return false;
- if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false;
- return $isExtensible ? $isExtensible(it) : true;
- } : $isExtensible;
- },{"../internals/array-buffer-non-extensible":264,"../internals/classof-raw":280,"../internals/fails":319,"../internals/is-object":352}],381:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- module.exports = uncurryThis({}.isPrototypeOf);
- },{"../internals/function-uncurry-this":327}],382:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var hasOwn = _dereq_('../internals/has-own-property');
- var toIndexedObject = _dereq_('../internals/to-indexed-object');
- var indexOf = _dereq_('../internals/array-includes').indexOf;
- var hiddenKeys = _dereq_('../internals/hidden-keys');
- var push = uncurryThis([].push);
- module.exports = function (object, names) {
- var O = toIndexedObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
- // Don't enum bug & hidden keys
- while (names.length > i) if (hasOwn(O, key = names[i++])) {
- ~indexOf(result, key) || push(result, key);
- }
- return result;
- };
- },{"../internals/array-includes":267,"../internals/function-uncurry-this":327,"../internals/has-own-property":334,"../internals/hidden-keys":335,"../internals/to-indexed-object":413}],383:[function(_dereq_,module,exports){
- var internalObjectKeys = _dereq_('../internals/object-keys-internal');
- var enumBugKeys = _dereq_('../internals/enum-bug-keys');
- // `Object.keys` method
- // https://tc39.es/ecma262/#sec-object.keys
- // eslint-disable-next-line es-x/no-object-keys -- safe
- module.exports = Object.keys || function keys(O) {
- return internalObjectKeys(O, enumBugKeys);
- };
- },{"../internals/enum-bug-keys":315,"../internals/object-keys-internal":382}],384:[function(_dereq_,module,exports){
- 'use strict';
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // Nashorn ~ JDK8 bug
- var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
- // `Object.prototype.propertyIsEnumerable` method implementation
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
- exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
- var descriptor = getOwnPropertyDescriptor(this, V);
- return !!descriptor && descriptor.enumerable;
- } : $propertyIsEnumerable;
- },{}],385:[function(_dereq_,module,exports){
- /* eslint-disable no-proto -- safe */
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var anObject = _dereq_('../internals/an-object');
- var aPossiblePrototype = _dereq_('../internals/a-possible-prototype');
- // `Object.setPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.setprototypeof
- // Works with __proto__ only. Old v8 can't work with null proto objects.
- // eslint-disable-next-line es-x/no-object-setprototypeof -- safe
- module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
- var CORRECT_SETTER = false;
- var test = {};
- var setter;
- try {
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
- setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
- setter(test, []);
- CORRECT_SETTER = test instanceof Array;
- } catch (error) { /* empty */ }
- return function setPrototypeOf(O, proto) {
- anObject(O);
- aPossiblePrototype(proto);
- if (CORRECT_SETTER) setter(O, proto);
- else O.__proto__ = proto;
- return O;
- };
- }() : undefined);
- },{"../internals/a-possible-prototype":260,"../internals/an-object":263,"../internals/function-uncurry-this":327}],386:[function(_dereq_,module,exports){
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var objectKeys = _dereq_('../internals/object-keys');
- var toIndexedObject = _dereq_('../internals/to-indexed-object');
- var $propertyIsEnumerable = _dereq_('../internals/object-property-is-enumerable').f;
- var propertyIsEnumerable = uncurryThis($propertyIsEnumerable);
- var push = uncurryThis([].push);
- // `Object.{ entries, values }` methods implementation
- var createMethod = function (TO_ENTRIES) {
- return function (it) {
- var O = toIndexedObject(it);
- var keys = objectKeys(O);
- var length = keys.length;
- var i = 0;
- var result = [];
- var key;
- while (length > i) {
- key = keys[i++];
- if (!DESCRIPTORS || propertyIsEnumerable(O, key)) {
- push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
- }
- }
- return result;
- };
- };
- module.exports = {
- // `Object.entries` method
- // https://tc39.es/ecma262/#sec-object.entries
- entries: createMethod(true),
- // `Object.values` method
- // https://tc39.es/ecma262/#sec-object.values
- values: createMethod(false)
- };
- },{"../internals/descriptors":299,"../internals/function-uncurry-this":327,"../internals/object-keys":383,"../internals/object-property-is-enumerable":384,"../internals/to-indexed-object":413}],387:[function(_dereq_,module,exports){
- 'use strict';
- var TO_STRING_TAG_SUPPORT = _dereq_('../internals/to-string-tag-support');
- var classof = _dereq_('../internals/classof');
- // `Object.prototype.toString` method implementation
- // https://tc39.es/ecma262/#sec-object.prototype.tostring
- module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
- return '[object ' + classof(this) + ']';
- };
- },{"../internals/classof":281,"../internals/to-string-tag-support":419}],388:[function(_dereq_,module,exports){
- var call = _dereq_('../internals/function-call');
- var isCallable = _dereq_('../internals/is-callable');
- var isObject = _dereq_('../internals/is-object');
- var $TypeError = TypeError;
- // `OrdinaryToPrimitive` abstract operation
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
- module.exports = function (input, pref) {
- var fn, val;
- if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
- if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
- if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
- throw $TypeError("Can't convert object to primitive value");
- };
- },{"../internals/function-call":325,"../internals/is-callable":346,"../internals/is-object":352}],389:[function(_dereq_,module,exports){
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var getOwnPropertyNamesModule = _dereq_('../internals/object-get-own-property-names');
- var getOwnPropertySymbolsModule = _dereq_('../internals/object-get-own-property-symbols');
- var anObject = _dereq_('../internals/an-object');
- var concat = uncurryThis([].concat);
- // all object keys, includes non-enumerable and symbols
- module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
- var keys = getOwnPropertyNamesModule.f(anObject(it));
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
- return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
- };
- },{"../internals/an-object":263,"../internals/function-uncurry-this":327,"../internals/get-built-in":328,"../internals/object-get-own-property-names":377,"../internals/object-get-own-property-symbols":378}],390:[function(_dereq_,module,exports){
- arguments[4][335][0].apply(exports,arguments)
- },{"dup":335}],391:[function(_dereq_,module,exports){
- module.exports = function (exec) {
- try {
- return { error: false, value: exec() };
- } catch (error) {
- return { error: true, value: error };
- }
- };
- },{}],392:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
- var isCallable = _dereq_('../internals/is-callable');
- var isForced = _dereq_('../internals/is-forced');
- var inspectSource = _dereq_('../internals/inspect-source');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var IS_BROWSER = _dereq_('../internals/engine-is-browser');
- var IS_DENO = _dereq_('../internals/engine-is-deno');
- var IS_PURE = _dereq_('../internals/is-pure');
- var V8_VERSION = _dereq_('../internals/engine-v8-version');
- var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
- var SPECIES = wellKnownSymbol('species');
- var SUBCLASSING = false;
- var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
- var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
- var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
- var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
- // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
- // We can't detect it synchronously, so just check versions
- if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
- // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution
- if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;
- // We can't use @@species feature detection in V8 since it causes
- // deoptimization and performance degradation
- // https://github.com/zloirock/core-js/issues/679
- if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
- // Detect correctness of subclassing with @@species support
- var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
- var FakePromise = function (exec) {
- exec(function () { /* empty */ }, function () { /* empty */ });
- };
- var constructor = promise.constructor = {};
- constructor[SPECIES] = FakePromise;
- SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
- if (!SUBCLASSING) return true;
- // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
- } return !GLOBAL_CORE_JS_PROMISE && (IS_BROWSER || IS_DENO) && !NATIVE_PROMISE_REJECTION_EVENT;
- });
- module.exports = {
- CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
- REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
- SUBCLASSING: SUBCLASSING
- };
- },{"../internals/engine-is-browser":304,"../internals/engine-is-deno":305,"../internals/engine-v8-version":312,"../internals/global":333,"../internals/inspect-source":340,"../internals/is-callable":346,"../internals/is-forced":349,"../internals/is-pure":353,"../internals/promise-native-constructor":393,"../internals/well-known-symbol":429}],393:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- module.exports = global.Promise;
- },{"../internals/global":333}],394:[function(_dereq_,module,exports){
- var anObject = _dereq_('../internals/an-object');
- var isObject = _dereq_('../internals/is-object');
- var newPromiseCapability = _dereq_('../internals/new-promise-capability');
- module.exports = function (C, x) {
- anObject(C);
- if (isObject(x) && x.constructor === C) return x;
- var promiseCapability = newPromiseCapability.f(C);
- var resolve = promiseCapability.resolve;
- resolve(x);
- return promiseCapability.promise;
- };
- },{"../internals/an-object":263,"../internals/is-object":352,"../internals/new-promise-capability":367}],395:[function(_dereq_,module,exports){
- var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
- var checkCorrectnessOfIteration = _dereq_('../internals/check-correctness-of-iteration');
- var FORCED_PROMISE_CONSTRUCTOR = _dereq_('../internals/promise-constructor-detection').CONSTRUCTOR;
- module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
- NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });
- });
- },{"../internals/check-correctness-of-iteration":279,"../internals/promise-constructor-detection":392,"../internals/promise-native-constructor":393}],396:[function(_dereq_,module,exports){
- var Queue = function () {
- this.head = null;
- this.tail = null;
- };
- Queue.prototype = {
- add: function (item) {
- var entry = { item: item, next: null };
- if (this.head) this.tail.next = entry;
- else this.head = entry;
- this.tail = entry;
- },
- get: function () {
- var entry = this.head;
- if (entry) {
- this.head = entry.next;
- if (this.tail === entry) this.tail = null;
- return entry.item;
- }
- }
- };
- module.exports = Queue;
- },{}],397:[function(_dereq_,module,exports){
- var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
- var $TypeError = TypeError;
- // `RequireObjectCoercible` abstract operation
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
- module.exports = function (it) {
- if (isNullOrUndefined(it)) throw $TypeError("Can't call method on " + it);
- return it;
- };
- },{"../internals/is-null-or-undefined":351}],398:[function(_dereq_,module,exports){
- // `SameValueZero` abstract operation
- // https://tc39.es/ecma262/#sec-samevaluezero
- module.exports = function (x, y) {
- // eslint-disable-next-line no-self-compare -- NaN check
- return x === y || x != x && y != y;
- };
- },{}],399:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- var apply = _dereq_('../internals/function-apply');
- var isCallable = _dereq_('../internals/is-callable');
- var userAgent = _dereq_('../internals/engine-user-agent');
- var arraySlice = _dereq_('../internals/array-slice');
- var validateArgumentsLength = _dereq_('../internals/validate-arguments-length');
- var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
- var Function = global.Function;
- var wrap = function (scheduler) {
- return MSIE ? function (handler, timeout /* , ...arguments */) {
- var boundArgs = validateArgumentsLength(arguments.length, 1) > 2;
- var fn = isCallable(handler) ? handler : Function(handler);
- var args = boundArgs ? arraySlice(arguments, 2) : undefined;
- return scheduler(boundArgs ? function () {
- apply(fn, this, args);
- } : fn, timeout);
- } : scheduler;
- };
- // ie9- setTimeout & setInterval additional parameters fix
- // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers
- module.exports = {
- // `setTimeout` method
- // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
- setTimeout: wrap(global.setTimeout),
- // `setInterval` method
- // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
- setInterval: wrap(global.setInterval)
- };
- },{"../internals/array-slice":274,"../internals/engine-user-agent":311,"../internals/function-apply":321,"../internals/global":333,"../internals/is-callable":346,"../internals/validate-arguments-length":425}],400:[function(_dereq_,module,exports){
- 'use strict';
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var definePropertyModule = _dereq_('../internals/object-define-property');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var SPECIES = wellKnownSymbol('species');
- module.exports = function (CONSTRUCTOR_NAME) {
- var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
- var defineProperty = definePropertyModule.f;
- if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
- defineProperty(Constructor, SPECIES, {
- configurable: true,
- get: function () { return this; }
- });
- }
- };
- },{"../internals/descriptors":299,"../internals/get-built-in":328,"../internals/object-define-property":374,"../internals/well-known-symbol":429}],401:[function(_dereq_,module,exports){
- var TO_STRING_TAG_SUPPORT = _dereq_('../internals/to-string-tag-support');
- var defineProperty = _dereq_('../internals/object-define-property').f;
- var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
- var hasOwn = _dereq_('../internals/has-own-property');
- var toString = _dereq_('../internals/object-to-string');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- module.exports = function (it, TAG, STATIC, SET_METHOD) {
- if (it) {
- var target = STATIC ? it : it.prototype;
- if (!hasOwn(target, TO_STRING_TAG)) {
- defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
- }
- if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
- createNonEnumerableProperty(target, 'toString', toString);
- }
- }
- };
- },{"../internals/create-non-enumerable-property":292,"../internals/has-own-property":334,"../internals/object-define-property":374,"../internals/object-to-string":387,"../internals/to-string-tag-support":419,"../internals/well-known-symbol":429}],402:[function(_dereq_,module,exports){
- var shared = _dereq_('../internals/shared');
- var uid = _dereq_('../internals/uid');
- var keys = shared('keys');
- module.exports = function (key) {
- return keys[key] || (keys[key] = uid(key));
- };
- },{"../internals/shared":404,"../internals/uid":422}],403:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- var defineGlobalProperty = _dereq_('../internals/define-global-property');
- var SHARED = '__core-js_shared__';
- var store = global[SHARED] || defineGlobalProperty(SHARED, {});
- module.exports = store;
- },{"../internals/define-global-property":297,"../internals/global":333}],404:[function(_dereq_,module,exports){
- var IS_PURE = _dereq_('../internals/is-pure');
- var store = _dereq_('../internals/shared-store');
- (module.exports = function (key, value) {
- return store[key] || (store[key] = value !== undefined ? value : {});
- })('versions', []).push({
- version: '3.25.1',
- mode: IS_PURE ? 'pure' : 'global',
- copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
- license: 'https://github.com/zloirock/core-js/blob/v3.25.1/LICENSE',
- source: 'https://github.com/zloirock/core-js'
- });
- },{"../internals/is-pure":353,"../internals/shared-store":403}],405:[function(_dereq_,module,exports){
- var anObject = _dereq_('../internals/an-object');
- var aConstructor = _dereq_('../internals/a-constructor');
- var isNullOrUndefined = _dereq_('../internals/is-null-or-undefined');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var SPECIES = wellKnownSymbol('species');
- // `SpeciesConstructor` abstract operation
- // https://tc39.es/ecma262/#sec-speciesconstructor
- module.exports = function (O, defaultConstructor) {
- var C = anObject(O).constructor;
- var S;
- return C === undefined || isNullOrUndefined(S = anObject(C)[SPECIES]) ? defaultConstructor : aConstructor(S);
- };
- },{"../internals/a-constructor":259,"../internals/an-object":263,"../internals/is-null-or-undefined":351,"../internals/well-known-symbol":429}],406:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var toIntegerOrInfinity = _dereq_('../internals/to-integer-or-infinity');
- var toString = _dereq_('../internals/to-string');
- var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
- var charAt = uncurryThis(''.charAt);
- var charCodeAt = uncurryThis(''.charCodeAt);
- var stringSlice = uncurryThis(''.slice);
- var createMethod = function (CONVERT_TO_STRING) {
- return function ($this, pos) {
- var S = toString(requireObjectCoercible($this));
- var position = toIntegerOrInfinity(pos);
- var size = S.length;
- var first, second;
- if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
- first = charCodeAt(S, position);
- return first < 0xD800 || first > 0xDBFF || position + 1 === size
- || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
- ? CONVERT_TO_STRING
- ? charAt(S, position)
- : first
- : CONVERT_TO_STRING
- ? stringSlice(S, position, position + 2)
- : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
- };
- };
- module.exports = {
- // `String.prototype.codePointAt` method
- // https://tc39.es/ecma262/#sec-string.prototype.codepointat
- codeAt: createMethod(false),
- // `String.prototype.at` method
- // https://github.com/mathiasbynens/String.prototype.at
- charAt: createMethod(true)
- };
- },{"../internals/function-uncurry-this":327,"../internals/require-object-coercible":397,"../internals/to-integer-or-infinity":414,"../internals/to-string":420}],407:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
- var toString = _dereq_('../internals/to-string');
- var whitespaces = _dereq_('../internals/whitespaces');
- var replace = uncurryThis(''.replace);
- var whitespace = '[' + whitespaces + ']';
- var ltrim = RegExp('^' + whitespace + whitespace + '*');
- var rtrim = RegExp(whitespace + whitespace + '*$');
- // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
- var createMethod = function (TYPE) {
- return function ($this) {
- var string = toString(requireObjectCoercible($this));
- if (TYPE & 1) string = replace(string, ltrim, '');
- if (TYPE & 2) string = replace(string, rtrim, '');
- return string;
- };
- };
- module.exports = {
- // `String.prototype.{ trimLeft, trimStart }` methods
- // https://tc39.es/ecma262/#sec-string.prototype.trimstart
- start: createMethod(1),
- // `String.prototype.{ trimRight, trimEnd }` methods
- // https://tc39.es/ecma262/#sec-string.prototype.trimend
- end: createMethod(2),
- // `String.prototype.trim` method
- // https://tc39.es/ecma262/#sec-string.prototype.trim
- trim: createMethod(3)
- };
- },{"../internals/function-uncurry-this":327,"../internals/require-object-coercible":397,"../internals/to-string":420,"../internals/whitespaces":430}],408:[function(_dereq_,module,exports){
- /* eslint-disable es-x/no-symbol -- required for testing */
- var V8_VERSION = _dereq_('../internals/engine-v8-version');
- var fails = _dereq_('../internals/fails');
- // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
- module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
- var symbol = Symbol();
- // Chrome 38 Symbol has incorrect toString conversion
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
- return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
- !Symbol.sham && V8_VERSION && V8_VERSION < 41;
- });
- },{"../internals/engine-v8-version":312,"../internals/fails":319}],409:[function(_dereq_,module,exports){
- var call = _dereq_('../internals/function-call');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var defineBuiltIn = _dereq_('../internals/define-built-in');
- module.exports = function () {
- var Symbol = getBuiltIn('Symbol');
- var SymbolPrototype = Symbol && Symbol.prototype;
- var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
- var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
- if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
- // `Symbol.prototype[@@toPrimitive]` method
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
- // eslint-disable-next-line no-unused-vars -- required for .length
- defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {
- return call(valueOf, this);
- }, { arity: 1 });
- }
- };
- },{"../internals/define-built-in":295,"../internals/function-call":325,"../internals/get-built-in":328,"../internals/well-known-symbol":429}],410:[function(_dereq_,module,exports){
- var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
- /* eslint-disable es-x/no-symbol -- safe */
- module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
- },{"../internals/symbol-constructor-detection":408}],411:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- var apply = _dereq_('../internals/function-apply');
- var bind = _dereq_('../internals/function-bind-context');
- var isCallable = _dereq_('../internals/is-callable');
- var hasOwn = _dereq_('../internals/has-own-property');
- var fails = _dereq_('../internals/fails');
- var html = _dereq_('../internals/html');
- var arraySlice = _dereq_('../internals/array-slice');
- var createElement = _dereq_('../internals/document-create-element');
- var validateArgumentsLength = _dereq_('../internals/validate-arguments-length');
- var IS_IOS = _dereq_('../internals/engine-is-ios');
- var IS_NODE = _dereq_('../internals/engine-is-node');
- var set = global.setImmediate;
- var clear = global.clearImmediate;
- var process = global.process;
- var Dispatch = global.Dispatch;
- var Function = global.Function;
- var MessageChannel = global.MessageChannel;
- var String = global.String;
- var counter = 0;
- var queue = {};
- var ONREADYSTATECHANGE = 'onreadystatechange';
- var location, defer, channel, port;
- try {
- // Deno throws a ReferenceError on `location` access without `--location` flag
- location = global.location;
- } catch (error) { /* empty */ }
- var run = function (id) {
- if (hasOwn(queue, id)) {
- var fn = queue[id];
- delete queue[id];
- fn();
- }
- };
- var runner = function (id) {
- return function () {
- run(id);
- };
- };
- var listener = function (event) {
- run(event.data);
- };
- var post = function (id) {
- // old engines have not location.origin
- global.postMessage(String(id), location.protocol + '//' + location.host);
- };
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
- if (!set || !clear) {
- set = function setImmediate(handler) {
- validateArgumentsLength(arguments.length, 1);
- var fn = isCallable(handler) ? handler : Function(handler);
- var args = arraySlice(arguments, 1);
- queue[++counter] = function () {
- apply(fn, undefined, args);
- };
- defer(counter);
- return counter;
- };
- clear = function clearImmediate(id) {
- delete queue[id];
- };
- // Node.js 0.8-
- if (IS_NODE) {
- defer = function (id) {
- process.nextTick(runner(id));
- };
- // Sphere (JS game engine) Dispatch API
- } else if (Dispatch && Dispatch.now) {
- defer = function (id) {
- Dispatch.now(runner(id));
- };
- // Browsers with MessageChannel, includes WebWorkers
- // except iOS - https://github.com/zloirock/core-js/issues/624
- } else if (MessageChannel && !IS_IOS) {
- channel = new MessageChannel();
- port = channel.port2;
- channel.port1.onmessage = listener;
- defer = bind(port.postMessage, port);
- // Browsers with postMessage, skip WebWorkers
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
- } else if (
- global.addEventListener &&
- isCallable(global.postMessage) &&
- !global.importScripts &&
- location && location.protocol !== 'file:' &&
- !fails(post)
- ) {
- defer = post;
- global.addEventListener('message', listener, false);
- // IE8-
- } else if (ONREADYSTATECHANGE in createElement('script')) {
- defer = function (id) {
- html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
- html.removeChild(this);
- run(id);
- };
- };
- // Rest old browsers
- } else {
- defer = function (id) {
- setTimeout(runner(id), 0);
- };
- }
- }
- module.exports = {
- set: set,
- clear: clear
- };
- },{"../internals/array-slice":274,"../internals/document-create-element":300,"../internals/engine-is-ios":308,"../internals/engine-is-node":309,"../internals/fails":319,"../internals/function-apply":321,"../internals/function-bind-context":322,"../internals/global":333,"../internals/has-own-property":334,"../internals/html":337,"../internals/is-callable":346,"../internals/validate-arguments-length":425}],412:[function(_dereq_,module,exports){
- var toIntegerOrInfinity = _dereq_('../internals/to-integer-or-infinity');
- var max = Math.max;
- var min = Math.min;
- // Helper for a popular repeating case of the spec:
- // Let integer be ? ToInteger(index).
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
- module.exports = function (index, length) {
- var integer = toIntegerOrInfinity(index);
- return integer < 0 ? max(integer + length, 0) : min(integer, length);
- };
- },{"../internals/to-integer-or-infinity":414}],413:[function(_dereq_,module,exports){
- // toObject with fallback for non-array-like ES3 strings
- var IndexedObject = _dereq_('../internals/indexed-object');
- var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
- module.exports = function (it) {
- return IndexedObject(requireObjectCoercible(it));
- };
- },{"../internals/indexed-object":339,"../internals/require-object-coercible":397}],414:[function(_dereq_,module,exports){
- var trunc = _dereq_('../internals/math-trunc');
- // `ToIntegerOrInfinity` abstract operation
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
- module.exports = function (argument) {
- var number = +argument;
- // eslint-disable-next-line no-self-compare -- NaN check
- return number !== number || number === 0 ? 0 : trunc(number);
- };
- },{"../internals/math-trunc":365}],415:[function(_dereq_,module,exports){
- var toIntegerOrInfinity = _dereq_('../internals/to-integer-or-infinity');
- var min = Math.min;
- // `ToLength` abstract operation
- // https://tc39.es/ecma262/#sec-tolength
- module.exports = function (argument) {
- return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
- };
- },{"../internals/to-integer-or-infinity":414}],416:[function(_dereq_,module,exports){
- var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
- var $Object = Object;
- // `ToObject` abstract operation
- // https://tc39.es/ecma262/#sec-toobject
- module.exports = function (argument) {
- return $Object(requireObjectCoercible(argument));
- };
- },{"../internals/require-object-coercible":397}],417:[function(_dereq_,module,exports){
- var call = _dereq_('../internals/function-call');
- var isObject = _dereq_('../internals/is-object');
- var isSymbol = _dereq_('../internals/is-symbol');
- var getMethod = _dereq_('../internals/get-method');
- var ordinaryToPrimitive = _dereq_('../internals/ordinary-to-primitive');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var $TypeError = TypeError;
- var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
- // `ToPrimitive` abstract operation
- // https://tc39.es/ecma262/#sec-toprimitive
- module.exports = function (input, pref) {
- if (!isObject(input) || isSymbol(input)) return input;
- var exoticToPrim = getMethod(input, TO_PRIMITIVE);
- var result;
- if (exoticToPrim) {
- if (pref === undefined) pref = 'default';
- result = call(exoticToPrim, input, pref);
- if (!isObject(result) || isSymbol(result)) return result;
- throw $TypeError("Can't convert object to primitive value");
- }
- if (pref === undefined) pref = 'number';
- return ordinaryToPrimitive(input, pref);
- };
- },{"../internals/function-call":325,"../internals/get-method":332,"../internals/is-object":352,"../internals/is-symbol":355,"../internals/ordinary-to-primitive":388,"../internals/well-known-symbol":429}],418:[function(_dereq_,module,exports){
- var toPrimitive = _dereq_('../internals/to-primitive');
- var isSymbol = _dereq_('../internals/is-symbol');
- // `ToPropertyKey` abstract operation
- // https://tc39.es/ecma262/#sec-topropertykey
- module.exports = function (argument) {
- var key = toPrimitive(argument, 'string');
- return isSymbol(key) ? key : key + '';
- };
- },{"../internals/is-symbol":355,"../internals/to-primitive":417}],419:[function(_dereq_,module,exports){
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- var test = {};
- test[TO_STRING_TAG] = 'z';
- module.exports = String(test) === '[object z]';
- },{"../internals/well-known-symbol":429}],420:[function(_dereq_,module,exports){
- var classof = _dereq_('../internals/classof');
- var $String = String;
- module.exports = function (argument) {
- if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
- return $String(argument);
- };
- },{"../internals/classof":281}],421:[function(_dereq_,module,exports){
- var $String = String;
- module.exports = function (argument) {
- try {
- return $String(argument);
- } catch (error) {
- return 'Object';
- }
- };
- },{}],422:[function(_dereq_,module,exports){
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var id = 0;
- var postfix = Math.random();
- var toString = uncurryThis(1.0.toString);
- module.exports = function (key) {
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
- };
- },{"../internals/function-uncurry-this":327}],423:[function(_dereq_,module,exports){
- /* eslint-disable es-x/no-symbol -- required for testing */
- var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
- module.exports = NATIVE_SYMBOL
- && !Symbol.sham
- && typeof Symbol.iterator == 'symbol';
- },{"../internals/symbol-constructor-detection":408}],424:[function(_dereq_,module,exports){
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var fails = _dereq_('../internals/fails');
- // V8 ~ Chrome 36-
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
- module.exports = DESCRIPTORS && fails(function () {
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
- return Object.defineProperty(function () { /* empty */ }, 'prototype', {
- value: 42,
- writable: false
- }).prototype != 42;
- });
- },{"../internals/descriptors":299,"../internals/fails":319}],425:[function(_dereq_,module,exports){
- var $TypeError = TypeError;
- module.exports = function (passed, required) {
- if (passed < required) throw $TypeError('Not enough arguments');
- return passed;
- };
- },{}],426:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- var isCallable = _dereq_('../internals/is-callable');
- var WeakMap = global.WeakMap;
- module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
- },{"../internals/global":333,"../internals/is-callable":346}],427:[function(_dereq_,module,exports){
- var path = _dereq_('../internals/path');
- var hasOwn = _dereq_('../internals/has-own-property');
- var wrappedWellKnownSymbolModule = _dereq_('../internals/well-known-symbol-wrapped');
- var defineProperty = _dereq_('../internals/object-define-property').f;
- module.exports = function (NAME) {
- var Symbol = path.Symbol || (path.Symbol = {});
- if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {
- value: wrappedWellKnownSymbolModule.f(NAME)
- });
- };
- },{"../internals/has-own-property":334,"../internals/object-define-property":374,"../internals/path":390,"../internals/well-known-symbol-wrapped":428}],428:[function(_dereq_,module,exports){
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- exports.f = wellKnownSymbol;
- },{"../internals/well-known-symbol":429}],429:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- var shared = _dereq_('../internals/shared');
- var hasOwn = _dereq_('../internals/has-own-property');
- var uid = _dereq_('../internals/uid');
- var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
- var USE_SYMBOL_AS_UID = _dereq_('../internals/use-symbol-as-uid');
- var WellKnownSymbolsStore = shared('wks');
- var Symbol = global.Symbol;
- var symbolFor = Symbol && Symbol['for'];
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
- module.exports = function (name) {
- if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
- var description = 'Symbol.' + name;
- if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
- WellKnownSymbolsStore[name] = Symbol[name];
- } else if (USE_SYMBOL_AS_UID && symbolFor) {
- WellKnownSymbolsStore[name] = symbolFor(description);
- } else {
- WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
- }
- } return WellKnownSymbolsStore[name];
- };
- },{"../internals/global":333,"../internals/has-own-property":334,"../internals/shared":404,"../internals/symbol-constructor-detection":408,"../internals/uid":422,"../internals/use-symbol-as-uid":423}],430:[function(_dereq_,module,exports){
- // a string of all valid unicode whitespaces
- module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
- '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
- },{}],431:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var isPrototypeOf = _dereq_('../internals/object-is-prototype-of');
- var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
- var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
- var copyConstructorProperties = _dereq_('../internals/copy-constructor-properties');
- var create = _dereq_('../internals/object-create');
- var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
- var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
- var clearErrorStack = _dereq_('../internals/error-stack-clear');
- var installErrorCause = _dereq_('../internals/install-error-cause');
- var iterate = _dereq_('../internals/iterate');
- var normalizeStringArgument = _dereq_('../internals/normalize-string-argument');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var ERROR_STACK_INSTALLABLE = _dereq_('../internals/error-stack-installable');
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- var $Error = Error;
- var push = [].push;
- var $AggregateError = function AggregateError(errors, message /* , options */) {
- var options = arguments.length > 2 ? arguments[2] : undefined;
- var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
- var that;
- if (setPrototypeOf) {
- that = setPrototypeOf($Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
- } else {
- that = isInstance ? this : create(AggregateErrorPrototype);
- createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
- }
- if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
- if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
- installErrorCause(that, options);
- var errorsArray = [];
- iterate(errors, push, { that: errorsArray });
- createNonEnumerableProperty(that, 'errors', errorsArray);
- return that;
- };
- if (setPrototypeOf) setPrototypeOf($AggregateError, $Error);
- else copyConstructorProperties($AggregateError, $Error, { name: true });
- var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
- constructor: createPropertyDescriptor(1, $AggregateError),
- message: createPropertyDescriptor(1, ''),
- name: createPropertyDescriptor(1, 'AggregateError')
- });
- // `AggregateError` constructor
- // https://tc39.es/ecma262/#sec-aggregate-error-constructor
- $({ global: true, constructor: true, arity: 2 }, {
- AggregateError: $AggregateError
- });
- },{"../internals/copy-constructor-properties":288,"../internals/create-non-enumerable-property":292,"../internals/create-property-descriptor":293,"../internals/error-stack-clear":316,"../internals/error-stack-installable":317,"../internals/export":318,"../internals/install-error-cause":341,"../internals/iterate":356,"../internals/normalize-string-argument":368,"../internals/object-create":372,"../internals/object-get-prototype-of":379,"../internals/object-is-prototype-of":381,"../internals/object-set-prototype-of":385,"../internals/well-known-symbol":429}],432:[function(_dereq_,module,exports){
- // TODO: Remove this module from `core-js@4` since it's replaced to module below
- _dereq_('../modules/es.aggregate-error.constructor');
- },{"../modules/es.aggregate-error.constructor":431}],433:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var fails = _dereq_('../internals/fails');
- var isArray = _dereq_('../internals/is-array');
- var isObject = _dereq_('../internals/is-object');
- var toObject = _dereq_('../internals/to-object');
- var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
- var doesNotExceedSafeInteger = _dereq_('../internals/does-not-exceed-safe-integer');
- var createProperty = _dereq_('../internals/create-property');
- var arraySpeciesCreate = _dereq_('../internals/array-species-create');
- var arrayMethodHasSpeciesSupport = _dereq_('../internals/array-method-has-species-support');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var V8_VERSION = _dereq_('../internals/engine-v8-version');
- var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
- // We can't use this feature detection in V8 since it causes
- // deoptimization and serious performance degradation
- // https://github.com/zloirock/core-js/issues/679
- var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
- var array = [];
- array[IS_CONCAT_SPREADABLE] = false;
- return array.concat()[0] !== array;
- });
- var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
- var isConcatSpreadable = function (O) {
- if (!isObject(O)) return false;
- var spreadable = O[IS_CONCAT_SPREADABLE];
- return spreadable !== undefined ? !!spreadable : isArray(O);
- };
- var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
- // `Array.prototype.concat` method
- // https://tc39.es/ecma262/#sec-array.prototype.concat
- // with adding support of @@isConcatSpreadable and @@species
- $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- concat: function concat(arg) {
- var O = toObject(this);
- var A = arraySpeciesCreate(O, 0);
- var n = 0;
- var i, k, length, len, E;
- for (i = -1, length = arguments.length; i < length; i++) {
- E = i === -1 ? O : arguments[i];
- if (isConcatSpreadable(E)) {
- len = lengthOfArrayLike(E);
- doesNotExceedSafeInteger(n + len);
- for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
- } else {
- doesNotExceedSafeInteger(n + 1);
- createProperty(A, n++, E);
- }
- }
- A.length = n;
- return A;
- }
- });
- },{"../internals/array-method-has-species-support":269,"../internals/array-species-create":277,"../internals/create-property":294,"../internals/does-not-exceed-safe-integer":301,"../internals/engine-v8-version":312,"../internals/export":318,"../internals/fails":319,"../internals/is-array":345,"../internals/is-object":352,"../internals/length-of-array-like":362,"../internals/to-object":416,"../internals/well-known-symbol":429}],434:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var $every = _dereq_('../internals/array-iteration').every;
- var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
- var STRICT_METHOD = arrayMethodIsStrict('every');
- // `Array.prototype.every` method
- // https://tc39.es/ecma262/#sec-array.prototype.every
- $({ target: 'Array', proto: true, forced: !STRICT_METHOD }, {
- every: function every(callbackfn /* , thisArg */) {
- return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- },{"../internals/array-iteration":268,"../internals/array-method-is-strict":270,"../internals/export":318}],435:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var $filter = _dereq_('../internals/array-iteration').filter;
- var arrayMethodHasSpeciesSupport = _dereq_('../internals/array-method-has-species-support');
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
- // `Array.prototype.filter` method
- // https://tc39.es/ecma262/#sec-array.prototype.filter
- // with adding support of @@species
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
- filter: function filter(callbackfn /* , thisArg */) {
- return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- },{"../internals/array-iteration":268,"../internals/array-method-has-species-support":269,"../internals/export":318}],436:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var $findIndex = _dereq_('../internals/array-iteration').findIndex;
- var addToUnscopables = _dereq_('../internals/add-to-unscopables');
- var FIND_INDEX = 'findIndex';
- var SKIPS_HOLES = true;
- // Shouldn't skip holes
- if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });
- // `Array.prototype.findIndex` method
- // https://tc39.es/ecma262/#sec-array.prototype.findindex
- $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
- findIndex: function findIndex(callbackfn /* , that = undefined */) {
- return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables(FIND_INDEX);
- },{"../internals/add-to-unscopables":261,"../internals/array-iteration":268,"../internals/export":318}],437:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var $find = _dereq_('../internals/array-iteration').find;
- var addToUnscopables = _dereq_('../internals/add-to-unscopables');
- var FIND = 'find';
- var SKIPS_HOLES = true;
- // Shouldn't skip holes
- if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
- // `Array.prototype.find` method
- // https://tc39.es/ecma262/#sec-array.prototype.find
- $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
- find: function find(callbackfn /* , that = undefined */) {
- return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables(FIND);
- },{"../internals/add-to-unscopables":261,"../internals/array-iteration":268,"../internals/export":318}],438:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var forEach = _dereq_('../internals/array-for-each');
- // `Array.prototype.forEach` method
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
- // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
- $({ target: 'Array', proto: true, forced: [].forEach != forEach }, {
- forEach: forEach
- });
- },{"../internals/array-for-each":265,"../internals/export":318}],439:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var from = _dereq_('../internals/array-from');
- var checkCorrectnessOfIteration = _dereq_('../internals/check-correctness-of-iteration');
- var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
- // eslint-disable-next-line es-x/no-array-from -- required for testing
- Array.from(iterable);
- });
- // `Array.from` method
- // https://tc39.es/ecma262/#sec-array.from
- $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
- from: from
- });
- },{"../internals/array-from":266,"../internals/check-correctness-of-iteration":279,"../internals/export":318}],440:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var $includes = _dereq_('../internals/array-includes').includes;
- var fails = _dereq_('../internals/fails');
- var addToUnscopables = _dereq_('../internals/add-to-unscopables');
- // FF99+ bug
- var BROKEN_ON_SPARSE = fails(function () {
- return !Array(1).includes();
- });
- // `Array.prototype.includes` method
- // https://tc39.es/ecma262/#sec-array.prototype.includes
- $({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
- includes: function includes(el /* , fromIndex = 0 */) {
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables('includes');
- },{"../internals/add-to-unscopables":261,"../internals/array-includes":267,"../internals/export":318,"../internals/fails":319}],441:[function(_dereq_,module,exports){
- 'use strict';
- /* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
- var $ = _dereq_('../internals/export');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var $indexOf = _dereq_('../internals/array-includes').indexOf;
- var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
- var nativeIndexOf = uncurryThis([].indexOf);
- var NEGATIVE_ZERO = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0;
- var STRICT_METHOD = arrayMethodIsStrict('indexOf');
- // `Array.prototype.indexOf` method
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
- $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
- indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
- var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
- return NEGATIVE_ZERO
- // convert -0 to +0
- ? nativeIndexOf(this, searchElement, fromIndex) || 0
- : $indexOf(this, searchElement, fromIndex);
- }
- });
- },{"../internals/array-includes":267,"../internals/array-method-is-strict":270,"../internals/export":318,"../internals/function-uncurry-this":327}],442:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var isArray = _dereq_('../internals/is-array');
- // `Array.isArray` method
- // https://tc39.es/ecma262/#sec-array.isarray
- $({ target: 'Array', stat: true }, {
- isArray: isArray
- });
- },{"../internals/export":318,"../internals/is-array":345}],443:[function(_dereq_,module,exports){
- 'use strict';
- var toIndexedObject = _dereq_('../internals/to-indexed-object');
- var addToUnscopables = _dereq_('../internals/add-to-unscopables');
- var Iterators = _dereq_('../internals/iterators');
- var InternalStateModule = _dereq_('../internals/internal-state');
- var defineProperty = _dereq_('../internals/object-define-property').f;
- var defineIterator = _dereq_('../internals/iterator-define');
- var createIterResultObject = _dereq_('../internals/create-iter-result-object');
- var IS_PURE = _dereq_('../internals/is-pure');
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var ARRAY_ITERATOR = 'Array Iterator';
- var setInternalState = InternalStateModule.set;
- var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
- // `Array.prototype.entries` method
- // https://tc39.es/ecma262/#sec-array.prototype.entries
- // `Array.prototype.keys` method
- // https://tc39.es/ecma262/#sec-array.prototype.keys
- // `Array.prototype.values` method
- // https://tc39.es/ecma262/#sec-array.prototype.values
- // `Array.prototype[@@iterator]` method
- // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
- // `CreateArrayIterator` internal method
- // https://tc39.es/ecma262/#sec-createarrayiterator
- module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
- setInternalState(this, {
- type: ARRAY_ITERATOR,
- target: toIndexedObject(iterated), // target
- index: 0, // next index
- kind: kind // kind
- });
- // `%ArrayIteratorPrototype%.next` method
- // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
- }, function () {
- var state = getInternalState(this);
- var target = state.target;
- var kind = state.kind;
- var index = state.index++;
- if (!target || index >= target.length) {
- state.target = undefined;
- return createIterResultObject(undefined, true);
- }
- if (kind == 'keys') return createIterResultObject(index, false);
- if (kind == 'values') return createIterResultObject(target[index], false);
- return createIterResultObject([index, target[index]], false);
- }, 'values');
- // argumentsList[@@iterator] is %ArrayProto_values%
- // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
- // https://tc39.es/ecma262/#sec-createmappedargumentsobject
- var values = Iterators.Arguments = Iterators.Array;
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables('keys');
- addToUnscopables('values');
- addToUnscopables('entries');
- // V8 ~ Chrome 45- bug
- if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
- defineProperty(values, 'name', { value: 'values' });
- } catch (error) { /* empty */ }
- },{"../internals/add-to-unscopables":261,"../internals/create-iter-result-object":291,"../internals/descriptors":299,"../internals/internal-state":343,"../internals/is-pure":353,"../internals/iterator-define":359,"../internals/iterators":361,"../internals/object-define-property":374,"../internals/to-indexed-object":413}],444:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var $map = _dereq_('../internals/array-iteration').map;
- var arrayMethodHasSpeciesSupport = _dereq_('../internals/array-method-has-species-support');
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
- // `Array.prototype.map` method
- // https://tc39.es/ecma262/#sec-array.prototype.map
- // with adding support of @@species
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
- map: function map(callbackfn /* , thisArg */) {
- return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- },{"../internals/array-iteration":268,"../internals/array-method-has-species-support":269,"../internals/export":318}],445:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var $reduce = _dereq_('../internals/array-reduce').left;
- var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
- var CHROME_VERSION = _dereq_('../internals/engine-v8-version');
- var IS_NODE = _dereq_('../internals/engine-is-node');
- var STRICT_METHOD = arrayMethodIsStrict('reduce');
- // Chrome 80-82 has a critical bug
- // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
- var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
- // `Array.prototype.reduce` method
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
- $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
- reduce: function reduce(callbackfn /* , initialValue */) {
- var length = arguments.length;
- return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
- }
- });
- },{"../internals/array-method-is-strict":270,"../internals/array-reduce":271,"../internals/engine-is-node":309,"../internals/engine-v8-version":312,"../internals/export":318}],446:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var isArray = _dereq_('../internals/is-array');
- var nativeReverse = uncurryThis([].reverse);
- var test = [1, 2];
- // `Array.prototype.reverse` method
- // https://tc39.es/ecma262/#sec-array.prototype.reverse
- // fix for Safari 12.0 bug
- // https://bugs.webkit.org/show_bug.cgi?id=188794
- $({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {
- reverse: function reverse() {
- // eslint-disable-next-line no-self-assign -- dirty hack
- if (isArray(this)) this.length = this.length;
- return nativeReverse(this);
- }
- });
- },{"../internals/export":318,"../internals/function-uncurry-this":327,"../internals/is-array":345}],447:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var isArray = _dereq_('../internals/is-array');
- var isConstructor = _dereq_('../internals/is-constructor');
- var isObject = _dereq_('../internals/is-object');
- var toAbsoluteIndex = _dereq_('../internals/to-absolute-index');
- var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
- var toIndexedObject = _dereq_('../internals/to-indexed-object');
- var createProperty = _dereq_('../internals/create-property');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var arrayMethodHasSpeciesSupport = _dereq_('../internals/array-method-has-species-support');
- var nativeSlice = _dereq_('../internals/array-slice');
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
- var SPECIES = wellKnownSymbol('species');
- var $Array = Array;
- var max = Math.max;
- // `Array.prototype.slice` method
- // https://tc39.es/ecma262/#sec-array.prototype.slice
- // fallback for not array-like ES3 strings and DOM objects
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
- slice: function slice(start, end) {
- var O = toIndexedObject(this);
- var length = lengthOfArrayLike(O);
- var k = toAbsoluteIndex(start, length);
- var fin = toAbsoluteIndex(end === undefined ? length : end, length);
- // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
- var Constructor, result, n;
- if (isArray(O)) {
- Constructor = O.constructor;
- // cross-realm fallback
- if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {
- Constructor = undefined;
- } else if (isObject(Constructor)) {
- Constructor = Constructor[SPECIES];
- if (Constructor === null) Constructor = undefined;
- }
- if (Constructor === $Array || Constructor === undefined) {
- return nativeSlice(O, k, fin);
- }
- }
- result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));
- for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
- result.length = n;
- return result;
- }
- });
- },{"../internals/array-method-has-species-support":269,"../internals/array-slice":274,"../internals/create-property":294,"../internals/export":318,"../internals/is-array":345,"../internals/is-constructor":347,"../internals/is-object":352,"../internals/length-of-array-like":362,"../internals/to-absolute-index":412,"../internals/to-indexed-object":413,"../internals/well-known-symbol":429}],448:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var aCallable = _dereq_('../internals/a-callable');
- var toObject = _dereq_('../internals/to-object');
- var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
- var deletePropertyOrThrow = _dereq_('../internals/delete-property-or-throw');
- var toString = _dereq_('../internals/to-string');
- var fails = _dereq_('../internals/fails');
- var internalSort = _dereq_('../internals/array-sort');
- var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
- var FF = _dereq_('../internals/engine-ff-version');
- var IE_OR_EDGE = _dereq_('../internals/engine-is-ie-or-edge');
- var V8 = _dereq_('../internals/engine-v8-version');
- var WEBKIT = _dereq_('../internals/engine-webkit-version');
- var test = [];
- var nativeSort = uncurryThis(test.sort);
- var push = uncurryThis(test.push);
- // IE8-
- var FAILS_ON_UNDEFINED = fails(function () {
- test.sort(undefined);
- });
- // V8 bug
- var FAILS_ON_NULL = fails(function () {
- test.sort(null);
- });
- // Old WebKit
- var STRICT_METHOD = arrayMethodIsStrict('sort');
- var STABLE_SORT = !fails(function () {
- // feature detection can be too slow, so check engines versions
- if (V8) return V8 < 70;
- if (FF && FF > 3) return;
- if (IE_OR_EDGE) return true;
- if (WEBKIT) return WEBKIT < 603;
- var result = '';
- var code, chr, value, index;
- // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
- for (code = 65; code < 76; code++) {
- chr = String.fromCharCode(code);
- switch (code) {
- case 66: case 69: case 70: case 72: value = 3; break;
- case 68: case 71: value = 4; break;
- default: value = 2;
- }
- for (index = 0; index < 47; index++) {
- test.push({ k: chr + index, v: value });
- }
- }
- test.sort(function (a, b) { return b.v - a.v; });
- for (index = 0; index < test.length; index++) {
- chr = test[index].k.charAt(0);
- if (result.charAt(result.length - 1) !== chr) result += chr;
- }
- return result !== 'DGBEFHACIJK';
- });
- var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
- var getSortCompare = function (comparefn) {
- return function (x, y) {
- if (y === undefined) return -1;
- if (x === undefined) return 1;
- if (comparefn !== undefined) return +comparefn(x, y) || 0;
- return toString(x) > toString(y) ? 1 : -1;
- };
- };
- // `Array.prototype.sort` method
- // https://tc39.es/ecma262/#sec-array.prototype.sort
- $({ target: 'Array', proto: true, forced: FORCED }, {
- sort: function sort(comparefn) {
- if (comparefn !== undefined) aCallable(comparefn);
- var array = toObject(this);
- if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
- var items = [];
- var arrayLength = lengthOfArrayLike(array);
- var itemsLength, index;
- for (index = 0; index < arrayLength; index++) {
- if (index in array) push(items, array[index]);
- }
- internalSort(items, getSortCompare(comparefn));
- itemsLength = lengthOfArrayLike(items);
- index = 0;
- while (index < itemsLength) array[index] = items[index++];
- while (index < arrayLength) deletePropertyOrThrow(array, index++);
- return array;
- }
- });
- },{"../internals/a-callable":258,"../internals/array-method-is-strict":270,"../internals/array-sort":275,"../internals/delete-property-or-throw":298,"../internals/engine-ff-version":303,"../internals/engine-is-ie-or-edge":306,"../internals/engine-v8-version":312,"../internals/engine-webkit-version":313,"../internals/export":318,"../internals/fails":319,"../internals/function-uncurry-this":327,"../internals/length-of-array-like":362,"../internals/to-object":416,"../internals/to-string":420}],449:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var toObject = _dereq_('../internals/to-object');
- var toAbsoluteIndex = _dereq_('../internals/to-absolute-index');
- var toIntegerOrInfinity = _dereq_('../internals/to-integer-or-infinity');
- var lengthOfArrayLike = _dereq_('../internals/length-of-array-like');
- var setArrayLength = _dereq_('../internals/array-set-length');
- var doesNotExceedSafeInteger = _dereq_('../internals/does-not-exceed-safe-integer');
- var arraySpeciesCreate = _dereq_('../internals/array-species-create');
- var createProperty = _dereq_('../internals/create-property');
- var deletePropertyOrThrow = _dereq_('../internals/delete-property-or-throw');
- var arrayMethodHasSpeciesSupport = _dereq_('../internals/array-method-has-species-support');
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
- var max = Math.max;
- var min = Math.min;
- // `Array.prototype.splice` method
- // https://tc39.es/ecma262/#sec-array.prototype.splice
- // with adding support of @@species
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
- splice: function splice(start, deleteCount /* , ...items */) {
- var O = toObject(this);
- var len = lengthOfArrayLike(O);
- var actualStart = toAbsoluteIndex(start, len);
- var argumentsLength = arguments.length;
- var insertCount, actualDeleteCount, A, k, from, to;
- if (argumentsLength === 0) {
- insertCount = actualDeleteCount = 0;
- } else if (argumentsLength === 1) {
- insertCount = 0;
- actualDeleteCount = len - actualStart;
- } else {
- insertCount = argumentsLength - 2;
- actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
- }
- doesNotExceedSafeInteger(len + insertCount - actualDeleteCount);
- A = arraySpeciesCreate(O, actualDeleteCount);
- for (k = 0; k < actualDeleteCount; k++) {
- from = actualStart + k;
- if (from in O) createProperty(A, k, O[from]);
- }
- A.length = actualDeleteCount;
- if (insertCount < actualDeleteCount) {
- for (k = actualStart; k < len - actualDeleteCount; k++) {
- from = k + actualDeleteCount;
- to = k + insertCount;
- if (from in O) O[to] = O[from];
- else deletePropertyOrThrow(O, to);
- }
- for (k = len; k > len - actualDeleteCount + insertCount; k--) deletePropertyOrThrow(O, k - 1);
- } else if (insertCount > actualDeleteCount) {
- for (k = len - actualDeleteCount; k > actualStart; k--) {
- from = k + actualDeleteCount - 1;
- to = k + insertCount - 1;
- if (from in O) O[to] = O[from];
- else deletePropertyOrThrow(O, to);
- }
- }
- for (k = 0; k < insertCount; k++) {
- O[k + actualStart] = arguments[k + 2];
- }
- setArrayLength(O, len - actualDeleteCount + insertCount);
- return A;
- }
- });
- },{"../internals/array-method-has-species-support":269,"../internals/array-set-length":272,"../internals/array-species-create":277,"../internals/create-property":294,"../internals/delete-property-or-throw":298,"../internals/does-not-exceed-safe-integer":301,"../internals/export":318,"../internals/length-of-array-like":362,"../internals/to-absolute-index":412,"../internals/to-integer-or-infinity":414,"../internals/to-object":416}],450:[function(_dereq_,module,exports){
- // TODO: Remove from `core-js@4`
- var $ = _dereq_('../internals/export');
- var bind = _dereq_('../internals/function-bind');
- // `Function.prototype.bind` method
- // https://tc39.es/ecma262/#sec-function.prototype.bind
- $({ target: 'Function', proto: true, forced: Function.bind !== bind }, {
- bind: bind
- });
- },{"../internals/export":318,"../internals/function-bind":324}],451:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var apply = _dereq_('../internals/function-apply');
- var call = _dereq_('../internals/function-call');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var fails = _dereq_('../internals/fails');
- var isArray = _dereq_('../internals/is-array');
- var isCallable = _dereq_('../internals/is-callable');
- var isObject = _dereq_('../internals/is-object');
- var isSymbol = _dereq_('../internals/is-symbol');
- var arraySlice = _dereq_('../internals/array-slice');
- var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
- var $stringify = getBuiltIn('JSON', 'stringify');
- var exec = uncurryThis(/./.exec);
- var charAt = uncurryThis(''.charAt);
- var charCodeAt = uncurryThis(''.charCodeAt);
- var replace = uncurryThis(''.replace);
- var numberToString = uncurryThis(1.0.toString);
- var tester = /[\uD800-\uDFFF]/g;
- var low = /^[\uD800-\uDBFF]$/;
- var hi = /^[\uDC00-\uDFFF]$/;
- var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
- var symbol = getBuiltIn('Symbol')();
- // MS Edge converts symbol values to JSON as {}
- return $stringify([symbol]) != '[null]'
- // WebKit converts symbol values to JSON as null
- || $stringify({ a: symbol }) != '{}'
- // V8 throws on boxed symbols
- || $stringify(Object(symbol)) != '{}';
- });
- // https://github.com/tc39/proposal-well-formed-stringify
- var ILL_FORMED_UNICODE = fails(function () {
- return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
- || $stringify('\uDEAD') !== '"\\udead"';
- });
- var stringifyWithSymbolsFix = function (it, replacer) {
- var args = arraySlice(arguments);
- var $replacer = replacer;
- if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
- if (!isArray(replacer)) replacer = function (key, value) {
- if (isCallable($replacer)) value = call($replacer, this, key, value);
- if (!isSymbol(value)) return value;
- };
- args[1] = replacer;
- return apply($stringify, null, args);
- };
- var fixIllFormed = function (match, offset, string) {
- var prev = charAt(string, offset - 1);
- var next = charAt(string, offset + 1);
- if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
- return '\\u' + numberToString(charCodeAt(match, 0), 16);
- } return match;
- };
- if ($stringify) {
- // `JSON.stringify` method
- // https://tc39.es/ecma262/#sec-json.stringify
- $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- stringify: function stringify(it, replacer, space) {
- var args = arraySlice(arguments);
- var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
- return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;
- }
- });
- }
- },{"../internals/array-slice":274,"../internals/export":318,"../internals/fails":319,"../internals/function-apply":321,"../internals/function-call":325,"../internals/function-uncurry-this":327,"../internals/get-built-in":328,"../internals/is-array":345,"../internals/is-callable":346,"../internals/is-object":352,"../internals/is-symbol":355,"../internals/symbol-constructor-detection":408}],452:[function(_dereq_,module,exports){
- var global = _dereq_('../internals/global');
- var setToStringTag = _dereq_('../internals/set-to-string-tag');
- // JSON[@@toStringTag] property
- // https://tc39.es/ecma262/#sec-json-@@tostringtag
- setToStringTag(global.JSON, 'JSON', true);
- },{"../internals/global":333,"../internals/set-to-string-tag":401}],453:[function(_dereq_,module,exports){
- 'use strict';
- var collection = _dereq_('../internals/collection');
- var collectionStrong = _dereq_('../internals/collection-strong');
- // `Map` constructor
- // https://tc39.es/ecma262/#sec-map-objects
- collection('Map', function (init) {
- return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };
- }, collectionStrong);
- },{"../internals/collection":287,"../internals/collection-strong":285}],454:[function(_dereq_,module,exports){
- // TODO: Remove this module from `core-js@4` since it's replaced to module below
- _dereq_('../modules/es.map.constructor');
- },{"../modules/es.map.constructor":453}],455:[function(_dereq_,module,exports){
- // empty
- },{}],456:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var isIntegralNumber = _dereq_('../internals/is-integral-number');
- // `Number.isInteger` method
- // https://tc39.es/ecma262/#sec-number.isinteger
- $({ target: 'Number', stat: true }, {
- isInteger: isIntegralNumber
- });
- },{"../internals/export":318,"../internals/is-integral-number":350}],457:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var assign = _dereq_('../internals/object-assign');
- // `Object.assign` method
- // https://tc39.es/ecma262/#sec-object.assign
- // eslint-disable-next-line es-x/no-object-assign -- required for testing
- $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
- assign: assign
- });
- },{"../internals/export":318,"../internals/object-assign":371}],458:[function(_dereq_,module,exports){
- // TODO: Remove from `core-js@4`
- var $ = _dereq_('../internals/export');
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var create = _dereq_('../internals/object-create');
- // `Object.create` method
- // https://tc39.es/ecma262/#sec-object.create
- $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
- create: create
- });
- },{"../internals/descriptors":299,"../internals/export":318,"../internals/object-create":372}],459:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var defineProperties = _dereq_('../internals/object-define-properties').f;
- // `Object.defineProperties` method
- // https://tc39.es/ecma262/#sec-object.defineproperties
- // eslint-disable-next-line es-x/no-object-defineproperties -- safe
- $({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {
- defineProperties: defineProperties
- });
- },{"../internals/descriptors":299,"../internals/export":318,"../internals/object-define-properties":373}],460:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var defineProperty = _dereq_('../internals/object-define-property').f;
- // `Object.defineProperty` method
- // https://tc39.es/ecma262/#sec-object.defineproperty
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
- $({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {
- defineProperty: defineProperty
- });
- },{"../internals/descriptors":299,"../internals/export":318,"../internals/object-define-property":374}],461:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var $entries = _dereq_('../internals/object-to-array').entries;
- // `Object.entries` method
- // https://tc39.es/ecma262/#sec-object.entries
- $({ target: 'Object', stat: true }, {
- entries: function entries(O) {
- return $entries(O);
- }
- });
- },{"../internals/export":318,"../internals/object-to-array":386}],462:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var FREEZING = _dereq_('../internals/freezing');
- var fails = _dereq_('../internals/fails');
- var isObject = _dereq_('../internals/is-object');
- var onFreeze = _dereq_('../internals/internal-metadata').onFreeze;
- // eslint-disable-next-line es-x/no-object-freeze -- safe
- var $freeze = Object.freeze;
- var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });
- // `Object.freeze` method
- // https://tc39.es/ecma262/#sec-object.freeze
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
- freeze: function freeze(it) {
- return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;
- }
- });
- },{"../internals/export":318,"../internals/fails":319,"../internals/freezing":320,"../internals/internal-metadata":342,"../internals/is-object":352}],463:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var fails = _dereq_('../internals/fails');
- var toIndexedObject = _dereq_('../internals/to-indexed-object');
- var nativeGetOwnPropertyDescriptor = _dereq_('../internals/object-get-own-property-descriptor').f;
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
- var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
- $({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
- getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
- return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
- }
- });
- },{"../internals/descriptors":299,"../internals/export":318,"../internals/fails":319,"../internals/object-get-own-property-descriptor":375,"../internals/to-indexed-object":413}],464:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var ownKeys = _dereq_('../internals/own-keys');
- var toIndexedObject = _dereq_('../internals/to-indexed-object');
- var getOwnPropertyDescriptorModule = _dereq_('../internals/object-get-own-property-descriptor');
- var createProperty = _dereq_('../internals/create-property');
- // `Object.getOwnPropertyDescriptors` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
- $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
- getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
- var O = toIndexedObject(object);
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- var keys = ownKeys(O);
- var result = {};
- var index = 0;
- var key, descriptor;
- while (keys.length > index) {
- descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
- if (descriptor !== undefined) createProperty(result, key, descriptor);
- }
- return result;
- }
- });
- },{"../internals/create-property":294,"../internals/descriptors":299,"../internals/export":318,"../internals/object-get-own-property-descriptor":375,"../internals/own-keys":389,"../internals/to-indexed-object":413}],465:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
- var fails = _dereq_('../internals/fails');
- var getOwnPropertySymbolsModule = _dereq_('../internals/object-get-own-property-symbols');
- var toObject = _dereq_('../internals/to-object');
- // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
- // https://bugs.chromium.org/p/v8/issues/detail?id=3443
- var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
- // `Object.getOwnPropertySymbols` method
- // https://tc39.es/ecma262/#sec-object.getownpropertysymbols
- $({ target: 'Object', stat: true, forced: FORCED }, {
- getOwnPropertySymbols: function getOwnPropertySymbols(it) {
- var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
- return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
- }
- });
- },{"../internals/export":318,"../internals/fails":319,"../internals/object-get-own-property-symbols":378,"../internals/symbol-constructor-detection":408,"../internals/to-object":416}],466:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var fails = _dereq_('../internals/fails');
- var toObject = _dereq_('../internals/to-object');
- var nativeGetPrototypeOf = _dereq_('../internals/object-get-prototype-of');
- var CORRECT_PROTOTYPE_GETTER = _dereq_('../internals/correct-prototype-getter');
- var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
- // `Object.getPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.getprototypeof
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
- getPrototypeOf: function getPrototypeOf(it) {
- return nativeGetPrototypeOf(toObject(it));
- }
- });
- },{"../internals/correct-prototype-getter":290,"../internals/export":318,"../internals/fails":319,"../internals/object-get-prototype-of":379,"../internals/to-object":416}],467:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var toObject = _dereq_('../internals/to-object');
- var nativeKeys = _dereq_('../internals/object-keys');
- var fails = _dereq_('../internals/fails');
- var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
- // `Object.keys` method
- // https://tc39.es/ecma262/#sec-object.keys
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
- keys: function keys(it) {
- return nativeKeys(toObject(it));
- }
- });
- },{"../internals/export":318,"../internals/fails":319,"../internals/object-keys":383,"../internals/to-object":416}],468:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
- // `Object.setPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.setprototypeof
- $({ target: 'Object', stat: true }, {
- setPrototypeOf: setPrototypeOf
- });
- },{"../internals/export":318,"../internals/object-set-prototype-of":385}],469:[function(_dereq_,module,exports){
- arguments[4][455][0].apply(exports,arguments)
- },{"dup":455}],470:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var $parseInt = _dereq_('../internals/number-parse-int');
- // `parseInt` method
- // https://tc39.es/ecma262/#sec-parseint-string-radix
- $({ global: true, forced: parseInt != $parseInt }, {
- parseInt: $parseInt
- });
- },{"../internals/export":318,"../internals/number-parse-int":370}],471:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
- var perform = _dereq_('../internals/perform');
- var iterate = _dereq_('../internals/iterate');
- // `Promise.allSettled` method
- // https://tc39.es/ecma262/#sec-promise.allsettled
- $({ target: 'Promise', stat: true }, {
- allSettled: function allSettled(iterable) {
- var C = this;
- var capability = newPromiseCapabilityModule.f(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var promiseResolve = aCallable(C.resolve);
- var values = [];
- var counter = 0;
- var remaining = 1;
- iterate(iterable, function (promise) {
- var index = counter++;
- var alreadyCalled = false;
- remaining++;
- call(promiseResolve, C, promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[index] = { status: 'fulfilled', value: value };
- --remaining || resolve(values);
- }, function (error) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[index] = { status: 'rejected', reason: error };
- --remaining || resolve(values);
- });
- });
- --remaining || resolve(values);
- });
- if (result.error) reject(result.value);
- return capability.promise;
- }
- });
- },{"../internals/a-callable":258,"../internals/export":318,"../internals/function-call":325,"../internals/iterate":356,"../internals/new-promise-capability":367,"../internals/perform":391}],472:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
- var perform = _dereq_('../internals/perform');
- var iterate = _dereq_('../internals/iterate');
- var PROMISE_STATICS_INCORRECT_ITERATION = _dereq_('../internals/promise-statics-incorrect-iteration');
- // `Promise.all` method
- // https://tc39.es/ecma262/#sec-promise.all
- $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
- all: function all(iterable) {
- var C = this;
- var capability = newPromiseCapabilityModule.f(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var $promiseResolve = aCallable(C.resolve);
- var values = [];
- var counter = 0;
- var remaining = 1;
- iterate(iterable, function (promise) {
- var index = counter++;
- var alreadyCalled = false;
- remaining++;
- call($promiseResolve, C, promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[index] = value;
- --remaining || resolve(values);
- }, reject);
- });
- --remaining || resolve(values);
- });
- if (result.error) reject(result.value);
- return capability.promise;
- }
- });
- },{"../internals/a-callable":258,"../internals/export":318,"../internals/function-call":325,"../internals/iterate":356,"../internals/new-promise-capability":367,"../internals/perform":391,"../internals/promise-statics-incorrect-iteration":395}],473:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
- var perform = _dereq_('../internals/perform');
- var iterate = _dereq_('../internals/iterate');
- var PROMISE_ANY_ERROR = 'No one promise resolved';
- // `Promise.any` method
- // https://tc39.es/ecma262/#sec-promise.any
- $({ target: 'Promise', stat: true }, {
- any: function any(iterable) {
- var C = this;
- var AggregateError = getBuiltIn('AggregateError');
- var capability = newPromiseCapabilityModule.f(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var promiseResolve = aCallable(C.resolve);
- var errors = [];
- var counter = 0;
- var remaining = 1;
- var alreadyResolved = false;
- iterate(iterable, function (promise) {
- var index = counter++;
- var alreadyRejected = false;
- remaining++;
- call(promiseResolve, C, promise).then(function (value) {
- if (alreadyRejected || alreadyResolved) return;
- alreadyResolved = true;
- resolve(value);
- }, function (error) {
- if (alreadyRejected || alreadyResolved) return;
- alreadyRejected = true;
- errors[index] = error;
- --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
- });
- });
- --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
- });
- if (result.error) reject(result.value);
- return capability.promise;
- }
- });
- },{"../internals/a-callable":258,"../internals/export":318,"../internals/function-call":325,"../internals/get-built-in":328,"../internals/iterate":356,"../internals/new-promise-capability":367,"../internals/perform":391}],474:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var IS_PURE = _dereq_('../internals/is-pure');
- var FORCED_PROMISE_CONSTRUCTOR = _dereq_('../internals/promise-constructor-detection').CONSTRUCTOR;
- var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var isCallable = _dereq_('../internals/is-callable');
- var defineBuiltIn = _dereq_('../internals/define-built-in');
- var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
- // `Promise.prototype.catch` method
- // https://tc39.es/ecma262/#sec-promise.prototype.catch
- $({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
- 'catch': function (onRejected) {
- return this.then(undefined, onRejected);
- }
- });
- // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
- if (!IS_PURE && isCallable(NativePromiseConstructor)) {
- var method = getBuiltIn('Promise').prototype['catch'];
- if (NativePromisePrototype['catch'] !== method) {
- defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
- }
- }
- },{"../internals/define-built-in":295,"../internals/export":318,"../internals/get-built-in":328,"../internals/is-callable":346,"../internals/is-pure":353,"../internals/promise-constructor-detection":392,"../internals/promise-native-constructor":393}],475:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var IS_PURE = _dereq_('../internals/is-pure');
- var IS_NODE = _dereq_('../internals/engine-is-node');
- var global = _dereq_('../internals/global');
- var call = _dereq_('../internals/function-call');
- var defineBuiltIn = _dereq_('../internals/define-built-in');
- var setPrototypeOf = _dereq_('../internals/object-set-prototype-of');
- var setToStringTag = _dereq_('../internals/set-to-string-tag');
- var setSpecies = _dereq_('../internals/set-species');
- var aCallable = _dereq_('../internals/a-callable');
- var isCallable = _dereq_('../internals/is-callable');
- var isObject = _dereq_('../internals/is-object');
- var anInstance = _dereq_('../internals/an-instance');
- var speciesConstructor = _dereq_('../internals/species-constructor');
- var task = _dereq_('../internals/task').set;
- var microtask = _dereq_('../internals/microtask');
- var hostReportErrors = _dereq_('../internals/host-report-errors');
- var perform = _dereq_('../internals/perform');
- var Queue = _dereq_('../internals/queue');
- var InternalStateModule = _dereq_('../internals/internal-state');
- var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
- var PromiseConstructorDetection = _dereq_('../internals/promise-constructor-detection');
- var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
- var PROMISE = 'Promise';
- var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
- var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
- var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
- var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
- var setInternalState = InternalStateModule.set;
- var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
- var PromiseConstructor = NativePromiseConstructor;
- var PromisePrototype = NativePromisePrototype;
- var TypeError = global.TypeError;
- var document = global.document;
- var process = global.process;
- var newPromiseCapability = newPromiseCapabilityModule.f;
- var newGenericPromiseCapability = newPromiseCapability;
- var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
- var UNHANDLED_REJECTION = 'unhandledrejection';
- var REJECTION_HANDLED = 'rejectionhandled';
- var PENDING = 0;
- var FULFILLED = 1;
- var REJECTED = 2;
- var HANDLED = 1;
- var UNHANDLED = 2;
- var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
- // helpers
- var isThenable = function (it) {
- var then;
- return isObject(it) && isCallable(then = it.then) ? then : false;
- };
- var callReaction = function (reaction, state) {
- var value = state.value;
- var ok = state.state == FULFILLED;
- var handler = ok ? reaction.ok : reaction.fail;
- var resolve = reaction.resolve;
- var reject = reaction.reject;
- var domain = reaction.domain;
- var result, then, exited;
- try {
- if (handler) {
- if (!ok) {
- if (state.rejection === UNHANDLED) onHandleUnhandled(state);
- state.rejection = HANDLED;
- }
- if (handler === true) result = value;
- else {
- if (domain) domain.enter();
- result = handler(value); // can throw
- if (domain) {
- domain.exit();
- exited = true;
- }
- }
- if (result === reaction.promise) {
- reject(TypeError('Promise-chain cycle'));
- } else if (then = isThenable(result)) {
- call(then, result, resolve, reject);
- } else resolve(result);
- } else reject(value);
- } catch (error) {
- if (domain && !exited) domain.exit();
- reject(error);
- }
- };
- var notify = function (state, isReject) {
- if (state.notified) return;
- state.notified = true;
- microtask(function () {
- var reactions = state.reactions;
- var reaction;
- while (reaction = reactions.get()) {
- callReaction(reaction, state);
- }
- state.notified = false;
- if (isReject && !state.rejection) onUnhandled(state);
- });
- };
- var dispatchEvent = function (name, promise, reason) {
- var event, handler;
- if (DISPATCH_EVENT) {
- event = document.createEvent('Event');
- event.promise = promise;
- event.reason = reason;
- event.initEvent(name, false, true);
- global.dispatchEvent(event);
- } else event = { promise: promise, reason: reason };
- if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
- else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
- };
- var onUnhandled = function (state) {
- call(task, global, function () {
- var promise = state.facade;
- var value = state.value;
- var IS_UNHANDLED = isUnhandled(state);
- var result;
- if (IS_UNHANDLED) {
- result = perform(function () {
- if (IS_NODE) {
- process.emit('unhandledRejection', value, promise);
- } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
- });
- // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
- state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
- if (result.error) throw result.value;
- }
- });
- };
- var isUnhandled = function (state) {
- return state.rejection !== HANDLED && !state.parent;
- };
- var onHandleUnhandled = function (state) {
- call(task, global, function () {
- var promise = state.facade;
- if (IS_NODE) {
- process.emit('rejectionHandled', promise);
- } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
- });
- };
- var bind = function (fn, state, unwrap) {
- return function (value) {
- fn(state, value, unwrap);
- };
- };
- var internalReject = function (state, value, unwrap) {
- if (state.done) return;
- state.done = true;
- if (unwrap) state = unwrap;
- state.value = value;
- state.state = REJECTED;
- notify(state, true);
- };
- var internalResolve = function (state, value, unwrap) {
- if (state.done) return;
- state.done = true;
- if (unwrap) state = unwrap;
- try {
- if (state.facade === value) throw TypeError("Promise can't be resolved itself");
- var then = isThenable(value);
- if (then) {
- microtask(function () {
- var wrapper = { done: false };
- try {
- call(then, value,
- bind(internalResolve, wrapper, state),
- bind(internalReject, wrapper, state)
- );
- } catch (error) {
- internalReject(wrapper, error, state);
- }
- });
- } else {
- state.value = value;
- state.state = FULFILLED;
- notify(state, false);
- }
- } catch (error) {
- internalReject({ done: false }, error, state);
- }
- };
- // constructor polyfill
- if (FORCED_PROMISE_CONSTRUCTOR) {
- // 25.4.3.1 Promise(executor)
- PromiseConstructor = function Promise(executor) {
- anInstance(this, PromisePrototype);
- aCallable(executor);
- call(Internal, this);
- var state = getInternalPromiseState(this);
- try {
- executor(bind(internalResolve, state), bind(internalReject, state));
- } catch (error) {
- internalReject(state, error);
- }
- };
- PromisePrototype = PromiseConstructor.prototype;
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- Internal = function Promise(executor) {
- setInternalState(this, {
- type: PROMISE,
- done: false,
- notified: false,
- parent: false,
- reactions: new Queue(),
- rejection: false,
- state: PENDING,
- value: undefined
- });
- };
- // `Promise.prototype.then` method
- // https://tc39.es/ecma262/#sec-promise.prototype.then
- Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
- var state = getInternalPromiseState(this);
- var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
- state.parent = true;
- reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
- reaction.fail = isCallable(onRejected) && onRejected;
- reaction.domain = IS_NODE ? process.domain : undefined;
- if (state.state == PENDING) state.reactions.add(reaction);
- else microtask(function () {
- callReaction(reaction, state);
- });
- return reaction.promise;
- });
- OwnPromiseCapability = function () {
- var promise = new Internal();
- var state = getInternalPromiseState(promise);
- this.promise = promise;
- this.resolve = bind(internalResolve, state);
- this.reject = bind(internalReject, state);
- };
- newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
- return C === PromiseConstructor || C === PromiseWrapper
- ? new OwnPromiseCapability(C)
- : newGenericPromiseCapability(C);
- };
- if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
- nativeThen = NativePromisePrototype.then;
- if (!NATIVE_PROMISE_SUBCLASSING) {
- // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
- defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
- var that = this;
- return new PromiseConstructor(function (resolve, reject) {
- call(nativeThen, that, resolve, reject);
- }).then(onFulfilled, onRejected);
- // https://github.com/zloirock/core-js/issues/640
- }, { unsafe: true });
- }
- // make `.constructor === Promise` work for native promise-based APIs
- try {
- delete NativePromisePrototype.constructor;
- } catch (error) { /* empty */ }
- // make `instanceof Promise` work for native promise-based APIs
- if (setPrototypeOf) {
- setPrototypeOf(NativePromisePrototype, PromisePrototype);
- }
- }
- }
- $({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
- Promise: PromiseConstructor
- });
- setToStringTag(PromiseConstructor, PROMISE, false, true);
- setSpecies(PROMISE);
- },{"../internals/a-callable":258,"../internals/an-instance":262,"../internals/define-built-in":295,"../internals/engine-is-node":309,"../internals/export":318,"../internals/function-call":325,"../internals/global":333,"../internals/host-report-errors":336,"../internals/internal-state":343,"../internals/is-callable":346,"../internals/is-object":352,"../internals/is-pure":353,"../internals/microtask":366,"../internals/new-promise-capability":367,"../internals/object-set-prototype-of":385,"../internals/perform":391,"../internals/promise-constructor-detection":392,"../internals/promise-native-constructor":393,"../internals/queue":396,"../internals/set-species":400,"../internals/set-to-string-tag":401,"../internals/species-constructor":405,"../internals/task":411}],476:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var IS_PURE = _dereq_('../internals/is-pure');
- var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
- var fails = _dereq_('../internals/fails');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var isCallable = _dereq_('../internals/is-callable');
- var speciesConstructor = _dereq_('../internals/species-constructor');
- var promiseResolve = _dereq_('../internals/promise-resolve');
- var defineBuiltIn = _dereq_('../internals/define-built-in');
- var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
- // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829
- var NON_GENERIC = !!NativePromiseConstructor && fails(function () {
- // eslint-disable-next-line unicorn/no-thenable -- required for testing
- NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });
- });
- // `Promise.prototype.finally` method
- // https://tc39.es/ecma262/#sec-promise.prototype.finally
- $({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
- 'finally': function (onFinally) {
- var C = speciesConstructor(this, getBuiltIn('Promise'));
- var isFunction = isCallable(onFinally);
- return this.then(
- isFunction ? function (x) {
- return promiseResolve(C, onFinally()).then(function () { return x; });
- } : onFinally,
- isFunction ? function (e) {
- return promiseResolve(C, onFinally()).then(function () { throw e; });
- } : onFinally
- );
- }
- });
- // makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
- if (!IS_PURE && isCallable(NativePromiseConstructor)) {
- var method = getBuiltIn('Promise').prototype['finally'];
- if (NativePromisePrototype['finally'] !== method) {
- defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true });
- }
- }
- },{"../internals/define-built-in":295,"../internals/export":318,"../internals/fails":319,"../internals/get-built-in":328,"../internals/is-callable":346,"../internals/is-pure":353,"../internals/promise-native-constructor":393,"../internals/promise-resolve":394,"../internals/species-constructor":405}],477:[function(_dereq_,module,exports){
- // TODO: Remove this module from `core-js@4` since it's split to modules listed below
- _dereq_('../modules/es.promise.constructor');
- _dereq_('../modules/es.promise.all');
- _dereq_('../modules/es.promise.catch');
- _dereq_('../modules/es.promise.race');
- _dereq_('../modules/es.promise.reject');
- _dereq_('../modules/es.promise.resolve');
- },{"../modules/es.promise.all":472,"../modules/es.promise.catch":474,"../modules/es.promise.constructor":475,"../modules/es.promise.race":478,"../modules/es.promise.reject":479,"../modules/es.promise.resolve":480}],478:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
- var perform = _dereq_('../internals/perform');
- var iterate = _dereq_('../internals/iterate');
- var PROMISE_STATICS_INCORRECT_ITERATION = _dereq_('../internals/promise-statics-incorrect-iteration');
- // `Promise.race` method
- // https://tc39.es/ecma262/#sec-promise.race
- $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
- race: function race(iterable) {
- var C = this;
- var capability = newPromiseCapabilityModule.f(C);
- var reject = capability.reject;
- var result = perform(function () {
- var $promiseResolve = aCallable(C.resolve);
- iterate(iterable, function (promise) {
- call($promiseResolve, C, promise).then(capability.resolve, reject);
- });
- });
- if (result.error) reject(result.value);
- return capability.promise;
- }
- });
- },{"../internals/a-callable":258,"../internals/export":318,"../internals/function-call":325,"../internals/iterate":356,"../internals/new-promise-capability":367,"../internals/perform":391,"../internals/promise-statics-incorrect-iteration":395}],479:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var call = _dereq_('../internals/function-call');
- var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
- var FORCED_PROMISE_CONSTRUCTOR = _dereq_('../internals/promise-constructor-detection').CONSTRUCTOR;
- // `Promise.reject` method
- // https://tc39.es/ecma262/#sec-promise.reject
- $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
- reject: function reject(r) {
- var capability = newPromiseCapabilityModule.f(this);
- call(capability.reject, undefined, r);
- return capability.promise;
- }
- });
- },{"../internals/export":318,"../internals/function-call":325,"../internals/new-promise-capability":367,"../internals/promise-constructor-detection":392}],480:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var IS_PURE = _dereq_('../internals/is-pure');
- var NativePromiseConstructor = _dereq_('../internals/promise-native-constructor');
- var FORCED_PROMISE_CONSTRUCTOR = _dereq_('../internals/promise-constructor-detection').CONSTRUCTOR;
- var promiseResolve = _dereq_('../internals/promise-resolve');
- var PromiseConstructorWrapper = getBuiltIn('Promise');
- var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
- // `Promise.resolve` method
- // https://tc39.es/ecma262/#sec-promise.resolve
- $({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
- resolve: function resolve(x) {
- return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
- }
- });
- },{"../internals/export":318,"../internals/get-built-in":328,"../internals/is-pure":353,"../internals/promise-constructor-detection":392,"../internals/promise-native-constructor":393,"../internals/promise-resolve":394}],481:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var apply = _dereq_('../internals/function-apply');
- var bind = _dereq_('../internals/function-bind');
- var aConstructor = _dereq_('../internals/a-constructor');
- var anObject = _dereq_('../internals/an-object');
- var isObject = _dereq_('../internals/is-object');
- var create = _dereq_('../internals/object-create');
- var fails = _dereq_('../internals/fails');
- var nativeConstruct = getBuiltIn('Reflect', 'construct');
- var ObjectPrototype = Object.prototype;
- var push = [].push;
- // `Reflect.construct` method
- // https://tc39.es/ecma262/#sec-reflect.construct
- // MS Edge supports only 2 arguments and argumentsList argument is optional
- // FF Nightly sets third argument as `new.target`, but does not create `this` from it
- var NEW_TARGET_BUG = fails(function () {
- function F() { /* empty */ }
- return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
- });
- var ARGS_BUG = !fails(function () {
- nativeConstruct(function () { /* empty */ });
- });
- var FORCED = NEW_TARGET_BUG || ARGS_BUG;
- $({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {
- construct: function construct(Target, args /* , newTarget */) {
- aConstructor(Target);
- anObject(args);
- var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);
- if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
- if (Target == newTarget) {
- // w/o altered newTarget, optimization for 0-4 arguments
- switch (args.length) {
- case 0: return new Target();
- case 1: return new Target(args[0]);
- case 2: return new Target(args[0], args[1]);
- case 3: return new Target(args[0], args[1], args[2]);
- case 4: return new Target(args[0], args[1], args[2], args[3]);
- }
- // w/o altered newTarget, lot of arguments case
- var $args = [null];
- apply(push, $args, args);
- return new (apply(bind, Target, $args))();
- }
- // with altered newTarget, not support built-in constructors
- var proto = newTarget.prototype;
- var instance = create(isObject(proto) ? proto : ObjectPrototype);
- var result = apply(Target, instance, args);
- return isObject(result) ? result : instance;
- }
- });
- },{"../internals/a-constructor":259,"../internals/an-object":263,"../internals/export":318,"../internals/fails":319,"../internals/function-apply":321,"../internals/function-bind":324,"../internals/get-built-in":328,"../internals/is-object":352,"../internals/object-create":372}],482:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var call = _dereq_('../internals/function-call');
- var isObject = _dereq_('../internals/is-object');
- var anObject = _dereq_('../internals/an-object');
- var isDataDescriptor = _dereq_('../internals/is-data-descriptor');
- var getOwnPropertyDescriptorModule = _dereq_('../internals/object-get-own-property-descriptor');
- var getPrototypeOf = _dereq_('../internals/object-get-prototype-of');
- // `Reflect.get` method
- // https://tc39.es/ecma262/#sec-reflect.get
- function get(target, propertyKey /* , receiver */) {
- var receiver = arguments.length < 3 ? target : arguments[2];
- var descriptor, prototype;
- if (anObject(target) === receiver) return target[propertyKey];
- descriptor = getOwnPropertyDescriptorModule.f(target, propertyKey);
- if (descriptor) return isDataDescriptor(descriptor)
- ? descriptor.value
- : descriptor.get === undefined ? undefined : call(descriptor.get, receiver);
- if (isObject(prototype = getPrototypeOf(target))) return get(prototype, propertyKey, receiver);
- }
- $({ target: 'Reflect', stat: true }, {
- get: get
- });
- },{"../internals/an-object":263,"../internals/export":318,"../internals/function-call":325,"../internals/is-data-descriptor":348,"../internals/is-object":352,"../internals/object-get-own-property-descriptor":375,"../internals/object-get-prototype-of":379}],483:[function(_dereq_,module,exports){
- arguments[4][455][0].apply(exports,arguments)
- },{"dup":455}],484:[function(_dereq_,module,exports){
- 'use strict';
- var collection = _dereq_('../internals/collection');
- var collectionStrong = _dereq_('../internals/collection-strong');
- // `Set` constructor
- // https://tc39.es/ecma262/#sec-set-objects
- collection('Set', function (init) {
- return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
- }, collectionStrong);
- },{"../internals/collection":287,"../internals/collection-strong":285}],485:[function(_dereq_,module,exports){
- // TODO: Remove this module from `core-js@4` since it's replaced to module below
- _dereq_('../modules/es.set.constructor');
- },{"../modules/es.set.constructor":484}],486:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var notARegExp = _dereq_('../internals/not-a-regexp');
- var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
- var toString = _dereq_('../internals/to-string');
- var correctIsRegExpLogic = _dereq_('../internals/correct-is-regexp-logic');
- var stringIndexOf = uncurryThis(''.indexOf);
- // `String.prototype.includes` method
- // https://tc39.es/ecma262/#sec-string.prototype.includes
- $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
- includes: function includes(searchString /* , position = 0 */) {
- return !!~stringIndexOf(
- toString(requireObjectCoercible(this)),
- toString(notARegExp(searchString)),
- arguments.length > 1 ? arguments[1] : undefined
- );
- }
- });
- },{"../internals/correct-is-regexp-logic":289,"../internals/export":318,"../internals/function-uncurry-this":327,"../internals/not-a-regexp":369,"../internals/require-object-coercible":397,"../internals/to-string":420}],487:[function(_dereq_,module,exports){
- 'use strict';
- var charAt = _dereq_('../internals/string-multibyte').charAt;
- var toString = _dereq_('../internals/to-string');
- var InternalStateModule = _dereq_('../internals/internal-state');
- var defineIterator = _dereq_('../internals/iterator-define');
- var createIterResultObject = _dereq_('../internals/create-iter-result-object');
- var STRING_ITERATOR = 'String Iterator';
- var setInternalState = InternalStateModule.set;
- var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
- // `String.prototype[@@iterator]` method
- // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
- defineIterator(String, 'String', function (iterated) {
- setInternalState(this, {
- type: STRING_ITERATOR,
- string: toString(iterated),
- index: 0
- });
- // `%StringIteratorPrototype%.next` method
- // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
- }, function next() {
- var state = getInternalState(this);
- var string = state.string;
- var index = state.index;
- var point;
- if (index >= string.length) return createIterResultObject(undefined, true);
- point = charAt(string, index);
- state.index += point.length;
- return createIterResultObject(point, false);
- });
- },{"../internals/create-iter-result-object":291,"../internals/internal-state":343,"../internals/iterator-define":359,"../internals/string-multibyte":406,"../internals/to-string":420}],488:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var getOwnPropertyDescriptor = _dereq_('../internals/object-get-own-property-descriptor').f;
- var toLength = _dereq_('../internals/to-length');
- var toString = _dereq_('../internals/to-string');
- var notARegExp = _dereq_('../internals/not-a-regexp');
- var requireObjectCoercible = _dereq_('../internals/require-object-coercible');
- var correctIsRegExpLogic = _dereq_('../internals/correct-is-regexp-logic');
- var IS_PURE = _dereq_('../internals/is-pure');
- // eslint-disable-next-line es-x/no-string-prototype-startswith -- safe
- var nativeStartsWith = uncurryThis(''.startsWith);
- var stringSlice = uncurryThis(''.slice);
- var min = Math.min;
- var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
- // https://github.com/zloirock/core-js/pull/702
- var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {
- var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
- return descriptor && !descriptor.writable;
- }();
- // `String.prototype.startsWith` method
- // https://tc39.es/ecma262/#sec-string.prototype.startswith
- $({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
- startsWith: function startsWith(searchString /* , position = 0 */) {
- var that = toString(requireObjectCoercible(this));
- notARegExp(searchString);
- var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
- var search = toString(searchString);
- return nativeStartsWith
- ? nativeStartsWith(that, search, index)
- : stringSlice(that, index, index + search.length) === search;
- }
- });
- },{"../internals/correct-is-regexp-logic":289,"../internals/export":318,"../internals/function-uncurry-this":327,"../internals/is-pure":353,"../internals/not-a-regexp":369,"../internals/object-get-own-property-descriptor":375,"../internals/require-object-coercible":397,"../internals/to-length":415,"../internals/to-string":420}],489:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.asyncIterator` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.asynciterator
- defineWellKnownSymbol('asyncIterator');
- },{"../internals/well-known-symbol-define":427}],490:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var global = _dereq_('../internals/global');
- var call = _dereq_('../internals/function-call');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var IS_PURE = _dereq_('../internals/is-pure');
- var DESCRIPTORS = _dereq_('../internals/descriptors');
- var NATIVE_SYMBOL = _dereq_('../internals/symbol-constructor-detection');
- var fails = _dereq_('../internals/fails');
- var hasOwn = _dereq_('../internals/has-own-property');
- var isPrototypeOf = _dereq_('../internals/object-is-prototype-of');
- var anObject = _dereq_('../internals/an-object');
- var toIndexedObject = _dereq_('../internals/to-indexed-object');
- var toPropertyKey = _dereq_('../internals/to-property-key');
- var $toString = _dereq_('../internals/to-string');
- var createPropertyDescriptor = _dereq_('../internals/create-property-descriptor');
- var nativeObjectCreate = _dereq_('../internals/object-create');
- var objectKeys = _dereq_('../internals/object-keys');
- var getOwnPropertyNamesModule = _dereq_('../internals/object-get-own-property-names');
- var getOwnPropertyNamesExternal = _dereq_('../internals/object-get-own-property-names-external');
- var getOwnPropertySymbolsModule = _dereq_('../internals/object-get-own-property-symbols');
- var getOwnPropertyDescriptorModule = _dereq_('../internals/object-get-own-property-descriptor');
- var definePropertyModule = _dereq_('../internals/object-define-property');
- var definePropertiesModule = _dereq_('../internals/object-define-properties');
- var propertyIsEnumerableModule = _dereq_('../internals/object-property-is-enumerable');
- var defineBuiltIn = _dereq_('../internals/define-built-in');
- var shared = _dereq_('../internals/shared');
- var sharedKey = _dereq_('../internals/shared-key');
- var hiddenKeys = _dereq_('../internals/hidden-keys');
- var uid = _dereq_('../internals/uid');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var wrappedWellKnownSymbolModule = _dereq_('../internals/well-known-symbol-wrapped');
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- var defineSymbolToPrimitive = _dereq_('../internals/symbol-define-to-primitive');
- var setToStringTag = _dereq_('../internals/set-to-string-tag');
- var InternalStateModule = _dereq_('../internals/internal-state');
- var $forEach = _dereq_('../internals/array-iteration').forEach;
- var HIDDEN = sharedKey('hidden');
- var SYMBOL = 'Symbol';
- var PROTOTYPE = 'prototype';
- var setInternalState = InternalStateModule.set;
- var getInternalState = InternalStateModule.getterFor(SYMBOL);
- var ObjectPrototype = Object[PROTOTYPE];
- var $Symbol = global.Symbol;
- var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
- var TypeError = global.TypeError;
- var QObject = global.QObject;
- var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- var nativeDefineProperty = definePropertyModule.f;
- var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
- var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
- var push = uncurryThis([].push);
- var AllSymbols = shared('symbols');
- var ObjectPrototypeSymbols = shared('op-symbols');
- var WellKnownSymbolsStore = shared('wks');
- // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
- var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
- // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
- var setSymbolDescriptor = DESCRIPTORS && fails(function () {
- return nativeObjectCreate(nativeDefineProperty({}, 'a', {
- get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
- })).a != 7;
- }) ? function (O, P, Attributes) {
- var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
- if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
- nativeDefineProperty(O, P, Attributes);
- if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
- nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
- }
- } : nativeDefineProperty;
- var wrap = function (tag, description) {
- var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
- setInternalState(symbol, {
- type: SYMBOL,
- tag: tag,
- description: description
- });
- if (!DESCRIPTORS) symbol.description = description;
- return symbol;
- };
- var $defineProperty = function defineProperty(O, P, Attributes) {
- if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
- anObject(O);
- var key = toPropertyKey(P);
- anObject(Attributes);
- if (hasOwn(AllSymbols, key)) {
- if (!Attributes.enumerable) {
- if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
- O[HIDDEN][key] = true;
- } else {
- if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
- Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
- } return setSymbolDescriptor(O, key, Attributes);
- } return nativeDefineProperty(O, key, Attributes);
- };
- var $defineProperties = function defineProperties(O, Properties) {
- anObject(O);
- var properties = toIndexedObject(Properties);
- var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
- $forEach(keys, function (key) {
- if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
- });
- return O;
- };
- var $create = function create(O, Properties) {
- return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
- };
- var $propertyIsEnumerable = function propertyIsEnumerable(V) {
- var P = toPropertyKey(V);
- var enumerable = call(nativePropertyIsEnumerable, this, P);
- if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
- return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
- ? enumerable : true;
- };
- var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
- var it = toIndexedObject(O);
- var key = toPropertyKey(P);
- if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
- var descriptor = nativeGetOwnPropertyDescriptor(it, key);
- if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
- descriptor.enumerable = true;
- }
- return descriptor;
- };
- var $getOwnPropertyNames = function getOwnPropertyNames(O) {
- var names = nativeGetOwnPropertyNames(toIndexedObject(O));
- var result = [];
- $forEach(names, function (key) {
- if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
- });
- return result;
- };
- var $getOwnPropertySymbols = function (O) {
- var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
- var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
- var result = [];
- $forEach(names, function (key) {
- if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
- push(result, AllSymbols[key]);
- }
- });
- return result;
- };
- // `Symbol` constructor
- // https://tc39.es/ecma262/#sec-symbol-constructor
- if (!NATIVE_SYMBOL) {
- $Symbol = function Symbol() {
- if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');
- var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
- var tag = uid(description);
- var setter = function (value) {
- if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
- if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
- setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
- };
- if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
- return wrap(tag, description);
- };
- SymbolPrototype = $Symbol[PROTOTYPE];
- defineBuiltIn(SymbolPrototype, 'toString', function toString() {
- return getInternalState(this).tag;
- });
- defineBuiltIn($Symbol, 'withoutSetter', function (description) {
- return wrap(uid(description), description);
- });
- propertyIsEnumerableModule.f = $propertyIsEnumerable;
- definePropertyModule.f = $defineProperty;
- definePropertiesModule.f = $defineProperties;
- getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
- getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
- getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
- wrappedWellKnownSymbolModule.f = function (name) {
- return wrap(wellKnownSymbol(name), name);
- };
- if (DESCRIPTORS) {
- // https://github.com/tc39/proposal-Symbol-description
- nativeDefineProperty(SymbolPrototype, 'description', {
- configurable: true,
- get: function description() {
- return getInternalState(this).description;
- }
- });
- if (!IS_PURE) {
- defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
- }
- }
- }
- $({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
- Symbol: $Symbol
- });
- $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
- defineWellKnownSymbol(name);
- });
- $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
- useSetter: function () { USE_SETTER = true; },
- useSimple: function () { USE_SETTER = false; }
- });
- $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
- // `Object.create` method
- // https://tc39.es/ecma262/#sec-object.create
- create: $create,
- // `Object.defineProperty` method
- // https://tc39.es/ecma262/#sec-object.defineproperty
- defineProperty: $defineProperty,
- // `Object.defineProperties` method
- // https://tc39.es/ecma262/#sec-object.defineproperties
- defineProperties: $defineProperties,
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
- getOwnPropertyDescriptor: $getOwnPropertyDescriptor
- });
- $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
- // `Object.getOwnPropertyNames` method
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
- getOwnPropertyNames: $getOwnPropertyNames
- });
- // `Symbol.prototype[@@toPrimitive]` method
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
- defineSymbolToPrimitive();
- // `Symbol.prototype[@@toStringTag]` property
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
- setToStringTag($Symbol, SYMBOL);
- hiddenKeys[HIDDEN] = true;
- },{"../internals/an-object":263,"../internals/array-iteration":268,"../internals/create-property-descriptor":293,"../internals/define-built-in":295,"../internals/descriptors":299,"../internals/export":318,"../internals/fails":319,"../internals/function-call":325,"../internals/function-uncurry-this":327,"../internals/global":333,"../internals/has-own-property":334,"../internals/hidden-keys":335,"../internals/internal-state":343,"../internals/is-pure":353,"../internals/object-create":372,"../internals/object-define-properties":373,"../internals/object-define-property":374,"../internals/object-get-own-property-descriptor":375,"../internals/object-get-own-property-names":377,"../internals/object-get-own-property-names-external":376,"../internals/object-get-own-property-symbols":378,"../internals/object-is-prototype-of":381,"../internals/object-keys":383,"../internals/object-property-is-enumerable":384,"../internals/set-to-string-tag":401,"../internals/shared":404,"../internals/shared-key":402,"../internals/symbol-constructor-detection":408,"../internals/symbol-define-to-primitive":409,"../internals/to-indexed-object":413,"../internals/to-property-key":418,"../internals/to-string":420,"../internals/uid":422,"../internals/well-known-symbol":429,"../internals/well-known-symbol-define":427,"../internals/well-known-symbol-wrapped":428}],491:[function(_dereq_,module,exports){
- arguments[4][455][0].apply(exports,arguments)
- },{"dup":455}],492:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var hasOwn = _dereq_('../internals/has-own-property');
- var toString = _dereq_('../internals/to-string');
- var shared = _dereq_('../internals/shared');
- var NATIVE_SYMBOL_REGISTRY = _dereq_('../internals/symbol-registry-detection');
- var StringToSymbolRegistry = shared('string-to-symbol-registry');
- var SymbolToStringRegistry = shared('symbol-to-string-registry');
- // `Symbol.for` method
- // https://tc39.es/ecma262/#sec-symbol.for
- $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
- 'for': function (key) {
- var string = toString(key);
- if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
- var symbol = getBuiltIn('Symbol')(string);
- StringToSymbolRegistry[string] = symbol;
- SymbolToStringRegistry[symbol] = string;
- return symbol;
- }
- });
- },{"../internals/export":318,"../internals/get-built-in":328,"../internals/has-own-property":334,"../internals/shared":404,"../internals/symbol-registry-detection":410,"../internals/to-string":420}],493:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.hasInstance` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.hasinstance
- defineWellKnownSymbol('hasInstance');
- },{"../internals/well-known-symbol-define":427}],494:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.isConcatSpreadable` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
- defineWellKnownSymbol('isConcatSpreadable');
- },{"../internals/well-known-symbol-define":427}],495:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.iterator` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.iterator
- defineWellKnownSymbol('iterator');
- },{"../internals/well-known-symbol-define":427}],496:[function(_dereq_,module,exports){
- // TODO: Remove this module from `core-js@4` since it's split to modules listed below
- _dereq_('../modules/es.symbol.constructor');
- _dereq_('../modules/es.symbol.for');
- _dereq_('../modules/es.symbol.key-for');
- _dereq_('../modules/es.json.stringify');
- _dereq_('../modules/es.object.get-own-property-symbols');
- },{"../modules/es.json.stringify":451,"../modules/es.object.get-own-property-symbols":465,"../modules/es.symbol.constructor":490,"../modules/es.symbol.for":492,"../modules/es.symbol.key-for":497}],497:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var hasOwn = _dereq_('../internals/has-own-property');
- var isSymbol = _dereq_('../internals/is-symbol');
- var tryToString = _dereq_('../internals/try-to-string');
- var shared = _dereq_('../internals/shared');
- var NATIVE_SYMBOL_REGISTRY = _dereq_('../internals/symbol-registry-detection');
- var SymbolToStringRegistry = shared('symbol-to-string-registry');
- // `Symbol.keyFor` method
- // https://tc39.es/ecma262/#sec-symbol.keyfor
- $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
- keyFor: function keyFor(sym) {
- if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
- if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
- }
- });
- },{"../internals/export":318,"../internals/has-own-property":334,"../internals/is-symbol":355,"../internals/shared":404,"../internals/symbol-registry-detection":410,"../internals/try-to-string":421}],498:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.matchAll` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.matchall
- defineWellKnownSymbol('matchAll');
- },{"../internals/well-known-symbol-define":427}],499:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.match` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.match
- defineWellKnownSymbol('match');
- },{"../internals/well-known-symbol-define":427}],500:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.replace` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.replace
- defineWellKnownSymbol('replace');
- },{"../internals/well-known-symbol-define":427}],501:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.search` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.search
- defineWellKnownSymbol('search');
- },{"../internals/well-known-symbol-define":427}],502:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.species` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.species
- defineWellKnownSymbol('species');
- },{"../internals/well-known-symbol-define":427}],503:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.split` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.split
- defineWellKnownSymbol('split');
- },{"../internals/well-known-symbol-define":427}],504:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- var defineSymbolToPrimitive = _dereq_('../internals/symbol-define-to-primitive');
- // `Symbol.toPrimitive` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.toprimitive
- defineWellKnownSymbol('toPrimitive');
- // `Symbol.prototype[@@toPrimitive]` method
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
- defineSymbolToPrimitive();
- },{"../internals/symbol-define-to-primitive":409,"../internals/well-known-symbol-define":427}],505:[function(_dereq_,module,exports){
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- var setToStringTag = _dereq_('../internals/set-to-string-tag');
- // `Symbol.toStringTag` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.tostringtag
- defineWellKnownSymbol('toStringTag');
- // `Symbol.prototype[@@toStringTag]` property
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
- setToStringTag(getBuiltIn('Symbol'), 'Symbol');
- },{"../internals/get-built-in":328,"../internals/set-to-string-tag":401,"../internals/well-known-symbol-define":427}],506:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.unscopables` well-known symbol
- // https://tc39.es/ecma262/#sec-symbol.unscopables
- defineWellKnownSymbol('unscopables');
- },{"../internals/well-known-symbol-define":427}],507:[function(_dereq_,module,exports){
- 'use strict';
- var global = _dereq_('../internals/global');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var defineBuiltIns = _dereq_('../internals/define-built-ins');
- var InternalMetadataModule = _dereq_('../internals/internal-metadata');
- var collection = _dereq_('../internals/collection');
- var collectionWeak = _dereq_('../internals/collection-weak');
- var isObject = _dereq_('../internals/is-object');
- var isExtensible = _dereq_('../internals/object-is-extensible');
- var enforceInternalState = _dereq_('../internals/internal-state').enforce;
- var NATIVE_WEAK_MAP = _dereq_('../internals/weak-map-basic-detection');
- var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
- var InternalWeakMap;
- var wrapper = function (init) {
- return function WeakMap() {
- return init(this, arguments.length ? arguments[0] : undefined);
- };
- };
- // `WeakMap` constructor
- // https://tc39.es/ecma262/#sec-weakmap-constructor
- var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
- // IE11 WeakMap frozen keys fix
- // We can't use feature detection because it crash some old IE builds
- // https://github.com/zloirock/core-js/issues/485
- if (NATIVE_WEAK_MAP && IS_IE11) {
- InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
- InternalMetadataModule.enable();
- var WeakMapPrototype = $WeakMap.prototype;
- var nativeDelete = uncurryThis(WeakMapPrototype['delete']);
- var nativeHas = uncurryThis(WeakMapPrototype.has);
- var nativeGet = uncurryThis(WeakMapPrototype.get);
- var nativeSet = uncurryThis(WeakMapPrototype.set);
- defineBuiltIns(WeakMapPrototype, {
- 'delete': function (key) {
- if (isObject(key) && !isExtensible(key)) {
- var state = enforceInternalState(this);
- if (!state.frozen) state.frozen = new InternalWeakMap();
- return nativeDelete(this, key) || state.frozen['delete'](key);
- } return nativeDelete(this, key);
- },
- has: function has(key) {
- if (isObject(key) && !isExtensible(key)) {
- var state = enforceInternalState(this);
- if (!state.frozen) state.frozen = new InternalWeakMap();
- return nativeHas(this, key) || state.frozen.has(key);
- } return nativeHas(this, key);
- },
- get: function get(key) {
- if (isObject(key) && !isExtensible(key)) {
- var state = enforceInternalState(this);
- if (!state.frozen) state.frozen = new InternalWeakMap();
- return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
- } return nativeGet(this, key);
- },
- set: function set(key, value) {
- if (isObject(key) && !isExtensible(key)) {
- var state = enforceInternalState(this);
- if (!state.frozen) state.frozen = new InternalWeakMap();
- nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
- } else nativeSet(this, key, value);
- return this;
- }
- });
- }
- },{"../internals/collection":287,"../internals/collection-weak":286,"../internals/define-built-ins":296,"../internals/function-uncurry-this":327,"../internals/global":333,"../internals/internal-metadata":342,"../internals/internal-state":343,"../internals/is-object":352,"../internals/object-is-extensible":380,"../internals/weak-map-basic-detection":426}],508:[function(_dereq_,module,exports){
- // TODO: Remove this module from `core-js@4` since it's replaced to module below
- _dereq_('../modules/es.weak-map.constructor');
- },{"../modules/es.weak-map.constructor":507}],509:[function(_dereq_,module,exports){
- // TODO: Remove from `core-js@4`
- _dereq_('../modules/es.aggregate-error');
- },{"../modules/es.aggregate-error":432}],510:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var deleteAll = _dereq_('../internals/collection-delete-all');
- // `Map.prototype.deleteAll` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- deleteAll: deleteAll
- });
- },{"../internals/collection-delete-all":282,"../internals/export":318}],511:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var emplace = _dereq_('../internals/map-emplace');
- // `Map.prototype.emplace` method
- // https://github.com/thumbsupep/proposal-upsert
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- emplace: emplace
- });
- },{"../internals/export":318,"../internals/map-emplace":363}],512:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var anObject = _dereq_('../internals/an-object');
- var bind = _dereq_('../internals/function-bind-context');
- var getMapIterator = _dereq_('../internals/get-map-iterator');
- var iterate = _dereq_('../internals/iterate');
- // `Map.prototype.every` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- every: function every(callbackfn /* , thisArg */) {
- var map = anObject(this);
- var iterator = getMapIterator(map);
- var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- return !iterate(iterator, function (key, value, stop) {
- if (!boundFunction(value, key, map)) return stop();
- }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped;
- }
- });
- },{"../internals/an-object":263,"../internals/export":318,"../internals/function-bind-context":322,"../internals/get-map-iterator":331,"../internals/iterate":356}],513:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var bind = _dereq_('../internals/function-bind-context');
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var anObject = _dereq_('../internals/an-object');
- var speciesConstructor = _dereq_('../internals/species-constructor');
- var getMapIterator = _dereq_('../internals/get-map-iterator');
- var iterate = _dereq_('../internals/iterate');
- // `Map.prototype.filter` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- filter: function filter(callbackfn /* , thisArg */) {
- var map = anObject(this);
- var iterator = getMapIterator(map);
- var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- var newMap = new (speciesConstructor(map, getBuiltIn('Map')))();
- var setter = aCallable(newMap.set);
- iterate(iterator, function (key, value) {
- if (boundFunction(value, key, map)) call(setter, newMap, key, value);
- }, { AS_ENTRIES: true, IS_ITERATOR: true });
- return newMap;
- }
- });
- },{"../internals/a-callable":258,"../internals/an-object":263,"../internals/export":318,"../internals/function-bind-context":322,"../internals/function-call":325,"../internals/get-built-in":328,"../internals/get-map-iterator":331,"../internals/iterate":356,"../internals/species-constructor":405}],514:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var anObject = _dereq_('../internals/an-object');
- var bind = _dereq_('../internals/function-bind-context');
- var getMapIterator = _dereq_('../internals/get-map-iterator');
- var iterate = _dereq_('../internals/iterate');
- // `Map.prototype.findKey` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- findKey: function findKey(callbackfn /* , thisArg */) {
- var map = anObject(this);
- var iterator = getMapIterator(map);
- var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- return iterate(iterator, function (key, value, stop) {
- if (boundFunction(value, key, map)) return stop(key);
- }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result;
- }
- });
- },{"../internals/an-object":263,"../internals/export":318,"../internals/function-bind-context":322,"../internals/get-map-iterator":331,"../internals/iterate":356}],515:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var anObject = _dereq_('../internals/an-object');
- var bind = _dereq_('../internals/function-bind-context');
- var getMapIterator = _dereq_('../internals/get-map-iterator');
- var iterate = _dereq_('../internals/iterate');
- // `Map.prototype.find` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- find: function find(callbackfn /* , thisArg */) {
- var map = anObject(this);
- var iterator = getMapIterator(map);
- var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- return iterate(iterator, function (key, value, stop) {
- if (boundFunction(value, key, map)) return stop(value);
- }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result;
- }
- });
- },{"../internals/an-object":263,"../internals/export":318,"../internals/function-bind-context":322,"../internals/get-map-iterator":331,"../internals/iterate":356}],516:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var from = _dereq_('../internals/collection-from');
- // `Map.from` method
- // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
- $({ target: 'Map', stat: true, forced: true }, {
- from: from
- });
- },{"../internals/collection-from":283,"../internals/export":318}],517:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var call = _dereq_('../internals/function-call');
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
- var aCallable = _dereq_('../internals/a-callable');
- var getIterator = _dereq_('../internals/get-iterator');
- var iterate = _dereq_('../internals/iterate');
- var push = uncurryThis([].push);
- // `Map.groupBy` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', stat: true, forced: true }, {
- groupBy: function groupBy(iterable, keyDerivative) {
- aCallable(keyDerivative);
- var iterator = getIterator(iterable);
- var newMap = new this();
- var has = aCallable(newMap.has);
- var get = aCallable(newMap.get);
- var set = aCallable(newMap.set);
- iterate(iterator, function (element) {
- var derivedKey = keyDerivative(element);
- if (!call(has, newMap, derivedKey)) call(set, newMap, derivedKey, [element]);
- else push(call(get, newMap, derivedKey), element);
- }, { IS_ITERATOR: true });
- return newMap;
- }
- });
- },{"../internals/a-callable":258,"../internals/export":318,"../internals/function-call":325,"../internals/function-uncurry-this":327,"../internals/get-iterator":330,"../internals/iterate":356}],518:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var anObject = _dereq_('../internals/an-object');
- var getMapIterator = _dereq_('../internals/get-map-iterator');
- var sameValueZero = _dereq_('../internals/same-value-zero');
- var iterate = _dereq_('../internals/iterate');
- // `Map.prototype.includes` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- includes: function includes(searchElement) {
- return iterate(getMapIterator(anObject(this)), function (key, value, stop) {
- if (sameValueZero(value, searchElement)) return stop();
- }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped;
- }
- });
- },{"../internals/an-object":263,"../internals/export":318,"../internals/get-map-iterator":331,"../internals/iterate":356,"../internals/same-value-zero":398}],519:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var call = _dereq_('../internals/function-call');
- var iterate = _dereq_('../internals/iterate');
- var aCallable = _dereq_('../internals/a-callable');
- // `Map.keyBy` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', stat: true, forced: true }, {
- keyBy: function keyBy(iterable, keyDerivative) {
- var newMap = new this();
- aCallable(keyDerivative);
- var setter = aCallable(newMap.set);
- iterate(iterable, function (element) {
- call(setter, newMap, keyDerivative(element), element);
- });
- return newMap;
- }
- });
- },{"../internals/a-callable":258,"../internals/export":318,"../internals/function-call":325,"../internals/iterate":356}],520:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var anObject = _dereq_('../internals/an-object');
- var getMapIterator = _dereq_('../internals/get-map-iterator');
- var iterate = _dereq_('../internals/iterate');
- // `Map.prototype.keyOf` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- keyOf: function keyOf(searchElement) {
- return iterate(getMapIterator(anObject(this)), function (key, value, stop) {
- if (value === searchElement) return stop(key);
- }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result;
- }
- });
- },{"../internals/an-object":263,"../internals/export":318,"../internals/get-map-iterator":331,"../internals/iterate":356}],521:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var bind = _dereq_('../internals/function-bind-context');
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var anObject = _dereq_('../internals/an-object');
- var speciesConstructor = _dereq_('../internals/species-constructor');
- var getMapIterator = _dereq_('../internals/get-map-iterator');
- var iterate = _dereq_('../internals/iterate');
- // `Map.prototype.mapKeys` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- mapKeys: function mapKeys(callbackfn /* , thisArg */) {
- var map = anObject(this);
- var iterator = getMapIterator(map);
- var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- var newMap = new (speciesConstructor(map, getBuiltIn('Map')))();
- var setter = aCallable(newMap.set);
- iterate(iterator, function (key, value) {
- call(setter, newMap, boundFunction(value, key, map), value);
- }, { AS_ENTRIES: true, IS_ITERATOR: true });
- return newMap;
- }
- });
- },{"../internals/a-callable":258,"../internals/an-object":263,"../internals/export":318,"../internals/function-bind-context":322,"../internals/function-call":325,"../internals/get-built-in":328,"../internals/get-map-iterator":331,"../internals/iterate":356,"../internals/species-constructor":405}],522:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var getBuiltIn = _dereq_('../internals/get-built-in');
- var bind = _dereq_('../internals/function-bind-context');
- var call = _dereq_('../internals/function-call');
- var aCallable = _dereq_('../internals/a-callable');
- var anObject = _dereq_('../internals/an-object');
- var speciesConstructor = _dereq_('../internals/species-constructor');
- var getMapIterator = _dereq_('../internals/get-map-iterator');
- var iterate = _dereq_('../internals/iterate');
- // `Map.prototype.mapValues` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- mapValues: function mapValues(callbackfn /* , thisArg */) {
- var map = anObject(this);
- var iterator = getMapIterator(map);
- var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- var newMap = new (speciesConstructor(map, getBuiltIn('Map')))();
- var setter = aCallable(newMap.set);
- iterate(iterator, function (key, value) {
- call(setter, newMap, key, boundFunction(value, key, map));
- }, { AS_ENTRIES: true, IS_ITERATOR: true });
- return newMap;
- }
- });
- },{"../internals/a-callable":258,"../internals/an-object":263,"../internals/export":318,"../internals/function-bind-context":322,"../internals/function-call":325,"../internals/get-built-in":328,"../internals/get-map-iterator":331,"../internals/iterate":356,"../internals/species-constructor":405}],523:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var aCallable = _dereq_('../internals/a-callable');
- var anObject = _dereq_('../internals/an-object');
- var iterate = _dereq_('../internals/iterate');
- // `Map.prototype.merge` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, arity: 1, forced: true }, {
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- merge: function merge(iterable /* ...iterables */) {
- var map = anObject(this);
- var setter = aCallable(map.set);
- var argumentsLength = arguments.length;
- var i = 0;
- while (i < argumentsLength) {
- iterate(arguments[i++], setter, { that: map, AS_ENTRIES: true });
- }
- return map;
- }
- });
- },{"../internals/a-callable":258,"../internals/an-object":263,"../internals/export":318,"../internals/iterate":356}],524:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var of = _dereq_('../internals/collection-of');
- // `Map.of` method
- // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
- $({ target: 'Map', stat: true, forced: true }, {
- of: of
- });
- },{"../internals/collection-of":284,"../internals/export":318}],525:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var anObject = _dereq_('../internals/an-object');
- var aCallable = _dereq_('../internals/a-callable');
- var getMapIterator = _dereq_('../internals/get-map-iterator');
- var iterate = _dereq_('../internals/iterate');
- var $TypeError = TypeError;
- // `Map.prototype.reduce` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- reduce: function reduce(callbackfn /* , initialValue */) {
- var map = anObject(this);
- var iterator = getMapIterator(map);
- var noInitial = arguments.length < 2;
- var accumulator = noInitial ? undefined : arguments[1];
- aCallable(callbackfn);
- iterate(iterator, function (key, value) {
- if (noInitial) {
- noInitial = false;
- accumulator = value;
- } else {
- accumulator = callbackfn(accumulator, value, key, map);
- }
- }, { AS_ENTRIES: true, IS_ITERATOR: true });
- if (noInitial) throw $TypeError('Reduce of empty map with no initial value');
- return accumulator;
- }
- });
- },{"../internals/a-callable":258,"../internals/an-object":263,"../internals/export":318,"../internals/get-map-iterator":331,"../internals/iterate":356}],526:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var anObject = _dereq_('../internals/an-object');
- var bind = _dereq_('../internals/function-bind-context');
- var getMapIterator = _dereq_('../internals/get-map-iterator');
- var iterate = _dereq_('../internals/iterate');
- // `Set.prototype.some` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- some: function some(callbackfn /* , thisArg */) {
- var map = anObject(this);
- var iterator = getMapIterator(map);
- var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- return iterate(iterator, function (key, value, stop) {
- if (boundFunction(value, key, map)) return stop();
- }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped;
- }
- });
- },{"../internals/an-object":263,"../internals/export":318,"../internals/function-bind-context":322,"../internals/get-map-iterator":331,"../internals/iterate":356}],527:[function(_dereq_,module,exports){
- 'use strict';
- // TODO: remove from `core-js@4`
- var $ = _dereq_('../internals/export');
- var upsert = _dereq_('../internals/map-upsert');
- // `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.emplace`)
- // https://github.com/thumbsupep/proposal-upsert
- $({ target: 'Map', proto: true, real: true, name: 'upsert', forced: true }, {
- updateOrInsert: upsert
- });
- },{"../internals/export":318,"../internals/map-upsert":364}],528:[function(_dereq_,module,exports){
- 'use strict';
- var $ = _dereq_('../internals/export');
- var call = _dereq_('../internals/function-call');
- var anObject = _dereq_('../internals/an-object');
- var aCallable = _dereq_('../internals/a-callable');
- var $TypeError = TypeError;
- // `Set.prototype.update` method
- // https://github.com/tc39/proposal-collection-methods
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- update: function update(key, callback /* , thunk */) {
- var map = anObject(this);
- var get = aCallable(map.get);
- var has = aCallable(map.has);
- var set = aCallable(map.set);
- var length = arguments.length;
- aCallable(callback);
- var isPresentInMap = call(has, map, key);
- if (!isPresentInMap && length < 3) {
- throw $TypeError('Updating absent value');
- }
- var value = isPresentInMap ? call(get, map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map);
- call(set, map, key, callback(value, key, map));
- return map;
- }
- });
- },{"../internals/a-callable":258,"../internals/an-object":263,"../internals/export":318,"../internals/function-call":325}],529:[function(_dereq_,module,exports){
- 'use strict';
- // TODO: remove from `core-js@4`
- var $ = _dereq_('../internals/export');
- var upsert = _dereq_('../internals/map-upsert');
- // `Map.prototype.upsert` method (replaced by `Map.prototype.emplace`)
- // https://github.com/thumbsupep/proposal-upsert
- $({ target: 'Map', proto: true, real: true, forced: true }, {
- upsert: upsert
- });
- },{"../internals/export":318,"../internals/map-upsert":364}],530:[function(_dereq_,module,exports){
- // TODO: Remove from `core-js@4`
- _dereq_('../modules/es.promise.all-settled.js');
- },{"../modules/es.promise.all-settled.js":471}],531:[function(_dereq_,module,exports){
- // TODO: Remove from `core-js@4`
- _dereq_('../modules/es.promise.any');
- },{"../modules/es.promise.any":473}],532:[function(_dereq_,module,exports){
- 'use strict';
- // TODO: Remove from `core-js@4`
- var $ = _dereq_('../internals/export');
- var newPromiseCapabilityModule = _dereq_('../internals/new-promise-capability');
- var perform = _dereq_('../internals/perform');
- // `Promise.try` method
- // https://github.com/tc39/proposal-promise-try
- $({ target: 'Promise', stat: true, forced: true }, {
- 'try': function (callbackfn) {
- var promiseCapability = newPromiseCapabilityModule.f(this);
- var result = perform(callbackfn);
- (result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value);
- return promiseCapability.promise;
- }
- });
- },{"../internals/export":318,"../internals/new-promise-capability":367,"../internals/perform":391}],533:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.asyncDispose` well-known symbol
- // https://github.com/tc39/proposal-using-statement
- defineWellKnownSymbol('asyncDispose');
- },{"../internals/well-known-symbol-define":427}],534:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.dispose` well-known symbol
- // https://github.com/tc39/proposal-using-statement
- defineWellKnownSymbol('dispose');
- },{"../internals/well-known-symbol-define":427}],535:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.matcher` well-known symbol
- // https://github.com/tc39/proposal-pattern-matching
- defineWellKnownSymbol('matcher');
- },{"../internals/well-known-symbol-define":427}],536:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.metadataKey` well-known symbol
- // https://github.com/tc39/proposal-decorator-metadata
- defineWellKnownSymbol('metadataKey');
- },{"../internals/well-known-symbol-define":427}],537:[function(_dereq_,module,exports){
- // TODO: Remove from `core-js@4`
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.metadata` well-known symbol
- // https://github.com/tc39/proposal-decorators
- defineWellKnownSymbol('metadata');
- },{"../internals/well-known-symbol-define":427}],538:[function(_dereq_,module,exports){
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.observable` well-known symbol
- // https://github.com/tc39/proposal-observable
- defineWellKnownSymbol('observable');
- },{"../internals/well-known-symbol-define":427}],539:[function(_dereq_,module,exports){
- // TODO: remove from `core-js@4`
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- // `Symbol.patternMatch` well-known symbol
- // https://github.com/tc39/proposal-pattern-matching
- defineWellKnownSymbol('patternMatch');
- },{"../internals/well-known-symbol-define":427}],540:[function(_dereq_,module,exports){
- // TODO: remove from `core-js@4`
- var defineWellKnownSymbol = _dereq_('../internals/well-known-symbol-define');
- defineWellKnownSymbol('replaceAll');
- },{"../internals/well-known-symbol-define":427}],541:[function(_dereq_,module,exports){
- _dereq_('../modules/es.array.iterator');
- var DOMIterables = _dereq_('../internals/dom-iterables');
- var global = _dereq_('../internals/global');
- var classof = _dereq_('../internals/classof');
- var createNonEnumerableProperty = _dereq_('../internals/create-non-enumerable-property');
- var Iterators = _dereq_('../internals/iterators');
- var wellKnownSymbol = _dereq_('../internals/well-known-symbol');
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- for (var COLLECTION_NAME in DOMIterables) {
- var Collection = global[COLLECTION_NAME];
- var CollectionPrototype = Collection && Collection.prototype;
- if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
- createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
- }
- Iterators[COLLECTION_NAME] = Iterators.Array;
- }
- },{"../internals/classof":281,"../internals/create-non-enumerable-property":292,"../internals/dom-iterables":302,"../internals/global":333,"../internals/iterators":361,"../internals/well-known-symbol":429,"../modules/es.array.iterator":443}],542:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var global = _dereq_('../internals/global');
- var setInterval = _dereq_('../internals/schedulers-fix').setInterval;
- // ie9- setInterval additional parameters fix
- // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
- $({ global: true, bind: true, forced: global.setInterval !== setInterval }, {
- setInterval: setInterval
- });
- },{"../internals/export":318,"../internals/global":333,"../internals/schedulers-fix":399}],543:[function(_dereq_,module,exports){
- var $ = _dereq_('../internals/export');
- var global = _dereq_('../internals/global');
- var setTimeout = _dereq_('../internals/schedulers-fix').setTimeout;
- // ie9- setTimeout additional parameters fix
- // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout
- $({ global: true, bind: true, forced: global.setTimeout !== setTimeout }, {
- setTimeout: setTimeout
- });
- },{"../internals/export":318,"../internals/global":333,"../internals/schedulers-fix":399}],544:[function(_dereq_,module,exports){
- // TODO: Remove this module from `core-js@4` since it's split to modules listed below
- _dereq_('../modules/web.set-interval');
- _dereq_('../modules/web.set-timeout');
- },{"../modules/web.set-interval":542,"../modules/web.set-timeout":543}],545:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/array/from');
- module.exports = parent;
- },{"../../es/array/from":163}],546:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/array/is-array');
- module.exports = parent;
- },{"../../es/array/is-array":164}],547:[function(_dereq_,module,exports){
- var parent = _dereq_('../../../es/array/virtual/entries');
- module.exports = parent;
- },{"../../../es/array/virtual/entries":166}],548:[function(_dereq_,module,exports){
- var parent = _dereq_('../../../es/array/virtual/for-each');
- module.exports = parent;
- },{"../../../es/array/virtual/for-each":171}],549:[function(_dereq_,module,exports){
- var parent = _dereq_('../../../es/array/virtual/keys');
- module.exports = parent;
- },{"../../../es/array/virtual/keys":174}],550:[function(_dereq_,module,exports){
- var parent = _dereq_('../../../es/array/virtual/values');
- module.exports = parent;
- },{"../../../es/array/virtual/values":181}],551:[function(_dereq_,module,exports){
- var parent = _dereq_('../es/get-iterator-method');
- _dereq_('../modules/web.dom-collections.iterator');
- module.exports = parent;
- },{"../es/get-iterator-method":183,"../modules/web.dom-collections.iterator":541}],552:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/bind');
- module.exports = parent;
- },{"../../es/instance/bind":184}],553:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/concat');
- module.exports = parent;
- },{"../../es/instance/concat":185}],554:[function(_dereq_,module,exports){
- _dereq_('../../modules/web.dom-collections.iterator');
- var classof = _dereq_('../../internals/classof');
- var hasOwn = _dereq_('../../internals/has-own-property');
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/entries');
- var ArrayPrototype = Array.prototype;
- var DOMIterables = {
- DOMTokenList: true,
- NodeList: true
- };
- module.exports = function (it) {
- var own = it.entries;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.entries)
- || hasOwn(DOMIterables, classof(it)) ? method : own;
- };
- },{"../../internals/classof":281,"../../internals/has-own-property":334,"../../internals/object-is-prototype-of":381,"../../modules/web.dom-collections.iterator":541,"../array/virtual/entries":547}],555:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/every');
- module.exports = parent;
- },{"../../es/instance/every":186}],556:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/filter');
- module.exports = parent;
- },{"../../es/instance/filter":187}],557:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/find-index');
- module.exports = parent;
- },{"../../es/instance/find-index":188}],558:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/find');
- module.exports = parent;
- },{"../../es/instance/find":189}],559:[function(_dereq_,module,exports){
- _dereq_('../../modules/web.dom-collections.iterator');
- var classof = _dereq_('../../internals/classof');
- var hasOwn = _dereq_('../../internals/has-own-property');
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/for-each');
- var ArrayPrototype = Array.prototype;
- var DOMIterables = {
- DOMTokenList: true,
- NodeList: true
- };
- module.exports = function (it) {
- var own = it.forEach;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.forEach)
- || hasOwn(DOMIterables, classof(it)) ? method : own;
- };
- },{"../../internals/classof":281,"../../internals/has-own-property":334,"../../internals/object-is-prototype-of":381,"../../modules/web.dom-collections.iterator":541,"../array/virtual/for-each":548}],560:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/includes');
- module.exports = parent;
- },{"../../es/instance/includes":190}],561:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/index-of');
- module.exports = parent;
- },{"../../es/instance/index-of":191}],562:[function(_dereq_,module,exports){
- _dereq_('../../modules/web.dom-collections.iterator');
- var classof = _dereq_('../../internals/classof');
- var hasOwn = _dereq_('../../internals/has-own-property');
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/keys');
- var ArrayPrototype = Array.prototype;
- var DOMIterables = {
- DOMTokenList: true,
- NodeList: true
- };
- module.exports = function (it) {
- var own = it.keys;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys)
- || hasOwn(DOMIterables, classof(it)) ? method : own;
- };
- },{"../../internals/classof":281,"../../internals/has-own-property":334,"../../internals/object-is-prototype-of":381,"../../modules/web.dom-collections.iterator":541,"../array/virtual/keys":549}],563:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/map');
- module.exports = parent;
- },{"../../es/instance/map":192}],564:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/reduce');
- module.exports = parent;
- },{"../../es/instance/reduce":193}],565:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/reverse');
- module.exports = parent;
- },{"../../es/instance/reverse":194}],566:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/slice');
- module.exports = parent;
- },{"../../es/instance/slice":195}],567:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/sort');
- module.exports = parent;
- },{"../../es/instance/sort":196}],568:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/splice');
- module.exports = parent;
- },{"../../es/instance/splice":197}],569:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/instance/starts-with');
- module.exports = parent;
- },{"../../es/instance/starts-with":198}],570:[function(_dereq_,module,exports){
- _dereq_('../../modules/web.dom-collections.iterator');
- var classof = _dereq_('../../internals/classof');
- var hasOwn = _dereq_('../../internals/has-own-property');
- var isPrototypeOf = _dereq_('../../internals/object-is-prototype-of');
- var method = _dereq_('../array/virtual/values');
- var ArrayPrototype = Array.prototype;
- var DOMIterables = {
- DOMTokenList: true,
- NodeList: true
- };
- module.exports = function (it) {
- var own = it.values;
- return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.values)
- || hasOwn(DOMIterables, classof(it)) ? method : own;
- };
- },{"../../internals/classof":281,"../../internals/has-own-property":334,"../../internals/object-is-prototype-of":381,"../../modules/web.dom-collections.iterator":541,"../array/virtual/values":550}],571:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/json/stringify');
- module.exports = parent;
- },{"../../es/json/stringify":199}],572:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/map');
- _dereq_('../../modules/web.dom-collections.iterator');
- module.exports = parent;
- },{"../../es/map":200,"../../modules/web.dom-collections.iterator":541}],573:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/number/is-integer');
- module.exports = parent;
- },{"../../es/number/is-integer":201}],574:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/assign');
- module.exports = parent;
- },{"../../es/object/assign":202}],575:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/create');
- module.exports = parent;
- },{"../../es/object/create":203}],576:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/define-properties');
- module.exports = parent;
- },{"../../es/object/define-properties":204}],577:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/define-property');
- module.exports = parent;
- },{"../../es/object/define-property":205}],578:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/entries');
- module.exports = parent;
- },{"../../es/object/entries":206}],579:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/freeze');
- module.exports = parent;
- },{"../../es/object/freeze":207}],580:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/get-own-property-descriptor');
- module.exports = parent;
- },{"../../es/object/get-own-property-descriptor":208}],581:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/get-own-property-descriptors');
- module.exports = parent;
- },{"../../es/object/get-own-property-descriptors":209}],582:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/get-own-property-symbols');
- module.exports = parent;
- },{"../../es/object/get-own-property-symbols":210}],583:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/get-prototype-of');
- module.exports = parent;
- },{"../../es/object/get-prototype-of":211}],584:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/keys');
- module.exports = parent;
- },{"../../es/object/keys":212}],585:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/object/set-prototype-of');
- module.exports = parent;
- },{"../../es/object/set-prototype-of":213}],586:[function(_dereq_,module,exports){
- var parent = _dereq_('../es/parse-int');
- module.exports = parent;
- },{"../es/parse-int":214}],587:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/promise');
- _dereq_('../../modules/web.dom-collections.iterator');
- module.exports = parent;
- },{"../../es/promise":215,"../../modules/web.dom-collections.iterator":541}],588:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/reflect/construct');
- module.exports = parent;
- },{"../../es/reflect/construct":216}],589:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/reflect/get');
- module.exports = parent;
- },{"../../es/reflect/get":217}],590:[function(_dereq_,module,exports){
- _dereq_('../modules/web.timers');
- var path = _dereq_('../internals/path');
- module.exports = path.setInterval;
- },{"../internals/path":390,"../modules/web.timers":544}],591:[function(_dereq_,module,exports){
- _dereq_('../modules/web.timers');
- var path = _dereq_('../internals/path');
- module.exports = path.setTimeout;
- },{"../internals/path":390,"../modules/web.timers":544}],592:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/set');
- _dereq_('../../modules/web.dom-collections.iterator');
- module.exports = parent;
- },{"../../es/set":218,"../../modules/web.dom-collections.iterator":541}],593:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/symbol');
- _dereq_('../../modules/web.dom-collections.iterator');
- module.exports = parent;
- },{"../../es/symbol":221,"../../modules/web.dom-collections.iterator":541}],594:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/symbol/iterator');
- _dereq_('../../modules/web.dom-collections.iterator');
- module.exports = parent;
- },{"../../es/symbol/iterator":222,"../../modules/web.dom-collections.iterator":541}],595:[function(_dereq_,module,exports){
- var parent = _dereq_('../../es/weak-map');
- _dereq_('../../modules/web.dom-collections.iterator');
- module.exports = parent;
- },{"../../es/weak-map":223,"../../modules/web.dom-collections.iterator":541}],596:[function(_dereq_,module,exports){
- ;(function (root, factory, undef) {
- if (typeof exports === "object") {
- // CommonJS
- module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core"));
- }
- else if (typeof define === "function" && define.amd) {
- // AMD
- define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
- }
- else {
- // Global (browser)
- factory(root.CryptoJS);
- }
- }(this, function (CryptoJS) {
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var BlockCipher = C_lib.BlockCipher;
- var C_algo = C.algo;
- // Lookup tables
- var SBOX = [];
- var INV_SBOX = [];
- var SUB_MIX_0 = [];
- var SUB_MIX_1 = [];
- var SUB_MIX_2 = [];
- var SUB_MIX_3 = [];
- var INV_SUB_MIX_0 = [];
- var INV_SUB_MIX_1 = [];
- var INV_SUB_MIX_2 = [];
- var INV_SUB_MIX_3 = [];
- // Compute lookup tables
- (function () {
- // Compute double table
- var d = [];
- for (var i = 0; i < 256; i++) {
- if (i < 128) {
- d[i] = i << 1;
- } else {
- d[i] = (i << 1) ^ 0x11b;
- }
- }
- // Walk GF(2^8)
- var x = 0;
- var xi = 0;
- for (var i = 0; i < 256; i++) {
- // Compute sbox
- var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
- sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
- SBOX[x] = sx;
- INV_SBOX[sx] = x;
- // Compute multiplication
- var x2 = d[x];
- var x4 = d[x2];
- var x8 = d[x4];
- // Compute sub bytes, mix columns tables
- var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
- SUB_MIX_0[x] = (t << 24) | (t >>> 8);
- SUB_MIX_1[x] = (t << 16) | (t >>> 16);
- SUB_MIX_2[x] = (t << 8) | (t >>> 24);
- SUB_MIX_3[x] = t;
- // Compute inv sub bytes, inv mix columns tables
- var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
- INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
- INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
- INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
- INV_SUB_MIX_3[sx] = t;
- // Compute next counter
- if (!x) {
- x = xi = 1;
- } else {
- x = x2 ^ d[d[d[x8 ^ x2]]];
- xi ^= d[d[xi]];
- }
- }
- }());
- // Precomputed Rcon lookup
- var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
- /**
- * AES block cipher algorithm.
- */
- var AES = C_algo.AES = BlockCipher.extend({
- _doReset: function () {
- var t;
- // Skip reset of nRounds has been set before and key did not change
- if (this._nRounds && this._keyPriorReset === this._key) {
- return;
- }
- // Shortcuts
- var key = this._keyPriorReset = this._key;
- var keyWords = key.words;
- var keySize = key.sigBytes / 4;
- // Compute number of rounds
- var nRounds = this._nRounds = keySize + 6;
- // Compute number of key schedule rows
- var ksRows = (nRounds + 1) * 4;
- // Compute key schedule
- var keySchedule = this._keySchedule = [];
- for (var ksRow = 0; ksRow < ksRows; ksRow++) {
- if (ksRow < keySize) {
- keySchedule[ksRow] = keyWords[ksRow];
- } else {
- t = keySchedule[ksRow - 1];
- if (!(ksRow % keySize)) {
- // Rot word
- t = (t << 8) | (t >>> 24);
- // Sub word
- t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
- // Mix Rcon
- t ^= RCON[(ksRow / keySize) | 0] << 24;
- } else if (keySize > 6 && ksRow % keySize == 4) {
- // Sub word
- t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
- }
- keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
- }
- }
- // Compute inv key schedule
- var invKeySchedule = this._invKeySchedule = [];
- for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
- var ksRow = ksRows - invKsRow;
- if (invKsRow % 4) {
- var t = keySchedule[ksRow];
- } else {
- var t = keySchedule[ksRow - 4];
- }
- if (invKsRow < 4 || ksRow <= 4) {
- invKeySchedule[invKsRow] = t;
- } else {
- invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
- INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
- }
- }
- },
- encryptBlock: function (M, offset) {
- this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
- },
- decryptBlock: function (M, offset) {
- // Swap 2nd and 4th rows
- var t = M[offset + 1];
- M[offset + 1] = M[offset + 3];
- M[offset + 3] = t;
- this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
- // Inv swap 2nd and 4th rows
- var t = M[offset + 1];
- M[offset + 1] = M[offset + 3];
- M[offset + 3] = t;
- },
- _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
- // Shortcut
- var nRounds = this._nRounds;
- // Get input, add round key
- var s0 = M[offset] ^ keySchedule[0];
- var s1 = M[offset + 1] ^ keySchedule[1];
- var s2 = M[offset + 2] ^ keySchedule[2];
- var s3 = M[offset + 3] ^ keySchedule[3];
- // Key schedule row counter
- var ksRow = 4;
- // Rounds
- for (var round = 1; round < nRounds; round++) {
- // Shift rows, sub bytes, mix columns, add round key
- var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
- var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
- var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
- var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
- // Update state
- s0 = t0;
- s1 = t1;
- s2 = t2;
- s3 = t3;
- }
- // Shift rows, sub bytes, add round key
- var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
- var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
- var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
- var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
- // Set output
- M[offset] = t0;
- M[offset + 1] = t1;
- M[offset + 2] = t2;
- M[offset + 3] = t3;
- },
- keySize: 256/32
- });
- /**
- * Shortcut functions to the cipher's object interface.
- *
- * @example
- *
- * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
- * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
- */
- C.AES = BlockCipher._createHelper(AES);
- }());
- return CryptoJS.AES;
- }));
- },{"./cipher-core":597,"./core":598,"./enc-base64":599,"./evpkdf":601,"./md5":603}],597:[function(_dereq_,module,exports){
- ;(function (root, factory, undef) {
- if (typeof exports === "object") {
- // CommonJS
- module.exports = exports = factory(_dereq_("./core"), _dereq_("./evpkdf"));
- }
- else if (typeof define === "function" && define.amd) {
- // AMD
- define(["./core", "./evpkdf"], factory);
- }
- else {
- // Global (browser)
- factory(root.CryptoJS);
- }
- }(this, function (CryptoJS) {
- /**
- * Cipher core components.
- */
- CryptoJS.lib.Cipher || (function (undefined) {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var Base = C_lib.Base;
- var WordArray = C_lib.WordArray;
- var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
- var C_enc = C.enc;
- var Utf8 = C_enc.Utf8;
- var Base64 = C_enc.Base64;
- var C_algo = C.algo;
- var EvpKDF = C_algo.EvpKDF;
- /**
- * Abstract base cipher template.
- *
- * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
- * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
- * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
- * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
- */
- var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
- /**
- * Configuration options.
- *
- * @property {WordArray} iv The IV to use for this operation.
- */
- cfg: Base.extend(),
- /**
- * Creates this cipher in encryption mode.
- *
- * @param {WordArray} key The key.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {Cipher} A cipher instance.
- *
- * @static
- *
- * @example
- *
- * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
- */
- createEncryptor: function (key, cfg) {
- return this.create(this._ENC_XFORM_MODE, key, cfg);
- },
- /**
- * Creates this cipher in decryption mode.
- *
- * @param {WordArray} key The key.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {Cipher} A cipher instance.
- *
- * @static
- *
- * @example
- *
- * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
- */
- createDecryptor: function (key, cfg) {
- return this.create(this._DEC_XFORM_MODE, key, cfg);
- },
- /**
- * Initializes a newly created cipher.
- *
- * @param {number} xformMode Either the encryption or decryption transormation mode constant.
- * @param {WordArray} key The key.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @example
- *
- * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
- */
- init: function (xformMode, key, cfg) {
- // Apply config defaults
- this.cfg = this.cfg.extend(cfg);
- // Store transform mode and key
- this._xformMode = xformMode;
- this._key = key;
- // Set initial values
- this.reset();
- },
- /**
- * Resets this cipher to its initial state.
- *
- * @example
- *
- * cipher.reset();
- */
- reset: function () {
- // Reset data buffer
- BufferedBlockAlgorithm.reset.call(this);
- // Perform concrete-cipher logic
- this._doReset();
- },
- /**
- * Adds data to be encrypted or decrypted.
- *
- * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
- *
- * @return {WordArray} The data after processing.
- *
- * @example
- *
- * var encrypted = cipher.process('data');
- * var encrypted = cipher.process(wordArray);
- */
- process: function (dataUpdate) {
- // Append
- this._append(dataUpdate);
- // Process available blocks
- return this._process();
- },
- /**
- * Finalizes the encryption or decryption process.
- * Note that the finalize operation is effectively a destructive, read-once operation.
- *
- * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
- *
- * @return {WordArray} The data after final processing.
- *
- * @example
- *
- * var encrypted = cipher.finalize();
- * var encrypted = cipher.finalize('data');
- * var encrypted = cipher.finalize(wordArray);
- */
- finalize: function (dataUpdate) {
- // Final data update
- if (dataUpdate) {
- this._append(dataUpdate);
- }
- // Perform concrete-cipher logic
- var finalProcessedData = this._doFinalize();
- return finalProcessedData;
- },
- keySize: 128/32,
- ivSize: 128/32,
- _ENC_XFORM_MODE: 1,
- _DEC_XFORM_MODE: 2,
- /**
- * Creates shortcut functions to a cipher's object interface.
- *
- * @param {Cipher} cipher The cipher to create a helper for.
- *
- * @return {Object} An object with encrypt and decrypt shortcut functions.
- *
- * @static
- *
- * @example
- *
- * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
- */
- _createHelper: (function () {
- function selectCipherStrategy(key) {
- if (typeof key == 'string') {
- return PasswordBasedCipher;
- } else {
- return SerializableCipher;
- }
- }
- return function (cipher) {
- return {
- encrypt: function (message, key, cfg) {
- return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
- },
- decrypt: function (ciphertext, key, cfg) {
- return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
- }
- };
- };
- }())
- });
- /**
- * Abstract base stream cipher template.
- *
- * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
- */
- var StreamCipher = C_lib.StreamCipher = Cipher.extend({
- _doFinalize: function () {
- // Process partial blocks
- var finalProcessedBlocks = this._process(!!'flush');
- return finalProcessedBlocks;
- },
- blockSize: 1
- });
- /**
- * Mode namespace.
- */
- var C_mode = C.mode = {};
- /**
- * Abstract base block cipher mode template.
- */
- var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
- /**
- * Creates this mode for encryption.
- *
- * @param {Cipher} cipher A block cipher instance.
- * @param {Array} iv The IV words.
- *
- * @static
- *
- * @example
- *
- * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
- */
- createEncryptor: function (cipher, iv) {
- return this.Encryptor.create(cipher, iv);
- },
- /**
- * Creates this mode for decryption.
- *
- * @param {Cipher} cipher A block cipher instance.
- * @param {Array} iv The IV words.
- *
- * @static
- *
- * @example
- *
- * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
- */
- createDecryptor: function (cipher, iv) {
- return this.Decryptor.create(cipher, iv);
- },
- /**
- * Initializes a newly created mode.
- *
- * @param {Cipher} cipher A block cipher instance.
- * @param {Array} iv The IV words.
- *
- * @example
- *
- * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
- */
- init: function (cipher, iv) {
- this._cipher = cipher;
- this._iv = iv;
- }
- });
- /**
- * Cipher Block Chaining mode.
- */
- var CBC = C_mode.CBC = (function () {
- /**
- * Abstract base CBC mode.
- */
- var CBC = BlockCipherMode.extend();
- /**
- * CBC encryptor.
- */
- CBC.Encryptor = CBC.extend({
- /**
- * Processes the data block at offset.
- *
- * @param {Array} words The data words to operate on.
- * @param {number} offset The offset where the block starts.
- *
- * @example
- *
- * mode.processBlock(data.words, offset);
- */
- processBlock: function (words, offset) {
- // Shortcuts
- var cipher = this._cipher;
- var blockSize = cipher.blockSize;
- // XOR and encrypt
- xorBlock.call(this, words, offset, blockSize);
- cipher.encryptBlock(words, offset);
- // Remember this block to use with next block
- this._prevBlock = words.slice(offset, offset + blockSize);
- }
- });
- /**
- * CBC decryptor.
- */
- CBC.Decryptor = CBC.extend({
- /**
- * Processes the data block at offset.
- *
- * @param {Array} words The data words to operate on.
- * @param {number} offset The offset where the block starts.
- *
- * @example
- *
- * mode.processBlock(data.words, offset);
- */
- processBlock: function (words, offset) {
- // Shortcuts
- var cipher = this._cipher;
- var blockSize = cipher.blockSize;
- // Remember this block to use with next block
- var thisBlock = words.slice(offset, offset + blockSize);
- // Decrypt and XOR
- cipher.decryptBlock(words, offset);
- xorBlock.call(this, words, offset, blockSize);
- // This block becomes the previous block
- this._prevBlock = thisBlock;
- }
- });
- function xorBlock(words, offset, blockSize) {
- var block;
- // Shortcut
- var iv = this._iv;
- // Choose mixing block
- if (iv) {
- block = iv;
- // Remove IV for subsequent blocks
- this._iv = undefined;
- } else {
- block = this._prevBlock;
- }
- // XOR blocks
- for (var i = 0; i < blockSize; i++) {
- words[offset + i] ^= block[i];
- }
- }
- return CBC;
- }());
- /**
- * Padding namespace.
- */
- var C_pad = C.pad = {};
- /**
- * PKCS #5/7 padding strategy.
- */
- var Pkcs7 = C_pad.Pkcs7 = {
- /**
- * Pads data using the algorithm defined in PKCS #5/7.
- *
- * @param {WordArray} data The data to pad.
- * @param {number} blockSize The multiple that the data should be padded to.
- *
- * @static
- *
- * @example
- *
- * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
- */
- pad: function (data, blockSize) {
- // Shortcut
- var blockSizeBytes = blockSize * 4;
- // Count padding bytes
- var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
- // Create padding word
- var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
- // Create padding
- var paddingWords = [];
- for (var i = 0; i < nPaddingBytes; i += 4) {
- paddingWords.push(paddingWord);
- }
- var padding = WordArray.create(paddingWords, nPaddingBytes);
- // Add padding
- data.concat(padding);
- },
- /**
- * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
- *
- * @param {WordArray} data The data to unpad.
- *
- * @static
- *
- * @example
- *
- * CryptoJS.pad.Pkcs7.unpad(wordArray);
- */
- unpad: function (data) {
- // Get number of padding bytes from last byte
- var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
- // Remove padding
- data.sigBytes -= nPaddingBytes;
- }
- };
- /**
- * Abstract base block cipher template.
- *
- * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
- */
- var BlockCipher = C_lib.BlockCipher = Cipher.extend({
- /**
- * Configuration options.
- *
- * @property {Mode} mode The block mode to use. Default: CBC
- * @property {Padding} padding The padding strategy to use. Default: Pkcs7
- */
- cfg: Cipher.cfg.extend({
- mode: CBC,
- padding: Pkcs7
- }),
- reset: function () {
- var modeCreator;
- // Reset cipher
- Cipher.reset.call(this);
- // Shortcuts
- var cfg = this.cfg;
- var iv = cfg.iv;
- var mode = cfg.mode;
- // Reset block mode
- if (this._xformMode == this._ENC_XFORM_MODE) {
- modeCreator = mode.createEncryptor;
- } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
- modeCreator = mode.createDecryptor;
- // Keep at least one block in the buffer for unpadding
- this._minBufferSize = 1;
- }
- if (this._mode && this._mode.__creator == modeCreator) {
- this._mode.init(this, iv && iv.words);
- } else {
- this._mode = modeCreator.call(mode, this, iv && iv.words);
- this._mode.__creator = modeCreator;
- }
- },
- _doProcessBlock: function (words, offset) {
- this._mode.processBlock(words, offset);
- },
- _doFinalize: function () {
- var finalProcessedBlocks;
- // Shortcut
- var padding = this.cfg.padding;
- // Finalize
- if (this._xformMode == this._ENC_XFORM_MODE) {
- // Pad data
- padding.pad(this._data, this.blockSize);
- // Process final blocks
- finalProcessedBlocks = this._process(!!'flush');
- } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
- // Process final blocks
- finalProcessedBlocks = this._process(!!'flush');
- // Unpad data
- padding.unpad(finalProcessedBlocks);
- }
- return finalProcessedBlocks;
- },
- blockSize: 128/32
- });
- /**
- * A collection of cipher parameters.
- *
- * @property {WordArray} ciphertext The raw ciphertext.
- * @property {WordArray} key The key to this ciphertext.
- * @property {WordArray} iv The IV used in the ciphering operation.
- * @property {WordArray} salt The salt used with a key derivation function.
- * @property {Cipher} algorithm The cipher algorithm.
- * @property {Mode} mode The block mode used in the ciphering operation.
- * @property {Padding} padding The padding scheme used in the ciphering operation.
- * @property {number} blockSize The block size of the cipher.
- * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
- */
- var CipherParams = C_lib.CipherParams = Base.extend({
- /**
- * Initializes a newly created cipher params object.
- *
- * @param {Object} cipherParams An object with any of the possible cipher parameters.
- *
- * @example
- *
- * var cipherParams = CryptoJS.lib.CipherParams.create({
- * ciphertext: ciphertextWordArray,
- * key: keyWordArray,
- * iv: ivWordArray,
- * salt: saltWordArray,
- * algorithm: CryptoJS.algo.AES,
- * mode: CryptoJS.mode.CBC,
- * padding: CryptoJS.pad.PKCS7,
- * blockSize: 4,
- * formatter: CryptoJS.format.OpenSSL
- * });
- */
- init: function (cipherParams) {
- this.mixIn(cipherParams);
- },
- /**
- * Converts this cipher params object to a string.
- *
- * @param {Format} formatter (Optional) The formatting strategy to use.
- *
- * @return {string} The stringified cipher params.
- *
- * @throws Error If neither the formatter nor the default formatter is set.
- *
- * @example
- *
- * var string = cipherParams + '';
- * var string = cipherParams.toString();
- * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
- */
- toString: function (formatter) {
- return (formatter || this.formatter).stringify(this);
- }
- });
- /**
- * Format namespace.
- */
- var C_format = C.format = {};
- /**
- * OpenSSL formatting strategy.
- */
- var OpenSSLFormatter = C_format.OpenSSL = {
- /**
- * Converts a cipher params object to an OpenSSL-compatible string.
- *
- * @param {CipherParams} cipherParams The cipher params object.
- *
- * @return {string} The OpenSSL-compatible string.
- *
- * @static
- *
- * @example
- *
- * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
- */
- stringify: function (cipherParams) {
- var wordArray;
- // Shortcuts
- var ciphertext = cipherParams.ciphertext;
- var salt = cipherParams.salt;
- // Format
- if (salt) {
- wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
- } else {
- wordArray = ciphertext;
- }
- return wordArray.toString(Base64);
- },
- /**
- * Converts an OpenSSL-compatible string to a cipher params object.
- *
- * @param {string} openSSLStr The OpenSSL-compatible string.
- *
- * @return {CipherParams} The cipher params object.
- *
- * @static
- *
- * @example
- *
- * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
- */
- parse: function (openSSLStr) {
- var salt;
- // Parse base64
- var ciphertext = Base64.parse(openSSLStr);
- // Shortcut
- var ciphertextWords = ciphertext.words;
- // Test for salt
- if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
- // Extract salt
- salt = WordArray.create(ciphertextWords.slice(2, 4));
- // Remove salt from ciphertext
- ciphertextWords.splice(0, 4);
- ciphertext.sigBytes -= 16;
- }
- return CipherParams.create({ ciphertext: ciphertext, salt: salt });
- }
- };
- /**
- * A cipher wrapper that returns ciphertext as a serializable cipher params object.
- */
- var SerializableCipher = C_lib.SerializableCipher = Base.extend({
- /**
- * Configuration options.
- *
- * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
- */
- cfg: Base.extend({
- format: OpenSSLFormatter
- }),
- /**
- * Encrypts a message.
- *
- * @param {Cipher} cipher The cipher algorithm to use.
- * @param {WordArray|string} message The message to encrypt.
- * @param {WordArray} key The key.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {CipherParams} A cipher params object.
- *
- * @static
- *
- * @example
- *
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
- */
- encrypt: function (cipher, message, key, cfg) {
- // Apply config defaults
- cfg = this.cfg.extend(cfg);
- // Encrypt
- var encryptor = cipher.createEncryptor(key, cfg);
- var ciphertext = encryptor.finalize(message);
- // Shortcut
- var cipherCfg = encryptor.cfg;
- // Create and return serializable cipher params
- return CipherParams.create({
- ciphertext: ciphertext,
- key: key,
- iv: cipherCfg.iv,
- algorithm: cipher,
- mode: cipherCfg.mode,
- padding: cipherCfg.padding,
- blockSize: cipher.blockSize,
- formatter: cfg.format
- });
- },
- /**
- * Decrypts serialized ciphertext.
- *
- * @param {Cipher} cipher The cipher algorithm to use.
- * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
- * @param {WordArray} key The key.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {WordArray} The plaintext.
- *
- * @static
- *
- * @example
- *
- * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
- * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
- */
- decrypt: function (cipher, ciphertext, key, cfg) {
- // Apply config defaults
- cfg = this.cfg.extend(cfg);
- // Convert string to CipherParams
- ciphertext = this._parse(ciphertext, cfg.format);
- // Decrypt
- var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
- return plaintext;
- },
- /**
- * Converts serialized ciphertext to CipherParams,
- * else assumed CipherParams already and returns ciphertext unchanged.
- *
- * @param {CipherParams|string} ciphertext The ciphertext.
- * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
- *
- * @return {CipherParams} The unserialized ciphertext.
- *
- * @static
- *
- * @example
- *
- * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
- */
- _parse: function (ciphertext, format) {
- if (typeof ciphertext == 'string') {
- return format.parse(ciphertext, this);
- } else {
- return ciphertext;
- }
- }
- });
- /**
- * Key derivation function namespace.
- */
- var C_kdf = C.kdf = {};
- /**
- * OpenSSL key derivation function.
- */
- var OpenSSLKdf = C_kdf.OpenSSL = {
- /**
- * Derives a key and IV from a password.
- *
- * @param {string} password The password to derive from.
- * @param {number} keySize The size in words of the key to generate.
- * @param {number} ivSize The size in words of the IV to generate.
- * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
- *
- * @return {CipherParams} A cipher params object with the key, IV, and salt.
- *
- * @static
- *
- * @example
- *
- * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
- * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
- */
- execute: function (password, keySize, ivSize, salt) {
- // Generate random salt
- if (!salt) {
- salt = WordArray.random(64/8);
- }
- // Derive key and IV
- var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
- // Separate key and IV
- var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
- key.sigBytes = keySize * 4;
- // Return params
- return CipherParams.create({ key: key, iv: iv, salt: salt });
- }
- };
- /**
- * A serializable cipher wrapper that derives the key from a password,
- * and returns ciphertext as a serializable cipher params object.
- */
- var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
- /**
- * Configuration options.
- *
- * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
- */
- cfg: SerializableCipher.cfg.extend({
- kdf: OpenSSLKdf
- }),
- /**
- * Encrypts a message using a password.
- *
- * @param {Cipher} cipher The cipher algorithm to use.
- * @param {WordArray|string} message The message to encrypt.
- * @param {string} password The password.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {CipherParams} A cipher params object.
- *
- * @static
- *
- * @example
- *
- * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
- * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
- */
- encrypt: function (cipher, message, password, cfg) {
- // Apply config defaults
- cfg = this.cfg.extend(cfg);
- // Derive key and other params
- var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
- // Add IV to config
- cfg.iv = derivedParams.iv;
- // Encrypt
- var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
- // Mix in derived params
- ciphertext.mixIn(derivedParams);
- return ciphertext;
- },
- /**
- * Decrypts serialized ciphertext using a password.
- *
- * @param {Cipher} cipher The cipher algorithm to use.
- * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
- * @param {string} password The password.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {WordArray} The plaintext.
- *
- * @static
- *
- * @example
- *
- * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
- * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
- */
- decrypt: function (cipher, ciphertext, password, cfg) {
- // Apply config defaults
- cfg = this.cfg.extend(cfg);
- // Convert string to CipherParams
- ciphertext = this._parse(ciphertext, cfg.format);
- // Derive key and other params
- var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
- // Add IV to config
- cfg.iv = derivedParams.iv;
- // Decrypt
- var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
- return plaintext;
- }
- });
- }());
- }));
- },{"./core":598,"./evpkdf":601}],598:[function(_dereq_,module,exports){
- (function (global){(function (){
- ;(function (root, factory) {
- if (typeof exports === "object") {
- // CommonJS
- module.exports = exports = factory();
- }
- else if (typeof define === "function" && define.amd) {
- // AMD
- define([], factory);
- }
- else {
- // Global (browser)
- root.CryptoJS = factory();
- }
- }(this, function () {
- /*globals window, global, require*/
- /**
- * CryptoJS core components.
- */
- var CryptoJS = CryptoJS || (function (Math, undefined) {
- var crypto;
- // Native crypto from window (Browser)
- if (typeof window !== 'undefined' && window.crypto) {
- crypto = window.crypto;
- }
- // Native crypto in web worker (Browser)
- if (typeof self !== 'undefined' && self.crypto) {
- crypto = self.crypto;
- }
- // Native crypto from worker
- if (typeof globalThis !== 'undefined' && globalThis.crypto) {
- crypto = globalThis.crypto;
- }
- // Native (experimental IE 11) crypto from window (Browser)
- if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
- crypto = window.msCrypto;
- }
- // Native crypto from global (NodeJS)
- if (!crypto && typeof global !== 'undefined' && global.crypto) {
- crypto = global.crypto;
- }
- // Native crypto import via require (NodeJS)
- if (!crypto && typeof _dereq_ === 'function') {
- try {
- crypto = _dereq_('crypto');
- } catch (err) {}
- }
- /*
- * Cryptographically secure pseudorandom number generator
- *
- * As Math.random() is cryptographically not safe to use
- */
- var cryptoSecureRandomInt = function () {
- if (crypto) {
- // Use getRandomValues method (Browser)
- if (typeof crypto.getRandomValues === 'function') {
- try {
- return crypto.getRandomValues(new Uint32Array(1))[0];
- } catch (err) {}
- }
- // Use randomBytes method (NodeJS)
- if (typeof crypto.randomBytes === 'function') {
- try {
- return crypto.randomBytes(4).readInt32LE();
- } catch (err) {}
- }
- }
- throw new Error('Native crypto module could not be used to get secure random number.');
- };
- /*
- * Local polyfill of Object.create
- */
- var create = Object.create || (function () {
- function F() {}
- return function (obj) {
- var subtype;
- F.prototype = obj;
- subtype = new F();
- F.prototype = null;
- return subtype;
- };
- }());
- /**
- * CryptoJS namespace.
- */
- var C = {};
- /**
- * Library namespace.
- */
- var C_lib = C.lib = {};
- /**
- * Base object for prototypal inheritance.
- */
- var Base = C_lib.Base = (function () {
- return {
- /**
- * Creates a new object that inherits from this object.
- *
- * @param {Object} overrides Properties to copy into the new object.
- *
- * @return {Object} The new object.
- *
- * @static
- *
- * @example
- *
- * var MyType = CryptoJS.lib.Base.extend({
- * field: 'value',
- *
- * method: function () {
- * }
- * });
- */
- extend: function (overrides) {
- // Spawn
- var subtype = create(this);
- // Augment
- if (overrides) {
- subtype.mixIn(overrides);
- }
- // Create default initializer
- if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
- subtype.init = function () {
- subtype.$super.init.apply(this, arguments);
- };
- }
- // Initializer's prototype is the subtype object
- subtype.init.prototype = subtype;
- // Reference supertype
- subtype.$super = this;
- return subtype;
- },
- /**
- * Extends this object and runs the init method.
- * Arguments to create() will be passed to init().
- *
- * @return {Object} The new object.
- *
- * @static
- *
- * @example
- *
- * var instance = MyType.create();
- */
- create: function () {
- var instance = this.extend();
- instance.init.apply(instance, arguments);
- return instance;
- },
- /**
- * Initializes a newly created object.
- * Override this method to add some logic when your objects are created.
- *
- * @example
- *
- * var MyType = CryptoJS.lib.Base.extend({
- * init: function () {
- * // ...
- * }
- * });
- */
- init: function () {
- },
- /**
- * Copies properties into this object.
- *
- * @param {Object} properties The properties to mix in.
- *
- * @example
- *
- * MyType.mixIn({
- * field: 'value'
- * });
- */
- mixIn: function (properties) {
- for (var propertyName in properties) {
- if (properties.hasOwnProperty(propertyName)) {
- this[propertyName] = properties[propertyName];
- }
- }
- // IE won't copy toString using the loop above
- if (properties.hasOwnProperty('toString')) {
- this.toString = properties.toString;
- }
- },
- /**
- * Creates a copy of this object.
- *
- * @return {Object} The clone.
- *
- * @example
- *
- * var clone = instance.clone();
- */
- clone: function () {
- return this.init.prototype.extend(this);
- }
- };
- }());
- /**
- * An array of 32-bit words.
- *
- * @property {Array} words The array of 32-bit words.
- * @property {number} sigBytes The number of significant bytes in this word array.
- */
- var WordArray = C_lib.WordArray = Base.extend({
- /**
- * Initializes a newly created word array.
- *
- * @param {Array} words (Optional) An array of 32-bit words.
- * @param {number} sigBytes (Optional) The number of significant bytes in the words.
- *
- * @example
- *
- * var wordArray = CryptoJS.lib.WordArray.create();
- * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
- * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
- */
- init: function (words, sigBytes) {
- words = this.words = words || [];
- if (sigBytes != undefined) {
- this.sigBytes = sigBytes;
- } else {
- this.sigBytes = words.length * 4;
- }
- },
- /**
- * Converts this word array to a string.
- *
- * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
- *
- * @return {string} The stringified word array.
- *
- * @example
- *
- * var string = wordArray + '';
- * var string = wordArray.toString();
- * var string = wordArray.toString(CryptoJS.enc.Utf8);
- */
- toString: function (encoder) {
- return (encoder || Hex).stringify(this);
- },
- /**
- * Concatenates a word array to this word array.
- *
- * @param {WordArray} wordArray The word array to append.
- *
- * @return {WordArray} This word array.
- *
- * @example
- *
- * wordArray1.concat(wordArray2);
- */
- concat: function (wordArray) {
- // Shortcuts
- var thisWords = this.words;
- var thatWords = wordArray.words;
- var thisSigBytes = this.sigBytes;
- var thatSigBytes = wordArray.sigBytes;
- // Clamp excess bits
- this.clamp();
- // Concat
- if (thisSigBytes % 4) {
- // Copy one byte at a time
- for (var i = 0; i < thatSigBytes; i++) {
- var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
- thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
- }
- } else {
- // Copy one word at a time
- for (var j = 0; j < thatSigBytes; j += 4) {
- thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];
- }
- }
- this.sigBytes += thatSigBytes;
- // Chainable
- return this;
- },
- /**
- * Removes insignificant bits.
- *
- * @example
- *
- * wordArray.clamp();
- */
- clamp: function () {
- // Shortcuts
- var words = this.words;
- var sigBytes = this.sigBytes;
- // Clamp
- words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
- words.length = Math.ceil(sigBytes / 4);
- },
- /**
- * Creates a copy of this word array.
- *
- * @return {WordArray} The clone.
- *
- * @example
- *
- * var clone = wordArray.clone();
- */
- clone: function () {
- var clone = Base.clone.call(this);
- clone.words = this.words.slice(0);
- return clone;
- },
- /**
- * Creates a word array filled with random bytes.
- *
- * @param {number} nBytes The number of random bytes to generate.
- *
- * @return {WordArray} The random word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.lib.WordArray.random(16);
- */
- random: function (nBytes) {
- var words = [];
- for (var i = 0; i < nBytes; i += 4) {
- words.push(cryptoSecureRandomInt());
- }
- return new WordArray.init(words, nBytes);
- }
- });
- /**
- * Encoder namespace.
- */
- var C_enc = C.enc = {};
- /**
- * Hex encoding strategy.
- */
- var Hex = C_enc.Hex = {
- /**
- * Converts a word array to a hex string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The hex string.
- *
- * @static
- *
- * @example
- *
- * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
- */
- stringify: function (wordArray) {
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
- // Convert
- var hexChars = [];
- for (var i = 0; i < sigBytes; i++) {
- var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
- hexChars.push((bite >>> 4).toString(16));
- hexChars.push((bite & 0x0f).toString(16));
- }
- return hexChars.join('');
- },
- /**
- * Converts a hex string to a word array.
- *
- * @param {string} hexStr The hex string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Hex.parse(hexString);
- */
- parse: function (hexStr) {
- // Shortcut
- var hexStrLength = hexStr.length;
- // Convert
- var words = [];
- for (var i = 0; i < hexStrLength; i += 2) {
- words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
- }
- return new WordArray.init(words, hexStrLength / 2);
- }
- };
- /**
- * Latin1 encoding strategy.
- */
- var Latin1 = C_enc.Latin1 = {
- /**
- * Converts a word array to a Latin1 string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The Latin1 string.
- *
- * @static
- *
- * @example
- *
- * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
- */
- stringify: function (wordArray) {
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
- // Convert
- var latin1Chars = [];
- for (var i = 0; i < sigBytes; i++) {
- var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
- latin1Chars.push(String.fromCharCode(bite));
- }
- return latin1Chars.join('');
- },
- /**
- * Converts a Latin1 string to a word array.
- *
- * @param {string} latin1Str The Latin1 string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
- */
- parse: function (latin1Str) {
- // Shortcut
- var latin1StrLength = latin1Str.length;
- // Convert
- var words = [];
- for (var i = 0; i < latin1StrLength; i++) {
- words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
- }
- return new WordArray.init(words, latin1StrLength);
- }
- };
- /**
- * UTF-8 encoding strategy.
- */
- var Utf8 = C_enc.Utf8 = {
- /**
- * Converts a word array to a UTF-8 string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The UTF-8 string.
- *
- * @static
- *
- * @example
- *
- * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
- */
- stringify: function (wordArray) {
- try {
- return decodeURIComponent(escape(Latin1.stringify(wordArray)));
- } catch (e) {
- throw new Error('Malformed UTF-8 data');
- }
- },
- /**
- * Converts a UTF-8 string to a word array.
- *
- * @param {string} utf8Str The UTF-8 string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
- */
- parse: function (utf8Str) {
- return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
- }
- };
- /**
- * Abstract buffered block algorithm template.
- *
- * The property blockSize must be implemented in a concrete subtype.
- *
- * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
- */
- var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
- /**
- * Resets this block algorithm's data buffer to its initial state.
- *
- * @example
- *
- * bufferedBlockAlgorithm.reset();
- */
- reset: function () {
- // Initial values
- this._data = new WordArray.init();
- this._nDataBytes = 0;
- },
- /**
- * Adds new data to this block algorithm's buffer.
- *
- * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
- *
- * @example
- *
- * bufferedBlockAlgorithm._append('data');
- * bufferedBlockAlgorithm._append(wordArray);
- */
- _append: function (data) {
- // Convert string to WordArray, else assume WordArray already
- if (typeof data == 'string') {
- data = Utf8.parse(data);
- }
- // Append
- this._data.concat(data);
- this._nDataBytes += data.sigBytes;
- },
- /**
- * Processes available data blocks.
- *
- * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
- *
- * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
- *
- * @return {WordArray} The processed data.
- *
- * @example
- *
- * var processedData = bufferedBlockAlgorithm._process();
- * var processedData = bufferedBlockAlgorithm._process(!!'flush');
- */
- _process: function (doFlush) {
- var processedWords;
- // Shortcuts
- var data = this._data;
- var dataWords = data.words;
- var dataSigBytes = data.sigBytes;
- var blockSize = this.blockSize;
- var blockSizeBytes = blockSize * 4;
- // Count blocks ready
- var nBlocksReady = dataSigBytes / blockSizeBytes;
- if (doFlush) {
- // Round up to include partial blocks
- nBlocksReady = Math.ceil(nBlocksReady);
- } else {
- // Round down to include only full blocks,
- // less the number of blocks that must remain in the buffer
- nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
- }
- // Count words ready
- var nWordsReady = nBlocksReady * blockSize;
- // Count bytes ready
- var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
- // Process blocks
- if (nWordsReady) {
- for (var offset = 0; offset < nWordsReady; offset += blockSize) {
- // Perform concrete-algorithm logic
- this._doProcessBlock(dataWords, offset);
- }
- // Remove processed words
- processedWords = dataWords.splice(0, nWordsReady);
- data.sigBytes -= nBytesReady;
- }
- // Return processed words
- return new WordArray.init(processedWords, nBytesReady);
- },
- /**
- * Creates a copy of this object.
- *
- * @return {Object} The clone.
- *
- * @example
- *
- * var clone = bufferedBlockAlgorithm.clone();
- */
- clone: function () {
- var clone = Base.clone.call(this);
- clone._data = this._data.clone();
- return clone;
- },
- _minBufferSize: 0
- });
- /**
- * Abstract hasher template.
- *
- * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
- */
- var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
- /**
- * Configuration options.
- */
- cfg: Base.extend(),
- /**
- * Initializes a newly created hasher.
- *
- * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
- *
- * @example
- *
- * var hasher = CryptoJS.algo.SHA256.create();
- */
- init: function (cfg) {
- // Apply config defaults
- this.cfg = this.cfg.extend(cfg);
- // Set initial values
- this.reset();
- },
- /**
- * Resets this hasher to its initial state.
- *
- * @example
- *
- * hasher.reset();
- */
- reset: function () {
- // Reset data buffer
- BufferedBlockAlgorithm.reset.call(this);
- // Perform concrete-hasher logic
- this._doReset();
- },
- /**
- * Updates this hasher with a message.
- *
- * @param {WordArray|string} messageUpdate The message to append.
- *
- * @return {Hasher} This hasher.
- *
- * @example
- *
- * hasher.update('message');
- * hasher.update(wordArray);
- */
- update: function (messageUpdate) {
- // Append
- this._append(messageUpdate);
- // Update the hash
- this._process();
- // Chainable
- return this;
- },
- /**
- * Finalizes the hash computation.
- * Note that the finalize operation is effectively a destructive, read-once operation.
- *
- * @param {WordArray|string} messageUpdate (Optional) A final message update.
- *
- * @return {WordArray} The hash.
- *
- * @example
- *
- * var hash = hasher.finalize();
- * var hash = hasher.finalize('message');
- * var hash = hasher.finalize(wordArray);
- */
- finalize: function (messageUpdate) {
- // Final message update
- if (messageUpdate) {
- this._append(messageUpdate);
- }
- // Perform concrete-hasher logic
- var hash = this._doFinalize();
- return hash;
- },
- blockSize: 512/32,
- /**
- * Creates a shortcut function to a hasher's object interface.
- *
- * @param {Hasher} hasher The hasher to create a helper for.
- *
- * @return {Function} The shortcut function.
- *
- * @static
- *
- * @example
- *
- * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
- */
- _createHelper: function (hasher) {
- return function (message, cfg) {
- return new hasher.init(cfg).finalize(message);
- };
- },
- /**
- * Creates a shortcut function to the HMAC's object interface.
- *
- * @param {Hasher} hasher The hasher to use in this HMAC helper.
- *
- * @return {Function} The shortcut function.
- *
- * @static
- *
- * @example
- *
- * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
- */
- _createHmacHelper: function (hasher) {
- return function (message, key) {
- return new C_algo.HMAC.init(hasher, key).finalize(message);
- };
- }
- });
- /**
- * Algorithm namespace.
- */
- var C_algo = C.algo = {};
- return C;
- }(Math));
- return CryptoJS;
- }));
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{"crypto":undefined}],599:[function(_dereq_,module,exports){
- ;(function (root, factory) {
- if (typeof exports === "object") {
- // CommonJS
- module.exports = exports = factory(_dereq_("./core"));
- }
- else if (typeof define === "function" && define.amd) {
- // AMD
- define(["./core"], factory);
- }
- else {
- // Global (browser)
- factory(root.CryptoJS);
- }
- }(this, function (CryptoJS) {
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var C_enc = C.enc;
- /**
- * Base64 encoding strategy.
- */
- var Base64 = C_enc.Base64 = {
- /**
- * Converts a word array to a Base64 string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The Base64 string.
- *
- * @static
- *
- * @example
- *
- * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
- */
- stringify: function (wordArray) {
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
- var map = this._map;
- // Clamp excess bits
- wordArray.clamp();
- // Convert
- var base64Chars = [];
- for (var i = 0; i < sigBytes; i += 3) {
- var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
- var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
- var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
- var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
- for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
- base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
- }
- }
- // Add padding
- var paddingChar = map.charAt(64);
- if (paddingChar) {
- while (base64Chars.length % 4) {
- base64Chars.push(paddingChar);
- }
- }
- return base64Chars.join('');
- },
- /**
- * Converts a Base64 string to a word array.
- *
- * @param {string} base64Str The Base64 string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Base64.parse(base64String);
- */
- parse: function (base64Str) {
- // Shortcuts
- var base64StrLength = base64Str.length;
- var map = this._map;
- var reverseMap = this._reverseMap;
- if (!reverseMap) {
- reverseMap = this._reverseMap = [];
- for (var j = 0; j < map.length; j++) {
- reverseMap[map.charCodeAt(j)] = j;
- }
- }
- // Ignore padding
- var paddingChar = map.charAt(64);
- if (paddingChar) {
- var paddingIndex = base64Str.indexOf(paddingChar);
- if (paddingIndex !== -1) {
- base64StrLength = paddingIndex;
- }
- }
- // Convert
- return parseLoop(base64Str, base64StrLength, reverseMap);
- },
- _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
- };
- function parseLoop(base64Str, base64StrLength, reverseMap) {
- var words = [];
- var nBytes = 0;
- for (var i = 0; i < base64StrLength; i++) {
- if (i % 4) {
- var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
- var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
- var bitsCombined = bits1 | bits2;
- words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
- nBytes++;
- }
- }
- return WordArray.create(words, nBytes);
- }
- }());
- return CryptoJS.enc.Base64;
- }));
- },{"./core":598}],600:[function(_dereq_,module,exports){
- ;(function (root, factory) {
- if (typeof exports === "object") {
- // CommonJS
- module.exports = exports = factory(_dereq_("./core"));
- }
- else if (typeof define === "function" && define.amd) {
- // AMD
- define(["./core"], factory);
- }
- else {
- // Global (browser)
- factory(root.CryptoJS);
- }
- }(this, function (CryptoJS) {
- return CryptoJS.enc.Utf8;
- }));
- },{"./core":598}],601:[function(_dereq_,module,exports){
- ;(function (root, factory, undef) {
- if (typeof exports === "object") {
- // CommonJS
- module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac"));
- }
- else if (typeof define === "function" && define.amd) {
- // AMD
- define(["./core", "./sha1", "./hmac"], factory);
- }
- else {
- // Global (browser)
- factory(root.CryptoJS);
- }
- }(this, function (CryptoJS) {
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var Base = C_lib.Base;
- var WordArray = C_lib.WordArray;
- var C_algo = C.algo;
- var MD5 = C_algo.MD5;
- /**
- * This key derivation function is meant to conform with EVP_BytesToKey.
- * www.openssl.org/docs/crypto/EVP_BytesToKey.html
- */
- var EvpKDF = C_algo.EvpKDF = Base.extend({
- /**
- * Configuration options.
- *
- * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
- * @property {Hasher} hasher The hash algorithm to use. Default: MD5
- * @property {number} iterations The number of iterations to perform. Default: 1
- */
- cfg: Base.extend({
- keySize: 128/32,
- hasher: MD5,
- iterations: 1
- }),
- /**
- * Initializes a newly created key derivation function.
- *
- * @param {Object} cfg (Optional) The configuration options to use for the derivation.
- *
- * @example
- *
- * var kdf = CryptoJS.algo.EvpKDF.create();
- * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
- * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
- */
- init: function (cfg) {
- this.cfg = this.cfg.extend(cfg);
- },
- /**
- * Derives a key from a password.
- *
- * @param {WordArray|string} password The password.
- * @param {WordArray|string} salt A salt.
- *
- * @return {WordArray} The derived key.
- *
- * @example
- *
- * var key = kdf.compute(password, salt);
- */
- compute: function (password, salt) {
- var block;
- // Shortcut
- var cfg = this.cfg;
- // Init hasher
- var hasher = cfg.hasher.create();
- // Initial values
- var derivedKey = WordArray.create();
- // Shortcuts
- var derivedKeyWords = derivedKey.words;
- var keySize = cfg.keySize;
- var iterations = cfg.iterations;
- // Generate key
- while (derivedKeyWords.length < keySize) {
- if (block) {
- hasher.update(block);
- }
- block = hasher.update(password).finalize(salt);
- hasher.reset();
- // Iterations
- for (var i = 1; i < iterations; i++) {
- block = hasher.finalize(block);
- hasher.reset();
- }
- derivedKey.concat(block);
- }
- derivedKey.sigBytes = keySize * 4;
- return derivedKey;
- }
- });
- /**
- * Derives a key from a password.
- *
- * @param {WordArray|string} password The password.
- * @param {WordArray|string} salt A salt.
- * @param {Object} cfg (Optional) The configuration options to use for this computation.
- *
- * @return {WordArray} The derived key.
- *
- * @static
- *
- * @example
- *
- * var key = CryptoJS.EvpKDF(password, salt);
- * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
- * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
- */
- C.EvpKDF = function (password, salt, cfg) {
- return EvpKDF.create(cfg).compute(password, salt);
- };
- }());
- return CryptoJS.EvpKDF;
- }));
- },{"./core":598,"./hmac":602,"./sha1":604}],602:[function(_dereq_,module,exports){
- ;(function (root, factory) {
- if (typeof exports === "object") {
- // CommonJS
- module.exports = exports = factory(_dereq_("./core"));
- }
- else if (typeof define === "function" && define.amd) {
- // AMD
- define(["./core"], factory);
- }
- else {
- // Global (browser)
- factory(root.CryptoJS);
- }
- }(this, function (CryptoJS) {
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var Base = C_lib.Base;
- var C_enc = C.enc;
- var Utf8 = C_enc.Utf8;
- var C_algo = C.algo;
- /**
- * HMAC algorithm.
- */
- var HMAC = C_algo.HMAC = Base.extend({
- /**
- * Initializes a newly created HMAC.
- *
- * @param {Hasher} hasher The hash algorithm to use.
- * @param {WordArray|string} key The secret key.
- *
- * @example
- *
- * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
- */
- init: function (hasher, key) {
- // Init hasher
- hasher = this._hasher = new hasher.init();
- // Convert string to WordArray, else assume WordArray already
- if (typeof key == 'string') {
- key = Utf8.parse(key);
- }
- // Shortcuts
- var hasherBlockSize = hasher.blockSize;
- var hasherBlockSizeBytes = hasherBlockSize * 4;
- // Allow arbitrary length keys
- if (key.sigBytes > hasherBlockSizeBytes) {
- key = hasher.finalize(key);
- }
- // Clamp excess bits
- key.clamp();
- // Clone key for inner and outer pads
- var oKey = this._oKey = key.clone();
- var iKey = this._iKey = key.clone();
- // Shortcuts
- var oKeyWords = oKey.words;
- var iKeyWords = iKey.words;
- // XOR keys with pad constants
- for (var i = 0; i < hasherBlockSize; i++) {
- oKeyWords[i] ^= 0x5c5c5c5c;
- iKeyWords[i] ^= 0x36363636;
- }
- oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
- // Set initial values
- this.reset();
- },
- /**
- * Resets this HMAC to its initial state.
- *
- * @example
- *
- * hmacHasher.reset();
- */
- reset: function () {
- // Shortcut
- var hasher = this._hasher;
- // Reset
- hasher.reset();
- hasher.update(this._iKey);
- },
- /**
- * Updates this HMAC with a message.
- *
- * @param {WordArray|string} messageUpdate The message to append.
- *
- * @return {HMAC} This HMAC instance.
- *
- * @example
- *
- * hmacHasher.update('message');
- * hmacHasher.update(wordArray);
- */
- update: function (messageUpdate) {
- this._hasher.update(messageUpdate);
- // Chainable
- return this;
- },
- /**
- * Finalizes the HMAC computation.
- * Note that the finalize operation is effectively a destructive, read-once operation.
- *
- * @param {WordArray|string} messageUpdate (Optional) A final message update.
- *
- * @return {WordArray} The HMAC.
- *
- * @example
- *
- * var hmac = hmacHasher.finalize();
- * var hmac = hmacHasher.finalize('message');
- * var hmac = hmacHasher.finalize(wordArray);
- */
- finalize: function (messageUpdate) {
- // Shortcut
- var hasher = this._hasher;
- // Compute HMAC
- var innerHash = hasher.finalize(messageUpdate);
- hasher.reset();
- var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
- return hmac;
- }
- });
- }());
- }));
- },{"./core":598}],603:[function(_dereq_,module,exports){
- ;(function (root, factory) {
- if (typeof exports === "object") {
- // CommonJS
- module.exports = exports = factory(_dereq_("./core"));
- }
- else if (typeof define === "function" && define.amd) {
- // AMD
- define(["./core"], factory);
- }
- else {
- // Global (browser)
- factory(root.CryptoJS);
- }
- }(this, function (CryptoJS) {
- (function (Math) {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var Hasher = C_lib.Hasher;
- var C_algo = C.algo;
- // Constants table
- var T = [];
- // Compute constants
- (function () {
- for (var i = 0; i < 64; i++) {
- T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
- }
- }());
- /**
- * MD5 hash algorithm.
- */
- var MD5 = C_algo.MD5 = Hasher.extend({
- _doReset: function () {
- this._hash = new WordArray.init([
- 0x67452301, 0xefcdab89,
- 0x98badcfe, 0x10325476
- ]);
- },
- _doProcessBlock: function (M, offset) {
- // Swap endian
- for (var i = 0; i < 16; i++) {
- // Shortcuts
- var offset_i = offset + i;
- var M_offset_i = M[offset_i];
- M[offset_i] = (
- (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
- (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
- );
- }
- // Shortcuts
- var H = this._hash.words;
- var M_offset_0 = M[offset + 0];
- var M_offset_1 = M[offset + 1];
- var M_offset_2 = M[offset + 2];
- var M_offset_3 = M[offset + 3];
- var M_offset_4 = M[offset + 4];
- var M_offset_5 = M[offset + 5];
- var M_offset_6 = M[offset + 6];
- var M_offset_7 = M[offset + 7];
- var M_offset_8 = M[offset + 8];
- var M_offset_9 = M[offset + 9];
- var M_offset_10 = M[offset + 10];
- var M_offset_11 = M[offset + 11];
- var M_offset_12 = M[offset + 12];
- var M_offset_13 = M[offset + 13];
- var M_offset_14 = M[offset + 14];
- var M_offset_15 = M[offset + 15];
- // Working varialbes
- var a = H[0];
- var b = H[1];
- var c = H[2];
- var d = H[3];
- // Computation
- a = FF(a, b, c, d, M_offset_0, 7, T[0]);
- d = FF(d, a, b, c, M_offset_1, 12, T[1]);
- c = FF(c, d, a, b, M_offset_2, 17, T[2]);
- b = FF(b, c, d, a, M_offset_3, 22, T[3]);
- a = FF(a, b, c, d, M_offset_4, 7, T[4]);
- d = FF(d, a, b, c, M_offset_5, 12, T[5]);
- c = FF(c, d, a, b, M_offset_6, 17, T[6]);
- b = FF(b, c, d, a, M_offset_7, 22, T[7]);
- a = FF(a, b, c, d, M_offset_8, 7, T[8]);
- d = FF(d, a, b, c, M_offset_9, 12, T[9]);
- c = FF(c, d, a, b, M_offset_10, 17, T[10]);
- b = FF(b, c, d, a, M_offset_11, 22, T[11]);
- a = FF(a, b, c, d, M_offset_12, 7, T[12]);
- d = FF(d, a, b, c, M_offset_13, 12, T[13]);
- c = FF(c, d, a, b, M_offset_14, 17, T[14]);
- b = FF(b, c, d, a, M_offset_15, 22, T[15]);
- a = GG(a, b, c, d, M_offset_1, 5, T[16]);
- d = GG(d, a, b, c, M_offset_6, 9, T[17]);
- c = GG(c, d, a, b, M_offset_11, 14, T[18]);
- b = GG(b, c, d, a, M_offset_0, 20, T[19]);
- a = GG(a, b, c, d, M_offset_5, 5, T[20]);
- d = GG(d, a, b, c, M_offset_10, 9, T[21]);
- c = GG(c, d, a, b, M_offset_15, 14, T[22]);
- b = GG(b, c, d, a, M_offset_4, 20, T[23]);
- a = GG(a, b, c, d, M_offset_9, 5, T[24]);
- d = GG(d, a, b, c, M_offset_14, 9, T[25]);
- c = GG(c, d, a, b, M_offset_3, 14, T[26]);
- b = GG(b, c, d, a, M_offset_8, 20, T[27]);
- a = GG(a, b, c, d, M_offset_13, 5, T[28]);
- d = GG(d, a, b, c, M_offset_2, 9, T[29]);
- c = GG(c, d, a, b, M_offset_7, 14, T[30]);
- b = GG(b, c, d, a, M_offset_12, 20, T[31]);
- a = HH(a, b, c, d, M_offset_5, 4, T[32]);
- d = HH(d, a, b, c, M_offset_8, 11, T[33]);
- c = HH(c, d, a, b, M_offset_11, 16, T[34]);
- b = HH(b, c, d, a, M_offset_14, 23, T[35]);
- a = HH(a, b, c, d, M_offset_1, 4, T[36]);
- d = HH(d, a, b, c, M_offset_4, 11, T[37]);
- c = HH(c, d, a, b, M_offset_7, 16, T[38]);
- b = HH(b, c, d, a, M_offset_10, 23, T[39]);
- a = HH(a, b, c, d, M_offset_13, 4, T[40]);
- d = HH(d, a, b, c, M_offset_0, 11, T[41]);
- c = HH(c, d, a, b, M_offset_3, 16, T[42]);
- b = HH(b, c, d, a, M_offset_6, 23, T[43]);
- a = HH(a, b, c, d, M_offset_9, 4, T[44]);
- d = HH(d, a, b, c, M_offset_12, 11, T[45]);
- c = HH(c, d, a, b, M_offset_15, 16, T[46]);
- b = HH(b, c, d, a, M_offset_2, 23, T[47]);
- a = II(a, b, c, d, M_offset_0, 6, T[48]);
- d = II(d, a, b, c, M_offset_7, 10, T[49]);
- c = II(c, d, a, b, M_offset_14, 15, T[50]);
- b = II(b, c, d, a, M_offset_5, 21, T[51]);
- a = II(a, b, c, d, M_offset_12, 6, T[52]);
- d = II(d, a, b, c, M_offset_3, 10, T[53]);
- c = II(c, d, a, b, M_offset_10, 15, T[54]);
- b = II(b, c, d, a, M_offset_1, 21, T[55]);
- a = II(a, b, c, d, M_offset_8, 6, T[56]);
- d = II(d, a, b, c, M_offset_15, 10, T[57]);
- c = II(c, d, a, b, M_offset_6, 15, T[58]);
- b = II(b, c, d, a, M_offset_13, 21, T[59]);
- a = II(a, b, c, d, M_offset_4, 6, T[60]);
- d = II(d, a, b, c, M_offset_11, 10, T[61]);
- c = II(c, d, a, b, M_offset_2, 15, T[62]);
- b = II(b, c, d, a, M_offset_9, 21, T[63]);
- // Intermediate hash value
- H[0] = (H[0] + a) | 0;
- H[1] = (H[1] + b) | 0;
- H[2] = (H[2] + c) | 0;
- H[3] = (H[3] + d) | 0;
- },
- _doFinalize: function () {
- // Shortcuts
- var data = this._data;
- var dataWords = data.words;
- var nBitsTotal = this._nDataBytes * 8;
- var nBitsLeft = data.sigBytes * 8;
- // Add padding
- dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
- var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
- var nBitsTotalL = nBitsTotal;
- dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
- (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
- (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
- );
- dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
- (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
- (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
- );
- data.sigBytes = (dataWords.length + 1) * 4;
- // Hash final blocks
- this._process();
- // Shortcuts
- var hash = this._hash;
- var H = hash.words;
- // Swap endian
- for (var i = 0; i < 4; i++) {
- // Shortcut
- var H_i = H[i];
- H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
- (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
- }
- // Return final computed hash
- return hash;
- },
- clone: function () {
- var clone = Hasher.clone.call(this);
- clone._hash = this._hash.clone();
- return clone;
- }
- });
- function FF(a, b, c, d, x, s, t) {
- var n = a + ((b & c) | (~b & d)) + x + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- }
- function GG(a, b, c, d, x, s, t) {
- var n = a + ((b & d) | (c & ~d)) + x + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- }
- function HH(a, b, c, d, x, s, t) {
- var n = a + (b ^ c ^ d) + x + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- }
- function II(a, b, c, d, x, s, t) {
- var n = a + (c ^ (b | ~d)) + x + t;
- return ((n << s) | (n >>> (32 - s))) + b;
- }
- /**
- * Shortcut function to the hasher's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- *
- * @return {WordArray} The hash.
- *
- * @static
- *
- * @example
- *
- * var hash = CryptoJS.MD5('message');
- * var hash = CryptoJS.MD5(wordArray);
- */
- C.MD5 = Hasher._createHelper(MD5);
- /**
- * Shortcut function to the HMAC's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- * @param {WordArray|string} key The secret key.
- *
- * @return {WordArray} The HMAC.
- *
- * @static
- *
- * @example
- *
- * var hmac = CryptoJS.HmacMD5(message, key);
- */
- C.HmacMD5 = Hasher._createHmacHelper(MD5);
- }(Math));
- return CryptoJS.MD5;
- }));
- },{"./core":598}],604:[function(_dereq_,module,exports){
- ;(function (root, factory) {
- if (typeof exports === "object") {
- // CommonJS
- module.exports = exports = factory(_dereq_("./core"));
- }
- else if (typeof define === "function" && define.amd) {
- // AMD
- define(["./core"], factory);
- }
- else {
- // Global (browser)
- factory(root.CryptoJS);
- }
- }(this, function (CryptoJS) {
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var Hasher = C_lib.Hasher;
- var C_algo = C.algo;
- // Reusable object
- var W = [];
- /**
- * SHA-1 hash algorithm.
- */
- var SHA1 = C_algo.SHA1 = Hasher.extend({
- _doReset: function () {
- this._hash = new WordArray.init([
- 0x67452301, 0xefcdab89,
- 0x98badcfe, 0x10325476,
- 0xc3d2e1f0
- ]);
- },
- _doProcessBlock: function (M, offset) {
- // Shortcut
- var H = this._hash.words;
- // Working variables
- var a = H[0];
- var b = H[1];
- var c = H[2];
- var d = H[3];
- var e = H[4];
- // Computation
- for (var i = 0; i < 80; i++) {
- if (i < 16) {
- W[i] = M[offset + i] | 0;
- } else {
- var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
- W[i] = (n << 1) | (n >>> 31);
- }
- var t = ((a << 5) | (a >>> 27)) + e + W[i];
- if (i < 20) {
- t += ((b & c) | (~b & d)) + 0x5a827999;
- } else if (i < 40) {
- t += (b ^ c ^ d) + 0x6ed9eba1;
- } else if (i < 60) {
- t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
- } else /* if (i < 80) */ {
- t += (b ^ c ^ d) - 0x359d3e2a;
- }
- e = d;
- d = c;
- c = (b << 30) | (b >>> 2);
- b = a;
- a = t;
- }
- // Intermediate hash value
- H[0] = (H[0] + a) | 0;
- H[1] = (H[1] + b) | 0;
- H[2] = (H[2] + c) | 0;
- H[3] = (H[3] + d) | 0;
- H[4] = (H[4] + e) | 0;
- },
- _doFinalize: function () {
- // Shortcuts
- var data = this._data;
- var dataWords = data.words;
- var nBitsTotal = this._nDataBytes * 8;
- var nBitsLeft = data.sigBytes * 8;
- // Add padding
- dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
- dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
- dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
- data.sigBytes = dataWords.length * 4;
- // Hash final blocks
- this._process();
- // Return final computed hash
- return this._hash;
- },
- clone: function () {
- var clone = Hasher.clone.call(this);
- clone._hash = this._hash.clone();
- return clone;
- }
- });
- /**
- * Shortcut function to the hasher's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- *
- * @return {WordArray} The hash.
- *
- * @static
- *
- * @example
- *
- * var hash = CryptoJS.SHA1('message');
- * var hash = CryptoJS.SHA1(wordArray);
- */
- C.SHA1 = Hasher._createHelper(SHA1);
- /**
- * Shortcut function to the HMAC's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- * @param {WordArray|string} key The secret key.
- *
- * @return {WordArray} The HMAC.
- *
- * @static
- *
- * @example
- *
- * var hmac = CryptoJS.HmacSHA1(message, key);
- */
- C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
- }());
- return CryptoJS.SHA1;
- }));
- },{"./core":598}],605:[function(_dereq_,module,exports){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- var objectCreate = Object.create || objectCreatePolyfill
- var objectKeys = Object.keys || objectKeysPolyfill
- var bind = Function.prototype.bind || functionBindPolyfill
- function EventEmitter() {
- if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
- this._events = objectCreate(null);
- this._eventsCount = 0;
- }
- this._maxListeners = this._maxListeners || undefined;
- }
- module.exports = EventEmitter;
- // Backwards-compat with node 0.10.x
- EventEmitter.EventEmitter = EventEmitter;
- EventEmitter.prototype._events = undefined;
- EventEmitter.prototype._maxListeners = undefined;
- // By default EventEmitters will print a warning if more than 10 listeners are
- // added to it. This is a useful default which helps finding memory leaks.
- var defaultMaxListeners = 10;
- var hasDefineProperty;
- try {
- var o = {};
- if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
- hasDefineProperty = o.x === 0;
- } catch (err) { hasDefineProperty = false }
- if (hasDefineProperty) {
- Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
- enumerable: true,
- get: function() {
- return defaultMaxListeners;
- },
- set: function(arg) {
- // check whether the input is a positive number (whose value is zero or
- // greater and not a NaN).
- if (typeof arg !== 'number' || arg < 0 || arg !== arg)
- throw new TypeError('"defaultMaxListeners" must be a positive number');
- defaultMaxListeners = arg;
- }
- });
- } else {
- EventEmitter.defaultMaxListeners = defaultMaxListeners;
- }
- // Obviously not all Emitters should be limited to 10. This function allows
- // that to be increased. Set to zero for unlimited.
- EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
- if (typeof n !== 'number' || n < 0 || isNaN(n))
- throw new TypeError('"n" argument must be a positive number');
- this._maxListeners = n;
- return this;
- };
- function $getMaxListeners(that) {
- if (that._maxListeners === undefined)
- return EventEmitter.defaultMaxListeners;
- return that._maxListeners;
- }
- EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
- return $getMaxListeners(this);
- };
- // These standalone emit* functions are used to optimize calling of event
- // handlers for fast cases because emit() itself often has a variable number of
- // arguments and can be deoptimized because of that. These functions always have
- // the same number of arguments and thus do not get deoptimized, so the code
- // inside them can execute faster.
- function emitNone(handler, isFn, self) {
- if (isFn)
- handler.call(self);
- else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i)
- listeners[i].call(self);
- }
- }
- function emitOne(handler, isFn, self, arg1) {
- if (isFn)
- handler.call(self, arg1);
- else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i)
- listeners[i].call(self, arg1);
- }
- }
- function emitTwo(handler, isFn, self, arg1, arg2) {
- if (isFn)
- handler.call(self, arg1, arg2);
- else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i)
- listeners[i].call(self, arg1, arg2);
- }
- }
- function emitThree(handler, isFn, self, arg1, arg2, arg3) {
- if (isFn)
- handler.call(self, arg1, arg2, arg3);
- else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i)
- listeners[i].call(self, arg1, arg2, arg3);
- }
- }
- function emitMany(handler, isFn, self, args) {
- if (isFn)
- handler.apply(self, args);
- else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i)
- listeners[i].apply(self, args);
- }
- }
- EventEmitter.prototype.emit = function emit(type) {
- var er, handler, len, args, i, events;
- var doError = (type === 'error');
- events = this._events;
- if (events)
- doError = (doError && events.error == null);
- else if (!doError)
- return false;
- // If there is no 'error' event listener then throw.
- if (doError) {
- if (arguments.length > 1)
- er = arguments[1];
- if (er instanceof Error) {
- throw er; // Unhandled 'error' event
- } else {
- // At least give some kind of context to the user
- var err = new Error('Unhandled "error" event. (' + er + ')');
- err.context = er;
- throw err;
- }
- return false;
- }
- handler = events[type];
- if (!handler)
- return false;
- var isFn = typeof handler === 'function';
- len = arguments.length;
- switch (len) {
- // fast cases
- case 1:
- emitNone(handler, isFn, this);
- break;
- case 2:
- emitOne(handler, isFn, this, arguments[1]);
- break;
- case 3:
- emitTwo(handler, isFn, this, arguments[1], arguments[2]);
- break;
- case 4:
- emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
- break;
- // slower
- default:
- args = new Array(len - 1);
- for (i = 1; i < len; i++)
- args[i - 1] = arguments[i];
- emitMany(handler, isFn, this, args);
- }
- return true;
- };
- function _addListener(target, type, listener, prepend) {
- var m;
- var events;
- var existing;
- if (typeof listener !== 'function')
- throw new TypeError('"listener" argument must be a function');
- events = target._events;
- if (!events) {
- events = target._events = objectCreate(null);
- target._eventsCount = 0;
- } else {
- // To avoid recursion in the case that type === "newListener"! Before
- // adding it to the listeners, first emit "newListener".
- if (events.newListener) {
- target.emit('newListener', type,
- listener.listener ? listener.listener : listener);
- // Re-assign `events` because a newListener handler could have caused the
- // this._events to be assigned to a new object
- events = target._events;
- }
- existing = events[type];
- }
- if (!existing) {
- // Optimize the case of one listener. Don't need the extra array object.
- existing = events[type] = listener;
- ++target._eventsCount;
- } else {
- if (typeof existing === 'function') {
- // Adding the second element, need to change to array.
- existing = events[type] =
- prepend ? [listener, existing] : [existing, listener];
- } else {
- // If we've already got an array, just append.
- if (prepend) {
- existing.unshift(listener);
- } else {
- existing.push(listener);
- }
- }
- // Check for listener leak
- if (!existing.warned) {
- m = $getMaxListeners(target);
- if (m && m > 0 && existing.length > m) {
- existing.warned = true;
- var w = new Error('Possible EventEmitter memory leak detected. ' +
- existing.length + ' "' + String(type) + '" listeners ' +
- 'added. Use emitter.setMaxListeners() to ' +
- 'increase limit.');
- w.name = 'MaxListenersExceededWarning';
- w.emitter = target;
- w.type = type;
- w.count = existing.length;
- if (typeof console === 'object' && console.warn) {
- console.warn('%s: %s', w.name, w.message);
- }
- }
- }
- }
- return target;
- }
- EventEmitter.prototype.addListener = function addListener(type, listener) {
- return _addListener(this, type, listener, false);
- };
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
- EventEmitter.prototype.prependListener =
- function prependListener(type, listener) {
- return _addListener(this, type, listener, true);
- };
- function onceWrapper() {
- if (!this.fired) {
- this.target.removeListener(this.type, this.wrapFn);
- this.fired = true;
- switch (arguments.length) {
- case 0:
- return this.listener.call(this.target);
- case 1:
- return this.listener.call(this.target, arguments[0]);
- case 2:
- return this.listener.call(this.target, arguments[0], arguments[1]);
- case 3:
- return this.listener.call(this.target, arguments[0], arguments[1],
- arguments[2]);
- default:
- var args = new Array(arguments.length);
- for (var i = 0; i < args.length; ++i)
- args[i] = arguments[i];
- this.listener.apply(this.target, args);
- }
- }
- }
- function _onceWrap(target, type, listener) {
- var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
- var wrapped = bind.call(onceWrapper, state);
- wrapped.listener = listener;
- state.wrapFn = wrapped;
- return wrapped;
- }
- EventEmitter.prototype.once = function once(type, listener) {
- if (typeof listener !== 'function')
- throw new TypeError('"listener" argument must be a function');
- this.on(type, _onceWrap(this, type, listener));
- return this;
- };
- EventEmitter.prototype.prependOnceListener =
- function prependOnceListener(type, listener) {
- if (typeof listener !== 'function')
- throw new TypeError('"listener" argument must be a function');
- this.prependListener(type, _onceWrap(this, type, listener));
- return this;
- };
- // Emits a 'removeListener' event if and only if the listener was removed.
- EventEmitter.prototype.removeListener =
- function removeListener(type, listener) {
- var list, events, position, i, originalListener;
- if (typeof listener !== 'function')
- throw new TypeError('"listener" argument must be a function');
- events = this._events;
- if (!events)
- return this;
- list = events[type];
- if (!list)
- return this;
- if (list === listener || list.listener === listener) {
- if (--this._eventsCount === 0)
- this._events = objectCreate(null);
- else {
- delete events[type];
- if (events.removeListener)
- this.emit('removeListener', type, list.listener || listener);
- }
- } else if (typeof list !== 'function') {
- position = -1;
- for (i = list.length - 1; i >= 0; i--) {
- if (list[i] === listener || list[i].listener === listener) {
- originalListener = list[i].listener;
- position = i;
- break;
- }
- }
- if (position < 0)
- return this;
- if (position === 0)
- list.shift();
- else
- spliceOne(list, position);
- if (list.length === 1)
- events[type] = list[0];
- if (events.removeListener)
- this.emit('removeListener', type, originalListener || listener);
- }
- return this;
- };
- EventEmitter.prototype.removeAllListeners =
- function removeAllListeners(type) {
- var listeners, events, i;
- events = this._events;
- if (!events)
- return this;
- // not listening for removeListener, no need to emit
- if (!events.removeListener) {
- if (arguments.length === 0) {
- this._events = objectCreate(null);
- this._eventsCount = 0;
- } else if (events[type]) {
- if (--this._eventsCount === 0)
- this._events = objectCreate(null);
- else
- delete events[type];
- }
- return this;
- }
- // emit removeListener for all listeners on all events
- if (arguments.length === 0) {
- var keys = objectKeys(events);
- var key;
- for (i = 0; i < keys.length; ++i) {
- key = keys[i];
- if (key === 'removeListener') continue;
- this.removeAllListeners(key);
- }
- this.removeAllListeners('removeListener');
- this._events = objectCreate(null);
- this._eventsCount = 0;
- return this;
- }
- listeners = events[type];
- if (typeof listeners === 'function') {
- this.removeListener(type, listeners);
- } else if (listeners) {
- // LIFO order
- for (i = listeners.length - 1; i >= 0; i--) {
- this.removeListener(type, listeners[i]);
- }
- }
- return this;
- };
- function _listeners(target, type, unwrap) {
- var events = target._events;
- if (!events)
- return [];
- var evlistener = events[type];
- if (!evlistener)
- return [];
- if (typeof evlistener === 'function')
- return unwrap ? [evlistener.listener || evlistener] : [evlistener];
- return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
- }
- EventEmitter.prototype.listeners = function listeners(type) {
- return _listeners(this, type, true);
- };
- EventEmitter.prototype.rawListeners = function rawListeners(type) {
- return _listeners(this, type, false);
- };
- EventEmitter.listenerCount = function(emitter, type) {
- if (typeof emitter.listenerCount === 'function') {
- return emitter.listenerCount(type);
- } else {
- return listenerCount.call(emitter, type);
- }
- };
- EventEmitter.prototype.listenerCount = listenerCount;
- function listenerCount(type) {
- var events = this._events;
- if (events) {
- var evlistener = events[type];
- if (typeof evlistener === 'function') {
- return 1;
- } else if (evlistener) {
- return evlistener.length;
- }
- }
- return 0;
- }
- EventEmitter.prototype.eventNames = function eventNames() {
- return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
- };
- // About 1.5x faster than the two-arg version of Array#splice().
- function spliceOne(list, index) {
- for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
- list[i] = list[k];
- list.pop();
- }
- function arrayClone(arr, n) {
- var copy = new Array(n);
- for (var i = 0; i < n; ++i)
- copy[i] = arr[i];
- return copy;
- }
- function unwrapListeners(arr) {
- var ret = new Array(arr.length);
- for (var i = 0; i < ret.length; ++i) {
- ret[i] = arr[i].listener || arr[i];
- }
- return ret;
- }
- function objectCreatePolyfill(proto) {
- var F = function() {};
- F.prototype = proto;
- return new F;
- }
- function objectKeysPolyfill(obj) {
- var keys = [];
- for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {
- keys.push(k);
- }
- return k;
- }
- function functionBindPolyfill(context) {
- var fn = this;
- return function () {
- return fn.apply(context, arguments);
- };
- }
- },{}],606:[function(_dereq_,module,exports){
- 'use strict';
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- var safariFix = _dereq_('safari-14-idb-fix');
- function _interopDefaultLegacy(e) {
- return e && _typeof(e) === 'object' && 'default' in e ? e : {
- 'default': e
- };
- }
- var safariFix__default = /*#__PURE__*/_interopDefaultLegacy(safariFix);
- function promisifyRequest(request) {
- return new Promise(function (resolve, reject) {
- // @ts-ignore - file size hacks
- request.oncomplete = request.onsuccess = function () {
- return resolve(request.result);
- }; // @ts-ignore - file size hacks
- request.onabort = request.onerror = function () {
- return reject(request.error);
- };
- });
- }
- function createStore(dbName, storeName) {
- var dbp = safariFix__default['default']().then(function () {
- var request = indexedDB.open(dbName);
- request.onupgradeneeded = function () {
- return request.result.createObjectStore(storeName);
- };
- return promisifyRequest(request);
- });
- return function (txMode, callback) {
- return dbp.then(function (db) {
- return callback(db.transaction(storeName, txMode).objectStore(storeName));
- });
- };
- }
- var defaultGetStoreFunc;
- function defaultGetStore() {
- if (!defaultGetStoreFunc) {
- defaultGetStoreFunc = createStore('keyval-store', 'keyval');
- }
- return defaultGetStoreFunc;
- }
- /**
- * Get a value by its key.
- *
- * @param key
- * @param customStore Method to get a custom store. Use with caution (see the docs).
- */
- function get(key) {
- var customStore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetStore();
- return customStore('readonly', function (store) {
- return promisifyRequest(store.get(key));
- });
- }
- /**
- * Set a value with a key.
- *
- * @param key
- * @param value
- * @param customStore Method to get a custom store. Use with caution (see the docs).
- */
- function set(key, value) {
- var customStore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultGetStore();
- return customStore('readwrite', function (store) {
- store.put(value, key);
- return promisifyRequest(store.transaction);
- });
- }
- /**
- * Set multiple values at once. This is faster than calling set() multiple times.
- * It's also atomic – if one of the pairs can't be added, none will be added.
- *
- * @param entries Array of entries, where each entry is an array of `[key, value]`.
- * @param customStore Method to get a custom store. Use with caution (see the docs).
- */
- function setMany(entries) {
- var customStore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetStore();
- return customStore('readwrite', function (store) {
- entries.forEach(function (entry) {
- return store.put(entry[1], entry[0]);
- });
- return promisifyRequest(store.transaction);
- });
- }
- /**
- * Get multiple values by their keys
- *
- * @param keys
- * @param customStore Method to get a custom store. Use with caution (see the docs).
- */
- function getMany(keys) {
- var customStore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetStore();
- return customStore('readonly', function (store) {
- return Promise.all(keys.map(function (key) {
- return promisifyRequest(store.get(key));
- }));
- });
- }
- /**
- * Update a value. This lets you see the old value and update it as an atomic operation.
- *
- * @param key
- * @param updater A callback that takes the old value and returns a new value.
- * @param customStore Method to get a custom store. Use with caution (see the docs).
- */
- function update(key, updater) {
- var customStore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultGetStore();
- return customStore('readwrite', function (store) {
- return (// Need to create the promise manually.
- // If I try to chain promises, the transaction closes in browsers
- // that use a promise polyfill (IE10/11).
- new Promise(function (resolve, reject) {
- store.get(key).onsuccess = function () {
- try {
- store.put(updater(this.result), key);
- resolve(promisifyRequest(store.transaction));
- } catch (err) {
- reject(err);
- }
- };
- })
- );
- });
- }
- /**
- * Delete a particular key from the store.
- *
- * @param key
- * @param customStore Method to get a custom store. Use with caution (see the docs).
- */
- function del(key) {
- var customStore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetStore();
- return customStore('readwrite', function (store) {
- store.delete(key);
- return promisifyRequest(store.transaction);
- });
- }
- /**
- * Delete multiple keys at once.
- *
- * @param keys List of keys to delete.
- * @param customStore Method to get a custom store. Use with caution (see the docs).
- */
- function delMany(keys) {
- var customStore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetStore();
- return customStore('readwrite', function (store) {
- keys.forEach(function (key) {
- return store.delete(key);
- });
- return promisifyRequest(store.transaction);
- });
- }
- /**
- * Clear all values in the store.
- *
- * @param customStore Method to get a custom store. Use with caution (see the docs).
- */
- function clear() {
- var customStore = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultGetStore();
- return customStore('readwrite', function (store) {
- store.clear();
- return promisifyRequest(store.transaction);
- });
- }
- function eachCursor(customStore, callback) {
- return customStore('readonly', function (store) {
- // This would be store.getAllKeys(), but it isn't supported by Edge or Safari.
- // And openKeyCursor isn't supported by Safari.
- store.openCursor().onsuccess = function () {
- if (!this.result) return;
- callback(this.result);
- this.result.continue();
- };
- return promisifyRequest(store.transaction);
- });
- }
- /**
- * Get all keys in the store.
- *
- * @param customStore Method to get a custom store. Use with caution (see the docs).
- */
- function keys() {
- var customStore = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultGetStore();
- var items = [];
- return eachCursor(customStore, function (cursor) {
- return items.push(cursor.key);
- }).then(function () {
- return items;
- });
- }
- /**
- * Get all values in the store.
- *
- * @param customStore Method to get a custom store. Use with caution (see the docs).
- */
- function values() {
- var customStore = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultGetStore();
- var items = [];
- return eachCursor(customStore, function (cursor) {
- return items.push(cursor.value);
- }).then(function () {
- return items;
- });
- }
- /**
- * Get all entries in the store. Each entry is an array of `[key, value]`.
- *
- * @param customStore Method to get a custom store. Use with caution (see the docs).
- */
- function entries() {
- var customStore = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultGetStore();
- var items = [];
- return eachCursor(customStore, function (cursor) {
- return items.push([cursor.key, cursor.value]);
- }).then(function () {
- return items;
- });
- }
- exports.clear = clear;
- exports.createStore = createStore;
- exports.del = del;
- exports.delMany = delMany;
- exports.entries = entries;
- exports.get = get;
- exports.getMany = getMany;
- exports.keys = keys;
- exports.promisifyRequest = promisifyRequest;
- exports.set = set;
- exports.setMany = setMany;
- exports.update = update;
- exports.values = values;
- },{"safari-14-idb-fix":607}],607:[function(_dereq_,module,exports){
- /**
- * Work around Safari 14 IndexedDB open bug.
- *
- * Safari has a horrible bug where IDB requests can hang while the browser is starting up. https://bugs.webkit.org/show_bug.cgi?id=226547
- * The only solution is to keep nudging it until it's awake.
- */
- function idbReady() {
- var isSafari = !navigator.userAgentData &&
- /Safari\//.test(navigator.userAgent) &&
- !/Chrom(e|ium)\//.test(navigator.userAgent);
- // No point putting other browsers or older versions of Safari through this mess.
- if (!isSafari || !indexedDB.databases)
- return Promise.resolve();
- var intervalId;
- return new Promise(function (resolve) {
- var tryIdb = function () { return indexedDB.databases().finally(resolve); };
- intervalId = setInterval(tryIdb, 100);
- tryIdb();
- }).finally(function () { return clearInterval(intervalId); });
- }
- module.exports = idbReady;
- },{}],608:[function(_dereq_,module,exports){
- /**
- * Convert array of 16 byte values to UUID string format of the form:
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
- */
- var byteToHex = [];
- for (var i = 0; i < 256; ++i) {
- byteToHex[i] = (i + 0x100).toString(16).substr(1);
- }
- function bytesToUuid(buf, offset) {
- var i = offset || 0;
- var bth = byteToHex;
- // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
- return ([
- bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]], '-',
- bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]],
- bth[buf[i++]], bth[buf[i++]]
- ]).join('');
- }
- module.exports = bytesToUuid;
- },{}],609:[function(_dereq_,module,exports){
- // Unique ID creation requires a high quality random # generator. In the
- // browser this is a little complicated due to unknown quality of Math.random()
- // and inconsistent support for the `crypto` API. We do the best we can via
- // feature-detection
- // getRandomValues needs to be invoked in a context where "this" is a Crypto
- // implementation. Also, find the complete implementation of crypto on IE11.
- var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
- (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
- if (getRandomValues) {
- // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
- var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
- module.exports = function whatwgRNG() {
- getRandomValues(rnds8);
- return rnds8;
- };
- } else {
- // Math.random()-based (RNG)
- //
- // If all else fails, use Math.random(). It's fast, but is of unspecified
- // quality.
- var rnds = new Array(16);
- module.exports = function mathRNG() {
- for (var i = 0, r; i < 16; i++) {
- if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
- rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
- }
- return rnds;
- };
- }
- },{}],610:[function(_dereq_,module,exports){
- var rng = _dereq_('./lib/rng');
- var bytesToUuid = _dereq_('./lib/bytesToUuid');
- function v4(options, buf, offset) {
- var i = buf && offset || 0;
- if (typeof(options) == 'string') {
- buf = options === 'binary' ? new Array(16) : null;
- options = null;
- }
- options = options || {};
- var rnds = options.random || (options.rng || rng)();
- // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
- rnds[6] = (rnds[6] & 0x0f) | 0x40;
- rnds[8] = (rnds[8] & 0x3f) | 0x80;
- // Copy bytes to buffer, if provided
- if (buf) {
- for (var ii = 0; ii < 16; ++ii) {
- buf[i + ii] = rnds[ii];
- }
- }
- return buf || bytesToUuid(rnds);
- }
- module.exports = v4;
- },{"./lib/bytesToUuid":608,"./lib/rng":609}]},{},[18])(18)
- });
|