mammoth.browser.js 874 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539
  1. // Module: @xmldom/xmldom@0.8.6
  2. // License: MIT
  3. //
  4. // Module: base64-js@1.5.1
  5. // License: MIT
  6. //
  7. // Module: bluebird@3.4.7
  8. // License: MIT
  9. //
  10. // Module: buffer@4.9.1
  11. // License: MIT
  12. //
  13. // Module: dingbat-to-unicode@1.0.1
  14. // License: BSD-2-Clause
  15. //
  16. // Module: ieee754@1.1.8
  17. // License: BSD-3-Clause
  18. //
  19. // Module: inherits@2.0.1
  20. // License: ISC
  21. //
  22. // Module: isarray@1.0.0
  23. // License: MIT
  24. //
  25. // Module: jszip@3.7.1
  26. // License: (MIT OR GPL-3.0-or-later)
  27. //
  28. // Module: lop@0.4.1
  29. // License: BSD-2-Clause
  30. //
  31. // Module: mammoth@1.8.0
  32. // License: BSD-2-Clause
  33. //
  34. // Module: option@0.2.4
  35. // License: BSD-2-Clause
  36. //
  37. // Module: process@0.11.9
  38. // License: MIT
  39. //
  40. // Module: underscore@1.13.1
  41. // License: MIT
  42. //
  43. // Module: util@0.10.3
  44. // License: MIT
  45. //
  46. // Module: xmlbuilder@10.0.0
  47. // License: MIT
  48. //
  49. (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.mammoth = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  50. var promises = require("../../lib/promises");
  51. exports.Files = Files;
  52. function Files() {
  53. function read(uri) {
  54. return promises.reject(new Error("could not open external image: '" + uri + "'\ncannot open linked files from a web browser"));
  55. }
  56. return {
  57. read: read
  58. };
  59. }
  60. },{"../../lib/promises":23}],2:[function(require,module,exports){
  61. var promises = require("../lib/promises");
  62. var zipfile = require("../lib/zipfile");
  63. exports.openZip = openZip;
  64. function openZip(options) {
  65. if (options.arrayBuffer) {
  66. return promises.resolve(zipfile.openArrayBuffer(options.arrayBuffer));
  67. } else {
  68. return promises.reject(new Error("Could not find file in options"));
  69. }
  70. }
  71. },{"../lib/promises":23,"../lib/zipfile":40}],3:[function(require,module,exports){
  72. var _ = require("underscore");
  73. var promises = require("./promises");
  74. var documents = require("./documents");
  75. var htmlPaths = require("./styles/html-paths");
  76. var results = require("./results");
  77. var images = require("./images");
  78. var Html = require("./html");
  79. var writers = require("./writers");
  80. exports.DocumentConverter = DocumentConverter;
  81. function DocumentConverter(options) {
  82. return {
  83. convertToHtml: function(element) {
  84. var comments = _.indexBy(
  85. element.type === documents.types.document ? element.comments : [],
  86. "commentId"
  87. );
  88. var conversion = new DocumentConversion(options, comments);
  89. return conversion.convertToHtml(element);
  90. }
  91. };
  92. }
  93. function DocumentConversion(options, comments) {
  94. var noteNumber = 1;
  95. var noteReferences = [];
  96. var referencedComments = [];
  97. options = _.extend({ignoreEmptyParagraphs: true}, options);
  98. var idPrefix = options.idPrefix === undefined ? "" : options.idPrefix;
  99. var ignoreEmptyParagraphs = options.ignoreEmptyParagraphs;
  100. var defaultParagraphStyle = htmlPaths.topLevelElement("p");
  101. var styleMap = options.styleMap || [];
  102. function convertToHtml(document) {
  103. var messages = [];
  104. var html = elementToHtml(document, messages, {});
  105. var deferredNodes = [];
  106. walkHtml(html, function(node) {
  107. if (node.type === "deferred") {
  108. deferredNodes.push(node);
  109. }
  110. });
  111. var deferredValues = {};
  112. return promises.mapSeries(deferredNodes, function(deferred) {
  113. return deferred.value().then(function(value) {
  114. deferredValues[deferred.id] = value;
  115. });
  116. }).then(function() {
  117. function replaceDeferred(nodes) {
  118. return flatMap(nodes, function(node) {
  119. if (node.type === "deferred") {
  120. return deferredValues[node.id];
  121. } else if (node.children) {
  122. return [
  123. _.extend({}, node, {
  124. children: replaceDeferred(node.children)
  125. })
  126. ];
  127. } else {
  128. return [node];
  129. }
  130. });
  131. }
  132. var writer = writers.writer({
  133. prettyPrint: options.prettyPrint,
  134. outputFormat: options.outputFormat
  135. });
  136. Html.write(writer, Html.simplify(replaceDeferred(html)));
  137. return new results.Result(writer.asString(), messages);
  138. });
  139. }
  140. function convertElements(elements, messages, options) {
  141. return flatMap(elements, function(element) {
  142. return elementToHtml(element, messages, options);
  143. });
  144. }
  145. function elementToHtml(element, messages, options) {
  146. if (!options) {
  147. throw new Error("options not set");
  148. }
  149. var handler = elementConverters[element.type];
  150. if (handler) {
  151. return handler(element, messages, options);
  152. } else {
  153. return [];
  154. }
  155. }
  156. function convertParagraph(element, messages, options) {
  157. return htmlPathForParagraph(element, messages).wrap(function() {
  158. var content = convertElements(element.children, messages, options);
  159. if (ignoreEmptyParagraphs) {
  160. return content;
  161. } else {
  162. return [Html.forceWrite].concat(content);
  163. }
  164. });
  165. }
  166. function htmlPathForParagraph(element, messages) {
  167. var style = findStyle(element);
  168. if (style) {
  169. return style.to;
  170. } else {
  171. if (element.styleId) {
  172. messages.push(unrecognisedStyleWarning("paragraph", element));
  173. }
  174. return defaultParagraphStyle;
  175. }
  176. }
  177. function convertRun(run, messages, options) {
  178. var nodes = function() {
  179. return convertElements(run.children, messages, options);
  180. };
  181. var paths = [];
  182. if (run.highlight !== null) {
  183. var path = findHtmlPath({type: "highlight", color: run.highlight});
  184. if (path) {
  185. paths.push(path);
  186. }
  187. }
  188. if (run.isSmallCaps) {
  189. paths.push(findHtmlPathForRunProperty("smallCaps"));
  190. }
  191. if (run.isAllCaps) {
  192. paths.push(findHtmlPathForRunProperty("allCaps"));
  193. }
  194. if (run.isStrikethrough) {
  195. paths.push(findHtmlPathForRunProperty("strikethrough", "s"));
  196. }
  197. if (run.isUnderline) {
  198. paths.push(findHtmlPathForRunProperty("underline"));
  199. }
  200. if (run.verticalAlignment === documents.verticalAlignment.subscript) {
  201. paths.push(htmlPaths.element("sub", {}, {fresh: false}));
  202. }
  203. if (run.verticalAlignment === documents.verticalAlignment.superscript) {
  204. paths.push(htmlPaths.element("sup", {}, {fresh: false}));
  205. }
  206. if (run.isItalic) {
  207. paths.push(findHtmlPathForRunProperty("italic", "em"));
  208. }
  209. if (run.isBold) {
  210. paths.push(findHtmlPathForRunProperty("bold", "strong"));
  211. }
  212. var stylePath = htmlPaths.empty;
  213. var style = findStyle(run);
  214. if (style) {
  215. stylePath = style.to;
  216. } else if (run.styleId) {
  217. messages.push(unrecognisedStyleWarning("run", run));
  218. }
  219. paths.push(stylePath);
  220. paths.forEach(function(path) {
  221. nodes = path.wrap.bind(path, nodes);
  222. });
  223. return nodes();
  224. }
  225. function findHtmlPathForRunProperty(elementType, defaultTagName) {
  226. var path = findHtmlPath({type: elementType});
  227. if (path) {
  228. return path;
  229. } else if (defaultTagName) {
  230. return htmlPaths.element(defaultTagName, {}, {fresh: false});
  231. } else {
  232. return htmlPaths.empty;
  233. }
  234. }
  235. function findHtmlPath(element, defaultPath) {
  236. var style = findStyle(element);
  237. return style ? style.to : defaultPath;
  238. }
  239. function findStyle(element) {
  240. for (var i = 0; i < styleMap.length; i++) {
  241. if (styleMap[i].from.matches(element)) {
  242. return styleMap[i];
  243. }
  244. }
  245. }
  246. function recoveringConvertImage(convertImage) {
  247. return function(image, messages) {
  248. return promises.attempt(function() {
  249. return convertImage(image, messages);
  250. }).caught(function(error) {
  251. messages.push(results.error(error));
  252. return [];
  253. });
  254. };
  255. }
  256. function noteHtmlId(note) {
  257. return referentHtmlId(note.noteType, note.noteId);
  258. }
  259. function noteRefHtmlId(note) {
  260. return referenceHtmlId(note.noteType, note.noteId);
  261. }
  262. function referentHtmlId(referenceType, referenceId) {
  263. return htmlId(referenceType + "-" + referenceId);
  264. }
  265. function referenceHtmlId(referenceType, referenceId) {
  266. return htmlId(referenceType + "-ref-" + referenceId);
  267. }
  268. function htmlId(suffix) {
  269. return idPrefix + suffix;
  270. }
  271. var defaultTablePath = htmlPaths.elements([
  272. htmlPaths.element("table", {}, {fresh: true})
  273. ]);
  274. function convertTable(element, messages, options) {
  275. return findHtmlPath(element, defaultTablePath).wrap(function() {
  276. return convertTableChildren(element, messages, options);
  277. });
  278. }
  279. function convertTableChildren(element, messages, options) {
  280. var bodyIndex = _.findIndex(element.children, function(child) {
  281. return !child.type === documents.types.tableRow || !child.isHeader;
  282. });
  283. if (bodyIndex === -1) {
  284. bodyIndex = element.children.length;
  285. }
  286. var children;
  287. if (bodyIndex === 0) {
  288. children = convertElements(
  289. element.children,
  290. messages,
  291. _.extend({}, options, {isTableHeader: false})
  292. );
  293. } else {
  294. var headRows = convertElements(
  295. element.children.slice(0, bodyIndex),
  296. messages,
  297. _.extend({}, options, {isTableHeader: true})
  298. );
  299. var bodyRows = convertElements(
  300. element.children.slice(bodyIndex),
  301. messages,
  302. _.extend({}, options, {isTableHeader: false})
  303. );
  304. children = [
  305. Html.freshElement("thead", {}, headRows),
  306. Html.freshElement("tbody", {}, bodyRows)
  307. ];
  308. }
  309. return [Html.forceWrite].concat(children);
  310. }
  311. function convertTableRow(element, messages, options) {
  312. var children = convertElements(element.children, messages, options);
  313. return [
  314. Html.freshElement("tr", {}, [Html.forceWrite].concat(children))
  315. ];
  316. }
  317. function convertTableCell(element, messages, options) {
  318. var tagName = options.isTableHeader ? "th" : "td";
  319. var children = convertElements(element.children, messages, options);
  320. var attributes = {};
  321. if (element.colSpan !== 1) {
  322. attributes.colspan = element.colSpan.toString();
  323. }
  324. if (element.rowSpan !== 1) {
  325. attributes.rowspan = element.rowSpan.toString();
  326. }
  327. return [
  328. Html.freshElement(tagName, attributes, [Html.forceWrite].concat(children))
  329. ];
  330. }
  331. function convertCommentReference(reference, messages, options) {
  332. return findHtmlPath(reference, htmlPaths.ignore).wrap(function() {
  333. var comment = comments[reference.commentId];
  334. var count = referencedComments.length + 1;
  335. var label = "[" + commentAuthorLabel(comment) + count + "]";
  336. referencedComments.push({label: label, comment: comment});
  337. // TODO: remove duplication with note references
  338. return [
  339. Html.freshElement("a", {
  340. href: "#" + referentHtmlId("comment", reference.commentId),
  341. id: referenceHtmlId("comment", reference.commentId)
  342. }, [Html.text(label)])
  343. ];
  344. });
  345. }
  346. function convertComment(referencedComment, messages, options) {
  347. // TODO: remove duplication with note references
  348. var label = referencedComment.label;
  349. var comment = referencedComment.comment;
  350. var body = convertElements(comment.body, messages, options).concat([
  351. Html.nonFreshElement("p", {}, [
  352. Html.text(" "),
  353. Html.freshElement("a", {"href": "#" + referenceHtmlId("comment", comment.commentId)}, [
  354. Html.text("↑")
  355. ])
  356. ])
  357. ]);
  358. return [
  359. Html.freshElement(
  360. "dt",
  361. {"id": referentHtmlId("comment", comment.commentId)},
  362. [Html.text("Comment " + label)]
  363. ),
  364. Html.freshElement("dd", {}, body)
  365. ];
  366. }
  367. function convertBreak(element, messages, options) {
  368. return htmlPathForBreak(element).wrap(function() {
  369. return [];
  370. });
  371. }
  372. function htmlPathForBreak(element) {
  373. var style = findStyle(element);
  374. if (style) {
  375. return style.to;
  376. } else if (element.breakType === "line") {
  377. return htmlPaths.topLevelElement("br");
  378. } else {
  379. return htmlPaths.empty;
  380. }
  381. }
  382. var elementConverters = {
  383. "document": function(document, messages, options) {
  384. var children = convertElements(document.children, messages, options);
  385. var notes = noteReferences.map(function(noteReference) {
  386. return document.notes.resolve(noteReference);
  387. });
  388. var notesNodes = convertElements(notes, messages, options);
  389. return children.concat([
  390. Html.freshElement("ol", {}, notesNodes),
  391. Html.freshElement("dl", {}, flatMap(referencedComments, function(referencedComment) {
  392. return convertComment(referencedComment, messages, options);
  393. }))
  394. ]);
  395. },
  396. "paragraph": convertParagraph,
  397. "run": convertRun,
  398. "text": function(element, messages, options) {
  399. return [Html.text(element.value)];
  400. },
  401. "tab": function(element, messages, options) {
  402. return [Html.text("\t")];
  403. },
  404. "hyperlink": function(element, messages, options) {
  405. var href = element.anchor ? "#" + htmlId(element.anchor) : element.href;
  406. var attributes = {href: href};
  407. if (element.targetFrame != null) {
  408. attributes.target = element.targetFrame;
  409. }
  410. var children = convertElements(element.children, messages, options);
  411. return [Html.nonFreshElement("a", attributes, children)];
  412. },
  413. "bookmarkStart": function(element, messages, options) {
  414. var anchor = Html.freshElement("a", {
  415. id: htmlId(element.name)
  416. }, [Html.forceWrite]);
  417. return [anchor];
  418. },
  419. "noteReference": function(element, messages, options) {
  420. noteReferences.push(element);
  421. var anchor = Html.freshElement("a", {
  422. href: "#" + noteHtmlId(element),
  423. id: noteRefHtmlId(element)
  424. }, [Html.text("[" + (noteNumber++) + "]")]);
  425. return [Html.freshElement("sup", {}, [anchor])];
  426. },
  427. "note": function(element, messages, options) {
  428. var children = convertElements(element.body, messages, options);
  429. var backLink = Html.elementWithTag(htmlPaths.element("p", {}, {fresh: false}), [
  430. Html.text(" "),
  431. Html.freshElement("a", {href: "#" + noteRefHtmlId(element)}, [Html.text("↑")])
  432. ]);
  433. var body = children.concat([backLink]);
  434. return Html.freshElement("li", {id: noteHtmlId(element)}, body);
  435. },
  436. "commentReference": convertCommentReference,
  437. "comment": convertComment,
  438. "image": deferredConversion(recoveringConvertImage(options.convertImage || images.dataUri)),
  439. "table": convertTable,
  440. "tableRow": convertTableRow,
  441. "tableCell": convertTableCell,
  442. "break": convertBreak
  443. };
  444. return {
  445. convertToHtml: convertToHtml
  446. };
  447. }
  448. var deferredId = 1;
  449. function deferredConversion(func) {
  450. return function(element, messages, options) {
  451. return [
  452. {
  453. type: "deferred",
  454. id: deferredId++,
  455. value: function() {
  456. return func(element, messages, options);
  457. }
  458. }
  459. ];
  460. };
  461. }
  462. function unrecognisedStyleWarning(type, element) {
  463. return results.warning(
  464. "Unrecognised " + type + " style: '" + element.styleName + "'" +
  465. " (Style ID: " + element.styleId + ")"
  466. );
  467. }
  468. function flatMap(values, func) {
  469. return _.flatten(values.map(func), true);
  470. }
  471. function walkHtml(nodes, callback) {
  472. nodes.forEach(function(node) {
  473. callback(node);
  474. if (node.children) {
  475. walkHtml(node.children, callback);
  476. }
  477. });
  478. }
  479. var commentAuthorLabel = exports.commentAuthorLabel = function commentAuthorLabel(comment) {
  480. return comment.authorInitials || "";
  481. };
  482. },{"./documents":4,"./html":18,"./images":20,"./promises":23,"./results":25,"./styles/html-paths":28,"./writers":33,"underscore":102}],4:[function(require,module,exports){
  483. (function (Buffer){
  484. var _ = require("underscore");
  485. var types = exports.types = {
  486. document: "document",
  487. paragraph: "paragraph",
  488. run: "run",
  489. text: "text",
  490. tab: "tab",
  491. hyperlink: "hyperlink",
  492. noteReference: "noteReference",
  493. image: "image",
  494. note: "note",
  495. commentReference: "commentReference",
  496. comment: "comment",
  497. table: "table",
  498. tableRow: "tableRow",
  499. tableCell: "tableCell",
  500. "break": "break",
  501. bookmarkStart: "bookmarkStart"
  502. };
  503. function Document(children, options) {
  504. options = options || {};
  505. return {
  506. type: types.document,
  507. children: children,
  508. notes: options.notes || new Notes({}),
  509. comments: options.comments || []
  510. };
  511. }
  512. function Paragraph(children, properties) {
  513. properties = properties || {};
  514. var indent = properties.indent || {};
  515. return {
  516. type: types.paragraph,
  517. children: children,
  518. styleId: properties.styleId || null,
  519. styleName: properties.styleName || null,
  520. numbering: properties.numbering || null,
  521. alignment: properties.alignment || null,
  522. indent: {
  523. start: indent.start || null,
  524. end: indent.end || null,
  525. firstLine: indent.firstLine || null,
  526. hanging: indent.hanging || null
  527. }
  528. };
  529. }
  530. function Run(children, properties) {
  531. properties = properties || {};
  532. return {
  533. type: types.run,
  534. children: children,
  535. styleId: properties.styleId || null,
  536. styleName: properties.styleName || null,
  537. isBold: !!properties.isBold,
  538. isUnderline: !!properties.isUnderline,
  539. isItalic: !!properties.isItalic,
  540. isStrikethrough: !!properties.isStrikethrough,
  541. isAllCaps: !!properties.isAllCaps,
  542. isSmallCaps: !!properties.isSmallCaps,
  543. verticalAlignment: properties.verticalAlignment || verticalAlignment.baseline,
  544. font: properties.font || null,
  545. fontSize: properties.fontSize || null,
  546. highlight: properties.highlight || null
  547. };
  548. }
  549. var verticalAlignment = {
  550. baseline: "baseline",
  551. superscript: "superscript",
  552. subscript: "subscript"
  553. };
  554. function Text(value) {
  555. return {
  556. type: types.text,
  557. value: value
  558. };
  559. }
  560. function Tab() {
  561. return {
  562. type: types.tab
  563. };
  564. }
  565. function Hyperlink(children, options) {
  566. return {
  567. type: types.hyperlink,
  568. children: children,
  569. href: options.href,
  570. anchor: options.anchor,
  571. targetFrame: options.targetFrame
  572. };
  573. }
  574. function NoteReference(options) {
  575. return {
  576. type: types.noteReference,
  577. noteType: options.noteType,
  578. noteId: options.noteId
  579. };
  580. }
  581. function Notes(notes) {
  582. this._notes = _.indexBy(notes, function(note) {
  583. return noteKey(note.noteType, note.noteId);
  584. });
  585. }
  586. Notes.prototype.resolve = function(reference) {
  587. return this.findNoteByKey(noteKey(reference.noteType, reference.noteId));
  588. };
  589. Notes.prototype.findNoteByKey = function(key) {
  590. return this._notes[key] || null;
  591. };
  592. function Note(options) {
  593. return {
  594. type: types.note,
  595. noteType: options.noteType,
  596. noteId: options.noteId,
  597. body: options.body
  598. };
  599. }
  600. function commentReference(options) {
  601. return {
  602. type: types.commentReference,
  603. commentId: options.commentId
  604. };
  605. }
  606. function comment(options) {
  607. return {
  608. type: types.comment,
  609. commentId: options.commentId,
  610. body: options.body,
  611. authorName: options.authorName,
  612. authorInitials: options.authorInitials
  613. };
  614. }
  615. function noteKey(noteType, id) {
  616. return noteType + "-" + id;
  617. }
  618. function Image(options) {
  619. return {
  620. type: types.image,
  621. // `read` is retained for backwards compatibility, but other read
  622. // methods should be preferred.
  623. read: function(encoding) {
  624. if (encoding) {
  625. return options.readImage(encoding);
  626. } else {
  627. return options.readImage().then(function(arrayBuffer) {
  628. return Buffer.from(arrayBuffer);
  629. });
  630. }
  631. },
  632. readAsArrayBuffer: function() {
  633. return options.readImage();
  634. },
  635. readAsBase64String: function() {
  636. return options.readImage("base64");
  637. },
  638. readAsBuffer: function() {
  639. return options.readImage().then(function(arrayBuffer) {
  640. return Buffer.from(arrayBuffer);
  641. });
  642. },
  643. altText: options.altText,
  644. contentType: options.contentType
  645. };
  646. }
  647. function Table(children, properties) {
  648. properties = properties || {};
  649. return {
  650. type: types.table,
  651. children: children,
  652. styleId: properties.styleId || null,
  653. styleName: properties.styleName || null
  654. };
  655. }
  656. function TableRow(children, options) {
  657. options = options || {};
  658. return {
  659. type: types.tableRow,
  660. children: children,
  661. isHeader: options.isHeader || false
  662. };
  663. }
  664. function TableCell(children, options) {
  665. options = options || {};
  666. return {
  667. type: types.tableCell,
  668. children: children,
  669. colSpan: options.colSpan == null ? 1 : options.colSpan,
  670. rowSpan: options.rowSpan == null ? 1 : options.rowSpan
  671. };
  672. }
  673. function Break(breakType) {
  674. return {
  675. type: types["break"],
  676. breakType: breakType
  677. };
  678. }
  679. function BookmarkStart(options) {
  680. return {
  681. type: types.bookmarkStart,
  682. name: options.name
  683. };
  684. }
  685. exports.document = exports.Document = Document;
  686. exports.paragraph = exports.Paragraph = Paragraph;
  687. exports.run = exports.Run = Run;
  688. exports.text = exports.Text = Text;
  689. exports.tab = exports.Tab = Tab;
  690. exports.Hyperlink = Hyperlink;
  691. exports.noteReference = exports.NoteReference = NoteReference;
  692. exports.Notes = Notes;
  693. exports.Note = Note;
  694. exports.commentReference = commentReference;
  695. exports.comment = comment;
  696. exports.Image = Image;
  697. exports.Table = Table;
  698. exports.TableRow = TableRow;
  699. exports.TableCell = TableCell;
  700. exports.lineBreak = Break("line");
  701. exports.pageBreak = Break("page");
  702. exports.columnBreak = Break("column");
  703. exports.BookmarkStart = BookmarkStart;
  704. exports.verticalAlignment = verticalAlignment;
  705. }).call(this,require("buffer").Buffer)
  706. },{"buffer":83,"underscore":102}],5:[function(require,module,exports){
  707. exports.createBodyReader = createBodyReader;
  708. exports._readNumberingProperties = readNumberingProperties;
  709. var dingbatToUnicode = require("dingbat-to-unicode");
  710. var _ = require("underscore");
  711. var documents = require("../documents");
  712. var Result = require("../results").Result;
  713. var warning = require("../results").warning;
  714. var uris = require("./uris");
  715. function createBodyReader(options) {
  716. return {
  717. readXmlElement: function(element) {
  718. return new BodyReader(options).readXmlElement(element);
  719. },
  720. readXmlElements: function(elements) {
  721. return new BodyReader(options).readXmlElements(elements);
  722. }
  723. };
  724. }
  725. function BodyReader(options) {
  726. var complexFieldStack = [];
  727. var currentInstrText = [];
  728. // When a paragraph is marked as deleted, its contents should be combined
  729. // with the following paragraph. See 17.13.5.15 del (Deleted Paragraph) of
  730. // ECMA-376 4th edition Part 1.
  731. var deletedParagraphContents = [];
  732. var relationships = options.relationships;
  733. var contentTypes = options.contentTypes;
  734. var docxFile = options.docxFile;
  735. var files = options.files;
  736. var numbering = options.numbering;
  737. var styles = options.styles;
  738. function readXmlElements(elements) {
  739. var results = elements.map(readXmlElement);
  740. return combineResults(results);
  741. }
  742. function readXmlElement(element) {
  743. if (element.type === "element") {
  744. var handler = xmlElementReaders[element.name];
  745. if (handler) {
  746. return handler(element);
  747. } else if (!Object.prototype.hasOwnProperty.call(ignoreElements, element.name)) {
  748. var message = warning("An unrecognised element was ignored: " + element.name);
  749. return emptyResultWithMessages([message]);
  750. }
  751. }
  752. return emptyResult();
  753. }
  754. function readParagraphProperties(element) {
  755. return readParagraphStyle(element).map(function(style) {
  756. return {
  757. type: "paragraphProperties",
  758. styleId: style.styleId,
  759. styleName: style.name,
  760. alignment: element.firstOrEmpty("w:jc").attributes["w:val"],
  761. numbering: readNumberingProperties(style.styleId, element.firstOrEmpty("w:numPr"), numbering),
  762. indent: readParagraphIndent(element.firstOrEmpty("w:ind"))
  763. };
  764. });
  765. }
  766. function readParagraphIndent(element) {
  767. return {
  768. start: element.attributes["w:start"] || element.attributes["w:left"],
  769. end: element.attributes["w:end"] || element.attributes["w:right"],
  770. firstLine: element.attributes["w:firstLine"],
  771. hanging: element.attributes["w:hanging"]
  772. };
  773. }
  774. function readRunProperties(element) {
  775. return readRunStyle(element).map(function(style) {
  776. var fontSizeString = element.firstOrEmpty("w:sz").attributes["w:val"];
  777. // w:sz gives the font size in half points, so halve the value to get the size in points
  778. var fontSize = /^[0-9]+$/.test(fontSizeString) ? parseInt(fontSizeString, 10) / 2 : null;
  779. return {
  780. type: "runProperties",
  781. styleId: style.styleId,
  782. styleName: style.name,
  783. verticalAlignment: element.firstOrEmpty("w:vertAlign").attributes["w:val"],
  784. font: element.firstOrEmpty("w:rFonts").attributes["w:ascii"],
  785. fontSize: fontSize,
  786. isBold: readBooleanElement(element.first("w:b")),
  787. isUnderline: readUnderline(element.first("w:u")),
  788. isItalic: readBooleanElement(element.first("w:i")),
  789. isStrikethrough: readBooleanElement(element.first("w:strike")),
  790. isAllCaps: readBooleanElement(element.first("w:caps")),
  791. isSmallCaps: readBooleanElement(element.first("w:smallCaps")),
  792. highlight: readHighlightValue(element.firstOrEmpty("w:highlight").attributes["w:val"])
  793. };
  794. });
  795. }
  796. function readUnderline(element) {
  797. if (element) {
  798. var value = element.attributes["w:val"];
  799. return value !== undefined && value !== "false" && value !== "0" && value !== "none";
  800. } else {
  801. return false;
  802. }
  803. }
  804. function readBooleanElement(element) {
  805. if (element) {
  806. var value = element.attributes["w:val"];
  807. return value !== "false" && value !== "0";
  808. } else {
  809. return false;
  810. }
  811. }
  812. function readHighlightValue(value) {
  813. if (!value || value === "none") {
  814. return null;
  815. } else {
  816. return value;
  817. }
  818. }
  819. function readParagraphStyle(element) {
  820. return readStyle(element, "w:pStyle", "Paragraph", styles.findParagraphStyleById);
  821. }
  822. function readRunStyle(element) {
  823. return readStyle(element, "w:rStyle", "Run", styles.findCharacterStyleById);
  824. }
  825. function readTableStyle(element) {
  826. return readStyle(element, "w:tblStyle", "Table", styles.findTableStyleById);
  827. }
  828. function readStyle(element, styleTagName, styleType, findStyleById) {
  829. var messages = [];
  830. var styleElement = element.first(styleTagName);
  831. var styleId = null;
  832. var name = null;
  833. if (styleElement) {
  834. styleId = styleElement.attributes["w:val"];
  835. if (styleId) {
  836. var style = findStyleById(styleId);
  837. if (style) {
  838. name = style.name;
  839. } else {
  840. messages.push(undefinedStyleWarning(styleType, styleId));
  841. }
  842. }
  843. }
  844. return elementResultWithMessages({styleId: styleId, name: name}, messages);
  845. }
  846. var unknownComplexField = {type: "unknown"};
  847. function readFldChar(element) {
  848. var type = element.attributes["w:fldCharType"];
  849. if (type === "begin") {
  850. complexFieldStack.push(unknownComplexField);
  851. currentInstrText = [];
  852. } else if (type === "end") {
  853. complexFieldStack.pop();
  854. } else if (type === "separate") {
  855. var hyperlinkOptions = parseHyperlinkFieldCode(currentInstrText.join(''));
  856. var complexField = hyperlinkOptions === null ? unknownComplexField : {type: "hyperlink", options: hyperlinkOptions};
  857. complexFieldStack.pop();
  858. complexFieldStack.push(complexField);
  859. }
  860. return emptyResult();
  861. }
  862. function currentHyperlinkOptions() {
  863. var topHyperlink = _.last(complexFieldStack.filter(function(complexField) {
  864. return complexField.type === "hyperlink";
  865. }));
  866. return topHyperlink ? topHyperlink.options : null;
  867. }
  868. function parseHyperlinkFieldCode(code) {
  869. var externalLinkResult = /\s*HYPERLINK "(.*)"/.exec(code);
  870. if (externalLinkResult) {
  871. return {href: externalLinkResult[1]};
  872. }
  873. var internalLinkResult = /\s*HYPERLINK\s+\\l\s+"(.*)"/.exec(code);
  874. if (internalLinkResult) {
  875. return {anchor: internalLinkResult[1]};
  876. }
  877. return null;
  878. }
  879. function readInstrText(element) {
  880. currentInstrText.push(element.text());
  881. return emptyResult();
  882. }
  883. function readSymbol(element) {
  884. // See 17.3.3.30 sym (Symbol Character) of ECMA-376 4th edition Part 1
  885. var font = element.attributes["w:font"];
  886. var char = element.attributes["w:char"];
  887. var unicodeCharacter = dingbatToUnicode.hex(font, char);
  888. if (unicodeCharacter == null && /^F0..$/.test(char)) {
  889. unicodeCharacter = dingbatToUnicode.hex(font, char.substring(2));
  890. }
  891. if (unicodeCharacter == null) {
  892. return emptyResultWithMessages([warning(
  893. "A w:sym element with an unsupported character was ignored: char " + char + " in font " + font
  894. )]);
  895. } else {
  896. return elementResult(new documents.Text(unicodeCharacter.string));
  897. }
  898. }
  899. function noteReferenceReader(noteType) {
  900. return function(element) {
  901. var noteId = element.attributes["w:id"];
  902. return elementResult(new documents.NoteReference({
  903. noteType: noteType,
  904. noteId: noteId
  905. }));
  906. };
  907. }
  908. function readCommentReference(element) {
  909. return elementResult(documents.commentReference({
  910. commentId: element.attributes["w:id"]
  911. }));
  912. }
  913. function readChildElements(element) {
  914. return readXmlElements(element.children);
  915. }
  916. var xmlElementReaders = {
  917. "w:p": function(element) {
  918. var paragraphPropertiesElement = element.firstOrEmpty("w:pPr");
  919. var isDeleted = !!paragraphPropertiesElement
  920. .firstOrEmpty("w:rPr")
  921. .first("w:del");
  922. if (isDeleted) {
  923. element.children.forEach(function(child) {
  924. deletedParagraphContents.push(child);
  925. });
  926. return emptyResult();
  927. } else {
  928. var childrenXml = element.children;
  929. if (deletedParagraphContents.length > 0) {
  930. childrenXml = deletedParagraphContents.concat(childrenXml);
  931. deletedParagraphContents = [];
  932. }
  933. return ReadResult.map(
  934. readParagraphProperties(paragraphPropertiesElement),
  935. readXmlElements(childrenXml),
  936. function(properties, children) {
  937. return new documents.Paragraph(children, properties);
  938. }
  939. ).insertExtra();
  940. }
  941. },
  942. "w:r": function(element) {
  943. return ReadResult.map(
  944. readRunProperties(element.firstOrEmpty("w:rPr")),
  945. readXmlElements(element.children),
  946. function(properties, children) {
  947. var hyperlinkOptions = currentHyperlinkOptions();
  948. if (hyperlinkOptions !== null) {
  949. children = [new documents.Hyperlink(children, hyperlinkOptions)];
  950. }
  951. return new documents.Run(children, properties);
  952. }
  953. );
  954. },
  955. "w:fldChar": readFldChar,
  956. "w:instrText": readInstrText,
  957. "w:t": function(element) {
  958. return elementResult(new documents.Text(element.text()));
  959. },
  960. "w:tab": function(element) {
  961. return elementResult(new documents.Tab());
  962. },
  963. "w:noBreakHyphen": function() {
  964. return elementResult(new documents.Text("\u2011"));
  965. },
  966. "w:softHyphen": function(element) {
  967. return elementResult(new documents.Text("\u00AD"));
  968. },
  969. "w:sym": readSymbol,
  970. "w:hyperlink": function(element) {
  971. var relationshipId = element.attributes["r:id"];
  972. var anchor = element.attributes["w:anchor"];
  973. return readXmlElements(element.children).map(function(children) {
  974. function create(options) {
  975. var targetFrame = element.attributes["w:tgtFrame"] || null;
  976. return new documents.Hyperlink(
  977. children,
  978. _.extend({targetFrame: targetFrame}, options)
  979. );
  980. }
  981. if (relationshipId) {
  982. var href = relationships.findTargetByRelationshipId(relationshipId);
  983. if (anchor) {
  984. href = uris.replaceFragment(href, anchor);
  985. }
  986. return create({href: href});
  987. } else if (anchor) {
  988. return create({anchor: anchor});
  989. } else {
  990. return children;
  991. }
  992. });
  993. },
  994. "w:tbl": readTable,
  995. "w:tr": readTableRow,
  996. "w:tc": readTableCell,
  997. "w:footnoteReference": noteReferenceReader("footnote"),
  998. "w:endnoteReference": noteReferenceReader("endnote"),
  999. "w:commentReference": readCommentReference,
  1000. "w:br": function(element) {
  1001. var breakType = element.attributes["w:type"];
  1002. if (breakType == null || breakType === "textWrapping") {
  1003. return elementResult(documents.lineBreak);
  1004. } else if (breakType === "page") {
  1005. return elementResult(documents.pageBreak);
  1006. } else if (breakType === "column") {
  1007. return elementResult(documents.columnBreak);
  1008. } else {
  1009. return emptyResultWithMessages([warning("Unsupported break type: " + breakType)]);
  1010. }
  1011. },
  1012. "w:bookmarkStart": function(element){
  1013. var name = element.attributes["w:name"];
  1014. if (name === "_GoBack") {
  1015. return emptyResult();
  1016. } else {
  1017. return elementResult(new documents.BookmarkStart({name: name}));
  1018. }
  1019. },
  1020. "mc:AlternateContent": function(element) {
  1021. return readChildElements(element.first("mc:Fallback"));
  1022. },
  1023. "w:sdt": function(element) {
  1024. return readXmlElements(element.firstOrEmpty("w:sdtContent").children);
  1025. },
  1026. "w:ins": readChildElements,
  1027. "w:object": readChildElements,
  1028. "w:smartTag": readChildElements,
  1029. "w:drawing": readChildElements,
  1030. "w:pict": function(element) {
  1031. return readChildElements(element).toExtra();
  1032. },
  1033. "v:roundrect": readChildElements,
  1034. "v:shape": readChildElements,
  1035. "v:textbox": readChildElements,
  1036. "w:txbxContent": readChildElements,
  1037. "wp:inline": readDrawingElement,
  1038. "wp:anchor": readDrawingElement,
  1039. "v:imagedata": readImageData,
  1040. "v:group": readChildElements,
  1041. "v:rect": readChildElements
  1042. };
  1043. return {
  1044. readXmlElement: readXmlElement,
  1045. readXmlElements: readXmlElements
  1046. };
  1047. function readTable(element) {
  1048. var propertiesResult = readTableProperties(element.firstOrEmpty("w:tblPr"));
  1049. return readXmlElements(element.children)
  1050. .flatMap(calculateRowSpans)
  1051. .flatMap(function(children) {
  1052. return propertiesResult.map(function(properties) {
  1053. return documents.Table(children, properties);
  1054. });
  1055. });
  1056. }
  1057. function readTableProperties(element) {
  1058. return readTableStyle(element).map(function(style) {
  1059. return {
  1060. styleId: style.styleId,
  1061. styleName: style.name
  1062. };
  1063. });
  1064. }
  1065. function readTableRow(element) {
  1066. var properties = element.firstOrEmpty("w:trPr");
  1067. var isHeader = !!properties.first("w:tblHeader");
  1068. return readXmlElements(element.children).map(function(children) {
  1069. return documents.TableRow(children, {isHeader: isHeader});
  1070. });
  1071. }
  1072. function readTableCell(element) {
  1073. return readXmlElements(element.children).map(function(children) {
  1074. var properties = element.firstOrEmpty("w:tcPr");
  1075. var gridSpan = properties.firstOrEmpty("w:gridSpan").attributes["w:val"];
  1076. var colSpan = gridSpan ? parseInt(gridSpan, 10) : 1;
  1077. var cell = documents.TableCell(children, {colSpan: colSpan});
  1078. cell._vMerge = readVMerge(properties);
  1079. return cell;
  1080. });
  1081. }
  1082. function readVMerge(properties) {
  1083. var element = properties.first("w:vMerge");
  1084. if (element) {
  1085. var val = element.attributes["w:val"];
  1086. return val === "continue" || !val;
  1087. } else {
  1088. return null;
  1089. }
  1090. }
  1091. function calculateRowSpans(rows) {
  1092. var unexpectedNonRows = _.any(rows, function(row) {
  1093. return row.type !== documents.types.tableRow;
  1094. });
  1095. if (unexpectedNonRows) {
  1096. return elementResultWithMessages(rows, [warning(
  1097. "unexpected non-row element in table, cell merging may be incorrect"
  1098. )]);
  1099. }
  1100. var unexpectedNonCells = _.any(rows, function(row) {
  1101. return _.any(row.children, function(cell) {
  1102. return cell.type !== documents.types.tableCell;
  1103. });
  1104. });
  1105. if (unexpectedNonCells) {
  1106. return elementResultWithMessages(rows, [warning(
  1107. "unexpected non-cell element in table row, cell merging may be incorrect"
  1108. )]);
  1109. }
  1110. var columns = {};
  1111. rows.forEach(function(row) {
  1112. var cellIndex = 0;
  1113. row.children.forEach(function(cell) {
  1114. if (cell._vMerge && columns[cellIndex]) {
  1115. columns[cellIndex].rowSpan++;
  1116. } else {
  1117. columns[cellIndex] = cell;
  1118. cell._vMerge = false;
  1119. }
  1120. cellIndex += cell.colSpan;
  1121. });
  1122. });
  1123. rows.forEach(function(row) {
  1124. row.children = row.children.filter(function(cell) {
  1125. return !cell._vMerge;
  1126. });
  1127. row.children.forEach(function(cell) {
  1128. delete cell._vMerge;
  1129. });
  1130. });
  1131. return elementResult(rows);
  1132. }
  1133. function readDrawingElement(element) {
  1134. var blips = element
  1135. .getElementsByTagName("a:graphic")
  1136. .getElementsByTagName("a:graphicData")
  1137. .getElementsByTagName("pic:pic")
  1138. .getElementsByTagName("pic:blipFill")
  1139. .getElementsByTagName("a:blip");
  1140. return combineResults(blips.map(readBlip.bind(null, element)));
  1141. }
  1142. function readBlip(element, blip) {
  1143. var properties = element.first("wp:docPr").attributes;
  1144. var altText = isBlank(properties.descr) ? properties.title : properties.descr;
  1145. var blipImageFile = findBlipImageFile(blip);
  1146. if (blipImageFile === null) {
  1147. return emptyResultWithMessages([warning("Could not find image file for a:blip element")]);
  1148. } else {
  1149. return readImage(blipImageFile, altText);
  1150. }
  1151. }
  1152. function isBlank(value) {
  1153. return value == null || /^\s*$/.test(value);
  1154. }
  1155. function findBlipImageFile(blip) {
  1156. var embedRelationshipId = blip.attributes["r:embed"];
  1157. var linkRelationshipId = blip.attributes["r:link"];
  1158. if (embedRelationshipId) {
  1159. return findEmbeddedImageFile(embedRelationshipId);
  1160. } else if (linkRelationshipId) {
  1161. var imagePath = relationships.findTargetByRelationshipId(linkRelationshipId);
  1162. return {
  1163. path: imagePath,
  1164. read: files.read.bind(files, imagePath)
  1165. };
  1166. } else {
  1167. return null;
  1168. }
  1169. }
  1170. function readImageData(element) {
  1171. var relationshipId = element.attributes['r:id'];
  1172. if (relationshipId) {
  1173. return readImage(
  1174. findEmbeddedImageFile(relationshipId),
  1175. element.attributes["o:title"]);
  1176. } else {
  1177. return emptyResultWithMessages([warning("A v:imagedata element without a relationship ID was ignored")]);
  1178. }
  1179. }
  1180. function findEmbeddedImageFile(relationshipId) {
  1181. var path = uris.uriToZipEntryName("word", relationships.findTargetByRelationshipId(relationshipId));
  1182. return {
  1183. path: path,
  1184. read: docxFile.read.bind(docxFile, path)
  1185. };
  1186. }
  1187. function readImage(imageFile, altText) {
  1188. var contentType = contentTypes.findContentType(imageFile.path);
  1189. var image = documents.Image({
  1190. readImage: imageFile.read,
  1191. altText: altText,
  1192. contentType: contentType
  1193. });
  1194. var warnings = supportedImageTypes[contentType] ?
  1195. [] : warning("Image of type " + contentType + " is unlikely to display in web browsers");
  1196. return elementResultWithMessages(image, warnings);
  1197. }
  1198. function undefinedStyleWarning(type, styleId) {
  1199. return warning(
  1200. type + " style with ID " + styleId + " was referenced but not defined in the document");
  1201. }
  1202. }
  1203. function readNumberingProperties(styleId, element, numbering) {
  1204. var level = element.firstOrEmpty("w:ilvl").attributes["w:val"];
  1205. var numId = element.firstOrEmpty("w:numId").attributes["w:val"];
  1206. if (level !== undefined && numId !== undefined) {
  1207. return numbering.findLevel(numId, level);
  1208. }
  1209. if (styleId != null) {
  1210. var levelByStyleId = numbering.findLevelByParagraphStyleId(styleId);
  1211. if (levelByStyleId != null) {
  1212. return levelByStyleId;
  1213. }
  1214. }
  1215. return null;
  1216. }
  1217. var supportedImageTypes = {
  1218. "image/png": true,
  1219. "image/gif": true,
  1220. "image/jpeg": true,
  1221. "image/svg+xml": true,
  1222. "image/tiff": true
  1223. };
  1224. var ignoreElements = {
  1225. "office-word:wrap": true,
  1226. "v:shadow": true,
  1227. "v:shapetype": true,
  1228. "w:annotationRef": true,
  1229. "w:bookmarkEnd": true,
  1230. "w:sectPr": true,
  1231. "w:proofErr": true,
  1232. "w:lastRenderedPageBreak": true,
  1233. "w:commentRangeStart": true,
  1234. "w:commentRangeEnd": true,
  1235. "w:del": true,
  1236. "w:footnoteRef": true,
  1237. "w:endnoteRef": true,
  1238. "w:pPr": true,
  1239. "w:rPr": true,
  1240. "w:tblPr": true,
  1241. "w:tblGrid": true,
  1242. "w:trPr": true,
  1243. "w:tcPr": true
  1244. };
  1245. function emptyResultWithMessages(messages) {
  1246. return new ReadResult(null, null, messages);
  1247. }
  1248. function emptyResult() {
  1249. return new ReadResult(null);
  1250. }
  1251. function elementResult(element) {
  1252. return new ReadResult(element);
  1253. }
  1254. function elementResultWithMessages(element, messages) {
  1255. return new ReadResult(element, null, messages);
  1256. }
  1257. function ReadResult(element, extra, messages) {
  1258. this.value = element || [];
  1259. this.extra = extra || [];
  1260. this._result = new Result({
  1261. element: this.value,
  1262. extra: extra
  1263. }, messages);
  1264. this.messages = this._result.messages;
  1265. }
  1266. ReadResult.prototype.toExtra = function() {
  1267. return new ReadResult(null, joinElements(this.extra, this.value), this.messages);
  1268. };
  1269. ReadResult.prototype.insertExtra = function() {
  1270. var extra = this.extra;
  1271. if (extra && extra.length) {
  1272. return new ReadResult(joinElements(this.value, extra), null, this.messages);
  1273. } else {
  1274. return this;
  1275. }
  1276. };
  1277. ReadResult.prototype.map = function(func) {
  1278. var result = this._result.map(function(value) {
  1279. return func(value.element);
  1280. });
  1281. return new ReadResult(result.value, this.extra, result.messages);
  1282. };
  1283. ReadResult.prototype.flatMap = function(func) {
  1284. var result = this._result.flatMap(function(value) {
  1285. return func(value.element)._result;
  1286. });
  1287. return new ReadResult(result.value.element, joinElements(this.extra, result.value.extra), result.messages);
  1288. };
  1289. ReadResult.map = function(first, second, func) {
  1290. return new ReadResult(
  1291. func(first.value, second.value),
  1292. joinElements(first.extra, second.extra),
  1293. first.messages.concat(second.messages)
  1294. );
  1295. };
  1296. function combineResults(results) {
  1297. var result = Result.combine(_.pluck(results, "_result"));
  1298. return new ReadResult(
  1299. _.flatten(_.pluck(result.value, "element")),
  1300. _.filter(_.flatten(_.pluck(result.value, "extra")), identity),
  1301. result.messages
  1302. );
  1303. }
  1304. function joinElements(first, second) {
  1305. return _.flatten([first, second]);
  1306. }
  1307. function identity(value) {
  1308. return value;
  1309. }
  1310. },{"../documents":4,"../results":25,"./uris":16,"dingbat-to-unicode":85,"underscore":102}],6:[function(require,module,exports){
  1311. var documents = require("../documents");
  1312. var Result = require("../results").Result;
  1313. function createCommentsReader(bodyReader) {
  1314. function readCommentsXml(element) {
  1315. return Result.combine(element.getElementsByTagName("w:comment")
  1316. .map(readCommentElement));
  1317. }
  1318. function readCommentElement(element) {
  1319. var id = element.attributes["w:id"];
  1320. function readOptionalAttribute(name) {
  1321. return (element.attributes[name] || "").trim() || null;
  1322. }
  1323. return bodyReader.readXmlElements(element.children)
  1324. .map(function(body) {
  1325. return documents.comment({
  1326. commentId: id,
  1327. body: body,
  1328. authorName: readOptionalAttribute("w:author"),
  1329. authorInitials: readOptionalAttribute("w:initials")
  1330. });
  1331. });
  1332. }
  1333. return readCommentsXml;
  1334. }
  1335. exports.createCommentsReader = createCommentsReader;
  1336. },{"../documents":4,"../results":25}],7:[function(require,module,exports){
  1337. exports.readContentTypesFromXml = readContentTypesFromXml;
  1338. var fallbackContentTypes = {
  1339. "png": "png",
  1340. "gif": "gif",
  1341. "jpeg": "jpeg",
  1342. "jpg": "jpeg",
  1343. "tif": "tiff",
  1344. "tiff": "tiff",
  1345. "bmp": "bmp"
  1346. };
  1347. exports.defaultContentTypes = contentTypes({}, {});
  1348. function readContentTypesFromXml(element) {
  1349. var extensionDefaults = {};
  1350. var overrides = {};
  1351. element.children.forEach(function(child) {
  1352. if (child.name === "content-types:Default") {
  1353. extensionDefaults[child.attributes.Extension] = child.attributes.ContentType;
  1354. }
  1355. if (child.name === "content-types:Override") {
  1356. var name = child.attributes.PartName;
  1357. if (name.charAt(0) === "/") {
  1358. name = name.substring(1);
  1359. }
  1360. overrides[name] = child.attributes.ContentType;
  1361. }
  1362. });
  1363. return contentTypes(overrides, extensionDefaults);
  1364. }
  1365. function contentTypes(overrides, extensionDefaults) {
  1366. return {
  1367. findContentType: function(path) {
  1368. var overrideContentType = overrides[path];
  1369. if (overrideContentType) {
  1370. return overrideContentType;
  1371. } else {
  1372. var pathParts = path.split(".");
  1373. var extension = pathParts[pathParts.length - 1];
  1374. if (extensionDefaults.hasOwnProperty(extension)) {
  1375. return extensionDefaults[extension];
  1376. } else {
  1377. var fallback = fallbackContentTypes[extension.toLowerCase()];
  1378. if (fallback) {
  1379. return "image/" + fallback;
  1380. } else {
  1381. return null;
  1382. }
  1383. }
  1384. }
  1385. }
  1386. };
  1387. }
  1388. },{}],8:[function(require,module,exports){
  1389. exports.DocumentXmlReader = DocumentXmlReader;
  1390. var documents = require("../documents");
  1391. var Result = require("../results").Result;
  1392. function DocumentXmlReader(options) {
  1393. var bodyReader = options.bodyReader;
  1394. function convertXmlToDocument(element) {
  1395. var body = element.first("w:body");
  1396. if (body == null) {
  1397. throw new Error("Could not find the body element: are you sure this is a docx file?");
  1398. }
  1399. var result = bodyReader.readXmlElements(body.children)
  1400. .map(function(children) {
  1401. return new documents.Document(children, {
  1402. notes: options.notes,
  1403. comments: options.comments
  1404. });
  1405. });
  1406. return new Result(result.value, result.messages);
  1407. }
  1408. return {
  1409. convertXmlToDocument: convertXmlToDocument
  1410. };
  1411. }
  1412. },{"../documents":4,"../results":25}],9:[function(require,module,exports){
  1413. exports.read = read;
  1414. exports._findPartPaths = findPartPaths;
  1415. var promises = require("../promises");
  1416. var documents = require("../documents");
  1417. var Result = require("../results").Result;
  1418. var zipfile = require("../zipfile");
  1419. var readXmlFromZipFile = require("./office-xml-reader").readXmlFromZipFile;
  1420. var createBodyReader = require("./body-reader").createBodyReader;
  1421. var DocumentXmlReader = require("./document-xml-reader").DocumentXmlReader;
  1422. var relationshipsReader = require("./relationships-reader");
  1423. var contentTypesReader = require("./content-types-reader");
  1424. var numberingXml = require("./numbering-xml");
  1425. var stylesReader = require("./styles-reader");
  1426. var notesReader = require("./notes-reader");
  1427. var commentsReader = require("./comments-reader");
  1428. var Files = require("./files").Files;
  1429. function read(docxFile, input) {
  1430. input = input || {};
  1431. return promises.props({
  1432. contentTypes: readContentTypesFromZipFile(docxFile),
  1433. partPaths: findPartPaths(docxFile),
  1434. docxFile: docxFile,
  1435. files: input.path ? Files.relativeToFile(input.path) : new Files(null)
  1436. }).also(function(result) {
  1437. return {
  1438. styles: readStylesFromZipFile(docxFile, result.partPaths.styles)
  1439. };
  1440. }).also(function(result) {
  1441. return {
  1442. numbering: readNumberingFromZipFile(docxFile, result.partPaths.numbering, result.styles)
  1443. };
  1444. }).also(function(result) {
  1445. return {
  1446. footnotes: readXmlFileWithBody(result.partPaths.footnotes, result, function(bodyReader, xml) {
  1447. if (xml) {
  1448. return notesReader.createFootnotesReader(bodyReader)(xml);
  1449. } else {
  1450. return new Result([]);
  1451. }
  1452. }),
  1453. endnotes: readXmlFileWithBody(result.partPaths.endnotes, result, function(bodyReader, xml) {
  1454. if (xml) {
  1455. return notesReader.createEndnotesReader(bodyReader)(xml);
  1456. } else {
  1457. return new Result([]);
  1458. }
  1459. }),
  1460. comments: readXmlFileWithBody(result.partPaths.comments, result, function(bodyReader, xml) {
  1461. if (xml) {
  1462. return commentsReader.createCommentsReader(bodyReader)(xml);
  1463. } else {
  1464. return new Result([]);
  1465. }
  1466. })
  1467. };
  1468. }).also(function(result) {
  1469. return {
  1470. notes: result.footnotes.flatMap(function(footnotes) {
  1471. return result.endnotes.map(function(endnotes) {
  1472. return new documents.Notes(footnotes.concat(endnotes));
  1473. });
  1474. })
  1475. };
  1476. }).then(function(result) {
  1477. return readXmlFileWithBody(result.partPaths.mainDocument, result, function(bodyReader, xml) {
  1478. return result.notes.flatMap(function(notes) {
  1479. return result.comments.flatMap(function(comments) {
  1480. var reader = new DocumentXmlReader({
  1481. bodyReader: bodyReader,
  1482. notes: notes,
  1483. comments: comments
  1484. });
  1485. return reader.convertXmlToDocument(xml);
  1486. });
  1487. });
  1488. });
  1489. });
  1490. }
  1491. function findPartPaths(docxFile) {
  1492. return readPackageRelationships(docxFile).then(function(packageRelationships) {
  1493. var mainDocumentPath = findPartPath({
  1494. docxFile: docxFile,
  1495. relationships: packageRelationships,
  1496. relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
  1497. basePath: "",
  1498. fallbackPath: "word/document.xml"
  1499. });
  1500. if (!docxFile.exists(mainDocumentPath)) {
  1501. throw new Error("Could not find main document part. Are you sure this is a valid .docx file?");
  1502. }
  1503. return xmlFileReader({
  1504. filename: relationshipsFilename(mainDocumentPath),
  1505. readElement: relationshipsReader.readRelationships,
  1506. defaultValue: relationshipsReader.defaultValue
  1507. })(docxFile).then(function(documentRelationships) {
  1508. function findPartRelatedToMainDocument(name) {
  1509. return findPartPath({
  1510. docxFile: docxFile,
  1511. relationships: documentRelationships,
  1512. relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" + name,
  1513. basePath: zipfile.splitPath(mainDocumentPath).dirname,
  1514. fallbackPath: "word/" + name + ".xml"
  1515. });
  1516. }
  1517. return {
  1518. mainDocument: mainDocumentPath,
  1519. comments: findPartRelatedToMainDocument("comments"),
  1520. endnotes: findPartRelatedToMainDocument("endnotes"),
  1521. footnotes: findPartRelatedToMainDocument("footnotes"),
  1522. numbering: findPartRelatedToMainDocument("numbering"),
  1523. styles: findPartRelatedToMainDocument("styles")
  1524. };
  1525. });
  1526. });
  1527. }
  1528. function findPartPath(options) {
  1529. var docxFile = options.docxFile;
  1530. var relationships = options.relationships;
  1531. var relationshipType = options.relationshipType;
  1532. var basePath = options.basePath;
  1533. var fallbackPath = options.fallbackPath;
  1534. var targets = relationships.findTargetsByType(relationshipType);
  1535. var normalisedTargets = targets.map(function(target) {
  1536. return stripPrefix(zipfile.joinPath(basePath, target), "/");
  1537. });
  1538. var validTargets = normalisedTargets.filter(function(target) {
  1539. return docxFile.exists(target);
  1540. });
  1541. if (validTargets.length === 0) {
  1542. return fallbackPath;
  1543. } else {
  1544. return validTargets[0];
  1545. }
  1546. }
  1547. function stripPrefix(value, prefix) {
  1548. if (value.substring(0, prefix.length) === prefix) {
  1549. return value.substring(prefix.length);
  1550. } else {
  1551. return value;
  1552. }
  1553. }
  1554. function xmlFileReader(options) {
  1555. return function(zipFile) {
  1556. return readXmlFromZipFile(zipFile, options.filename)
  1557. .then(function(element) {
  1558. return element ? options.readElement(element) : options.defaultValue;
  1559. });
  1560. };
  1561. }
  1562. function readXmlFileWithBody(filename, options, func) {
  1563. var readRelationshipsFromZipFile = xmlFileReader({
  1564. filename: relationshipsFilename(filename),
  1565. readElement: relationshipsReader.readRelationships,
  1566. defaultValue: relationshipsReader.defaultValue
  1567. });
  1568. return readRelationshipsFromZipFile(options.docxFile).then(function(relationships) {
  1569. var bodyReader = new createBodyReader({
  1570. relationships: relationships,
  1571. contentTypes: options.contentTypes,
  1572. docxFile: options.docxFile,
  1573. numbering: options.numbering,
  1574. styles: options.styles,
  1575. files: options.files
  1576. });
  1577. return readXmlFromZipFile(options.docxFile, filename)
  1578. .then(function(xml) {
  1579. return func(bodyReader, xml);
  1580. });
  1581. });
  1582. }
  1583. function relationshipsFilename(filename) {
  1584. var split = zipfile.splitPath(filename);
  1585. return zipfile.joinPath(split.dirname, "_rels", split.basename + ".rels");
  1586. }
  1587. var readContentTypesFromZipFile = xmlFileReader({
  1588. filename: "[Content_Types].xml",
  1589. readElement: contentTypesReader.readContentTypesFromXml,
  1590. defaultValue: contentTypesReader.defaultContentTypes
  1591. });
  1592. function readNumberingFromZipFile(zipFile, path, styles) {
  1593. return xmlFileReader({
  1594. filename: path,
  1595. readElement: function(element) {
  1596. return numberingXml.readNumberingXml(element, {styles: styles});
  1597. },
  1598. defaultValue: numberingXml.defaultNumbering
  1599. })(zipFile);
  1600. }
  1601. function readStylesFromZipFile(zipFile, path) {
  1602. return xmlFileReader({
  1603. filename: path,
  1604. readElement: stylesReader.readStylesXml,
  1605. defaultValue: stylesReader.defaultStyles
  1606. })(zipFile);
  1607. }
  1608. var readPackageRelationships = xmlFileReader({
  1609. filename: "_rels/.rels",
  1610. readElement: relationshipsReader.readRelationships,
  1611. defaultValue: relationshipsReader.defaultValue
  1612. });
  1613. },{"../documents":4,"../promises":23,"../results":25,"../zipfile":40,"./body-reader":5,"./comments-reader":6,"./content-types-reader":7,"./document-xml-reader":8,"./files":1,"./notes-reader":10,"./numbering-xml":11,"./office-xml-reader":12,"./relationships-reader":13,"./styles-reader":15}],10:[function(require,module,exports){
  1614. var documents = require("../documents");
  1615. var Result = require("../results").Result;
  1616. exports.createFootnotesReader = createReader.bind(this, "footnote");
  1617. exports.createEndnotesReader = createReader.bind(this, "endnote");
  1618. function createReader(noteType, bodyReader) {
  1619. function readNotesXml(element) {
  1620. return Result.combine(element.getElementsByTagName("w:" + noteType)
  1621. .filter(isFootnoteElement)
  1622. .map(readFootnoteElement));
  1623. }
  1624. function isFootnoteElement(element) {
  1625. var type = element.attributes["w:type"];
  1626. return type !== "continuationSeparator" && type !== "separator";
  1627. }
  1628. function readFootnoteElement(footnoteElement) {
  1629. var id = footnoteElement.attributes["w:id"];
  1630. return bodyReader.readXmlElements(footnoteElement.children)
  1631. .map(function(body) {
  1632. return documents.Note({noteType: noteType, noteId: id, body: body});
  1633. });
  1634. }
  1635. return readNotesXml;
  1636. }
  1637. },{"../documents":4,"../results":25}],11:[function(require,module,exports){
  1638. var _ = require("underscore");
  1639. exports.readNumberingXml = readNumberingXml;
  1640. exports.Numbering = Numbering;
  1641. exports.defaultNumbering = new Numbering({}, {});
  1642. function Numbering(nums, abstractNums, styles) {
  1643. var allLevels = _.flatten(_.values(abstractNums).map(function(abstractNum) {
  1644. return _.values(abstractNum.levels);
  1645. }));
  1646. var levelsByParagraphStyleId = _.indexBy(
  1647. allLevels.filter(function(level) {
  1648. return level.paragraphStyleId != null;
  1649. }),
  1650. "paragraphStyleId"
  1651. );
  1652. function findLevel(numId, level) {
  1653. var num = nums[numId];
  1654. if (num) {
  1655. var abstractNum = abstractNums[num.abstractNumId];
  1656. if (!abstractNum) {
  1657. return null;
  1658. } else if (abstractNum.numStyleLink == null) {
  1659. return abstractNums[num.abstractNumId].levels[level];
  1660. } else {
  1661. var style = styles.findNumberingStyleById(abstractNum.numStyleLink);
  1662. return findLevel(style.numId, level);
  1663. }
  1664. } else {
  1665. return null;
  1666. }
  1667. }
  1668. function findLevelByParagraphStyleId(styleId) {
  1669. return levelsByParagraphStyleId[styleId] || null;
  1670. }
  1671. return {
  1672. findLevel: findLevel,
  1673. findLevelByParagraphStyleId: findLevelByParagraphStyleId
  1674. };
  1675. }
  1676. function readNumberingXml(root, options) {
  1677. if (!options || !options.styles) {
  1678. throw new Error("styles is missing");
  1679. }
  1680. var abstractNums = readAbstractNums(root);
  1681. var nums = readNums(root, abstractNums);
  1682. return new Numbering(nums, abstractNums, options.styles);
  1683. }
  1684. function readAbstractNums(root) {
  1685. var abstractNums = {};
  1686. root.getElementsByTagName("w:abstractNum").forEach(function(element) {
  1687. var id = element.attributes["w:abstractNumId"];
  1688. abstractNums[id] = readAbstractNum(element);
  1689. });
  1690. return abstractNums;
  1691. }
  1692. function readAbstractNum(element) {
  1693. var levels = {};
  1694. element.getElementsByTagName("w:lvl").forEach(function(levelElement) {
  1695. var levelIndex = levelElement.attributes["w:ilvl"];
  1696. var numFmt = levelElement.firstOrEmpty("w:numFmt").attributes["w:val"];
  1697. var paragraphStyleId = levelElement.firstOrEmpty("w:pStyle").attributes["w:val"];
  1698. levels[levelIndex] = {
  1699. isOrdered: numFmt !== "bullet",
  1700. level: levelIndex,
  1701. paragraphStyleId: paragraphStyleId
  1702. };
  1703. });
  1704. var numStyleLink = element.firstOrEmpty("w:numStyleLink").attributes["w:val"];
  1705. return {levels: levels, numStyleLink: numStyleLink};
  1706. }
  1707. function readNums(root) {
  1708. var nums = {};
  1709. root.getElementsByTagName("w:num").forEach(function(element) {
  1710. var numId = element.attributes["w:numId"];
  1711. var abstractNumId = element.first("w:abstractNumId").attributes["w:val"];
  1712. nums[numId] = {abstractNumId: abstractNumId};
  1713. });
  1714. return nums;
  1715. }
  1716. },{"underscore":102}],12:[function(require,module,exports){
  1717. var _ = require("underscore");
  1718. var promises = require("../promises");
  1719. var xml = require("../xml");
  1720. exports.read = read;
  1721. exports.readXmlFromZipFile = readXmlFromZipFile;
  1722. var xmlNamespaceMap = {
  1723. // Transitional format
  1724. "http://schemas.openxmlformats.org/wordprocessingml/2006/main": "w",
  1725. "http://schemas.openxmlformats.org/officeDocument/2006/relationships": "r",
  1726. "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing": "wp",
  1727. "http://schemas.openxmlformats.org/drawingml/2006/main": "a",
  1728. "http://schemas.openxmlformats.org/drawingml/2006/picture": "pic",
  1729. // Strict format
  1730. "http://purl.oclc.org/ooxml/wordprocessingml/main": "w",
  1731. "http://purl.oclc.org/ooxml/officeDocument/relationships": "r",
  1732. "http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing": "wp",
  1733. "http://purl.oclc.org/ooxml/drawingml/main": "a",
  1734. "http://purl.oclc.org/ooxml/drawingml/picture": "pic",
  1735. // Common
  1736. "http://schemas.openxmlformats.org/package/2006/content-types": "content-types",
  1737. "http://schemas.openxmlformats.org/package/2006/relationships": "relationships",
  1738. "http://schemas.openxmlformats.org/markup-compatibility/2006": "mc",
  1739. "urn:schemas-microsoft-com:vml": "v",
  1740. "urn:schemas-microsoft-com:office:word": "office-word"
  1741. };
  1742. function read(xmlString) {
  1743. return xml.readString(xmlString, xmlNamespaceMap)
  1744. .then(function(document) {
  1745. return collapseAlternateContent(document)[0];
  1746. });
  1747. }
  1748. function readXmlFromZipFile(docxFile, path) {
  1749. if (docxFile.exists(path)) {
  1750. return docxFile.read(path, "utf-8")
  1751. .then(stripUtf8Bom)
  1752. .then(read);
  1753. } else {
  1754. return promises.resolve(null);
  1755. }
  1756. }
  1757. function stripUtf8Bom(xmlString) {
  1758. return xmlString.replace(/^\uFEFF/g, '');
  1759. }
  1760. function collapseAlternateContent(node) {
  1761. if (node.type === "element") {
  1762. if (node.name === "mc:AlternateContent") {
  1763. return node.first("mc:Fallback").children;
  1764. } else {
  1765. node.children = _.flatten(node.children.map(collapseAlternateContent, true));
  1766. return [node];
  1767. }
  1768. } else {
  1769. return [node];
  1770. }
  1771. }
  1772. },{"../promises":23,"../xml":35,"underscore":102}],13:[function(require,module,exports){
  1773. exports.readRelationships = readRelationships;
  1774. exports.defaultValue = new Relationships([]);
  1775. exports.Relationships = Relationships;
  1776. function readRelationships(element) {
  1777. var relationships = [];
  1778. element.children.forEach(function(child) {
  1779. if (child.name === "relationships:Relationship") {
  1780. var relationship = {
  1781. relationshipId: child.attributes.Id,
  1782. target: child.attributes.Target,
  1783. type: child.attributes.Type
  1784. };
  1785. relationships.push(relationship);
  1786. }
  1787. });
  1788. return new Relationships(relationships);
  1789. }
  1790. function Relationships(relationships) {
  1791. var targetsByRelationshipId = {};
  1792. relationships.forEach(function(relationship) {
  1793. targetsByRelationshipId[relationship.relationshipId] = relationship.target;
  1794. });
  1795. var targetsByType = {};
  1796. relationships.forEach(function(relationship) {
  1797. if (!targetsByType[relationship.type]) {
  1798. targetsByType[relationship.type] = [];
  1799. }
  1800. targetsByType[relationship.type].push(relationship.target);
  1801. });
  1802. return {
  1803. findTargetByRelationshipId: function(relationshipId) {
  1804. return targetsByRelationshipId[relationshipId];
  1805. },
  1806. findTargetsByType: function(type) {
  1807. return targetsByType[type] || [];
  1808. }
  1809. };
  1810. }
  1811. },{}],14:[function(require,module,exports){
  1812. var _ = require("underscore");
  1813. var promises = require("../promises");
  1814. var xml = require("../xml");
  1815. exports.writeStyleMap = writeStyleMap;
  1816. exports.readStyleMap = readStyleMap;
  1817. var schema = "http://schemas.zwobble.org/mammoth/style-map";
  1818. var styleMapPath = "mammoth/style-map";
  1819. var styleMapAbsolutePath = "/" + styleMapPath;
  1820. function writeStyleMap(docxFile, styleMap) {
  1821. docxFile.write(styleMapPath, styleMap);
  1822. return updateRelationships(docxFile).then(function() {
  1823. return updateContentTypes(docxFile);
  1824. });
  1825. }
  1826. function updateRelationships(docxFile) {
  1827. var path = "word/_rels/document.xml.rels";
  1828. var relationshipsUri = "http://schemas.openxmlformats.org/package/2006/relationships";
  1829. var relationshipElementName = "{" + relationshipsUri + "}Relationship";
  1830. return docxFile.read(path, "utf8")
  1831. .then(xml.readString)
  1832. .then(function(relationshipsContainer) {
  1833. var relationships = relationshipsContainer.children;
  1834. addOrUpdateElement(relationships, relationshipElementName, "Id", {
  1835. "Id": "rMammothStyleMap",
  1836. "Type": schema,
  1837. "Target": styleMapAbsolutePath
  1838. });
  1839. var namespaces = {"": relationshipsUri};
  1840. return docxFile.write(path, xml.writeString(relationshipsContainer, namespaces));
  1841. });
  1842. }
  1843. function updateContentTypes(docxFile) {
  1844. var path = "[Content_Types].xml";
  1845. var contentTypesUri = "http://schemas.openxmlformats.org/package/2006/content-types";
  1846. var overrideName = "{" + contentTypesUri + "}Override";
  1847. return docxFile.read(path, "utf8")
  1848. .then(xml.readString)
  1849. .then(function(typesElement) {
  1850. var children = typesElement.children;
  1851. addOrUpdateElement(children, overrideName, "PartName", {
  1852. "PartName": styleMapAbsolutePath,
  1853. "ContentType": "text/prs.mammoth.style-map"
  1854. });
  1855. var namespaces = {"": contentTypesUri};
  1856. return docxFile.write(path, xml.writeString(typesElement, namespaces));
  1857. });
  1858. }
  1859. function addOrUpdateElement(elements, name, identifyingAttribute, attributes) {
  1860. var existingElement = _.find(elements, function(element) {
  1861. return element.name === name &&
  1862. element.attributes[identifyingAttribute] === attributes[identifyingAttribute];
  1863. });
  1864. if (existingElement) {
  1865. existingElement.attributes = attributes;
  1866. } else {
  1867. elements.push(xml.element(name, attributes));
  1868. }
  1869. }
  1870. function readStyleMap(docxFile) {
  1871. if (docxFile.exists(styleMapPath)) {
  1872. return docxFile.read(styleMapPath, "utf8");
  1873. } else {
  1874. return promises.resolve(null);
  1875. }
  1876. }
  1877. },{"../promises":23,"../xml":35,"underscore":102}],15:[function(require,module,exports){
  1878. exports.readStylesXml = readStylesXml;
  1879. exports.Styles = Styles;
  1880. exports.defaultStyles = new Styles({}, {});
  1881. function Styles(paragraphStyles, characterStyles, tableStyles, numberingStyles) {
  1882. return {
  1883. findParagraphStyleById: function(styleId) {
  1884. return paragraphStyles[styleId];
  1885. },
  1886. findCharacterStyleById: function(styleId) {
  1887. return characterStyles[styleId];
  1888. },
  1889. findTableStyleById: function(styleId) {
  1890. return tableStyles[styleId];
  1891. },
  1892. findNumberingStyleById: function(styleId) {
  1893. return numberingStyles[styleId];
  1894. }
  1895. };
  1896. }
  1897. Styles.EMPTY = new Styles({}, {}, {}, {});
  1898. function readStylesXml(root) {
  1899. var paragraphStyles = {};
  1900. var characterStyles = {};
  1901. var tableStyles = {};
  1902. var numberingStyles = {};
  1903. var styles = {
  1904. "paragraph": paragraphStyles,
  1905. "character": characterStyles,
  1906. "table": tableStyles
  1907. };
  1908. root.getElementsByTagName("w:style").forEach(function(styleElement) {
  1909. var style = readStyleElement(styleElement);
  1910. if (style.type === "numbering") {
  1911. numberingStyles[style.styleId] = readNumberingStyleElement(styleElement);
  1912. } else {
  1913. var styleSet = styles[style.type];
  1914. if (styleSet) {
  1915. styleSet[style.styleId] = style;
  1916. }
  1917. }
  1918. });
  1919. return new Styles(paragraphStyles, characterStyles, tableStyles, numberingStyles);
  1920. }
  1921. function readStyleElement(styleElement) {
  1922. var type = styleElement.attributes["w:type"];
  1923. var styleId = styleElement.attributes["w:styleId"];
  1924. var name = styleName(styleElement);
  1925. return {type: type, styleId: styleId, name: name};
  1926. }
  1927. function styleName(styleElement) {
  1928. var nameElement = styleElement.first("w:name");
  1929. return nameElement ? nameElement.attributes["w:val"] : null;
  1930. }
  1931. function readNumberingStyleElement(styleElement) {
  1932. var numId = styleElement
  1933. .firstOrEmpty("w:pPr")
  1934. .firstOrEmpty("w:numPr")
  1935. .firstOrEmpty("w:numId")
  1936. .attributes["w:val"];
  1937. return {numId: numId};
  1938. }
  1939. },{}],16:[function(require,module,exports){
  1940. exports.uriToZipEntryName = uriToZipEntryName;
  1941. exports.replaceFragment = replaceFragment;
  1942. function uriToZipEntryName(base, uri) {
  1943. if (uri.charAt(0) === "/") {
  1944. return uri.substr(1);
  1945. } else {
  1946. // In general, we should check first and second for trailing and leading slashes,
  1947. // but in our specific case this seems to be sufficient
  1948. return base + "/" + uri;
  1949. }
  1950. }
  1951. function replaceFragment(uri, fragment) {
  1952. var hashIndex = uri.indexOf("#");
  1953. if (hashIndex !== -1) {
  1954. uri = uri.substring(0, hashIndex);
  1955. }
  1956. return uri + "#" + fragment;
  1957. }
  1958. },{}],17:[function(require,module,exports){
  1959. var htmlPaths = require("../styles/html-paths");
  1960. function nonFreshElement(tagName, attributes, children) {
  1961. return elementWithTag(
  1962. htmlPaths.element(tagName, attributes, {fresh: false}),
  1963. children);
  1964. }
  1965. function freshElement(tagName, attributes, children) {
  1966. var tag = htmlPaths.element(tagName, attributes, {fresh: true});
  1967. return elementWithTag(tag, children);
  1968. }
  1969. function elementWithTag(tag, children) {
  1970. return {
  1971. type: "element",
  1972. tag: tag,
  1973. children: children || []
  1974. };
  1975. }
  1976. function text(value) {
  1977. return {
  1978. type: "text",
  1979. value: value
  1980. };
  1981. }
  1982. var forceWrite = {
  1983. type: "forceWrite"
  1984. };
  1985. exports.freshElement = freshElement;
  1986. exports.nonFreshElement = nonFreshElement;
  1987. exports.elementWithTag = elementWithTag;
  1988. exports.text = text;
  1989. exports.forceWrite = forceWrite;
  1990. var voidTagNames = {
  1991. "br": true,
  1992. "hr": true,
  1993. "img": true
  1994. };
  1995. function isVoidElement(node) {
  1996. return (node.children.length === 0) && voidTagNames[node.tag.tagName];
  1997. }
  1998. exports.isVoidElement = isVoidElement;
  1999. },{"../styles/html-paths":28}],18:[function(require,module,exports){
  2000. var ast = require("./ast");
  2001. exports.freshElement = ast.freshElement;
  2002. exports.nonFreshElement = ast.nonFreshElement;
  2003. exports.elementWithTag = ast.elementWithTag;
  2004. exports.text = ast.text;
  2005. exports.forceWrite = ast.forceWrite;
  2006. exports.simplify = require("./simplify");
  2007. function write(writer, nodes) {
  2008. nodes.forEach(function(node) {
  2009. writeNode(writer, node);
  2010. });
  2011. }
  2012. function writeNode(writer, node) {
  2013. toStrings[node.type](writer, node);
  2014. }
  2015. var toStrings = {
  2016. element: generateElementString,
  2017. text: generateTextString,
  2018. forceWrite: function() { }
  2019. };
  2020. function generateElementString(writer, node) {
  2021. if (ast.isVoidElement(node)) {
  2022. writer.selfClosing(node.tag.tagName, node.tag.attributes);
  2023. } else {
  2024. writer.open(node.tag.tagName, node.tag.attributes);
  2025. write(writer, node.children);
  2026. writer.close(node.tag.tagName);
  2027. }
  2028. }
  2029. function generateTextString(writer, node) {
  2030. writer.text(node.value);
  2031. }
  2032. exports.write = write;
  2033. },{"./ast":17,"./simplify":19}],19:[function(require,module,exports){
  2034. var _ = require("underscore");
  2035. var ast = require("./ast");
  2036. function simplify(nodes) {
  2037. return collapse(removeEmpty(nodes));
  2038. }
  2039. function collapse(nodes) {
  2040. var children = [];
  2041. nodes.map(collapseNode).forEach(function(child) {
  2042. appendChild(children, child);
  2043. });
  2044. return children;
  2045. }
  2046. function collapseNode(node) {
  2047. return collapsers[node.type](node);
  2048. }
  2049. var collapsers = {
  2050. element: collapseElement,
  2051. text: identity,
  2052. forceWrite: identity
  2053. };
  2054. function collapseElement(node) {
  2055. return ast.elementWithTag(node.tag, collapse(node.children));
  2056. }
  2057. function identity(value) {
  2058. return value;
  2059. }
  2060. function appendChild(children, child) {
  2061. var lastChild = children[children.length - 1];
  2062. if (child.type === "element" && !child.tag.fresh && lastChild && lastChild.type === "element" && child.tag.matchesElement(lastChild.tag)) {
  2063. if (child.tag.separator) {
  2064. appendChild(lastChild.children, ast.text(child.tag.separator));
  2065. }
  2066. child.children.forEach(function(grandChild) {
  2067. // Mutation is fine since simplifying elements create a copy of the children.
  2068. appendChild(lastChild.children, grandChild);
  2069. });
  2070. } else {
  2071. children.push(child);
  2072. }
  2073. }
  2074. function removeEmpty(nodes) {
  2075. return flatMap(nodes, function(node) {
  2076. return emptiers[node.type](node);
  2077. });
  2078. }
  2079. function flatMap(values, func) {
  2080. return _.flatten(_.map(values, func), true);
  2081. }
  2082. var emptiers = {
  2083. element: elementEmptier,
  2084. text: textEmptier,
  2085. forceWrite: neverEmpty
  2086. };
  2087. function neverEmpty(node) {
  2088. return [node];
  2089. }
  2090. function elementEmptier(element) {
  2091. var children = removeEmpty(element.children);
  2092. if (children.length === 0 && !ast.isVoidElement(element)) {
  2093. return [];
  2094. } else {
  2095. return [ast.elementWithTag(element.tag, children)];
  2096. }
  2097. }
  2098. function textEmptier(node) {
  2099. if (node.value.length === 0) {
  2100. return [];
  2101. } else {
  2102. return [node];
  2103. }
  2104. }
  2105. module.exports = simplify;
  2106. },{"./ast":17,"underscore":102}],20:[function(require,module,exports){
  2107. var _ = require("underscore");
  2108. var promises = require("./promises");
  2109. var Html = require("./html");
  2110. exports.imgElement = imgElement;
  2111. function imgElement(func) {
  2112. return function(element, messages) {
  2113. return promises.when(func(element)).then(function(result) {
  2114. var attributes = {};
  2115. if (element.altText) {
  2116. attributes.alt = element.altText;
  2117. }
  2118. _.extend(attributes, result);
  2119. return [Html.freshElement("img", attributes)];
  2120. });
  2121. };
  2122. }
  2123. // Undocumented, but retained for backwards-compatibility with 0.3.x
  2124. exports.inline = exports.imgElement;
  2125. exports.dataUri = imgElement(function(element) {
  2126. return element.readAsBase64String().then(function(imageBuffer) {
  2127. return {
  2128. src: "data:" + element.contentType + ";base64," + imageBuffer
  2129. };
  2130. });
  2131. });
  2132. },{"./html":18,"./promises":23,"underscore":102}],21:[function(require,module,exports){
  2133. (function (Buffer){
  2134. var _ = require("underscore");
  2135. var docxReader = require("./docx/docx-reader");
  2136. var docxStyleMap = require("./docx/style-map");
  2137. var DocumentConverter = require("./document-to-html").DocumentConverter;
  2138. var convertElementToRawText = require("./raw-text").convertElementToRawText;
  2139. var readStyle = require("./style-reader").readStyle;
  2140. var readOptions = require("./options-reader").readOptions;
  2141. var unzip = require("./unzip");
  2142. var Result = require("./results").Result;
  2143. exports.convertToHtml = convertToHtml;
  2144. exports.convertToMarkdown = convertToMarkdown;
  2145. exports.convert = convert;
  2146. exports.extractRawText = extractRawText;
  2147. exports.images = require("./images");
  2148. exports.transforms = require("./transforms");
  2149. exports.underline = require("./underline");
  2150. exports.embedStyleMap = embedStyleMap;
  2151. exports.readEmbeddedStyleMap = readEmbeddedStyleMap;
  2152. function convertToHtml(input, options) {
  2153. return convert(input, options);
  2154. }
  2155. function convertToMarkdown(input, options) {
  2156. var markdownOptions = Object.create(options || {});
  2157. markdownOptions.outputFormat = "markdown";
  2158. return convert(input, markdownOptions);
  2159. }
  2160. function convert(input, options) {
  2161. options = readOptions(options);
  2162. return unzip.openZip(input)
  2163. .tap(function(docxFile) {
  2164. return docxStyleMap.readStyleMap(docxFile).then(function(styleMap) {
  2165. options.embeddedStyleMap = styleMap;
  2166. });
  2167. })
  2168. .then(function(docxFile) {
  2169. return docxReader.read(docxFile, input)
  2170. .then(function(documentResult) {
  2171. return documentResult.map(options.transformDocument);
  2172. })
  2173. .then(function(documentResult) {
  2174. return convertDocumentToHtml(documentResult, options);
  2175. });
  2176. });
  2177. }
  2178. function readEmbeddedStyleMap(input) {
  2179. return unzip.openZip(input)
  2180. .then(docxStyleMap.readStyleMap);
  2181. }
  2182. function convertDocumentToHtml(documentResult, options) {
  2183. var styleMapResult = parseStyleMap(options.readStyleMap());
  2184. var parsedOptions = _.extend({}, options, {
  2185. styleMap: styleMapResult.value
  2186. });
  2187. var documentConverter = new DocumentConverter(parsedOptions);
  2188. return documentResult.flatMapThen(function(document) {
  2189. return styleMapResult.flatMapThen(function(styleMap) {
  2190. return documentConverter.convertToHtml(document);
  2191. });
  2192. });
  2193. }
  2194. function parseStyleMap(styleMap) {
  2195. return Result.combine((styleMap || []).map(readStyle))
  2196. .map(function(styleMap) {
  2197. return styleMap.filter(function(styleMapping) {
  2198. return !!styleMapping;
  2199. });
  2200. });
  2201. }
  2202. function extractRawText(input) {
  2203. return unzip.openZip(input)
  2204. .then(docxReader.read)
  2205. .then(function(documentResult) {
  2206. return documentResult.map(convertElementToRawText);
  2207. });
  2208. }
  2209. function embedStyleMap(input, styleMap) {
  2210. return unzip.openZip(input)
  2211. .tap(function(docxFile) {
  2212. return docxStyleMap.writeStyleMap(docxFile, styleMap);
  2213. })
  2214. .then(function(docxFile) {
  2215. return docxFile.toArrayBuffer();
  2216. })
  2217. .then(function(arrayBuffer) {
  2218. return {
  2219. toArrayBuffer: function() {
  2220. return arrayBuffer;
  2221. },
  2222. toBuffer: function() {
  2223. return Buffer.from(arrayBuffer);
  2224. }
  2225. };
  2226. });
  2227. }
  2228. exports.styleMapping = function() {
  2229. throw new Error('Use a raw string instead of mammoth.styleMapping e.g. "p[style-name=\'Title\'] => h1" instead of mammoth.styleMapping("p[style-name=\'Title\'] => h1")');
  2230. };
  2231. }).call(this,require("buffer").Buffer)
  2232. },{"./document-to-html":3,"./docx/docx-reader":9,"./docx/style-map":14,"./images":20,"./options-reader":22,"./raw-text":24,"./results":25,"./style-reader":26,"./transforms":30,"./underline":31,"./unzip":2,"buffer":83,"underscore":102}],22:[function(require,module,exports){
  2233. exports.readOptions = readOptions;
  2234. var _ = require("underscore");
  2235. var defaultStyleMap = exports._defaultStyleMap = [
  2236. "p.Heading1 => h1:fresh",
  2237. "p.Heading2 => h2:fresh",
  2238. "p.Heading3 => h3:fresh",
  2239. "p.Heading4 => h4:fresh",
  2240. "p.Heading5 => h5:fresh",
  2241. "p.Heading6 => h6:fresh",
  2242. "p[style-name='Heading 1'] => h1:fresh",
  2243. "p[style-name='Heading 2'] => h2:fresh",
  2244. "p[style-name='Heading 3'] => h3:fresh",
  2245. "p[style-name='Heading 4'] => h4:fresh",
  2246. "p[style-name='Heading 5'] => h5:fresh",
  2247. "p[style-name='Heading 6'] => h6:fresh",
  2248. "p[style-name='heading 1'] => h1:fresh",
  2249. "p[style-name='heading 2'] => h2:fresh",
  2250. "p[style-name='heading 3'] => h3:fresh",
  2251. "p[style-name='heading 4'] => h4:fresh",
  2252. "p[style-name='heading 5'] => h5:fresh",
  2253. "p[style-name='heading 6'] => h6:fresh",
  2254. "r[style-name='Strong'] => strong",
  2255. "p[style-name='footnote text'] => p:fresh",
  2256. "r[style-name='footnote reference'] =>",
  2257. "p[style-name='endnote text'] => p:fresh",
  2258. "r[style-name='endnote reference'] =>",
  2259. "p[style-name='annotation text'] => p:fresh",
  2260. "r[style-name='annotation reference'] =>",
  2261. // LibreOffice
  2262. "p[style-name='Footnote'] => p:fresh",
  2263. "r[style-name='Footnote anchor'] =>",
  2264. "p[style-name='Endnote'] => p:fresh",
  2265. "r[style-name='Endnote anchor'] =>",
  2266. "p:unordered-list(1) => ul > li:fresh",
  2267. "p:unordered-list(2) => ul|ol > li > ul > li:fresh",
  2268. "p:unordered-list(3) => ul|ol > li > ul|ol > li > ul > li:fresh",
  2269. "p:unordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh",
  2270. "p:unordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh",
  2271. "p:ordered-list(1) => ol > li:fresh",
  2272. "p:ordered-list(2) => ul|ol > li > ol > li:fresh",
  2273. "p:ordered-list(3) => ul|ol > li > ul|ol > li > ol > li:fresh",
  2274. "p:ordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh",
  2275. "p:ordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh",
  2276. "r[style-name='Hyperlink'] =>",
  2277. "p[style-name='Normal'] => p:fresh"
  2278. ];
  2279. var standardOptions = exports._standardOptions = {
  2280. transformDocument: identity,
  2281. includeDefaultStyleMap: true,
  2282. includeEmbeddedStyleMap: true
  2283. };
  2284. function readOptions(options) {
  2285. options = options || {};
  2286. return _.extend({}, standardOptions, options, {
  2287. customStyleMap: readStyleMap(options.styleMap),
  2288. readStyleMap: function() {
  2289. var styleMap = this.customStyleMap;
  2290. if (this.includeEmbeddedStyleMap) {
  2291. styleMap = styleMap.concat(readStyleMap(this.embeddedStyleMap));
  2292. }
  2293. if (this.includeDefaultStyleMap) {
  2294. styleMap = styleMap.concat(defaultStyleMap);
  2295. }
  2296. return styleMap;
  2297. }
  2298. });
  2299. }
  2300. function readStyleMap(styleMap) {
  2301. if (!styleMap) {
  2302. return [];
  2303. } else if (_.isString(styleMap)) {
  2304. return styleMap.split("\n")
  2305. .map(function(line) {
  2306. return line.trim();
  2307. })
  2308. .filter(function(line) {
  2309. return line !== "" && line.charAt(0) !== "#";
  2310. });
  2311. } else {
  2312. return styleMap;
  2313. }
  2314. }
  2315. function identity(value) {
  2316. return value;
  2317. }
  2318. },{"underscore":102}],23:[function(require,module,exports){
  2319. var _ = require("underscore");
  2320. var bluebird = require("bluebird/js/release/promise")();
  2321. exports.defer = defer;
  2322. exports.when = bluebird.resolve;
  2323. exports.resolve = bluebird.resolve;
  2324. exports.all = bluebird.all;
  2325. exports.props = bluebird.props;
  2326. exports.reject = bluebird.reject;
  2327. exports.promisify = bluebird.promisify;
  2328. exports.mapSeries = bluebird.mapSeries;
  2329. exports.attempt = bluebird.attempt;
  2330. exports.nfcall = function(func) {
  2331. var args = Array.prototype.slice.call(arguments, 1);
  2332. var promisedFunc = bluebird.promisify(func);
  2333. return promisedFunc.apply(null, args);
  2334. };
  2335. bluebird.prototype.fail = bluebird.prototype.caught;
  2336. bluebird.prototype.also = function(func) {
  2337. return this.then(function(value) {
  2338. var returnValue = _.extend({}, value, func(value));
  2339. return bluebird.props(returnValue);
  2340. });
  2341. };
  2342. function defer() {
  2343. var resolve;
  2344. var reject;
  2345. var promise = new bluebird.Promise(function(resolveArg, rejectArg) {
  2346. resolve = resolveArg;
  2347. reject = rejectArg;
  2348. });
  2349. return {
  2350. resolve: resolve,
  2351. reject: reject,
  2352. promise: promise
  2353. };
  2354. }
  2355. },{"bluebird/js/release/promise":68,"underscore":102}],24:[function(require,module,exports){
  2356. var documents = require("./documents");
  2357. function convertElementToRawText(element) {
  2358. if (element.type === "text") {
  2359. return element.value;
  2360. } else if (element.type === documents.types.tab) {
  2361. return "\t";
  2362. } else {
  2363. var tail = element.type === "paragraph" ? "\n\n" : "";
  2364. return (element.children || []).map(convertElementToRawText).join("") + tail;
  2365. }
  2366. }
  2367. exports.convertElementToRawText = convertElementToRawText;
  2368. },{"./documents":4}],25:[function(require,module,exports){
  2369. var _ = require("underscore");
  2370. exports.Result = Result;
  2371. exports.success = success;
  2372. exports.warning = warning;
  2373. exports.error = error;
  2374. function Result(value, messages) {
  2375. this.value = value;
  2376. this.messages = messages || [];
  2377. }
  2378. Result.prototype.map = function(func) {
  2379. return new Result(func(this.value), this.messages);
  2380. };
  2381. Result.prototype.flatMap = function(func) {
  2382. var funcResult = func(this.value);
  2383. return new Result(funcResult.value, combineMessages([this, funcResult]));
  2384. };
  2385. Result.prototype.flatMapThen = function(func) {
  2386. var that = this;
  2387. return func(this.value).then(function(otherResult) {
  2388. return new Result(otherResult.value, combineMessages([that, otherResult]));
  2389. });
  2390. };
  2391. Result.combine = function(results) {
  2392. var values = _.flatten(_.pluck(results, "value"));
  2393. var messages = combineMessages(results);
  2394. return new Result(values, messages);
  2395. };
  2396. function success(value) {
  2397. return new Result(value, []);
  2398. }
  2399. function warning(message) {
  2400. return {
  2401. type: "warning",
  2402. message: message
  2403. };
  2404. }
  2405. function error(exception) {
  2406. return {
  2407. type: "error",
  2408. message: exception.message,
  2409. error: exception
  2410. };
  2411. }
  2412. function combineMessages(results) {
  2413. var messages = [];
  2414. _.flatten(_.pluck(results, "messages"), true).forEach(function(message) {
  2415. if (!containsMessage(messages, message)) {
  2416. messages.push(message);
  2417. }
  2418. });
  2419. return messages;
  2420. }
  2421. function containsMessage(messages, message) {
  2422. return _.find(messages, isSameMessage.bind(null, message)) !== undefined;
  2423. }
  2424. function isSameMessage(first, second) {
  2425. return first.type === second.type && first.message === second.message;
  2426. }
  2427. },{"underscore":102}],26:[function(require,module,exports){
  2428. var _ = require("underscore");
  2429. var lop = require("lop");
  2430. var documentMatchers = require("./styles/document-matchers");
  2431. var htmlPaths = require("./styles/html-paths");
  2432. var tokenise = require("./styles/parser/tokeniser").tokenise;
  2433. var results = require("./results");
  2434. exports.readHtmlPath = readHtmlPath;
  2435. exports.readDocumentMatcher = readDocumentMatcher;
  2436. exports.readStyle = readStyle;
  2437. function readStyle(string) {
  2438. return parseString(styleRule, string);
  2439. }
  2440. function createStyleRule() {
  2441. return lop.rules.sequence(
  2442. lop.rules.sequence.capture(documentMatcherRule()),
  2443. lop.rules.tokenOfType("whitespace"),
  2444. lop.rules.tokenOfType("arrow"),
  2445. lop.rules.sequence.capture(lop.rules.optional(lop.rules.sequence(
  2446. lop.rules.tokenOfType("whitespace"),
  2447. lop.rules.sequence.capture(htmlPathRule())
  2448. ).head())),
  2449. lop.rules.tokenOfType("end")
  2450. ).map(function(documentMatcher, htmlPath) {
  2451. return {
  2452. from: documentMatcher,
  2453. to: htmlPath.valueOrElse(htmlPaths.empty)
  2454. };
  2455. });
  2456. }
  2457. function readDocumentMatcher(string) {
  2458. return parseString(documentMatcherRule(), string);
  2459. }
  2460. function documentMatcherRule() {
  2461. var sequence = lop.rules.sequence;
  2462. var identifierToConstant = function(identifier, constant) {
  2463. return lop.rules.then(
  2464. lop.rules.token("identifier", identifier),
  2465. function() {
  2466. return constant;
  2467. }
  2468. );
  2469. };
  2470. var paragraphRule = identifierToConstant("p", documentMatchers.paragraph);
  2471. var runRule = identifierToConstant("r", documentMatchers.run);
  2472. var elementTypeRule = lop.rules.firstOf("p or r or table",
  2473. paragraphRule,
  2474. runRule
  2475. );
  2476. var styleIdRule = lop.rules.sequence(
  2477. lop.rules.tokenOfType("dot"),
  2478. lop.rules.sequence.cut(),
  2479. lop.rules.sequence.capture(identifierRule)
  2480. ).map(function(styleId) {
  2481. return {styleId: styleId};
  2482. });
  2483. var styleNameMatcherRule = lop.rules.firstOf("style name matcher",
  2484. lop.rules.then(
  2485. lop.rules.sequence(
  2486. lop.rules.tokenOfType("equals"),
  2487. lop.rules.sequence.cut(),
  2488. lop.rules.sequence.capture(stringRule)
  2489. ).head(),
  2490. function(styleName) {
  2491. return {styleName: documentMatchers.equalTo(styleName)};
  2492. }
  2493. ),
  2494. lop.rules.then(
  2495. lop.rules.sequence(
  2496. lop.rules.tokenOfType("startsWith"),
  2497. lop.rules.sequence.cut(),
  2498. lop.rules.sequence.capture(stringRule)
  2499. ).head(),
  2500. function(styleName) {
  2501. return {styleName: documentMatchers.startsWith(styleName)};
  2502. }
  2503. )
  2504. );
  2505. var styleNameRule = lop.rules.sequence(
  2506. lop.rules.tokenOfType("open-square-bracket"),
  2507. lop.rules.sequence.cut(),
  2508. lop.rules.token("identifier", "style-name"),
  2509. lop.rules.sequence.capture(styleNameMatcherRule),
  2510. lop.rules.tokenOfType("close-square-bracket")
  2511. ).head();
  2512. var listTypeRule = lop.rules.firstOf("list type",
  2513. identifierToConstant("ordered-list", {isOrdered: true}),
  2514. identifierToConstant("unordered-list", {isOrdered: false})
  2515. );
  2516. var listRule = sequence(
  2517. lop.rules.tokenOfType("colon"),
  2518. sequence.capture(listTypeRule),
  2519. sequence.cut(),
  2520. lop.rules.tokenOfType("open-paren"),
  2521. sequence.capture(integerRule),
  2522. lop.rules.tokenOfType("close-paren")
  2523. ).map(function(listType, levelNumber) {
  2524. return {
  2525. list: {
  2526. isOrdered: listType.isOrdered,
  2527. levelIndex: levelNumber - 1
  2528. }
  2529. };
  2530. });
  2531. function createMatcherSuffixesRule(rules) {
  2532. var matcherSuffix = lop.rules.firstOf.apply(
  2533. lop.rules.firstOf,
  2534. ["matcher suffix"].concat(rules)
  2535. );
  2536. var matcherSuffixes = lop.rules.zeroOrMore(matcherSuffix);
  2537. return lop.rules.then(matcherSuffixes, function(suffixes) {
  2538. var matcherOptions = {};
  2539. suffixes.forEach(function(suffix) {
  2540. _.extend(matcherOptions, suffix);
  2541. });
  2542. return matcherOptions;
  2543. });
  2544. }
  2545. var paragraphOrRun = sequence(
  2546. sequence.capture(elementTypeRule),
  2547. sequence.capture(createMatcherSuffixesRule([
  2548. styleIdRule,
  2549. styleNameRule,
  2550. listRule
  2551. ]))
  2552. ).map(function(createMatcher, matcherOptions) {
  2553. return createMatcher(matcherOptions);
  2554. });
  2555. var table = sequence(
  2556. lop.rules.token("identifier", "table"),
  2557. sequence.capture(createMatcherSuffixesRule([
  2558. styleIdRule,
  2559. styleNameRule
  2560. ]))
  2561. ).map(function(options) {
  2562. return documentMatchers.table(options);
  2563. });
  2564. var bold = identifierToConstant("b", documentMatchers.bold);
  2565. var italic = identifierToConstant("i", documentMatchers.italic);
  2566. var underline = identifierToConstant("u", documentMatchers.underline);
  2567. var strikethrough = identifierToConstant("strike", documentMatchers.strikethrough);
  2568. var allCaps = identifierToConstant("all-caps", documentMatchers.allCaps);
  2569. var smallCaps = identifierToConstant("small-caps", documentMatchers.smallCaps);
  2570. var highlight = sequence(
  2571. lop.rules.token("identifier", "highlight"),
  2572. lop.rules.sequence.capture(lop.rules.optional(lop.rules.sequence(
  2573. lop.rules.tokenOfType("open-square-bracket"),
  2574. lop.rules.sequence.cut(),
  2575. lop.rules.token("identifier", "color"),
  2576. lop.rules.tokenOfType("equals"),
  2577. lop.rules.sequence.capture(stringRule),
  2578. lop.rules.tokenOfType("close-square-bracket")
  2579. ).head()))
  2580. ).map(function(color) {
  2581. return documentMatchers.highlight({
  2582. color: color.valueOrElse(undefined)
  2583. });
  2584. });
  2585. var commentReference = identifierToConstant("comment-reference", documentMatchers.commentReference);
  2586. var breakMatcher = sequence(
  2587. lop.rules.token("identifier", "br"),
  2588. sequence.cut(),
  2589. lop.rules.tokenOfType("open-square-bracket"),
  2590. lop.rules.token("identifier", "type"),
  2591. lop.rules.tokenOfType("equals"),
  2592. sequence.capture(stringRule),
  2593. lop.rules.tokenOfType("close-square-bracket")
  2594. ).map(function(breakType) {
  2595. switch (breakType) {
  2596. case "line":
  2597. return documentMatchers.lineBreak;
  2598. case "page":
  2599. return documentMatchers.pageBreak;
  2600. case "column":
  2601. return documentMatchers.columnBreak;
  2602. default:
  2603. // TODO: handle unknown document matchers
  2604. }
  2605. });
  2606. return lop.rules.firstOf("element type",
  2607. paragraphOrRun,
  2608. table,
  2609. bold,
  2610. italic,
  2611. underline,
  2612. strikethrough,
  2613. allCaps,
  2614. smallCaps,
  2615. highlight,
  2616. commentReference,
  2617. breakMatcher
  2618. );
  2619. }
  2620. function readHtmlPath(string) {
  2621. return parseString(htmlPathRule(), string);
  2622. }
  2623. function htmlPathRule() {
  2624. var capture = lop.rules.sequence.capture;
  2625. var whitespaceRule = lop.rules.tokenOfType("whitespace");
  2626. var freshRule = lop.rules.then(
  2627. lop.rules.optional(lop.rules.sequence(
  2628. lop.rules.tokenOfType("colon"),
  2629. lop.rules.token("identifier", "fresh")
  2630. )),
  2631. function(option) {
  2632. return option.map(function() {
  2633. return true;
  2634. }).valueOrElse(false);
  2635. }
  2636. );
  2637. var separatorRule = lop.rules.then(
  2638. lop.rules.optional(lop.rules.sequence(
  2639. lop.rules.tokenOfType("colon"),
  2640. lop.rules.token("identifier", "separator"),
  2641. lop.rules.tokenOfType("open-paren"),
  2642. capture(stringRule),
  2643. lop.rules.tokenOfType("close-paren")
  2644. ).head()),
  2645. function(option) {
  2646. return option.valueOrElse("");
  2647. }
  2648. );
  2649. var tagNamesRule = lop.rules.oneOrMoreWithSeparator(
  2650. identifierRule,
  2651. lop.rules.tokenOfType("choice")
  2652. );
  2653. var styleElementRule = lop.rules.sequence(
  2654. capture(tagNamesRule),
  2655. capture(lop.rules.zeroOrMore(attributeOrClassRule)),
  2656. capture(freshRule),
  2657. capture(separatorRule)
  2658. ).map(function(tagName, attributesList, fresh, separator) {
  2659. var attributes = {};
  2660. var options = {};
  2661. attributesList.forEach(function(attribute) {
  2662. if (attribute.append && attributes[attribute.name]) {
  2663. attributes[attribute.name] += " " + attribute.value;
  2664. } else {
  2665. attributes[attribute.name] = attribute.value;
  2666. }
  2667. });
  2668. if (fresh) {
  2669. options.fresh = true;
  2670. }
  2671. if (separator) {
  2672. options.separator = separator;
  2673. }
  2674. return htmlPaths.element(tagName, attributes, options);
  2675. });
  2676. return lop.rules.firstOf("html path",
  2677. lop.rules.then(lop.rules.tokenOfType("bang"), function() {
  2678. return htmlPaths.ignore;
  2679. }),
  2680. lop.rules.then(
  2681. lop.rules.zeroOrMoreWithSeparator(
  2682. styleElementRule,
  2683. lop.rules.sequence(
  2684. whitespaceRule,
  2685. lop.rules.tokenOfType("gt"),
  2686. whitespaceRule
  2687. )
  2688. ),
  2689. htmlPaths.elements
  2690. )
  2691. );
  2692. }
  2693. var identifierRule = lop.rules.then(
  2694. lop.rules.tokenOfType("identifier"),
  2695. decodeEscapeSequences
  2696. );
  2697. var integerRule = lop.rules.tokenOfType("integer");
  2698. var stringRule = lop.rules.then(
  2699. lop.rules.tokenOfType("string"),
  2700. decodeEscapeSequences
  2701. );
  2702. var escapeSequences = {
  2703. "n": "\n",
  2704. "r": "\r",
  2705. "t": "\t"
  2706. };
  2707. function decodeEscapeSequences(value) {
  2708. return value.replace(/\\(.)/g, function(match, code) {
  2709. return escapeSequences[code] || code;
  2710. });
  2711. }
  2712. var attributeRule = lop.rules.sequence(
  2713. lop.rules.tokenOfType("open-square-bracket"),
  2714. lop.rules.sequence.cut(),
  2715. lop.rules.sequence.capture(identifierRule),
  2716. lop.rules.tokenOfType("equals"),
  2717. lop.rules.sequence.capture(stringRule),
  2718. lop.rules.tokenOfType("close-square-bracket")
  2719. ).map(function(name, value) {
  2720. return {name: name, value: value, append: false};
  2721. });
  2722. var classRule = lop.rules.sequence(
  2723. lop.rules.tokenOfType("dot"),
  2724. lop.rules.sequence.cut(),
  2725. lop.rules.sequence.capture(identifierRule)
  2726. ).map(function(className) {
  2727. return {name: "class", value: className, append: true};
  2728. });
  2729. var attributeOrClassRule = lop.rules.firstOf(
  2730. "attribute or class",
  2731. attributeRule,
  2732. classRule
  2733. );
  2734. function parseString(rule, string) {
  2735. var tokens = tokenise(string);
  2736. var parser = lop.Parser();
  2737. var parseResult = parser.parseTokens(rule, tokens);
  2738. if (parseResult.isSuccess()) {
  2739. return results.success(parseResult.value());
  2740. } else {
  2741. return new results.Result(null, [results.warning(describeFailure(string, parseResult))]);
  2742. }
  2743. }
  2744. function describeFailure(input, parseResult) {
  2745. return "Did not understand this style mapping, so ignored it: " + input + "\n" +
  2746. parseResult.errors().map(describeError).join("\n");
  2747. }
  2748. function describeError(error) {
  2749. return "Error was at character number " + error.characterNumber() + ": " +
  2750. "Expected " + error.expected + " but got " + error.actual;
  2751. }
  2752. var styleRule = createStyleRule();
  2753. },{"./results":25,"./styles/document-matchers":27,"./styles/html-paths":28,"./styles/parser/tokeniser":29,"lop":89,"underscore":102}],27:[function(require,module,exports){
  2754. exports.paragraph = paragraph;
  2755. exports.run = run;
  2756. exports.table = table;
  2757. exports.bold = new Matcher("bold");
  2758. exports.italic = new Matcher("italic");
  2759. exports.underline = new Matcher("underline");
  2760. exports.strikethrough = new Matcher("strikethrough");
  2761. exports.allCaps = new Matcher("allCaps");
  2762. exports.smallCaps = new Matcher("smallCaps");
  2763. exports.highlight = highlight;
  2764. exports.commentReference = new Matcher("commentReference");
  2765. exports.lineBreak = new BreakMatcher({breakType: "line"});
  2766. exports.pageBreak = new BreakMatcher({breakType: "page"});
  2767. exports.columnBreak = new BreakMatcher({breakType: "column"});
  2768. exports.equalTo = equalTo;
  2769. exports.startsWith = startsWith;
  2770. function paragraph(options) {
  2771. return new Matcher("paragraph", options);
  2772. }
  2773. function run(options) {
  2774. return new Matcher("run", options);
  2775. }
  2776. function table(options) {
  2777. return new Matcher("table", options);
  2778. }
  2779. function highlight(options) {
  2780. return new HighlightMatcher(options);
  2781. }
  2782. function Matcher(elementType, options) {
  2783. options = options || {};
  2784. this._elementType = elementType;
  2785. this._styleId = options.styleId;
  2786. this._styleName = options.styleName;
  2787. if (options.list) {
  2788. this._listIndex = options.list.levelIndex;
  2789. this._listIsOrdered = options.list.isOrdered;
  2790. }
  2791. }
  2792. Matcher.prototype.matches = function(element) {
  2793. return element.type === this._elementType &&
  2794. (this._styleId === undefined || element.styleId === this._styleId) &&
  2795. (this._styleName === undefined || (element.styleName && this._styleName.operator(this._styleName.operand, element.styleName))) &&
  2796. (this._listIndex === undefined || isList(element, this._listIndex, this._listIsOrdered)) &&
  2797. (this._breakType === undefined || this._breakType === element.breakType);
  2798. };
  2799. function HighlightMatcher(options) {
  2800. options = options || {};
  2801. this._color = options.color;
  2802. }
  2803. HighlightMatcher.prototype.matches = function(element) {
  2804. return element.type === "highlight" &&
  2805. (this._color === undefined || element.color === this._color);
  2806. };
  2807. function BreakMatcher(options) {
  2808. options = options || {};
  2809. this._breakType = options.breakType;
  2810. }
  2811. BreakMatcher.prototype.matches = function(element) {
  2812. return element.type === "break" &&
  2813. (this._breakType === undefined || element.breakType === this._breakType);
  2814. };
  2815. function isList(element, levelIndex, isOrdered) {
  2816. return element.numbering &&
  2817. element.numbering.level == levelIndex &&
  2818. element.numbering.isOrdered == isOrdered;
  2819. }
  2820. function equalTo(value) {
  2821. return {
  2822. operator: operatorEqualTo,
  2823. operand: value
  2824. };
  2825. }
  2826. function startsWith(value) {
  2827. return {
  2828. operator: operatorStartsWith,
  2829. operand: value
  2830. };
  2831. }
  2832. function operatorEqualTo(first, second) {
  2833. return first.toUpperCase() === second.toUpperCase();
  2834. }
  2835. function operatorStartsWith(first, second) {
  2836. return second.toUpperCase().indexOf(first.toUpperCase()) === 0;
  2837. }
  2838. },{}],28:[function(require,module,exports){
  2839. var _ = require("underscore");
  2840. var html = require("../html");
  2841. exports.topLevelElement = topLevelElement;
  2842. exports.elements = elements;
  2843. exports.element = element;
  2844. function topLevelElement(tagName, attributes) {
  2845. return elements([element(tagName, attributes, {fresh: true})]);
  2846. }
  2847. function elements(elementStyles) {
  2848. return new HtmlPath(elementStyles.map(function(elementStyle) {
  2849. if (_.isString(elementStyle)) {
  2850. return element(elementStyle);
  2851. } else {
  2852. return elementStyle;
  2853. }
  2854. }));
  2855. }
  2856. function HtmlPath(elements) {
  2857. this._elements = elements;
  2858. }
  2859. HtmlPath.prototype.wrap = function wrap(children) {
  2860. var result = children();
  2861. for (var index = this._elements.length - 1; index >= 0; index--) {
  2862. result = this._elements[index].wrapNodes(result);
  2863. }
  2864. return result;
  2865. };
  2866. function element(tagName, attributes, options) {
  2867. options = options || {};
  2868. return new Element(tagName, attributes, options);
  2869. }
  2870. function Element(tagName, attributes, options) {
  2871. var tagNames = {};
  2872. if (_.isArray(tagName)) {
  2873. tagName.forEach(function(tagName) {
  2874. tagNames[tagName] = true;
  2875. });
  2876. tagName = tagName[0];
  2877. } else {
  2878. tagNames[tagName] = true;
  2879. }
  2880. this.tagName = tagName;
  2881. this.tagNames = tagNames;
  2882. this.attributes = attributes || {};
  2883. this.fresh = options.fresh;
  2884. this.separator = options.separator;
  2885. }
  2886. Element.prototype.matchesElement = function(element) {
  2887. return this.tagNames[element.tagName] && _.isEqual(this.attributes || {}, element.attributes || {});
  2888. };
  2889. Element.prototype.wrap = function wrap(generateNodes) {
  2890. return this.wrapNodes(generateNodes());
  2891. };
  2892. Element.prototype.wrapNodes = function wrapNodes(nodes) {
  2893. return [html.elementWithTag(this, nodes)];
  2894. };
  2895. exports.empty = elements([]);
  2896. exports.ignore = {
  2897. wrap: function() {
  2898. return [];
  2899. }
  2900. };
  2901. },{"../html":18,"underscore":102}],29:[function(require,module,exports){
  2902. var lop = require("lop");
  2903. var RegexTokeniser = lop.RegexTokeniser;
  2904. exports.tokenise = tokenise;
  2905. var stringPrefix = "'((?:\\\\.|[^'])*)";
  2906. function tokenise(string) {
  2907. var identifierCharacter = "(?:[a-zA-Z\\-_]|\\\\.)";
  2908. var tokeniser = new RegexTokeniser([
  2909. {name: "identifier", regex: new RegExp("(" + identifierCharacter + "(?:" + identifierCharacter + "|[0-9])*)")},
  2910. {name: "dot", regex: /\./},
  2911. {name: "colon", regex: /:/},
  2912. {name: "gt", regex: />/},
  2913. {name: "whitespace", regex: /\s+/},
  2914. {name: "arrow", regex: /=>/},
  2915. {name: "equals", regex: /=/},
  2916. {name: "startsWith", regex: /\^=/},
  2917. {name: "open-paren", regex: /\(/},
  2918. {name: "close-paren", regex: /\)/},
  2919. {name: "open-square-bracket", regex: /\[/},
  2920. {name: "close-square-bracket", regex: /\]/},
  2921. {name: "string", regex: new RegExp(stringPrefix + "'")},
  2922. {name: "unterminated-string", regex: new RegExp(stringPrefix)},
  2923. {name: "integer", regex: /([0-9]+)/},
  2924. {name: "choice", regex: /\|/},
  2925. {name: "bang", regex: /(!)/}
  2926. ]);
  2927. return tokeniser.tokenise(string);
  2928. }
  2929. },{"lop":89}],30:[function(require,module,exports){
  2930. var _ = require("underscore");
  2931. exports.paragraph = paragraph;
  2932. exports.run = run;
  2933. exports._elements = elements;
  2934. exports.getDescendantsOfType = getDescendantsOfType;
  2935. exports.getDescendants = getDescendants;
  2936. function paragraph(transform) {
  2937. return elementsOfType("paragraph", transform);
  2938. }
  2939. function run(transform) {
  2940. return elementsOfType("run", transform);
  2941. }
  2942. function elementsOfType(elementType, transform) {
  2943. return elements(function(element) {
  2944. if (element.type === elementType) {
  2945. return transform(element);
  2946. } else {
  2947. return element;
  2948. }
  2949. });
  2950. }
  2951. function elements(transform) {
  2952. return function transformElement(element) {
  2953. if (element.children) {
  2954. var children = _.map(element.children, transformElement);
  2955. element = _.extend(element, {children: children});
  2956. }
  2957. return transform(element);
  2958. };
  2959. }
  2960. function getDescendantsOfType(element, type) {
  2961. return getDescendants(element).filter(function(descendant) {
  2962. return descendant.type === type;
  2963. });
  2964. }
  2965. function getDescendants(element) {
  2966. var descendants = [];
  2967. visitDescendants(element, function(descendant) {
  2968. descendants.push(descendant);
  2969. });
  2970. return descendants;
  2971. }
  2972. function visitDescendants(element, visit) {
  2973. if (element.children) {
  2974. element.children.forEach(function(child) {
  2975. visitDescendants(child, visit);
  2976. visit(child);
  2977. });
  2978. }
  2979. }
  2980. },{"underscore":102}],31:[function(require,module,exports){
  2981. var htmlPaths = require("./styles/html-paths");
  2982. var Html = require("./html");
  2983. exports.element = element;
  2984. function element(name) {
  2985. return function(html) {
  2986. return Html.elementWithTag(htmlPaths.element(name), [html]);
  2987. };
  2988. }
  2989. },{"./html":18,"./styles/html-paths":28}],32:[function(require,module,exports){
  2990. var _ = require("underscore");
  2991. exports.writer = writer;
  2992. function writer(options) {
  2993. options = options || {};
  2994. if (options.prettyPrint) {
  2995. return prettyWriter();
  2996. } else {
  2997. return simpleWriter();
  2998. }
  2999. }
  3000. var indentedElements = {
  3001. div: true,
  3002. p: true,
  3003. ul: true,
  3004. li: true
  3005. };
  3006. function prettyWriter() {
  3007. var indentationLevel = 0;
  3008. var indentation = " ";
  3009. var stack = [];
  3010. var start = true;
  3011. var inText = false;
  3012. var writer = simpleWriter();
  3013. function open(tagName, attributes) {
  3014. if (indentedElements[tagName]) {
  3015. indent();
  3016. }
  3017. stack.push(tagName);
  3018. writer.open(tagName, attributes);
  3019. if (indentedElements[tagName]) {
  3020. indentationLevel++;
  3021. }
  3022. start = false;
  3023. }
  3024. function close(tagName) {
  3025. if (indentedElements[tagName]) {
  3026. indentationLevel--;
  3027. indent();
  3028. }
  3029. stack.pop();
  3030. writer.close(tagName);
  3031. }
  3032. function text(value) {
  3033. startText();
  3034. var text = isInPre() ? value : value.replace("\n", "\n" + indentation);
  3035. writer.text(text);
  3036. }
  3037. function selfClosing(tagName, attributes) {
  3038. indent();
  3039. writer.selfClosing(tagName, attributes);
  3040. }
  3041. function insideIndentedElement() {
  3042. return stack.length === 0 || indentedElements[stack[stack.length - 1]];
  3043. }
  3044. function startText() {
  3045. if (!inText) {
  3046. indent();
  3047. inText = true;
  3048. }
  3049. }
  3050. function indent() {
  3051. inText = false;
  3052. if (!start && insideIndentedElement() && !isInPre()) {
  3053. writer._append("\n");
  3054. for (var i = 0; i < indentationLevel; i++) {
  3055. writer._append(indentation);
  3056. }
  3057. }
  3058. }
  3059. function isInPre() {
  3060. return _.some(stack, function(tagName) {
  3061. return tagName === "pre";
  3062. });
  3063. }
  3064. return {
  3065. asString: writer.asString,
  3066. open: open,
  3067. close: close,
  3068. text: text,
  3069. selfClosing: selfClosing
  3070. };
  3071. }
  3072. function simpleWriter() {
  3073. var fragments = [];
  3074. function open(tagName, attributes) {
  3075. var attributeString = generateAttributeString(attributes);
  3076. fragments.push("<" + tagName + attributeString + ">");
  3077. }
  3078. function close(tagName) {
  3079. fragments.push("</" + tagName + ">");
  3080. }
  3081. function selfClosing(tagName, attributes) {
  3082. var attributeString = generateAttributeString(attributes);
  3083. fragments.push("<" + tagName + attributeString + " />");
  3084. }
  3085. function generateAttributeString(attributes) {
  3086. return _.map(attributes, function(value, key) {
  3087. return " " + key + '="' + escapeHtmlAttribute(value) + '"';
  3088. }).join("");
  3089. }
  3090. function text(value) {
  3091. fragments.push(escapeHtmlText(value));
  3092. }
  3093. function append(html) {
  3094. fragments.push(html);
  3095. }
  3096. function asString() {
  3097. return fragments.join("");
  3098. }
  3099. return {
  3100. asString: asString,
  3101. open: open,
  3102. close: close,
  3103. text: text,
  3104. selfClosing: selfClosing,
  3105. _append: append
  3106. };
  3107. }
  3108. function escapeHtmlText(value) {
  3109. return value
  3110. .replace(/&/g, '&amp;')
  3111. .replace(/</g, '&lt;')
  3112. .replace(/>/g, '&gt;');
  3113. }
  3114. function escapeHtmlAttribute(value) {
  3115. return value
  3116. .replace(/&/g, '&amp;')
  3117. .replace(/"/g, '&quot;')
  3118. .replace(/</g, '&lt;')
  3119. .replace(/>/g, '&gt;');
  3120. }
  3121. },{"underscore":102}],33:[function(require,module,exports){
  3122. var htmlWriter = require("./html-writer");
  3123. var markdownWriter = require("./markdown-writer");
  3124. exports.writer = writer;
  3125. function writer(options) {
  3126. options = options || {};
  3127. if (options.outputFormat === "markdown") {
  3128. return markdownWriter.writer();
  3129. } else {
  3130. return htmlWriter.writer(options);
  3131. }
  3132. }
  3133. },{"./html-writer":32,"./markdown-writer":34}],34:[function(require,module,exports){
  3134. var _ = require("underscore");
  3135. function symmetricMarkdownElement(end) {
  3136. return markdownElement(end, end);
  3137. }
  3138. function markdownElement(start, end) {
  3139. return function() {
  3140. return {start: start, end: end};
  3141. };
  3142. }
  3143. function markdownLink(attributes) {
  3144. var href = attributes.href || "";
  3145. if (href) {
  3146. return {
  3147. start: "[",
  3148. end: "](" + href + ")",
  3149. anchorPosition: "before"
  3150. };
  3151. } else {
  3152. return {};
  3153. }
  3154. }
  3155. function markdownImage(attributes) {
  3156. var src = attributes.src || "";
  3157. var altText = attributes.alt || "";
  3158. if (src || altText) {
  3159. return {start: "![" + altText + "](" + src + ")"};
  3160. } else {
  3161. return {};
  3162. }
  3163. }
  3164. function markdownList(options) {
  3165. return function(attributes, list) {
  3166. return {
  3167. start: list ? "\n" : "",
  3168. end: list ? "" : "\n",
  3169. list: {
  3170. isOrdered: options.isOrdered,
  3171. indent: list ? list.indent + 1 : 0,
  3172. count: 0
  3173. }
  3174. };
  3175. };
  3176. }
  3177. function markdownListItem(attributes, list, listItem) {
  3178. list = list || {indent: 0, isOrdered: false, count: 0};
  3179. list.count++;
  3180. listItem.hasClosed = false;
  3181. var bullet = list.isOrdered ? list.count + "." : "-";
  3182. var start = repeatString("\t", list.indent) + bullet + " ";
  3183. return {
  3184. start: start,
  3185. end: function() {
  3186. if (!listItem.hasClosed) {
  3187. listItem.hasClosed = true;
  3188. return "\n";
  3189. }
  3190. }
  3191. };
  3192. }
  3193. var htmlToMarkdown = {
  3194. "p": markdownElement("", "\n\n"),
  3195. "br": markdownElement("", " \n"),
  3196. "ul": markdownList({isOrdered: false}),
  3197. "ol": markdownList({isOrdered: true}),
  3198. "li": markdownListItem,
  3199. "strong": symmetricMarkdownElement("__"),
  3200. "em": symmetricMarkdownElement("*"),
  3201. "a": markdownLink,
  3202. "img": markdownImage
  3203. };
  3204. (function() {
  3205. for (var i = 1; i <= 6; i++) {
  3206. htmlToMarkdown["h" + i] = markdownElement(repeatString("#", i) + " ", "\n\n");
  3207. }
  3208. })();
  3209. function repeatString(value, count) {
  3210. return new Array(count + 1).join(value);
  3211. }
  3212. function markdownWriter() {
  3213. var fragments = [];
  3214. var elementStack = [];
  3215. var list = null;
  3216. var listItem = {};
  3217. function open(tagName, attributes) {
  3218. attributes = attributes || {};
  3219. var createElement = htmlToMarkdown[tagName] || function() {
  3220. return {};
  3221. };
  3222. var element = createElement(attributes, list, listItem);
  3223. elementStack.push({end: element.end, list: list});
  3224. if (element.list) {
  3225. list = element.list;
  3226. }
  3227. var anchorBeforeStart = element.anchorPosition === "before";
  3228. if (anchorBeforeStart) {
  3229. writeAnchor(attributes);
  3230. }
  3231. fragments.push(element.start || "");
  3232. if (!anchorBeforeStart) {
  3233. writeAnchor(attributes);
  3234. }
  3235. }
  3236. function writeAnchor(attributes) {
  3237. if (attributes.id) {
  3238. fragments.push('<a id="' + attributes.id + '"></a>');
  3239. }
  3240. }
  3241. function close(tagName) {
  3242. var element = elementStack.pop();
  3243. list = element.list;
  3244. var end = _.isFunction(element.end) ? element.end() : element.end;
  3245. fragments.push(end || "");
  3246. }
  3247. function selfClosing(tagName, attributes) {
  3248. open(tagName, attributes);
  3249. close(tagName);
  3250. }
  3251. function text(value) {
  3252. fragments.push(escapeMarkdown(value));
  3253. }
  3254. function asString() {
  3255. return fragments.join("");
  3256. }
  3257. return {
  3258. asString: asString,
  3259. open: open,
  3260. close: close,
  3261. text: text,
  3262. selfClosing: selfClosing
  3263. };
  3264. }
  3265. exports.writer = markdownWriter;
  3266. function escapeMarkdown(value) {
  3267. return value
  3268. .replace(/\\/g, '\\\\')
  3269. .replace(/([\`\*_\{\}\[\]\(\)\#\+\-\.\!])/g, '\\$1');
  3270. }
  3271. },{"underscore":102}],35:[function(require,module,exports){
  3272. var nodes = require("./nodes");
  3273. exports.Element = nodes.Element;
  3274. exports.element = nodes.element;
  3275. exports.text = nodes.text;
  3276. exports.readString = require("./reader").readString;
  3277. exports.writeString = require("./writer").writeString;
  3278. },{"./nodes":36,"./reader":37,"./writer":38}],36:[function(require,module,exports){
  3279. var _ = require("underscore");
  3280. exports.Element = Element;
  3281. exports.element = function(name, attributes, children) {
  3282. return new Element(name, attributes, children);
  3283. };
  3284. exports.text = function(value) {
  3285. return {
  3286. type: "text",
  3287. value: value
  3288. };
  3289. };
  3290. var emptyElement = {
  3291. first: function() {
  3292. return null;
  3293. },
  3294. firstOrEmpty: function() {
  3295. return emptyElement;
  3296. },
  3297. attributes: {}
  3298. };
  3299. function Element(name, attributes, children) {
  3300. this.type = "element";
  3301. this.name = name;
  3302. this.attributes = attributes || {};
  3303. this.children = children || [];
  3304. }
  3305. Element.prototype.first = function(name) {
  3306. return _.find(this.children, function(child) {
  3307. return child.name === name;
  3308. });
  3309. };
  3310. Element.prototype.firstOrEmpty = function(name) {
  3311. return this.first(name) || emptyElement;
  3312. };
  3313. Element.prototype.getElementsByTagName = function(name) {
  3314. var elements = _.filter(this.children, function(child) {
  3315. return child.name === name;
  3316. });
  3317. return toElementList(elements);
  3318. };
  3319. Element.prototype.text = function() {
  3320. if (this.children.length === 0) {
  3321. return "";
  3322. } else if (this.children.length !== 1 || this.children[0].type !== "text") {
  3323. throw new Error("Not implemented");
  3324. }
  3325. return this.children[0].value;
  3326. };
  3327. var elementListPrototype = {
  3328. getElementsByTagName: function(name) {
  3329. return toElementList(_.flatten(this.map(function(element) {
  3330. return element.getElementsByTagName(name);
  3331. }, true)));
  3332. }
  3333. };
  3334. function toElementList(array) {
  3335. return _.extend(array, elementListPrototype);
  3336. }
  3337. },{"underscore":102}],37:[function(require,module,exports){
  3338. var promises = require("../promises");
  3339. var _ = require("underscore");
  3340. var xmldom = require("./xmldom");
  3341. var nodes = require("./nodes");
  3342. var Element = nodes.Element;
  3343. exports.readString = readString;
  3344. var Node = xmldom.Node;
  3345. function readString(xmlString, namespaceMap) {
  3346. namespaceMap = namespaceMap || {};
  3347. try {
  3348. var document = xmldom.parseFromString(xmlString, "text/xml");
  3349. } catch (error) {
  3350. return promises.reject(error);
  3351. }
  3352. if (document.documentElement.tagName === "parsererror") {
  3353. return promises.resolve(new Error(document.documentElement.textContent));
  3354. }
  3355. function convertNode(node) {
  3356. switch (node.nodeType) {
  3357. case Node.ELEMENT_NODE:
  3358. return convertElement(node);
  3359. case Node.TEXT_NODE:
  3360. return nodes.text(node.nodeValue);
  3361. }
  3362. }
  3363. function convertElement(element) {
  3364. var convertedName = convertName(element);
  3365. var convertedChildren = [];
  3366. _.forEach(element.childNodes, function(childNode) {
  3367. var convertedNode = convertNode(childNode);
  3368. if (convertedNode) {
  3369. convertedChildren.push(convertedNode);
  3370. }
  3371. });
  3372. var convertedAttributes = {};
  3373. _.forEach(element.attributes, function(attribute) {
  3374. convertedAttributes[convertName(attribute)] = attribute.value;
  3375. });
  3376. return new Element(convertedName, convertedAttributes, convertedChildren);
  3377. }
  3378. function convertName(node) {
  3379. if (node.namespaceURI) {
  3380. var mappedPrefix = namespaceMap[node.namespaceURI];
  3381. var prefix;
  3382. if (mappedPrefix) {
  3383. prefix = mappedPrefix + ":";
  3384. } else {
  3385. prefix = "{" + node.namespaceURI + "}";
  3386. }
  3387. return prefix + node.localName;
  3388. } else {
  3389. return node.localName;
  3390. }
  3391. }
  3392. return promises.resolve(convertNode(document.documentElement));
  3393. }
  3394. },{"../promises":23,"./nodes":36,"./xmldom":39,"underscore":102}],38:[function(require,module,exports){
  3395. var _ = require("underscore");
  3396. var xmlbuilder = require("xmlbuilder");
  3397. exports.writeString = writeString;
  3398. function writeString(root, namespaces) {
  3399. var uriToPrefix = _.invert(namespaces);
  3400. var nodeWriters = {
  3401. element: writeElement,
  3402. text: writeTextNode
  3403. };
  3404. function writeNode(builder, node) {
  3405. return nodeWriters[node.type](builder, node);
  3406. }
  3407. function writeElement(builder, element) {
  3408. var elementBuilder = builder.element(mapElementName(element.name), element.attributes);
  3409. element.children.forEach(function(child) {
  3410. writeNode(elementBuilder, child);
  3411. });
  3412. }
  3413. function mapElementName(name) {
  3414. var longFormMatch = /^\{(.*)\}(.*)$/.exec(name);
  3415. if (longFormMatch) {
  3416. var prefix = uriToPrefix[longFormMatch[1]];
  3417. return prefix + (prefix === "" ? "" : ":") + longFormMatch[2];
  3418. } else {
  3419. return name;
  3420. }
  3421. }
  3422. function writeDocument(root) {
  3423. var builder = xmlbuilder
  3424. .create(mapElementName(root.name), {
  3425. version: '1.0',
  3426. encoding: 'UTF-8',
  3427. standalone: true
  3428. });
  3429. _.forEach(namespaces, function(uri, prefix) {
  3430. var key = "xmlns" + (prefix === "" ? "" : ":" + prefix);
  3431. builder.attribute(key, uri);
  3432. });
  3433. root.children.forEach(function(child) {
  3434. writeNode(builder, child);
  3435. });
  3436. return builder.end();
  3437. }
  3438. return writeDocument(root);
  3439. }
  3440. function writeTextNode(builder, node) {
  3441. builder.text(node.value);
  3442. }
  3443. },{"underscore":102,"xmlbuilder":127}],39:[function(require,module,exports){
  3444. var xmldom = require("@xmldom/xmldom");
  3445. var dom = require("@xmldom/xmldom/lib/dom");
  3446. function parseFromString(string) {
  3447. var error = null;
  3448. var domParser = new xmldom.DOMParser({
  3449. errorHandler: function(level, message) {
  3450. error = {level: level, message: message};
  3451. }
  3452. });
  3453. var document = domParser.parseFromString(string);
  3454. if (error === null) {
  3455. return document;
  3456. } else {
  3457. throw new Error(error.level + ": " + error.message);
  3458. }
  3459. }
  3460. exports.parseFromString = parseFromString;
  3461. exports.Node = dom.Node;
  3462. },{"@xmldom/xmldom":45,"@xmldom/xmldom/lib/dom":43}],40:[function(require,module,exports){
  3463. var base64js = require("base64-js");
  3464. var JSZip = require("jszip");
  3465. exports.openArrayBuffer = openArrayBuffer;
  3466. exports.splitPath = splitPath;
  3467. exports.joinPath = joinPath;
  3468. function openArrayBuffer(arrayBuffer) {
  3469. return JSZip.loadAsync(arrayBuffer).then(function(zipFile) {
  3470. function exists(name) {
  3471. return zipFile.file(name) !== null;
  3472. }
  3473. function read(name, encoding) {
  3474. return zipFile.file(name).async("uint8array").then(function(array) {
  3475. if (encoding === "base64") {
  3476. return base64js.fromByteArray(array);
  3477. } else if (encoding) {
  3478. var decoder = new TextDecoder(encoding);
  3479. return decoder.decode(array);
  3480. } else {
  3481. return array;
  3482. }
  3483. });
  3484. }
  3485. function write(name, contents) {
  3486. zipFile.file(name, contents);
  3487. }
  3488. function toArrayBuffer() {
  3489. return zipFile.generateAsync({type: "arraybuffer"});
  3490. }
  3491. return {
  3492. exists: exists,
  3493. read: read,
  3494. write: write,
  3495. toArrayBuffer: toArrayBuffer
  3496. };
  3497. });
  3498. }
  3499. function splitPath(path) {
  3500. var lastIndex = path.lastIndexOf("/");
  3501. if (lastIndex === -1) {
  3502. return {dirname: "", basename: path};
  3503. } else {
  3504. return {
  3505. dirname: path.substring(0, lastIndex),
  3506. basename: path.substring(lastIndex + 1)
  3507. };
  3508. }
  3509. }
  3510. function joinPath() {
  3511. var nonEmptyPaths = Array.prototype.filter.call(arguments, function(path) {
  3512. return path;
  3513. });
  3514. var relevantPaths = [];
  3515. nonEmptyPaths.forEach(function(path) {
  3516. if (/^\//.test(path)) {
  3517. relevantPaths = [path];
  3518. } else {
  3519. relevantPaths.push(path);
  3520. }
  3521. });
  3522. return relevantPaths.join("/");
  3523. }
  3524. },{"base64-js":47,"jszip":88}],41:[function(require,module,exports){
  3525. 'use strict'
  3526. /**
  3527. * Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes.
  3528. *
  3529. * Works with anything that has a `length` property and index access properties, including NodeList.
  3530. *
  3531. * @template {unknown} T
  3532. * @param {Array<T> | ({length:number, [number]: T})} list
  3533. * @param {function (item: T, index: number, list:Array<T> | ({length:number, [number]: T})):boolean} predicate
  3534. * @param {Partial<Pick<ArrayConstructor['prototype'], 'find'>>?} ac `Array.prototype` by default,
  3535. * allows injecting a custom implementation in tests
  3536. * @returns {T | undefined}
  3537. *
  3538. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
  3539. * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find
  3540. */
  3541. function find(list, predicate, ac) {
  3542. if (ac === undefined) {
  3543. ac = Array.prototype;
  3544. }
  3545. if (list && typeof ac.find === 'function') {
  3546. return ac.find.call(list, predicate);
  3547. }
  3548. for (var i = 0; i < list.length; i++) {
  3549. if (Object.prototype.hasOwnProperty.call(list, i)) {
  3550. var item = list[i];
  3551. if (predicate.call(undefined, item, i, list)) {
  3552. return item;
  3553. }
  3554. }
  3555. }
  3556. }
  3557. /**
  3558. * "Shallow freezes" an object to render it immutable.
  3559. * Uses `Object.freeze` if available,
  3560. * otherwise the immutability is only in the type.
  3561. *
  3562. * Is used to create "enum like" objects.
  3563. *
  3564. * @template T
  3565. * @param {T} object the object to freeze
  3566. * @param {Pick<ObjectConstructor, 'freeze'> = Object} oc `Object` by default,
  3567. * allows to inject custom object constructor for tests
  3568. * @returns {Readonly<T>}
  3569. *
  3570. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
  3571. */
  3572. function freeze(object, oc) {
  3573. if (oc === undefined) {
  3574. oc = Object
  3575. }
  3576. return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
  3577. }
  3578. /**
  3579. * Since we can not rely on `Object.assign` we provide a simplified version
  3580. * that is sufficient for our needs.
  3581. *
  3582. * @param {Object} target
  3583. * @param {Object | null | undefined} source
  3584. *
  3585. * @returns {Object} target
  3586. * @throws TypeError if target is not an object
  3587. *
  3588. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
  3589. * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign
  3590. */
  3591. function assign(target, source) {
  3592. if (target === null || typeof target !== 'object') {
  3593. throw new TypeError('target is not an object')
  3594. }
  3595. for (var key in source) {
  3596. if (Object.prototype.hasOwnProperty.call(source, key)) {
  3597. target[key] = source[key]
  3598. }
  3599. }
  3600. return target
  3601. }
  3602. /**
  3603. * All mime types that are allowed as input to `DOMParser.parseFromString`
  3604. *
  3605. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN
  3606. * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec
  3607. * @see DOMParser.prototype.parseFromString
  3608. */
  3609. var MIME_TYPE = freeze({
  3610. /**
  3611. * `text/html`, the only mime type that triggers treating an XML document as HTML.
  3612. *
  3613. * @see DOMParser.SupportedType.isHTML
  3614. * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
  3615. * @see https://en.wikipedia.org/wiki/HTML Wikipedia
  3616. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
  3617. * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec
  3618. */
  3619. HTML: 'text/html',
  3620. /**
  3621. * Helper method to check a mime type if it indicates an HTML document
  3622. *
  3623. * @param {string} [value]
  3624. * @returns {boolean}
  3625. *
  3626. * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
  3627. * @see https://en.wikipedia.org/wiki/HTML Wikipedia
  3628. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
  3629. * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */
  3630. isHTML: function (value) {
  3631. return value === MIME_TYPE.HTML
  3632. },
  3633. /**
  3634. * `application/xml`, the standard mime type for XML documents.
  3635. *
  3636. * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration
  3637. * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303
  3638. * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
  3639. */
  3640. XML_APPLICATION: 'application/xml',
  3641. /**
  3642. * `text/html`, an alias for `application/xml`.
  3643. *
  3644. * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303
  3645. * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration
  3646. * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
  3647. */
  3648. XML_TEXT: 'text/xml',
  3649. /**
  3650. * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,
  3651. * but is parsed as an XML document.
  3652. *
  3653. * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration
  3654. * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec
  3655. * @see https://en.wikipedia.org/wiki/XHTML Wikipedia
  3656. */
  3657. XML_XHTML_APPLICATION: 'application/xhtml+xml',
  3658. /**
  3659. * `image/svg+xml`,
  3660. *
  3661. * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration
  3662. * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1
  3663. * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
  3664. */
  3665. XML_SVG_IMAGE: 'image/svg+xml',
  3666. })
  3667. /**
  3668. * Namespaces that are used in this code base.
  3669. *
  3670. * @see http://www.w3.org/TR/REC-xml-names
  3671. */
  3672. var NAMESPACE = freeze({
  3673. /**
  3674. * The XHTML namespace.
  3675. *
  3676. * @see http://www.w3.org/1999/xhtml
  3677. */
  3678. HTML: 'http://www.w3.org/1999/xhtml',
  3679. /**
  3680. * Checks if `uri` equals `NAMESPACE.HTML`.
  3681. *
  3682. * @param {string} [uri]
  3683. *
  3684. * @see NAMESPACE.HTML
  3685. */
  3686. isHTML: function (uri) {
  3687. return uri === NAMESPACE.HTML
  3688. },
  3689. /**
  3690. * The SVG namespace.
  3691. *
  3692. * @see http://www.w3.org/2000/svg
  3693. */
  3694. SVG: 'http://www.w3.org/2000/svg',
  3695. /**
  3696. * The `xml:` namespace.
  3697. *
  3698. * @see http://www.w3.org/XML/1998/namespace
  3699. */
  3700. XML: 'http://www.w3.org/XML/1998/namespace',
  3701. /**
  3702. * The `xmlns:` namespace
  3703. *
  3704. * @see https://www.w3.org/2000/xmlns/
  3705. */
  3706. XMLNS: 'http://www.w3.org/2000/xmlns/',
  3707. })
  3708. exports.assign = assign;
  3709. exports.find = find;
  3710. exports.freeze = freeze;
  3711. exports.MIME_TYPE = MIME_TYPE;
  3712. exports.NAMESPACE = NAMESPACE;
  3713. },{}],42:[function(require,module,exports){
  3714. var conventions = require("./conventions");
  3715. var dom = require('./dom')
  3716. var entities = require('./entities');
  3717. var sax = require('./sax');
  3718. var DOMImplementation = dom.DOMImplementation;
  3719. var NAMESPACE = conventions.NAMESPACE;
  3720. var ParseError = sax.ParseError;
  3721. var XMLReader = sax.XMLReader;
  3722. /**
  3723. * Normalizes line ending according to https://www.w3.org/TR/xml11/#sec-line-ends:
  3724. *
  3725. * > XML parsed entities are often stored in computer files which,
  3726. * > for editing convenience, are organized into lines.
  3727. * > These lines are typically separated by some combination
  3728. * > of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).
  3729. * >
  3730. * > To simplify the tasks of applications, the XML processor must behave
  3731. * > as if it normalized all line breaks in external parsed entities (including the document entity)
  3732. * > on input, before parsing, by translating all of the following to a single #xA character:
  3733. * >
  3734. * > 1. the two-character sequence #xD #xA
  3735. * > 2. the two-character sequence #xD #x85
  3736. * > 3. the single character #x85
  3737. * > 4. the single character #x2028
  3738. * > 5. any #xD character that is not immediately followed by #xA or #x85.
  3739. *
  3740. * @param {string} input
  3741. * @returns {string}
  3742. */
  3743. function normalizeLineEndings(input) {
  3744. return input
  3745. .replace(/\r[\n\u0085]/g, '\n')
  3746. .replace(/[\r\u0085\u2028]/g, '\n')
  3747. }
  3748. /**
  3749. * @typedef Locator
  3750. * @property {number} [columnNumber]
  3751. * @property {number} [lineNumber]
  3752. */
  3753. /**
  3754. * @typedef DOMParserOptions
  3755. * @property {DOMHandler} [domBuilder]
  3756. * @property {Function} [errorHandler]
  3757. * @property {(string) => string} [normalizeLineEndings] used to replace line endings before parsing
  3758. * defaults to `normalizeLineEndings`
  3759. * @property {Locator} [locator]
  3760. * @property {Record<string, string>} [xmlns]
  3761. *
  3762. * @see normalizeLineEndings
  3763. */
  3764. /**
  3765. * The DOMParser interface provides the ability to parse XML or HTML source code
  3766. * from a string into a DOM `Document`.
  3767. *
  3768. * _xmldom is different from the spec in that it allows an `options` parameter,
  3769. * to override the default behavior._
  3770. *
  3771. * @param {DOMParserOptions} [options]
  3772. * @constructor
  3773. *
  3774. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
  3775. * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
  3776. */
  3777. function DOMParser(options){
  3778. this.options = options ||{locator:{}};
  3779. }
  3780. DOMParser.prototype.parseFromString = function(source,mimeType){
  3781. var options = this.options;
  3782. var sax = new XMLReader();
  3783. var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler
  3784. var errorHandler = options.errorHandler;
  3785. var locator = options.locator;
  3786. var defaultNSMap = options.xmlns||{};
  3787. var isHTML = /\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1;
  3788. var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
  3789. if(locator){
  3790. domBuilder.setDocumentLocator(locator)
  3791. }
  3792. sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator);
  3793. sax.domBuilder = options.domBuilder || domBuilder;
  3794. if(isHTML){
  3795. defaultNSMap[''] = NAMESPACE.HTML;
  3796. }
  3797. defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
  3798. var normalize = options.normalizeLineEndings || normalizeLineEndings;
  3799. if (source && typeof source === 'string') {
  3800. sax.parse(
  3801. normalize(source),
  3802. defaultNSMap,
  3803. entityMap
  3804. )
  3805. } else {
  3806. sax.errorHandler.error('invalid doc source')
  3807. }
  3808. return domBuilder.doc;
  3809. }
  3810. function buildErrorHandler(errorImpl,domBuilder,locator){
  3811. if(!errorImpl){
  3812. if(domBuilder instanceof DOMHandler){
  3813. return domBuilder;
  3814. }
  3815. errorImpl = domBuilder ;
  3816. }
  3817. var errorHandler = {}
  3818. var isCallback = errorImpl instanceof Function;
  3819. locator = locator||{}
  3820. function build(key){
  3821. var fn = errorImpl[key];
  3822. if(!fn && isCallback){
  3823. fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl;
  3824. }
  3825. errorHandler[key] = fn && function(msg){
  3826. fn('[xmldom '+key+']\t'+msg+_locator(locator));
  3827. }||function(){};
  3828. }
  3829. build('warning');
  3830. build('error');
  3831. build('fatalError');
  3832. return errorHandler;
  3833. }
  3834. //console.log('#\n\n\n\n\n\n\n####')
  3835. /**
  3836. * +ContentHandler+ErrorHandler
  3837. * +LexicalHandler+EntityResolver2
  3838. * -DeclHandler-DTDHandler
  3839. *
  3840. * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler
  3841. * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2
  3842. * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html
  3843. */
  3844. function DOMHandler() {
  3845. this.cdata = false;
  3846. }
  3847. function position(locator,node){
  3848. node.lineNumber = locator.lineNumber;
  3849. node.columnNumber = locator.columnNumber;
  3850. }
  3851. /**
  3852. * @see org.xml.sax.ContentHandler#startDocument
  3853. * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html
  3854. */
  3855. DOMHandler.prototype = {
  3856. startDocument : function() {
  3857. this.doc = new DOMImplementation().createDocument(null, null, null);
  3858. if (this.locator) {
  3859. this.doc.documentURI = this.locator.systemId;
  3860. }
  3861. },
  3862. startElement:function(namespaceURI, localName, qName, attrs) {
  3863. var doc = this.doc;
  3864. var el = doc.createElementNS(namespaceURI, qName||localName);
  3865. var len = attrs.length;
  3866. appendElement(this, el);
  3867. this.currentElement = el;
  3868. this.locator && position(this.locator,el)
  3869. for (var i = 0 ; i < len; i++) {
  3870. var namespaceURI = attrs.getURI(i);
  3871. var value = attrs.getValue(i);
  3872. var qName = attrs.getQName(i);
  3873. var attr = doc.createAttributeNS(namespaceURI, qName);
  3874. this.locator &&position(attrs.getLocator(i),attr);
  3875. attr.value = attr.nodeValue = value;
  3876. el.setAttributeNode(attr)
  3877. }
  3878. },
  3879. endElement:function(namespaceURI, localName, qName) {
  3880. var current = this.currentElement
  3881. var tagName = current.tagName;
  3882. this.currentElement = current.parentNode;
  3883. },
  3884. startPrefixMapping:function(prefix, uri) {
  3885. },
  3886. endPrefixMapping:function(prefix) {
  3887. },
  3888. processingInstruction:function(target, data) {
  3889. var ins = this.doc.createProcessingInstruction(target, data);
  3890. this.locator && position(this.locator,ins)
  3891. appendElement(this, ins);
  3892. },
  3893. ignorableWhitespace:function(ch, start, length) {
  3894. },
  3895. characters:function(chars, start, length) {
  3896. chars = _toString.apply(this,arguments)
  3897. //console.log(chars)
  3898. if(chars){
  3899. if (this.cdata) {
  3900. var charNode = this.doc.createCDATASection(chars);
  3901. } else {
  3902. var charNode = this.doc.createTextNode(chars);
  3903. }
  3904. if(this.currentElement){
  3905. this.currentElement.appendChild(charNode);
  3906. }else if(/^\s*$/.test(chars)){
  3907. this.doc.appendChild(charNode);
  3908. //process xml
  3909. }
  3910. this.locator && position(this.locator,charNode)
  3911. }
  3912. },
  3913. skippedEntity:function(name) {
  3914. },
  3915. endDocument:function() {
  3916. this.doc.normalize();
  3917. },
  3918. setDocumentLocator:function (locator) {
  3919. if(this.locator = locator){// && !('lineNumber' in locator)){
  3920. locator.lineNumber = 0;
  3921. }
  3922. },
  3923. //LexicalHandler
  3924. comment:function(chars, start, length) {
  3925. chars = _toString.apply(this,arguments)
  3926. var comm = this.doc.createComment(chars);
  3927. this.locator && position(this.locator,comm)
  3928. appendElement(this, comm);
  3929. },
  3930. startCDATA:function() {
  3931. //used in characters() methods
  3932. this.cdata = true;
  3933. },
  3934. endCDATA:function() {
  3935. this.cdata = false;
  3936. },
  3937. startDTD:function(name, publicId, systemId) {
  3938. var impl = this.doc.implementation;
  3939. if (impl && impl.createDocumentType) {
  3940. var dt = impl.createDocumentType(name, publicId, systemId);
  3941. this.locator && position(this.locator,dt)
  3942. appendElement(this, dt);
  3943. this.doc.doctype = dt;
  3944. }
  3945. },
  3946. /**
  3947. * @see org.xml.sax.ErrorHandler
  3948. * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
  3949. */
  3950. warning:function(error) {
  3951. console.warn('[xmldom warning]\t'+error,_locator(this.locator));
  3952. },
  3953. error:function(error) {
  3954. console.error('[xmldom error]\t'+error,_locator(this.locator));
  3955. },
  3956. fatalError:function(error) {
  3957. throw new ParseError(error, this.locator);
  3958. }
  3959. }
  3960. function _locator(l){
  3961. if(l){
  3962. return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']'
  3963. }
  3964. }
  3965. function _toString(chars,start,length){
  3966. if(typeof chars == 'string'){
  3967. return chars.substr(start,length)
  3968. }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)")
  3969. if(chars.length >= start+length || start){
  3970. return new java.lang.String(chars,start,length)+'';
  3971. }
  3972. return chars;
  3973. }
  3974. }
  3975. /*
  3976. * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html
  3977. * used method of org.xml.sax.ext.LexicalHandler:
  3978. * #comment(chars, start, length)
  3979. * #startCDATA()
  3980. * #endCDATA()
  3981. * #startDTD(name, publicId, systemId)
  3982. *
  3983. *
  3984. * IGNORED method of org.xml.sax.ext.LexicalHandler:
  3985. * #endDTD()
  3986. * #startEntity(name)
  3987. * #endEntity(name)
  3988. *
  3989. *
  3990. * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html
  3991. * IGNORED method of org.xml.sax.ext.DeclHandler
  3992. * #attributeDecl(eName, aName, type, mode, value)
  3993. * #elementDecl(name, model)
  3994. * #externalEntityDecl(name, publicId, systemId)
  3995. * #internalEntityDecl(name, value)
  3996. * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html
  3997. * IGNORED method of org.xml.sax.EntityResolver2
  3998. * #resolveEntity(String name,String publicId,String baseURI,String systemId)
  3999. * #resolveEntity(publicId, systemId)
  4000. * #getExternalSubset(name, baseURI)
  4001. * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html
  4002. * IGNORED method of org.xml.sax.DTDHandler
  4003. * #notationDecl(name, publicId, systemId) {};
  4004. * #unparsedEntityDecl(name, publicId, systemId, notationName) {};
  4005. */
  4006. "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){
  4007. DOMHandler.prototype[key] = function(){return null}
  4008. })
  4009. /* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */
  4010. function appendElement (hander,node) {
  4011. if (!hander.currentElement) {
  4012. hander.doc.appendChild(node);
  4013. } else {
  4014. hander.currentElement.appendChild(node);
  4015. }
  4016. }//appendChild and setAttributeNS are preformance key
  4017. exports.__DOMHandler = DOMHandler;
  4018. exports.normalizeLineEndings = normalizeLineEndings;
  4019. exports.DOMParser = DOMParser;
  4020. },{"./conventions":41,"./dom":43,"./entities":44,"./sax":46}],43:[function(require,module,exports){
  4021. var conventions = require("./conventions");
  4022. var find = conventions.find;
  4023. var NAMESPACE = conventions.NAMESPACE;
  4024. /**
  4025. * A prerequisite for `[].filter`, to drop elements that are empty
  4026. * @param {string} input
  4027. * @returns {boolean}
  4028. */
  4029. function notEmptyString (input) {
  4030. return input !== ''
  4031. }
  4032. /**
  4033. * @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace
  4034. * @see https://infra.spec.whatwg.org/#ascii-whitespace
  4035. *
  4036. * @param {string} input
  4037. * @returns {string[]} (can be empty)
  4038. */
  4039. function splitOnASCIIWhitespace(input) {
  4040. // U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, U+0020 SPACE
  4041. return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : []
  4042. }
  4043. /**
  4044. * Adds element as a key to current if it is not already present.
  4045. *
  4046. * @param {Record<string, boolean | undefined>} current
  4047. * @param {string} element
  4048. * @returns {Record<string, boolean | undefined>}
  4049. */
  4050. function orderedSetReducer (current, element) {
  4051. if (!current.hasOwnProperty(element)) {
  4052. current[element] = true;
  4053. }
  4054. return current;
  4055. }
  4056. /**
  4057. * @see https://infra.spec.whatwg.org/#ordered-set
  4058. * @param {string} input
  4059. * @returns {string[]}
  4060. */
  4061. function toOrderedSet(input) {
  4062. if (!input) return [];
  4063. var list = splitOnASCIIWhitespace(input);
  4064. return Object.keys(list.reduce(orderedSetReducer, {}))
  4065. }
  4066. /**
  4067. * Uses `list.indexOf` to implement something like `Array.prototype.includes`,
  4068. * which we can not rely on being available.
  4069. *
  4070. * @param {any[]} list
  4071. * @returns {function(any): boolean}
  4072. */
  4073. function arrayIncludes (list) {
  4074. return function(element) {
  4075. return list && list.indexOf(element) !== -1;
  4076. }
  4077. }
  4078. function copy(src,dest){
  4079. for(var p in src){
  4080. if (Object.prototype.hasOwnProperty.call(src, p)) {
  4081. dest[p] = src[p];
  4082. }
  4083. }
  4084. }
  4085. /**
  4086. ^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));?
  4087. ^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));?
  4088. */
  4089. function _extends(Class,Super){
  4090. var pt = Class.prototype;
  4091. if(!(pt instanceof Super)){
  4092. function t(){};
  4093. t.prototype = Super.prototype;
  4094. t = new t();
  4095. copy(pt,t);
  4096. Class.prototype = pt = t;
  4097. }
  4098. if(pt.constructor != Class){
  4099. if(typeof Class != 'function'){
  4100. console.error("unknown Class:"+Class)
  4101. }
  4102. pt.constructor = Class
  4103. }
  4104. }
  4105. // Node Types
  4106. var NodeType = {}
  4107. var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
  4108. var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;
  4109. var TEXT_NODE = NodeType.TEXT_NODE = 3;
  4110. var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;
  4111. var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;
  4112. var ENTITY_NODE = NodeType.ENTITY_NODE = 6;
  4113. var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;
  4114. var COMMENT_NODE = NodeType.COMMENT_NODE = 8;
  4115. var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;
  4116. var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
  4117. var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
  4118. var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
  4119. // ExceptionCode
  4120. var ExceptionCode = {}
  4121. var ExceptionMessage = {};
  4122. var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]="Index size error"),1);
  4123. var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2);
  4124. var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3);
  4125. var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4);
  4126. var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
  4127. var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6);
  4128. var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7);
  4129. var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8);
  4130. var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9);
  4131. var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10);
  4132. //level2
  4133. var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
  4134. var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12);
  4135. var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13);
  4136. var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14);
  4137. var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = ((ExceptionMessage[15]="Invalid access"),15);
  4138. /**
  4139. * DOM Level 2
  4140. * Object DOMException
  4141. * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html
  4142. * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html
  4143. */
  4144. function DOMException(code, message) {
  4145. if(message instanceof Error){
  4146. var error = message;
  4147. }else{
  4148. error = this;
  4149. Error.call(this, ExceptionMessage[code]);
  4150. this.message = ExceptionMessage[code];
  4151. if(Error.captureStackTrace) Error.captureStackTrace(this, DOMException);
  4152. }
  4153. error.code = code;
  4154. if(message) this.message = this.message + ": " + message;
  4155. return error;
  4156. };
  4157. DOMException.prototype = Error.prototype;
  4158. copy(ExceptionCode,DOMException)
  4159. /**
  4160. * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177
  4161. * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.
  4162. * The items in the NodeList are accessible via an integral index, starting from 0.
  4163. */
  4164. function NodeList() {
  4165. };
  4166. NodeList.prototype = {
  4167. /**
  4168. * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.
  4169. * @standard level1
  4170. */
  4171. length:0,
  4172. /**
  4173. * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.
  4174. * @standard level1
  4175. * @param index unsigned long
  4176. * Index into the collection.
  4177. * @return Node
  4178. * The node at the indexth position in the NodeList, or null if that is not a valid index.
  4179. */
  4180. item: function(index) {
  4181. return this[index] || null;
  4182. },
  4183. toString:function(isHTML,nodeFilter){
  4184. for(var buf = [], i = 0;i<this.length;i++){
  4185. serializeToString(this[i],buf,isHTML,nodeFilter);
  4186. }
  4187. return buf.join('');
  4188. },
  4189. /**
  4190. * @private
  4191. * @param {function (Node):boolean} predicate
  4192. * @returns {Node[]}
  4193. */
  4194. filter: function (predicate) {
  4195. return Array.prototype.filter.call(this, predicate);
  4196. },
  4197. /**
  4198. * @private
  4199. * @param {Node} item
  4200. * @returns {number}
  4201. */
  4202. indexOf: function (item) {
  4203. return Array.prototype.indexOf.call(this, item);
  4204. },
  4205. };
  4206. function LiveNodeList(node,refresh){
  4207. this._node = node;
  4208. this._refresh = refresh
  4209. _updateLiveList(this);
  4210. }
  4211. function _updateLiveList(list){
  4212. var inc = list._node._inc || list._node.ownerDocument._inc;
  4213. if(list._inc != inc){
  4214. var ls = list._refresh(list._node);
  4215. //console.log(ls.length)
  4216. __set__(list,'length',ls.length);
  4217. copy(ls,list);
  4218. list._inc = inc;
  4219. }
  4220. }
  4221. LiveNodeList.prototype.item = function(i){
  4222. _updateLiveList(this);
  4223. return this[i];
  4224. }
  4225. _extends(LiveNodeList,NodeList);
  4226. /**
  4227. * Objects implementing the NamedNodeMap interface are used
  4228. * to represent collections of nodes that can be accessed by name.
  4229. * Note that NamedNodeMap does not inherit from NodeList;
  4230. * NamedNodeMaps are not maintained in any particular order.
  4231. * Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index,
  4232. * but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,
  4233. * and does not imply that the DOM specifies an order to these Nodes.
  4234. * NamedNodeMap objects in the DOM are live.
  4235. * used for attributes or DocumentType entities
  4236. */
  4237. function NamedNodeMap() {
  4238. };
  4239. function _findNodeIndex(list,node){
  4240. var i = list.length;
  4241. while(i--){
  4242. if(list[i] === node){return i}
  4243. }
  4244. }
  4245. function _addNamedNode(el,list,newAttr,oldAttr){
  4246. if(oldAttr){
  4247. list[_findNodeIndex(list,oldAttr)] = newAttr;
  4248. }else{
  4249. list[list.length++] = newAttr;
  4250. }
  4251. if(el){
  4252. newAttr.ownerElement = el;
  4253. var doc = el.ownerDocument;
  4254. if(doc){
  4255. oldAttr && _onRemoveAttribute(doc,el,oldAttr);
  4256. _onAddAttribute(doc,el,newAttr);
  4257. }
  4258. }
  4259. }
  4260. function _removeNamedNode(el,list,attr){
  4261. //console.log('remove attr:'+attr)
  4262. var i = _findNodeIndex(list,attr);
  4263. if(i>=0){
  4264. var lastIndex = list.length-1
  4265. while(i<lastIndex){
  4266. list[i] = list[++i]
  4267. }
  4268. list.length = lastIndex;
  4269. if(el){
  4270. var doc = el.ownerDocument;
  4271. if(doc){
  4272. _onRemoveAttribute(doc,el,attr);
  4273. attr.ownerElement = null;
  4274. }
  4275. }
  4276. }else{
  4277. throw new DOMException(NOT_FOUND_ERR,new Error(el.tagName+'@'+attr))
  4278. }
  4279. }
  4280. NamedNodeMap.prototype = {
  4281. length:0,
  4282. item:NodeList.prototype.item,
  4283. getNamedItem: function(key) {
  4284. // if(key.indexOf(':')>0 || key == 'xmlns'){
  4285. // return null;
  4286. // }
  4287. //console.log()
  4288. var i = this.length;
  4289. while(i--){
  4290. var attr = this[i];
  4291. //console.log(attr.nodeName,key)
  4292. if(attr.nodeName == key){
  4293. return attr;
  4294. }
  4295. }
  4296. },
  4297. setNamedItem: function(attr) {
  4298. var el = attr.ownerElement;
  4299. if(el && el!=this._ownerElement){
  4300. throw new DOMException(INUSE_ATTRIBUTE_ERR);
  4301. }
  4302. var oldAttr = this.getNamedItem(attr.nodeName);
  4303. _addNamedNode(this._ownerElement,this,attr,oldAttr);
  4304. return oldAttr;
  4305. },
  4306. /* returns Node */
  4307. setNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR
  4308. var el = attr.ownerElement, oldAttr;
  4309. if(el && el!=this._ownerElement){
  4310. throw new DOMException(INUSE_ATTRIBUTE_ERR);
  4311. }
  4312. oldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName);
  4313. _addNamedNode(this._ownerElement,this,attr,oldAttr);
  4314. return oldAttr;
  4315. },
  4316. /* returns Node */
  4317. removeNamedItem: function(key) {
  4318. var attr = this.getNamedItem(key);
  4319. _removeNamedNode(this._ownerElement,this,attr);
  4320. return attr;
  4321. },// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR
  4322. //for level2
  4323. removeNamedItemNS:function(namespaceURI,localName){
  4324. var attr = this.getNamedItemNS(namespaceURI,localName);
  4325. _removeNamedNode(this._ownerElement,this,attr);
  4326. return attr;
  4327. },
  4328. getNamedItemNS: function(namespaceURI, localName) {
  4329. var i = this.length;
  4330. while(i--){
  4331. var node = this[i];
  4332. if(node.localName == localName && node.namespaceURI == namespaceURI){
  4333. return node;
  4334. }
  4335. }
  4336. return null;
  4337. }
  4338. };
  4339. /**
  4340. * The DOMImplementation interface represents an object providing methods
  4341. * which are not dependent on any particular document.
  4342. * Such an object is returned by the `Document.implementation` property.
  4343. *
  4344. * __The individual methods describe the differences compared to the specs.__
  4345. *
  4346. * @constructor
  4347. *
  4348. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN
  4349. * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial)
  4350. * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core
  4351. * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core
  4352. * @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard
  4353. */
  4354. function DOMImplementation() {
  4355. }
  4356. DOMImplementation.prototype = {
  4357. /**
  4358. * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.
  4359. * The different implementations fairly diverged in what kind of features were reported.
  4360. * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.
  4361. *
  4362. * @deprecated It is deprecated and modern browsers return true in all cases.
  4363. *
  4364. * @param {string} feature
  4365. * @param {string} [version]
  4366. * @returns {boolean} always true
  4367. *
  4368. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN
  4369. * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core
  4370. * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard
  4371. */
  4372. hasFeature: function(feature, version) {
  4373. return true;
  4374. },
  4375. /**
  4376. * Creates an XML Document object of the specified type with its document element.
  4377. *
  4378. * __It behaves slightly different from the description in the living standard__:
  4379. * - There is no interface/class `XMLDocument`, it returns a `Document` instance.
  4380. * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.
  4381. * - this implementation is not validating names or qualified names
  4382. * (when parsing XML strings, the SAX parser takes care of that)
  4383. *
  4384. * @param {string|null} namespaceURI
  4385. * @param {string} qualifiedName
  4386. * @param {DocumentType=null} doctype
  4387. * @returns {Document}
  4388. *
  4389. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN
  4390. * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)
  4391. * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core
  4392. *
  4393. * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
  4394. * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
  4395. * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
  4396. */
  4397. createDocument: function(namespaceURI, qualifiedName, doctype){
  4398. var doc = new Document();
  4399. doc.implementation = this;
  4400. doc.childNodes = new NodeList();
  4401. doc.doctype = doctype || null;
  4402. if (doctype){
  4403. doc.appendChild(doctype);
  4404. }
  4405. if (qualifiedName){
  4406. var root = doc.createElementNS(namespaceURI, qualifiedName);
  4407. doc.appendChild(root);
  4408. }
  4409. return doc;
  4410. },
  4411. /**
  4412. * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
  4413. *
  4414. * __This behavior is slightly different from the in the specs__:
  4415. * - this implementation is not validating names or qualified names
  4416. * (when parsing XML strings, the SAX parser takes care of that)
  4417. *
  4418. * @param {string} qualifiedName
  4419. * @param {string} [publicId]
  4420. * @param {string} [systemId]
  4421. * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
  4422. * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
  4423. *
  4424. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN
  4425. * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core
  4426. * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard
  4427. *
  4428. * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
  4429. * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
  4430. * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
  4431. */
  4432. createDocumentType: function(qualifiedName, publicId, systemId){
  4433. var node = new DocumentType();
  4434. node.name = qualifiedName;
  4435. node.nodeName = qualifiedName;
  4436. node.publicId = publicId || '';
  4437. node.systemId = systemId || '';
  4438. return node;
  4439. }
  4440. };
  4441. /**
  4442. * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247
  4443. */
  4444. function Node() {
  4445. };
  4446. Node.prototype = {
  4447. firstChild : null,
  4448. lastChild : null,
  4449. previousSibling : null,
  4450. nextSibling : null,
  4451. attributes : null,
  4452. parentNode : null,
  4453. childNodes : null,
  4454. ownerDocument : null,
  4455. nodeValue : null,
  4456. namespaceURI : null,
  4457. prefix : null,
  4458. localName : null,
  4459. // Modified in DOM Level 2:
  4460. insertBefore:function(newChild, refChild){//raises
  4461. return _insertBefore(this,newChild,refChild);
  4462. },
  4463. replaceChild:function(newChild, oldChild){//raises
  4464. _insertBefore(this, newChild,oldChild, assertPreReplacementValidityInDocument);
  4465. if(oldChild){
  4466. this.removeChild(oldChild);
  4467. }
  4468. },
  4469. removeChild:function(oldChild){
  4470. return _removeChild(this,oldChild);
  4471. },
  4472. appendChild:function(newChild){
  4473. return this.insertBefore(newChild,null);
  4474. },
  4475. hasChildNodes:function(){
  4476. return this.firstChild != null;
  4477. },
  4478. cloneNode:function(deep){
  4479. return cloneNode(this.ownerDocument||this,this,deep);
  4480. },
  4481. // Modified in DOM Level 2:
  4482. normalize:function(){
  4483. var child = this.firstChild;
  4484. while(child){
  4485. var next = child.nextSibling;
  4486. if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){
  4487. this.removeChild(next);
  4488. child.appendData(next.data);
  4489. }else{
  4490. child.normalize();
  4491. child = next;
  4492. }
  4493. }
  4494. },
  4495. // Introduced in DOM Level 2:
  4496. isSupported:function(feature, version){
  4497. return this.ownerDocument.implementation.hasFeature(feature,version);
  4498. },
  4499. // Introduced in DOM Level 2:
  4500. hasAttributes:function(){
  4501. return this.attributes.length>0;
  4502. },
  4503. /**
  4504. * Look up the prefix associated to the given namespace URI, starting from this node.
  4505. * **The default namespace declarations are ignored by this method.**
  4506. * See Namespace Prefix Lookup for details on the algorithm used by this method.
  4507. *
  4508. * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._
  4509. *
  4510. * @param {string | null} namespaceURI
  4511. * @returns {string | null}
  4512. * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix
  4513. * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo
  4514. * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix
  4515. * @see https://github.com/xmldom/xmldom/issues/322
  4516. */
  4517. lookupPrefix:function(namespaceURI){
  4518. var el = this;
  4519. while(el){
  4520. var map = el._nsMap;
  4521. //console.dir(map)
  4522. if(map){
  4523. for(var n in map){
  4524. if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {
  4525. return n;
  4526. }
  4527. }
  4528. }
  4529. el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
  4530. }
  4531. return null;
  4532. },
  4533. // Introduced in DOM Level 3:
  4534. lookupNamespaceURI:function(prefix){
  4535. var el = this;
  4536. while(el){
  4537. var map = el._nsMap;
  4538. //console.dir(map)
  4539. if(map){
  4540. if(Object.prototype.hasOwnProperty.call(map, prefix)){
  4541. return map[prefix] ;
  4542. }
  4543. }
  4544. el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
  4545. }
  4546. return null;
  4547. },
  4548. // Introduced in DOM Level 3:
  4549. isDefaultNamespace:function(namespaceURI){
  4550. var prefix = this.lookupPrefix(namespaceURI);
  4551. return prefix == null;
  4552. }
  4553. };
  4554. function _xmlEncoder(c){
  4555. return c == '<' && '&lt;' ||
  4556. c == '>' && '&gt;' ||
  4557. c == '&' && '&amp;' ||
  4558. c == '"' && '&quot;' ||
  4559. '&#'+c.charCodeAt()+';'
  4560. }
  4561. copy(NodeType,Node);
  4562. copy(NodeType,Node.prototype);
  4563. /**
  4564. * @param callback return true for continue,false for break
  4565. * @return boolean true: break visit;
  4566. */
  4567. function _visitNode(node,callback){
  4568. if(callback(node)){
  4569. return true;
  4570. }
  4571. if(node = node.firstChild){
  4572. do{
  4573. if(_visitNode(node,callback)){return true}
  4574. }while(node=node.nextSibling)
  4575. }
  4576. }
  4577. function Document(){
  4578. this.ownerDocument = this;
  4579. }
  4580. function _onAddAttribute(doc,el,newAttr){
  4581. doc && doc._inc++;
  4582. var ns = newAttr.namespaceURI ;
  4583. if(ns === NAMESPACE.XMLNS){
  4584. //update namespace
  4585. el._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value
  4586. }
  4587. }
  4588. function _onRemoveAttribute(doc,el,newAttr,remove){
  4589. doc && doc._inc++;
  4590. var ns = newAttr.namespaceURI ;
  4591. if(ns === NAMESPACE.XMLNS){
  4592. //update namespace
  4593. delete el._nsMap[newAttr.prefix?newAttr.localName:'']
  4594. }
  4595. }
  4596. /**
  4597. * Updates `el.childNodes`, updating the indexed items and it's `length`.
  4598. * Passing `newChild` means it will be appended.
  4599. * Otherwise it's assumed that an item has been removed,
  4600. * and `el.firstNode` and it's `.nextSibling` are used
  4601. * to walk the current list of child nodes.
  4602. *
  4603. * @param {Document} doc
  4604. * @param {Node} el
  4605. * @param {Node} [newChild]
  4606. * @private
  4607. */
  4608. function _onUpdateChild (doc, el, newChild) {
  4609. if(doc && doc._inc){
  4610. doc._inc++;
  4611. //update childNodes
  4612. var cs = el.childNodes;
  4613. if (newChild) {
  4614. cs[cs.length++] = newChild;
  4615. } else {
  4616. var child = el.firstChild;
  4617. var i = 0;
  4618. while (child) {
  4619. cs[i++] = child;
  4620. child = child.nextSibling;
  4621. }
  4622. cs.length = i;
  4623. delete cs[cs.length];
  4624. }
  4625. }
  4626. }
  4627. /**
  4628. * Removes the connections between `parentNode` and `child`
  4629. * and any existing `child.previousSibling` or `child.nextSibling`.
  4630. *
  4631. * @see https://github.com/xmldom/xmldom/issues/135
  4632. * @see https://github.com/xmldom/xmldom/issues/145
  4633. *
  4634. * @param {Node} parentNode
  4635. * @param {Node} child
  4636. * @returns {Node} the child that was removed.
  4637. * @private
  4638. */
  4639. function _removeChild (parentNode, child) {
  4640. var previous = child.previousSibling;
  4641. var next = child.nextSibling;
  4642. if (previous) {
  4643. previous.nextSibling = next;
  4644. } else {
  4645. parentNode.firstChild = next;
  4646. }
  4647. if (next) {
  4648. next.previousSibling = previous;
  4649. } else {
  4650. parentNode.lastChild = previous;
  4651. }
  4652. child.parentNode = null;
  4653. child.previousSibling = null;
  4654. child.nextSibling = null;
  4655. _onUpdateChild(parentNode.ownerDocument, parentNode);
  4656. return child;
  4657. }
  4658. /**
  4659. * Returns `true` if `node` can be a parent for insertion.
  4660. * @param {Node} node
  4661. * @returns {boolean}
  4662. */
  4663. function hasValidParentNodeType(node) {
  4664. return (
  4665. node &&
  4666. (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE)
  4667. );
  4668. }
  4669. /**
  4670. * Returns `true` if `node` can be inserted according to it's `nodeType`.
  4671. * @param {Node} node
  4672. * @returns {boolean}
  4673. */
  4674. function hasInsertableNodeType(node) {
  4675. return (
  4676. node &&
  4677. (isElementNode(node) ||
  4678. isTextNode(node) ||
  4679. isDocTypeNode(node) ||
  4680. node.nodeType === Node.DOCUMENT_FRAGMENT_NODE ||
  4681. node.nodeType === Node.COMMENT_NODE ||
  4682. node.nodeType === Node.PROCESSING_INSTRUCTION_NODE)
  4683. );
  4684. }
  4685. /**
  4686. * Returns true if `node` is a DOCTYPE node
  4687. * @param {Node} node
  4688. * @returns {boolean}
  4689. */
  4690. function isDocTypeNode(node) {
  4691. return node && node.nodeType === Node.DOCUMENT_TYPE_NODE;
  4692. }
  4693. /**
  4694. * Returns true if the node is an element
  4695. * @param {Node} node
  4696. * @returns {boolean}
  4697. */
  4698. function isElementNode(node) {
  4699. return node && node.nodeType === Node.ELEMENT_NODE;
  4700. }
  4701. /**
  4702. * Returns true if `node` is a text node
  4703. * @param {Node} node
  4704. * @returns {boolean}
  4705. */
  4706. function isTextNode(node) {
  4707. return node && node.nodeType === Node.TEXT_NODE;
  4708. }
  4709. /**
  4710. * Check if en element node can be inserted before `child`, or at the end if child is falsy,
  4711. * according to the presence and position of a doctype node on the same level.
  4712. *
  4713. * @param {Document} doc The document node
  4714. * @param {Node} child the node that would become the nextSibling if the element would be inserted
  4715. * @returns {boolean} `true` if an element can be inserted before child
  4716. * @private
  4717. * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  4718. */
  4719. function isElementInsertionPossible(doc, child) {
  4720. var parentChildNodes = doc.childNodes || [];
  4721. if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) {
  4722. return false;
  4723. }
  4724. var docTypeNode = find(parentChildNodes, isDocTypeNode);
  4725. return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
  4726. }
  4727. /**
  4728. * Check if en element node can be inserted before `child`, or at the end if child is falsy,
  4729. * according to the presence and position of a doctype node on the same level.
  4730. *
  4731. * @param {Node} doc The document node
  4732. * @param {Node} child the node that would become the nextSibling if the element would be inserted
  4733. * @returns {boolean} `true` if an element can be inserted before child
  4734. * @private
  4735. * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  4736. */
  4737. function isElementReplacementPossible(doc, child) {
  4738. var parentChildNodes = doc.childNodes || [];
  4739. function hasElementChildThatIsNotChild(node) {
  4740. return isElementNode(node) && node !== child;
  4741. }
  4742. if (find(parentChildNodes, hasElementChildThatIsNotChild)) {
  4743. return false;
  4744. }
  4745. var docTypeNode = find(parentChildNodes, isDocTypeNode);
  4746. return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
  4747. }
  4748. /**
  4749. * @private
  4750. * Steps 1-5 of the checks before inserting and before replacing a child are the same.
  4751. *
  4752. * @param {Node} parent the parent node to insert `node` into
  4753. * @param {Node} node the node to insert
  4754. * @param {Node=} child the node that should become the `nextSibling` of `node`
  4755. * @returns {Node}
  4756. * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
  4757. * @throws DOMException if `child` is provided but is not a child of `parent`.
  4758. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  4759. * @see https://dom.spec.whatwg.org/#concept-node-replace
  4760. */
  4761. function assertPreInsertionValidity1to5(parent, node, child) {
  4762. // 1. If `parent` is not a Document, DocumentFragment, or Element node, then throw a "HierarchyRequestError" DOMException.
  4763. if (!hasValidParentNodeType(parent)) {
  4764. throw new DOMException(HIERARCHY_REQUEST_ERR, 'Unexpected parent node type ' + parent.nodeType);
  4765. }
  4766. // 2. If `node` is a host-including inclusive ancestor of `parent`, then throw a "HierarchyRequestError" DOMException.
  4767. // not implemented!
  4768. // 3. If `child` is non-null and its parent is not `parent`, then throw a "NotFoundError" DOMException.
  4769. if (child && child.parentNode !== parent) {
  4770. throw new DOMException(NOT_FOUND_ERR, 'child not in parent');
  4771. }
  4772. if (
  4773. // 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a "HierarchyRequestError" DOMException.
  4774. !hasInsertableNodeType(node) ||
  4775. // 5. If either `node` is a Text node and `parent` is a document,
  4776. // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0
  4777. // || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE)
  4778. // or `node` is a doctype and `parent` is not a document, then throw a "HierarchyRequestError" DOMException.
  4779. (isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE)
  4780. ) {
  4781. throw new DOMException(
  4782. HIERARCHY_REQUEST_ERR,
  4783. 'Unexpected node type ' + node.nodeType + ' for parent node type ' + parent.nodeType
  4784. );
  4785. }
  4786. }
  4787. /**
  4788. * @private
  4789. * Step 6 of the checks before inserting and before replacing a child are different.
  4790. *
  4791. * @param {Document} parent the parent node to insert `node` into
  4792. * @param {Node} node the node to insert
  4793. * @param {Node | undefined} child the node that should become the `nextSibling` of `node`
  4794. * @returns {Node}
  4795. * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
  4796. * @throws DOMException if `child` is provided but is not a child of `parent`.
  4797. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  4798. * @see https://dom.spec.whatwg.org/#concept-node-replace
  4799. */
  4800. function assertPreInsertionValidityInDocument(parent, node, child) {
  4801. var parentChildNodes = parent.childNodes || [];
  4802. var nodeChildNodes = node.childNodes || [];
  4803. // DocumentFragment
  4804. if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
  4805. var nodeChildElements = nodeChildNodes.filter(isElementNode);
  4806. // If node has more than one element child or has a Text node child.
  4807. if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
  4808. throw new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');
  4809. }
  4810. // Otherwise, if `node` has one element child and either `parent` has an element child,
  4811. // `child` is a doctype, or `child` is non-null and a doctype is following `child`.
  4812. if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {
  4813. throw new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');
  4814. }
  4815. }
  4816. // Element
  4817. if (isElementNode(node)) {
  4818. // `parent` has an element child, `child` is a doctype,
  4819. // or `child` is non-null and a doctype is following `child`.
  4820. if (!isElementInsertionPossible(parent, child)) {
  4821. throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');
  4822. }
  4823. }
  4824. // DocumentType
  4825. if (isDocTypeNode(node)) {
  4826. // `parent` has a doctype child,
  4827. if (find(parentChildNodes, isDocTypeNode)) {
  4828. throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');
  4829. }
  4830. var parentElementChild = find(parentChildNodes, isElementNode);
  4831. // `child` is non-null and an element is preceding `child`,
  4832. if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
  4833. throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');
  4834. }
  4835. // or `child` is null and `parent` has an element child.
  4836. if (!child && parentElementChild) {
  4837. throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can not be appended since element is present');
  4838. }
  4839. }
  4840. }
  4841. /**
  4842. * @private
  4843. * Step 6 of the checks before inserting and before replacing a child are different.
  4844. *
  4845. * @param {Document} parent the parent node to insert `node` into
  4846. * @param {Node} node the node to insert
  4847. * @param {Node | undefined} child the node that should become the `nextSibling` of `node`
  4848. * @returns {Node}
  4849. * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
  4850. * @throws DOMException if `child` is provided but is not a child of `parent`.
  4851. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  4852. * @see https://dom.spec.whatwg.org/#concept-node-replace
  4853. */
  4854. function assertPreReplacementValidityInDocument(parent, node, child) {
  4855. var parentChildNodes = parent.childNodes || [];
  4856. var nodeChildNodes = node.childNodes || [];
  4857. // DocumentFragment
  4858. if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
  4859. var nodeChildElements = nodeChildNodes.filter(isElementNode);
  4860. // If `node` has more than one element child or has a Text node child.
  4861. if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
  4862. throw new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');
  4863. }
  4864. // Otherwise, if `node` has one element child and either `parent` has an element child that is not `child` or a doctype is following `child`.
  4865. if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {
  4866. throw new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');
  4867. }
  4868. }
  4869. // Element
  4870. if (isElementNode(node)) {
  4871. // `parent` has an element child that is not `child` or a doctype is following `child`.
  4872. if (!isElementReplacementPossible(parent, child)) {
  4873. throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');
  4874. }
  4875. }
  4876. // DocumentType
  4877. if (isDocTypeNode(node)) {
  4878. function hasDoctypeChildThatIsNotChild(node) {
  4879. return isDocTypeNode(node) && node !== child;
  4880. }
  4881. // `parent` has a doctype child that is not `child`,
  4882. if (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) {
  4883. throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');
  4884. }
  4885. var parentElementChild = find(parentChildNodes, isElementNode);
  4886. // or an element is preceding `child`.
  4887. if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
  4888. throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');
  4889. }
  4890. }
  4891. }
  4892. /**
  4893. * @private
  4894. * @param {Node} parent the parent node to insert `node` into
  4895. * @param {Node} node the node to insert
  4896. * @param {Node=} child the node that should become the `nextSibling` of `node`
  4897. * @returns {Node}
  4898. * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
  4899. * @throws DOMException if `child` is provided but is not a child of `parent`.
  4900. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
  4901. */
  4902. function _insertBefore(parent, node, child, _inDocumentAssertion) {
  4903. // To ensure pre-insertion validity of a node into a parent before a child, run these steps:
  4904. assertPreInsertionValidity1to5(parent, node, child);
  4905. // If parent is a document, and any of the statements below, switched on the interface node implements,
  4906. // are true, then throw a "HierarchyRequestError" DOMException.
  4907. if (parent.nodeType === Node.DOCUMENT_NODE) {
  4908. (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);
  4909. }
  4910. var cp = node.parentNode;
  4911. if(cp){
  4912. cp.removeChild(node);//remove and update
  4913. }
  4914. if(node.nodeType === DOCUMENT_FRAGMENT_NODE){
  4915. var newFirst = node.firstChild;
  4916. if (newFirst == null) {
  4917. return node;
  4918. }
  4919. var newLast = node.lastChild;
  4920. }else{
  4921. newFirst = newLast = node;
  4922. }
  4923. var pre = child ? child.previousSibling : parent.lastChild;
  4924. newFirst.previousSibling = pre;
  4925. newLast.nextSibling = child;
  4926. if(pre){
  4927. pre.nextSibling = newFirst;
  4928. }else{
  4929. parent.firstChild = newFirst;
  4930. }
  4931. if(child == null){
  4932. parent.lastChild = newLast;
  4933. }else{
  4934. child.previousSibling = newLast;
  4935. }
  4936. do{
  4937. newFirst.parentNode = parent;
  4938. }while(newFirst !== newLast && (newFirst= newFirst.nextSibling))
  4939. _onUpdateChild(parent.ownerDocument||parent, parent);
  4940. //console.log(parent.lastChild.nextSibling == null)
  4941. if (node.nodeType == DOCUMENT_FRAGMENT_NODE) {
  4942. node.firstChild = node.lastChild = null;
  4943. }
  4944. return node;
  4945. }
  4946. /**
  4947. * Appends `newChild` to `parentNode`.
  4948. * If `newChild` is already connected to a `parentNode` it is first removed from it.
  4949. *
  4950. * @see https://github.com/xmldom/xmldom/issues/135
  4951. * @see https://github.com/xmldom/xmldom/issues/145
  4952. * @param {Node} parentNode
  4953. * @param {Node} newChild
  4954. * @returns {Node}
  4955. * @private
  4956. */
  4957. function _appendSingleChild (parentNode, newChild) {
  4958. if (newChild.parentNode) {
  4959. newChild.parentNode.removeChild(newChild);
  4960. }
  4961. newChild.parentNode = parentNode;
  4962. newChild.previousSibling = parentNode.lastChild;
  4963. newChild.nextSibling = null;
  4964. if (newChild.previousSibling) {
  4965. newChild.previousSibling.nextSibling = newChild;
  4966. } else {
  4967. parentNode.firstChild = newChild;
  4968. }
  4969. parentNode.lastChild = newChild;
  4970. _onUpdateChild(parentNode.ownerDocument, parentNode, newChild);
  4971. return newChild;
  4972. }
  4973. Document.prototype = {
  4974. //implementation : null,
  4975. nodeName : '#document',
  4976. nodeType : DOCUMENT_NODE,
  4977. /**
  4978. * The DocumentType node of the document.
  4979. *
  4980. * @readonly
  4981. * @type DocumentType
  4982. */
  4983. doctype : null,
  4984. documentElement : null,
  4985. _inc : 1,
  4986. insertBefore : function(newChild, refChild){//raises
  4987. if(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){
  4988. var child = newChild.firstChild;
  4989. while(child){
  4990. var next = child.nextSibling;
  4991. this.insertBefore(child,refChild);
  4992. child = next;
  4993. }
  4994. return newChild;
  4995. }
  4996. _insertBefore(this, newChild, refChild);
  4997. newChild.ownerDocument = this;
  4998. if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {
  4999. this.documentElement = newChild;
  5000. }
  5001. return newChild;
  5002. },
  5003. removeChild : function(oldChild){
  5004. if(this.documentElement == oldChild){
  5005. this.documentElement = null;
  5006. }
  5007. return _removeChild(this,oldChild);
  5008. },
  5009. replaceChild: function (newChild, oldChild) {
  5010. //raises
  5011. _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
  5012. newChild.ownerDocument = this;
  5013. if (oldChild) {
  5014. this.removeChild(oldChild);
  5015. }
  5016. if (isElementNode(newChild)) {
  5017. this.documentElement = newChild;
  5018. }
  5019. },
  5020. // Introduced in DOM Level 2:
  5021. importNode : function(importedNode,deep){
  5022. return importNode(this,importedNode,deep);
  5023. },
  5024. // Introduced in DOM Level 2:
  5025. getElementById : function(id){
  5026. var rtv = null;
  5027. _visitNode(this.documentElement,function(node){
  5028. if(node.nodeType == ELEMENT_NODE){
  5029. if(node.getAttribute('id') == id){
  5030. rtv = node;
  5031. return true;
  5032. }
  5033. }
  5034. })
  5035. return rtv;
  5036. },
  5037. /**
  5038. * The `getElementsByClassName` method of `Document` interface returns an array-like object
  5039. * of all child elements which have **all** of the given class name(s).
  5040. *
  5041. * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.
  5042. *
  5043. *
  5044. * Warning: This is a live LiveNodeList.
  5045. * Changes in the DOM will reflect in the array as the changes occur.
  5046. * If an element selected by this array no longer qualifies for the selector,
  5047. * it will automatically be removed. Be aware of this for iteration purposes.
  5048. *
  5049. * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace
  5050. *
  5051. * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
  5052. * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname
  5053. */
  5054. getElementsByClassName: function(classNames) {
  5055. var classNamesSet = toOrderedSet(classNames)
  5056. return new LiveNodeList(this, function(base) {
  5057. var ls = [];
  5058. if (classNamesSet.length > 0) {
  5059. _visitNode(base.documentElement, function(node) {
  5060. if(node !== base && node.nodeType === ELEMENT_NODE) {
  5061. var nodeClassNames = node.getAttribute('class')
  5062. // can be null if the attribute does not exist
  5063. if (nodeClassNames) {
  5064. // before splitting and iterating just compare them for the most common case
  5065. var matches = classNames === nodeClassNames;
  5066. if (!matches) {
  5067. var nodeClassNamesSet = toOrderedSet(nodeClassNames)
  5068. matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet))
  5069. }
  5070. if(matches) {
  5071. ls.push(node);
  5072. }
  5073. }
  5074. }
  5075. });
  5076. }
  5077. return ls;
  5078. });
  5079. },
  5080. //document factory method:
  5081. createElement : function(tagName){
  5082. var node = new Element();
  5083. node.ownerDocument = this;
  5084. node.nodeName = tagName;
  5085. node.tagName = tagName;
  5086. node.localName = tagName;
  5087. node.childNodes = new NodeList();
  5088. var attrs = node.attributes = new NamedNodeMap();
  5089. attrs._ownerElement = node;
  5090. return node;
  5091. },
  5092. createDocumentFragment : function(){
  5093. var node = new DocumentFragment();
  5094. node.ownerDocument = this;
  5095. node.childNodes = new NodeList();
  5096. return node;
  5097. },
  5098. createTextNode : function(data){
  5099. var node = new Text();
  5100. node.ownerDocument = this;
  5101. node.appendData(data)
  5102. return node;
  5103. },
  5104. createComment : function(data){
  5105. var node = new Comment();
  5106. node.ownerDocument = this;
  5107. node.appendData(data)
  5108. return node;
  5109. },
  5110. createCDATASection : function(data){
  5111. var node = new CDATASection();
  5112. node.ownerDocument = this;
  5113. node.appendData(data)
  5114. return node;
  5115. },
  5116. createProcessingInstruction : function(target,data){
  5117. var node = new ProcessingInstruction();
  5118. node.ownerDocument = this;
  5119. node.tagName = node.target = target;
  5120. node.nodeValue= node.data = data;
  5121. return node;
  5122. },
  5123. createAttribute : function(name){
  5124. var node = new Attr();
  5125. node.ownerDocument = this;
  5126. node.name = name;
  5127. node.nodeName = name;
  5128. node.localName = name;
  5129. node.specified = true;
  5130. return node;
  5131. },
  5132. createEntityReference : function(name){
  5133. var node = new EntityReference();
  5134. node.ownerDocument = this;
  5135. node.nodeName = name;
  5136. return node;
  5137. },
  5138. // Introduced in DOM Level 2:
  5139. createElementNS : function(namespaceURI,qualifiedName){
  5140. var node = new Element();
  5141. var pl = qualifiedName.split(':');
  5142. var attrs = node.attributes = new NamedNodeMap();
  5143. node.childNodes = new NodeList();
  5144. node.ownerDocument = this;
  5145. node.nodeName = qualifiedName;
  5146. node.tagName = qualifiedName;
  5147. node.namespaceURI = namespaceURI;
  5148. if(pl.length == 2){
  5149. node.prefix = pl[0];
  5150. node.localName = pl[1];
  5151. }else{
  5152. //el.prefix = null;
  5153. node.localName = qualifiedName;
  5154. }
  5155. attrs._ownerElement = node;
  5156. return node;
  5157. },
  5158. // Introduced in DOM Level 2:
  5159. createAttributeNS : function(namespaceURI,qualifiedName){
  5160. var node = new Attr();
  5161. var pl = qualifiedName.split(':');
  5162. node.ownerDocument = this;
  5163. node.nodeName = qualifiedName;
  5164. node.name = qualifiedName;
  5165. node.namespaceURI = namespaceURI;
  5166. node.specified = true;
  5167. if(pl.length == 2){
  5168. node.prefix = pl[0];
  5169. node.localName = pl[1];
  5170. }else{
  5171. //el.prefix = null;
  5172. node.localName = qualifiedName;
  5173. }
  5174. return node;
  5175. }
  5176. };
  5177. _extends(Document,Node);
  5178. function Element() {
  5179. this._nsMap = {};
  5180. };
  5181. Element.prototype = {
  5182. nodeType : ELEMENT_NODE,
  5183. hasAttribute : function(name){
  5184. return this.getAttributeNode(name)!=null;
  5185. },
  5186. getAttribute : function(name){
  5187. var attr = this.getAttributeNode(name);
  5188. return attr && attr.value || '';
  5189. },
  5190. getAttributeNode : function(name){
  5191. return this.attributes.getNamedItem(name);
  5192. },
  5193. setAttribute : function(name, value){
  5194. var attr = this.ownerDocument.createAttribute(name);
  5195. attr.value = attr.nodeValue = "" + value;
  5196. this.setAttributeNode(attr)
  5197. },
  5198. removeAttribute : function(name){
  5199. var attr = this.getAttributeNode(name)
  5200. attr && this.removeAttributeNode(attr);
  5201. },
  5202. //four real opeartion method
  5203. appendChild:function(newChild){
  5204. if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){
  5205. return this.insertBefore(newChild,null);
  5206. }else{
  5207. return _appendSingleChild(this,newChild);
  5208. }
  5209. },
  5210. setAttributeNode : function(newAttr){
  5211. return this.attributes.setNamedItem(newAttr);
  5212. },
  5213. setAttributeNodeNS : function(newAttr){
  5214. return this.attributes.setNamedItemNS(newAttr);
  5215. },
  5216. removeAttributeNode : function(oldAttr){
  5217. //console.log(this == oldAttr.ownerElement)
  5218. return this.attributes.removeNamedItem(oldAttr.nodeName);
  5219. },
  5220. //get real attribute name,and remove it by removeAttributeNode
  5221. removeAttributeNS : function(namespaceURI, localName){
  5222. var old = this.getAttributeNodeNS(namespaceURI, localName);
  5223. old && this.removeAttributeNode(old);
  5224. },
  5225. hasAttributeNS : function(namespaceURI, localName){
  5226. return this.getAttributeNodeNS(namespaceURI, localName)!=null;
  5227. },
  5228. getAttributeNS : function(namespaceURI, localName){
  5229. var attr = this.getAttributeNodeNS(namespaceURI, localName);
  5230. return attr && attr.value || '';
  5231. },
  5232. setAttributeNS : function(namespaceURI, qualifiedName, value){
  5233. var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
  5234. attr.value = attr.nodeValue = "" + value;
  5235. this.setAttributeNode(attr)
  5236. },
  5237. getAttributeNodeNS : function(namespaceURI, localName){
  5238. return this.attributes.getNamedItemNS(namespaceURI, localName);
  5239. },
  5240. getElementsByTagName : function(tagName){
  5241. return new LiveNodeList(this,function(base){
  5242. var ls = [];
  5243. _visitNode(base,function(node){
  5244. if(node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)){
  5245. ls.push(node);
  5246. }
  5247. });
  5248. return ls;
  5249. });
  5250. },
  5251. getElementsByTagNameNS : function(namespaceURI, localName){
  5252. return new LiveNodeList(this,function(base){
  5253. var ls = [];
  5254. _visitNode(base,function(node){
  5255. if(node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)){
  5256. ls.push(node);
  5257. }
  5258. });
  5259. return ls;
  5260. });
  5261. }
  5262. };
  5263. Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;
  5264. Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;
  5265. _extends(Element,Node);
  5266. function Attr() {
  5267. };
  5268. Attr.prototype.nodeType = ATTRIBUTE_NODE;
  5269. _extends(Attr,Node);
  5270. function CharacterData() {
  5271. };
  5272. CharacterData.prototype = {
  5273. data : '',
  5274. substringData : function(offset, count) {
  5275. return this.data.substring(offset, offset+count);
  5276. },
  5277. appendData: function(text) {
  5278. text = this.data+text;
  5279. this.nodeValue = this.data = text;
  5280. this.length = text.length;
  5281. },
  5282. insertData: function(offset,text) {
  5283. this.replaceData(offset,0,text);
  5284. },
  5285. appendChild:function(newChild){
  5286. throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR])
  5287. },
  5288. deleteData: function(offset, count) {
  5289. this.replaceData(offset,count,"");
  5290. },
  5291. replaceData: function(offset, count, text) {
  5292. var start = this.data.substring(0,offset);
  5293. var end = this.data.substring(offset+count);
  5294. text = start + text + end;
  5295. this.nodeValue = this.data = text;
  5296. this.length = text.length;
  5297. }
  5298. }
  5299. _extends(CharacterData,Node);
  5300. function Text() {
  5301. };
  5302. Text.prototype = {
  5303. nodeName : "#text",
  5304. nodeType : TEXT_NODE,
  5305. splitText : function(offset) {
  5306. var text = this.data;
  5307. var newText = text.substring(offset);
  5308. text = text.substring(0, offset);
  5309. this.data = this.nodeValue = text;
  5310. this.length = text.length;
  5311. var newNode = this.ownerDocument.createTextNode(newText);
  5312. if(this.parentNode){
  5313. this.parentNode.insertBefore(newNode, this.nextSibling);
  5314. }
  5315. return newNode;
  5316. }
  5317. }
  5318. _extends(Text,CharacterData);
  5319. function Comment() {
  5320. };
  5321. Comment.prototype = {
  5322. nodeName : "#comment",
  5323. nodeType : COMMENT_NODE
  5324. }
  5325. _extends(Comment,CharacterData);
  5326. function CDATASection() {
  5327. };
  5328. CDATASection.prototype = {
  5329. nodeName : "#cdata-section",
  5330. nodeType : CDATA_SECTION_NODE
  5331. }
  5332. _extends(CDATASection,CharacterData);
  5333. function DocumentType() {
  5334. };
  5335. DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
  5336. _extends(DocumentType,Node);
  5337. function Notation() {
  5338. };
  5339. Notation.prototype.nodeType = NOTATION_NODE;
  5340. _extends(Notation,Node);
  5341. function Entity() {
  5342. };
  5343. Entity.prototype.nodeType = ENTITY_NODE;
  5344. _extends(Entity,Node);
  5345. function EntityReference() {
  5346. };
  5347. EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
  5348. _extends(EntityReference,Node);
  5349. function DocumentFragment() {
  5350. };
  5351. DocumentFragment.prototype.nodeName = "#document-fragment";
  5352. DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
  5353. _extends(DocumentFragment,Node);
  5354. function ProcessingInstruction() {
  5355. }
  5356. ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
  5357. _extends(ProcessingInstruction,Node);
  5358. function XMLSerializer(){}
  5359. XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){
  5360. return nodeSerializeToString.call(node,isHtml,nodeFilter);
  5361. }
  5362. Node.prototype.toString = nodeSerializeToString;
  5363. function nodeSerializeToString(isHtml,nodeFilter){
  5364. var buf = [];
  5365. var refNode = this.nodeType == 9 && this.documentElement || this;
  5366. var prefix = refNode.prefix;
  5367. var uri = refNode.namespaceURI;
  5368. if(uri && prefix == null){
  5369. //console.log(prefix)
  5370. var prefix = refNode.lookupPrefix(uri);
  5371. if(prefix == null){
  5372. //isHTML = true;
  5373. var visibleNamespaces=[
  5374. {namespace:uri,prefix:null}
  5375. //{namespace:uri,prefix:''}
  5376. ]
  5377. }
  5378. }
  5379. serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);
  5380. //console.log('###',this.nodeType,uri,prefix,buf.join(''))
  5381. return buf.join('');
  5382. }
  5383. function needNamespaceDefine(node, isHTML, visibleNamespaces) {
  5384. var prefix = node.prefix || '';
  5385. var uri = node.namespaceURI;
  5386. // According to [Namespaces in XML 1.0](https://www.w3.org/TR/REC-xml-names/#ns-using) ,
  5387. // and more specifically https://www.w3.org/TR/REC-xml-names/#nsc-NoPrefixUndecl :
  5388. // > In a namespace declaration for a prefix [...], the attribute value MUST NOT be empty.
  5389. // in a similar manner [Namespaces in XML 1.1](https://www.w3.org/TR/xml-names11/#ns-using)
  5390. // and more specifically https://www.w3.org/TR/xml-names11/#nsc-NSDeclared :
  5391. // > [...] Furthermore, the attribute value [...] must not be an empty string.
  5392. // so serializing empty namespace value like xmlns:ds="" would produce an invalid XML document.
  5393. if (!uri) {
  5394. return false;
  5395. }
  5396. if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {
  5397. return false;
  5398. }
  5399. var i = visibleNamespaces.length
  5400. while (i--) {
  5401. var ns = visibleNamespaces[i];
  5402. // get namespace prefix
  5403. if (ns.prefix === prefix) {
  5404. return ns.namespace !== uri;
  5405. }
  5406. }
  5407. return true;
  5408. }
  5409. /**
  5410. * Well-formed constraint: No < in Attribute Values
  5411. * > The replacement text of any entity referred to directly or indirectly
  5412. * > in an attribute value must not contain a <.
  5413. * @see https://www.w3.org/TR/xml11/#CleanAttrVals
  5414. * @see https://www.w3.org/TR/xml11/#NT-AttValue
  5415. *
  5416. * Literal whitespace other than space that appear in attribute values
  5417. * are serialized as their entity references, so they will be preserved.
  5418. * (In contrast to whitespace literals in the input which are normalized to spaces)
  5419. * @see https://www.w3.org/TR/xml11/#AVNormalize
  5420. * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
  5421. */
  5422. function addSerializedAttribute(buf, qualifiedName, value) {
  5423. buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"')
  5424. }
  5425. function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
  5426. if (!visibleNamespaces) {
  5427. visibleNamespaces = [];
  5428. }
  5429. if(nodeFilter){
  5430. node = nodeFilter(node);
  5431. if(node){
  5432. if(typeof node == 'string'){
  5433. buf.push(node);
  5434. return;
  5435. }
  5436. }else{
  5437. return;
  5438. }
  5439. //buf.sort.apply(attrs, attributeSorter);
  5440. }
  5441. switch(node.nodeType){
  5442. case ELEMENT_NODE:
  5443. var attrs = node.attributes;
  5444. var len = attrs.length;
  5445. var child = node.firstChild;
  5446. var nodeName = node.tagName;
  5447. isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML
  5448. var prefixedNodeName = nodeName
  5449. if (!isHTML && !node.prefix && node.namespaceURI) {
  5450. var defaultNS
  5451. // lookup current default ns from `xmlns` attribute
  5452. for (var ai = 0; ai < attrs.length; ai++) {
  5453. if (attrs.item(ai).name === 'xmlns') {
  5454. defaultNS = attrs.item(ai).value
  5455. break
  5456. }
  5457. }
  5458. if (!defaultNS) {
  5459. // lookup current default ns in visibleNamespaces
  5460. for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
  5461. var namespace = visibleNamespaces[nsi]
  5462. if (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {
  5463. defaultNS = namespace.namespace
  5464. break
  5465. }
  5466. }
  5467. }
  5468. if (defaultNS !== node.namespaceURI) {
  5469. for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
  5470. var namespace = visibleNamespaces[nsi]
  5471. if (namespace.namespace === node.namespaceURI) {
  5472. if (namespace.prefix) {
  5473. prefixedNodeName = namespace.prefix + ':' + nodeName
  5474. }
  5475. break
  5476. }
  5477. }
  5478. }
  5479. }
  5480. buf.push('<', prefixedNodeName);
  5481. for(var i=0;i<len;i++){
  5482. // add namespaces for attributes
  5483. var attr = attrs.item(i);
  5484. if (attr.prefix == 'xmlns') {
  5485. visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
  5486. }else if(attr.nodeName == 'xmlns'){
  5487. visibleNamespaces.push({ prefix: '', namespace: attr.value });
  5488. }
  5489. }
  5490. for(var i=0;i<len;i++){
  5491. var attr = attrs.item(i);
  5492. if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) {
  5493. var prefix = attr.prefix||'';
  5494. var uri = attr.namespaceURI;
  5495. addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
  5496. visibleNamespaces.push({ prefix: prefix, namespace:uri });
  5497. }
  5498. serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
  5499. }
  5500. // add namespace for current node
  5501. if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
  5502. var prefix = node.prefix||'';
  5503. var uri = node.namespaceURI;
  5504. addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
  5505. visibleNamespaces.push({ prefix: prefix, namespace:uri });
  5506. }
  5507. if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){
  5508. buf.push('>');
  5509. //if is cdata child node
  5510. if(isHTML && /^script$/i.test(nodeName)){
  5511. while(child){
  5512. if(child.data){
  5513. buf.push(child.data);
  5514. }else{
  5515. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  5516. }
  5517. child = child.nextSibling;
  5518. }
  5519. }else
  5520. {
  5521. while(child){
  5522. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  5523. child = child.nextSibling;
  5524. }
  5525. }
  5526. buf.push('</',prefixedNodeName,'>');
  5527. }else{
  5528. buf.push('/>');
  5529. }
  5530. // remove added visible namespaces
  5531. //visibleNamespaces.length = startVisibleNamespaces;
  5532. return;
  5533. case DOCUMENT_NODE:
  5534. case DOCUMENT_FRAGMENT_NODE:
  5535. var child = node.firstChild;
  5536. while(child){
  5537. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  5538. child = child.nextSibling;
  5539. }
  5540. return;
  5541. case ATTRIBUTE_NODE:
  5542. return addSerializedAttribute(buf, node.name, node.value);
  5543. case TEXT_NODE:
  5544. /**
  5545. * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
  5546. * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
  5547. * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
  5548. * `&amp;` and `&lt;` respectively.
  5549. * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
  5550. * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
  5551. * when that string is not marking the end of a CDATA section.
  5552. *
  5553. * In the content of elements, character data is any string of characters
  5554. * which does not contain the start-delimiter of any markup
  5555. * and does not include the CDATA-section-close delimiter, `]]>`.
  5556. *
  5557. * @see https://www.w3.org/TR/xml/#NT-CharData
  5558. * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
  5559. */
  5560. return buf.push(node.data
  5561. .replace(/[<&>]/g,_xmlEncoder)
  5562. );
  5563. case CDATA_SECTION_NODE:
  5564. return buf.push( '<![CDATA[',node.data,']]>');
  5565. case COMMENT_NODE:
  5566. return buf.push( "<!--",node.data,"-->");
  5567. case DOCUMENT_TYPE_NODE:
  5568. var pubid = node.publicId;
  5569. var sysid = node.systemId;
  5570. buf.push('<!DOCTYPE ',node.name);
  5571. if(pubid){
  5572. buf.push(' PUBLIC ', pubid);
  5573. if (sysid && sysid!='.') {
  5574. buf.push(' ', sysid);
  5575. }
  5576. buf.push('>');
  5577. }else if(sysid && sysid!='.'){
  5578. buf.push(' SYSTEM ', sysid, '>');
  5579. }else{
  5580. var sub = node.internalSubset;
  5581. if(sub){
  5582. buf.push(" [",sub,"]");
  5583. }
  5584. buf.push(">");
  5585. }
  5586. return;
  5587. case PROCESSING_INSTRUCTION_NODE:
  5588. return buf.push( "<?",node.target," ",node.data,"?>");
  5589. case ENTITY_REFERENCE_NODE:
  5590. return buf.push( '&',node.nodeName,';');
  5591. //case ENTITY_NODE:
  5592. //case NOTATION_NODE:
  5593. default:
  5594. buf.push('??',node.nodeName);
  5595. }
  5596. }
  5597. function importNode(doc,node,deep){
  5598. var node2;
  5599. switch (node.nodeType) {
  5600. case ELEMENT_NODE:
  5601. node2 = node.cloneNode(false);
  5602. node2.ownerDocument = doc;
  5603. //var attrs = node2.attributes;
  5604. //var len = attrs.length;
  5605. //for(var i=0;i<len;i++){
  5606. //node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep));
  5607. //}
  5608. case DOCUMENT_FRAGMENT_NODE:
  5609. break;
  5610. case ATTRIBUTE_NODE:
  5611. deep = true;
  5612. break;
  5613. //case ENTITY_REFERENCE_NODE:
  5614. //case PROCESSING_INSTRUCTION_NODE:
  5615. ////case TEXT_NODE:
  5616. //case CDATA_SECTION_NODE:
  5617. //case COMMENT_NODE:
  5618. // deep = false;
  5619. // break;
  5620. //case DOCUMENT_NODE:
  5621. //case DOCUMENT_TYPE_NODE:
  5622. //cannot be imported.
  5623. //case ENTITY_NODE:
  5624. //case NOTATION_NODE:
  5625. //can not hit in level3
  5626. //default:throw e;
  5627. }
  5628. if(!node2){
  5629. node2 = node.cloneNode(false);//false
  5630. }
  5631. node2.ownerDocument = doc;
  5632. node2.parentNode = null;
  5633. if(deep){
  5634. var child = node.firstChild;
  5635. while(child){
  5636. node2.appendChild(importNode(doc,child,deep));
  5637. child = child.nextSibling;
  5638. }
  5639. }
  5640. return node2;
  5641. }
  5642. //
  5643. //var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1,
  5644. // attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
  5645. function cloneNode(doc,node,deep){
  5646. var node2 = new node.constructor();
  5647. for (var n in node) {
  5648. if (Object.prototype.hasOwnProperty.call(node, n)) {
  5649. var v = node[n];
  5650. if (typeof v != "object") {
  5651. if (v != node2[n]) {
  5652. node2[n] = v;
  5653. }
  5654. }
  5655. }
  5656. }
  5657. if(node.childNodes){
  5658. node2.childNodes = new NodeList();
  5659. }
  5660. node2.ownerDocument = doc;
  5661. switch (node2.nodeType) {
  5662. case ELEMENT_NODE:
  5663. var attrs = node.attributes;
  5664. var attrs2 = node2.attributes = new NamedNodeMap();
  5665. var len = attrs.length
  5666. attrs2._ownerElement = node2;
  5667. for(var i=0;i<len;i++){
  5668. node2.setAttributeNode(cloneNode(doc,attrs.item(i),true));
  5669. }
  5670. break;;
  5671. case ATTRIBUTE_NODE:
  5672. deep = true;
  5673. }
  5674. if(deep){
  5675. var child = node.firstChild;
  5676. while(child){
  5677. node2.appendChild(cloneNode(doc,child,deep));
  5678. child = child.nextSibling;
  5679. }
  5680. }
  5681. return node2;
  5682. }
  5683. function __set__(object,key,value){
  5684. object[key] = value
  5685. }
  5686. //do dynamic
  5687. try{
  5688. if(Object.defineProperty){
  5689. Object.defineProperty(LiveNodeList.prototype,'length',{
  5690. get:function(){
  5691. _updateLiveList(this);
  5692. return this.$$length;
  5693. }
  5694. });
  5695. Object.defineProperty(Node.prototype,'textContent',{
  5696. get:function(){
  5697. return getTextContent(this);
  5698. },
  5699. set:function(data){
  5700. switch(this.nodeType){
  5701. case ELEMENT_NODE:
  5702. case DOCUMENT_FRAGMENT_NODE:
  5703. while(this.firstChild){
  5704. this.removeChild(this.firstChild);
  5705. }
  5706. if(data || String(data)){
  5707. this.appendChild(this.ownerDocument.createTextNode(data));
  5708. }
  5709. break;
  5710. default:
  5711. this.data = data;
  5712. this.value = data;
  5713. this.nodeValue = data;
  5714. }
  5715. }
  5716. })
  5717. function getTextContent(node){
  5718. switch(node.nodeType){
  5719. case ELEMENT_NODE:
  5720. case DOCUMENT_FRAGMENT_NODE:
  5721. var buf = [];
  5722. node = node.firstChild;
  5723. while(node){
  5724. if(node.nodeType!==7 && node.nodeType !==8){
  5725. buf.push(getTextContent(node));
  5726. }
  5727. node = node.nextSibling;
  5728. }
  5729. return buf.join('');
  5730. default:
  5731. return node.nodeValue;
  5732. }
  5733. }
  5734. __set__ = function(object,key,value){
  5735. //console.log(value)
  5736. object['$$'+key] = value
  5737. }
  5738. }
  5739. }catch(e){//ie8
  5740. }
  5741. //if(typeof require == 'function'){
  5742. exports.DocumentType = DocumentType;
  5743. exports.DOMException = DOMException;
  5744. exports.DOMImplementation = DOMImplementation;
  5745. exports.Element = Element;
  5746. exports.Node = Node;
  5747. exports.NodeList = NodeList;
  5748. exports.XMLSerializer = XMLSerializer;
  5749. //}
  5750. },{"./conventions":41}],44:[function(require,module,exports){
  5751. var freeze = require('./conventions').freeze;
  5752. /**
  5753. * The entities that are predefined in every XML document.
  5754. *
  5755. * @see https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-predefined-ent W3C XML 1.1
  5756. * @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0
  5757. * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia
  5758. */
  5759. exports.XML_ENTITIES = freeze({amp:'&', apos:"'", gt:'>', lt:'<', quot:'"'})
  5760. /**
  5761. * A map of currently 241 entities that are detected in an HTML document.
  5762. * They contain all entries from `XML_ENTITIES`.
  5763. *
  5764. * @see XML_ENTITIES
  5765. * @see DOMParser.parseFromString
  5766. * @see DOMImplementation.prototype.createHTMLDocument
  5767. * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec
  5768. * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names
  5769. * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML
  5770. * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)
  5771. * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)
  5772. */
  5773. exports.HTML_ENTITIES = freeze({
  5774. lt: '<',
  5775. gt: '>',
  5776. amp: '&',
  5777. quot: '"',
  5778. apos: "'",
  5779. Agrave: "À",
  5780. Aacute: "Á",
  5781. Acirc: "Â",
  5782. Atilde: "Ã",
  5783. Auml: "Ä",
  5784. Aring: "Å",
  5785. AElig: "Æ",
  5786. Ccedil: "Ç",
  5787. Egrave: "È",
  5788. Eacute: "É",
  5789. Ecirc: "Ê",
  5790. Euml: "Ë",
  5791. Igrave: "Ì",
  5792. Iacute: "Í",
  5793. Icirc: "Î",
  5794. Iuml: "Ï",
  5795. ETH: "Ð",
  5796. Ntilde: "Ñ",
  5797. Ograve: "Ò",
  5798. Oacute: "Ó",
  5799. Ocirc: "Ô",
  5800. Otilde: "Õ",
  5801. Ouml: "Ö",
  5802. Oslash: "Ø",
  5803. Ugrave: "Ù",
  5804. Uacute: "Ú",
  5805. Ucirc: "Û",
  5806. Uuml: "Ü",
  5807. Yacute: "Ý",
  5808. THORN: "Þ",
  5809. szlig: "ß",
  5810. agrave: "à",
  5811. aacute: "á",
  5812. acirc: "â",
  5813. atilde: "ã",
  5814. auml: "ä",
  5815. aring: "å",
  5816. aelig: "æ",
  5817. ccedil: "ç",
  5818. egrave: "è",
  5819. eacute: "é",
  5820. ecirc: "ê",
  5821. euml: "ë",
  5822. igrave: "ì",
  5823. iacute: "í",
  5824. icirc: "î",
  5825. iuml: "ï",
  5826. eth: "ð",
  5827. ntilde: "ñ",
  5828. ograve: "ò",
  5829. oacute: "ó",
  5830. ocirc: "ô",
  5831. otilde: "õ",
  5832. ouml: "ö",
  5833. oslash: "ø",
  5834. ugrave: "ù",
  5835. uacute: "ú",
  5836. ucirc: "û",
  5837. uuml: "ü",
  5838. yacute: "ý",
  5839. thorn: "þ",
  5840. yuml: "ÿ",
  5841. nbsp: "\u00a0",
  5842. iexcl: "¡",
  5843. cent: "¢",
  5844. pound: "£",
  5845. curren: "¤",
  5846. yen: "¥",
  5847. brvbar: "¦",
  5848. sect: "§",
  5849. uml: "¨",
  5850. copy: "©",
  5851. ordf: "ª",
  5852. laquo: "«",
  5853. not: "¬",
  5854. shy: "­­",
  5855. reg: "®",
  5856. macr: "¯",
  5857. deg: "°",
  5858. plusmn: "±",
  5859. sup2: "²",
  5860. sup3: "³",
  5861. acute: "´",
  5862. micro: "µ",
  5863. para: "¶",
  5864. middot: "·",
  5865. cedil: "¸",
  5866. sup1: "¹",
  5867. ordm: "º",
  5868. raquo: "»",
  5869. frac14: "¼",
  5870. frac12: "½",
  5871. frac34: "¾",
  5872. iquest: "¿",
  5873. times: "×",
  5874. divide: "÷",
  5875. forall: "∀",
  5876. part: "∂",
  5877. exist: "∃",
  5878. empty: "∅",
  5879. nabla: "∇",
  5880. isin: "∈",
  5881. notin: "∉",
  5882. ni: "∋",
  5883. prod: "∏",
  5884. sum: "∑",
  5885. minus: "−",
  5886. lowast: "∗",
  5887. radic: "√",
  5888. prop: "∝",
  5889. infin: "∞",
  5890. ang: "∠",
  5891. and: "∧",
  5892. or: "∨",
  5893. cap: "∩",
  5894. cup: "∪",
  5895. 'int': "∫",
  5896. there4: "∴",
  5897. sim: "∼",
  5898. cong: "≅",
  5899. asymp: "≈",
  5900. ne: "≠",
  5901. equiv: "≡",
  5902. le: "≤",
  5903. ge: "≥",
  5904. sub: "⊂",
  5905. sup: "⊃",
  5906. nsub: "⊄",
  5907. sube: "⊆",
  5908. supe: "⊇",
  5909. oplus: "⊕",
  5910. otimes: "⊗",
  5911. perp: "⊥",
  5912. sdot: "⋅",
  5913. Alpha: "Α",
  5914. Beta: "Β",
  5915. Gamma: "Γ",
  5916. Delta: "Δ",
  5917. Epsilon: "Ε",
  5918. Zeta: "Ζ",
  5919. Eta: "Η",
  5920. Theta: "Θ",
  5921. Iota: "Ι",
  5922. Kappa: "Κ",
  5923. Lambda: "Λ",
  5924. Mu: "Μ",
  5925. Nu: "Ν",
  5926. Xi: "Ξ",
  5927. Omicron: "Ο",
  5928. Pi: "Π",
  5929. Rho: "Ρ",
  5930. Sigma: "Σ",
  5931. Tau: "Τ",
  5932. Upsilon: "Υ",
  5933. Phi: "Φ",
  5934. Chi: "Χ",
  5935. Psi: "Ψ",
  5936. Omega: "Ω",
  5937. alpha: "α",
  5938. beta: "β",
  5939. gamma: "γ",
  5940. delta: "δ",
  5941. epsilon: "ε",
  5942. zeta: "ζ",
  5943. eta: "η",
  5944. theta: "θ",
  5945. iota: "ι",
  5946. kappa: "κ",
  5947. lambda: "λ",
  5948. mu: "μ",
  5949. nu: "ν",
  5950. xi: "ξ",
  5951. omicron: "ο",
  5952. pi: "π",
  5953. rho: "ρ",
  5954. sigmaf: "ς",
  5955. sigma: "σ",
  5956. tau: "τ",
  5957. upsilon: "υ",
  5958. phi: "φ",
  5959. chi: "χ",
  5960. psi: "ψ",
  5961. omega: "ω",
  5962. thetasym: "ϑ",
  5963. upsih: "ϒ",
  5964. piv: "ϖ",
  5965. OElig: "Œ",
  5966. oelig: "œ",
  5967. Scaron: "Š",
  5968. scaron: "š",
  5969. Yuml: "Ÿ",
  5970. fnof: "ƒ",
  5971. circ: "ˆ",
  5972. tilde: "˜",
  5973. ensp: " ",
  5974. emsp: " ",
  5975. thinsp: " ",
  5976. zwnj: "‌",
  5977. zwj: "‍",
  5978. lrm: "‎",
  5979. rlm: "‏",
  5980. ndash: "–",
  5981. mdash: "—",
  5982. lsquo: "‘",
  5983. rsquo: "’",
  5984. sbquo: "‚",
  5985. ldquo: "“",
  5986. rdquo: "”",
  5987. bdquo: "„",
  5988. dagger: "†",
  5989. Dagger: "‡",
  5990. bull: "•",
  5991. hellip: "…",
  5992. permil: "‰",
  5993. prime: "′",
  5994. Prime: "″",
  5995. lsaquo: "‹",
  5996. rsaquo: "›",
  5997. oline: "‾",
  5998. euro: "€",
  5999. trade: "™",
  6000. larr: "←",
  6001. uarr: "↑",
  6002. rarr: "→",
  6003. darr: "↓",
  6004. harr: "↔",
  6005. crarr: "↵",
  6006. lceil: "⌈",
  6007. rceil: "⌉",
  6008. lfloor: "⌊",
  6009. rfloor: "⌋",
  6010. loz: "◊",
  6011. spades: "♠",
  6012. clubs: "♣",
  6013. hearts: "♥",
  6014. diams: "♦"
  6015. });
  6016. /**
  6017. * @deprecated use `HTML_ENTITIES` instead
  6018. * @see HTML_ENTITIES
  6019. */
  6020. exports.entityMap = exports.HTML_ENTITIES
  6021. },{"./conventions":41}],45:[function(require,module,exports){
  6022. var dom = require('./dom')
  6023. exports.DOMImplementation = dom.DOMImplementation
  6024. exports.XMLSerializer = dom.XMLSerializer
  6025. exports.DOMParser = require('./dom-parser').DOMParser
  6026. },{"./dom":43,"./dom-parser":42}],46:[function(require,module,exports){
  6027. var NAMESPACE = require("./conventions").NAMESPACE;
  6028. //[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
  6029. //[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
  6030. //[5] Name ::= NameStartChar (NameChar)*
  6031. var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF
  6032. var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
  6033. var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
  6034. //var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
  6035. //var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')
  6036. //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
  6037. //S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
  6038. var S_TAG = 0;//tag name offerring
  6039. var S_ATTR = 1;//attr name offerring
  6040. var S_ATTR_SPACE=2;//attr name end and space offer
  6041. var S_EQ = 3;//=space?
  6042. var S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only)
  6043. var S_ATTR_END = 5;//attr value end and no space(quot end)
  6044. var S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer)
  6045. var S_TAG_CLOSE = 7;//closed el<el />
  6046. /**
  6047. * Creates an error that will not be caught by XMLReader aka the SAX parser.
  6048. *
  6049. * @param {string} message
  6050. * @param {any?} locator Optional, can provide details about the location in the source
  6051. * @constructor
  6052. */
  6053. function ParseError(message, locator) {
  6054. this.message = message
  6055. this.locator = locator
  6056. if(Error.captureStackTrace) Error.captureStackTrace(this, ParseError);
  6057. }
  6058. ParseError.prototype = new Error();
  6059. ParseError.prototype.name = ParseError.name
  6060. function XMLReader(){
  6061. }
  6062. XMLReader.prototype = {
  6063. parse:function(source,defaultNSMap,entityMap){
  6064. var domBuilder = this.domBuilder;
  6065. domBuilder.startDocument();
  6066. _copy(defaultNSMap ,defaultNSMap = {})
  6067. parse(source,defaultNSMap,entityMap,
  6068. domBuilder,this.errorHandler);
  6069. domBuilder.endDocument();
  6070. }
  6071. }
  6072. function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
  6073. function fixedFromCharCode(code) {
  6074. // String.prototype.fromCharCode does not supports
  6075. // > 2 bytes unicode chars directly
  6076. if (code > 0xffff) {
  6077. code -= 0x10000;
  6078. var surrogate1 = 0xd800 + (code >> 10)
  6079. , surrogate2 = 0xdc00 + (code & 0x3ff);
  6080. return String.fromCharCode(surrogate1, surrogate2);
  6081. } else {
  6082. return String.fromCharCode(code);
  6083. }
  6084. }
  6085. function entityReplacer(a){
  6086. var k = a.slice(1,-1);
  6087. if (Object.hasOwnProperty.call(entityMap, k)) {
  6088. return entityMap[k];
  6089. }else if(k.charAt(0) === '#'){
  6090. return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')))
  6091. }else{
  6092. errorHandler.error('entity not found:'+a);
  6093. return a;
  6094. }
  6095. }
  6096. function appendText(end){//has some bugs
  6097. if(end>start){
  6098. var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer);
  6099. locator&&position(start);
  6100. domBuilder.characters(xt,0,end-start);
  6101. start = end
  6102. }
  6103. }
  6104. function position(p,m){
  6105. while(p>=lineEnd && (m = linePattern.exec(source))){
  6106. lineStart = m.index;
  6107. lineEnd = lineStart + m[0].length;
  6108. locator.lineNumber++;
  6109. //console.log('line++:',locator,startPos,endPos)
  6110. }
  6111. locator.columnNumber = p-lineStart+1;
  6112. }
  6113. var lineStart = 0;
  6114. var lineEnd = 0;
  6115. var linePattern = /.*(?:\r\n?|\n)|.*$/g
  6116. var locator = domBuilder.locator;
  6117. var parseStack = [{currentNSMap:defaultNSMapCopy}]
  6118. var closeMap = {};
  6119. var start = 0;
  6120. while(true){
  6121. try{
  6122. var tagStart = source.indexOf('<',start);
  6123. if(tagStart<0){
  6124. if(!source.substr(start).match(/^\s*$/)){
  6125. var doc = domBuilder.doc;
  6126. var text = doc.createTextNode(source.substr(start));
  6127. doc.appendChild(text);
  6128. domBuilder.currentElement = text;
  6129. }
  6130. return;
  6131. }
  6132. if(tagStart>start){
  6133. appendText(tagStart);
  6134. }
  6135. switch(source.charAt(tagStart+1)){
  6136. case '/':
  6137. var end = source.indexOf('>',tagStart+3);
  6138. var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, '');
  6139. var config = parseStack.pop();
  6140. if(end<0){
  6141. tagName = source.substring(tagStart+2).replace(/[\s<].*/,'');
  6142. errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName);
  6143. end = tagStart+1+tagName.length;
  6144. }else if(tagName.match(/\s</)){
  6145. tagName = tagName.replace(/[\s<].*/,'');
  6146. errorHandler.error("end tag name: "+tagName+' maybe not complete');
  6147. end = tagStart+1+tagName.length;
  6148. }
  6149. var localNSMap = config.localNSMap;
  6150. var endMatch = config.tagName == tagName;
  6151. var endIgnoreCaseMach = endMatch || config.tagName&&config.tagName.toLowerCase() == tagName.toLowerCase()
  6152. if(endIgnoreCaseMach){
  6153. domBuilder.endElement(config.uri,config.localName,tagName);
  6154. if(localNSMap){
  6155. for (var prefix in localNSMap) {
  6156. if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
  6157. domBuilder.endPrefixMapping(prefix);
  6158. }
  6159. }
  6160. }
  6161. if(!endMatch){
  6162. errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName ); // No known test case
  6163. }
  6164. }else{
  6165. parseStack.push(config)
  6166. }
  6167. end++;
  6168. break;
  6169. // end elment
  6170. case '?':// <?...?>
  6171. locator&&position(tagStart);
  6172. end = parseInstruction(source,tagStart,domBuilder);
  6173. break;
  6174. case '!':// <!doctype,<![CDATA,<!--
  6175. locator&&position(tagStart);
  6176. end = parseDCC(source,tagStart,domBuilder,errorHandler);
  6177. break;
  6178. default:
  6179. locator&&position(tagStart);
  6180. var el = new ElementAttributes();
  6181. var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
  6182. //elStartEnd
  6183. var end = parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler);
  6184. var len = el.length;
  6185. if(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){
  6186. el.closed = true;
  6187. if(!entityMap.nbsp){
  6188. errorHandler.warning('unclosed xml attribute');
  6189. }
  6190. }
  6191. if(locator && len){
  6192. var locator2 = copyLocator(locator,{});
  6193. //try{//attribute position fixed
  6194. for(var i = 0;i<len;i++){
  6195. var a = el[i];
  6196. position(a.offset);
  6197. a.locator = copyLocator(locator,{});
  6198. }
  6199. domBuilder.locator = locator2
  6200. if(appendElement(el,domBuilder,currentNSMap)){
  6201. parseStack.push(el)
  6202. }
  6203. domBuilder.locator = locator;
  6204. }else{
  6205. if(appendElement(el,domBuilder,currentNSMap)){
  6206. parseStack.push(el)
  6207. }
  6208. }
  6209. if (NAMESPACE.isHTML(el.uri) && !el.closed) {
  6210. end = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder)
  6211. } else {
  6212. end++;
  6213. }
  6214. }
  6215. }catch(e){
  6216. if (e instanceof ParseError) {
  6217. throw e;
  6218. }
  6219. errorHandler.error('element parse error: '+e)
  6220. end = -1;
  6221. }
  6222. if(end>start){
  6223. start = end;
  6224. }else{
  6225. //TODO: 这里有可能sax回退,有位置错误风险
  6226. appendText(Math.max(tagStart,start)+1);
  6227. }
  6228. }
  6229. }
  6230. function copyLocator(f,t){
  6231. t.lineNumber = f.lineNumber;
  6232. t.columnNumber = f.columnNumber;
  6233. return t;
  6234. }
  6235. /**
  6236. * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);
  6237. * @return end of the elementStartPart(end of elementEndPart for selfClosed el)
  6238. */
  6239. function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){
  6240. /**
  6241. * @param {string} qname
  6242. * @param {string} value
  6243. * @param {number} startIndex
  6244. */
  6245. function addAttribute(qname, value, startIndex) {
  6246. if (el.attributeNames.hasOwnProperty(qname)) {
  6247. errorHandler.fatalError('Attribute ' + qname + ' redefined')
  6248. }
  6249. el.addValue(
  6250. qname,
  6251. // @see https://www.w3.org/TR/xml/#AVNormalize
  6252. // since the xmldom sax parser does not "interpret" DTD the following is not implemented:
  6253. // - recursive replacement of (DTD) entity references
  6254. // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA
  6255. value.replace(/[\t\n\r]/g, ' ').replace(/&#?\w+;/g, entityReplacer),
  6256. startIndex
  6257. )
  6258. }
  6259. var attrName;
  6260. var value;
  6261. var p = ++start;
  6262. var s = S_TAG;//status
  6263. while(true){
  6264. var c = source.charAt(p);
  6265. switch(c){
  6266. case '=':
  6267. if(s === S_ATTR){//attrName
  6268. attrName = source.slice(start,p);
  6269. s = S_EQ;
  6270. }else if(s === S_ATTR_SPACE){
  6271. s = S_EQ;
  6272. }else{
  6273. //fatalError: equal must after attrName or space after attrName
  6274. throw new Error('attribute equal must after attrName'); // No known test case
  6275. }
  6276. break;
  6277. case '\'':
  6278. case '"':
  6279. if(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE
  6280. ){//equal
  6281. if(s === S_ATTR){
  6282. errorHandler.warning('attribute value must after "="')
  6283. attrName = source.slice(start,p)
  6284. }
  6285. start = p+1;
  6286. p = source.indexOf(c,start)
  6287. if(p>0){
  6288. value = source.slice(start, p);
  6289. addAttribute(attrName, value, start-1);
  6290. s = S_ATTR_END;
  6291. }else{
  6292. //fatalError: no end quot match
  6293. throw new Error('attribute value no end \''+c+'\' match');
  6294. }
  6295. }else if(s == S_ATTR_NOQUOT_VALUE){
  6296. value = source.slice(start, p);
  6297. addAttribute(attrName, value, start);
  6298. errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!');
  6299. start = p+1;
  6300. s = S_ATTR_END
  6301. }else{
  6302. //fatalError: no equal before
  6303. throw new Error('attribute value must after "="'); // No known test case
  6304. }
  6305. break;
  6306. case '/':
  6307. switch(s){
  6308. case S_TAG:
  6309. el.setTagName(source.slice(start,p));
  6310. case S_ATTR_END:
  6311. case S_TAG_SPACE:
  6312. case S_TAG_CLOSE:
  6313. s =S_TAG_CLOSE;
  6314. el.closed = true;
  6315. case S_ATTR_NOQUOT_VALUE:
  6316. case S_ATTR:
  6317. case S_ATTR_SPACE:
  6318. break;
  6319. //case S_EQ:
  6320. default:
  6321. throw new Error("attribute invalid close char('/')") // No known test case
  6322. }
  6323. break;
  6324. case ''://end document
  6325. errorHandler.error('unexpected end of input');
  6326. if(s == S_TAG){
  6327. el.setTagName(source.slice(start,p));
  6328. }
  6329. return p;
  6330. case '>':
  6331. switch(s){
  6332. case S_TAG:
  6333. el.setTagName(source.slice(start,p));
  6334. case S_ATTR_END:
  6335. case S_TAG_SPACE:
  6336. case S_TAG_CLOSE:
  6337. break;//normal
  6338. case S_ATTR_NOQUOT_VALUE://Compatible state
  6339. case S_ATTR:
  6340. value = source.slice(start,p);
  6341. if(value.slice(-1) === '/'){
  6342. el.closed = true;
  6343. value = value.slice(0,-1)
  6344. }
  6345. case S_ATTR_SPACE:
  6346. if(s === S_ATTR_SPACE){
  6347. value = attrName;
  6348. }
  6349. if(s == S_ATTR_NOQUOT_VALUE){
  6350. errorHandler.warning('attribute "'+value+'" missed quot(")!');
  6351. addAttribute(attrName, value, start)
  6352. }else{
  6353. if(!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){
  6354. errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!')
  6355. }
  6356. addAttribute(value, value, start)
  6357. }
  6358. break;
  6359. case S_EQ:
  6360. throw new Error('attribute value missed!!');
  6361. }
  6362. // console.log(tagName,tagNamePattern,tagNamePattern.test(tagName))
  6363. return p;
  6364. /*xml space '\x20' | #x9 | #xD | #xA; */
  6365. case '\u0080':
  6366. c = ' ';
  6367. default:
  6368. if(c<= ' '){//space
  6369. switch(s){
  6370. case S_TAG:
  6371. el.setTagName(source.slice(start,p));//tagName
  6372. s = S_TAG_SPACE;
  6373. break;
  6374. case S_ATTR:
  6375. attrName = source.slice(start,p)
  6376. s = S_ATTR_SPACE;
  6377. break;
  6378. case S_ATTR_NOQUOT_VALUE:
  6379. var value = source.slice(start, p);
  6380. errorHandler.warning('attribute "'+value+'" missed quot(")!!');
  6381. addAttribute(attrName, value, start)
  6382. case S_ATTR_END:
  6383. s = S_TAG_SPACE;
  6384. break;
  6385. //case S_TAG_SPACE:
  6386. //case S_EQ:
  6387. //case S_ATTR_SPACE:
  6388. // void();break;
  6389. //case S_TAG_CLOSE:
  6390. //ignore warning
  6391. }
  6392. }else{//not space
  6393. //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
  6394. //S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
  6395. switch(s){
  6396. //case S_TAG:void();break;
  6397. //case S_ATTR:void();break;
  6398. //case S_ATTR_NOQUOT_VALUE:void();break;
  6399. case S_ATTR_SPACE:
  6400. var tagName = el.tagName;
  6401. if (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
  6402. errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!')
  6403. }
  6404. addAttribute(attrName, attrName, start);
  6405. start = p;
  6406. s = S_ATTR;
  6407. break;
  6408. case S_ATTR_END:
  6409. errorHandler.warning('attribute space is required"'+attrName+'"!!')
  6410. case S_TAG_SPACE:
  6411. s = S_ATTR;
  6412. start = p;
  6413. break;
  6414. case S_EQ:
  6415. s = S_ATTR_NOQUOT_VALUE;
  6416. start = p;
  6417. break;
  6418. case S_TAG_CLOSE:
  6419. throw new Error("elements closed character '/' and '>' must be connected to");
  6420. }
  6421. }
  6422. }//end outer switch
  6423. //console.log('p++',p)
  6424. p++;
  6425. }
  6426. }
  6427. /**
  6428. * @return true if has new namespace define
  6429. */
  6430. function appendElement(el,domBuilder,currentNSMap){
  6431. var tagName = el.tagName;
  6432. var localNSMap = null;
  6433. //var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
  6434. var i = el.length;
  6435. while(i--){
  6436. var a = el[i];
  6437. var qName = a.qName;
  6438. var value = a.value;
  6439. var nsp = qName.indexOf(':');
  6440. if(nsp>0){
  6441. var prefix = a.prefix = qName.slice(0,nsp);
  6442. var localName = qName.slice(nsp+1);
  6443. var nsPrefix = prefix === 'xmlns' && localName
  6444. }else{
  6445. localName = qName;
  6446. prefix = null
  6447. nsPrefix = qName === 'xmlns' && ''
  6448. }
  6449. //can not set prefix,because prefix !== ''
  6450. a.localName = localName ;
  6451. //prefix == null for no ns prefix attribute
  6452. if(nsPrefix !== false){//hack!!
  6453. if(localNSMap == null){
  6454. localNSMap = {}
  6455. //console.log(currentNSMap,0)
  6456. _copy(currentNSMap,currentNSMap={})
  6457. //console.log(currentNSMap,1)
  6458. }
  6459. currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
  6460. a.uri = NAMESPACE.XMLNS
  6461. domBuilder.startPrefixMapping(nsPrefix, value)
  6462. }
  6463. }
  6464. var i = el.length;
  6465. while(i--){
  6466. a = el[i];
  6467. var prefix = a.prefix;
  6468. if(prefix){//no prefix attribute has no namespace
  6469. if(prefix === 'xml'){
  6470. a.uri = NAMESPACE.XML;
  6471. }if(prefix !== 'xmlns'){
  6472. a.uri = currentNSMap[prefix || '']
  6473. //{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}
  6474. }
  6475. }
  6476. }
  6477. var nsp = tagName.indexOf(':');
  6478. if(nsp>0){
  6479. prefix = el.prefix = tagName.slice(0,nsp);
  6480. localName = el.localName = tagName.slice(nsp+1);
  6481. }else{
  6482. prefix = null;//important!!
  6483. localName = el.localName = tagName;
  6484. }
  6485. //no prefix element has default namespace
  6486. var ns = el.uri = currentNSMap[prefix || ''];
  6487. domBuilder.startElement(ns,localName,tagName,el);
  6488. //endPrefixMapping and startPrefixMapping have not any help for dom builder
  6489. //localNSMap = null
  6490. if(el.closed){
  6491. domBuilder.endElement(ns,localName,tagName);
  6492. if(localNSMap){
  6493. for (prefix in localNSMap) {
  6494. if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
  6495. domBuilder.endPrefixMapping(prefix);
  6496. }
  6497. }
  6498. }
  6499. }else{
  6500. el.currentNSMap = currentNSMap;
  6501. el.localNSMap = localNSMap;
  6502. //parseStack.push(el);
  6503. return true;
  6504. }
  6505. }
  6506. function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){
  6507. if(/^(?:script|textarea)$/i.test(tagName)){
  6508. var elEndStart = source.indexOf('</'+tagName+'>',elStartEnd);
  6509. var text = source.substring(elStartEnd+1,elEndStart);
  6510. if(/[&<]/.test(text)){
  6511. if(/^script$/i.test(tagName)){
  6512. //if(!/\]\]>/.test(text)){
  6513. //lexHandler.startCDATA();
  6514. domBuilder.characters(text,0,text.length);
  6515. //lexHandler.endCDATA();
  6516. return elEndStart;
  6517. //}
  6518. }//}else{//text area
  6519. text = text.replace(/&#?\w+;/g,entityReplacer);
  6520. domBuilder.characters(text,0,text.length);
  6521. return elEndStart;
  6522. //}
  6523. }
  6524. }
  6525. return elStartEnd+1;
  6526. }
  6527. function fixSelfClosed(source,elStartEnd,tagName,closeMap){
  6528. //if(tagName in closeMap){
  6529. var pos = closeMap[tagName];
  6530. if(pos == null){
  6531. //console.log(tagName)
  6532. pos = source.lastIndexOf('</'+tagName+'>')
  6533. if(pos<elStartEnd){//忘记闭合
  6534. pos = source.lastIndexOf('</'+tagName)
  6535. }
  6536. closeMap[tagName] =pos
  6537. }
  6538. return pos<elStartEnd;
  6539. //}
  6540. }
  6541. function _copy (source, target) {
  6542. for (var n in source) {
  6543. if (Object.prototype.hasOwnProperty.call(source, n)) {
  6544. target[n] = source[n];
  6545. }
  6546. }
  6547. }
  6548. function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
  6549. var next= source.charAt(start+2)
  6550. switch(next){
  6551. case '-':
  6552. if(source.charAt(start + 3) === '-'){
  6553. var end = source.indexOf('-->',start+4);
  6554. //append comment source.substring(4,end)//<!--
  6555. if(end>start){
  6556. domBuilder.comment(source,start+4,end-start-4);
  6557. return end+3;
  6558. }else{
  6559. errorHandler.error("Unclosed comment");
  6560. return -1;
  6561. }
  6562. }else{
  6563. //error
  6564. return -1;
  6565. }
  6566. default:
  6567. if(source.substr(start+3,6) == 'CDATA['){
  6568. var end = source.indexOf(']]>',start+9);
  6569. domBuilder.startCDATA();
  6570. domBuilder.characters(source,start+9,end-start-9);
  6571. domBuilder.endCDATA()
  6572. return end+3;
  6573. }
  6574. //<!DOCTYPE
  6575. //startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
  6576. var matchs = split(source,start);
  6577. var len = matchs.length;
  6578. if(len>1 && /!doctype/i.test(matchs[0][0])){
  6579. var name = matchs[1][0];
  6580. var pubid = false;
  6581. var sysid = false;
  6582. if(len>3){
  6583. if(/^public$/i.test(matchs[2][0])){
  6584. pubid = matchs[3][0];
  6585. sysid = len>4 && matchs[4][0];
  6586. }else if(/^system$/i.test(matchs[2][0])){
  6587. sysid = matchs[3][0];
  6588. }
  6589. }
  6590. var lastMatch = matchs[len-1]
  6591. domBuilder.startDTD(name, pubid, sysid);
  6592. domBuilder.endDTD();
  6593. return lastMatch.index+lastMatch[0].length
  6594. }
  6595. }
  6596. return -1;
  6597. }
  6598. function parseInstruction(source,start,domBuilder){
  6599. var end = source.indexOf('?>',start);
  6600. if(end){
  6601. var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
  6602. if(match){
  6603. var len = match[0].length;
  6604. domBuilder.processingInstruction(match[1], match[2]) ;
  6605. return end+2;
  6606. }else{//error
  6607. return -1;
  6608. }
  6609. }
  6610. return -1;
  6611. }
  6612. function ElementAttributes(){
  6613. this.attributeNames = {}
  6614. }
  6615. ElementAttributes.prototype = {
  6616. setTagName:function(tagName){
  6617. if(!tagNamePattern.test(tagName)){
  6618. throw new Error('invalid tagName:'+tagName)
  6619. }
  6620. this.tagName = tagName
  6621. },
  6622. addValue:function(qName, value, offset) {
  6623. if(!tagNamePattern.test(qName)){
  6624. throw new Error('invalid attribute:'+qName)
  6625. }
  6626. this.attributeNames[qName] = this.length;
  6627. this[this.length++] = {qName:qName,value:value,offset:offset}
  6628. },
  6629. length:0,
  6630. getLocalName:function(i){return this[i].localName},
  6631. getLocator:function(i){return this[i].locator},
  6632. getQName:function(i){return this[i].qName},
  6633. getURI:function(i){return this[i].uri},
  6634. getValue:function(i){return this[i].value}
  6635. // ,getIndex:function(uri, localName)){
  6636. // if(localName){
  6637. //
  6638. // }else{
  6639. // var qName = uri
  6640. // }
  6641. // },
  6642. // getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},
  6643. // getType:function(uri,localName){}
  6644. // getType:function(i){},
  6645. }
  6646. function split(source,start){
  6647. var match;
  6648. var buf = [];
  6649. var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
  6650. reg.lastIndex = start;
  6651. reg.exec(source);//skip <
  6652. while(match = reg.exec(source)){
  6653. buf.push(match);
  6654. if(match[1])return buf;
  6655. }
  6656. }
  6657. exports.XMLReader = XMLReader;
  6658. exports.ParseError = ParseError;
  6659. },{"./conventions":41}],47:[function(require,module,exports){
  6660. 'use strict'
  6661. exports.byteLength = byteLength
  6662. exports.toByteArray = toByteArray
  6663. exports.fromByteArray = fromByteArray
  6664. var lookup = []
  6665. var revLookup = []
  6666. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  6667. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  6668. for (var i = 0, len = code.length; i < len; ++i) {
  6669. lookup[i] = code[i]
  6670. revLookup[code.charCodeAt(i)] = i
  6671. }
  6672. // Support decoding URL-safe base64 strings, as Node.js does.
  6673. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  6674. revLookup['-'.charCodeAt(0)] = 62
  6675. revLookup['_'.charCodeAt(0)] = 63
  6676. function getLens (b64) {
  6677. var len = b64.length
  6678. if (len % 4 > 0) {
  6679. throw new Error('Invalid string. Length must be a multiple of 4')
  6680. }
  6681. // Trim off extra bytes after placeholder bytes are found
  6682. // See: https://github.com/beatgammit/base64-js/issues/42
  6683. var validLen = b64.indexOf('=')
  6684. if (validLen === -1) validLen = len
  6685. var placeHoldersLen = validLen === len
  6686. ? 0
  6687. : 4 - (validLen % 4)
  6688. return [validLen, placeHoldersLen]
  6689. }
  6690. // base64 is 4/3 + up to two characters of the original data
  6691. function byteLength (b64) {
  6692. var lens = getLens(b64)
  6693. var validLen = lens[0]
  6694. var placeHoldersLen = lens[1]
  6695. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  6696. }
  6697. function _byteLength (b64, validLen, placeHoldersLen) {
  6698. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  6699. }
  6700. function toByteArray (b64) {
  6701. var tmp
  6702. var lens = getLens(b64)
  6703. var validLen = lens[0]
  6704. var placeHoldersLen = lens[1]
  6705. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  6706. var curByte = 0
  6707. // if there are placeholders, only get up to the last complete 4 chars
  6708. var len = placeHoldersLen > 0
  6709. ? validLen - 4
  6710. : validLen
  6711. var i
  6712. for (i = 0; i < len; i += 4) {
  6713. tmp =
  6714. (revLookup[b64.charCodeAt(i)] << 18) |
  6715. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  6716. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  6717. revLookup[b64.charCodeAt(i + 3)]
  6718. arr[curByte++] = (tmp >> 16) & 0xFF
  6719. arr[curByte++] = (tmp >> 8) & 0xFF
  6720. arr[curByte++] = tmp & 0xFF
  6721. }
  6722. if (placeHoldersLen === 2) {
  6723. tmp =
  6724. (revLookup[b64.charCodeAt(i)] << 2) |
  6725. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  6726. arr[curByte++] = tmp & 0xFF
  6727. }
  6728. if (placeHoldersLen === 1) {
  6729. tmp =
  6730. (revLookup[b64.charCodeAt(i)] << 10) |
  6731. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  6732. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  6733. arr[curByte++] = (tmp >> 8) & 0xFF
  6734. arr[curByte++] = tmp & 0xFF
  6735. }
  6736. return arr
  6737. }
  6738. function tripletToBase64 (num) {
  6739. return lookup[num >> 18 & 0x3F] +
  6740. lookup[num >> 12 & 0x3F] +
  6741. lookup[num >> 6 & 0x3F] +
  6742. lookup[num & 0x3F]
  6743. }
  6744. function encodeChunk (uint8, start, end) {
  6745. var tmp
  6746. var output = []
  6747. for (var i = start; i < end; i += 3) {
  6748. tmp =
  6749. ((uint8[i] << 16) & 0xFF0000) +
  6750. ((uint8[i + 1] << 8) & 0xFF00) +
  6751. (uint8[i + 2] & 0xFF)
  6752. output.push(tripletToBase64(tmp))
  6753. }
  6754. return output.join('')
  6755. }
  6756. function fromByteArray (uint8) {
  6757. var tmp
  6758. var len = uint8.length
  6759. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  6760. var parts = []
  6761. var maxChunkLength = 16383 // must be multiple of 3
  6762. // go through the array every three bytes, we'll deal with trailing stuff later
  6763. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  6764. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  6765. }
  6766. // pad the end with zeros, but make sure to not forget the extra bytes
  6767. if (extraBytes === 1) {
  6768. tmp = uint8[len - 1]
  6769. parts.push(
  6770. lookup[tmp >> 2] +
  6771. lookup[(tmp << 4) & 0x3F] +
  6772. '=='
  6773. )
  6774. } else if (extraBytes === 2) {
  6775. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  6776. parts.push(
  6777. lookup[tmp >> 10] +
  6778. lookup[(tmp >> 4) & 0x3F] +
  6779. lookup[(tmp << 2) & 0x3F] +
  6780. '='
  6781. )
  6782. }
  6783. return parts.join('')
  6784. }
  6785. },{}],48:[function(require,module,exports){
  6786. "use strict";
  6787. module.exports = function(Promise) {
  6788. var SomePromiseArray = Promise._SomePromiseArray;
  6789. function any(promises) {
  6790. var ret = new SomePromiseArray(promises);
  6791. var promise = ret.promise();
  6792. ret.setHowMany(1);
  6793. ret.setUnwrap();
  6794. ret.init();
  6795. return promise;
  6796. }
  6797. Promise.any = function (promises) {
  6798. return any(promises);
  6799. };
  6800. Promise.prototype.any = function () {
  6801. return any(this);
  6802. };
  6803. };
  6804. },{}],49:[function(require,module,exports){
  6805. (function (process){
  6806. "use strict";
  6807. var firstLineError;
  6808. try {throw new Error(); } catch (e) {firstLineError = e;}
  6809. var schedule = require("./schedule");
  6810. var Queue = require("./queue");
  6811. var util = require("./util");
  6812. function Async() {
  6813. this._customScheduler = false;
  6814. this._isTickUsed = false;
  6815. this._lateQueue = new Queue(16);
  6816. this._normalQueue = new Queue(16);
  6817. this._haveDrainedQueues = false;
  6818. this._trampolineEnabled = true;
  6819. var self = this;
  6820. this.drainQueues = function () {
  6821. self._drainQueues();
  6822. };
  6823. this._schedule = schedule;
  6824. }
  6825. Async.prototype.setScheduler = function(fn) {
  6826. var prev = this._schedule;
  6827. this._schedule = fn;
  6828. this._customScheduler = true;
  6829. return prev;
  6830. };
  6831. Async.prototype.hasCustomScheduler = function() {
  6832. return this._customScheduler;
  6833. };
  6834. Async.prototype.enableTrampoline = function() {
  6835. this._trampolineEnabled = true;
  6836. };
  6837. Async.prototype.disableTrampolineIfNecessary = function() {
  6838. if (util.hasDevTools) {
  6839. this._trampolineEnabled = false;
  6840. }
  6841. };
  6842. Async.prototype.haveItemsQueued = function () {
  6843. return this._isTickUsed || this._haveDrainedQueues;
  6844. };
  6845. Async.prototype.fatalError = function(e, isNode) {
  6846. if (isNode) {
  6847. process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) +
  6848. "\n");
  6849. process.exit(2);
  6850. } else {
  6851. this.throwLater(e);
  6852. }
  6853. };
  6854. Async.prototype.throwLater = function(fn, arg) {
  6855. if (arguments.length === 1) {
  6856. arg = fn;
  6857. fn = function () { throw arg; };
  6858. }
  6859. if (typeof setTimeout !== "undefined") {
  6860. setTimeout(function() {
  6861. fn(arg);
  6862. }, 0);
  6863. } else try {
  6864. this._schedule(function() {
  6865. fn(arg);
  6866. });
  6867. } catch (e) {
  6868. throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  6869. }
  6870. };
  6871. function AsyncInvokeLater(fn, receiver, arg) {
  6872. this._lateQueue.push(fn, receiver, arg);
  6873. this._queueTick();
  6874. }
  6875. function AsyncInvoke(fn, receiver, arg) {
  6876. this._normalQueue.push(fn, receiver, arg);
  6877. this._queueTick();
  6878. }
  6879. function AsyncSettlePromises(promise) {
  6880. this._normalQueue._pushOne(promise);
  6881. this._queueTick();
  6882. }
  6883. if (!util.hasDevTools) {
  6884. Async.prototype.invokeLater = AsyncInvokeLater;
  6885. Async.prototype.invoke = AsyncInvoke;
  6886. Async.prototype.settlePromises = AsyncSettlePromises;
  6887. } else {
  6888. Async.prototype.invokeLater = function (fn, receiver, arg) {
  6889. if (this._trampolineEnabled) {
  6890. AsyncInvokeLater.call(this, fn, receiver, arg);
  6891. } else {
  6892. this._schedule(function() {
  6893. setTimeout(function() {
  6894. fn.call(receiver, arg);
  6895. }, 100);
  6896. });
  6897. }
  6898. };
  6899. Async.prototype.invoke = function (fn, receiver, arg) {
  6900. if (this._trampolineEnabled) {
  6901. AsyncInvoke.call(this, fn, receiver, arg);
  6902. } else {
  6903. this._schedule(function() {
  6904. fn.call(receiver, arg);
  6905. });
  6906. }
  6907. };
  6908. Async.prototype.settlePromises = function(promise) {
  6909. if (this._trampolineEnabled) {
  6910. AsyncSettlePromises.call(this, promise);
  6911. } else {
  6912. this._schedule(function() {
  6913. promise._settlePromises();
  6914. });
  6915. }
  6916. };
  6917. }
  6918. Async.prototype._drainQueue = function(queue) {
  6919. while (queue.length() > 0) {
  6920. var fn = queue.shift();
  6921. if (typeof fn !== "function") {
  6922. fn._settlePromises();
  6923. continue;
  6924. }
  6925. var receiver = queue.shift();
  6926. var arg = queue.shift();
  6927. fn.call(receiver, arg);
  6928. }
  6929. };
  6930. Async.prototype._drainQueues = function () {
  6931. this._drainQueue(this._normalQueue);
  6932. this._reset();
  6933. this._haveDrainedQueues = true;
  6934. this._drainQueue(this._lateQueue);
  6935. };
  6936. Async.prototype._queueTick = function () {
  6937. if (!this._isTickUsed) {
  6938. this._isTickUsed = true;
  6939. this._schedule(this.drainQueues);
  6940. }
  6941. };
  6942. Async.prototype._reset = function () {
  6943. this._isTickUsed = false;
  6944. };
  6945. module.exports = Async;
  6946. module.exports.firstLineError = firstLineError;
  6947. }).call(this,require('_process'))
  6948. },{"./queue":72,"./schedule":75,"./util":82,"_process":101}],50:[function(require,module,exports){
  6949. "use strict";
  6950. module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
  6951. var calledBind = false;
  6952. var rejectThis = function(_, e) {
  6953. this._reject(e);
  6954. };
  6955. var targetRejected = function(e, context) {
  6956. context.promiseRejectionQueued = true;
  6957. context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
  6958. };
  6959. var bindingResolved = function(thisArg, context) {
  6960. if (((this._bitField & 50397184) === 0)) {
  6961. this._resolveCallback(context.target);
  6962. }
  6963. };
  6964. var bindingRejected = function(e, context) {
  6965. if (!context.promiseRejectionQueued) this._reject(e);
  6966. };
  6967. Promise.prototype.bind = function (thisArg) {
  6968. if (!calledBind) {
  6969. calledBind = true;
  6970. Promise.prototype._propagateFrom = debug.propagateFromFunction();
  6971. Promise.prototype._boundValue = debug.boundValueFunction();
  6972. }
  6973. var maybePromise = tryConvertToPromise(thisArg);
  6974. var ret = new Promise(INTERNAL);
  6975. ret._propagateFrom(this, 1);
  6976. var target = this._target();
  6977. ret._setBoundTo(maybePromise);
  6978. if (maybePromise instanceof Promise) {
  6979. var context = {
  6980. promiseRejectionQueued: false,
  6981. promise: ret,
  6982. target: target,
  6983. bindingPromise: maybePromise
  6984. };
  6985. target._then(INTERNAL, targetRejected, undefined, ret, context);
  6986. maybePromise._then(
  6987. bindingResolved, bindingRejected, undefined, ret, context);
  6988. ret._setOnCancel(maybePromise);
  6989. } else {
  6990. ret._resolveCallback(target);
  6991. }
  6992. return ret;
  6993. };
  6994. Promise.prototype._setBoundTo = function (obj) {
  6995. if (obj !== undefined) {
  6996. this._bitField = this._bitField | 2097152;
  6997. this._boundTo = obj;
  6998. } else {
  6999. this._bitField = this._bitField & (~2097152);
  7000. }
  7001. };
  7002. Promise.prototype._isBound = function () {
  7003. return (this._bitField & 2097152) === 2097152;
  7004. };
  7005. Promise.bind = function (thisArg, value) {
  7006. return Promise.resolve(value).bind(thisArg);
  7007. };
  7008. };
  7009. },{}],51:[function(require,module,exports){
  7010. "use strict";
  7011. var cr = Object.create;
  7012. if (cr) {
  7013. var callerCache = cr(null);
  7014. var getterCache = cr(null);
  7015. callerCache[" size"] = getterCache[" size"] = 0;
  7016. }
  7017. module.exports = function(Promise) {
  7018. var util = require("./util");
  7019. var canEvaluate = util.canEvaluate;
  7020. var isIdentifier = util.isIdentifier;
  7021. var getMethodCaller;
  7022. var getGetter;
  7023. if (!false) {
  7024. var makeMethodCaller = function (methodName) {
  7025. return new Function("ensureMethod", " \n\
  7026. return function(obj) { \n\
  7027. 'use strict' \n\
  7028. var len = this.length; \n\
  7029. ensureMethod(obj, 'methodName'); \n\
  7030. switch(len) { \n\
  7031. case 1: return obj.methodName(this[0]); \n\
  7032. case 2: return obj.methodName(this[0], this[1]); \n\
  7033. case 3: return obj.methodName(this[0], this[1], this[2]); \n\
  7034. case 0: return obj.methodName(); \n\
  7035. default: \n\
  7036. return obj.methodName.apply(obj, this); \n\
  7037. } \n\
  7038. }; \n\
  7039. ".replace(/methodName/g, methodName))(ensureMethod);
  7040. };
  7041. var makeGetter = function (propertyName) {
  7042. return new Function("obj", " \n\
  7043. 'use strict'; \n\
  7044. return obj.propertyName; \n\
  7045. ".replace("propertyName", propertyName));
  7046. };
  7047. var getCompiled = function(name, compiler, cache) {
  7048. var ret = cache[name];
  7049. if (typeof ret !== "function") {
  7050. if (!isIdentifier(name)) {
  7051. return null;
  7052. }
  7053. ret = compiler(name);
  7054. cache[name] = ret;
  7055. cache[" size"]++;
  7056. if (cache[" size"] > 512) {
  7057. var keys = Object.keys(cache);
  7058. for (var i = 0; i < 256; ++i) delete cache[keys[i]];
  7059. cache[" size"] = keys.length - 256;
  7060. }
  7061. }
  7062. return ret;
  7063. };
  7064. getMethodCaller = function(name) {
  7065. return getCompiled(name, makeMethodCaller, callerCache);
  7066. };
  7067. getGetter = function(name) {
  7068. return getCompiled(name, makeGetter, getterCache);
  7069. };
  7070. }
  7071. function ensureMethod(obj, methodName) {
  7072. var fn;
  7073. if (obj != null) fn = obj[methodName];
  7074. if (typeof fn !== "function") {
  7075. var message = "Object " + util.classString(obj) + " has no method '" +
  7076. util.toString(methodName) + "'";
  7077. throw new Promise.TypeError(message);
  7078. }
  7079. return fn;
  7080. }
  7081. function caller(obj) {
  7082. var methodName = this.pop();
  7083. var fn = ensureMethod(obj, methodName);
  7084. return fn.apply(obj, this);
  7085. }
  7086. Promise.prototype.call = function (methodName) {
  7087. var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};
  7088. if (!false) {
  7089. if (canEvaluate) {
  7090. var maybeCaller = getMethodCaller(methodName);
  7091. if (maybeCaller !== null) {
  7092. return this._then(
  7093. maybeCaller, undefined, undefined, args, undefined);
  7094. }
  7095. }
  7096. }
  7097. args.push(methodName);
  7098. return this._then(caller, undefined, undefined, args, undefined);
  7099. };
  7100. function namedGetter(obj) {
  7101. return obj[this];
  7102. }
  7103. function indexedGetter(obj) {
  7104. var index = +this;
  7105. if (index < 0) index = Math.max(0, index + obj.length);
  7106. return obj[index];
  7107. }
  7108. Promise.prototype.get = function (propertyName) {
  7109. var isIndex = (typeof propertyName === "number");
  7110. var getter;
  7111. if (!isIndex) {
  7112. if (canEvaluate) {
  7113. var maybeGetter = getGetter(propertyName);
  7114. getter = maybeGetter !== null ? maybeGetter : namedGetter;
  7115. } else {
  7116. getter = namedGetter;
  7117. }
  7118. } else {
  7119. getter = indexedGetter;
  7120. }
  7121. return this._then(getter, undefined, undefined, propertyName, undefined);
  7122. };
  7123. };
  7124. },{"./util":82}],52:[function(require,module,exports){
  7125. "use strict";
  7126. module.exports = function(Promise, PromiseArray, apiRejection, debug) {
  7127. var util = require("./util");
  7128. var tryCatch = util.tryCatch;
  7129. var errorObj = util.errorObj;
  7130. var async = Promise._async;
  7131. Promise.prototype["break"] = Promise.prototype.cancel = function() {
  7132. if (!debug.cancellation()) return this._warn("cancellation is disabled");
  7133. var promise = this;
  7134. var child = promise;
  7135. while (promise._isCancellable()) {
  7136. if (!promise._cancelBy(child)) {
  7137. if (child._isFollowing()) {
  7138. child._followee().cancel();
  7139. } else {
  7140. child._cancelBranched();
  7141. }
  7142. break;
  7143. }
  7144. var parent = promise._cancellationParent;
  7145. if (parent == null || !parent._isCancellable()) {
  7146. if (promise._isFollowing()) {
  7147. promise._followee().cancel();
  7148. } else {
  7149. promise._cancelBranched();
  7150. }
  7151. break;
  7152. } else {
  7153. if (promise._isFollowing()) promise._followee().cancel();
  7154. promise._setWillBeCancelled();
  7155. child = promise;
  7156. promise = parent;
  7157. }
  7158. }
  7159. };
  7160. Promise.prototype._branchHasCancelled = function() {
  7161. this._branchesRemainingToCancel--;
  7162. };
  7163. Promise.prototype._enoughBranchesHaveCancelled = function() {
  7164. return this._branchesRemainingToCancel === undefined ||
  7165. this._branchesRemainingToCancel <= 0;
  7166. };
  7167. Promise.prototype._cancelBy = function(canceller) {
  7168. if (canceller === this) {
  7169. this._branchesRemainingToCancel = 0;
  7170. this._invokeOnCancel();
  7171. return true;
  7172. } else {
  7173. this._branchHasCancelled();
  7174. if (this._enoughBranchesHaveCancelled()) {
  7175. this._invokeOnCancel();
  7176. return true;
  7177. }
  7178. }
  7179. return false;
  7180. };
  7181. Promise.prototype._cancelBranched = function() {
  7182. if (this._enoughBranchesHaveCancelled()) {
  7183. this._cancel();
  7184. }
  7185. };
  7186. Promise.prototype._cancel = function() {
  7187. if (!this._isCancellable()) return;
  7188. this._setCancelled();
  7189. async.invoke(this._cancelPromises, this, undefined);
  7190. };
  7191. Promise.prototype._cancelPromises = function() {
  7192. if (this._length() > 0) this._settlePromises();
  7193. };
  7194. Promise.prototype._unsetOnCancel = function() {
  7195. this._onCancelField = undefined;
  7196. };
  7197. Promise.prototype._isCancellable = function() {
  7198. return this.isPending() && !this._isCancelled();
  7199. };
  7200. Promise.prototype.isCancellable = function() {
  7201. return this.isPending() && !this.isCancelled();
  7202. };
  7203. Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
  7204. if (util.isArray(onCancelCallback)) {
  7205. for (var i = 0; i < onCancelCallback.length; ++i) {
  7206. this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
  7207. }
  7208. } else if (onCancelCallback !== undefined) {
  7209. if (typeof onCancelCallback === "function") {
  7210. if (!internalOnly) {
  7211. var e = tryCatch(onCancelCallback).call(this._boundValue());
  7212. if (e === errorObj) {
  7213. this._attachExtraTrace(e.e);
  7214. async.throwLater(e.e);
  7215. }
  7216. }
  7217. } else {
  7218. onCancelCallback._resultCancelled(this);
  7219. }
  7220. }
  7221. };
  7222. Promise.prototype._invokeOnCancel = function() {
  7223. var onCancelCallback = this._onCancel();
  7224. this._unsetOnCancel();
  7225. async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
  7226. };
  7227. Promise.prototype._invokeInternalOnCancel = function() {
  7228. if (this._isCancellable()) {
  7229. this._doInvokeOnCancel(this._onCancel(), true);
  7230. this._unsetOnCancel();
  7231. }
  7232. };
  7233. Promise.prototype._resultCancelled = function() {
  7234. this.cancel();
  7235. };
  7236. };
  7237. },{"./util":82}],53:[function(require,module,exports){
  7238. "use strict";
  7239. module.exports = function(NEXT_FILTER) {
  7240. var util = require("./util");
  7241. var getKeys = require("./es5").keys;
  7242. var tryCatch = util.tryCatch;
  7243. var errorObj = util.errorObj;
  7244. function catchFilter(instances, cb, promise) {
  7245. return function(e) {
  7246. var boundTo = promise._boundValue();
  7247. predicateLoop: for (var i = 0; i < instances.length; ++i) {
  7248. var item = instances[i];
  7249. if (item === Error ||
  7250. (item != null && item.prototype instanceof Error)) {
  7251. if (e instanceof item) {
  7252. return tryCatch(cb).call(boundTo, e);
  7253. }
  7254. } else if (typeof item === "function") {
  7255. var matchesPredicate = tryCatch(item).call(boundTo, e);
  7256. if (matchesPredicate === errorObj) {
  7257. return matchesPredicate;
  7258. } else if (matchesPredicate) {
  7259. return tryCatch(cb).call(boundTo, e);
  7260. }
  7261. } else if (util.isObject(e)) {
  7262. var keys = getKeys(item);
  7263. for (var j = 0; j < keys.length; ++j) {
  7264. var key = keys[j];
  7265. if (item[key] != e[key]) {
  7266. continue predicateLoop;
  7267. }
  7268. }
  7269. return tryCatch(cb).call(boundTo, e);
  7270. }
  7271. }
  7272. return NEXT_FILTER;
  7273. };
  7274. }
  7275. return catchFilter;
  7276. };
  7277. },{"./es5":59,"./util":82}],54:[function(require,module,exports){
  7278. "use strict";
  7279. module.exports = function(Promise) {
  7280. var longStackTraces = false;
  7281. var contextStack = [];
  7282. Promise.prototype._promiseCreated = function() {};
  7283. Promise.prototype._pushContext = function() {};
  7284. Promise.prototype._popContext = function() {return null;};
  7285. Promise._peekContext = Promise.prototype._peekContext = function() {};
  7286. function Context() {
  7287. this._trace = new Context.CapturedTrace(peekContext());
  7288. }
  7289. Context.prototype._pushContext = function () {
  7290. if (this._trace !== undefined) {
  7291. this._trace._promiseCreated = null;
  7292. contextStack.push(this._trace);
  7293. }
  7294. };
  7295. Context.prototype._popContext = function () {
  7296. if (this._trace !== undefined) {
  7297. var trace = contextStack.pop();
  7298. var ret = trace._promiseCreated;
  7299. trace._promiseCreated = null;
  7300. return ret;
  7301. }
  7302. return null;
  7303. };
  7304. function createContext() {
  7305. if (longStackTraces) return new Context();
  7306. }
  7307. function peekContext() {
  7308. var lastIndex = contextStack.length - 1;
  7309. if (lastIndex >= 0) {
  7310. return contextStack[lastIndex];
  7311. }
  7312. return undefined;
  7313. }
  7314. Context.CapturedTrace = null;
  7315. Context.create = createContext;
  7316. Context.deactivateLongStackTraces = function() {};
  7317. Context.activateLongStackTraces = function() {
  7318. var Promise_pushContext = Promise.prototype._pushContext;
  7319. var Promise_popContext = Promise.prototype._popContext;
  7320. var Promise_PeekContext = Promise._peekContext;
  7321. var Promise_peekContext = Promise.prototype._peekContext;
  7322. var Promise_promiseCreated = Promise.prototype._promiseCreated;
  7323. Context.deactivateLongStackTraces = function() {
  7324. Promise.prototype._pushContext = Promise_pushContext;
  7325. Promise.prototype._popContext = Promise_popContext;
  7326. Promise._peekContext = Promise_PeekContext;
  7327. Promise.prototype._peekContext = Promise_peekContext;
  7328. Promise.prototype._promiseCreated = Promise_promiseCreated;
  7329. longStackTraces = false;
  7330. };
  7331. longStackTraces = true;
  7332. Promise.prototype._pushContext = Context.prototype._pushContext;
  7333. Promise.prototype._popContext = Context.prototype._popContext;
  7334. Promise._peekContext = Promise.prototype._peekContext = peekContext;
  7335. Promise.prototype._promiseCreated = function() {
  7336. var ctx = this._peekContext();
  7337. if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
  7338. };
  7339. };
  7340. return Context;
  7341. };
  7342. },{}],55:[function(require,module,exports){
  7343. (function (process){
  7344. "use strict";
  7345. module.exports = function(Promise, Context) {
  7346. var getDomain = Promise._getDomain;
  7347. var async = Promise._async;
  7348. var Warning = require("./errors").Warning;
  7349. var util = require("./util");
  7350. var canAttachTrace = util.canAttachTrace;
  7351. var unhandledRejectionHandled;
  7352. var possiblyUnhandledRejection;
  7353. var bluebirdFramePattern =
  7354. /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
  7355. var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
  7356. var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
  7357. var stackFramePattern = null;
  7358. var formatStack = null;
  7359. var indentStackFrames = false;
  7360. var printWarning;
  7361. var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 &&
  7362. (false ||
  7363. util.env("BLUEBIRD_DEBUG") ||
  7364. util.env("NODE_ENV") === "development"));
  7365. var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 &&
  7366. (debugging || util.env("BLUEBIRD_WARNINGS")));
  7367. var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
  7368. (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
  7369. var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
  7370. (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
  7371. Promise.prototype.suppressUnhandledRejections = function() {
  7372. var target = this._target();
  7373. target._bitField = ((target._bitField & (~1048576)) |
  7374. 524288);
  7375. };
  7376. Promise.prototype._ensurePossibleRejectionHandled = function () {
  7377. if ((this._bitField & 524288) !== 0) return;
  7378. this._setRejectionIsUnhandled();
  7379. async.invokeLater(this._notifyUnhandledRejection, this, undefined);
  7380. };
  7381. Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
  7382. fireRejectionEvent("rejectionHandled",
  7383. unhandledRejectionHandled, undefined, this);
  7384. };
  7385. Promise.prototype._setReturnedNonUndefined = function() {
  7386. this._bitField = this._bitField | 268435456;
  7387. };
  7388. Promise.prototype._returnedNonUndefined = function() {
  7389. return (this._bitField & 268435456) !== 0;
  7390. };
  7391. Promise.prototype._notifyUnhandledRejection = function () {
  7392. if (this._isRejectionUnhandled()) {
  7393. var reason = this._settledValue();
  7394. this._setUnhandledRejectionIsNotified();
  7395. fireRejectionEvent("unhandledRejection",
  7396. possiblyUnhandledRejection, reason, this);
  7397. }
  7398. };
  7399. Promise.prototype._setUnhandledRejectionIsNotified = function () {
  7400. this._bitField = this._bitField | 262144;
  7401. };
  7402. Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
  7403. this._bitField = this._bitField & (~262144);
  7404. };
  7405. Promise.prototype._isUnhandledRejectionNotified = function () {
  7406. return (this._bitField & 262144) > 0;
  7407. };
  7408. Promise.prototype._setRejectionIsUnhandled = function () {
  7409. this._bitField = this._bitField | 1048576;
  7410. };
  7411. Promise.prototype._unsetRejectionIsUnhandled = function () {
  7412. this._bitField = this._bitField & (~1048576);
  7413. if (this._isUnhandledRejectionNotified()) {
  7414. this._unsetUnhandledRejectionIsNotified();
  7415. this._notifyUnhandledRejectionIsHandled();
  7416. }
  7417. };
  7418. Promise.prototype._isRejectionUnhandled = function () {
  7419. return (this._bitField & 1048576) > 0;
  7420. };
  7421. Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
  7422. return warn(message, shouldUseOwnTrace, promise || this);
  7423. };
  7424. Promise.onPossiblyUnhandledRejection = function (fn) {
  7425. var domain = getDomain();
  7426. possiblyUnhandledRejection =
  7427. typeof fn === "function" ? (domain === null ?
  7428. fn : util.domainBind(domain, fn))
  7429. : undefined;
  7430. };
  7431. Promise.onUnhandledRejectionHandled = function (fn) {
  7432. var domain = getDomain();
  7433. unhandledRejectionHandled =
  7434. typeof fn === "function" ? (domain === null ?
  7435. fn : util.domainBind(domain, fn))
  7436. : undefined;
  7437. };
  7438. var disableLongStackTraces = function() {};
  7439. Promise.longStackTraces = function () {
  7440. if (async.haveItemsQueued() && !config.longStackTraces) {
  7441. throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  7442. }
  7443. if (!config.longStackTraces && longStackTracesIsSupported()) {
  7444. var Promise_captureStackTrace = Promise.prototype._captureStackTrace;
  7445. var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;
  7446. config.longStackTraces = true;
  7447. disableLongStackTraces = function() {
  7448. if (async.haveItemsQueued() && !config.longStackTraces) {
  7449. throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  7450. }
  7451. Promise.prototype._captureStackTrace = Promise_captureStackTrace;
  7452. Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
  7453. Context.deactivateLongStackTraces();
  7454. async.enableTrampoline();
  7455. config.longStackTraces = false;
  7456. };
  7457. Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
  7458. Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
  7459. Context.activateLongStackTraces();
  7460. async.disableTrampolineIfNecessary();
  7461. }
  7462. };
  7463. Promise.hasLongStackTraces = function () {
  7464. return config.longStackTraces && longStackTracesIsSupported();
  7465. };
  7466. var fireDomEvent = (function() {
  7467. try {
  7468. if (typeof CustomEvent === "function") {
  7469. var event = new CustomEvent("CustomEvent");
  7470. util.global.dispatchEvent(event);
  7471. return function(name, event) {
  7472. var domEvent = new CustomEvent(name.toLowerCase(), {
  7473. detail: event,
  7474. cancelable: true
  7475. });
  7476. return !util.global.dispatchEvent(domEvent);
  7477. };
  7478. } else if (typeof Event === "function") {
  7479. var event = new Event("CustomEvent");
  7480. util.global.dispatchEvent(event);
  7481. return function(name, event) {
  7482. var domEvent = new Event(name.toLowerCase(), {
  7483. cancelable: true
  7484. });
  7485. domEvent.detail = event;
  7486. return !util.global.dispatchEvent(domEvent);
  7487. };
  7488. } else {
  7489. var event = document.createEvent("CustomEvent");
  7490. event.initCustomEvent("testingtheevent", false, true, {});
  7491. util.global.dispatchEvent(event);
  7492. return function(name, event) {
  7493. var domEvent = document.createEvent("CustomEvent");
  7494. domEvent.initCustomEvent(name.toLowerCase(), false, true,
  7495. event);
  7496. return !util.global.dispatchEvent(domEvent);
  7497. };
  7498. }
  7499. } catch (e) {}
  7500. return function() {
  7501. return false;
  7502. };
  7503. })();
  7504. var fireGlobalEvent = (function() {
  7505. if (util.isNode) {
  7506. return function() {
  7507. return process.emit.apply(process, arguments);
  7508. };
  7509. } else {
  7510. if (!util.global) {
  7511. return function() {
  7512. return false;
  7513. };
  7514. }
  7515. return function(name) {
  7516. var methodName = "on" + name.toLowerCase();
  7517. var method = util.global[methodName];
  7518. if (!method) return false;
  7519. method.apply(util.global, [].slice.call(arguments, 1));
  7520. return true;
  7521. };
  7522. }
  7523. })();
  7524. function generatePromiseLifecycleEventObject(name, promise) {
  7525. return {promise: promise};
  7526. }
  7527. var eventToObjectGenerator = {
  7528. promiseCreated: generatePromiseLifecycleEventObject,
  7529. promiseFulfilled: generatePromiseLifecycleEventObject,
  7530. promiseRejected: generatePromiseLifecycleEventObject,
  7531. promiseResolved: generatePromiseLifecycleEventObject,
  7532. promiseCancelled: generatePromiseLifecycleEventObject,
  7533. promiseChained: function(name, promise, child) {
  7534. return {promise: promise, child: child};
  7535. },
  7536. warning: function(name, warning) {
  7537. return {warning: warning};
  7538. },
  7539. unhandledRejection: function (name, reason, promise) {
  7540. return {reason: reason, promise: promise};
  7541. },
  7542. rejectionHandled: generatePromiseLifecycleEventObject
  7543. };
  7544. var activeFireEvent = function (name) {
  7545. var globalEventFired = false;
  7546. try {
  7547. globalEventFired = fireGlobalEvent.apply(null, arguments);
  7548. } catch (e) {
  7549. async.throwLater(e);
  7550. globalEventFired = true;
  7551. }
  7552. var domEventFired = false;
  7553. try {
  7554. domEventFired = fireDomEvent(name,
  7555. eventToObjectGenerator[name].apply(null, arguments));
  7556. } catch (e) {
  7557. async.throwLater(e);
  7558. domEventFired = true;
  7559. }
  7560. return domEventFired || globalEventFired;
  7561. };
  7562. Promise.config = function(opts) {
  7563. opts = Object(opts);
  7564. if ("longStackTraces" in opts) {
  7565. if (opts.longStackTraces) {
  7566. Promise.longStackTraces();
  7567. } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {
  7568. disableLongStackTraces();
  7569. }
  7570. }
  7571. if ("warnings" in opts) {
  7572. var warningsOption = opts.warnings;
  7573. config.warnings = !!warningsOption;
  7574. wForgottenReturn = config.warnings;
  7575. if (util.isObject(warningsOption)) {
  7576. if ("wForgottenReturn" in warningsOption) {
  7577. wForgottenReturn = !!warningsOption.wForgottenReturn;
  7578. }
  7579. }
  7580. }
  7581. if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
  7582. if (async.haveItemsQueued()) {
  7583. throw new Error(
  7584. "cannot enable cancellation after promises are in use");
  7585. }
  7586. Promise.prototype._clearCancellationData =
  7587. cancellationClearCancellationData;
  7588. Promise.prototype._propagateFrom = cancellationPropagateFrom;
  7589. Promise.prototype._onCancel = cancellationOnCancel;
  7590. Promise.prototype._setOnCancel = cancellationSetOnCancel;
  7591. Promise.prototype._attachCancellationCallback =
  7592. cancellationAttachCancellationCallback;
  7593. Promise.prototype._execute = cancellationExecute;
  7594. propagateFromFunction = cancellationPropagateFrom;
  7595. config.cancellation = true;
  7596. }
  7597. if ("monitoring" in opts) {
  7598. if (opts.monitoring && !config.monitoring) {
  7599. config.monitoring = true;
  7600. Promise.prototype._fireEvent = activeFireEvent;
  7601. } else if (!opts.monitoring && config.monitoring) {
  7602. config.monitoring = false;
  7603. Promise.prototype._fireEvent = defaultFireEvent;
  7604. }
  7605. }
  7606. return Promise;
  7607. };
  7608. function defaultFireEvent() { return false; }
  7609. Promise.prototype._fireEvent = defaultFireEvent;
  7610. Promise.prototype._execute = function(executor, resolve, reject) {
  7611. try {
  7612. executor(resolve, reject);
  7613. } catch (e) {
  7614. return e;
  7615. }
  7616. };
  7617. Promise.prototype._onCancel = function () {};
  7618. Promise.prototype._setOnCancel = function (handler) { ; };
  7619. Promise.prototype._attachCancellationCallback = function(onCancel) {
  7620. ;
  7621. };
  7622. Promise.prototype._captureStackTrace = function () {};
  7623. Promise.prototype._attachExtraTrace = function () {};
  7624. Promise.prototype._clearCancellationData = function() {};
  7625. Promise.prototype._propagateFrom = function (parent, flags) {
  7626. ;
  7627. ;
  7628. };
  7629. function cancellationExecute(executor, resolve, reject) {
  7630. var promise = this;
  7631. try {
  7632. executor(resolve, reject, function(onCancel) {
  7633. if (typeof onCancel !== "function") {
  7634. throw new TypeError("onCancel must be a function, got: " +
  7635. util.toString(onCancel));
  7636. }
  7637. promise._attachCancellationCallback(onCancel);
  7638. });
  7639. } catch (e) {
  7640. return e;
  7641. }
  7642. }
  7643. function cancellationAttachCancellationCallback(onCancel) {
  7644. if (!this._isCancellable()) return this;
  7645. var previousOnCancel = this._onCancel();
  7646. if (previousOnCancel !== undefined) {
  7647. if (util.isArray(previousOnCancel)) {
  7648. previousOnCancel.push(onCancel);
  7649. } else {
  7650. this._setOnCancel([previousOnCancel, onCancel]);
  7651. }
  7652. } else {
  7653. this._setOnCancel(onCancel);
  7654. }
  7655. }
  7656. function cancellationOnCancel() {
  7657. return this._onCancelField;
  7658. }
  7659. function cancellationSetOnCancel(onCancel) {
  7660. this._onCancelField = onCancel;
  7661. }
  7662. function cancellationClearCancellationData() {
  7663. this._cancellationParent = undefined;
  7664. this._onCancelField = undefined;
  7665. }
  7666. function cancellationPropagateFrom(parent, flags) {
  7667. if ((flags & 1) !== 0) {
  7668. this._cancellationParent = parent;
  7669. var branchesRemainingToCancel = parent._branchesRemainingToCancel;
  7670. if (branchesRemainingToCancel === undefined) {
  7671. branchesRemainingToCancel = 0;
  7672. }
  7673. parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
  7674. }
  7675. if ((flags & 2) !== 0 && parent._isBound()) {
  7676. this._setBoundTo(parent._boundTo);
  7677. }
  7678. }
  7679. function bindingPropagateFrom(parent, flags) {
  7680. if ((flags & 2) !== 0 && parent._isBound()) {
  7681. this._setBoundTo(parent._boundTo);
  7682. }
  7683. }
  7684. var propagateFromFunction = bindingPropagateFrom;
  7685. function boundValueFunction() {
  7686. var ret = this._boundTo;
  7687. if (ret !== undefined) {
  7688. if (ret instanceof Promise) {
  7689. if (ret.isFulfilled()) {
  7690. return ret.value();
  7691. } else {
  7692. return undefined;
  7693. }
  7694. }
  7695. }
  7696. return ret;
  7697. }
  7698. function longStackTracesCaptureStackTrace() {
  7699. this._trace = new CapturedTrace(this._peekContext());
  7700. }
  7701. function longStackTracesAttachExtraTrace(error, ignoreSelf) {
  7702. if (canAttachTrace(error)) {
  7703. var trace = this._trace;
  7704. if (trace !== undefined) {
  7705. if (ignoreSelf) trace = trace._parent;
  7706. }
  7707. if (trace !== undefined) {
  7708. trace.attachExtraTrace(error);
  7709. } else if (!error.__stackCleaned__) {
  7710. var parsed = parseStackAndMessage(error);
  7711. util.notEnumerableProp(error, "stack",
  7712. parsed.message + "\n" + parsed.stack.join("\n"));
  7713. util.notEnumerableProp(error, "__stackCleaned__", true);
  7714. }
  7715. }
  7716. }
  7717. function checkForgottenReturns(returnValue, promiseCreated, name, promise,
  7718. parent) {
  7719. if (returnValue === undefined && promiseCreated !== null &&
  7720. wForgottenReturn) {
  7721. if (parent !== undefined && parent._returnedNonUndefined()) return;
  7722. if ((promise._bitField & 65535) === 0) return;
  7723. if (name) name = name + " ";
  7724. var handlerLine = "";
  7725. var creatorLine = "";
  7726. if (promiseCreated._trace) {
  7727. var traceLines = promiseCreated._trace.stack.split("\n");
  7728. var stack = cleanStack(traceLines);
  7729. for (var i = stack.length - 1; i >= 0; --i) {
  7730. var line = stack[i];
  7731. if (!nodeFramePattern.test(line)) {
  7732. var lineMatches = line.match(parseLinePattern);
  7733. if (lineMatches) {
  7734. handlerLine = "at " + lineMatches[1] +
  7735. ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
  7736. }
  7737. break;
  7738. }
  7739. }
  7740. if (stack.length > 0) {
  7741. var firstUserLine = stack[0];
  7742. for (var i = 0; i < traceLines.length; ++i) {
  7743. if (traceLines[i] === firstUserLine) {
  7744. if (i > 0) {
  7745. creatorLine = "\n" + traceLines[i - 1];
  7746. }
  7747. break;
  7748. }
  7749. }
  7750. }
  7751. }
  7752. var msg = "a promise was created in a " + name +
  7753. "handler " + handlerLine + "but was not returned from it, " +
  7754. "see http://goo.gl/rRqMUw" +
  7755. creatorLine;
  7756. promise._warn(msg, true, promiseCreated);
  7757. }
  7758. }
  7759. function deprecated(name, replacement) {
  7760. var message = name +
  7761. " is deprecated and will be removed in a future version.";
  7762. if (replacement) message += " Use " + replacement + " instead.";
  7763. return warn(message);
  7764. }
  7765. function warn(message, shouldUseOwnTrace, promise) {
  7766. if (!config.warnings) return;
  7767. var warning = new Warning(message);
  7768. var ctx;
  7769. if (shouldUseOwnTrace) {
  7770. promise._attachExtraTrace(warning);
  7771. } else if (config.longStackTraces && (ctx = Promise._peekContext())) {
  7772. ctx.attachExtraTrace(warning);
  7773. } else {
  7774. var parsed = parseStackAndMessage(warning);
  7775. warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
  7776. }
  7777. if (!activeFireEvent("warning", warning)) {
  7778. formatAndLogError(warning, "", true);
  7779. }
  7780. }
  7781. function reconstructStack(message, stacks) {
  7782. for (var i = 0; i < stacks.length - 1; ++i) {
  7783. stacks[i].push("From previous event:");
  7784. stacks[i] = stacks[i].join("\n");
  7785. }
  7786. if (i < stacks.length) {
  7787. stacks[i] = stacks[i].join("\n");
  7788. }
  7789. return message + "\n" + stacks.join("\n");
  7790. }
  7791. function removeDuplicateOrEmptyJumps(stacks) {
  7792. for (var i = 0; i < stacks.length; ++i) {
  7793. if (stacks[i].length === 0 ||
  7794. ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {
  7795. stacks.splice(i, 1);
  7796. i--;
  7797. }
  7798. }
  7799. }
  7800. function removeCommonRoots(stacks) {
  7801. var current = stacks[0];
  7802. for (var i = 1; i < stacks.length; ++i) {
  7803. var prev = stacks[i];
  7804. var currentLastIndex = current.length - 1;
  7805. var currentLastLine = current[currentLastIndex];
  7806. var commonRootMeetPoint = -1;
  7807. for (var j = prev.length - 1; j >= 0; --j) {
  7808. if (prev[j] === currentLastLine) {
  7809. commonRootMeetPoint = j;
  7810. break;
  7811. }
  7812. }
  7813. for (var j = commonRootMeetPoint; j >= 0; --j) {
  7814. var line = prev[j];
  7815. if (current[currentLastIndex] === line) {
  7816. current.pop();
  7817. currentLastIndex--;
  7818. } else {
  7819. break;
  7820. }
  7821. }
  7822. current = prev;
  7823. }
  7824. }
  7825. function cleanStack(stack) {
  7826. var ret = [];
  7827. for (var i = 0; i < stack.length; ++i) {
  7828. var line = stack[i];
  7829. var isTraceLine = " (No stack trace)" === line ||
  7830. stackFramePattern.test(line);
  7831. var isInternalFrame = isTraceLine && shouldIgnore(line);
  7832. if (isTraceLine && !isInternalFrame) {
  7833. if (indentStackFrames && line.charAt(0) !== " ") {
  7834. line = " " + line;
  7835. }
  7836. ret.push(line);
  7837. }
  7838. }
  7839. return ret;
  7840. }
  7841. function stackFramesAsArray(error) {
  7842. var stack = error.stack.replace(/\s+$/g, "").split("\n");
  7843. for (var i = 0; i < stack.length; ++i) {
  7844. var line = stack[i];
  7845. if (" (No stack trace)" === line || stackFramePattern.test(line)) {
  7846. break;
  7847. }
  7848. }
  7849. if (i > 0 && error.name != "SyntaxError") {
  7850. stack = stack.slice(i);
  7851. }
  7852. return stack;
  7853. }
  7854. function parseStackAndMessage(error) {
  7855. var stack = error.stack;
  7856. var message = error.toString();
  7857. stack = typeof stack === "string" && stack.length > 0
  7858. ? stackFramesAsArray(error) : [" (No stack trace)"];
  7859. return {
  7860. message: message,
  7861. stack: error.name == "SyntaxError" ? stack : cleanStack(stack)
  7862. };
  7863. }
  7864. function formatAndLogError(error, title, isSoft) {
  7865. if (typeof console !== "undefined") {
  7866. var message;
  7867. if (util.isObject(error)) {
  7868. var stack = error.stack;
  7869. message = title + formatStack(stack, error);
  7870. } else {
  7871. message = title + String(error);
  7872. }
  7873. if (typeof printWarning === "function") {
  7874. printWarning(message, isSoft);
  7875. } else if (typeof console.log === "function" ||
  7876. typeof console.log === "object") {
  7877. console.log(message);
  7878. }
  7879. }
  7880. }
  7881. function fireRejectionEvent(name, localHandler, reason, promise) {
  7882. var localEventFired = false;
  7883. try {
  7884. if (typeof localHandler === "function") {
  7885. localEventFired = true;
  7886. if (name === "rejectionHandled") {
  7887. localHandler(promise);
  7888. } else {
  7889. localHandler(reason, promise);
  7890. }
  7891. }
  7892. } catch (e) {
  7893. async.throwLater(e);
  7894. }
  7895. if (name === "unhandledRejection") {
  7896. if (!activeFireEvent(name, reason, promise) && !localEventFired) {
  7897. formatAndLogError(reason, "Unhandled rejection ");
  7898. }
  7899. } else {
  7900. activeFireEvent(name, promise);
  7901. }
  7902. }
  7903. function formatNonError(obj) {
  7904. var str;
  7905. if (typeof obj === "function") {
  7906. str = "[function " +
  7907. (obj.name || "anonymous") +
  7908. "]";
  7909. } else {
  7910. str = obj && typeof obj.toString === "function"
  7911. ? obj.toString() : util.toString(obj);
  7912. var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
  7913. if (ruselessToString.test(str)) {
  7914. try {
  7915. var newStr = JSON.stringify(obj);
  7916. str = newStr;
  7917. }
  7918. catch(e) {
  7919. }
  7920. }
  7921. if (str.length === 0) {
  7922. str = "(empty array)";
  7923. }
  7924. }
  7925. return ("(<" + snip(str) + ">, no stack trace)");
  7926. }
  7927. function snip(str) {
  7928. var maxChars = 41;
  7929. if (str.length < maxChars) {
  7930. return str;
  7931. }
  7932. return str.substr(0, maxChars - 3) + "...";
  7933. }
  7934. function longStackTracesIsSupported() {
  7935. return typeof captureStackTrace === "function";
  7936. }
  7937. var shouldIgnore = function() { return false; };
  7938. var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
  7939. function parseLineInfo(line) {
  7940. var matches = line.match(parseLineInfoRegex);
  7941. if (matches) {
  7942. return {
  7943. fileName: matches[1],
  7944. line: parseInt(matches[2], 10)
  7945. };
  7946. }
  7947. }
  7948. function setBounds(firstLineError, lastLineError) {
  7949. if (!longStackTracesIsSupported()) return;
  7950. var firstStackLines = firstLineError.stack.split("\n");
  7951. var lastStackLines = lastLineError.stack.split("\n");
  7952. var firstIndex = -1;
  7953. var lastIndex = -1;
  7954. var firstFileName;
  7955. var lastFileName;
  7956. for (var i = 0; i < firstStackLines.length; ++i) {
  7957. var result = parseLineInfo(firstStackLines[i]);
  7958. if (result) {
  7959. firstFileName = result.fileName;
  7960. firstIndex = result.line;
  7961. break;
  7962. }
  7963. }
  7964. for (var i = 0; i < lastStackLines.length; ++i) {
  7965. var result = parseLineInfo(lastStackLines[i]);
  7966. if (result) {
  7967. lastFileName = result.fileName;
  7968. lastIndex = result.line;
  7969. break;
  7970. }
  7971. }
  7972. if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||
  7973. firstFileName !== lastFileName || firstIndex >= lastIndex) {
  7974. return;
  7975. }
  7976. shouldIgnore = function(line) {
  7977. if (bluebirdFramePattern.test(line)) return true;
  7978. var info = parseLineInfo(line);
  7979. if (info) {
  7980. if (info.fileName === firstFileName &&
  7981. (firstIndex <= info.line && info.line <= lastIndex)) {
  7982. return true;
  7983. }
  7984. }
  7985. return false;
  7986. };
  7987. }
  7988. function CapturedTrace(parent) {
  7989. this._parent = parent;
  7990. this._promisesCreated = 0;
  7991. var length = this._length = 1 + (parent === undefined ? 0 : parent._length);
  7992. captureStackTrace(this, CapturedTrace);
  7993. if (length > 32) this.uncycle();
  7994. }
  7995. util.inherits(CapturedTrace, Error);
  7996. Context.CapturedTrace = CapturedTrace;
  7997. CapturedTrace.prototype.uncycle = function() {
  7998. var length = this._length;
  7999. if (length < 2) return;
  8000. var nodes = [];
  8001. var stackToIndex = {};
  8002. for (var i = 0, node = this; node !== undefined; ++i) {
  8003. nodes.push(node);
  8004. node = node._parent;
  8005. }
  8006. length = this._length = i;
  8007. for (var i = length - 1; i >= 0; --i) {
  8008. var stack = nodes[i].stack;
  8009. if (stackToIndex[stack] === undefined) {
  8010. stackToIndex[stack] = i;
  8011. }
  8012. }
  8013. for (var i = 0; i < length; ++i) {
  8014. var currentStack = nodes[i].stack;
  8015. var index = stackToIndex[currentStack];
  8016. if (index !== undefined && index !== i) {
  8017. if (index > 0) {
  8018. nodes[index - 1]._parent = undefined;
  8019. nodes[index - 1]._length = 1;
  8020. }
  8021. nodes[i]._parent = undefined;
  8022. nodes[i]._length = 1;
  8023. var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
  8024. if (index < length - 1) {
  8025. cycleEdgeNode._parent = nodes[index + 1];
  8026. cycleEdgeNode._parent.uncycle();
  8027. cycleEdgeNode._length =
  8028. cycleEdgeNode._parent._length + 1;
  8029. } else {
  8030. cycleEdgeNode._parent = undefined;
  8031. cycleEdgeNode._length = 1;
  8032. }
  8033. var currentChildLength = cycleEdgeNode._length + 1;
  8034. for (var j = i - 2; j >= 0; --j) {
  8035. nodes[j]._length = currentChildLength;
  8036. currentChildLength++;
  8037. }
  8038. return;
  8039. }
  8040. }
  8041. };
  8042. CapturedTrace.prototype.attachExtraTrace = function(error) {
  8043. if (error.__stackCleaned__) return;
  8044. this.uncycle();
  8045. var parsed = parseStackAndMessage(error);
  8046. var message = parsed.message;
  8047. var stacks = [parsed.stack];
  8048. var trace = this;
  8049. while (trace !== undefined) {
  8050. stacks.push(cleanStack(trace.stack.split("\n")));
  8051. trace = trace._parent;
  8052. }
  8053. removeCommonRoots(stacks);
  8054. removeDuplicateOrEmptyJumps(stacks);
  8055. util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
  8056. util.notEnumerableProp(error, "__stackCleaned__", true);
  8057. };
  8058. var captureStackTrace = (function stackDetection() {
  8059. var v8stackFramePattern = /^\s*at\s*/;
  8060. var v8stackFormatter = function(stack, error) {
  8061. if (typeof stack === "string") return stack;
  8062. if (error.name !== undefined &&
  8063. error.message !== undefined) {
  8064. return error.toString();
  8065. }
  8066. return formatNonError(error);
  8067. };
  8068. if (typeof Error.stackTraceLimit === "number" &&
  8069. typeof Error.captureStackTrace === "function") {
  8070. Error.stackTraceLimit += 6;
  8071. stackFramePattern = v8stackFramePattern;
  8072. formatStack = v8stackFormatter;
  8073. var captureStackTrace = Error.captureStackTrace;
  8074. shouldIgnore = function(line) {
  8075. return bluebirdFramePattern.test(line);
  8076. };
  8077. return function(receiver, ignoreUntil) {
  8078. Error.stackTraceLimit += 6;
  8079. captureStackTrace(receiver, ignoreUntil);
  8080. Error.stackTraceLimit -= 6;
  8081. };
  8082. }
  8083. var err = new Error();
  8084. if (typeof err.stack === "string" &&
  8085. err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
  8086. stackFramePattern = /@/;
  8087. formatStack = v8stackFormatter;
  8088. indentStackFrames = true;
  8089. return function captureStackTrace(o) {
  8090. o.stack = new Error().stack;
  8091. };
  8092. }
  8093. var hasStackAfterThrow;
  8094. try { throw new Error(); }
  8095. catch(e) {
  8096. hasStackAfterThrow = ("stack" in e);
  8097. }
  8098. if (!("stack" in err) && hasStackAfterThrow &&
  8099. typeof Error.stackTraceLimit === "number") {
  8100. stackFramePattern = v8stackFramePattern;
  8101. formatStack = v8stackFormatter;
  8102. return function captureStackTrace(o) {
  8103. Error.stackTraceLimit += 6;
  8104. try { throw new Error(); }
  8105. catch(e) { o.stack = e.stack; }
  8106. Error.stackTraceLimit -= 6;
  8107. };
  8108. }
  8109. formatStack = function(stack, error) {
  8110. if (typeof stack === "string") return stack;
  8111. if ((typeof error === "object" ||
  8112. typeof error === "function") &&
  8113. error.name !== undefined &&
  8114. error.message !== undefined) {
  8115. return error.toString();
  8116. }
  8117. return formatNonError(error);
  8118. };
  8119. return null;
  8120. })([]);
  8121. if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
  8122. printWarning = function (message) {
  8123. console.warn(message);
  8124. };
  8125. if (util.isNode && process.stderr.isTTY) {
  8126. printWarning = function(message, isSoft) {
  8127. var color = isSoft ? "\u001b[33m" : "\u001b[31m";
  8128. console.warn(color + message + "\u001b[0m\n");
  8129. };
  8130. } else if (!util.isNode && typeof (new Error().stack) === "string") {
  8131. printWarning = function(message, isSoft) {
  8132. console.warn("%c" + message,
  8133. isSoft ? "color: darkorange" : "color: red");
  8134. };
  8135. }
  8136. }
  8137. var config = {
  8138. warnings: warnings,
  8139. longStackTraces: false,
  8140. cancellation: false,
  8141. monitoring: false
  8142. };
  8143. if (longStackTraces) Promise.longStackTraces();
  8144. return {
  8145. longStackTraces: function() {
  8146. return config.longStackTraces;
  8147. },
  8148. warnings: function() {
  8149. return config.warnings;
  8150. },
  8151. cancellation: function() {
  8152. return config.cancellation;
  8153. },
  8154. monitoring: function() {
  8155. return config.monitoring;
  8156. },
  8157. propagateFromFunction: function() {
  8158. return propagateFromFunction;
  8159. },
  8160. boundValueFunction: function() {
  8161. return boundValueFunction;
  8162. },
  8163. checkForgottenReturns: checkForgottenReturns,
  8164. setBounds: setBounds,
  8165. warn: warn,
  8166. deprecated: deprecated,
  8167. CapturedTrace: CapturedTrace,
  8168. fireDomEvent: fireDomEvent,
  8169. fireGlobalEvent: fireGlobalEvent
  8170. };
  8171. };
  8172. }).call(this,require('_process'))
  8173. },{"./errors":58,"./util":82,"_process":101}],56:[function(require,module,exports){
  8174. "use strict";
  8175. module.exports = function(Promise) {
  8176. function returner() {
  8177. return this.value;
  8178. }
  8179. function thrower() {
  8180. throw this.reason;
  8181. }
  8182. Promise.prototype["return"] =
  8183. Promise.prototype.thenReturn = function (value) {
  8184. if (value instanceof Promise) value.suppressUnhandledRejections();
  8185. return this._then(
  8186. returner, undefined, undefined, {value: value}, undefined);
  8187. };
  8188. Promise.prototype["throw"] =
  8189. Promise.prototype.thenThrow = function (reason) {
  8190. return this._then(
  8191. thrower, undefined, undefined, {reason: reason}, undefined);
  8192. };
  8193. Promise.prototype.catchThrow = function (reason) {
  8194. if (arguments.length <= 1) {
  8195. return this._then(
  8196. undefined, thrower, undefined, {reason: reason}, undefined);
  8197. } else {
  8198. var _reason = arguments[1];
  8199. var handler = function() {throw _reason;};
  8200. return this.caught(reason, handler);
  8201. }
  8202. };
  8203. Promise.prototype.catchReturn = function (value) {
  8204. if (arguments.length <= 1) {
  8205. if (value instanceof Promise) value.suppressUnhandledRejections();
  8206. return this._then(
  8207. undefined, returner, undefined, {value: value}, undefined);
  8208. } else {
  8209. var _value = arguments[1];
  8210. if (_value instanceof Promise) _value.suppressUnhandledRejections();
  8211. var handler = function() {return _value;};
  8212. return this.caught(value, handler);
  8213. }
  8214. };
  8215. };
  8216. },{}],57:[function(require,module,exports){
  8217. "use strict";
  8218. module.exports = function(Promise, INTERNAL) {
  8219. var PromiseReduce = Promise.reduce;
  8220. var PromiseAll = Promise.all;
  8221. function promiseAllThis() {
  8222. return PromiseAll(this);
  8223. }
  8224. function PromiseMapSeries(promises, fn) {
  8225. return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
  8226. }
  8227. Promise.prototype.each = function (fn) {
  8228. return PromiseReduce(this, fn, INTERNAL, 0)
  8229. ._then(promiseAllThis, undefined, undefined, this, undefined);
  8230. };
  8231. Promise.prototype.mapSeries = function (fn) {
  8232. return PromiseReduce(this, fn, INTERNAL, INTERNAL);
  8233. };
  8234. Promise.each = function (promises, fn) {
  8235. return PromiseReduce(promises, fn, INTERNAL, 0)
  8236. ._then(promiseAllThis, undefined, undefined, promises, undefined);
  8237. };
  8238. Promise.mapSeries = PromiseMapSeries;
  8239. };
  8240. },{}],58:[function(require,module,exports){
  8241. "use strict";
  8242. var es5 = require("./es5");
  8243. var Objectfreeze = es5.freeze;
  8244. var util = require("./util");
  8245. var inherits = util.inherits;
  8246. var notEnumerableProp = util.notEnumerableProp;
  8247. function subError(nameProperty, defaultMessage) {
  8248. function SubError(message) {
  8249. if (!(this instanceof SubError)) return new SubError(message);
  8250. notEnumerableProp(this, "message",
  8251. typeof message === "string" ? message : defaultMessage);
  8252. notEnumerableProp(this, "name", nameProperty);
  8253. if (Error.captureStackTrace) {
  8254. Error.captureStackTrace(this, this.constructor);
  8255. } else {
  8256. Error.call(this);
  8257. }
  8258. }
  8259. inherits(SubError, Error);
  8260. return SubError;
  8261. }
  8262. var _TypeError, _RangeError;
  8263. var Warning = subError("Warning", "warning");
  8264. var CancellationError = subError("CancellationError", "cancellation error");
  8265. var TimeoutError = subError("TimeoutError", "timeout error");
  8266. var AggregateError = subError("AggregateError", "aggregate error");
  8267. try {
  8268. _TypeError = TypeError;
  8269. _RangeError = RangeError;
  8270. } catch(e) {
  8271. _TypeError = subError("TypeError", "type error");
  8272. _RangeError = subError("RangeError", "range error");
  8273. }
  8274. var methods = ("join pop push shift unshift slice filter forEach some " +
  8275. "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
  8276. for (var i = 0; i < methods.length; ++i) {
  8277. if (typeof Array.prototype[methods[i]] === "function") {
  8278. AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
  8279. }
  8280. }
  8281. es5.defineProperty(AggregateError.prototype, "length", {
  8282. value: 0,
  8283. configurable: false,
  8284. writable: true,
  8285. enumerable: true
  8286. });
  8287. AggregateError.prototype["isOperational"] = true;
  8288. var level = 0;
  8289. AggregateError.prototype.toString = function() {
  8290. var indent = Array(level * 4 + 1).join(" ");
  8291. var ret = "\n" + indent + "AggregateError of:" + "\n";
  8292. level++;
  8293. indent = Array(level * 4 + 1).join(" ");
  8294. for (var i = 0; i < this.length; ++i) {
  8295. var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
  8296. var lines = str.split("\n");
  8297. for (var j = 0; j < lines.length; ++j) {
  8298. lines[j] = indent + lines[j];
  8299. }
  8300. str = lines.join("\n");
  8301. ret += str + "\n";
  8302. }
  8303. level--;
  8304. return ret;
  8305. };
  8306. function OperationalError(message) {
  8307. if (!(this instanceof OperationalError))
  8308. return new OperationalError(message);
  8309. notEnumerableProp(this, "name", "OperationalError");
  8310. notEnumerableProp(this, "message", message);
  8311. this.cause = message;
  8312. this["isOperational"] = true;
  8313. if (message instanceof Error) {
  8314. notEnumerableProp(this, "message", message.message);
  8315. notEnumerableProp(this, "stack", message.stack);
  8316. } else if (Error.captureStackTrace) {
  8317. Error.captureStackTrace(this, this.constructor);
  8318. }
  8319. }
  8320. inherits(OperationalError, Error);
  8321. var errorTypes = Error["__BluebirdErrorTypes__"];
  8322. if (!errorTypes) {
  8323. errorTypes = Objectfreeze({
  8324. CancellationError: CancellationError,
  8325. TimeoutError: TimeoutError,
  8326. OperationalError: OperationalError,
  8327. RejectionError: OperationalError,
  8328. AggregateError: AggregateError
  8329. });
  8330. es5.defineProperty(Error, "__BluebirdErrorTypes__", {
  8331. value: errorTypes,
  8332. writable: false,
  8333. enumerable: false,
  8334. configurable: false
  8335. });
  8336. }
  8337. module.exports = {
  8338. Error: Error,
  8339. TypeError: _TypeError,
  8340. RangeError: _RangeError,
  8341. CancellationError: errorTypes.CancellationError,
  8342. OperationalError: errorTypes.OperationalError,
  8343. TimeoutError: errorTypes.TimeoutError,
  8344. AggregateError: errorTypes.AggregateError,
  8345. Warning: Warning
  8346. };
  8347. },{"./es5":59,"./util":82}],59:[function(require,module,exports){
  8348. var isES5 = (function(){
  8349. "use strict";
  8350. return this === undefined;
  8351. })();
  8352. if (isES5) {
  8353. module.exports = {
  8354. freeze: Object.freeze,
  8355. defineProperty: Object.defineProperty,
  8356. getDescriptor: Object.getOwnPropertyDescriptor,
  8357. keys: Object.keys,
  8358. names: Object.getOwnPropertyNames,
  8359. getPrototypeOf: Object.getPrototypeOf,
  8360. isArray: Array.isArray,
  8361. isES5: isES5,
  8362. propertyIsWritable: function(obj, prop) {
  8363. var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
  8364. return !!(!descriptor || descriptor.writable || descriptor.set);
  8365. }
  8366. };
  8367. } else {
  8368. var has = {}.hasOwnProperty;
  8369. var str = {}.toString;
  8370. var proto = {}.constructor.prototype;
  8371. var ObjectKeys = function (o) {
  8372. var ret = [];
  8373. for (var key in o) {
  8374. if (has.call(o, key)) {
  8375. ret.push(key);
  8376. }
  8377. }
  8378. return ret;
  8379. };
  8380. var ObjectGetDescriptor = function(o, key) {
  8381. return {value: o[key]};
  8382. };
  8383. var ObjectDefineProperty = function (o, key, desc) {
  8384. o[key] = desc.value;
  8385. return o;
  8386. };
  8387. var ObjectFreeze = function (obj) {
  8388. return obj;
  8389. };
  8390. var ObjectGetPrototypeOf = function (obj) {
  8391. try {
  8392. return Object(obj).constructor.prototype;
  8393. }
  8394. catch (e) {
  8395. return proto;
  8396. }
  8397. };
  8398. var ArrayIsArray = function (obj) {
  8399. try {
  8400. return str.call(obj) === "[object Array]";
  8401. }
  8402. catch(e) {
  8403. return false;
  8404. }
  8405. };
  8406. module.exports = {
  8407. isArray: ArrayIsArray,
  8408. keys: ObjectKeys,
  8409. names: ObjectKeys,
  8410. defineProperty: ObjectDefineProperty,
  8411. getDescriptor: ObjectGetDescriptor,
  8412. freeze: ObjectFreeze,
  8413. getPrototypeOf: ObjectGetPrototypeOf,
  8414. isES5: isES5,
  8415. propertyIsWritable: function() {
  8416. return true;
  8417. }
  8418. };
  8419. }
  8420. },{}],60:[function(require,module,exports){
  8421. "use strict";
  8422. module.exports = function(Promise, INTERNAL) {
  8423. var PromiseMap = Promise.map;
  8424. Promise.prototype.filter = function (fn, options) {
  8425. return PromiseMap(this, fn, options, INTERNAL);
  8426. };
  8427. Promise.filter = function (promises, fn, options) {
  8428. return PromiseMap(promises, fn, options, INTERNAL);
  8429. };
  8430. };
  8431. },{}],61:[function(require,module,exports){
  8432. "use strict";
  8433. module.exports = function(Promise, tryConvertToPromise) {
  8434. var util = require("./util");
  8435. var CancellationError = Promise.CancellationError;
  8436. var errorObj = util.errorObj;
  8437. function PassThroughHandlerContext(promise, type, handler) {
  8438. this.promise = promise;
  8439. this.type = type;
  8440. this.handler = handler;
  8441. this.called = false;
  8442. this.cancelPromise = null;
  8443. }
  8444. PassThroughHandlerContext.prototype.isFinallyHandler = function() {
  8445. return this.type === 0;
  8446. };
  8447. function FinallyHandlerCancelReaction(finallyHandler) {
  8448. this.finallyHandler = finallyHandler;
  8449. }
  8450. FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
  8451. checkCancel(this.finallyHandler);
  8452. };
  8453. function checkCancel(ctx, reason) {
  8454. if (ctx.cancelPromise != null) {
  8455. if (arguments.length > 1) {
  8456. ctx.cancelPromise._reject(reason);
  8457. } else {
  8458. ctx.cancelPromise._cancel();
  8459. }
  8460. ctx.cancelPromise = null;
  8461. return true;
  8462. }
  8463. return false;
  8464. }
  8465. function succeed() {
  8466. return finallyHandler.call(this, this.promise._target()._settledValue());
  8467. }
  8468. function fail(reason) {
  8469. if (checkCancel(this, reason)) return;
  8470. errorObj.e = reason;
  8471. return errorObj;
  8472. }
  8473. function finallyHandler(reasonOrValue) {
  8474. var promise = this.promise;
  8475. var handler = this.handler;
  8476. if (!this.called) {
  8477. this.called = true;
  8478. var ret = this.isFinallyHandler()
  8479. ? handler.call(promise._boundValue())
  8480. : handler.call(promise._boundValue(), reasonOrValue);
  8481. if (ret !== undefined) {
  8482. promise._setReturnedNonUndefined();
  8483. var maybePromise = tryConvertToPromise(ret, promise);
  8484. if (maybePromise instanceof Promise) {
  8485. if (this.cancelPromise != null) {
  8486. if (maybePromise._isCancelled()) {
  8487. var reason =
  8488. new CancellationError("late cancellation observer");
  8489. promise._attachExtraTrace(reason);
  8490. errorObj.e = reason;
  8491. return errorObj;
  8492. } else if (maybePromise.isPending()) {
  8493. maybePromise._attachCancellationCallback(
  8494. new FinallyHandlerCancelReaction(this));
  8495. }
  8496. }
  8497. return maybePromise._then(
  8498. succeed, fail, undefined, this, undefined);
  8499. }
  8500. }
  8501. }
  8502. if (promise.isRejected()) {
  8503. checkCancel(this);
  8504. errorObj.e = reasonOrValue;
  8505. return errorObj;
  8506. } else {
  8507. checkCancel(this);
  8508. return reasonOrValue;
  8509. }
  8510. }
  8511. Promise.prototype._passThrough = function(handler, type, success, fail) {
  8512. if (typeof handler !== "function") return this.then();
  8513. return this._then(success,
  8514. fail,
  8515. undefined,
  8516. new PassThroughHandlerContext(this, type, handler),
  8517. undefined);
  8518. };
  8519. Promise.prototype.lastly =
  8520. Promise.prototype["finally"] = function (handler) {
  8521. return this._passThrough(handler,
  8522. 0,
  8523. finallyHandler,
  8524. finallyHandler);
  8525. };
  8526. Promise.prototype.tap = function (handler) {
  8527. return this._passThrough(handler, 1, finallyHandler);
  8528. };
  8529. return PassThroughHandlerContext;
  8530. };
  8531. },{"./util":82}],62:[function(require,module,exports){
  8532. "use strict";
  8533. module.exports = function(Promise,
  8534. apiRejection,
  8535. INTERNAL,
  8536. tryConvertToPromise,
  8537. Proxyable,
  8538. debug) {
  8539. var errors = require("./errors");
  8540. var TypeError = errors.TypeError;
  8541. var util = require("./util");
  8542. var errorObj = util.errorObj;
  8543. var tryCatch = util.tryCatch;
  8544. var yieldHandlers = [];
  8545. function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
  8546. for (var i = 0; i < yieldHandlers.length; ++i) {
  8547. traceParent._pushContext();
  8548. var result = tryCatch(yieldHandlers[i])(value);
  8549. traceParent._popContext();
  8550. if (result === errorObj) {
  8551. traceParent._pushContext();
  8552. var ret = Promise.reject(errorObj.e);
  8553. traceParent._popContext();
  8554. return ret;
  8555. }
  8556. var maybePromise = tryConvertToPromise(result, traceParent);
  8557. if (maybePromise instanceof Promise) return maybePromise;
  8558. }
  8559. return null;
  8560. }
  8561. function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
  8562. if (debug.cancellation()) {
  8563. var internal = new Promise(INTERNAL);
  8564. var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);
  8565. this._promise = internal.lastly(function() {
  8566. return _finallyPromise;
  8567. });
  8568. internal._captureStackTrace();
  8569. internal._setOnCancel(this);
  8570. } else {
  8571. var promise = this._promise = new Promise(INTERNAL);
  8572. promise._captureStackTrace();
  8573. }
  8574. this._stack = stack;
  8575. this._generatorFunction = generatorFunction;
  8576. this._receiver = receiver;
  8577. this._generator = undefined;
  8578. this._yieldHandlers = typeof yieldHandler === "function"
  8579. ? [yieldHandler].concat(yieldHandlers)
  8580. : yieldHandlers;
  8581. this._yieldedPromise = null;
  8582. this._cancellationPhase = false;
  8583. }
  8584. util.inherits(PromiseSpawn, Proxyable);
  8585. PromiseSpawn.prototype._isResolved = function() {
  8586. return this._promise === null;
  8587. };
  8588. PromiseSpawn.prototype._cleanup = function() {
  8589. this._promise = this._generator = null;
  8590. if (debug.cancellation() && this._finallyPromise !== null) {
  8591. this._finallyPromise._fulfill();
  8592. this._finallyPromise = null;
  8593. }
  8594. };
  8595. PromiseSpawn.prototype._promiseCancelled = function() {
  8596. if (this._isResolved()) return;
  8597. var implementsReturn = typeof this._generator["return"] !== "undefined";
  8598. var result;
  8599. if (!implementsReturn) {
  8600. var reason = new Promise.CancellationError(
  8601. "generator .return() sentinel");
  8602. Promise.coroutine.returnSentinel = reason;
  8603. this._promise._attachExtraTrace(reason);
  8604. this._promise._pushContext();
  8605. result = tryCatch(this._generator["throw"]).call(this._generator,
  8606. reason);
  8607. this._promise._popContext();
  8608. } else {
  8609. this._promise._pushContext();
  8610. result = tryCatch(this._generator["return"]).call(this._generator,
  8611. undefined);
  8612. this._promise._popContext();
  8613. }
  8614. this._cancellationPhase = true;
  8615. this._yieldedPromise = null;
  8616. this._continue(result);
  8617. };
  8618. PromiseSpawn.prototype._promiseFulfilled = function(value) {
  8619. this._yieldedPromise = null;
  8620. this._promise._pushContext();
  8621. var result = tryCatch(this._generator.next).call(this._generator, value);
  8622. this._promise._popContext();
  8623. this._continue(result);
  8624. };
  8625. PromiseSpawn.prototype._promiseRejected = function(reason) {
  8626. this._yieldedPromise = null;
  8627. this._promise._attachExtraTrace(reason);
  8628. this._promise._pushContext();
  8629. var result = tryCatch(this._generator["throw"])
  8630. .call(this._generator, reason);
  8631. this._promise._popContext();
  8632. this._continue(result);
  8633. };
  8634. PromiseSpawn.prototype._resultCancelled = function() {
  8635. if (this._yieldedPromise instanceof Promise) {
  8636. var promise = this._yieldedPromise;
  8637. this._yieldedPromise = null;
  8638. promise.cancel();
  8639. }
  8640. };
  8641. PromiseSpawn.prototype.promise = function () {
  8642. return this._promise;
  8643. };
  8644. PromiseSpawn.prototype._run = function () {
  8645. this._generator = this._generatorFunction.call(this._receiver);
  8646. this._receiver =
  8647. this._generatorFunction = undefined;
  8648. this._promiseFulfilled(undefined);
  8649. };
  8650. PromiseSpawn.prototype._continue = function (result) {
  8651. var promise = this._promise;
  8652. if (result === errorObj) {
  8653. this._cleanup();
  8654. if (this._cancellationPhase) {
  8655. return promise.cancel();
  8656. } else {
  8657. return promise._rejectCallback(result.e, false);
  8658. }
  8659. }
  8660. var value = result.value;
  8661. if (result.done === true) {
  8662. this._cleanup();
  8663. if (this._cancellationPhase) {
  8664. return promise.cancel();
  8665. } else {
  8666. return promise._resolveCallback(value);
  8667. }
  8668. } else {
  8669. var maybePromise = tryConvertToPromise(value, this._promise);
  8670. if (!(maybePromise instanceof Promise)) {
  8671. maybePromise =
  8672. promiseFromYieldHandler(maybePromise,
  8673. this._yieldHandlers,
  8674. this._promise);
  8675. if (maybePromise === null) {
  8676. this._promiseRejected(
  8677. new TypeError(
  8678. "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", value) +
  8679. "From coroutine:\u000a" +
  8680. this._stack.split("\n").slice(1, -7).join("\n")
  8681. )
  8682. );
  8683. return;
  8684. }
  8685. }
  8686. maybePromise = maybePromise._target();
  8687. var bitField = maybePromise._bitField;
  8688. ;
  8689. if (((bitField & 50397184) === 0)) {
  8690. this._yieldedPromise = maybePromise;
  8691. maybePromise._proxy(this, null);
  8692. } else if (((bitField & 33554432) !== 0)) {
  8693. Promise._async.invoke(
  8694. this._promiseFulfilled, this, maybePromise._value()
  8695. );
  8696. } else if (((bitField & 16777216) !== 0)) {
  8697. Promise._async.invoke(
  8698. this._promiseRejected, this, maybePromise._reason()
  8699. );
  8700. } else {
  8701. this._promiseCancelled();
  8702. }
  8703. }
  8704. };
  8705. Promise.coroutine = function (generatorFunction, options) {
  8706. if (typeof generatorFunction !== "function") {
  8707. throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  8708. }
  8709. var yieldHandler = Object(options).yieldHandler;
  8710. var PromiseSpawn$ = PromiseSpawn;
  8711. var stack = new Error().stack;
  8712. return function () {
  8713. var generator = generatorFunction.apply(this, arguments);
  8714. var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,
  8715. stack);
  8716. var ret = spawn.promise();
  8717. spawn._generator = generator;
  8718. spawn._promiseFulfilled(undefined);
  8719. return ret;
  8720. };
  8721. };
  8722. Promise.coroutine.addYieldHandler = function(fn) {
  8723. if (typeof fn !== "function") {
  8724. throw new TypeError("expecting a function but got " + util.classString(fn));
  8725. }
  8726. yieldHandlers.push(fn);
  8727. };
  8728. Promise.spawn = function (generatorFunction) {
  8729. debug.deprecated("Promise.spawn()", "Promise.coroutine()");
  8730. if (typeof generatorFunction !== "function") {
  8731. return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  8732. }
  8733. var spawn = new PromiseSpawn(generatorFunction, this);
  8734. var ret = spawn.promise();
  8735. spawn._run(Promise.spawn);
  8736. return ret;
  8737. };
  8738. };
  8739. },{"./errors":58,"./util":82}],63:[function(require,module,exports){
  8740. "use strict";
  8741. module.exports =
  8742. function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,
  8743. getDomain) {
  8744. var util = require("./util");
  8745. var canEvaluate = util.canEvaluate;
  8746. var tryCatch = util.tryCatch;
  8747. var errorObj = util.errorObj;
  8748. var reject;
  8749. if (!false) {
  8750. if (canEvaluate) {
  8751. var thenCallback = function(i) {
  8752. return new Function("value", "holder", " \n\
  8753. 'use strict'; \n\
  8754. holder.pIndex = value; \n\
  8755. holder.checkFulfillment(this); \n\
  8756. ".replace(/Index/g, i));
  8757. };
  8758. var promiseSetter = function(i) {
  8759. return new Function("promise", "holder", " \n\
  8760. 'use strict'; \n\
  8761. holder.pIndex = promise; \n\
  8762. ".replace(/Index/g, i));
  8763. };
  8764. var generateHolderClass = function(total) {
  8765. var props = new Array(total);
  8766. for (var i = 0; i < props.length; ++i) {
  8767. props[i] = "this.p" + (i+1);
  8768. }
  8769. var assignment = props.join(" = ") + " = null;";
  8770. var cancellationCode= "var promise;\n" + props.map(function(prop) {
  8771. return " \n\
  8772. promise = " + prop + "; \n\
  8773. if (promise instanceof Promise) { \n\
  8774. promise.cancel(); \n\
  8775. } \n\
  8776. ";
  8777. }).join("\n");
  8778. var passedArguments = props.join(", ");
  8779. var name = "Holder$" + total;
  8780. var code = "return function(tryCatch, errorObj, Promise, async) { \n\
  8781. 'use strict'; \n\
  8782. function [TheName](fn) { \n\
  8783. [TheProperties] \n\
  8784. this.fn = fn; \n\
  8785. this.asyncNeeded = true; \n\
  8786. this.now = 0; \n\
  8787. } \n\
  8788. \n\
  8789. [TheName].prototype._callFunction = function(promise) { \n\
  8790. promise._pushContext(); \n\
  8791. var ret = tryCatch(this.fn)([ThePassedArguments]); \n\
  8792. promise._popContext(); \n\
  8793. if (ret === errorObj) { \n\
  8794. promise._rejectCallback(ret.e, false); \n\
  8795. } else { \n\
  8796. promise._resolveCallback(ret); \n\
  8797. } \n\
  8798. }; \n\
  8799. \n\
  8800. [TheName].prototype.checkFulfillment = function(promise) { \n\
  8801. var now = ++this.now; \n\
  8802. if (now === [TheTotal]) { \n\
  8803. if (this.asyncNeeded) { \n\
  8804. async.invoke(this._callFunction, this, promise); \n\
  8805. } else { \n\
  8806. this._callFunction(promise); \n\
  8807. } \n\
  8808. \n\
  8809. } \n\
  8810. }; \n\
  8811. \n\
  8812. [TheName].prototype._resultCancelled = function() { \n\
  8813. [CancellationCode] \n\
  8814. }; \n\
  8815. \n\
  8816. return [TheName]; \n\
  8817. }(tryCatch, errorObj, Promise, async); \n\
  8818. ";
  8819. code = code.replace(/\[TheName\]/g, name)
  8820. .replace(/\[TheTotal\]/g, total)
  8821. .replace(/\[ThePassedArguments\]/g, passedArguments)
  8822. .replace(/\[TheProperties\]/g, assignment)
  8823. .replace(/\[CancellationCode\]/g, cancellationCode);
  8824. return new Function("tryCatch", "errorObj", "Promise", "async", code)
  8825. (tryCatch, errorObj, Promise, async);
  8826. };
  8827. var holderClasses = [];
  8828. var thenCallbacks = [];
  8829. var promiseSetters = [];
  8830. for (var i = 0; i < 8; ++i) {
  8831. holderClasses.push(generateHolderClass(i + 1));
  8832. thenCallbacks.push(thenCallback(i + 1));
  8833. promiseSetters.push(promiseSetter(i + 1));
  8834. }
  8835. reject = function (reason) {
  8836. this._reject(reason);
  8837. };
  8838. }}
  8839. Promise.join = function () {
  8840. var last = arguments.length - 1;
  8841. var fn;
  8842. if (last > 0 && typeof arguments[last] === "function") {
  8843. fn = arguments[last];
  8844. if (!false) {
  8845. if (last <= 8 && canEvaluate) {
  8846. var ret = new Promise(INTERNAL);
  8847. ret._captureStackTrace();
  8848. var HolderClass = holderClasses[last - 1];
  8849. var holder = new HolderClass(fn);
  8850. var callbacks = thenCallbacks;
  8851. for (var i = 0; i < last; ++i) {
  8852. var maybePromise = tryConvertToPromise(arguments[i], ret);
  8853. if (maybePromise instanceof Promise) {
  8854. maybePromise = maybePromise._target();
  8855. var bitField = maybePromise._bitField;
  8856. ;
  8857. if (((bitField & 50397184) === 0)) {
  8858. maybePromise._then(callbacks[i], reject,
  8859. undefined, ret, holder);
  8860. promiseSetters[i](maybePromise, holder);
  8861. holder.asyncNeeded = false;
  8862. } else if (((bitField & 33554432) !== 0)) {
  8863. callbacks[i].call(ret,
  8864. maybePromise._value(), holder);
  8865. } else if (((bitField & 16777216) !== 0)) {
  8866. ret._reject(maybePromise._reason());
  8867. } else {
  8868. ret._cancel();
  8869. }
  8870. } else {
  8871. callbacks[i].call(ret, maybePromise, holder);
  8872. }
  8873. }
  8874. if (!ret._isFateSealed()) {
  8875. if (holder.asyncNeeded) {
  8876. var domain = getDomain();
  8877. if (domain !== null) {
  8878. holder.fn = util.domainBind(domain, holder.fn);
  8879. }
  8880. }
  8881. ret._setAsyncGuaranteed();
  8882. ret._setOnCancel(holder);
  8883. }
  8884. return ret;
  8885. }
  8886. }
  8887. }
  8888. var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];};
  8889. if (fn) args.pop();
  8890. var ret = new PromiseArray(args).promise();
  8891. return fn !== undefined ? ret.spread(fn) : ret;
  8892. };
  8893. };
  8894. },{"./util":82}],64:[function(require,module,exports){
  8895. "use strict";
  8896. module.exports = function(Promise,
  8897. PromiseArray,
  8898. apiRejection,
  8899. tryConvertToPromise,
  8900. INTERNAL,
  8901. debug) {
  8902. var getDomain = Promise._getDomain;
  8903. var util = require("./util");
  8904. var tryCatch = util.tryCatch;
  8905. var errorObj = util.errorObj;
  8906. var async = Promise._async;
  8907. function MappingPromiseArray(promises, fn, limit, _filter) {
  8908. this.constructor$(promises);
  8909. this._promise._captureStackTrace();
  8910. var domain = getDomain();
  8911. this._callback = domain === null ? fn : util.domainBind(domain, fn);
  8912. this._preservedValues = _filter === INTERNAL
  8913. ? new Array(this.length())
  8914. : null;
  8915. this._limit = limit;
  8916. this._inFlight = 0;
  8917. this._queue = [];
  8918. async.invoke(this._asyncInit, this, undefined);
  8919. }
  8920. util.inherits(MappingPromiseArray, PromiseArray);
  8921. MappingPromiseArray.prototype._asyncInit = function() {
  8922. this._init$(undefined, -2);
  8923. };
  8924. MappingPromiseArray.prototype._init = function () {};
  8925. MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
  8926. var values = this._values;
  8927. var length = this.length();
  8928. var preservedValues = this._preservedValues;
  8929. var limit = this._limit;
  8930. if (index < 0) {
  8931. index = (index * -1) - 1;
  8932. values[index] = value;
  8933. if (limit >= 1) {
  8934. this._inFlight--;
  8935. this._drainQueue();
  8936. if (this._isResolved()) return true;
  8937. }
  8938. } else {
  8939. if (limit >= 1 && this._inFlight >= limit) {
  8940. values[index] = value;
  8941. this._queue.push(index);
  8942. return false;
  8943. }
  8944. if (preservedValues !== null) preservedValues[index] = value;
  8945. var promise = this._promise;
  8946. var callback = this._callback;
  8947. var receiver = promise._boundValue();
  8948. promise._pushContext();
  8949. var ret = tryCatch(callback).call(receiver, value, index, length);
  8950. var promiseCreated = promise._popContext();
  8951. debug.checkForgottenReturns(
  8952. ret,
  8953. promiseCreated,
  8954. preservedValues !== null ? "Promise.filter" : "Promise.map",
  8955. promise
  8956. );
  8957. if (ret === errorObj) {
  8958. this._reject(ret.e);
  8959. return true;
  8960. }
  8961. var maybePromise = tryConvertToPromise(ret, this._promise);
  8962. if (maybePromise instanceof Promise) {
  8963. maybePromise = maybePromise._target();
  8964. var bitField = maybePromise._bitField;
  8965. ;
  8966. if (((bitField & 50397184) === 0)) {
  8967. if (limit >= 1) this._inFlight++;
  8968. values[index] = maybePromise;
  8969. maybePromise._proxy(this, (index + 1) * -1);
  8970. return false;
  8971. } else if (((bitField & 33554432) !== 0)) {
  8972. ret = maybePromise._value();
  8973. } else if (((bitField & 16777216) !== 0)) {
  8974. this._reject(maybePromise._reason());
  8975. return true;
  8976. } else {
  8977. this._cancel();
  8978. return true;
  8979. }
  8980. }
  8981. values[index] = ret;
  8982. }
  8983. var totalResolved = ++this._totalResolved;
  8984. if (totalResolved >= length) {
  8985. if (preservedValues !== null) {
  8986. this._filter(values, preservedValues);
  8987. } else {
  8988. this._resolve(values);
  8989. }
  8990. return true;
  8991. }
  8992. return false;
  8993. };
  8994. MappingPromiseArray.prototype._drainQueue = function () {
  8995. var queue = this._queue;
  8996. var limit = this._limit;
  8997. var values = this._values;
  8998. while (queue.length > 0 && this._inFlight < limit) {
  8999. if (this._isResolved()) return;
  9000. var index = queue.pop();
  9001. this._promiseFulfilled(values[index], index);
  9002. }
  9003. };
  9004. MappingPromiseArray.prototype._filter = function (booleans, values) {
  9005. var len = values.length;
  9006. var ret = new Array(len);
  9007. var j = 0;
  9008. for (var i = 0; i < len; ++i) {
  9009. if (booleans[i]) ret[j++] = values[i];
  9010. }
  9011. ret.length = j;
  9012. this._resolve(ret);
  9013. };
  9014. MappingPromiseArray.prototype.preservedValues = function () {
  9015. return this._preservedValues;
  9016. };
  9017. function map(promises, fn, options, _filter) {
  9018. if (typeof fn !== "function") {
  9019. return apiRejection("expecting a function but got " + util.classString(fn));
  9020. }
  9021. var limit = 0;
  9022. if (options !== undefined) {
  9023. if (typeof options === "object" && options !== null) {
  9024. if (typeof options.concurrency !== "number") {
  9025. return Promise.reject(
  9026. new TypeError("'concurrency' must be a number but it is " +
  9027. util.classString(options.concurrency)));
  9028. }
  9029. limit = options.concurrency;
  9030. } else {
  9031. return Promise.reject(new TypeError(
  9032. "options argument must be an object but it is " +
  9033. util.classString(options)));
  9034. }
  9035. }
  9036. limit = typeof limit === "number" &&
  9037. isFinite(limit) && limit >= 1 ? limit : 0;
  9038. return new MappingPromiseArray(promises, fn, limit, _filter).promise();
  9039. }
  9040. Promise.prototype.map = function (fn, options) {
  9041. return map(this, fn, options, null);
  9042. };
  9043. Promise.map = function (promises, fn, options, _filter) {
  9044. return map(promises, fn, options, _filter);
  9045. };
  9046. };
  9047. },{"./util":82}],65:[function(require,module,exports){
  9048. "use strict";
  9049. module.exports =
  9050. function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
  9051. var util = require("./util");
  9052. var tryCatch = util.tryCatch;
  9053. Promise.method = function (fn) {
  9054. if (typeof fn !== "function") {
  9055. throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
  9056. }
  9057. return function () {
  9058. var ret = new Promise(INTERNAL);
  9059. ret._captureStackTrace();
  9060. ret._pushContext();
  9061. var value = tryCatch(fn).apply(this, arguments);
  9062. var promiseCreated = ret._popContext();
  9063. debug.checkForgottenReturns(
  9064. value, promiseCreated, "Promise.method", ret);
  9065. ret._resolveFromSyncValue(value);
  9066. return ret;
  9067. };
  9068. };
  9069. Promise.attempt = Promise["try"] = function (fn) {
  9070. if (typeof fn !== "function") {
  9071. return apiRejection("expecting a function but got " + util.classString(fn));
  9072. }
  9073. var ret = new Promise(INTERNAL);
  9074. ret._captureStackTrace();
  9075. ret._pushContext();
  9076. var value;
  9077. if (arguments.length > 1) {
  9078. debug.deprecated("calling Promise.try with more than 1 argument");
  9079. var arg = arguments[1];
  9080. var ctx = arguments[2];
  9081. value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
  9082. : tryCatch(fn).call(ctx, arg);
  9083. } else {
  9084. value = tryCatch(fn)();
  9085. }
  9086. var promiseCreated = ret._popContext();
  9087. debug.checkForgottenReturns(
  9088. value, promiseCreated, "Promise.try", ret);
  9089. ret._resolveFromSyncValue(value);
  9090. return ret;
  9091. };
  9092. Promise.prototype._resolveFromSyncValue = function (value) {
  9093. if (value === util.errorObj) {
  9094. this._rejectCallback(value.e, false);
  9095. } else {
  9096. this._resolveCallback(value, true);
  9097. }
  9098. };
  9099. };
  9100. },{"./util":82}],66:[function(require,module,exports){
  9101. "use strict";
  9102. var util = require("./util");
  9103. var maybeWrapAsError = util.maybeWrapAsError;
  9104. var errors = require("./errors");
  9105. var OperationalError = errors.OperationalError;
  9106. var es5 = require("./es5");
  9107. function isUntypedError(obj) {
  9108. return obj instanceof Error &&
  9109. es5.getPrototypeOf(obj) === Error.prototype;
  9110. }
  9111. var rErrorKey = /^(?:name|message|stack|cause)$/;
  9112. function wrapAsOperationalError(obj) {
  9113. var ret;
  9114. if (isUntypedError(obj)) {
  9115. ret = new OperationalError(obj);
  9116. ret.name = obj.name;
  9117. ret.message = obj.message;
  9118. ret.stack = obj.stack;
  9119. var keys = es5.keys(obj);
  9120. for (var i = 0; i < keys.length; ++i) {
  9121. var key = keys[i];
  9122. if (!rErrorKey.test(key)) {
  9123. ret[key] = obj[key];
  9124. }
  9125. }
  9126. return ret;
  9127. }
  9128. util.markAsOriginatingFromRejection(obj);
  9129. return obj;
  9130. }
  9131. function nodebackForPromise(promise, multiArgs) {
  9132. return function(err, value) {
  9133. if (promise === null) return;
  9134. if (err) {
  9135. var wrapped = wrapAsOperationalError(maybeWrapAsError(err));
  9136. promise._attachExtraTrace(wrapped);
  9137. promise._reject(wrapped);
  9138. } else if (!multiArgs) {
  9139. promise._fulfill(value);
  9140. } else {
  9141. var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};
  9142. promise._fulfill(args);
  9143. }
  9144. promise = null;
  9145. };
  9146. }
  9147. module.exports = nodebackForPromise;
  9148. },{"./errors":58,"./es5":59,"./util":82}],67:[function(require,module,exports){
  9149. "use strict";
  9150. module.exports = function(Promise) {
  9151. var util = require("./util");
  9152. var async = Promise._async;
  9153. var tryCatch = util.tryCatch;
  9154. var errorObj = util.errorObj;
  9155. function spreadAdapter(val, nodeback) {
  9156. var promise = this;
  9157. if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);
  9158. var ret =
  9159. tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));
  9160. if (ret === errorObj) {
  9161. async.throwLater(ret.e);
  9162. }
  9163. }
  9164. function successAdapter(val, nodeback) {
  9165. var promise = this;
  9166. var receiver = promise._boundValue();
  9167. var ret = val === undefined
  9168. ? tryCatch(nodeback).call(receiver, null)
  9169. : tryCatch(nodeback).call(receiver, null, val);
  9170. if (ret === errorObj) {
  9171. async.throwLater(ret.e);
  9172. }
  9173. }
  9174. function errorAdapter(reason, nodeback) {
  9175. var promise = this;
  9176. if (!reason) {
  9177. var newReason = new Error(reason + "");
  9178. newReason.cause = reason;
  9179. reason = newReason;
  9180. }
  9181. var ret = tryCatch(nodeback).call(promise._boundValue(), reason);
  9182. if (ret === errorObj) {
  9183. async.throwLater(ret.e);
  9184. }
  9185. }
  9186. Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,
  9187. options) {
  9188. if (typeof nodeback == "function") {
  9189. var adapter = successAdapter;
  9190. if (options !== undefined && Object(options).spread) {
  9191. adapter = spreadAdapter;
  9192. }
  9193. this._then(
  9194. adapter,
  9195. errorAdapter,
  9196. undefined,
  9197. this,
  9198. nodeback
  9199. );
  9200. }
  9201. return this;
  9202. };
  9203. };
  9204. },{"./util":82}],68:[function(require,module,exports){
  9205. (function (process){
  9206. "use strict";
  9207. module.exports = function() {
  9208. var makeSelfResolutionError = function () {
  9209. return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  9210. };
  9211. var reflectHandler = function() {
  9212. return new Promise.PromiseInspection(this._target());
  9213. };
  9214. var apiRejection = function(msg) {
  9215. return Promise.reject(new TypeError(msg));
  9216. };
  9217. function Proxyable() {}
  9218. var UNDEFINED_BINDING = {};
  9219. var util = require("./util");
  9220. var getDomain;
  9221. if (util.isNode) {
  9222. getDomain = function() {
  9223. var ret = process.domain;
  9224. if (ret === undefined) ret = null;
  9225. return ret;
  9226. };
  9227. } else {
  9228. getDomain = function() {
  9229. return null;
  9230. };
  9231. }
  9232. util.notEnumerableProp(Promise, "_getDomain", getDomain);
  9233. var es5 = require("./es5");
  9234. var Async = require("./async");
  9235. var async = new Async();
  9236. es5.defineProperty(Promise, "_async", {value: async});
  9237. var errors = require("./errors");
  9238. var TypeError = Promise.TypeError = errors.TypeError;
  9239. Promise.RangeError = errors.RangeError;
  9240. var CancellationError = Promise.CancellationError = errors.CancellationError;
  9241. Promise.TimeoutError = errors.TimeoutError;
  9242. Promise.OperationalError = errors.OperationalError;
  9243. Promise.RejectionError = errors.OperationalError;
  9244. Promise.AggregateError = errors.AggregateError;
  9245. var INTERNAL = function(){};
  9246. var APPLY = {};
  9247. var NEXT_FILTER = {};
  9248. var tryConvertToPromise = require("./thenables")(Promise, INTERNAL);
  9249. var PromiseArray =
  9250. require("./promise_array")(Promise, INTERNAL,
  9251. tryConvertToPromise, apiRejection, Proxyable);
  9252. var Context = require("./context")(Promise);
  9253. /*jshint unused:false*/
  9254. var createContext = Context.create;
  9255. var debug = require("./debuggability")(Promise, Context);
  9256. var CapturedTrace = debug.CapturedTrace;
  9257. var PassThroughHandlerContext =
  9258. require("./finally")(Promise, tryConvertToPromise);
  9259. var catchFilter = require("./catch_filter")(NEXT_FILTER);
  9260. var nodebackForPromise = require("./nodeback");
  9261. var errorObj = util.errorObj;
  9262. var tryCatch = util.tryCatch;
  9263. function check(self, executor) {
  9264. if (typeof executor !== "function") {
  9265. throw new TypeError("expecting a function but got " + util.classString(executor));
  9266. }
  9267. if (self.constructor !== Promise) {
  9268. throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  9269. }
  9270. }
  9271. function Promise(executor) {
  9272. this._bitField = 0;
  9273. this._fulfillmentHandler0 = undefined;
  9274. this._rejectionHandler0 = undefined;
  9275. this._promise0 = undefined;
  9276. this._receiver0 = undefined;
  9277. if (executor !== INTERNAL) {
  9278. check(this, executor);
  9279. this._resolveFromExecutor(executor);
  9280. }
  9281. this._promiseCreated();
  9282. this._fireEvent("promiseCreated", this);
  9283. }
  9284. Promise.prototype.toString = function () {
  9285. return "[object Promise]";
  9286. };
  9287. Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
  9288. var len = arguments.length;
  9289. if (len > 1) {
  9290. var catchInstances = new Array(len - 1),
  9291. j = 0, i;
  9292. for (i = 0; i < len - 1; ++i) {
  9293. var item = arguments[i];
  9294. if (util.isObject(item)) {
  9295. catchInstances[j++] = item;
  9296. } else {
  9297. return apiRejection("expecting an object but got " +
  9298. "A catch statement predicate " + util.classString(item));
  9299. }
  9300. }
  9301. catchInstances.length = j;
  9302. fn = arguments[i];
  9303. return this.then(undefined, catchFilter(catchInstances, fn, this));
  9304. }
  9305. return this.then(undefined, fn);
  9306. };
  9307. Promise.prototype.reflect = function () {
  9308. return this._then(reflectHandler,
  9309. reflectHandler, undefined, this, undefined);
  9310. };
  9311. Promise.prototype.then = function (didFulfill, didReject) {
  9312. if (debug.warnings() && arguments.length > 0 &&
  9313. typeof didFulfill !== "function" &&
  9314. typeof didReject !== "function") {
  9315. var msg = ".then() only accepts functions but was passed: " +
  9316. util.classString(didFulfill);
  9317. if (arguments.length > 1) {
  9318. msg += ", " + util.classString(didReject);
  9319. }
  9320. this._warn(msg);
  9321. }
  9322. return this._then(didFulfill, didReject, undefined, undefined, undefined);
  9323. };
  9324. Promise.prototype.done = function (didFulfill, didReject) {
  9325. var promise =
  9326. this._then(didFulfill, didReject, undefined, undefined, undefined);
  9327. promise._setIsFinal();
  9328. };
  9329. Promise.prototype.spread = function (fn) {
  9330. if (typeof fn !== "function") {
  9331. return apiRejection("expecting a function but got " + util.classString(fn));
  9332. }
  9333. return this.all()._then(fn, undefined, undefined, APPLY, undefined);
  9334. };
  9335. Promise.prototype.toJSON = function () {
  9336. var ret = {
  9337. isFulfilled: false,
  9338. isRejected: false,
  9339. fulfillmentValue: undefined,
  9340. rejectionReason: undefined
  9341. };
  9342. if (this.isFulfilled()) {
  9343. ret.fulfillmentValue = this.value();
  9344. ret.isFulfilled = true;
  9345. } else if (this.isRejected()) {
  9346. ret.rejectionReason = this.reason();
  9347. ret.isRejected = true;
  9348. }
  9349. return ret;
  9350. };
  9351. Promise.prototype.all = function () {
  9352. if (arguments.length > 0) {
  9353. this._warn(".all() was passed arguments but it does not take any");
  9354. }
  9355. return new PromiseArray(this).promise();
  9356. };
  9357. Promise.prototype.error = function (fn) {
  9358. return this.caught(util.originatesFromRejection, fn);
  9359. };
  9360. Promise.getNewLibraryCopy = module.exports;
  9361. Promise.is = function (val) {
  9362. return val instanceof Promise;
  9363. };
  9364. Promise.fromNode = Promise.fromCallback = function(fn) {
  9365. var ret = new Promise(INTERNAL);
  9366. ret._captureStackTrace();
  9367. var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
  9368. : false;
  9369. var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
  9370. if (result === errorObj) {
  9371. ret._rejectCallback(result.e, true);
  9372. }
  9373. if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
  9374. return ret;
  9375. };
  9376. Promise.all = function (promises) {
  9377. return new PromiseArray(promises).promise();
  9378. };
  9379. Promise.cast = function (obj) {
  9380. var ret = tryConvertToPromise(obj);
  9381. if (!(ret instanceof Promise)) {
  9382. ret = new Promise(INTERNAL);
  9383. ret._captureStackTrace();
  9384. ret._setFulfilled();
  9385. ret._rejectionHandler0 = obj;
  9386. }
  9387. return ret;
  9388. };
  9389. Promise.resolve = Promise.fulfilled = Promise.cast;
  9390. Promise.reject = Promise.rejected = function (reason) {
  9391. var ret = new Promise(INTERNAL);
  9392. ret._captureStackTrace();
  9393. ret._rejectCallback(reason, true);
  9394. return ret;
  9395. };
  9396. Promise.setScheduler = function(fn) {
  9397. if (typeof fn !== "function") {
  9398. throw new TypeError("expecting a function but got " + util.classString(fn));
  9399. }
  9400. return async.setScheduler(fn);
  9401. };
  9402. Promise.prototype._then = function (
  9403. didFulfill,
  9404. didReject,
  9405. _, receiver,
  9406. internalData
  9407. ) {
  9408. var haveInternalData = internalData !== undefined;
  9409. var promise = haveInternalData ? internalData : new Promise(INTERNAL);
  9410. var target = this._target();
  9411. var bitField = target._bitField;
  9412. if (!haveInternalData) {
  9413. promise._propagateFrom(this, 3);
  9414. promise._captureStackTrace();
  9415. if (receiver === undefined &&
  9416. ((this._bitField & 2097152) !== 0)) {
  9417. if (!((bitField & 50397184) === 0)) {
  9418. receiver = this._boundValue();
  9419. } else {
  9420. receiver = target === this ? undefined : this._boundTo;
  9421. }
  9422. }
  9423. this._fireEvent("promiseChained", this, promise);
  9424. }
  9425. var domain = getDomain();
  9426. if (!((bitField & 50397184) === 0)) {
  9427. var handler, value, settler = target._settlePromiseCtx;
  9428. if (((bitField & 33554432) !== 0)) {
  9429. value = target._rejectionHandler0;
  9430. handler = didFulfill;
  9431. } else if (((bitField & 16777216) !== 0)) {
  9432. value = target._fulfillmentHandler0;
  9433. handler = didReject;
  9434. target._unsetRejectionIsUnhandled();
  9435. } else {
  9436. settler = target._settlePromiseLateCancellationObserver;
  9437. value = new CancellationError("late cancellation observer");
  9438. target._attachExtraTrace(value);
  9439. handler = didReject;
  9440. }
  9441. async.invoke(settler, target, {
  9442. handler: domain === null ? handler
  9443. : (typeof handler === "function" &&
  9444. util.domainBind(domain, handler)),
  9445. promise: promise,
  9446. receiver: receiver,
  9447. value: value
  9448. });
  9449. } else {
  9450. target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
  9451. }
  9452. return promise;
  9453. };
  9454. Promise.prototype._length = function () {
  9455. return this._bitField & 65535;
  9456. };
  9457. Promise.prototype._isFateSealed = function () {
  9458. return (this._bitField & 117506048) !== 0;
  9459. };
  9460. Promise.prototype._isFollowing = function () {
  9461. return (this._bitField & 67108864) === 67108864;
  9462. };
  9463. Promise.prototype._setLength = function (len) {
  9464. this._bitField = (this._bitField & -65536) |
  9465. (len & 65535);
  9466. };
  9467. Promise.prototype._setFulfilled = function () {
  9468. this._bitField = this._bitField | 33554432;
  9469. this._fireEvent("promiseFulfilled", this);
  9470. };
  9471. Promise.prototype._setRejected = function () {
  9472. this._bitField = this._bitField | 16777216;
  9473. this._fireEvent("promiseRejected", this);
  9474. };
  9475. Promise.prototype._setFollowing = function () {
  9476. this._bitField = this._bitField | 67108864;
  9477. this._fireEvent("promiseResolved", this);
  9478. };
  9479. Promise.prototype._setIsFinal = function () {
  9480. this._bitField = this._bitField | 4194304;
  9481. };
  9482. Promise.prototype._isFinal = function () {
  9483. return (this._bitField & 4194304) > 0;
  9484. };
  9485. Promise.prototype._unsetCancelled = function() {
  9486. this._bitField = this._bitField & (~65536);
  9487. };
  9488. Promise.prototype._setCancelled = function() {
  9489. this._bitField = this._bitField | 65536;
  9490. this._fireEvent("promiseCancelled", this);
  9491. };
  9492. Promise.prototype._setWillBeCancelled = function() {
  9493. this._bitField = this._bitField | 8388608;
  9494. };
  9495. Promise.prototype._setAsyncGuaranteed = function() {
  9496. if (async.hasCustomScheduler()) return;
  9497. this._bitField = this._bitField | 134217728;
  9498. };
  9499. Promise.prototype._receiverAt = function (index) {
  9500. var ret = index === 0 ? this._receiver0 : this[
  9501. index * 4 - 4 + 3];
  9502. if (ret === UNDEFINED_BINDING) {
  9503. return undefined;
  9504. } else if (ret === undefined && this._isBound()) {
  9505. return this._boundValue();
  9506. }
  9507. return ret;
  9508. };
  9509. Promise.prototype._promiseAt = function (index) {
  9510. return this[
  9511. index * 4 - 4 + 2];
  9512. };
  9513. Promise.prototype._fulfillmentHandlerAt = function (index) {
  9514. return this[
  9515. index * 4 - 4 + 0];
  9516. };
  9517. Promise.prototype._rejectionHandlerAt = function (index) {
  9518. return this[
  9519. index * 4 - 4 + 1];
  9520. };
  9521. Promise.prototype._boundValue = function() {};
  9522. Promise.prototype._migrateCallback0 = function (follower) {
  9523. var bitField = follower._bitField;
  9524. var fulfill = follower._fulfillmentHandler0;
  9525. var reject = follower._rejectionHandler0;
  9526. var promise = follower._promise0;
  9527. var receiver = follower._receiverAt(0);
  9528. if (receiver === undefined) receiver = UNDEFINED_BINDING;
  9529. this._addCallbacks(fulfill, reject, promise, receiver, null);
  9530. };
  9531. Promise.prototype._migrateCallbackAt = function (follower, index) {
  9532. var fulfill = follower._fulfillmentHandlerAt(index);
  9533. var reject = follower._rejectionHandlerAt(index);
  9534. var promise = follower._promiseAt(index);
  9535. var receiver = follower._receiverAt(index);
  9536. if (receiver === undefined) receiver = UNDEFINED_BINDING;
  9537. this._addCallbacks(fulfill, reject, promise, receiver, null);
  9538. };
  9539. Promise.prototype._addCallbacks = function (
  9540. fulfill,
  9541. reject,
  9542. promise,
  9543. receiver,
  9544. domain
  9545. ) {
  9546. var index = this._length();
  9547. if (index >= 65535 - 4) {
  9548. index = 0;
  9549. this._setLength(0);
  9550. }
  9551. if (index === 0) {
  9552. this._promise0 = promise;
  9553. this._receiver0 = receiver;
  9554. if (typeof fulfill === "function") {
  9555. this._fulfillmentHandler0 =
  9556. domain === null ? fulfill : util.domainBind(domain, fulfill);
  9557. }
  9558. if (typeof reject === "function") {
  9559. this._rejectionHandler0 =
  9560. domain === null ? reject : util.domainBind(domain, reject);
  9561. }
  9562. } else {
  9563. var base = index * 4 - 4;
  9564. this[base + 2] = promise;
  9565. this[base + 3] = receiver;
  9566. if (typeof fulfill === "function") {
  9567. this[base + 0] =
  9568. domain === null ? fulfill : util.domainBind(domain, fulfill);
  9569. }
  9570. if (typeof reject === "function") {
  9571. this[base + 1] =
  9572. domain === null ? reject : util.domainBind(domain, reject);
  9573. }
  9574. }
  9575. this._setLength(index + 1);
  9576. return index;
  9577. };
  9578. Promise.prototype._proxy = function (proxyable, arg) {
  9579. this._addCallbacks(undefined, undefined, arg, proxyable, null);
  9580. };
  9581. Promise.prototype._resolveCallback = function(value, shouldBind) {
  9582. if (((this._bitField & 117506048) !== 0)) return;
  9583. if (value === this)
  9584. return this._rejectCallback(makeSelfResolutionError(), false);
  9585. var maybePromise = tryConvertToPromise(value, this);
  9586. if (!(maybePromise instanceof Promise)) return this._fulfill(value);
  9587. if (shouldBind) this._propagateFrom(maybePromise, 2);
  9588. var promise = maybePromise._target();
  9589. if (promise === this) {
  9590. this._reject(makeSelfResolutionError());
  9591. return;
  9592. }
  9593. var bitField = promise._bitField;
  9594. if (((bitField & 50397184) === 0)) {
  9595. var len = this._length();
  9596. if (len > 0) promise._migrateCallback0(this);
  9597. for (var i = 1; i < len; ++i) {
  9598. promise._migrateCallbackAt(this, i);
  9599. }
  9600. this._setFollowing();
  9601. this._setLength(0);
  9602. this._setFollowee(promise);
  9603. } else if (((bitField & 33554432) !== 0)) {
  9604. this._fulfill(promise._value());
  9605. } else if (((bitField & 16777216) !== 0)) {
  9606. this._reject(promise._reason());
  9607. } else {
  9608. var reason = new CancellationError("late cancellation observer");
  9609. promise._attachExtraTrace(reason);
  9610. this._reject(reason);
  9611. }
  9612. };
  9613. Promise.prototype._rejectCallback =
  9614. function(reason, synchronous, ignoreNonErrorWarnings) {
  9615. var trace = util.ensureErrorObject(reason);
  9616. var hasStack = trace === reason;
  9617. if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
  9618. var message = "a promise was rejected with a non-error: " +
  9619. util.classString(reason);
  9620. this._warn(message, true);
  9621. }
  9622. this._attachExtraTrace(trace, synchronous ? hasStack : false);
  9623. this._reject(reason);
  9624. };
  9625. Promise.prototype._resolveFromExecutor = function (executor) {
  9626. var promise = this;
  9627. this._captureStackTrace();
  9628. this._pushContext();
  9629. var synchronous = true;
  9630. var r = this._execute(executor, function(value) {
  9631. promise._resolveCallback(value);
  9632. }, function (reason) {
  9633. promise._rejectCallback(reason, synchronous);
  9634. });
  9635. synchronous = false;
  9636. this._popContext();
  9637. if (r !== undefined) {
  9638. promise._rejectCallback(r, true);
  9639. }
  9640. };
  9641. Promise.prototype._settlePromiseFromHandler = function (
  9642. handler, receiver, value, promise
  9643. ) {
  9644. var bitField = promise._bitField;
  9645. if (((bitField & 65536) !== 0)) return;
  9646. promise._pushContext();
  9647. var x;
  9648. if (receiver === APPLY) {
  9649. if (!value || typeof value.length !== "number") {
  9650. x = errorObj;
  9651. x.e = new TypeError("cannot .spread() a non-array: " +
  9652. util.classString(value));
  9653. } else {
  9654. x = tryCatch(handler).apply(this._boundValue(), value);
  9655. }
  9656. } else {
  9657. x = tryCatch(handler).call(receiver, value);
  9658. }
  9659. var promiseCreated = promise._popContext();
  9660. bitField = promise._bitField;
  9661. if (((bitField & 65536) !== 0)) return;
  9662. if (x === NEXT_FILTER) {
  9663. promise._reject(value);
  9664. } else if (x === errorObj) {
  9665. promise._rejectCallback(x.e, false);
  9666. } else {
  9667. debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
  9668. promise._resolveCallback(x);
  9669. }
  9670. };
  9671. Promise.prototype._target = function() {
  9672. var ret = this;
  9673. while (ret._isFollowing()) ret = ret._followee();
  9674. return ret;
  9675. };
  9676. Promise.prototype._followee = function() {
  9677. return this._rejectionHandler0;
  9678. };
  9679. Promise.prototype._setFollowee = function(promise) {
  9680. this._rejectionHandler0 = promise;
  9681. };
  9682. Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
  9683. var isPromise = promise instanceof Promise;
  9684. var bitField = this._bitField;
  9685. var asyncGuaranteed = ((bitField & 134217728) !== 0);
  9686. if (((bitField & 65536) !== 0)) {
  9687. if (isPromise) promise._invokeInternalOnCancel();
  9688. if (receiver instanceof PassThroughHandlerContext &&
  9689. receiver.isFinallyHandler()) {
  9690. receiver.cancelPromise = promise;
  9691. if (tryCatch(handler).call(receiver, value) === errorObj) {
  9692. promise._reject(errorObj.e);
  9693. }
  9694. } else if (handler === reflectHandler) {
  9695. promise._fulfill(reflectHandler.call(receiver));
  9696. } else if (receiver instanceof Proxyable) {
  9697. receiver._promiseCancelled(promise);
  9698. } else if (isPromise || promise instanceof PromiseArray) {
  9699. promise._cancel();
  9700. } else {
  9701. receiver.cancel();
  9702. }
  9703. } else if (typeof handler === "function") {
  9704. if (!isPromise) {
  9705. handler.call(receiver, value, promise);
  9706. } else {
  9707. if (asyncGuaranteed) promise._setAsyncGuaranteed();
  9708. this._settlePromiseFromHandler(handler, receiver, value, promise);
  9709. }
  9710. } else if (receiver instanceof Proxyable) {
  9711. if (!receiver._isResolved()) {
  9712. if (((bitField & 33554432) !== 0)) {
  9713. receiver._promiseFulfilled(value, promise);
  9714. } else {
  9715. receiver._promiseRejected(value, promise);
  9716. }
  9717. }
  9718. } else if (isPromise) {
  9719. if (asyncGuaranteed) promise._setAsyncGuaranteed();
  9720. if (((bitField & 33554432) !== 0)) {
  9721. promise._fulfill(value);
  9722. } else {
  9723. promise._reject(value);
  9724. }
  9725. }
  9726. };
  9727. Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
  9728. var handler = ctx.handler;
  9729. var promise = ctx.promise;
  9730. var receiver = ctx.receiver;
  9731. var value = ctx.value;
  9732. if (typeof handler === "function") {
  9733. if (!(promise instanceof Promise)) {
  9734. handler.call(receiver, value, promise);
  9735. } else {
  9736. this._settlePromiseFromHandler(handler, receiver, value, promise);
  9737. }
  9738. } else if (promise instanceof Promise) {
  9739. promise._reject(value);
  9740. }
  9741. };
  9742. Promise.prototype._settlePromiseCtx = function(ctx) {
  9743. this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
  9744. };
  9745. Promise.prototype._settlePromise0 = function(handler, value, bitField) {
  9746. var promise = this._promise0;
  9747. var receiver = this._receiverAt(0);
  9748. this._promise0 = undefined;
  9749. this._receiver0 = undefined;
  9750. this._settlePromise(promise, handler, receiver, value);
  9751. };
  9752. Promise.prototype._clearCallbackDataAtIndex = function(index) {
  9753. var base = index * 4 - 4;
  9754. this[base + 2] =
  9755. this[base + 3] =
  9756. this[base + 0] =
  9757. this[base + 1] = undefined;
  9758. };
  9759. Promise.prototype._fulfill = function (value) {
  9760. var bitField = this._bitField;
  9761. if (((bitField & 117506048) >>> 16)) return;
  9762. if (value === this) {
  9763. var err = makeSelfResolutionError();
  9764. this._attachExtraTrace(err);
  9765. return this._reject(err);
  9766. }
  9767. this._setFulfilled();
  9768. this._rejectionHandler0 = value;
  9769. if ((bitField & 65535) > 0) {
  9770. if (((bitField & 134217728) !== 0)) {
  9771. this._settlePromises();
  9772. } else {
  9773. async.settlePromises(this);
  9774. }
  9775. }
  9776. };
  9777. Promise.prototype._reject = function (reason) {
  9778. var bitField = this._bitField;
  9779. if (((bitField & 117506048) >>> 16)) return;
  9780. this._setRejected();
  9781. this._fulfillmentHandler0 = reason;
  9782. if (this._isFinal()) {
  9783. return async.fatalError(reason, util.isNode);
  9784. }
  9785. if ((bitField & 65535) > 0) {
  9786. async.settlePromises(this);
  9787. } else {
  9788. this._ensurePossibleRejectionHandled();
  9789. }
  9790. };
  9791. Promise.prototype._fulfillPromises = function (len, value) {
  9792. for (var i = 1; i < len; i++) {
  9793. var handler = this._fulfillmentHandlerAt(i);
  9794. var promise = this._promiseAt(i);
  9795. var receiver = this._receiverAt(i);
  9796. this._clearCallbackDataAtIndex(i);
  9797. this._settlePromise(promise, handler, receiver, value);
  9798. }
  9799. };
  9800. Promise.prototype._rejectPromises = function (len, reason) {
  9801. for (var i = 1; i < len; i++) {
  9802. var handler = this._rejectionHandlerAt(i);
  9803. var promise = this._promiseAt(i);
  9804. var receiver = this._receiverAt(i);
  9805. this._clearCallbackDataAtIndex(i);
  9806. this._settlePromise(promise, handler, receiver, reason);
  9807. }
  9808. };
  9809. Promise.prototype._settlePromises = function () {
  9810. var bitField = this._bitField;
  9811. var len = (bitField & 65535);
  9812. if (len > 0) {
  9813. if (((bitField & 16842752) !== 0)) {
  9814. var reason = this._fulfillmentHandler0;
  9815. this._settlePromise0(this._rejectionHandler0, reason, bitField);
  9816. this._rejectPromises(len, reason);
  9817. } else {
  9818. var value = this._rejectionHandler0;
  9819. this._settlePromise0(this._fulfillmentHandler0, value, bitField);
  9820. this._fulfillPromises(len, value);
  9821. }
  9822. this._setLength(0);
  9823. }
  9824. this._clearCancellationData();
  9825. };
  9826. Promise.prototype._settledValue = function() {
  9827. var bitField = this._bitField;
  9828. if (((bitField & 33554432) !== 0)) {
  9829. return this._rejectionHandler0;
  9830. } else if (((bitField & 16777216) !== 0)) {
  9831. return this._fulfillmentHandler0;
  9832. }
  9833. };
  9834. function deferResolve(v) {this.promise._resolveCallback(v);}
  9835. function deferReject(v) {this.promise._rejectCallback(v, false);}
  9836. Promise.defer = Promise.pending = function() {
  9837. debug.deprecated("Promise.defer", "new Promise");
  9838. var promise = new Promise(INTERNAL);
  9839. return {
  9840. promise: promise,
  9841. resolve: deferResolve,
  9842. reject: deferReject
  9843. };
  9844. };
  9845. util.notEnumerableProp(Promise,
  9846. "_makeSelfResolutionError",
  9847. makeSelfResolutionError);
  9848. require("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection,
  9849. debug);
  9850. require("./bind")(Promise, INTERNAL, tryConvertToPromise, debug);
  9851. require("./cancel")(Promise, PromiseArray, apiRejection, debug);
  9852. require("./direct_resolve")(Promise);
  9853. require("./synchronous_inspection")(Promise);
  9854. require("./join")(
  9855. Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);
  9856. Promise.Promise = Promise;
  9857. Promise.version = "3.4.7";
  9858. require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
  9859. require('./call_get.js')(Promise);
  9860. require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
  9861. require('./timers.js')(Promise, INTERNAL, debug);
  9862. require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
  9863. require('./nodeify.js')(Promise);
  9864. require('./promisify.js')(Promise, INTERNAL);
  9865. require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
  9866. require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
  9867. require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
  9868. require('./settle.js')(Promise, PromiseArray, debug);
  9869. require('./some.js')(Promise, PromiseArray, apiRejection);
  9870. require('./filter.js')(Promise, INTERNAL);
  9871. require('./each.js')(Promise, INTERNAL);
  9872. require('./any.js')(Promise);
  9873. util.toFastProperties(Promise);
  9874. util.toFastProperties(Promise.prototype);
  9875. function fillTypes(value) {
  9876. var p = new Promise(INTERNAL);
  9877. p._fulfillmentHandler0 = value;
  9878. p._rejectionHandler0 = value;
  9879. p._promise0 = value;
  9880. p._receiver0 = value;
  9881. }
  9882. // Complete slack tracking, opt out of field-type tracking and
  9883. // stabilize map
  9884. fillTypes({a: 1});
  9885. fillTypes({b: 2});
  9886. fillTypes({c: 3});
  9887. fillTypes(1);
  9888. fillTypes(function(){});
  9889. fillTypes(undefined);
  9890. fillTypes(false);
  9891. fillTypes(new Promise(INTERNAL));
  9892. debug.setBounds(Async.firstLineError, util.lastLineError);
  9893. return Promise;
  9894. };
  9895. }).call(this,require('_process'))
  9896. },{"./any.js":48,"./async":49,"./bind":50,"./call_get.js":51,"./cancel":52,"./catch_filter":53,"./context":54,"./debuggability":55,"./direct_resolve":56,"./each.js":57,"./errors":58,"./es5":59,"./filter.js":60,"./finally":61,"./generators.js":62,"./join":63,"./map.js":64,"./method":65,"./nodeback":66,"./nodeify.js":67,"./promise_array":69,"./promisify.js":70,"./props.js":71,"./race.js":73,"./reduce.js":74,"./settle.js":76,"./some.js":77,"./synchronous_inspection":78,"./thenables":79,"./timers.js":80,"./using.js":81,"./util":82,"_process":101}],69:[function(require,module,exports){
  9897. "use strict";
  9898. module.exports = function(Promise, INTERNAL, tryConvertToPromise,
  9899. apiRejection, Proxyable) {
  9900. var util = require("./util");
  9901. var isArray = util.isArray;
  9902. function toResolutionValue(val) {
  9903. switch(val) {
  9904. case -2: return [];
  9905. case -3: return {};
  9906. }
  9907. }
  9908. function PromiseArray(values) {
  9909. var promise = this._promise = new Promise(INTERNAL);
  9910. if (values instanceof Promise) {
  9911. promise._propagateFrom(values, 3);
  9912. }
  9913. promise._setOnCancel(this);
  9914. this._values = values;
  9915. this._length = 0;
  9916. this._totalResolved = 0;
  9917. this._init(undefined, -2);
  9918. }
  9919. util.inherits(PromiseArray, Proxyable);
  9920. PromiseArray.prototype.length = function () {
  9921. return this._length;
  9922. };
  9923. PromiseArray.prototype.promise = function () {
  9924. return this._promise;
  9925. };
  9926. PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
  9927. var values = tryConvertToPromise(this._values, this._promise);
  9928. if (values instanceof Promise) {
  9929. values = values._target();
  9930. var bitField = values._bitField;
  9931. ;
  9932. this._values = values;
  9933. if (((bitField & 50397184) === 0)) {
  9934. this._promise._setAsyncGuaranteed();
  9935. return values._then(
  9936. init,
  9937. this._reject,
  9938. undefined,
  9939. this,
  9940. resolveValueIfEmpty
  9941. );
  9942. } else if (((bitField & 33554432) !== 0)) {
  9943. values = values._value();
  9944. } else if (((bitField & 16777216) !== 0)) {
  9945. return this._reject(values._reason());
  9946. } else {
  9947. return this._cancel();
  9948. }
  9949. }
  9950. values = util.asArray(values);
  9951. if (values === null) {
  9952. var err = apiRejection(
  9953. "expecting an array or an iterable object but got " + util.classString(values)).reason();
  9954. this._promise._rejectCallback(err, false);
  9955. return;
  9956. }
  9957. if (values.length === 0) {
  9958. if (resolveValueIfEmpty === -5) {
  9959. this._resolveEmptyArray();
  9960. }
  9961. else {
  9962. this._resolve(toResolutionValue(resolveValueIfEmpty));
  9963. }
  9964. return;
  9965. }
  9966. this._iterate(values);
  9967. };
  9968. PromiseArray.prototype._iterate = function(values) {
  9969. var len = this.getActualLength(values.length);
  9970. this._length = len;
  9971. this._values = this.shouldCopyValues() ? new Array(len) : this._values;
  9972. var result = this._promise;
  9973. var isResolved = false;
  9974. var bitField = null;
  9975. for (var i = 0; i < len; ++i) {
  9976. var maybePromise = tryConvertToPromise(values[i], result);
  9977. if (maybePromise instanceof Promise) {
  9978. maybePromise = maybePromise._target();
  9979. bitField = maybePromise._bitField;
  9980. } else {
  9981. bitField = null;
  9982. }
  9983. if (isResolved) {
  9984. if (bitField !== null) {
  9985. maybePromise.suppressUnhandledRejections();
  9986. }
  9987. } else if (bitField !== null) {
  9988. if (((bitField & 50397184) === 0)) {
  9989. maybePromise._proxy(this, i);
  9990. this._values[i] = maybePromise;
  9991. } else if (((bitField & 33554432) !== 0)) {
  9992. isResolved = this._promiseFulfilled(maybePromise._value(), i);
  9993. } else if (((bitField & 16777216) !== 0)) {
  9994. isResolved = this._promiseRejected(maybePromise._reason(), i);
  9995. } else {
  9996. isResolved = this._promiseCancelled(i);
  9997. }
  9998. } else {
  9999. isResolved = this._promiseFulfilled(maybePromise, i);
  10000. }
  10001. }
  10002. if (!isResolved) result._setAsyncGuaranteed();
  10003. };
  10004. PromiseArray.prototype._isResolved = function () {
  10005. return this._values === null;
  10006. };
  10007. PromiseArray.prototype._resolve = function (value) {
  10008. this._values = null;
  10009. this._promise._fulfill(value);
  10010. };
  10011. PromiseArray.prototype._cancel = function() {
  10012. if (this._isResolved() || !this._promise._isCancellable()) return;
  10013. this._values = null;
  10014. this._promise._cancel();
  10015. };
  10016. PromiseArray.prototype._reject = function (reason) {
  10017. this._values = null;
  10018. this._promise._rejectCallback(reason, false);
  10019. };
  10020. PromiseArray.prototype._promiseFulfilled = function (value, index) {
  10021. this._values[index] = value;
  10022. var totalResolved = ++this._totalResolved;
  10023. if (totalResolved >= this._length) {
  10024. this._resolve(this._values);
  10025. return true;
  10026. }
  10027. return false;
  10028. };
  10029. PromiseArray.prototype._promiseCancelled = function() {
  10030. this._cancel();
  10031. return true;
  10032. };
  10033. PromiseArray.prototype._promiseRejected = function (reason) {
  10034. this._totalResolved++;
  10035. this._reject(reason);
  10036. return true;
  10037. };
  10038. PromiseArray.prototype._resultCancelled = function() {
  10039. if (this._isResolved()) return;
  10040. var values = this._values;
  10041. this._cancel();
  10042. if (values instanceof Promise) {
  10043. values.cancel();
  10044. } else {
  10045. for (var i = 0; i < values.length; ++i) {
  10046. if (values[i] instanceof Promise) {
  10047. values[i].cancel();
  10048. }
  10049. }
  10050. }
  10051. };
  10052. PromiseArray.prototype.shouldCopyValues = function () {
  10053. return true;
  10054. };
  10055. PromiseArray.prototype.getActualLength = function (len) {
  10056. return len;
  10057. };
  10058. return PromiseArray;
  10059. };
  10060. },{"./util":82}],70:[function(require,module,exports){
  10061. "use strict";
  10062. module.exports = function(Promise, INTERNAL) {
  10063. var THIS = {};
  10064. var util = require("./util");
  10065. var nodebackForPromise = require("./nodeback");
  10066. var withAppended = util.withAppended;
  10067. var maybeWrapAsError = util.maybeWrapAsError;
  10068. var canEvaluate = util.canEvaluate;
  10069. var TypeError = require("./errors").TypeError;
  10070. var defaultSuffix = "Async";
  10071. var defaultPromisified = {__isPromisified__: true};
  10072. var noCopyProps = [
  10073. "arity", "length",
  10074. "name",
  10075. "arguments",
  10076. "caller",
  10077. "callee",
  10078. "prototype",
  10079. "__isPromisified__"
  10080. ];
  10081. var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
  10082. var defaultFilter = function(name) {
  10083. return util.isIdentifier(name) &&
  10084. name.charAt(0) !== "_" &&
  10085. name !== "constructor";
  10086. };
  10087. function propsFilter(key) {
  10088. return !noCopyPropsPattern.test(key);
  10089. }
  10090. function isPromisified(fn) {
  10091. try {
  10092. return fn.__isPromisified__ === true;
  10093. }
  10094. catch (e) {
  10095. return false;
  10096. }
  10097. }
  10098. function hasPromisified(obj, key, suffix) {
  10099. var val = util.getDataPropertyOrDefault(obj, key + suffix,
  10100. defaultPromisified);
  10101. return val ? isPromisified(val) : false;
  10102. }
  10103. function checkValid(ret, suffix, suffixRegexp) {
  10104. for (var i = 0; i < ret.length; i += 2) {
  10105. var key = ret[i];
  10106. if (suffixRegexp.test(key)) {
  10107. var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
  10108. for (var j = 0; j < ret.length; j += 2) {
  10109. if (ret[j] === keyWithoutAsyncSuffix) {
  10110. throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a"
  10111. .replace("%s", suffix));
  10112. }
  10113. }
  10114. }
  10115. }
  10116. }
  10117. function promisifiableMethods(obj, suffix, suffixRegexp, filter) {
  10118. var keys = util.inheritedDataKeys(obj);
  10119. var ret = [];
  10120. for (var i = 0; i < keys.length; ++i) {
  10121. var key = keys[i];
  10122. var value = obj[key];
  10123. var passesDefaultFilter = filter === defaultFilter
  10124. ? true : defaultFilter(key, value, obj);
  10125. if (typeof value === "function" &&
  10126. !isPromisified(value) &&
  10127. !hasPromisified(obj, key, suffix) &&
  10128. filter(key, value, obj, passesDefaultFilter)) {
  10129. ret.push(key, value);
  10130. }
  10131. }
  10132. checkValid(ret, suffix, suffixRegexp);
  10133. return ret;
  10134. }
  10135. var escapeIdentRegex = function(str) {
  10136. return str.replace(/([$])/, "\\$");
  10137. };
  10138. var makeNodePromisifiedEval;
  10139. if (!false) {
  10140. var switchCaseArgumentOrder = function(likelyArgumentCount) {
  10141. var ret = [likelyArgumentCount];
  10142. var min = Math.max(0, likelyArgumentCount - 1 - 3);
  10143. for(var i = likelyArgumentCount - 1; i >= min; --i) {
  10144. ret.push(i);
  10145. }
  10146. for(var i = likelyArgumentCount + 1; i <= 3; ++i) {
  10147. ret.push(i);
  10148. }
  10149. return ret;
  10150. };
  10151. var argumentSequence = function(argumentCount) {
  10152. return util.filledRange(argumentCount, "_arg", "");
  10153. };
  10154. var parameterDeclaration = function(parameterCount) {
  10155. return util.filledRange(
  10156. Math.max(parameterCount, 3), "_arg", "");
  10157. };
  10158. var parameterCount = function(fn) {
  10159. if (typeof fn.length === "number") {
  10160. return Math.max(Math.min(fn.length, 1023 + 1), 0);
  10161. }
  10162. return 0;
  10163. };
  10164. makeNodePromisifiedEval =
  10165. function(callback, receiver, originalName, fn, _, multiArgs) {
  10166. var newParameterCount = Math.max(0, parameterCount(fn) - 1);
  10167. var argumentOrder = switchCaseArgumentOrder(newParameterCount);
  10168. var shouldProxyThis = typeof callback === "string" || receiver === THIS;
  10169. function generateCallForArgumentCount(count) {
  10170. var args = argumentSequence(count).join(", ");
  10171. var comma = count > 0 ? ", " : "";
  10172. var ret;
  10173. if (shouldProxyThis) {
  10174. ret = "ret = callback.call(this, {{args}}, nodeback); break;\n";
  10175. } else {
  10176. ret = receiver === undefined
  10177. ? "ret = callback({{args}}, nodeback); break;\n"
  10178. : "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
  10179. }
  10180. return ret.replace("{{args}}", args).replace(", ", comma);
  10181. }
  10182. function generateArgumentSwitchCase() {
  10183. var ret = "";
  10184. for (var i = 0; i < argumentOrder.length; ++i) {
  10185. ret += "case " + argumentOrder[i] +":" +
  10186. generateCallForArgumentCount(argumentOrder[i]);
  10187. }
  10188. ret += " \n\
  10189. default: \n\
  10190. var args = new Array(len + 1); \n\
  10191. var i = 0; \n\
  10192. for (var i = 0; i < len; ++i) { \n\
  10193. args[i] = arguments[i]; \n\
  10194. } \n\
  10195. args[i] = nodeback; \n\
  10196. [CodeForCall] \n\
  10197. break; \n\
  10198. ".replace("[CodeForCall]", (shouldProxyThis
  10199. ? "ret = callback.apply(this, args);\n"
  10200. : "ret = callback.apply(receiver, args);\n"));
  10201. return ret;
  10202. }
  10203. var getFunctionCode = typeof callback === "string"
  10204. ? ("this != null ? this['"+callback+"'] : fn")
  10205. : "fn";
  10206. var body = "'use strict'; \n\
  10207. var ret = function (Parameters) { \n\
  10208. 'use strict'; \n\
  10209. var len = arguments.length; \n\
  10210. var promise = new Promise(INTERNAL); \n\
  10211. promise._captureStackTrace(); \n\
  10212. var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\
  10213. var ret; \n\
  10214. var callback = tryCatch([GetFunctionCode]); \n\
  10215. switch(len) { \n\
  10216. [CodeForSwitchCase] \n\
  10217. } \n\
  10218. if (ret === errorObj) { \n\
  10219. promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\
  10220. } \n\
  10221. if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\
  10222. return promise; \n\
  10223. }; \n\
  10224. notEnumerableProp(ret, '__isPromisified__', true); \n\
  10225. return ret; \n\
  10226. ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase())
  10227. .replace("[GetFunctionCode]", getFunctionCode);
  10228. body = body.replace("Parameters", parameterDeclaration(newParameterCount));
  10229. return new Function("Promise",
  10230. "fn",
  10231. "receiver",
  10232. "withAppended",
  10233. "maybeWrapAsError",
  10234. "nodebackForPromise",
  10235. "tryCatch",
  10236. "errorObj",
  10237. "notEnumerableProp",
  10238. "INTERNAL",
  10239. body)(
  10240. Promise,
  10241. fn,
  10242. receiver,
  10243. withAppended,
  10244. maybeWrapAsError,
  10245. nodebackForPromise,
  10246. util.tryCatch,
  10247. util.errorObj,
  10248. util.notEnumerableProp,
  10249. INTERNAL);
  10250. };
  10251. }
  10252. function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
  10253. var defaultThis = (function() {return this;})();
  10254. var method = callback;
  10255. if (typeof method === "string") {
  10256. callback = fn;
  10257. }
  10258. function promisified() {
  10259. var _receiver = receiver;
  10260. if (receiver === THIS) _receiver = this;
  10261. var promise = new Promise(INTERNAL);
  10262. promise._captureStackTrace();
  10263. var cb = typeof method === "string" && this !== defaultThis
  10264. ? this[method] : callback;
  10265. var fn = nodebackForPromise(promise, multiArgs);
  10266. try {
  10267. cb.apply(_receiver, withAppended(arguments, fn));
  10268. } catch(e) {
  10269. promise._rejectCallback(maybeWrapAsError(e), true, true);
  10270. }
  10271. if (!promise._isFateSealed()) promise._setAsyncGuaranteed();
  10272. return promise;
  10273. }
  10274. util.notEnumerableProp(promisified, "__isPromisified__", true);
  10275. return promisified;
  10276. }
  10277. var makeNodePromisified = canEvaluate
  10278. ? makeNodePromisifiedEval
  10279. : makeNodePromisifiedClosure;
  10280. function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {
  10281. var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
  10282. var methods =
  10283. promisifiableMethods(obj, suffix, suffixRegexp, filter);
  10284. for (var i = 0, len = methods.length; i < len; i+= 2) {
  10285. var key = methods[i];
  10286. var fn = methods[i+1];
  10287. var promisifiedKey = key + suffix;
  10288. if (promisifier === makeNodePromisified) {
  10289. obj[promisifiedKey] =
  10290. makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
  10291. } else {
  10292. var promisified = promisifier(fn, function() {
  10293. return makeNodePromisified(key, THIS, key,
  10294. fn, suffix, multiArgs);
  10295. });
  10296. util.notEnumerableProp(promisified, "__isPromisified__", true);
  10297. obj[promisifiedKey] = promisified;
  10298. }
  10299. }
  10300. util.toFastProperties(obj);
  10301. return obj;
  10302. }
  10303. function promisify(callback, receiver, multiArgs) {
  10304. return makeNodePromisified(callback, receiver, undefined,
  10305. callback, null, multiArgs);
  10306. }
  10307. Promise.promisify = function (fn, options) {
  10308. if (typeof fn !== "function") {
  10309. throw new TypeError("expecting a function but got " + util.classString(fn));
  10310. }
  10311. if (isPromisified(fn)) {
  10312. return fn;
  10313. }
  10314. options = Object(options);
  10315. var receiver = options.context === undefined ? THIS : options.context;
  10316. var multiArgs = !!options.multiArgs;
  10317. var ret = promisify(fn, receiver, multiArgs);
  10318. util.copyDescriptors(fn, ret, propsFilter);
  10319. return ret;
  10320. };
  10321. Promise.promisifyAll = function (target, options) {
  10322. if (typeof target !== "function" && typeof target !== "object") {
  10323. throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  10324. }
  10325. options = Object(options);
  10326. var multiArgs = !!options.multiArgs;
  10327. var suffix = options.suffix;
  10328. if (typeof suffix !== "string") suffix = defaultSuffix;
  10329. var filter = options.filter;
  10330. if (typeof filter !== "function") filter = defaultFilter;
  10331. var promisifier = options.promisifier;
  10332. if (typeof promisifier !== "function") promisifier = makeNodePromisified;
  10333. if (!util.isIdentifier(suffix)) {
  10334. throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  10335. }
  10336. var keys = util.inheritedDataKeys(target);
  10337. for (var i = 0; i < keys.length; ++i) {
  10338. var value = target[keys[i]];
  10339. if (keys[i] !== "constructor" &&
  10340. util.isClass(value)) {
  10341. promisifyAll(value.prototype, suffix, filter, promisifier,
  10342. multiArgs);
  10343. promisifyAll(value, suffix, filter, promisifier, multiArgs);
  10344. }
  10345. }
  10346. return promisifyAll(target, suffix, filter, promisifier, multiArgs);
  10347. };
  10348. };
  10349. },{"./errors":58,"./nodeback":66,"./util":82}],71:[function(require,module,exports){
  10350. "use strict";
  10351. module.exports = function(
  10352. Promise, PromiseArray, tryConvertToPromise, apiRejection) {
  10353. var util = require("./util");
  10354. var isObject = util.isObject;
  10355. var es5 = require("./es5");
  10356. var Es6Map;
  10357. if (typeof Map === "function") Es6Map = Map;
  10358. var mapToEntries = (function() {
  10359. var index = 0;
  10360. var size = 0;
  10361. function extractEntry(value, key) {
  10362. this[index] = value;
  10363. this[index + size] = key;
  10364. index++;
  10365. }
  10366. return function mapToEntries(map) {
  10367. size = map.size;
  10368. index = 0;
  10369. var ret = new Array(map.size * 2);
  10370. map.forEach(extractEntry, ret);
  10371. return ret;
  10372. };
  10373. })();
  10374. var entriesToMap = function(entries) {
  10375. var ret = new Es6Map();
  10376. var length = entries.length / 2 | 0;
  10377. for (var i = 0; i < length; ++i) {
  10378. var key = entries[length + i];
  10379. var value = entries[i];
  10380. ret.set(key, value);
  10381. }
  10382. return ret;
  10383. };
  10384. function PropertiesPromiseArray(obj) {
  10385. var isMap = false;
  10386. var entries;
  10387. if (Es6Map !== undefined && obj instanceof Es6Map) {
  10388. entries = mapToEntries(obj);
  10389. isMap = true;
  10390. } else {
  10391. var keys = es5.keys(obj);
  10392. var len = keys.length;
  10393. entries = new Array(len * 2);
  10394. for (var i = 0; i < len; ++i) {
  10395. var key = keys[i];
  10396. entries[i] = obj[key];
  10397. entries[i + len] = key;
  10398. }
  10399. }
  10400. this.constructor$(entries);
  10401. this._isMap = isMap;
  10402. this._init$(undefined, -3);
  10403. }
  10404. util.inherits(PropertiesPromiseArray, PromiseArray);
  10405. PropertiesPromiseArray.prototype._init = function () {};
  10406. PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
  10407. this._values[index] = value;
  10408. var totalResolved = ++this._totalResolved;
  10409. if (totalResolved >= this._length) {
  10410. var val;
  10411. if (this._isMap) {
  10412. val = entriesToMap(this._values);
  10413. } else {
  10414. val = {};
  10415. var keyOffset = this.length();
  10416. for (var i = 0, len = this.length(); i < len; ++i) {
  10417. val[this._values[i + keyOffset]] = this._values[i];
  10418. }
  10419. }
  10420. this._resolve(val);
  10421. return true;
  10422. }
  10423. return false;
  10424. };
  10425. PropertiesPromiseArray.prototype.shouldCopyValues = function () {
  10426. return false;
  10427. };
  10428. PropertiesPromiseArray.prototype.getActualLength = function (len) {
  10429. return len >> 1;
  10430. };
  10431. function props(promises) {
  10432. var ret;
  10433. var castValue = tryConvertToPromise(promises);
  10434. if (!isObject(castValue)) {
  10435. return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  10436. } else if (castValue instanceof Promise) {
  10437. ret = castValue._then(
  10438. Promise.props, undefined, undefined, undefined, undefined);
  10439. } else {
  10440. ret = new PropertiesPromiseArray(castValue).promise();
  10441. }
  10442. if (castValue instanceof Promise) {
  10443. ret._propagateFrom(castValue, 2);
  10444. }
  10445. return ret;
  10446. }
  10447. Promise.prototype.props = function () {
  10448. return props(this);
  10449. };
  10450. Promise.props = function (promises) {
  10451. return props(promises);
  10452. };
  10453. };
  10454. },{"./es5":59,"./util":82}],72:[function(require,module,exports){
  10455. "use strict";
  10456. function arrayMove(src, srcIndex, dst, dstIndex, len) {
  10457. for (var j = 0; j < len; ++j) {
  10458. dst[j + dstIndex] = src[j + srcIndex];
  10459. src[j + srcIndex] = void 0;
  10460. }
  10461. }
  10462. function Queue(capacity) {
  10463. this._capacity = capacity;
  10464. this._length = 0;
  10465. this._front = 0;
  10466. }
  10467. Queue.prototype._willBeOverCapacity = function (size) {
  10468. return this._capacity < size;
  10469. };
  10470. Queue.prototype._pushOne = function (arg) {
  10471. var length = this.length();
  10472. this._checkCapacity(length + 1);
  10473. var i = (this._front + length) & (this._capacity - 1);
  10474. this[i] = arg;
  10475. this._length = length + 1;
  10476. };
  10477. Queue.prototype.push = function (fn, receiver, arg) {
  10478. var length = this.length() + 3;
  10479. if (this._willBeOverCapacity(length)) {
  10480. this._pushOne(fn);
  10481. this._pushOne(receiver);
  10482. this._pushOne(arg);
  10483. return;
  10484. }
  10485. var j = this._front + length - 3;
  10486. this._checkCapacity(length);
  10487. var wrapMask = this._capacity - 1;
  10488. this[(j + 0) & wrapMask] = fn;
  10489. this[(j + 1) & wrapMask] = receiver;
  10490. this[(j + 2) & wrapMask] = arg;
  10491. this._length = length;
  10492. };
  10493. Queue.prototype.shift = function () {
  10494. var front = this._front,
  10495. ret = this[front];
  10496. this[front] = undefined;
  10497. this._front = (front + 1) & (this._capacity - 1);
  10498. this._length--;
  10499. return ret;
  10500. };
  10501. Queue.prototype.length = function () {
  10502. return this._length;
  10503. };
  10504. Queue.prototype._checkCapacity = function (size) {
  10505. if (this._capacity < size) {
  10506. this._resizeTo(this._capacity << 1);
  10507. }
  10508. };
  10509. Queue.prototype._resizeTo = function (capacity) {
  10510. var oldCapacity = this._capacity;
  10511. this._capacity = capacity;
  10512. var front = this._front;
  10513. var length = this._length;
  10514. var moveItemsCount = (front + length) & (oldCapacity - 1);
  10515. arrayMove(this, 0, this, oldCapacity, moveItemsCount);
  10516. };
  10517. module.exports = Queue;
  10518. },{}],73:[function(require,module,exports){
  10519. "use strict";
  10520. module.exports = function(
  10521. Promise, INTERNAL, tryConvertToPromise, apiRejection) {
  10522. var util = require("./util");
  10523. var raceLater = function (promise) {
  10524. return promise.then(function(array) {
  10525. return race(array, promise);
  10526. });
  10527. };
  10528. function race(promises, parent) {
  10529. var maybePromise = tryConvertToPromise(promises);
  10530. if (maybePromise instanceof Promise) {
  10531. return raceLater(maybePromise);
  10532. } else {
  10533. promises = util.asArray(promises);
  10534. if (promises === null)
  10535. return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
  10536. }
  10537. var ret = new Promise(INTERNAL);
  10538. if (parent !== undefined) {
  10539. ret._propagateFrom(parent, 3);
  10540. }
  10541. var fulfill = ret._fulfill;
  10542. var reject = ret._reject;
  10543. for (var i = 0, len = promises.length; i < len; ++i) {
  10544. var val = promises[i];
  10545. if (val === undefined && !(i in promises)) {
  10546. continue;
  10547. }
  10548. Promise.cast(val)._then(fulfill, reject, undefined, ret, null);
  10549. }
  10550. return ret;
  10551. }
  10552. Promise.race = function (promises) {
  10553. return race(promises, undefined);
  10554. };
  10555. Promise.prototype.race = function () {
  10556. return race(this, undefined);
  10557. };
  10558. };
  10559. },{"./util":82}],74:[function(require,module,exports){
  10560. "use strict";
  10561. module.exports = function(Promise,
  10562. PromiseArray,
  10563. apiRejection,
  10564. tryConvertToPromise,
  10565. INTERNAL,
  10566. debug) {
  10567. var getDomain = Promise._getDomain;
  10568. var util = require("./util");
  10569. var tryCatch = util.tryCatch;
  10570. function ReductionPromiseArray(promises, fn, initialValue, _each) {
  10571. this.constructor$(promises);
  10572. var domain = getDomain();
  10573. this._fn = domain === null ? fn : util.domainBind(domain, fn);
  10574. if (initialValue !== undefined) {
  10575. initialValue = Promise.resolve(initialValue);
  10576. initialValue._attachCancellationCallback(this);
  10577. }
  10578. this._initialValue = initialValue;
  10579. this._currentCancellable = null;
  10580. if(_each === INTERNAL) {
  10581. this._eachValues = Array(this._length);
  10582. } else if (_each === 0) {
  10583. this._eachValues = null;
  10584. } else {
  10585. this._eachValues = undefined;
  10586. }
  10587. this._promise._captureStackTrace();
  10588. this._init$(undefined, -5);
  10589. }
  10590. util.inherits(ReductionPromiseArray, PromiseArray);
  10591. ReductionPromiseArray.prototype._gotAccum = function(accum) {
  10592. if (this._eachValues !== undefined &&
  10593. this._eachValues !== null &&
  10594. accum !== INTERNAL) {
  10595. this._eachValues.push(accum);
  10596. }
  10597. };
  10598. ReductionPromiseArray.prototype._eachComplete = function(value) {
  10599. if (this._eachValues !== null) {
  10600. this._eachValues.push(value);
  10601. }
  10602. return this._eachValues;
  10603. };
  10604. ReductionPromiseArray.prototype._init = function() {};
  10605. ReductionPromiseArray.prototype._resolveEmptyArray = function() {
  10606. this._resolve(this._eachValues !== undefined ? this._eachValues
  10607. : this._initialValue);
  10608. };
  10609. ReductionPromiseArray.prototype.shouldCopyValues = function () {
  10610. return false;
  10611. };
  10612. ReductionPromiseArray.prototype._resolve = function(value) {
  10613. this._promise._resolveCallback(value);
  10614. this._values = null;
  10615. };
  10616. ReductionPromiseArray.prototype._resultCancelled = function(sender) {
  10617. if (sender === this._initialValue) return this._cancel();
  10618. if (this._isResolved()) return;
  10619. this._resultCancelled$();
  10620. if (this._currentCancellable instanceof Promise) {
  10621. this._currentCancellable.cancel();
  10622. }
  10623. if (this._initialValue instanceof Promise) {
  10624. this._initialValue.cancel();
  10625. }
  10626. };
  10627. ReductionPromiseArray.prototype._iterate = function (values) {
  10628. this._values = values;
  10629. var value;
  10630. var i;
  10631. var length = values.length;
  10632. if (this._initialValue !== undefined) {
  10633. value = this._initialValue;
  10634. i = 0;
  10635. } else {
  10636. value = Promise.resolve(values[0]);
  10637. i = 1;
  10638. }
  10639. this._currentCancellable = value;
  10640. if (!value.isRejected()) {
  10641. for (; i < length; ++i) {
  10642. var ctx = {
  10643. accum: null,
  10644. value: values[i],
  10645. index: i,
  10646. length: length,
  10647. array: this
  10648. };
  10649. value = value._then(gotAccum, undefined, undefined, ctx, undefined);
  10650. }
  10651. }
  10652. if (this._eachValues !== undefined) {
  10653. value = value
  10654. ._then(this._eachComplete, undefined, undefined, this, undefined);
  10655. }
  10656. value._then(completed, completed, undefined, value, this);
  10657. };
  10658. Promise.prototype.reduce = function (fn, initialValue) {
  10659. return reduce(this, fn, initialValue, null);
  10660. };
  10661. Promise.reduce = function (promises, fn, initialValue, _each) {
  10662. return reduce(promises, fn, initialValue, _each);
  10663. };
  10664. function completed(valueOrReason, array) {
  10665. if (this.isFulfilled()) {
  10666. array._resolve(valueOrReason);
  10667. } else {
  10668. array._reject(valueOrReason);
  10669. }
  10670. }
  10671. function reduce(promises, fn, initialValue, _each) {
  10672. if (typeof fn !== "function") {
  10673. return apiRejection("expecting a function but got " + util.classString(fn));
  10674. }
  10675. var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
  10676. return array.promise();
  10677. }
  10678. function gotAccum(accum) {
  10679. this.accum = accum;
  10680. this.array._gotAccum(accum);
  10681. var value = tryConvertToPromise(this.value, this.array._promise);
  10682. if (value instanceof Promise) {
  10683. this.array._currentCancellable = value;
  10684. return value._then(gotValue, undefined, undefined, this, undefined);
  10685. } else {
  10686. return gotValue.call(this, value);
  10687. }
  10688. }
  10689. function gotValue(value) {
  10690. var array = this.array;
  10691. var promise = array._promise;
  10692. var fn = tryCatch(array._fn);
  10693. promise._pushContext();
  10694. var ret;
  10695. if (array._eachValues !== undefined) {
  10696. ret = fn.call(promise._boundValue(), value, this.index, this.length);
  10697. } else {
  10698. ret = fn.call(promise._boundValue(),
  10699. this.accum, value, this.index, this.length);
  10700. }
  10701. if (ret instanceof Promise) {
  10702. array._currentCancellable = ret;
  10703. }
  10704. var promiseCreated = promise._popContext();
  10705. debug.checkForgottenReturns(
  10706. ret,
  10707. promiseCreated,
  10708. array._eachValues !== undefined ? "Promise.each" : "Promise.reduce",
  10709. promise
  10710. );
  10711. return ret;
  10712. }
  10713. };
  10714. },{"./util":82}],75:[function(require,module,exports){
  10715. (function (process,global){
  10716. "use strict";
  10717. var util = require("./util");
  10718. var schedule;
  10719. var noAsyncScheduler = function() {
  10720. throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  10721. };
  10722. var NativePromise = util.getNativePromise();
  10723. if (util.isNode && typeof MutationObserver === "undefined") {
  10724. var GlobalSetImmediate = global.setImmediate;
  10725. var ProcessNextTick = process.nextTick;
  10726. schedule = util.isRecentNode
  10727. ? function(fn) { GlobalSetImmediate.call(global, fn); }
  10728. : function(fn) { ProcessNextTick.call(process, fn); };
  10729. } else if (typeof NativePromise === "function" &&
  10730. typeof NativePromise.resolve === "function") {
  10731. var nativePromise = NativePromise.resolve();
  10732. schedule = function(fn) {
  10733. nativePromise.then(fn);
  10734. };
  10735. } else if ((typeof MutationObserver !== "undefined") &&
  10736. !(typeof window !== "undefined" &&
  10737. window.navigator &&
  10738. (window.navigator.standalone || window.cordova))) {
  10739. schedule = (function() {
  10740. var div = document.createElement("div");
  10741. var opts = {attributes: true};
  10742. var toggleScheduled = false;
  10743. var div2 = document.createElement("div");
  10744. var o2 = new MutationObserver(function() {
  10745. div.classList.toggle("foo");
  10746. toggleScheduled = false;
  10747. });
  10748. o2.observe(div2, opts);
  10749. var scheduleToggle = function() {
  10750. if (toggleScheduled) return;
  10751. toggleScheduled = true;
  10752. div2.classList.toggle("foo");
  10753. };
  10754. return function schedule(fn) {
  10755. var o = new MutationObserver(function() {
  10756. o.disconnect();
  10757. fn();
  10758. });
  10759. o.observe(div, opts);
  10760. scheduleToggle();
  10761. };
  10762. })();
  10763. } else if (typeof setImmediate !== "undefined") {
  10764. schedule = function (fn) {
  10765. setImmediate(fn);
  10766. };
  10767. } else if (typeof setTimeout !== "undefined") {
  10768. schedule = function (fn) {
  10769. setTimeout(fn, 0);
  10770. };
  10771. } else {
  10772. schedule = noAsyncScheduler;
  10773. }
  10774. module.exports = schedule;
  10775. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  10776. },{"./util":82,"_process":101}],76:[function(require,module,exports){
  10777. "use strict";
  10778. module.exports =
  10779. function(Promise, PromiseArray, debug) {
  10780. var PromiseInspection = Promise.PromiseInspection;
  10781. var util = require("./util");
  10782. function SettledPromiseArray(values) {
  10783. this.constructor$(values);
  10784. }
  10785. util.inherits(SettledPromiseArray, PromiseArray);
  10786. SettledPromiseArray.prototype._promiseResolved = function (index, inspection) {
  10787. this._values[index] = inspection;
  10788. var totalResolved = ++this._totalResolved;
  10789. if (totalResolved >= this._length) {
  10790. this._resolve(this._values);
  10791. return true;
  10792. }
  10793. return false;
  10794. };
  10795. SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {
  10796. var ret = new PromiseInspection();
  10797. ret._bitField = 33554432;
  10798. ret._settledValueField = value;
  10799. return this._promiseResolved(index, ret);
  10800. };
  10801. SettledPromiseArray.prototype._promiseRejected = function (reason, index) {
  10802. var ret = new PromiseInspection();
  10803. ret._bitField = 16777216;
  10804. ret._settledValueField = reason;
  10805. return this._promiseResolved(index, ret);
  10806. };
  10807. Promise.settle = function (promises) {
  10808. debug.deprecated(".settle()", ".reflect()");
  10809. return new SettledPromiseArray(promises).promise();
  10810. };
  10811. Promise.prototype.settle = function () {
  10812. return Promise.settle(this);
  10813. };
  10814. };
  10815. },{"./util":82}],77:[function(require,module,exports){
  10816. "use strict";
  10817. module.exports =
  10818. function(Promise, PromiseArray, apiRejection) {
  10819. var util = require("./util");
  10820. var RangeError = require("./errors").RangeError;
  10821. var AggregateError = require("./errors").AggregateError;
  10822. var isArray = util.isArray;
  10823. var CANCELLATION = {};
  10824. function SomePromiseArray(values) {
  10825. this.constructor$(values);
  10826. this._howMany = 0;
  10827. this._unwrap = false;
  10828. this._initialized = false;
  10829. }
  10830. util.inherits(SomePromiseArray, PromiseArray);
  10831. SomePromiseArray.prototype._init = function () {
  10832. if (!this._initialized) {
  10833. return;
  10834. }
  10835. if (this._howMany === 0) {
  10836. this._resolve([]);
  10837. return;
  10838. }
  10839. this._init$(undefined, -5);
  10840. var isArrayResolved = isArray(this._values);
  10841. if (!this._isResolved() &&
  10842. isArrayResolved &&
  10843. this._howMany > this._canPossiblyFulfill()) {
  10844. this._reject(this._getRangeError(this.length()));
  10845. }
  10846. };
  10847. SomePromiseArray.prototype.init = function () {
  10848. this._initialized = true;
  10849. this._init();
  10850. };
  10851. SomePromiseArray.prototype.setUnwrap = function () {
  10852. this._unwrap = true;
  10853. };
  10854. SomePromiseArray.prototype.howMany = function () {
  10855. return this._howMany;
  10856. };
  10857. SomePromiseArray.prototype.setHowMany = function (count) {
  10858. this._howMany = count;
  10859. };
  10860. SomePromiseArray.prototype._promiseFulfilled = function (value) {
  10861. this._addFulfilled(value);
  10862. if (this._fulfilled() === this.howMany()) {
  10863. this._values.length = this.howMany();
  10864. if (this.howMany() === 1 && this._unwrap) {
  10865. this._resolve(this._values[0]);
  10866. } else {
  10867. this._resolve(this._values);
  10868. }
  10869. return true;
  10870. }
  10871. return false;
  10872. };
  10873. SomePromiseArray.prototype._promiseRejected = function (reason) {
  10874. this._addRejected(reason);
  10875. return this._checkOutcome();
  10876. };
  10877. SomePromiseArray.prototype._promiseCancelled = function () {
  10878. if (this._values instanceof Promise || this._values == null) {
  10879. return this._cancel();
  10880. }
  10881. this._addRejected(CANCELLATION);
  10882. return this._checkOutcome();
  10883. };
  10884. SomePromiseArray.prototype._checkOutcome = function() {
  10885. if (this.howMany() > this._canPossiblyFulfill()) {
  10886. var e = new AggregateError();
  10887. for (var i = this.length(); i < this._values.length; ++i) {
  10888. if (this._values[i] !== CANCELLATION) {
  10889. e.push(this._values[i]);
  10890. }
  10891. }
  10892. if (e.length > 0) {
  10893. this._reject(e);
  10894. } else {
  10895. this._cancel();
  10896. }
  10897. return true;
  10898. }
  10899. return false;
  10900. };
  10901. SomePromiseArray.prototype._fulfilled = function () {
  10902. return this._totalResolved;
  10903. };
  10904. SomePromiseArray.prototype._rejected = function () {
  10905. return this._values.length - this.length();
  10906. };
  10907. SomePromiseArray.prototype._addRejected = function (reason) {
  10908. this._values.push(reason);
  10909. };
  10910. SomePromiseArray.prototype._addFulfilled = function (value) {
  10911. this._values[this._totalResolved++] = value;
  10912. };
  10913. SomePromiseArray.prototype._canPossiblyFulfill = function () {
  10914. return this.length() - this._rejected();
  10915. };
  10916. SomePromiseArray.prototype._getRangeError = function (count) {
  10917. var message = "Input array must contain at least " +
  10918. this._howMany + " items but contains only " + count + " items";
  10919. return new RangeError(message);
  10920. };
  10921. SomePromiseArray.prototype._resolveEmptyArray = function () {
  10922. this._reject(this._getRangeError(0));
  10923. };
  10924. function some(promises, howMany) {
  10925. if ((howMany | 0) !== howMany || howMany < 0) {
  10926. return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  10927. }
  10928. var ret = new SomePromiseArray(promises);
  10929. var promise = ret.promise();
  10930. ret.setHowMany(howMany);
  10931. ret.init();
  10932. return promise;
  10933. }
  10934. Promise.some = function (promises, howMany) {
  10935. return some(promises, howMany);
  10936. };
  10937. Promise.prototype.some = function (howMany) {
  10938. return some(this, howMany);
  10939. };
  10940. Promise._SomePromiseArray = SomePromiseArray;
  10941. };
  10942. },{"./errors":58,"./util":82}],78:[function(require,module,exports){
  10943. "use strict";
  10944. module.exports = function(Promise) {
  10945. function PromiseInspection(promise) {
  10946. if (promise !== undefined) {
  10947. promise = promise._target();
  10948. this._bitField = promise._bitField;
  10949. this._settledValueField = promise._isFateSealed()
  10950. ? promise._settledValue() : undefined;
  10951. }
  10952. else {
  10953. this._bitField = 0;
  10954. this._settledValueField = undefined;
  10955. }
  10956. }
  10957. PromiseInspection.prototype._settledValue = function() {
  10958. return this._settledValueField;
  10959. };
  10960. var value = PromiseInspection.prototype.value = function () {
  10961. if (!this.isFulfilled()) {
  10962. throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  10963. }
  10964. return this._settledValue();
  10965. };
  10966. var reason = PromiseInspection.prototype.error =
  10967. PromiseInspection.prototype.reason = function () {
  10968. if (!this.isRejected()) {
  10969. throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
  10970. }
  10971. return this._settledValue();
  10972. };
  10973. var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
  10974. return (this._bitField & 33554432) !== 0;
  10975. };
  10976. var isRejected = PromiseInspection.prototype.isRejected = function () {
  10977. return (this._bitField & 16777216) !== 0;
  10978. };
  10979. var isPending = PromiseInspection.prototype.isPending = function () {
  10980. return (this._bitField & 50397184) === 0;
  10981. };
  10982. var isResolved = PromiseInspection.prototype.isResolved = function () {
  10983. return (this._bitField & 50331648) !== 0;
  10984. };
  10985. PromiseInspection.prototype.isCancelled = function() {
  10986. return (this._bitField & 8454144) !== 0;
  10987. };
  10988. Promise.prototype.__isCancelled = function() {
  10989. return (this._bitField & 65536) === 65536;
  10990. };
  10991. Promise.prototype._isCancelled = function() {
  10992. return this._target().__isCancelled();
  10993. };
  10994. Promise.prototype.isCancelled = function() {
  10995. return (this._target()._bitField & 8454144) !== 0;
  10996. };
  10997. Promise.prototype.isPending = function() {
  10998. return isPending.call(this._target());
  10999. };
  11000. Promise.prototype.isRejected = function() {
  11001. return isRejected.call(this._target());
  11002. };
  11003. Promise.prototype.isFulfilled = function() {
  11004. return isFulfilled.call(this._target());
  11005. };
  11006. Promise.prototype.isResolved = function() {
  11007. return isResolved.call(this._target());
  11008. };
  11009. Promise.prototype.value = function() {
  11010. return value.call(this._target());
  11011. };
  11012. Promise.prototype.reason = function() {
  11013. var target = this._target();
  11014. target._unsetRejectionIsUnhandled();
  11015. return reason.call(target);
  11016. };
  11017. Promise.prototype._value = function() {
  11018. return this._settledValue();
  11019. };
  11020. Promise.prototype._reason = function() {
  11021. this._unsetRejectionIsUnhandled();
  11022. return this._settledValue();
  11023. };
  11024. Promise.PromiseInspection = PromiseInspection;
  11025. };
  11026. },{}],79:[function(require,module,exports){
  11027. "use strict";
  11028. module.exports = function(Promise, INTERNAL) {
  11029. var util = require("./util");
  11030. var errorObj = util.errorObj;
  11031. var isObject = util.isObject;
  11032. function tryConvertToPromise(obj, context) {
  11033. if (isObject(obj)) {
  11034. if (obj instanceof Promise) return obj;
  11035. var then = getThen(obj);
  11036. if (then === errorObj) {
  11037. if (context) context._pushContext();
  11038. var ret = Promise.reject(then.e);
  11039. if (context) context._popContext();
  11040. return ret;
  11041. } else if (typeof then === "function") {
  11042. if (isAnyBluebirdPromise(obj)) {
  11043. var ret = new Promise(INTERNAL);
  11044. obj._then(
  11045. ret._fulfill,
  11046. ret._reject,
  11047. undefined,
  11048. ret,
  11049. null
  11050. );
  11051. return ret;
  11052. }
  11053. return doThenable(obj, then, context);
  11054. }
  11055. }
  11056. return obj;
  11057. }
  11058. function doGetThen(obj) {
  11059. return obj.then;
  11060. }
  11061. function getThen(obj) {
  11062. try {
  11063. return doGetThen(obj);
  11064. } catch (e) {
  11065. errorObj.e = e;
  11066. return errorObj;
  11067. }
  11068. }
  11069. var hasProp = {}.hasOwnProperty;
  11070. function isAnyBluebirdPromise(obj) {
  11071. try {
  11072. return hasProp.call(obj, "_promise0");
  11073. } catch (e) {
  11074. return false;
  11075. }
  11076. }
  11077. function doThenable(x, then, context) {
  11078. var promise = new Promise(INTERNAL);
  11079. var ret = promise;
  11080. if (context) context._pushContext();
  11081. promise._captureStackTrace();
  11082. if (context) context._popContext();
  11083. var synchronous = true;
  11084. var result = util.tryCatch(then).call(x, resolve, reject);
  11085. synchronous = false;
  11086. if (promise && result === errorObj) {
  11087. promise._rejectCallback(result.e, true, true);
  11088. promise = null;
  11089. }
  11090. function resolve(value) {
  11091. if (!promise) return;
  11092. promise._resolveCallback(value);
  11093. promise = null;
  11094. }
  11095. function reject(reason) {
  11096. if (!promise) return;
  11097. promise._rejectCallback(reason, synchronous, true);
  11098. promise = null;
  11099. }
  11100. return ret;
  11101. }
  11102. return tryConvertToPromise;
  11103. };
  11104. },{"./util":82}],80:[function(require,module,exports){
  11105. "use strict";
  11106. module.exports = function(Promise, INTERNAL, debug) {
  11107. var util = require("./util");
  11108. var TimeoutError = Promise.TimeoutError;
  11109. function HandleWrapper(handle) {
  11110. this.handle = handle;
  11111. }
  11112. HandleWrapper.prototype._resultCancelled = function() {
  11113. clearTimeout(this.handle);
  11114. };
  11115. var afterValue = function(value) { return delay(+this).thenReturn(value); };
  11116. var delay = Promise.delay = function (ms, value) {
  11117. var ret;
  11118. var handle;
  11119. if (value !== undefined) {
  11120. ret = Promise.resolve(value)
  11121. ._then(afterValue, null, null, ms, undefined);
  11122. if (debug.cancellation() && value instanceof Promise) {
  11123. ret._setOnCancel(value);
  11124. }
  11125. } else {
  11126. ret = new Promise(INTERNAL);
  11127. handle = setTimeout(function() { ret._fulfill(); }, +ms);
  11128. if (debug.cancellation()) {
  11129. ret._setOnCancel(new HandleWrapper(handle));
  11130. }
  11131. ret._captureStackTrace();
  11132. }
  11133. ret._setAsyncGuaranteed();
  11134. return ret;
  11135. };
  11136. Promise.prototype.delay = function (ms) {
  11137. return delay(ms, this);
  11138. };
  11139. var afterTimeout = function (promise, message, parent) {
  11140. var err;
  11141. if (typeof message !== "string") {
  11142. if (message instanceof Error) {
  11143. err = message;
  11144. } else {
  11145. err = new TimeoutError("operation timed out");
  11146. }
  11147. } else {
  11148. err = new TimeoutError(message);
  11149. }
  11150. util.markAsOriginatingFromRejection(err);
  11151. promise._attachExtraTrace(err);
  11152. promise._reject(err);
  11153. if (parent != null) {
  11154. parent.cancel();
  11155. }
  11156. };
  11157. function successClear(value) {
  11158. clearTimeout(this.handle);
  11159. return value;
  11160. }
  11161. function failureClear(reason) {
  11162. clearTimeout(this.handle);
  11163. throw reason;
  11164. }
  11165. Promise.prototype.timeout = function (ms, message) {
  11166. ms = +ms;
  11167. var ret, parent;
  11168. var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
  11169. if (ret.isPending()) {
  11170. afterTimeout(ret, message, parent);
  11171. }
  11172. }, ms));
  11173. if (debug.cancellation()) {
  11174. parent = this.then();
  11175. ret = parent._then(successClear, failureClear,
  11176. undefined, handleWrapper, undefined);
  11177. ret._setOnCancel(handleWrapper);
  11178. } else {
  11179. ret = this._then(successClear, failureClear,
  11180. undefined, handleWrapper, undefined);
  11181. }
  11182. return ret;
  11183. };
  11184. };
  11185. },{"./util":82}],81:[function(require,module,exports){
  11186. "use strict";
  11187. module.exports = function (Promise, apiRejection, tryConvertToPromise,
  11188. createContext, INTERNAL, debug) {
  11189. var util = require("./util");
  11190. var TypeError = require("./errors").TypeError;
  11191. var inherits = require("./util").inherits;
  11192. var errorObj = util.errorObj;
  11193. var tryCatch = util.tryCatch;
  11194. var NULL = {};
  11195. function thrower(e) {
  11196. setTimeout(function(){throw e;}, 0);
  11197. }
  11198. function castPreservingDisposable(thenable) {
  11199. var maybePromise = tryConvertToPromise(thenable);
  11200. if (maybePromise !== thenable &&
  11201. typeof thenable._isDisposable === "function" &&
  11202. typeof thenable._getDisposer === "function" &&
  11203. thenable._isDisposable()) {
  11204. maybePromise._setDisposable(thenable._getDisposer());
  11205. }
  11206. return maybePromise;
  11207. }
  11208. function dispose(resources, inspection) {
  11209. var i = 0;
  11210. var len = resources.length;
  11211. var ret = new Promise(INTERNAL);
  11212. function iterator() {
  11213. if (i >= len) return ret._fulfill();
  11214. var maybePromise = castPreservingDisposable(resources[i++]);
  11215. if (maybePromise instanceof Promise &&
  11216. maybePromise._isDisposable()) {
  11217. try {
  11218. maybePromise = tryConvertToPromise(
  11219. maybePromise._getDisposer().tryDispose(inspection),
  11220. resources.promise);
  11221. } catch (e) {
  11222. return thrower(e);
  11223. }
  11224. if (maybePromise instanceof Promise) {
  11225. return maybePromise._then(iterator, thrower,
  11226. null, null, null);
  11227. }
  11228. }
  11229. iterator();
  11230. }
  11231. iterator();
  11232. return ret;
  11233. }
  11234. function Disposer(data, promise, context) {
  11235. this._data = data;
  11236. this._promise = promise;
  11237. this._context = context;
  11238. }
  11239. Disposer.prototype.data = function () {
  11240. return this._data;
  11241. };
  11242. Disposer.prototype.promise = function () {
  11243. return this._promise;
  11244. };
  11245. Disposer.prototype.resource = function () {
  11246. if (this.promise().isFulfilled()) {
  11247. return this.promise().value();
  11248. }
  11249. return NULL;
  11250. };
  11251. Disposer.prototype.tryDispose = function(inspection) {
  11252. var resource = this.resource();
  11253. var context = this._context;
  11254. if (context !== undefined) context._pushContext();
  11255. var ret = resource !== NULL
  11256. ? this.doDispose(resource, inspection) : null;
  11257. if (context !== undefined) context._popContext();
  11258. this._promise._unsetDisposable();
  11259. this._data = null;
  11260. return ret;
  11261. };
  11262. Disposer.isDisposer = function (d) {
  11263. return (d != null &&
  11264. typeof d.resource === "function" &&
  11265. typeof d.tryDispose === "function");
  11266. };
  11267. function FunctionDisposer(fn, promise, context) {
  11268. this.constructor$(fn, promise, context);
  11269. }
  11270. inherits(FunctionDisposer, Disposer);
  11271. FunctionDisposer.prototype.doDispose = function (resource, inspection) {
  11272. var fn = this.data();
  11273. return fn.call(resource, resource, inspection);
  11274. };
  11275. function maybeUnwrapDisposer(value) {
  11276. if (Disposer.isDisposer(value)) {
  11277. this.resources[this.index]._setDisposable(value);
  11278. return value.promise();
  11279. }
  11280. return value;
  11281. }
  11282. function ResourceList(length) {
  11283. this.length = length;
  11284. this.promise = null;
  11285. this[length-1] = null;
  11286. }
  11287. ResourceList.prototype._resultCancelled = function() {
  11288. var len = this.length;
  11289. for (var i = 0; i < len; ++i) {
  11290. var item = this[i];
  11291. if (item instanceof Promise) {
  11292. item.cancel();
  11293. }
  11294. }
  11295. };
  11296. Promise.using = function () {
  11297. var len = arguments.length;
  11298. if (len < 2) return apiRejection(
  11299. "you must pass at least 2 arguments to Promise.using");
  11300. var fn = arguments[len - 1];
  11301. if (typeof fn !== "function") {
  11302. return apiRejection("expecting a function but got " + util.classString(fn));
  11303. }
  11304. var input;
  11305. var spreadArgs = true;
  11306. if (len === 2 && Array.isArray(arguments[0])) {
  11307. input = arguments[0];
  11308. len = input.length;
  11309. spreadArgs = false;
  11310. } else {
  11311. input = arguments;
  11312. len--;
  11313. }
  11314. var resources = new ResourceList(len);
  11315. for (var i = 0; i < len; ++i) {
  11316. var resource = input[i];
  11317. if (Disposer.isDisposer(resource)) {
  11318. var disposer = resource;
  11319. resource = resource.promise();
  11320. resource._setDisposable(disposer);
  11321. } else {
  11322. var maybePromise = tryConvertToPromise(resource);
  11323. if (maybePromise instanceof Promise) {
  11324. resource =
  11325. maybePromise._then(maybeUnwrapDisposer, null, null, {
  11326. resources: resources,
  11327. index: i
  11328. }, undefined);
  11329. }
  11330. }
  11331. resources[i] = resource;
  11332. }
  11333. var reflectedResources = new Array(resources.length);
  11334. for (var i = 0; i < reflectedResources.length; ++i) {
  11335. reflectedResources[i] = Promise.resolve(resources[i]).reflect();
  11336. }
  11337. var resultPromise = Promise.all(reflectedResources)
  11338. .then(function(inspections) {
  11339. for (var i = 0; i < inspections.length; ++i) {
  11340. var inspection = inspections[i];
  11341. if (inspection.isRejected()) {
  11342. errorObj.e = inspection.error();
  11343. return errorObj;
  11344. } else if (!inspection.isFulfilled()) {
  11345. resultPromise.cancel();
  11346. return;
  11347. }
  11348. inspections[i] = inspection.value();
  11349. }
  11350. promise._pushContext();
  11351. fn = tryCatch(fn);
  11352. var ret = spreadArgs
  11353. ? fn.apply(undefined, inspections) : fn(inspections);
  11354. var promiseCreated = promise._popContext();
  11355. debug.checkForgottenReturns(
  11356. ret, promiseCreated, "Promise.using", promise);
  11357. return ret;
  11358. });
  11359. var promise = resultPromise.lastly(function() {
  11360. var inspection = new Promise.PromiseInspection(resultPromise);
  11361. return dispose(resources, inspection);
  11362. });
  11363. resources.promise = promise;
  11364. promise._setOnCancel(resources);
  11365. return promise;
  11366. };
  11367. Promise.prototype._setDisposable = function (disposer) {
  11368. this._bitField = this._bitField | 131072;
  11369. this._disposer = disposer;
  11370. };
  11371. Promise.prototype._isDisposable = function () {
  11372. return (this._bitField & 131072) > 0;
  11373. };
  11374. Promise.prototype._getDisposer = function () {
  11375. return this._disposer;
  11376. };
  11377. Promise.prototype._unsetDisposable = function () {
  11378. this._bitField = this._bitField & (~131072);
  11379. this._disposer = undefined;
  11380. };
  11381. Promise.prototype.disposer = function (fn) {
  11382. if (typeof fn === "function") {
  11383. return new FunctionDisposer(fn, this, createContext());
  11384. }
  11385. throw new TypeError();
  11386. };
  11387. };
  11388. },{"./errors":58,"./util":82}],82:[function(require,module,exports){
  11389. (function (process,global){
  11390. "use strict";
  11391. var es5 = require("./es5");
  11392. var canEvaluate = typeof navigator == "undefined";
  11393. var errorObj = {e: {}};
  11394. var tryCatchTarget;
  11395. var globalObject = typeof self !== "undefined" ? self :
  11396. typeof window !== "undefined" ? window :
  11397. typeof global !== "undefined" ? global :
  11398. this !== undefined ? this : null;
  11399. function tryCatcher() {
  11400. try {
  11401. var target = tryCatchTarget;
  11402. tryCatchTarget = null;
  11403. return target.apply(this, arguments);
  11404. } catch (e) {
  11405. errorObj.e = e;
  11406. return errorObj;
  11407. }
  11408. }
  11409. function tryCatch(fn) {
  11410. tryCatchTarget = fn;
  11411. return tryCatcher;
  11412. }
  11413. var inherits = function(Child, Parent) {
  11414. var hasProp = {}.hasOwnProperty;
  11415. function T() {
  11416. this.constructor = Child;
  11417. this.constructor$ = Parent;
  11418. for (var propertyName in Parent.prototype) {
  11419. if (hasProp.call(Parent.prototype, propertyName) &&
  11420. propertyName.charAt(propertyName.length-1) !== "$"
  11421. ) {
  11422. this[propertyName + "$"] = Parent.prototype[propertyName];
  11423. }
  11424. }
  11425. }
  11426. T.prototype = Parent.prototype;
  11427. Child.prototype = new T();
  11428. return Child.prototype;
  11429. };
  11430. function isPrimitive(val) {
  11431. return val == null || val === true || val === false ||
  11432. typeof val === "string" || typeof val === "number";
  11433. }
  11434. function isObject(value) {
  11435. return typeof value === "function" ||
  11436. typeof value === "object" && value !== null;
  11437. }
  11438. function maybeWrapAsError(maybeError) {
  11439. if (!isPrimitive(maybeError)) return maybeError;
  11440. return new Error(safeToString(maybeError));
  11441. }
  11442. function withAppended(target, appendee) {
  11443. var len = target.length;
  11444. var ret = new Array(len + 1);
  11445. var i;
  11446. for (i = 0; i < len; ++i) {
  11447. ret[i] = target[i];
  11448. }
  11449. ret[i] = appendee;
  11450. return ret;
  11451. }
  11452. function getDataPropertyOrDefault(obj, key, defaultValue) {
  11453. if (es5.isES5) {
  11454. var desc = Object.getOwnPropertyDescriptor(obj, key);
  11455. if (desc != null) {
  11456. return desc.get == null && desc.set == null
  11457. ? desc.value
  11458. : defaultValue;
  11459. }
  11460. } else {
  11461. return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
  11462. }
  11463. }
  11464. function notEnumerableProp(obj, name, value) {
  11465. if (isPrimitive(obj)) return obj;
  11466. var descriptor = {
  11467. value: value,
  11468. configurable: true,
  11469. enumerable: false,
  11470. writable: true
  11471. };
  11472. es5.defineProperty(obj, name, descriptor);
  11473. return obj;
  11474. }
  11475. function thrower(r) {
  11476. throw r;
  11477. }
  11478. var inheritedDataKeys = (function() {
  11479. var excludedPrototypes = [
  11480. Array.prototype,
  11481. Object.prototype,
  11482. Function.prototype
  11483. ];
  11484. var isExcludedProto = function(val) {
  11485. for (var i = 0; i < excludedPrototypes.length; ++i) {
  11486. if (excludedPrototypes[i] === val) {
  11487. return true;
  11488. }
  11489. }
  11490. return false;
  11491. };
  11492. if (es5.isES5) {
  11493. var getKeys = Object.getOwnPropertyNames;
  11494. return function(obj) {
  11495. var ret = [];
  11496. var visitedKeys = Object.create(null);
  11497. while (obj != null && !isExcludedProto(obj)) {
  11498. var keys;
  11499. try {
  11500. keys = getKeys(obj);
  11501. } catch (e) {
  11502. return ret;
  11503. }
  11504. for (var i = 0; i < keys.length; ++i) {
  11505. var key = keys[i];
  11506. if (visitedKeys[key]) continue;
  11507. visitedKeys[key] = true;
  11508. var desc = Object.getOwnPropertyDescriptor(obj, key);
  11509. if (desc != null && desc.get == null && desc.set == null) {
  11510. ret.push(key);
  11511. }
  11512. }
  11513. obj = es5.getPrototypeOf(obj);
  11514. }
  11515. return ret;
  11516. };
  11517. } else {
  11518. var hasProp = {}.hasOwnProperty;
  11519. return function(obj) {
  11520. if (isExcludedProto(obj)) return [];
  11521. var ret = [];
  11522. /*jshint forin:false */
  11523. enumeration: for (var key in obj) {
  11524. if (hasProp.call(obj, key)) {
  11525. ret.push(key);
  11526. } else {
  11527. for (var i = 0; i < excludedPrototypes.length; ++i) {
  11528. if (hasProp.call(excludedPrototypes[i], key)) {
  11529. continue enumeration;
  11530. }
  11531. }
  11532. ret.push(key);
  11533. }
  11534. }
  11535. return ret;
  11536. };
  11537. }
  11538. })();
  11539. var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
  11540. function isClass(fn) {
  11541. try {
  11542. if (typeof fn === "function") {
  11543. var keys = es5.names(fn.prototype);
  11544. var hasMethods = es5.isES5 && keys.length > 1;
  11545. var hasMethodsOtherThanConstructor = keys.length > 0 &&
  11546. !(keys.length === 1 && keys[0] === "constructor");
  11547. var hasThisAssignmentAndStaticMethods =
  11548. thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
  11549. if (hasMethods || hasMethodsOtherThanConstructor ||
  11550. hasThisAssignmentAndStaticMethods) {
  11551. return true;
  11552. }
  11553. }
  11554. return false;
  11555. } catch (e) {
  11556. return false;
  11557. }
  11558. }
  11559. function toFastProperties(obj) {
  11560. /*jshint -W027,-W055,-W031*/
  11561. function FakeConstructor() {}
  11562. FakeConstructor.prototype = obj;
  11563. var l = 8;
  11564. while (l--) new FakeConstructor();
  11565. return obj;
  11566. eval(obj);
  11567. }
  11568. var rident = /^[a-z$_][a-z$_0-9]*$/i;
  11569. function isIdentifier(str) {
  11570. return rident.test(str);
  11571. }
  11572. function filledRange(count, prefix, suffix) {
  11573. var ret = new Array(count);
  11574. for(var i = 0; i < count; ++i) {
  11575. ret[i] = prefix + i + suffix;
  11576. }
  11577. return ret;
  11578. }
  11579. function safeToString(obj) {
  11580. try {
  11581. return obj + "";
  11582. } catch (e) {
  11583. return "[no string representation]";
  11584. }
  11585. }
  11586. function isError(obj) {
  11587. return obj !== null &&
  11588. typeof obj === "object" &&
  11589. typeof obj.message === "string" &&
  11590. typeof obj.name === "string";
  11591. }
  11592. function markAsOriginatingFromRejection(e) {
  11593. try {
  11594. notEnumerableProp(e, "isOperational", true);
  11595. }
  11596. catch(ignore) {}
  11597. }
  11598. function originatesFromRejection(e) {
  11599. if (e == null) return false;
  11600. return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
  11601. e["isOperational"] === true);
  11602. }
  11603. function canAttachTrace(obj) {
  11604. return isError(obj) && es5.propertyIsWritable(obj, "stack");
  11605. }
  11606. var ensureErrorObject = (function() {
  11607. if (!("stack" in new Error())) {
  11608. return function(value) {
  11609. if (canAttachTrace(value)) return value;
  11610. try {throw new Error(safeToString(value));}
  11611. catch(err) {return err;}
  11612. };
  11613. } else {
  11614. return function(value) {
  11615. if (canAttachTrace(value)) return value;
  11616. return new Error(safeToString(value));
  11617. };
  11618. }
  11619. })();
  11620. function classString(obj) {
  11621. return {}.toString.call(obj);
  11622. }
  11623. function copyDescriptors(from, to, filter) {
  11624. var keys = es5.names(from);
  11625. for (var i = 0; i < keys.length; ++i) {
  11626. var key = keys[i];
  11627. if (filter(key)) {
  11628. try {
  11629. es5.defineProperty(to, key, es5.getDescriptor(from, key));
  11630. } catch (ignore) {}
  11631. }
  11632. }
  11633. }
  11634. var asArray = function(v) {
  11635. if (es5.isArray(v)) {
  11636. return v;
  11637. }
  11638. return null;
  11639. };
  11640. if (typeof Symbol !== "undefined" && Symbol.iterator) {
  11641. var ArrayFrom = typeof Array.from === "function" ? function(v) {
  11642. return Array.from(v);
  11643. } : function(v) {
  11644. var ret = [];
  11645. var it = v[Symbol.iterator]();
  11646. var itResult;
  11647. while (!((itResult = it.next()).done)) {
  11648. ret.push(itResult.value);
  11649. }
  11650. return ret;
  11651. };
  11652. asArray = function(v) {
  11653. if (es5.isArray(v)) {
  11654. return v;
  11655. } else if (v != null && typeof v[Symbol.iterator] === "function") {
  11656. return ArrayFrom(v);
  11657. }
  11658. return null;
  11659. };
  11660. }
  11661. var isNode = typeof process !== "undefined" &&
  11662. classString(process).toLowerCase() === "[object process]";
  11663. var hasEnvVariables = typeof process !== "undefined" &&
  11664. typeof process.env !== "undefined";
  11665. function env(key) {
  11666. return hasEnvVariables ? process.env[key] : undefined;
  11667. }
  11668. function getNativePromise() {
  11669. if (typeof Promise === "function") {
  11670. try {
  11671. var promise = new Promise(function(){});
  11672. if ({}.toString.call(promise) === "[object Promise]") {
  11673. return Promise;
  11674. }
  11675. } catch (e) {}
  11676. }
  11677. }
  11678. function domainBind(self, cb) {
  11679. return self.bind(cb);
  11680. }
  11681. var ret = {
  11682. isClass: isClass,
  11683. isIdentifier: isIdentifier,
  11684. inheritedDataKeys: inheritedDataKeys,
  11685. getDataPropertyOrDefault: getDataPropertyOrDefault,
  11686. thrower: thrower,
  11687. isArray: es5.isArray,
  11688. asArray: asArray,
  11689. notEnumerableProp: notEnumerableProp,
  11690. isPrimitive: isPrimitive,
  11691. isObject: isObject,
  11692. isError: isError,
  11693. canEvaluate: canEvaluate,
  11694. errorObj: errorObj,
  11695. tryCatch: tryCatch,
  11696. inherits: inherits,
  11697. withAppended: withAppended,
  11698. maybeWrapAsError: maybeWrapAsError,
  11699. toFastProperties: toFastProperties,
  11700. filledRange: filledRange,
  11701. toString: safeToString,
  11702. canAttachTrace: canAttachTrace,
  11703. ensureErrorObject: ensureErrorObject,
  11704. originatesFromRejection: originatesFromRejection,
  11705. markAsOriginatingFromRejection: markAsOriginatingFromRejection,
  11706. classString: classString,
  11707. copyDescriptors: copyDescriptors,
  11708. hasDevTools: typeof chrome !== "undefined" && chrome &&
  11709. typeof chrome.loadTimes === "function",
  11710. isNode: isNode,
  11711. hasEnvVariables: hasEnvVariables,
  11712. env: env,
  11713. global: globalObject,
  11714. getNativePromise: getNativePromise,
  11715. domainBind: domainBind
  11716. };
  11717. ret.isRecentNode = ret.isNode && (function() {
  11718. var version = process.versions.node.split(".").map(Number);
  11719. return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
  11720. })();
  11721. if (ret.isNode) ret.toFastProperties(process);
  11722. try {throw new Error(); } catch (e) {ret.lastLineError = e;}
  11723. module.exports = ret;
  11724. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  11725. },{"./es5":59,"_process":101}],83:[function(require,module,exports){
  11726. (function (global){
  11727. /*!
  11728. * The buffer module from node.js, for the browser.
  11729. *
  11730. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  11731. * @license MIT
  11732. */
  11733. /* eslint-disable no-proto */
  11734. 'use strict'
  11735. var base64 = require('base64-js')
  11736. var ieee754 = require('ieee754')
  11737. var isArray = require('isarray')
  11738. exports.Buffer = Buffer
  11739. exports.SlowBuffer = SlowBuffer
  11740. exports.INSPECT_MAX_BYTES = 50
  11741. /**
  11742. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  11743. * === true Use Uint8Array implementation (fastest)
  11744. * === false Use Object implementation (most compatible, even IE6)
  11745. *
  11746. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  11747. * Opera 11.6+, iOS 4.2+.
  11748. *
  11749. * Due to various browser bugs, sometimes the Object implementation will be used even
  11750. * when the browser supports typed arrays.
  11751. *
  11752. * Note:
  11753. *
  11754. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  11755. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  11756. *
  11757. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  11758. *
  11759. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  11760. * incorrect length in some situations.
  11761. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  11762. * get the Object implementation, which is slower but behaves correctly.
  11763. */
  11764. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  11765. ? global.TYPED_ARRAY_SUPPORT
  11766. : typedArraySupport()
  11767. /*
  11768. * Export kMaxLength after typed array support is determined.
  11769. */
  11770. exports.kMaxLength = kMaxLength()
  11771. function typedArraySupport () {
  11772. try {
  11773. var arr = new Uint8Array(1)
  11774. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  11775. return arr.foo() === 42 && // typed array instances can be augmented
  11776. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  11777. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  11778. } catch (e) {
  11779. return false
  11780. }
  11781. }
  11782. function kMaxLength () {
  11783. return Buffer.TYPED_ARRAY_SUPPORT
  11784. ? 0x7fffffff
  11785. : 0x3fffffff
  11786. }
  11787. function createBuffer (that, length) {
  11788. if (kMaxLength() < length) {
  11789. throw new RangeError('Invalid typed array length')
  11790. }
  11791. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11792. // Return an augmented `Uint8Array` instance, for best performance
  11793. that = new Uint8Array(length)
  11794. that.__proto__ = Buffer.prototype
  11795. } else {
  11796. // Fallback: Return an object instance of the Buffer class
  11797. if (that === null) {
  11798. that = new Buffer(length)
  11799. }
  11800. that.length = length
  11801. }
  11802. return that
  11803. }
  11804. /**
  11805. * The Buffer constructor returns instances of `Uint8Array` that have their
  11806. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  11807. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  11808. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  11809. * returns a single octet.
  11810. *
  11811. * The `Uint8Array` prototype remains unmodified.
  11812. */
  11813. function Buffer (arg, encodingOrOffset, length) {
  11814. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  11815. return new Buffer(arg, encodingOrOffset, length)
  11816. }
  11817. // Common case.
  11818. if (typeof arg === 'number') {
  11819. if (typeof encodingOrOffset === 'string') {
  11820. throw new Error(
  11821. 'If encoding is specified then the first argument must be a string'
  11822. )
  11823. }
  11824. return allocUnsafe(this, arg)
  11825. }
  11826. return from(this, arg, encodingOrOffset, length)
  11827. }
  11828. Buffer.poolSize = 8192 // not used by this implementation
  11829. // TODO: Legacy, not needed anymore. Remove in next major version.
  11830. Buffer._augment = function (arr) {
  11831. arr.__proto__ = Buffer.prototype
  11832. return arr
  11833. }
  11834. function from (that, value, encodingOrOffset, length) {
  11835. if (typeof value === 'number') {
  11836. throw new TypeError('"value" argument must not be a number')
  11837. }
  11838. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  11839. return fromArrayBuffer(that, value, encodingOrOffset, length)
  11840. }
  11841. if (typeof value === 'string') {
  11842. return fromString(that, value, encodingOrOffset)
  11843. }
  11844. return fromObject(that, value)
  11845. }
  11846. /**
  11847. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  11848. * if value is a number.
  11849. * Buffer.from(str[, encoding])
  11850. * Buffer.from(array)
  11851. * Buffer.from(buffer)
  11852. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  11853. **/
  11854. Buffer.from = function (value, encodingOrOffset, length) {
  11855. return from(null, value, encodingOrOffset, length)
  11856. }
  11857. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11858. Buffer.prototype.__proto__ = Uint8Array.prototype
  11859. Buffer.__proto__ = Uint8Array
  11860. if (typeof Symbol !== 'undefined' && Symbol.species &&
  11861. Buffer[Symbol.species] === Buffer) {
  11862. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  11863. Object.defineProperty(Buffer, Symbol.species, {
  11864. value: null,
  11865. configurable: true
  11866. })
  11867. }
  11868. }
  11869. function assertSize (size) {
  11870. if (typeof size !== 'number') {
  11871. throw new TypeError('"size" argument must be a number')
  11872. } else if (size < 0) {
  11873. throw new RangeError('"size" argument must not be negative')
  11874. }
  11875. }
  11876. function alloc (that, size, fill, encoding) {
  11877. assertSize(size)
  11878. if (size <= 0) {
  11879. return createBuffer(that, size)
  11880. }
  11881. if (fill !== undefined) {
  11882. // Only pay attention to encoding if it's a string. This
  11883. // prevents accidentally sending in a number that would
  11884. // be interpretted as a start offset.
  11885. return typeof encoding === 'string'
  11886. ? createBuffer(that, size).fill(fill, encoding)
  11887. : createBuffer(that, size).fill(fill)
  11888. }
  11889. return createBuffer(that, size)
  11890. }
  11891. /**
  11892. * Creates a new filled Buffer instance.
  11893. * alloc(size[, fill[, encoding]])
  11894. **/
  11895. Buffer.alloc = function (size, fill, encoding) {
  11896. return alloc(null, size, fill, encoding)
  11897. }
  11898. function allocUnsafe (that, size) {
  11899. assertSize(size)
  11900. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  11901. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  11902. for (var i = 0; i < size; ++i) {
  11903. that[i] = 0
  11904. }
  11905. }
  11906. return that
  11907. }
  11908. /**
  11909. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  11910. * */
  11911. Buffer.allocUnsafe = function (size) {
  11912. return allocUnsafe(null, size)
  11913. }
  11914. /**
  11915. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  11916. */
  11917. Buffer.allocUnsafeSlow = function (size) {
  11918. return allocUnsafe(null, size)
  11919. }
  11920. function fromString (that, string, encoding) {
  11921. if (typeof encoding !== 'string' || encoding === '') {
  11922. encoding = 'utf8'
  11923. }
  11924. if (!Buffer.isEncoding(encoding)) {
  11925. throw new TypeError('"encoding" must be a valid string encoding')
  11926. }
  11927. var length = byteLength(string, encoding) | 0
  11928. that = createBuffer(that, length)
  11929. var actual = that.write(string, encoding)
  11930. if (actual !== length) {
  11931. // Writing a hex string, for example, that contains invalid characters will
  11932. // cause everything after the first invalid character to be ignored. (e.g.
  11933. // 'abxxcd' will be treated as 'ab')
  11934. that = that.slice(0, actual)
  11935. }
  11936. return that
  11937. }
  11938. function fromArrayLike (that, array) {
  11939. var length = array.length < 0 ? 0 : checked(array.length) | 0
  11940. that = createBuffer(that, length)
  11941. for (var i = 0; i < length; i += 1) {
  11942. that[i] = array[i] & 255
  11943. }
  11944. return that
  11945. }
  11946. function fromArrayBuffer (that, array, byteOffset, length) {
  11947. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  11948. if (byteOffset < 0 || array.byteLength < byteOffset) {
  11949. throw new RangeError('\'offset\' is out of bounds')
  11950. }
  11951. if (array.byteLength < byteOffset + (length || 0)) {
  11952. throw new RangeError('\'length\' is out of bounds')
  11953. }
  11954. if (byteOffset === undefined && length === undefined) {
  11955. array = new Uint8Array(array)
  11956. } else if (length === undefined) {
  11957. array = new Uint8Array(array, byteOffset)
  11958. } else {
  11959. array = new Uint8Array(array, byteOffset, length)
  11960. }
  11961. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11962. // Return an augmented `Uint8Array` instance, for best performance
  11963. that = array
  11964. that.__proto__ = Buffer.prototype
  11965. } else {
  11966. // Fallback: Return an object instance of the Buffer class
  11967. that = fromArrayLike(that, array)
  11968. }
  11969. return that
  11970. }
  11971. function fromObject (that, obj) {
  11972. if (Buffer.isBuffer(obj)) {
  11973. var len = checked(obj.length) | 0
  11974. that = createBuffer(that, len)
  11975. if (that.length === 0) {
  11976. return that
  11977. }
  11978. obj.copy(that, 0, 0, len)
  11979. return that
  11980. }
  11981. if (obj) {
  11982. if ((typeof ArrayBuffer !== 'undefined' &&
  11983. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  11984. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  11985. return createBuffer(that, 0)
  11986. }
  11987. return fromArrayLike(that, obj)
  11988. }
  11989. if (obj.type === 'Buffer' && isArray(obj.data)) {
  11990. return fromArrayLike(that, obj.data)
  11991. }
  11992. }
  11993. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  11994. }
  11995. function checked (length) {
  11996. // Note: cannot use `length < kMaxLength()` here because that fails when
  11997. // length is NaN (which is otherwise coerced to zero.)
  11998. if (length >= kMaxLength()) {
  11999. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  12000. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  12001. }
  12002. return length | 0
  12003. }
  12004. function SlowBuffer (length) {
  12005. if (+length != length) { // eslint-disable-line eqeqeq
  12006. length = 0
  12007. }
  12008. return Buffer.alloc(+length)
  12009. }
  12010. Buffer.isBuffer = function isBuffer (b) {
  12011. return !!(b != null && b._isBuffer)
  12012. }
  12013. Buffer.compare = function compare (a, b) {
  12014. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  12015. throw new TypeError('Arguments must be Buffers')
  12016. }
  12017. if (a === b) return 0
  12018. var x = a.length
  12019. var y = b.length
  12020. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  12021. if (a[i] !== b[i]) {
  12022. x = a[i]
  12023. y = b[i]
  12024. break
  12025. }
  12026. }
  12027. if (x < y) return -1
  12028. if (y < x) return 1
  12029. return 0
  12030. }
  12031. Buffer.isEncoding = function isEncoding (encoding) {
  12032. switch (String(encoding).toLowerCase()) {
  12033. case 'hex':
  12034. case 'utf8':
  12035. case 'utf-8':
  12036. case 'ascii':
  12037. case 'latin1':
  12038. case 'binary':
  12039. case 'base64':
  12040. case 'ucs2':
  12041. case 'ucs-2':
  12042. case 'utf16le':
  12043. case 'utf-16le':
  12044. return true
  12045. default:
  12046. return false
  12047. }
  12048. }
  12049. Buffer.concat = function concat (list, length) {
  12050. if (!isArray(list)) {
  12051. throw new TypeError('"list" argument must be an Array of Buffers')
  12052. }
  12053. if (list.length === 0) {
  12054. return Buffer.alloc(0)
  12055. }
  12056. var i
  12057. if (length === undefined) {
  12058. length = 0
  12059. for (i = 0; i < list.length; ++i) {
  12060. length += list[i].length
  12061. }
  12062. }
  12063. var buffer = Buffer.allocUnsafe(length)
  12064. var pos = 0
  12065. for (i = 0; i < list.length; ++i) {
  12066. var buf = list[i]
  12067. if (!Buffer.isBuffer(buf)) {
  12068. throw new TypeError('"list" argument must be an Array of Buffers')
  12069. }
  12070. buf.copy(buffer, pos)
  12071. pos += buf.length
  12072. }
  12073. return buffer
  12074. }
  12075. function byteLength (string, encoding) {
  12076. if (Buffer.isBuffer(string)) {
  12077. return string.length
  12078. }
  12079. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  12080. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  12081. return string.byteLength
  12082. }
  12083. if (typeof string !== 'string') {
  12084. string = '' + string
  12085. }
  12086. var len = string.length
  12087. if (len === 0) return 0
  12088. // Use a for loop to avoid recursion
  12089. var loweredCase = false
  12090. for (;;) {
  12091. switch (encoding) {
  12092. case 'ascii':
  12093. case 'latin1':
  12094. case 'binary':
  12095. return len
  12096. case 'utf8':
  12097. case 'utf-8':
  12098. case undefined:
  12099. return utf8ToBytes(string).length
  12100. case 'ucs2':
  12101. case 'ucs-2':
  12102. case 'utf16le':
  12103. case 'utf-16le':
  12104. return len * 2
  12105. case 'hex':
  12106. return len >>> 1
  12107. case 'base64':
  12108. return base64ToBytes(string).length
  12109. default:
  12110. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  12111. encoding = ('' + encoding).toLowerCase()
  12112. loweredCase = true
  12113. }
  12114. }
  12115. }
  12116. Buffer.byteLength = byteLength
  12117. function slowToString (encoding, start, end) {
  12118. var loweredCase = false
  12119. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  12120. // property of a typed array.
  12121. // This behaves neither like String nor Uint8Array in that we set start/end
  12122. // to their upper/lower bounds if the value passed is out of range.
  12123. // undefined is handled specially as per ECMA-262 6th Edition,
  12124. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  12125. if (start === undefined || start < 0) {
  12126. start = 0
  12127. }
  12128. // Return early if start > this.length. Done here to prevent potential uint32
  12129. // coercion fail below.
  12130. if (start > this.length) {
  12131. return ''
  12132. }
  12133. if (end === undefined || end > this.length) {
  12134. end = this.length
  12135. }
  12136. if (end <= 0) {
  12137. return ''
  12138. }
  12139. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  12140. end >>>= 0
  12141. start >>>= 0
  12142. if (end <= start) {
  12143. return ''
  12144. }
  12145. if (!encoding) encoding = 'utf8'
  12146. while (true) {
  12147. switch (encoding) {
  12148. case 'hex':
  12149. return hexSlice(this, start, end)
  12150. case 'utf8':
  12151. case 'utf-8':
  12152. return utf8Slice(this, start, end)
  12153. case 'ascii':
  12154. return asciiSlice(this, start, end)
  12155. case 'latin1':
  12156. case 'binary':
  12157. return latin1Slice(this, start, end)
  12158. case 'base64':
  12159. return base64Slice(this, start, end)
  12160. case 'ucs2':
  12161. case 'ucs-2':
  12162. case 'utf16le':
  12163. case 'utf-16le':
  12164. return utf16leSlice(this, start, end)
  12165. default:
  12166. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  12167. encoding = (encoding + '').toLowerCase()
  12168. loweredCase = true
  12169. }
  12170. }
  12171. }
  12172. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  12173. // Buffer instances.
  12174. Buffer.prototype._isBuffer = true
  12175. function swap (b, n, m) {
  12176. var i = b[n]
  12177. b[n] = b[m]
  12178. b[m] = i
  12179. }
  12180. Buffer.prototype.swap16 = function swap16 () {
  12181. var len = this.length
  12182. if (len % 2 !== 0) {
  12183. throw new RangeError('Buffer size must be a multiple of 16-bits')
  12184. }
  12185. for (var i = 0; i < len; i += 2) {
  12186. swap(this, i, i + 1)
  12187. }
  12188. return this
  12189. }
  12190. Buffer.prototype.swap32 = function swap32 () {
  12191. var len = this.length
  12192. if (len % 4 !== 0) {
  12193. throw new RangeError('Buffer size must be a multiple of 32-bits')
  12194. }
  12195. for (var i = 0; i < len; i += 4) {
  12196. swap(this, i, i + 3)
  12197. swap(this, i + 1, i + 2)
  12198. }
  12199. return this
  12200. }
  12201. Buffer.prototype.swap64 = function swap64 () {
  12202. var len = this.length
  12203. if (len % 8 !== 0) {
  12204. throw new RangeError('Buffer size must be a multiple of 64-bits')
  12205. }
  12206. for (var i = 0; i < len; i += 8) {
  12207. swap(this, i, i + 7)
  12208. swap(this, i + 1, i + 6)
  12209. swap(this, i + 2, i + 5)
  12210. swap(this, i + 3, i + 4)
  12211. }
  12212. return this
  12213. }
  12214. Buffer.prototype.toString = function toString () {
  12215. var length = this.length | 0
  12216. if (length === 0) return ''
  12217. if (arguments.length === 0) return utf8Slice(this, 0, length)
  12218. return slowToString.apply(this, arguments)
  12219. }
  12220. Buffer.prototype.equals = function equals (b) {
  12221. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  12222. if (this === b) return true
  12223. return Buffer.compare(this, b) === 0
  12224. }
  12225. Buffer.prototype.inspect = function inspect () {
  12226. var str = ''
  12227. var max = exports.INSPECT_MAX_BYTES
  12228. if (this.length > 0) {
  12229. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  12230. if (this.length > max) str += ' ... '
  12231. }
  12232. return '<Buffer ' + str + '>'
  12233. }
  12234. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  12235. if (!Buffer.isBuffer(target)) {
  12236. throw new TypeError('Argument must be a Buffer')
  12237. }
  12238. if (start === undefined) {
  12239. start = 0
  12240. }
  12241. if (end === undefined) {
  12242. end = target ? target.length : 0
  12243. }
  12244. if (thisStart === undefined) {
  12245. thisStart = 0
  12246. }
  12247. if (thisEnd === undefined) {
  12248. thisEnd = this.length
  12249. }
  12250. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  12251. throw new RangeError('out of range index')
  12252. }
  12253. if (thisStart >= thisEnd && start >= end) {
  12254. return 0
  12255. }
  12256. if (thisStart >= thisEnd) {
  12257. return -1
  12258. }
  12259. if (start >= end) {
  12260. return 1
  12261. }
  12262. start >>>= 0
  12263. end >>>= 0
  12264. thisStart >>>= 0
  12265. thisEnd >>>= 0
  12266. if (this === target) return 0
  12267. var x = thisEnd - thisStart
  12268. var y = end - start
  12269. var len = Math.min(x, y)
  12270. var thisCopy = this.slice(thisStart, thisEnd)
  12271. var targetCopy = target.slice(start, end)
  12272. for (var i = 0; i < len; ++i) {
  12273. if (thisCopy[i] !== targetCopy[i]) {
  12274. x = thisCopy[i]
  12275. y = targetCopy[i]
  12276. break
  12277. }
  12278. }
  12279. if (x < y) return -1
  12280. if (y < x) return 1
  12281. return 0
  12282. }
  12283. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  12284. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  12285. //
  12286. // Arguments:
  12287. // - buffer - a Buffer to search
  12288. // - val - a string, Buffer, or number
  12289. // - byteOffset - an index into `buffer`; will be clamped to an int32
  12290. // - encoding - an optional encoding, relevant is val is a string
  12291. // - dir - true for indexOf, false for lastIndexOf
  12292. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  12293. // Empty buffer means no match
  12294. if (buffer.length === 0) return -1
  12295. // Normalize byteOffset
  12296. if (typeof byteOffset === 'string') {
  12297. encoding = byteOffset
  12298. byteOffset = 0
  12299. } else if (byteOffset > 0x7fffffff) {
  12300. byteOffset = 0x7fffffff
  12301. } else if (byteOffset < -0x80000000) {
  12302. byteOffset = -0x80000000
  12303. }
  12304. byteOffset = +byteOffset // Coerce to Number.
  12305. if (isNaN(byteOffset)) {
  12306. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  12307. byteOffset = dir ? 0 : (buffer.length - 1)
  12308. }
  12309. // Normalize byteOffset: negative offsets start from the end of the buffer
  12310. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  12311. if (byteOffset >= buffer.length) {
  12312. if (dir) return -1
  12313. else byteOffset = buffer.length - 1
  12314. } else if (byteOffset < 0) {
  12315. if (dir) byteOffset = 0
  12316. else return -1
  12317. }
  12318. // Normalize val
  12319. if (typeof val === 'string') {
  12320. val = Buffer.from(val, encoding)
  12321. }
  12322. // Finally, search either indexOf (if dir is true) or lastIndexOf
  12323. if (Buffer.isBuffer(val)) {
  12324. // Special case: looking for empty string/buffer always fails
  12325. if (val.length === 0) {
  12326. return -1
  12327. }
  12328. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  12329. } else if (typeof val === 'number') {
  12330. val = val & 0xFF // Search for a byte value [0-255]
  12331. if (Buffer.TYPED_ARRAY_SUPPORT &&
  12332. typeof Uint8Array.prototype.indexOf === 'function') {
  12333. if (dir) {
  12334. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  12335. } else {
  12336. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  12337. }
  12338. }
  12339. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  12340. }
  12341. throw new TypeError('val must be string, number or Buffer')
  12342. }
  12343. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  12344. var indexSize = 1
  12345. var arrLength = arr.length
  12346. var valLength = val.length
  12347. if (encoding !== undefined) {
  12348. encoding = String(encoding).toLowerCase()
  12349. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  12350. encoding === 'utf16le' || encoding === 'utf-16le') {
  12351. if (arr.length < 2 || val.length < 2) {
  12352. return -1
  12353. }
  12354. indexSize = 2
  12355. arrLength /= 2
  12356. valLength /= 2
  12357. byteOffset /= 2
  12358. }
  12359. }
  12360. function read (buf, i) {
  12361. if (indexSize === 1) {
  12362. return buf[i]
  12363. } else {
  12364. return buf.readUInt16BE(i * indexSize)
  12365. }
  12366. }
  12367. var i
  12368. if (dir) {
  12369. var foundIndex = -1
  12370. for (i = byteOffset; i < arrLength; i++) {
  12371. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  12372. if (foundIndex === -1) foundIndex = i
  12373. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  12374. } else {
  12375. if (foundIndex !== -1) i -= i - foundIndex
  12376. foundIndex = -1
  12377. }
  12378. }
  12379. } else {
  12380. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  12381. for (i = byteOffset; i >= 0; i--) {
  12382. var found = true
  12383. for (var j = 0; j < valLength; j++) {
  12384. if (read(arr, i + j) !== read(val, j)) {
  12385. found = false
  12386. break
  12387. }
  12388. }
  12389. if (found) return i
  12390. }
  12391. }
  12392. return -1
  12393. }
  12394. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  12395. return this.indexOf(val, byteOffset, encoding) !== -1
  12396. }
  12397. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  12398. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  12399. }
  12400. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  12401. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  12402. }
  12403. function hexWrite (buf, string, offset, length) {
  12404. offset = Number(offset) || 0
  12405. var remaining = buf.length - offset
  12406. if (!length) {
  12407. length = remaining
  12408. } else {
  12409. length = Number(length)
  12410. if (length > remaining) {
  12411. length = remaining
  12412. }
  12413. }
  12414. // must be an even number of digits
  12415. var strLen = string.length
  12416. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  12417. if (length > strLen / 2) {
  12418. length = strLen / 2
  12419. }
  12420. for (var i = 0; i < length; ++i) {
  12421. var parsed = parseInt(string.substr(i * 2, 2), 16)
  12422. if (isNaN(parsed)) return i
  12423. buf[offset + i] = parsed
  12424. }
  12425. return i
  12426. }
  12427. function utf8Write (buf, string, offset, length) {
  12428. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  12429. }
  12430. function asciiWrite (buf, string, offset, length) {
  12431. return blitBuffer(asciiToBytes(string), buf, offset, length)
  12432. }
  12433. function latin1Write (buf, string, offset, length) {
  12434. return asciiWrite(buf, string, offset, length)
  12435. }
  12436. function base64Write (buf, string, offset, length) {
  12437. return blitBuffer(base64ToBytes(string), buf, offset, length)
  12438. }
  12439. function ucs2Write (buf, string, offset, length) {
  12440. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  12441. }
  12442. Buffer.prototype.write = function write (string, offset, length, encoding) {
  12443. // Buffer#write(string)
  12444. if (offset === undefined) {
  12445. encoding = 'utf8'
  12446. length = this.length
  12447. offset = 0
  12448. // Buffer#write(string, encoding)
  12449. } else if (length === undefined && typeof offset === 'string') {
  12450. encoding = offset
  12451. length = this.length
  12452. offset = 0
  12453. // Buffer#write(string, offset[, length][, encoding])
  12454. } else if (isFinite(offset)) {
  12455. offset = offset | 0
  12456. if (isFinite(length)) {
  12457. length = length | 0
  12458. if (encoding === undefined) encoding = 'utf8'
  12459. } else {
  12460. encoding = length
  12461. length = undefined
  12462. }
  12463. // legacy write(string, encoding, offset, length) - remove in v0.13
  12464. } else {
  12465. throw new Error(
  12466. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  12467. )
  12468. }
  12469. var remaining = this.length - offset
  12470. if (length === undefined || length > remaining) length = remaining
  12471. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  12472. throw new RangeError('Attempt to write outside buffer bounds')
  12473. }
  12474. if (!encoding) encoding = 'utf8'
  12475. var loweredCase = false
  12476. for (;;) {
  12477. switch (encoding) {
  12478. case 'hex':
  12479. return hexWrite(this, string, offset, length)
  12480. case 'utf8':
  12481. case 'utf-8':
  12482. return utf8Write(this, string, offset, length)
  12483. case 'ascii':
  12484. return asciiWrite(this, string, offset, length)
  12485. case 'latin1':
  12486. case 'binary':
  12487. return latin1Write(this, string, offset, length)
  12488. case 'base64':
  12489. // Warning: maxLength not taken into account in base64Write
  12490. return base64Write(this, string, offset, length)
  12491. case 'ucs2':
  12492. case 'ucs-2':
  12493. case 'utf16le':
  12494. case 'utf-16le':
  12495. return ucs2Write(this, string, offset, length)
  12496. default:
  12497. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  12498. encoding = ('' + encoding).toLowerCase()
  12499. loweredCase = true
  12500. }
  12501. }
  12502. }
  12503. Buffer.prototype.toJSON = function toJSON () {
  12504. return {
  12505. type: 'Buffer',
  12506. data: Array.prototype.slice.call(this._arr || this, 0)
  12507. }
  12508. }
  12509. function base64Slice (buf, start, end) {
  12510. if (start === 0 && end === buf.length) {
  12511. return base64.fromByteArray(buf)
  12512. } else {
  12513. return base64.fromByteArray(buf.slice(start, end))
  12514. }
  12515. }
  12516. function utf8Slice (buf, start, end) {
  12517. end = Math.min(buf.length, end)
  12518. var res = []
  12519. var i = start
  12520. while (i < end) {
  12521. var firstByte = buf[i]
  12522. var codePoint = null
  12523. var bytesPerSequence = (firstByte > 0xEF) ? 4
  12524. : (firstByte > 0xDF) ? 3
  12525. : (firstByte > 0xBF) ? 2
  12526. : 1
  12527. if (i + bytesPerSequence <= end) {
  12528. var secondByte, thirdByte, fourthByte, tempCodePoint
  12529. switch (bytesPerSequence) {
  12530. case 1:
  12531. if (firstByte < 0x80) {
  12532. codePoint = firstByte
  12533. }
  12534. break
  12535. case 2:
  12536. secondByte = buf[i + 1]
  12537. if ((secondByte & 0xC0) === 0x80) {
  12538. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  12539. if (tempCodePoint > 0x7F) {
  12540. codePoint = tempCodePoint
  12541. }
  12542. }
  12543. break
  12544. case 3:
  12545. secondByte = buf[i + 1]
  12546. thirdByte = buf[i + 2]
  12547. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  12548. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  12549. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  12550. codePoint = tempCodePoint
  12551. }
  12552. }
  12553. break
  12554. case 4:
  12555. secondByte = buf[i + 1]
  12556. thirdByte = buf[i + 2]
  12557. fourthByte = buf[i + 3]
  12558. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  12559. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  12560. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  12561. codePoint = tempCodePoint
  12562. }
  12563. }
  12564. }
  12565. }
  12566. if (codePoint === null) {
  12567. // we did not generate a valid codePoint so insert a
  12568. // replacement char (U+FFFD) and advance only 1 byte
  12569. codePoint = 0xFFFD
  12570. bytesPerSequence = 1
  12571. } else if (codePoint > 0xFFFF) {
  12572. // encode to utf16 (surrogate pair dance)
  12573. codePoint -= 0x10000
  12574. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  12575. codePoint = 0xDC00 | codePoint & 0x3FF
  12576. }
  12577. res.push(codePoint)
  12578. i += bytesPerSequence
  12579. }
  12580. return decodeCodePointsArray(res)
  12581. }
  12582. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  12583. // the lowest limit is Chrome, with 0x10000 args.
  12584. // We go 1 magnitude less, for safety
  12585. var MAX_ARGUMENTS_LENGTH = 0x1000
  12586. function decodeCodePointsArray (codePoints) {
  12587. var len = codePoints.length
  12588. if (len <= MAX_ARGUMENTS_LENGTH) {
  12589. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  12590. }
  12591. // Decode in chunks to avoid "call stack size exceeded".
  12592. var res = ''
  12593. var i = 0
  12594. while (i < len) {
  12595. res += String.fromCharCode.apply(
  12596. String,
  12597. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  12598. )
  12599. }
  12600. return res
  12601. }
  12602. function asciiSlice (buf, start, end) {
  12603. var ret = ''
  12604. end = Math.min(buf.length, end)
  12605. for (var i = start; i < end; ++i) {
  12606. ret += String.fromCharCode(buf[i] & 0x7F)
  12607. }
  12608. return ret
  12609. }
  12610. function latin1Slice (buf, start, end) {
  12611. var ret = ''
  12612. end = Math.min(buf.length, end)
  12613. for (var i = start; i < end; ++i) {
  12614. ret += String.fromCharCode(buf[i])
  12615. }
  12616. return ret
  12617. }
  12618. function hexSlice (buf, start, end) {
  12619. var len = buf.length
  12620. if (!start || start < 0) start = 0
  12621. if (!end || end < 0 || end > len) end = len
  12622. var out = ''
  12623. for (var i = start; i < end; ++i) {
  12624. out += toHex(buf[i])
  12625. }
  12626. return out
  12627. }
  12628. function utf16leSlice (buf, start, end) {
  12629. var bytes = buf.slice(start, end)
  12630. var res = ''
  12631. for (var i = 0; i < bytes.length; i += 2) {
  12632. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  12633. }
  12634. return res
  12635. }
  12636. Buffer.prototype.slice = function slice (start, end) {
  12637. var len = this.length
  12638. start = ~~start
  12639. end = end === undefined ? len : ~~end
  12640. if (start < 0) {
  12641. start += len
  12642. if (start < 0) start = 0
  12643. } else if (start > len) {
  12644. start = len
  12645. }
  12646. if (end < 0) {
  12647. end += len
  12648. if (end < 0) end = 0
  12649. } else if (end > len) {
  12650. end = len
  12651. }
  12652. if (end < start) end = start
  12653. var newBuf
  12654. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12655. newBuf = this.subarray(start, end)
  12656. newBuf.__proto__ = Buffer.prototype
  12657. } else {
  12658. var sliceLen = end - start
  12659. newBuf = new Buffer(sliceLen, undefined)
  12660. for (var i = 0; i < sliceLen; ++i) {
  12661. newBuf[i] = this[i + start]
  12662. }
  12663. }
  12664. return newBuf
  12665. }
  12666. /*
  12667. * Need to make sure that buffer isn't trying to write out of bounds.
  12668. */
  12669. function checkOffset (offset, ext, length) {
  12670. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  12671. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  12672. }
  12673. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  12674. offset = offset | 0
  12675. byteLength = byteLength | 0
  12676. if (!noAssert) checkOffset(offset, byteLength, this.length)
  12677. var val = this[offset]
  12678. var mul = 1
  12679. var i = 0
  12680. while (++i < byteLength && (mul *= 0x100)) {
  12681. val += this[offset + i] * mul
  12682. }
  12683. return val
  12684. }
  12685. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  12686. offset = offset | 0
  12687. byteLength = byteLength | 0
  12688. if (!noAssert) {
  12689. checkOffset(offset, byteLength, this.length)
  12690. }
  12691. var val = this[offset + --byteLength]
  12692. var mul = 1
  12693. while (byteLength > 0 && (mul *= 0x100)) {
  12694. val += this[offset + --byteLength] * mul
  12695. }
  12696. return val
  12697. }
  12698. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  12699. if (!noAssert) checkOffset(offset, 1, this.length)
  12700. return this[offset]
  12701. }
  12702. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  12703. if (!noAssert) checkOffset(offset, 2, this.length)
  12704. return this[offset] | (this[offset + 1] << 8)
  12705. }
  12706. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  12707. if (!noAssert) checkOffset(offset, 2, this.length)
  12708. return (this[offset] << 8) | this[offset + 1]
  12709. }
  12710. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  12711. if (!noAssert) checkOffset(offset, 4, this.length)
  12712. return ((this[offset]) |
  12713. (this[offset + 1] << 8) |
  12714. (this[offset + 2] << 16)) +
  12715. (this[offset + 3] * 0x1000000)
  12716. }
  12717. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  12718. if (!noAssert) checkOffset(offset, 4, this.length)
  12719. return (this[offset] * 0x1000000) +
  12720. ((this[offset + 1] << 16) |
  12721. (this[offset + 2] << 8) |
  12722. this[offset + 3])
  12723. }
  12724. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  12725. offset = offset | 0
  12726. byteLength = byteLength | 0
  12727. if (!noAssert) checkOffset(offset, byteLength, this.length)
  12728. var val = this[offset]
  12729. var mul = 1
  12730. var i = 0
  12731. while (++i < byteLength && (mul *= 0x100)) {
  12732. val += this[offset + i] * mul
  12733. }
  12734. mul *= 0x80
  12735. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  12736. return val
  12737. }
  12738. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  12739. offset = offset | 0
  12740. byteLength = byteLength | 0
  12741. if (!noAssert) checkOffset(offset, byteLength, this.length)
  12742. var i = byteLength
  12743. var mul = 1
  12744. var val = this[offset + --i]
  12745. while (i > 0 && (mul *= 0x100)) {
  12746. val += this[offset + --i] * mul
  12747. }
  12748. mul *= 0x80
  12749. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  12750. return val
  12751. }
  12752. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  12753. if (!noAssert) checkOffset(offset, 1, this.length)
  12754. if (!(this[offset] & 0x80)) return (this[offset])
  12755. return ((0xff - this[offset] + 1) * -1)
  12756. }
  12757. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  12758. if (!noAssert) checkOffset(offset, 2, this.length)
  12759. var val = this[offset] | (this[offset + 1] << 8)
  12760. return (val & 0x8000) ? val | 0xFFFF0000 : val
  12761. }
  12762. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  12763. if (!noAssert) checkOffset(offset, 2, this.length)
  12764. var val = this[offset + 1] | (this[offset] << 8)
  12765. return (val & 0x8000) ? val | 0xFFFF0000 : val
  12766. }
  12767. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  12768. if (!noAssert) checkOffset(offset, 4, this.length)
  12769. return (this[offset]) |
  12770. (this[offset + 1] << 8) |
  12771. (this[offset + 2] << 16) |
  12772. (this[offset + 3] << 24)
  12773. }
  12774. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  12775. if (!noAssert) checkOffset(offset, 4, this.length)
  12776. return (this[offset] << 24) |
  12777. (this[offset + 1] << 16) |
  12778. (this[offset + 2] << 8) |
  12779. (this[offset + 3])
  12780. }
  12781. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  12782. if (!noAssert) checkOffset(offset, 4, this.length)
  12783. return ieee754.read(this, offset, true, 23, 4)
  12784. }
  12785. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  12786. if (!noAssert) checkOffset(offset, 4, this.length)
  12787. return ieee754.read(this, offset, false, 23, 4)
  12788. }
  12789. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  12790. if (!noAssert) checkOffset(offset, 8, this.length)
  12791. return ieee754.read(this, offset, true, 52, 8)
  12792. }
  12793. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  12794. if (!noAssert) checkOffset(offset, 8, this.length)
  12795. return ieee754.read(this, offset, false, 52, 8)
  12796. }
  12797. function checkInt (buf, value, offset, ext, max, min) {
  12798. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  12799. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  12800. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  12801. }
  12802. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  12803. value = +value
  12804. offset = offset | 0
  12805. byteLength = byteLength | 0
  12806. if (!noAssert) {
  12807. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  12808. checkInt(this, value, offset, byteLength, maxBytes, 0)
  12809. }
  12810. var mul = 1
  12811. var i = 0
  12812. this[offset] = value & 0xFF
  12813. while (++i < byteLength && (mul *= 0x100)) {
  12814. this[offset + i] = (value / mul) & 0xFF
  12815. }
  12816. return offset + byteLength
  12817. }
  12818. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  12819. value = +value
  12820. offset = offset | 0
  12821. byteLength = byteLength | 0
  12822. if (!noAssert) {
  12823. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  12824. checkInt(this, value, offset, byteLength, maxBytes, 0)
  12825. }
  12826. var i = byteLength - 1
  12827. var mul = 1
  12828. this[offset + i] = value & 0xFF
  12829. while (--i >= 0 && (mul *= 0x100)) {
  12830. this[offset + i] = (value / mul) & 0xFF
  12831. }
  12832. return offset + byteLength
  12833. }
  12834. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  12835. value = +value
  12836. offset = offset | 0
  12837. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  12838. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  12839. this[offset] = (value & 0xff)
  12840. return offset + 1
  12841. }
  12842. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  12843. if (value < 0) value = 0xffff + value + 1
  12844. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  12845. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  12846. (littleEndian ? i : 1 - i) * 8
  12847. }
  12848. }
  12849. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  12850. value = +value
  12851. offset = offset | 0
  12852. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  12853. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12854. this[offset] = (value & 0xff)
  12855. this[offset + 1] = (value >>> 8)
  12856. } else {
  12857. objectWriteUInt16(this, value, offset, true)
  12858. }
  12859. return offset + 2
  12860. }
  12861. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  12862. value = +value
  12863. offset = offset | 0
  12864. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  12865. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12866. this[offset] = (value >>> 8)
  12867. this[offset + 1] = (value & 0xff)
  12868. } else {
  12869. objectWriteUInt16(this, value, offset, false)
  12870. }
  12871. return offset + 2
  12872. }
  12873. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  12874. if (value < 0) value = 0xffffffff + value + 1
  12875. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  12876. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  12877. }
  12878. }
  12879. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  12880. value = +value
  12881. offset = offset | 0
  12882. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  12883. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12884. this[offset + 3] = (value >>> 24)
  12885. this[offset + 2] = (value >>> 16)
  12886. this[offset + 1] = (value >>> 8)
  12887. this[offset] = (value & 0xff)
  12888. } else {
  12889. objectWriteUInt32(this, value, offset, true)
  12890. }
  12891. return offset + 4
  12892. }
  12893. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  12894. value = +value
  12895. offset = offset | 0
  12896. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  12897. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12898. this[offset] = (value >>> 24)
  12899. this[offset + 1] = (value >>> 16)
  12900. this[offset + 2] = (value >>> 8)
  12901. this[offset + 3] = (value & 0xff)
  12902. } else {
  12903. objectWriteUInt32(this, value, offset, false)
  12904. }
  12905. return offset + 4
  12906. }
  12907. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  12908. value = +value
  12909. offset = offset | 0
  12910. if (!noAssert) {
  12911. var limit = Math.pow(2, 8 * byteLength - 1)
  12912. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  12913. }
  12914. var i = 0
  12915. var mul = 1
  12916. var sub = 0
  12917. this[offset] = value & 0xFF
  12918. while (++i < byteLength && (mul *= 0x100)) {
  12919. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  12920. sub = 1
  12921. }
  12922. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  12923. }
  12924. return offset + byteLength
  12925. }
  12926. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  12927. value = +value
  12928. offset = offset | 0
  12929. if (!noAssert) {
  12930. var limit = Math.pow(2, 8 * byteLength - 1)
  12931. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  12932. }
  12933. var i = byteLength - 1
  12934. var mul = 1
  12935. var sub = 0
  12936. this[offset + i] = value & 0xFF
  12937. while (--i >= 0 && (mul *= 0x100)) {
  12938. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  12939. sub = 1
  12940. }
  12941. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  12942. }
  12943. return offset + byteLength
  12944. }
  12945. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  12946. value = +value
  12947. offset = offset | 0
  12948. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  12949. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  12950. if (value < 0) value = 0xff + value + 1
  12951. this[offset] = (value & 0xff)
  12952. return offset + 1
  12953. }
  12954. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  12955. value = +value
  12956. offset = offset | 0
  12957. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  12958. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12959. this[offset] = (value & 0xff)
  12960. this[offset + 1] = (value >>> 8)
  12961. } else {
  12962. objectWriteUInt16(this, value, offset, true)
  12963. }
  12964. return offset + 2
  12965. }
  12966. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  12967. value = +value
  12968. offset = offset | 0
  12969. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  12970. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12971. this[offset] = (value >>> 8)
  12972. this[offset + 1] = (value & 0xff)
  12973. } else {
  12974. objectWriteUInt16(this, value, offset, false)
  12975. }
  12976. return offset + 2
  12977. }
  12978. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  12979. value = +value
  12980. offset = offset | 0
  12981. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  12982. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12983. this[offset] = (value & 0xff)
  12984. this[offset + 1] = (value >>> 8)
  12985. this[offset + 2] = (value >>> 16)
  12986. this[offset + 3] = (value >>> 24)
  12987. } else {
  12988. objectWriteUInt32(this, value, offset, true)
  12989. }
  12990. return offset + 4
  12991. }
  12992. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  12993. value = +value
  12994. offset = offset | 0
  12995. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  12996. if (value < 0) value = 0xffffffff + value + 1
  12997. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12998. this[offset] = (value >>> 24)
  12999. this[offset + 1] = (value >>> 16)
  13000. this[offset + 2] = (value >>> 8)
  13001. this[offset + 3] = (value & 0xff)
  13002. } else {
  13003. objectWriteUInt32(this, value, offset, false)
  13004. }
  13005. return offset + 4
  13006. }
  13007. function checkIEEE754 (buf, value, offset, ext, max, min) {
  13008. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  13009. if (offset < 0) throw new RangeError('Index out of range')
  13010. }
  13011. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  13012. if (!noAssert) {
  13013. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  13014. }
  13015. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  13016. return offset + 4
  13017. }
  13018. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  13019. return writeFloat(this, value, offset, true, noAssert)
  13020. }
  13021. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  13022. return writeFloat(this, value, offset, false, noAssert)
  13023. }
  13024. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  13025. if (!noAssert) {
  13026. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  13027. }
  13028. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  13029. return offset + 8
  13030. }
  13031. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  13032. return writeDouble(this, value, offset, true, noAssert)
  13033. }
  13034. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  13035. return writeDouble(this, value, offset, false, noAssert)
  13036. }
  13037. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  13038. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  13039. if (!start) start = 0
  13040. if (!end && end !== 0) end = this.length
  13041. if (targetStart >= target.length) targetStart = target.length
  13042. if (!targetStart) targetStart = 0
  13043. if (end > 0 && end < start) end = start
  13044. // Copy 0 bytes; we're done
  13045. if (end === start) return 0
  13046. if (target.length === 0 || this.length === 0) return 0
  13047. // Fatal error conditions
  13048. if (targetStart < 0) {
  13049. throw new RangeError('targetStart out of bounds')
  13050. }
  13051. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  13052. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  13053. // Are we oob?
  13054. if (end > this.length) end = this.length
  13055. if (target.length - targetStart < end - start) {
  13056. end = target.length - targetStart + start
  13057. }
  13058. var len = end - start
  13059. var i
  13060. if (this === target && start < targetStart && targetStart < end) {
  13061. // descending copy from end
  13062. for (i = len - 1; i >= 0; --i) {
  13063. target[i + targetStart] = this[i + start]
  13064. }
  13065. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  13066. // ascending copy from start
  13067. for (i = 0; i < len; ++i) {
  13068. target[i + targetStart] = this[i + start]
  13069. }
  13070. } else {
  13071. Uint8Array.prototype.set.call(
  13072. target,
  13073. this.subarray(start, start + len),
  13074. targetStart
  13075. )
  13076. }
  13077. return len
  13078. }
  13079. // Usage:
  13080. // buffer.fill(number[, offset[, end]])
  13081. // buffer.fill(buffer[, offset[, end]])
  13082. // buffer.fill(string[, offset[, end]][, encoding])
  13083. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  13084. // Handle string cases:
  13085. if (typeof val === 'string') {
  13086. if (typeof start === 'string') {
  13087. encoding = start
  13088. start = 0
  13089. end = this.length
  13090. } else if (typeof end === 'string') {
  13091. encoding = end
  13092. end = this.length
  13093. }
  13094. if (val.length === 1) {
  13095. var code = val.charCodeAt(0)
  13096. if (code < 256) {
  13097. val = code
  13098. }
  13099. }
  13100. if (encoding !== undefined && typeof encoding !== 'string') {
  13101. throw new TypeError('encoding must be a string')
  13102. }
  13103. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  13104. throw new TypeError('Unknown encoding: ' + encoding)
  13105. }
  13106. } else if (typeof val === 'number') {
  13107. val = val & 255
  13108. }
  13109. // Invalid ranges are not set to a default, so can range check early.
  13110. if (start < 0 || this.length < start || this.length < end) {
  13111. throw new RangeError('Out of range index')
  13112. }
  13113. if (end <= start) {
  13114. return this
  13115. }
  13116. start = start >>> 0
  13117. end = end === undefined ? this.length : end >>> 0
  13118. if (!val) val = 0
  13119. var i
  13120. if (typeof val === 'number') {
  13121. for (i = start; i < end; ++i) {
  13122. this[i] = val
  13123. }
  13124. } else {
  13125. var bytes = Buffer.isBuffer(val)
  13126. ? val
  13127. : utf8ToBytes(new Buffer(val, encoding).toString())
  13128. var len = bytes.length
  13129. for (i = 0; i < end - start; ++i) {
  13130. this[i + start] = bytes[i % len]
  13131. }
  13132. }
  13133. return this
  13134. }
  13135. // HELPER FUNCTIONS
  13136. // ================
  13137. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  13138. function base64clean (str) {
  13139. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  13140. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  13141. // Node converts strings with length < 2 to ''
  13142. if (str.length < 2) return ''
  13143. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  13144. while (str.length % 4 !== 0) {
  13145. str = str + '='
  13146. }
  13147. return str
  13148. }
  13149. function stringtrim (str) {
  13150. if (str.trim) return str.trim()
  13151. return str.replace(/^\s+|\s+$/g, '')
  13152. }
  13153. function toHex (n) {
  13154. if (n < 16) return '0' + n.toString(16)
  13155. return n.toString(16)
  13156. }
  13157. function utf8ToBytes (string, units) {
  13158. units = units || Infinity
  13159. var codePoint
  13160. var length = string.length
  13161. var leadSurrogate = null
  13162. var bytes = []
  13163. for (var i = 0; i < length; ++i) {
  13164. codePoint = string.charCodeAt(i)
  13165. // is surrogate component
  13166. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  13167. // last char was a lead
  13168. if (!leadSurrogate) {
  13169. // no lead yet
  13170. if (codePoint > 0xDBFF) {
  13171. // unexpected trail
  13172. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  13173. continue
  13174. } else if (i + 1 === length) {
  13175. // unpaired lead
  13176. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  13177. continue
  13178. }
  13179. // valid lead
  13180. leadSurrogate = codePoint
  13181. continue
  13182. }
  13183. // 2 leads in a row
  13184. if (codePoint < 0xDC00) {
  13185. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  13186. leadSurrogate = codePoint
  13187. continue
  13188. }
  13189. // valid surrogate pair
  13190. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  13191. } else if (leadSurrogate) {
  13192. // valid bmp char, but last char was a lead
  13193. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  13194. }
  13195. leadSurrogate = null
  13196. // encode utf8
  13197. if (codePoint < 0x80) {
  13198. if ((units -= 1) < 0) break
  13199. bytes.push(codePoint)
  13200. } else if (codePoint < 0x800) {
  13201. if ((units -= 2) < 0) break
  13202. bytes.push(
  13203. codePoint >> 0x6 | 0xC0,
  13204. codePoint & 0x3F | 0x80
  13205. )
  13206. } else if (codePoint < 0x10000) {
  13207. if ((units -= 3) < 0) break
  13208. bytes.push(
  13209. codePoint >> 0xC | 0xE0,
  13210. codePoint >> 0x6 & 0x3F | 0x80,
  13211. codePoint & 0x3F | 0x80
  13212. )
  13213. } else if (codePoint < 0x110000) {
  13214. if ((units -= 4) < 0) break
  13215. bytes.push(
  13216. codePoint >> 0x12 | 0xF0,
  13217. codePoint >> 0xC & 0x3F | 0x80,
  13218. codePoint >> 0x6 & 0x3F | 0x80,
  13219. codePoint & 0x3F | 0x80
  13220. )
  13221. } else {
  13222. throw new Error('Invalid code point')
  13223. }
  13224. }
  13225. return bytes
  13226. }
  13227. function asciiToBytes (str) {
  13228. var byteArray = []
  13229. for (var i = 0; i < str.length; ++i) {
  13230. // Node's code seems to be doing this and not & 0x7F..
  13231. byteArray.push(str.charCodeAt(i) & 0xFF)
  13232. }
  13233. return byteArray
  13234. }
  13235. function utf16leToBytes (str, units) {
  13236. var c, hi, lo
  13237. var byteArray = []
  13238. for (var i = 0; i < str.length; ++i) {
  13239. if ((units -= 2) < 0) break
  13240. c = str.charCodeAt(i)
  13241. hi = c >> 8
  13242. lo = c % 256
  13243. byteArray.push(lo)
  13244. byteArray.push(hi)
  13245. }
  13246. return byteArray
  13247. }
  13248. function base64ToBytes (str) {
  13249. return base64.toByteArray(base64clean(str))
  13250. }
  13251. function blitBuffer (src, dst, offset, length) {
  13252. for (var i = 0; i < length; ++i) {
  13253. if ((i + offset >= dst.length) || (i >= src.length)) break
  13254. dst[i + offset] = src[i]
  13255. }
  13256. return i
  13257. }
  13258. function isnan (val) {
  13259. return val !== val // eslint-disable-line no-self-compare
  13260. }
  13261. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  13262. },{"base64-js":47,"ieee754":86,"isarray":87}],84:[function(require,module,exports){
  13263. "use strict";
  13264. Object.defineProperty(exports, "__esModule", { value: true });
  13265. var dingbats = [
  13266. { "Typeface name": "Symbol", "Dingbat dec": "32", "Dingbat hex": "20", "Unicode dec": "32", "Unicode hex": "20" },
  13267. { "Typeface name": "Symbol", "Dingbat dec": "33", "Dingbat hex": "21", "Unicode dec": "33", "Unicode hex": "21" },
  13268. { "Typeface name": "Symbol", "Dingbat dec": "34", "Dingbat hex": "22", "Unicode dec": "8704", "Unicode hex": "2200" },
  13269. { "Typeface name": "Symbol", "Dingbat dec": "35", "Dingbat hex": "23", "Unicode dec": "35", "Unicode hex": "23" },
  13270. { "Typeface name": "Symbol", "Dingbat dec": "36", "Dingbat hex": "24", "Unicode dec": "8707", "Unicode hex": "2203" },
  13271. { "Typeface name": "Symbol", "Dingbat dec": "37", "Dingbat hex": "25", "Unicode dec": "37", "Unicode hex": "25" },
  13272. { "Typeface name": "Symbol", "Dingbat dec": "38", "Dingbat hex": "26", "Unicode dec": "38", "Unicode hex": "26" },
  13273. { "Typeface name": "Symbol", "Dingbat dec": "39", "Dingbat hex": "27", "Unicode dec": "8717", "Unicode hex": "220D" },
  13274. { "Typeface name": "Symbol", "Dingbat dec": "40", "Dingbat hex": "28", "Unicode dec": "40", "Unicode hex": "28" },
  13275. { "Typeface name": "Symbol", "Dingbat dec": "41", "Dingbat hex": "29", "Unicode dec": "41", "Unicode hex": "29" },
  13276. { "Typeface name": "Symbol", "Dingbat dec": "42", "Dingbat hex": "2A", "Unicode dec": "42", "Unicode hex": "2A" },
  13277. { "Typeface name": "Symbol", "Dingbat dec": "43", "Dingbat hex": "2B", "Unicode dec": "43", "Unicode hex": "2B" },
  13278. { "Typeface name": "Symbol", "Dingbat dec": "44", "Dingbat hex": "2C", "Unicode dec": "44", "Unicode hex": "2C" },
  13279. { "Typeface name": "Symbol", "Dingbat dec": "45", "Dingbat hex": "2D", "Unicode dec": "8722", "Unicode hex": "2212" },
  13280. { "Typeface name": "Symbol", "Dingbat dec": "46", "Dingbat hex": "2E", "Unicode dec": "46", "Unicode hex": "2E" },
  13281. { "Typeface name": "Symbol", "Dingbat dec": "47", "Dingbat hex": "2F", "Unicode dec": "47", "Unicode hex": "2F" },
  13282. { "Typeface name": "Symbol", "Dingbat dec": "48", "Dingbat hex": "30", "Unicode dec": "48", "Unicode hex": "30" },
  13283. { "Typeface name": "Symbol", "Dingbat dec": "49", "Dingbat hex": "31", "Unicode dec": "49", "Unicode hex": "31" },
  13284. { "Typeface name": "Symbol", "Dingbat dec": "50", "Dingbat hex": "32", "Unicode dec": "50", "Unicode hex": "32" },
  13285. { "Typeface name": "Symbol", "Dingbat dec": "51", "Dingbat hex": "33", "Unicode dec": "51", "Unicode hex": "33" },
  13286. { "Typeface name": "Symbol", "Dingbat dec": "52", "Dingbat hex": "34", "Unicode dec": "52", "Unicode hex": "34" },
  13287. { "Typeface name": "Symbol", "Dingbat dec": "53", "Dingbat hex": "35", "Unicode dec": "53", "Unicode hex": "35" },
  13288. { "Typeface name": "Symbol", "Dingbat dec": "54", "Dingbat hex": "36", "Unicode dec": "54", "Unicode hex": "36" },
  13289. { "Typeface name": "Symbol", "Dingbat dec": "55", "Dingbat hex": "37", "Unicode dec": "55", "Unicode hex": "37" },
  13290. { "Typeface name": "Symbol", "Dingbat dec": "56", "Dingbat hex": "38", "Unicode dec": "56", "Unicode hex": "38" },
  13291. { "Typeface name": "Symbol", "Dingbat dec": "57", "Dingbat hex": "39", "Unicode dec": "57", "Unicode hex": "39" },
  13292. { "Typeface name": "Symbol", "Dingbat dec": "58", "Dingbat hex": "3A", "Unicode dec": "58", "Unicode hex": "3A" },
  13293. { "Typeface name": "Symbol", "Dingbat dec": "59", "Dingbat hex": "3B", "Unicode dec": "59", "Unicode hex": "3B" },
  13294. { "Typeface name": "Symbol", "Dingbat dec": "60", "Dingbat hex": "3C", "Unicode dec": "60", "Unicode hex": "3C" },
  13295. { "Typeface name": "Symbol", "Dingbat dec": "61", "Dingbat hex": "3D", "Unicode dec": "61", "Unicode hex": "3D" },
  13296. { "Typeface name": "Symbol", "Dingbat dec": "62", "Dingbat hex": "3E", "Unicode dec": "62", "Unicode hex": "3E" },
  13297. { "Typeface name": "Symbol", "Dingbat dec": "63", "Dingbat hex": "3F", "Unicode dec": "63", "Unicode hex": "3F" },
  13298. { "Typeface name": "Symbol", "Dingbat dec": "64", "Dingbat hex": "40", "Unicode dec": "8773", "Unicode hex": "2245" },
  13299. { "Typeface name": "Symbol", "Dingbat dec": "65", "Dingbat hex": "41", "Unicode dec": "913", "Unicode hex": "391" },
  13300. { "Typeface name": "Symbol", "Dingbat dec": "66", "Dingbat hex": "42", "Unicode dec": "914", "Unicode hex": "392" },
  13301. { "Typeface name": "Symbol", "Dingbat dec": "67", "Dingbat hex": "43", "Unicode dec": "935", "Unicode hex": "3A7" },
  13302. { "Typeface name": "Symbol", "Dingbat dec": "68", "Dingbat hex": "44", "Unicode dec": "916", "Unicode hex": "394" },
  13303. { "Typeface name": "Symbol", "Dingbat dec": "69", "Dingbat hex": "45", "Unicode dec": "917", "Unicode hex": "395" },
  13304. { "Typeface name": "Symbol", "Dingbat dec": "70", "Dingbat hex": "46", "Unicode dec": "934", "Unicode hex": "3A6" },
  13305. { "Typeface name": "Symbol", "Dingbat dec": "71", "Dingbat hex": "47", "Unicode dec": "915", "Unicode hex": "393" },
  13306. { "Typeface name": "Symbol", "Dingbat dec": "72", "Dingbat hex": "48", "Unicode dec": "919", "Unicode hex": "397" },
  13307. { "Typeface name": "Symbol", "Dingbat dec": "73", "Dingbat hex": "49", "Unicode dec": "921", "Unicode hex": "399" },
  13308. { "Typeface name": "Symbol", "Dingbat dec": "74", "Dingbat hex": "4A", "Unicode dec": "977", "Unicode hex": "3D1" },
  13309. { "Typeface name": "Symbol", "Dingbat dec": "75", "Dingbat hex": "4B", "Unicode dec": "922", "Unicode hex": "39A" },
  13310. { "Typeface name": "Symbol", "Dingbat dec": "76", "Dingbat hex": "4C", "Unicode dec": "923", "Unicode hex": "39B" },
  13311. { "Typeface name": "Symbol", "Dingbat dec": "77", "Dingbat hex": "4D", "Unicode dec": "924", "Unicode hex": "39C" },
  13312. { "Typeface name": "Symbol", "Dingbat dec": "78", "Dingbat hex": "4E", "Unicode dec": "925", "Unicode hex": "39D" },
  13313. { "Typeface name": "Symbol", "Dingbat dec": "79", "Dingbat hex": "4F", "Unicode dec": "927", "Unicode hex": "39F" },
  13314. { "Typeface name": "Symbol", "Dingbat dec": "80", "Dingbat hex": "50", "Unicode dec": "928", "Unicode hex": "3A0" },
  13315. { "Typeface name": "Symbol", "Dingbat dec": "81", "Dingbat hex": "51", "Unicode dec": "920", "Unicode hex": "398" },
  13316. { "Typeface name": "Symbol", "Dingbat dec": "82", "Dingbat hex": "52", "Unicode dec": "929", "Unicode hex": "3A1" },
  13317. { "Typeface name": "Symbol", "Dingbat dec": "83", "Dingbat hex": "53", "Unicode dec": "931", "Unicode hex": "3A3" },
  13318. { "Typeface name": "Symbol", "Dingbat dec": "84", "Dingbat hex": "54", "Unicode dec": "932", "Unicode hex": "3A4" },
  13319. { "Typeface name": "Symbol", "Dingbat dec": "85", "Dingbat hex": "55", "Unicode dec": "933", "Unicode hex": "3A5" },
  13320. { "Typeface name": "Symbol", "Dingbat dec": "86", "Dingbat hex": "56", "Unicode dec": "962", "Unicode hex": "3C2" },
  13321. { "Typeface name": "Symbol", "Dingbat dec": "87", "Dingbat hex": "57", "Unicode dec": "937", "Unicode hex": "3A9" },
  13322. { "Typeface name": "Symbol", "Dingbat dec": "88", "Dingbat hex": "58", "Unicode dec": "926", "Unicode hex": "39E" },
  13323. { "Typeface name": "Symbol", "Dingbat dec": "89", "Dingbat hex": "59", "Unicode dec": "936", "Unicode hex": "3A8" },
  13324. { "Typeface name": "Symbol", "Dingbat dec": "90", "Dingbat hex": "5A", "Unicode dec": "918", "Unicode hex": "396" },
  13325. { "Typeface name": "Symbol", "Dingbat dec": "91", "Dingbat hex": "5B", "Unicode dec": "91", "Unicode hex": "5B" },
  13326. { "Typeface name": "Symbol", "Dingbat dec": "92", "Dingbat hex": "5C", "Unicode dec": "8756", "Unicode hex": "2234" },
  13327. { "Typeface name": "Symbol", "Dingbat dec": "93", "Dingbat hex": "5D", "Unicode dec": "93", "Unicode hex": "5D" },
  13328. { "Typeface name": "Symbol", "Dingbat dec": "94", "Dingbat hex": "5E", "Unicode dec": "8869", "Unicode hex": "22A5" },
  13329. { "Typeface name": "Symbol", "Dingbat dec": "95", "Dingbat hex": "5F", "Unicode dec": "95", "Unicode hex": "5F" },
  13330. { "Typeface name": "Symbol", "Dingbat dec": "96", "Dingbat hex": "60", "Unicode dec": "8254", "Unicode hex": "203E" },
  13331. { "Typeface name": "Symbol", "Dingbat dec": "97", "Dingbat hex": "61", "Unicode dec": "945", "Unicode hex": "3B1" },
  13332. { "Typeface name": "Symbol", "Dingbat dec": "98", "Dingbat hex": "62", "Unicode dec": "946", "Unicode hex": "3B2" },
  13333. { "Typeface name": "Symbol", "Dingbat dec": "99", "Dingbat hex": "63", "Unicode dec": "967", "Unicode hex": "3C7" },
  13334. { "Typeface name": "Symbol", "Dingbat dec": "100", "Dingbat hex": "64", "Unicode dec": "948", "Unicode hex": "3B4" },
  13335. { "Typeface name": "Symbol", "Dingbat dec": "101", "Dingbat hex": "65", "Unicode dec": "949", "Unicode hex": "3B5" },
  13336. { "Typeface name": "Symbol", "Dingbat dec": "102", "Dingbat hex": "66", "Unicode dec": "966", "Unicode hex": "3C6" },
  13337. { "Typeface name": "Symbol", "Dingbat dec": "103", "Dingbat hex": "67", "Unicode dec": "947", "Unicode hex": "3B3" },
  13338. { "Typeface name": "Symbol", "Dingbat dec": "104", "Dingbat hex": "68", "Unicode dec": "951", "Unicode hex": "3B7" },
  13339. { "Typeface name": "Symbol", "Dingbat dec": "105", "Dingbat hex": "69", "Unicode dec": "953", "Unicode hex": "3B9" },
  13340. { "Typeface name": "Symbol", "Dingbat dec": "106", "Dingbat hex": "6A", "Unicode dec": "981", "Unicode hex": "3D5" },
  13341. { "Typeface name": "Symbol", "Dingbat dec": "107", "Dingbat hex": "6B", "Unicode dec": "954", "Unicode hex": "3BA" },
  13342. { "Typeface name": "Symbol", "Dingbat dec": "108", "Dingbat hex": "6C", "Unicode dec": "955", "Unicode hex": "3BB" },
  13343. { "Typeface name": "Symbol", "Dingbat dec": "109", "Dingbat hex": "6D", "Unicode dec": "956", "Unicode hex": "3BC" },
  13344. { "Typeface name": "Symbol", "Dingbat dec": "110", "Dingbat hex": "6E", "Unicode dec": "957", "Unicode hex": "3BD" },
  13345. { "Typeface name": "Symbol", "Dingbat dec": "111", "Dingbat hex": "6F", "Unicode dec": "959", "Unicode hex": "3BF" },
  13346. { "Typeface name": "Symbol", "Dingbat dec": "112", "Dingbat hex": "70", "Unicode dec": "960", "Unicode hex": "3C0" },
  13347. { "Typeface name": "Symbol", "Dingbat dec": "113", "Dingbat hex": "71", "Unicode dec": "952", "Unicode hex": "3B8" },
  13348. { "Typeface name": "Symbol", "Dingbat dec": "114", "Dingbat hex": "72", "Unicode dec": "961", "Unicode hex": "3C1" },
  13349. { "Typeface name": "Symbol", "Dingbat dec": "115", "Dingbat hex": "73", "Unicode dec": "963", "Unicode hex": "3C3" },
  13350. { "Typeface name": "Symbol", "Dingbat dec": "116", "Dingbat hex": "74", "Unicode dec": "964", "Unicode hex": "3C4" },
  13351. { "Typeface name": "Symbol", "Dingbat dec": "117", "Dingbat hex": "75", "Unicode dec": "965", "Unicode hex": "3C5" },
  13352. { "Typeface name": "Symbol", "Dingbat dec": "118", "Dingbat hex": "76", "Unicode dec": "982", "Unicode hex": "3D6" },
  13353. { "Typeface name": "Symbol", "Dingbat dec": "119", "Dingbat hex": "77", "Unicode dec": "969", "Unicode hex": "3C9" },
  13354. { "Typeface name": "Symbol", "Dingbat dec": "120", "Dingbat hex": "78", "Unicode dec": "958", "Unicode hex": "3BE" },
  13355. { "Typeface name": "Symbol", "Dingbat dec": "121", "Dingbat hex": "79", "Unicode dec": "968", "Unicode hex": "3C8" },
  13356. { "Typeface name": "Symbol", "Dingbat dec": "122", "Dingbat hex": "7A", "Unicode dec": "950", "Unicode hex": "3B6" },
  13357. { "Typeface name": "Symbol", "Dingbat dec": "123", "Dingbat hex": "7B", "Unicode dec": "123", "Unicode hex": "7B" },
  13358. { "Typeface name": "Symbol", "Dingbat dec": "124", "Dingbat hex": "7C", "Unicode dec": "124", "Unicode hex": "7C" },
  13359. { "Typeface name": "Symbol", "Dingbat dec": "125", "Dingbat hex": "7D", "Unicode dec": "125", "Unicode hex": "7D" },
  13360. { "Typeface name": "Symbol", "Dingbat dec": "126", "Dingbat hex": "7E", "Unicode dec": "126", "Unicode hex": "7E" },
  13361. { "Typeface name": "Symbol", "Dingbat dec": "160", "Dingbat hex": "A0", "Unicode dec": "8364", "Unicode hex": "20AC" },
  13362. { "Typeface name": "Symbol", "Dingbat dec": "161", "Dingbat hex": "A1", "Unicode dec": "978", "Unicode hex": "3D2" },
  13363. { "Typeface name": "Symbol", "Dingbat dec": "162", "Dingbat hex": "A2", "Unicode dec": "8242", "Unicode hex": "2032" },
  13364. { "Typeface name": "Symbol", "Dingbat dec": "163", "Dingbat hex": "A3", "Unicode dec": "8804", "Unicode hex": "2264" },
  13365. { "Typeface name": "Symbol", "Dingbat dec": "164", "Dingbat hex": "A4", "Unicode dec": "8260", "Unicode hex": "2044" },
  13366. { "Typeface name": "Symbol", "Dingbat dec": "165", "Dingbat hex": "A5", "Unicode dec": "8734", "Unicode hex": "221E" },
  13367. { "Typeface name": "Symbol", "Dingbat dec": "166", "Dingbat hex": "A6", "Unicode dec": "402", "Unicode hex": "192" },
  13368. { "Typeface name": "Symbol", "Dingbat dec": "167", "Dingbat hex": "A7", "Unicode dec": "9827", "Unicode hex": "2663" },
  13369. { "Typeface name": "Symbol", "Dingbat dec": "168", "Dingbat hex": "A8", "Unicode dec": "9830", "Unicode hex": "2666" },
  13370. { "Typeface name": "Symbol", "Dingbat dec": "169", "Dingbat hex": "A9", "Unicode dec": "9829", "Unicode hex": "2665" },
  13371. { "Typeface name": "Symbol", "Dingbat dec": "170", "Dingbat hex": "AA", "Unicode dec": "9824", "Unicode hex": "2660" },
  13372. { "Typeface name": "Symbol", "Dingbat dec": "171", "Dingbat hex": "AB", "Unicode dec": "8596", "Unicode hex": "2194" },
  13373. { "Typeface name": "Symbol", "Dingbat dec": "172", "Dingbat hex": "AC", "Unicode dec": "8592", "Unicode hex": "2190" },
  13374. { "Typeface name": "Symbol", "Dingbat dec": "173", "Dingbat hex": "AD", "Unicode dec": "8593", "Unicode hex": "2191" },
  13375. { "Typeface name": "Symbol", "Dingbat dec": "174", "Dingbat hex": "AE", "Unicode dec": "8594", "Unicode hex": "2192" },
  13376. { "Typeface name": "Symbol", "Dingbat dec": "175", "Dingbat hex": "AF", "Unicode dec": "8595", "Unicode hex": "2193" },
  13377. { "Typeface name": "Symbol", "Dingbat dec": "176", "Dingbat hex": "B0", "Unicode dec": "176", "Unicode hex": "B0" },
  13378. { "Typeface name": "Symbol", "Dingbat dec": "177", "Dingbat hex": "B1", "Unicode dec": "177", "Unicode hex": "B1" },
  13379. { "Typeface name": "Symbol", "Dingbat dec": "178", "Dingbat hex": "B2", "Unicode dec": "8243", "Unicode hex": "2033" },
  13380. { "Typeface name": "Symbol", "Dingbat dec": "179", "Dingbat hex": "B3", "Unicode dec": "8805", "Unicode hex": "2265" },
  13381. { "Typeface name": "Symbol", "Dingbat dec": "180", "Dingbat hex": "B4", "Unicode dec": "215", "Unicode hex": "D7" },
  13382. { "Typeface name": "Symbol", "Dingbat dec": "181", "Dingbat hex": "B5", "Unicode dec": "8733", "Unicode hex": "221D" },
  13383. { "Typeface name": "Symbol", "Dingbat dec": "182", "Dingbat hex": "B6", "Unicode dec": "8706", "Unicode hex": "2202" },
  13384. { "Typeface name": "Symbol", "Dingbat dec": "183", "Dingbat hex": "B7", "Unicode dec": "8226", "Unicode hex": "2022" },
  13385. { "Typeface name": "Symbol", "Dingbat dec": "184", "Dingbat hex": "B8", "Unicode dec": "247", "Unicode hex": "F7" },
  13386. { "Typeface name": "Symbol", "Dingbat dec": "185", "Dingbat hex": "B9", "Unicode dec": "8800", "Unicode hex": "2260" },
  13387. { "Typeface name": "Symbol", "Dingbat dec": "186", "Dingbat hex": "BA", "Unicode dec": "8801", "Unicode hex": "2261" },
  13388. { "Typeface name": "Symbol", "Dingbat dec": "187", "Dingbat hex": "BB", "Unicode dec": "8776", "Unicode hex": "2248" },
  13389. { "Typeface name": "Symbol", "Dingbat dec": "188", "Dingbat hex": "BC", "Unicode dec": "8230", "Unicode hex": "2026" },
  13390. { "Typeface name": "Symbol", "Dingbat dec": "189", "Dingbat hex": "BD", "Unicode dec": "9168", "Unicode hex": "23D0" },
  13391. { "Typeface name": "Symbol", "Dingbat dec": "190", "Dingbat hex": "BE", "Unicode dec": "9135", "Unicode hex": "23AF" },
  13392. { "Typeface name": "Symbol", "Dingbat dec": "191", "Dingbat hex": "BF", "Unicode dec": "8629", "Unicode hex": "21B5" },
  13393. { "Typeface name": "Symbol", "Dingbat dec": "192", "Dingbat hex": "C0", "Unicode dec": "8501", "Unicode hex": "2135" },
  13394. { "Typeface name": "Symbol", "Dingbat dec": "193", "Dingbat hex": "C1", "Unicode dec": "8465", "Unicode hex": "2111" },
  13395. { "Typeface name": "Symbol", "Dingbat dec": "194", "Dingbat hex": "C2", "Unicode dec": "8476", "Unicode hex": "211C" },
  13396. { "Typeface name": "Symbol", "Dingbat dec": "195", "Dingbat hex": "C3", "Unicode dec": "8472", "Unicode hex": "2118" },
  13397. { "Typeface name": "Symbol", "Dingbat dec": "196", "Dingbat hex": "C4", "Unicode dec": "8855", "Unicode hex": "2297" },
  13398. { "Typeface name": "Symbol", "Dingbat dec": "197", "Dingbat hex": "C5", "Unicode dec": "8853", "Unicode hex": "2295" },
  13399. { "Typeface name": "Symbol", "Dingbat dec": "198", "Dingbat hex": "C6", "Unicode dec": "8709", "Unicode hex": "2205" },
  13400. { "Typeface name": "Symbol", "Dingbat dec": "199", "Dingbat hex": "C7", "Unicode dec": "8745", "Unicode hex": "2229" },
  13401. { "Typeface name": "Symbol", "Dingbat dec": "200", "Dingbat hex": "C8", "Unicode dec": "8746", "Unicode hex": "222A" },
  13402. { "Typeface name": "Symbol", "Dingbat dec": "201", "Dingbat hex": "C9", "Unicode dec": "8835", "Unicode hex": "2283" },
  13403. { "Typeface name": "Symbol", "Dingbat dec": "202", "Dingbat hex": "CA", "Unicode dec": "8839", "Unicode hex": "2287" },
  13404. { "Typeface name": "Symbol", "Dingbat dec": "203", "Dingbat hex": "CB", "Unicode dec": "8836", "Unicode hex": "2284" },
  13405. { "Typeface name": "Symbol", "Dingbat dec": "204", "Dingbat hex": "CC", "Unicode dec": "8834", "Unicode hex": "2282" },
  13406. { "Typeface name": "Symbol", "Dingbat dec": "205", "Dingbat hex": "CD", "Unicode dec": "8838", "Unicode hex": "2286" },
  13407. { "Typeface name": "Symbol", "Dingbat dec": "206", "Dingbat hex": "CE", "Unicode dec": "8712", "Unicode hex": "2208" },
  13408. { "Typeface name": "Symbol", "Dingbat dec": "207", "Dingbat hex": "CF", "Unicode dec": "8713", "Unicode hex": "2209" },
  13409. { "Typeface name": "Symbol", "Dingbat dec": "208", "Dingbat hex": "D0", "Unicode dec": "8736", "Unicode hex": "2220" },
  13410. { "Typeface name": "Symbol", "Dingbat dec": "209", "Dingbat hex": "D1", "Unicode dec": "8711", "Unicode hex": "2207" },
  13411. { "Typeface name": "Symbol", "Dingbat dec": "210", "Dingbat hex": "D2", "Unicode dec": "174", "Unicode hex": "AE" },
  13412. { "Typeface name": "Symbol", "Dingbat dec": "211", "Dingbat hex": "D3", "Unicode dec": "169", "Unicode hex": "A9" },
  13413. { "Typeface name": "Symbol", "Dingbat dec": "212", "Dingbat hex": "D4", "Unicode dec": "8482", "Unicode hex": "2122" },
  13414. { "Typeface name": "Symbol", "Dingbat dec": "213", "Dingbat hex": "D5", "Unicode dec": "8719", "Unicode hex": "220F" },
  13415. { "Typeface name": "Symbol", "Dingbat dec": "214", "Dingbat hex": "D6", "Unicode dec": "8730", "Unicode hex": "221A" },
  13416. { "Typeface name": "Symbol", "Dingbat dec": "215", "Dingbat hex": "D7", "Unicode dec": "8901", "Unicode hex": "22C5" },
  13417. { "Typeface name": "Symbol", "Dingbat dec": "216", "Dingbat hex": "D8", "Unicode dec": "172", "Unicode hex": "AC" },
  13418. { "Typeface name": "Symbol", "Dingbat dec": "217", "Dingbat hex": "D9", "Unicode dec": "8743", "Unicode hex": "2227" },
  13419. { "Typeface name": "Symbol", "Dingbat dec": "218", "Dingbat hex": "DA", "Unicode dec": "8744", "Unicode hex": "2228" },
  13420. { "Typeface name": "Symbol", "Dingbat dec": "219", "Dingbat hex": "DB", "Unicode dec": "8660", "Unicode hex": "21D4" },
  13421. { "Typeface name": "Symbol", "Dingbat dec": "220", "Dingbat hex": "DC", "Unicode dec": "8656", "Unicode hex": "21D0" },
  13422. { "Typeface name": "Symbol", "Dingbat dec": "221", "Dingbat hex": "DD", "Unicode dec": "8657", "Unicode hex": "21D1" },
  13423. { "Typeface name": "Symbol", "Dingbat dec": "222", "Dingbat hex": "DE", "Unicode dec": "8658", "Unicode hex": "21D2" },
  13424. { "Typeface name": "Symbol", "Dingbat dec": "223", "Dingbat hex": "DF", "Unicode dec": "8659", "Unicode hex": "21D3" },
  13425. { "Typeface name": "Symbol", "Dingbat dec": "224", "Dingbat hex": "E0", "Unicode dec": "9674", "Unicode hex": "25CA" },
  13426. { "Typeface name": "Symbol", "Dingbat dec": "225", "Dingbat hex": "E1", "Unicode dec": "12296", "Unicode hex": "3008" },
  13427. { "Typeface name": "Symbol", "Dingbat dec": "226", "Dingbat hex": "E2", "Unicode dec": "174", "Unicode hex": "AE" },
  13428. { "Typeface name": "Symbol", "Dingbat dec": "227", "Dingbat hex": "E3", "Unicode dec": "169", "Unicode hex": "A9" },
  13429. { "Typeface name": "Symbol", "Dingbat dec": "228", "Dingbat hex": "E4", "Unicode dec": "8482", "Unicode hex": "2122" },
  13430. { "Typeface name": "Symbol", "Dingbat dec": "229", "Dingbat hex": "E5", "Unicode dec": "8721", "Unicode hex": "2211" },
  13431. { "Typeface name": "Symbol", "Dingbat dec": "230", "Dingbat hex": "E6", "Unicode dec": "9115", "Unicode hex": "239B" },
  13432. { "Typeface name": "Symbol", "Dingbat dec": "231", "Dingbat hex": "E7", "Unicode dec": "9116", "Unicode hex": "239C" },
  13433. { "Typeface name": "Symbol", "Dingbat dec": "232", "Dingbat hex": "E8", "Unicode dec": "9117", "Unicode hex": "239D" },
  13434. { "Typeface name": "Symbol", "Dingbat dec": "233", "Dingbat hex": "E9", "Unicode dec": "9121", "Unicode hex": "23A1" },
  13435. { "Typeface name": "Symbol", "Dingbat dec": "234", "Dingbat hex": "EA", "Unicode dec": "9122", "Unicode hex": "23A2" },
  13436. { "Typeface name": "Symbol", "Dingbat dec": "235", "Dingbat hex": "EB", "Unicode dec": "9123", "Unicode hex": "23A3" },
  13437. { "Typeface name": "Symbol", "Dingbat dec": "236", "Dingbat hex": "EC", "Unicode dec": "9127", "Unicode hex": "23A7" },
  13438. { "Typeface name": "Symbol", "Dingbat dec": "237", "Dingbat hex": "ED", "Unicode dec": "9128", "Unicode hex": "23A8" },
  13439. { "Typeface name": "Symbol", "Dingbat dec": "238", "Dingbat hex": "EE", "Unicode dec": "9129", "Unicode hex": "23A9" },
  13440. { "Typeface name": "Symbol", "Dingbat dec": "239", "Dingbat hex": "EF", "Unicode dec": "9130", "Unicode hex": "23AA" },
  13441. { "Typeface name": "Symbol", "Dingbat dec": "240", "Dingbat hex": "F0", "Unicode dec": "63743", "Unicode hex": "F8FF" },
  13442. { "Typeface name": "Symbol", "Dingbat dec": "241", "Dingbat hex": "F1", "Unicode dec": "12297", "Unicode hex": "3009" },
  13443. { "Typeface name": "Symbol", "Dingbat dec": "242", "Dingbat hex": "F2", "Unicode dec": "8747", "Unicode hex": "222B" },
  13444. { "Typeface name": "Symbol", "Dingbat dec": "243", "Dingbat hex": "F3", "Unicode dec": "8992", "Unicode hex": "2320" },
  13445. { "Typeface name": "Symbol", "Dingbat dec": "244", "Dingbat hex": "F4", "Unicode dec": "9134", "Unicode hex": "23AE" },
  13446. { "Typeface name": "Symbol", "Dingbat dec": "245", "Dingbat hex": "F5", "Unicode dec": "8993", "Unicode hex": "2321" },
  13447. { "Typeface name": "Symbol", "Dingbat dec": "246", "Dingbat hex": "F6", "Unicode dec": "9118", "Unicode hex": "239E" },
  13448. { "Typeface name": "Symbol", "Dingbat dec": "247", "Dingbat hex": "F7", "Unicode dec": "9119", "Unicode hex": "239F" },
  13449. { "Typeface name": "Symbol", "Dingbat dec": "248", "Dingbat hex": "F8", "Unicode dec": "9120", "Unicode hex": "23A0" },
  13450. { "Typeface name": "Symbol", "Dingbat dec": "249", "Dingbat hex": "F9", "Unicode dec": "9124", "Unicode hex": "23A4" },
  13451. { "Typeface name": "Symbol", "Dingbat dec": "250", "Dingbat hex": "FA", "Unicode dec": "9125", "Unicode hex": "23A5" },
  13452. { "Typeface name": "Symbol", "Dingbat dec": "251", "Dingbat hex": "FB", "Unicode dec": "9126", "Unicode hex": "23A6" },
  13453. { "Typeface name": "Symbol", "Dingbat dec": "252", "Dingbat hex": "FC", "Unicode dec": "9131", "Unicode hex": "23AB" },
  13454. { "Typeface name": "Symbol", "Dingbat dec": "253", "Dingbat hex": "FD", "Unicode dec": "9132", "Unicode hex": "23AC" },
  13455. { "Typeface name": "Symbol", "Dingbat dec": "254", "Dingbat hex": "FE", "Unicode dec": "9133", "Unicode hex": "23AD" },
  13456. { "Typeface name": "Webdings", "Dingbat dec": "32", "Dingbat hex": "20", "Unicode dec": "32", "Unicode hex": "20" },
  13457. { "Typeface name": "Webdings", "Dingbat dec": "33", "Dingbat hex": "21", "Unicode dec": "128375", "Unicode hex": "1F577" },
  13458. { "Typeface name": "Webdings", "Dingbat dec": "34", "Dingbat hex": "22", "Unicode dec": "128376", "Unicode hex": "1F578" },
  13459. { "Typeface name": "Webdings", "Dingbat dec": "35", "Dingbat hex": "23", "Unicode dec": "128370", "Unicode hex": "1F572" },
  13460. { "Typeface name": "Webdings", "Dingbat dec": "36", "Dingbat hex": "24", "Unicode dec": "128374", "Unicode hex": "1F576" },
  13461. { "Typeface name": "Webdings", "Dingbat dec": "37", "Dingbat hex": "25", "Unicode dec": "127942", "Unicode hex": "1F3C6" },
  13462. { "Typeface name": "Webdings", "Dingbat dec": "38", "Dingbat hex": "26", "Unicode dec": "127894", "Unicode hex": "1F396" },
  13463. { "Typeface name": "Webdings", "Dingbat dec": "39", "Dingbat hex": "27", "Unicode dec": "128391", "Unicode hex": "1F587" },
  13464. { "Typeface name": "Webdings", "Dingbat dec": "40", "Dingbat hex": "28", "Unicode dec": "128488", "Unicode hex": "1F5E8" },
  13465. { "Typeface name": "Webdings", "Dingbat dec": "41", "Dingbat hex": "29", "Unicode dec": "128489", "Unicode hex": "1F5E9" },
  13466. { "Typeface name": "Webdings", "Dingbat dec": "42", "Dingbat hex": "2A", "Unicode dec": "128496", "Unicode hex": "1F5F0" },
  13467. { "Typeface name": "Webdings", "Dingbat dec": "43", "Dingbat hex": "2B", "Unicode dec": "128497", "Unicode hex": "1F5F1" },
  13468. { "Typeface name": "Webdings", "Dingbat dec": "44", "Dingbat hex": "2C", "Unicode dec": "127798", "Unicode hex": "1F336" },
  13469. { "Typeface name": "Webdings", "Dingbat dec": "45", "Dingbat hex": "2D", "Unicode dec": "127895", "Unicode hex": "1F397" },
  13470. { "Typeface name": "Webdings", "Dingbat dec": "46", "Dingbat hex": "2E", "Unicode dec": "128638", "Unicode hex": "1F67E" },
  13471. { "Typeface name": "Webdings", "Dingbat dec": "47", "Dingbat hex": "2F", "Unicode dec": "128636", "Unicode hex": "1F67C" },
  13472. { "Typeface name": "Webdings", "Dingbat dec": "48", "Dingbat hex": "30", "Unicode dec": "128469", "Unicode hex": "1F5D5" },
  13473. { "Typeface name": "Webdings", "Dingbat dec": "49", "Dingbat hex": "31", "Unicode dec": "128470", "Unicode hex": "1F5D6" },
  13474. { "Typeface name": "Webdings", "Dingbat dec": "50", "Dingbat hex": "32", "Unicode dec": "128471", "Unicode hex": "1F5D7" },
  13475. { "Typeface name": "Webdings", "Dingbat dec": "51", "Dingbat hex": "33", "Unicode dec": "9204", "Unicode hex": "23F4" },
  13476. { "Typeface name": "Webdings", "Dingbat dec": "52", "Dingbat hex": "34", "Unicode dec": "9205", "Unicode hex": "23F5" },
  13477. { "Typeface name": "Webdings", "Dingbat dec": "53", "Dingbat hex": "35", "Unicode dec": "9206", "Unicode hex": "23F6" },
  13478. { "Typeface name": "Webdings", "Dingbat dec": "54", "Dingbat hex": "36", "Unicode dec": "9207", "Unicode hex": "23F7" },
  13479. { "Typeface name": "Webdings", "Dingbat dec": "55", "Dingbat hex": "37", "Unicode dec": "9194", "Unicode hex": "23EA" },
  13480. { "Typeface name": "Webdings", "Dingbat dec": "56", "Dingbat hex": "38", "Unicode dec": "9193", "Unicode hex": "23E9" },
  13481. { "Typeface name": "Webdings", "Dingbat dec": "57", "Dingbat hex": "39", "Unicode dec": "9198", "Unicode hex": "23EE" },
  13482. { "Typeface name": "Webdings", "Dingbat dec": "58", "Dingbat hex": "3A", "Unicode dec": "9197", "Unicode hex": "23ED" },
  13483. { "Typeface name": "Webdings", "Dingbat dec": "59", "Dingbat hex": "3B", "Unicode dec": "9208", "Unicode hex": "23F8" },
  13484. { "Typeface name": "Webdings", "Dingbat dec": "60", "Dingbat hex": "3C", "Unicode dec": "9209", "Unicode hex": "23F9" },
  13485. { "Typeface name": "Webdings", "Dingbat dec": "61", "Dingbat hex": "3D", "Unicode dec": "9210", "Unicode hex": "23FA" },
  13486. { "Typeface name": "Webdings", "Dingbat dec": "62", "Dingbat hex": "3E", "Unicode dec": "128474", "Unicode hex": "1F5DA" },
  13487. { "Typeface name": "Webdings", "Dingbat dec": "63", "Dingbat hex": "3F", "Unicode dec": "128499", "Unicode hex": "1F5F3" },
  13488. { "Typeface name": "Webdings", "Dingbat dec": "64", "Dingbat hex": "40", "Unicode dec": "128736", "Unicode hex": "1F6E0" },
  13489. { "Typeface name": "Webdings", "Dingbat dec": "65", "Dingbat hex": "41", "Unicode dec": "127959", "Unicode hex": "1F3D7" },
  13490. { "Typeface name": "Webdings", "Dingbat dec": "66", "Dingbat hex": "42", "Unicode dec": "127960", "Unicode hex": "1F3D8" },
  13491. { "Typeface name": "Webdings", "Dingbat dec": "67", "Dingbat hex": "43", "Unicode dec": "127961", "Unicode hex": "1F3D9" },
  13492. { "Typeface name": "Webdings", "Dingbat dec": "68", "Dingbat hex": "44", "Unicode dec": "127962", "Unicode hex": "1F3DA" },
  13493. { "Typeface name": "Webdings", "Dingbat dec": "69", "Dingbat hex": "45", "Unicode dec": "127964", "Unicode hex": "1F3DC" },
  13494. { "Typeface name": "Webdings", "Dingbat dec": "70", "Dingbat hex": "46", "Unicode dec": "127981", "Unicode hex": "1F3ED" },
  13495. { "Typeface name": "Webdings", "Dingbat dec": "71", "Dingbat hex": "47", "Unicode dec": "127963", "Unicode hex": "1F3DB" },
  13496. { "Typeface name": "Webdings", "Dingbat dec": "72", "Dingbat hex": "48", "Unicode dec": "127968", "Unicode hex": "1F3E0" },
  13497. { "Typeface name": "Webdings", "Dingbat dec": "73", "Dingbat hex": "49", "Unicode dec": "127958", "Unicode hex": "1F3D6" },
  13498. { "Typeface name": "Webdings", "Dingbat dec": "74", "Dingbat hex": "4A", "Unicode dec": "127965", "Unicode hex": "1F3DD" },
  13499. { "Typeface name": "Webdings", "Dingbat dec": "75", "Dingbat hex": "4B", "Unicode dec": "128739", "Unicode hex": "1F6E3" },
  13500. { "Typeface name": "Webdings", "Dingbat dec": "76", "Dingbat hex": "4C", "Unicode dec": "128269", "Unicode hex": "1F50D" },
  13501. { "Typeface name": "Webdings", "Dingbat dec": "77", "Dingbat hex": "4D", "Unicode dec": "127956", "Unicode hex": "1F3D4" },
  13502. { "Typeface name": "Webdings", "Dingbat dec": "78", "Dingbat hex": "4E", "Unicode dec": "128065", "Unicode hex": "1F441" },
  13503. { "Typeface name": "Webdings", "Dingbat dec": "79", "Dingbat hex": "4F", "Unicode dec": "128066", "Unicode hex": "1F442" },
  13504. { "Typeface name": "Webdings", "Dingbat dec": "80", "Dingbat hex": "50", "Unicode dec": "127966", "Unicode hex": "1F3DE" },
  13505. { "Typeface name": "Webdings", "Dingbat dec": "81", "Dingbat hex": "51", "Unicode dec": "127957", "Unicode hex": "1F3D5" },
  13506. { "Typeface name": "Webdings", "Dingbat dec": "82", "Dingbat hex": "52", "Unicode dec": "128740", "Unicode hex": "1F6E4" },
  13507. { "Typeface name": "Webdings", "Dingbat dec": "83", "Dingbat hex": "53", "Unicode dec": "127967", "Unicode hex": "1F3DF" },
  13508. { "Typeface name": "Webdings", "Dingbat dec": "84", "Dingbat hex": "54", "Unicode dec": "128755", "Unicode hex": "1F6F3" },
  13509. { "Typeface name": "Webdings", "Dingbat dec": "85", "Dingbat hex": "55", "Unicode dec": "128364", "Unicode hex": "1F56C" },
  13510. { "Typeface name": "Webdings", "Dingbat dec": "86", "Dingbat hex": "56", "Unicode dec": "128363", "Unicode hex": "1F56B" },
  13511. { "Typeface name": "Webdings", "Dingbat dec": "87", "Dingbat hex": "57", "Unicode dec": "128360", "Unicode hex": "1F568" },
  13512. { "Typeface name": "Webdings", "Dingbat dec": "88", "Dingbat hex": "58", "Unicode dec": "128264", "Unicode hex": "1F508" },
  13513. { "Typeface name": "Webdings", "Dingbat dec": "89", "Dingbat hex": "59", "Unicode dec": "127892", "Unicode hex": "1F394" },
  13514. { "Typeface name": "Webdings", "Dingbat dec": "90", "Dingbat hex": "5A", "Unicode dec": "127893", "Unicode hex": "1F395" },
  13515. { "Typeface name": "Webdings", "Dingbat dec": "91", "Dingbat hex": "5B", "Unicode dec": "128492", "Unicode hex": "1F5EC" },
  13516. { "Typeface name": "Webdings", "Dingbat dec": "92", "Dingbat hex": "5C", "Unicode dec": "128637", "Unicode hex": "1F67D" },
  13517. { "Typeface name": "Webdings", "Dingbat dec": "93", "Dingbat hex": "5D", "Unicode dec": "128493", "Unicode hex": "1F5ED" },
  13518. { "Typeface name": "Webdings", "Dingbat dec": "94", "Dingbat hex": "5E", "Unicode dec": "128490", "Unicode hex": "1F5EA" },
  13519. { "Typeface name": "Webdings", "Dingbat dec": "95", "Dingbat hex": "5F", "Unicode dec": "128491", "Unicode hex": "1F5EB" },
  13520. { "Typeface name": "Webdings", "Dingbat dec": "96", "Dingbat hex": "60", "Unicode dec": "11156", "Unicode hex": "2B94" },
  13521. { "Typeface name": "Webdings", "Dingbat dec": "97", "Dingbat hex": "61", "Unicode dec": "10004", "Unicode hex": "2714" },
  13522. { "Typeface name": "Webdings", "Dingbat dec": "98", "Dingbat hex": "62", "Unicode dec": "128690", "Unicode hex": "1F6B2" },
  13523. { "Typeface name": "Webdings", "Dingbat dec": "99", "Dingbat hex": "63", "Unicode dec": "11036", "Unicode hex": "2B1C" },
  13524. { "Typeface name": "Webdings", "Dingbat dec": "100", "Dingbat hex": "64", "Unicode dec": "128737", "Unicode hex": "1F6E1" },
  13525. { "Typeface name": "Webdings", "Dingbat dec": "101", "Dingbat hex": "65", "Unicode dec": "128230", "Unicode hex": "1F4E6" },
  13526. { "Typeface name": "Webdings", "Dingbat dec": "102", "Dingbat hex": "66", "Unicode dec": "128753", "Unicode hex": "1F6F1" },
  13527. { "Typeface name": "Webdings", "Dingbat dec": "103", "Dingbat hex": "67", "Unicode dec": "11035", "Unicode hex": "2B1B" },
  13528. { "Typeface name": "Webdings", "Dingbat dec": "104", "Dingbat hex": "68", "Unicode dec": "128657", "Unicode hex": "1F691" },
  13529. { "Typeface name": "Webdings", "Dingbat dec": "105", "Dingbat hex": "69", "Unicode dec": "128712", "Unicode hex": "1F6C8" },
  13530. { "Typeface name": "Webdings", "Dingbat dec": "106", "Dingbat hex": "6A", "Unicode dec": "128745", "Unicode hex": "1F6E9" },
  13531. { "Typeface name": "Webdings", "Dingbat dec": "107", "Dingbat hex": "6B", "Unicode dec": "128752", "Unicode hex": "1F6F0" },
  13532. { "Typeface name": "Webdings", "Dingbat dec": "108", "Dingbat hex": "6C", "Unicode dec": "128968", "Unicode hex": "1F7C8" },
  13533. { "Typeface name": "Webdings", "Dingbat dec": "109", "Dingbat hex": "6D", "Unicode dec": "128372", "Unicode hex": "1F574" },
  13534. { "Typeface name": "Webdings", "Dingbat dec": "110", "Dingbat hex": "6E", "Unicode dec": "11044", "Unicode hex": "2B24" },
  13535. { "Typeface name": "Webdings", "Dingbat dec": "111", "Dingbat hex": "6F", "Unicode dec": "128741", "Unicode hex": "1F6E5" },
  13536. { "Typeface name": "Webdings", "Dingbat dec": "112", "Dingbat hex": "70", "Unicode dec": "128660", "Unicode hex": "1F694" },
  13537. { "Typeface name": "Webdings", "Dingbat dec": "113", "Dingbat hex": "71", "Unicode dec": "128472", "Unicode hex": "1F5D8" },
  13538. { "Typeface name": "Webdings", "Dingbat dec": "114", "Dingbat hex": "72", "Unicode dec": "128473", "Unicode hex": "1F5D9" },
  13539. { "Typeface name": "Webdings", "Dingbat dec": "115", "Dingbat hex": "73", "Unicode dec": "10067", "Unicode hex": "2753" },
  13540. { "Typeface name": "Webdings", "Dingbat dec": "116", "Dingbat hex": "74", "Unicode dec": "128754", "Unicode hex": "1F6F2" },
  13541. { "Typeface name": "Webdings", "Dingbat dec": "117", "Dingbat hex": "75", "Unicode dec": "128647", "Unicode hex": "1F687" },
  13542. { "Typeface name": "Webdings", "Dingbat dec": "118", "Dingbat hex": "76", "Unicode dec": "128653", "Unicode hex": "1F68D" },
  13543. { "Typeface name": "Webdings", "Dingbat dec": "119", "Dingbat hex": "77", "Unicode dec": "9971", "Unicode hex": "26F3" },
  13544. { "Typeface name": "Webdings", "Dingbat dec": "120", "Dingbat hex": "78", "Unicode dec": "10680", "Unicode hex": "29B8" },
  13545. { "Typeface name": "Webdings", "Dingbat dec": "121", "Dingbat hex": "79", "Unicode dec": "8854", "Unicode hex": "2296" },
  13546. { "Typeface name": "Webdings", "Dingbat dec": "122", "Dingbat hex": "7A", "Unicode dec": "128685", "Unicode hex": "1F6AD" },
  13547. { "Typeface name": "Webdings", "Dingbat dec": "123", "Dingbat hex": "7B", "Unicode dec": "128494", "Unicode hex": "1F5EE" },
  13548. { "Typeface name": "Webdings", "Dingbat dec": "124", "Dingbat hex": "7C", "Unicode dec": "9168", "Unicode hex": "23D0" },
  13549. { "Typeface name": "Webdings", "Dingbat dec": "125", "Dingbat hex": "7D", "Unicode dec": "128495", "Unicode hex": "1F5EF" },
  13550. { "Typeface name": "Webdings", "Dingbat dec": "126", "Dingbat hex": "7E", "Unicode dec": "128498", "Unicode hex": "1F5F2" },
  13551. { "Typeface name": "Webdings", "Dingbat dec": "128", "Dingbat hex": "80", "Unicode dec": "128697", "Unicode hex": "1F6B9" },
  13552. { "Typeface name": "Webdings", "Dingbat dec": "129", "Dingbat hex": "81", "Unicode dec": "128698", "Unicode hex": "1F6BA" },
  13553. { "Typeface name": "Webdings", "Dingbat dec": "130", "Dingbat hex": "82", "Unicode dec": "128713", "Unicode hex": "1F6C9" },
  13554. { "Typeface name": "Webdings", "Dingbat dec": "131", "Dingbat hex": "83", "Unicode dec": "128714", "Unicode hex": "1F6CA" },
  13555. { "Typeface name": "Webdings", "Dingbat dec": "132", "Dingbat hex": "84", "Unicode dec": "128700", "Unicode hex": "1F6BC" },
  13556. { "Typeface name": "Webdings", "Dingbat dec": "133", "Dingbat hex": "85", "Unicode dec": "128125", "Unicode hex": "1F47D" },
  13557. { "Typeface name": "Webdings", "Dingbat dec": "134", "Dingbat hex": "86", "Unicode dec": "127947", "Unicode hex": "1F3CB" },
  13558. { "Typeface name": "Webdings", "Dingbat dec": "135", "Dingbat hex": "87", "Unicode dec": "9975", "Unicode hex": "26F7" },
  13559. { "Typeface name": "Webdings", "Dingbat dec": "136", "Dingbat hex": "88", "Unicode dec": "127938", "Unicode hex": "1F3C2" },
  13560. { "Typeface name": "Webdings", "Dingbat dec": "137", "Dingbat hex": "89", "Unicode dec": "127948", "Unicode hex": "1F3CC" },
  13561. { "Typeface name": "Webdings", "Dingbat dec": "138", "Dingbat hex": "8A", "Unicode dec": "127946", "Unicode hex": "1F3CA" },
  13562. { "Typeface name": "Webdings", "Dingbat dec": "139", "Dingbat hex": "8B", "Unicode dec": "127940", "Unicode hex": "1F3C4" },
  13563. { "Typeface name": "Webdings", "Dingbat dec": "140", "Dingbat hex": "8C", "Unicode dec": "127949", "Unicode hex": "1F3CD" },
  13564. { "Typeface name": "Webdings", "Dingbat dec": "141", "Dingbat hex": "8D", "Unicode dec": "127950", "Unicode hex": "1F3CE" },
  13565. { "Typeface name": "Webdings", "Dingbat dec": "142", "Dingbat hex": "8E", "Unicode dec": "128664", "Unicode hex": "1F698" },
  13566. { "Typeface name": "Webdings", "Dingbat dec": "143", "Dingbat hex": "8F", "Unicode dec": "128480", "Unicode hex": "1F5E0" },
  13567. { "Typeface name": "Webdings", "Dingbat dec": "144", "Dingbat hex": "90", "Unicode dec": "128738", "Unicode hex": "1F6E2" },
  13568. { "Typeface name": "Webdings", "Dingbat dec": "145", "Dingbat hex": "91", "Unicode dec": "128176", "Unicode hex": "1F4B0" },
  13569. { "Typeface name": "Webdings", "Dingbat dec": "146", "Dingbat hex": "92", "Unicode dec": "127991", "Unicode hex": "1F3F7" },
  13570. { "Typeface name": "Webdings", "Dingbat dec": "147", "Dingbat hex": "93", "Unicode dec": "128179", "Unicode hex": "1F4B3" },
  13571. { "Typeface name": "Webdings", "Dingbat dec": "148", "Dingbat hex": "94", "Unicode dec": "128106", "Unicode hex": "1F46A" },
  13572. { "Typeface name": "Webdings", "Dingbat dec": "149", "Dingbat hex": "95", "Unicode dec": "128481", "Unicode hex": "1F5E1" },
  13573. { "Typeface name": "Webdings", "Dingbat dec": "150", "Dingbat hex": "96", "Unicode dec": "128482", "Unicode hex": "1F5E2" },
  13574. { "Typeface name": "Webdings", "Dingbat dec": "151", "Dingbat hex": "97", "Unicode dec": "128483", "Unicode hex": "1F5E3" },
  13575. { "Typeface name": "Webdings", "Dingbat dec": "152", "Dingbat hex": "98", "Unicode dec": "10031", "Unicode hex": "272F" },
  13576. { "Typeface name": "Webdings", "Dingbat dec": "153", "Dingbat hex": "99", "Unicode dec": "128388", "Unicode hex": "1F584" },
  13577. { "Typeface name": "Webdings", "Dingbat dec": "154", "Dingbat hex": "9A", "Unicode dec": "128389", "Unicode hex": "1F585" },
  13578. { "Typeface name": "Webdings", "Dingbat dec": "155", "Dingbat hex": "9B", "Unicode dec": "128387", "Unicode hex": "1F583" },
  13579. { "Typeface name": "Webdings", "Dingbat dec": "156", "Dingbat hex": "9C", "Unicode dec": "128390", "Unicode hex": "1F586" },
  13580. { "Typeface name": "Webdings", "Dingbat dec": "157", "Dingbat hex": "9D", "Unicode dec": "128441", "Unicode hex": "1F5B9" },
  13581. { "Typeface name": "Webdings", "Dingbat dec": "158", "Dingbat hex": "9E", "Unicode dec": "128442", "Unicode hex": "1F5BA" },
  13582. { "Typeface name": "Webdings", "Dingbat dec": "159", "Dingbat hex": "9F", "Unicode dec": "128443", "Unicode hex": "1F5BB" },
  13583. { "Typeface name": "Webdings", "Dingbat dec": "160", "Dingbat hex": "A0", "Unicode dec": "128373", "Unicode hex": "1F575" },
  13584. { "Typeface name": "Webdings", "Dingbat dec": "161", "Dingbat hex": "A1", "Unicode dec": "128368", "Unicode hex": "1F570" },
  13585. { "Typeface name": "Webdings", "Dingbat dec": "162", "Dingbat hex": "A2", "Unicode dec": "128445", "Unicode hex": "1F5BD" },
  13586. { "Typeface name": "Webdings", "Dingbat dec": "163", "Dingbat hex": "A3", "Unicode dec": "128446", "Unicode hex": "1F5BE" },
  13587. { "Typeface name": "Webdings", "Dingbat dec": "164", "Dingbat hex": "A4", "Unicode dec": "128203", "Unicode hex": "1F4CB" },
  13588. { "Typeface name": "Webdings", "Dingbat dec": "165", "Dingbat hex": "A5", "Unicode dec": "128466", "Unicode hex": "1F5D2" },
  13589. { "Typeface name": "Webdings", "Dingbat dec": "166", "Dingbat hex": "A6", "Unicode dec": "128467", "Unicode hex": "1F5D3" },
  13590. { "Typeface name": "Webdings", "Dingbat dec": "167", "Dingbat hex": "A7", "Unicode dec": "128366", "Unicode hex": "1F56E" },
  13591. { "Typeface name": "Webdings", "Dingbat dec": "168", "Dingbat hex": "A8", "Unicode dec": "128218", "Unicode hex": "1F4DA" },
  13592. { "Typeface name": "Webdings", "Dingbat dec": "169", "Dingbat hex": "A9", "Unicode dec": "128478", "Unicode hex": "1F5DE" },
  13593. { "Typeface name": "Webdings", "Dingbat dec": "170", "Dingbat hex": "AA", "Unicode dec": "128479", "Unicode hex": "1F5DF" },
  13594. { "Typeface name": "Webdings", "Dingbat dec": "171", "Dingbat hex": "AB", "Unicode dec": "128451", "Unicode hex": "1F5C3" },
  13595. { "Typeface name": "Webdings", "Dingbat dec": "172", "Dingbat hex": "AC", "Unicode dec": "128450", "Unicode hex": "1F5C2" },
  13596. { "Typeface name": "Webdings", "Dingbat dec": "173", "Dingbat hex": "AD", "Unicode dec": "128444", "Unicode hex": "1F5BC" },
  13597. { "Typeface name": "Webdings", "Dingbat dec": "174", "Dingbat hex": "AE", "Unicode dec": "127917", "Unicode hex": "1F3AD" },
  13598. { "Typeface name": "Webdings", "Dingbat dec": "175", "Dingbat hex": "AF", "Unicode dec": "127900", "Unicode hex": "1F39C" },
  13599. { "Typeface name": "Webdings", "Dingbat dec": "176", "Dingbat hex": "B0", "Unicode dec": "127896", "Unicode hex": "1F398" },
  13600. { "Typeface name": "Webdings", "Dingbat dec": "177", "Dingbat hex": "B1", "Unicode dec": "127897", "Unicode hex": "1F399" },
  13601. { "Typeface name": "Webdings", "Dingbat dec": "178", "Dingbat hex": "B2", "Unicode dec": "127911", "Unicode hex": "1F3A7" },
  13602. { "Typeface name": "Webdings", "Dingbat dec": "179", "Dingbat hex": "B3", "Unicode dec": "128191", "Unicode hex": "1F4BF" },
  13603. { "Typeface name": "Webdings", "Dingbat dec": "180", "Dingbat hex": "B4", "Unicode dec": "127902", "Unicode hex": "1F39E" },
  13604. { "Typeface name": "Webdings", "Dingbat dec": "181", "Dingbat hex": "B5", "Unicode dec": "128247", "Unicode hex": "1F4F7" },
  13605. { "Typeface name": "Webdings", "Dingbat dec": "182", "Dingbat hex": "B6", "Unicode dec": "127903", "Unicode hex": "1F39F" },
  13606. { "Typeface name": "Webdings", "Dingbat dec": "183", "Dingbat hex": "B7", "Unicode dec": "127916", "Unicode hex": "1F3AC" },
  13607. { "Typeface name": "Webdings", "Dingbat dec": "184", "Dingbat hex": "B8", "Unicode dec": "128253", "Unicode hex": "1F4FD" },
  13608. { "Typeface name": "Webdings", "Dingbat dec": "185", "Dingbat hex": "B9", "Unicode dec": "128249", "Unicode hex": "1F4F9" },
  13609. { "Typeface name": "Webdings", "Dingbat dec": "186", "Dingbat hex": "BA", "Unicode dec": "128254", "Unicode hex": "1F4FE" },
  13610. { "Typeface name": "Webdings", "Dingbat dec": "187", "Dingbat hex": "BB", "Unicode dec": "128251", "Unicode hex": "1F4FB" },
  13611. { "Typeface name": "Webdings", "Dingbat dec": "188", "Dingbat hex": "BC", "Unicode dec": "127898", "Unicode hex": "1F39A" },
  13612. { "Typeface name": "Webdings", "Dingbat dec": "189", "Dingbat hex": "BD", "Unicode dec": "127899", "Unicode hex": "1F39B" },
  13613. { "Typeface name": "Webdings", "Dingbat dec": "190", "Dingbat hex": "BE", "Unicode dec": "128250", "Unicode hex": "1F4FA" },
  13614. { "Typeface name": "Webdings", "Dingbat dec": "191", "Dingbat hex": "BF", "Unicode dec": "128187", "Unicode hex": "1F4BB" },
  13615. { "Typeface name": "Webdings", "Dingbat dec": "192", "Dingbat hex": "C0", "Unicode dec": "128421", "Unicode hex": "1F5A5" },
  13616. { "Typeface name": "Webdings", "Dingbat dec": "193", "Dingbat hex": "C1", "Unicode dec": "128422", "Unicode hex": "1F5A6" },
  13617. { "Typeface name": "Webdings", "Dingbat dec": "194", "Dingbat hex": "C2", "Unicode dec": "128423", "Unicode hex": "1F5A7" },
  13618. { "Typeface name": "Webdings", "Dingbat dec": "195", "Dingbat hex": "C3", "Unicode dec": "128377", "Unicode hex": "1F579" },
  13619. { "Typeface name": "Webdings", "Dingbat dec": "196", "Dingbat hex": "C4", "Unicode dec": "127918", "Unicode hex": "1F3AE" },
  13620. { "Typeface name": "Webdings", "Dingbat dec": "197", "Dingbat hex": "C5", "Unicode dec": "128379", "Unicode hex": "1F57B" },
  13621. { "Typeface name": "Webdings", "Dingbat dec": "198", "Dingbat hex": "C6", "Unicode dec": "128380", "Unicode hex": "1F57C" },
  13622. { "Typeface name": "Webdings", "Dingbat dec": "199", "Dingbat hex": "C7", "Unicode dec": "128223", "Unicode hex": "1F4DF" },
  13623. { "Typeface name": "Webdings", "Dingbat dec": "200", "Dingbat hex": "C8", "Unicode dec": "128385", "Unicode hex": "1F581" },
  13624. { "Typeface name": "Webdings", "Dingbat dec": "201", "Dingbat hex": "C9", "Unicode dec": "128384", "Unicode hex": "1F580" },
  13625. { "Typeface name": "Webdings", "Dingbat dec": "202", "Dingbat hex": "CA", "Unicode dec": "128424", "Unicode hex": "1F5A8" },
  13626. { "Typeface name": "Webdings", "Dingbat dec": "203", "Dingbat hex": "CB", "Unicode dec": "128425", "Unicode hex": "1F5A9" },
  13627. { "Typeface name": "Webdings", "Dingbat dec": "204", "Dingbat hex": "CC", "Unicode dec": "128447", "Unicode hex": "1F5BF" },
  13628. { "Typeface name": "Webdings", "Dingbat dec": "205", "Dingbat hex": "CD", "Unicode dec": "128426", "Unicode hex": "1F5AA" },
  13629. { "Typeface name": "Webdings", "Dingbat dec": "206", "Dingbat hex": "CE", "Unicode dec": "128476", "Unicode hex": "1F5DC" },
  13630. { "Typeface name": "Webdings", "Dingbat dec": "207", "Dingbat hex": "CF", "Unicode dec": "128274", "Unicode hex": "1F512" },
  13631. { "Typeface name": "Webdings", "Dingbat dec": "208", "Dingbat hex": "D0", "Unicode dec": "128275", "Unicode hex": "1F513" },
  13632. { "Typeface name": "Webdings", "Dingbat dec": "209", "Dingbat hex": "D1", "Unicode dec": "128477", "Unicode hex": "1F5DD" },
  13633. { "Typeface name": "Webdings", "Dingbat dec": "210", "Dingbat hex": "D2", "Unicode dec": "128229", "Unicode hex": "1F4E5" },
  13634. { "Typeface name": "Webdings", "Dingbat dec": "211", "Dingbat hex": "D3", "Unicode dec": "128228", "Unicode hex": "1F4E4" },
  13635. { "Typeface name": "Webdings", "Dingbat dec": "212", "Dingbat hex": "D4", "Unicode dec": "128371", "Unicode hex": "1F573" },
  13636. { "Typeface name": "Webdings", "Dingbat dec": "213", "Dingbat hex": "D5", "Unicode dec": "127779", "Unicode hex": "1F323" },
  13637. { "Typeface name": "Webdings", "Dingbat dec": "214", "Dingbat hex": "D6", "Unicode dec": "127780", "Unicode hex": "1F324" },
  13638. { "Typeface name": "Webdings", "Dingbat dec": "215", "Dingbat hex": "D7", "Unicode dec": "127781", "Unicode hex": "1F325" },
  13639. { "Typeface name": "Webdings", "Dingbat dec": "216", "Dingbat hex": "D8", "Unicode dec": "127782", "Unicode hex": "1F326" },
  13640. { "Typeface name": "Webdings", "Dingbat dec": "217", "Dingbat hex": "D9", "Unicode dec": "9729", "Unicode hex": "2601" },
  13641. { "Typeface name": "Webdings", "Dingbat dec": "218", "Dingbat hex": "DA", "Unicode dec": "127784", "Unicode hex": "1F328" },
  13642. { "Typeface name": "Webdings", "Dingbat dec": "219", "Dingbat hex": "DB", "Unicode dec": "127783", "Unicode hex": "1F327" },
  13643. { "Typeface name": "Webdings", "Dingbat dec": "220", "Dingbat hex": "DC", "Unicode dec": "127785", "Unicode hex": "1F329" },
  13644. { "Typeface name": "Webdings", "Dingbat dec": "221", "Dingbat hex": "DD", "Unicode dec": "127786", "Unicode hex": "1F32A" },
  13645. { "Typeface name": "Webdings", "Dingbat dec": "222", "Dingbat hex": "DE", "Unicode dec": "127788", "Unicode hex": "1F32C" },
  13646. { "Typeface name": "Webdings", "Dingbat dec": "223", "Dingbat hex": "DF", "Unicode dec": "127787", "Unicode hex": "1F32B" },
  13647. { "Typeface name": "Webdings", "Dingbat dec": "224", "Dingbat hex": "E0", "Unicode dec": "127772", "Unicode hex": "1F31C" },
  13648. { "Typeface name": "Webdings", "Dingbat dec": "225", "Dingbat hex": "E1", "Unicode dec": "127777", "Unicode hex": "1F321" },
  13649. { "Typeface name": "Webdings", "Dingbat dec": "226", "Dingbat hex": "E2", "Unicode dec": "128715", "Unicode hex": "1F6CB" },
  13650. { "Typeface name": "Webdings", "Dingbat dec": "227", "Dingbat hex": "E3", "Unicode dec": "128719", "Unicode hex": "1F6CF" },
  13651. { "Typeface name": "Webdings", "Dingbat dec": "228", "Dingbat hex": "E4", "Unicode dec": "127869", "Unicode hex": "1F37D" },
  13652. { "Typeface name": "Webdings", "Dingbat dec": "229", "Dingbat hex": "E5", "Unicode dec": "127864", "Unicode hex": "1F378" },
  13653. { "Typeface name": "Webdings", "Dingbat dec": "230", "Dingbat hex": "E6", "Unicode dec": "128718", "Unicode hex": "1F6CE" },
  13654. { "Typeface name": "Webdings", "Dingbat dec": "231", "Dingbat hex": "E7", "Unicode dec": "128717", "Unicode hex": "1F6CD" },
  13655. { "Typeface name": "Webdings", "Dingbat dec": "232", "Dingbat hex": "E8", "Unicode dec": "9413", "Unicode hex": "24C5" },
  13656. { "Typeface name": "Webdings", "Dingbat dec": "233", "Dingbat hex": "E9", "Unicode dec": "9855", "Unicode hex": "267F" },
  13657. { "Typeface name": "Webdings", "Dingbat dec": "234", "Dingbat hex": "EA", "Unicode dec": "128710", "Unicode hex": "1F6C6" },
  13658. { "Typeface name": "Webdings", "Dingbat dec": "235", "Dingbat hex": "EB", "Unicode dec": "128392", "Unicode hex": "1F588" },
  13659. { "Typeface name": "Webdings", "Dingbat dec": "236", "Dingbat hex": "EC", "Unicode dec": "127891", "Unicode hex": "1F393" },
  13660. { "Typeface name": "Webdings", "Dingbat dec": "237", "Dingbat hex": "ED", "Unicode dec": "128484", "Unicode hex": "1F5E4" },
  13661. { "Typeface name": "Webdings", "Dingbat dec": "238", "Dingbat hex": "EE", "Unicode dec": "128485", "Unicode hex": "1F5E5" },
  13662. { "Typeface name": "Webdings", "Dingbat dec": "239", "Dingbat hex": "EF", "Unicode dec": "128486", "Unicode hex": "1F5E6" },
  13663. { "Typeface name": "Webdings", "Dingbat dec": "240", "Dingbat hex": "F0", "Unicode dec": "128487", "Unicode hex": "1F5E7" },
  13664. { "Typeface name": "Webdings", "Dingbat dec": "241", "Dingbat hex": "F1", "Unicode dec": "128746", "Unicode hex": "1F6EA" },
  13665. { "Typeface name": "Webdings", "Dingbat dec": "242", "Dingbat hex": "F2", "Unicode dec": "128063", "Unicode hex": "1F43F" },
  13666. { "Typeface name": "Webdings", "Dingbat dec": "243", "Dingbat hex": "F3", "Unicode dec": "128038", "Unicode hex": "1F426" },
  13667. { "Typeface name": "Webdings", "Dingbat dec": "244", "Dingbat hex": "F4", "Unicode dec": "128031", "Unicode hex": "1F41F" },
  13668. { "Typeface name": "Webdings", "Dingbat dec": "245", "Dingbat hex": "F5", "Unicode dec": "128021", "Unicode hex": "1F415" },
  13669. { "Typeface name": "Webdings", "Dingbat dec": "246", "Dingbat hex": "F6", "Unicode dec": "128008", "Unicode hex": "1F408" },
  13670. { "Typeface name": "Webdings", "Dingbat dec": "247", "Dingbat hex": "F7", "Unicode dec": "128620", "Unicode hex": "1F66C" },
  13671. { "Typeface name": "Webdings", "Dingbat dec": "248", "Dingbat hex": "F8", "Unicode dec": "128622", "Unicode hex": "1F66E" },
  13672. { "Typeface name": "Webdings", "Dingbat dec": "249", "Dingbat hex": "F9", "Unicode dec": "128621", "Unicode hex": "1F66D" },
  13673. { "Typeface name": "Webdings", "Dingbat dec": "250", "Dingbat hex": "FA", "Unicode dec": "128623", "Unicode hex": "1F66F" },
  13674. { "Typeface name": "Webdings", "Dingbat dec": "251", "Dingbat hex": "FB", "Unicode dec": "128506", "Unicode hex": "1F5FA" },
  13675. { "Typeface name": "Webdings", "Dingbat dec": "252", "Dingbat hex": "FC", "Unicode dec": "127757", "Unicode hex": "1F30D" },
  13676. { "Typeface name": "Webdings", "Dingbat dec": "253", "Dingbat hex": "FD", "Unicode dec": "127759", "Unicode hex": "1F30F" },
  13677. { "Typeface name": "Webdings", "Dingbat dec": "254", "Dingbat hex": "FE", "Unicode dec": "127758", "Unicode hex": "1F30E" },
  13678. { "Typeface name": "Webdings", "Dingbat dec": "255", "Dingbat hex": "FF", "Unicode dec": "128330", "Unicode hex": "1F54A" },
  13679. { "Typeface name": "Wingdings", "Dingbat dec": "32", "Dingbat hex": "20", "Unicode dec": "32", "Unicode hex": "20" },
  13680. { "Typeface name": "Wingdings", "Dingbat dec": "33", "Dingbat hex": "21", "Unicode dec": "128393", "Unicode hex": "1F589" },
  13681. { "Typeface name": "Wingdings", "Dingbat dec": "34", "Dingbat hex": "22", "Unicode dec": "9986", "Unicode hex": "2702" },
  13682. { "Typeface name": "Wingdings", "Dingbat dec": "35", "Dingbat hex": "23", "Unicode dec": "9985", "Unicode hex": "2701" },
  13683. { "Typeface name": "Wingdings", "Dingbat dec": "36", "Dingbat hex": "24", "Unicode dec": "128083", "Unicode hex": "1F453" },
  13684. { "Typeface name": "Wingdings", "Dingbat dec": "37", "Dingbat hex": "25", "Unicode dec": "128365", "Unicode hex": "1F56D" },
  13685. { "Typeface name": "Wingdings", "Dingbat dec": "38", "Dingbat hex": "26", "Unicode dec": "128366", "Unicode hex": "1F56E" },
  13686. { "Typeface name": "Wingdings", "Dingbat dec": "39", "Dingbat hex": "27", "Unicode dec": "128367", "Unicode hex": "1F56F" },
  13687. { "Typeface name": "Wingdings", "Dingbat dec": "40", "Dingbat hex": "28", "Unicode dec": "128383", "Unicode hex": "1F57F" },
  13688. { "Typeface name": "Wingdings", "Dingbat dec": "41", "Dingbat hex": "29", "Unicode dec": "9990", "Unicode hex": "2706" },
  13689. { "Typeface name": "Wingdings", "Dingbat dec": "42", "Dingbat hex": "2A", "Unicode dec": "128386", "Unicode hex": "1F582" },
  13690. { "Typeface name": "Wingdings", "Dingbat dec": "43", "Dingbat hex": "2B", "Unicode dec": "128387", "Unicode hex": "1F583" },
  13691. { "Typeface name": "Wingdings", "Dingbat dec": "44", "Dingbat hex": "2C", "Unicode dec": "128234", "Unicode hex": "1F4EA" },
  13692. { "Typeface name": "Wingdings", "Dingbat dec": "45", "Dingbat hex": "2D", "Unicode dec": "128235", "Unicode hex": "1F4EB" },
  13693. { "Typeface name": "Wingdings", "Dingbat dec": "46", "Dingbat hex": "2E", "Unicode dec": "128236", "Unicode hex": "1F4EC" },
  13694. { "Typeface name": "Wingdings", "Dingbat dec": "47", "Dingbat hex": "2F", "Unicode dec": "128237", "Unicode hex": "1F4ED" },
  13695. { "Typeface name": "Wingdings", "Dingbat dec": "48", "Dingbat hex": "30", "Unicode dec": "128448", "Unicode hex": "1F5C0" },
  13696. { "Typeface name": "Wingdings", "Dingbat dec": "49", "Dingbat hex": "31", "Unicode dec": "128449", "Unicode hex": "1F5C1" },
  13697. { "Typeface name": "Wingdings", "Dingbat dec": "50", "Dingbat hex": "32", "Unicode dec": "128462", "Unicode hex": "1F5CE" },
  13698. { "Typeface name": "Wingdings", "Dingbat dec": "51", "Dingbat hex": "33", "Unicode dec": "128463", "Unicode hex": "1F5CF" },
  13699. { "Typeface name": "Wingdings", "Dingbat dec": "52", "Dingbat hex": "34", "Unicode dec": "128464", "Unicode hex": "1F5D0" },
  13700. { "Typeface name": "Wingdings", "Dingbat dec": "53", "Dingbat hex": "35", "Unicode dec": "128452", "Unicode hex": "1F5C4" },
  13701. { "Typeface name": "Wingdings", "Dingbat dec": "54", "Dingbat hex": "36", "Unicode dec": "8987", "Unicode hex": "231B" },
  13702. { "Typeface name": "Wingdings", "Dingbat dec": "55", "Dingbat hex": "37", "Unicode dec": "128430", "Unicode hex": "1F5AE" },
  13703. { "Typeface name": "Wingdings", "Dingbat dec": "56", "Dingbat hex": "38", "Unicode dec": "128432", "Unicode hex": "1F5B0" },
  13704. { "Typeface name": "Wingdings", "Dingbat dec": "57", "Dingbat hex": "39", "Unicode dec": "128434", "Unicode hex": "1F5B2" },
  13705. { "Typeface name": "Wingdings", "Dingbat dec": "58", "Dingbat hex": "3A", "Unicode dec": "128435", "Unicode hex": "1F5B3" },
  13706. { "Typeface name": "Wingdings", "Dingbat dec": "59", "Dingbat hex": "3B", "Unicode dec": "128436", "Unicode hex": "1F5B4" },
  13707. { "Typeface name": "Wingdings", "Dingbat dec": "60", "Dingbat hex": "3C", "Unicode dec": "128427", "Unicode hex": "1F5AB" },
  13708. { "Typeface name": "Wingdings", "Dingbat dec": "61", "Dingbat hex": "3D", "Unicode dec": "128428", "Unicode hex": "1F5AC" },
  13709. { "Typeface name": "Wingdings", "Dingbat dec": "62", "Dingbat hex": "3E", "Unicode dec": "9991", "Unicode hex": "2707" },
  13710. { "Typeface name": "Wingdings", "Dingbat dec": "63", "Dingbat hex": "3F", "Unicode dec": "9997", "Unicode hex": "270D" },
  13711. { "Typeface name": "Wingdings", "Dingbat dec": "64", "Dingbat hex": "40", "Unicode dec": "128398", "Unicode hex": "1F58E" },
  13712. { "Typeface name": "Wingdings", "Dingbat dec": "65", "Dingbat hex": "41", "Unicode dec": "9996", "Unicode hex": "270C" },
  13713. { "Typeface name": "Wingdings", "Dingbat dec": "66", "Dingbat hex": "42", "Unicode dec": "128399", "Unicode hex": "1F58F" },
  13714. { "Typeface name": "Wingdings", "Dingbat dec": "67", "Dingbat hex": "43", "Unicode dec": "128077", "Unicode hex": "1F44D" },
  13715. { "Typeface name": "Wingdings", "Dingbat dec": "68", "Dingbat hex": "44", "Unicode dec": "128078", "Unicode hex": "1F44E" },
  13716. { "Typeface name": "Wingdings", "Dingbat dec": "69", "Dingbat hex": "45", "Unicode dec": "9756", "Unicode hex": "261C" },
  13717. { "Typeface name": "Wingdings", "Dingbat dec": "70", "Dingbat hex": "46", "Unicode dec": "9758", "Unicode hex": "261E" },
  13718. { "Typeface name": "Wingdings", "Dingbat dec": "71", "Dingbat hex": "47", "Unicode dec": "9757", "Unicode hex": "261D" },
  13719. { "Typeface name": "Wingdings", "Dingbat dec": "72", "Dingbat hex": "48", "Unicode dec": "9759", "Unicode hex": "261F" },
  13720. { "Typeface name": "Wingdings", "Dingbat dec": "73", "Dingbat hex": "49", "Unicode dec": "128400", "Unicode hex": "1F590" },
  13721. { "Typeface name": "Wingdings", "Dingbat dec": "74", "Dingbat hex": "4A", "Unicode dec": "9786", "Unicode hex": "263A" },
  13722. { "Typeface name": "Wingdings", "Dingbat dec": "75", "Dingbat hex": "4B", "Unicode dec": "128528", "Unicode hex": "1F610" },
  13723. { "Typeface name": "Wingdings", "Dingbat dec": "76", "Dingbat hex": "4C", "Unicode dec": "9785", "Unicode hex": "2639" },
  13724. { "Typeface name": "Wingdings", "Dingbat dec": "77", "Dingbat hex": "4D", "Unicode dec": "128163", "Unicode hex": "1F4A3" },
  13725. { "Typeface name": "Wingdings", "Dingbat dec": "78", "Dingbat hex": "4E", "Unicode dec": "128369", "Unicode hex": "1F571" },
  13726. { "Typeface name": "Wingdings", "Dingbat dec": "79", "Dingbat hex": "4F", "Unicode dec": "127987", "Unicode hex": "1F3F3" },
  13727. { "Typeface name": "Wingdings", "Dingbat dec": "80", "Dingbat hex": "50", "Unicode dec": "127985", "Unicode hex": "1F3F1" },
  13728. { "Typeface name": "Wingdings", "Dingbat dec": "81", "Dingbat hex": "51", "Unicode dec": "9992", "Unicode hex": "2708" },
  13729. { "Typeface name": "Wingdings", "Dingbat dec": "82", "Dingbat hex": "52", "Unicode dec": "9788", "Unicode hex": "263C" },
  13730. { "Typeface name": "Wingdings", "Dingbat dec": "83", "Dingbat hex": "53", "Unicode dec": "127778", "Unicode hex": "1F322" },
  13731. { "Typeface name": "Wingdings", "Dingbat dec": "84", "Dingbat hex": "54", "Unicode dec": "10052", "Unicode hex": "2744" },
  13732. { "Typeface name": "Wingdings", "Dingbat dec": "85", "Dingbat hex": "55", "Unicode dec": "128326", "Unicode hex": "1F546" },
  13733. { "Typeface name": "Wingdings", "Dingbat dec": "86", "Dingbat hex": "56", "Unicode dec": "10014", "Unicode hex": "271E" },
  13734. { "Typeface name": "Wingdings", "Dingbat dec": "87", "Dingbat hex": "57", "Unicode dec": "128328", "Unicode hex": "1F548" },
  13735. { "Typeface name": "Wingdings", "Dingbat dec": "88", "Dingbat hex": "58", "Unicode dec": "10016", "Unicode hex": "2720" },
  13736. { "Typeface name": "Wingdings", "Dingbat dec": "89", "Dingbat hex": "59", "Unicode dec": "10017", "Unicode hex": "2721" },
  13737. { "Typeface name": "Wingdings", "Dingbat dec": "90", "Dingbat hex": "5A", "Unicode dec": "9770", "Unicode hex": "262A" },
  13738. { "Typeface name": "Wingdings", "Dingbat dec": "91", "Dingbat hex": "5B", "Unicode dec": "9775", "Unicode hex": "262F" },
  13739. { "Typeface name": "Wingdings", "Dingbat dec": "92", "Dingbat hex": "5C", "Unicode dec": "128329", "Unicode hex": "1F549" },
  13740. { "Typeface name": "Wingdings", "Dingbat dec": "93", "Dingbat hex": "5D", "Unicode dec": "9784", "Unicode hex": "2638" },
  13741. { "Typeface name": "Wingdings", "Dingbat dec": "94", "Dingbat hex": "5E", "Unicode dec": "9800", "Unicode hex": "2648" },
  13742. { "Typeface name": "Wingdings", "Dingbat dec": "95", "Dingbat hex": "5F", "Unicode dec": "9801", "Unicode hex": "2649" },
  13743. { "Typeface name": "Wingdings", "Dingbat dec": "96", "Dingbat hex": "60", "Unicode dec": "9802", "Unicode hex": "264A" },
  13744. { "Typeface name": "Wingdings", "Dingbat dec": "97", "Dingbat hex": "61", "Unicode dec": "9803", "Unicode hex": "264B" },
  13745. { "Typeface name": "Wingdings", "Dingbat dec": "98", "Dingbat hex": "62", "Unicode dec": "9804", "Unicode hex": "264C" },
  13746. { "Typeface name": "Wingdings", "Dingbat dec": "99", "Dingbat hex": "63", "Unicode dec": "9805", "Unicode hex": "264D" },
  13747. { "Typeface name": "Wingdings", "Dingbat dec": "100", "Dingbat hex": "64", "Unicode dec": "9806", "Unicode hex": "264E" },
  13748. { "Typeface name": "Wingdings", "Dingbat dec": "101", "Dingbat hex": "65", "Unicode dec": "9807", "Unicode hex": "264F" },
  13749. { "Typeface name": "Wingdings", "Dingbat dec": "102", "Dingbat hex": "66", "Unicode dec": "9808", "Unicode hex": "2650" },
  13750. { "Typeface name": "Wingdings", "Dingbat dec": "103", "Dingbat hex": "67", "Unicode dec": "9809", "Unicode hex": "2651" },
  13751. { "Typeface name": "Wingdings", "Dingbat dec": "104", "Dingbat hex": "68", "Unicode dec": "9810", "Unicode hex": "2652" },
  13752. { "Typeface name": "Wingdings", "Dingbat dec": "105", "Dingbat hex": "69", "Unicode dec": "9811", "Unicode hex": "2653" },
  13753. { "Typeface name": "Wingdings", "Dingbat dec": "106", "Dingbat hex": "6A", "Unicode dec": "128624", "Unicode hex": "1F670" },
  13754. { "Typeface name": "Wingdings", "Dingbat dec": "107", "Dingbat hex": "6B", "Unicode dec": "128629", "Unicode hex": "1F675" },
  13755. { "Typeface name": "Wingdings", "Dingbat dec": "108", "Dingbat hex": "6C", "Unicode dec": "9899", "Unicode hex": "26AB" },
  13756. { "Typeface name": "Wingdings", "Dingbat dec": "109", "Dingbat hex": "6D", "Unicode dec": "128318", "Unicode hex": "1F53E" },
  13757. { "Typeface name": "Wingdings", "Dingbat dec": "110", "Dingbat hex": "6E", "Unicode dec": "9724", "Unicode hex": "25FC" },
  13758. { "Typeface name": "Wingdings", "Dingbat dec": "111", "Dingbat hex": "6F", "Unicode dec": "128911", "Unicode hex": "1F78F" },
  13759. { "Typeface name": "Wingdings", "Dingbat dec": "112", "Dingbat hex": "70", "Unicode dec": "128912", "Unicode hex": "1F790" },
  13760. { "Typeface name": "Wingdings", "Dingbat dec": "113", "Dingbat hex": "71", "Unicode dec": "10065", "Unicode hex": "2751" },
  13761. { "Typeface name": "Wingdings", "Dingbat dec": "114", "Dingbat hex": "72", "Unicode dec": "10066", "Unicode hex": "2752" },
  13762. { "Typeface name": "Wingdings", "Dingbat dec": "115", "Dingbat hex": "73", "Unicode dec": "128927", "Unicode hex": "1F79F" },
  13763. { "Typeface name": "Wingdings", "Dingbat dec": "116", "Dingbat hex": "74", "Unicode dec": "10731", "Unicode hex": "29EB" },
  13764. { "Typeface name": "Wingdings", "Dingbat dec": "117", "Dingbat hex": "75", "Unicode dec": "9670", "Unicode hex": "25C6" },
  13765. { "Typeface name": "Wingdings", "Dingbat dec": "118", "Dingbat hex": "76", "Unicode dec": "10070", "Unicode hex": "2756" },
  13766. { "Typeface name": "Wingdings", "Dingbat dec": "119", "Dingbat hex": "77", "Unicode dec": "11049", "Unicode hex": "2B29" },
  13767. { "Typeface name": "Wingdings", "Dingbat dec": "120", "Dingbat hex": "78", "Unicode dec": "8999", "Unicode hex": "2327" },
  13768. { "Typeface name": "Wingdings", "Dingbat dec": "121", "Dingbat hex": "79", "Unicode dec": "11193", "Unicode hex": "2BB9" },
  13769. { "Typeface name": "Wingdings", "Dingbat dec": "122", "Dingbat hex": "7A", "Unicode dec": "8984", "Unicode hex": "2318" },
  13770. { "Typeface name": "Wingdings", "Dingbat dec": "123", "Dingbat hex": "7B", "Unicode dec": "127989", "Unicode hex": "1F3F5" },
  13771. { "Typeface name": "Wingdings", "Dingbat dec": "124", "Dingbat hex": "7C", "Unicode dec": "127990", "Unicode hex": "1F3F6" },
  13772. { "Typeface name": "Wingdings", "Dingbat dec": "125", "Dingbat hex": "7D", "Unicode dec": "128630", "Unicode hex": "1F676" },
  13773. { "Typeface name": "Wingdings", "Dingbat dec": "126", "Dingbat hex": "7E", "Unicode dec": "128631", "Unicode hex": "1F677" },
  13774. { "Typeface name": "Wingdings", "Dingbat dec": "127", "Dingbat hex": "7F", "Unicode dec": "9647", "Unicode hex": "25AF" },
  13775. { "Typeface name": "Wingdings", "Dingbat dec": "128", "Dingbat hex": "80", "Unicode dec": "127243", "Unicode hex": "1F10B" },
  13776. { "Typeface name": "Wingdings", "Dingbat dec": "129", "Dingbat hex": "81", "Unicode dec": "10112", "Unicode hex": "2780" },
  13777. { "Typeface name": "Wingdings", "Dingbat dec": "130", "Dingbat hex": "82", "Unicode dec": "10113", "Unicode hex": "2781" },
  13778. { "Typeface name": "Wingdings", "Dingbat dec": "131", "Dingbat hex": "83", "Unicode dec": "10114", "Unicode hex": "2782" },
  13779. { "Typeface name": "Wingdings", "Dingbat dec": "132", "Dingbat hex": "84", "Unicode dec": "10115", "Unicode hex": "2783" },
  13780. { "Typeface name": "Wingdings", "Dingbat dec": "133", "Dingbat hex": "85", "Unicode dec": "10116", "Unicode hex": "2784" },
  13781. { "Typeface name": "Wingdings", "Dingbat dec": "134", "Dingbat hex": "86", "Unicode dec": "10117", "Unicode hex": "2785" },
  13782. { "Typeface name": "Wingdings", "Dingbat dec": "135", "Dingbat hex": "87", "Unicode dec": "10118", "Unicode hex": "2786" },
  13783. { "Typeface name": "Wingdings", "Dingbat dec": "136", "Dingbat hex": "88", "Unicode dec": "10119", "Unicode hex": "2787" },
  13784. { "Typeface name": "Wingdings", "Dingbat dec": "137", "Dingbat hex": "89", "Unicode dec": "10120", "Unicode hex": "2788" },
  13785. { "Typeface name": "Wingdings", "Dingbat dec": "138", "Dingbat hex": "8A", "Unicode dec": "10121", "Unicode hex": "2789" },
  13786. { "Typeface name": "Wingdings", "Dingbat dec": "139", "Dingbat hex": "8B", "Unicode dec": "127244", "Unicode hex": "1F10C" },
  13787. { "Typeface name": "Wingdings", "Dingbat dec": "140", "Dingbat hex": "8C", "Unicode dec": "10122", "Unicode hex": "278A" },
  13788. { "Typeface name": "Wingdings", "Dingbat dec": "141", "Dingbat hex": "8D", "Unicode dec": "10123", "Unicode hex": "278B" },
  13789. { "Typeface name": "Wingdings", "Dingbat dec": "142", "Dingbat hex": "8E", "Unicode dec": "10124", "Unicode hex": "278C" },
  13790. { "Typeface name": "Wingdings", "Dingbat dec": "143", "Dingbat hex": "8F", "Unicode dec": "10125", "Unicode hex": "278D" },
  13791. { "Typeface name": "Wingdings", "Dingbat dec": "144", "Dingbat hex": "90", "Unicode dec": "10126", "Unicode hex": "278E" },
  13792. { "Typeface name": "Wingdings", "Dingbat dec": "145", "Dingbat hex": "91", "Unicode dec": "10127", "Unicode hex": "278F" },
  13793. { "Typeface name": "Wingdings", "Dingbat dec": "146", "Dingbat hex": "92", "Unicode dec": "10128", "Unicode hex": "2790" },
  13794. { "Typeface name": "Wingdings", "Dingbat dec": "147", "Dingbat hex": "93", "Unicode dec": "10129", "Unicode hex": "2791" },
  13795. { "Typeface name": "Wingdings", "Dingbat dec": "148", "Dingbat hex": "94", "Unicode dec": "10130", "Unicode hex": "2792" },
  13796. { "Typeface name": "Wingdings", "Dingbat dec": "149", "Dingbat hex": "95", "Unicode dec": "10131", "Unicode hex": "2793" },
  13797. { "Typeface name": "Wingdings", "Dingbat dec": "150", "Dingbat hex": "96", "Unicode dec": "128610", "Unicode hex": "1F662" },
  13798. { "Typeface name": "Wingdings", "Dingbat dec": "151", "Dingbat hex": "97", "Unicode dec": "128608", "Unicode hex": "1F660" },
  13799. { "Typeface name": "Wingdings", "Dingbat dec": "152", "Dingbat hex": "98", "Unicode dec": "128609", "Unicode hex": "1F661" },
  13800. { "Typeface name": "Wingdings", "Dingbat dec": "153", "Dingbat hex": "99", "Unicode dec": "128611", "Unicode hex": "1F663" },
  13801. { "Typeface name": "Wingdings", "Dingbat dec": "154", "Dingbat hex": "9A", "Unicode dec": "128606", "Unicode hex": "1F65E" },
  13802. { "Typeface name": "Wingdings", "Dingbat dec": "155", "Dingbat hex": "9B", "Unicode dec": "128604", "Unicode hex": "1F65C" },
  13803. { "Typeface name": "Wingdings", "Dingbat dec": "156", "Dingbat hex": "9C", "Unicode dec": "128605", "Unicode hex": "1F65D" },
  13804. { "Typeface name": "Wingdings", "Dingbat dec": "157", "Dingbat hex": "9D", "Unicode dec": "128607", "Unicode hex": "1F65F" },
  13805. { "Typeface name": "Wingdings", "Dingbat dec": "158", "Dingbat hex": "9E", "Unicode dec": "8729", "Unicode hex": "2219" },
  13806. { "Typeface name": "Wingdings", "Dingbat dec": "159", "Dingbat hex": "9F", "Unicode dec": "8226", "Unicode hex": "2022" },
  13807. { "Typeface name": "Wingdings", "Dingbat dec": "160", "Dingbat hex": "A0", "Unicode dec": "11037", "Unicode hex": "2B1D" },
  13808. { "Typeface name": "Wingdings", "Dingbat dec": "161", "Dingbat hex": "A1", "Unicode dec": "11096", "Unicode hex": "2B58" },
  13809. { "Typeface name": "Wingdings", "Dingbat dec": "162", "Dingbat hex": "A2", "Unicode dec": "128902", "Unicode hex": "1F786" },
  13810. { "Typeface name": "Wingdings", "Dingbat dec": "163", "Dingbat hex": "A3", "Unicode dec": "128904", "Unicode hex": "1F788" },
  13811. { "Typeface name": "Wingdings", "Dingbat dec": "164", "Dingbat hex": "A4", "Unicode dec": "128906", "Unicode hex": "1F78A" },
  13812. { "Typeface name": "Wingdings", "Dingbat dec": "165", "Dingbat hex": "A5", "Unicode dec": "128907", "Unicode hex": "1F78B" },
  13813. { "Typeface name": "Wingdings", "Dingbat dec": "166", "Dingbat hex": "A6", "Unicode dec": "128319", "Unicode hex": "1F53F" },
  13814. { "Typeface name": "Wingdings", "Dingbat dec": "167", "Dingbat hex": "A7", "Unicode dec": "9642", "Unicode hex": "25AA" },
  13815. { "Typeface name": "Wingdings", "Dingbat dec": "168", "Dingbat hex": "A8", "Unicode dec": "128910", "Unicode hex": "1F78E" },
  13816. { "Typeface name": "Wingdings", "Dingbat dec": "169", "Dingbat hex": "A9", "Unicode dec": "128961", "Unicode hex": "1F7C1" },
  13817. { "Typeface name": "Wingdings", "Dingbat dec": "170", "Dingbat hex": "AA", "Unicode dec": "128965", "Unicode hex": "1F7C5" },
  13818. { "Typeface name": "Wingdings", "Dingbat dec": "171", "Dingbat hex": "AB", "Unicode dec": "9733", "Unicode hex": "2605" },
  13819. { "Typeface name": "Wingdings", "Dingbat dec": "172", "Dingbat hex": "AC", "Unicode dec": "128971", "Unicode hex": "1F7CB" },
  13820. { "Typeface name": "Wingdings", "Dingbat dec": "173", "Dingbat hex": "AD", "Unicode dec": "128975", "Unicode hex": "1F7CF" },
  13821. { "Typeface name": "Wingdings", "Dingbat dec": "174", "Dingbat hex": "AE", "Unicode dec": "128979", "Unicode hex": "1F7D3" },
  13822. { "Typeface name": "Wingdings", "Dingbat dec": "175", "Dingbat hex": "AF", "Unicode dec": "128977", "Unicode hex": "1F7D1" },
  13823. { "Typeface name": "Wingdings", "Dingbat dec": "176", "Dingbat hex": "B0", "Unicode dec": "11216", "Unicode hex": "2BD0" },
  13824. { "Typeface name": "Wingdings", "Dingbat dec": "177", "Dingbat hex": "B1", "Unicode dec": "8982", "Unicode hex": "2316" },
  13825. { "Typeface name": "Wingdings", "Dingbat dec": "178", "Dingbat hex": "B2", "Unicode dec": "11214", "Unicode hex": "2BCE" },
  13826. { "Typeface name": "Wingdings", "Dingbat dec": "179", "Dingbat hex": "B3", "Unicode dec": "11215", "Unicode hex": "2BCF" },
  13827. { "Typeface name": "Wingdings", "Dingbat dec": "180", "Dingbat hex": "B4", "Unicode dec": "11217", "Unicode hex": "2BD1" },
  13828. { "Typeface name": "Wingdings", "Dingbat dec": "181", "Dingbat hex": "B5", "Unicode dec": "10026", "Unicode hex": "272A" },
  13829. { "Typeface name": "Wingdings", "Dingbat dec": "182", "Dingbat hex": "B6", "Unicode dec": "10032", "Unicode hex": "2730" },
  13830. { "Typeface name": "Wingdings", "Dingbat dec": "183", "Dingbat hex": "B7", "Unicode dec": "128336", "Unicode hex": "1F550" },
  13831. { "Typeface name": "Wingdings", "Dingbat dec": "184", "Dingbat hex": "B8", "Unicode dec": "128337", "Unicode hex": "1F551" },
  13832. { "Typeface name": "Wingdings", "Dingbat dec": "185", "Dingbat hex": "B9", "Unicode dec": "128338", "Unicode hex": "1F552" },
  13833. { "Typeface name": "Wingdings", "Dingbat dec": "186", "Dingbat hex": "BA", "Unicode dec": "128339", "Unicode hex": "1F553" },
  13834. { "Typeface name": "Wingdings", "Dingbat dec": "187", "Dingbat hex": "BB", "Unicode dec": "128340", "Unicode hex": "1F554" },
  13835. { "Typeface name": "Wingdings", "Dingbat dec": "188", "Dingbat hex": "BC", "Unicode dec": "128341", "Unicode hex": "1F555" },
  13836. { "Typeface name": "Wingdings", "Dingbat dec": "189", "Dingbat hex": "BD", "Unicode dec": "128342", "Unicode hex": "1F556" },
  13837. { "Typeface name": "Wingdings", "Dingbat dec": "190", "Dingbat hex": "BE", "Unicode dec": "128343", "Unicode hex": "1F557" },
  13838. { "Typeface name": "Wingdings", "Dingbat dec": "191", "Dingbat hex": "BF", "Unicode dec": "128344", "Unicode hex": "1F558" },
  13839. { "Typeface name": "Wingdings", "Dingbat dec": "192", "Dingbat hex": "C0", "Unicode dec": "128345", "Unicode hex": "1F559" },
  13840. { "Typeface name": "Wingdings", "Dingbat dec": "193", "Dingbat hex": "C1", "Unicode dec": "128346", "Unicode hex": "1F55A" },
  13841. { "Typeface name": "Wingdings", "Dingbat dec": "194", "Dingbat hex": "C2", "Unicode dec": "128347", "Unicode hex": "1F55B" },
  13842. { "Typeface name": "Wingdings", "Dingbat dec": "195", "Dingbat hex": "C3", "Unicode dec": "11184", "Unicode hex": "2BB0" },
  13843. { "Typeface name": "Wingdings", "Dingbat dec": "196", "Dingbat hex": "C4", "Unicode dec": "11185", "Unicode hex": "2BB1" },
  13844. { "Typeface name": "Wingdings", "Dingbat dec": "197", "Dingbat hex": "C5", "Unicode dec": "11186", "Unicode hex": "2BB2" },
  13845. { "Typeface name": "Wingdings", "Dingbat dec": "198", "Dingbat hex": "C6", "Unicode dec": "11187", "Unicode hex": "2BB3" },
  13846. { "Typeface name": "Wingdings", "Dingbat dec": "199", "Dingbat hex": "C7", "Unicode dec": "11188", "Unicode hex": "2BB4" },
  13847. { "Typeface name": "Wingdings", "Dingbat dec": "200", "Dingbat hex": "C8", "Unicode dec": "11189", "Unicode hex": "2BB5" },
  13848. { "Typeface name": "Wingdings", "Dingbat dec": "201", "Dingbat hex": "C9", "Unicode dec": "11190", "Unicode hex": "2BB6" },
  13849. { "Typeface name": "Wingdings", "Dingbat dec": "202", "Dingbat hex": "CA", "Unicode dec": "11191", "Unicode hex": "2BB7" },
  13850. { "Typeface name": "Wingdings", "Dingbat dec": "203", "Dingbat hex": "CB", "Unicode dec": "128618", "Unicode hex": "1F66A" },
  13851. { "Typeface name": "Wingdings", "Dingbat dec": "204", "Dingbat hex": "CC", "Unicode dec": "128619", "Unicode hex": "1F66B" },
  13852. { "Typeface name": "Wingdings", "Dingbat dec": "205", "Dingbat hex": "CD", "Unicode dec": "128597", "Unicode hex": "1F655" },
  13853. { "Typeface name": "Wingdings", "Dingbat dec": "206", "Dingbat hex": "CE", "Unicode dec": "128596", "Unicode hex": "1F654" },
  13854. { "Typeface name": "Wingdings", "Dingbat dec": "207", "Dingbat hex": "CF", "Unicode dec": "128599", "Unicode hex": "1F657" },
  13855. { "Typeface name": "Wingdings", "Dingbat dec": "208", "Dingbat hex": "D0", "Unicode dec": "128598", "Unicode hex": "1F656" },
  13856. { "Typeface name": "Wingdings", "Dingbat dec": "209", "Dingbat hex": "D1", "Unicode dec": "128592", "Unicode hex": "1F650" },
  13857. { "Typeface name": "Wingdings", "Dingbat dec": "210", "Dingbat hex": "D2", "Unicode dec": "128593", "Unicode hex": "1F651" },
  13858. { "Typeface name": "Wingdings", "Dingbat dec": "211", "Dingbat hex": "D3", "Unicode dec": "128594", "Unicode hex": "1F652" },
  13859. { "Typeface name": "Wingdings", "Dingbat dec": "212", "Dingbat hex": "D4", "Unicode dec": "128595", "Unicode hex": "1F653" },
  13860. { "Typeface name": "Wingdings", "Dingbat dec": "213", "Dingbat hex": "D5", "Unicode dec": "9003", "Unicode hex": "232B" },
  13861. { "Typeface name": "Wingdings", "Dingbat dec": "214", "Dingbat hex": "D6", "Unicode dec": "8998", "Unicode hex": "2326" },
  13862. { "Typeface name": "Wingdings", "Dingbat dec": "215", "Dingbat hex": "D7", "Unicode dec": "11160", "Unicode hex": "2B98" },
  13863. { "Typeface name": "Wingdings", "Dingbat dec": "216", "Dingbat hex": "D8", "Unicode dec": "11162", "Unicode hex": "2B9A" },
  13864. { "Typeface name": "Wingdings", "Dingbat dec": "217", "Dingbat hex": "D9", "Unicode dec": "11161", "Unicode hex": "2B99" },
  13865. { "Typeface name": "Wingdings", "Dingbat dec": "218", "Dingbat hex": "DA", "Unicode dec": "11163", "Unicode hex": "2B9B" },
  13866. { "Typeface name": "Wingdings", "Dingbat dec": "219", "Dingbat hex": "DB", "Unicode dec": "11144", "Unicode hex": "2B88" },
  13867. { "Typeface name": "Wingdings", "Dingbat dec": "220", "Dingbat hex": "DC", "Unicode dec": "11146", "Unicode hex": "2B8A" },
  13868. { "Typeface name": "Wingdings", "Dingbat dec": "221", "Dingbat hex": "DD", "Unicode dec": "11145", "Unicode hex": "2B89" },
  13869. { "Typeface name": "Wingdings", "Dingbat dec": "222", "Dingbat hex": "DE", "Unicode dec": "11147", "Unicode hex": "2B8B" },
  13870. { "Typeface name": "Wingdings", "Dingbat dec": "223", "Dingbat hex": "DF", "Unicode dec": "129128", "Unicode hex": "1F868" },
  13871. { "Typeface name": "Wingdings", "Dingbat dec": "224", "Dingbat hex": "E0", "Unicode dec": "129130", "Unicode hex": "1F86A" },
  13872. { "Typeface name": "Wingdings", "Dingbat dec": "225", "Dingbat hex": "E1", "Unicode dec": "129129", "Unicode hex": "1F869" },
  13873. { "Typeface name": "Wingdings", "Dingbat dec": "226", "Dingbat hex": "E2", "Unicode dec": "129131", "Unicode hex": "1F86B" },
  13874. { "Typeface name": "Wingdings", "Dingbat dec": "227", "Dingbat hex": "E3", "Unicode dec": "129132", "Unicode hex": "1F86C" },
  13875. { "Typeface name": "Wingdings", "Dingbat dec": "228", "Dingbat hex": "E4", "Unicode dec": "129133", "Unicode hex": "1F86D" },
  13876. { "Typeface name": "Wingdings", "Dingbat dec": "229", "Dingbat hex": "E5", "Unicode dec": "129135", "Unicode hex": "1F86F" },
  13877. { "Typeface name": "Wingdings", "Dingbat dec": "230", "Dingbat hex": "E6", "Unicode dec": "129134", "Unicode hex": "1F86E" },
  13878. { "Typeface name": "Wingdings", "Dingbat dec": "231", "Dingbat hex": "E7", "Unicode dec": "129144", "Unicode hex": "1F878" },
  13879. { "Typeface name": "Wingdings", "Dingbat dec": "232", "Dingbat hex": "E8", "Unicode dec": "129146", "Unicode hex": "1F87A" },
  13880. { "Typeface name": "Wingdings", "Dingbat dec": "233", "Dingbat hex": "E9", "Unicode dec": "129145", "Unicode hex": "1F879" },
  13881. { "Typeface name": "Wingdings", "Dingbat dec": "234", "Dingbat hex": "EA", "Unicode dec": "129147", "Unicode hex": "1F87B" },
  13882. { "Typeface name": "Wingdings", "Dingbat dec": "235", "Dingbat hex": "EB", "Unicode dec": "129148", "Unicode hex": "1F87C" },
  13883. { "Typeface name": "Wingdings", "Dingbat dec": "236", "Dingbat hex": "EC", "Unicode dec": "129149", "Unicode hex": "1F87D" },
  13884. { "Typeface name": "Wingdings", "Dingbat dec": "237", "Dingbat hex": "ED", "Unicode dec": "129151", "Unicode hex": "1F87F" },
  13885. { "Typeface name": "Wingdings", "Dingbat dec": "238", "Dingbat hex": "EE", "Unicode dec": "129150", "Unicode hex": "1F87E" },
  13886. { "Typeface name": "Wingdings", "Dingbat dec": "239", "Dingbat hex": "EF", "Unicode dec": "8678", "Unicode hex": "21E6" },
  13887. { "Typeface name": "Wingdings", "Dingbat dec": "240", "Dingbat hex": "F0", "Unicode dec": "8680", "Unicode hex": "21E8" },
  13888. { "Typeface name": "Wingdings", "Dingbat dec": "241", "Dingbat hex": "F1", "Unicode dec": "8679", "Unicode hex": "21E7" },
  13889. { "Typeface name": "Wingdings", "Dingbat dec": "242", "Dingbat hex": "F2", "Unicode dec": "8681", "Unicode hex": "21E9" },
  13890. { "Typeface name": "Wingdings", "Dingbat dec": "243", "Dingbat hex": "F3", "Unicode dec": "11012", "Unicode hex": "2B04" },
  13891. { "Typeface name": "Wingdings", "Dingbat dec": "244", "Dingbat hex": "F4", "Unicode dec": "8691", "Unicode hex": "21F3" },
  13892. { "Typeface name": "Wingdings", "Dingbat dec": "245", "Dingbat hex": "F5", "Unicode dec": "11009", "Unicode hex": "2B01" },
  13893. { "Typeface name": "Wingdings", "Dingbat dec": "246", "Dingbat hex": "F6", "Unicode dec": "11008", "Unicode hex": "2B00" },
  13894. { "Typeface name": "Wingdings", "Dingbat dec": "247", "Dingbat hex": "F7", "Unicode dec": "11011", "Unicode hex": "2B03" },
  13895. { "Typeface name": "Wingdings", "Dingbat dec": "248", "Dingbat hex": "F8", "Unicode dec": "11010", "Unicode hex": "2B02" },
  13896. { "Typeface name": "Wingdings", "Dingbat dec": "249", "Dingbat hex": "F9", "Unicode dec": "129196", "Unicode hex": "1F8AC" },
  13897. { "Typeface name": "Wingdings", "Dingbat dec": "250", "Dingbat hex": "FA", "Unicode dec": "129197", "Unicode hex": "1F8AD" },
  13898. { "Typeface name": "Wingdings", "Dingbat dec": "251", "Dingbat hex": "FB", "Unicode dec": "128502", "Unicode hex": "1F5F6" },
  13899. { "Typeface name": "Wingdings", "Dingbat dec": "252", "Dingbat hex": "FC", "Unicode dec": "10003", "Unicode hex": "2713" },
  13900. { "Typeface name": "Wingdings", "Dingbat dec": "253", "Dingbat hex": "FD", "Unicode dec": "128503", "Unicode hex": "1F5F7" },
  13901. { "Typeface name": "Wingdings", "Dingbat dec": "254", "Dingbat hex": "FE", "Unicode dec": "128505", "Unicode hex": "1F5F9" },
  13902. { "Typeface name": "Wingdings 2", "Dingbat dec": "32", "Dingbat hex": "20", "Unicode dec": "32", "Unicode hex": "20" },
  13903. { "Typeface name": "Wingdings 2", "Dingbat dec": "33", "Dingbat hex": "21", "Unicode dec": "128394", "Unicode hex": "1F58A" },
  13904. { "Typeface name": "Wingdings 2", "Dingbat dec": "34", "Dingbat hex": "22", "Unicode dec": "128395", "Unicode hex": "1F58B" },
  13905. { "Typeface name": "Wingdings 2", "Dingbat dec": "35", "Dingbat hex": "23", "Unicode dec": "128396", "Unicode hex": "1F58C" },
  13906. { "Typeface name": "Wingdings 2", "Dingbat dec": "36", "Dingbat hex": "24", "Unicode dec": "128397", "Unicode hex": "1F58D" },
  13907. { "Typeface name": "Wingdings 2", "Dingbat dec": "37", "Dingbat hex": "25", "Unicode dec": "9988", "Unicode hex": "2704" },
  13908. { "Typeface name": "Wingdings 2", "Dingbat dec": "38", "Dingbat hex": "26", "Unicode dec": "9984", "Unicode hex": "2700" },
  13909. { "Typeface name": "Wingdings 2", "Dingbat dec": "39", "Dingbat hex": "27", "Unicode dec": "128382", "Unicode hex": "1F57E" },
  13910. { "Typeface name": "Wingdings 2", "Dingbat dec": "40", "Dingbat hex": "28", "Unicode dec": "128381", "Unicode hex": "1F57D" },
  13911. { "Typeface name": "Wingdings 2", "Dingbat dec": "41", "Dingbat hex": "29", "Unicode dec": "128453", "Unicode hex": "1F5C5" },
  13912. { "Typeface name": "Wingdings 2", "Dingbat dec": "42", "Dingbat hex": "2A", "Unicode dec": "128454", "Unicode hex": "1F5C6" },
  13913. { "Typeface name": "Wingdings 2", "Dingbat dec": "43", "Dingbat hex": "2B", "Unicode dec": "128455", "Unicode hex": "1F5C7" },
  13914. { "Typeface name": "Wingdings 2", "Dingbat dec": "44", "Dingbat hex": "2C", "Unicode dec": "128456", "Unicode hex": "1F5C8" },
  13915. { "Typeface name": "Wingdings 2", "Dingbat dec": "45", "Dingbat hex": "2D", "Unicode dec": "128457", "Unicode hex": "1F5C9" },
  13916. { "Typeface name": "Wingdings 2", "Dingbat dec": "46", "Dingbat hex": "2E", "Unicode dec": "128458", "Unicode hex": "1F5CA" },
  13917. { "Typeface name": "Wingdings 2", "Dingbat dec": "47", "Dingbat hex": "2F", "Unicode dec": "128459", "Unicode hex": "1F5CB" },
  13918. { "Typeface name": "Wingdings 2", "Dingbat dec": "48", "Dingbat hex": "30", "Unicode dec": "128460", "Unicode hex": "1F5CC" },
  13919. { "Typeface name": "Wingdings 2", "Dingbat dec": "49", "Dingbat hex": "31", "Unicode dec": "128461", "Unicode hex": "1F5CD" },
  13920. { "Typeface name": "Wingdings 2", "Dingbat dec": "50", "Dingbat hex": "32", "Unicode dec": "128203", "Unicode hex": "1F4CB" },
  13921. { "Typeface name": "Wingdings 2", "Dingbat dec": "51", "Dingbat hex": "33", "Unicode dec": "128465", "Unicode hex": "1F5D1" },
  13922. { "Typeface name": "Wingdings 2", "Dingbat dec": "52", "Dingbat hex": "34", "Unicode dec": "128468", "Unicode hex": "1F5D4" },
  13923. { "Typeface name": "Wingdings 2", "Dingbat dec": "53", "Dingbat hex": "35", "Unicode dec": "128437", "Unicode hex": "1F5B5" },
  13924. { "Typeface name": "Wingdings 2", "Dingbat dec": "54", "Dingbat hex": "36", "Unicode dec": "128438", "Unicode hex": "1F5B6" },
  13925. { "Typeface name": "Wingdings 2", "Dingbat dec": "55", "Dingbat hex": "37", "Unicode dec": "128439", "Unicode hex": "1F5B7" },
  13926. { "Typeface name": "Wingdings 2", "Dingbat dec": "56", "Dingbat hex": "38", "Unicode dec": "128440", "Unicode hex": "1F5B8" },
  13927. { "Typeface name": "Wingdings 2", "Dingbat dec": "57", "Dingbat hex": "39", "Unicode dec": "128429", "Unicode hex": "1F5AD" },
  13928. { "Typeface name": "Wingdings 2", "Dingbat dec": "58", "Dingbat hex": "3A", "Unicode dec": "128431", "Unicode hex": "1F5AF" },
  13929. { "Typeface name": "Wingdings 2", "Dingbat dec": "59", "Dingbat hex": "3B", "Unicode dec": "128433", "Unicode hex": "1F5B1" },
  13930. { "Typeface name": "Wingdings 2", "Dingbat dec": "60", "Dingbat hex": "3C", "Unicode dec": "128402", "Unicode hex": "1F592" },
  13931. { "Typeface name": "Wingdings 2", "Dingbat dec": "61", "Dingbat hex": "3D", "Unicode dec": "128403", "Unicode hex": "1F593" },
  13932. { "Typeface name": "Wingdings 2", "Dingbat dec": "62", "Dingbat hex": "3E", "Unicode dec": "128408", "Unicode hex": "1F598" },
  13933. { "Typeface name": "Wingdings 2", "Dingbat dec": "63", "Dingbat hex": "3F", "Unicode dec": "128409", "Unicode hex": "1F599" },
  13934. { "Typeface name": "Wingdings 2", "Dingbat dec": "64", "Dingbat hex": "40", "Unicode dec": "128410", "Unicode hex": "1F59A" },
  13935. { "Typeface name": "Wingdings 2", "Dingbat dec": "65", "Dingbat hex": "41", "Unicode dec": "128411", "Unicode hex": "1F59B" },
  13936. { "Typeface name": "Wingdings 2", "Dingbat dec": "66", "Dingbat hex": "42", "Unicode dec": "128072", "Unicode hex": "1F448" },
  13937. { "Typeface name": "Wingdings 2", "Dingbat dec": "67", "Dingbat hex": "43", "Unicode dec": "128073", "Unicode hex": "1F449" },
  13938. { "Typeface name": "Wingdings 2", "Dingbat dec": "68", "Dingbat hex": "44", "Unicode dec": "128412", "Unicode hex": "1F59C" },
  13939. { "Typeface name": "Wingdings 2", "Dingbat dec": "69", "Dingbat hex": "45", "Unicode dec": "128413", "Unicode hex": "1F59D" },
  13940. { "Typeface name": "Wingdings 2", "Dingbat dec": "70", "Dingbat hex": "46", "Unicode dec": "128414", "Unicode hex": "1F59E" },
  13941. { "Typeface name": "Wingdings 2", "Dingbat dec": "71", "Dingbat hex": "47", "Unicode dec": "128415", "Unicode hex": "1F59F" },
  13942. { "Typeface name": "Wingdings 2", "Dingbat dec": "72", "Dingbat hex": "48", "Unicode dec": "128416", "Unicode hex": "1F5A0" },
  13943. { "Typeface name": "Wingdings 2", "Dingbat dec": "73", "Dingbat hex": "49", "Unicode dec": "128417", "Unicode hex": "1F5A1" },
  13944. { "Typeface name": "Wingdings 2", "Dingbat dec": "74", "Dingbat hex": "4A", "Unicode dec": "128070", "Unicode hex": "1F446" },
  13945. { "Typeface name": "Wingdings 2", "Dingbat dec": "75", "Dingbat hex": "4B", "Unicode dec": "128071", "Unicode hex": "1F447" },
  13946. { "Typeface name": "Wingdings 2", "Dingbat dec": "76", "Dingbat hex": "4C", "Unicode dec": "128418", "Unicode hex": "1F5A2" },
  13947. { "Typeface name": "Wingdings 2", "Dingbat dec": "77", "Dingbat hex": "4D", "Unicode dec": "128419", "Unicode hex": "1F5A3" },
  13948. { "Typeface name": "Wingdings 2", "Dingbat dec": "78", "Dingbat hex": "4E", "Unicode dec": "128401", "Unicode hex": "1F591" },
  13949. { "Typeface name": "Wingdings 2", "Dingbat dec": "79", "Dingbat hex": "4F", "Unicode dec": "128500", "Unicode hex": "1F5F4" },
  13950. { "Typeface name": "Wingdings 2", "Dingbat dec": "80", "Dingbat hex": "50", "Unicode dec": "128504", "Unicode hex": "1F5F8" },
  13951. { "Typeface name": "Wingdings 2", "Dingbat dec": "81", "Dingbat hex": "51", "Unicode dec": "128501", "Unicode hex": "1F5F5" },
  13952. { "Typeface name": "Wingdings 2", "Dingbat dec": "82", "Dingbat hex": "52", "Unicode dec": "9745", "Unicode hex": "2611" },
  13953. { "Typeface name": "Wingdings 2", "Dingbat dec": "83", "Dingbat hex": "53", "Unicode dec": "11197", "Unicode hex": "2BBD" },
  13954. { "Typeface name": "Wingdings 2", "Dingbat dec": "84", "Dingbat hex": "54", "Unicode dec": "9746", "Unicode hex": "2612" },
  13955. { "Typeface name": "Wingdings 2", "Dingbat dec": "85", "Dingbat hex": "55", "Unicode dec": "11198", "Unicode hex": "2BBE" },
  13956. { "Typeface name": "Wingdings 2", "Dingbat dec": "86", "Dingbat hex": "56", "Unicode dec": "11199", "Unicode hex": "2BBF" },
  13957. { "Typeface name": "Wingdings 2", "Dingbat dec": "87", "Dingbat hex": "57", "Unicode dec": "128711", "Unicode hex": "1F6C7" },
  13958. { "Typeface name": "Wingdings 2", "Dingbat dec": "88", "Dingbat hex": "58", "Unicode dec": "10680", "Unicode hex": "29B8" },
  13959. { "Typeface name": "Wingdings 2", "Dingbat dec": "89", "Dingbat hex": "59", "Unicode dec": "128625", "Unicode hex": "1F671" },
  13960. { "Typeface name": "Wingdings 2", "Dingbat dec": "90", "Dingbat hex": "5A", "Unicode dec": "128628", "Unicode hex": "1F674" },
  13961. { "Typeface name": "Wingdings 2", "Dingbat dec": "91", "Dingbat hex": "5B", "Unicode dec": "128626", "Unicode hex": "1F672" },
  13962. { "Typeface name": "Wingdings 2", "Dingbat dec": "92", "Dingbat hex": "5C", "Unicode dec": "128627", "Unicode hex": "1F673" },
  13963. { "Typeface name": "Wingdings 2", "Dingbat dec": "93", "Dingbat hex": "5D", "Unicode dec": "8253", "Unicode hex": "203D" },
  13964. { "Typeface name": "Wingdings 2", "Dingbat dec": "94", "Dingbat hex": "5E", "Unicode dec": "128633", "Unicode hex": "1F679" },
  13965. { "Typeface name": "Wingdings 2", "Dingbat dec": "95", "Dingbat hex": "5F", "Unicode dec": "128634", "Unicode hex": "1F67A" },
  13966. { "Typeface name": "Wingdings 2", "Dingbat dec": "96", "Dingbat hex": "60", "Unicode dec": "128635", "Unicode hex": "1F67B" },
  13967. { "Typeface name": "Wingdings 2", "Dingbat dec": "97", "Dingbat hex": "61", "Unicode dec": "128614", "Unicode hex": "1F666" },
  13968. { "Typeface name": "Wingdings 2", "Dingbat dec": "98", "Dingbat hex": "62", "Unicode dec": "128612", "Unicode hex": "1F664" },
  13969. { "Typeface name": "Wingdings 2", "Dingbat dec": "99", "Dingbat hex": "63", "Unicode dec": "128613", "Unicode hex": "1F665" },
  13970. { "Typeface name": "Wingdings 2", "Dingbat dec": "100", "Dingbat hex": "64", "Unicode dec": "128615", "Unicode hex": "1F667" },
  13971. { "Typeface name": "Wingdings 2", "Dingbat dec": "101", "Dingbat hex": "65", "Unicode dec": "128602", "Unicode hex": "1F65A" },
  13972. { "Typeface name": "Wingdings 2", "Dingbat dec": "102", "Dingbat hex": "66", "Unicode dec": "128600", "Unicode hex": "1F658" },
  13973. { "Typeface name": "Wingdings 2", "Dingbat dec": "103", "Dingbat hex": "67", "Unicode dec": "128601", "Unicode hex": "1F659" },
  13974. { "Typeface name": "Wingdings 2", "Dingbat dec": "104", "Dingbat hex": "68", "Unicode dec": "128603", "Unicode hex": "1F65B" },
  13975. { "Typeface name": "Wingdings 2", "Dingbat dec": "105", "Dingbat hex": "69", "Unicode dec": "9450", "Unicode hex": "24EA" },
  13976. { "Typeface name": "Wingdings 2", "Dingbat dec": "106", "Dingbat hex": "6A", "Unicode dec": "9312", "Unicode hex": "2460" },
  13977. { "Typeface name": "Wingdings 2", "Dingbat dec": "107", "Dingbat hex": "6B", "Unicode dec": "9313", "Unicode hex": "2461" },
  13978. { "Typeface name": "Wingdings 2", "Dingbat dec": "108", "Dingbat hex": "6C", "Unicode dec": "9314", "Unicode hex": "2462" },
  13979. { "Typeface name": "Wingdings 2", "Dingbat dec": "109", "Dingbat hex": "6D", "Unicode dec": "9315", "Unicode hex": "2463" },
  13980. { "Typeface name": "Wingdings 2", "Dingbat dec": "110", "Dingbat hex": "6E", "Unicode dec": "9316", "Unicode hex": "2464" },
  13981. { "Typeface name": "Wingdings 2", "Dingbat dec": "111", "Dingbat hex": "6F", "Unicode dec": "9317", "Unicode hex": "2465" },
  13982. { "Typeface name": "Wingdings 2", "Dingbat dec": "112", "Dingbat hex": "70", "Unicode dec": "9318", "Unicode hex": "2466" },
  13983. { "Typeface name": "Wingdings 2", "Dingbat dec": "113", "Dingbat hex": "71", "Unicode dec": "9319", "Unicode hex": "2467" },
  13984. { "Typeface name": "Wingdings 2", "Dingbat dec": "114", "Dingbat hex": "72", "Unicode dec": "9320", "Unicode hex": "2468" },
  13985. { "Typeface name": "Wingdings 2", "Dingbat dec": "115", "Dingbat hex": "73", "Unicode dec": "9321", "Unicode hex": "2469" },
  13986. { "Typeface name": "Wingdings 2", "Dingbat dec": "116", "Dingbat hex": "74", "Unicode dec": "9471", "Unicode hex": "24FF" },
  13987. { "Typeface name": "Wingdings 2", "Dingbat dec": "117", "Dingbat hex": "75", "Unicode dec": "10102", "Unicode hex": "2776" },
  13988. { "Typeface name": "Wingdings 2", "Dingbat dec": "118", "Dingbat hex": "76", "Unicode dec": "10103", "Unicode hex": "2777" },
  13989. { "Typeface name": "Wingdings 2", "Dingbat dec": "119", "Dingbat hex": "77", "Unicode dec": "10104", "Unicode hex": "2778" },
  13990. { "Typeface name": "Wingdings 2", "Dingbat dec": "120", "Dingbat hex": "78", "Unicode dec": "10105", "Unicode hex": "2779" },
  13991. { "Typeface name": "Wingdings 2", "Dingbat dec": "121", "Dingbat hex": "79", "Unicode dec": "10106", "Unicode hex": "277A" },
  13992. { "Typeface name": "Wingdings 2", "Dingbat dec": "122", "Dingbat hex": "7A", "Unicode dec": "10107", "Unicode hex": "277B" },
  13993. { "Typeface name": "Wingdings 2", "Dingbat dec": "123", "Dingbat hex": "7B", "Unicode dec": "10108", "Unicode hex": "277C" },
  13994. { "Typeface name": "Wingdings 2", "Dingbat dec": "124", "Dingbat hex": "7C", "Unicode dec": "10109", "Unicode hex": "277D" },
  13995. { "Typeface name": "Wingdings 2", "Dingbat dec": "125", "Dingbat hex": "7D", "Unicode dec": "10110", "Unicode hex": "277E" },
  13996. { "Typeface name": "Wingdings 2", "Dingbat dec": "126", "Dingbat hex": "7E", "Unicode dec": "10111", "Unicode hex": "277F" },
  13997. { "Typeface name": "Wingdings 2", "Dingbat dec": "128", "Dingbat hex": "80", "Unicode dec": "9737", "Unicode hex": "2609" },
  13998. { "Typeface name": "Wingdings 2", "Dingbat dec": "129", "Dingbat hex": "81", "Unicode dec": "127765", "Unicode hex": "1F315" },
  13999. { "Typeface name": "Wingdings 2", "Dingbat dec": "130", "Dingbat hex": "82", "Unicode dec": "9789", "Unicode hex": "263D" },
  14000. { "Typeface name": "Wingdings 2", "Dingbat dec": "131", "Dingbat hex": "83", "Unicode dec": "9790", "Unicode hex": "263E" },
  14001. { "Typeface name": "Wingdings 2", "Dingbat dec": "132", "Dingbat hex": "84", "Unicode dec": "11839", "Unicode hex": "2E3F" },
  14002. { "Typeface name": "Wingdings 2", "Dingbat dec": "133", "Dingbat hex": "85", "Unicode dec": "10013", "Unicode hex": "271D" },
  14003. { "Typeface name": "Wingdings 2", "Dingbat dec": "134", "Dingbat hex": "86", "Unicode dec": "128327", "Unicode hex": "1F547" },
  14004. { "Typeface name": "Wingdings 2", "Dingbat dec": "135", "Dingbat hex": "87", "Unicode dec": "128348", "Unicode hex": "1F55C" },
  14005. { "Typeface name": "Wingdings 2", "Dingbat dec": "136", "Dingbat hex": "88", "Unicode dec": "128349", "Unicode hex": "1F55D" },
  14006. { "Typeface name": "Wingdings 2", "Dingbat dec": "137", "Dingbat hex": "89", "Unicode dec": "128350", "Unicode hex": "1F55E" },
  14007. { "Typeface name": "Wingdings 2", "Dingbat dec": "138", "Dingbat hex": "8A", "Unicode dec": "128351", "Unicode hex": "1F55F" },
  14008. { "Typeface name": "Wingdings 2", "Dingbat dec": "139", "Dingbat hex": "8B", "Unicode dec": "128352", "Unicode hex": "1F560" },
  14009. { "Typeface name": "Wingdings 2", "Dingbat dec": "140", "Dingbat hex": "8C", "Unicode dec": "128353", "Unicode hex": "1F561" },
  14010. { "Typeface name": "Wingdings 2", "Dingbat dec": "141", "Dingbat hex": "8D", "Unicode dec": "128354", "Unicode hex": "1F562" },
  14011. { "Typeface name": "Wingdings 2", "Dingbat dec": "142", "Dingbat hex": "8E", "Unicode dec": "128355", "Unicode hex": "1F563" },
  14012. { "Typeface name": "Wingdings 2", "Dingbat dec": "143", "Dingbat hex": "8F", "Unicode dec": "128356", "Unicode hex": "1F564" },
  14013. { "Typeface name": "Wingdings 2", "Dingbat dec": "144", "Dingbat hex": "90", "Unicode dec": "128357", "Unicode hex": "1F565" },
  14014. { "Typeface name": "Wingdings 2", "Dingbat dec": "145", "Dingbat hex": "91", "Unicode dec": "128358", "Unicode hex": "1F566" },
  14015. { "Typeface name": "Wingdings 2", "Dingbat dec": "146", "Dingbat hex": "92", "Unicode dec": "128359", "Unicode hex": "1F567" },
  14016. { "Typeface name": "Wingdings 2", "Dingbat dec": "147", "Dingbat hex": "93", "Unicode dec": "128616", "Unicode hex": "1F668" },
  14017. { "Typeface name": "Wingdings 2", "Dingbat dec": "148", "Dingbat hex": "94", "Unicode dec": "128617", "Unicode hex": "1F669" },
  14018. { "Typeface name": "Wingdings 2", "Dingbat dec": "149", "Dingbat hex": "95", "Unicode dec": "8901", "Unicode hex": "22C5" },
  14019. { "Typeface name": "Wingdings 2", "Dingbat dec": "150", "Dingbat hex": "96", "Unicode dec": "128900", "Unicode hex": "1F784" },
  14020. { "Typeface name": "Wingdings 2", "Dingbat dec": "151", "Dingbat hex": "97", "Unicode dec": "10625", "Unicode hex": "2981" },
  14021. { "Typeface name": "Wingdings 2", "Dingbat dec": "152", "Dingbat hex": "98", "Unicode dec": "9679", "Unicode hex": "25CF" },
  14022. { "Typeface name": "Wingdings 2", "Dingbat dec": "153", "Dingbat hex": "99", "Unicode dec": "9675", "Unicode hex": "25CB" },
  14023. { "Typeface name": "Wingdings 2", "Dingbat dec": "154", "Dingbat hex": "9A", "Unicode dec": "128901", "Unicode hex": "1F785" },
  14024. { "Typeface name": "Wingdings 2", "Dingbat dec": "155", "Dingbat hex": "9B", "Unicode dec": "128903", "Unicode hex": "1F787" },
  14025. { "Typeface name": "Wingdings 2", "Dingbat dec": "156", "Dingbat hex": "9C", "Unicode dec": "128905", "Unicode hex": "1F789" },
  14026. { "Typeface name": "Wingdings 2", "Dingbat dec": "157", "Dingbat hex": "9D", "Unicode dec": "8857", "Unicode hex": "2299" },
  14027. { "Typeface name": "Wingdings 2", "Dingbat dec": "158", "Dingbat hex": "9E", "Unicode dec": "10687", "Unicode hex": "29BF" },
  14028. { "Typeface name": "Wingdings 2", "Dingbat dec": "159", "Dingbat hex": "9F", "Unicode dec": "128908", "Unicode hex": "1F78C" },
  14029. { "Typeface name": "Wingdings 2", "Dingbat dec": "160", "Dingbat hex": "A0", "Unicode dec": "128909", "Unicode hex": "1F78D" },
  14030. { "Typeface name": "Wingdings 2", "Dingbat dec": "161", "Dingbat hex": "A1", "Unicode dec": "9726", "Unicode hex": "25FE" },
  14031. { "Typeface name": "Wingdings 2", "Dingbat dec": "162", "Dingbat hex": "A2", "Unicode dec": "9632", "Unicode hex": "25A0" },
  14032. { "Typeface name": "Wingdings 2", "Dingbat dec": "163", "Dingbat hex": "A3", "Unicode dec": "9633", "Unicode hex": "25A1" },
  14033. { "Typeface name": "Wingdings 2", "Dingbat dec": "164", "Dingbat hex": "A4", "Unicode dec": "128913", "Unicode hex": "1F791" },
  14034. { "Typeface name": "Wingdings 2", "Dingbat dec": "165", "Dingbat hex": "A5", "Unicode dec": "128914", "Unicode hex": "1F792" },
  14035. { "Typeface name": "Wingdings 2", "Dingbat dec": "166", "Dingbat hex": "A6", "Unicode dec": "128915", "Unicode hex": "1F793" },
  14036. { "Typeface name": "Wingdings 2", "Dingbat dec": "167", "Dingbat hex": "A7", "Unicode dec": "128916", "Unicode hex": "1F794" },
  14037. { "Typeface name": "Wingdings 2", "Dingbat dec": "168", "Dingbat hex": "A8", "Unicode dec": "9635", "Unicode hex": "25A3" },
  14038. { "Typeface name": "Wingdings 2", "Dingbat dec": "169", "Dingbat hex": "A9", "Unicode dec": "128917", "Unicode hex": "1F795" },
  14039. { "Typeface name": "Wingdings 2", "Dingbat dec": "170", "Dingbat hex": "AA", "Unicode dec": "128918", "Unicode hex": "1F796" },
  14040. { "Typeface name": "Wingdings 2", "Dingbat dec": "171", "Dingbat hex": "AB", "Unicode dec": "128919", "Unicode hex": "1F797" },
  14041. { "Typeface name": "Wingdings 2", "Dingbat dec": "172", "Dingbat hex": "AC", "Unicode dec": "128920", "Unicode hex": "1F798" },
  14042. { "Typeface name": "Wingdings 2", "Dingbat dec": "173", "Dingbat hex": "AD", "Unicode dec": "11049", "Unicode hex": "2B29" },
  14043. { "Typeface name": "Wingdings 2", "Dingbat dec": "174", "Dingbat hex": "AE", "Unicode dec": "11045", "Unicode hex": "2B25" },
  14044. { "Typeface name": "Wingdings 2", "Dingbat dec": "175", "Dingbat hex": "AF", "Unicode dec": "9671", "Unicode hex": "25C7" },
  14045. { "Typeface name": "Wingdings 2", "Dingbat dec": "176", "Dingbat hex": "B0", "Unicode dec": "128922", "Unicode hex": "1F79A" },
  14046. { "Typeface name": "Wingdings 2", "Dingbat dec": "177", "Dingbat hex": "B1", "Unicode dec": "9672", "Unicode hex": "25C8" },
  14047. { "Typeface name": "Wingdings 2", "Dingbat dec": "178", "Dingbat hex": "B2", "Unicode dec": "128923", "Unicode hex": "1F79B" },
  14048. { "Typeface name": "Wingdings 2", "Dingbat dec": "179", "Dingbat hex": "B3", "Unicode dec": "128924", "Unicode hex": "1F79C" },
  14049. { "Typeface name": "Wingdings 2", "Dingbat dec": "180", "Dingbat hex": "B4", "Unicode dec": "128925", "Unicode hex": "1F79D" },
  14050. { "Typeface name": "Wingdings 2", "Dingbat dec": "181", "Dingbat hex": "B5", "Unicode dec": "128926", "Unicode hex": "1F79E" },
  14051. { "Typeface name": "Wingdings 2", "Dingbat dec": "182", "Dingbat hex": "B6", "Unicode dec": "11050", "Unicode hex": "2B2A" },
  14052. { "Typeface name": "Wingdings 2", "Dingbat dec": "183", "Dingbat hex": "B7", "Unicode dec": "11047", "Unicode hex": "2B27" },
  14053. { "Typeface name": "Wingdings 2", "Dingbat dec": "184", "Dingbat hex": "B8", "Unicode dec": "9674", "Unicode hex": "25CA" },
  14054. { "Typeface name": "Wingdings 2", "Dingbat dec": "185", "Dingbat hex": "B9", "Unicode dec": "128928", "Unicode hex": "1F7A0" },
  14055. { "Typeface name": "Wingdings 2", "Dingbat dec": "186", "Dingbat hex": "BA", "Unicode dec": "9686", "Unicode hex": "25D6" },
  14056. { "Typeface name": "Wingdings 2", "Dingbat dec": "187", "Dingbat hex": "BB", "Unicode dec": "9687", "Unicode hex": "25D7" },
  14057. { "Typeface name": "Wingdings 2", "Dingbat dec": "188", "Dingbat hex": "BC", "Unicode dec": "11210", "Unicode hex": "2BCA" },
  14058. { "Typeface name": "Wingdings 2", "Dingbat dec": "189", "Dingbat hex": "BD", "Unicode dec": "11211", "Unicode hex": "2BCB" },
  14059. { "Typeface name": "Wingdings 2", "Dingbat dec": "190", "Dingbat hex": "BE", "Unicode dec": "11200", "Unicode hex": "2BC0" },
  14060. { "Typeface name": "Wingdings 2", "Dingbat dec": "191", "Dingbat hex": "BF", "Unicode dec": "11201", "Unicode hex": "2BC1" },
  14061. { "Typeface name": "Wingdings 2", "Dingbat dec": "192", "Dingbat hex": "C0", "Unicode dec": "11039", "Unicode hex": "2B1F" },
  14062. { "Typeface name": "Wingdings 2", "Dingbat dec": "193", "Dingbat hex": "C1", "Unicode dec": "11202", "Unicode hex": "2BC2" },
  14063. { "Typeface name": "Wingdings 2", "Dingbat dec": "194", "Dingbat hex": "C2", "Unicode dec": "11043", "Unicode hex": "2B23" },
  14064. { "Typeface name": "Wingdings 2", "Dingbat dec": "195", "Dingbat hex": "C3", "Unicode dec": "11042", "Unicode hex": "2B22" },
  14065. { "Typeface name": "Wingdings 2", "Dingbat dec": "196", "Dingbat hex": "C4", "Unicode dec": "11203", "Unicode hex": "2BC3" },
  14066. { "Typeface name": "Wingdings 2", "Dingbat dec": "197", "Dingbat hex": "C5", "Unicode dec": "11204", "Unicode hex": "2BC4" },
  14067. { "Typeface name": "Wingdings 2", "Dingbat dec": "198", "Dingbat hex": "C6", "Unicode dec": "128929", "Unicode hex": "1F7A1" },
  14068. { "Typeface name": "Wingdings 2", "Dingbat dec": "199", "Dingbat hex": "C7", "Unicode dec": "128930", "Unicode hex": "1F7A2" },
  14069. { "Typeface name": "Wingdings 2", "Dingbat dec": "200", "Dingbat hex": "C8", "Unicode dec": "128931", "Unicode hex": "1F7A3" },
  14070. { "Typeface name": "Wingdings 2", "Dingbat dec": "201", "Dingbat hex": "C9", "Unicode dec": "128932", "Unicode hex": "1F7A4" },
  14071. { "Typeface name": "Wingdings 2", "Dingbat dec": "202", "Dingbat hex": "CA", "Unicode dec": "128933", "Unicode hex": "1F7A5" },
  14072. { "Typeface name": "Wingdings 2", "Dingbat dec": "203", "Dingbat hex": "CB", "Unicode dec": "128934", "Unicode hex": "1F7A6" },
  14073. { "Typeface name": "Wingdings 2", "Dingbat dec": "204", "Dingbat hex": "CC", "Unicode dec": "128935", "Unicode hex": "1F7A7" },
  14074. { "Typeface name": "Wingdings 2", "Dingbat dec": "205", "Dingbat hex": "CD", "Unicode dec": "128936", "Unicode hex": "1F7A8" },
  14075. { "Typeface name": "Wingdings 2", "Dingbat dec": "206", "Dingbat hex": "CE", "Unicode dec": "128937", "Unicode hex": "1F7A9" },
  14076. { "Typeface name": "Wingdings 2", "Dingbat dec": "207", "Dingbat hex": "CF", "Unicode dec": "128938", "Unicode hex": "1F7AA" },
  14077. { "Typeface name": "Wingdings 2", "Dingbat dec": "208", "Dingbat hex": "D0", "Unicode dec": "128939", "Unicode hex": "1F7AB" },
  14078. { "Typeface name": "Wingdings 2", "Dingbat dec": "209", "Dingbat hex": "D1", "Unicode dec": "128940", "Unicode hex": "1F7AC" },
  14079. { "Typeface name": "Wingdings 2", "Dingbat dec": "210", "Dingbat hex": "D2", "Unicode dec": "128941", "Unicode hex": "1F7AD" },
  14080. { "Typeface name": "Wingdings 2", "Dingbat dec": "211", "Dingbat hex": "D3", "Unicode dec": "128942", "Unicode hex": "1F7AE" },
  14081. { "Typeface name": "Wingdings 2", "Dingbat dec": "212", "Dingbat hex": "D4", "Unicode dec": "128943", "Unicode hex": "1F7AF" },
  14082. { "Typeface name": "Wingdings 2", "Dingbat dec": "213", "Dingbat hex": "D5", "Unicode dec": "128944", "Unicode hex": "1F7B0" },
  14083. { "Typeface name": "Wingdings 2", "Dingbat dec": "214", "Dingbat hex": "D6", "Unicode dec": "128945", "Unicode hex": "1F7B1" },
  14084. { "Typeface name": "Wingdings 2", "Dingbat dec": "215", "Dingbat hex": "D7", "Unicode dec": "128946", "Unicode hex": "1F7B2" },
  14085. { "Typeface name": "Wingdings 2", "Dingbat dec": "216", "Dingbat hex": "D8", "Unicode dec": "128947", "Unicode hex": "1F7B3" },
  14086. { "Typeface name": "Wingdings 2", "Dingbat dec": "217", "Dingbat hex": "D9", "Unicode dec": "128948", "Unicode hex": "1F7B4" },
  14087. { "Typeface name": "Wingdings 2", "Dingbat dec": "218", "Dingbat hex": "DA", "Unicode dec": "128949", "Unicode hex": "1F7B5" },
  14088. { "Typeface name": "Wingdings 2", "Dingbat dec": "219", "Dingbat hex": "DB", "Unicode dec": "128950", "Unicode hex": "1F7B6" },
  14089. { "Typeface name": "Wingdings 2", "Dingbat dec": "220", "Dingbat hex": "DC", "Unicode dec": "128951", "Unicode hex": "1F7B7" },
  14090. { "Typeface name": "Wingdings 2", "Dingbat dec": "221", "Dingbat hex": "DD", "Unicode dec": "128952", "Unicode hex": "1F7B8" },
  14091. { "Typeface name": "Wingdings 2", "Dingbat dec": "222", "Dingbat hex": "DE", "Unicode dec": "128953", "Unicode hex": "1F7B9" },
  14092. { "Typeface name": "Wingdings 2", "Dingbat dec": "223", "Dingbat hex": "DF", "Unicode dec": "128954", "Unicode hex": "1F7BA" },
  14093. { "Typeface name": "Wingdings 2", "Dingbat dec": "224", "Dingbat hex": "E0", "Unicode dec": "128955", "Unicode hex": "1F7BB" },
  14094. { "Typeface name": "Wingdings 2", "Dingbat dec": "225", "Dingbat hex": "E1", "Unicode dec": "128956", "Unicode hex": "1F7BC" },
  14095. { "Typeface name": "Wingdings 2", "Dingbat dec": "226", "Dingbat hex": "E2", "Unicode dec": "128957", "Unicode hex": "1F7BD" },
  14096. { "Typeface name": "Wingdings 2", "Dingbat dec": "227", "Dingbat hex": "E3", "Unicode dec": "128958", "Unicode hex": "1F7BE" },
  14097. { "Typeface name": "Wingdings 2", "Dingbat dec": "228", "Dingbat hex": "E4", "Unicode dec": "128959", "Unicode hex": "1F7BF" },
  14098. { "Typeface name": "Wingdings 2", "Dingbat dec": "229", "Dingbat hex": "E5", "Unicode dec": "128960", "Unicode hex": "1F7C0" },
  14099. { "Typeface name": "Wingdings 2", "Dingbat dec": "230", "Dingbat hex": "E6", "Unicode dec": "128962", "Unicode hex": "1F7C2" },
  14100. { "Typeface name": "Wingdings 2", "Dingbat dec": "231", "Dingbat hex": "E7", "Unicode dec": "128964", "Unicode hex": "1F7C4" },
  14101. { "Typeface name": "Wingdings 2", "Dingbat dec": "232", "Dingbat hex": "E8", "Unicode dec": "128966", "Unicode hex": "1F7C6" },
  14102. { "Typeface name": "Wingdings 2", "Dingbat dec": "233", "Dingbat hex": "E9", "Unicode dec": "128969", "Unicode hex": "1F7C9" },
  14103. { "Typeface name": "Wingdings 2", "Dingbat dec": "234", "Dingbat hex": "EA", "Unicode dec": "128970", "Unicode hex": "1F7CA" },
  14104. { "Typeface name": "Wingdings 2", "Dingbat dec": "235", "Dingbat hex": "EB", "Unicode dec": "10038", "Unicode hex": "2736" },
  14105. { "Typeface name": "Wingdings 2", "Dingbat dec": "236", "Dingbat hex": "EC", "Unicode dec": "128972", "Unicode hex": "1F7CC" },
  14106. { "Typeface name": "Wingdings 2", "Dingbat dec": "237", "Dingbat hex": "ED", "Unicode dec": "128974", "Unicode hex": "1F7CE" },
  14107. { "Typeface name": "Wingdings 2", "Dingbat dec": "238", "Dingbat hex": "EE", "Unicode dec": "128976", "Unicode hex": "1F7D0" },
  14108. { "Typeface name": "Wingdings 2", "Dingbat dec": "239", "Dingbat hex": "EF", "Unicode dec": "128978", "Unicode hex": "1F7D2" },
  14109. { "Typeface name": "Wingdings 2", "Dingbat dec": "240", "Dingbat hex": "F0", "Unicode dec": "10041", "Unicode hex": "2739" },
  14110. { "Typeface name": "Wingdings 2", "Dingbat dec": "241", "Dingbat hex": "F1", "Unicode dec": "128963", "Unicode hex": "1F7C3" },
  14111. { "Typeface name": "Wingdings 2", "Dingbat dec": "242", "Dingbat hex": "F2", "Unicode dec": "128967", "Unicode hex": "1F7C7" },
  14112. { "Typeface name": "Wingdings 2", "Dingbat dec": "243", "Dingbat hex": "F3", "Unicode dec": "10031", "Unicode hex": "272F" },
  14113. { "Typeface name": "Wingdings 2", "Dingbat dec": "244", "Dingbat hex": "F4", "Unicode dec": "128973", "Unicode hex": "1F7CD" },
  14114. { "Typeface name": "Wingdings 2", "Dingbat dec": "245", "Dingbat hex": "F5", "Unicode dec": "128980", "Unicode hex": "1F7D4" },
  14115. { "Typeface name": "Wingdings 2", "Dingbat dec": "246", "Dingbat hex": "F6", "Unicode dec": "11212", "Unicode hex": "2BCC" },
  14116. { "Typeface name": "Wingdings 2", "Dingbat dec": "247", "Dingbat hex": "F7", "Unicode dec": "11213", "Unicode hex": "2BCD" },
  14117. { "Typeface name": "Wingdings 2", "Dingbat dec": "248", "Dingbat hex": "F8", "Unicode dec": "8251", "Unicode hex": "203B" },
  14118. { "Typeface name": "Wingdings 2", "Dingbat dec": "249", "Dingbat hex": "F9", "Unicode dec": "8258", "Unicode hex": "2042" },
  14119. { "Typeface name": "Wingdings 3", "Dingbat dec": "32", "Dingbat hex": "20", "Unicode dec": "32", "Unicode hex": "20" },
  14120. { "Typeface name": "Wingdings 3", "Dingbat dec": "33", "Dingbat hex": "21", "Unicode dec": "11104", "Unicode hex": "2B60" },
  14121. { "Typeface name": "Wingdings 3", "Dingbat dec": "34", "Dingbat hex": "22", "Unicode dec": "11106", "Unicode hex": "2B62" },
  14122. { "Typeface name": "Wingdings 3", "Dingbat dec": "35", "Dingbat hex": "23", "Unicode dec": "11105", "Unicode hex": "2B61" },
  14123. { "Typeface name": "Wingdings 3", "Dingbat dec": "36", "Dingbat hex": "24", "Unicode dec": "11107", "Unicode hex": "2B63" },
  14124. { "Typeface name": "Wingdings 3", "Dingbat dec": "37", "Dingbat hex": "25", "Unicode dec": "11110", "Unicode hex": "2B66" },
  14125. { "Typeface name": "Wingdings 3", "Dingbat dec": "38", "Dingbat hex": "26", "Unicode dec": "11111", "Unicode hex": "2B67" },
  14126. { "Typeface name": "Wingdings 3", "Dingbat dec": "39", "Dingbat hex": "27", "Unicode dec": "11113", "Unicode hex": "2B69" },
  14127. { "Typeface name": "Wingdings 3", "Dingbat dec": "40", "Dingbat hex": "28", "Unicode dec": "11112", "Unicode hex": "2B68" },
  14128. { "Typeface name": "Wingdings 3", "Dingbat dec": "41", "Dingbat hex": "29", "Unicode dec": "11120", "Unicode hex": "2B70" },
  14129. { "Typeface name": "Wingdings 3", "Dingbat dec": "42", "Dingbat hex": "2A", "Unicode dec": "11122", "Unicode hex": "2B72" },
  14130. { "Typeface name": "Wingdings 3", "Dingbat dec": "43", "Dingbat hex": "2B", "Unicode dec": "11121", "Unicode hex": "2B71" },
  14131. { "Typeface name": "Wingdings 3", "Dingbat dec": "44", "Dingbat hex": "2C", "Unicode dec": "11123", "Unicode hex": "2B73" },
  14132. { "Typeface name": "Wingdings 3", "Dingbat dec": "45", "Dingbat hex": "2D", "Unicode dec": "11126", "Unicode hex": "2B76" },
  14133. { "Typeface name": "Wingdings 3", "Dingbat dec": "46", "Dingbat hex": "2E", "Unicode dec": "11128", "Unicode hex": "2B78" },
  14134. { "Typeface name": "Wingdings 3", "Dingbat dec": "47", "Dingbat hex": "2F", "Unicode dec": "11131", "Unicode hex": "2B7B" },
  14135. { "Typeface name": "Wingdings 3", "Dingbat dec": "48", "Dingbat hex": "30", "Unicode dec": "11133", "Unicode hex": "2B7D" },
  14136. { "Typeface name": "Wingdings 3", "Dingbat dec": "49", "Dingbat hex": "31", "Unicode dec": "11108", "Unicode hex": "2B64" },
  14137. { "Typeface name": "Wingdings 3", "Dingbat dec": "50", "Dingbat hex": "32", "Unicode dec": "11109", "Unicode hex": "2B65" },
  14138. { "Typeface name": "Wingdings 3", "Dingbat dec": "51", "Dingbat hex": "33", "Unicode dec": "11114", "Unicode hex": "2B6A" },
  14139. { "Typeface name": "Wingdings 3", "Dingbat dec": "52", "Dingbat hex": "34", "Unicode dec": "11116", "Unicode hex": "2B6C" },
  14140. { "Typeface name": "Wingdings 3", "Dingbat dec": "53", "Dingbat hex": "35", "Unicode dec": "11115", "Unicode hex": "2B6B" },
  14141. { "Typeface name": "Wingdings 3", "Dingbat dec": "54", "Dingbat hex": "36", "Unicode dec": "11117", "Unicode hex": "2B6D" },
  14142. { "Typeface name": "Wingdings 3", "Dingbat dec": "55", "Dingbat hex": "37", "Unicode dec": "11085", "Unicode hex": "2B4D" },
  14143. { "Typeface name": "Wingdings 3", "Dingbat dec": "56", "Dingbat hex": "38", "Unicode dec": "11168", "Unicode hex": "2BA0" },
  14144. { "Typeface name": "Wingdings 3", "Dingbat dec": "57", "Dingbat hex": "39", "Unicode dec": "11169", "Unicode hex": "2BA1" },
  14145. { "Typeface name": "Wingdings 3", "Dingbat dec": "58", "Dingbat hex": "3A", "Unicode dec": "11170", "Unicode hex": "2BA2" },
  14146. { "Typeface name": "Wingdings 3", "Dingbat dec": "59", "Dingbat hex": "3B", "Unicode dec": "11171", "Unicode hex": "2BA3" },
  14147. { "Typeface name": "Wingdings 3", "Dingbat dec": "60", "Dingbat hex": "3C", "Unicode dec": "11172", "Unicode hex": "2BA4" },
  14148. { "Typeface name": "Wingdings 3", "Dingbat dec": "61", "Dingbat hex": "3D", "Unicode dec": "11173", "Unicode hex": "2BA5" },
  14149. { "Typeface name": "Wingdings 3", "Dingbat dec": "62", "Dingbat hex": "3E", "Unicode dec": "11174", "Unicode hex": "2BA6" },
  14150. { "Typeface name": "Wingdings 3", "Dingbat dec": "63", "Dingbat hex": "3F", "Unicode dec": "11175", "Unicode hex": "2BA7" },
  14151. { "Typeface name": "Wingdings 3", "Dingbat dec": "64", "Dingbat hex": "40", "Unicode dec": "11152", "Unicode hex": "2B90" },
  14152. { "Typeface name": "Wingdings 3", "Dingbat dec": "65", "Dingbat hex": "41", "Unicode dec": "11153", "Unicode hex": "2B91" },
  14153. { "Typeface name": "Wingdings 3", "Dingbat dec": "66", "Dingbat hex": "42", "Unicode dec": "11154", "Unicode hex": "2B92" },
  14154. { "Typeface name": "Wingdings 3", "Dingbat dec": "67", "Dingbat hex": "43", "Unicode dec": "11155", "Unicode hex": "2B93" },
  14155. { "Typeface name": "Wingdings 3", "Dingbat dec": "68", "Dingbat hex": "44", "Unicode dec": "11136", "Unicode hex": "2B80" },
  14156. { "Typeface name": "Wingdings 3", "Dingbat dec": "69", "Dingbat hex": "45", "Unicode dec": "11139", "Unicode hex": "2B83" },
  14157. { "Typeface name": "Wingdings 3", "Dingbat dec": "70", "Dingbat hex": "46", "Unicode dec": "11134", "Unicode hex": "2B7E" },
  14158. { "Typeface name": "Wingdings 3", "Dingbat dec": "71", "Dingbat hex": "47", "Unicode dec": "11135", "Unicode hex": "2B7F" },
  14159. { "Typeface name": "Wingdings 3", "Dingbat dec": "72", "Dingbat hex": "48", "Unicode dec": "11140", "Unicode hex": "2B84" },
  14160. { "Typeface name": "Wingdings 3", "Dingbat dec": "73", "Dingbat hex": "49", "Unicode dec": "11142", "Unicode hex": "2B86" },
  14161. { "Typeface name": "Wingdings 3", "Dingbat dec": "74", "Dingbat hex": "4A", "Unicode dec": "11141", "Unicode hex": "2B85" },
  14162. { "Typeface name": "Wingdings 3", "Dingbat dec": "75", "Dingbat hex": "4B", "Unicode dec": "11143", "Unicode hex": "2B87" },
  14163. { "Typeface name": "Wingdings 3", "Dingbat dec": "76", "Dingbat hex": "4C", "Unicode dec": "11151", "Unicode hex": "2B8F" },
  14164. { "Typeface name": "Wingdings 3", "Dingbat dec": "77", "Dingbat hex": "4D", "Unicode dec": "11149", "Unicode hex": "2B8D" },
  14165. { "Typeface name": "Wingdings 3", "Dingbat dec": "78", "Dingbat hex": "4E", "Unicode dec": "11150", "Unicode hex": "2B8E" },
  14166. { "Typeface name": "Wingdings 3", "Dingbat dec": "79", "Dingbat hex": "4F", "Unicode dec": "11148", "Unicode hex": "2B8C" },
  14167. { "Typeface name": "Wingdings 3", "Dingbat dec": "80", "Dingbat hex": "50", "Unicode dec": "11118", "Unicode hex": "2B6E" },
  14168. { "Typeface name": "Wingdings 3", "Dingbat dec": "81", "Dingbat hex": "51", "Unicode dec": "11119", "Unicode hex": "2B6F" },
  14169. { "Typeface name": "Wingdings 3", "Dingbat dec": "82", "Dingbat hex": "52", "Unicode dec": "9099", "Unicode hex": "238B" },
  14170. { "Typeface name": "Wingdings 3", "Dingbat dec": "83", "Dingbat hex": "53", "Unicode dec": "8996", "Unicode hex": "2324" },
  14171. { "Typeface name": "Wingdings 3", "Dingbat dec": "84", "Dingbat hex": "54", "Unicode dec": "8963", "Unicode hex": "2303" },
  14172. { "Typeface name": "Wingdings 3", "Dingbat dec": "85", "Dingbat hex": "55", "Unicode dec": "8997", "Unicode hex": "2325" },
  14173. { "Typeface name": "Wingdings 3", "Dingbat dec": "86", "Dingbat hex": "56", "Unicode dec": "9251", "Unicode hex": "2423" },
  14174. { "Typeface name": "Wingdings 3", "Dingbat dec": "87", "Dingbat hex": "57", "Unicode dec": "9085", "Unicode hex": "237D" },
  14175. { "Typeface name": "Wingdings 3", "Dingbat dec": "88", "Dingbat hex": "58", "Unicode dec": "8682", "Unicode hex": "21EA" },
  14176. { "Typeface name": "Wingdings 3", "Dingbat dec": "89", "Dingbat hex": "59", "Unicode dec": "11192", "Unicode hex": "2BB8" },
  14177. { "Typeface name": "Wingdings 3", "Dingbat dec": "90", "Dingbat hex": "5A", "Unicode dec": "129184", "Unicode hex": "1F8A0" },
  14178. { "Typeface name": "Wingdings 3", "Dingbat dec": "91", "Dingbat hex": "5B", "Unicode dec": "129185", "Unicode hex": "1F8A1" },
  14179. { "Typeface name": "Wingdings 3", "Dingbat dec": "92", "Dingbat hex": "5C", "Unicode dec": "129186", "Unicode hex": "1F8A2" },
  14180. { "Typeface name": "Wingdings 3", "Dingbat dec": "93", "Dingbat hex": "5D", "Unicode dec": "129187", "Unicode hex": "1F8A3" },
  14181. { "Typeface name": "Wingdings 3", "Dingbat dec": "94", "Dingbat hex": "5E", "Unicode dec": "129188", "Unicode hex": "1F8A4" },
  14182. { "Typeface name": "Wingdings 3", "Dingbat dec": "95", "Dingbat hex": "5F", "Unicode dec": "129189", "Unicode hex": "1F8A5" },
  14183. { "Typeface name": "Wingdings 3", "Dingbat dec": "96", "Dingbat hex": "60", "Unicode dec": "129190", "Unicode hex": "1F8A6" },
  14184. { "Typeface name": "Wingdings 3", "Dingbat dec": "97", "Dingbat hex": "61", "Unicode dec": "129191", "Unicode hex": "1F8A7" },
  14185. { "Typeface name": "Wingdings 3", "Dingbat dec": "98", "Dingbat hex": "62", "Unicode dec": "129192", "Unicode hex": "1F8A8" },
  14186. { "Typeface name": "Wingdings 3", "Dingbat dec": "99", "Dingbat hex": "63", "Unicode dec": "129193", "Unicode hex": "1F8A9" },
  14187. { "Typeface name": "Wingdings 3", "Dingbat dec": "100", "Dingbat hex": "64", "Unicode dec": "129194", "Unicode hex": "1F8AA" },
  14188. { "Typeface name": "Wingdings 3", "Dingbat dec": "101", "Dingbat hex": "65", "Unicode dec": "129195", "Unicode hex": "1F8AB" },
  14189. { "Typeface name": "Wingdings 3", "Dingbat dec": "102", "Dingbat hex": "66", "Unicode dec": "129104", "Unicode hex": "1F850" },
  14190. { "Typeface name": "Wingdings 3", "Dingbat dec": "103", "Dingbat hex": "67", "Unicode dec": "129106", "Unicode hex": "1F852" },
  14191. { "Typeface name": "Wingdings 3", "Dingbat dec": "104", "Dingbat hex": "68", "Unicode dec": "129105", "Unicode hex": "1F851" },
  14192. { "Typeface name": "Wingdings 3", "Dingbat dec": "105", "Dingbat hex": "69", "Unicode dec": "129107", "Unicode hex": "1F853" },
  14193. { "Typeface name": "Wingdings 3", "Dingbat dec": "106", "Dingbat hex": "6A", "Unicode dec": "129108", "Unicode hex": "1F854" },
  14194. { "Typeface name": "Wingdings 3", "Dingbat dec": "107", "Dingbat hex": "6B", "Unicode dec": "129109", "Unicode hex": "1F855" },
  14195. { "Typeface name": "Wingdings 3", "Dingbat dec": "108", "Dingbat hex": "6C", "Unicode dec": "129111", "Unicode hex": "1F857" },
  14196. { "Typeface name": "Wingdings 3", "Dingbat dec": "109", "Dingbat hex": "6D", "Unicode dec": "129110", "Unicode hex": "1F856" },
  14197. { "Typeface name": "Wingdings 3", "Dingbat dec": "110", "Dingbat hex": "6E", "Unicode dec": "129112", "Unicode hex": "1F858" },
  14198. { "Typeface name": "Wingdings 3", "Dingbat dec": "111", "Dingbat hex": "6F", "Unicode dec": "129113", "Unicode hex": "1F859" },
  14199. { "Typeface name": "Wingdings 3", "Dingbat dec": "112", "Dingbat hex": "70", "Unicode dec": "9650", "Unicode hex": "25B2" },
  14200. { "Typeface name": "Wingdings 3", "Dingbat dec": "113", "Dingbat hex": "71", "Unicode dec": "9660", "Unicode hex": "25BC" },
  14201. { "Typeface name": "Wingdings 3", "Dingbat dec": "114", "Dingbat hex": "72", "Unicode dec": "9651", "Unicode hex": "25B3" },
  14202. { "Typeface name": "Wingdings 3", "Dingbat dec": "115", "Dingbat hex": "73", "Unicode dec": "9661", "Unicode hex": "25BD" },
  14203. { "Typeface name": "Wingdings 3", "Dingbat dec": "116", "Dingbat hex": "74", "Unicode dec": "9664", "Unicode hex": "25C0" },
  14204. { "Typeface name": "Wingdings 3", "Dingbat dec": "117", "Dingbat hex": "75", "Unicode dec": "9654", "Unicode hex": "25B6" },
  14205. { "Typeface name": "Wingdings 3", "Dingbat dec": "118", "Dingbat hex": "76", "Unicode dec": "9665", "Unicode hex": "25C1" },
  14206. { "Typeface name": "Wingdings 3", "Dingbat dec": "119", "Dingbat hex": "77", "Unicode dec": "9655", "Unicode hex": "25B7" },
  14207. { "Typeface name": "Wingdings 3", "Dingbat dec": "120", "Dingbat hex": "78", "Unicode dec": "9699", "Unicode hex": "25E3" },
  14208. { "Typeface name": "Wingdings 3", "Dingbat dec": "121", "Dingbat hex": "79", "Unicode dec": "9698", "Unicode hex": "25E2" },
  14209. { "Typeface name": "Wingdings 3", "Dingbat dec": "122", "Dingbat hex": "7A", "Unicode dec": "9700", "Unicode hex": "25E4" },
  14210. { "Typeface name": "Wingdings 3", "Dingbat dec": "123", "Dingbat hex": "7B", "Unicode dec": "9701", "Unicode hex": "25E5" },
  14211. { "Typeface name": "Wingdings 3", "Dingbat dec": "124", "Dingbat hex": "7C", "Unicode dec": "128896", "Unicode hex": "1F780" },
  14212. { "Typeface name": "Wingdings 3", "Dingbat dec": "125", "Dingbat hex": "7D", "Unicode dec": "128898", "Unicode hex": "1F782" },
  14213. { "Typeface name": "Wingdings 3", "Dingbat dec": "126", "Dingbat hex": "7E", "Unicode dec": "128897", "Unicode hex": "1F781" },
  14214. { "Typeface name": "Wingdings 3", "Dingbat dec": "128", "Dingbat hex": "80", "Unicode dec": "128899", "Unicode hex": "1F783" },
  14215. { "Typeface name": "Wingdings 3", "Dingbat dec": "129", "Dingbat hex": "81", "Unicode dec": "11205", "Unicode hex": "2BC5" },
  14216. { "Typeface name": "Wingdings 3", "Dingbat dec": "130", "Dingbat hex": "82", "Unicode dec": "11206", "Unicode hex": "2BC6" },
  14217. { "Typeface name": "Wingdings 3", "Dingbat dec": "131", "Dingbat hex": "83", "Unicode dec": "11207", "Unicode hex": "2BC7" },
  14218. { "Typeface name": "Wingdings 3", "Dingbat dec": "132", "Dingbat hex": "84", "Unicode dec": "11208", "Unicode hex": "2BC8" },
  14219. { "Typeface name": "Wingdings 3", "Dingbat dec": "133", "Dingbat hex": "85", "Unicode dec": "11164", "Unicode hex": "2B9C" },
  14220. { "Typeface name": "Wingdings 3", "Dingbat dec": "134", "Dingbat hex": "86", "Unicode dec": "11166", "Unicode hex": "2B9E" },
  14221. { "Typeface name": "Wingdings 3", "Dingbat dec": "135", "Dingbat hex": "87", "Unicode dec": "11165", "Unicode hex": "2B9D" },
  14222. { "Typeface name": "Wingdings 3", "Dingbat dec": "136", "Dingbat hex": "88", "Unicode dec": "11167", "Unicode hex": "2B9F" },
  14223. { "Typeface name": "Wingdings 3", "Dingbat dec": "137", "Dingbat hex": "89", "Unicode dec": "129040", "Unicode hex": "1F810" },
  14224. { "Typeface name": "Wingdings 3", "Dingbat dec": "138", "Dingbat hex": "8A", "Unicode dec": "129042", "Unicode hex": "1F812" },
  14225. { "Typeface name": "Wingdings 3", "Dingbat dec": "139", "Dingbat hex": "8B", "Unicode dec": "129041", "Unicode hex": "1F811" },
  14226. { "Typeface name": "Wingdings 3", "Dingbat dec": "140", "Dingbat hex": "8C", "Unicode dec": "129043", "Unicode hex": "1F813" },
  14227. { "Typeface name": "Wingdings 3", "Dingbat dec": "141", "Dingbat hex": "8D", "Unicode dec": "129044", "Unicode hex": "1F814" },
  14228. { "Typeface name": "Wingdings 3", "Dingbat dec": "142", "Dingbat hex": "8E", "Unicode dec": "129046", "Unicode hex": "1F816" },
  14229. { "Typeface name": "Wingdings 3", "Dingbat dec": "143", "Dingbat hex": "8F", "Unicode dec": "129045", "Unicode hex": "1F815" },
  14230. { "Typeface name": "Wingdings 3", "Dingbat dec": "144", "Dingbat hex": "90", "Unicode dec": "129047", "Unicode hex": "1F817" },
  14231. { "Typeface name": "Wingdings 3", "Dingbat dec": "145", "Dingbat hex": "91", "Unicode dec": "129048", "Unicode hex": "1F818" },
  14232. { "Typeface name": "Wingdings 3", "Dingbat dec": "146", "Dingbat hex": "92", "Unicode dec": "129050", "Unicode hex": "1F81A" },
  14233. { "Typeface name": "Wingdings 3", "Dingbat dec": "147", "Dingbat hex": "93", "Unicode dec": "129049", "Unicode hex": "1F819" },
  14234. { "Typeface name": "Wingdings 3", "Dingbat dec": "148", "Dingbat hex": "94", "Unicode dec": "129051", "Unicode hex": "1F81B" },
  14235. { "Typeface name": "Wingdings 3", "Dingbat dec": "149", "Dingbat hex": "95", "Unicode dec": "129052", "Unicode hex": "1F81C" },
  14236. { "Typeface name": "Wingdings 3", "Dingbat dec": "150", "Dingbat hex": "96", "Unicode dec": "129054", "Unicode hex": "1F81E" },
  14237. { "Typeface name": "Wingdings 3", "Dingbat dec": "151", "Dingbat hex": "97", "Unicode dec": "129053", "Unicode hex": "1F81D" },
  14238. { "Typeface name": "Wingdings 3", "Dingbat dec": "152", "Dingbat hex": "98", "Unicode dec": "129055", "Unicode hex": "1F81F" },
  14239. { "Typeface name": "Wingdings 3", "Dingbat dec": "153", "Dingbat hex": "99", "Unicode dec": "129024", "Unicode hex": "1F800" },
  14240. { "Typeface name": "Wingdings 3", "Dingbat dec": "154", "Dingbat hex": "9A", "Unicode dec": "129026", "Unicode hex": "1F802" },
  14241. { "Typeface name": "Wingdings 3", "Dingbat dec": "155", "Dingbat hex": "9B", "Unicode dec": "129025", "Unicode hex": "1F801" },
  14242. { "Typeface name": "Wingdings 3", "Dingbat dec": "156", "Dingbat hex": "9C", "Unicode dec": "129027", "Unicode hex": "1F803" },
  14243. { "Typeface name": "Wingdings 3", "Dingbat dec": "157", "Dingbat hex": "9D", "Unicode dec": "129028", "Unicode hex": "1F804" },
  14244. { "Typeface name": "Wingdings 3", "Dingbat dec": "158", "Dingbat hex": "9E", "Unicode dec": "129030", "Unicode hex": "1F806" },
  14245. { "Typeface name": "Wingdings 3", "Dingbat dec": "159", "Dingbat hex": "9F", "Unicode dec": "129029", "Unicode hex": "1F805" },
  14246. { "Typeface name": "Wingdings 3", "Dingbat dec": "160", "Dingbat hex": "A0", "Unicode dec": "129031", "Unicode hex": "1F807" },
  14247. { "Typeface name": "Wingdings 3", "Dingbat dec": "161", "Dingbat hex": "A1", "Unicode dec": "129032", "Unicode hex": "1F808" },
  14248. { "Typeface name": "Wingdings 3", "Dingbat dec": "162", "Dingbat hex": "A2", "Unicode dec": "129034", "Unicode hex": "1F80A" },
  14249. { "Typeface name": "Wingdings 3", "Dingbat dec": "163", "Dingbat hex": "A3", "Unicode dec": "129033", "Unicode hex": "1F809" },
  14250. { "Typeface name": "Wingdings 3", "Dingbat dec": "164", "Dingbat hex": "A4", "Unicode dec": "129035", "Unicode hex": "1F80B" },
  14251. { "Typeface name": "Wingdings 3", "Dingbat dec": "165", "Dingbat hex": "A5", "Unicode dec": "129056", "Unicode hex": "1F820" },
  14252. { "Typeface name": "Wingdings 3", "Dingbat dec": "166", "Dingbat hex": "A6", "Unicode dec": "129058", "Unicode hex": "1F822" },
  14253. { "Typeface name": "Wingdings 3", "Dingbat dec": "167", "Dingbat hex": "A7", "Unicode dec": "129060", "Unicode hex": "1F824" },
  14254. { "Typeface name": "Wingdings 3", "Dingbat dec": "168", "Dingbat hex": "A8", "Unicode dec": "129062", "Unicode hex": "1F826" },
  14255. { "Typeface name": "Wingdings 3", "Dingbat dec": "169", "Dingbat hex": "A9", "Unicode dec": "129064", "Unicode hex": "1F828" },
  14256. { "Typeface name": "Wingdings 3", "Dingbat dec": "170", "Dingbat hex": "AA", "Unicode dec": "129066", "Unicode hex": "1F82A" },
  14257. { "Typeface name": "Wingdings 3", "Dingbat dec": "171", "Dingbat hex": "AB", "Unicode dec": "129068", "Unicode hex": "1F82C" },
  14258. { "Typeface name": "Wingdings 3", "Dingbat dec": "172", "Dingbat hex": "AC", "Unicode dec": "129180", "Unicode hex": "1F89C" },
  14259. { "Typeface name": "Wingdings 3", "Dingbat dec": "173", "Dingbat hex": "AD", "Unicode dec": "129181", "Unicode hex": "1F89D" },
  14260. { "Typeface name": "Wingdings 3", "Dingbat dec": "174", "Dingbat hex": "AE", "Unicode dec": "129182", "Unicode hex": "1F89E" },
  14261. { "Typeface name": "Wingdings 3", "Dingbat dec": "175", "Dingbat hex": "AF", "Unicode dec": "129183", "Unicode hex": "1F89F" },
  14262. { "Typeface name": "Wingdings 3", "Dingbat dec": "176", "Dingbat hex": "B0", "Unicode dec": "129070", "Unicode hex": "1F82E" },
  14263. { "Typeface name": "Wingdings 3", "Dingbat dec": "177", "Dingbat hex": "B1", "Unicode dec": "129072", "Unicode hex": "1F830" },
  14264. { "Typeface name": "Wingdings 3", "Dingbat dec": "178", "Dingbat hex": "B2", "Unicode dec": "129074", "Unicode hex": "1F832" },
  14265. { "Typeface name": "Wingdings 3", "Dingbat dec": "179", "Dingbat hex": "B3", "Unicode dec": "129076", "Unicode hex": "1F834" },
  14266. { "Typeface name": "Wingdings 3", "Dingbat dec": "180", "Dingbat hex": "B4", "Unicode dec": "129078", "Unicode hex": "1F836" },
  14267. { "Typeface name": "Wingdings 3", "Dingbat dec": "181", "Dingbat hex": "B5", "Unicode dec": "129080", "Unicode hex": "1F838" },
  14268. { "Typeface name": "Wingdings 3", "Dingbat dec": "182", "Dingbat hex": "B6", "Unicode dec": "129082", "Unicode hex": "1F83A" },
  14269. { "Typeface name": "Wingdings 3", "Dingbat dec": "183", "Dingbat hex": "B7", "Unicode dec": "129081", "Unicode hex": "1F839" },
  14270. { "Typeface name": "Wingdings 3", "Dingbat dec": "184", "Dingbat hex": "B8", "Unicode dec": "129083", "Unicode hex": "1F83B" },
  14271. { "Typeface name": "Wingdings 3", "Dingbat dec": "185", "Dingbat hex": "B9", "Unicode dec": "129176", "Unicode hex": "1F898" },
  14272. { "Typeface name": "Wingdings 3", "Dingbat dec": "186", "Dingbat hex": "BA", "Unicode dec": "129178", "Unicode hex": "1F89A" },
  14273. { "Typeface name": "Wingdings 3", "Dingbat dec": "187", "Dingbat hex": "BB", "Unicode dec": "129177", "Unicode hex": "1F899" },
  14274. { "Typeface name": "Wingdings 3", "Dingbat dec": "188", "Dingbat hex": "BC", "Unicode dec": "129179", "Unicode hex": "1F89B" },
  14275. { "Typeface name": "Wingdings 3", "Dingbat dec": "189", "Dingbat hex": "BD", "Unicode dec": "129084", "Unicode hex": "1F83C" },
  14276. { "Typeface name": "Wingdings 3", "Dingbat dec": "190", "Dingbat hex": "BE", "Unicode dec": "129086", "Unicode hex": "1F83E" },
  14277. { "Typeface name": "Wingdings 3", "Dingbat dec": "191", "Dingbat hex": "BF", "Unicode dec": "129085", "Unicode hex": "1F83D" },
  14278. { "Typeface name": "Wingdings 3", "Dingbat dec": "192", "Dingbat hex": "C0", "Unicode dec": "129087", "Unicode hex": "1F83F" },
  14279. { "Typeface name": "Wingdings 3", "Dingbat dec": "193", "Dingbat hex": "C1", "Unicode dec": "129088", "Unicode hex": "1F840" },
  14280. { "Typeface name": "Wingdings 3", "Dingbat dec": "194", "Dingbat hex": "C2", "Unicode dec": "129090", "Unicode hex": "1F842" },
  14281. { "Typeface name": "Wingdings 3", "Dingbat dec": "195", "Dingbat hex": "C3", "Unicode dec": "129089", "Unicode hex": "1F841" },
  14282. { "Typeface name": "Wingdings 3", "Dingbat dec": "196", "Dingbat hex": "C4", "Unicode dec": "129091", "Unicode hex": "1F843" },
  14283. { "Typeface name": "Wingdings 3", "Dingbat dec": "197", "Dingbat hex": "C5", "Unicode dec": "129092", "Unicode hex": "1F844" },
  14284. { "Typeface name": "Wingdings 3", "Dingbat dec": "198", "Dingbat hex": "C6", "Unicode dec": "129094", "Unicode hex": "1F846" },
  14285. { "Typeface name": "Wingdings 3", "Dingbat dec": "199", "Dingbat hex": "C7", "Unicode dec": "129093", "Unicode hex": "1F845" },
  14286. { "Typeface name": "Wingdings 3", "Dingbat dec": "200", "Dingbat hex": "C8", "Unicode dec": "129095", "Unicode hex": "1F847" },
  14287. { "Typeface name": "Wingdings 3", "Dingbat dec": "201", "Dingbat hex": "C9", "Unicode dec": "11176", "Unicode hex": "2BA8" },
  14288. { "Typeface name": "Wingdings 3", "Dingbat dec": "202", "Dingbat hex": "CA", "Unicode dec": "11177", "Unicode hex": "2BA9" },
  14289. { "Typeface name": "Wingdings 3", "Dingbat dec": "203", "Dingbat hex": "CB", "Unicode dec": "11178", "Unicode hex": "2BAA" },
  14290. { "Typeface name": "Wingdings 3", "Dingbat dec": "204", "Dingbat hex": "CC", "Unicode dec": "11179", "Unicode hex": "2BAB" },
  14291. { "Typeface name": "Wingdings 3", "Dingbat dec": "205", "Dingbat hex": "CD", "Unicode dec": "11180", "Unicode hex": "2BAC" },
  14292. { "Typeface name": "Wingdings 3", "Dingbat dec": "206", "Dingbat hex": "CE", "Unicode dec": "11181", "Unicode hex": "2BAD" },
  14293. { "Typeface name": "Wingdings 3", "Dingbat dec": "207", "Dingbat hex": "CF", "Unicode dec": "11182", "Unicode hex": "2BAE" },
  14294. { "Typeface name": "Wingdings 3", "Dingbat dec": "208", "Dingbat hex": "D0", "Unicode dec": "11183", "Unicode hex": "2BAF" },
  14295. { "Typeface name": "Wingdings 3", "Dingbat dec": "209", "Dingbat hex": "D1", "Unicode dec": "129120", "Unicode hex": "1F860" },
  14296. { "Typeface name": "Wingdings 3", "Dingbat dec": "210", "Dingbat hex": "D2", "Unicode dec": "129122", "Unicode hex": "1F862" },
  14297. { "Typeface name": "Wingdings 3", "Dingbat dec": "211", "Dingbat hex": "D3", "Unicode dec": "129121", "Unicode hex": "1F861" },
  14298. { "Typeface name": "Wingdings 3", "Dingbat dec": "212", "Dingbat hex": "D4", "Unicode dec": "129123", "Unicode hex": "1F863" },
  14299. { "Typeface name": "Wingdings 3", "Dingbat dec": "213", "Dingbat hex": "D5", "Unicode dec": "129124", "Unicode hex": "1F864" },
  14300. { "Typeface name": "Wingdings 3", "Dingbat dec": "214", "Dingbat hex": "D6", "Unicode dec": "129125", "Unicode hex": "1F865" },
  14301. { "Typeface name": "Wingdings 3", "Dingbat dec": "215", "Dingbat hex": "D7", "Unicode dec": "129127", "Unicode hex": "1F867" },
  14302. { "Typeface name": "Wingdings 3", "Dingbat dec": "216", "Dingbat hex": "D8", "Unicode dec": "129126", "Unicode hex": "1F866" },
  14303. { "Typeface name": "Wingdings 3", "Dingbat dec": "217", "Dingbat hex": "D9", "Unicode dec": "129136", "Unicode hex": "1F870" },
  14304. { "Typeface name": "Wingdings 3", "Dingbat dec": "218", "Dingbat hex": "DA", "Unicode dec": "129138", "Unicode hex": "1F872" },
  14305. { "Typeface name": "Wingdings 3", "Dingbat dec": "219", "Dingbat hex": "DB", "Unicode dec": "129137", "Unicode hex": "1F871" },
  14306. { "Typeface name": "Wingdings 3", "Dingbat dec": "220", "Dingbat hex": "DC", "Unicode dec": "129139", "Unicode hex": "1F873" },
  14307. { "Typeface name": "Wingdings 3", "Dingbat dec": "221", "Dingbat hex": "DD", "Unicode dec": "129140", "Unicode hex": "1F874" },
  14308. { "Typeface name": "Wingdings 3", "Dingbat dec": "222", "Dingbat hex": "DE", "Unicode dec": "129141", "Unicode hex": "1F875" },
  14309. { "Typeface name": "Wingdings 3", "Dingbat dec": "223", "Dingbat hex": "DF", "Unicode dec": "129143", "Unicode hex": "1F877" },
  14310. { "Typeface name": "Wingdings 3", "Dingbat dec": "224", "Dingbat hex": "E0", "Unicode dec": "129142", "Unicode hex": "1F876" },
  14311. { "Typeface name": "Wingdings 3", "Dingbat dec": "225", "Dingbat hex": "E1", "Unicode dec": "129152", "Unicode hex": "1F880" },
  14312. { "Typeface name": "Wingdings 3", "Dingbat dec": "226", "Dingbat hex": "E2", "Unicode dec": "129154", "Unicode hex": "1F882" },
  14313. { "Typeface name": "Wingdings 3", "Dingbat dec": "227", "Dingbat hex": "E3", "Unicode dec": "129153", "Unicode hex": "1F881" },
  14314. { "Typeface name": "Wingdings 3", "Dingbat dec": "228", "Dingbat hex": "E4", "Unicode dec": "129155", "Unicode hex": "1F883" },
  14315. { "Typeface name": "Wingdings 3", "Dingbat dec": "229", "Dingbat hex": "E5", "Unicode dec": "129156", "Unicode hex": "1F884" },
  14316. { "Typeface name": "Wingdings 3", "Dingbat dec": "230", "Dingbat hex": "E6", "Unicode dec": "129157", "Unicode hex": "1F885" },
  14317. { "Typeface name": "Wingdings 3", "Dingbat dec": "231", "Dingbat hex": "E7", "Unicode dec": "129159", "Unicode hex": "1F887" },
  14318. { "Typeface name": "Wingdings 3", "Dingbat dec": "232", "Dingbat hex": "E8", "Unicode dec": "129158", "Unicode hex": "1F886" },
  14319. { "Typeface name": "Wingdings 3", "Dingbat dec": "233", "Dingbat hex": "E9", "Unicode dec": "129168", "Unicode hex": "1F890" },
  14320. { "Typeface name": "Wingdings 3", "Dingbat dec": "234", "Dingbat hex": "EA", "Unicode dec": "129170", "Unicode hex": "1F892" },
  14321. { "Typeface name": "Wingdings 3", "Dingbat dec": "235", "Dingbat hex": "EB", "Unicode dec": "129169", "Unicode hex": "1F891" },
  14322. { "Typeface name": "Wingdings 3", "Dingbat dec": "236", "Dingbat hex": "EC", "Unicode dec": "129171", "Unicode hex": "1F893" },
  14323. { "Typeface name": "Wingdings 3", "Dingbat dec": "237", "Dingbat hex": "ED", "Unicode dec": "129172", "Unicode hex": "1F894" },
  14324. { "Typeface name": "Wingdings 3", "Dingbat dec": "238", "Dingbat hex": "EE", "Unicode dec": "129174", "Unicode hex": "1F896" },
  14325. { "Typeface name": "Wingdings 3", "Dingbat dec": "239", "Dingbat hex": "EF", "Unicode dec": "129173", "Unicode hex": "1F895" },
  14326. { "Typeface name": "Wingdings 3", "Dingbat dec": "240", "Dingbat hex": "F0", "Unicode dec": "129175", "Unicode hex": "1F897" },
  14327. ];
  14328. exports.default = dingbats;
  14329. },{}],85:[function(require,module,exports){
  14330. "use strict";
  14331. var __importDefault = (this && this.__importDefault) || function (mod) {
  14332. return (mod && mod.__esModule) ? mod : { "default": mod };
  14333. };
  14334. Object.defineProperty(exports, "__esModule", { value: true });
  14335. exports.hex = exports.dec = exports.codePoint = void 0;
  14336. var dingbats_1 = __importDefault(require("./dingbats"));
  14337. var dingbatsByCodePoint = {};
  14338. var fromCodePoint = String.fromCodePoint ? String.fromCodePoint : fromCodePointPolyfill;
  14339. for (var _i = 0, dingbats_2 = dingbats_1.default; _i < dingbats_2.length; _i++) {
  14340. var dingbat = dingbats_2[_i];
  14341. var codePoint_1 = parseInt(dingbat["Unicode dec"], 10);
  14342. var scalarValue = {
  14343. codePoint: codePoint_1,
  14344. string: fromCodePoint(codePoint_1),
  14345. };
  14346. dingbatsByCodePoint[dingbat["Typeface name"].toUpperCase() + "_" + dingbat["Dingbat dec"]] = scalarValue;
  14347. }
  14348. function codePoint(typeface, codePoint) {
  14349. return dingbatsByCodePoint[typeface.toUpperCase() + "_" + codePoint];
  14350. }
  14351. exports.codePoint = codePoint;
  14352. function dec(typeface, dec) {
  14353. return codePoint(typeface, parseInt(dec, 10));
  14354. }
  14355. exports.dec = dec;
  14356. function hex(typeface, hex) {
  14357. return codePoint(typeface, parseInt(hex, 16));
  14358. }
  14359. exports.hex = hex;
  14360. function fromCodePointPolyfill(codePoint) {
  14361. if (codePoint <= 0xFFFF) {
  14362. // BMP
  14363. return String.fromCharCode(codePoint);
  14364. }
  14365. else {
  14366. // Astral
  14367. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  14368. var highSurrogate = Math.floor((codePoint - 0x10000) / 0x400) + 0xD800;
  14369. var lowSurrogate = (codePoint - 0x10000) % 0x400 + 0xDC00;
  14370. return String.fromCharCode(highSurrogate, lowSurrogate);
  14371. }
  14372. }
  14373. ;
  14374. },{"./dingbats":84}],86:[function(require,module,exports){
  14375. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  14376. var e, m
  14377. var eLen = nBytes * 8 - mLen - 1
  14378. var eMax = (1 << eLen) - 1
  14379. var eBias = eMax >> 1
  14380. var nBits = -7
  14381. var i = isLE ? (nBytes - 1) : 0
  14382. var d = isLE ? -1 : 1
  14383. var s = buffer[offset + i]
  14384. i += d
  14385. e = s & ((1 << (-nBits)) - 1)
  14386. s >>= (-nBits)
  14387. nBits += eLen
  14388. for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  14389. m = e & ((1 << (-nBits)) - 1)
  14390. e >>= (-nBits)
  14391. nBits += mLen
  14392. for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  14393. if (e === 0) {
  14394. e = 1 - eBias
  14395. } else if (e === eMax) {
  14396. return m ? NaN : ((s ? -1 : 1) * Infinity)
  14397. } else {
  14398. m = m + Math.pow(2, mLen)
  14399. e = e - eBias
  14400. }
  14401. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  14402. }
  14403. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  14404. var e, m, c
  14405. var eLen = nBytes * 8 - mLen - 1
  14406. var eMax = (1 << eLen) - 1
  14407. var eBias = eMax >> 1
  14408. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  14409. var i = isLE ? 0 : (nBytes - 1)
  14410. var d = isLE ? 1 : -1
  14411. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  14412. value = Math.abs(value)
  14413. if (isNaN(value) || value === Infinity) {
  14414. m = isNaN(value) ? 1 : 0
  14415. e = eMax
  14416. } else {
  14417. e = Math.floor(Math.log(value) / Math.LN2)
  14418. if (value * (c = Math.pow(2, -e)) < 1) {
  14419. e--
  14420. c *= 2
  14421. }
  14422. if (e + eBias >= 1) {
  14423. value += rt / c
  14424. } else {
  14425. value += rt * Math.pow(2, 1 - eBias)
  14426. }
  14427. if (value * c >= 2) {
  14428. e++
  14429. c /= 2
  14430. }
  14431. if (e + eBias >= eMax) {
  14432. m = 0
  14433. e = eMax
  14434. } else if (e + eBias >= 1) {
  14435. m = (value * c - 1) * Math.pow(2, mLen)
  14436. e = e + eBias
  14437. } else {
  14438. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  14439. e = 0
  14440. }
  14441. }
  14442. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  14443. e = (e << mLen) | m
  14444. eLen += mLen
  14445. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  14446. buffer[offset + i - d] |= s * 128
  14447. }
  14448. },{}],87:[function(require,module,exports){
  14449. var toString = {}.toString;
  14450. module.exports = Array.isArray || function (arr) {
  14451. return toString.call(arr) == '[object Array]';
  14452. };
  14453. },{}],88:[function(require,module,exports){
  14454. (function (global,Buffer){
  14455. /*!
  14456. JSZip v3.7.1 - A JavaScript class for generating and reading zip files
  14457. <http://stuartk.com/jszip>
  14458. (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
  14459. Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown.
  14460. JSZip uses the library pako released under the MIT license :
  14461. https://github.com/nodeca/pako/blob/master/LICENSE
  14462. */
  14463. !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JSZip=t()}}(function(){return function s(a,o,h){function u(r,t){if(!o[r]){if(!a[r]){var e="function"==typeof require&&require;if(!t&&e)return e(r,!0);if(l)return l(r,!0);var i=new Error("Cannot find module '"+r+"'");throw i.code="MODULE_NOT_FOUND",i}var n=o[r]={exports:{}};a[r][0].call(n.exports,function(t){var e=a[r][1][t];return u(e||t)},n,n.exports,s,a,o,h)}return o[r].exports}for(var l="function"==typeof require&&require,t=0;t<h.length;t++)u(h[t]);return u}({1:[function(t,e,r){"use strict";var c=t("./utils"),d=t("./support"),p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(t){for(var e,r,i,n,s,a,o,h=[],u=0,l=t.length,f=l,d="string"!==c.getTypeOf(t);u<t.length;)f=l-u,i=d?(e=t[u++],r=u<l?t[u++]:0,u<l?t[u++]:0):(e=t.charCodeAt(u++),r=u<l?t.charCodeAt(u++):0,u<l?t.charCodeAt(u++):0),n=e>>2,s=(3&e)<<4|r>>4,a=1<f?(15&r)<<2|i>>6:64,o=2<f?63&i:64,h.push(p.charAt(n)+p.charAt(s)+p.charAt(a)+p.charAt(o));return h.join("")},r.decode=function(t){var e,r,i,n,s,a,o=0,h=0,u="data:";if(t.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var l,f=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(t.charAt(t.length-1)===p.charAt(64)&&f--,t.charAt(t.length-2)===p.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(l=d.uint8array?new Uint8Array(0|f):new Array(0|f);o<t.length;)e=p.indexOf(t.charAt(o++))<<2|(n=p.indexOf(t.charAt(o++)))>>4,r=(15&n)<<4|(s=p.indexOf(t.charAt(o++)))>>2,i=(3&s)<<6|(a=p.indexOf(t.charAt(o++))),l[h++]=e,64!==s&&(l[h++]=r),64!==a&&(l[h++]=i);return l}},{"./support":30,"./utils":32}],2:[function(t,e,r){"use strict";var i=t("./external"),n=t("./stream/DataWorker"),s=t("./stream/Crc32Probe"),a=t("./stream/DataLengthProbe");function o(t,e,r,i,n){this.compressedSize=t,this.uncompressedSize=e,this.crc32=r,this.compression=i,this.compressedContent=n}o.prototype={getContentWorker:function(){var t=new n(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),e=this;return t.on("end",function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),t},getCompressedWorker:function(){return new n(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(t,e,r){return t.pipe(new s).pipe(new a("uncompressedSize")).pipe(e.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",e)},e.exports=o},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,r){"use strict";var i=t("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(t){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},r.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,r){"use strict";var i=t("./utils");var o=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==i.getTypeOf(t)?function(t,e,r,i){var n=o,s=i+r;t^=-1;for(var a=i;a<s;a++)t=t>>>8^n[255&(t^e[a])];return-1^t}(0|e,t,t.length,0):function(t,e,r,i){var n=o,s=i+r;t^=-1;for(var a=i;a<s;a++)t=t>>>8^n[255&(t^e.charCodeAt(a))];return-1^t}(0|e,t,t.length,0):0}},{"./utils":32}],5:[function(t,e,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(t,e,r){"use strict";var i=null;i="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:i}},{lie:37}],7:[function(t,e,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=t("pako"),s=t("./utils"),a=t("./stream/GenericWorker"),o=i?"uint8array":"array";function h(t,e){a.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}r.magic="\b\0",s.inherits(h,a),h.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(o,t.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},r.compressWorker=function(t){return new h("Deflate",t)},r.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,r){"use strict";function A(t,e){var r,i="";for(r=0;r<e;r++)i+=String.fromCharCode(255&t),t>>>=8;return i}function i(t,e,r,i,n,s){var a,o,h=t.file,u=t.compression,l=s!==O.utf8encode,f=I.transformTo("string",s(h.name)),d=I.transformTo("string",O.utf8encode(h.name)),c=h.comment,p=I.transformTo("string",s(c)),m=I.transformTo("string",O.utf8encode(c)),_=d.length!==h.name.length,g=m.length!==c.length,b="",v="",y="",w=h.dir,k=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};e&&!r||(x.crc32=t.crc32,x.compressedSize=t.compressedSize,x.uncompressedSize=t.uncompressedSize);var S=0;e&&(S|=8),l||!_&&!g||(S|=2048);var z=0,C=0;w&&(z|=16),"UNIX"===n?(C=798,z|=function(t,e){var r=t;return t||(r=e?16893:33204),(65535&r)<<16}(h.unixPermissions,w)):(C=20,z|=function(t){return 63&(t||0)}(h.dosPermissions)),a=k.getUTCHours(),a<<=6,a|=k.getUTCMinutes(),a<<=5,a|=k.getUTCSeconds()/2,o=k.getUTCFullYear()-1980,o<<=4,o|=k.getUTCMonth()+1,o<<=5,o|=k.getUTCDate(),_&&(v=A(1,1)+A(B(f),4)+d,b+="up"+A(v.length,2)+v),g&&(y=A(1,1)+A(B(p),4)+m,b+="uc"+A(y.length,2)+y);var E="";return E+="\n\0",E+=A(S,2),E+=u.magic,E+=A(a,2),E+=A(o,2),E+=A(x.crc32,4),E+=A(x.compressedSize,4),E+=A(x.uncompressedSize,4),E+=A(f.length,2),E+=A(b.length,2),{fileRecord:R.LOCAL_FILE_HEADER+E+f+b,dirRecord:R.CENTRAL_FILE_HEADER+A(C,2)+E+A(p.length,2)+"\0\0\0\0"+A(z,4)+A(i,4)+f+b+p}}var I=t("../utils"),n=t("../stream/GenericWorker"),O=t("../utf8"),B=t("../crc32"),R=t("../signature");function s(t,e,r,i){n.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}I.inherits(s,n),s.prototype.push=function(t){var e=t.meta.percent||0,r=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,n.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:r?(e+100*(r-i-1))/r:100}}))},s.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var r=i(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},s.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,r=i(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),e)this.push({data:function(t){return R.DATA_DESCRIPTOR+A(t.crc32,4)+A(t.compressedSize,4)+A(t.uncompressedSize,4)}(t),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},s.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e<this.dirRecords.length;e++)this.push({data:this.dirRecords[e],meta:{percent:100}});var r=this.bytesWritten-t,i=function(t,e,r,i,n){var s=I.transformTo("string",n(i));return R.CENTRAL_DIRECTORY_END+"\0\0\0\0"+A(t,2)+A(t,2)+A(e,4)+A(r,4)+A(s.length,2)+s}(this.dirRecords.length,r,t,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})},s.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},s.prototype.registerPrevious=function(t){this._sources.push(t);var e=this;return t.on("data",function(t){e.processChunk(t)}),t.on("end",function(){e.closedSource(e.previous.streamInfo),e._sources.length?e.prepareNextSource():e.end()}),t.on("error",function(t){e.error(t)}),this},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},s.prototype.error=function(t){var e=this._sources;if(!n.prototype.error.call(this,t))return!1;for(var r=0;r<e.length;r++)try{e[r].error(t)}catch(t){}return!0},s.prototype.lock=function(){n.prototype.lock.call(this);for(var t=this._sources,e=0;e<t.length;e++)t[e].lock()},e.exports=s},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,e,r){"use strict";var u=t("../compressions"),i=t("./ZipFileWorker");r.generateWorker=function(t,a,e){var o=new i(a.streamFiles,e,a.platform,a.encodeFileName),h=0;try{t.forEach(function(t,e){h++;var r=function(t,e){var r=t||e,i=u[r];if(!i)throw new Error(r+" is not a valid compression method !");return i}(e.options.compression,a.compression),i=e.options.compressionOptions||a.compressionOptions||{},n=e.dir,s=e.date;e._compressWorker(r,i).withStreamInfo("file",{name:t,dir:n,date:s,comment:e.comment||"",unixPermissions:e.unixPermissions,dosPermissions:e.dosPermissions}).pipe(o)}),o.entriesCount=h}catch(t){o.error(t)}return o}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,e,r){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var t=new i;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}(i.prototype=t("./object")).loadAsync=t("./load"),i.support=t("./support"),i.defaults=t("./defaults"),i.version="3.7.1",i.loadAsync=function(t,e){return(new i).loadAsync(t,e)},i.external=t("./external"),e.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,e,r){"use strict";var i=t("./utils"),n=t("./external"),o=t("./utf8"),h=t("./zipEntries"),s=t("./stream/Crc32Probe"),u=t("./nodejsUtils");function l(i){return new n.Promise(function(t,e){var r=i.decompressed.getContentWorker().pipe(new s);r.on("error",function(t){e(t)}).on("end",function(){r.streamInfo.crc32!==i.decompressed.crc32?e(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}e.exports=function(t,s){var a=this;return s=i.extend(s||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),u.isNode&&u.isStream(t)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",t,!0,s.optimizedBinaryString,s.base64).then(function(t){var e=new h(s);return e.load(t),e}).then(function(t){var e=[n.Promise.resolve(t)],r=t.files;if(s.checkCRC32)for(var i=0;i<r.length;i++)e.push(l(r[i]));return n.Promise.all(e)}).then(function(t){for(var e=t.shift(),r=e.files,i=0;i<r.length;i++){var n=r[i];a.file(n.fileNameStr,n.decompressed,{binary:!0,optimizedBinaryString:!0,date:n.date,dir:n.dir,comment:n.fileCommentStr.length?n.fileCommentStr:null,unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions,createFolders:s.createFolders})}return e.zipComment.length&&(a.comment=e.zipComment),a})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,e,r){"use strict";var i=t("../utils"),n=t("../stream/GenericWorker");function s(t,e){n.call(this,"Nodejs stream input adapter for "+t),this._upstreamEnded=!1,this._bindStream(e)}i.inherits(s,n),s.prototype._bindStream=function(t){var e=this;(this._stream=t).pause(),t.on("data",function(t){e.push({data:t,meta:{percent:0}})}).on("error",function(t){e.isPaused?this.generatedError=t:e.error(t)}).on("end",function(){e.isPaused?e._upstreamEnded=!0:e.end()})},s.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},e.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,e,r){"use strict";var n=t("readable-stream").Readable;function i(t,e,r){n.call(this,e),this._helper=t;var i=this;t.on("data",function(t,e){i.push(t)||i._helper.pause(),r&&r(e)}).on("error",function(t){i.emit("error",t)}).on("end",function(){i.push(null)})}t("../utils").inherits(i,n),i.prototype._read=function(){this._helper.resume()},e.exports=i},{"../utils":32,"readable-stream":16}],14:[function(t,e,r){"use strict";e.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(t,e){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(t,e);if("number"==typeof t)throw new Error('The "data" argument must not be a number');return new Buffer(t,e)},allocBuffer:function(t){if(Buffer.alloc)return Buffer.alloc(t);var e=new Buffer(t);return e.fill(0),e},isBuffer:function(t){return Buffer.isBuffer(t)},isStream:function(t){return t&&"function"==typeof t.on&&"function"==typeof t.pause&&"function"==typeof t.resume}}},{}],15:[function(t,e,r){"use strict";function s(t,e,r){var i,n=u.getTypeOf(e),s=u.extend(r||{},f);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(t=g(t)),s.createFolders&&(i=_(t))&&b.call(this,i,!0);var a="string"===n&&!1===s.binary&&!1===s.base64;r&&void 0!==r.binary||(s.binary=!a),(e instanceof d&&0===e.uncompressedSize||s.dir||!e||0===e.length)&&(s.base64=!1,s.binary=!0,e="",s.compression="STORE",n="string");var o=null;o=e instanceof d||e instanceof l?e:p.isNode&&p.isStream(e)?new m(t,e):u.prepareContent(t,e,s.binary,s.optimizedBinaryString,s.base64);var h=new c(t,o,s);this.files[t]=h}var n=t("./utf8"),u=t("./utils"),l=t("./stream/GenericWorker"),a=t("./stream/StreamHelper"),f=t("./defaults"),d=t("./compressedObject"),c=t("./zipObject"),o=t("./generate"),p=t("./nodejsUtils"),m=t("./nodejs/NodejsStreamInputAdapter"),_=function(t){"/"===t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return 0<e?t.substring(0,e):""},g=function(t){return"/"!==t.slice(-1)&&(t+="/"),t},b=function(t,e){return e=void 0!==e?e:f.createFolders,t=g(t),this.files[t]||s.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function h(t){return"[object RegExp]"===Object.prototype.toString.call(t)}var i={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(t){var e,r,i;for(e in this.files)i=this.files[e],(r=e.slice(this.root.length,e.length))&&e.slice(0,this.root.length)===this.root&&t(r,i)},filter:function(r){var i=[];return this.forEach(function(t,e){r(t,e)&&i.push(e)}),i},file:function(t,e,r){if(1!==arguments.length)return t=this.root+t,s.call(this,t,e,r),this;if(h(t)){var i=t;return this.filter(function(t,e){return!e.dir&&i.test(t)})}var n=this.files[this.root+t];return n&&!n.dir?n:null},folder:function(r){if(!r)return this;if(h(r))return this.filter(function(t,e){return e.dir&&r.test(t)});var t=this.root+r,e=b.call(this,t),i=this.clone();return i.root=e.name,i},remove:function(r){r=this.root+r;var t=this.files[r];if(t||("/"!==r.slice(-1)&&(r+="/"),t=this.files[r]),t&&!t.dir)delete this.files[r];else for(var e=this.filter(function(t,e){return e.name.slice(0,r.length)===r}),i=0;i<e.length;i++)delete this.files[e[i].name];return this},generate:function(t){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(t){var e,r={};try{if((r=u.extend(t||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");u.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var i=r.comment||this.comment||"";e=o.generateWorker(this,r,i)}catch(t){(e=new l("error")).error(t)}return new a(e,r.type||"string",r.mimeType)},generateAsync:function(t,e){return this.generateInternalStream(t).accumulate(e)},generateNodeStream:function(t,e){return(t=t||{}).type||(t.type="nodebuffer"),this.generateInternalStream(t).toNodejsStream(e)}};e.exports=i},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,e,r){e.exports=t("stream")},{stream:void 0}],17:[function(t,e,r){"use strict";var i=t("./DataReader");function n(t){i.call(this,t);for(var e=0;e<this.data.length;e++)t[e]=255&t[e]}t("../utils").inherits(n,i),n.prototype.byteAt=function(t){return this.data[this.zero+t]},n.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),r=t.charCodeAt(1),i=t.charCodeAt(2),n=t.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===e&&this.data[s+1]===r&&this.data[s+2]===i&&this.data[s+3]===n)return s-this.zero;return-1},n.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),r=t.charCodeAt(1),i=t.charCodeAt(2),n=t.charCodeAt(3),s=this.readData(4);return e===s[0]&&r===s[1]&&i===s[2]&&n===s[3]},n.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n},{"../utils":32,"./DataReader":18}],18:[function(t,e,r){"use strict";var i=t("../utils");function n(t){this.data=t,this.length=t.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length<this.zero+t||t<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t},skip:function(t){this.setIndex(this.index+t)},byteAt:function(t){},readInt:function(t){var e,r=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)r=(r<<8)+this.byteAt(e);return this.index+=t,r},readString:function(t){return i.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readAndCheckSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=n},{"../utils":32}],19:[function(t,e,r){"use strict";var i=t("./Uint8ArrayReader");function n(t){i.call(this,t)}t("../utils").inherits(n,i),n.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,r){"use strict";var i=t("./DataReader");function n(t){i.call(this,t)}t("../utils").inherits(n,i),n.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},n.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},n.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},n.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n},{"../utils":32,"./DataReader":18}],21:[function(t,e,r){"use strict";var i=t("./ArrayReader");function n(t){i.call(this,t)}t("../utils").inherits(n,i),n.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,r){"use strict";var i=t("../utils"),n=t("../support"),s=t("./ArrayReader"),a=t("./StringReader"),o=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");e.exports=function(t){var e=i.getTypeOf(t);return i.checkSupport(e),"string"!==e||n.uint8array?"nodebuffer"===e?new o(t):n.uint8array?new h(i.transformTo("uint8array",t)):new s(i.transformTo("array",t)):new a(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,r){"use strict";var i=t("./GenericWorker"),n=t("../utils");function s(t){i.call(this,"ConvertWorker to "+t),this.destType=t}n.inherits(s,i),s.prototype.processChunk=function(t){this.push({data:n.transformTo(this.destType,t.data),meta:t.meta})},e.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,r){"use strict";var i=t("./GenericWorker"),n=t("../crc32");function s(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(s,i),s.prototype.processChunk=function(t){this.streamInfo.crc32=n(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,r){"use strict";var i=t("../utils"),n=t("./GenericWorker");function s(t){n.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}i.inherits(s,n),s.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}n.prototype.processChunk.call(this,t)},e.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,r){"use strict";var i=t("../utils"),n=t("./GenericWorker");function s(t){n.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then(function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=i.getTypeOf(t),e.isPaused||e._tickAndRepeat()},function(t){e.error(t)})}i.inherits(s,n),s.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,r){"use strict";function i(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var r=0;r<this._listeners[t].length;r++)this._listeners[t][r].call(this,e)},pipe:function(t){return t.registerPrevious(this)},registerPrevious:function(t){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=t.streamInfo,this.mergeStreamInfo(),this.previous=t;var e=this;return t.on("data",function(t){e.processChunk(t)}),t.on("end",function(){e.end()}),t.on("error",function(t){e.error(t)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var t=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),t=!0),this.previous&&this.previous.resume(),!t},flush:function(){},processChunk:function(t){this.push(t)},withStreamInfo:function(t,e){return this.extraStreamInfo[t]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var t in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(t)&&(this.streamInfo[t]=this.extraStreamInfo[t])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var t="Worker "+this.name;return this.previous?this.previous+" -> "+t:t}},e.exports=i},{}],29:[function(t,e,r){"use strict";var h=t("../utils"),n=t("./ConvertWorker"),s=t("./GenericWorker"),u=t("../base64"),i=t("../support"),a=t("../external"),o=null;if(i.nodestream)try{o=t("../nodejs/NodejsStreamOutputAdapter")}catch(t){}function l(t,o){return new a.Promise(function(e,r){var i=[],n=t._internalType,s=t._outputType,a=t._mimeType;t.on("data",function(t,e){i.push(t),o&&o(e)}).on("error",function(t){i=[],r(t)}).on("end",function(){try{var t=function(t,e,r){switch(t){case"blob":return h.newBlob(h.transformTo("arraybuffer",e),r);case"base64":return u.encode(e);default:return h.transformTo(t,e)}}(s,function(t,e){var r,i=0,n=null,s=0;for(r=0;r<e.length;r++)s+=e[r].length;switch(t){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(n=new Uint8Array(s),r=0;r<e.length;r++)n.set(e[r],i),i+=e[r].length;return n;case"nodebuffer":return Buffer.concat(e);default:throw new Error("concat : unsupported type '"+t+"'")}}(n,i),a);e(t)}catch(t){r(t)}i=[]}).resume()})}function f(t,e,r){var i=e;switch(e){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string"}try{this._internalType=i,this._outputType=e,this._mimeType=r,h.checkSupport(i),this._worker=t.pipe(new n(i)),t.lock()}catch(t){this._worker=new s("error"),this._worker.error(t)}}f.prototype={accumulate:function(t){return l(this,t)},on:function(t,e){var r=this;return"data"===t?this._worker.on(t,function(t){e.call(r,t.data,t.meta)}):this._worker.on(t,function(){h.delay(e,arguments,r)}),this},resume:function(){return h.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(t){if(h.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new o(this,{objectMode:"nodebuffer"!==this._outputType},t)}},e.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,e,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer="undefined"!=typeof Buffer,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var i=new ArrayBuffer(0);try{r.blob=0===new Blob([i],{type:"application/zip"}).size}catch(t){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(i),r.blob=0===n.getBlob("application/zip").size}catch(t){r.blob=!1}}}try{r.nodestream=!!t("readable-stream").Readable}catch(t){r.nodestream=!1}},{"readable-stream":16}],31:[function(t,e,s){"use strict";for(var o=t("./utils"),h=t("./support"),r=t("./nodejsUtils"),i=t("./stream/GenericWorker"),u=new Array(256),n=0;n<256;n++)u[n]=252<=n?6:248<=n?5:240<=n?4:224<=n?3:192<=n?2:1;u[254]=u[254]=1;function a(){i.call(this,"utf-8 decode"),this.leftOver=null}function l(){i.call(this,"utf-8 encode")}s.utf8encode=function(t){return h.nodebuffer?r.newBufferFrom(t,"utf-8"):function(t){var e,r,i,n,s,a=t.length,o=0;for(n=0;n<a;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),o+=r<128?1:r<2048?2:r<65536?3:4;for(e=h.uint8array?new Uint8Array(o):new Array(o),n=s=0;s<o;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),r<128?e[s++]=r:(r<2048?e[s++]=192|r>>>6:(r<65536?e[s++]=224|r>>>12:(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63),e[s++]=128|r>>>6&63),e[s++]=128|63&r);return e}(t)},s.utf8decode=function(t){return h.nodebuffer?o.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,r,i,n,s=t.length,a=new Array(2*s);for(e=r=0;e<s;)if((i=t[e++])<128)a[r++]=i;else if(4<(n=u[i]))a[r++]=65533,e+=n-1;else{for(i&=2===n?31:3===n?15:7;1<n&&e<s;)i=i<<6|63&t[e++],n--;1<n?a[r++]=65533:i<65536?a[r++]=i:(i-=65536,a[r++]=55296|i>>10&1023,a[r++]=56320|1023&i)}return a.length!==r&&(a.subarray?a=a.subarray(0,r):a.length=r),o.applyFromCharCode(a)}(t=o.transformTo(h.uint8array?"uint8array":"array",t))},o.inherits(a,i),a.prototype.processChunk=function(t){var e=o.transformTo(h.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var r=e;(e=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),e.set(r,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var i=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;0<=r&&128==(192&t[r]);)r--;return r<0?e:0===r?e:r+u[t[r]]>e?r:e}(e),n=e;i!==e.length&&(h.uint8array?(n=e.subarray(0,i),this.leftOver=e.subarray(i,e.length)):(n=e.slice(0,i),this.leftOver=e.slice(i,e.length))),this.push({data:s.utf8decode(n),meta:t.meta})},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=a,o.inherits(l,i),l.prototype.processChunk=function(t){this.push({data:s.utf8encode(t.data),meta:t.meta})},s.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,a){"use strict";var o=t("./support"),h=t("./base64"),r=t("./nodejsUtils"),i=t("set-immediate-shim"),u=t("./external");function n(t){return t}function l(t,e){for(var r=0;r<t.length;++r)e[r]=255&t.charCodeAt(r);return e}a.newBlob=function(e,r){a.checkSupport("blob");try{return new Blob([e],{type:r})}catch(t){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return i.append(e),i.getBlob(r)}catch(t){throw new Error("Bug : can't construct the Blob.")}}};var s={stringifyByChunk:function(t,e,r){var i=[],n=0,s=t.length;if(s<=r)return String.fromCharCode.apply(null,t);for(;n<s;)"array"===e||"nodebuffer"===e?i.push(String.fromCharCode.apply(null,t.slice(n,Math.min(n+r,s)))):i.push(String.fromCharCode.apply(null,t.subarray(n,Math.min(n+r,s)))),n+=r;return i.join("")},stringifyByChar:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},applyCanBeUsed:{uint8array:function(){try{return o.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(t){return!1}}(),nodebuffer:function(){try{return o.nodebuffer&&1===String.fromCharCode.apply(null,r.allocBuffer(1)).length}catch(t){return!1}}()}};function f(t){var e=65536,r=a.getTypeOf(t),i=!0;if("uint8array"===r?i=s.applyCanBeUsed.uint8array:"nodebuffer"===r&&(i=s.applyCanBeUsed.nodebuffer),i)for(;1<e;)try{return s.stringifyByChunk(t,r,e)}catch(t){e=Math.floor(e/2)}return s.stringifyByChar(t)}function d(t,e){for(var r=0;r<t.length;r++)e[r]=t[r];return e}a.applyFromCharCode=f;var c={};c.string={string:n,array:function(t){return l(t,new Array(t.length))},arraybuffer:function(t){return c.string.uint8array(t).buffer},uint8array:function(t){return l(t,new Uint8Array(t.length))},nodebuffer:function(t){return l(t,r.allocBuffer(t.length))}},c.array={string:f,array:n,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return r.newBufferFrom(t)}},c.arraybuffer={string:function(t){return f(new Uint8Array(t))},array:function(t){return d(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:n,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return r.newBufferFrom(new Uint8Array(t))}},c.uint8array={string:f,array:function(t){return d(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:n,nodebuffer:function(t){return r.newBufferFrom(t)}},c.nodebuffer={string:f,array:function(t){return d(t,new Array(t.length))},arraybuffer:function(t){return c.nodebuffer.uint8array(t).buffer},uint8array:function(t){return d(t,new Uint8Array(t.length))},nodebuffer:n},a.transformTo=function(t,e){if(e=e||"",!t)return e;a.checkSupport(t);var r=a.getTypeOf(e);return c[r][t](e)},a.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":o.nodebuffer&&r.isBuffer(t)?"nodebuffer":o.uint8array&&t instanceof Uint8Array?"uint8array":o.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},a.checkSupport=function(t){if(!o[t.toLowerCase()])throw new Error(t+" is not supported by this platform")},a.MAX_VALUE_16BITS=65535,a.MAX_VALUE_32BITS=-1,a.pretty=function(t){var e,r,i="";for(r=0;r<(t||"").length;r++)i+="\\x"+((e=t.charCodeAt(r))<16?"0":"")+e.toString(16).toUpperCase();return i},a.delay=function(t,e,r){i(function(){t.apply(r||null,e||[])})},a.inherits=function(t,e){function r(){}r.prototype=e.prototype,t.prototype=new r},a.extend=function(){var t,e,r={};for(t=0;t<arguments.length;t++)for(e in arguments[t])arguments[t].hasOwnProperty(e)&&void 0===r[e]&&(r[e]=arguments[t][e]);return r},a.prepareContent=function(r,t,i,n,s){return u.Promise.resolve(t).then(function(i){return o.blob&&(i instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(i)))&&"undefined"!=typeof FileReader?new u.Promise(function(e,r){var t=new FileReader;t.onload=function(t){e(t.target.result)},t.onerror=function(t){r(t.target.error)},t.readAsArrayBuffer(i)}):i}).then(function(t){var e=a.getTypeOf(t);return e?("arraybuffer"===e?t=a.transformTo("uint8array",t):"string"===e&&(s?t=h.decode(t):i&&!0!==n&&(t=function(t){return l(t,o.uint8array?new Uint8Array(t.length):new Array(t.length))}(t))),t):u.Promise.reject(new Error("Can't read the data of '"+r+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"set-immediate-shim":54}],33:[function(t,e,r){"use strict";var i=t("./reader/readerFor"),n=t("./utils"),s=t("./signature"),a=t("./zipEntry"),o=(t("./utf8"),t("./support"));function h(t){this.files=[],this.loadOptions=t}h.prototype={checkSignature:function(t){if(!this.reader.readAndCheckSignature(t)){this.reader.index-=4;var e=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(e)+", expected "+n.pretty(t)+")")}},isSignature:function(t,e){var r=this.reader.index;this.reader.setIndex(t);var i=this.reader.readString(4)===e;return this.reader.setIndex(r),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var t=this.reader.readData(this.zipCommentLength),e=o.uint8array?"uint8array":"array",r=n.transformTo(e,t);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,r,i=this.zip64EndOfCentralSize-44;0<i;)t=this.reader.readInt(2),e=this.reader.readInt(4),r=this.reader.readData(e),this.zip64ExtensibleData[t]={id:t,length:e,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var t;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(t=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(t);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(t<0)throw!this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory");this.reader.setIndex(t);var e=t;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(t=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(t),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var i=e-r;if(0<i)this.isSignature(e,s.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(t){this.reader=i(t)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},e.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(t,e,r){"use strict";var i=t("./reader/readerFor"),s=t("./utils"),n=t("./compressedObject"),a=t("./crc32"),o=t("./utf8"),h=t("./compressions"),u=t("./support");function l(t,e){this.options=t,this.loadOptions=e}l.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(t){var e,r;if(t.skip(22),this.fileNameLength=t.readInt(2),r=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(e=function(t){for(var e in h)if(h.hasOwnProperty(e)&&h[e].magic===t)return h[e];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new n(this.compressedSize,this.uncompressedSize,this.crc32,e,t.readData(this.compressedSize))},readCentralPart:function(t){this.versionMadeBy=t.readInt(2),t.skip(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4);var e=t.readInt(2);if(this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");t.skip(e),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(t){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(t){var e,r,i,n=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4<n;)e=t.readInt(2),r=t.readInt(2),i=t.readData(r),this.extraFields[e]={id:e,length:r,value:i};t.setIndex(n)},handleUTF8:function(){var t=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=o.utf8decode(this.fileName),this.fileCommentStr=o.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();if(null!==e)this.fileNameStr=e;else{var r=s.transformTo(t,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var i=this.findExtraFieldUnicodeComment();if(null!==i)this.fileCommentStr=i;else{var n=s.transformTo(t,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(n)}}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=i(t.value);return 1!==e.readInt(1)?null:a(this.fileName)!==e.readInt(4)?null:o.utf8decode(e.readData(t.length-5))}return null},findExtraFieldUnicodeComment:function(){var t=this.extraFields[25461];if(t){var e=i(t.value);return 1!==e.readInt(1)?null:a(this.fileComment)!==e.readInt(4)?null:o.utf8decode(e.readData(t.length-5))}return null}},e.exports=l},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,e,r){"use strict";function i(t,e,r){this.name=t,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=e,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}}var s=t("./stream/StreamHelper"),n=t("./stream/DataWorker"),a=t("./utf8"),o=t("./compressedObject"),h=t("./stream/GenericWorker");i.prototype={internalStream:function(t){var e=null,r="string";try{if(!t)throw new Error("No output type specified.");var i="string"===(r=t.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),e=this._decompressWorker();var n=!this._dataBinary;n&&!i&&(e=e.pipe(new a.Utf8EncodeWorker)),!n&&i&&(e=e.pipe(new a.Utf8DecodeWorker))}catch(t){(e=new h("error")).error(t)}return new s(e,r,"")},async:function(t,e){return this.internalStream(t).accumulate(e)},nodeStream:function(t,e){return this.internalStream(t||"nodebuffer").toNodejsStream(e)},_compressWorker:function(t,e){if(this._data instanceof o&&this._data.compression.magic===t.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new a.Utf8EncodeWorker)),o.createWorkerFrom(r,t,e)},_decompressWorker:function(){return this._data instanceof o?this._data.getContentWorker():this._data instanceof h?this._data:new n(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<u.length;f++)i.prototype[u[f]]=l;e.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,l,e){(function(e){"use strict";var r,i,t=e.MutationObserver||e.WebKitMutationObserver;if(t){var n=0,s=new t(u),a=e.document.createTextNode("");s.observe(a,{characterData:!0}),r=function(){a.data=n=++n%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var o=new e.MessageChannel;o.port1.onmessage=u,r=function(){o.port2.postMessage(0)}}var h=[];function u(){var t,e;i=!0;for(var r=h.length;r;){for(e=h,h=[],t=-1;++t<r;)e[t]();r=h.length}i=!1}l.exports=function(t){1!==h.push(t)||i||r()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(t,e,r){"use strict";var n=t("immediate");function u(){}var l={},s=["REJECTED"],a=["FULFILLED"],i=["PENDING"];function o(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=i,this.queue=[],this.outcome=void 0,t!==u&&c(this,t)}function h(t,e,r){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function f(e,r,i){n(function(){var t;try{t=r(i)}catch(t){return l.reject(e,t)}t===e?l.reject(e,new TypeError("Cannot resolve promise with itself")):l.resolve(e,t)})}function d(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function c(e,t){var r=!1;function i(t){r||(r=!0,l.reject(e,t))}function n(t){r||(r=!0,l.resolve(e,t))}var s=p(function(){t(n,i)});"error"===s.status&&i(s.value)}function p(t,e){var r={};try{r.value=t(e),r.status="success"}catch(t){r.status="error",r.value=t}return r}(e.exports=o).prototype.finally=function(e){if("function"!=typeof e)return this;var r=this.constructor;return this.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})})},o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){if("function"!=typeof t&&this.state===a||"function"!=typeof e&&this.state===s)return this;var r=new this.constructor(u);this.state!==i?f(r,this.state===a?t:e,this.outcome):this.queue.push(new h(r,t,e));return r},h.prototype.callFulfilled=function(t){l.resolve(this.promise,t)},h.prototype.otherCallFulfilled=function(t){f(this.promise,this.onFulfilled,t)},h.prototype.callRejected=function(t){l.reject(this.promise,t)},h.prototype.otherCallRejected=function(t){f(this.promise,this.onRejected,t)},l.resolve=function(t,e){var r=p(d,e);if("error"===r.status)return l.reject(t,r.value);var i=r.value;if(i)c(t,i);else{t.state=a,t.outcome=e;for(var n=-1,s=t.queue.length;++n<s;)t.queue[n].callFulfilled(e)}return t},l.reject=function(t,e){t.state=s,t.outcome=e;for(var r=-1,i=t.queue.length;++r<i;)t.queue[r].callRejected(e);return t},o.resolve=function(t){if(t instanceof this)return t;return l.resolve(new this(u),t)},o.reject=function(t){var e=new this(u);return l.reject(e,t)},o.all=function(t){var r=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var i=t.length,n=!1;if(!i)return this.resolve([]);var s=new Array(i),a=0,e=-1,o=new this(u);for(;++e<i;)h(t[e],e);return o;function h(t,e){r.resolve(t).then(function(t){s[e]=t,++a!==i||n||(n=!0,l.resolve(o,s))},function(t){n||(n=!0,l.reject(o,t))})}},o.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var r=t.length,i=!1;if(!r)return this.resolve([]);var n=-1,s=new this(u);for(;++n<r;)a=t[n],e.resolve(a).then(function(t){i||(i=!0,l.resolve(s,t))},function(t){i||(i=!0,l.reject(s,t))});var a;return s}},{immediate:36}],38:[function(t,e,r){"use strict";var i={};(0,t("./lib/utils/common").assign)(i,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),e.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,e,r){"use strict";var a=t("./zlib/deflate"),o=t("./utils/common"),h=t("./utils/strings"),n=t("./zlib/messages"),s=t("./zlib/zstream"),u=Object.prototype.toString,l=0,f=-1,d=0,c=8;function p(t){if(!(this instanceof p))return new p(t);this.options=o.assign({level:f,method:c,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},t||{});var e=this.options;e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var r=a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==l)throw new Error(n[r]);if(e.header&&a.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(i="string"==typeof e.dictionary?h.string2buf(e.dictionary):"[object ArrayBuffer]"===u.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(r=a.deflateSetDictionary(this.strm,i))!==l)throw new Error(n[r]);this._dict_set=!0}}function i(t,e){var r=new p(e);if(r.push(t,!0),r.err)throw r.msg||n[r.err];return r.result}p.prototype.push=function(t,e){var r,i,n=this.strm,s=this.options.chunkSize;if(this.ended)return!1;i=e===~~e?e:!0===e?4:0,"string"==typeof t?n.input=h.string2buf(t):"[object ArrayBuffer]"===u.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new o.Buf8(s),n.next_out=0,n.avail_out=s),1!==(r=a.deflate(n,i))&&r!==l)return this.onEnd(r),!(this.ended=!0);0!==n.avail_out&&(0!==n.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(h.buf2binstring(o.shrinkBuf(n.output,n.next_out))):this.onData(o.shrinkBuf(n.output,n.next_out)))}while((0<n.avail_in||0===n.avail_out)&&1!==r);return 4===i?(r=a.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===l):2!==i||(this.onEnd(l),!(n.avail_out=0))},p.prototype.onData=function(t){this.chunks.push(t)},p.prototype.onEnd=function(t){t===l&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},r.Deflate=p,r.deflate=i,r.deflateRaw=function(t,e){return(e=e||{}).raw=!0,i(t,e)},r.gzip=function(t,e){return(e=e||{}).gzip=!0,i(t,e)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,e,r){"use strict";var d=t("./zlib/inflate"),c=t("./utils/common"),p=t("./utils/strings"),m=t("./zlib/constants"),i=t("./zlib/messages"),n=t("./zlib/zstream"),s=t("./zlib/gzheader"),_=Object.prototype.toString;function a(t){if(!(this instanceof a))return new a(t);this.options=c.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&0<=e.windowBits&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(0<=e.windowBits&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),15<e.windowBits&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n,this.strm.avail_out=0;var r=d.inflateInit2(this.strm,e.windowBits);if(r!==m.Z_OK)throw new Error(i[r]);this.header=new s,d.inflateGetHeader(this.strm,this.header)}function o(t,e){var r=new a(e);if(r.push(t,!0),r.err)throw r.msg||i[r.err];return r.result}a.prototype.push=function(t,e){var r,i,n,s,a,o,h=this.strm,u=this.options.chunkSize,l=this.options.dictionary,f=!1;if(this.ended)return!1;i=e===~~e?e:!0===e?m.Z_FINISH:m.Z_NO_FLUSH,"string"==typeof t?h.input=p.binstring2buf(t):"[object ArrayBuffer]"===_.call(t)?h.input=new Uint8Array(t):h.input=t,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new c.Buf8(u),h.next_out=0,h.avail_out=u),(r=d.inflate(h,m.Z_NO_FLUSH))===m.Z_NEED_DICT&&l&&(o="string"==typeof l?p.string2buf(l):"[object ArrayBuffer]"===_.call(l)?new Uint8Array(l):l,r=d.inflateSetDictionary(this.strm,o)),r===m.Z_BUF_ERROR&&!0===f&&(r=m.Z_OK,f=!1),r!==m.Z_STREAM_END&&r!==m.Z_OK)return this.onEnd(r),!(this.ended=!0);h.next_out&&(0!==h.avail_out&&r!==m.Z_STREAM_END&&(0!==h.avail_in||i!==m.Z_FINISH&&i!==m.Z_SYNC_FLUSH)||("string"===this.options.to?(n=p.utf8border(h.output,h.next_out),s=h.next_out-n,a=p.buf2string(h.output,n),h.next_out=s,h.avail_out=u-s,s&&c.arraySet(h.output,h.output,n,s,0),this.onData(a)):this.onData(c.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(f=!0)}while((0<h.avail_in||0===h.avail_out)&&r!==m.Z_STREAM_END);return r===m.Z_STREAM_END&&(i=m.Z_FINISH),i===m.Z_FINISH?(r=d.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===m.Z_OK):i!==m.Z_SYNC_FLUSH||(this.onEnd(m.Z_OK),!(h.avail_out=0))},a.prototype.onData=function(t){this.chunks.push(t)},a.prototype.onEnd=function(t){t===m.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=c.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},r.Inflate=a,r.inflate=o,r.inflateRaw=function(t,e){return(e=e||{}).raw=!0,o(t,e)},r.ungzip=o},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,e,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])}}return t},r.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var n={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+i),n);else for(var s=0;s<i;s++)t[n+s]=e[r+s]},flattenChunks:function(t){var e,r,i,n,s,a;for(e=i=0,r=t.length;e<r;e++)i+=t[e].length;for(a=new Uint8Array(i),e=n=0,r=t.length;e<r;e++)s=t[e],a.set(s,n),n+=s.length;return a}},s={arraySet:function(t,e,r,i,n){for(var s=0;s<i;s++)t[n+s]=e[r+s]},flattenChunks:function(t){return[].concat.apply([],t)}};r.setTyped=function(t){t?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,n)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s))},r.setTyped(i)},{}],42:[function(t,e,r){"use strict";var h=t("./common"),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(t){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){s=!1}for(var u=new h.Buf8(256),i=0;i<256;i++)u[i]=252<=i?6:248<=i?5:240<=i?4:224<=i?3:192<=i?2:1;function l(t,e){if(e<65537&&(t.subarray&&s||!t.subarray&&n))return String.fromCharCode.apply(null,h.shrinkBuf(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}u[254]=u[254]=1,r.string2buf=function(t){var e,r,i,n,s,a=t.length,o=0;for(n=0;n<a;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),o+=r<128?1:r<2048?2:r<65536?3:4;for(e=new h.Buf8(o),n=s=0;s<o;n++)55296==(64512&(r=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=t.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),r<128?e[s++]=r:(r<2048?e[s++]=192|r>>>6:(r<65536?e[s++]=224|r>>>12:(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63),e[s++]=128|r>>>6&63),e[s++]=128|63&r);return e},r.buf2binstring=function(t){return l(t,t.length)},r.binstring2buf=function(t){for(var e=new h.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e},r.buf2string=function(t,e){var r,i,n,s,a=e||t.length,o=new Array(2*a);for(r=i=0;r<a;)if((n=t[r++])<128)o[i++]=n;else if(4<(s=u[n]))o[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&r<a;)n=n<<6|63&t[r++],s--;1<s?o[i++]=65533:n<65536?o[i++]=n:(n-=65536,o[i++]=55296|n>>10&1023,o[i++]=56320|1023&n)}return l(o,i)},r.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;0<=r&&128==(192&t[r]);)r--;return r<0?e:0===r?e:r+u[t[r]]>e?r:e}},{"./common":41}],43:[function(t,e,r){"use strict";e.exports=function(t,e,r,i){for(var n=65535&t|0,s=t>>>16&65535|0,a=0;0!==r;){for(r-=a=2e3<r?2e3:r;s=s+(n=n+e[i++]|0)|0,--a;);n%=65521,s%=65521}return n|s<<16|0}},{}],44:[function(t,e,r){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,e,r){"use strict";var o=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();e.exports=function(t,e,r,i){var n=o,s=i+r;t^=-1;for(var a=i;a<s;a++)t=t>>>8^n[255&(t^e[a])];return-1^t}},{}],46:[function(t,e,r){"use strict";var h,d=t("../utils/common"),u=t("./trees"),c=t("./adler32"),p=t("./crc32"),i=t("./messages"),l=0,f=4,m=0,_=-2,g=-1,b=4,n=2,v=8,y=9,s=286,a=30,o=19,w=2*s+1,k=15,x=3,S=258,z=S+x+1,C=42,E=113,A=1,I=2,O=3,B=4;function R(t,e){return t.msg=i[e],e}function T(t){return(t<<1)-(4<t?9:0)}function D(t){for(var e=t.length;0<=--e;)t[e]=0}function F(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(d.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function N(t,e){u._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,F(t.strm)}function U(t,e){t.pending_buf[t.pending++]=e}function P(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function L(t,e){var r,i,n=t.max_chain_length,s=t.strstart,a=t.prev_length,o=t.nice_match,h=t.strstart>t.w_size-z?t.strstart-(t.w_size-z):0,u=t.window,l=t.w_mask,f=t.prev,d=t.strstart+S,c=u[s+a-1],p=u[s+a];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(u[(r=e)+a]===p&&u[r+a-1]===c&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&s<d);if(i=S-(d-s),s=d-S,a<i){if(t.match_start=e,o<=(a=i))break;c=u[s+a-1],p=u[s+a]}}}while((e=f[e&l])>h&&0!=--n);return a<=t.lookahead?a:t.lookahead}function j(t){var e,r,i,n,s,a,o,h,u,l,f=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=f+(f-z)){for(d.arraySet(t.window,t.window,f,f,0),t.match_start-=f,t.strstart-=f,t.block_start-=f,e=r=t.hash_size;i=t.head[--e],t.head[e]=f<=i?i-f:0,--r;);for(e=r=f;i=t.prev[--e],t.prev[e]=f<=i?i-f:0,--r;);n+=f}if(0===t.strm.avail_in)break;if(a=t.strm,o=t.window,h=t.strstart+t.lookahead,u=n,l=void 0,l=a.avail_in,u<l&&(l=u),r=0===l?0:(a.avail_in-=l,d.arraySet(o,a.input,a.next_in,l,h),1===a.state.wrap?a.adler=c(a.adler,o,l,h):2===a.state.wrap&&(a.adler=p(a.adler,o,l,h)),a.next_in+=l,a.total_in+=l,l),t.lookahead+=r,t.lookahead+t.insert>=x)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+x-1])&t.hash_mask,t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<x)););}while(t.lookahead<z&&0!==t.strm.avail_in)}function Z(t,e){for(var r,i;;){if(t.lookahead<z){if(j(t),t.lookahead<z&&e===l)return A;if(0===t.lookahead)break}if(r=0,t.lookahead>=x&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+x-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-z&&(t.match_length=L(t,r)),t.match_length>=x)if(i=u._tr_tally(t,t.strstart-t.match_start,t.match_length-x),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=x){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+x-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,0!=--t.match_length;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=u._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(N(t,!1),0===t.strm.avail_out))return A}return t.insert=t.strstart<x-1?t.strstart:x-1,e===f?(N(t,!0),0===t.strm.avail_out?O:B):t.last_lit&&(N(t,!1),0===t.strm.avail_out)?A:I}function W(t,e){for(var r,i,n;;){if(t.lookahead<z){if(j(t),t.lookahead<z&&e===l)return A;if(0===t.lookahead)break}if(r=0,t.lookahead>=x&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+x-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=x-1,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-z&&(t.match_length=L(t,r),t.match_length<=5&&(1===t.strategy||t.match_length===x&&4096<t.strstart-t.match_start)&&(t.match_length=x-1)),t.prev_length>=x&&t.match_length<=t.prev_length){for(n=t.strstart+t.lookahead-x,i=u._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-x),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+x-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!=--t.prev_length;);if(t.match_available=0,t.match_length=x-1,t.strstart++,i&&(N(t,!1),0===t.strm.avail_out))return A}else if(t.match_available){if((i=u._tr_tally(t,0,t.window[t.strstart-1]))&&N(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return A}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=u._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<x-1?t.strstart:x-1,e===f?(N(t,!0),0===t.strm.avail_out?O:B):t.last_lit&&(N(t,!1),0===t.strm.avail_out)?A:I}function M(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}function H(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new d.Buf16(2*w),this.dyn_dtree=new d.Buf16(2*(2*a+1)),this.bl_tree=new d.Buf16(2*(2*o+1)),D(this.dyn_ltree),D(this.dyn_dtree),D(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new d.Buf16(k+1),this.heap=new d.Buf16(2*s+1),D(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new d.Buf16(2*s+1),D(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function G(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=n,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?C:E,t.adler=2===e.wrap?0:1,e.last_flush=l,u._tr_init(e),m):R(t,_)}function K(t){var e=G(t);return e===m&&function(t){t.window_size=2*t.w_size,D(t.head),t.max_lazy_match=h[t.level].max_lazy,t.good_match=h[t.level].good_length,t.nice_match=h[t.level].nice_length,t.max_chain_length=h[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=x-1,t.match_available=0,t.ins_h=0}(t.state),e}function Y(t,e,r,i,n,s){if(!t)return _;var a=1;if(e===g&&(e=6),i<0?(a=0,i=-i):15<i&&(a=2,i-=16),n<1||y<n||r!==v||i<8||15<i||e<0||9<e||s<0||b<s)return R(t,_);8===i&&(i=9);var o=new H;return(t.state=o).strm=t,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+x-1)/x),o.window=new d.Buf8(2*o.w_size),o.head=new d.Buf16(o.hash_size),o.prev=new d.Buf16(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new d.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=e,o.strategy=s,o.method=r,K(t)}h=[new M(0,0,0,0,function(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(j(t),0===t.lookahead&&e===l)return A;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,N(t,!1),0===t.strm.avail_out))return A;if(t.strstart-t.block_start>=t.w_size-z&&(N(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===f?(N(t,!0),0===t.strm.avail_out?O:B):(t.strstart>t.block_start&&(N(t,!1),t.strm.avail_out),A)}),new M(4,4,8,4,Z),new M(4,5,16,8,Z),new M(4,6,32,32,Z),new M(4,4,16,16,W),new M(8,16,32,32,W),new M(8,16,128,128,W),new M(8,32,128,256,W),new M(32,128,258,1024,W),new M(32,258,258,4096,W)],r.deflateInit=function(t,e){return Y(t,e,v,15,8,0)},r.deflateInit2=Y,r.deflateReset=K,r.deflateResetKeep=G,r.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?_:(t.state.gzhead=e,m):_},r.deflate=function(t,e){var r,i,n,s;if(!t||!t.state||5<e||e<0)return t?R(t,_):_;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||666===i.status&&e!==f)return R(t,0===t.avail_out?-5:_);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===C)if(2===i.wrap)t.adler=0,U(i,31),U(i,139),U(i,8),i.gzhead?(U(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),U(i,255&i.gzhead.time),U(i,i.gzhead.time>>8&255),U(i,i.gzhead.time>>16&255),U(i,i.gzhead.time>>24&255),U(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),U(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(U(i,255&i.gzhead.extra.length),U(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=p(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(U(i,0),U(i,0),U(i,0),U(i,0),U(i,0),U(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),U(i,3),i.status=E);else{var a=v+(i.w_bits-8<<4)<<8;a|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(a|=32),a+=31-a%31,i.status=E,P(i,a),0!==i.strstart&&(P(i,t.adler>>>16),P(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),F(t),n=i.pending,i.pending!==i.pending_buf_size));)U(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),F(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,U(i,s)}while(0!==s);i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),0===s&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),F(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,U(i,s)}while(0!==s);i.gzhead.hcrc&&i.pending>n&&(t.adler=p(t.adler,i.pending_buf,i.pending-n,n)),0===s&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&F(t),i.pending+2<=i.pending_buf_size&&(U(i,255&t.adler),U(i,t.adler>>8&255),t.adler=0,i.status=E)):i.status=E),0!==i.pending){if(F(t),0===t.avail_out)return i.last_flush=-1,m}else if(0===t.avail_in&&T(e)<=T(r)&&e!==f)return R(t,-5);if(666===i.status&&0!==t.avail_in)return R(t,-5);if(0!==t.avail_in||0!==i.lookahead||e!==l&&666!==i.status){var o=2===i.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(j(t),0===t.lookahead)){if(e===l)return A;break}if(t.match_length=0,r=u._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(N(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===f?(N(t,!0),0===t.strm.avail_out?O:B):t.last_lit&&(N(t,!1),0===t.strm.avail_out)?A:I}(i,e):3===i.strategy?function(t,e){for(var r,i,n,s,a=t.window;;){if(t.lookahead<=S){if(j(t),t.lookahead<=S&&e===l)return A;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=x&&0<t.strstart&&(i=a[n=t.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){s=t.strstart+S;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<s);t.match_length=S-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=x?(r=u._tr_tally(t,1,t.match_length-x),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=u._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(N(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===f?(N(t,!0),0===t.strm.avail_out?O:B):t.last_lit&&(N(t,!1),0===t.strm.avail_out)?A:I}(i,e):h[i.level].func(i,e);if(o!==O&&o!==B||(i.status=666),o===A||o===O)return 0===t.avail_out&&(i.last_flush=-1),m;if(o===I&&(1===e?u._tr_align(i):5!==e&&(u._tr_stored_block(i,0,0,!1),3===e&&(D(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),F(t),0===t.avail_out))return i.last_flush=-1,m}return e!==f?m:i.wrap<=0?1:(2===i.wrap?(U(i,255&t.adler),U(i,t.adler>>8&255),U(i,t.adler>>16&255),U(i,t.adler>>24&255),U(i,255&t.total_in),U(i,t.total_in>>8&255),U(i,t.total_in>>16&255),U(i,t.total_in>>24&255)):(P(i,t.adler>>>16),P(i,65535&t.adler)),F(t),0<i.wrap&&(i.wrap=-i.wrap),0!==i.pending?m:1)},r.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==C&&69!==e&&73!==e&&91!==e&&103!==e&&e!==E&&666!==e?R(t,_):(t.state=null,e===E?R(t,-3):m):_},r.deflateSetDictionary=function(t,e){var r,i,n,s,a,o,h,u,l=e.length;if(!t||!t.state)return _;if(2===(s=(r=t.state).wrap)||1===s&&r.status!==C||r.lookahead)return _;for(1===s&&(t.adler=c(t.adler,e,l,0)),r.wrap=0,l>=r.w_size&&(0===s&&(D(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new d.Buf8(r.w_size),d.arraySet(u,e,l-r.w_size,r.w_size,0),e=u,l=r.w_size),a=t.avail_in,o=t.next_in,h=t.input,t.avail_in=l,t.next_in=0,t.input=e,j(r);r.lookahead>=x;){for(i=r.strstart,n=r.lookahead-(x-1);r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+x-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,--n;);r.strstart=i,r.lookahead=x-1,j(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=x-1,r.match_available=0,t.next_in=o,t.input=h,t.avail_in=a,r.wrap=s,m},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,e,r){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,e,r){"use strict";e.exports=function(t,e){var r,i,n,s,a,o,h,u,l,f,d,c,p,m,_,g,b,v,y,w,k,x,S,z,C;r=t.state,i=t.next_in,z=t.input,n=i+(t.avail_in-5),s=t.next_out,C=t.output,a=s-(e-t.avail_out),o=s+(t.avail_out-257),h=r.dmax,u=r.wsize,l=r.whave,f=r.wnext,d=r.window,c=r.hold,p=r.bits,m=r.lencode,_=r.distcode,g=(1<<r.lenbits)-1,b=(1<<r.distbits)-1;t:do{p<15&&(c+=z[i++]<<p,p+=8,c+=z[i++]<<p,p+=8),v=m[c&g];e:for(;;){if(c>>>=y=v>>>24,p-=y,0===(y=v>>>16&255))C[s++]=65535&v;else{if(!(16&y)){if(0==(64&y)){v=m[(65535&v)+(c&(1<<y)-1)];continue e}if(32&y){r.mode=12;break t}t.msg="invalid literal/length code",r.mode=30;break t}w=65535&v,(y&=15)&&(p<y&&(c+=z[i++]<<p,p+=8),w+=c&(1<<y)-1,c>>>=y,p-=y),p<15&&(c+=z[i++]<<p,p+=8,c+=z[i++]<<p,p+=8),v=_[c&b];r:for(;;){if(c>>>=y=v>>>24,p-=y,!(16&(y=v>>>16&255))){if(0==(64&y)){v=_[(65535&v)+(c&(1<<y)-1)];continue r}t.msg="invalid distance code",r.mode=30;break t}if(k=65535&v,p<(y&=15)&&(c+=z[i++]<<p,(p+=8)<y&&(c+=z[i++]<<p,p+=8)),h<(k+=c&(1<<y)-1)){t.msg="invalid distance too far back",r.mode=30;break t}if(c>>>=y,p-=y,(y=s-a)<k){if(l<(y=k-y)&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(S=d,(x=0)===f){if(x+=u-y,y<w){for(w-=y;C[s++]=d[x++],--y;);x=s-k,S=C}}else if(f<y){if(x+=u+f-y,(y-=f)<w){for(w-=y;C[s++]=d[x++],--y;);if(x=0,f<w){for(w-=y=f;C[s++]=d[x++],--y;);x=s-k,S=C}}}else if(x+=f-y,y<w){for(w-=y;C[s++]=d[x++],--y;);x=s-k,S=C}for(;2<w;)C[s++]=S[x++],C[s++]=S[x++],C[s++]=S[x++],w-=3;w&&(C[s++]=S[x++],1<w&&(C[s++]=S[x++]))}else{for(x=s-k;C[s++]=C[x++],C[s++]=C[x++],C[s++]=C[x++],2<(w-=3););w&&(C[s++]=C[x++],1<w&&(C[s++]=C[x++]))}break}}break}}while(i<n&&s<o);i-=w=p>>3,c&=(1<<(p-=w<<3))-1,t.next_in=i,t.next_out=s,t.avail_in=i<n?n-i+5:5-(i-n),t.avail_out=s<o?o-s+257:257-(s-o),r.hold=c,r.bits=p}},{}],49:[function(t,e,r){"use strict";var I=t("../utils/common"),O=t("./adler32"),B=t("./crc32"),R=t("./inffast"),T=t("./inftrees"),D=1,F=2,N=0,U=-2,P=1,i=852,n=592;function L(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new I.Buf16(320),this.work=new I.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=P,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new I.Buf32(i),e.distcode=e.distdyn=new I.Buf32(n),e.sane=1,e.back=-1,N):U}function o(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,a(t)):U}function h(t,e){var r,i;return t&&t.state?(i=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15<e)?U:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,o(t))):U}function u(t,e){var r,i;return t?(i=new s,(t.state=i).window=null,(r=h(t,e))!==N&&(t.state=null),r):U}var l,f,d=!0;function j(t){if(d){var e;for(l=new I.Buf32(512),f=new I.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(T(D,t.lens,0,288,l,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;T(F,t.lens,0,32,f,0,t.work,{bits:5}),d=!1}t.lencode=l,t.lenbits=9,t.distcode=f,t.distbits=5}function Z(t,e,r,i){var n,s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new I.Buf8(s.wsize)),i>=s.wsize?(I.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i<(n=s.wsize-s.wnext)&&(n=i),I.arraySet(s.window,e,r-i,n,s.wnext),(i-=n)?(I.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0}r.inflateReset=o,r.inflateReset2=h,r.inflateResetKeep=a,r.inflateInit=function(t){return u(t,15)},r.inflateInit2=u,r.inflate=function(t,e){var r,i,n,s,a,o,h,u,l,f,d,c,p,m,_,g,b,v,y,w,k,x,S,z,C=0,E=new I.Buf8(4),A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return U;12===(r=t.state).mode&&(r.mode=13),a=t.next_out,n=t.output,h=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,u=r.hold,l=r.bits,f=o,d=h,x=N;t:for(;;)switch(r.mode){case P:if(0===r.wrap){r.mode=13;break}for(;l<16;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}if(2&r.wrap&&35615===u){E[r.check=0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0),l=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){t.msg="unknown compression method",r.mode=30;break}if(l-=4,k=8+(15&(u>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<<k,t.adler=r.check=1,r.mode=512&u?10:12,l=u=0;break;case 2:for(;l<16;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}if(r.flags=u,8!=(255&r.flags)){t.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=3;case 3:for(;l<32;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=B(r.check,E,4,0)),l=u=0,r.mode=4;case 4:for(;l<16;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(o<(c=r.length)&&(c=o),c&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),I.arraySet(r.head.extra,i,s,c,k)),512&r.flags&&(r.check=B(r.check,i,c,s)),o-=c,s+=c,r.length-=c),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break t;for(c=0;k=i[s+c++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&c<o;);if(512&r.flags&&(r.check=B(r.check,i,c,s)),o-=c,s+=c,k)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===o)break t;for(c=0;k=i[s+c++],r.head&&k&&r.length<65536&&(r.head.comment+=String.fromCharCode(k)),k&&c<o;);if(512&r.flags&&(r.check=B(r.check,i,c,s)),o-=c,s+=c,k)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;l<16;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}if(u!==(65535&r.check)){t.msg="header crc mismatch",r.mode=30;break}l=u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;l<32;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}t.adler=r.check=L(u),l=u=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,r.hold=u,r.bits=l,2;t.adler=r.check=1,r.mode=12;case 12:if(5===e||6===e)break t;case 13:if(r.last){u>>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}switch(r.last=1&u,l-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(j(r),r.mode=20,6!==e)break;u>>>=2,l-=2;break t;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30}u>>>=2,l-=2;break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,l=u=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(c=r.length){if(o<c&&(c=o),h<c&&(c=h),0===c)break t;I.arraySet(n,i,s,c,a),o-=c,s+=c,h-=c,a+=c,r.length-=c;break}r.mode=12;break;case 17:for(;l<14;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,286<r.nlen||30<r.ndist){t.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;l<3;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}r.lens[A[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=T(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;g=(C=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}if(b<16)u>>>=_,l-=_,r.lens[r.have++]=b;else{if(16===b){for(z=_+2;l<z;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}if(u>>>=_,l-=_,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],c=3+(3&u),u>>>=2,l-=2}else if(17===b){for(z=_+3;l<z;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}l-=_,k=0,c=3+(7&(u>>>=_)),u>>>=3,l-=3}else{for(z=_+7;l<z;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}l-=_,k=0,c=11+(127&(u>>>=_)),u>>>=7,l-=7}if(r.have+c>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;c--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},x=T(D,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=T(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(6<=o&&258<=h){t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,r.hold=u,r.bits=l,R(t,d),a=t.next_out,n=t.output,h=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,u=r.hold,l=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;g=(C=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}if(g&&0==(240&g)){for(v=_,y=g,w=b;g=(C=r.lencode[w+((u&(1<<v+y)-1)>>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,r.length=b,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=12;break}if(64&g){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(z=r.extra;l<z;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;g=(C=r.distcode[u&(1<<r.distbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}if(0==(240&g)){for(v=_,y=g,w=b;g=(C=r.distcode[w+((u&(1<<v+y)-1)>>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,64&g){t.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(z=r.extra;l<z;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===h)break t;if(c=d-h,r.offset>c){if((c=r.offset-c)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}p=c>r.wnext?(c-=r.wnext,r.wsize-c):r.wnext-c,c>r.length&&(c=r.length),m=r.window}else m=n,p=a-r.offset,c=r.length;for(h<c&&(c=h),h-=c,r.length-=c;n[a++]=m[p++],--c;);0===r.length&&(r.mode=21);break;case 26:if(0===h)break t;n[a++]=r.length,h--,r.mode=21;break;case 27:if(r.wrap){for(;l<32;){if(0===o)break t;o--,u|=i[s++]<<l,l+=8}if(d-=h,t.total_out+=d,r.total+=d,d&&(t.adler=r.check=r.flags?B(r.check,n,d,a-d):O(r.check,n,d,a-d)),d=h,(r.flags?u:L(u))!==r.check){t.msg="incorrect data check",r.mode=30;break}l=u=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;l<32;){if(0===o)break t;o--,u+=i[s++]<<l,l+=8}if(u!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=30;break}l=u=0}r.mode=29;case 29:x=1;break t;case 30:x=-3;break t;case 31:return-4;case 32:default:return U}return t.next_out=a,t.avail_out=h,t.next_in=s,t.avail_in=o,r.hold=u,r.bits=l,(r.wsize||d!==t.avail_out&&r.mode<30&&(r.mode<27||4!==e))&&Z(t,t.output,t.next_out,d-t.avail_out)?(r.mode=31,-4):(f-=t.avail_in,d-=t.avail_out,t.total_in+=f,t.total_out+=d,r.total+=d,r.wrap&&d&&(t.adler=r.check=r.flags?B(r.check,n,d,t.next_out-d):O(r.check,n,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==f&&0===d||4===e)&&x===N&&(x=-5),x)},r.inflateEnd=function(t){if(!t||!t.state)return U;var e=t.state;return e.window&&(e.window=null),t.state=null,N},r.inflateGetHeader=function(t,e){var r;return t&&t.state?0==(2&(r=t.state).wrap)?U:((r.head=e).done=!1,N):U},r.inflateSetDictionary=function(t,e){var r,i=e.length;return t&&t.state?0!==(r=t.state).wrap&&11!==r.mode?U:11===r.mode&&O(1,e,i,0)!==r.check?-3:Z(t,e,i,i)?(r.mode=31,-4):(r.havedict=1,N):U},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,e,r){"use strict";var D=t("../utils/common"),F=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],N=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],U=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],P=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,r,i,n,s,a,o){var h,u,l,f,d,c,p,m,_,g=o.bits,b=0,v=0,y=0,w=0,k=0,x=0,S=0,z=0,C=0,E=0,A=null,I=0,O=new D.Buf16(16),B=new D.Buf16(16),R=null,T=0;for(b=0;b<=15;b++)O[b]=0;for(v=0;v<i;v++)O[e[r+v]]++;for(k=g,w=15;1<=w&&0===O[w];w--);if(w<k&&(k=w),0===w)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(y=1;y<w&&0===O[y];y++);for(k<y&&(k=y),b=z=1;b<=15;b++)if(z<<=1,(z-=O[b])<0)return-1;if(0<z&&(0===t||1!==w))return-1;for(B[1]=0,b=1;b<15;b++)B[b+1]=B[b]+O[b];for(v=0;v<i;v++)0!==e[r+v]&&(a[B[e[r+v]]++]=v);if(c=0===t?(A=R=a,19):1===t?(A=F,I-=257,R=N,T-=257,256):(A=U,R=P,-1),b=y,d=s,S=v=E=0,l=-1,f=(C=1<<(x=k))-1,1===t&&852<C||2===t&&592<C)return 1;for(;;){for(p=b-S,_=a[v]<c?(m=0,a[v]):a[v]>c?(m=R[T+a[v]],A[I+a[v]]):(m=96,0),h=1<<b-S,y=u=1<<x;n[d+(E>>S)+(u-=h)]=p<<24|m<<16|_|0,0!==u;);for(h=1<<b-1;E&h;)h>>=1;if(0!==h?(E&=h-1,E+=h):E=0,v++,0==--O[b]){if(b===w)break;b=e[r+a[v]]}if(k<b&&(E&f)!==l){for(0===S&&(S=k),d+=y,z=1<<(x=b-S);x+S<w&&!((z-=O[x+S])<=0);)x++,z<<=1;if(C+=1<<x,1===t&&852<C||2===t&&592<C)return 1;n[l=E&f]=k<<24|x<<16|d-s|0}}return 0!==E&&(n[d+E]=b-S<<24|64<<16|0),o.bits=k,0}},{"../utils/common":41}],51:[function(t,e,r){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,e,r){"use strict";var n=t("../utils/common"),o=0,h=1;function i(t){for(var e=t.length;0<=--e;)t[e]=0}var s=0,a=29,u=256,l=u+1+a,f=30,d=19,_=2*l+1,g=15,c=16,p=7,m=256,b=16,v=17,y=18,w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],k=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],z=new Array(2*(l+2));i(z);var C=new Array(2*f);i(C);var E=new Array(512);i(E);var A=new Array(256);i(A);var I=new Array(a);i(I);var O,B,R,T=new Array(f);function D(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}function F(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function N(t){return t<256?E[t]:E[256+(t>>>7)]}function U(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function P(t,e,r){t.bi_valid>c-r?(t.bi_buf|=e<<t.bi_valid&65535,U(t,t.bi_buf),t.bi_buf=e>>c-t.bi_valid,t.bi_valid+=r-c):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}function L(t,e,r){P(t,r[2*e],r[2*e+1])}function j(t,e){for(var r=0;r|=1&t,t>>>=1,r<<=1,0<--e;);return r>>>1}function Z(t,e,r){var i,n,s=new Array(g+1),a=0;for(i=1;i<=g;i++)s[i]=a=a+r[i-1]<<1;for(n=0;n<=e;n++){var o=t[2*n+1];0!==o&&(t[2*n]=j(s[o]++,o))}}function W(t){var e;for(e=0;e<l;e++)t.dyn_ltree[2*e]=0;for(e=0;e<f;e++)t.dyn_dtree[2*e]=0;for(e=0;e<d;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*m]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function M(t){8<t.bi_valid?U(t,t.bi_buf):0<t.bi_valid&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function H(t,e,r,i){var n=2*e,s=2*r;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[r]}function G(t,e,r){for(var i=t.heap[r],n=r<<1;n<=t.heap_len&&(n<t.heap_len&&H(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!H(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i}function K(t,e,r){var i,n,s,a,o=0;if(0!==t.last_lit)for(;i=t.pending_buf[t.d_buf+2*o]<<8|t.pending_buf[t.d_buf+2*o+1],n=t.pending_buf[t.l_buf+o],o++,0===i?L(t,n,e):(L(t,(s=A[n])+u+1,e),0!==(a=w[s])&&P(t,n-=I[s],a),L(t,s=N(--i),r),0!==(a=k[s])&&P(t,i-=T[s],a)),o<t.last_lit;);L(t,m,e)}function Y(t,e){var r,i,n,s=e.dyn_tree,a=e.stat_desc.static_tree,o=e.stat_desc.has_stree,h=e.stat_desc.elems,u=-1;for(t.heap_len=0,t.heap_max=_,r=0;r<h;r++)0!==s[2*r]?(t.heap[++t.heap_len]=u=r,t.depth[r]=0):s[2*r+1]=0;for(;t.heap_len<2;)s[2*(n=t.heap[++t.heap_len]=u<2?++u:0)]=1,t.depth[n]=0,t.opt_len--,o&&(t.static_len-=a[2*n+1]);for(e.max_code=u,r=t.heap_len>>1;1<=r;r--)G(t,s,r);for(n=h;r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],G(t,s,1),i=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=i,s[2*n]=s[2*r]+s[2*i],t.depth[n]=(t.depth[r]>=t.depth[i]?t.depth[r]:t.depth[i])+1,s[2*r+1]=s[2*i+1]=n,t.heap[1]=n++,G(t,s,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,i,n,s,a,o,h=e.dyn_tree,u=e.max_code,l=e.stat_desc.static_tree,f=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,c=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(s=0;s<=g;s++)t.bl_count[s]=0;for(h[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<_;r++)p<(s=h[2*h[2*(i=t.heap[r])+1]+1]+1)&&(s=p,m++),h[2*i+1]=s,u<i||(t.bl_count[s]++,a=0,c<=i&&(a=d[i-c]),o=h[2*i],t.opt_len+=o*(s+a),f&&(t.static_len+=o*(l[2*i+1]+a)));if(0!==m){do{for(s=p-1;0===t.bl_count[s];)s--;t.bl_count[s]--,t.bl_count[s+1]+=2,t.bl_count[p]--,m-=2}while(0<m);for(s=p;0!==s;s--)for(i=t.bl_count[s];0!==i;)u<(n=t.heap[--r])||(h[2*n+1]!==s&&(t.opt_len+=(s-h[2*n+1])*h[2*n],h[2*n+1]=s),i--)}}(t,e),Z(s,u,t.bl_count)}function X(t,e,r){var i,n,s=-1,a=e[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),e[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=e[2*(i+1)+1],++o<h&&n===a||(o<u?t.bl_tree[2*n]+=o:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[2*b]++):o<=10?t.bl_tree[2*v]++:t.bl_tree[2*y]++,s=n,u=(o=0)===a?(h=138,3):n===a?(h=6,3):(h=7,4))}function V(t,e,r){var i,n,s=-1,a=e[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),i=0;i<=r;i++)if(n=a,a=e[2*(i+1)+1],!(++o<h&&n===a)){if(o<u)for(;L(t,n,t.bl_tree),0!=--o;);else 0!==n?(n!==s&&(L(t,n,t.bl_tree),o--),L(t,b,t.bl_tree),P(t,o-3,2)):o<=10?(L(t,v,t.bl_tree),P(t,o-3,3)):(L(t,y,t.bl_tree),P(t,o-11,7));s=n,u=(o=0)===a?(h=138,3):n===a?(h=6,3):(h=7,4)}}i(T);var q=!1;function J(t,e,r,i){P(t,(s<<1)+(i?1:0),3),function(t,e,r,i){M(t),i&&(U(t,r),U(t,~r)),n.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}(t,e,r,!0)}r._tr_init=function(t){q||(function(){var t,e,r,i,n,s=new Array(g+1);for(i=r=0;i<a-1;i++)for(I[i]=r,t=0;t<1<<w[i];t++)A[r++]=i;for(A[r-1]=i,i=n=0;i<16;i++)for(T[i]=n,t=0;t<1<<k[i];t++)E[n++]=i;for(n>>=7;i<f;i++)for(T[i]=n<<7,t=0;t<1<<k[i]-7;t++)E[256+n++]=i;for(e=0;e<=g;e++)s[e]=0;for(t=0;t<=143;)z[2*t+1]=8,t++,s[8]++;for(;t<=255;)z[2*t+1]=9,t++,s[9]++;for(;t<=279;)z[2*t+1]=7,t++,s[7]++;for(;t<=287;)z[2*t+1]=8,t++,s[8]++;for(Z(z,l+1,s),t=0;t<f;t++)C[2*t+1]=5,C[2*t]=j(t,5);O=new D(z,w,u+1,l,g),B=new D(C,k,0,f,g),R=new D(new Array(0),x,0,d,p)}(),q=!0),t.l_desc=new F(t.dyn_ltree,O),t.d_desc=new F(t.dyn_dtree,B),t.bl_desc=new F(t.bl_tree,R),t.bi_buf=0,t.bi_valid=0,W(t)},r._tr_stored_block=J,r._tr_flush_block=function(t,e,r,i){var n,s,a=0;0<t.level?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return o;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return h;for(e=32;e<u;e++)if(0!==t.dyn_ltree[2*e])return h;return o}(t)),Y(t,t.l_desc),Y(t,t.d_desc),a=function(t){var e;for(X(t,t.dyn_ltree,t.l_desc.max_code),X(t,t.dyn_dtree,t.d_desc.max_code),Y(t,t.bl_desc),e=d-1;3<=e&&0===t.bl_tree[2*S[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(s=t.static_len+3+7>>>3)<=n&&(n=s)):n=s=r+5,r+4<=n&&-1!==e?J(t,e,r,i):4===t.strategy||s===n?(P(t,2+(i?1:0),3),K(t,z,C)):(P(t,4+(i?1:0),3),function(t,e,r,i){var n;for(P(t,e-257,5),P(t,r-1,5),P(t,i-4,4),n=0;n<i;n++)P(t,t.bl_tree[2*S[n]+1],3);V(t,t.dyn_ltree,e-1),V(t,t.dyn_dtree,r-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),K(t,t.dyn_ltree,t.dyn_dtree)),W(t),i&&M(t)},r._tr_tally=function(t,e,r){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(A[r]+u+1)]++,t.dyn_dtree[2*N(e)]++),t.last_lit===t.lit_bufsize-1},r._tr_align=function(t){P(t,2,3),L(t,m,z),function(t){16===t.bi_valid?(U(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},{"../utils/common":41}],53:[function(t,e,r){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,r){"use strict";e.exports="function"==typeof setImmediate?setImmediate:function(){var t=[].slice.apply(arguments);t.splice(1,0,0),setTimeout.apply(null,t)}},{}]},{},[10])(10)});
  14464. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
  14465. },{"buffer":83}],89:[function(require,module,exports){
  14466. exports.Parser = require("./lib/parser").Parser;
  14467. exports.rules = require("./lib/rules");
  14468. exports.errors = require("./lib/errors");
  14469. exports.results = require("./lib/parsing-results");
  14470. exports.StringSource = require("./lib/StringSource");
  14471. exports.Token = require("./lib/Token");
  14472. exports.bottomUp = require("./lib/bottom-up");
  14473. exports.RegexTokeniser = require("./lib/regex-tokeniser").RegexTokeniser;
  14474. exports.rule = function(ruleBuilder) {
  14475. var rule;
  14476. return function(input) {
  14477. if (!rule) {
  14478. rule = ruleBuilder();
  14479. }
  14480. return rule(input);
  14481. };
  14482. };
  14483. },{"./lib/StringSource":90,"./lib/Token":91,"./lib/bottom-up":93,"./lib/errors":94,"./lib/parser":96,"./lib/parsing-results":97,"./lib/regex-tokeniser":98,"./lib/rules":99}],90:[function(require,module,exports){
  14484. var util = require("util");
  14485. var StringSource = module.exports = function(string, description) {
  14486. var self = {
  14487. asString: function() {
  14488. return string;
  14489. },
  14490. range: function(startIndex, endIndex) {
  14491. return new StringSourceRange(string, description, startIndex, endIndex);
  14492. }
  14493. };
  14494. return self;
  14495. };
  14496. var StringSourceRange = function(string, description, startIndex, endIndex) {
  14497. this._string = string;
  14498. this._description = description;
  14499. this._startIndex = startIndex;
  14500. this._endIndex = endIndex;
  14501. };
  14502. StringSourceRange.prototype.to = function(otherRange) {
  14503. // TODO: Assert that tokens are the same across both iterators
  14504. return new StringSourceRange(this._string, this._description, this._startIndex, otherRange._endIndex);
  14505. };
  14506. StringSourceRange.prototype.describe = function() {
  14507. var position = this._position();
  14508. var description = this._description ? this._description + "\n" : "";
  14509. return util.format("%sLine number: %s\nCharacter number: %s",
  14510. description, position.lineNumber, position.characterNumber);
  14511. };
  14512. StringSourceRange.prototype.lineNumber = function() {
  14513. return this._position().lineNumber;
  14514. };
  14515. StringSourceRange.prototype.characterNumber = function() {
  14516. return this._position().characterNumber;
  14517. };
  14518. StringSourceRange.prototype._position = function() {
  14519. var self = this;
  14520. var index = 0;
  14521. var nextNewLine = function() {
  14522. return self._string.indexOf("\n", index);
  14523. };
  14524. var lineNumber = 1;
  14525. while (nextNewLine() !== -1 && nextNewLine() < this._startIndex) {
  14526. index = nextNewLine() + 1;
  14527. lineNumber += 1;
  14528. }
  14529. var characterNumber = this._startIndex - index + 1;
  14530. return {lineNumber: lineNumber, characterNumber: characterNumber};
  14531. };
  14532. },{"util":105}],91:[function(require,module,exports){
  14533. module.exports = function(name, value, source) {
  14534. this.name = name;
  14535. this.value = value;
  14536. if (source) {
  14537. this.source = source;
  14538. }
  14539. };
  14540. },{}],92:[function(require,module,exports){
  14541. var TokenIterator = module.exports = function(tokens, startIndex) {
  14542. this._tokens = tokens;
  14543. this._startIndex = startIndex || 0;
  14544. };
  14545. TokenIterator.prototype.head = function() {
  14546. return this._tokens[this._startIndex];
  14547. };
  14548. TokenIterator.prototype.tail = function(startIndex) {
  14549. return new TokenIterator(this._tokens, this._startIndex + 1);
  14550. };
  14551. TokenIterator.prototype.toArray = function() {
  14552. return this._tokens.slice(this._startIndex);
  14553. };
  14554. TokenIterator.prototype.end = function() {
  14555. return this._tokens[this._tokens.length - 1];
  14556. };
  14557. // TODO: doesn't need to be a method, can be a separate function,
  14558. // which simplifies implementation of the TokenIterator interface
  14559. TokenIterator.prototype.to = function(end) {
  14560. var start = this.head().source;
  14561. var endToken = end.head() || end.end();
  14562. return start.to(endToken.source);
  14563. };
  14564. },{}],93:[function(require,module,exports){
  14565. var rules = require("./rules");
  14566. var results = require("./parsing-results");
  14567. exports.parser = function(name, prefixRules, infixRuleBuilders) {
  14568. var self = {
  14569. rule: rule,
  14570. leftAssociative: leftAssociative,
  14571. rightAssociative: rightAssociative
  14572. };
  14573. var infixRules = new InfixRules(infixRuleBuilders.map(createInfixRule));
  14574. var prefixRule = rules.firstOf(name, prefixRules);
  14575. function createInfixRule(infixRuleBuilder) {
  14576. return {
  14577. name: infixRuleBuilder.name,
  14578. rule: lazyRule(infixRuleBuilder.ruleBuilder.bind(null, self))
  14579. };
  14580. }
  14581. function rule() {
  14582. return createRule(infixRules);
  14583. }
  14584. function leftAssociative(name) {
  14585. return createRule(infixRules.untilExclusive(name));
  14586. }
  14587. function rightAssociative(name) {
  14588. return createRule(infixRules.untilInclusive(name));
  14589. }
  14590. function createRule(infixRules) {
  14591. return apply.bind(null, infixRules);
  14592. }
  14593. function apply(infixRules, tokens) {
  14594. var leftResult = prefixRule(tokens);
  14595. if (leftResult.isSuccess()) {
  14596. return infixRules.apply(leftResult);
  14597. } else {
  14598. return leftResult;
  14599. }
  14600. }
  14601. return self;
  14602. };
  14603. function InfixRules(infixRules) {
  14604. function untilExclusive(name) {
  14605. return new InfixRules(infixRules.slice(0, ruleNames().indexOf(name)));
  14606. }
  14607. function untilInclusive(name) {
  14608. return new InfixRules(infixRules.slice(0, ruleNames().indexOf(name) + 1));
  14609. }
  14610. function ruleNames() {
  14611. return infixRules.map(function(rule) {
  14612. return rule.name;
  14613. });
  14614. }
  14615. function apply(leftResult) {
  14616. var currentResult;
  14617. var source;
  14618. while (true) {
  14619. currentResult = applyToTokens(leftResult.remaining());
  14620. if (currentResult.isSuccess()) {
  14621. source = leftResult.source().to(currentResult.source());
  14622. leftResult = results.success(
  14623. currentResult.value()(leftResult.value(), source),
  14624. currentResult.remaining(),
  14625. source
  14626. )
  14627. } else if (currentResult.isFailure()) {
  14628. return leftResult;
  14629. } else {
  14630. return currentResult;
  14631. }
  14632. }
  14633. }
  14634. function applyToTokens(tokens) {
  14635. return rules.firstOf("infix", infixRules.map(function(infix) {
  14636. return infix.rule;
  14637. }))(tokens);
  14638. }
  14639. return {
  14640. apply: apply,
  14641. untilExclusive: untilExclusive,
  14642. untilInclusive: untilInclusive
  14643. }
  14644. }
  14645. exports.infix = function(name, ruleBuilder) {
  14646. function map(func) {
  14647. return exports.infix(name, function(parser) {
  14648. var rule = ruleBuilder(parser);
  14649. return function(tokens) {
  14650. var result = rule(tokens);
  14651. return result.map(function(right) {
  14652. return function(left, source) {
  14653. return func(left, right, source);
  14654. };
  14655. });
  14656. };
  14657. });
  14658. }
  14659. return {
  14660. name: name,
  14661. ruleBuilder: ruleBuilder,
  14662. map: map
  14663. };
  14664. }
  14665. // TODO: move into a sensible place and remove duplication
  14666. var lazyRule = function(ruleBuilder) {
  14667. var rule;
  14668. return function(input) {
  14669. if (!rule) {
  14670. rule = ruleBuilder();
  14671. }
  14672. return rule(input);
  14673. };
  14674. };
  14675. },{"./parsing-results":97,"./rules":99}],94:[function(require,module,exports){
  14676. exports.error = function(options) {
  14677. return new Error(options);
  14678. };
  14679. var Error = function(options) {
  14680. this.expected = options.expected;
  14681. this.actual = options.actual;
  14682. this._location = options.location;
  14683. };
  14684. Error.prototype.describe = function() {
  14685. var locationDescription = this._location ? this._location.describe() + ":\n" : "";
  14686. return locationDescription + "Expected " + this.expected + "\nbut got " + this.actual;
  14687. };
  14688. Error.prototype.lineNumber = function() {
  14689. return this._location.lineNumber();
  14690. };
  14691. Error.prototype.characterNumber = function() {
  14692. return this._location.characterNumber();
  14693. };
  14694. },{}],95:[function(require,module,exports){
  14695. var fromArray = exports.fromArray = function(array) {
  14696. var index = 0;
  14697. var hasNext = function() {
  14698. return index < array.length;
  14699. };
  14700. return new LazyIterator({
  14701. hasNext: hasNext,
  14702. next: function() {
  14703. if (!hasNext()) {
  14704. throw new Error("No more elements");
  14705. } else {
  14706. return array[index++];
  14707. }
  14708. }
  14709. });
  14710. };
  14711. var LazyIterator = function(iterator) {
  14712. this._iterator = iterator;
  14713. };
  14714. LazyIterator.prototype.map = function(func) {
  14715. var iterator = this._iterator;
  14716. return new LazyIterator({
  14717. hasNext: function() {
  14718. return iterator.hasNext();
  14719. },
  14720. next: function() {
  14721. return func(iterator.next());
  14722. }
  14723. });
  14724. };
  14725. LazyIterator.prototype.filter = function(condition) {
  14726. var iterator = this._iterator;
  14727. var moved = false;
  14728. var hasNext = false;
  14729. var next;
  14730. var moveIfNecessary = function() {
  14731. if (moved) {
  14732. return;
  14733. }
  14734. moved = true;
  14735. hasNext = false;
  14736. while (iterator.hasNext() && !hasNext) {
  14737. next = iterator.next();
  14738. hasNext = condition(next);
  14739. }
  14740. };
  14741. return new LazyIterator({
  14742. hasNext: function() {
  14743. moveIfNecessary();
  14744. return hasNext;
  14745. },
  14746. next: function() {
  14747. moveIfNecessary();
  14748. var toReturn = next;
  14749. moved = false;
  14750. return toReturn;
  14751. }
  14752. });
  14753. };
  14754. LazyIterator.prototype.first = function() {
  14755. var iterator = this._iterator;
  14756. if (this._iterator.hasNext()) {
  14757. return iterator.next();
  14758. } else {
  14759. return null;
  14760. }
  14761. };
  14762. LazyIterator.prototype.toArray = function() {
  14763. var result = [];
  14764. while (this._iterator.hasNext()) {
  14765. result.push(this._iterator.next());
  14766. }
  14767. return result;
  14768. };
  14769. },{}],96:[function(require,module,exports){
  14770. var TokenIterator = require("./TokenIterator");
  14771. exports.Parser = function(options) {
  14772. var parseTokens = function(parser, tokens) {
  14773. return parser(new TokenIterator(tokens));
  14774. };
  14775. return {
  14776. parseTokens: parseTokens
  14777. };
  14778. };
  14779. },{"./TokenIterator":92}],97:[function(require,module,exports){
  14780. module.exports = {
  14781. failure: function(errors, remaining) {
  14782. if (errors.length < 1) {
  14783. throw new Error("Failure must have errors");
  14784. }
  14785. return new Result({
  14786. status: "failure",
  14787. remaining: remaining,
  14788. errors: errors
  14789. });
  14790. },
  14791. error: function(errors, remaining) {
  14792. if (errors.length < 1) {
  14793. throw new Error("Failure must have errors");
  14794. }
  14795. return new Result({
  14796. status: "error",
  14797. remaining: remaining,
  14798. errors: errors
  14799. });
  14800. },
  14801. success: function(value, remaining, source) {
  14802. return new Result({
  14803. status: "success",
  14804. value: value,
  14805. source: source,
  14806. remaining: remaining,
  14807. errors: []
  14808. });
  14809. },
  14810. cut: function(remaining) {
  14811. return new Result({
  14812. status: "cut",
  14813. remaining: remaining,
  14814. errors: []
  14815. });
  14816. }
  14817. };
  14818. var Result = function(options) {
  14819. this._value = options.value;
  14820. this._status = options.status;
  14821. this._hasValue = options.value !== undefined;
  14822. this._remaining = options.remaining;
  14823. this._source = options.source;
  14824. this._errors = options.errors;
  14825. };
  14826. Result.prototype.map = function(func) {
  14827. if (this._hasValue) {
  14828. return new Result({
  14829. value: func(this._value, this._source),
  14830. status: this._status,
  14831. remaining: this._remaining,
  14832. source: this._source,
  14833. errors: this._errors
  14834. });
  14835. } else {
  14836. return this;
  14837. }
  14838. };
  14839. Result.prototype.changeRemaining = function(remaining) {
  14840. return new Result({
  14841. value: this._value,
  14842. status: this._status,
  14843. remaining: remaining,
  14844. source: this._source,
  14845. errors: this._errors
  14846. });
  14847. };
  14848. Result.prototype.isSuccess = function() {
  14849. return this._status === "success" || this._status === "cut";
  14850. };
  14851. Result.prototype.isFailure = function() {
  14852. return this._status === "failure";
  14853. };
  14854. Result.prototype.isError = function() {
  14855. return this._status === "error";
  14856. };
  14857. Result.prototype.isCut = function() {
  14858. return this._status === "cut";
  14859. };
  14860. Result.prototype.value = function() {
  14861. return this._value;
  14862. };
  14863. Result.prototype.remaining = function() {
  14864. return this._remaining;
  14865. };
  14866. Result.prototype.source = function() {
  14867. return this._source;
  14868. };
  14869. Result.prototype.errors = function() {
  14870. return this._errors;
  14871. };
  14872. },{}],98:[function(require,module,exports){
  14873. var Token = require("./Token");
  14874. var StringSource = require("./StringSource");
  14875. exports.RegexTokeniser = RegexTokeniser;
  14876. function RegexTokeniser(rules) {
  14877. rules = rules.map(function(rule) {
  14878. return {
  14879. name: rule.name,
  14880. regex: new RegExp(rule.regex.source, "g")
  14881. };
  14882. });
  14883. function tokenise(input, description) {
  14884. var source = new StringSource(input, description);
  14885. var index = 0;
  14886. var tokens = [];
  14887. while (index < input.length) {
  14888. var result = readNextToken(input, index, source);
  14889. index = result.endIndex;
  14890. tokens.push(result.token);
  14891. }
  14892. tokens.push(endToken(input, source));
  14893. return tokens;
  14894. }
  14895. function readNextToken(string, startIndex, source) {
  14896. for (var i = 0; i < rules.length; i++) {
  14897. var regex = rules[i].regex;
  14898. regex.lastIndex = startIndex;
  14899. var result = regex.exec(string);
  14900. if (result) {
  14901. var endIndex = startIndex + result[0].length;
  14902. if (result.index === startIndex && endIndex > startIndex) {
  14903. var value = result[1];
  14904. var token = new Token(
  14905. rules[i].name,
  14906. value,
  14907. source.range(startIndex, endIndex)
  14908. );
  14909. return {token: token, endIndex: endIndex};
  14910. }
  14911. }
  14912. }
  14913. var endIndex = startIndex + 1;
  14914. var token = new Token(
  14915. "unrecognisedCharacter",
  14916. string.substring(startIndex, endIndex),
  14917. source.range(startIndex, endIndex)
  14918. );
  14919. return {token: token, endIndex: endIndex};
  14920. }
  14921. function endToken(input, source) {
  14922. return new Token(
  14923. "end",
  14924. null,
  14925. source.range(input.length, input.length)
  14926. );
  14927. }
  14928. return {
  14929. tokenise: tokenise
  14930. }
  14931. }
  14932. },{"./StringSource":90,"./Token":91}],99:[function(require,module,exports){
  14933. var _ = require("underscore");
  14934. var options = require("option");
  14935. var results = require("./parsing-results");
  14936. var errors = require("./errors");
  14937. var lazyIterators = require("./lazy-iterators");
  14938. exports.token = function(tokenType, value) {
  14939. var matchValue = value !== undefined;
  14940. return function(input) {
  14941. var token = input.head();
  14942. if (token && token.name === tokenType && (!matchValue || token.value === value)) {
  14943. return results.success(token.value, input.tail(), token.source);
  14944. } else {
  14945. var expected = describeToken({name: tokenType, value: value});
  14946. return describeTokenMismatch(input, expected);
  14947. }
  14948. };
  14949. };
  14950. exports.tokenOfType = function(tokenType) {
  14951. return exports.token(tokenType);
  14952. };
  14953. exports.firstOf = function(name, parsers) {
  14954. if (!_.isArray(parsers)) {
  14955. parsers = Array.prototype.slice.call(arguments, 1);
  14956. }
  14957. return function(input) {
  14958. return lazyIterators
  14959. .fromArray(parsers)
  14960. .map(function(parser) {
  14961. return parser(input);
  14962. })
  14963. .filter(function(result) {
  14964. return result.isSuccess() || result.isError();
  14965. })
  14966. .first() || describeTokenMismatch(input, name);
  14967. };
  14968. };
  14969. exports.then = function(parser, func) {
  14970. return function(input) {
  14971. var result = parser(input);
  14972. if (!result.map) {
  14973. console.log(result);
  14974. }
  14975. return result.map(func);
  14976. };
  14977. };
  14978. exports.sequence = function() {
  14979. var parsers = Array.prototype.slice.call(arguments, 0);
  14980. var rule = function(input) {
  14981. var result = _.foldl(parsers, function(memo, parser) {
  14982. var result = memo.result;
  14983. var hasCut = memo.hasCut;
  14984. if (!result.isSuccess()) {
  14985. return {result: result, hasCut: hasCut};
  14986. }
  14987. var subResult = parser(result.remaining());
  14988. if (subResult.isCut()) {
  14989. return {result: result, hasCut: true};
  14990. } else if (subResult.isSuccess()) {
  14991. var values;
  14992. if (parser.isCaptured) {
  14993. values = result.value().withValue(parser, subResult.value());
  14994. } else {
  14995. values = result.value();
  14996. }
  14997. var remaining = subResult.remaining();
  14998. var source = input.to(remaining);
  14999. return {
  15000. result: results.success(values, remaining, source),
  15001. hasCut: hasCut
  15002. };
  15003. } else if (hasCut) {
  15004. return {result: results.error(subResult.errors(), subResult.remaining()), hasCut: hasCut};
  15005. } else {
  15006. return {result: subResult, hasCut: hasCut};
  15007. }
  15008. }, {result: results.success(new SequenceValues(), input), hasCut: false}).result;
  15009. var source = input.to(result.remaining());
  15010. return result.map(function(values) {
  15011. return values.withValue(exports.sequence.source, source);
  15012. });
  15013. };
  15014. rule.head = function() {
  15015. var firstCapture = _.find(parsers, isCapturedRule);
  15016. return exports.then(
  15017. rule,
  15018. exports.sequence.extract(firstCapture)
  15019. );
  15020. };
  15021. rule.map = function(func) {
  15022. return exports.then(
  15023. rule,
  15024. function(result) {
  15025. return func.apply(this, result.toArray());
  15026. }
  15027. );
  15028. };
  15029. function isCapturedRule(subRule) {
  15030. return subRule.isCaptured;
  15031. }
  15032. return rule;
  15033. };
  15034. var SequenceValues = function(values, valuesArray) {
  15035. this._values = values || {};
  15036. this._valuesArray = valuesArray || [];
  15037. };
  15038. SequenceValues.prototype.withValue = function(rule, value) {
  15039. if (rule.captureName && rule.captureName in this._values) {
  15040. throw new Error("Cannot add second value for capture \"" + rule.captureName + "\"");
  15041. } else {
  15042. var newValues = _.clone(this._values);
  15043. newValues[rule.captureName] = value;
  15044. var newValuesArray = this._valuesArray.concat([value]);
  15045. return new SequenceValues(newValues, newValuesArray);
  15046. }
  15047. };
  15048. SequenceValues.prototype.get = function(rule) {
  15049. if (rule.captureName in this._values) {
  15050. return this._values[rule.captureName];
  15051. } else {
  15052. throw new Error("No value for capture \"" + rule.captureName + "\"");
  15053. }
  15054. };
  15055. SequenceValues.prototype.toArray = function() {
  15056. return this._valuesArray;
  15057. };
  15058. exports.sequence.capture = function(rule, name) {
  15059. var captureRule = function() {
  15060. return rule.apply(this, arguments);
  15061. };
  15062. captureRule.captureName = name;
  15063. captureRule.isCaptured = true;
  15064. return captureRule;
  15065. };
  15066. exports.sequence.extract = function(rule) {
  15067. return function(result) {
  15068. return result.get(rule);
  15069. };
  15070. };
  15071. exports.sequence.applyValues = function(func) {
  15072. // TODO: check captureName doesn't conflict with source or other captures
  15073. var rules = Array.prototype.slice.call(arguments, 1);
  15074. return function(result) {
  15075. var values = rules.map(function(rule) {
  15076. return result.get(rule);
  15077. });
  15078. return func.apply(this, values);
  15079. };
  15080. };
  15081. exports.sequence.source = {
  15082. captureName: "☃source☃"
  15083. };
  15084. exports.sequence.cut = function() {
  15085. return function(input) {
  15086. return results.cut(input);
  15087. };
  15088. };
  15089. exports.optional = function(rule) {
  15090. return function(input) {
  15091. var result = rule(input);
  15092. if (result.isSuccess()) {
  15093. return result.map(options.some);
  15094. } else if (result.isFailure()) {
  15095. return results.success(options.none, input);
  15096. } else {
  15097. return result;
  15098. }
  15099. };
  15100. };
  15101. exports.zeroOrMoreWithSeparator = function(rule, separator) {
  15102. return repeatedWithSeparator(rule, separator, false);
  15103. };
  15104. exports.oneOrMoreWithSeparator = function(rule, separator) {
  15105. return repeatedWithSeparator(rule, separator, true);
  15106. };
  15107. var zeroOrMore = exports.zeroOrMore = function(rule) {
  15108. return function(input) {
  15109. var values = [];
  15110. var result;
  15111. while ((result = rule(input)) && result.isSuccess()) {
  15112. input = result.remaining();
  15113. values.push(result.value());
  15114. }
  15115. if (result.isError()) {
  15116. return result;
  15117. } else {
  15118. return results.success(values, input);
  15119. }
  15120. };
  15121. };
  15122. exports.oneOrMore = function(rule) {
  15123. return exports.oneOrMoreWithSeparator(rule, noOpRule);
  15124. };
  15125. function noOpRule(input) {
  15126. return results.success(null, input);
  15127. }
  15128. var repeatedWithSeparator = function(rule, separator, isOneOrMore) {
  15129. return function(input) {
  15130. var result = rule(input);
  15131. if (result.isSuccess()) {
  15132. var mainRule = exports.sequence.capture(rule, "main");
  15133. var remainingRule = zeroOrMore(exports.then(
  15134. exports.sequence(separator, mainRule),
  15135. exports.sequence.extract(mainRule)
  15136. ));
  15137. var remainingResult = remainingRule(result.remaining());
  15138. return results.success([result.value()].concat(remainingResult.value()), remainingResult.remaining());
  15139. } else if (isOneOrMore || result.isError()) {
  15140. return result;
  15141. } else {
  15142. return results.success([], input);
  15143. }
  15144. };
  15145. };
  15146. exports.leftAssociative = function(leftRule, rightRule, func) {
  15147. var rights;
  15148. if (func) {
  15149. rights = [{func: func, rule: rightRule}];
  15150. } else {
  15151. rights = rightRule;
  15152. }
  15153. rights = rights.map(function(right) {
  15154. return exports.then(right.rule, function(rightValue) {
  15155. return function(leftValue, source) {
  15156. return right.func(leftValue, rightValue, source);
  15157. };
  15158. });
  15159. });
  15160. var repeatedRule = exports.firstOf.apply(null, ["rules"].concat(rights));
  15161. return function(input) {
  15162. var start = input;
  15163. var leftResult = leftRule(input);
  15164. if (!leftResult.isSuccess()) {
  15165. return leftResult;
  15166. }
  15167. var repeatedResult = repeatedRule(leftResult.remaining());
  15168. while (repeatedResult.isSuccess()) {
  15169. var remaining = repeatedResult.remaining();
  15170. var source = start.to(repeatedResult.remaining());
  15171. var right = repeatedResult.value();
  15172. leftResult = results.success(
  15173. right(leftResult.value(), source),
  15174. remaining,
  15175. source
  15176. );
  15177. repeatedResult = repeatedRule(leftResult.remaining());
  15178. }
  15179. if (repeatedResult.isError()) {
  15180. return repeatedResult;
  15181. }
  15182. return leftResult;
  15183. };
  15184. };
  15185. exports.leftAssociative.firstOf = function() {
  15186. return Array.prototype.slice.call(arguments, 0);
  15187. };
  15188. exports.nonConsuming = function(rule) {
  15189. return function(input) {
  15190. return rule(input).changeRemaining(input);
  15191. };
  15192. };
  15193. var describeToken = function(token) {
  15194. if (token.value) {
  15195. return token.name + " \"" + token.value + "\"";
  15196. } else {
  15197. return token.name;
  15198. }
  15199. };
  15200. function describeTokenMismatch(input, expected) {
  15201. var error;
  15202. var token = input.head();
  15203. if (token) {
  15204. error = errors.error({
  15205. expected: expected,
  15206. actual: describeToken(token),
  15207. location: token.source
  15208. });
  15209. } else {
  15210. error = errors.error({
  15211. expected: expected,
  15212. actual: "end of tokens"
  15213. });
  15214. }
  15215. return results.failure([error], input);
  15216. }
  15217. },{"./errors":94,"./lazy-iterators":95,"./parsing-results":97,"option":100,"underscore":102}],100:[function(require,module,exports){
  15218. exports.none = Object.create({
  15219. value: function() {
  15220. throw new Error('Called value on none');
  15221. },
  15222. isNone: function() {
  15223. return true;
  15224. },
  15225. isSome: function() {
  15226. return false;
  15227. },
  15228. map: function() {
  15229. return exports.none;
  15230. },
  15231. flatMap: function() {
  15232. return exports.none;
  15233. },
  15234. filter: function() {
  15235. return exports.none;
  15236. },
  15237. toArray: function() {
  15238. return [];
  15239. },
  15240. orElse: callOrReturn,
  15241. valueOrElse: callOrReturn
  15242. });
  15243. function callOrReturn(value) {
  15244. if (typeof(value) == "function") {
  15245. return value();
  15246. } else {
  15247. return value;
  15248. }
  15249. }
  15250. exports.some = function(value) {
  15251. return new Some(value);
  15252. };
  15253. var Some = function(value) {
  15254. this._value = value;
  15255. };
  15256. Some.prototype.value = function() {
  15257. return this._value;
  15258. };
  15259. Some.prototype.isNone = function() {
  15260. return false;
  15261. };
  15262. Some.prototype.isSome = function() {
  15263. return true;
  15264. };
  15265. Some.prototype.map = function(func) {
  15266. return new Some(func(this._value));
  15267. };
  15268. Some.prototype.flatMap = function(func) {
  15269. return func(this._value);
  15270. };
  15271. Some.prototype.filter = function(predicate) {
  15272. return predicate(this._value) ? this : exports.none;
  15273. };
  15274. Some.prototype.toArray = function() {
  15275. return [this._value];
  15276. };
  15277. Some.prototype.orElse = function(value) {
  15278. return this;
  15279. };
  15280. Some.prototype.valueOrElse = function(value) {
  15281. return this._value;
  15282. };
  15283. exports.isOption = function(value) {
  15284. return value === exports.none || value instanceof Some;
  15285. };
  15286. exports.fromNullable = function(value) {
  15287. if (value == null) {
  15288. return exports.none;
  15289. }
  15290. return new Some(value);
  15291. }
  15292. },{}],101:[function(require,module,exports){
  15293. // shim for using process in browser
  15294. var process = module.exports = {};
  15295. // cached from whatever global is present so that test runners that stub it
  15296. // don't break things. But we need to wrap it in a try catch in case it is
  15297. // wrapped in strict mode code which doesn't define any globals. It's inside a
  15298. // function because try/catches deoptimize in certain engines.
  15299. var cachedSetTimeout;
  15300. var cachedClearTimeout;
  15301. function defaultSetTimout() {
  15302. throw new Error('setTimeout has not been defined');
  15303. }
  15304. function defaultClearTimeout () {
  15305. throw new Error('clearTimeout has not been defined');
  15306. }
  15307. (function () {
  15308. try {
  15309. if (typeof setTimeout === 'function') {
  15310. cachedSetTimeout = setTimeout;
  15311. } else {
  15312. cachedSetTimeout = defaultSetTimout;
  15313. }
  15314. } catch (e) {
  15315. cachedSetTimeout = defaultSetTimout;
  15316. }
  15317. try {
  15318. if (typeof clearTimeout === 'function') {
  15319. cachedClearTimeout = clearTimeout;
  15320. } else {
  15321. cachedClearTimeout = defaultClearTimeout;
  15322. }
  15323. } catch (e) {
  15324. cachedClearTimeout = defaultClearTimeout;
  15325. }
  15326. } ())
  15327. function runTimeout(fun) {
  15328. if (cachedSetTimeout === setTimeout) {
  15329. //normal enviroments in sane situations
  15330. return setTimeout(fun, 0);
  15331. }
  15332. // if setTimeout wasn't available but was latter defined
  15333. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  15334. cachedSetTimeout = setTimeout;
  15335. return setTimeout(fun, 0);
  15336. }
  15337. try {
  15338. // when when somebody has screwed with setTimeout but no I.E. maddness
  15339. return cachedSetTimeout(fun, 0);
  15340. } catch(e){
  15341. try {
  15342. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  15343. return cachedSetTimeout.call(null, fun, 0);
  15344. } catch(e){
  15345. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  15346. return cachedSetTimeout.call(this, fun, 0);
  15347. }
  15348. }
  15349. }
  15350. function runClearTimeout(marker) {
  15351. if (cachedClearTimeout === clearTimeout) {
  15352. //normal enviroments in sane situations
  15353. return clearTimeout(marker);
  15354. }
  15355. // if clearTimeout wasn't available but was latter defined
  15356. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  15357. cachedClearTimeout = clearTimeout;
  15358. return clearTimeout(marker);
  15359. }
  15360. try {
  15361. // when when somebody has screwed with setTimeout but no I.E. maddness
  15362. return cachedClearTimeout(marker);
  15363. } catch (e){
  15364. try {
  15365. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  15366. return cachedClearTimeout.call(null, marker);
  15367. } catch (e){
  15368. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  15369. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  15370. return cachedClearTimeout.call(this, marker);
  15371. }
  15372. }
  15373. }
  15374. var queue = [];
  15375. var draining = false;
  15376. var currentQueue;
  15377. var queueIndex = -1;
  15378. function cleanUpNextTick() {
  15379. if (!draining || !currentQueue) {
  15380. return;
  15381. }
  15382. draining = false;
  15383. if (currentQueue.length) {
  15384. queue = currentQueue.concat(queue);
  15385. } else {
  15386. queueIndex = -1;
  15387. }
  15388. if (queue.length) {
  15389. drainQueue();
  15390. }
  15391. }
  15392. function drainQueue() {
  15393. if (draining) {
  15394. return;
  15395. }
  15396. var timeout = runTimeout(cleanUpNextTick);
  15397. draining = true;
  15398. var len = queue.length;
  15399. while(len) {
  15400. currentQueue = queue;
  15401. queue = [];
  15402. while (++queueIndex < len) {
  15403. if (currentQueue) {
  15404. currentQueue[queueIndex].run();
  15405. }
  15406. }
  15407. queueIndex = -1;
  15408. len = queue.length;
  15409. }
  15410. currentQueue = null;
  15411. draining = false;
  15412. runClearTimeout(timeout);
  15413. }
  15414. process.nextTick = function (fun) {
  15415. var args = new Array(arguments.length - 1);
  15416. if (arguments.length > 1) {
  15417. for (var i = 1; i < arguments.length; i++) {
  15418. args[i - 1] = arguments[i];
  15419. }
  15420. }
  15421. queue.push(new Item(fun, args));
  15422. if (queue.length === 1 && !draining) {
  15423. runTimeout(drainQueue);
  15424. }
  15425. };
  15426. // v8 likes predictible objects
  15427. function Item(fun, array) {
  15428. this.fun = fun;
  15429. this.array = array;
  15430. }
  15431. Item.prototype.run = function () {
  15432. this.fun.apply(null, this.array);
  15433. };
  15434. process.title = 'browser';
  15435. process.browser = true;
  15436. process.env = {};
  15437. process.argv = [];
  15438. process.version = ''; // empty string to avoid regexp issues
  15439. process.versions = {};
  15440. function noop() {}
  15441. process.on = noop;
  15442. process.addListener = noop;
  15443. process.once = noop;
  15444. process.off = noop;
  15445. process.removeListener = noop;
  15446. process.removeAllListeners = noop;
  15447. process.emit = noop;
  15448. process.binding = function (name) {
  15449. throw new Error('process.binding is not supported');
  15450. };
  15451. process.cwd = function () { return '/' };
  15452. process.chdir = function (dir) {
  15453. throw new Error('process.chdir is not supported');
  15454. };
  15455. process.umask = function() { return 0; };
  15456. },{}],102:[function(require,module,exports){
  15457. (function (global){
  15458. (function (global, factory) {
  15459. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  15460. typeof define === 'function' && define.amd ? define('underscore', factory) :
  15461. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {
  15462. var current = global._;
  15463. var exports = global._ = factory();
  15464. exports.noConflict = function () { global._ = current; return exports; };
  15465. }()));
  15466. }(this, (function () {
  15467. // Underscore.js 1.13.1
  15468. // https://underscorejs.org
  15469. // (c) 2009-2021 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
  15470. // Underscore may be freely distributed under the MIT license.
  15471. // Current version.
  15472. var VERSION = '1.13.1';
  15473. // Establish the root object, `window` (`self`) in the browser, `global`
  15474. // on the server, or `this` in some virtual machines. We use `self`
  15475. // instead of `window` for `WebWorker` support.
  15476. var root = typeof self == 'object' && self.self === self && self ||
  15477. typeof global == 'object' && global.global === global && global ||
  15478. Function('return this')() ||
  15479. {};
  15480. // Save bytes in the minified (but not gzipped) version:
  15481. var ArrayProto = Array.prototype, ObjProto = Object.prototype;
  15482. var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
  15483. // Create quick reference variables for speed access to core prototypes.
  15484. var push = ArrayProto.push,
  15485. slice = ArrayProto.slice,
  15486. toString = ObjProto.toString,
  15487. hasOwnProperty = ObjProto.hasOwnProperty;
  15488. // Modern feature detection.
  15489. var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
  15490. supportsDataView = typeof DataView !== 'undefined';
  15491. // All **ECMAScript 5+** native function implementations that we hope to use
  15492. // are declared here.
  15493. var nativeIsArray = Array.isArray,
  15494. nativeKeys = Object.keys,
  15495. nativeCreate = Object.create,
  15496. nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
  15497. // Create references to these builtin functions because we override them.
  15498. var _isNaN = isNaN,
  15499. _isFinite = isFinite;
  15500. // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
  15501. var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
  15502. var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
  15503. 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
  15504. // The largest integer that can be represented exactly.
  15505. var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
  15506. // Some functions take a variable number of arguments, or a few expected
  15507. // arguments at the beginning and then a variable number of values to operate
  15508. // on. This helper accumulates all remaining arguments past the function’s
  15509. // argument length (or an explicit `startIndex`), into an array that becomes
  15510. // the last argument. Similar to ES6’s "rest parameter".
  15511. function restArguments(func, startIndex) {
  15512. startIndex = startIndex == null ? func.length - 1 : +startIndex;
  15513. return function() {
  15514. var length = Math.max(arguments.length - startIndex, 0),
  15515. rest = Array(length),
  15516. index = 0;
  15517. for (; index < length; index++) {
  15518. rest[index] = arguments[index + startIndex];
  15519. }
  15520. switch (startIndex) {
  15521. case 0: return func.call(this, rest);
  15522. case 1: return func.call(this, arguments[0], rest);
  15523. case 2: return func.call(this, arguments[0], arguments[1], rest);
  15524. }
  15525. var args = Array(startIndex + 1);
  15526. for (index = 0; index < startIndex; index++) {
  15527. args[index] = arguments[index];
  15528. }
  15529. args[startIndex] = rest;
  15530. return func.apply(this, args);
  15531. };
  15532. }
  15533. // Is a given variable an object?
  15534. function isObject(obj) {
  15535. var type = typeof obj;
  15536. return type === 'function' || type === 'object' && !!obj;
  15537. }
  15538. // Is a given value equal to null?
  15539. function isNull(obj) {
  15540. return obj === null;
  15541. }
  15542. // Is a given variable undefined?
  15543. function isUndefined(obj) {
  15544. return obj === void 0;
  15545. }
  15546. // Is a given value a boolean?
  15547. function isBoolean(obj) {
  15548. return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
  15549. }
  15550. // Is a given value a DOM element?
  15551. function isElement(obj) {
  15552. return !!(obj && obj.nodeType === 1);
  15553. }
  15554. // Internal function for creating a `toString`-based type tester.
  15555. function tagTester(name) {
  15556. var tag = '[object ' + name + ']';
  15557. return function(obj) {
  15558. return toString.call(obj) === tag;
  15559. };
  15560. }
  15561. var isString = tagTester('String');
  15562. var isNumber = tagTester('Number');
  15563. var isDate = tagTester('Date');
  15564. var isRegExp = tagTester('RegExp');
  15565. var isError = tagTester('Error');
  15566. var isSymbol = tagTester('Symbol');
  15567. var isArrayBuffer = tagTester('ArrayBuffer');
  15568. var isFunction = tagTester('Function');
  15569. // Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
  15570. // v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
  15571. var nodelist = root.document && root.document.childNodes;
  15572. if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
  15573. isFunction = function(obj) {
  15574. return typeof obj == 'function' || false;
  15575. };
  15576. }
  15577. var isFunction$1 = isFunction;
  15578. var hasObjectTag = tagTester('Object');
  15579. // In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
  15580. // In IE 11, the most common among them, this problem also applies to
  15581. // `Map`, `WeakMap` and `Set`.
  15582. var hasStringTagBug = (
  15583. supportsDataView && hasObjectTag(new DataView(new ArrayBuffer(8)))
  15584. ),
  15585. isIE11 = (typeof Map !== 'undefined' && hasObjectTag(new Map));
  15586. var isDataView = tagTester('DataView');
  15587. // In IE 10 - Edge 13, we need a different heuristic
  15588. // to determine whether an object is a `DataView`.
  15589. function ie10IsDataView(obj) {
  15590. return obj != null && isFunction$1(obj.getInt8) && isArrayBuffer(obj.buffer);
  15591. }
  15592. var isDataView$1 = (hasStringTagBug ? ie10IsDataView : isDataView);
  15593. // Is a given value an array?
  15594. // Delegates to ECMA5's native `Array.isArray`.
  15595. var isArray = nativeIsArray || tagTester('Array');
  15596. // Internal function to check whether `key` is an own property name of `obj`.
  15597. function has$1(obj, key) {
  15598. return obj != null && hasOwnProperty.call(obj, key);
  15599. }
  15600. var isArguments = tagTester('Arguments');
  15601. // Define a fallback version of the method in browsers (ahem, IE < 9), where
  15602. // there isn't any inspectable "Arguments" type.
  15603. (function() {
  15604. if (!isArguments(arguments)) {
  15605. isArguments = function(obj) {
  15606. return has$1(obj, 'callee');
  15607. };
  15608. }
  15609. }());
  15610. var isArguments$1 = isArguments;
  15611. // Is a given object a finite number?
  15612. function isFinite$1(obj) {
  15613. return !isSymbol(obj) && _isFinite(obj) && !isNaN(parseFloat(obj));
  15614. }
  15615. // Is the given value `NaN`?
  15616. function isNaN$1(obj) {
  15617. return isNumber(obj) && _isNaN(obj);
  15618. }
  15619. // Predicate-generating function. Often useful outside of Underscore.
  15620. function constant(value) {
  15621. return function() {
  15622. return value;
  15623. };
  15624. }
  15625. // Common internal logic for `isArrayLike` and `isBufferLike`.
  15626. function createSizePropertyCheck(getSizeProperty) {
  15627. return function(collection) {
  15628. var sizeProperty = getSizeProperty(collection);
  15629. return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= MAX_ARRAY_INDEX;
  15630. }
  15631. }
  15632. // Internal helper to generate a function to obtain property `key` from `obj`.
  15633. function shallowProperty(key) {
  15634. return function(obj) {
  15635. return obj == null ? void 0 : obj[key];
  15636. };
  15637. }
  15638. // Internal helper to obtain the `byteLength` property of an object.
  15639. var getByteLength = shallowProperty('byteLength');
  15640. // Internal helper to determine whether we should spend extensive checks against
  15641. // `ArrayBuffer` et al.
  15642. var isBufferLike = createSizePropertyCheck(getByteLength);
  15643. // Is a given value a typed array?
  15644. var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
  15645. function isTypedArray(obj) {
  15646. // `ArrayBuffer.isView` is the most future-proof, so use it when available.
  15647. // Otherwise, fall back on the above regular expression.
  15648. return nativeIsView ? (nativeIsView(obj) && !isDataView$1(obj)) :
  15649. isBufferLike(obj) && typedArrayPattern.test(toString.call(obj));
  15650. }
  15651. var isTypedArray$1 = supportsArrayBuffer ? isTypedArray : constant(false);
  15652. // Internal helper to obtain the `length` property of an object.
  15653. var getLength = shallowProperty('length');
  15654. // Internal helper to create a simple lookup structure.
  15655. // `collectNonEnumProps` used to depend on `_.contains`, but this led to
  15656. // circular imports. `emulatedSet` is a one-off solution that only works for
  15657. // arrays of strings.
  15658. function emulatedSet(keys) {
  15659. var hash = {};
  15660. for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
  15661. return {
  15662. contains: function(key) { return hash[key]; },
  15663. push: function(key) {
  15664. hash[key] = true;
  15665. return keys.push(key);
  15666. }
  15667. };
  15668. }
  15669. // Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
  15670. // be iterated by `for key in ...` and thus missed. Extends `keys` in place if
  15671. // needed.
  15672. function collectNonEnumProps(obj, keys) {
  15673. keys = emulatedSet(keys);
  15674. var nonEnumIdx = nonEnumerableProps.length;
  15675. var constructor = obj.constructor;
  15676. var proto = isFunction$1(constructor) && constructor.prototype || ObjProto;
  15677. // Constructor is a special case.
  15678. var prop = 'constructor';
  15679. if (has$1(obj, prop) && !keys.contains(prop)) keys.push(prop);
  15680. while (nonEnumIdx--) {
  15681. prop = nonEnumerableProps[nonEnumIdx];
  15682. if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
  15683. keys.push(prop);
  15684. }
  15685. }
  15686. }
  15687. // Retrieve the names of an object's own properties.
  15688. // Delegates to **ECMAScript 5**'s native `Object.keys`.
  15689. function keys(obj) {
  15690. if (!isObject(obj)) return [];
  15691. if (nativeKeys) return nativeKeys(obj);
  15692. var keys = [];
  15693. for (var key in obj) if (has$1(obj, key)) keys.push(key);
  15694. // Ahem, IE < 9.
  15695. if (hasEnumBug) collectNonEnumProps(obj, keys);
  15696. return keys;
  15697. }
  15698. // Is a given array, string, or object empty?
  15699. // An "empty" object has no enumerable own-properties.
  15700. function isEmpty(obj) {
  15701. if (obj == null) return true;
  15702. // Skip the more expensive `toString`-based type checks if `obj` has no
  15703. // `.length`.
  15704. var length = getLength(obj);
  15705. if (typeof length == 'number' && (
  15706. isArray(obj) || isString(obj) || isArguments$1(obj)
  15707. )) return length === 0;
  15708. return getLength(keys(obj)) === 0;
  15709. }
  15710. // Returns whether an object has a given set of `key:value` pairs.
  15711. function isMatch(object, attrs) {
  15712. var _keys = keys(attrs), length = _keys.length;
  15713. if (object == null) return !length;
  15714. var obj = Object(object);
  15715. for (var i = 0; i < length; i++) {
  15716. var key = _keys[i];
  15717. if (attrs[key] !== obj[key] || !(key in obj)) return false;
  15718. }
  15719. return true;
  15720. }
  15721. // If Underscore is called as a function, it returns a wrapped object that can
  15722. // be used OO-style. This wrapper holds altered versions of all functions added
  15723. // through `_.mixin`. Wrapped objects may be chained.
  15724. function _$1(obj) {
  15725. if (obj instanceof _$1) return obj;
  15726. if (!(this instanceof _$1)) return new _$1(obj);
  15727. this._wrapped = obj;
  15728. }
  15729. _$1.VERSION = VERSION;
  15730. // Extracts the result from a wrapped and chained object.
  15731. _$1.prototype.value = function() {
  15732. return this._wrapped;
  15733. };
  15734. // Provide unwrapping proxies for some methods used in engine operations
  15735. // such as arithmetic and JSON stringification.
  15736. _$1.prototype.valueOf = _$1.prototype.toJSON = _$1.prototype.value;
  15737. _$1.prototype.toString = function() {
  15738. return String(this._wrapped);
  15739. };
  15740. // Internal function to wrap or shallow-copy an ArrayBuffer,
  15741. // typed array or DataView to a new view, reusing the buffer.
  15742. function toBufferView(bufferSource) {
  15743. return new Uint8Array(
  15744. bufferSource.buffer || bufferSource,
  15745. bufferSource.byteOffset || 0,
  15746. getByteLength(bufferSource)
  15747. );
  15748. }
  15749. // We use this string twice, so give it a name for minification.
  15750. var tagDataView = '[object DataView]';
  15751. // Internal recursive comparison function for `_.isEqual`.
  15752. function eq(a, b, aStack, bStack) {
  15753. // Identical objects are equal. `0 === -0`, but they aren't identical.
  15754. // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
  15755. if (a === b) return a !== 0 || 1 / a === 1 / b;
  15756. // `null` or `undefined` only equal to itself (strict comparison).
  15757. if (a == null || b == null) return false;
  15758. // `NaN`s are equivalent, but non-reflexive.
  15759. if (a !== a) return b !== b;
  15760. // Exhaust primitive checks
  15761. var type = typeof a;
  15762. if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
  15763. return deepEq(a, b, aStack, bStack);
  15764. }
  15765. // Internal recursive comparison function for `_.isEqual`.
  15766. function deepEq(a, b, aStack, bStack) {
  15767. // Unwrap any wrapped objects.
  15768. if (a instanceof _$1) a = a._wrapped;
  15769. if (b instanceof _$1) b = b._wrapped;
  15770. // Compare `[[Class]]` names.
  15771. var className = toString.call(a);
  15772. if (className !== toString.call(b)) return false;
  15773. // Work around a bug in IE 10 - Edge 13.
  15774. if (hasStringTagBug && className == '[object Object]' && isDataView$1(a)) {
  15775. if (!isDataView$1(b)) return false;
  15776. className = tagDataView;
  15777. }
  15778. switch (className) {
  15779. // These types are compared by value.
  15780. case '[object RegExp]':
  15781. // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
  15782. case '[object String]':
  15783. // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
  15784. // equivalent to `new String("5")`.
  15785. return '' + a === '' + b;
  15786. case '[object Number]':
  15787. // `NaN`s are equivalent, but non-reflexive.
  15788. // Object(NaN) is equivalent to NaN.
  15789. if (+a !== +a) return +b !== +b;
  15790. // An `egal` comparison is performed for other numeric values.
  15791. return +a === 0 ? 1 / +a === 1 / b : +a === +b;
  15792. case '[object Date]':
  15793. case '[object Boolean]':
  15794. // Coerce dates and booleans to numeric primitive values. Dates are compared by their
  15795. // millisecond representations. Note that invalid dates with millisecond representations
  15796. // of `NaN` are not equivalent.
  15797. return +a === +b;
  15798. case '[object Symbol]':
  15799. return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b);
  15800. case '[object ArrayBuffer]':
  15801. case tagDataView:
  15802. // Coerce to typed array so we can fall through.
  15803. return deepEq(toBufferView(a), toBufferView(b), aStack, bStack);
  15804. }
  15805. var areArrays = className === '[object Array]';
  15806. if (!areArrays && isTypedArray$1(a)) {
  15807. var byteLength = getByteLength(a);
  15808. if (byteLength !== getByteLength(b)) return false;
  15809. if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
  15810. areArrays = true;
  15811. }
  15812. if (!areArrays) {
  15813. if (typeof a != 'object' || typeof b != 'object') return false;
  15814. // Objects with different constructors are not equivalent, but `Object`s or `Array`s
  15815. // from different frames are.
  15816. var aCtor = a.constructor, bCtor = b.constructor;
  15817. if (aCtor !== bCtor && !(isFunction$1(aCtor) && aCtor instanceof aCtor &&
  15818. isFunction$1(bCtor) && bCtor instanceof bCtor)
  15819. && ('constructor' in a && 'constructor' in b)) {
  15820. return false;
  15821. }
  15822. }
  15823. // Assume equality for cyclic structures. The algorithm for detecting cyclic
  15824. // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
  15825. // Initializing stack of traversed objects.
  15826. // It's done here since we only need them for objects and arrays comparison.
  15827. aStack = aStack || [];
  15828. bStack = bStack || [];
  15829. var length = aStack.length;
  15830. while (length--) {
  15831. // Linear search. Performance is inversely proportional to the number of
  15832. // unique nested structures.
  15833. if (aStack[length] === a) return bStack[length] === b;
  15834. }
  15835. // Add the first object to the stack of traversed objects.
  15836. aStack.push(a);
  15837. bStack.push(b);
  15838. // Recursively compare objects and arrays.
  15839. if (areArrays) {
  15840. // Compare array lengths to determine if a deep comparison is necessary.
  15841. length = a.length;
  15842. if (length !== b.length) return false;
  15843. // Deep compare the contents, ignoring non-numeric properties.
  15844. while (length--) {
  15845. if (!eq(a[length], b[length], aStack, bStack)) return false;
  15846. }
  15847. } else {
  15848. // Deep compare objects.
  15849. var _keys = keys(a), key;
  15850. length = _keys.length;
  15851. // Ensure that both objects contain the same number of properties before comparing deep equality.
  15852. if (keys(b).length !== length) return false;
  15853. while (length--) {
  15854. // Deep compare each member
  15855. key = _keys[length];
  15856. if (!(has$1(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
  15857. }
  15858. }
  15859. // Remove the first object from the stack of traversed objects.
  15860. aStack.pop();
  15861. bStack.pop();
  15862. return true;
  15863. }
  15864. // Perform a deep comparison to check if two objects are equal.
  15865. function isEqual(a, b) {
  15866. return eq(a, b);
  15867. }
  15868. // Retrieve all the enumerable property names of an object.
  15869. function allKeys(obj) {
  15870. if (!isObject(obj)) return [];
  15871. var keys = [];
  15872. for (var key in obj) keys.push(key);
  15873. // Ahem, IE < 9.
  15874. if (hasEnumBug) collectNonEnumProps(obj, keys);
  15875. return keys;
  15876. }
  15877. // Since the regular `Object.prototype.toString` type tests don't work for
  15878. // some types in IE 11, we use a fingerprinting heuristic instead, based
  15879. // on the methods. It's not great, but it's the best we got.
  15880. // The fingerprint method lists are defined below.
  15881. function ie11fingerprint(methods) {
  15882. var length = getLength(methods);
  15883. return function(obj) {
  15884. if (obj == null) return false;
  15885. // `Map`, `WeakMap` and `Set` have no enumerable keys.
  15886. var keys = allKeys(obj);
  15887. if (getLength(keys)) return false;
  15888. for (var i = 0; i < length; i++) {
  15889. if (!isFunction$1(obj[methods[i]])) return false;
  15890. }
  15891. // If we are testing against `WeakMap`, we need to ensure that
  15892. // `obj` doesn't have a `forEach` method in order to distinguish
  15893. // it from a regular `Map`.
  15894. return methods !== weakMapMethods || !isFunction$1(obj[forEachName]);
  15895. };
  15896. }
  15897. // In the interest of compact minification, we write
  15898. // each string in the fingerprints only once.
  15899. var forEachName = 'forEach',
  15900. hasName = 'has',
  15901. commonInit = ['clear', 'delete'],
  15902. mapTail = ['get', hasName, 'set'];
  15903. // `Map`, `WeakMap` and `Set` each have slightly different
  15904. // combinations of the above sublists.
  15905. var mapMethods = commonInit.concat(forEachName, mapTail),
  15906. weakMapMethods = commonInit.concat(mapTail),
  15907. setMethods = ['add'].concat(commonInit, forEachName, hasName);
  15908. var isMap = isIE11 ? ie11fingerprint(mapMethods) : tagTester('Map');
  15909. var isWeakMap = isIE11 ? ie11fingerprint(weakMapMethods) : tagTester('WeakMap');
  15910. var isSet = isIE11 ? ie11fingerprint(setMethods) : tagTester('Set');
  15911. var isWeakSet = tagTester('WeakSet');
  15912. // Retrieve the values of an object's properties.
  15913. function values(obj) {
  15914. var _keys = keys(obj);
  15915. var length = _keys.length;
  15916. var values = Array(length);
  15917. for (var i = 0; i < length; i++) {
  15918. values[i] = obj[_keys[i]];
  15919. }
  15920. return values;
  15921. }
  15922. // Convert an object into a list of `[key, value]` pairs.
  15923. // The opposite of `_.object` with one argument.
  15924. function pairs(obj) {
  15925. var _keys = keys(obj);
  15926. var length = _keys.length;
  15927. var pairs = Array(length);
  15928. for (var i = 0; i < length; i++) {
  15929. pairs[i] = [_keys[i], obj[_keys[i]]];
  15930. }
  15931. return pairs;
  15932. }
  15933. // Invert the keys and values of an object. The values must be serializable.
  15934. function invert(obj) {
  15935. var result = {};
  15936. var _keys = keys(obj);
  15937. for (var i = 0, length = _keys.length; i < length; i++) {
  15938. result[obj[_keys[i]]] = _keys[i];
  15939. }
  15940. return result;
  15941. }
  15942. // Return a sorted list of the function names available on the object.
  15943. function functions(obj) {
  15944. var names = [];
  15945. for (var key in obj) {
  15946. if (isFunction$1(obj[key])) names.push(key);
  15947. }
  15948. return names.sort();
  15949. }
  15950. // An internal function for creating assigner functions.
  15951. function createAssigner(keysFunc, defaults) {
  15952. return function(obj) {
  15953. var length = arguments.length;
  15954. if (defaults) obj = Object(obj);
  15955. if (length < 2 || obj == null) return obj;
  15956. for (var index = 1; index < length; index++) {
  15957. var source = arguments[index],
  15958. keys = keysFunc(source),
  15959. l = keys.length;
  15960. for (var i = 0; i < l; i++) {
  15961. var key = keys[i];
  15962. if (!defaults || obj[key] === void 0) obj[key] = source[key];
  15963. }
  15964. }
  15965. return obj;
  15966. };
  15967. }
  15968. // Extend a given object with all the properties in passed-in object(s).
  15969. var extend = createAssigner(allKeys);
  15970. // Assigns a given object with all the own properties in the passed-in
  15971. // object(s).
  15972. // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
  15973. var extendOwn = createAssigner(keys);
  15974. // Fill in a given object with default properties.
  15975. var defaults = createAssigner(allKeys, true);
  15976. // Create a naked function reference for surrogate-prototype-swapping.
  15977. function ctor() {
  15978. return function(){};
  15979. }
  15980. // An internal function for creating a new object that inherits from another.
  15981. function baseCreate(prototype) {
  15982. if (!isObject(prototype)) return {};
  15983. if (nativeCreate) return nativeCreate(prototype);
  15984. var Ctor = ctor();
  15985. Ctor.prototype = prototype;
  15986. var result = new Ctor;
  15987. Ctor.prototype = null;
  15988. return result;
  15989. }
  15990. // Creates an object that inherits from the given prototype object.
  15991. // If additional properties are provided then they will be added to the
  15992. // created object.
  15993. function create(prototype, props) {
  15994. var result = baseCreate(prototype);
  15995. if (props) extendOwn(result, props);
  15996. return result;
  15997. }
  15998. // Create a (shallow-cloned) duplicate of an object.
  15999. function clone(obj) {
  16000. if (!isObject(obj)) return obj;
  16001. return isArray(obj) ? obj.slice() : extend({}, obj);
  16002. }
  16003. // Invokes `interceptor` with the `obj` and then returns `obj`.
  16004. // The primary purpose of this method is to "tap into" a method chain, in
  16005. // order to perform operations on intermediate results within the chain.
  16006. function tap(obj, interceptor) {
  16007. interceptor(obj);
  16008. return obj;
  16009. }
  16010. // Normalize a (deep) property `path` to array.
  16011. // Like `_.iteratee`, this function can be customized.
  16012. function toPath$1(path) {
  16013. return isArray(path) ? path : [path];
  16014. }
  16015. _$1.toPath = toPath$1;
  16016. // Internal wrapper for `_.toPath` to enable minification.
  16017. // Similar to `cb` for `_.iteratee`.
  16018. function toPath(path) {
  16019. return _$1.toPath(path);
  16020. }
  16021. // Internal function to obtain a nested property in `obj` along `path`.
  16022. function deepGet(obj, path) {
  16023. var length = path.length;
  16024. for (var i = 0; i < length; i++) {
  16025. if (obj == null) return void 0;
  16026. obj = obj[path[i]];
  16027. }
  16028. return length ? obj : void 0;
  16029. }
  16030. // Get the value of the (deep) property on `path` from `object`.
  16031. // If any property in `path` does not exist or if the value is
  16032. // `undefined`, return `defaultValue` instead.
  16033. // The `path` is normalized through `_.toPath`.
  16034. function get(object, path, defaultValue) {
  16035. var value = deepGet(object, toPath(path));
  16036. return isUndefined(value) ? defaultValue : value;
  16037. }
  16038. // Shortcut function for checking if an object has a given property directly on
  16039. // itself (in other words, not on a prototype). Unlike the internal `has`
  16040. // function, this public version can also traverse nested properties.
  16041. function has(obj, path) {
  16042. path = toPath(path);
  16043. var length = path.length;
  16044. for (var i = 0; i < length; i++) {
  16045. var key = path[i];
  16046. if (!has$1(obj, key)) return false;
  16047. obj = obj[key];
  16048. }
  16049. return !!length;
  16050. }
  16051. // Keep the identity function around for default iteratees.
  16052. function identity(value) {
  16053. return value;
  16054. }
  16055. // Returns a predicate for checking whether an object has a given set of
  16056. // `key:value` pairs.
  16057. function matcher(attrs) {
  16058. attrs = extendOwn({}, attrs);
  16059. return function(obj) {
  16060. return isMatch(obj, attrs);
  16061. };
  16062. }
  16063. // Creates a function that, when passed an object, will traverse that object’s
  16064. // properties down the given `path`, specified as an array of keys or indices.
  16065. function property(path) {
  16066. path = toPath(path);
  16067. return function(obj) {
  16068. return deepGet(obj, path);
  16069. };
  16070. }
  16071. // Internal function that returns an efficient (for current engines) version
  16072. // of the passed-in callback, to be repeatedly applied in other Underscore
  16073. // functions.
  16074. function optimizeCb(func, context, argCount) {
  16075. if (context === void 0) return func;
  16076. switch (argCount == null ? 3 : argCount) {
  16077. case 1: return function(value) {
  16078. return func.call(context, value);
  16079. };
  16080. // The 2-argument case is omitted because we’re not using it.
  16081. case 3: return function(value, index, collection) {
  16082. return func.call(context, value, index, collection);
  16083. };
  16084. case 4: return function(accumulator, value, index, collection) {
  16085. return func.call(context, accumulator, value, index, collection);
  16086. };
  16087. }
  16088. return function() {
  16089. return func.apply(context, arguments);
  16090. };
  16091. }
  16092. // An internal function to generate callbacks that can be applied to each
  16093. // element in a collection, returning the desired result — either `_.identity`,
  16094. // an arbitrary callback, a property matcher, or a property accessor.
  16095. function baseIteratee(value, context, argCount) {
  16096. if (value == null) return identity;
  16097. if (isFunction$1(value)) return optimizeCb(value, context, argCount);
  16098. if (isObject(value) && !isArray(value)) return matcher(value);
  16099. return property(value);
  16100. }
  16101. // External wrapper for our callback generator. Users may customize
  16102. // `_.iteratee` if they want additional predicate/iteratee shorthand styles.
  16103. // This abstraction hides the internal-only `argCount` argument.
  16104. function iteratee(value, context) {
  16105. return baseIteratee(value, context, Infinity);
  16106. }
  16107. _$1.iteratee = iteratee;
  16108. // The function we call internally to generate a callback. It invokes
  16109. // `_.iteratee` if overridden, otherwise `baseIteratee`.
  16110. function cb(value, context, argCount) {
  16111. if (_$1.iteratee !== iteratee) return _$1.iteratee(value, context);
  16112. return baseIteratee(value, context, argCount);
  16113. }
  16114. // Returns the results of applying the `iteratee` to each element of `obj`.
  16115. // In contrast to `_.map` it returns an object.
  16116. function mapObject(obj, iteratee, context) {
  16117. iteratee = cb(iteratee, context);
  16118. var _keys = keys(obj),
  16119. length = _keys.length,
  16120. results = {};
  16121. for (var index = 0; index < length; index++) {
  16122. var currentKey = _keys[index];
  16123. results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
  16124. }
  16125. return results;
  16126. }
  16127. // Predicate-generating function. Often useful outside of Underscore.
  16128. function noop(){}
  16129. // Generates a function for a given object that returns a given property.
  16130. function propertyOf(obj) {
  16131. if (obj == null) return noop;
  16132. return function(path) {
  16133. return get(obj, path);
  16134. };
  16135. }
  16136. // Run a function **n** times.
  16137. function times(n, iteratee, context) {
  16138. var accum = Array(Math.max(0, n));
  16139. iteratee = optimizeCb(iteratee, context, 1);
  16140. for (var i = 0; i < n; i++) accum[i] = iteratee(i);
  16141. return accum;
  16142. }
  16143. // Return a random integer between `min` and `max` (inclusive).
  16144. function random(min, max) {
  16145. if (max == null) {
  16146. max = min;
  16147. min = 0;
  16148. }
  16149. return min + Math.floor(Math.random() * (max - min + 1));
  16150. }
  16151. // A (possibly faster) way to get the current timestamp as an integer.
  16152. var now = Date.now || function() {
  16153. return new Date().getTime();
  16154. };
  16155. // Internal helper to generate functions for escaping and unescaping strings
  16156. // to/from HTML interpolation.
  16157. function createEscaper(map) {
  16158. var escaper = function(match) {
  16159. return map[match];
  16160. };
  16161. // Regexes for identifying a key that needs to be escaped.
  16162. var source = '(?:' + keys(map).join('|') + ')';
  16163. var testRegexp = RegExp(source);
  16164. var replaceRegexp = RegExp(source, 'g');
  16165. return function(string) {
  16166. string = string == null ? '' : '' + string;
  16167. return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
  16168. };
  16169. }
  16170. // Internal list of HTML entities for escaping.
  16171. var escapeMap = {
  16172. '&': '&amp;',
  16173. '<': '&lt;',
  16174. '>': '&gt;',
  16175. '"': '&quot;',
  16176. "'": '&#x27;',
  16177. '`': '&#x60;'
  16178. };
  16179. // Function for escaping strings to HTML interpolation.
  16180. var _escape = createEscaper(escapeMap);
  16181. // Internal list of HTML entities for unescaping.
  16182. var unescapeMap = invert(escapeMap);
  16183. // Function for unescaping strings from HTML interpolation.
  16184. var _unescape = createEscaper(unescapeMap);
  16185. // By default, Underscore uses ERB-style template delimiters. Change the
  16186. // following template settings to use alternative delimiters.
  16187. var templateSettings = _$1.templateSettings = {
  16188. evaluate: /<%([\s\S]+?)%>/g,
  16189. interpolate: /<%=([\s\S]+?)%>/g,
  16190. escape: /<%-([\s\S]+?)%>/g
  16191. };
  16192. // When customizing `_.templateSettings`, if you don't want to define an
  16193. // interpolation, evaluation or escaping regex, we need one that is
  16194. // guaranteed not to match.
  16195. var noMatch = /(.)^/;
  16196. // Certain characters need to be escaped so that they can be put into a
  16197. // string literal.
  16198. var escapes = {
  16199. "'": "'",
  16200. '\\': '\\',
  16201. '\r': 'r',
  16202. '\n': 'n',
  16203. '\u2028': 'u2028',
  16204. '\u2029': 'u2029'
  16205. };
  16206. var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
  16207. function escapeChar(match) {
  16208. return '\\' + escapes[match];
  16209. }
  16210. // In order to prevent third-party code injection through
  16211. // `_.templateSettings.variable`, we test it against the following regular
  16212. // expression. It is intentionally a bit more liberal than just matching valid
  16213. // identifiers, but still prevents possible loopholes through defaults or
  16214. // destructuring assignment.
  16215. var bareIdentifier = /^\s*(\w|\$)+\s*$/;
  16216. // JavaScript micro-templating, similar to John Resig's implementation.
  16217. // Underscore templating handles arbitrary delimiters, preserves whitespace,
  16218. // and correctly escapes quotes within interpolated code.
  16219. // NB: `oldSettings` only exists for backwards compatibility.
  16220. function template(text, settings, oldSettings) {
  16221. if (!settings && oldSettings) settings = oldSettings;
  16222. settings = defaults({}, settings, _$1.templateSettings);
  16223. // Combine delimiters into one regular expression via alternation.
  16224. var matcher = RegExp([
  16225. (settings.escape || noMatch).source,
  16226. (settings.interpolate || noMatch).source,
  16227. (settings.evaluate || noMatch).source
  16228. ].join('|') + '|$', 'g');
  16229. // Compile the template source, escaping string literals appropriately.
  16230. var index = 0;
  16231. var source = "__p+='";
  16232. text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
  16233. source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
  16234. index = offset + match.length;
  16235. if (escape) {
  16236. source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
  16237. } else if (interpolate) {
  16238. source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
  16239. } else if (evaluate) {
  16240. source += "';\n" + evaluate + "\n__p+='";
  16241. }
  16242. // Adobe VMs need the match returned to produce the correct offset.
  16243. return match;
  16244. });
  16245. source += "';\n";
  16246. var argument = settings.variable;
  16247. if (argument) {
  16248. // Insure against third-party code injection. (CVE-2021-23358)
  16249. if (!bareIdentifier.test(argument)) throw new Error(
  16250. 'variable is not a bare identifier: ' + argument
  16251. );
  16252. } else {
  16253. // If a variable is not specified, place data values in local scope.
  16254. source = 'with(obj||{}){\n' + source + '}\n';
  16255. argument = 'obj';
  16256. }
  16257. source = "var __t,__p='',__j=Array.prototype.join," +
  16258. "print=function(){__p+=__j.call(arguments,'');};\n" +
  16259. source + 'return __p;\n';
  16260. var render;
  16261. try {
  16262. render = new Function(argument, '_', source);
  16263. } catch (e) {
  16264. e.source = source;
  16265. throw e;
  16266. }
  16267. var template = function(data) {
  16268. return render.call(this, data, _$1);
  16269. };
  16270. // Provide the compiled source as a convenience for precompilation.
  16271. template.source = 'function(' + argument + '){\n' + source + '}';
  16272. return template;
  16273. }
  16274. // Traverses the children of `obj` along `path`. If a child is a function, it
  16275. // is invoked with its parent as context. Returns the value of the final
  16276. // child, or `fallback` if any child is undefined.
  16277. function result(obj, path, fallback) {
  16278. path = toPath(path);
  16279. var length = path.length;
  16280. if (!length) {
  16281. return isFunction$1(fallback) ? fallback.call(obj) : fallback;
  16282. }
  16283. for (var i = 0; i < length; i++) {
  16284. var prop = obj == null ? void 0 : obj[path[i]];
  16285. if (prop === void 0) {
  16286. prop = fallback;
  16287. i = length; // Ensure we don't continue iterating.
  16288. }
  16289. obj = isFunction$1(prop) ? prop.call(obj) : prop;
  16290. }
  16291. return obj;
  16292. }
  16293. // Generate a unique integer id (unique within the entire client session).
  16294. // Useful for temporary DOM ids.
  16295. var idCounter = 0;
  16296. function uniqueId(prefix) {
  16297. var id = ++idCounter + '';
  16298. return prefix ? prefix + id : id;
  16299. }
  16300. // Start chaining a wrapped Underscore object.
  16301. function chain(obj) {
  16302. var instance = _$1(obj);
  16303. instance._chain = true;
  16304. return instance;
  16305. }
  16306. // Internal function to execute `sourceFunc` bound to `context` with optional
  16307. // `args`. Determines whether to execute a function as a constructor or as a
  16308. // normal function.
  16309. function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
  16310. if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
  16311. var self = baseCreate(sourceFunc.prototype);
  16312. var result = sourceFunc.apply(self, args);
  16313. if (isObject(result)) return result;
  16314. return self;
  16315. }
  16316. // Partially apply a function by creating a version that has had some of its
  16317. // arguments pre-filled, without changing its dynamic `this` context. `_` acts
  16318. // as a placeholder by default, allowing any combination of arguments to be
  16319. // pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
  16320. var partial = restArguments(function(func, boundArgs) {
  16321. var placeholder = partial.placeholder;
  16322. var bound = function() {
  16323. var position = 0, length = boundArgs.length;
  16324. var args = Array(length);
  16325. for (var i = 0; i < length; i++) {
  16326. args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
  16327. }
  16328. while (position < arguments.length) args.push(arguments[position++]);
  16329. return executeBound(func, bound, this, this, args);
  16330. };
  16331. return bound;
  16332. });
  16333. partial.placeholder = _$1;
  16334. // Create a function bound to a given object (assigning `this`, and arguments,
  16335. // optionally).
  16336. var bind = restArguments(function(func, context, args) {
  16337. if (!isFunction$1(func)) throw new TypeError('Bind must be called on a function');
  16338. var bound = restArguments(function(callArgs) {
  16339. return executeBound(func, bound, context, this, args.concat(callArgs));
  16340. });
  16341. return bound;
  16342. });
  16343. // Internal helper for collection methods to determine whether a collection
  16344. // should be iterated as an array or as an object.
  16345. // Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
  16346. // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
  16347. var isArrayLike = createSizePropertyCheck(getLength);
  16348. // Internal implementation of a recursive `flatten` function.
  16349. function flatten$1(input, depth, strict, output) {
  16350. output = output || [];
  16351. if (!depth && depth !== 0) {
  16352. depth = Infinity;
  16353. } else if (depth <= 0) {
  16354. return output.concat(input);
  16355. }
  16356. var idx = output.length;
  16357. for (var i = 0, length = getLength(input); i < length; i++) {
  16358. var value = input[i];
  16359. if (isArrayLike(value) && (isArray(value) || isArguments$1(value))) {
  16360. // Flatten current level of array or arguments object.
  16361. if (depth > 1) {
  16362. flatten$1(value, depth - 1, strict, output);
  16363. idx = output.length;
  16364. } else {
  16365. var j = 0, len = value.length;
  16366. while (j < len) output[idx++] = value[j++];
  16367. }
  16368. } else if (!strict) {
  16369. output[idx++] = value;
  16370. }
  16371. }
  16372. return output;
  16373. }
  16374. // Bind a number of an object's methods to that object. Remaining arguments
  16375. // are the method names to be bound. Useful for ensuring that all callbacks
  16376. // defined on an object belong to it.
  16377. var bindAll = restArguments(function(obj, keys) {
  16378. keys = flatten$1(keys, false, false);
  16379. var index = keys.length;
  16380. if (index < 1) throw new Error('bindAll must be passed function names');
  16381. while (index--) {
  16382. var key = keys[index];
  16383. obj[key] = bind(obj[key], obj);
  16384. }
  16385. return obj;
  16386. });
  16387. // Memoize an expensive function by storing its results.
  16388. function memoize(func, hasher) {
  16389. var memoize = function(key) {
  16390. var cache = memoize.cache;
  16391. var address = '' + (hasher ? hasher.apply(this, arguments) : key);
  16392. if (!has$1(cache, address)) cache[address] = func.apply(this, arguments);
  16393. return cache[address];
  16394. };
  16395. memoize.cache = {};
  16396. return memoize;
  16397. }
  16398. // Delays a function for the given number of milliseconds, and then calls
  16399. // it with the arguments supplied.
  16400. var delay = restArguments(function(func, wait, args) {
  16401. return setTimeout(function() {
  16402. return func.apply(null, args);
  16403. }, wait);
  16404. });
  16405. // Defers a function, scheduling it to run after the current call stack has
  16406. // cleared.
  16407. var defer = partial(delay, _$1, 1);
  16408. // Returns a function, that, when invoked, will only be triggered at most once
  16409. // during a given window of time. Normally, the throttled function will run
  16410. // as much as it can, without ever going more than once per `wait` duration;
  16411. // but if you'd like to disable the execution on the leading edge, pass
  16412. // `{leading: false}`. To disable execution on the trailing edge, ditto.
  16413. function throttle(func, wait, options) {
  16414. var timeout, context, args, result;
  16415. var previous = 0;
  16416. if (!options) options = {};
  16417. var later = function() {
  16418. previous = options.leading === false ? 0 : now();
  16419. timeout = null;
  16420. result = func.apply(context, args);
  16421. if (!timeout) context = args = null;
  16422. };
  16423. var throttled = function() {
  16424. var _now = now();
  16425. if (!previous && options.leading === false) previous = _now;
  16426. var remaining = wait - (_now - previous);
  16427. context = this;
  16428. args = arguments;
  16429. if (remaining <= 0 || remaining > wait) {
  16430. if (timeout) {
  16431. clearTimeout(timeout);
  16432. timeout = null;
  16433. }
  16434. previous = _now;
  16435. result = func.apply(context, args);
  16436. if (!timeout) context = args = null;
  16437. } else if (!timeout && options.trailing !== false) {
  16438. timeout = setTimeout(later, remaining);
  16439. }
  16440. return result;
  16441. };
  16442. throttled.cancel = function() {
  16443. clearTimeout(timeout);
  16444. previous = 0;
  16445. timeout = context = args = null;
  16446. };
  16447. return throttled;
  16448. }
  16449. // When a sequence of calls of the returned function ends, the argument
  16450. // function is triggered. The end of a sequence is defined by the `wait`
  16451. // parameter. If `immediate` is passed, the argument function will be
  16452. // triggered at the beginning of the sequence instead of at the end.
  16453. function debounce(func, wait, immediate) {
  16454. var timeout, previous, args, result, context;
  16455. var later = function() {
  16456. var passed = now() - previous;
  16457. if (wait > passed) {
  16458. timeout = setTimeout(later, wait - passed);
  16459. } else {
  16460. timeout = null;
  16461. if (!immediate) result = func.apply(context, args);
  16462. // This check is needed because `func` can recursively invoke `debounced`.
  16463. if (!timeout) args = context = null;
  16464. }
  16465. };
  16466. var debounced = restArguments(function(_args) {
  16467. context = this;
  16468. args = _args;
  16469. previous = now();
  16470. if (!timeout) {
  16471. timeout = setTimeout(later, wait);
  16472. if (immediate) result = func.apply(context, args);
  16473. }
  16474. return result;
  16475. });
  16476. debounced.cancel = function() {
  16477. clearTimeout(timeout);
  16478. timeout = args = context = null;
  16479. };
  16480. return debounced;
  16481. }
  16482. // Returns the first function passed as an argument to the second,
  16483. // allowing you to adjust arguments, run code before and after, and
  16484. // conditionally execute the original function.
  16485. function wrap(func, wrapper) {
  16486. return partial(wrapper, func);
  16487. }
  16488. // Returns a negated version of the passed-in predicate.
  16489. function negate(predicate) {
  16490. return function() {
  16491. return !predicate.apply(this, arguments);
  16492. };
  16493. }
  16494. // Returns a function that is the composition of a list of functions, each
  16495. // consuming the return value of the function that follows.
  16496. function compose() {
  16497. var args = arguments;
  16498. var start = args.length - 1;
  16499. return function() {
  16500. var i = start;
  16501. var result = args[start].apply(this, arguments);
  16502. while (i--) result = args[i].call(this, result);
  16503. return result;
  16504. };
  16505. }
  16506. // Returns a function that will only be executed on and after the Nth call.
  16507. function after(times, func) {
  16508. return function() {
  16509. if (--times < 1) {
  16510. return func.apply(this, arguments);
  16511. }
  16512. };
  16513. }
  16514. // Returns a function that will only be executed up to (but not including) the
  16515. // Nth call.
  16516. function before(times, func) {
  16517. var memo;
  16518. return function() {
  16519. if (--times > 0) {
  16520. memo = func.apply(this, arguments);
  16521. }
  16522. if (times <= 1) func = null;
  16523. return memo;
  16524. };
  16525. }
  16526. // Returns a function that will be executed at most one time, no matter how
  16527. // often you call it. Useful for lazy initialization.
  16528. var once = partial(before, 2);
  16529. // Returns the first key on an object that passes a truth test.
  16530. function findKey(obj, predicate, context) {
  16531. predicate = cb(predicate, context);
  16532. var _keys = keys(obj), key;
  16533. for (var i = 0, length = _keys.length; i < length; i++) {
  16534. key = _keys[i];
  16535. if (predicate(obj[key], key, obj)) return key;
  16536. }
  16537. }
  16538. // Internal function to generate `_.findIndex` and `_.findLastIndex`.
  16539. function createPredicateIndexFinder(dir) {
  16540. return function(array, predicate, context) {
  16541. predicate = cb(predicate, context);
  16542. var length = getLength(array);
  16543. var index = dir > 0 ? 0 : length - 1;
  16544. for (; index >= 0 && index < length; index += dir) {
  16545. if (predicate(array[index], index, array)) return index;
  16546. }
  16547. return -1;
  16548. };
  16549. }
  16550. // Returns the first index on an array-like that passes a truth test.
  16551. var findIndex = createPredicateIndexFinder(1);
  16552. // Returns the last index on an array-like that passes a truth test.
  16553. var findLastIndex = createPredicateIndexFinder(-1);
  16554. // Use a comparator function to figure out the smallest index at which
  16555. // an object should be inserted so as to maintain order. Uses binary search.
  16556. function sortedIndex(array, obj, iteratee, context) {
  16557. iteratee = cb(iteratee, context, 1);
  16558. var value = iteratee(obj);
  16559. var low = 0, high = getLength(array);
  16560. while (low < high) {
  16561. var mid = Math.floor((low + high) / 2);
  16562. if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
  16563. }
  16564. return low;
  16565. }
  16566. // Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
  16567. function createIndexFinder(dir, predicateFind, sortedIndex) {
  16568. return function(array, item, idx) {
  16569. var i = 0, length = getLength(array);
  16570. if (typeof idx == 'number') {
  16571. if (dir > 0) {
  16572. i = idx >= 0 ? idx : Math.max(idx + length, i);
  16573. } else {
  16574. length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
  16575. }
  16576. } else if (sortedIndex && idx && length) {
  16577. idx = sortedIndex(array, item);
  16578. return array[idx] === item ? idx : -1;
  16579. }
  16580. if (item !== item) {
  16581. idx = predicateFind(slice.call(array, i, length), isNaN$1);
  16582. return idx >= 0 ? idx + i : -1;
  16583. }
  16584. for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
  16585. if (array[idx] === item) return idx;
  16586. }
  16587. return -1;
  16588. };
  16589. }
  16590. // Return the position of the first occurrence of an item in an array,
  16591. // or -1 if the item is not included in the array.
  16592. // If the array is large and already in sort order, pass `true`
  16593. // for **isSorted** to use binary search.
  16594. var indexOf = createIndexFinder(1, findIndex, sortedIndex);
  16595. // Return the position of the last occurrence of an item in an array,
  16596. // or -1 if the item is not included in the array.
  16597. var lastIndexOf = createIndexFinder(-1, findLastIndex);
  16598. // Return the first value which passes a truth test.
  16599. function find(obj, predicate, context) {
  16600. var keyFinder = isArrayLike(obj) ? findIndex : findKey;
  16601. var key = keyFinder(obj, predicate, context);
  16602. if (key !== void 0 && key !== -1) return obj[key];
  16603. }
  16604. // Convenience version of a common use case of `_.find`: getting the first
  16605. // object containing specific `key:value` pairs.
  16606. function findWhere(obj, attrs) {
  16607. return find(obj, matcher(attrs));
  16608. }
  16609. // The cornerstone for collection functions, an `each`
  16610. // implementation, aka `forEach`.
  16611. // Handles raw objects in addition to array-likes. Treats all
  16612. // sparse array-likes as if they were dense.
  16613. function each(obj, iteratee, context) {
  16614. iteratee = optimizeCb(iteratee, context);
  16615. var i, length;
  16616. if (isArrayLike(obj)) {
  16617. for (i = 0, length = obj.length; i < length; i++) {
  16618. iteratee(obj[i], i, obj);
  16619. }
  16620. } else {
  16621. var _keys = keys(obj);
  16622. for (i = 0, length = _keys.length; i < length; i++) {
  16623. iteratee(obj[_keys[i]], _keys[i], obj);
  16624. }
  16625. }
  16626. return obj;
  16627. }
  16628. // Return the results of applying the iteratee to each element.
  16629. function map(obj, iteratee, context) {
  16630. iteratee = cb(iteratee, context);
  16631. var _keys = !isArrayLike(obj) && keys(obj),
  16632. length = (_keys || obj).length,
  16633. results = Array(length);
  16634. for (var index = 0; index < length; index++) {
  16635. var currentKey = _keys ? _keys[index] : index;
  16636. results[index] = iteratee(obj[currentKey], currentKey, obj);
  16637. }
  16638. return results;
  16639. }
  16640. // Internal helper to create a reducing function, iterating left or right.
  16641. function createReduce(dir) {
  16642. // Wrap code that reassigns argument variables in a separate function than
  16643. // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
  16644. var reducer = function(obj, iteratee, memo, initial) {
  16645. var _keys = !isArrayLike(obj) && keys(obj),
  16646. length = (_keys || obj).length,
  16647. index = dir > 0 ? 0 : length - 1;
  16648. if (!initial) {
  16649. memo = obj[_keys ? _keys[index] : index];
  16650. index += dir;
  16651. }
  16652. for (; index >= 0 && index < length; index += dir) {
  16653. var currentKey = _keys ? _keys[index] : index;
  16654. memo = iteratee(memo, obj[currentKey], currentKey, obj);
  16655. }
  16656. return memo;
  16657. };
  16658. return function(obj, iteratee, memo, context) {
  16659. var initial = arguments.length >= 3;
  16660. return reducer(obj, optimizeCb(iteratee, context, 4), memo, initial);
  16661. };
  16662. }
  16663. // **Reduce** builds up a single result from a list of values, aka `inject`,
  16664. // or `foldl`.
  16665. var reduce = createReduce(1);
  16666. // The right-associative version of reduce, also known as `foldr`.
  16667. var reduceRight = createReduce(-1);
  16668. // Return all the elements that pass a truth test.
  16669. function filter(obj, predicate, context) {
  16670. var results = [];
  16671. predicate = cb(predicate, context);
  16672. each(obj, function(value, index, list) {
  16673. if (predicate(value, index, list)) results.push(value);
  16674. });
  16675. return results;
  16676. }
  16677. // Return all the elements for which a truth test fails.
  16678. function reject(obj, predicate, context) {
  16679. return filter(obj, negate(cb(predicate)), context);
  16680. }
  16681. // Determine whether all of the elements pass a truth test.
  16682. function every(obj, predicate, context) {
  16683. predicate = cb(predicate, context);
  16684. var _keys = !isArrayLike(obj) && keys(obj),
  16685. length = (_keys || obj).length;
  16686. for (var index = 0; index < length; index++) {
  16687. var currentKey = _keys ? _keys[index] : index;
  16688. if (!predicate(obj[currentKey], currentKey, obj)) return false;
  16689. }
  16690. return true;
  16691. }
  16692. // Determine if at least one element in the object passes a truth test.
  16693. function some(obj, predicate, context) {
  16694. predicate = cb(predicate, context);
  16695. var _keys = !isArrayLike(obj) && keys(obj),
  16696. length = (_keys || obj).length;
  16697. for (var index = 0; index < length; index++) {
  16698. var currentKey = _keys ? _keys[index] : index;
  16699. if (predicate(obj[currentKey], currentKey, obj)) return true;
  16700. }
  16701. return false;
  16702. }
  16703. // Determine if the array or object contains a given item (using `===`).
  16704. function contains(obj, item, fromIndex, guard) {
  16705. if (!isArrayLike(obj)) obj = values(obj);
  16706. if (typeof fromIndex != 'number' || guard) fromIndex = 0;
  16707. return indexOf(obj, item, fromIndex) >= 0;
  16708. }
  16709. // Invoke a method (with arguments) on every item in a collection.
  16710. var invoke = restArguments(function(obj, path, args) {
  16711. var contextPath, func;
  16712. if (isFunction$1(path)) {
  16713. func = path;
  16714. } else {
  16715. path = toPath(path);
  16716. contextPath = path.slice(0, -1);
  16717. path = path[path.length - 1];
  16718. }
  16719. return map(obj, function(context) {
  16720. var method = func;
  16721. if (!method) {
  16722. if (contextPath && contextPath.length) {
  16723. context = deepGet(context, contextPath);
  16724. }
  16725. if (context == null) return void 0;
  16726. method = context[path];
  16727. }
  16728. return method == null ? method : method.apply(context, args);
  16729. });
  16730. });
  16731. // Convenience version of a common use case of `_.map`: fetching a property.
  16732. function pluck(obj, key) {
  16733. return map(obj, property(key));
  16734. }
  16735. // Convenience version of a common use case of `_.filter`: selecting only
  16736. // objects containing specific `key:value` pairs.
  16737. function where(obj, attrs) {
  16738. return filter(obj, matcher(attrs));
  16739. }
  16740. // Return the maximum element (or element-based computation).
  16741. function max(obj, iteratee, context) {
  16742. var result = -Infinity, lastComputed = -Infinity,
  16743. value, computed;
  16744. if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
  16745. obj = isArrayLike(obj) ? obj : values(obj);
  16746. for (var i = 0, length = obj.length; i < length; i++) {
  16747. value = obj[i];
  16748. if (value != null && value > result) {
  16749. result = value;
  16750. }
  16751. }
  16752. } else {
  16753. iteratee = cb(iteratee, context);
  16754. each(obj, function(v, index, list) {
  16755. computed = iteratee(v, index, list);
  16756. if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
  16757. result = v;
  16758. lastComputed = computed;
  16759. }
  16760. });
  16761. }
  16762. return result;
  16763. }
  16764. // Return the minimum element (or element-based computation).
  16765. function min(obj, iteratee, context) {
  16766. var result = Infinity, lastComputed = Infinity,
  16767. value, computed;
  16768. if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
  16769. obj = isArrayLike(obj) ? obj : values(obj);
  16770. for (var i = 0, length = obj.length; i < length; i++) {
  16771. value = obj[i];
  16772. if (value != null && value < result) {
  16773. result = value;
  16774. }
  16775. }
  16776. } else {
  16777. iteratee = cb(iteratee, context);
  16778. each(obj, function(v, index, list) {
  16779. computed = iteratee(v, index, list);
  16780. if (computed < lastComputed || computed === Infinity && result === Infinity) {
  16781. result = v;
  16782. lastComputed = computed;
  16783. }
  16784. });
  16785. }
  16786. return result;
  16787. }
  16788. // Sample **n** random values from a collection using the modern version of the
  16789. // [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
  16790. // If **n** is not specified, returns a single random element.
  16791. // The internal `guard` argument allows it to work with `_.map`.
  16792. function sample(obj, n, guard) {
  16793. if (n == null || guard) {
  16794. if (!isArrayLike(obj)) obj = values(obj);
  16795. return obj[random(obj.length - 1)];
  16796. }
  16797. var sample = isArrayLike(obj) ? clone(obj) : values(obj);
  16798. var length = getLength(sample);
  16799. n = Math.max(Math.min(n, length), 0);
  16800. var last = length - 1;
  16801. for (var index = 0; index < n; index++) {
  16802. var rand = random(index, last);
  16803. var temp = sample[index];
  16804. sample[index] = sample[rand];
  16805. sample[rand] = temp;
  16806. }
  16807. return sample.slice(0, n);
  16808. }
  16809. // Shuffle a collection.
  16810. function shuffle(obj) {
  16811. return sample(obj, Infinity);
  16812. }
  16813. // Sort the object's values by a criterion produced by an iteratee.
  16814. function sortBy(obj, iteratee, context) {
  16815. var index = 0;
  16816. iteratee = cb(iteratee, context);
  16817. return pluck(map(obj, function(value, key, list) {
  16818. return {
  16819. value: value,
  16820. index: index++,
  16821. criteria: iteratee(value, key, list)
  16822. };
  16823. }).sort(function(left, right) {
  16824. var a = left.criteria;
  16825. var b = right.criteria;
  16826. if (a !== b) {
  16827. if (a > b || a === void 0) return 1;
  16828. if (a < b || b === void 0) return -1;
  16829. }
  16830. return left.index - right.index;
  16831. }), 'value');
  16832. }
  16833. // An internal function used for aggregate "group by" operations.
  16834. function group(behavior, partition) {
  16835. return function(obj, iteratee, context) {
  16836. var result = partition ? [[], []] : {};
  16837. iteratee = cb(iteratee, context);
  16838. each(obj, function(value, index) {
  16839. var key = iteratee(value, index, obj);
  16840. behavior(result, value, key);
  16841. });
  16842. return result;
  16843. };
  16844. }
  16845. // Groups the object's values by a criterion. Pass either a string attribute
  16846. // to group by, or a function that returns the criterion.
  16847. var groupBy = group(function(result, value, key) {
  16848. if (has$1(result, key)) result[key].push(value); else result[key] = [value];
  16849. });
  16850. // Indexes the object's values by a criterion, similar to `_.groupBy`, but for
  16851. // when you know that your index values will be unique.
  16852. var indexBy = group(function(result, value, key) {
  16853. result[key] = value;
  16854. });
  16855. // Counts instances of an object that group by a certain criterion. Pass
  16856. // either a string attribute to count by, or a function that returns the
  16857. // criterion.
  16858. var countBy = group(function(result, value, key) {
  16859. if (has$1(result, key)) result[key]++; else result[key] = 1;
  16860. });
  16861. // Split a collection into two arrays: one whose elements all pass the given
  16862. // truth test, and one whose elements all do not pass the truth test.
  16863. var partition = group(function(result, value, pass) {
  16864. result[pass ? 0 : 1].push(value);
  16865. }, true);
  16866. // Safely create a real, live array from anything iterable.
  16867. var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
  16868. function toArray(obj) {
  16869. if (!obj) return [];
  16870. if (isArray(obj)) return slice.call(obj);
  16871. if (isString(obj)) {
  16872. // Keep surrogate pair characters together.
  16873. return obj.match(reStrSymbol);
  16874. }
  16875. if (isArrayLike(obj)) return map(obj, identity);
  16876. return values(obj);
  16877. }
  16878. // Return the number of elements in a collection.
  16879. function size(obj) {
  16880. if (obj == null) return 0;
  16881. return isArrayLike(obj) ? obj.length : keys(obj).length;
  16882. }
  16883. // Internal `_.pick` helper function to determine whether `key` is an enumerable
  16884. // property name of `obj`.
  16885. function keyInObj(value, key, obj) {
  16886. return key in obj;
  16887. }
  16888. // Return a copy of the object only containing the allowed properties.
  16889. var pick = restArguments(function(obj, keys) {
  16890. var result = {}, iteratee = keys[0];
  16891. if (obj == null) return result;
  16892. if (isFunction$1(iteratee)) {
  16893. if (keys.length > 1) iteratee = optimizeCb(iteratee, keys[1]);
  16894. keys = allKeys(obj);
  16895. } else {
  16896. iteratee = keyInObj;
  16897. keys = flatten$1(keys, false, false);
  16898. obj = Object(obj);
  16899. }
  16900. for (var i = 0, length = keys.length; i < length; i++) {
  16901. var key = keys[i];
  16902. var value = obj[key];
  16903. if (iteratee(value, key, obj)) result[key] = value;
  16904. }
  16905. return result;
  16906. });
  16907. // Return a copy of the object without the disallowed properties.
  16908. var omit = restArguments(function(obj, keys) {
  16909. var iteratee = keys[0], context;
  16910. if (isFunction$1(iteratee)) {
  16911. iteratee = negate(iteratee);
  16912. if (keys.length > 1) context = keys[1];
  16913. } else {
  16914. keys = map(flatten$1(keys, false, false), String);
  16915. iteratee = function(value, key) {
  16916. return !contains(keys, key);
  16917. };
  16918. }
  16919. return pick(obj, iteratee, context);
  16920. });
  16921. // Returns everything but the last entry of the array. Especially useful on
  16922. // the arguments object. Passing **n** will return all the values in
  16923. // the array, excluding the last N.
  16924. function initial(array, n, guard) {
  16925. return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
  16926. }
  16927. // Get the first element of an array. Passing **n** will return the first N
  16928. // values in the array. The **guard** check allows it to work with `_.map`.
  16929. function first(array, n, guard) {
  16930. if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
  16931. if (n == null || guard) return array[0];
  16932. return initial(array, array.length - n);
  16933. }
  16934. // Returns everything but the first entry of the `array`. Especially useful on
  16935. // the `arguments` object. Passing an **n** will return the rest N values in the
  16936. // `array`.
  16937. function rest(array, n, guard) {
  16938. return slice.call(array, n == null || guard ? 1 : n);
  16939. }
  16940. // Get the last element of an array. Passing **n** will return the last N
  16941. // values in the array.
  16942. function last(array, n, guard) {
  16943. if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
  16944. if (n == null || guard) return array[array.length - 1];
  16945. return rest(array, Math.max(0, array.length - n));
  16946. }
  16947. // Trim out all falsy values from an array.
  16948. function compact(array) {
  16949. return filter(array, Boolean);
  16950. }
  16951. // Flatten out an array, either recursively (by default), or up to `depth`.
  16952. // Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
  16953. function flatten(array, depth) {
  16954. return flatten$1(array, depth, false);
  16955. }
  16956. // Take the difference between one array and a number of other arrays.
  16957. // Only the elements present in just the first array will remain.
  16958. var difference = restArguments(function(array, rest) {
  16959. rest = flatten$1(rest, true, true);
  16960. return filter(array, function(value){
  16961. return !contains(rest, value);
  16962. });
  16963. });
  16964. // Return a version of the array that does not contain the specified value(s).
  16965. var without = restArguments(function(array, otherArrays) {
  16966. return difference(array, otherArrays);
  16967. });
  16968. // Produce a duplicate-free version of the array. If the array has already
  16969. // been sorted, you have the option of using a faster algorithm.
  16970. // The faster algorithm will not work with an iteratee if the iteratee
  16971. // is not a one-to-one function, so providing an iteratee will disable
  16972. // the faster algorithm.
  16973. function uniq(array, isSorted, iteratee, context) {
  16974. if (!isBoolean(isSorted)) {
  16975. context = iteratee;
  16976. iteratee = isSorted;
  16977. isSorted = false;
  16978. }
  16979. if (iteratee != null) iteratee = cb(iteratee, context);
  16980. var result = [];
  16981. var seen = [];
  16982. for (var i = 0, length = getLength(array); i < length; i++) {
  16983. var value = array[i],
  16984. computed = iteratee ? iteratee(value, i, array) : value;
  16985. if (isSorted && !iteratee) {
  16986. if (!i || seen !== computed) result.push(value);
  16987. seen = computed;
  16988. } else if (iteratee) {
  16989. if (!contains(seen, computed)) {
  16990. seen.push(computed);
  16991. result.push(value);
  16992. }
  16993. } else if (!contains(result, value)) {
  16994. result.push(value);
  16995. }
  16996. }
  16997. return result;
  16998. }
  16999. // Produce an array that contains the union: each distinct element from all of
  17000. // the passed-in arrays.
  17001. var union = restArguments(function(arrays) {
  17002. return uniq(flatten$1(arrays, true, true));
  17003. });
  17004. // Produce an array that contains every item shared between all the
  17005. // passed-in arrays.
  17006. function intersection(array) {
  17007. var result = [];
  17008. var argsLength = arguments.length;
  17009. for (var i = 0, length = getLength(array); i < length; i++) {
  17010. var item = array[i];
  17011. if (contains(result, item)) continue;
  17012. var j;
  17013. for (j = 1; j < argsLength; j++) {
  17014. if (!contains(arguments[j], item)) break;
  17015. }
  17016. if (j === argsLength) result.push(item);
  17017. }
  17018. return result;
  17019. }
  17020. // Complement of zip. Unzip accepts an array of arrays and groups
  17021. // each array's elements on shared indices.
  17022. function unzip(array) {
  17023. var length = array && max(array, getLength).length || 0;
  17024. var result = Array(length);
  17025. for (var index = 0; index < length; index++) {
  17026. result[index] = pluck(array, index);
  17027. }
  17028. return result;
  17029. }
  17030. // Zip together multiple lists into a single array -- elements that share
  17031. // an index go together.
  17032. var zip = restArguments(unzip);
  17033. // Converts lists into objects. Pass either a single array of `[key, value]`
  17034. // pairs, or two parallel arrays of the same length -- one of keys, and one of
  17035. // the corresponding values. Passing by pairs is the reverse of `_.pairs`.
  17036. function object(list, values) {
  17037. var result = {};
  17038. for (var i = 0, length = getLength(list); i < length; i++) {
  17039. if (values) {
  17040. result[list[i]] = values[i];
  17041. } else {
  17042. result[list[i][0]] = list[i][1];
  17043. }
  17044. }
  17045. return result;
  17046. }
  17047. // Generate an integer Array containing an arithmetic progression. A port of
  17048. // the native Python `range()` function. See
  17049. // [the Python documentation](https://docs.python.org/library/functions.html#range).
  17050. function range(start, stop, step) {
  17051. if (stop == null) {
  17052. stop = start || 0;
  17053. start = 0;
  17054. }
  17055. if (!step) {
  17056. step = stop < start ? -1 : 1;
  17057. }
  17058. var length = Math.max(Math.ceil((stop - start) / step), 0);
  17059. var range = Array(length);
  17060. for (var idx = 0; idx < length; idx++, start += step) {
  17061. range[idx] = start;
  17062. }
  17063. return range;
  17064. }
  17065. // Chunk a single array into multiple arrays, each containing `count` or fewer
  17066. // items.
  17067. function chunk(array, count) {
  17068. if (count == null || count < 1) return [];
  17069. var result = [];
  17070. var i = 0, length = array.length;
  17071. while (i < length) {
  17072. result.push(slice.call(array, i, i += count));
  17073. }
  17074. return result;
  17075. }
  17076. // Helper function to continue chaining intermediate results.
  17077. function chainResult(instance, obj) {
  17078. return instance._chain ? _$1(obj).chain() : obj;
  17079. }
  17080. // Add your own custom functions to the Underscore object.
  17081. function mixin(obj) {
  17082. each(functions(obj), function(name) {
  17083. var func = _$1[name] = obj[name];
  17084. _$1.prototype[name] = function() {
  17085. var args = [this._wrapped];
  17086. push.apply(args, arguments);
  17087. return chainResult(this, func.apply(_$1, args));
  17088. };
  17089. });
  17090. return _$1;
  17091. }
  17092. // Add all mutator `Array` functions to the wrapper.
  17093. each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
  17094. var method = ArrayProto[name];
  17095. _$1.prototype[name] = function() {
  17096. var obj = this._wrapped;
  17097. if (obj != null) {
  17098. method.apply(obj, arguments);
  17099. if ((name === 'shift' || name === 'splice') && obj.length === 0) {
  17100. delete obj[0];
  17101. }
  17102. }
  17103. return chainResult(this, obj);
  17104. };
  17105. });
  17106. // Add all accessor `Array` functions to the wrapper.
  17107. each(['concat', 'join', 'slice'], function(name) {
  17108. var method = ArrayProto[name];
  17109. _$1.prototype[name] = function() {
  17110. var obj = this._wrapped;
  17111. if (obj != null) obj = method.apply(obj, arguments);
  17112. return chainResult(this, obj);
  17113. };
  17114. });
  17115. // Named Exports
  17116. var allExports = {
  17117. __proto__: null,
  17118. VERSION: VERSION,
  17119. restArguments: restArguments,
  17120. isObject: isObject,
  17121. isNull: isNull,
  17122. isUndefined: isUndefined,
  17123. isBoolean: isBoolean,
  17124. isElement: isElement,
  17125. isString: isString,
  17126. isNumber: isNumber,
  17127. isDate: isDate,
  17128. isRegExp: isRegExp,
  17129. isError: isError,
  17130. isSymbol: isSymbol,
  17131. isArrayBuffer: isArrayBuffer,
  17132. isDataView: isDataView$1,
  17133. isArray: isArray,
  17134. isFunction: isFunction$1,
  17135. isArguments: isArguments$1,
  17136. isFinite: isFinite$1,
  17137. isNaN: isNaN$1,
  17138. isTypedArray: isTypedArray$1,
  17139. isEmpty: isEmpty,
  17140. isMatch: isMatch,
  17141. isEqual: isEqual,
  17142. isMap: isMap,
  17143. isWeakMap: isWeakMap,
  17144. isSet: isSet,
  17145. isWeakSet: isWeakSet,
  17146. keys: keys,
  17147. allKeys: allKeys,
  17148. values: values,
  17149. pairs: pairs,
  17150. invert: invert,
  17151. functions: functions,
  17152. methods: functions,
  17153. extend: extend,
  17154. extendOwn: extendOwn,
  17155. assign: extendOwn,
  17156. defaults: defaults,
  17157. create: create,
  17158. clone: clone,
  17159. tap: tap,
  17160. get: get,
  17161. has: has,
  17162. mapObject: mapObject,
  17163. identity: identity,
  17164. constant: constant,
  17165. noop: noop,
  17166. toPath: toPath$1,
  17167. property: property,
  17168. propertyOf: propertyOf,
  17169. matcher: matcher,
  17170. matches: matcher,
  17171. times: times,
  17172. random: random,
  17173. now: now,
  17174. escape: _escape,
  17175. unescape: _unescape,
  17176. templateSettings: templateSettings,
  17177. template: template,
  17178. result: result,
  17179. uniqueId: uniqueId,
  17180. chain: chain,
  17181. iteratee: iteratee,
  17182. partial: partial,
  17183. bind: bind,
  17184. bindAll: bindAll,
  17185. memoize: memoize,
  17186. delay: delay,
  17187. defer: defer,
  17188. throttle: throttle,
  17189. debounce: debounce,
  17190. wrap: wrap,
  17191. negate: negate,
  17192. compose: compose,
  17193. after: after,
  17194. before: before,
  17195. once: once,
  17196. findKey: findKey,
  17197. findIndex: findIndex,
  17198. findLastIndex: findLastIndex,
  17199. sortedIndex: sortedIndex,
  17200. indexOf: indexOf,
  17201. lastIndexOf: lastIndexOf,
  17202. find: find,
  17203. detect: find,
  17204. findWhere: findWhere,
  17205. each: each,
  17206. forEach: each,
  17207. map: map,
  17208. collect: map,
  17209. reduce: reduce,
  17210. foldl: reduce,
  17211. inject: reduce,
  17212. reduceRight: reduceRight,
  17213. foldr: reduceRight,
  17214. filter: filter,
  17215. select: filter,
  17216. reject: reject,
  17217. every: every,
  17218. all: every,
  17219. some: some,
  17220. any: some,
  17221. contains: contains,
  17222. includes: contains,
  17223. include: contains,
  17224. invoke: invoke,
  17225. pluck: pluck,
  17226. where: where,
  17227. max: max,
  17228. min: min,
  17229. shuffle: shuffle,
  17230. sample: sample,
  17231. sortBy: sortBy,
  17232. groupBy: groupBy,
  17233. indexBy: indexBy,
  17234. countBy: countBy,
  17235. partition: partition,
  17236. toArray: toArray,
  17237. size: size,
  17238. pick: pick,
  17239. omit: omit,
  17240. first: first,
  17241. head: first,
  17242. take: first,
  17243. initial: initial,
  17244. last: last,
  17245. rest: rest,
  17246. tail: rest,
  17247. drop: rest,
  17248. compact: compact,
  17249. flatten: flatten,
  17250. without: without,
  17251. uniq: uniq,
  17252. unique: uniq,
  17253. union: union,
  17254. intersection: intersection,
  17255. difference: difference,
  17256. unzip: unzip,
  17257. transpose: unzip,
  17258. zip: zip,
  17259. object: object,
  17260. range: range,
  17261. chunk: chunk,
  17262. mixin: mixin,
  17263. 'default': _$1
  17264. };
  17265. // Default Export
  17266. // Add all of the Underscore functions to the wrapper object.
  17267. var _ = mixin(allExports);
  17268. // Legacy Node.js API.
  17269. _._ = _;
  17270. return _;
  17271. })));
  17272. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  17273. },{}],103:[function(require,module,exports){
  17274. if (typeof Object.create === 'function') {
  17275. // implementation from standard node.js 'util' module
  17276. module.exports = function inherits(ctor, superCtor) {
  17277. ctor.super_ = superCtor
  17278. ctor.prototype = Object.create(superCtor.prototype, {
  17279. constructor: {
  17280. value: ctor,
  17281. enumerable: false,
  17282. writable: true,
  17283. configurable: true
  17284. }
  17285. });
  17286. };
  17287. } else {
  17288. // old school shim for old browsers
  17289. module.exports = function inherits(ctor, superCtor) {
  17290. ctor.super_ = superCtor
  17291. var TempCtor = function () {}
  17292. TempCtor.prototype = superCtor.prototype
  17293. ctor.prototype = new TempCtor()
  17294. ctor.prototype.constructor = ctor
  17295. }
  17296. }
  17297. },{}],104:[function(require,module,exports){
  17298. module.exports = function isBuffer(arg) {
  17299. return arg && typeof arg === 'object'
  17300. && typeof arg.copy === 'function'
  17301. && typeof arg.fill === 'function'
  17302. && typeof arg.readUInt8 === 'function';
  17303. }
  17304. },{}],105:[function(require,module,exports){
  17305. (function (process,global){
  17306. // Copyright Joyent, Inc. and other Node contributors.
  17307. //
  17308. // Permission is hereby granted, free of charge, to any person obtaining a
  17309. // copy of this software and associated documentation files (the
  17310. // "Software"), to deal in the Software without restriction, including
  17311. // without limitation the rights to use, copy, modify, merge, publish,
  17312. // distribute, sublicense, and/or sell copies of the Software, and to permit
  17313. // persons to whom the Software is furnished to do so, subject to the
  17314. // following conditions:
  17315. //
  17316. // The above copyright notice and this permission notice shall be included
  17317. // in all copies or substantial portions of the Software.
  17318. //
  17319. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17320. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17321. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  17322. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  17323. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  17324. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  17325. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  17326. var formatRegExp = /%[sdj%]/g;
  17327. exports.format = function(f) {
  17328. if (!isString(f)) {
  17329. var objects = [];
  17330. for (var i = 0; i < arguments.length; i++) {
  17331. objects.push(inspect(arguments[i]));
  17332. }
  17333. return objects.join(' ');
  17334. }
  17335. var i = 1;
  17336. var args = arguments;
  17337. var len = args.length;
  17338. var str = String(f).replace(formatRegExp, function(x) {
  17339. if (x === '%%') return '%';
  17340. if (i >= len) return x;
  17341. switch (x) {
  17342. case '%s': return String(args[i++]);
  17343. case '%d': return Number(args[i++]);
  17344. case '%j':
  17345. try {
  17346. return JSON.stringify(args[i++]);
  17347. } catch (_) {
  17348. return '[Circular]';
  17349. }
  17350. default:
  17351. return x;
  17352. }
  17353. });
  17354. for (var x = args[i]; i < len; x = args[++i]) {
  17355. if (isNull(x) || !isObject(x)) {
  17356. str += ' ' + x;
  17357. } else {
  17358. str += ' ' + inspect(x);
  17359. }
  17360. }
  17361. return str;
  17362. };
  17363. // Mark that a method should not be used.
  17364. // Returns a modified function which warns once by default.
  17365. // If --no-deprecation is set, then it is a no-op.
  17366. exports.deprecate = function(fn, msg) {
  17367. // Allow for deprecating things in the process of starting up.
  17368. if (isUndefined(global.process)) {
  17369. return function() {
  17370. return exports.deprecate(fn, msg).apply(this, arguments);
  17371. };
  17372. }
  17373. if (process.noDeprecation === true) {
  17374. return fn;
  17375. }
  17376. var warned = false;
  17377. function deprecated() {
  17378. if (!warned) {
  17379. if (process.throwDeprecation) {
  17380. throw new Error(msg);
  17381. } else if (process.traceDeprecation) {
  17382. console.trace(msg);
  17383. } else {
  17384. console.error(msg);
  17385. }
  17386. warned = true;
  17387. }
  17388. return fn.apply(this, arguments);
  17389. }
  17390. return deprecated;
  17391. };
  17392. var debugs = {};
  17393. var debugEnviron;
  17394. exports.debuglog = function(set) {
  17395. if (isUndefined(debugEnviron))
  17396. debugEnviron = process.env.NODE_DEBUG || '';
  17397. set = set.toUpperCase();
  17398. if (!debugs[set]) {
  17399. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  17400. var pid = process.pid;
  17401. debugs[set] = function() {
  17402. var msg = exports.format.apply(exports, arguments);
  17403. console.error('%s %d: %s', set, pid, msg);
  17404. };
  17405. } else {
  17406. debugs[set] = function() {};
  17407. }
  17408. }
  17409. return debugs[set];
  17410. };
  17411. /**
  17412. * Echos the value of a value. Trys to print the value out
  17413. * in the best way possible given the different types.
  17414. *
  17415. * @param {Object} obj The object to print out.
  17416. * @param {Object} opts Optional options object that alters the output.
  17417. */
  17418. /* legacy: obj, showHidden, depth, colors*/
  17419. function inspect(obj, opts) {
  17420. // default options
  17421. var ctx = {
  17422. seen: [],
  17423. stylize: stylizeNoColor
  17424. };
  17425. // legacy...
  17426. if (arguments.length >= 3) ctx.depth = arguments[2];
  17427. if (arguments.length >= 4) ctx.colors = arguments[3];
  17428. if (isBoolean(opts)) {
  17429. // legacy...
  17430. ctx.showHidden = opts;
  17431. } else if (opts) {
  17432. // got an "options" object
  17433. exports._extend(ctx, opts);
  17434. }
  17435. // set default options
  17436. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  17437. if (isUndefined(ctx.depth)) ctx.depth = 2;
  17438. if (isUndefined(ctx.colors)) ctx.colors = false;
  17439. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  17440. if (ctx.colors) ctx.stylize = stylizeWithColor;
  17441. return formatValue(ctx, obj, ctx.depth);
  17442. }
  17443. exports.inspect = inspect;
  17444. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  17445. inspect.colors = {
  17446. 'bold' : [1, 22],
  17447. 'italic' : [3, 23],
  17448. 'underline' : [4, 24],
  17449. 'inverse' : [7, 27],
  17450. 'white' : [37, 39],
  17451. 'grey' : [90, 39],
  17452. 'black' : [30, 39],
  17453. 'blue' : [34, 39],
  17454. 'cyan' : [36, 39],
  17455. 'green' : [32, 39],
  17456. 'magenta' : [35, 39],
  17457. 'red' : [31, 39],
  17458. 'yellow' : [33, 39]
  17459. };
  17460. // Don't use 'blue' not visible on cmd.exe
  17461. inspect.styles = {
  17462. 'special': 'cyan',
  17463. 'number': 'yellow',
  17464. 'boolean': 'yellow',
  17465. 'undefined': 'grey',
  17466. 'null': 'bold',
  17467. 'string': 'green',
  17468. 'date': 'magenta',
  17469. // "name": intentionally not styling
  17470. 'regexp': 'red'
  17471. };
  17472. function stylizeWithColor(str, styleType) {
  17473. var style = inspect.styles[styleType];
  17474. if (style) {
  17475. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  17476. '\u001b[' + inspect.colors[style][1] + 'm';
  17477. } else {
  17478. return str;
  17479. }
  17480. }
  17481. function stylizeNoColor(str, styleType) {
  17482. return str;
  17483. }
  17484. function arrayToHash(array) {
  17485. var hash = {};
  17486. array.forEach(function(val, idx) {
  17487. hash[val] = true;
  17488. });
  17489. return hash;
  17490. }
  17491. function formatValue(ctx, value, recurseTimes) {
  17492. // Provide a hook for user-specified inspect functions.
  17493. // Check that value is an object with an inspect function on it
  17494. if (ctx.customInspect &&
  17495. value &&
  17496. isFunction(value.inspect) &&
  17497. // Filter out the util module, it's inspect function is special
  17498. value.inspect !== exports.inspect &&
  17499. // Also filter out any prototype objects using the circular check.
  17500. !(value.constructor && value.constructor.prototype === value)) {
  17501. var ret = value.inspect(recurseTimes, ctx);
  17502. if (!isString(ret)) {
  17503. ret = formatValue(ctx, ret, recurseTimes);
  17504. }
  17505. return ret;
  17506. }
  17507. // Primitive types cannot have properties
  17508. var primitive = formatPrimitive(ctx, value);
  17509. if (primitive) {
  17510. return primitive;
  17511. }
  17512. // Look up the keys of the object.
  17513. var keys = Object.keys(value);
  17514. var visibleKeys = arrayToHash(keys);
  17515. if (ctx.showHidden) {
  17516. keys = Object.getOwnPropertyNames(value);
  17517. }
  17518. // IE doesn't make error fields non-enumerable
  17519. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  17520. if (isError(value)
  17521. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  17522. return formatError(value);
  17523. }
  17524. // Some type of object without properties can be shortcutted.
  17525. if (keys.length === 0) {
  17526. if (isFunction(value)) {
  17527. var name = value.name ? ': ' + value.name : '';
  17528. return ctx.stylize('[Function' + name + ']', 'special');
  17529. }
  17530. if (isRegExp(value)) {
  17531. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  17532. }
  17533. if (isDate(value)) {
  17534. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  17535. }
  17536. if (isError(value)) {
  17537. return formatError(value);
  17538. }
  17539. }
  17540. var base = '', array = false, braces = ['{', '}'];
  17541. // Make Array say that they are Array
  17542. if (isArray(value)) {
  17543. array = true;
  17544. braces = ['[', ']'];
  17545. }
  17546. // Make functions say that they are functions
  17547. if (isFunction(value)) {
  17548. var n = value.name ? ': ' + value.name : '';
  17549. base = ' [Function' + n + ']';
  17550. }
  17551. // Make RegExps say that they are RegExps
  17552. if (isRegExp(value)) {
  17553. base = ' ' + RegExp.prototype.toString.call(value);
  17554. }
  17555. // Make dates with properties first say the date
  17556. if (isDate(value)) {
  17557. base = ' ' + Date.prototype.toUTCString.call(value);
  17558. }
  17559. // Make error with message first say the error
  17560. if (isError(value)) {
  17561. base = ' ' + formatError(value);
  17562. }
  17563. if (keys.length === 0 && (!array || value.length == 0)) {
  17564. return braces[0] + base + braces[1];
  17565. }
  17566. if (recurseTimes < 0) {
  17567. if (isRegExp(value)) {
  17568. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  17569. } else {
  17570. return ctx.stylize('[Object]', 'special');
  17571. }
  17572. }
  17573. ctx.seen.push(value);
  17574. var output;
  17575. if (array) {
  17576. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  17577. } else {
  17578. output = keys.map(function(key) {
  17579. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  17580. });
  17581. }
  17582. ctx.seen.pop();
  17583. return reduceToSingleString(output, base, braces);
  17584. }
  17585. function formatPrimitive(ctx, value) {
  17586. if (isUndefined(value))
  17587. return ctx.stylize('undefined', 'undefined');
  17588. if (isString(value)) {
  17589. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  17590. .replace(/'/g, "\\'")
  17591. .replace(/\\"/g, '"') + '\'';
  17592. return ctx.stylize(simple, 'string');
  17593. }
  17594. if (isNumber(value))
  17595. return ctx.stylize('' + value, 'number');
  17596. if (isBoolean(value))
  17597. return ctx.stylize('' + value, 'boolean');
  17598. // For some reason typeof null is "object", so special case here.
  17599. if (isNull(value))
  17600. return ctx.stylize('null', 'null');
  17601. }
  17602. function formatError(value) {
  17603. return '[' + Error.prototype.toString.call(value) + ']';
  17604. }
  17605. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  17606. var output = [];
  17607. for (var i = 0, l = value.length; i < l; ++i) {
  17608. if (hasOwnProperty(value, String(i))) {
  17609. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  17610. String(i), true));
  17611. } else {
  17612. output.push('');
  17613. }
  17614. }
  17615. keys.forEach(function(key) {
  17616. if (!key.match(/^\d+$/)) {
  17617. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  17618. key, true));
  17619. }
  17620. });
  17621. return output;
  17622. }
  17623. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  17624. var name, str, desc;
  17625. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  17626. if (desc.get) {
  17627. if (desc.set) {
  17628. str = ctx.stylize('[Getter/Setter]', 'special');
  17629. } else {
  17630. str = ctx.stylize('[Getter]', 'special');
  17631. }
  17632. } else {
  17633. if (desc.set) {
  17634. str = ctx.stylize('[Setter]', 'special');
  17635. }
  17636. }
  17637. if (!hasOwnProperty(visibleKeys, key)) {
  17638. name = '[' + key + ']';
  17639. }
  17640. if (!str) {
  17641. if (ctx.seen.indexOf(desc.value) < 0) {
  17642. if (isNull(recurseTimes)) {
  17643. str = formatValue(ctx, desc.value, null);
  17644. } else {
  17645. str = formatValue(ctx, desc.value, recurseTimes - 1);
  17646. }
  17647. if (str.indexOf('\n') > -1) {
  17648. if (array) {
  17649. str = str.split('\n').map(function(line) {
  17650. return ' ' + line;
  17651. }).join('\n').substr(2);
  17652. } else {
  17653. str = '\n' + str.split('\n').map(function(line) {
  17654. return ' ' + line;
  17655. }).join('\n');
  17656. }
  17657. }
  17658. } else {
  17659. str = ctx.stylize('[Circular]', 'special');
  17660. }
  17661. }
  17662. if (isUndefined(name)) {
  17663. if (array && key.match(/^\d+$/)) {
  17664. return str;
  17665. }
  17666. name = JSON.stringify('' + key);
  17667. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  17668. name = name.substr(1, name.length - 2);
  17669. name = ctx.stylize(name, 'name');
  17670. } else {
  17671. name = name.replace(/'/g, "\\'")
  17672. .replace(/\\"/g, '"')
  17673. .replace(/(^"|"$)/g, "'");
  17674. name = ctx.stylize(name, 'string');
  17675. }
  17676. }
  17677. return name + ': ' + str;
  17678. }
  17679. function reduceToSingleString(output, base, braces) {
  17680. var numLinesEst = 0;
  17681. var length = output.reduce(function(prev, cur) {
  17682. numLinesEst++;
  17683. if (cur.indexOf('\n') >= 0) numLinesEst++;
  17684. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  17685. }, 0);
  17686. if (length > 60) {
  17687. return braces[0] +
  17688. (base === '' ? '' : base + '\n ') +
  17689. ' ' +
  17690. output.join(',\n ') +
  17691. ' ' +
  17692. braces[1];
  17693. }
  17694. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  17695. }
  17696. // NOTE: These type checking functions intentionally don't use `instanceof`
  17697. // because it is fragile and can be easily faked with `Object.create()`.
  17698. function isArray(ar) {
  17699. return Array.isArray(ar);
  17700. }
  17701. exports.isArray = isArray;
  17702. function isBoolean(arg) {
  17703. return typeof arg === 'boolean';
  17704. }
  17705. exports.isBoolean = isBoolean;
  17706. function isNull(arg) {
  17707. return arg === null;
  17708. }
  17709. exports.isNull = isNull;
  17710. function isNullOrUndefined(arg) {
  17711. return arg == null;
  17712. }
  17713. exports.isNullOrUndefined = isNullOrUndefined;
  17714. function isNumber(arg) {
  17715. return typeof arg === 'number';
  17716. }
  17717. exports.isNumber = isNumber;
  17718. function isString(arg) {
  17719. return typeof arg === 'string';
  17720. }
  17721. exports.isString = isString;
  17722. function isSymbol(arg) {
  17723. return typeof arg === 'symbol';
  17724. }
  17725. exports.isSymbol = isSymbol;
  17726. function isUndefined(arg) {
  17727. return arg === void 0;
  17728. }
  17729. exports.isUndefined = isUndefined;
  17730. function isRegExp(re) {
  17731. return isObject(re) && objectToString(re) === '[object RegExp]';
  17732. }
  17733. exports.isRegExp = isRegExp;
  17734. function isObject(arg) {
  17735. return typeof arg === 'object' && arg !== null;
  17736. }
  17737. exports.isObject = isObject;
  17738. function isDate(d) {
  17739. return isObject(d) && objectToString(d) === '[object Date]';
  17740. }
  17741. exports.isDate = isDate;
  17742. function isError(e) {
  17743. return isObject(e) &&
  17744. (objectToString(e) === '[object Error]' || e instanceof Error);
  17745. }
  17746. exports.isError = isError;
  17747. function isFunction(arg) {
  17748. return typeof arg === 'function';
  17749. }
  17750. exports.isFunction = isFunction;
  17751. function isPrimitive(arg) {
  17752. return arg === null ||
  17753. typeof arg === 'boolean' ||
  17754. typeof arg === 'number' ||
  17755. typeof arg === 'string' ||
  17756. typeof arg === 'symbol' || // ES6 symbol
  17757. typeof arg === 'undefined';
  17758. }
  17759. exports.isPrimitive = isPrimitive;
  17760. exports.isBuffer = require('./support/isBuffer');
  17761. function objectToString(o) {
  17762. return Object.prototype.toString.call(o);
  17763. }
  17764. function pad(n) {
  17765. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  17766. }
  17767. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  17768. 'Oct', 'Nov', 'Dec'];
  17769. // 26 Feb 16:19:34
  17770. function timestamp() {
  17771. var d = new Date();
  17772. var time = [pad(d.getHours()),
  17773. pad(d.getMinutes()),
  17774. pad(d.getSeconds())].join(':');
  17775. return [d.getDate(), months[d.getMonth()], time].join(' ');
  17776. }
  17777. // log is just a thin wrapper to console.log that prepends a timestamp
  17778. exports.log = function() {
  17779. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  17780. };
  17781. /**
  17782. * Inherit the prototype methods from one constructor into another.
  17783. *
  17784. * The Function.prototype.inherits from lang.js rewritten as a standalone
  17785. * function (not on Function.prototype). NOTE: If this file is to be loaded
  17786. * during bootstrapping this function needs to be rewritten using some native
  17787. * functions as prototype setup using normal JavaScript does not work as
  17788. * expected during bootstrapping (see mirror.js in r114903).
  17789. *
  17790. * @param {function} ctor Constructor function which needs to inherit the
  17791. * prototype.
  17792. * @param {function} superCtor Constructor function to inherit prototype from.
  17793. */
  17794. exports.inherits = require('inherits');
  17795. exports._extend = function(origin, add) {
  17796. // Don't do anything if add isn't an object
  17797. if (!add || !isObject(add)) return origin;
  17798. var keys = Object.keys(add);
  17799. var i = keys.length;
  17800. while (i--) {
  17801. origin[keys[i]] = add[keys[i]];
  17802. }
  17803. return origin;
  17804. };
  17805. function hasOwnProperty(obj, prop) {
  17806. return Object.prototype.hasOwnProperty.call(obj, prop);
  17807. }
  17808. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  17809. },{"./support/isBuffer":104,"_process":101,"inherits":103}],106:[function(require,module,exports){
  17810. // Generated by CoffeeScript 1.12.7
  17811. (function() {
  17812. var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject,
  17813. slice = [].slice,
  17814. hasProp = {}.hasOwnProperty;
  17815. assign = function() {
  17816. var i, key, len, source, sources, target;
  17817. target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
  17818. if (isFunction(Object.assign)) {
  17819. Object.assign.apply(null, arguments);
  17820. } else {
  17821. for (i = 0, len = sources.length; i < len; i++) {
  17822. source = sources[i];
  17823. if (source != null) {
  17824. for (key in source) {
  17825. if (!hasProp.call(source, key)) continue;
  17826. target[key] = source[key];
  17827. }
  17828. }
  17829. }
  17830. }
  17831. return target;
  17832. };
  17833. isFunction = function(val) {
  17834. return !!val && Object.prototype.toString.call(val) === '[object Function]';
  17835. };
  17836. isObject = function(val) {
  17837. var ref;
  17838. return !!val && ((ref = typeof val) === 'function' || ref === 'object');
  17839. };
  17840. isArray = function(val) {
  17841. if (isFunction(Array.isArray)) {
  17842. return Array.isArray(val);
  17843. } else {
  17844. return Object.prototype.toString.call(val) === '[object Array]';
  17845. }
  17846. };
  17847. isEmpty = function(val) {
  17848. var key;
  17849. if (isArray(val)) {
  17850. return !val.length;
  17851. } else {
  17852. for (key in val) {
  17853. if (!hasProp.call(val, key)) continue;
  17854. return false;
  17855. }
  17856. return true;
  17857. }
  17858. };
  17859. isPlainObject = function(val) {
  17860. var ctor, proto;
  17861. return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));
  17862. };
  17863. getValue = function(obj) {
  17864. if (isFunction(obj.valueOf)) {
  17865. return obj.valueOf();
  17866. } else {
  17867. return obj;
  17868. }
  17869. };
  17870. module.exports.assign = assign;
  17871. module.exports.isFunction = isFunction;
  17872. module.exports.isObject = isObject;
  17873. module.exports.isArray = isArray;
  17874. module.exports.isEmpty = isEmpty;
  17875. module.exports.isPlainObject = isPlainObject;
  17876. module.exports.getValue = getValue;
  17877. }).call(this);
  17878. },{}],107:[function(require,module,exports){
  17879. // Generated by CoffeeScript 1.12.7
  17880. (function() {
  17881. var XMLAttribute;
  17882. module.exports = XMLAttribute = (function() {
  17883. function XMLAttribute(parent, name, value) {
  17884. this.options = parent.options;
  17885. this.stringify = parent.stringify;
  17886. this.parent = parent;
  17887. if (name == null) {
  17888. throw new Error("Missing attribute name. " + this.debugInfo(name));
  17889. }
  17890. if (value == null) {
  17891. throw new Error("Missing attribute value. " + this.debugInfo(name));
  17892. }
  17893. this.name = this.stringify.attName(name);
  17894. this.value = this.stringify.attValue(value);
  17895. }
  17896. XMLAttribute.prototype.clone = function() {
  17897. return Object.create(this);
  17898. };
  17899. XMLAttribute.prototype.toString = function(options) {
  17900. return this.options.writer.set(options).attribute(this);
  17901. };
  17902. XMLAttribute.prototype.debugInfo = function(name) {
  17903. var ref, ref1;
  17904. name = name || this.name;
  17905. if ((name == null) && !((ref = this.parent) != null ? ref.name : void 0)) {
  17906. return "";
  17907. } else if (name == null) {
  17908. return "parent: <" + this.parent.name + ">";
  17909. } else if (!((ref1 = this.parent) != null ? ref1.name : void 0)) {
  17910. return "attribute: {" + name + "}";
  17911. } else {
  17912. return "attribute: {" + name + "}, parent: <" + this.parent.name + ">";
  17913. }
  17914. };
  17915. return XMLAttribute;
  17916. })();
  17917. }).call(this);
  17918. },{}],108:[function(require,module,exports){
  17919. // Generated by CoffeeScript 1.12.7
  17920. (function() {
  17921. var XMLCData, XMLNode,
  17922. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  17923. hasProp = {}.hasOwnProperty;
  17924. XMLNode = require('./XMLNode');
  17925. module.exports = XMLCData = (function(superClass) {
  17926. extend(XMLCData, superClass);
  17927. function XMLCData(parent, text) {
  17928. XMLCData.__super__.constructor.call(this, parent);
  17929. if (text == null) {
  17930. throw new Error("Missing CDATA text. " + this.debugInfo());
  17931. }
  17932. this.text = this.stringify.cdata(text);
  17933. }
  17934. XMLCData.prototype.clone = function() {
  17935. return Object.create(this);
  17936. };
  17937. XMLCData.prototype.toString = function(options) {
  17938. return this.options.writer.set(options).cdata(this);
  17939. };
  17940. return XMLCData;
  17941. })(XMLNode);
  17942. }).call(this);
  17943. },{"./XMLNode":119}],109:[function(require,module,exports){
  17944. // Generated by CoffeeScript 1.12.7
  17945. (function() {
  17946. var XMLComment, XMLNode,
  17947. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  17948. hasProp = {}.hasOwnProperty;
  17949. XMLNode = require('./XMLNode');
  17950. module.exports = XMLComment = (function(superClass) {
  17951. extend(XMLComment, superClass);
  17952. function XMLComment(parent, text) {
  17953. XMLComment.__super__.constructor.call(this, parent);
  17954. if (text == null) {
  17955. throw new Error("Missing comment text. " + this.debugInfo());
  17956. }
  17957. this.text = this.stringify.comment(text);
  17958. }
  17959. XMLComment.prototype.clone = function() {
  17960. return Object.create(this);
  17961. };
  17962. XMLComment.prototype.toString = function(options) {
  17963. return this.options.writer.set(options).comment(this);
  17964. };
  17965. return XMLComment;
  17966. })(XMLNode);
  17967. }).call(this);
  17968. },{"./XMLNode":119}],110:[function(require,module,exports){
  17969. // Generated by CoffeeScript 1.12.7
  17970. (function() {
  17971. var XMLDTDAttList, XMLNode,
  17972. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  17973. hasProp = {}.hasOwnProperty;
  17974. XMLNode = require('./XMLNode');
  17975. module.exports = XMLDTDAttList = (function(superClass) {
  17976. extend(XMLDTDAttList, superClass);
  17977. function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  17978. XMLDTDAttList.__super__.constructor.call(this, parent);
  17979. if (elementName == null) {
  17980. throw new Error("Missing DTD element name. " + this.debugInfo());
  17981. }
  17982. if (attributeName == null) {
  17983. throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName));
  17984. }
  17985. if (!attributeType) {
  17986. throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName));
  17987. }
  17988. if (!defaultValueType) {
  17989. throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName));
  17990. }
  17991. if (defaultValueType.indexOf('#') !== 0) {
  17992. defaultValueType = '#' + defaultValueType;
  17993. }
  17994. if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
  17995. throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName));
  17996. }
  17997. if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
  17998. throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName));
  17999. }
  18000. this.elementName = this.stringify.eleName(elementName);
  18001. this.attributeName = this.stringify.attName(attributeName);
  18002. this.attributeType = this.stringify.dtdAttType(attributeType);
  18003. this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
  18004. this.defaultValueType = defaultValueType;
  18005. }
  18006. XMLDTDAttList.prototype.toString = function(options) {
  18007. return this.options.writer.set(options).dtdAttList(this);
  18008. };
  18009. return XMLDTDAttList;
  18010. })(XMLNode);
  18011. }).call(this);
  18012. },{"./XMLNode":119}],111:[function(require,module,exports){
  18013. // Generated by CoffeeScript 1.12.7
  18014. (function() {
  18015. var XMLDTDElement, XMLNode,
  18016. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  18017. hasProp = {}.hasOwnProperty;
  18018. XMLNode = require('./XMLNode');
  18019. module.exports = XMLDTDElement = (function(superClass) {
  18020. extend(XMLDTDElement, superClass);
  18021. function XMLDTDElement(parent, name, value) {
  18022. XMLDTDElement.__super__.constructor.call(this, parent);
  18023. if (name == null) {
  18024. throw new Error("Missing DTD element name. " + this.debugInfo());
  18025. }
  18026. if (!value) {
  18027. value = '(#PCDATA)';
  18028. }
  18029. if (Array.isArray(value)) {
  18030. value = '(' + value.join(',') + ')';
  18031. }
  18032. this.name = this.stringify.eleName(name);
  18033. this.value = this.stringify.dtdElementValue(value);
  18034. }
  18035. XMLDTDElement.prototype.toString = function(options) {
  18036. return this.options.writer.set(options).dtdElement(this);
  18037. };
  18038. return XMLDTDElement;
  18039. })(XMLNode);
  18040. }).call(this);
  18041. },{"./XMLNode":119}],112:[function(require,module,exports){
  18042. // Generated by CoffeeScript 1.12.7
  18043. (function() {
  18044. var XMLDTDEntity, XMLNode, isObject,
  18045. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  18046. hasProp = {}.hasOwnProperty;
  18047. isObject = require('./Utility').isObject;
  18048. XMLNode = require('./XMLNode');
  18049. module.exports = XMLDTDEntity = (function(superClass) {
  18050. extend(XMLDTDEntity, superClass);
  18051. function XMLDTDEntity(parent, pe, name, value) {
  18052. XMLDTDEntity.__super__.constructor.call(this, parent);
  18053. if (name == null) {
  18054. throw new Error("Missing DTD entity name. " + this.debugInfo(name));
  18055. }
  18056. if (value == null) {
  18057. throw new Error("Missing DTD entity value. " + this.debugInfo(name));
  18058. }
  18059. this.pe = !!pe;
  18060. this.name = this.stringify.eleName(name);
  18061. if (!isObject(value)) {
  18062. this.value = this.stringify.dtdEntityValue(value);
  18063. } else {
  18064. if (!value.pubID && !value.sysID) {
  18065. throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name));
  18066. }
  18067. if (value.pubID && !value.sysID) {
  18068. throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name));
  18069. }
  18070. if (value.pubID != null) {
  18071. this.pubID = this.stringify.dtdPubID(value.pubID);
  18072. }
  18073. if (value.sysID != null) {
  18074. this.sysID = this.stringify.dtdSysID(value.sysID);
  18075. }
  18076. if (value.nData != null) {
  18077. this.nData = this.stringify.dtdNData(value.nData);
  18078. }
  18079. if (this.pe && this.nData) {
  18080. throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name));
  18081. }
  18082. }
  18083. }
  18084. XMLDTDEntity.prototype.toString = function(options) {
  18085. return this.options.writer.set(options).dtdEntity(this);
  18086. };
  18087. return XMLDTDEntity;
  18088. })(XMLNode);
  18089. }).call(this);
  18090. },{"./Utility":106,"./XMLNode":119}],113:[function(require,module,exports){
  18091. // Generated by CoffeeScript 1.12.7
  18092. (function() {
  18093. var XMLDTDNotation, XMLNode,
  18094. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  18095. hasProp = {}.hasOwnProperty;
  18096. XMLNode = require('./XMLNode');
  18097. module.exports = XMLDTDNotation = (function(superClass) {
  18098. extend(XMLDTDNotation, superClass);
  18099. function XMLDTDNotation(parent, name, value) {
  18100. XMLDTDNotation.__super__.constructor.call(this, parent);
  18101. if (name == null) {
  18102. throw new Error("Missing DTD notation name. " + this.debugInfo(name));
  18103. }
  18104. if (!value.pubID && !value.sysID) {
  18105. throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
  18106. }
  18107. this.name = this.stringify.eleName(name);
  18108. if (value.pubID != null) {
  18109. this.pubID = this.stringify.dtdPubID(value.pubID);
  18110. }
  18111. if (value.sysID != null) {
  18112. this.sysID = this.stringify.dtdSysID(value.sysID);
  18113. }
  18114. }
  18115. XMLDTDNotation.prototype.toString = function(options) {
  18116. return this.options.writer.set(options).dtdNotation(this);
  18117. };
  18118. return XMLDTDNotation;
  18119. })(XMLNode);
  18120. }).call(this);
  18121. },{"./XMLNode":119}],114:[function(require,module,exports){
  18122. // Generated by CoffeeScript 1.12.7
  18123. (function() {
  18124. var XMLDeclaration, XMLNode, isObject,
  18125. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  18126. hasProp = {}.hasOwnProperty;
  18127. isObject = require('./Utility').isObject;
  18128. XMLNode = require('./XMLNode');
  18129. module.exports = XMLDeclaration = (function(superClass) {
  18130. extend(XMLDeclaration, superClass);
  18131. function XMLDeclaration(parent, version, encoding, standalone) {
  18132. var ref;
  18133. XMLDeclaration.__super__.constructor.call(this, parent);
  18134. if (isObject(version)) {
  18135. ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
  18136. }
  18137. if (!version) {
  18138. version = '1.0';
  18139. }
  18140. this.version = this.stringify.xmlVersion(version);
  18141. if (encoding != null) {
  18142. this.encoding = this.stringify.xmlEncoding(encoding);
  18143. }
  18144. if (standalone != null) {
  18145. this.standalone = this.stringify.xmlStandalone(standalone);
  18146. }
  18147. }
  18148. XMLDeclaration.prototype.toString = function(options) {
  18149. return this.options.writer.set(options).declaration(this);
  18150. };
  18151. return XMLDeclaration;
  18152. })(XMLNode);
  18153. }).call(this);
  18154. },{"./Utility":106,"./XMLNode":119}],115:[function(require,module,exports){
  18155. // Generated by CoffeeScript 1.12.7
  18156. (function() {
  18157. var XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNode, isObject,
  18158. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  18159. hasProp = {}.hasOwnProperty;
  18160. isObject = require('./Utility').isObject;
  18161. XMLNode = require('./XMLNode');
  18162. XMLDTDAttList = require('./XMLDTDAttList');
  18163. XMLDTDEntity = require('./XMLDTDEntity');
  18164. XMLDTDElement = require('./XMLDTDElement');
  18165. XMLDTDNotation = require('./XMLDTDNotation');
  18166. module.exports = XMLDocType = (function(superClass) {
  18167. extend(XMLDocType, superClass);
  18168. function XMLDocType(parent, pubID, sysID) {
  18169. var ref, ref1;
  18170. XMLDocType.__super__.constructor.call(this, parent);
  18171. this.name = "!DOCTYPE";
  18172. this.documentObject = parent;
  18173. if (isObject(pubID)) {
  18174. ref = pubID, pubID = ref.pubID, sysID = ref.sysID;
  18175. }
  18176. if (sysID == null) {
  18177. ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1];
  18178. }
  18179. if (pubID != null) {
  18180. this.pubID = this.stringify.dtdPubID(pubID);
  18181. }
  18182. if (sysID != null) {
  18183. this.sysID = this.stringify.dtdSysID(sysID);
  18184. }
  18185. }
  18186. XMLDocType.prototype.element = function(name, value) {
  18187. var child;
  18188. child = new XMLDTDElement(this, name, value);
  18189. this.children.push(child);
  18190. return this;
  18191. };
  18192. XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  18193. var child;
  18194. child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
  18195. this.children.push(child);
  18196. return this;
  18197. };
  18198. XMLDocType.prototype.entity = function(name, value) {
  18199. var child;
  18200. child = new XMLDTDEntity(this, false, name, value);
  18201. this.children.push(child);
  18202. return this;
  18203. };
  18204. XMLDocType.prototype.pEntity = function(name, value) {
  18205. var child;
  18206. child = new XMLDTDEntity(this, true, name, value);
  18207. this.children.push(child);
  18208. return this;
  18209. };
  18210. XMLDocType.prototype.notation = function(name, value) {
  18211. var child;
  18212. child = new XMLDTDNotation(this, name, value);
  18213. this.children.push(child);
  18214. return this;
  18215. };
  18216. XMLDocType.prototype.toString = function(options) {
  18217. return this.options.writer.set(options).docType(this);
  18218. };
  18219. XMLDocType.prototype.ele = function(name, value) {
  18220. return this.element(name, value);
  18221. };
  18222. XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  18223. return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
  18224. };
  18225. XMLDocType.prototype.ent = function(name, value) {
  18226. return this.entity(name, value);
  18227. };
  18228. XMLDocType.prototype.pent = function(name, value) {
  18229. return this.pEntity(name, value);
  18230. };
  18231. XMLDocType.prototype.not = function(name, value) {
  18232. return this.notation(name, value);
  18233. };
  18234. XMLDocType.prototype.up = function() {
  18235. return this.root() || this.documentObject;
  18236. };
  18237. return XMLDocType;
  18238. })(XMLNode);
  18239. }).call(this);
  18240. },{"./Utility":106,"./XMLDTDAttList":110,"./XMLDTDElement":111,"./XMLDTDEntity":112,"./XMLDTDNotation":113,"./XMLNode":119}],116:[function(require,module,exports){
  18241. // Generated by CoffeeScript 1.12.7
  18242. (function() {
  18243. var XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject,
  18244. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  18245. hasProp = {}.hasOwnProperty;
  18246. isPlainObject = require('./Utility').isPlainObject;
  18247. XMLNode = require('./XMLNode');
  18248. XMLStringifier = require('./XMLStringifier');
  18249. XMLStringWriter = require('./XMLStringWriter');
  18250. module.exports = XMLDocument = (function(superClass) {
  18251. extend(XMLDocument, superClass);
  18252. function XMLDocument(options) {
  18253. XMLDocument.__super__.constructor.call(this, null);
  18254. this.name = "?xml";
  18255. options || (options = {});
  18256. if (!options.writer) {
  18257. options.writer = new XMLStringWriter();
  18258. }
  18259. this.options = options;
  18260. this.stringify = new XMLStringifier(options);
  18261. this.isDocument = true;
  18262. }
  18263. XMLDocument.prototype.end = function(writer) {
  18264. var writerOptions;
  18265. if (!writer) {
  18266. writer = this.options.writer;
  18267. } else if (isPlainObject(writer)) {
  18268. writerOptions = writer;
  18269. writer = this.options.writer.set(writerOptions);
  18270. }
  18271. return writer.document(this);
  18272. };
  18273. XMLDocument.prototype.toString = function(options) {
  18274. return this.options.writer.set(options).document(this);
  18275. };
  18276. return XMLDocument;
  18277. })(XMLNode);
  18278. }).call(this);
  18279. },{"./Utility":106,"./XMLNode":119,"./XMLStringWriter":123,"./XMLStringifier":124}],117:[function(require,module,exports){
  18280. // Generated by CoffeeScript 1.12.7
  18281. (function() {
  18282. var XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref,
  18283. hasProp = {}.hasOwnProperty;
  18284. ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue;
  18285. XMLElement = require('./XMLElement');
  18286. XMLCData = require('./XMLCData');
  18287. XMLComment = require('./XMLComment');
  18288. XMLRaw = require('./XMLRaw');
  18289. XMLText = require('./XMLText');
  18290. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  18291. XMLDeclaration = require('./XMLDeclaration');
  18292. XMLDocType = require('./XMLDocType');
  18293. XMLDTDAttList = require('./XMLDTDAttList');
  18294. XMLDTDEntity = require('./XMLDTDEntity');
  18295. XMLDTDElement = require('./XMLDTDElement');
  18296. XMLDTDNotation = require('./XMLDTDNotation');
  18297. XMLAttribute = require('./XMLAttribute');
  18298. XMLStringifier = require('./XMLStringifier');
  18299. XMLStringWriter = require('./XMLStringWriter');
  18300. module.exports = XMLDocumentCB = (function() {
  18301. function XMLDocumentCB(options, onData, onEnd) {
  18302. var writerOptions;
  18303. this.name = "?xml";
  18304. options || (options = {});
  18305. if (!options.writer) {
  18306. options.writer = new XMLStringWriter(options);
  18307. } else if (isPlainObject(options.writer)) {
  18308. writerOptions = options.writer;
  18309. options.writer = new XMLStringWriter(writerOptions);
  18310. }
  18311. this.options = options;
  18312. this.writer = options.writer;
  18313. this.stringify = new XMLStringifier(options);
  18314. this.onDataCallback = onData || function() {};
  18315. this.onEndCallback = onEnd || function() {};
  18316. this.currentNode = null;
  18317. this.currentLevel = -1;
  18318. this.openTags = {};
  18319. this.documentStarted = false;
  18320. this.documentCompleted = false;
  18321. this.root = null;
  18322. }
  18323. XMLDocumentCB.prototype.node = function(name, attributes, text) {
  18324. var ref1;
  18325. if (name == null) {
  18326. throw new Error("Missing node name.");
  18327. }
  18328. if (this.root && this.currentLevel === -1) {
  18329. throw new Error("Document can only have one root node. " + this.debugInfo(name));
  18330. }
  18331. this.openCurrent();
  18332. name = getValue(name);
  18333. if (attributes == null) {
  18334. attributes = {};
  18335. }
  18336. attributes = getValue(attributes);
  18337. if (!isObject(attributes)) {
  18338. ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
  18339. }
  18340. this.currentNode = new XMLElement(this, name, attributes);
  18341. this.currentNode.children = false;
  18342. this.currentLevel++;
  18343. this.openTags[this.currentLevel] = this.currentNode;
  18344. if (text != null) {
  18345. this.text(text);
  18346. }
  18347. return this;
  18348. };
  18349. XMLDocumentCB.prototype.element = function(name, attributes, text) {
  18350. if (this.currentNode && this.currentNode instanceof XMLDocType) {
  18351. return this.dtdElement.apply(this, arguments);
  18352. } else {
  18353. return this.node(name, attributes, text);
  18354. }
  18355. };
  18356. XMLDocumentCB.prototype.attribute = function(name, value) {
  18357. var attName, attValue;
  18358. if (!this.currentNode || this.currentNode.children) {
  18359. throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name));
  18360. }
  18361. if (name != null) {
  18362. name = getValue(name);
  18363. }
  18364. if (isObject(name)) {
  18365. for (attName in name) {
  18366. if (!hasProp.call(name, attName)) continue;
  18367. attValue = name[attName];
  18368. this.attribute(attName, attValue);
  18369. }
  18370. } else {
  18371. if (isFunction(value)) {
  18372. value = value.apply();
  18373. }
  18374. if (!this.options.skipNullAttributes || (value != null)) {
  18375. this.currentNode.attributes[name] = new XMLAttribute(this, name, value);
  18376. }
  18377. }
  18378. return this;
  18379. };
  18380. XMLDocumentCB.prototype.text = function(value) {
  18381. var node;
  18382. this.openCurrent();
  18383. node = new XMLText(this, value);
  18384. this.onData(this.writer.text(node, this.currentLevel + 1), this.currentLevel + 1);
  18385. return this;
  18386. };
  18387. XMLDocumentCB.prototype.cdata = function(value) {
  18388. var node;
  18389. this.openCurrent();
  18390. node = new XMLCData(this, value);
  18391. this.onData(this.writer.cdata(node, this.currentLevel + 1), this.currentLevel + 1);
  18392. return this;
  18393. };
  18394. XMLDocumentCB.prototype.comment = function(value) {
  18395. var node;
  18396. this.openCurrent();
  18397. node = new XMLComment(this, value);
  18398. this.onData(this.writer.comment(node, this.currentLevel + 1), this.currentLevel + 1);
  18399. return this;
  18400. };
  18401. XMLDocumentCB.prototype.raw = function(value) {
  18402. var node;
  18403. this.openCurrent();
  18404. node = new XMLRaw(this, value);
  18405. this.onData(this.writer.raw(node, this.currentLevel + 1), this.currentLevel + 1);
  18406. return this;
  18407. };
  18408. XMLDocumentCB.prototype.instruction = function(target, value) {
  18409. var i, insTarget, insValue, len, node;
  18410. this.openCurrent();
  18411. if (target != null) {
  18412. target = getValue(target);
  18413. }
  18414. if (value != null) {
  18415. value = getValue(value);
  18416. }
  18417. if (Array.isArray(target)) {
  18418. for (i = 0, len = target.length; i < len; i++) {
  18419. insTarget = target[i];
  18420. this.instruction(insTarget);
  18421. }
  18422. } else if (isObject(target)) {
  18423. for (insTarget in target) {
  18424. if (!hasProp.call(target, insTarget)) continue;
  18425. insValue = target[insTarget];
  18426. this.instruction(insTarget, insValue);
  18427. }
  18428. } else {
  18429. if (isFunction(value)) {
  18430. value = value.apply();
  18431. }
  18432. node = new XMLProcessingInstruction(this, target, value);
  18433. this.onData(this.writer.processingInstruction(node, this.currentLevel + 1), this.currentLevel + 1);
  18434. }
  18435. return this;
  18436. };
  18437. XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) {
  18438. var node;
  18439. this.openCurrent();
  18440. if (this.documentStarted) {
  18441. throw new Error("declaration() must be the first node.");
  18442. }
  18443. node = new XMLDeclaration(this, version, encoding, standalone);
  18444. this.onData(this.writer.declaration(node, this.currentLevel + 1), this.currentLevel + 1);
  18445. return this;
  18446. };
  18447. XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) {
  18448. this.openCurrent();
  18449. if (root == null) {
  18450. throw new Error("Missing root node name.");
  18451. }
  18452. if (this.root) {
  18453. throw new Error("dtd() must come before the root node.");
  18454. }
  18455. this.currentNode = new XMLDocType(this, pubID, sysID);
  18456. this.currentNode.rootNodeName = root;
  18457. this.currentNode.children = false;
  18458. this.currentLevel++;
  18459. this.openTags[this.currentLevel] = this.currentNode;
  18460. return this;
  18461. };
  18462. XMLDocumentCB.prototype.dtdElement = function(name, value) {
  18463. var node;
  18464. this.openCurrent();
  18465. node = new XMLDTDElement(this, name, value);
  18466. this.onData(this.writer.dtdElement(node, this.currentLevel + 1), this.currentLevel + 1);
  18467. return this;
  18468. };
  18469. XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  18470. var node;
  18471. this.openCurrent();
  18472. node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
  18473. this.onData(this.writer.dtdAttList(node, this.currentLevel + 1), this.currentLevel + 1);
  18474. return this;
  18475. };
  18476. XMLDocumentCB.prototype.entity = function(name, value) {
  18477. var node;
  18478. this.openCurrent();
  18479. node = new XMLDTDEntity(this, false, name, value);
  18480. this.onData(this.writer.dtdEntity(node, this.currentLevel + 1), this.currentLevel + 1);
  18481. return this;
  18482. };
  18483. XMLDocumentCB.prototype.pEntity = function(name, value) {
  18484. var node;
  18485. this.openCurrent();
  18486. node = new XMLDTDEntity(this, true, name, value);
  18487. this.onData(this.writer.dtdEntity(node, this.currentLevel + 1), this.currentLevel + 1);
  18488. return this;
  18489. };
  18490. XMLDocumentCB.prototype.notation = function(name, value) {
  18491. var node;
  18492. this.openCurrent();
  18493. node = new XMLDTDNotation(this, name, value);
  18494. this.onData(this.writer.dtdNotation(node, this.currentLevel + 1), this.currentLevel + 1);
  18495. return this;
  18496. };
  18497. XMLDocumentCB.prototype.up = function() {
  18498. if (this.currentLevel < 0) {
  18499. throw new Error("The document node has no parent.");
  18500. }
  18501. if (this.currentNode) {
  18502. if (this.currentNode.children) {
  18503. this.closeNode(this.currentNode);
  18504. } else {
  18505. this.openNode(this.currentNode);
  18506. }
  18507. this.currentNode = null;
  18508. } else {
  18509. this.closeNode(this.openTags[this.currentLevel]);
  18510. }
  18511. delete this.openTags[this.currentLevel];
  18512. this.currentLevel--;
  18513. return this;
  18514. };
  18515. XMLDocumentCB.prototype.end = function() {
  18516. while (this.currentLevel >= 0) {
  18517. this.up();
  18518. }
  18519. return this.onEnd();
  18520. };
  18521. XMLDocumentCB.prototype.openCurrent = function() {
  18522. if (this.currentNode) {
  18523. this.currentNode.children = true;
  18524. return this.openNode(this.currentNode);
  18525. }
  18526. };
  18527. XMLDocumentCB.prototype.openNode = function(node) {
  18528. if (!node.isOpen) {
  18529. if (!this.root && this.currentLevel === 0 && node instanceof XMLElement) {
  18530. this.root = node;
  18531. }
  18532. this.onData(this.writer.openNode(node, this.currentLevel), this.currentLevel);
  18533. return node.isOpen = true;
  18534. }
  18535. };
  18536. XMLDocumentCB.prototype.closeNode = function(node) {
  18537. if (!node.isClosed) {
  18538. this.onData(this.writer.closeNode(node, this.currentLevel), this.currentLevel);
  18539. return node.isClosed = true;
  18540. }
  18541. };
  18542. XMLDocumentCB.prototype.onData = function(chunk, level) {
  18543. this.documentStarted = true;
  18544. return this.onDataCallback(chunk, level + 1);
  18545. };
  18546. XMLDocumentCB.prototype.onEnd = function() {
  18547. this.documentCompleted = true;
  18548. return this.onEndCallback();
  18549. };
  18550. XMLDocumentCB.prototype.debugInfo = function(name) {
  18551. if (name == null) {
  18552. return "";
  18553. } else {
  18554. return "node: <" + name + ">";
  18555. }
  18556. };
  18557. XMLDocumentCB.prototype.ele = function() {
  18558. return this.element.apply(this, arguments);
  18559. };
  18560. XMLDocumentCB.prototype.nod = function(name, attributes, text) {
  18561. return this.node(name, attributes, text);
  18562. };
  18563. XMLDocumentCB.prototype.txt = function(value) {
  18564. return this.text(value);
  18565. };
  18566. XMLDocumentCB.prototype.dat = function(value) {
  18567. return this.cdata(value);
  18568. };
  18569. XMLDocumentCB.prototype.com = function(value) {
  18570. return this.comment(value);
  18571. };
  18572. XMLDocumentCB.prototype.ins = function(target, value) {
  18573. return this.instruction(target, value);
  18574. };
  18575. XMLDocumentCB.prototype.dec = function(version, encoding, standalone) {
  18576. return this.declaration(version, encoding, standalone);
  18577. };
  18578. XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) {
  18579. return this.doctype(root, pubID, sysID);
  18580. };
  18581. XMLDocumentCB.prototype.e = function(name, attributes, text) {
  18582. return this.element(name, attributes, text);
  18583. };
  18584. XMLDocumentCB.prototype.n = function(name, attributes, text) {
  18585. return this.node(name, attributes, text);
  18586. };
  18587. XMLDocumentCB.prototype.t = function(value) {
  18588. return this.text(value);
  18589. };
  18590. XMLDocumentCB.prototype.d = function(value) {
  18591. return this.cdata(value);
  18592. };
  18593. XMLDocumentCB.prototype.c = function(value) {
  18594. return this.comment(value);
  18595. };
  18596. XMLDocumentCB.prototype.r = function(value) {
  18597. return this.raw(value);
  18598. };
  18599. XMLDocumentCB.prototype.i = function(target, value) {
  18600. return this.instruction(target, value);
  18601. };
  18602. XMLDocumentCB.prototype.att = function() {
  18603. if (this.currentNode && this.currentNode instanceof XMLDocType) {
  18604. return this.attList.apply(this, arguments);
  18605. } else {
  18606. return this.attribute.apply(this, arguments);
  18607. }
  18608. };
  18609. XMLDocumentCB.prototype.a = function() {
  18610. if (this.currentNode && this.currentNode instanceof XMLDocType) {
  18611. return this.attList.apply(this, arguments);
  18612. } else {
  18613. return this.attribute.apply(this, arguments);
  18614. }
  18615. };
  18616. XMLDocumentCB.prototype.ent = function(name, value) {
  18617. return this.entity(name, value);
  18618. };
  18619. XMLDocumentCB.prototype.pent = function(name, value) {
  18620. return this.pEntity(name, value);
  18621. };
  18622. XMLDocumentCB.prototype.not = function(name, value) {
  18623. return this.notation(name, value);
  18624. };
  18625. return XMLDocumentCB;
  18626. })();
  18627. }).call(this);
  18628. },{"./Utility":106,"./XMLAttribute":107,"./XMLCData":108,"./XMLComment":109,"./XMLDTDAttList":110,"./XMLDTDElement":111,"./XMLDTDEntity":112,"./XMLDTDNotation":113,"./XMLDeclaration":114,"./XMLDocType":115,"./XMLElement":118,"./XMLProcessingInstruction":120,"./XMLRaw":121,"./XMLStringWriter":123,"./XMLStringifier":124,"./XMLText":125}],118:[function(require,module,exports){
  18629. // Generated by CoffeeScript 1.12.7
  18630. (function() {
  18631. var XMLAttribute, XMLElement, XMLNode, getValue, isFunction, isObject, ref,
  18632. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  18633. hasProp = {}.hasOwnProperty;
  18634. ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
  18635. XMLNode = require('./XMLNode');
  18636. XMLAttribute = require('./XMLAttribute');
  18637. module.exports = XMLElement = (function(superClass) {
  18638. extend(XMLElement, superClass);
  18639. function XMLElement(parent, name, attributes) {
  18640. XMLElement.__super__.constructor.call(this, parent);
  18641. if (name == null) {
  18642. throw new Error("Missing element name. " + this.debugInfo());
  18643. }
  18644. this.name = this.stringify.eleName(name);
  18645. this.attributes = {};
  18646. if (attributes != null) {
  18647. this.attribute(attributes);
  18648. }
  18649. if (parent.isDocument) {
  18650. this.isRoot = true;
  18651. this.documentObject = parent;
  18652. parent.rootObject = this;
  18653. }
  18654. }
  18655. XMLElement.prototype.clone = function() {
  18656. var att, attName, clonedSelf, ref1;
  18657. clonedSelf = Object.create(this);
  18658. if (clonedSelf.isRoot) {
  18659. clonedSelf.documentObject = null;
  18660. }
  18661. clonedSelf.attributes = {};
  18662. ref1 = this.attributes;
  18663. for (attName in ref1) {
  18664. if (!hasProp.call(ref1, attName)) continue;
  18665. att = ref1[attName];
  18666. clonedSelf.attributes[attName] = att.clone();
  18667. }
  18668. clonedSelf.children = [];
  18669. this.children.forEach(function(child) {
  18670. var clonedChild;
  18671. clonedChild = child.clone();
  18672. clonedChild.parent = clonedSelf;
  18673. return clonedSelf.children.push(clonedChild);
  18674. });
  18675. return clonedSelf;
  18676. };
  18677. XMLElement.prototype.attribute = function(name, value) {
  18678. var attName, attValue;
  18679. if (name != null) {
  18680. name = getValue(name);
  18681. }
  18682. if (isObject(name)) {
  18683. for (attName in name) {
  18684. if (!hasProp.call(name, attName)) continue;
  18685. attValue = name[attName];
  18686. this.attribute(attName, attValue);
  18687. }
  18688. } else {
  18689. if (isFunction(value)) {
  18690. value = value.apply();
  18691. }
  18692. if (!this.options.skipNullAttributes || (value != null)) {
  18693. this.attributes[name] = new XMLAttribute(this, name, value);
  18694. }
  18695. }
  18696. return this;
  18697. };
  18698. XMLElement.prototype.removeAttribute = function(name) {
  18699. var attName, i, len;
  18700. if (name == null) {
  18701. throw new Error("Missing attribute name. " + this.debugInfo());
  18702. }
  18703. name = getValue(name);
  18704. if (Array.isArray(name)) {
  18705. for (i = 0, len = name.length; i < len; i++) {
  18706. attName = name[i];
  18707. delete this.attributes[attName];
  18708. }
  18709. } else {
  18710. delete this.attributes[name];
  18711. }
  18712. return this;
  18713. };
  18714. XMLElement.prototype.toString = function(options) {
  18715. return this.options.writer.set(options).element(this);
  18716. };
  18717. XMLElement.prototype.att = function(name, value) {
  18718. return this.attribute(name, value);
  18719. };
  18720. XMLElement.prototype.a = function(name, value) {
  18721. return this.attribute(name, value);
  18722. };
  18723. return XMLElement;
  18724. })(XMLNode);
  18725. }).call(this);
  18726. },{"./Utility":106,"./XMLAttribute":107,"./XMLNode":119}],119:[function(require,module,exports){
  18727. // Generated by CoffeeScript 1.12.7
  18728. (function() {
  18729. var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref,
  18730. hasProp = {}.hasOwnProperty;
  18731. ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isEmpty = ref.isEmpty, getValue = ref.getValue;
  18732. XMLElement = null;
  18733. XMLCData = null;
  18734. XMLComment = null;
  18735. XMLDeclaration = null;
  18736. XMLDocType = null;
  18737. XMLRaw = null;
  18738. XMLText = null;
  18739. XMLProcessingInstruction = null;
  18740. module.exports = XMLNode = (function() {
  18741. function XMLNode(parent) {
  18742. this.parent = parent;
  18743. if (this.parent) {
  18744. this.options = this.parent.options;
  18745. this.stringify = this.parent.stringify;
  18746. }
  18747. this.children = [];
  18748. if (!XMLElement) {
  18749. XMLElement = require('./XMLElement');
  18750. XMLCData = require('./XMLCData');
  18751. XMLComment = require('./XMLComment');
  18752. XMLDeclaration = require('./XMLDeclaration');
  18753. XMLDocType = require('./XMLDocType');
  18754. XMLRaw = require('./XMLRaw');
  18755. XMLText = require('./XMLText');
  18756. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  18757. }
  18758. }
  18759. XMLNode.prototype.element = function(name, attributes, text) {
  18760. var childNode, item, j, k, key, lastChild, len, len1, ref1, val;
  18761. lastChild = null;
  18762. if (attributes == null) {
  18763. attributes = {};
  18764. }
  18765. attributes = getValue(attributes);
  18766. if (!isObject(attributes)) {
  18767. ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
  18768. }
  18769. if (name != null) {
  18770. name = getValue(name);
  18771. }
  18772. if (Array.isArray(name)) {
  18773. for (j = 0, len = name.length; j < len; j++) {
  18774. item = name[j];
  18775. lastChild = this.element(item);
  18776. }
  18777. } else if (isFunction(name)) {
  18778. lastChild = this.element(name.apply());
  18779. } else if (isObject(name)) {
  18780. for (key in name) {
  18781. if (!hasProp.call(name, key)) continue;
  18782. val = name[key];
  18783. if (isFunction(val)) {
  18784. val = val.apply();
  18785. }
  18786. if ((isObject(val)) && (isEmpty(val))) {
  18787. val = null;
  18788. }
  18789. if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
  18790. lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
  18791. } else if (!this.options.separateArrayItems && Array.isArray(val)) {
  18792. for (k = 0, len1 = val.length; k < len1; k++) {
  18793. item = val[k];
  18794. childNode = {};
  18795. childNode[key] = item;
  18796. lastChild = this.element(childNode);
  18797. }
  18798. } else if (isObject(val)) {
  18799. lastChild = this.element(key);
  18800. lastChild.element(val);
  18801. } else {
  18802. lastChild = this.element(key, val);
  18803. }
  18804. }
  18805. } else {
  18806. if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
  18807. lastChild = this.text(text);
  18808. } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
  18809. lastChild = this.cdata(text);
  18810. } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
  18811. lastChild = this.comment(text);
  18812. } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
  18813. lastChild = this.raw(text);
  18814. } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
  18815. lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
  18816. } else {
  18817. lastChild = this.node(name, attributes, text);
  18818. }
  18819. }
  18820. if (lastChild == null) {
  18821. throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
  18822. }
  18823. return lastChild;
  18824. };
  18825. XMLNode.prototype.insertBefore = function(name, attributes, text) {
  18826. var child, i, removed;
  18827. if (this.isRoot) {
  18828. throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
  18829. }
  18830. i = this.parent.children.indexOf(this);
  18831. removed = this.parent.children.splice(i);
  18832. child = this.parent.element(name, attributes, text);
  18833. Array.prototype.push.apply(this.parent.children, removed);
  18834. return child;
  18835. };
  18836. XMLNode.prototype.insertAfter = function(name, attributes, text) {
  18837. var child, i, removed;
  18838. if (this.isRoot) {
  18839. throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
  18840. }
  18841. i = this.parent.children.indexOf(this);
  18842. removed = this.parent.children.splice(i + 1);
  18843. child = this.parent.element(name, attributes, text);
  18844. Array.prototype.push.apply(this.parent.children, removed);
  18845. return child;
  18846. };
  18847. XMLNode.prototype.remove = function() {
  18848. var i, ref1;
  18849. if (this.isRoot) {
  18850. throw new Error("Cannot remove the root element. " + this.debugInfo());
  18851. }
  18852. i = this.parent.children.indexOf(this);
  18853. [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref1 = [])), ref1;
  18854. return this.parent;
  18855. };
  18856. XMLNode.prototype.node = function(name, attributes, text) {
  18857. var child, ref1;
  18858. if (name != null) {
  18859. name = getValue(name);
  18860. }
  18861. attributes || (attributes = {});
  18862. attributes = getValue(attributes);
  18863. if (!isObject(attributes)) {
  18864. ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
  18865. }
  18866. child = new XMLElement(this, name, attributes);
  18867. if (text != null) {
  18868. child.text(text);
  18869. }
  18870. this.children.push(child);
  18871. return child;
  18872. };
  18873. XMLNode.prototype.text = function(value) {
  18874. var child;
  18875. child = new XMLText(this, value);
  18876. this.children.push(child);
  18877. return this;
  18878. };
  18879. XMLNode.prototype.cdata = function(value) {
  18880. var child;
  18881. child = new XMLCData(this, value);
  18882. this.children.push(child);
  18883. return this;
  18884. };
  18885. XMLNode.prototype.comment = function(value) {
  18886. var child;
  18887. child = new XMLComment(this, value);
  18888. this.children.push(child);
  18889. return this;
  18890. };
  18891. XMLNode.prototype.commentBefore = function(value) {
  18892. var child, i, removed;
  18893. i = this.parent.children.indexOf(this);
  18894. removed = this.parent.children.splice(i);
  18895. child = this.parent.comment(value);
  18896. Array.prototype.push.apply(this.parent.children, removed);
  18897. return this;
  18898. };
  18899. XMLNode.prototype.commentAfter = function(value) {
  18900. var child, i, removed;
  18901. i = this.parent.children.indexOf(this);
  18902. removed = this.parent.children.splice(i + 1);
  18903. child = this.parent.comment(value);
  18904. Array.prototype.push.apply(this.parent.children, removed);
  18905. return this;
  18906. };
  18907. XMLNode.prototype.raw = function(value) {
  18908. var child;
  18909. child = new XMLRaw(this, value);
  18910. this.children.push(child);
  18911. return this;
  18912. };
  18913. XMLNode.prototype.instruction = function(target, value) {
  18914. var insTarget, insValue, instruction, j, len;
  18915. if (target != null) {
  18916. target = getValue(target);
  18917. }
  18918. if (value != null) {
  18919. value = getValue(value);
  18920. }
  18921. if (Array.isArray(target)) {
  18922. for (j = 0, len = target.length; j < len; j++) {
  18923. insTarget = target[j];
  18924. this.instruction(insTarget);
  18925. }
  18926. } else if (isObject(target)) {
  18927. for (insTarget in target) {
  18928. if (!hasProp.call(target, insTarget)) continue;
  18929. insValue = target[insTarget];
  18930. this.instruction(insTarget, insValue);
  18931. }
  18932. } else {
  18933. if (isFunction(value)) {
  18934. value = value.apply();
  18935. }
  18936. instruction = new XMLProcessingInstruction(this, target, value);
  18937. this.children.push(instruction);
  18938. }
  18939. return this;
  18940. };
  18941. XMLNode.prototype.instructionBefore = function(target, value) {
  18942. var child, i, removed;
  18943. i = this.parent.children.indexOf(this);
  18944. removed = this.parent.children.splice(i);
  18945. child = this.parent.instruction(target, value);
  18946. Array.prototype.push.apply(this.parent.children, removed);
  18947. return this;
  18948. };
  18949. XMLNode.prototype.instructionAfter = function(target, value) {
  18950. var child, i, removed;
  18951. i = this.parent.children.indexOf(this);
  18952. removed = this.parent.children.splice(i + 1);
  18953. child = this.parent.instruction(target, value);
  18954. Array.prototype.push.apply(this.parent.children, removed);
  18955. return this;
  18956. };
  18957. XMLNode.prototype.declaration = function(version, encoding, standalone) {
  18958. var doc, xmldec;
  18959. doc = this.document();
  18960. xmldec = new XMLDeclaration(doc, version, encoding, standalone);
  18961. if (doc.children[0] instanceof XMLDeclaration) {
  18962. doc.children[0] = xmldec;
  18963. } else {
  18964. doc.children.unshift(xmldec);
  18965. }
  18966. return doc.root() || doc;
  18967. };
  18968. XMLNode.prototype.doctype = function(pubID, sysID) {
  18969. var child, doc, doctype, i, j, k, len, len1, ref1, ref2;
  18970. doc = this.document();
  18971. doctype = new XMLDocType(doc, pubID, sysID);
  18972. ref1 = doc.children;
  18973. for (i = j = 0, len = ref1.length; j < len; i = ++j) {
  18974. child = ref1[i];
  18975. if (child instanceof XMLDocType) {
  18976. doc.children[i] = doctype;
  18977. return doctype;
  18978. }
  18979. }
  18980. ref2 = doc.children;
  18981. for (i = k = 0, len1 = ref2.length; k < len1; i = ++k) {
  18982. child = ref2[i];
  18983. if (child.isRoot) {
  18984. doc.children.splice(i, 0, doctype);
  18985. return doctype;
  18986. }
  18987. }
  18988. doc.children.push(doctype);
  18989. return doctype;
  18990. };
  18991. XMLNode.prototype.up = function() {
  18992. if (this.isRoot) {
  18993. throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
  18994. }
  18995. return this.parent;
  18996. };
  18997. XMLNode.prototype.root = function() {
  18998. var node;
  18999. node = this;
  19000. while (node) {
  19001. if (node.isDocument) {
  19002. return node.rootObject;
  19003. } else if (node.isRoot) {
  19004. return node;
  19005. } else {
  19006. node = node.parent;
  19007. }
  19008. }
  19009. };
  19010. XMLNode.prototype.document = function() {
  19011. var node;
  19012. node = this;
  19013. while (node) {
  19014. if (node.isDocument) {
  19015. return node;
  19016. } else {
  19017. node = node.parent;
  19018. }
  19019. }
  19020. };
  19021. XMLNode.prototype.end = function(options) {
  19022. return this.document().end(options);
  19023. };
  19024. XMLNode.prototype.prev = function() {
  19025. var i;
  19026. i = this.parent.children.indexOf(this);
  19027. if (i < 1) {
  19028. throw new Error("Already at the first node. " + this.debugInfo());
  19029. }
  19030. return this.parent.children[i - 1];
  19031. };
  19032. XMLNode.prototype.next = function() {
  19033. var i;
  19034. i = this.parent.children.indexOf(this);
  19035. if (i === -1 || i === this.parent.children.length - 1) {
  19036. throw new Error("Already at the last node. " + this.debugInfo());
  19037. }
  19038. return this.parent.children[i + 1];
  19039. };
  19040. XMLNode.prototype.importDocument = function(doc) {
  19041. var clonedRoot;
  19042. clonedRoot = doc.root().clone();
  19043. clonedRoot.parent = this;
  19044. clonedRoot.isRoot = false;
  19045. this.children.push(clonedRoot);
  19046. return this;
  19047. };
  19048. XMLNode.prototype.debugInfo = function(name) {
  19049. var ref1, ref2;
  19050. name = name || this.name;
  19051. if ((name == null) && !((ref1 = this.parent) != null ? ref1.name : void 0)) {
  19052. return "";
  19053. } else if (name == null) {
  19054. return "parent: <" + this.parent.name + ">";
  19055. } else if (!((ref2 = this.parent) != null ? ref2.name : void 0)) {
  19056. return "node: <" + name + ">";
  19057. } else {
  19058. return "node: <" + name + ">, parent: <" + this.parent.name + ">";
  19059. }
  19060. };
  19061. XMLNode.prototype.ele = function(name, attributes, text) {
  19062. return this.element(name, attributes, text);
  19063. };
  19064. XMLNode.prototype.nod = function(name, attributes, text) {
  19065. return this.node(name, attributes, text);
  19066. };
  19067. XMLNode.prototype.txt = function(value) {
  19068. return this.text(value);
  19069. };
  19070. XMLNode.prototype.dat = function(value) {
  19071. return this.cdata(value);
  19072. };
  19073. XMLNode.prototype.com = function(value) {
  19074. return this.comment(value);
  19075. };
  19076. XMLNode.prototype.ins = function(target, value) {
  19077. return this.instruction(target, value);
  19078. };
  19079. XMLNode.prototype.doc = function() {
  19080. return this.document();
  19081. };
  19082. XMLNode.prototype.dec = function(version, encoding, standalone) {
  19083. return this.declaration(version, encoding, standalone);
  19084. };
  19085. XMLNode.prototype.dtd = function(pubID, sysID) {
  19086. return this.doctype(pubID, sysID);
  19087. };
  19088. XMLNode.prototype.e = function(name, attributes, text) {
  19089. return this.element(name, attributes, text);
  19090. };
  19091. XMLNode.prototype.n = function(name, attributes, text) {
  19092. return this.node(name, attributes, text);
  19093. };
  19094. XMLNode.prototype.t = function(value) {
  19095. return this.text(value);
  19096. };
  19097. XMLNode.prototype.d = function(value) {
  19098. return this.cdata(value);
  19099. };
  19100. XMLNode.prototype.c = function(value) {
  19101. return this.comment(value);
  19102. };
  19103. XMLNode.prototype.r = function(value) {
  19104. return this.raw(value);
  19105. };
  19106. XMLNode.prototype.i = function(target, value) {
  19107. return this.instruction(target, value);
  19108. };
  19109. XMLNode.prototype.u = function() {
  19110. return this.up();
  19111. };
  19112. XMLNode.prototype.importXMLBuilder = function(doc) {
  19113. return this.importDocument(doc);
  19114. };
  19115. return XMLNode;
  19116. })();
  19117. }).call(this);
  19118. },{"./Utility":106,"./XMLCData":108,"./XMLComment":109,"./XMLDeclaration":114,"./XMLDocType":115,"./XMLElement":118,"./XMLProcessingInstruction":120,"./XMLRaw":121,"./XMLText":125}],120:[function(require,module,exports){
  19119. // Generated by CoffeeScript 1.12.7
  19120. (function() {
  19121. var XMLNode, XMLProcessingInstruction,
  19122. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  19123. hasProp = {}.hasOwnProperty;
  19124. XMLNode = require('./XMLNode');
  19125. module.exports = XMLProcessingInstruction = (function(superClass) {
  19126. extend(XMLProcessingInstruction, superClass);
  19127. function XMLProcessingInstruction(parent, target, value) {
  19128. XMLProcessingInstruction.__super__.constructor.call(this, parent);
  19129. if (target == null) {
  19130. throw new Error("Missing instruction target. " + this.debugInfo());
  19131. }
  19132. this.target = this.stringify.insTarget(target);
  19133. if (value) {
  19134. this.value = this.stringify.insValue(value);
  19135. }
  19136. }
  19137. XMLProcessingInstruction.prototype.clone = function() {
  19138. return Object.create(this);
  19139. };
  19140. XMLProcessingInstruction.prototype.toString = function(options) {
  19141. return this.options.writer.set(options).processingInstruction(this);
  19142. };
  19143. return XMLProcessingInstruction;
  19144. })(XMLNode);
  19145. }).call(this);
  19146. },{"./XMLNode":119}],121:[function(require,module,exports){
  19147. // Generated by CoffeeScript 1.12.7
  19148. (function() {
  19149. var XMLNode, XMLRaw,
  19150. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  19151. hasProp = {}.hasOwnProperty;
  19152. XMLNode = require('./XMLNode');
  19153. module.exports = XMLRaw = (function(superClass) {
  19154. extend(XMLRaw, superClass);
  19155. function XMLRaw(parent, text) {
  19156. XMLRaw.__super__.constructor.call(this, parent);
  19157. if (text == null) {
  19158. throw new Error("Missing raw text. " + this.debugInfo());
  19159. }
  19160. this.value = this.stringify.raw(text);
  19161. }
  19162. XMLRaw.prototype.clone = function() {
  19163. return Object.create(this);
  19164. };
  19165. XMLRaw.prototype.toString = function(options) {
  19166. return this.options.writer.set(options).raw(this);
  19167. };
  19168. return XMLRaw;
  19169. })(XMLNode);
  19170. }).call(this);
  19171. },{"./XMLNode":119}],122:[function(require,module,exports){
  19172. // Generated by CoffeeScript 1.12.7
  19173. (function() {
  19174. var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStreamWriter, XMLText, XMLWriterBase,
  19175. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  19176. hasProp = {}.hasOwnProperty;
  19177. XMLDeclaration = require('./XMLDeclaration');
  19178. XMLDocType = require('./XMLDocType');
  19179. XMLCData = require('./XMLCData');
  19180. XMLComment = require('./XMLComment');
  19181. XMLElement = require('./XMLElement');
  19182. XMLRaw = require('./XMLRaw');
  19183. XMLText = require('./XMLText');
  19184. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  19185. XMLDTDAttList = require('./XMLDTDAttList');
  19186. XMLDTDElement = require('./XMLDTDElement');
  19187. XMLDTDEntity = require('./XMLDTDEntity');
  19188. XMLDTDNotation = require('./XMLDTDNotation');
  19189. XMLWriterBase = require('./XMLWriterBase');
  19190. module.exports = XMLStreamWriter = (function(superClass) {
  19191. extend(XMLStreamWriter, superClass);
  19192. function XMLStreamWriter(stream, options) {
  19193. XMLStreamWriter.__super__.constructor.call(this, options);
  19194. this.stream = stream;
  19195. }
  19196. XMLStreamWriter.prototype.document = function(doc) {
  19197. var child, i, j, len, len1, ref, ref1, results;
  19198. ref = doc.children;
  19199. for (i = 0, len = ref.length; i < len; i++) {
  19200. child = ref[i];
  19201. child.isLastRootNode = false;
  19202. }
  19203. doc.children[doc.children.length - 1].isLastRootNode = true;
  19204. ref1 = doc.children;
  19205. results = [];
  19206. for (j = 0, len1 = ref1.length; j < len1; j++) {
  19207. child = ref1[j];
  19208. switch (false) {
  19209. case !(child instanceof XMLDeclaration):
  19210. results.push(this.declaration(child));
  19211. break;
  19212. case !(child instanceof XMLDocType):
  19213. results.push(this.docType(child));
  19214. break;
  19215. case !(child instanceof XMLComment):
  19216. results.push(this.comment(child));
  19217. break;
  19218. case !(child instanceof XMLProcessingInstruction):
  19219. results.push(this.processingInstruction(child));
  19220. break;
  19221. default:
  19222. results.push(this.element(child));
  19223. }
  19224. }
  19225. return results;
  19226. };
  19227. XMLStreamWriter.prototype.attribute = function(att) {
  19228. return this.stream.write(' ' + att.name + '="' + att.value + '"');
  19229. };
  19230. XMLStreamWriter.prototype.cdata = function(node, level) {
  19231. return this.stream.write(this.space(level) + '<![CDATA[' + node.text + ']]>' + this.endline(node));
  19232. };
  19233. XMLStreamWriter.prototype.comment = function(node, level) {
  19234. return this.stream.write(this.space(level) + '<!-- ' + node.text + ' -->' + this.endline(node));
  19235. };
  19236. XMLStreamWriter.prototype.declaration = function(node, level) {
  19237. this.stream.write(this.space(level));
  19238. this.stream.write('<?xml version="' + node.version + '"');
  19239. if (node.encoding != null) {
  19240. this.stream.write(' encoding="' + node.encoding + '"');
  19241. }
  19242. if (node.standalone != null) {
  19243. this.stream.write(' standalone="' + node.standalone + '"');
  19244. }
  19245. this.stream.write(this.spacebeforeslash + '?>');
  19246. return this.stream.write(this.endline(node));
  19247. };
  19248. XMLStreamWriter.prototype.docType = function(node, level) {
  19249. var child, i, len, ref;
  19250. level || (level = 0);
  19251. this.stream.write(this.space(level));
  19252. this.stream.write('<!DOCTYPE ' + node.root().name);
  19253. if (node.pubID && node.sysID) {
  19254. this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
  19255. } else if (node.sysID) {
  19256. this.stream.write(' SYSTEM "' + node.sysID + '"');
  19257. }
  19258. if (node.children.length > 0) {
  19259. this.stream.write(' [');
  19260. this.stream.write(this.endline(node));
  19261. ref = node.children;
  19262. for (i = 0, len = ref.length; i < len; i++) {
  19263. child = ref[i];
  19264. switch (false) {
  19265. case !(child instanceof XMLDTDAttList):
  19266. this.dtdAttList(child, level + 1);
  19267. break;
  19268. case !(child instanceof XMLDTDElement):
  19269. this.dtdElement(child, level + 1);
  19270. break;
  19271. case !(child instanceof XMLDTDEntity):
  19272. this.dtdEntity(child, level + 1);
  19273. break;
  19274. case !(child instanceof XMLDTDNotation):
  19275. this.dtdNotation(child, level + 1);
  19276. break;
  19277. case !(child instanceof XMLCData):
  19278. this.cdata(child, level + 1);
  19279. break;
  19280. case !(child instanceof XMLComment):
  19281. this.comment(child, level + 1);
  19282. break;
  19283. case !(child instanceof XMLProcessingInstruction):
  19284. this.processingInstruction(child, level + 1);
  19285. break;
  19286. default:
  19287. throw new Error("Unknown DTD node type: " + child.constructor.name);
  19288. }
  19289. }
  19290. this.stream.write(']');
  19291. }
  19292. this.stream.write(this.spacebeforeslash + '>');
  19293. return this.stream.write(this.endline(node));
  19294. };
  19295. XMLStreamWriter.prototype.element = function(node, level) {
  19296. var att, child, i, len, name, ref, ref1, space;
  19297. level || (level = 0);
  19298. space = this.space(level);
  19299. this.stream.write(space + '<' + node.name);
  19300. ref = node.attributes;
  19301. for (name in ref) {
  19302. if (!hasProp.call(ref, name)) continue;
  19303. att = ref[name];
  19304. this.attribute(att);
  19305. }
  19306. if (node.children.length === 0 || node.children.every(function(e) {
  19307. return e.value === '';
  19308. })) {
  19309. if (this.allowEmpty) {
  19310. this.stream.write('></' + node.name + '>');
  19311. } else {
  19312. this.stream.write(this.spacebeforeslash + '/>');
  19313. }
  19314. } else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) {
  19315. this.stream.write('>');
  19316. this.stream.write(node.children[0].value);
  19317. this.stream.write('</' + node.name + '>');
  19318. } else {
  19319. this.stream.write('>' + this.newline);
  19320. ref1 = node.children;
  19321. for (i = 0, len = ref1.length; i < len; i++) {
  19322. child = ref1[i];
  19323. switch (false) {
  19324. case !(child instanceof XMLCData):
  19325. this.cdata(child, level + 1);
  19326. break;
  19327. case !(child instanceof XMLComment):
  19328. this.comment(child, level + 1);
  19329. break;
  19330. case !(child instanceof XMLElement):
  19331. this.element(child, level + 1);
  19332. break;
  19333. case !(child instanceof XMLRaw):
  19334. this.raw(child, level + 1);
  19335. break;
  19336. case !(child instanceof XMLText):
  19337. this.text(child, level + 1);
  19338. break;
  19339. case !(child instanceof XMLProcessingInstruction):
  19340. this.processingInstruction(child, level + 1);
  19341. break;
  19342. default:
  19343. throw new Error("Unknown XML node type: " + child.constructor.name);
  19344. }
  19345. }
  19346. this.stream.write(space + '</' + node.name + '>');
  19347. }
  19348. return this.stream.write(this.endline(node));
  19349. };
  19350. XMLStreamWriter.prototype.processingInstruction = function(node, level) {
  19351. this.stream.write(this.space(level) + '<?' + node.target);
  19352. if (node.value) {
  19353. this.stream.write(' ' + node.value);
  19354. }
  19355. return this.stream.write(this.spacebeforeslash + '?>' + this.endline(node));
  19356. };
  19357. XMLStreamWriter.prototype.raw = function(node, level) {
  19358. return this.stream.write(this.space(level) + node.value + this.endline(node));
  19359. };
  19360. XMLStreamWriter.prototype.text = function(node, level) {
  19361. return this.stream.write(this.space(level) + node.value + this.endline(node));
  19362. };
  19363. XMLStreamWriter.prototype.dtdAttList = function(node, level) {
  19364. this.stream.write(this.space(level) + '<!ATTLIST ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType);
  19365. if (node.defaultValueType !== '#DEFAULT') {
  19366. this.stream.write(' ' + node.defaultValueType);
  19367. }
  19368. if (node.defaultValue) {
  19369. this.stream.write(' "' + node.defaultValue + '"');
  19370. }
  19371. return this.stream.write(this.spacebeforeslash + '>' + this.endline(node));
  19372. };
  19373. XMLStreamWriter.prototype.dtdElement = function(node, level) {
  19374. this.stream.write(this.space(level) + '<!ELEMENT ' + node.name + ' ' + node.value);
  19375. return this.stream.write(this.spacebeforeslash + '>' + this.endline(node));
  19376. };
  19377. XMLStreamWriter.prototype.dtdEntity = function(node, level) {
  19378. this.stream.write(this.space(level) + '<!ENTITY');
  19379. if (node.pe) {
  19380. this.stream.write(' %');
  19381. }
  19382. this.stream.write(' ' + node.name);
  19383. if (node.value) {
  19384. this.stream.write(' "' + node.value + '"');
  19385. } else {
  19386. if (node.pubID && node.sysID) {
  19387. this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
  19388. } else if (node.sysID) {
  19389. this.stream.write(' SYSTEM "' + node.sysID + '"');
  19390. }
  19391. if (node.nData) {
  19392. this.stream.write(' NDATA ' + node.nData);
  19393. }
  19394. }
  19395. return this.stream.write(this.spacebeforeslash + '>' + this.endline(node));
  19396. };
  19397. XMLStreamWriter.prototype.dtdNotation = function(node, level) {
  19398. this.stream.write(this.space(level) + '<!NOTATION ' + node.name);
  19399. if (node.pubID && node.sysID) {
  19400. this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
  19401. } else if (node.pubID) {
  19402. this.stream.write(' PUBLIC "' + node.pubID + '"');
  19403. } else if (node.sysID) {
  19404. this.stream.write(' SYSTEM "' + node.sysID + '"');
  19405. }
  19406. return this.stream.write(this.spacebeforeslash + '>' + this.endline(node));
  19407. };
  19408. XMLStreamWriter.prototype.endline = function(node) {
  19409. if (!node.isLastRootNode) {
  19410. return this.newline;
  19411. } else {
  19412. return '';
  19413. }
  19414. };
  19415. return XMLStreamWriter;
  19416. })(XMLWriterBase);
  19417. }).call(this);
  19418. },{"./XMLCData":108,"./XMLComment":109,"./XMLDTDAttList":110,"./XMLDTDElement":111,"./XMLDTDEntity":112,"./XMLDTDNotation":113,"./XMLDeclaration":114,"./XMLDocType":115,"./XMLElement":118,"./XMLProcessingInstruction":120,"./XMLRaw":121,"./XMLText":125,"./XMLWriterBase":126}],123:[function(require,module,exports){
  19419. // Generated by CoffeeScript 1.12.7
  19420. (function() {
  19421. var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLText, XMLWriterBase,
  19422. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  19423. hasProp = {}.hasOwnProperty;
  19424. XMLDeclaration = require('./XMLDeclaration');
  19425. XMLDocType = require('./XMLDocType');
  19426. XMLCData = require('./XMLCData');
  19427. XMLComment = require('./XMLComment');
  19428. XMLElement = require('./XMLElement');
  19429. XMLRaw = require('./XMLRaw');
  19430. XMLText = require('./XMLText');
  19431. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  19432. XMLDTDAttList = require('./XMLDTDAttList');
  19433. XMLDTDElement = require('./XMLDTDElement');
  19434. XMLDTDEntity = require('./XMLDTDEntity');
  19435. XMLDTDNotation = require('./XMLDTDNotation');
  19436. XMLWriterBase = require('./XMLWriterBase');
  19437. module.exports = XMLStringWriter = (function(superClass) {
  19438. extend(XMLStringWriter, superClass);
  19439. function XMLStringWriter(options) {
  19440. XMLStringWriter.__super__.constructor.call(this, options);
  19441. }
  19442. XMLStringWriter.prototype.document = function(doc) {
  19443. var child, i, len, r, ref;
  19444. this.textispresent = false;
  19445. r = '';
  19446. ref = doc.children;
  19447. for (i = 0, len = ref.length; i < len; i++) {
  19448. child = ref[i];
  19449. r += (function() {
  19450. switch (false) {
  19451. case !(child instanceof XMLDeclaration):
  19452. return this.declaration(child);
  19453. case !(child instanceof XMLDocType):
  19454. return this.docType(child);
  19455. case !(child instanceof XMLComment):
  19456. return this.comment(child);
  19457. case !(child instanceof XMLProcessingInstruction):
  19458. return this.processingInstruction(child);
  19459. default:
  19460. return this.element(child, 0);
  19461. }
  19462. }).call(this);
  19463. }
  19464. if (this.pretty && r.slice(-this.newline.length) === this.newline) {
  19465. r = r.slice(0, -this.newline.length);
  19466. }
  19467. return r;
  19468. };
  19469. XMLStringWriter.prototype.attribute = function(att) {
  19470. return ' ' + att.name + '="' + att.value + '"';
  19471. };
  19472. XMLStringWriter.prototype.cdata = function(node, level) {
  19473. return this.space(level) + '<![CDATA[' + node.text + ']]>' + this.newline;
  19474. };
  19475. XMLStringWriter.prototype.comment = function(node, level) {
  19476. return this.space(level) + '<!-- ' + node.text + ' -->' + this.newline;
  19477. };
  19478. XMLStringWriter.prototype.declaration = function(node, level) {
  19479. var r;
  19480. r = this.space(level);
  19481. r += '<?xml version="' + node.version + '"';
  19482. if (node.encoding != null) {
  19483. r += ' encoding="' + node.encoding + '"';
  19484. }
  19485. if (node.standalone != null) {
  19486. r += ' standalone="' + node.standalone + '"';
  19487. }
  19488. r += this.spacebeforeslash + '?>';
  19489. r += this.newline;
  19490. return r;
  19491. };
  19492. XMLStringWriter.prototype.docType = function(node, level) {
  19493. var child, i, len, r, ref;
  19494. level || (level = 0);
  19495. r = this.space(level);
  19496. r += '<!DOCTYPE ' + node.root().name;
  19497. if (node.pubID && node.sysID) {
  19498. r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  19499. } else if (node.sysID) {
  19500. r += ' SYSTEM "' + node.sysID + '"';
  19501. }
  19502. if (node.children.length > 0) {
  19503. r += ' [';
  19504. r += this.newline;
  19505. ref = node.children;
  19506. for (i = 0, len = ref.length; i < len; i++) {
  19507. child = ref[i];
  19508. r += (function() {
  19509. switch (false) {
  19510. case !(child instanceof XMLDTDAttList):
  19511. return this.dtdAttList(child, level + 1);
  19512. case !(child instanceof XMLDTDElement):
  19513. return this.dtdElement(child, level + 1);
  19514. case !(child instanceof XMLDTDEntity):
  19515. return this.dtdEntity(child, level + 1);
  19516. case !(child instanceof XMLDTDNotation):
  19517. return this.dtdNotation(child, level + 1);
  19518. case !(child instanceof XMLCData):
  19519. return this.cdata(child, level + 1);
  19520. case !(child instanceof XMLComment):
  19521. return this.comment(child, level + 1);
  19522. case !(child instanceof XMLProcessingInstruction):
  19523. return this.processingInstruction(child, level + 1);
  19524. default:
  19525. throw new Error("Unknown DTD node type: " + child.constructor.name);
  19526. }
  19527. }).call(this);
  19528. }
  19529. r += ']';
  19530. }
  19531. r += this.spacebeforeslash + '>';
  19532. r += this.newline;
  19533. return r;
  19534. };
  19535. XMLStringWriter.prototype.element = function(node, level) {
  19536. var att, child, i, j, len, len1, name, r, ref, ref1, ref2, space, textispresentwasset;
  19537. level || (level = 0);
  19538. textispresentwasset = false;
  19539. if (this.textispresent) {
  19540. this.newline = '';
  19541. this.pretty = false;
  19542. } else {
  19543. this.newline = this.newlinedefault;
  19544. this.pretty = this.prettydefault;
  19545. }
  19546. space = this.space(level);
  19547. r = '';
  19548. r += space + '<' + node.name;
  19549. ref = node.attributes;
  19550. for (name in ref) {
  19551. if (!hasProp.call(ref, name)) continue;
  19552. att = ref[name];
  19553. r += this.attribute(att);
  19554. }
  19555. if (node.children.length === 0 || node.children.every(function(e) {
  19556. return e.value === '';
  19557. })) {
  19558. if (this.allowEmpty) {
  19559. r += '></' + node.name + '>' + this.newline;
  19560. } else {
  19561. r += this.spacebeforeslash + '/>' + this.newline;
  19562. }
  19563. } else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) {
  19564. r += '>';
  19565. r += node.children[0].value;
  19566. r += '</' + node.name + '>' + this.newline;
  19567. } else {
  19568. if (this.dontprettytextnodes) {
  19569. ref1 = node.children;
  19570. for (i = 0, len = ref1.length; i < len; i++) {
  19571. child = ref1[i];
  19572. if (child.value != null) {
  19573. this.textispresent++;
  19574. textispresentwasset = true;
  19575. break;
  19576. }
  19577. }
  19578. }
  19579. if (this.textispresent) {
  19580. this.newline = '';
  19581. this.pretty = false;
  19582. space = this.space(level);
  19583. }
  19584. r += '>' + this.newline;
  19585. ref2 = node.children;
  19586. for (j = 0, len1 = ref2.length; j < len1; j++) {
  19587. child = ref2[j];
  19588. r += (function() {
  19589. switch (false) {
  19590. case !(child instanceof XMLCData):
  19591. return this.cdata(child, level + 1);
  19592. case !(child instanceof XMLComment):
  19593. return this.comment(child, level + 1);
  19594. case !(child instanceof XMLElement):
  19595. return this.element(child, level + 1);
  19596. case !(child instanceof XMLRaw):
  19597. return this.raw(child, level + 1);
  19598. case !(child instanceof XMLText):
  19599. return this.text(child, level + 1);
  19600. case !(child instanceof XMLProcessingInstruction):
  19601. return this.processingInstruction(child, level + 1);
  19602. default:
  19603. throw new Error("Unknown XML node type: " + child.constructor.name);
  19604. }
  19605. }).call(this);
  19606. }
  19607. if (textispresentwasset) {
  19608. this.textispresent--;
  19609. }
  19610. if (!this.textispresent) {
  19611. this.newline = this.newlinedefault;
  19612. this.pretty = this.prettydefault;
  19613. }
  19614. r += space + '</' + node.name + '>' + this.newline;
  19615. }
  19616. return r;
  19617. };
  19618. XMLStringWriter.prototype.processingInstruction = function(node, level) {
  19619. var r;
  19620. r = this.space(level) + '<?' + node.target;
  19621. if (node.value) {
  19622. r += ' ' + node.value;
  19623. }
  19624. r += this.spacebeforeslash + '?>' + this.newline;
  19625. return r;
  19626. };
  19627. XMLStringWriter.prototype.raw = function(node, level) {
  19628. return this.space(level) + node.value + this.newline;
  19629. };
  19630. XMLStringWriter.prototype.text = function(node, level) {
  19631. return this.space(level) + node.value + this.newline;
  19632. };
  19633. XMLStringWriter.prototype.dtdAttList = function(node, level) {
  19634. var r;
  19635. r = this.space(level) + '<!ATTLIST ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType;
  19636. if (node.defaultValueType !== '#DEFAULT') {
  19637. r += ' ' + node.defaultValueType;
  19638. }
  19639. if (node.defaultValue) {
  19640. r += ' "' + node.defaultValue + '"';
  19641. }
  19642. r += this.spacebeforeslash + '>' + this.newline;
  19643. return r;
  19644. };
  19645. XMLStringWriter.prototype.dtdElement = function(node, level) {
  19646. return this.space(level) + '<!ELEMENT ' + node.name + ' ' + node.value + this.spacebeforeslash + '>' + this.newline;
  19647. };
  19648. XMLStringWriter.prototype.dtdEntity = function(node, level) {
  19649. var r;
  19650. r = this.space(level) + '<!ENTITY';
  19651. if (node.pe) {
  19652. r += ' %';
  19653. }
  19654. r += ' ' + node.name;
  19655. if (node.value) {
  19656. r += ' "' + node.value + '"';
  19657. } else {
  19658. if (node.pubID && node.sysID) {
  19659. r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  19660. } else if (node.sysID) {
  19661. r += ' SYSTEM "' + node.sysID + '"';
  19662. }
  19663. if (node.nData) {
  19664. r += ' NDATA ' + node.nData;
  19665. }
  19666. }
  19667. r += this.spacebeforeslash + '>' + this.newline;
  19668. return r;
  19669. };
  19670. XMLStringWriter.prototype.dtdNotation = function(node, level) {
  19671. var r;
  19672. r = this.space(level) + '<!NOTATION ' + node.name;
  19673. if (node.pubID && node.sysID) {
  19674. r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  19675. } else if (node.pubID) {
  19676. r += ' PUBLIC "' + node.pubID + '"';
  19677. } else if (node.sysID) {
  19678. r += ' SYSTEM "' + node.sysID + '"';
  19679. }
  19680. r += this.spacebeforeslash + '>' + this.newline;
  19681. return r;
  19682. };
  19683. XMLStringWriter.prototype.openNode = function(node, level) {
  19684. var att, name, r, ref;
  19685. level || (level = 0);
  19686. if (node instanceof XMLElement) {
  19687. r = this.space(level) + '<' + node.name;
  19688. ref = node.attributes;
  19689. for (name in ref) {
  19690. if (!hasProp.call(ref, name)) continue;
  19691. att = ref[name];
  19692. r += this.attribute(att);
  19693. }
  19694. r += (node.children ? '>' : '/>') + this.newline;
  19695. return r;
  19696. } else {
  19697. r = this.space(level) + '<!DOCTYPE ' + node.rootNodeName;
  19698. if (node.pubID && node.sysID) {
  19699. r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  19700. } else if (node.sysID) {
  19701. r += ' SYSTEM "' + node.sysID + '"';
  19702. }
  19703. r += (node.children ? ' [' : '>') + this.newline;
  19704. return r;
  19705. }
  19706. };
  19707. XMLStringWriter.prototype.closeNode = function(node, level) {
  19708. level || (level = 0);
  19709. switch (false) {
  19710. case !(node instanceof XMLElement):
  19711. return this.space(level) + '</' + node.name + '>' + this.newline;
  19712. case !(node instanceof XMLDocType):
  19713. return this.space(level) + ']>' + this.newline;
  19714. }
  19715. };
  19716. return XMLStringWriter;
  19717. })(XMLWriterBase);
  19718. }).call(this);
  19719. },{"./XMLCData":108,"./XMLComment":109,"./XMLDTDAttList":110,"./XMLDTDElement":111,"./XMLDTDEntity":112,"./XMLDTDNotation":113,"./XMLDeclaration":114,"./XMLDocType":115,"./XMLElement":118,"./XMLProcessingInstruction":120,"./XMLRaw":121,"./XMLText":125,"./XMLWriterBase":126}],124:[function(require,module,exports){
  19720. // Generated by CoffeeScript 1.12.7
  19721. (function() {
  19722. var XMLStringifier,
  19723. bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
  19724. hasProp = {}.hasOwnProperty;
  19725. module.exports = XMLStringifier = (function() {
  19726. function XMLStringifier(options) {
  19727. this.assertLegalChar = bind(this.assertLegalChar, this);
  19728. var key, ref, value;
  19729. options || (options = {});
  19730. this.noDoubleEncoding = options.noDoubleEncoding;
  19731. ref = options.stringify || {};
  19732. for (key in ref) {
  19733. if (!hasProp.call(ref, key)) continue;
  19734. value = ref[key];
  19735. this[key] = value;
  19736. }
  19737. }
  19738. XMLStringifier.prototype.eleName = function(val) {
  19739. val = '' + val || '';
  19740. return this.assertLegalChar(val);
  19741. };
  19742. XMLStringifier.prototype.eleText = function(val) {
  19743. val = '' + val || '';
  19744. return this.assertLegalChar(this.elEscape(val));
  19745. };
  19746. XMLStringifier.prototype.cdata = function(val) {
  19747. val = '' + val || '';
  19748. val = val.replace(']]>', ']]]]><![CDATA[>');
  19749. return this.assertLegalChar(val);
  19750. };
  19751. XMLStringifier.prototype.comment = function(val) {
  19752. val = '' + val || '';
  19753. if (val.match(/--/)) {
  19754. throw new Error("Comment text cannot contain double-hypen: " + val);
  19755. }
  19756. return this.assertLegalChar(val);
  19757. };
  19758. XMLStringifier.prototype.raw = function(val) {
  19759. return '' + val || '';
  19760. };
  19761. XMLStringifier.prototype.attName = function(val) {
  19762. return val = '' + val || '';
  19763. };
  19764. XMLStringifier.prototype.attValue = function(val) {
  19765. val = '' + val || '';
  19766. return this.attEscape(val);
  19767. };
  19768. XMLStringifier.prototype.insTarget = function(val) {
  19769. return '' + val || '';
  19770. };
  19771. XMLStringifier.prototype.insValue = function(val) {
  19772. val = '' + val || '';
  19773. if (val.match(/\?>/)) {
  19774. throw new Error("Invalid processing instruction value: " + val);
  19775. }
  19776. return val;
  19777. };
  19778. XMLStringifier.prototype.xmlVersion = function(val) {
  19779. val = '' + val || '';
  19780. if (!val.match(/1\.[0-9]+/)) {
  19781. throw new Error("Invalid version number: " + val);
  19782. }
  19783. return val;
  19784. };
  19785. XMLStringifier.prototype.xmlEncoding = function(val) {
  19786. val = '' + val || '';
  19787. if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) {
  19788. throw new Error("Invalid encoding: " + val);
  19789. }
  19790. return val;
  19791. };
  19792. XMLStringifier.prototype.xmlStandalone = function(val) {
  19793. if (val) {
  19794. return "yes";
  19795. } else {
  19796. return "no";
  19797. }
  19798. };
  19799. XMLStringifier.prototype.dtdPubID = function(val) {
  19800. return '' + val || '';
  19801. };
  19802. XMLStringifier.prototype.dtdSysID = function(val) {
  19803. return '' + val || '';
  19804. };
  19805. XMLStringifier.prototype.dtdElementValue = function(val) {
  19806. return '' + val || '';
  19807. };
  19808. XMLStringifier.prototype.dtdAttType = function(val) {
  19809. return '' + val || '';
  19810. };
  19811. XMLStringifier.prototype.dtdAttDefault = function(val) {
  19812. if (val != null) {
  19813. return '' + val || '';
  19814. } else {
  19815. return val;
  19816. }
  19817. };
  19818. XMLStringifier.prototype.dtdEntityValue = function(val) {
  19819. return '' + val || '';
  19820. };
  19821. XMLStringifier.prototype.dtdNData = function(val) {
  19822. return '' + val || '';
  19823. };
  19824. XMLStringifier.prototype.convertAttKey = '@';
  19825. XMLStringifier.prototype.convertPIKey = '?';
  19826. XMLStringifier.prototype.convertTextKey = '#text';
  19827. XMLStringifier.prototype.convertCDataKey = '#cdata';
  19828. XMLStringifier.prototype.convertCommentKey = '#comment';
  19829. XMLStringifier.prototype.convertRawKey = '#raw';
  19830. XMLStringifier.prototype.assertLegalChar = function(str) {
  19831. var res;
  19832. res = str.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/);
  19833. if (res) {
  19834. throw new Error("Invalid character in string: " + str + " at index " + res.index);
  19835. }
  19836. return str;
  19837. };
  19838. XMLStringifier.prototype.elEscape = function(str) {
  19839. var ampregex;
  19840. ampregex = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
  19841. return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\r/g, '&#xD;');
  19842. };
  19843. XMLStringifier.prototype.attEscape = function(str) {
  19844. var ampregex;
  19845. ampregex = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
  19846. return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/\t/g, '&#x9;').replace(/\n/g, '&#xA;').replace(/\r/g, '&#xD;');
  19847. };
  19848. return XMLStringifier;
  19849. })();
  19850. }).call(this);
  19851. },{}],125:[function(require,module,exports){
  19852. // Generated by CoffeeScript 1.12.7
  19853. (function() {
  19854. var XMLNode, XMLText,
  19855. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  19856. hasProp = {}.hasOwnProperty;
  19857. XMLNode = require('./XMLNode');
  19858. module.exports = XMLText = (function(superClass) {
  19859. extend(XMLText, superClass);
  19860. function XMLText(parent, text) {
  19861. XMLText.__super__.constructor.call(this, parent);
  19862. if (text == null) {
  19863. throw new Error("Missing element text. " + this.debugInfo());
  19864. }
  19865. this.value = this.stringify.eleText(text);
  19866. }
  19867. XMLText.prototype.clone = function() {
  19868. return Object.create(this);
  19869. };
  19870. XMLText.prototype.toString = function(options) {
  19871. return this.options.writer.set(options).text(this);
  19872. };
  19873. return XMLText;
  19874. })(XMLNode);
  19875. }).call(this);
  19876. },{"./XMLNode":119}],126:[function(require,module,exports){
  19877. // Generated by CoffeeScript 1.12.7
  19878. (function() {
  19879. var XMLWriterBase,
  19880. hasProp = {}.hasOwnProperty;
  19881. module.exports = XMLWriterBase = (function() {
  19882. function XMLWriterBase(options) {
  19883. var key, ref, ref1, ref2, ref3, ref4, ref5, ref6, value;
  19884. options || (options = {});
  19885. this.pretty = options.pretty || false;
  19886. this.allowEmpty = (ref = options.allowEmpty) != null ? ref : false;
  19887. if (this.pretty) {
  19888. this.indent = (ref1 = options.indent) != null ? ref1 : ' ';
  19889. this.newline = (ref2 = options.newline) != null ? ref2 : '\n';
  19890. this.offset = (ref3 = options.offset) != null ? ref3 : 0;
  19891. this.dontprettytextnodes = (ref4 = options.dontprettytextnodes) != null ? ref4 : 0;
  19892. } else {
  19893. this.indent = '';
  19894. this.newline = '';
  19895. this.offset = 0;
  19896. this.dontprettytextnodes = 0;
  19897. }
  19898. this.spacebeforeslash = (ref5 = options.spacebeforeslash) != null ? ref5 : '';
  19899. if (this.spacebeforeslash === true) {
  19900. this.spacebeforeslash = ' ';
  19901. }
  19902. this.newlinedefault = this.newline;
  19903. this.prettydefault = this.pretty;
  19904. ref6 = options.writer || {};
  19905. for (key in ref6) {
  19906. if (!hasProp.call(ref6, key)) continue;
  19907. value = ref6[key];
  19908. this[key] = value;
  19909. }
  19910. }
  19911. XMLWriterBase.prototype.set = function(options) {
  19912. var key, ref, value;
  19913. options || (options = {});
  19914. if ("pretty" in options) {
  19915. this.pretty = options.pretty;
  19916. }
  19917. if ("allowEmpty" in options) {
  19918. this.allowEmpty = options.allowEmpty;
  19919. }
  19920. if (this.pretty) {
  19921. this.indent = "indent" in options ? options.indent : ' ';
  19922. this.newline = "newline" in options ? options.newline : '\n';
  19923. this.offset = "offset" in options ? options.offset : 0;
  19924. this.dontprettytextnodes = "dontprettytextnodes" in options ? options.dontprettytextnodes : 0;
  19925. } else {
  19926. this.indent = '';
  19927. this.newline = '';
  19928. this.offset = 0;
  19929. this.dontprettytextnodes = 0;
  19930. }
  19931. this.spacebeforeslash = "spacebeforeslash" in options ? options.spacebeforeslash : '';
  19932. if (this.spacebeforeslash === true) {
  19933. this.spacebeforeslash = ' ';
  19934. }
  19935. this.newlinedefault = this.newline;
  19936. this.prettydefault = this.pretty;
  19937. ref = options.writer || {};
  19938. for (key in ref) {
  19939. if (!hasProp.call(ref, key)) continue;
  19940. value = ref[key];
  19941. this[key] = value;
  19942. }
  19943. return this;
  19944. };
  19945. XMLWriterBase.prototype.space = function(level) {
  19946. var indent;
  19947. if (this.pretty) {
  19948. indent = (level || 0) + this.offset + 1;
  19949. if (indent > 0) {
  19950. return new Array(indent).join(this.indent);
  19951. } else {
  19952. return '';
  19953. }
  19954. } else {
  19955. return '';
  19956. }
  19957. };
  19958. return XMLWriterBase;
  19959. })();
  19960. }).call(this);
  19961. },{}],127:[function(require,module,exports){
  19962. // Generated by CoffeeScript 1.12.7
  19963. (function() {
  19964. var XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
  19965. ref = require('./Utility'), assign = ref.assign, isFunction = ref.isFunction;
  19966. XMLDocument = require('./XMLDocument');
  19967. XMLDocumentCB = require('./XMLDocumentCB');
  19968. XMLStringWriter = require('./XMLStringWriter');
  19969. XMLStreamWriter = require('./XMLStreamWriter');
  19970. module.exports.create = function(name, xmldec, doctype, options) {
  19971. var doc, root;
  19972. if (name == null) {
  19973. throw new Error("Root element needs a name.");
  19974. }
  19975. options = assign({}, xmldec, doctype, options);
  19976. doc = new XMLDocument(options);
  19977. root = doc.element(name);
  19978. if (!options.headless) {
  19979. doc.declaration(options);
  19980. if ((options.pubID != null) || (options.sysID != null)) {
  19981. doc.doctype(options);
  19982. }
  19983. }
  19984. return root;
  19985. };
  19986. module.exports.begin = function(options, onData, onEnd) {
  19987. var ref1;
  19988. if (isFunction(options)) {
  19989. ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
  19990. options = {};
  19991. }
  19992. if (onData) {
  19993. return new XMLDocumentCB(options, onData, onEnd);
  19994. } else {
  19995. return new XMLDocument(options);
  19996. }
  19997. };
  19998. module.exports.stringWriter = function(options) {
  19999. return new XMLStringWriter(options);
  20000. };
  20001. module.exports.streamWriter = function(stream, options) {
  20002. return new XMLStreamWriter(stream, options);
  20003. };
  20004. }).call(this);
  20005. },{"./Utility":106,"./XMLDocument":116,"./XMLDocumentCB":117,"./XMLStreamWriter":122,"./XMLStringWriter":123}]},{},[21])(21)
  20006. });