zx-quill.umd.js 541 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["zx-quill"] = factory();
  8. else
  9. root["zx-quill"] = factory();
  10. })((typeof self !== 'undefined' ? self : this), function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "9896");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "0126":
  99. /***/ (function(module, exports, __webpack_require__) {
  100. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  101. * Quill Editor v1.3.7
  102. * https://quilljs.com/
  103. * Copyright (c) 2014, Jason Chen
  104. * Copyright (c) 2013, salesforce.com
  105. */
  106. (function webpackUniversalModuleDefinition(root, factory) {
  107. if(true)
  108. module.exports = factory();
  109. else {}
  110. })(typeof self !== 'undefined' ? self : this, function() {
  111. return /******/ (function(modules) { // webpackBootstrap
  112. /******/ // The module cache
  113. /******/ var installedModules = {};
  114. /******/
  115. /******/ // The require function
  116. /******/ function __webpack_require__(moduleId) {
  117. /******/
  118. /******/ // Check if module is in cache
  119. /******/ if(installedModules[moduleId]) {
  120. /******/ return installedModules[moduleId].exports;
  121. /******/ }
  122. /******/ // Create a new module (and put it into the cache)
  123. /******/ var module = installedModules[moduleId] = {
  124. /******/ i: moduleId,
  125. /******/ l: false,
  126. /******/ exports: {}
  127. /******/ };
  128. /******/
  129. /******/ // Execute the module function
  130. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  131. /******/
  132. /******/ // Flag the module as loaded
  133. /******/ module.l = true;
  134. /******/
  135. /******/ // Return the exports of the module
  136. /******/ return module.exports;
  137. /******/ }
  138. /******/
  139. /******/
  140. /******/ // expose the modules object (__webpack_modules__)
  141. /******/ __webpack_require__.m = modules;
  142. /******/
  143. /******/ // expose the module cache
  144. /******/ __webpack_require__.c = installedModules;
  145. /******/
  146. /******/ // define getter function for harmony exports
  147. /******/ __webpack_require__.d = function(exports, name, getter) {
  148. /******/ if(!__webpack_require__.o(exports, name)) {
  149. /******/ Object.defineProperty(exports, name, {
  150. /******/ configurable: false,
  151. /******/ enumerable: true,
  152. /******/ get: getter
  153. /******/ });
  154. /******/ }
  155. /******/ };
  156. /******/
  157. /******/ // getDefaultExport function for compatibility with non-harmony modules
  158. /******/ __webpack_require__.n = function(module) {
  159. /******/ var getter = module && module.__esModule ?
  160. /******/ function getDefault() { return module['default']; } :
  161. /******/ function getModuleExports() { return module; };
  162. /******/ __webpack_require__.d(getter, 'a', getter);
  163. /******/ return getter;
  164. /******/ };
  165. /******/
  166. /******/ // Object.prototype.hasOwnProperty.call
  167. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  168. /******/
  169. /******/ // __webpack_public_path__
  170. /******/ __webpack_require__.p = "";
  171. /******/
  172. /******/ // Load entry module and return exports
  173. /******/ return __webpack_require__(__webpack_require__.s = 109);
  174. /******/ })
  175. /************************************************************************/
  176. /******/ ([
  177. /* 0 */
  178. /***/ (function(module, exports, __webpack_require__) {
  179. "use strict";
  180. Object.defineProperty(exports, "__esModule", { value: true });
  181. var container_1 = __webpack_require__(17);
  182. var format_1 = __webpack_require__(18);
  183. var leaf_1 = __webpack_require__(19);
  184. var scroll_1 = __webpack_require__(45);
  185. var inline_1 = __webpack_require__(46);
  186. var block_1 = __webpack_require__(47);
  187. var embed_1 = __webpack_require__(48);
  188. var text_1 = __webpack_require__(49);
  189. var attributor_1 = __webpack_require__(12);
  190. var class_1 = __webpack_require__(32);
  191. var style_1 = __webpack_require__(33);
  192. var store_1 = __webpack_require__(31);
  193. var Registry = __webpack_require__(1);
  194. var Parchment = {
  195. Scope: Registry.Scope,
  196. create: Registry.create,
  197. find: Registry.find,
  198. query: Registry.query,
  199. register: Registry.register,
  200. Container: container_1.default,
  201. Format: format_1.default,
  202. Leaf: leaf_1.default,
  203. Embed: embed_1.default,
  204. Scroll: scroll_1.default,
  205. Block: block_1.default,
  206. Inline: inline_1.default,
  207. Text: text_1.default,
  208. Attributor: {
  209. Attribute: attributor_1.default,
  210. Class: class_1.default,
  211. Style: style_1.default,
  212. Store: store_1.default,
  213. },
  214. };
  215. exports.default = Parchment;
  216. /***/ }),
  217. /* 1 */
  218. /***/ (function(module, exports, __webpack_require__) {
  219. "use strict";
  220. var __extends = (this && this.__extends) || (function () {
  221. var extendStatics = Object.setPrototypeOf ||
  222. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  223. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  224. return function (d, b) {
  225. extendStatics(d, b);
  226. function __() { this.constructor = d; }
  227. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  228. };
  229. })();
  230. Object.defineProperty(exports, "__esModule", { value: true });
  231. var ParchmentError = /** @class */ (function (_super) {
  232. __extends(ParchmentError, _super);
  233. function ParchmentError(message) {
  234. var _this = this;
  235. message = '[Parchment] ' + message;
  236. _this = _super.call(this, message) || this;
  237. _this.message = message;
  238. _this.name = _this.constructor.name;
  239. return _this;
  240. }
  241. return ParchmentError;
  242. }(Error));
  243. exports.ParchmentError = ParchmentError;
  244. var attributes = {};
  245. var classes = {};
  246. var tags = {};
  247. var types = {};
  248. exports.DATA_KEY = '__blot';
  249. var Scope;
  250. (function (Scope) {
  251. Scope[Scope["TYPE"] = 3] = "TYPE";
  252. Scope[Scope["LEVEL"] = 12] = "LEVEL";
  253. Scope[Scope["ATTRIBUTE"] = 13] = "ATTRIBUTE";
  254. Scope[Scope["BLOT"] = 14] = "BLOT";
  255. Scope[Scope["INLINE"] = 7] = "INLINE";
  256. Scope[Scope["BLOCK"] = 11] = "BLOCK";
  257. Scope[Scope["BLOCK_BLOT"] = 10] = "BLOCK_BLOT";
  258. Scope[Scope["INLINE_BLOT"] = 6] = "INLINE_BLOT";
  259. Scope[Scope["BLOCK_ATTRIBUTE"] = 9] = "BLOCK_ATTRIBUTE";
  260. Scope[Scope["INLINE_ATTRIBUTE"] = 5] = "INLINE_ATTRIBUTE";
  261. Scope[Scope["ANY"] = 15] = "ANY";
  262. })(Scope = exports.Scope || (exports.Scope = {}));
  263. function create(input, value) {
  264. var match = query(input);
  265. if (match == null) {
  266. throw new ParchmentError("Unable to create " + input + " blot");
  267. }
  268. var BlotClass = match;
  269. var node =
  270. // @ts-ignore
  271. input instanceof Node || input['nodeType'] === Node.TEXT_NODE ? input : BlotClass.create(value);
  272. return new BlotClass(node, value);
  273. }
  274. exports.create = create;
  275. function find(node, bubble) {
  276. if (bubble === void 0) { bubble = false; }
  277. if (node == null)
  278. return null;
  279. // @ts-ignore
  280. if (node[exports.DATA_KEY] != null)
  281. return node[exports.DATA_KEY].blot;
  282. if (bubble)
  283. return find(node.parentNode, bubble);
  284. return null;
  285. }
  286. exports.find = find;
  287. function query(query, scope) {
  288. if (scope === void 0) { scope = Scope.ANY; }
  289. var match;
  290. if (typeof query === 'string') {
  291. match = types[query] || attributes[query];
  292. // @ts-ignore
  293. }
  294. else if (query instanceof Text || query['nodeType'] === Node.TEXT_NODE) {
  295. match = types['text'];
  296. }
  297. else if (typeof query === 'number') {
  298. if (query & Scope.LEVEL & Scope.BLOCK) {
  299. match = types['block'];
  300. }
  301. else if (query & Scope.LEVEL & Scope.INLINE) {
  302. match = types['inline'];
  303. }
  304. }
  305. else if (query instanceof HTMLElement) {
  306. var names = (query.getAttribute('class') || '').split(/\s+/);
  307. for (var i in names) {
  308. match = classes[names[i]];
  309. if (match)
  310. break;
  311. }
  312. match = match || tags[query.tagName];
  313. }
  314. if (match == null)
  315. return null;
  316. // @ts-ignore
  317. if (scope & Scope.LEVEL & match.scope && scope & Scope.TYPE & match.scope)
  318. return match;
  319. return null;
  320. }
  321. exports.query = query;
  322. function register() {
  323. var Definitions = [];
  324. for (var _i = 0; _i < arguments.length; _i++) {
  325. Definitions[_i] = arguments[_i];
  326. }
  327. if (Definitions.length > 1) {
  328. return Definitions.map(function (d) {
  329. return register(d);
  330. });
  331. }
  332. var Definition = Definitions[0];
  333. if (typeof Definition.blotName !== 'string' && typeof Definition.attrName !== 'string') {
  334. throw new ParchmentError('Invalid definition');
  335. }
  336. else if (Definition.blotName === 'abstract') {
  337. throw new ParchmentError('Cannot register abstract class');
  338. }
  339. types[Definition.blotName || Definition.attrName] = Definition;
  340. if (typeof Definition.keyName === 'string') {
  341. attributes[Definition.keyName] = Definition;
  342. }
  343. else {
  344. if (Definition.className != null) {
  345. classes[Definition.className] = Definition;
  346. }
  347. if (Definition.tagName != null) {
  348. if (Array.isArray(Definition.tagName)) {
  349. Definition.tagName = Definition.tagName.map(function (tagName) {
  350. return tagName.toUpperCase();
  351. });
  352. }
  353. else {
  354. Definition.tagName = Definition.tagName.toUpperCase();
  355. }
  356. var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName];
  357. tagNames.forEach(function (tag) {
  358. if (tags[tag] == null || Definition.className == null) {
  359. tags[tag] = Definition;
  360. }
  361. });
  362. }
  363. }
  364. return Definition;
  365. }
  366. exports.register = register;
  367. /***/ }),
  368. /* 2 */
  369. /***/ (function(module, exports, __webpack_require__) {
  370. var diff = __webpack_require__(51);
  371. var equal = __webpack_require__(11);
  372. var extend = __webpack_require__(3);
  373. var op = __webpack_require__(20);
  374. var NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff()
  375. var Delta = function (ops) {
  376. // Assume we are given a well formed ops
  377. if (Array.isArray(ops)) {
  378. this.ops = ops;
  379. } else if (ops != null && Array.isArray(ops.ops)) {
  380. this.ops = ops.ops;
  381. } else {
  382. this.ops = [];
  383. }
  384. };
  385. Delta.prototype.insert = function (text, attributes) {
  386. var newOp = {};
  387. if (text.length === 0) return this;
  388. newOp.insert = text;
  389. if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
  390. newOp.attributes = attributes;
  391. }
  392. return this.push(newOp);
  393. };
  394. Delta.prototype['delete'] = function (length) {
  395. if (length <= 0) return this;
  396. return this.push({ 'delete': length });
  397. };
  398. Delta.prototype.retain = function (length, attributes) {
  399. if (length <= 0) return this;
  400. var newOp = { retain: length };
  401. if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
  402. newOp.attributes = attributes;
  403. }
  404. return this.push(newOp);
  405. };
  406. Delta.prototype.push = function (newOp) {
  407. var index = this.ops.length;
  408. var lastOp = this.ops[index - 1];
  409. newOp = extend(true, {}, newOp);
  410. if (typeof lastOp === 'object') {
  411. if (typeof newOp['delete'] === 'number' && typeof lastOp['delete'] === 'number') {
  412. this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] };
  413. return this;
  414. }
  415. // Since it does not matter if we insert before or after deleting at the same index,
  416. // always prefer to insert first
  417. if (typeof lastOp['delete'] === 'number' && newOp.insert != null) {
  418. index -= 1;
  419. lastOp = this.ops[index - 1];
  420. if (typeof lastOp !== 'object') {
  421. this.ops.unshift(newOp);
  422. return this;
  423. }
  424. }
  425. if (equal(newOp.attributes, lastOp.attributes)) {
  426. if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') {
  427. this.ops[index - 1] = { insert: lastOp.insert + newOp.insert };
  428. if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
  429. return this;
  430. } else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') {
  431. this.ops[index - 1] = { retain: lastOp.retain + newOp.retain };
  432. if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
  433. return this;
  434. }
  435. }
  436. }
  437. if (index === this.ops.length) {
  438. this.ops.push(newOp);
  439. } else {
  440. this.ops.splice(index, 0, newOp);
  441. }
  442. return this;
  443. };
  444. Delta.prototype.chop = function () {
  445. var lastOp = this.ops[this.ops.length - 1];
  446. if (lastOp && lastOp.retain && !lastOp.attributes) {
  447. this.ops.pop();
  448. }
  449. return this;
  450. };
  451. Delta.prototype.filter = function (predicate) {
  452. return this.ops.filter(predicate);
  453. };
  454. Delta.prototype.forEach = function (predicate) {
  455. this.ops.forEach(predicate);
  456. };
  457. Delta.prototype.map = function (predicate) {
  458. return this.ops.map(predicate);
  459. };
  460. Delta.prototype.partition = function (predicate) {
  461. var passed = [], failed = [];
  462. this.forEach(function(op) {
  463. var target = predicate(op) ? passed : failed;
  464. target.push(op);
  465. });
  466. return [passed, failed];
  467. };
  468. Delta.prototype.reduce = function (predicate, initial) {
  469. return this.ops.reduce(predicate, initial);
  470. };
  471. Delta.prototype.changeLength = function () {
  472. return this.reduce(function (length, elem) {
  473. if (elem.insert) {
  474. return length + op.length(elem);
  475. } else if (elem.delete) {
  476. return length - elem.delete;
  477. }
  478. return length;
  479. }, 0);
  480. };
  481. Delta.prototype.length = function () {
  482. return this.reduce(function (length, elem) {
  483. return length + op.length(elem);
  484. }, 0);
  485. };
  486. Delta.prototype.slice = function (start, end) {
  487. start = start || 0;
  488. if (typeof end !== 'number') end = Infinity;
  489. var ops = [];
  490. var iter = op.iterator(this.ops);
  491. var index = 0;
  492. while (index < end && iter.hasNext()) {
  493. var nextOp;
  494. if (index < start) {
  495. nextOp = iter.next(start - index);
  496. } else {
  497. nextOp = iter.next(end - index);
  498. ops.push(nextOp);
  499. }
  500. index += op.length(nextOp);
  501. }
  502. return new Delta(ops);
  503. };
  504. Delta.prototype.compose = function (other) {
  505. var thisIter = op.iterator(this.ops);
  506. var otherIter = op.iterator(other.ops);
  507. var ops = [];
  508. var firstOther = otherIter.peek();
  509. if (firstOther != null && typeof firstOther.retain === 'number' && firstOther.attributes == null) {
  510. var firstLeft = firstOther.retain;
  511. while (thisIter.peekType() === 'insert' && thisIter.peekLength() <= firstLeft) {
  512. firstLeft -= thisIter.peekLength();
  513. ops.push(thisIter.next());
  514. }
  515. if (firstOther.retain - firstLeft > 0) {
  516. otherIter.next(firstOther.retain - firstLeft);
  517. }
  518. }
  519. var delta = new Delta(ops);
  520. while (thisIter.hasNext() || otherIter.hasNext()) {
  521. if (otherIter.peekType() === 'insert') {
  522. delta.push(otherIter.next());
  523. } else if (thisIter.peekType() === 'delete') {
  524. delta.push(thisIter.next());
  525. } else {
  526. var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
  527. var thisOp = thisIter.next(length);
  528. var otherOp = otherIter.next(length);
  529. if (typeof otherOp.retain === 'number') {
  530. var newOp = {};
  531. if (typeof thisOp.retain === 'number') {
  532. newOp.retain = length;
  533. } else {
  534. newOp.insert = thisOp.insert;
  535. }
  536. // Preserve null when composing with a retain, otherwise remove it for inserts
  537. var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');
  538. if (attributes) newOp.attributes = attributes;
  539. delta.push(newOp);
  540. // Optimization if rest of other is just retain
  541. if (!otherIter.hasNext() && equal(delta.ops[delta.ops.length - 1], newOp)) {
  542. var rest = new Delta(thisIter.rest());
  543. return delta.concat(rest).chop();
  544. }
  545. // Other op should be delete, we could be an insert or retain
  546. // Insert + delete cancels out
  547. } else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {
  548. delta.push(otherOp);
  549. }
  550. }
  551. }
  552. return delta.chop();
  553. };
  554. Delta.prototype.concat = function (other) {
  555. var delta = new Delta(this.ops.slice());
  556. if (other.ops.length > 0) {
  557. delta.push(other.ops[0]);
  558. delta.ops = delta.ops.concat(other.ops.slice(1));
  559. }
  560. return delta;
  561. };
  562. Delta.prototype.diff = function (other, index) {
  563. if (this.ops === other.ops) {
  564. return new Delta();
  565. }
  566. var strings = [this, other].map(function (delta) {
  567. return delta.map(function (op) {
  568. if (op.insert != null) {
  569. return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER;
  570. }
  571. var prep = (delta === other) ? 'on' : 'with';
  572. throw new Error('diff() called ' + prep + ' non-document');
  573. }).join('');
  574. });
  575. var delta = new Delta();
  576. var diffResult = diff(strings[0], strings[1], index);
  577. var thisIter = op.iterator(this.ops);
  578. var otherIter = op.iterator(other.ops);
  579. diffResult.forEach(function (component) {
  580. var length = component[1].length;
  581. while (length > 0) {
  582. var opLength = 0;
  583. switch (component[0]) {
  584. case diff.INSERT:
  585. opLength = Math.min(otherIter.peekLength(), length);
  586. delta.push(otherIter.next(opLength));
  587. break;
  588. case diff.DELETE:
  589. opLength = Math.min(length, thisIter.peekLength());
  590. thisIter.next(opLength);
  591. delta['delete'](opLength);
  592. break;
  593. case diff.EQUAL:
  594. opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length);
  595. var thisOp = thisIter.next(opLength);
  596. var otherOp = otherIter.next(opLength);
  597. if (equal(thisOp.insert, otherOp.insert)) {
  598. delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes));
  599. } else {
  600. delta.push(otherOp)['delete'](opLength);
  601. }
  602. break;
  603. }
  604. length -= opLength;
  605. }
  606. });
  607. return delta.chop();
  608. };
  609. Delta.prototype.eachLine = function (predicate, newline) {
  610. newline = newline || '\n';
  611. var iter = op.iterator(this.ops);
  612. var line = new Delta();
  613. var i = 0;
  614. while (iter.hasNext()) {
  615. if (iter.peekType() !== 'insert') return;
  616. var thisOp = iter.peek();
  617. var start = op.length(thisOp) - iter.peekLength();
  618. var index = typeof thisOp.insert === 'string' ?
  619. thisOp.insert.indexOf(newline, start) - start : -1;
  620. if (index < 0) {
  621. line.push(iter.next());
  622. } else if (index > 0) {
  623. line.push(iter.next(index));
  624. } else {
  625. if (predicate(line, iter.next(1).attributes || {}, i) === false) {
  626. return;
  627. }
  628. i += 1;
  629. line = new Delta();
  630. }
  631. }
  632. if (line.length() > 0) {
  633. predicate(line, {}, i);
  634. }
  635. };
  636. Delta.prototype.transform = function (other, priority) {
  637. priority = !!priority;
  638. if (typeof other === 'number') {
  639. return this.transformPosition(other, priority);
  640. }
  641. var thisIter = op.iterator(this.ops);
  642. var otherIter = op.iterator(other.ops);
  643. var delta = new Delta();
  644. while (thisIter.hasNext() || otherIter.hasNext()) {
  645. if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) {
  646. delta.retain(op.length(thisIter.next()));
  647. } else if (otherIter.peekType() === 'insert') {
  648. delta.push(otherIter.next());
  649. } else {
  650. var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
  651. var thisOp = thisIter.next(length);
  652. var otherOp = otherIter.next(length);
  653. if (thisOp['delete']) {
  654. // Our delete either makes their delete redundant or removes their retain
  655. continue;
  656. } else if (otherOp['delete']) {
  657. delta.push(otherOp);
  658. } else {
  659. // We retain either their retain or insert
  660. delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority));
  661. }
  662. }
  663. }
  664. return delta.chop();
  665. };
  666. Delta.prototype.transformPosition = function (index, priority) {
  667. priority = !!priority;
  668. var thisIter = op.iterator(this.ops);
  669. var offset = 0;
  670. while (thisIter.hasNext() && offset <= index) {
  671. var length = thisIter.peekLength();
  672. var nextType = thisIter.peekType();
  673. thisIter.next();
  674. if (nextType === 'delete') {
  675. index -= Math.min(length, index - offset);
  676. continue;
  677. } else if (nextType === 'insert' && (offset < index || !priority)) {
  678. index += length;
  679. }
  680. offset += length;
  681. }
  682. return index;
  683. };
  684. module.exports = Delta;
  685. /***/ }),
  686. /* 3 */
  687. /***/ (function(module, exports) {
  688. 'use strict';
  689. var hasOwn = Object.prototype.hasOwnProperty;
  690. var toStr = Object.prototype.toString;
  691. var defineProperty = Object.defineProperty;
  692. var gOPD = Object.getOwnPropertyDescriptor;
  693. var isArray = function isArray(arr) {
  694. if (typeof Array.isArray === 'function') {
  695. return Array.isArray(arr);
  696. }
  697. return toStr.call(arr) === '[object Array]';
  698. };
  699. var isPlainObject = function isPlainObject(obj) {
  700. if (!obj || toStr.call(obj) !== '[object Object]') {
  701. return false;
  702. }
  703. var hasOwnConstructor = hasOwn.call(obj, 'constructor');
  704. var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
  705. // Not own constructor property must be Object
  706. if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
  707. return false;
  708. }
  709. // Own properties are enumerated firstly, so to speed up,
  710. // if last one is own, then all properties are own.
  711. var key;
  712. for (key in obj) { /**/ }
  713. return typeof key === 'undefined' || hasOwn.call(obj, key);
  714. };
  715. // If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
  716. var setProperty = function setProperty(target, options) {
  717. if (defineProperty && options.name === '__proto__') {
  718. defineProperty(target, options.name, {
  719. enumerable: true,
  720. configurable: true,
  721. value: options.newValue,
  722. writable: true
  723. });
  724. } else {
  725. target[options.name] = options.newValue;
  726. }
  727. };
  728. // Return undefined instead of __proto__ if '__proto__' is not an own property
  729. var getProperty = function getProperty(obj, name) {
  730. if (name === '__proto__') {
  731. if (!hasOwn.call(obj, name)) {
  732. return void 0;
  733. } else if (gOPD) {
  734. // In early versions of node, obj['__proto__'] is buggy when obj has
  735. // __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
  736. return gOPD(obj, name).value;
  737. }
  738. }
  739. return obj[name];
  740. };
  741. module.exports = function extend() {
  742. var options, name, src, copy, copyIsArray, clone;
  743. var target = arguments[0];
  744. var i = 1;
  745. var length = arguments.length;
  746. var deep = false;
  747. // Handle a deep copy situation
  748. if (typeof target === 'boolean') {
  749. deep = target;
  750. target = arguments[1] || {};
  751. // skip the boolean and the target
  752. i = 2;
  753. }
  754. if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
  755. target = {};
  756. }
  757. for (; i < length; ++i) {
  758. options = arguments[i];
  759. // Only deal with non-null/undefined values
  760. if (options != null) {
  761. // Extend the base object
  762. for (name in options) {
  763. src = getProperty(target, name);
  764. copy = getProperty(options, name);
  765. // Prevent never-ending loop
  766. if (target !== copy) {
  767. // Recurse if we're merging plain objects or arrays
  768. if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
  769. if (copyIsArray) {
  770. copyIsArray = false;
  771. clone = src && isArray(src) ? src : [];
  772. } else {
  773. clone = src && isPlainObject(src) ? src : {};
  774. }
  775. // Never move original objects, clone them
  776. setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
  777. // Don't bring in undefined values
  778. } else if (typeof copy !== 'undefined') {
  779. setProperty(target, { name: name, newValue: copy });
  780. }
  781. }
  782. }
  783. }
  784. }
  785. // Return the modified object
  786. return target;
  787. };
  788. /***/ }),
  789. /* 4 */
  790. /***/ (function(module, exports, __webpack_require__) {
  791. "use strict";
  792. Object.defineProperty(exports, "__esModule", {
  793. value: true
  794. });
  795. exports.default = exports.BlockEmbed = exports.bubbleFormats = undefined;
  796. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  797. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  798. var _extend = __webpack_require__(3);
  799. var _extend2 = _interopRequireDefault(_extend);
  800. var _quillDelta = __webpack_require__(2);
  801. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  802. var _parchment = __webpack_require__(0);
  803. var _parchment2 = _interopRequireDefault(_parchment);
  804. var _break = __webpack_require__(16);
  805. var _break2 = _interopRequireDefault(_break);
  806. var _inline = __webpack_require__(6);
  807. var _inline2 = _interopRequireDefault(_inline);
  808. var _text = __webpack_require__(7);
  809. var _text2 = _interopRequireDefault(_text);
  810. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  811. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  812. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  813. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  814. var NEWLINE_LENGTH = 1;
  815. var BlockEmbed = function (_Parchment$Embed) {
  816. _inherits(BlockEmbed, _Parchment$Embed);
  817. function BlockEmbed() {
  818. _classCallCheck(this, BlockEmbed);
  819. return _possibleConstructorReturn(this, (BlockEmbed.__proto__ || Object.getPrototypeOf(BlockEmbed)).apply(this, arguments));
  820. }
  821. _createClass(BlockEmbed, [{
  822. key: 'attach',
  823. value: function attach() {
  824. _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'attach', this).call(this);
  825. this.attributes = new _parchment2.default.Attributor.Store(this.domNode);
  826. }
  827. }, {
  828. key: 'delta',
  829. value: function delta() {
  830. return new _quillDelta2.default().insert(this.value(), (0, _extend2.default)(this.formats(), this.attributes.values()));
  831. }
  832. }, {
  833. key: 'format',
  834. value: function format(name, value) {
  835. var attribute = _parchment2.default.query(name, _parchment2.default.Scope.BLOCK_ATTRIBUTE);
  836. if (attribute != null) {
  837. this.attributes.attribute(attribute, value);
  838. }
  839. }
  840. }, {
  841. key: 'formatAt',
  842. value: function formatAt(index, length, name, value) {
  843. this.format(name, value);
  844. }
  845. }, {
  846. key: 'insertAt',
  847. value: function insertAt(index, value, def) {
  848. if (typeof value === 'string' && value.endsWith('\n')) {
  849. var block = _parchment2.default.create(Block.blotName);
  850. this.parent.insertBefore(block, index === 0 ? this : this.next);
  851. block.insertAt(0, value.slice(0, -1));
  852. } else {
  853. _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'insertAt', this).call(this, index, value, def);
  854. }
  855. }
  856. }]);
  857. return BlockEmbed;
  858. }(_parchment2.default.Embed);
  859. BlockEmbed.scope = _parchment2.default.Scope.BLOCK_BLOT;
  860. // It is important for cursor behavior BlockEmbeds use tags that are block level elements
  861. var Block = function (_Parchment$Block) {
  862. _inherits(Block, _Parchment$Block);
  863. function Block(domNode) {
  864. _classCallCheck(this, Block);
  865. var _this2 = _possibleConstructorReturn(this, (Block.__proto__ || Object.getPrototypeOf(Block)).call(this, domNode));
  866. _this2.cache = {};
  867. return _this2;
  868. }
  869. _createClass(Block, [{
  870. key: 'delta',
  871. value: function delta() {
  872. if (this.cache.delta == null) {
  873. this.cache.delta = this.descendants(_parchment2.default.Leaf).reduce(function (delta, leaf) {
  874. if (leaf.length() === 0) {
  875. return delta;
  876. } else {
  877. return delta.insert(leaf.value(), bubbleFormats(leaf));
  878. }
  879. }, new _quillDelta2.default()).insert('\n', bubbleFormats(this));
  880. }
  881. return this.cache.delta;
  882. }
  883. }, {
  884. key: 'deleteAt',
  885. value: function deleteAt(index, length) {
  886. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'deleteAt', this).call(this, index, length);
  887. this.cache = {};
  888. }
  889. }, {
  890. key: 'formatAt',
  891. value: function formatAt(index, length, name, value) {
  892. if (length <= 0) return;
  893. if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
  894. if (index + length === this.length()) {
  895. this.format(name, value);
  896. }
  897. } else {
  898. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'formatAt', this).call(this, index, Math.min(length, this.length() - index - 1), name, value);
  899. }
  900. this.cache = {};
  901. }
  902. }, {
  903. key: 'insertAt',
  904. value: function insertAt(index, value, def) {
  905. if (def != null) return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, index, value, def);
  906. if (value.length === 0) return;
  907. var lines = value.split('\n');
  908. var text = lines.shift();
  909. if (text.length > 0) {
  910. if (index < this.length() - 1 || this.children.tail == null) {
  911. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, Math.min(index, this.length() - 1), text);
  912. } else {
  913. this.children.tail.insertAt(this.children.tail.length(), text);
  914. }
  915. this.cache = {};
  916. }
  917. var block = this;
  918. lines.reduce(function (index, line) {
  919. block = block.split(index, true);
  920. block.insertAt(0, line);
  921. return line.length;
  922. }, index + text.length);
  923. }
  924. }, {
  925. key: 'insertBefore',
  926. value: function insertBefore(blot, ref) {
  927. var head = this.children.head;
  928. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertBefore', this).call(this, blot, ref);
  929. if (head instanceof _break2.default) {
  930. head.remove();
  931. }
  932. this.cache = {};
  933. }
  934. }, {
  935. key: 'length',
  936. value: function length() {
  937. if (this.cache.length == null) {
  938. this.cache.length = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'length', this).call(this) + NEWLINE_LENGTH;
  939. }
  940. return this.cache.length;
  941. }
  942. }, {
  943. key: 'moveChildren',
  944. value: function moveChildren(target, ref) {
  945. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'moveChildren', this).call(this, target, ref);
  946. this.cache = {};
  947. }
  948. }, {
  949. key: 'optimize',
  950. value: function optimize(context) {
  951. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'optimize', this).call(this, context);
  952. this.cache = {};
  953. }
  954. }, {
  955. key: 'path',
  956. value: function path(index) {
  957. return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'path', this).call(this, index, true);
  958. }
  959. }, {
  960. key: 'removeChild',
  961. value: function removeChild(child) {
  962. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'removeChild', this).call(this, child);
  963. this.cache = {};
  964. }
  965. }, {
  966. key: 'split',
  967. value: function split(index) {
  968. var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  969. if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) {
  970. var clone = this.clone();
  971. if (index === 0) {
  972. this.parent.insertBefore(clone, this);
  973. return this;
  974. } else {
  975. this.parent.insertBefore(clone, this.next);
  976. return clone;
  977. }
  978. } else {
  979. var next = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'split', this).call(this, index, force);
  980. this.cache = {};
  981. return next;
  982. }
  983. }
  984. }]);
  985. return Block;
  986. }(_parchment2.default.Block);
  987. Block.blotName = 'block';
  988. Block.tagName = 'P';
  989. Block.defaultChild = 'break';
  990. Block.allowedChildren = [_inline2.default, _parchment2.default.Embed, _text2.default];
  991. function bubbleFormats(blot) {
  992. var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  993. if (blot == null) return formats;
  994. if (typeof blot.formats === 'function') {
  995. formats = (0, _extend2.default)(formats, blot.formats());
  996. }
  997. if (blot.parent == null || blot.parent.blotName == 'scroll' || blot.parent.statics.scope !== blot.statics.scope) {
  998. return formats;
  999. }
  1000. return bubbleFormats(blot.parent, formats);
  1001. }
  1002. exports.bubbleFormats = bubbleFormats;
  1003. exports.BlockEmbed = BlockEmbed;
  1004. exports.default = Block;
  1005. /***/ }),
  1006. /* 5 */
  1007. /***/ (function(module, exports, __webpack_require__) {
  1008. "use strict";
  1009. Object.defineProperty(exports, "__esModule", {
  1010. value: true
  1011. });
  1012. exports.default = exports.overload = exports.expandConfig = undefined;
  1013. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  1014. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  1015. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1016. __webpack_require__(50);
  1017. var _quillDelta = __webpack_require__(2);
  1018. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  1019. var _editor = __webpack_require__(14);
  1020. var _editor2 = _interopRequireDefault(_editor);
  1021. var _emitter3 = __webpack_require__(8);
  1022. var _emitter4 = _interopRequireDefault(_emitter3);
  1023. var _module = __webpack_require__(9);
  1024. var _module2 = _interopRequireDefault(_module);
  1025. var _parchment = __webpack_require__(0);
  1026. var _parchment2 = _interopRequireDefault(_parchment);
  1027. var _selection = __webpack_require__(15);
  1028. var _selection2 = _interopRequireDefault(_selection);
  1029. var _extend = __webpack_require__(3);
  1030. var _extend2 = _interopRequireDefault(_extend);
  1031. var _logger = __webpack_require__(10);
  1032. var _logger2 = _interopRequireDefault(_logger);
  1033. var _theme = __webpack_require__(34);
  1034. var _theme2 = _interopRequireDefault(_theme);
  1035. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1036. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  1037. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1038. var debug = (0, _logger2.default)('quill');
  1039. var Quill = function () {
  1040. _createClass(Quill, null, [{
  1041. key: 'debug',
  1042. value: function debug(limit) {
  1043. if (limit === true) {
  1044. limit = 'log';
  1045. }
  1046. _logger2.default.level(limit);
  1047. }
  1048. }, {
  1049. key: 'find',
  1050. value: function find(node) {
  1051. return node.__quill || _parchment2.default.find(node);
  1052. }
  1053. }, {
  1054. key: 'import',
  1055. value: function _import(name) {
  1056. if (this.imports[name] == null) {
  1057. debug.error('Cannot import ' + name + '. Are you sure it was registered?');
  1058. }
  1059. return this.imports[name];
  1060. }
  1061. }, {
  1062. key: 'register',
  1063. value: function register(path, target) {
  1064. var _this = this;
  1065. var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1066. if (typeof path !== 'string') {
  1067. var name = path.attrName || path.blotName;
  1068. if (typeof name === 'string') {
  1069. // register(Blot | Attributor, overwrite)
  1070. this.register('formats/' + name, path, target);
  1071. } else {
  1072. Object.keys(path).forEach(function (key) {
  1073. _this.register(key, path[key], target);
  1074. });
  1075. }
  1076. } else {
  1077. if (this.imports[path] != null && !overwrite) {
  1078. debug.warn('Overwriting ' + path + ' with', target);
  1079. }
  1080. this.imports[path] = target;
  1081. if ((path.startsWith('blots/') || path.startsWith('formats/')) && target.blotName !== 'abstract') {
  1082. _parchment2.default.register(target);
  1083. } else if (path.startsWith('modules') && typeof target.register === 'function') {
  1084. target.register();
  1085. }
  1086. }
  1087. }
  1088. }]);
  1089. function Quill(container) {
  1090. var _this2 = this;
  1091. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1092. _classCallCheck(this, Quill);
  1093. this.options = expandConfig(container, options);
  1094. this.container = this.options.container;
  1095. if (this.container == null) {
  1096. return debug.error('Invalid Quill container', container);
  1097. }
  1098. if (this.options.debug) {
  1099. Quill.debug(this.options.debug);
  1100. }
  1101. var html = this.container.innerHTML.trim();
  1102. this.container.classList.add('ql-container');
  1103. this.container.innerHTML = '';
  1104. this.container.__quill = this;
  1105. this.root = this.addContainer('ql-editor');
  1106. this.root.classList.add('ql-blank');
  1107. this.root.setAttribute('data-gramm', false);
  1108. this.scrollingContainer = this.options.scrollingContainer || this.root;
  1109. this.emitter = new _emitter4.default();
  1110. this.scroll = _parchment2.default.create(this.root, {
  1111. emitter: this.emitter,
  1112. whitelist: this.options.formats
  1113. });
  1114. this.editor = new _editor2.default(this.scroll);
  1115. this.selection = new _selection2.default(this.scroll, this.emitter);
  1116. this.theme = new this.options.theme(this, this.options);
  1117. this.keyboard = this.theme.addModule('keyboard');
  1118. this.clipboard = this.theme.addModule('clipboard');
  1119. this.history = this.theme.addModule('history');
  1120. this.theme.init();
  1121. this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type) {
  1122. if (type === _emitter4.default.events.TEXT_CHANGE) {
  1123. _this2.root.classList.toggle('ql-blank', _this2.editor.isBlank());
  1124. }
  1125. });
  1126. this.emitter.on(_emitter4.default.events.SCROLL_UPDATE, function (source, mutations) {
  1127. var range = _this2.selection.lastRange;
  1128. var index = range && range.length === 0 ? range.index : undefined;
  1129. modify.call(_this2, function () {
  1130. return _this2.editor.update(null, mutations, index);
  1131. }, source);
  1132. });
  1133. var contents = this.clipboard.convert('<div class=\'ql-editor\' style="white-space: normal;">' + html + '<p><br></p></div>');
  1134. this.setContents(contents);
  1135. this.history.clear();
  1136. if (this.options.placeholder) {
  1137. this.root.setAttribute('data-placeholder', this.options.placeholder);
  1138. }
  1139. if (this.options.readOnly) {
  1140. this.disable();
  1141. }
  1142. }
  1143. _createClass(Quill, [{
  1144. key: 'addContainer',
  1145. value: function addContainer(container) {
  1146. var refNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1147. if (typeof container === 'string') {
  1148. var className = container;
  1149. container = document.createElement('div');
  1150. container.classList.add(className);
  1151. }
  1152. this.container.insertBefore(container, refNode);
  1153. return container;
  1154. }
  1155. }, {
  1156. key: 'blur',
  1157. value: function blur() {
  1158. this.selection.setRange(null);
  1159. }
  1160. }, {
  1161. key: 'deleteText',
  1162. value: function deleteText(index, length, source) {
  1163. var _this3 = this;
  1164. var _overload = overload(index, length, source);
  1165. var _overload2 = _slicedToArray(_overload, 4);
  1166. index = _overload2[0];
  1167. length = _overload2[1];
  1168. source = _overload2[3];
  1169. return modify.call(this, function () {
  1170. return _this3.editor.deleteText(index, length);
  1171. }, source, index, -1 * length);
  1172. }
  1173. }, {
  1174. key: 'disable',
  1175. value: function disable() {
  1176. this.enable(false);
  1177. }
  1178. }, {
  1179. key: 'enable',
  1180. value: function enable() {
  1181. var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  1182. this.scroll.enable(enabled);
  1183. this.container.classList.toggle('ql-disabled', !enabled);
  1184. }
  1185. }, {
  1186. key: 'focus',
  1187. value: function focus() {
  1188. var scrollTop = this.scrollingContainer.scrollTop;
  1189. this.selection.focus();
  1190. this.scrollingContainer.scrollTop = scrollTop;
  1191. this.scrollIntoView();
  1192. }
  1193. }, {
  1194. key: 'format',
  1195. value: function format(name, value) {
  1196. var _this4 = this;
  1197. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
  1198. return modify.call(this, function () {
  1199. var range = _this4.getSelection(true);
  1200. var change = new _quillDelta2.default();
  1201. if (range == null) {
  1202. return change;
  1203. } else if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
  1204. change = _this4.editor.formatLine(range.index, range.length, _defineProperty({}, name, value));
  1205. } else if (range.length === 0) {
  1206. _this4.selection.format(name, value);
  1207. return change;
  1208. } else {
  1209. change = _this4.editor.formatText(range.index, range.length, _defineProperty({}, name, value));
  1210. }
  1211. _this4.setSelection(range, _emitter4.default.sources.SILENT);
  1212. return change;
  1213. }, source);
  1214. }
  1215. }, {
  1216. key: 'formatLine',
  1217. value: function formatLine(index, length, name, value, source) {
  1218. var _this5 = this;
  1219. var formats = void 0;
  1220. var _overload3 = overload(index, length, name, value, source);
  1221. var _overload4 = _slicedToArray(_overload3, 4);
  1222. index = _overload4[0];
  1223. length = _overload4[1];
  1224. formats = _overload4[2];
  1225. source = _overload4[3];
  1226. return modify.call(this, function () {
  1227. return _this5.editor.formatLine(index, length, formats);
  1228. }, source, index, 0);
  1229. }
  1230. }, {
  1231. key: 'formatText',
  1232. value: function formatText(index, length, name, value, source) {
  1233. var _this6 = this;
  1234. var formats = void 0;
  1235. var _overload5 = overload(index, length, name, value, source);
  1236. var _overload6 = _slicedToArray(_overload5, 4);
  1237. index = _overload6[0];
  1238. length = _overload6[1];
  1239. formats = _overload6[2];
  1240. source = _overload6[3];
  1241. return modify.call(this, function () {
  1242. return _this6.editor.formatText(index, length, formats);
  1243. }, source, index, 0);
  1244. }
  1245. }, {
  1246. key: 'getBounds',
  1247. value: function getBounds(index) {
  1248. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  1249. var bounds = void 0;
  1250. if (typeof index === 'number') {
  1251. bounds = this.selection.getBounds(index, length);
  1252. } else {
  1253. bounds = this.selection.getBounds(index.index, index.length);
  1254. }
  1255. var containerBounds = this.container.getBoundingClientRect();
  1256. return {
  1257. bottom: bounds.bottom - containerBounds.top,
  1258. height: bounds.height,
  1259. left: bounds.left - containerBounds.left,
  1260. right: bounds.right - containerBounds.left,
  1261. top: bounds.top - containerBounds.top,
  1262. width: bounds.width
  1263. };
  1264. }
  1265. }, {
  1266. key: 'getContents',
  1267. value: function getContents() {
  1268. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1269. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
  1270. var _overload7 = overload(index, length);
  1271. var _overload8 = _slicedToArray(_overload7, 2);
  1272. index = _overload8[0];
  1273. length = _overload8[1];
  1274. return this.editor.getContents(index, length);
  1275. }
  1276. }, {
  1277. key: 'getFormat',
  1278. value: function getFormat() {
  1279. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSelection(true);
  1280. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  1281. if (typeof index === 'number') {
  1282. return this.editor.getFormat(index, length);
  1283. } else {
  1284. return this.editor.getFormat(index.index, index.length);
  1285. }
  1286. }
  1287. }, {
  1288. key: 'getIndex',
  1289. value: function getIndex(blot) {
  1290. return blot.offset(this.scroll);
  1291. }
  1292. }, {
  1293. key: 'getLength',
  1294. value: function getLength() {
  1295. return this.scroll.length();
  1296. }
  1297. }, {
  1298. key: 'getLeaf',
  1299. value: function getLeaf(index) {
  1300. return this.scroll.leaf(index);
  1301. }
  1302. }, {
  1303. key: 'getLine',
  1304. value: function getLine(index) {
  1305. return this.scroll.line(index);
  1306. }
  1307. }, {
  1308. key: 'getLines',
  1309. value: function getLines() {
  1310. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1311. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
  1312. if (typeof index !== 'number') {
  1313. return this.scroll.lines(index.index, index.length);
  1314. } else {
  1315. return this.scroll.lines(index, length);
  1316. }
  1317. }
  1318. }, {
  1319. key: 'getModule',
  1320. value: function getModule(name) {
  1321. return this.theme.modules[name];
  1322. }
  1323. }, {
  1324. key: 'getSelection',
  1325. value: function getSelection() {
  1326. var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  1327. if (focus) this.focus();
  1328. this.update(); // Make sure we access getRange with editor in consistent state
  1329. return this.selection.getRange()[0];
  1330. }
  1331. }, {
  1332. key: 'getText',
  1333. value: function getText() {
  1334. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1335. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
  1336. var _overload9 = overload(index, length);
  1337. var _overload10 = _slicedToArray(_overload9, 2);
  1338. index = _overload10[0];
  1339. length = _overload10[1];
  1340. return this.editor.getText(index, length);
  1341. }
  1342. }, {
  1343. key: 'hasFocus',
  1344. value: function hasFocus() {
  1345. return this.selection.hasFocus();
  1346. }
  1347. }, {
  1348. key: 'insertEmbed',
  1349. value: function insertEmbed(index, embed, value) {
  1350. var _this7 = this;
  1351. var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Quill.sources.API;
  1352. return modify.call(this, function () {
  1353. return _this7.editor.insertEmbed(index, embed, value);
  1354. }, source, index);
  1355. }
  1356. }, {
  1357. key: 'insertText',
  1358. value: function insertText(index, text, name, value, source) {
  1359. var _this8 = this;
  1360. var formats = void 0;
  1361. var _overload11 = overload(index, 0, name, value, source);
  1362. var _overload12 = _slicedToArray(_overload11, 4);
  1363. index = _overload12[0];
  1364. formats = _overload12[2];
  1365. source = _overload12[3];
  1366. return modify.call(this, function () {
  1367. return _this8.editor.insertText(index, text, formats);
  1368. }, source, index, text.length);
  1369. }
  1370. }, {
  1371. key: 'isEnabled',
  1372. value: function isEnabled() {
  1373. return !this.container.classList.contains('ql-disabled');
  1374. }
  1375. }, {
  1376. key: 'off',
  1377. value: function off() {
  1378. return this.emitter.off.apply(this.emitter, arguments);
  1379. }
  1380. }, {
  1381. key: 'on',
  1382. value: function on() {
  1383. return this.emitter.on.apply(this.emitter, arguments);
  1384. }
  1385. }, {
  1386. key: 'once',
  1387. value: function once() {
  1388. return this.emitter.once.apply(this.emitter, arguments);
  1389. }
  1390. }, {
  1391. key: 'pasteHTML',
  1392. value: function pasteHTML(index, html, source) {
  1393. this.clipboard.dangerouslyPasteHTML(index, html, source);
  1394. }
  1395. }, {
  1396. key: 'removeFormat',
  1397. value: function removeFormat(index, length, source) {
  1398. var _this9 = this;
  1399. var _overload13 = overload(index, length, source);
  1400. var _overload14 = _slicedToArray(_overload13, 4);
  1401. index = _overload14[0];
  1402. length = _overload14[1];
  1403. source = _overload14[3];
  1404. return modify.call(this, function () {
  1405. return _this9.editor.removeFormat(index, length);
  1406. }, source, index);
  1407. }
  1408. }, {
  1409. key: 'scrollIntoView',
  1410. value: function scrollIntoView() {
  1411. this.selection.scrollIntoView(this.scrollingContainer);
  1412. }
  1413. }, {
  1414. key: 'setContents',
  1415. value: function setContents(delta) {
  1416. var _this10 = this;
  1417. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1418. return modify.call(this, function () {
  1419. delta = new _quillDelta2.default(delta);
  1420. var length = _this10.getLength();
  1421. var deleted = _this10.editor.deleteText(0, length);
  1422. var applied = _this10.editor.applyDelta(delta);
  1423. var lastOp = applied.ops[applied.ops.length - 1];
  1424. if (lastOp != null && typeof lastOp.insert === 'string' && lastOp.insert[lastOp.insert.length - 1] === '\n') {
  1425. _this10.editor.deleteText(_this10.getLength() - 1, 1);
  1426. applied.delete(1);
  1427. }
  1428. var ret = deleted.compose(applied);
  1429. return ret;
  1430. }, source);
  1431. }
  1432. }, {
  1433. key: 'setSelection',
  1434. value: function setSelection(index, length, source) {
  1435. if (index == null) {
  1436. this.selection.setRange(null, length || Quill.sources.API);
  1437. } else {
  1438. var _overload15 = overload(index, length, source);
  1439. var _overload16 = _slicedToArray(_overload15, 4);
  1440. index = _overload16[0];
  1441. length = _overload16[1];
  1442. source = _overload16[3];
  1443. this.selection.setRange(new _selection.Range(index, length), source);
  1444. if (source !== _emitter4.default.sources.SILENT) {
  1445. this.selection.scrollIntoView(this.scrollingContainer);
  1446. }
  1447. }
  1448. }
  1449. }, {
  1450. key: 'setText',
  1451. value: function setText(text) {
  1452. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1453. var delta = new _quillDelta2.default().insert(text);
  1454. return this.setContents(delta, source);
  1455. }
  1456. }, {
  1457. key: 'update',
  1458. value: function update() {
  1459. var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
  1460. var change = this.scroll.update(source); // Will update selection before selection.update() does if text changes
  1461. this.selection.update(source);
  1462. return change;
  1463. }
  1464. }, {
  1465. key: 'updateContents',
  1466. value: function updateContents(delta) {
  1467. var _this11 = this;
  1468. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1469. return modify.call(this, function () {
  1470. delta = new _quillDelta2.default(delta);
  1471. return _this11.editor.applyDelta(delta, source);
  1472. }, source, true);
  1473. }
  1474. }]);
  1475. return Quill;
  1476. }();
  1477. Quill.DEFAULTS = {
  1478. bounds: null,
  1479. formats: null,
  1480. modules: {},
  1481. placeholder: '',
  1482. readOnly: false,
  1483. scrollingContainer: null,
  1484. strict: true,
  1485. theme: 'default'
  1486. };
  1487. Quill.events = _emitter4.default.events;
  1488. Quill.sources = _emitter4.default.sources;
  1489. // eslint-disable-next-line no-undef
  1490. Quill.version = false ? undefined : "1.3.7";
  1491. Quill.imports = {
  1492. 'delta': _quillDelta2.default,
  1493. 'parchment': _parchment2.default,
  1494. 'core/module': _module2.default,
  1495. 'core/theme': _theme2.default
  1496. };
  1497. function expandConfig(container, userConfig) {
  1498. userConfig = (0, _extend2.default)(true, {
  1499. container: container,
  1500. modules: {
  1501. clipboard: true,
  1502. keyboard: true,
  1503. history: true
  1504. }
  1505. }, userConfig);
  1506. if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) {
  1507. userConfig.theme = _theme2.default;
  1508. } else {
  1509. userConfig.theme = Quill.import('themes/' + userConfig.theme);
  1510. if (userConfig.theme == null) {
  1511. throw new Error('Invalid theme ' + userConfig.theme + '. Did you register it?');
  1512. }
  1513. }
  1514. var themeConfig = (0, _extend2.default)(true, {}, userConfig.theme.DEFAULTS);
  1515. [themeConfig, userConfig].forEach(function (config) {
  1516. config.modules = config.modules || {};
  1517. Object.keys(config.modules).forEach(function (module) {
  1518. if (config.modules[module] === true) {
  1519. config.modules[module] = {};
  1520. }
  1521. });
  1522. });
  1523. var moduleNames = Object.keys(themeConfig.modules).concat(Object.keys(userConfig.modules));
  1524. var moduleConfig = moduleNames.reduce(function (config, name) {
  1525. var moduleClass = Quill.import('modules/' + name);
  1526. if (moduleClass == null) {
  1527. debug.error('Cannot load ' + name + ' module. Are you sure you registered it?');
  1528. } else {
  1529. config[name] = moduleClass.DEFAULTS || {};
  1530. }
  1531. return config;
  1532. }, {});
  1533. // Special case toolbar shorthand
  1534. if (userConfig.modules != null && userConfig.modules.toolbar && userConfig.modules.toolbar.constructor !== Object) {
  1535. userConfig.modules.toolbar = {
  1536. container: userConfig.modules.toolbar
  1537. };
  1538. }
  1539. userConfig = (0, _extend2.default)(true, {}, Quill.DEFAULTS, { modules: moduleConfig }, themeConfig, userConfig);
  1540. ['bounds', 'container', 'scrollingContainer'].forEach(function (key) {
  1541. if (typeof userConfig[key] === 'string') {
  1542. userConfig[key] = document.querySelector(userConfig[key]);
  1543. }
  1544. });
  1545. userConfig.modules = Object.keys(userConfig.modules).reduce(function (config, name) {
  1546. if (userConfig.modules[name]) {
  1547. config[name] = userConfig.modules[name];
  1548. }
  1549. return config;
  1550. }, {});
  1551. return userConfig;
  1552. }
  1553. // Handle selection preservation and TEXT_CHANGE emission
  1554. // common to modification APIs
  1555. function modify(modifier, source, index, shift) {
  1556. if (this.options.strict && !this.isEnabled() && source === _emitter4.default.sources.USER) {
  1557. return new _quillDelta2.default();
  1558. }
  1559. var range = index == null ? null : this.getSelection();
  1560. var oldDelta = this.editor.delta;
  1561. var change = modifier();
  1562. if (range != null) {
  1563. if (index === true) index = range.index;
  1564. if (shift == null) {
  1565. range = shiftRange(range, change, source);
  1566. } else if (shift !== 0) {
  1567. range = shiftRange(range, index, shift, source);
  1568. }
  1569. this.setSelection(range, _emitter4.default.sources.SILENT);
  1570. }
  1571. if (change.length() > 0) {
  1572. var _emitter;
  1573. var args = [_emitter4.default.events.TEXT_CHANGE, change, oldDelta, source];
  1574. (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
  1575. if (source !== _emitter4.default.sources.SILENT) {
  1576. var _emitter2;
  1577. (_emitter2 = this.emitter).emit.apply(_emitter2, args);
  1578. }
  1579. }
  1580. return change;
  1581. }
  1582. function overload(index, length, name, value, source) {
  1583. var formats = {};
  1584. if (typeof index.index === 'number' && typeof index.length === 'number') {
  1585. // Allow for throwaway end (used by insertText/insertEmbed)
  1586. if (typeof length !== 'number') {
  1587. source = value, value = name, name = length, length = index.length, index = index.index;
  1588. } else {
  1589. length = index.length, index = index.index;
  1590. }
  1591. } else if (typeof length !== 'number') {
  1592. source = value, value = name, name = length, length = 0;
  1593. }
  1594. // Handle format being object, two format name/value strings or excluded
  1595. if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
  1596. formats = name;
  1597. source = value;
  1598. } else if (typeof name === 'string') {
  1599. if (value != null) {
  1600. formats[name] = value;
  1601. } else {
  1602. source = name;
  1603. }
  1604. }
  1605. // Handle optional source
  1606. source = source || _emitter4.default.sources.API;
  1607. return [index, length, formats, source];
  1608. }
  1609. function shiftRange(range, index, length, source) {
  1610. if (range == null) return null;
  1611. var start = void 0,
  1612. end = void 0;
  1613. if (index instanceof _quillDelta2.default) {
  1614. var _map = [range.index, range.index + range.length].map(function (pos) {
  1615. return index.transformPosition(pos, source !== _emitter4.default.sources.USER);
  1616. });
  1617. var _map2 = _slicedToArray(_map, 2);
  1618. start = _map2[0];
  1619. end = _map2[1];
  1620. } else {
  1621. var _map3 = [range.index, range.index + range.length].map(function (pos) {
  1622. if (pos < index || pos === index && source === _emitter4.default.sources.USER) return pos;
  1623. if (length >= 0) {
  1624. return pos + length;
  1625. } else {
  1626. return Math.max(index, pos + length);
  1627. }
  1628. });
  1629. var _map4 = _slicedToArray(_map3, 2);
  1630. start = _map4[0];
  1631. end = _map4[1];
  1632. }
  1633. return new _selection.Range(start, end - start);
  1634. }
  1635. exports.expandConfig = expandConfig;
  1636. exports.overload = overload;
  1637. exports.default = Quill;
  1638. /***/ }),
  1639. /* 6 */
  1640. /***/ (function(module, exports, __webpack_require__) {
  1641. "use strict";
  1642. Object.defineProperty(exports, "__esModule", {
  1643. value: true
  1644. });
  1645. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1646. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1647. var _text = __webpack_require__(7);
  1648. var _text2 = _interopRequireDefault(_text);
  1649. var _parchment = __webpack_require__(0);
  1650. var _parchment2 = _interopRequireDefault(_parchment);
  1651. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1652. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1653. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1654. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1655. var Inline = function (_Parchment$Inline) {
  1656. _inherits(Inline, _Parchment$Inline);
  1657. function Inline() {
  1658. _classCallCheck(this, Inline);
  1659. return _possibleConstructorReturn(this, (Inline.__proto__ || Object.getPrototypeOf(Inline)).apply(this, arguments));
  1660. }
  1661. _createClass(Inline, [{
  1662. key: 'formatAt',
  1663. value: function formatAt(index, length, name, value) {
  1664. if (Inline.compare(this.statics.blotName, name) < 0 && _parchment2.default.query(name, _parchment2.default.Scope.BLOT)) {
  1665. var blot = this.isolate(index, length);
  1666. if (value) {
  1667. blot.wrap(name, value);
  1668. }
  1669. } else {
  1670. _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'formatAt', this).call(this, index, length, name, value);
  1671. }
  1672. }
  1673. }, {
  1674. key: 'optimize',
  1675. value: function optimize(context) {
  1676. _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'optimize', this).call(this, context);
  1677. if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) {
  1678. var parent = this.parent.isolate(this.offset(), this.length());
  1679. this.moveChildren(parent);
  1680. parent.wrap(this);
  1681. }
  1682. }
  1683. }], [{
  1684. key: 'compare',
  1685. value: function compare(self, other) {
  1686. var selfIndex = Inline.order.indexOf(self);
  1687. var otherIndex = Inline.order.indexOf(other);
  1688. if (selfIndex >= 0 || otherIndex >= 0) {
  1689. return selfIndex - otherIndex;
  1690. } else if (self === other) {
  1691. return 0;
  1692. } else if (self < other) {
  1693. return -1;
  1694. } else {
  1695. return 1;
  1696. }
  1697. }
  1698. }]);
  1699. return Inline;
  1700. }(_parchment2.default.Inline);
  1701. Inline.allowedChildren = [Inline, _parchment2.default.Embed, _text2.default];
  1702. // Lower index means deeper in the DOM tree, since not found (-1) is for embeds
  1703. Inline.order = ['cursor', 'inline', // Must be lower
  1704. 'underline', 'strike', 'italic', 'bold', 'script', 'link', 'code' // Must be higher
  1705. ];
  1706. exports.default = Inline;
  1707. /***/ }),
  1708. /* 7 */
  1709. /***/ (function(module, exports, __webpack_require__) {
  1710. "use strict";
  1711. Object.defineProperty(exports, "__esModule", {
  1712. value: true
  1713. });
  1714. var _parchment = __webpack_require__(0);
  1715. var _parchment2 = _interopRequireDefault(_parchment);
  1716. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1717. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1718. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1719. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1720. var TextBlot = function (_Parchment$Text) {
  1721. _inherits(TextBlot, _Parchment$Text);
  1722. function TextBlot() {
  1723. _classCallCheck(this, TextBlot);
  1724. return _possibleConstructorReturn(this, (TextBlot.__proto__ || Object.getPrototypeOf(TextBlot)).apply(this, arguments));
  1725. }
  1726. return TextBlot;
  1727. }(_parchment2.default.Text);
  1728. exports.default = TextBlot;
  1729. /***/ }),
  1730. /* 8 */
  1731. /***/ (function(module, exports, __webpack_require__) {
  1732. "use strict";
  1733. Object.defineProperty(exports, "__esModule", {
  1734. value: true
  1735. });
  1736. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1737. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1738. var _eventemitter = __webpack_require__(54);
  1739. var _eventemitter2 = _interopRequireDefault(_eventemitter);
  1740. var _logger = __webpack_require__(10);
  1741. var _logger2 = _interopRequireDefault(_logger);
  1742. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1743. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1744. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1745. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1746. var debug = (0, _logger2.default)('quill:events');
  1747. var EVENTS = ['selectionchange', 'mousedown', 'mouseup', 'click'];
  1748. EVENTS.forEach(function (eventName) {
  1749. document.addEventListener(eventName, function () {
  1750. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  1751. args[_key] = arguments[_key];
  1752. }
  1753. [].slice.call(document.querySelectorAll('.ql-container')).forEach(function (node) {
  1754. // TODO use WeakMap
  1755. if (node.__quill && node.__quill.emitter) {
  1756. var _node$__quill$emitter;
  1757. (_node$__quill$emitter = node.__quill.emitter).handleDOM.apply(_node$__quill$emitter, args);
  1758. }
  1759. });
  1760. });
  1761. });
  1762. var Emitter = function (_EventEmitter) {
  1763. _inherits(Emitter, _EventEmitter);
  1764. function Emitter() {
  1765. _classCallCheck(this, Emitter);
  1766. var _this = _possibleConstructorReturn(this, (Emitter.__proto__ || Object.getPrototypeOf(Emitter)).call(this));
  1767. _this.listeners = {};
  1768. _this.on('error', debug.error);
  1769. return _this;
  1770. }
  1771. _createClass(Emitter, [{
  1772. key: 'emit',
  1773. value: function emit() {
  1774. debug.log.apply(debug, arguments);
  1775. _get(Emitter.prototype.__proto__ || Object.getPrototypeOf(Emitter.prototype), 'emit', this).apply(this, arguments);
  1776. }
  1777. }, {
  1778. key: 'handleDOM',
  1779. value: function handleDOM(event) {
  1780. for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  1781. args[_key2 - 1] = arguments[_key2];
  1782. }
  1783. (this.listeners[event.type] || []).forEach(function (_ref) {
  1784. var node = _ref.node,
  1785. handler = _ref.handler;
  1786. if (event.target === node || node.contains(event.target)) {
  1787. handler.apply(undefined, [event].concat(args));
  1788. }
  1789. });
  1790. }
  1791. }, {
  1792. key: 'listenDOM',
  1793. value: function listenDOM(eventName, node, handler) {
  1794. if (!this.listeners[eventName]) {
  1795. this.listeners[eventName] = [];
  1796. }
  1797. this.listeners[eventName].push({ node: node, handler: handler });
  1798. }
  1799. }]);
  1800. return Emitter;
  1801. }(_eventemitter2.default);
  1802. Emitter.events = {
  1803. EDITOR_CHANGE: 'editor-change',
  1804. SCROLL_BEFORE_UPDATE: 'scroll-before-update',
  1805. SCROLL_OPTIMIZE: 'scroll-optimize',
  1806. SCROLL_UPDATE: 'scroll-update',
  1807. SELECTION_CHANGE: 'selection-change',
  1808. TEXT_CHANGE: 'text-change'
  1809. };
  1810. Emitter.sources = {
  1811. API: 'api',
  1812. SILENT: 'silent',
  1813. USER: 'user'
  1814. };
  1815. exports.default = Emitter;
  1816. /***/ }),
  1817. /* 9 */
  1818. /***/ (function(module, exports, __webpack_require__) {
  1819. "use strict";
  1820. Object.defineProperty(exports, "__esModule", {
  1821. value: true
  1822. });
  1823. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1824. var Module = function Module(quill) {
  1825. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1826. _classCallCheck(this, Module);
  1827. this.quill = quill;
  1828. this.options = options;
  1829. };
  1830. Module.DEFAULTS = {};
  1831. exports.default = Module;
  1832. /***/ }),
  1833. /* 10 */
  1834. /***/ (function(module, exports, __webpack_require__) {
  1835. "use strict";
  1836. Object.defineProperty(exports, "__esModule", {
  1837. value: true
  1838. });
  1839. var levels = ['error', 'warn', 'log', 'info'];
  1840. var level = 'warn';
  1841. function debug(method) {
  1842. if (levels.indexOf(method) <= levels.indexOf(level)) {
  1843. var _console;
  1844. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  1845. args[_key - 1] = arguments[_key];
  1846. }
  1847. (_console = console)[method].apply(_console, args); // eslint-disable-line no-console
  1848. }
  1849. }
  1850. function namespace(ns) {
  1851. return levels.reduce(function (logger, method) {
  1852. logger[method] = debug.bind(console, method, ns);
  1853. return logger;
  1854. }, {});
  1855. }
  1856. debug.level = namespace.level = function (newLevel) {
  1857. level = newLevel;
  1858. };
  1859. exports.default = namespace;
  1860. /***/ }),
  1861. /* 11 */
  1862. /***/ (function(module, exports, __webpack_require__) {
  1863. var pSlice = Array.prototype.slice;
  1864. var objectKeys = __webpack_require__(52);
  1865. var isArguments = __webpack_require__(53);
  1866. var deepEqual = module.exports = function (actual, expected, opts) {
  1867. if (!opts) opts = {};
  1868. // 7.1. All identical values are equivalent, as determined by ===.
  1869. if (actual === expected) {
  1870. return true;
  1871. } else if (actual instanceof Date && expected instanceof Date) {
  1872. return actual.getTime() === expected.getTime();
  1873. // 7.3. Other pairs that do not both pass typeof value == 'object',
  1874. // equivalence is determined by ==.
  1875. } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
  1876. return opts.strict ? actual === expected : actual == expected;
  1877. // 7.4. For all other Object pairs, including Array objects, equivalence is
  1878. // determined by having the same number of owned properties (as verified
  1879. // with Object.prototype.hasOwnProperty.call), the same set of keys
  1880. // (although not necessarily the same order), equivalent values for every
  1881. // corresponding key, and an identical 'prototype' property. Note: this
  1882. // accounts for both named and indexed properties on Arrays.
  1883. } else {
  1884. return objEquiv(actual, expected, opts);
  1885. }
  1886. }
  1887. function isUndefinedOrNull(value) {
  1888. return value === null || value === undefined;
  1889. }
  1890. function isBuffer (x) {
  1891. if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
  1892. if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
  1893. return false;
  1894. }
  1895. if (x.length > 0 && typeof x[0] !== 'number') return false;
  1896. return true;
  1897. }
  1898. function objEquiv(a, b, opts) {
  1899. var i, key;
  1900. if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
  1901. return false;
  1902. // an identical 'prototype' property.
  1903. if (a.prototype !== b.prototype) return false;
  1904. //~~~I've managed to break Object.keys through screwy arguments passing.
  1905. // Converting to array solves the problem.
  1906. if (isArguments(a)) {
  1907. if (!isArguments(b)) {
  1908. return false;
  1909. }
  1910. a = pSlice.call(a);
  1911. b = pSlice.call(b);
  1912. return deepEqual(a, b, opts);
  1913. }
  1914. if (isBuffer(a)) {
  1915. if (!isBuffer(b)) {
  1916. return false;
  1917. }
  1918. if (a.length !== b.length) return false;
  1919. for (i = 0; i < a.length; i++) {
  1920. if (a[i] !== b[i]) return false;
  1921. }
  1922. return true;
  1923. }
  1924. try {
  1925. var ka = objectKeys(a),
  1926. kb = objectKeys(b);
  1927. } catch (e) {//happens when one is a string literal and the other isn't
  1928. return false;
  1929. }
  1930. // having the same number of owned properties (keys incorporates
  1931. // hasOwnProperty)
  1932. if (ka.length != kb.length)
  1933. return false;
  1934. //the same set of keys (although not necessarily the same order),
  1935. ka.sort();
  1936. kb.sort();
  1937. //~~~cheap key test
  1938. for (i = ka.length - 1; i >= 0; i--) {
  1939. if (ka[i] != kb[i])
  1940. return false;
  1941. }
  1942. //equivalent values for every corresponding key, and
  1943. //~~~possibly expensive deep test
  1944. for (i = ka.length - 1; i >= 0; i--) {
  1945. key = ka[i];
  1946. if (!deepEqual(a[key], b[key], opts)) return false;
  1947. }
  1948. return typeof a === typeof b;
  1949. }
  1950. /***/ }),
  1951. /* 12 */
  1952. /***/ (function(module, exports, __webpack_require__) {
  1953. "use strict";
  1954. Object.defineProperty(exports, "__esModule", { value: true });
  1955. var Registry = __webpack_require__(1);
  1956. var Attributor = /** @class */ (function () {
  1957. function Attributor(attrName, keyName, options) {
  1958. if (options === void 0) { options = {}; }
  1959. this.attrName = attrName;
  1960. this.keyName = keyName;
  1961. var attributeBit = Registry.Scope.TYPE & Registry.Scope.ATTRIBUTE;
  1962. if (options.scope != null) {
  1963. // Ignore type bits, force attribute bit
  1964. this.scope = (options.scope & Registry.Scope.LEVEL) | attributeBit;
  1965. }
  1966. else {
  1967. this.scope = Registry.Scope.ATTRIBUTE;
  1968. }
  1969. if (options.whitelist != null)
  1970. this.whitelist = options.whitelist;
  1971. }
  1972. Attributor.keys = function (node) {
  1973. return [].map.call(node.attributes, function (item) {
  1974. return item.name;
  1975. });
  1976. };
  1977. Attributor.prototype.add = function (node, value) {
  1978. if (!this.canAdd(node, value))
  1979. return false;
  1980. node.setAttribute(this.keyName, value);
  1981. return true;
  1982. };
  1983. Attributor.prototype.canAdd = function (node, value) {
  1984. var match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE));
  1985. if (match == null)
  1986. return false;
  1987. if (this.whitelist == null)
  1988. return true;
  1989. if (typeof value === 'string') {
  1990. return this.whitelist.indexOf(value.replace(/["']/g, '')) > -1;
  1991. }
  1992. else {
  1993. return this.whitelist.indexOf(value) > -1;
  1994. }
  1995. };
  1996. Attributor.prototype.remove = function (node) {
  1997. node.removeAttribute(this.keyName);
  1998. };
  1999. Attributor.prototype.value = function (node) {
  2000. var value = node.getAttribute(this.keyName);
  2001. if (this.canAdd(node, value) && value) {
  2002. return value;
  2003. }
  2004. return '';
  2005. };
  2006. return Attributor;
  2007. }());
  2008. exports.default = Attributor;
  2009. /***/ }),
  2010. /* 13 */
  2011. /***/ (function(module, exports, __webpack_require__) {
  2012. "use strict";
  2013. Object.defineProperty(exports, "__esModule", {
  2014. value: true
  2015. });
  2016. exports.default = exports.Code = undefined;
  2017. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  2018. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2019. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  2020. var _quillDelta = __webpack_require__(2);
  2021. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  2022. var _parchment = __webpack_require__(0);
  2023. var _parchment2 = _interopRequireDefault(_parchment);
  2024. var _block = __webpack_require__(4);
  2025. var _block2 = _interopRequireDefault(_block);
  2026. var _inline = __webpack_require__(6);
  2027. var _inline2 = _interopRequireDefault(_inline);
  2028. var _text = __webpack_require__(7);
  2029. var _text2 = _interopRequireDefault(_text);
  2030. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2031. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2032. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2033. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2034. var Code = function (_Inline) {
  2035. _inherits(Code, _Inline);
  2036. function Code() {
  2037. _classCallCheck(this, Code);
  2038. return _possibleConstructorReturn(this, (Code.__proto__ || Object.getPrototypeOf(Code)).apply(this, arguments));
  2039. }
  2040. return Code;
  2041. }(_inline2.default);
  2042. Code.blotName = 'code';
  2043. Code.tagName = 'CODE';
  2044. var CodeBlock = function (_Block) {
  2045. _inherits(CodeBlock, _Block);
  2046. function CodeBlock() {
  2047. _classCallCheck(this, CodeBlock);
  2048. return _possibleConstructorReturn(this, (CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock)).apply(this, arguments));
  2049. }
  2050. _createClass(CodeBlock, [{
  2051. key: 'delta',
  2052. value: function delta() {
  2053. var _this3 = this;
  2054. var text = this.domNode.textContent;
  2055. if (text.endsWith('\n')) {
  2056. // Should always be true
  2057. text = text.slice(0, -1);
  2058. }
  2059. return text.split('\n').reduce(function (delta, frag) {
  2060. return delta.insert(frag).insert('\n', _this3.formats());
  2061. }, new _quillDelta2.default());
  2062. }
  2063. }, {
  2064. key: 'format',
  2065. value: function format(name, value) {
  2066. if (name === this.statics.blotName && value) return;
  2067. var _descendant = this.descendant(_text2.default, this.length() - 1),
  2068. _descendant2 = _slicedToArray(_descendant, 1),
  2069. text = _descendant2[0];
  2070. if (text != null) {
  2071. text.deleteAt(text.length() - 1, 1);
  2072. }
  2073. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'format', this).call(this, name, value);
  2074. }
  2075. }, {
  2076. key: 'formatAt',
  2077. value: function formatAt(index, length, name, value) {
  2078. if (length === 0) return;
  2079. if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK) == null || name === this.statics.blotName && value === this.statics.formats(this.domNode)) {
  2080. return;
  2081. }
  2082. var nextNewline = this.newlineIndex(index);
  2083. if (nextNewline < 0 || nextNewline >= index + length) return;
  2084. var prevNewline = this.newlineIndex(index, true) + 1;
  2085. var isolateLength = nextNewline - prevNewline + 1;
  2086. var blot = this.isolate(prevNewline, isolateLength);
  2087. var next = blot.next;
  2088. blot.format(name, value);
  2089. if (next instanceof CodeBlock) {
  2090. next.formatAt(0, index - prevNewline + length - isolateLength, name, value);
  2091. }
  2092. }
  2093. }, {
  2094. key: 'insertAt',
  2095. value: function insertAt(index, value, def) {
  2096. if (def != null) return;
  2097. var _descendant3 = this.descendant(_text2.default, index),
  2098. _descendant4 = _slicedToArray(_descendant3, 2),
  2099. text = _descendant4[0],
  2100. offset = _descendant4[1];
  2101. text.insertAt(offset, value);
  2102. }
  2103. }, {
  2104. key: 'length',
  2105. value: function length() {
  2106. var length = this.domNode.textContent.length;
  2107. if (!this.domNode.textContent.endsWith('\n')) {
  2108. return length + 1;
  2109. }
  2110. return length;
  2111. }
  2112. }, {
  2113. key: 'newlineIndex',
  2114. value: function newlineIndex(searchIndex) {
  2115. var reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2116. if (!reverse) {
  2117. var offset = this.domNode.textContent.slice(searchIndex).indexOf('\n');
  2118. return offset > -1 ? searchIndex + offset : -1;
  2119. } else {
  2120. return this.domNode.textContent.slice(0, searchIndex).lastIndexOf('\n');
  2121. }
  2122. }
  2123. }, {
  2124. key: 'optimize',
  2125. value: function optimize(context) {
  2126. if (!this.domNode.textContent.endsWith('\n')) {
  2127. this.appendChild(_parchment2.default.create('text', '\n'));
  2128. }
  2129. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'optimize', this).call(this, context);
  2130. var next = this.next;
  2131. if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && this.statics.formats(this.domNode) === next.statics.formats(next.domNode)) {
  2132. next.optimize(context);
  2133. next.moveChildren(this);
  2134. next.remove();
  2135. }
  2136. }
  2137. }, {
  2138. key: 'replace',
  2139. value: function replace(target) {
  2140. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'replace', this).call(this, target);
  2141. [].slice.call(this.domNode.querySelectorAll('*')).forEach(function (node) {
  2142. var blot = _parchment2.default.find(node);
  2143. if (blot == null) {
  2144. node.parentNode.removeChild(node);
  2145. } else if (blot instanceof _parchment2.default.Embed) {
  2146. blot.remove();
  2147. } else {
  2148. blot.unwrap();
  2149. }
  2150. });
  2151. }
  2152. }], [{
  2153. key: 'create',
  2154. value: function create(value) {
  2155. var domNode = _get(CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock), 'create', this).call(this, value);
  2156. domNode.setAttribute('spellcheck', false);
  2157. return domNode;
  2158. }
  2159. }, {
  2160. key: 'formats',
  2161. value: function formats() {
  2162. return true;
  2163. }
  2164. }]);
  2165. return CodeBlock;
  2166. }(_block2.default);
  2167. CodeBlock.blotName = 'code-block';
  2168. CodeBlock.tagName = 'PRE';
  2169. CodeBlock.TAB = ' ';
  2170. exports.Code = Code;
  2171. exports.default = CodeBlock;
  2172. /***/ }),
  2173. /* 14 */
  2174. /***/ (function(module, exports, __webpack_require__) {
  2175. "use strict";
  2176. Object.defineProperty(exports, "__esModule", {
  2177. value: true
  2178. });
  2179. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  2180. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  2181. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2182. var _quillDelta = __webpack_require__(2);
  2183. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  2184. var _op = __webpack_require__(20);
  2185. var _op2 = _interopRequireDefault(_op);
  2186. var _parchment = __webpack_require__(0);
  2187. var _parchment2 = _interopRequireDefault(_parchment);
  2188. var _code = __webpack_require__(13);
  2189. var _code2 = _interopRequireDefault(_code);
  2190. var _cursor = __webpack_require__(24);
  2191. var _cursor2 = _interopRequireDefault(_cursor);
  2192. var _block = __webpack_require__(4);
  2193. var _block2 = _interopRequireDefault(_block);
  2194. var _break = __webpack_require__(16);
  2195. var _break2 = _interopRequireDefault(_break);
  2196. var _clone = __webpack_require__(21);
  2197. var _clone2 = _interopRequireDefault(_clone);
  2198. var _deepEqual = __webpack_require__(11);
  2199. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  2200. var _extend = __webpack_require__(3);
  2201. var _extend2 = _interopRequireDefault(_extend);
  2202. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2203. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  2204. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2205. var ASCII = /^[ -~]*$/;
  2206. var Editor = function () {
  2207. function Editor(scroll) {
  2208. _classCallCheck(this, Editor);
  2209. this.scroll = scroll;
  2210. this.delta = this.getDelta();
  2211. }
  2212. _createClass(Editor, [{
  2213. key: 'applyDelta',
  2214. value: function applyDelta(delta) {
  2215. var _this = this;
  2216. var consumeNextNewline = false;
  2217. this.scroll.update();
  2218. var scrollLength = this.scroll.length();
  2219. this.scroll.batchStart();
  2220. delta = normalizeDelta(delta);
  2221. delta.reduce(function (index, op) {
  2222. var length = op.retain || op.delete || op.insert.length || 1;
  2223. var attributes = op.attributes || {};
  2224. if (op.insert != null) {
  2225. if (typeof op.insert === 'string') {
  2226. var text = op.insert;
  2227. if (text.endsWith('\n') && consumeNextNewline) {
  2228. consumeNextNewline = false;
  2229. text = text.slice(0, -1);
  2230. }
  2231. if (index >= scrollLength && !text.endsWith('\n')) {
  2232. consumeNextNewline = true;
  2233. }
  2234. _this.scroll.insertAt(index, text);
  2235. var _scroll$line = _this.scroll.line(index),
  2236. _scroll$line2 = _slicedToArray(_scroll$line, 2),
  2237. line = _scroll$line2[0],
  2238. offset = _scroll$line2[1];
  2239. var formats = (0, _extend2.default)({}, (0, _block.bubbleFormats)(line));
  2240. if (line instanceof _block2.default) {
  2241. var _line$descendant = line.descendant(_parchment2.default.Leaf, offset),
  2242. _line$descendant2 = _slicedToArray(_line$descendant, 1),
  2243. leaf = _line$descendant2[0];
  2244. formats = (0, _extend2.default)(formats, (0, _block.bubbleFormats)(leaf));
  2245. }
  2246. attributes = _op2.default.attributes.diff(formats, attributes) || {};
  2247. } else if (_typeof(op.insert) === 'object') {
  2248. var key = Object.keys(op.insert)[0]; // There should only be one key
  2249. if (key == null) return index;
  2250. _this.scroll.insertAt(index, key, op.insert[key]);
  2251. }
  2252. scrollLength += length;
  2253. }
  2254. Object.keys(attributes).forEach(function (name) {
  2255. _this.scroll.formatAt(index, length, name, attributes[name]);
  2256. });
  2257. return index + length;
  2258. }, 0);
  2259. delta.reduce(function (index, op) {
  2260. if (typeof op.delete === 'number') {
  2261. _this.scroll.deleteAt(index, op.delete);
  2262. return index;
  2263. }
  2264. return index + (op.retain || op.insert.length || 1);
  2265. }, 0);
  2266. this.scroll.batchEnd();
  2267. return this.update(delta);
  2268. }
  2269. }, {
  2270. key: 'deleteText',
  2271. value: function deleteText(index, length) {
  2272. this.scroll.deleteAt(index, length);
  2273. return this.update(new _quillDelta2.default().retain(index).delete(length));
  2274. }
  2275. }, {
  2276. key: 'formatLine',
  2277. value: function formatLine(index, length) {
  2278. var _this2 = this;
  2279. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2280. this.scroll.update();
  2281. Object.keys(formats).forEach(function (format) {
  2282. if (_this2.scroll.whitelist != null && !_this2.scroll.whitelist[format]) return;
  2283. var lines = _this2.scroll.lines(index, Math.max(length, 1));
  2284. var lengthRemaining = length;
  2285. lines.forEach(function (line) {
  2286. var lineLength = line.length();
  2287. if (!(line instanceof _code2.default)) {
  2288. line.format(format, formats[format]);
  2289. } else {
  2290. var codeIndex = index - line.offset(_this2.scroll);
  2291. var codeLength = line.newlineIndex(codeIndex + lengthRemaining) - codeIndex + 1;
  2292. line.formatAt(codeIndex, codeLength, format, formats[format]);
  2293. }
  2294. lengthRemaining -= lineLength;
  2295. });
  2296. });
  2297. this.scroll.optimize();
  2298. return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
  2299. }
  2300. }, {
  2301. key: 'formatText',
  2302. value: function formatText(index, length) {
  2303. var _this3 = this;
  2304. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2305. Object.keys(formats).forEach(function (format) {
  2306. _this3.scroll.formatAt(index, length, format, formats[format]);
  2307. });
  2308. return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
  2309. }
  2310. }, {
  2311. key: 'getContents',
  2312. value: function getContents(index, length) {
  2313. return this.delta.slice(index, index + length);
  2314. }
  2315. }, {
  2316. key: 'getDelta',
  2317. value: function getDelta() {
  2318. return this.scroll.lines().reduce(function (delta, line) {
  2319. return delta.concat(line.delta());
  2320. }, new _quillDelta2.default());
  2321. }
  2322. }, {
  2323. key: 'getFormat',
  2324. value: function getFormat(index) {
  2325. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  2326. var lines = [],
  2327. leaves = [];
  2328. if (length === 0) {
  2329. this.scroll.path(index).forEach(function (path) {
  2330. var _path = _slicedToArray(path, 1),
  2331. blot = _path[0];
  2332. if (blot instanceof _block2.default) {
  2333. lines.push(blot);
  2334. } else if (blot instanceof _parchment2.default.Leaf) {
  2335. leaves.push(blot);
  2336. }
  2337. });
  2338. } else {
  2339. lines = this.scroll.lines(index, length);
  2340. leaves = this.scroll.descendants(_parchment2.default.Leaf, index, length);
  2341. }
  2342. var formatsArr = [lines, leaves].map(function (blots) {
  2343. if (blots.length === 0) return {};
  2344. var formats = (0, _block.bubbleFormats)(blots.shift());
  2345. while (Object.keys(formats).length > 0) {
  2346. var blot = blots.shift();
  2347. if (blot == null) return formats;
  2348. formats = combineFormats((0, _block.bubbleFormats)(blot), formats);
  2349. }
  2350. return formats;
  2351. });
  2352. return _extend2.default.apply(_extend2.default, formatsArr);
  2353. }
  2354. }, {
  2355. key: 'getText',
  2356. value: function getText(index, length) {
  2357. return this.getContents(index, length).filter(function (op) {
  2358. return typeof op.insert === 'string';
  2359. }).map(function (op) {
  2360. return op.insert;
  2361. }).join('');
  2362. }
  2363. }, {
  2364. key: 'insertEmbed',
  2365. value: function insertEmbed(index, embed, value) {
  2366. this.scroll.insertAt(index, embed, value);
  2367. return this.update(new _quillDelta2.default().retain(index).insert(_defineProperty({}, embed, value)));
  2368. }
  2369. }, {
  2370. key: 'insertText',
  2371. value: function insertText(index, text) {
  2372. var _this4 = this;
  2373. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2374. text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
  2375. this.scroll.insertAt(index, text);
  2376. Object.keys(formats).forEach(function (format) {
  2377. _this4.scroll.formatAt(index, text.length, format, formats[format]);
  2378. });
  2379. return this.update(new _quillDelta2.default().retain(index).insert(text, (0, _clone2.default)(formats)));
  2380. }
  2381. }, {
  2382. key: 'isBlank',
  2383. value: function isBlank() {
  2384. if (this.scroll.children.length == 0) return true;
  2385. if (this.scroll.children.length > 1) return false;
  2386. var block = this.scroll.children.head;
  2387. if (block.statics.blotName !== _block2.default.blotName) return false;
  2388. if (block.children.length > 1) return false;
  2389. return block.children.head instanceof _break2.default;
  2390. }
  2391. }, {
  2392. key: 'removeFormat',
  2393. value: function removeFormat(index, length) {
  2394. var text = this.getText(index, length);
  2395. var _scroll$line3 = this.scroll.line(index + length),
  2396. _scroll$line4 = _slicedToArray(_scroll$line3, 2),
  2397. line = _scroll$line4[0],
  2398. offset = _scroll$line4[1];
  2399. var suffixLength = 0,
  2400. suffix = new _quillDelta2.default();
  2401. if (line != null) {
  2402. if (!(line instanceof _code2.default)) {
  2403. suffixLength = line.length() - offset;
  2404. } else {
  2405. suffixLength = line.newlineIndex(offset) - offset + 1;
  2406. }
  2407. suffix = line.delta().slice(offset, offset + suffixLength - 1).insert('\n');
  2408. }
  2409. var contents = this.getContents(index, length + suffixLength);
  2410. var diff = contents.diff(new _quillDelta2.default().insert(text).concat(suffix));
  2411. var delta = new _quillDelta2.default().retain(index).concat(diff);
  2412. return this.applyDelta(delta);
  2413. }
  2414. }, {
  2415. key: 'update',
  2416. value: function update(change) {
  2417. var mutations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  2418. var cursorIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
  2419. var oldDelta = this.delta;
  2420. if (mutations.length === 1 && mutations[0].type === 'characterData' && mutations[0].target.data.match(ASCII) && _parchment2.default.find(mutations[0].target)) {
  2421. // Optimization for character changes
  2422. var textBlot = _parchment2.default.find(mutations[0].target);
  2423. var formats = (0, _block.bubbleFormats)(textBlot);
  2424. var index = textBlot.offset(this.scroll);
  2425. var oldValue = mutations[0].oldValue.replace(_cursor2.default.CONTENTS, '');
  2426. var oldText = new _quillDelta2.default().insert(oldValue);
  2427. var newText = new _quillDelta2.default().insert(textBlot.value());
  2428. var diffDelta = new _quillDelta2.default().retain(index).concat(oldText.diff(newText, cursorIndex));
  2429. change = diffDelta.reduce(function (delta, op) {
  2430. if (op.insert) {
  2431. return delta.insert(op.insert, formats);
  2432. } else {
  2433. return delta.push(op);
  2434. }
  2435. }, new _quillDelta2.default());
  2436. this.delta = oldDelta.compose(change);
  2437. } else {
  2438. this.delta = this.getDelta();
  2439. if (!change || !(0, _deepEqual2.default)(oldDelta.compose(change), this.delta)) {
  2440. change = oldDelta.diff(this.delta, cursorIndex);
  2441. }
  2442. }
  2443. return change;
  2444. }
  2445. }]);
  2446. return Editor;
  2447. }();
  2448. function combineFormats(formats, combined) {
  2449. return Object.keys(combined).reduce(function (merged, name) {
  2450. if (formats[name] == null) return merged;
  2451. if (combined[name] === formats[name]) {
  2452. merged[name] = combined[name];
  2453. } else if (Array.isArray(combined[name])) {
  2454. if (combined[name].indexOf(formats[name]) < 0) {
  2455. merged[name] = combined[name].concat([formats[name]]);
  2456. }
  2457. } else {
  2458. merged[name] = [combined[name], formats[name]];
  2459. }
  2460. return merged;
  2461. }, {});
  2462. }
  2463. function normalizeDelta(delta) {
  2464. return delta.reduce(function (delta, op) {
  2465. if (op.insert === 1) {
  2466. var attributes = (0, _clone2.default)(op.attributes);
  2467. delete attributes['image'];
  2468. return delta.insert({ image: op.attributes.image }, attributes);
  2469. }
  2470. if (op.attributes != null && (op.attributes.list === true || op.attributes.bullet === true)) {
  2471. op = (0, _clone2.default)(op);
  2472. if (op.attributes.list) {
  2473. op.attributes.list = 'ordered';
  2474. } else {
  2475. op.attributes.list = 'bullet';
  2476. delete op.attributes.bullet;
  2477. }
  2478. }
  2479. if (typeof op.insert === 'string') {
  2480. var text = op.insert.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
  2481. return delta.insert(text, op.attributes);
  2482. }
  2483. return delta.push(op);
  2484. }, new _quillDelta2.default());
  2485. }
  2486. exports.default = Editor;
  2487. /***/ }),
  2488. /* 15 */
  2489. /***/ (function(module, exports, __webpack_require__) {
  2490. "use strict";
  2491. Object.defineProperty(exports, "__esModule", {
  2492. value: true
  2493. });
  2494. exports.default = exports.Range = undefined;
  2495. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  2496. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2497. var _parchment = __webpack_require__(0);
  2498. var _parchment2 = _interopRequireDefault(_parchment);
  2499. var _clone = __webpack_require__(21);
  2500. var _clone2 = _interopRequireDefault(_clone);
  2501. var _deepEqual = __webpack_require__(11);
  2502. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  2503. var _emitter3 = __webpack_require__(8);
  2504. var _emitter4 = _interopRequireDefault(_emitter3);
  2505. var _logger = __webpack_require__(10);
  2506. var _logger2 = _interopRequireDefault(_logger);
  2507. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2508. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  2509. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2510. var debug = (0, _logger2.default)('quill:selection');
  2511. var Range = function Range(index) {
  2512. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  2513. _classCallCheck(this, Range);
  2514. this.index = index;
  2515. this.length = length;
  2516. };
  2517. var Selection = function () {
  2518. function Selection(scroll, emitter) {
  2519. var _this = this;
  2520. _classCallCheck(this, Selection);
  2521. this.emitter = emitter;
  2522. this.scroll = scroll;
  2523. this.composing = false;
  2524. this.mouseDown = false;
  2525. this.root = this.scroll.domNode;
  2526. this.cursor = _parchment2.default.create('cursor', this);
  2527. // savedRange is last non-null range
  2528. this.lastRange = this.savedRange = new Range(0, 0);
  2529. this.handleComposition();
  2530. this.handleDragging();
  2531. this.emitter.listenDOM('selectionchange', document, function () {
  2532. if (!_this.mouseDown) {
  2533. setTimeout(_this.update.bind(_this, _emitter4.default.sources.USER), 1);
  2534. }
  2535. });
  2536. this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type, delta) {
  2537. if (type === _emitter4.default.events.TEXT_CHANGE && delta.length() > 0) {
  2538. _this.update(_emitter4.default.sources.SILENT);
  2539. }
  2540. });
  2541. this.emitter.on(_emitter4.default.events.SCROLL_BEFORE_UPDATE, function () {
  2542. if (!_this.hasFocus()) return;
  2543. var native = _this.getNativeRange();
  2544. if (native == null) return;
  2545. if (native.start.node === _this.cursor.textNode) return; // cursor.restore() will handle
  2546. // TODO unclear if this has negative side effects
  2547. _this.emitter.once(_emitter4.default.events.SCROLL_UPDATE, function () {
  2548. try {
  2549. _this.setNativeRange(native.start.node, native.start.offset, native.end.node, native.end.offset);
  2550. } catch (ignored) {}
  2551. });
  2552. });
  2553. this.emitter.on(_emitter4.default.events.SCROLL_OPTIMIZE, function (mutations, context) {
  2554. if (context.range) {
  2555. var _context$range = context.range,
  2556. startNode = _context$range.startNode,
  2557. startOffset = _context$range.startOffset,
  2558. endNode = _context$range.endNode,
  2559. endOffset = _context$range.endOffset;
  2560. _this.setNativeRange(startNode, startOffset, endNode, endOffset);
  2561. }
  2562. });
  2563. this.update(_emitter4.default.sources.SILENT);
  2564. }
  2565. _createClass(Selection, [{
  2566. key: 'handleComposition',
  2567. value: function handleComposition() {
  2568. var _this2 = this;
  2569. this.root.addEventListener('compositionstart', function () {
  2570. _this2.composing = true;
  2571. });
  2572. this.root.addEventListener('compositionend', function () {
  2573. _this2.composing = false;
  2574. if (_this2.cursor.parent) {
  2575. var range = _this2.cursor.restore();
  2576. if (!range) return;
  2577. setTimeout(function () {
  2578. _this2.setNativeRange(range.startNode, range.startOffset, range.endNode, range.endOffset);
  2579. }, 1);
  2580. }
  2581. });
  2582. }
  2583. }, {
  2584. key: 'handleDragging',
  2585. value: function handleDragging() {
  2586. var _this3 = this;
  2587. this.emitter.listenDOM('mousedown', document.body, function () {
  2588. _this3.mouseDown = true;
  2589. });
  2590. this.emitter.listenDOM('mouseup', document.body, function () {
  2591. _this3.mouseDown = false;
  2592. _this3.update(_emitter4.default.sources.USER);
  2593. });
  2594. }
  2595. }, {
  2596. key: 'focus',
  2597. value: function focus() {
  2598. if (this.hasFocus()) return;
  2599. this.root.focus();
  2600. this.setRange(this.savedRange);
  2601. }
  2602. }, {
  2603. key: 'format',
  2604. value: function format(_format, value) {
  2605. if (this.scroll.whitelist != null && !this.scroll.whitelist[_format]) return;
  2606. this.scroll.update();
  2607. var nativeRange = this.getNativeRange();
  2608. if (nativeRange == null || !nativeRange.native.collapsed || _parchment2.default.query(_format, _parchment2.default.Scope.BLOCK)) return;
  2609. if (nativeRange.start.node !== this.cursor.textNode) {
  2610. var blot = _parchment2.default.find(nativeRange.start.node, false);
  2611. if (blot == null) return;
  2612. // TODO Give blot ability to not split
  2613. if (blot instanceof _parchment2.default.Leaf) {
  2614. var after = blot.split(nativeRange.start.offset);
  2615. blot.parent.insertBefore(this.cursor, after);
  2616. } else {
  2617. blot.insertBefore(this.cursor, nativeRange.start.node); // Should never happen
  2618. }
  2619. this.cursor.attach();
  2620. }
  2621. this.cursor.format(_format, value);
  2622. this.scroll.optimize();
  2623. this.setNativeRange(this.cursor.textNode, this.cursor.textNode.data.length);
  2624. this.update();
  2625. }
  2626. }, {
  2627. key: 'getBounds',
  2628. value: function getBounds(index) {
  2629. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  2630. var scrollLength = this.scroll.length();
  2631. index = Math.min(index, scrollLength - 1);
  2632. length = Math.min(index + length, scrollLength - 1) - index;
  2633. var node = void 0,
  2634. _scroll$leaf = this.scroll.leaf(index),
  2635. _scroll$leaf2 = _slicedToArray(_scroll$leaf, 2),
  2636. leaf = _scroll$leaf2[0],
  2637. offset = _scroll$leaf2[1];
  2638. if (leaf == null) return null;
  2639. var _leaf$position = leaf.position(offset, true);
  2640. var _leaf$position2 = _slicedToArray(_leaf$position, 2);
  2641. node = _leaf$position2[0];
  2642. offset = _leaf$position2[1];
  2643. var range = document.createRange();
  2644. if (length > 0) {
  2645. range.setStart(node, offset);
  2646. var _scroll$leaf3 = this.scroll.leaf(index + length);
  2647. var _scroll$leaf4 = _slicedToArray(_scroll$leaf3, 2);
  2648. leaf = _scroll$leaf4[0];
  2649. offset = _scroll$leaf4[1];
  2650. if (leaf == null) return null;
  2651. var _leaf$position3 = leaf.position(offset, true);
  2652. var _leaf$position4 = _slicedToArray(_leaf$position3, 2);
  2653. node = _leaf$position4[0];
  2654. offset = _leaf$position4[1];
  2655. range.setEnd(node, offset);
  2656. return range.getBoundingClientRect();
  2657. } else {
  2658. var side = 'left';
  2659. var rect = void 0;
  2660. if (node instanceof Text) {
  2661. if (offset < node.data.length) {
  2662. range.setStart(node, offset);
  2663. range.setEnd(node, offset + 1);
  2664. } else {
  2665. range.setStart(node, offset - 1);
  2666. range.setEnd(node, offset);
  2667. side = 'right';
  2668. }
  2669. rect = range.getBoundingClientRect();
  2670. } else {
  2671. rect = leaf.domNode.getBoundingClientRect();
  2672. if (offset > 0) side = 'right';
  2673. }
  2674. return {
  2675. bottom: rect.top + rect.height,
  2676. height: rect.height,
  2677. left: rect[side],
  2678. right: rect[side],
  2679. top: rect.top,
  2680. width: 0
  2681. };
  2682. }
  2683. }
  2684. }, {
  2685. key: 'getNativeRange',
  2686. value: function getNativeRange() {
  2687. var selection = document.getSelection();
  2688. if (selection == null || selection.rangeCount <= 0) return null;
  2689. var nativeRange = selection.getRangeAt(0);
  2690. if (nativeRange == null) return null;
  2691. var range = this.normalizeNative(nativeRange);
  2692. debug.info('getNativeRange', range);
  2693. return range;
  2694. }
  2695. }, {
  2696. key: 'getRange',
  2697. value: function getRange() {
  2698. var normalized = this.getNativeRange();
  2699. if (normalized == null) return [null, null];
  2700. var range = this.normalizedToRange(normalized);
  2701. return [range, normalized];
  2702. }
  2703. }, {
  2704. key: 'hasFocus',
  2705. value: function hasFocus() {
  2706. return document.activeElement === this.root;
  2707. }
  2708. }, {
  2709. key: 'normalizedToRange',
  2710. value: function normalizedToRange(range) {
  2711. var _this4 = this;
  2712. var positions = [[range.start.node, range.start.offset]];
  2713. if (!range.native.collapsed) {
  2714. positions.push([range.end.node, range.end.offset]);
  2715. }
  2716. var indexes = positions.map(function (position) {
  2717. var _position = _slicedToArray(position, 2),
  2718. node = _position[0],
  2719. offset = _position[1];
  2720. var blot = _parchment2.default.find(node, true);
  2721. var index = blot.offset(_this4.scroll);
  2722. if (offset === 0) {
  2723. return index;
  2724. } else if (blot instanceof _parchment2.default.Container) {
  2725. return index + blot.length();
  2726. } else {
  2727. return index + blot.index(node, offset);
  2728. }
  2729. });
  2730. var end = Math.min(Math.max.apply(Math, _toConsumableArray(indexes)), this.scroll.length() - 1);
  2731. var start = Math.min.apply(Math, [end].concat(_toConsumableArray(indexes)));
  2732. return new Range(start, end - start);
  2733. }
  2734. }, {
  2735. key: 'normalizeNative',
  2736. value: function normalizeNative(nativeRange) {
  2737. if (!contains(this.root, nativeRange.startContainer) || !nativeRange.collapsed && !contains(this.root, nativeRange.endContainer)) {
  2738. return null;
  2739. }
  2740. var range = {
  2741. start: { node: nativeRange.startContainer, offset: nativeRange.startOffset },
  2742. end: { node: nativeRange.endContainer, offset: nativeRange.endOffset },
  2743. native: nativeRange
  2744. };
  2745. [range.start, range.end].forEach(function (position) {
  2746. var node = position.node,
  2747. offset = position.offset;
  2748. while (!(node instanceof Text) && node.childNodes.length > 0) {
  2749. if (node.childNodes.length > offset) {
  2750. node = node.childNodes[offset];
  2751. offset = 0;
  2752. } else if (node.childNodes.length === offset) {
  2753. node = node.lastChild;
  2754. offset = node instanceof Text ? node.data.length : node.childNodes.length + 1;
  2755. } else {
  2756. break;
  2757. }
  2758. }
  2759. position.node = node, position.offset = offset;
  2760. });
  2761. return range;
  2762. }
  2763. }, {
  2764. key: 'rangeToNative',
  2765. value: function rangeToNative(range) {
  2766. var _this5 = this;
  2767. var indexes = range.collapsed ? [range.index] : [range.index, range.index + range.length];
  2768. var args = [];
  2769. var scrollLength = this.scroll.length();
  2770. indexes.forEach(function (index, i) {
  2771. index = Math.min(scrollLength - 1, index);
  2772. var node = void 0,
  2773. _scroll$leaf5 = _this5.scroll.leaf(index),
  2774. _scroll$leaf6 = _slicedToArray(_scroll$leaf5, 2),
  2775. leaf = _scroll$leaf6[0],
  2776. offset = _scroll$leaf6[1];
  2777. var _leaf$position5 = leaf.position(offset, i !== 0);
  2778. var _leaf$position6 = _slicedToArray(_leaf$position5, 2);
  2779. node = _leaf$position6[0];
  2780. offset = _leaf$position6[1];
  2781. args.push(node, offset);
  2782. });
  2783. if (args.length < 2) {
  2784. args = args.concat(args);
  2785. }
  2786. return args;
  2787. }
  2788. }, {
  2789. key: 'scrollIntoView',
  2790. value: function scrollIntoView(scrollingContainer) {
  2791. var range = this.lastRange;
  2792. if (range == null) return;
  2793. var bounds = this.getBounds(range.index, range.length);
  2794. if (bounds == null) return;
  2795. var limit = this.scroll.length() - 1;
  2796. var _scroll$line = this.scroll.line(Math.min(range.index, limit)),
  2797. _scroll$line2 = _slicedToArray(_scroll$line, 1),
  2798. first = _scroll$line2[0];
  2799. var last = first;
  2800. if (range.length > 0) {
  2801. var _scroll$line3 = this.scroll.line(Math.min(range.index + range.length, limit));
  2802. var _scroll$line4 = _slicedToArray(_scroll$line3, 1);
  2803. last = _scroll$line4[0];
  2804. }
  2805. if (first == null || last == null) return;
  2806. var scrollBounds = scrollingContainer.getBoundingClientRect();
  2807. if (bounds.top < scrollBounds.top) {
  2808. scrollingContainer.scrollTop -= scrollBounds.top - bounds.top;
  2809. } else if (bounds.bottom > scrollBounds.bottom) {
  2810. scrollingContainer.scrollTop += bounds.bottom - scrollBounds.bottom;
  2811. }
  2812. }
  2813. }, {
  2814. key: 'setNativeRange',
  2815. value: function setNativeRange(startNode, startOffset) {
  2816. var endNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode;
  2817. var endOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset;
  2818. var force = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  2819. debug.info('setNativeRange', startNode, startOffset, endNode, endOffset);
  2820. if (startNode != null && (this.root.parentNode == null || startNode.parentNode == null || endNode.parentNode == null)) {
  2821. return;
  2822. }
  2823. var selection = document.getSelection();
  2824. if (selection == null) return;
  2825. if (startNode != null) {
  2826. if (!this.hasFocus()) this.root.focus();
  2827. var native = (this.getNativeRange() || {}).native;
  2828. if (native == null || force || startNode !== native.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) {
  2829. if (startNode.tagName == "BR") {
  2830. startOffset = [].indexOf.call(startNode.parentNode.childNodes, startNode);
  2831. startNode = startNode.parentNode;
  2832. }
  2833. if (endNode.tagName == "BR") {
  2834. endOffset = [].indexOf.call(endNode.parentNode.childNodes, endNode);
  2835. endNode = endNode.parentNode;
  2836. }
  2837. var range = document.createRange();
  2838. range.setStart(startNode, startOffset);
  2839. range.setEnd(endNode, endOffset);
  2840. selection.removeAllRanges();
  2841. selection.addRange(range);
  2842. }
  2843. } else {
  2844. selection.removeAllRanges();
  2845. this.root.blur();
  2846. document.body.focus(); // root.blur() not enough on IE11+Travis+SauceLabs (but not local VMs)
  2847. }
  2848. }
  2849. }, {
  2850. key: 'setRange',
  2851. value: function setRange(range) {
  2852. var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2853. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
  2854. if (typeof force === 'string') {
  2855. source = force;
  2856. force = false;
  2857. }
  2858. debug.info('setRange', range);
  2859. if (range != null) {
  2860. var args = this.rangeToNative(range);
  2861. this.setNativeRange.apply(this, _toConsumableArray(args).concat([force]));
  2862. } else {
  2863. this.setNativeRange(null);
  2864. }
  2865. this.update(source);
  2866. }
  2867. }, {
  2868. key: 'update',
  2869. value: function update() {
  2870. var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
  2871. var oldRange = this.lastRange;
  2872. var _getRange = this.getRange(),
  2873. _getRange2 = _slicedToArray(_getRange, 2),
  2874. lastRange = _getRange2[0],
  2875. nativeRange = _getRange2[1];
  2876. this.lastRange = lastRange;
  2877. if (this.lastRange != null) {
  2878. this.savedRange = this.lastRange;
  2879. }
  2880. if (!(0, _deepEqual2.default)(oldRange, this.lastRange)) {
  2881. var _emitter;
  2882. if (!this.composing && nativeRange != null && nativeRange.native.collapsed && nativeRange.start.node !== this.cursor.textNode) {
  2883. this.cursor.restore();
  2884. }
  2885. var args = [_emitter4.default.events.SELECTION_CHANGE, (0, _clone2.default)(this.lastRange), (0, _clone2.default)(oldRange), source];
  2886. (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
  2887. if (source !== _emitter4.default.sources.SILENT) {
  2888. var _emitter2;
  2889. (_emitter2 = this.emitter).emit.apply(_emitter2, args);
  2890. }
  2891. }
  2892. }
  2893. }]);
  2894. return Selection;
  2895. }();
  2896. function contains(parent, descendant) {
  2897. try {
  2898. // Firefox inserts inaccessible nodes around video elements
  2899. descendant.parentNode;
  2900. } catch (e) {
  2901. return false;
  2902. }
  2903. // IE11 has bug with Text nodes
  2904. // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect
  2905. if (descendant instanceof Text) {
  2906. descendant = descendant.parentNode;
  2907. }
  2908. return parent.contains(descendant);
  2909. }
  2910. exports.Range = Range;
  2911. exports.default = Selection;
  2912. /***/ }),
  2913. /* 16 */
  2914. /***/ (function(module, exports, __webpack_require__) {
  2915. "use strict";
  2916. Object.defineProperty(exports, "__esModule", {
  2917. value: true
  2918. });
  2919. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2920. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  2921. var _parchment = __webpack_require__(0);
  2922. var _parchment2 = _interopRequireDefault(_parchment);
  2923. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2924. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2925. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2926. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2927. var Break = function (_Parchment$Embed) {
  2928. _inherits(Break, _Parchment$Embed);
  2929. function Break() {
  2930. _classCallCheck(this, Break);
  2931. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).apply(this, arguments));
  2932. }
  2933. _createClass(Break, [{
  2934. key: 'insertInto',
  2935. value: function insertInto(parent, ref) {
  2936. if (parent.children.length === 0) {
  2937. _get(Break.prototype.__proto__ || Object.getPrototypeOf(Break.prototype), 'insertInto', this).call(this, parent, ref);
  2938. } else {
  2939. this.remove();
  2940. }
  2941. }
  2942. }, {
  2943. key: 'length',
  2944. value: function length() {
  2945. return 0;
  2946. }
  2947. }, {
  2948. key: 'value',
  2949. value: function value() {
  2950. return '';
  2951. }
  2952. }], [{
  2953. key: 'value',
  2954. value: function value() {
  2955. return undefined;
  2956. }
  2957. }]);
  2958. return Break;
  2959. }(_parchment2.default.Embed);
  2960. Break.blotName = 'break';
  2961. Break.tagName = 'BR';
  2962. exports.default = Break;
  2963. /***/ }),
  2964. /* 17 */
  2965. /***/ (function(module, exports, __webpack_require__) {
  2966. "use strict";
  2967. var __extends = (this && this.__extends) || (function () {
  2968. var extendStatics = Object.setPrototypeOf ||
  2969. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  2970. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  2971. return function (d, b) {
  2972. extendStatics(d, b);
  2973. function __() { this.constructor = d; }
  2974. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2975. };
  2976. })();
  2977. Object.defineProperty(exports, "__esModule", { value: true });
  2978. var linked_list_1 = __webpack_require__(44);
  2979. var shadow_1 = __webpack_require__(30);
  2980. var Registry = __webpack_require__(1);
  2981. var ContainerBlot = /** @class */ (function (_super) {
  2982. __extends(ContainerBlot, _super);
  2983. function ContainerBlot(domNode) {
  2984. var _this = _super.call(this, domNode) || this;
  2985. _this.build();
  2986. return _this;
  2987. }
  2988. ContainerBlot.prototype.appendChild = function (other) {
  2989. this.insertBefore(other);
  2990. };
  2991. ContainerBlot.prototype.attach = function () {
  2992. _super.prototype.attach.call(this);
  2993. this.children.forEach(function (child) {
  2994. child.attach();
  2995. });
  2996. };
  2997. ContainerBlot.prototype.build = function () {
  2998. var _this = this;
  2999. this.children = new linked_list_1.default();
  3000. // Need to be reversed for if DOM nodes already in order
  3001. [].slice
  3002. .call(this.domNode.childNodes)
  3003. .reverse()
  3004. .forEach(function (node) {
  3005. try {
  3006. var child = makeBlot(node);
  3007. _this.insertBefore(child, _this.children.head || undefined);
  3008. }
  3009. catch (err) {
  3010. if (err instanceof Registry.ParchmentError)
  3011. return;
  3012. else
  3013. throw err;
  3014. }
  3015. });
  3016. };
  3017. ContainerBlot.prototype.deleteAt = function (index, length) {
  3018. if (index === 0 && length === this.length()) {
  3019. return this.remove();
  3020. }
  3021. this.children.forEachAt(index, length, function (child, offset, length) {
  3022. child.deleteAt(offset, length);
  3023. });
  3024. };
  3025. ContainerBlot.prototype.descendant = function (criteria, index) {
  3026. var _a = this.children.find(index), child = _a[0], offset = _a[1];
  3027. if ((criteria.blotName == null && criteria(child)) ||
  3028. (criteria.blotName != null && child instanceof criteria)) {
  3029. return [child, offset];
  3030. }
  3031. else if (child instanceof ContainerBlot) {
  3032. return child.descendant(criteria, offset);
  3033. }
  3034. else {
  3035. return [null, -1];
  3036. }
  3037. };
  3038. ContainerBlot.prototype.descendants = function (criteria, index, length) {
  3039. if (index === void 0) { index = 0; }
  3040. if (length === void 0) { length = Number.MAX_VALUE; }
  3041. var descendants = [];
  3042. var lengthLeft = length;
  3043. this.children.forEachAt(index, length, function (child, index, length) {
  3044. if ((criteria.blotName == null && criteria(child)) ||
  3045. (criteria.blotName != null && child instanceof criteria)) {
  3046. descendants.push(child);
  3047. }
  3048. if (child instanceof ContainerBlot) {
  3049. descendants = descendants.concat(child.descendants(criteria, index, lengthLeft));
  3050. }
  3051. lengthLeft -= length;
  3052. });
  3053. return descendants;
  3054. };
  3055. ContainerBlot.prototype.detach = function () {
  3056. this.children.forEach(function (child) {
  3057. child.detach();
  3058. });
  3059. _super.prototype.detach.call(this);
  3060. };
  3061. ContainerBlot.prototype.formatAt = function (index, length, name, value) {
  3062. this.children.forEachAt(index, length, function (child, offset, length) {
  3063. child.formatAt(offset, length, name, value);
  3064. });
  3065. };
  3066. ContainerBlot.prototype.insertAt = function (index, value, def) {
  3067. var _a = this.children.find(index), child = _a[0], offset = _a[1];
  3068. if (child) {
  3069. child.insertAt(offset, value, def);
  3070. }
  3071. else {
  3072. var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);
  3073. this.appendChild(blot);
  3074. }
  3075. };
  3076. ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) {
  3077. if (this.statics.allowedChildren != null &&
  3078. !this.statics.allowedChildren.some(function (child) {
  3079. return childBlot instanceof child;
  3080. })) {
  3081. throw new Registry.ParchmentError("Cannot insert " + childBlot.statics.blotName + " into " + this.statics.blotName);
  3082. }
  3083. childBlot.insertInto(this, refBlot);
  3084. };
  3085. ContainerBlot.prototype.length = function () {
  3086. return this.children.reduce(function (memo, child) {
  3087. return memo + child.length();
  3088. }, 0);
  3089. };
  3090. ContainerBlot.prototype.moveChildren = function (targetParent, refNode) {
  3091. this.children.forEach(function (child) {
  3092. targetParent.insertBefore(child, refNode);
  3093. });
  3094. };
  3095. ContainerBlot.prototype.optimize = function (context) {
  3096. _super.prototype.optimize.call(this, context);
  3097. if (this.children.length === 0) {
  3098. if (this.statics.defaultChild != null) {
  3099. var child = Registry.create(this.statics.defaultChild);
  3100. this.appendChild(child);
  3101. child.optimize(context);
  3102. }
  3103. else {
  3104. this.remove();
  3105. }
  3106. }
  3107. };
  3108. ContainerBlot.prototype.path = function (index, inclusive) {
  3109. if (inclusive === void 0) { inclusive = false; }
  3110. var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1];
  3111. var position = [[this, index]];
  3112. if (child instanceof ContainerBlot) {
  3113. return position.concat(child.path(offset, inclusive));
  3114. }
  3115. else if (child != null) {
  3116. position.push([child, offset]);
  3117. }
  3118. return position;
  3119. };
  3120. ContainerBlot.prototype.removeChild = function (child) {
  3121. this.children.remove(child);
  3122. };
  3123. ContainerBlot.prototype.replace = function (target) {
  3124. if (target instanceof ContainerBlot) {
  3125. target.moveChildren(this);
  3126. }
  3127. _super.prototype.replace.call(this, target);
  3128. };
  3129. ContainerBlot.prototype.split = function (index, force) {
  3130. if (force === void 0) { force = false; }
  3131. if (!force) {
  3132. if (index === 0)
  3133. return this;
  3134. if (index === this.length())
  3135. return this.next;
  3136. }
  3137. var after = this.clone();
  3138. this.parent.insertBefore(after, this.next);
  3139. this.children.forEachAt(index, this.length(), function (child, offset, length) {
  3140. child = child.split(offset, force);
  3141. after.appendChild(child);
  3142. });
  3143. return after;
  3144. };
  3145. ContainerBlot.prototype.unwrap = function () {
  3146. this.moveChildren(this.parent, this.next);
  3147. this.remove();
  3148. };
  3149. ContainerBlot.prototype.update = function (mutations, context) {
  3150. var _this = this;
  3151. var addedNodes = [];
  3152. var removedNodes = [];
  3153. mutations.forEach(function (mutation) {
  3154. if (mutation.target === _this.domNode && mutation.type === 'childList') {
  3155. addedNodes.push.apply(addedNodes, mutation.addedNodes);
  3156. removedNodes.push.apply(removedNodes, mutation.removedNodes);
  3157. }
  3158. });
  3159. removedNodes.forEach(function (node) {
  3160. // Check node has actually been removed
  3161. // One exception is Chrome does not immediately remove IFRAMEs
  3162. // from DOM but MutationRecord is correct in its reported removal
  3163. if (node.parentNode != null &&
  3164. // @ts-ignore
  3165. node.tagName !== 'IFRAME' &&
  3166. document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
  3167. return;
  3168. }
  3169. var blot = Registry.find(node);
  3170. if (blot == null)
  3171. return;
  3172. if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) {
  3173. blot.detach();
  3174. }
  3175. });
  3176. addedNodes
  3177. .filter(function (node) {
  3178. return node.parentNode == _this.domNode;
  3179. })
  3180. .sort(function (a, b) {
  3181. if (a === b)
  3182. return 0;
  3183. if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) {
  3184. return 1;
  3185. }
  3186. return -1;
  3187. })
  3188. .forEach(function (node) {
  3189. var refBlot = null;
  3190. if (node.nextSibling != null) {
  3191. refBlot = Registry.find(node.nextSibling);
  3192. }
  3193. var blot = makeBlot(node);
  3194. if (blot.next != refBlot || blot.next == null) {
  3195. if (blot.parent != null) {
  3196. blot.parent.removeChild(_this);
  3197. }
  3198. _this.insertBefore(blot, refBlot || undefined);
  3199. }
  3200. });
  3201. };
  3202. return ContainerBlot;
  3203. }(shadow_1.default));
  3204. function makeBlot(node) {
  3205. var blot = Registry.find(node);
  3206. if (blot == null) {
  3207. try {
  3208. blot = Registry.create(node);
  3209. }
  3210. catch (e) {
  3211. blot = Registry.create(Registry.Scope.INLINE);
  3212. [].slice.call(node.childNodes).forEach(function (child) {
  3213. // @ts-ignore
  3214. blot.domNode.appendChild(child);
  3215. });
  3216. if (node.parentNode) {
  3217. node.parentNode.replaceChild(blot.domNode, node);
  3218. }
  3219. blot.attach();
  3220. }
  3221. }
  3222. return blot;
  3223. }
  3224. exports.default = ContainerBlot;
  3225. /***/ }),
  3226. /* 18 */
  3227. /***/ (function(module, exports, __webpack_require__) {
  3228. "use strict";
  3229. var __extends = (this && this.__extends) || (function () {
  3230. var extendStatics = Object.setPrototypeOf ||
  3231. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3232. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  3233. return function (d, b) {
  3234. extendStatics(d, b);
  3235. function __() { this.constructor = d; }
  3236. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3237. };
  3238. })();
  3239. Object.defineProperty(exports, "__esModule", { value: true });
  3240. var attributor_1 = __webpack_require__(12);
  3241. var store_1 = __webpack_require__(31);
  3242. var container_1 = __webpack_require__(17);
  3243. var Registry = __webpack_require__(1);
  3244. var FormatBlot = /** @class */ (function (_super) {
  3245. __extends(FormatBlot, _super);
  3246. function FormatBlot(domNode) {
  3247. var _this = _super.call(this, domNode) || this;
  3248. _this.attributes = new store_1.default(_this.domNode);
  3249. return _this;
  3250. }
  3251. FormatBlot.formats = function (domNode) {
  3252. if (typeof this.tagName === 'string') {
  3253. return true;
  3254. }
  3255. else if (Array.isArray(this.tagName)) {
  3256. return domNode.tagName.toLowerCase();
  3257. }
  3258. return undefined;
  3259. };
  3260. FormatBlot.prototype.format = function (name, value) {
  3261. var format = Registry.query(name);
  3262. if (format instanceof attributor_1.default) {
  3263. this.attributes.attribute(format, value);
  3264. }
  3265. else if (value) {
  3266. if (format != null && (name !== this.statics.blotName || this.formats()[name] !== value)) {
  3267. this.replaceWith(name, value);
  3268. }
  3269. }
  3270. };
  3271. FormatBlot.prototype.formats = function () {
  3272. var formats = this.attributes.values();
  3273. var format = this.statics.formats(this.domNode);
  3274. if (format != null) {
  3275. formats[this.statics.blotName] = format;
  3276. }
  3277. return formats;
  3278. };
  3279. FormatBlot.prototype.replaceWith = function (name, value) {
  3280. var replacement = _super.prototype.replaceWith.call(this, name, value);
  3281. this.attributes.copy(replacement);
  3282. return replacement;
  3283. };
  3284. FormatBlot.prototype.update = function (mutations, context) {
  3285. var _this = this;
  3286. _super.prototype.update.call(this, mutations, context);
  3287. if (mutations.some(function (mutation) {
  3288. return mutation.target === _this.domNode && mutation.type === 'attributes';
  3289. })) {
  3290. this.attributes.build();
  3291. }
  3292. };
  3293. FormatBlot.prototype.wrap = function (name, value) {
  3294. var wrapper = _super.prototype.wrap.call(this, name, value);
  3295. if (wrapper instanceof FormatBlot && wrapper.statics.scope === this.statics.scope) {
  3296. this.attributes.move(wrapper);
  3297. }
  3298. return wrapper;
  3299. };
  3300. return FormatBlot;
  3301. }(container_1.default));
  3302. exports.default = FormatBlot;
  3303. /***/ }),
  3304. /* 19 */
  3305. /***/ (function(module, exports, __webpack_require__) {
  3306. "use strict";
  3307. var __extends = (this && this.__extends) || (function () {
  3308. var extendStatics = Object.setPrototypeOf ||
  3309. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3310. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  3311. return function (d, b) {
  3312. extendStatics(d, b);
  3313. function __() { this.constructor = d; }
  3314. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3315. };
  3316. })();
  3317. Object.defineProperty(exports, "__esModule", { value: true });
  3318. var shadow_1 = __webpack_require__(30);
  3319. var Registry = __webpack_require__(1);
  3320. var LeafBlot = /** @class */ (function (_super) {
  3321. __extends(LeafBlot, _super);
  3322. function LeafBlot() {
  3323. return _super !== null && _super.apply(this, arguments) || this;
  3324. }
  3325. LeafBlot.value = function (domNode) {
  3326. return true;
  3327. };
  3328. LeafBlot.prototype.index = function (node, offset) {
  3329. if (this.domNode === node ||
  3330. this.domNode.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
  3331. return Math.min(offset, 1);
  3332. }
  3333. return -1;
  3334. };
  3335. LeafBlot.prototype.position = function (index, inclusive) {
  3336. var offset = [].indexOf.call(this.parent.domNode.childNodes, this.domNode);
  3337. if (index > 0)
  3338. offset += 1;
  3339. return [this.parent.domNode, offset];
  3340. };
  3341. LeafBlot.prototype.value = function () {
  3342. var _a;
  3343. return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
  3344. };
  3345. LeafBlot.scope = Registry.Scope.INLINE_BLOT;
  3346. return LeafBlot;
  3347. }(shadow_1.default));
  3348. exports.default = LeafBlot;
  3349. /***/ }),
  3350. /* 20 */
  3351. /***/ (function(module, exports, __webpack_require__) {
  3352. var equal = __webpack_require__(11);
  3353. var extend = __webpack_require__(3);
  3354. var lib = {
  3355. attributes: {
  3356. compose: function (a, b, keepNull) {
  3357. if (typeof a !== 'object') a = {};
  3358. if (typeof b !== 'object') b = {};
  3359. var attributes = extend(true, {}, b);
  3360. if (!keepNull) {
  3361. attributes = Object.keys(attributes).reduce(function (copy, key) {
  3362. if (attributes[key] != null) {
  3363. copy[key] = attributes[key];
  3364. }
  3365. return copy;
  3366. }, {});
  3367. }
  3368. for (var key in a) {
  3369. if (a[key] !== undefined && b[key] === undefined) {
  3370. attributes[key] = a[key];
  3371. }
  3372. }
  3373. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3374. },
  3375. diff: function(a, b) {
  3376. if (typeof a !== 'object') a = {};
  3377. if (typeof b !== 'object') b = {};
  3378. var attributes = Object.keys(a).concat(Object.keys(b)).reduce(function (attributes, key) {
  3379. if (!equal(a[key], b[key])) {
  3380. attributes[key] = b[key] === undefined ? null : b[key];
  3381. }
  3382. return attributes;
  3383. }, {});
  3384. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3385. },
  3386. transform: function (a, b, priority) {
  3387. if (typeof a !== 'object') return b;
  3388. if (typeof b !== 'object') return undefined;
  3389. if (!priority) return b; // b simply overwrites us without priority
  3390. var attributes = Object.keys(b).reduce(function (attributes, key) {
  3391. if (a[key] === undefined) attributes[key] = b[key]; // null is a valid value
  3392. return attributes;
  3393. }, {});
  3394. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3395. }
  3396. },
  3397. iterator: function (ops) {
  3398. return new Iterator(ops);
  3399. },
  3400. length: function (op) {
  3401. if (typeof op['delete'] === 'number') {
  3402. return op['delete'];
  3403. } else if (typeof op.retain === 'number') {
  3404. return op.retain;
  3405. } else {
  3406. return typeof op.insert === 'string' ? op.insert.length : 1;
  3407. }
  3408. }
  3409. };
  3410. function Iterator(ops) {
  3411. this.ops = ops;
  3412. this.index = 0;
  3413. this.offset = 0;
  3414. };
  3415. Iterator.prototype.hasNext = function () {
  3416. return this.peekLength() < Infinity;
  3417. };
  3418. Iterator.prototype.next = function (length) {
  3419. if (!length) length = Infinity;
  3420. var nextOp = this.ops[this.index];
  3421. if (nextOp) {
  3422. var offset = this.offset;
  3423. var opLength = lib.length(nextOp)
  3424. if (length >= opLength - offset) {
  3425. length = opLength - offset;
  3426. this.index += 1;
  3427. this.offset = 0;
  3428. } else {
  3429. this.offset += length;
  3430. }
  3431. if (typeof nextOp['delete'] === 'number') {
  3432. return { 'delete': length };
  3433. } else {
  3434. var retOp = {};
  3435. if (nextOp.attributes) {
  3436. retOp.attributes = nextOp.attributes;
  3437. }
  3438. if (typeof nextOp.retain === 'number') {
  3439. retOp.retain = length;
  3440. } else if (typeof nextOp.insert === 'string') {
  3441. retOp.insert = nextOp.insert.substr(offset, length);
  3442. } else {
  3443. // offset should === 0, length should === 1
  3444. retOp.insert = nextOp.insert;
  3445. }
  3446. return retOp;
  3447. }
  3448. } else {
  3449. return { retain: Infinity };
  3450. }
  3451. };
  3452. Iterator.prototype.peek = function () {
  3453. return this.ops[this.index];
  3454. };
  3455. Iterator.prototype.peekLength = function () {
  3456. if (this.ops[this.index]) {
  3457. // Should never return 0 if our index is being managed correctly
  3458. return lib.length(this.ops[this.index]) - this.offset;
  3459. } else {
  3460. return Infinity;
  3461. }
  3462. };
  3463. Iterator.prototype.peekType = function () {
  3464. if (this.ops[this.index]) {
  3465. if (typeof this.ops[this.index]['delete'] === 'number') {
  3466. return 'delete';
  3467. } else if (typeof this.ops[this.index].retain === 'number') {
  3468. return 'retain';
  3469. } else {
  3470. return 'insert';
  3471. }
  3472. }
  3473. return 'retain';
  3474. };
  3475. Iterator.prototype.rest = function () {
  3476. if (!this.hasNext()) {
  3477. return [];
  3478. } else if (this.offset === 0) {
  3479. return this.ops.slice(this.index);
  3480. } else {
  3481. var offset = this.offset;
  3482. var index = this.index;
  3483. var next = this.next();
  3484. var rest = this.ops.slice(this.index);
  3485. this.offset = offset;
  3486. this.index = index;
  3487. return [next].concat(rest);
  3488. }
  3489. };
  3490. module.exports = lib;
  3491. /***/ }),
  3492. /* 21 */
  3493. /***/ (function(module, exports) {
  3494. var clone = (function() {
  3495. 'use strict';
  3496. function _instanceof(obj, type) {
  3497. return type != null && obj instanceof type;
  3498. }
  3499. var nativeMap;
  3500. try {
  3501. nativeMap = Map;
  3502. } catch(_) {
  3503. // maybe a reference error because no `Map`. Give it a dummy value that no
  3504. // value will ever be an instanceof.
  3505. nativeMap = function() {};
  3506. }
  3507. var nativeSet;
  3508. try {
  3509. nativeSet = Set;
  3510. } catch(_) {
  3511. nativeSet = function() {};
  3512. }
  3513. var nativePromise;
  3514. try {
  3515. nativePromise = Promise;
  3516. } catch(_) {
  3517. nativePromise = function() {};
  3518. }
  3519. /**
  3520. * Clones (copies) an Object using deep copying.
  3521. *
  3522. * This function supports circular references by default, but if you are certain
  3523. * there are no circular references in your object, you can save some CPU time
  3524. * by calling clone(obj, false).
  3525. *
  3526. * Caution: if `circular` is false and `parent` contains circular references,
  3527. * your program may enter an infinite loop and crash.
  3528. *
  3529. * @param `parent` - the object to be cloned
  3530. * @param `circular` - set to true if the object to be cloned may contain
  3531. * circular references. (optional - true by default)
  3532. * @param `depth` - set to a number if the object is only to be cloned to
  3533. * a particular depth. (optional - defaults to Infinity)
  3534. * @param `prototype` - sets the prototype to be used when cloning an object.
  3535. * (optional - defaults to parent prototype).
  3536. * @param `includeNonEnumerable` - set to true if the non-enumerable properties
  3537. * should be cloned as well. Non-enumerable properties on the prototype
  3538. * chain will be ignored. (optional - false by default)
  3539. */
  3540. function clone(parent, circular, depth, prototype, includeNonEnumerable) {
  3541. if (typeof circular === 'object') {
  3542. depth = circular.depth;
  3543. prototype = circular.prototype;
  3544. includeNonEnumerable = circular.includeNonEnumerable;
  3545. circular = circular.circular;
  3546. }
  3547. // maintain two arrays for circular references, where corresponding parents
  3548. // and children have the same index
  3549. var allParents = [];
  3550. var allChildren = [];
  3551. var useBuffer = typeof Buffer != 'undefined';
  3552. if (typeof circular == 'undefined')
  3553. circular = true;
  3554. if (typeof depth == 'undefined')
  3555. depth = Infinity;
  3556. // recurse this function so we don't reset allParents and allChildren
  3557. function _clone(parent, depth) {
  3558. // cloning null always returns null
  3559. if (parent === null)
  3560. return null;
  3561. if (depth === 0)
  3562. return parent;
  3563. var child;
  3564. var proto;
  3565. if (typeof parent != 'object') {
  3566. return parent;
  3567. }
  3568. if (_instanceof(parent, nativeMap)) {
  3569. child = new nativeMap();
  3570. } else if (_instanceof(parent, nativeSet)) {
  3571. child = new nativeSet();
  3572. } else if (_instanceof(parent, nativePromise)) {
  3573. child = new nativePromise(function (resolve, reject) {
  3574. parent.then(function(value) {
  3575. resolve(_clone(value, depth - 1));
  3576. }, function(err) {
  3577. reject(_clone(err, depth - 1));
  3578. });
  3579. });
  3580. } else if (clone.__isArray(parent)) {
  3581. child = [];
  3582. } else if (clone.__isRegExp(parent)) {
  3583. child = new RegExp(parent.source, __getRegExpFlags(parent));
  3584. if (parent.lastIndex) child.lastIndex = parent.lastIndex;
  3585. } else if (clone.__isDate(parent)) {
  3586. child = new Date(parent.getTime());
  3587. } else if (useBuffer && Buffer.isBuffer(parent)) {
  3588. if (Buffer.allocUnsafe) {
  3589. // Node.js >= 4.5.0
  3590. child = Buffer.allocUnsafe(parent.length);
  3591. } else {
  3592. // Older Node.js versions
  3593. child = new Buffer(parent.length);
  3594. }
  3595. parent.copy(child);
  3596. return child;
  3597. } else if (_instanceof(parent, Error)) {
  3598. child = Object.create(parent);
  3599. } else {
  3600. if (typeof prototype == 'undefined') {
  3601. proto = Object.getPrototypeOf(parent);
  3602. child = Object.create(proto);
  3603. }
  3604. else {
  3605. child = Object.create(prototype);
  3606. proto = prototype;
  3607. }
  3608. }
  3609. if (circular) {
  3610. var index = allParents.indexOf(parent);
  3611. if (index != -1) {
  3612. return allChildren[index];
  3613. }
  3614. allParents.push(parent);
  3615. allChildren.push(child);
  3616. }
  3617. if (_instanceof(parent, nativeMap)) {
  3618. parent.forEach(function(value, key) {
  3619. var keyChild = _clone(key, depth - 1);
  3620. var valueChild = _clone(value, depth - 1);
  3621. child.set(keyChild, valueChild);
  3622. });
  3623. }
  3624. if (_instanceof(parent, nativeSet)) {
  3625. parent.forEach(function(value) {
  3626. var entryChild = _clone(value, depth - 1);
  3627. child.add(entryChild);
  3628. });
  3629. }
  3630. for (var i in parent) {
  3631. var attrs;
  3632. if (proto) {
  3633. attrs = Object.getOwnPropertyDescriptor(proto, i);
  3634. }
  3635. if (attrs && attrs.set == null) {
  3636. continue;
  3637. }
  3638. child[i] = _clone(parent[i], depth - 1);
  3639. }
  3640. if (Object.getOwnPropertySymbols) {
  3641. var symbols = Object.getOwnPropertySymbols(parent);
  3642. for (var i = 0; i < symbols.length; i++) {
  3643. // Don't need to worry about cloning a symbol because it is a primitive,
  3644. // like a number or string.
  3645. var symbol = symbols[i];
  3646. var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
  3647. if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
  3648. continue;
  3649. }
  3650. child[symbol] = _clone(parent[symbol], depth - 1);
  3651. if (!descriptor.enumerable) {
  3652. Object.defineProperty(child, symbol, {
  3653. enumerable: false
  3654. });
  3655. }
  3656. }
  3657. }
  3658. if (includeNonEnumerable) {
  3659. var allPropertyNames = Object.getOwnPropertyNames(parent);
  3660. for (var i = 0; i < allPropertyNames.length; i++) {
  3661. var propertyName = allPropertyNames[i];
  3662. var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);
  3663. if (descriptor && descriptor.enumerable) {
  3664. continue;
  3665. }
  3666. child[propertyName] = _clone(parent[propertyName], depth - 1);
  3667. Object.defineProperty(child, propertyName, {
  3668. enumerable: false
  3669. });
  3670. }
  3671. }
  3672. return child;
  3673. }
  3674. return _clone(parent, depth);
  3675. }
  3676. /**
  3677. * Simple flat clone using prototype, accepts only objects, usefull for property
  3678. * override on FLAT configuration object (no nested props).
  3679. *
  3680. * USE WITH CAUTION! This may not behave as you wish if you do not know how this
  3681. * works.
  3682. */
  3683. clone.clonePrototype = function clonePrototype(parent) {
  3684. if (parent === null)
  3685. return null;
  3686. var c = function () {};
  3687. c.prototype = parent;
  3688. return new c();
  3689. };
  3690. // private utility functions
  3691. function __objToStr(o) {
  3692. return Object.prototype.toString.call(o);
  3693. }
  3694. clone.__objToStr = __objToStr;
  3695. function __isDate(o) {
  3696. return typeof o === 'object' && __objToStr(o) === '[object Date]';
  3697. }
  3698. clone.__isDate = __isDate;
  3699. function __isArray(o) {
  3700. return typeof o === 'object' && __objToStr(o) === '[object Array]';
  3701. }
  3702. clone.__isArray = __isArray;
  3703. function __isRegExp(o) {
  3704. return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
  3705. }
  3706. clone.__isRegExp = __isRegExp;
  3707. function __getRegExpFlags(re) {
  3708. var flags = '';
  3709. if (re.global) flags += 'g';
  3710. if (re.ignoreCase) flags += 'i';
  3711. if (re.multiline) flags += 'm';
  3712. return flags;
  3713. }
  3714. clone.__getRegExpFlags = __getRegExpFlags;
  3715. return clone;
  3716. })();
  3717. if (typeof module === 'object' && module.exports) {
  3718. module.exports = clone;
  3719. }
  3720. /***/ }),
  3721. /* 22 */
  3722. /***/ (function(module, exports, __webpack_require__) {
  3723. "use strict";
  3724. Object.defineProperty(exports, "__esModule", {
  3725. value: true
  3726. });
  3727. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  3728. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3729. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  3730. var _parchment = __webpack_require__(0);
  3731. var _parchment2 = _interopRequireDefault(_parchment);
  3732. var _emitter = __webpack_require__(8);
  3733. var _emitter2 = _interopRequireDefault(_emitter);
  3734. var _block = __webpack_require__(4);
  3735. var _block2 = _interopRequireDefault(_block);
  3736. var _break = __webpack_require__(16);
  3737. var _break2 = _interopRequireDefault(_break);
  3738. var _code = __webpack_require__(13);
  3739. var _code2 = _interopRequireDefault(_code);
  3740. var _container = __webpack_require__(25);
  3741. var _container2 = _interopRequireDefault(_container);
  3742. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3743. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3744. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3745. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3746. function isLine(blot) {
  3747. return blot instanceof _block2.default || blot instanceof _block.BlockEmbed;
  3748. }
  3749. var Scroll = function (_Parchment$Scroll) {
  3750. _inherits(Scroll, _Parchment$Scroll);
  3751. function Scroll(domNode, config) {
  3752. _classCallCheck(this, Scroll);
  3753. var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, domNode));
  3754. _this.emitter = config.emitter;
  3755. if (Array.isArray(config.whitelist)) {
  3756. _this.whitelist = config.whitelist.reduce(function (whitelist, format) {
  3757. whitelist[format] = true;
  3758. return whitelist;
  3759. }, {});
  3760. }
  3761. // Some reason fixes composition issues with character languages in Windows/Chrome, Safari
  3762. _this.domNode.addEventListener('DOMNodeInserted', function () {});
  3763. _this.optimize();
  3764. _this.enable();
  3765. return _this;
  3766. }
  3767. _createClass(Scroll, [{
  3768. key: 'batchStart',
  3769. value: function batchStart() {
  3770. this.batch = true;
  3771. }
  3772. }, {
  3773. key: 'batchEnd',
  3774. value: function batchEnd() {
  3775. this.batch = false;
  3776. this.optimize();
  3777. }
  3778. }, {
  3779. key: 'deleteAt',
  3780. value: function deleteAt(index, length) {
  3781. var _line = this.line(index),
  3782. _line2 = _slicedToArray(_line, 2),
  3783. first = _line2[0],
  3784. offset = _line2[1];
  3785. var _line3 = this.line(index + length),
  3786. _line4 = _slicedToArray(_line3, 1),
  3787. last = _line4[0];
  3788. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'deleteAt', this).call(this, index, length);
  3789. if (last != null && first !== last && offset > 0) {
  3790. if (first instanceof _block.BlockEmbed || last instanceof _block.BlockEmbed) {
  3791. this.optimize();
  3792. return;
  3793. }
  3794. if (first instanceof _code2.default) {
  3795. var newlineIndex = first.newlineIndex(first.length(), true);
  3796. if (newlineIndex > -1) {
  3797. first = first.split(newlineIndex + 1);
  3798. if (first === last) {
  3799. this.optimize();
  3800. return;
  3801. }
  3802. }
  3803. } else if (last instanceof _code2.default) {
  3804. var _newlineIndex = last.newlineIndex(0);
  3805. if (_newlineIndex > -1) {
  3806. last.split(_newlineIndex + 1);
  3807. }
  3808. }
  3809. var ref = last.children.head instanceof _break2.default ? null : last.children.head;
  3810. first.moveChildren(last, ref);
  3811. first.remove();
  3812. }
  3813. this.optimize();
  3814. }
  3815. }, {
  3816. key: 'enable',
  3817. value: function enable() {
  3818. var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  3819. this.domNode.setAttribute('contenteditable', enabled);
  3820. }
  3821. }, {
  3822. key: 'formatAt',
  3823. value: function formatAt(index, length, format, value) {
  3824. if (this.whitelist != null && !this.whitelist[format]) return;
  3825. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'formatAt', this).call(this, index, length, format, value);
  3826. this.optimize();
  3827. }
  3828. }, {
  3829. key: 'insertAt',
  3830. value: function insertAt(index, value, def) {
  3831. if (def != null && this.whitelist != null && !this.whitelist[value]) return;
  3832. if (index >= this.length()) {
  3833. if (def == null || _parchment2.default.query(value, _parchment2.default.Scope.BLOCK) == null) {
  3834. var blot = _parchment2.default.create(this.statics.defaultChild);
  3835. this.appendChild(blot);
  3836. if (def == null && value.endsWith('\n')) {
  3837. value = value.slice(0, -1);
  3838. }
  3839. blot.insertAt(0, value, def);
  3840. } else {
  3841. var embed = _parchment2.default.create(value, def);
  3842. this.appendChild(embed);
  3843. }
  3844. } else {
  3845. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertAt', this).call(this, index, value, def);
  3846. }
  3847. this.optimize();
  3848. }
  3849. }, {
  3850. key: 'insertBefore',
  3851. value: function insertBefore(blot, ref) {
  3852. if (blot.statics.scope === _parchment2.default.Scope.INLINE_BLOT) {
  3853. var wrapper = _parchment2.default.create(this.statics.defaultChild);
  3854. wrapper.appendChild(blot);
  3855. blot = wrapper;
  3856. }
  3857. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertBefore', this).call(this, blot, ref);
  3858. }
  3859. }, {
  3860. key: 'leaf',
  3861. value: function leaf(index) {
  3862. return this.path(index).pop() || [null, -1];
  3863. }
  3864. }, {
  3865. key: 'line',
  3866. value: function line(index) {
  3867. if (index === this.length()) {
  3868. return this.line(index - 1);
  3869. }
  3870. return this.descendant(isLine, index);
  3871. }
  3872. }, {
  3873. key: 'lines',
  3874. value: function lines() {
  3875. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  3876. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
  3877. var getLines = function getLines(blot, index, length) {
  3878. var lines = [],
  3879. lengthLeft = length;
  3880. blot.children.forEachAt(index, length, function (child, index, length) {
  3881. if (isLine(child)) {
  3882. lines.push(child);
  3883. } else if (child instanceof _parchment2.default.Container) {
  3884. lines = lines.concat(getLines(child, index, lengthLeft));
  3885. }
  3886. lengthLeft -= length;
  3887. });
  3888. return lines;
  3889. };
  3890. return getLines(this, index, length);
  3891. }
  3892. }, {
  3893. key: 'optimize',
  3894. value: function optimize() {
  3895. var mutations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  3896. var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3897. if (this.batch === true) return;
  3898. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'optimize', this).call(this, mutations, context);
  3899. if (mutations.length > 0) {
  3900. this.emitter.emit(_emitter2.default.events.SCROLL_OPTIMIZE, mutations, context);
  3901. }
  3902. }
  3903. }, {
  3904. key: 'path',
  3905. value: function path(index) {
  3906. return _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'path', this).call(this, index).slice(1); // Exclude self
  3907. }
  3908. }, {
  3909. key: 'update',
  3910. value: function update(mutations) {
  3911. if (this.batch === true) return;
  3912. var source = _emitter2.default.sources.USER;
  3913. if (typeof mutations === 'string') {
  3914. source = mutations;
  3915. }
  3916. if (!Array.isArray(mutations)) {
  3917. mutations = this.observer.takeRecords();
  3918. }
  3919. if (mutations.length > 0) {
  3920. this.emitter.emit(_emitter2.default.events.SCROLL_BEFORE_UPDATE, source, mutations);
  3921. }
  3922. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'update', this).call(this, mutations.concat([])); // pass copy
  3923. if (mutations.length > 0) {
  3924. this.emitter.emit(_emitter2.default.events.SCROLL_UPDATE, source, mutations);
  3925. }
  3926. }
  3927. }]);
  3928. return Scroll;
  3929. }(_parchment2.default.Scroll);
  3930. Scroll.blotName = 'scroll';
  3931. Scroll.className = 'ql-editor';
  3932. Scroll.tagName = 'DIV';
  3933. Scroll.defaultChild = 'block';
  3934. Scroll.allowedChildren = [_block2.default, _block.BlockEmbed, _container2.default];
  3935. exports.default = Scroll;
  3936. /***/ }),
  3937. /* 23 */
  3938. /***/ (function(module, exports, __webpack_require__) {
  3939. "use strict";
  3940. Object.defineProperty(exports, "__esModule", {
  3941. value: true
  3942. });
  3943. exports.SHORTKEY = exports.default = undefined;
  3944. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  3945. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  3946. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3947. var _clone = __webpack_require__(21);
  3948. var _clone2 = _interopRequireDefault(_clone);
  3949. var _deepEqual = __webpack_require__(11);
  3950. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  3951. var _extend = __webpack_require__(3);
  3952. var _extend2 = _interopRequireDefault(_extend);
  3953. var _quillDelta = __webpack_require__(2);
  3954. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  3955. var _op = __webpack_require__(20);
  3956. var _op2 = _interopRequireDefault(_op);
  3957. var _parchment = __webpack_require__(0);
  3958. var _parchment2 = _interopRequireDefault(_parchment);
  3959. var _quill = __webpack_require__(5);
  3960. var _quill2 = _interopRequireDefault(_quill);
  3961. var _logger = __webpack_require__(10);
  3962. var _logger2 = _interopRequireDefault(_logger);
  3963. var _module = __webpack_require__(9);
  3964. var _module2 = _interopRequireDefault(_module);
  3965. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3966. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  3967. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3968. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3969. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3970. var debug = (0, _logger2.default)('quill:keyboard');
  3971. var SHORTKEY = /Mac/i.test(navigator.platform) ? 'metaKey' : 'ctrlKey';
  3972. var Keyboard = function (_Module) {
  3973. _inherits(Keyboard, _Module);
  3974. _createClass(Keyboard, null, [{
  3975. key: 'match',
  3976. value: function match(evt, binding) {
  3977. binding = normalize(binding);
  3978. if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function (key) {
  3979. return !!binding[key] !== evt[key] && binding[key] !== null;
  3980. })) {
  3981. return false;
  3982. }
  3983. return binding.key === (evt.which || evt.keyCode);
  3984. }
  3985. }]);
  3986. function Keyboard(quill, options) {
  3987. _classCallCheck(this, Keyboard);
  3988. var _this = _possibleConstructorReturn(this, (Keyboard.__proto__ || Object.getPrototypeOf(Keyboard)).call(this, quill, options));
  3989. _this.bindings = {};
  3990. Object.keys(_this.options.bindings).forEach(function (name) {
  3991. if (name === 'list autofill' && quill.scroll.whitelist != null && !quill.scroll.whitelist['list']) {
  3992. return;
  3993. }
  3994. if (_this.options.bindings[name]) {
  3995. _this.addBinding(_this.options.bindings[name]);
  3996. }
  3997. });
  3998. _this.addBinding({ key: Keyboard.keys.ENTER, shiftKey: null }, handleEnter);
  3999. _this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function () {});
  4000. if (/Firefox/i.test(navigator.userAgent)) {
  4001. // Need to handle delete and backspace for Firefox in the general case #1171
  4002. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace);
  4003. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true }, handleDelete);
  4004. } else {
  4005. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace);
  4006. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^.?$/ }, handleDelete);
  4007. }
  4008. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange);
  4009. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange);
  4010. _this.addBinding({ key: Keyboard.keys.BACKSPACE, altKey: null, ctrlKey: null, metaKey: null, shiftKey: null }, { collapsed: true, offset: 0 }, handleBackspace);
  4011. _this.listen();
  4012. return _this;
  4013. }
  4014. _createClass(Keyboard, [{
  4015. key: 'addBinding',
  4016. value: function addBinding(key) {
  4017. var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4018. var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4019. var binding = normalize(key);
  4020. if (binding == null || binding.key == null) {
  4021. return debug.warn('Attempted to add invalid keyboard binding', binding);
  4022. }
  4023. if (typeof context === 'function') {
  4024. context = { handler: context };
  4025. }
  4026. if (typeof handler === 'function') {
  4027. handler = { handler: handler };
  4028. }
  4029. binding = (0, _extend2.default)(binding, context, handler);
  4030. this.bindings[binding.key] = this.bindings[binding.key] || [];
  4031. this.bindings[binding.key].push(binding);
  4032. }
  4033. }, {
  4034. key: 'listen',
  4035. value: function listen() {
  4036. var _this2 = this;
  4037. this.quill.root.addEventListener('keydown', function (evt) {
  4038. if (evt.defaultPrevented) return;
  4039. var which = evt.which || evt.keyCode;
  4040. var bindings = (_this2.bindings[which] || []).filter(function (binding) {
  4041. return Keyboard.match(evt, binding);
  4042. });
  4043. if (bindings.length === 0) return;
  4044. var range = _this2.quill.getSelection();
  4045. if (range == null || !_this2.quill.hasFocus()) return;
  4046. var _quill$getLine = _this2.quill.getLine(range.index),
  4047. _quill$getLine2 = _slicedToArray(_quill$getLine, 2),
  4048. line = _quill$getLine2[0],
  4049. offset = _quill$getLine2[1];
  4050. var _quill$getLeaf = _this2.quill.getLeaf(range.index),
  4051. _quill$getLeaf2 = _slicedToArray(_quill$getLeaf, 2),
  4052. leafStart = _quill$getLeaf2[0],
  4053. offsetStart = _quill$getLeaf2[1];
  4054. var _ref = range.length === 0 ? [leafStart, offsetStart] : _this2.quill.getLeaf(range.index + range.length),
  4055. _ref2 = _slicedToArray(_ref, 2),
  4056. leafEnd = _ref2[0],
  4057. offsetEnd = _ref2[1];
  4058. var prefixText = leafStart instanceof _parchment2.default.Text ? leafStart.value().slice(0, offsetStart) : '';
  4059. var suffixText = leafEnd instanceof _parchment2.default.Text ? leafEnd.value().slice(offsetEnd) : '';
  4060. var curContext = {
  4061. collapsed: range.length === 0,
  4062. empty: range.length === 0 && line.length() <= 1,
  4063. format: _this2.quill.getFormat(range),
  4064. offset: offset,
  4065. prefix: prefixText,
  4066. suffix: suffixText
  4067. };
  4068. var prevented = bindings.some(function (binding) {
  4069. if (binding.collapsed != null && binding.collapsed !== curContext.collapsed) return false;
  4070. if (binding.empty != null && binding.empty !== curContext.empty) return false;
  4071. if (binding.offset != null && binding.offset !== curContext.offset) return false;
  4072. if (Array.isArray(binding.format)) {
  4073. // any format is present
  4074. if (binding.format.every(function (name) {
  4075. return curContext.format[name] == null;
  4076. })) {
  4077. return false;
  4078. }
  4079. } else if (_typeof(binding.format) === 'object') {
  4080. // all formats must match
  4081. if (!Object.keys(binding.format).every(function (name) {
  4082. if (binding.format[name] === true) return curContext.format[name] != null;
  4083. if (binding.format[name] === false) return curContext.format[name] == null;
  4084. return (0, _deepEqual2.default)(binding.format[name], curContext.format[name]);
  4085. })) {
  4086. return false;
  4087. }
  4088. }
  4089. if (binding.prefix != null && !binding.prefix.test(curContext.prefix)) return false;
  4090. if (binding.suffix != null && !binding.suffix.test(curContext.suffix)) return false;
  4091. return binding.handler.call(_this2, range, curContext) !== true;
  4092. });
  4093. if (prevented) {
  4094. evt.preventDefault();
  4095. }
  4096. });
  4097. }
  4098. }]);
  4099. return Keyboard;
  4100. }(_module2.default);
  4101. Keyboard.keys = {
  4102. BACKSPACE: 8,
  4103. TAB: 9,
  4104. ENTER: 13,
  4105. ESCAPE: 27,
  4106. LEFT: 37,
  4107. UP: 38,
  4108. RIGHT: 39,
  4109. DOWN: 40,
  4110. DELETE: 46
  4111. };
  4112. Keyboard.DEFAULTS = {
  4113. bindings: {
  4114. 'bold': makeFormatHandler('bold'),
  4115. 'italic': makeFormatHandler('italic'),
  4116. 'underline': makeFormatHandler('underline'),
  4117. 'indent': {
  4118. // highlight tab or tab at beginning of list, indent or blockquote
  4119. key: Keyboard.keys.TAB,
  4120. format: ['blockquote', 'indent', 'list'],
  4121. handler: function handler(range, context) {
  4122. if (context.collapsed && context.offset !== 0) return true;
  4123. this.quill.format('indent', '+1', _quill2.default.sources.USER);
  4124. }
  4125. },
  4126. 'outdent': {
  4127. key: Keyboard.keys.TAB,
  4128. shiftKey: true,
  4129. format: ['blockquote', 'indent', 'list'],
  4130. // highlight tab or tab at beginning of list, indent or blockquote
  4131. handler: function handler(range, context) {
  4132. if (context.collapsed && context.offset !== 0) return true;
  4133. this.quill.format('indent', '-1', _quill2.default.sources.USER);
  4134. }
  4135. },
  4136. 'outdent backspace': {
  4137. key: Keyboard.keys.BACKSPACE,
  4138. collapsed: true,
  4139. shiftKey: null,
  4140. metaKey: null,
  4141. ctrlKey: null,
  4142. altKey: null,
  4143. format: ['indent', 'list'],
  4144. offset: 0,
  4145. handler: function handler(range, context) {
  4146. if (context.format.indent != null) {
  4147. this.quill.format('indent', '-1', _quill2.default.sources.USER);
  4148. } else if (context.format.list != null) {
  4149. this.quill.format('list', false, _quill2.default.sources.USER);
  4150. }
  4151. }
  4152. },
  4153. 'indent code-block': makeCodeBlockHandler(true),
  4154. 'outdent code-block': makeCodeBlockHandler(false),
  4155. 'remove tab': {
  4156. key: Keyboard.keys.TAB,
  4157. shiftKey: true,
  4158. collapsed: true,
  4159. prefix: /\t$/,
  4160. handler: function handler(range) {
  4161. this.quill.deleteText(range.index - 1, 1, _quill2.default.sources.USER);
  4162. }
  4163. },
  4164. 'tab': {
  4165. key: Keyboard.keys.TAB,
  4166. handler: function handler(range) {
  4167. this.quill.history.cutoff();
  4168. var delta = new _quillDelta2.default().retain(range.index).delete(range.length).insert('\t');
  4169. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4170. this.quill.history.cutoff();
  4171. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4172. }
  4173. },
  4174. 'list empty enter': {
  4175. key: Keyboard.keys.ENTER,
  4176. collapsed: true,
  4177. format: ['list'],
  4178. empty: true,
  4179. handler: function handler(range, context) {
  4180. this.quill.format('list', false, _quill2.default.sources.USER);
  4181. if (context.format.indent) {
  4182. this.quill.format('indent', false, _quill2.default.sources.USER);
  4183. }
  4184. }
  4185. },
  4186. 'checklist enter': {
  4187. key: Keyboard.keys.ENTER,
  4188. collapsed: true,
  4189. format: { list: 'checked' },
  4190. handler: function handler(range) {
  4191. var _quill$getLine3 = this.quill.getLine(range.index),
  4192. _quill$getLine4 = _slicedToArray(_quill$getLine3, 2),
  4193. line = _quill$getLine4[0],
  4194. offset = _quill$getLine4[1];
  4195. var formats = (0, _extend2.default)({}, line.formats(), { list: 'checked' });
  4196. var delta = new _quillDelta2.default().retain(range.index).insert('\n', formats).retain(line.length() - offset - 1).retain(1, { list: 'unchecked' });
  4197. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4198. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4199. this.quill.scrollIntoView();
  4200. }
  4201. },
  4202. 'header enter': {
  4203. key: Keyboard.keys.ENTER,
  4204. collapsed: true,
  4205. format: ['header'],
  4206. suffix: /^$/,
  4207. handler: function handler(range, context) {
  4208. var _quill$getLine5 = this.quill.getLine(range.index),
  4209. _quill$getLine6 = _slicedToArray(_quill$getLine5, 2),
  4210. line = _quill$getLine6[0],
  4211. offset = _quill$getLine6[1];
  4212. var delta = new _quillDelta2.default().retain(range.index).insert('\n', context.format).retain(line.length() - offset - 1).retain(1, { header: null });
  4213. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4214. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4215. this.quill.scrollIntoView();
  4216. }
  4217. },
  4218. 'list autofill': {
  4219. key: ' ',
  4220. collapsed: true,
  4221. format: { list: false },
  4222. prefix: /^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,
  4223. handler: function handler(range, context) {
  4224. var length = context.prefix.length;
  4225. var _quill$getLine7 = this.quill.getLine(range.index),
  4226. _quill$getLine8 = _slicedToArray(_quill$getLine7, 2),
  4227. line = _quill$getLine8[0],
  4228. offset = _quill$getLine8[1];
  4229. if (offset > length) return true;
  4230. var value = void 0;
  4231. switch (context.prefix.trim()) {
  4232. case '[]':case '[ ]':
  4233. value = 'unchecked';
  4234. break;
  4235. case '[x]':
  4236. value = 'checked';
  4237. break;
  4238. case '-':case '*':
  4239. value = 'bullet';
  4240. break;
  4241. default:
  4242. value = 'ordered';
  4243. }
  4244. this.quill.insertText(range.index, ' ', _quill2.default.sources.USER);
  4245. this.quill.history.cutoff();
  4246. var delta = new _quillDelta2.default().retain(range.index - offset).delete(length + 1).retain(line.length() - 2 - offset).retain(1, { list: value });
  4247. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4248. this.quill.history.cutoff();
  4249. this.quill.setSelection(range.index - length, _quill2.default.sources.SILENT);
  4250. }
  4251. },
  4252. 'code exit': {
  4253. key: Keyboard.keys.ENTER,
  4254. collapsed: true,
  4255. format: ['code-block'],
  4256. prefix: /\n\n$/,
  4257. suffix: /^\s+$/,
  4258. handler: function handler(range) {
  4259. var _quill$getLine9 = this.quill.getLine(range.index),
  4260. _quill$getLine10 = _slicedToArray(_quill$getLine9, 2),
  4261. line = _quill$getLine10[0],
  4262. offset = _quill$getLine10[1];
  4263. var delta = new _quillDelta2.default().retain(range.index + line.length() - offset - 2).retain(1, { 'code-block': null }).delete(1);
  4264. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4265. }
  4266. },
  4267. 'embed left': makeEmbedArrowHandler(Keyboard.keys.LEFT, false),
  4268. 'embed left shift': makeEmbedArrowHandler(Keyboard.keys.LEFT, true),
  4269. 'embed right': makeEmbedArrowHandler(Keyboard.keys.RIGHT, false),
  4270. 'embed right shift': makeEmbedArrowHandler(Keyboard.keys.RIGHT, true)
  4271. }
  4272. };
  4273. function makeEmbedArrowHandler(key, shiftKey) {
  4274. var _ref3;
  4275. var where = key === Keyboard.keys.LEFT ? 'prefix' : 'suffix';
  4276. return _ref3 = {
  4277. key: key,
  4278. shiftKey: shiftKey,
  4279. altKey: null
  4280. }, _defineProperty(_ref3, where, /^$/), _defineProperty(_ref3, 'handler', function handler(range) {
  4281. var index = range.index;
  4282. if (key === Keyboard.keys.RIGHT) {
  4283. index += range.length + 1;
  4284. }
  4285. var _quill$getLeaf3 = this.quill.getLeaf(index),
  4286. _quill$getLeaf4 = _slicedToArray(_quill$getLeaf3, 1),
  4287. leaf = _quill$getLeaf4[0];
  4288. if (!(leaf instanceof _parchment2.default.Embed)) return true;
  4289. if (key === Keyboard.keys.LEFT) {
  4290. if (shiftKey) {
  4291. this.quill.setSelection(range.index - 1, range.length + 1, _quill2.default.sources.USER);
  4292. } else {
  4293. this.quill.setSelection(range.index - 1, _quill2.default.sources.USER);
  4294. }
  4295. } else {
  4296. if (shiftKey) {
  4297. this.quill.setSelection(range.index, range.length + 1, _quill2.default.sources.USER);
  4298. } else {
  4299. this.quill.setSelection(range.index + range.length + 1, _quill2.default.sources.USER);
  4300. }
  4301. }
  4302. return false;
  4303. }), _ref3;
  4304. }
  4305. function handleBackspace(range, context) {
  4306. if (range.index === 0 || this.quill.getLength() <= 1) return;
  4307. var _quill$getLine11 = this.quill.getLine(range.index),
  4308. _quill$getLine12 = _slicedToArray(_quill$getLine11, 1),
  4309. line = _quill$getLine12[0];
  4310. var formats = {};
  4311. if (context.offset === 0) {
  4312. var _quill$getLine13 = this.quill.getLine(range.index - 1),
  4313. _quill$getLine14 = _slicedToArray(_quill$getLine13, 1),
  4314. prev = _quill$getLine14[0];
  4315. if (prev != null && prev.length() > 1) {
  4316. var curFormats = line.formats();
  4317. var prevFormats = this.quill.getFormat(range.index - 1, 1);
  4318. formats = _op2.default.attributes.diff(curFormats, prevFormats) || {};
  4319. }
  4320. }
  4321. // Check for astral symbols
  4322. var length = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(context.prefix) ? 2 : 1;
  4323. this.quill.deleteText(range.index - length, length, _quill2.default.sources.USER);
  4324. if (Object.keys(formats).length > 0) {
  4325. this.quill.formatLine(range.index - length, length, formats, _quill2.default.sources.USER);
  4326. }
  4327. this.quill.focus();
  4328. }
  4329. function handleDelete(range, context) {
  4330. // Check for astral symbols
  4331. var length = /^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(context.suffix) ? 2 : 1;
  4332. if (range.index >= this.quill.getLength() - length) return;
  4333. var formats = {},
  4334. nextLength = 0;
  4335. var _quill$getLine15 = this.quill.getLine(range.index),
  4336. _quill$getLine16 = _slicedToArray(_quill$getLine15, 1),
  4337. line = _quill$getLine16[0];
  4338. if (context.offset >= line.length() - 1) {
  4339. var _quill$getLine17 = this.quill.getLine(range.index + 1),
  4340. _quill$getLine18 = _slicedToArray(_quill$getLine17, 1),
  4341. next = _quill$getLine18[0];
  4342. if (next) {
  4343. var curFormats = line.formats();
  4344. var nextFormats = this.quill.getFormat(range.index, 1);
  4345. formats = _op2.default.attributes.diff(curFormats, nextFormats) || {};
  4346. nextLength = next.length();
  4347. }
  4348. }
  4349. this.quill.deleteText(range.index, length, _quill2.default.sources.USER);
  4350. if (Object.keys(formats).length > 0) {
  4351. this.quill.formatLine(range.index + nextLength - 1, length, formats, _quill2.default.sources.USER);
  4352. }
  4353. }
  4354. function handleDeleteRange(range) {
  4355. var lines = this.quill.getLines(range);
  4356. var formats = {};
  4357. if (lines.length > 1) {
  4358. var firstFormats = lines[0].formats();
  4359. var lastFormats = lines[lines.length - 1].formats();
  4360. formats = _op2.default.attributes.diff(lastFormats, firstFormats) || {};
  4361. }
  4362. this.quill.deleteText(range, _quill2.default.sources.USER);
  4363. if (Object.keys(formats).length > 0) {
  4364. this.quill.formatLine(range.index, 1, formats, _quill2.default.sources.USER);
  4365. }
  4366. this.quill.setSelection(range.index, _quill2.default.sources.SILENT);
  4367. this.quill.focus();
  4368. }
  4369. function handleEnter(range, context) {
  4370. var _this3 = this;
  4371. if (range.length > 0) {
  4372. this.quill.scroll.deleteAt(range.index, range.length); // So we do not trigger text-change
  4373. }
  4374. var lineFormats = Object.keys(context.format).reduce(function (lineFormats, format) {
  4375. if (_parchment2.default.query(format, _parchment2.default.Scope.BLOCK) && !Array.isArray(context.format[format])) {
  4376. lineFormats[format] = context.format[format];
  4377. }
  4378. return lineFormats;
  4379. }, {});
  4380. this.quill.insertText(range.index, '\n', lineFormats, _quill2.default.sources.USER);
  4381. // Earlier scroll.deleteAt might have messed up our selection,
  4382. // so insertText's built in selection preservation is not reliable
  4383. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4384. this.quill.focus();
  4385. Object.keys(context.format).forEach(function (name) {
  4386. if (lineFormats[name] != null) return;
  4387. if (Array.isArray(context.format[name])) return;
  4388. if (name === 'link') return;
  4389. _this3.quill.format(name, context.format[name], _quill2.default.sources.USER);
  4390. });
  4391. }
  4392. function makeCodeBlockHandler(indent) {
  4393. return {
  4394. key: Keyboard.keys.TAB,
  4395. shiftKey: !indent,
  4396. format: { 'code-block': true },
  4397. handler: function handler(range) {
  4398. var CodeBlock = _parchment2.default.query('code-block');
  4399. var index = range.index,
  4400. length = range.length;
  4401. var _quill$scroll$descend = this.quill.scroll.descendant(CodeBlock, index),
  4402. _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
  4403. block = _quill$scroll$descend2[0],
  4404. offset = _quill$scroll$descend2[1];
  4405. if (block == null) return;
  4406. var scrollIndex = this.quill.getIndex(block);
  4407. var start = block.newlineIndex(offset, true) + 1;
  4408. var end = block.newlineIndex(scrollIndex + offset + length);
  4409. var lines = block.domNode.textContent.slice(start, end).split('\n');
  4410. offset = 0;
  4411. lines.forEach(function (line, i) {
  4412. if (indent) {
  4413. block.insertAt(start + offset, CodeBlock.TAB);
  4414. offset += CodeBlock.TAB.length;
  4415. if (i === 0) {
  4416. index += CodeBlock.TAB.length;
  4417. } else {
  4418. length += CodeBlock.TAB.length;
  4419. }
  4420. } else if (line.startsWith(CodeBlock.TAB)) {
  4421. block.deleteAt(start + offset, CodeBlock.TAB.length);
  4422. offset -= CodeBlock.TAB.length;
  4423. if (i === 0) {
  4424. index -= CodeBlock.TAB.length;
  4425. } else {
  4426. length -= CodeBlock.TAB.length;
  4427. }
  4428. }
  4429. offset += line.length + 1;
  4430. });
  4431. this.quill.update(_quill2.default.sources.USER);
  4432. this.quill.setSelection(index, length, _quill2.default.sources.SILENT);
  4433. }
  4434. };
  4435. }
  4436. function makeFormatHandler(format) {
  4437. return {
  4438. key: format[0].toUpperCase(),
  4439. shortKey: true,
  4440. handler: function handler(range, context) {
  4441. this.quill.format(format, !context.format[format], _quill2.default.sources.USER);
  4442. }
  4443. };
  4444. }
  4445. function normalize(binding) {
  4446. if (typeof binding === 'string' || typeof binding === 'number') {
  4447. return normalize({ key: binding });
  4448. }
  4449. if ((typeof binding === 'undefined' ? 'undefined' : _typeof(binding)) === 'object') {
  4450. binding = (0, _clone2.default)(binding, false);
  4451. }
  4452. if (typeof binding.key === 'string') {
  4453. if (Keyboard.keys[binding.key.toUpperCase()] != null) {
  4454. binding.key = Keyboard.keys[binding.key.toUpperCase()];
  4455. } else if (binding.key.length === 1) {
  4456. binding.key = binding.key.toUpperCase().charCodeAt(0);
  4457. } else {
  4458. return null;
  4459. }
  4460. }
  4461. if (binding.shortKey) {
  4462. binding[SHORTKEY] = binding.shortKey;
  4463. delete binding.shortKey;
  4464. }
  4465. return binding;
  4466. }
  4467. exports.default = Keyboard;
  4468. exports.SHORTKEY = SHORTKEY;
  4469. /***/ }),
  4470. /* 24 */
  4471. /***/ (function(module, exports, __webpack_require__) {
  4472. "use strict";
  4473. Object.defineProperty(exports, "__esModule", {
  4474. value: true
  4475. });
  4476. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  4477. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  4478. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4479. var _parchment = __webpack_require__(0);
  4480. var _parchment2 = _interopRequireDefault(_parchment);
  4481. var _text = __webpack_require__(7);
  4482. var _text2 = _interopRequireDefault(_text);
  4483. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4484. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4485. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4486. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4487. var Cursor = function (_Parchment$Embed) {
  4488. _inherits(Cursor, _Parchment$Embed);
  4489. _createClass(Cursor, null, [{
  4490. key: 'value',
  4491. value: function value() {
  4492. return undefined;
  4493. }
  4494. }]);
  4495. function Cursor(domNode, selection) {
  4496. _classCallCheck(this, Cursor);
  4497. var _this = _possibleConstructorReturn(this, (Cursor.__proto__ || Object.getPrototypeOf(Cursor)).call(this, domNode));
  4498. _this.selection = selection;
  4499. _this.textNode = document.createTextNode(Cursor.CONTENTS);
  4500. _this.domNode.appendChild(_this.textNode);
  4501. _this._length = 0;
  4502. return _this;
  4503. }
  4504. _createClass(Cursor, [{
  4505. key: 'detach',
  4506. value: function detach() {
  4507. // super.detach() will also clear domNode.__blot
  4508. if (this.parent != null) this.parent.removeChild(this);
  4509. }
  4510. }, {
  4511. key: 'format',
  4512. value: function format(name, value) {
  4513. if (this._length !== 0) {
  4514. return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'format', this).call(this, name, value);
  4515. }
  4516. var target = this,
  4517. index = 0;
  4518. while (target != null && target.statics.scope !== _parchment2.default.Scope.BLOCK_BLOT) {
  4519. index += target.offset(target.parent);
  4520. target = target.parent;
  4521. }
  4522. if (target != null) {
  4523. this._length = Cursor.CONTENTS.length;
  4524. target.optimize();
  4525. target.formatAt(index, Cursor.CONTENTS.length, name, value);
  4526. this._length = 0;
  4527. }
  4528. }
  4529. }, {
  4530. key: 'index',
  4531. value: function index(node, offset) {
  4532. if (node === this.textNode) return 0;
  4533. return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'index', this).call(this, node, offset);
  4534. }
  4535. }, {
  4536. key: 'length',
  4537. value: function length() {
  4538. return this._length;
  4539. }
  4540. }, {
  4541. key: 'position',
  4542. value: function position() {
  4543. return [this.textNode, this.textNode.data.length];
  4544. }
  4545. }, {
  4546. key: 'remove',
  4547. value: function remove() {
  4548. _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'remove', this).call(this);
  4549. this.parent = null;
  4550. }
  4551. }, {
  4552. key: 'restore',
  4553. value: function restore() {
  4554. if (this.selection.composing || this.parent == null) return;
  4555. var textNode = this.textNode;
  4556. var range = this.selection.getNativeRange();
  4557. var restoreText = void 0,
  4558. start = void 0,
  4559. end = void 0;
  4560. if (range != null && range.start.node === textNode && range.end.node === textNode) {
  4561. var _ref = [textNode, range.start.offset, range.end.offset];
  4562. restoreText = _ref[0];
  4563. start = _ref[1];
  4564. end = _ref[2];
  4565. }
  4566. // Link format will insert text outside of anchor tag
  4567. while (this.domNode.lastChild != null && this.domNode.lastChild !== this.textNode) {
  4568. this.domNode.parentNode.insertBefore(this.domNode.lastChild, this.domNode);
  4569. }
  4570. if (this.textNode.data !== Cursor.CONTENTS) {
  4571. var text = this.textNode.data.split(Cursor.CONTENTS).join('');
  4572. if (this.next instanceof _text2.default) {
  4573. restoreText = this.next.domNode;
  4574. this.next.insertAt(0, text);
  4575. this.textNode.data = Cursor.CONTENTS;
  4576. } else {
  4577. this.textNode.data = text;
  4578. this.parent.insertBefore(_parchment2.default.create(this.textNode), this);
  4579. this.textNode = document.createTextNode(Cursor.CONTENTS);
  4580. this.domNode.appendChild(this.textNode);
  4581. }
  4582. }
  4583. this.remove();
  4584. if (start != null) {
  4585. var _map = [start, end].map(function (offset) {
  4586. return Math.max(0, Math.min(restoreText.data.length, offset - 1));
  4587. });
  4588. var _map2 = _slicedToArray(_map, 2);
  4589. start = _map2[0];
  4590. end = _map2[1];
  4591. return {
  4592. startNode: restoreText,
  4593. startOffset: start,
  4594. endNode: restoreText,
  4595. endOffset: end
  4596. };
  4597. }
  4598. }
  4599. }, {
  4600. key: 'update',
  4601. value: function update(mutations, context) {
  4602. var _this2 = this;
  4603. if (mutations.some(function (mutation) {
  4604. return mutation.type === 'characterData' && mutation.target === _this2.textNode;
  4605. })) {
  4606. var range = this.restore();
  4607. if (range) context.range = range;
  4608. }
  4609. }
  4610. }, {
  4611. key: 'value',
  4612. value: function value() {
  4613. return '';
  4614. }
  4615. }]);
  4616. return Cursor;
  4617. }(_parchment2.default.Embed);
  4618. Cursor.blotName = 'cursor';
  4619. Cursor.className = 'ql-cursor';
  4620. Cursor.tagName = 'span';
  4621. Cursor.CONTENTS = '\uFEFF'; // Zero width no break space
  4622. exports.default = Cursor;
  4623. /***/ }),
  4624. /* 25 */
  4625. /***/ (function(module, exports, __webpack_require__) {
  4626. "use strict";
  4627. Object.defineProperty(exports, "__esModule", {
  4628. value: true
  4629. });
  4630. var _parchment = __webpack_require__(0);
  4631. var _parchment2 = _interopRequireDefault(_parchment);
  4632. var _block = __webpack_require__(4);
  4633. var _block2 = _interopRequireDefault(_block);
  4634. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4635. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4636. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4637. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4638. var Container = function (_Parchment$Container) {
  4639. _inherits(Container, _Parchment$Container);
  4640. function Container() {
  4641. _classCallCheck(this, Container);
  4642. return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).apply(this, arguments));
  4643. }
  4644. return Container;
  4645. }(_parchment2.default.Container);
  4646. Container.allowedChildren = [_block2.default, _block.BlockEmbed, Container];
  4647. exports.default = Container;
  4648. /***/ }),
  4649. /* 26 */
  4650. /***/ (function(module, exports, __webpack_require__) {
  4651. "use strict";
  4652. Object.defineProperty(exports, "__esModule", {
  4653. value: true
  4654. });
  4655. exports.ColorStyle = exports.ColorClass = exports.ColorAttributor = undefined;
  4656. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4657. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  4658. var _parchment = __webpack_require__(0);
  4659. var _parchment2 = _interopRequireDefault(_parchment);
  4660. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4661. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4662. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4663. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4664. var ColorAttributor = function (_Parchment$Attributor) {
  4665. _inherits(ColorAttributor, _Parchment$Attributor);
  4666. function ColorAttributor() {
  4667. _classCallCheck(this, ColorAttributor);
  4668. return _possibleConstructorReturn(this, (ColorAttributor.__proto__ || Object.getPrototypeOf(ColorAttributor)).apply(this, arguments));
  4669. }
  4670. _createClass(ColorAttributor, [{
  4671. key: 'value',
  4672. value: function value(domNode) {
  4673. var value = _get(ColorAttributor.prototype.__proto__ || Object.getPrototypeOf(ColorAttributor.prototype), 'value', this).call(this, domNode);
  4674. if (!value.startsWith('rgb(')) return value;
  4675. value = value.replace(/^[^\d]+/, '').replace(/[^\d]+$/, '');
  4676. return '#' + value.split(',').map(function (component) {
  4677. return ('00' + parseInt(component).toString(16)).slice(-2);
  4678. }).join('');
  4679. }
  4680. }]);
  4681. return ColorAttributor;
  4682. }(_parchment2.default.Attributor.Style);
  4683. var ColorClass = new _parchment2.default.Attributor.Class('color', 'ql-color', {
  4684. scope: _parchment2.default.Scope.INLINE
  4685. });
  4686. var ColorStyle = new ColorAttributor('color', 'color', {
  4687. scope: _parchment2.default.Scope.INLINE
  4688. });
  4689. exports.ColorAttributor = ColorAttributor;
  4690. exports.ColorClass = ColorClass;
  4691. exports.ColorStyle = ColorStyle;
  4692. /***/ }),
  4693. /* 27 */
  4694. /***/ (function(module, exports, __webpack_require__) {
  4695. "use strict";
  4696. Object.defineProperty(exports, "__esModule", {
  4697. value: true
  4698. });
  4699. exports.sanitize = exports.default = undefined;
  4700. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4701. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  4702. var _inline = __webpack_require__(6);
  4703. var _inline2 = _interopRequireDefault(_inline);
  4704. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4705. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4706. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4707. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4708. var Link = function (_Inline) {
  4709. _inherits(Link, _Inline);
  4710. function Link() {
  4711. _classCallCheck(this, Link);
  4712. return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments));
  4713. }
  4714. _createClass(Link, [{
  4715. key: 'format',
  4716. value: function format(name, value) {
  4717. if (name !== this.statics.blotName || !value) return _get(Link.prototype.__proto__ || Object.getPrototypeOf(Link.prototype), 'format', this).call(this, name, value);
  4718. value = this.constructor.sanitize(value);
  4719. this.domNode.setAttribute('href', value);
  4720. }
  4721. }], [{
  4722. key: 'create',
  4723. value: function create(value) {
  4724. var node = _get(Link.__proto__ || Object.getPrototypeOf(Link), 'create', this).call(this, value);
  4725. value = this.sanitize(value);
  4726. node.setAttribute('href', value);
  4727. node.setAttribute('rel', 'noopener noreferrer');
  4728. node.setAttribute('target', '_blank');
  4729. return node;
  4730. }
  4731. }, {
  4732. key: 'formats',
  4733. value: function formats(domNode) {
  4734. return domNode.getAttribute('href');
  4735. }
  4736. }, {
  4737. key: 'sanitize',
  4738. value: function sanitize(url) {
  4739. return _sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;
  4740. }
  4741. }]);
  4742. return Link;
  4743. }(_inline2.default);
  4744. Link.blotName = 'link';
  4745. Link.tagName = 'A';
  4746. Link.SANITIZED_URL = 'about:blank';
  4747. Link.PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel'];
  4748. function _sanitize(url, protocols) {
  4749. var anchor = document.createElement('a');
  4750. anchor.href = url;
  4751. var protocol = anchor.href.slice(0, anchor.href.indexOf(':'));
  4752. return protocols.indexOf(protocol) > -1;
  4753. }
  4754. exports.default = Link;
  4755. exports.sanitize = _sanitize;
  4756. /***/ }),
  4757. /* 28 */
  4758. /***/ (function(module, exports, __webpack_require__) {
  4759. "use strict";
  4760. Object.defineProperty(exports, "__esModule", {
  4761. value: true
  4762. });
  4763. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  4764. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4765. var _keyboard = __webpack_require__(23);
  4766. var _keyboard2 = _interopRequireDefault(_keyboard);
  4767. var _dropdown = __webpack_require__(107);
  4768. var _dropdown2 = _interopRequireDefault(_dropdown);
  4769. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4770. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4771. var optionsCounter = 0;
  4772. function toggleAriaAttribute(element, attribute) {
  4773. element.setAttribute(attribute, !(element.getAttribute(attribute) === 'true'));
  4774. }
  4775. var Picker = function () {
  4776. function Picker(select) {
  4777. var _this = this;
  4778. _classCallCheck(this, Picker);
  4779. this.select = select;
  4780. this.container = document.createElement('span');
  4781. this.buildPicker();
  4782. this.select.style.display = 'none';
  4783. this.select.parentNode.insertBefore(this.container, this.select);
  4784. this.label.addEventListener('mousedown', function () {
  4785. _this.togglePicker();
  4786. });
  4787. this.label.addEventListener('keydown', function (event) {
  4788. switch (event.keyCode) {
  4789. // Allows the "Enter" key to open the picker
  4790. case _keyboard2.default.keys.ENTER:
  4791. _this.togglePicker();
  4792. break;
  4793. // Allows the "Escape" key to close the picker
  4794. case _keyboard2.default.keys.ESCAPE:
  4795. _this.escape();
  4796. event.preventDefault();
  4797. break;
  4798. default:
  4799. }
  4800. });
  4801. this.select.addEventListener('change', this.update.bind(this));
  4802. }
  4803. _createClass(Picker, [{
  4804. key: 'togglePicker',
  4805. value: function togglePicker() {
  4806. this.container.classList.toggle('ql-expanded');
  4807. // Toggle aria-expanded and aria-hidden to make the picker accessible
  4808. toggleAriaAttribute(this.label, 'aria-expanded');
  4809. toggleAriaAttribute(this.options, 'aria-hidden');
  4810. }
  4811. }, {
  4812. key: 'buildItem',
  4813. value: function buildItem(option) {
  4814. var _this2 = this;
  4815. var item = document.createElement('span');
  4816. item.tabIndex = '0';
  4817. item.setAttribute('role', 'button');
  4818. item.classList.add('ql-picker-item');
  4819. if (option.hasAttribute('value')) {
  4820. item.setAttribute('data-value', option.getAttribute('value'));
  4821. }
  4822. if (option.textContent) {
  4823. item.setAttribute('data-label', option.textContent);
  4824. }
  4825. item.addEventListener('click', function () {
  4826. _this2.selectItem(item, true);
  4827. });
  4828. item.addEventListener('keydown', function (event) {
  4829. switch (event.keyCode) {
  4830. // Allows the "Enter" key to select an item
  4831. case _keyboard2.default.keys.ENTER:
  4832. _this2.selectItem(item, true);
  4833. event.preventDefault();
  4834. break;
  4835. // Allows the "Escape" key to close the picker
  4836. case _keyboard2.default.keys.ESCAPE:
  4837. _this2.escape();
  4838. event.preventDefault();
  4839. break;
  4840. default:
  4841. }
  4842. });
  4843. return item;
  4844. }
  4845. }, {
  4846. key: 'buildLabel',
  4847. value: function buildLabel() {
  4848. var label = document.createElement('span');
  4849. label.classList.add('ql-picker-label');
  4850. label.innerHTML = _dropdown2.default;
  4851. label.tabIndex = '0';
  4852. label.setAttribute('role', 'button');
  4853. label.setAttribute('aria-expanded', 'false');
  4854. this.container.appendChild(label);
  4855. return label;
  4856. }
  4857. }, {
  4858. key: 'buildOptions',
  4859. value: function buildOptions() {
  4860. var _this3 = this;
  4861. var options = document.createElement('span');
  4862. options.classList.add('ql-picker-options');
  4863. // Don't want screen readers to read this until options are visible
  4864. options.setAttribute('aria-hidden', 'true');
  4865. options.tabIndex = '-1';
  4866. // Need a unique id for aria-controls
  4867. options.id = 'ql-picker-options-' + optionsCounter;
  4868. optionsCounter += 1;
  4869. this.label.setAttribute('aria-controls', options.id);
  4870. this.options = options;
  4871. [].slice.call(this.select.options).forEach(function (option) {
  4872. var item = _this3.buildItem(option);
  4873. options.appendChild(item);
  4874. if (option.selected === true) {
  4875. _this3.selectItem(item);
  4876. }
  4877. });
  4878. this.container.appendChild(options);
  4879. }
  4880. }, {
  4881. key: 'buildPicker',
  4882. value: function buildPicker() {
  4883. var _this4 = this;
  4884. [].slice.call(this.select.attributes).forEach(function (item) {
  4885. _this4.container.setAttribute(item.name, item.value);
  4886. });
  4887. this.container.classList.add('ql-picker');
  4888. this.label = this.buildLabel();
  4889. this.buildOptions();
  4890. }
  4891. }, {
  4892. key: 'escape',
  4893. value: function escape() {
  4894. var _this5 = this;
  4895. // Close menu and return focus to trigger label
  4896. this.close();
  4897. // Need setTimeout for accessibility to ensure that the browser executes
  4898. // focus on the next process thread and after any DOM content changes
  4899. setTimeout(function () {
  4900. return _this5.label.focus();
  4901. }, 1);
  4902. }
  4903. }, {
  4904. key: 'close',
  4905. value: function close() {
  4906. this.container.classList.remove('ql-expanded');
  4907. this.label.setAttribute('aria-expanded', 'false');
  4908. this.options.setAttribute('aria-hidden', 'true');
  4909. }
  4910. }, {
  4911. key: 'selectItem',
  4912. value: function selectItem(item) {
  4913. var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4914. var selected = this.container.querySelector('.ql-selected');
  4915. if (item === selected) return;
  4916. if (selected != null) {
  4917. selected.classList.remove('ql-selected');
  4918. }
  4919. if (item == null) return;
  4920. item.classList.add('ql-selected');
  4921. this.select.selectedIndex = [].indexOf.call(item.parentNode.children, item);
  4922. if (item.hasAttribute('data-value')) {
  4923. this.label.setAttribute('data-value', item.getAttribute('data-value'));
  4924. } else {
  4925. this.label.removeAttribute('data-value');
  4926. }
  4927. if (item.hasAttribute('data-label')) {
  4928. this.label.setAttribute('data-label', item.getAttribute('data-label'));
  4929. } else {
  4930. this.label.removeAttribute('data-label');
  4931. }
  4932. if (trigger) {
  4933. if (typeof Event === 'function') {
  4934. this.select.dispatchEvent(new Event('change'));
  4935. } else if ((typeof Event === 'undefined' ? 'undefined' : _typeof(Event)) === 'object') {
  4936. // IE11
  4937. var event = document.createEvent('Event');
  4938. event.initEvent('change', true, true);
  4939. this.select.dispatchEvent(event);
  4940. }
  4941. this.close();
  4942. }
  4943. }
  4944. }, {
  4945. key: 'update',
  4946. value: function update() {
  4947. var option = void 0;
  4948. if (this.select.selectedIndex > -1) {
  4949. var item = this.container.querySelector('.ql-picker-options').children[this.select.selectedIndex];
  4950. option = this.select.options[this.select.selectedIndex];
  4951. this.selectItem(item);
  4952. } else {
  4953. this.selectItem(null);
  4954. }
  4955. var isActive = option != null && option !== this.select.querySelector('option[selected]');
  4956. this.label.classList.toggle('ql-active', isActive);
  4957. }
  4958. }]);
  4959. return Picker;
  4960. }();
  4961. exports.default = Picker;
  4962. /***/ }),
  4963. /* 29 */
  4964. /***/ (function(module, exports, __webpack_require__) {
  4965. "use strict";
  4966. Object.defineProperty(exports, "__esModule", {
  4967. value: true
  4968. });
  4969. var _parchment = __webpack_require__(0);
  4970. var _parchment2 = _interopRequireDefault(_parchment);
  4971. var _quill = __webpack_require__(5);
  4972. var _quill2 = _interopRequireDefault(_quill);
  4973. var _block = __webpack_require__(4);
  4974. var _block2 = _interopRequireDefault(_block);
  4975. var _break = __webpack_require__(16);
  4976. var _break2 = _interopRequireDefault(_break);
  4977. var _container = __webpack_require__(25);
  4978. var _container2 = _interopRequireDefault(_container);
  4979. var _cursor = __webpack_require__(24);
  4980. var _cursor2 = _interopRequireDefault(_cursor);
  4981. var _embed = __webpack_require__(35);
  4982. var _embed2 = _interopRequireDefault(_embed);
  4983. var _inline = __webpack_require__(6);
  4984. var _inline2 = _interopRequireDefault(_inline);
  4985. var _scroll = __webpack_require__(22);
  4986. var _scroll2 = _interopRequireDefault(_scroll);
  4987. var _text = __webpack_require__(7);
  4988. var _text2 = _interopRequireDefault(_text);
  4989. var _clipboard = __webpack_require__(55);
  4990. var _clipboard2 = _interopRequireDefault(_clipboard);
  4991. var _history = __webpack_require__(42);
  4992. var _history2 = _interopRequireDefault(_history);
  4993. var _keyboard = __webpack_require__(23);
  4994. var _keyboard2 = _interopRequireDefault(_keyboard);
  4995. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4996. _quill2.default.register({
  4997. 'blots/block': _block2.default,
  4998. 'blots/block/embed': _block.BlockEmbed,
  4999. 'blots/break': _break2.default,
  5000. 'blots/container': _container2.default,
  5001. 'blots/cursor': _cursor2.default,
  5002. 'blots/embed': _embed2.default,
  5003. 'blots/inline': _inline2.default,
  5004. 'blots/scroll': _scroll2.default,
  5005. 'blots/text': _text2.default,
  5006. 'modules/clipboard': _clipboard2.default,
  5007. 'modules/history': _history2.default,
  5008. 'modules/keyboard': _keyboard2.default
  5009. });
  5010. _parchment2.default.register(_block2.default, _break2.default, _cursor2.default, _inline2.default, _scroll2.default, _text2.default);
  5011. exports.default = _quill2.default;
  5012. /***/ }),
  5013. /* 30 */
  5014. /***/ (function(module, exports, __webpack_require__) {
  5015. "use strict";
  5016. Object.defineProperty(exports, "__esModule", { value: true });
  5017. var Registry = __webpack_require__(1);
  5018. var ShadowBlot = /** @class */ (function () {
  5019. function ShadowBlot(domNode) {
  5020. this.domNode = domNode;
  5021. // @ts-ignore
  5022. this.domNode[Registry.DATA_KEY] = { blot: this };
  5023. }
  5024. Object.defineProperty(ShadowBlot.prototype, "statics", {
  5025. // Hack for accessing inherited static methods
  5026. get: function () {
  5027. return this.constructor;
  5028. },
  5029. enumerable: true,
  5030. configurable: true
  5031. });
  5032. ShadowBlot.create = function (value) {
  5033. if (this.tagName == null) {
  5034. throw new Registry.ParchmentError('Blot definition missing tagName');
  5035. }
  5036. var node;
  5037. if (Array.isArray(this.tagName)) {
  5038. if (typeof value === 'string') {
  5039. value = value.toUpperCase();
  5040. if (parseInt(value).toString() === value) {
  5041. value = parseInt(value);
  5042. }
  5043. }
  5044. if (typeof value === 'number') {
  5045. node = document.createElement(this.tagName[value - 1]);
  5046. }
  5047. else if (this.tagName.indexOf(value) > -1) {
  5048. node = document.createElement(value);
  5049. }
  5050. else {
  5051. node = document.createElement(this.tagName[0]);
  5052. }
  5053. }
  5054. else {
  5055. node = document.createElement(this.tagName);
  5056. }
  5057. if (this.className) {
  5058. node.classList.add(this.className);
  5059. }
  5060. return node;
  5061. };
  5062. ShadowBlot.prototype.attach = function () {
  5063. if (this.parent != null) {
  5064. this.scroll = this.parent.scroll;
  5065. }
  5066. };
  5067. ShadowBlot.prototype.clone = function () {
  5068. var domNode = this.domNode.cloneNode(false);
  5069. return Registry.create(domNode);
  5070. };
  5071. ShadowBlot.prototype.detach = function () {
  5072. if (this.parent != null)
  5073. this.parent.removeChild(this);
  5074. // @ts-ignore
  5075. delete this.domNode[Registry.DATA_KEY];
  5076. };
  5077. ShadowBlot.prototype.deleteAt = function (index, length) {
  5078. var blot = this.isolate(index, length);
  5079. blot.remove();
  5080. };
  5081. ShadowBlot.prototype.formatAt = function (index, length, name, value) {
  5082. var blot = this.isolate(index, length);
  5083. if (Registry.query(name, Registry.Scope.BLOT) != null && value) {
  5084. blot.wrap(name, value);
  5085. }
  5086. else if (Registry.query(name, Registry.Scope.ATTRIBUTE) != null) {
  5087. var parent = Registry.create(this.statics.scope);
  5088. blot.wrap(parent);
  5089. parent.format(name, value);
  5090. }
  5091. };
  5092. ShadowBlot.prototype.insertAt = function (index, value, def) {
  5093. var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);
  5094. var ref = this.split(index);
  5095. this.parent.insertBefore(blot, ref);
  5096. };
  5097. ShadowBlot.prototype.insertInto = function (parentBlot, refBlot) {
  5098. if (refBlot === void 0) { refBlot = null; }
  5099. if (this.parent != null) {
  5100. this.parent.children.remove(this);
  5101. }
  5102. var refDomNode = null;
  5103. parentBlot.children.insertBefore(this, refBlot);
  5104. if (refBlot != null) {
  5105. refDomNode = refBlot.domNode;
  5106. }
  5107. if (this.domNode.parentNode != parentBlot.domNode ||
  5108. this.domNode.nextSibling != refDomNode) {
  5109. parentBlot.domNode.insertBefore(this.domNode, refDomNode);
  5110. }
  5111. this.parent = parentBlot;
  5112. this.attach();
  5113. };
  5114. ShadowBlot.prototype.isolate = function (index, length) {
  5115. var target = this.split(index);
  5116. target.split(length);
  5117. return target;
  5118. };
  5119. ShadowBlot.prototype.length = function () {
  5120. return 1;
  5121. };
  5122. ShadowBlot.prototype.offset = function (root) {
  5123. if (root === void 0) { root = this.parent; }
  5124. if (this.parent == null || this == root)
  5125. return 0;
  5126. return this.parent.children.offset(this) + this.parent.offset(root);
  5127. };
  5128. ShadowBlot.prototype.optimize = function (context) {
  5129. // TODO clean up once we use WeakMap
  5130. // @ts-ignore
  5131. if (this.domNode[Registry.DATA_KEY] != null) {
  5132. // @ts-ignore
  5133. delete this.domNode[Registry.DATA_KEY].mutations;
  5134. }
  5135. };
  5136. ShadowBlot.prototype.remove = function () {
  5137. if (this.domNode.parentNode != null) {
  5138. this.domNode.parentNode.removeChild(this.domNode);
  5139. }
  5140. this.detach();
  5141. };
  5142. ShadowBlot.prototype.replace = function (target) {
  5143. if (target.parent == null)
  5144. return;
  5145. target.parent.insertBefore(this, target.next);
  5146. target.remove();
  5147. };
  5148. ShadowBlot.prototype.replaceWith = function (name, value) {
  5149. var replacement = typeof name === 'string' ? Registry.create(name, value) : name;
  5150. replacement.replace(this);
  5151. return replacement;
  5152. };
  5153. ShadowBlot.prototype.split = function (index, force) {
  5154. return index === 0 ? this : this.next;
  5155. };
  5156. ShadowBlot.prototype.update = function (mutations, context) {
  5157. // Nothing to do by default
  5158. };
  5159. ShadowBlot.prototype.wrap = function (name, value) {
  5160. var wrapper = typeof name === 'string' ? Registry.create(name, value) : name;
  5161. if (this.parent != null) {
  5162. this.parent.insertBefore(wrapper, this.next);
  5163. }
  5164. wrapper.appendChild(this);
  5165. return wrapper;
  5166. };
  5167. ShadowBlot.blotName = 'abstract';
  5168. return ShadowBlot;
  5169. }());
  5170. exports.default = ShadowBlot;
  5171. /***/ }),
  5172. /* 31 */
  5173. /***/ (function(module, exports, __webpack_require__) {
  5174. "use strict";
  5175. Object.defineProperty(exports, "__esModule", { value: true });
  5176. var attributor_1 = __webpack_require__(12);
  5177. var class_1 = __webpack_require__(32);
  5178. var style_1 = __webpack_require__(33);
  5179. var Registry = __webpack_require__(1);
  5180. var AttributorStore = /** @class */ (function () {
  5181. function AttributorStore(domNode) {
  5182. this.attributes = {};
  5183. this.domNode = domNode;
  5184. this.build();
  5185. }
  5186. AttributorStore.prototype.attribute = function (attribute, value) {
  5187. // verb
  5188. if (value) {
  5189. if (attribute.add(this.domNode, value)) {
  5190. if (attribute.value(this.domNode) != null) {
  5191. this.attributes[attribute.attrName] = attribute;
  5192. }
  5193. else {
  5194. delete this.attributes[attribute.attrName];
  5195. }
  5196. }
  5197. }
  5198. else {
  5199. attribute.remove(this.domNode);
  5200. delete this.attributes[attribute.attrName];
  5201. }
  5202. };
  5203. AttributorStore.prototype.build = function () {
  5204. var _this = this;
  5205. this.attributes = {};
  5206. var attributes = attributor_1.default.keys(this.domNode);
  5207. var classes = class_1.default.keys(this.domNode);
  5208. var styles = style_1.default.keys(this.domNode);
  5209. attributes
  5210. .concat(classes)
  5211. .concat(styles)
  5212. .forEach(function (name) {
  5213. var attr = Registry.query(name, Registry.Scope.ATTRIBUTE);
  5214. if (attr instanceof attributor_1.default) {
  5215. _this.attributes[attr.attrName] = attr;
  5216. }
  5217. });
  5218. };
  5219. AttributorStore.prototype.copy = function (target) {
  5220. var _this = this;
  5221. Object.keys(this.attributes).forEach(function (key) {
  5222. var value = _this.attributes[key].value(_this.domNode);
  5223. target.format(key, value);
  5224. });
  5225. };
  5226. AttributorStore.prototype.move = function (target) {
  5227. var _this = this;
  5228. this.copy(target);
  5229. Object.keys(this.attributes).forEach(function (key) {
  5230. _this.attributes[key].remove(_this.domNode);
  5231. });
  5232. this.attributes = {};
  5233. };
  5234. AttributorStore.prototype.values = function () {
  5235. var _this = this;
  5236. return Object.keys(this.attributes).reduce(function (attributes, name) {
  5237. attributes[name] = _this.attributes[name].value(_this.domNode);
  5238. return attributes;
  5239. }, {});
  5240. };
  5241. return AttributorStore;
  5242. }());
  5243. exports.default = AttributorStore;
  5244. /***/ }),
  5245. /* 32 */
  5246. /***/ (function(module, exports, __webpack_require__) {
  5247. "use strict";
  5248. var __extends = (this && this.__extends) || (function () {
  5249. var extendStatics = Object.setPrototypeOf ||
  5250. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5251. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5252. return function (d, b) {
  5253. extendStatics(d, b);
  5254. function __() { this.constructor = d; }
  5255. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5256. };
  5257. })();
  5258. Object.defineProperty(exports, "__esModule", { value: true });
  5259. var attributor_1 = __webpack_require__(12);
  5260. function match(node, prefix) {
  5261. var className = node.getAttribute('class') || '';
  5262. return className.split(/\s+/).filter(function (name) {
  5263. return name.indexOf(prefix + "-") === 0;
  5264. });
  5265. }
  5266. var ClassAttributor = /** @class */ (function (_super) {
  5267. __extends(ClassAttributor, _super);
  5268. function ClassAttributor() {
  5269. return _super !== null && _super.apply(this, arguments) || this;
  5270. }
  5271. ClassAttributor.keys = function (node) {
  5272. return (node.getAttribute('class') || '').split(/\s+/).map(function (name) {
  5273. return name
  5274. .split('-')
  5275. .slice(0, -1)
  5276. .join('-');
  5277. });
  5278. };
  5279. ClassAttributor.prototype.add = function (node, value) {
  5280. if (!this.canAdd(node, value))
  5281. return false;
  5282. this.remove(node);
  5283. node.classList.add(this.keyName + "-" + value);
  5284. return true;
  5285. };
  5286. ClassAttributor.prototype.remove = function (node) {
  5287. var matches = match(node, this.keyName);
  5288. matches.forEach(function (name) {
  5289. node.classList.remove(name);
  5290. });
  5291. if (node.classList.length === 0) {
  5292. node.removeAttribute('class');
  5293. }
  5294. };
  5295. ClassAttributor.prototype.value = function (node) {
  5296. var result = match(node, this.keyName)[0] || '';
  5297. var value = result.slice(this.keyName.length + 1); // +1 for hyphen
  5298. return this.canAdd(node, value) ? value : '';
  5299. };
  5300. return ClassAttributor;
  5301. }(attributor_1.default));
  5302. exports.default = ClassAttributor;
  5303. /***/ }),
  5304. /* 33 */
  5305. /***/ (function(module, exports, __webpack_require__) {
  5306. "use strict";
  5307. var __extends = (this && this.__extends) || (function () {
  5308. var extendStatics = Object.setPrototypeOf ||
  5309. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5310. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5311. return function (d, b) {
  5312. extendStatics(d, b);
  5313. function __() { this.constructor = d; }
  5314. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5315. };
  5316. })();
  5317. Object.defineProperty(exports, "__esModule", { value: true });
  5318. var attributor_1 = __webpack_require__(12);
  5319. function camelize(name) {
  5320. var parts = name.split('-');
  5321. var rest = parts
  5322. .slice(1)
  5323. .map(function (part) {
  5324. return part[0].toUpperCase() + part.slice(1);
  5325. })
  5326. .join('');
  5327. return parts[0] + rest;
  5328. }
  5329. var StyleAttributor = /** @class */ (function (_super) {
  5330. __extends(StyleAttributor, _super);
  5331. function StyleAttributor() {
  5332. return _super !== null && _super.apply(this, arguments) || this;
  5333. }
  5334. StyleAttributor.keys = function (node) {
  5335. return (node.getAttribute('style') || '').split(';').map(function (value) {
  5336. var arr = value.split(':');
  5337. return arr[0].trim();
  5338. });
  5339. };
  5340. StyleAttributor.prototype.add = function (node, value) {
  5341. if (!this.canAdd(node, value))
  5342. return false;
  5343. // @ts-ignore
  5344. node.style[camelize(this.keyName)] = value;
  5345. return true;
  5346. };
  5347. StyleAttributor.prototype.remove = function (node) {
  5348. // @ts-ignore
  5349. node.style[camelize(this.keyName)] = '';
  5350. if (!node.getAttribute('style')) {
  5351. node.removeAttribute('style');
  5352. }
  5353. };
  5354. StyleAttributor.prototype.value = function (node) {
  5355. // @ts-ignore
  5356. var value = node.style[camelize(this.keyName)];
  5357. return this.canAdd(node, value) ? value : '';
  5358. };
  5359. return StyleAttributor;
  5360. }(attributor_1.default));
  5361. exports.default = StyleAttributor;
  5362. /***/ }),
  5363. /* 34 */
  5364. /***/ (function(module, exports, __webpack_require__) {
  5365. "use strict";
  5366. Object.defineProperty(exports, "__esModule", {
  5367. value: true
  5368. });
  5369. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5370. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5371. var Theme = function () {
  5372. function Theme(quill, options) {
  5373. _classCallCheck(this, Theme);
  5374. this.quill = quill;
  5375. this.options = options;
  5376. this.modules = {};
  5377. }
  5378. _createClass(Theme, [{
  5379. key: 'init',
  5380. value: function init() {
  5381. var _this = this;
  5382. Object.keys(this.options.modules).forEach(function (name) {
  5383. if (_this.modules[name] == null) {
  5384. _this.addModule(name);
  5385. }
  5386. });
  5387. }
  5388. }, {
  5389. key: 'addModule',
  5390. value: function addModule(name) {
  5391. var moduleClass = this.quill.constructor.import('modules/' + name);
  5392. this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {});
  5393. return this.modules[name];
  5394. }
  5395. }]);
  5396. return Theme;
  5397. }();
  5398. Theme.DEFAULTS = {
  5399. modules: {}
  5400. };
  5401. Theme.themes = {
  5402. 'default': Theme
  5403. };
  5404. exports.default = Theme;
  5405. /***/ }),
  5406. /* 35 */
  5407. /***/ (function(module, exports, __webpack_require__) {
  5408. "use strict";
  5409. Object.defineProperty(exports, "__esModule", {
  5410. value: true
  5411. });
  5412. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5413. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5414. var _parchment = __webpack_require__(0);
  5415. var _parchment2 = _interopRequireDefault(_parchment);
  5416. var _text = __webpack_require__(7);
  5417. var _text2 = _interopRequireDefault(_text);
  5418. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5419. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5420. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5421. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5422. var GUARD_TEXT = '\uFEFF';
  5423. var Embed = function (_Parchment$Embed) {
  5424. _inherits(Embed, _Parchment$Embed);
  5425. function Embed(node) {
  5426. _classCallCheck(this, Embed);
  5427. var _this = _possibleConstructorReturn(this, (Embed.__proto__ || Object.getPrototypeOf(Embed)).call(this, node));
  5428. _this.contentNode = document.createElement('span');
  5429. _this.contentNode.setAttribute('contenteditable', false);
  5430. [].slice.call(_this.domNode.childNodes).forEach(function (childNode) {
  5431. _this.contentNode.appendChild(childNode);
  5432. });
  5433. _this.leftGuard = document.createTextNode(GUARD_TEXT);
  5434. _this.rightGuard = document.createTextNode(GUARD_TEXT);
  5435. _this.domNode.appendChild(_this.leftGuard);
  5436. _this.domNode.appendChild(_this.contentNode);
  5437. _this.domNode.appendChild(_this.rightGuard);
  5438. return _this;
  5439. }
  5440. _createClass(Embed, [{
  5441. key: 'index',
  5442. value: function index(node, offset) {
  5443. if (node === this.leftGuard) return 0;
  5444. if (node === this.rightGuard) return 1;
  5445. return _get(Embed.prototype.__proto__ || Object.getPrototypeOf(Embed.prototype), 'index', this).call(this, node, offset);
  5446. }
  5447. }, {
  5448. key: 'restore',
  5449. value: function restore(node) {
  5450. var range = void 0,
  5451. textNode = void 0;
  5452. var text = node.data.split(GUARD_TEXT).join('');
  5453. if (node === this.leftGuard) {
  5454. if (this.prev instanceof _text2.default) {
  5455. var prevLength = this.prev.length();
  5456. this.prev.insertAt(prevLength, text);
  5457. range = {
  5458. startNode: this.prev.domNode,
  5459. startOffset: prevLength + text.length
  5460. };
  5461. } else {
  5462. textNode = document.createTextNode(text);
  5463. this.parent.insertBefore(_parchment2.default.create(textNode), this);
  5464. range = {
  5465. startNode: textNode,
  5466. startOffset: text.length
  5467. };
  5468. }
  5469. } else if (node === this.rightGuard) {
  5470. if (this.next instanceof _text2.default) {
  5471. this.next.insertAt(0, text);
  5472. range = {
  5473. startNode: this.next.domNode,
  5474. startOffset: text.length
  5475. };
  5476. } else {
  5477. textNode = document.createTextNode(text);
  5478. this.parent.insertBefore(_parchment2.default.create(textNode), this.next);
  5479. range = {
  5480. startNode: textNode,
  5481. startOffset: text.length
  5482. };
  5483. }
  5484. }
  5485. node.data = GUARD_TEXT;
  5486. return range;
  5487. }
  5488. }, {
  5489. key: 'update',
  5490. value: function update(mutations, context) {
  5491. var _this2 = this;
  5492. mutations.forEach(function (mutation) {
  5493. if (mutation.type === 'characterData' && (mutation.target === _this2.leftGuard || mutation.target === _this2.rightGuard)) {
  5494. var range = _this2.restore(mutation.target);
  5495. if (range) context.range = range;
  5496. }
  5497. });
  5498. }
  5499. }]);
  5500. return Embed;
  5501. }(_parchment2.default.Embed);
  5502. exports.default = Embed;
  5503. /***/ }),
  5504. /* 36 */
  5505. /***/ (function(module, exports, __webpack_require__) {
  5506. "use strict";
  5507. Object.defineProperty(exports, "__esModule", {
  5508. value: true
  5509. });
  5510. exports.AlignStyle = exports.AlignClass = exports.AlignAttribute = undefined;
  5511. var _parchment = __webpack_require__(0);
  5512. var _parchment2 = _interopRequireDefault(_parchment);
  5513. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5514. var config = {
  5515. scope: _parchment2.default.Scope.BLOCK,
  5516. whitelist: ['right', 'center', 'justify']
  5517. };
  5518. var AlignAttribute = new _parchment2.default.Attributor.Attribute('align', 'align', config);
  5519. var AlignClass = new _parchment2.default.Attributor.Class('align', 'ql-align', config);
  5520. var AlignStyle = new _parchment2.default.Attributor.Style('align', 'text-align', config);
  5521. exports.AlignAttribute = AlignAttribute;
  5522. exports.AlignClass = AlignClass;
  5523. exports.AlignStyle = AlignStyle;
  5524. /***/ }),
  5525. /* 37 */
  5526. /***/ (function(module, exports, __webpack_require__) {
  5527. "use strict";
  5528. Object.defineProperty(exports, "__esModule", {
  5529. value: true
  5530. });
  5531. exports.BackgroundStyle = exports.BackgroundClass = undefined;
  5532. var _parchment = __webpack_require__(0);
  5533. var _parchment2 = _interopRequireDefault(_parchment);
  5534. var _color = __webpack_require__(26);
  5535. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5536. var BackgroundClass = new _parchment2.default.Attributor.Class('background', 'ql-bg', {
  5537. scope: _parchment2.default.Scope.INLINE
  5538. });
  5539. var BackgroundStyle = new _color.ColorAttributor('background', 'background-color', {
  5540. scope: _parchment2.default.Scope.INLINE
  5541. });
  5542. exports.BackgroundClass = BackgroundClass;
  5543. exports.BackgroundStyle = BackgroundStyle;
  5544. /***/ }),
  5545. /* 38 */
  5546. /***/ (function(module, exports, __webpack_require__) {
  5547. "use strict";
  5548. Object.defineProperty(exports, "__esModule", {
  5549. value: true
  5550. });
  5551. exports.DirectionStyle = exports.DirectionClass = exports.DirectionAttribute = undefined;
  5552. var _parchment = __webpack_require__(0);
  5553. var _parchment2 = _interopRequireDefault(_parchment);
  5554. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5555. var config = {
  5556. scope: _parchment2.default.Scope.BLOCK,
  5557. whitelist: ['rtl']
  5558. };
  5559. var DirectionAttribute = new _parchment2.default.Attributor.Attribute('direction', 'dir', config);
  5560. var DirectionClass = new _parchment2.default.Attributor.Class('direction', 'ql-direction', config);
  5561. var DirectionStyle = new _parchment2.default.Attributor.Style('direction', 'direction', config);
  5562. exports.DirectionAttribute = DirectionAttribute;
  5563. exports.DirectionClass = DirectionClass;
  5564. exports.DirectionStyle = DirectionStyle;
  5565. /***/ }),
  5566. /* 39 */
  5567. /***/ (function(module, exports, __webpack_require__) {
  5568. "use strict";
  5569. Object.defineProperty(exports, "__esModule", {
  5570. value: true
  5571. });
  5572. exports.FontClass = exports.FontStyle = undefined;
  5573. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5574. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5575. var _parchment = __webpack_require__(0);
  5576. var _parchment2 = _interopRequireDefault(_parchment);
  5577. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5578. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5579. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5580. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5581. var config = {
  5582. scope: _parchment2.default.Scope.INLINE,
  5583. whitelist: ['serif', 'monospace']
  5584. };
  5585. var FontClass = new _parchment2.default.Attributor.Class('font', 'ql-font', config);
  5586. var FontStyleAttributor = function (_Parchment$Attributor) {
  5587. _inherits(FontStyleAttributor, _Parchment$Attributor);
  5588. function FontStyleAttributor() {
  5589. _classCallCheck(this, FontStyleAttributor);
  5590. return _possibleConstructorReturn(this, (FontStyleAttributor.__proto__ || Object.getPrototypeOf(FontStyleAttributor)).apply(this, arguments));
  5591. }
  5592. _createClass(FontStyleAttributor, [{
  5593. key: 'value',
  5594. value: function value(node) {
  5595. return _get(FontStyleAttributor.prototype.__proto__ || Object.getPrototypeOf(FontStyleAttributor.prototype), 'value', this).call(this, node).replace(/["']/g, '');
  5596. }
  5597. }]);
  5598. return FontStyleAttributor;
  5599. }(_parchment2.default.Attributor.Style);
  5600. var FontStyle = new FontStyleAttributor('font', 'font-family', config);
  5601. exports.FontStyle = FontStyle;
  5602. exports.FontClass = FontClass;
  5603. /***/ }),
  5604. /* 40 */
  5605. /***/ (function(module, exports, __webpack_require__) {
  5606. "use strict";
  5607. Object.defineProperty(exports, "__esModule", {
  5608. value: true
  5609. });
  5610. exports.SizeStyle = exports.SizeClass = undefined;
  5611. var _parchment = __webpack_require__(0);
  5612. var _parchment2 = _interopRequireDefault(_parchment);
  5613. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5614. var SizeClass = new _parchment2.default.Attributor.Class('size', 'ql-size', {
  5615. scope: _parchment2.default.Scope.INLINE,
  5616. whitelist: ['small', 'large', 'huge']
  5617. });
  5618. var SizeStyle = new _parchment2.default.Attributor.Style('size', 'font-size', {
  5619. scope: _parchment2.default.Scope.INLINE,
  5620. whitelist: ['10px', '18px', '32px']
  5621. });
  5622. exports.SizeClass = SizeClass;
  5623. exports.SizeStyle = SizeStyle;
  5624. /***/ }),
  5625. /* 41 */
  5626. /***/ (function(module, exports, __webpack_require__) {
  5627. "use strict";
  5628. module.exports = {
  5629. 'align': {
  5630. '': __webpack_require__(76),
  5631. 'center': __webpack_require__(77),
  5632. 'right': __webpack_require__(78),
  5633. 'justify': __webpack_require__(79)
  5634. },
  5635. 'background': __webpack_require__(80),
  5636. 'blockquote': __webpack_require__(81),
  5637. 'bold': __webpack_require__(82),
  5638. 'clean': __webpack_require__(83),
  5639. 'code': __webpack_require__(58),
  5640. 'code-block': __webpack_require__(58),
  5641. 'color': __webpack_require__(84),
  5642. 'direction': {
  5643. '': __webpack_require__(85),
  5644. 'rtl': __webpack_require__(86)
  5645. },
  5646. 'float': {
  5647. 'center': __webpack_require__(87),
  5648. 'full': __webpack_require__(88),
  5649. 'left': __webpack_require__(89),
  5650. 'right': __webpack_require__(90)
  5651. },
  5652. 'formula': __webpack_require__(91),
  5653. 'header': {
  5654. '1': __webpack_require__(92),
  5655. '2': __webpack_require__(93)
  5656. },
  5657. 'italic': __webpack_require__(94),
  5658. 'image': __webpack_require__(95),
  5659. 'indent': {
  5660. '+1': __webpack_require__(96),
  5661. '-1': __webpack_require__(97)
  5662. },
  5663. 'link': __webpack_require__(98),
  5664. 'list': {
  5665. 'ordered': __webpack_require__(99),
  5666. 'bullet': __webpack_require__(100),
  5667. 'check': __webpack_require__(101)
  5668. },
  5669. 'script': {
  5670. 'sub': __webpack_require__(102),
  5671. 'super': __webpack_require__(103)
  5672. },
  5673. 'strike': __webpack_require__(104),
  5674. 'underline': __webpack_require__(105),
  5675. 'video': __webpack_require__(106)
  5676. };
  5677. /***/ }),
  5678. /* 42 */
  5679. /***/ (function(module, exports, __webpack_require__) {
  5680. "use strict";
  5681. Object.defineProperty(exports, "__esModule", {
  5682. value: true
  5683. });
  5684. exports.getLastChangeIndex = exports.default = undefined;
  5685. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5686. var _parchment = __webpack_require__(0);
  5687. var _parchment2 = _interopRequireDefault(_parchment);
  5688. var _quill = __webpack_require__(5);
  5689. var _quill2 = _interopRequireDefault(_quill);
  5690. var _module = __webpack_require__(9);
  5691. var _module2 = _interopRequireDefault(_module);
  5692. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5693. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5694. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5695. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5696. var History = function (_Module) {
  5697. _inherits(History, _Module);
  5698. function History(quill, options) {
  5699. _classCallCheck(this, History);
  5700. var _this = _possibleConstructorReturn(this, (History.__proto__ || Object.getPrototypeOf(History)).call(this, quill, options));
  5701. _this.lastRecorded = 0;
  5702. _this.ignoreChange = false;
  5703. _this.clear();
  5704. _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (eventName, delta, oldDelta, source) {
  5705. if (eventName !== _quill2.default.events.TEXT_CHANGE || _this.ignoreChange) return;
  5706. if (!_this.options.userOnly || source === _quill2.default.sources.USER) {
  5707. _this.record(delta, oldDelta);
  5708. } else {
  5709. _this.transform(delta);
  5710. }
  5711. });
  5712. _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true }, _this.undo.bind(_this));
  5713. _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true, shiftKey: true }, _this.redo.bind(_this));
  5714. if (/Win/i.test(navigator.platform)) {
  5715. _this.quill.keyboard.addBinding({ key: 'Y', shortKey: true }, _this.redo.bind(_this));
  5716. }
  5717. return _this;
  5718. }
  5719. _createClass(History, [{
  5720. key: 'change',
  5721. value: function change(source, dest) {
  5722. if (this.stack[source].length === 0) return;
  5723. var delta = this.stack[source].pop();
  5724. this.stack[dest].push(delta);
  5725. this.lastRecorded = 0;
  5726. this.ignoreChange = true;
  5727. this.quill.updateContents(delta[source], _quill2.default.sources.USER);
  5728. this.ignoreChange = false;
  5729. var index = getLastChangeIndex(delta[source]);
  5730. this.quill.setSelection(index);
  5731. }
  5732. }, {
  5733. key: 'clear',
  5734. value: function clear() {
  5735. this.stack = { undo: [], redo: [] };
  5736. }
  5737. }, {
  5738. key: 'cutoff',
  5739. value: function cutoff() {
  5740. this.lastRecorded = 0;
  5741. }
  5742. }, {
  5743. key: 'record',
  5744. value: function record(changeDelta, oldDelta) {
  5745. if (changeDelta.ops.length === 0) return;
  5746. this.stack.redo = [];
  5747. var undoDelta = this.quill.getContents().diff(oldDelta);
  5748. var timestamp = Date.now();
  5749. if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) {
  5750. var delta = this.stack.undo.pop();
  5751. undoDelta = undoDelta.compose(delta.undo);
  5752. changeDelta = delta.redo.compose(changeDelta);
  5753. } else {
  5754. this.lastRecorded = timestamp;
  5755. }
  5756. this.stack.undo.push({
  5757. redo: changeDelta,
  5758. undo: undoDelta
  5759. });
  5760. if (this.stack.undo.length > this.options.maxStack) {
  5761. this.stack.undo.shift();
  5762. }
  5763. }
  5764. }, {
  5765. key: 'redo',
  5766. value: function redo() {
  5767. this.change('redo', 'undo');
  5768. }
  5769. }, {
  5770. key: 'transform',
  5771. value: function transform(delta) {
  5772. this.stack.undo.forEach(function (change) {
  5773. change.undo = delta.transform(change.undo, true);
  5774. change.redo = delta.transform(change.redo, true);
  5775. });
  5776. this.stack.redo.forEach(function (change) {
  5777. change.undo = delta.transform(change.undo, true);
  5778. change.redo = delta.transform(change.redo, true);
  5779. });
  5780. }
  5781. }, {
  5782. key: 'undo',
  5783. value: function undo() {
  5784. this.change('undo', 'redo');
  5785. }
  5786. }]);
  5787. return History;
  5788. }(_module2.default);
  5789. History.DEFAULTS = {
  5790. delay: 1000,
  5791. maxStack: 100,
  5792. userOnly: false
  5793. };
  5794. function endsWithNewlineChange(delta) {
  5795. var lastOp = delta.ops[delta.ops.length - 1];
  5796. if (lastOp == null) return false;
  5797. if (lastOp.insert != null) {
  5798. return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\n');
  5799. }
  5800. if (lastOp.attributes != null) {
  5801. return Object.keys(lastOp.attributes).some(function (attr) {
  5802. return _parchment2.default.query(attr, _parchment2.default.Scope.BLOCK) != null;
  5803. });
  5804. }
  5805. return false;
  5806. }
  5807. function getLastChangeIndex(delta) {
  5808. var deleteLength = delta.reduce(function (length, op) {
  5809. length += op.delete || 0;
  5810. return length;
  5811. }, 0);
  5812. var changeIndex = delta.length() - deleteLength;
  5813. if (endsWithNewlineChange(delta)) {
  5814. changeIndex -= 1;
  5815. }
  5816. return changeIndex;
  5817. }
  5818. exports.default = History;
  5819. exports.getLastChangeIndex = getLastChangeIndex;
  5820. /***/ }),
  5821. /* 43 */
  5822. /***/ (function(module, exports, __webpack_require__) {
  5823. "use strict";
  5824. Object.defineProperty(exports, "__esModule", {
  5825. value: true
  5826. });
  5827. exports.default = exports.BaseTooltip = undefined;
  5828. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5829. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5830. var _extend = __webpack_require__(3);
  5831. var _extend2 = _interopRequireDefault(_extend);
  5832. var _quillDelta = __webpack_require__(2);
  5833. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  5834. var _emitter = __webpack_require__(8);
  5835. var _emitter2 = _interopRequireDefault(_emitter);
  5836. var _keyboard = __webpack_require__(23);
  5837. var _keyboard2 = _interopRequireDefault(_keyboard);
  5838. var _theme = __webpack_require__(34);
  5839. var _theme2 = _interopRequireDefault(_theme);
  5840. var _colorPicker = __webpack_require__(59);
  5841. var _colorPicker2 = _interopRequireDefault(_colorPicker);
  5842. var _iconPicker = __webpack_require__(60);
  5843. var _iconPicker2 = _interopRequireDefault(_iconPicker);
  5844. var _picker = __webpack_require__(28);
  5845. var _picker2 = _interopRequireDefault(_picker);
  5846. var _tooltip = __webpack_require__(61);
  5847. var _tooltip2 = _interopRequireDefault(_tooltip);
  5848. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5849. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5850. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5851. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5852. var ALIGNS = [false, 'center', 'right', 'justify'];
  5853. var COLORS = ["#000000", "#e60000", "#ff9900", "#ffff00", "#008a00", "#0066cc", "#9933ff", "#ffffff", "#facccc", "#ffebcc", "#ffffcc", "#cce8cc", "#cce0f5", "#ebd6ff", "#bbbbbb", "#f06666", "#ffc266", "#ffff66", "#66b966", "#66a3e0", "#c285ff", "#888888", "#a10000", "#b26b00", "#b2b200", "#006100", "#0047b2", "#6b24b2", "#444444", "#5c0000", "#663d00", "#666600", "#003700", "#002966", "#3d1466"];
  5854. var FONTS = [false, 'serif', 'monospace'];
  5855. var HEADERS = ['1', '2', '3', false];
  5856. var SIZES = ['small', false, 'large', 'huge'];
  5857. var BaseTheme = function (_Theme) {
  5858. _inherits(BaseTheme, _Theme);
  5859. function BaseTheme(quill, options) {
  5860. _classCallCheck(this, BaseTheme);
  5861. var _this = _possibleConstructorReturn(this, (BaseTheme.__proto__ || Object.getPrototypeOf(BaseTheme)).call(this, quill, options));
  5862. var listener = function listener(e) {
  5863. if (!document.body.contains(quill.root)) {
  5864. return document.body.removeEventListener('click', listener);
  5865. }
  5866. if (_this.tooltip != null && !_this.tooltip.root.contains(e.target) && document.activeElement !== _this.tooltip.textbox && !_this.quill.hasFocus()) {
  5867. _this.tooltip.hide();
  5868. }
  5869. if (_this.pickers != null) {
  5870. _this.pickers.forEach(function (picker) {
  5871. if (!picker.container.contains(e.target)) {
  5872. picker.close();
  5873. }
  5874. });
  5875. }
  5876. };
  5877. quill.emitter.listenDOM('click', document.body, listener);
  5878. return _this;
  5879. }
  5880. _createClass(BaseTheme, [{
  5881. key: 'addModule',
  5882. value: function addModule(name) {
  5883. var module = _get(BaseTheme.prototype.__proto__ || Object.getPrototypeOf(BaseTheme.prototype), 'addModule', this).call(this, name);
  5884. if (name === 'toolbar') {
  5885. this.extendToolbar(module);
  5886. }
  5887. return module;
  5888. }
  5889. }, {
  5890. key: 'buildButtons',
  5891. value: function buildButtons(buttons, icons) {
  5892. buttons.forEach(function (button) {
  5893. var className = button.getAttribute('class') || '';
  5894. className.split(/\s+/).forEach(function (name) {
  5895. if (!name.startsWith('ql-')) return;
  5896. name = name.slice('ql-'.length);
  5897. if (icons[name] == null) return;
  5898. if (name === 'direction') {
  5899. button.innerHTML = icons[name][''] + icons[name]['rtl'];
  5900. } else if (typeof icons[name] === 'string') {
  5901. button.innerHTML = icons[name];
  5902. } else {
  5903. var value = button.value || '';
  5904. if (value != null && icons[name][value]) {
  5905. button.innerHTML = icons[name][value];
  5906. }
  5907. }
  5908. });
  5909. });
  5910. }
  5911. }, {
  5912. key: 'buildPickers',
  5913. value: function buildPickers(selects, icons) {
  5914. var _this2 = this;
  5915. this.pickers = selects.map(function (select) {
  5916. if (select.classList.contains('ql-align')) {
  5917. if (select.querySelector('option') == null) {
  5918. fillSelect(select, ALIGNS);
  5919. }
  5920. return new _iconPicker2.default(select, icons.align);
  5921. } else if (select.classList.contains('ql-background') || select.classList.contains('ql-color')) {
  5922. var format = select.classList.contains('ql-background') ? 'background' : 'color';
  5923. if (select.querySelector('option') == null) {
  5924. fillSelect(select, COLORS, format === 'background' ? '#ffffff' : '#000000');
  5925. }
  5926. return new _colorPicker2.default(select, icons[format]);
  5927. } else {
  5928. if (select.querySelector('option') == null) {
  5929. if (select.classList.contains('ql-font')) {
  5930. fillSelect(select, FONTS);
  5931. } else if (select.classList.contains('ql-header')) {
  5932. fillSelect(select, HEADERS);
  5933. } else if (select.classList.contains('ql-size')) {
  5934. fillSelect(select, SIZES);
  5935. }
  5936. }
  5937. return new _picker2.default(select);
  5938. }
  5939. });
  5940. var update = function update() {
  5941. _this2.pickers.forEach(function (picker) {
  5942. picker.update();
  5943. });
  5944. };
  5945. this.quill.on(_emitter2.default.events.EDITOR_CHANGE, update);
  5946. }
  5947. }]);
  5948. return BaseTheme;
  5949. }(_theme2.default);
  5950. BaseTheme.DEFAULTS = (0, _extend2.default)(true, {}, _theme2.default.DEFAULTS, {
  5951. modules: {
  5952. toolbar: {
  5953. handlers: {
  5954. formula: function formula() {
  5955. this.quill.theme.tooltip.edit('formula');
  5956. },
  5957. image: function image() {
  5958. var _this3 = this;
  5959. var fileInput = this.container.querySelector('input.ql-image[type=file]');
  5960. if (fileInput == null) {
  5961. fileInput = document.createElement('input');
  5962. fileInput.setAttribute('type', 'file');
  5963. fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');
  5964. fileInput.classList.add('ql-image');
  5965. fileInput.addEventListener('change', function () {
  5966. if (fileInput.files != null && fileInput.files[0] != null) {
  5967. var reader = new FileReader();
  5968. reader.onload = function (e) {
  5969. var range = _this3.quill.getSelection(true);
  5970. _this3.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert({ image: e.target.result }), _emitter2.default.sources.USER);
  5971. _this3.quill.setSelection(range.index + 1, _emitter2.default.sources.SILENT);
  5972. fileInput.value = "";
  5973. };
  5974. reader.readAsDataURL(fileInput.files[0]);
  5975. }
  5976. });
  5977. this.container.appendChild(fileInput);
  5978. }
  5979. fileInput.click();
  5980. },
  5981. video: function video() {
  5982. this.quill.theme.tooltip.edit('video');
  5983. }
  5984. }
  5985. }
  5986. }
  5987. });
  5988. var BaseTooltip = function (_Tooltip) {
  5989. _inherits(BaseTooltip, _Tooltip);
  5990. function BaseTooltip(quill, boundsContainer) {
  5991. _classCallCheck(this, BaseTooltip);
  5992. var _this4 = _possibleConstructorReturn(this, (BaseTooltip.__proto__ || Object.getPrototypeOf(BaseTooltip)).call(this, quill, boundsContainer));
  5993. _this4.textbox = _this4.root.querySelector('input[type="text"]');
  5994. _this4.listen();
  5995. return _this4;
  5996. }
  5997. _createClass(BaseTooltip, [{
  5998. key: 'listen',
  5999. value: function listen() {
  6000. var _this5 = this;
  6001. this.textbox.addEventListener('keydown', function (event) {
  6002. if (_keyboard2.default.match(event, 'enter')) {
  6003. _this5.save();
  6004. event.preventDefault();
  6005. } else if (_keyboard2.default.match(event, 'escape')) {
  6006. _this5.cancel();
  6007. event.preventDefault();
  6008. }
  6009. });
  6010. }
  6011. }, {
  6012. key: 'cancel',
  6013. value: function cancel() {
  6014. this.hide();
  6015. }
  6016. }, {
  6017. key: 'edit',
  6018. value: function edit() {
  6019. var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'link';
  6020. var preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  6021. this.root.classList.remove('ql-hidden');
  6022. this.root.classList.add('ql-editing');
  6023. if (preview != null) {
  6024. this.textbox.value = preview;
  6025. } else if (mode !== this.root.getAttribute('data-mode')) {
  6026. this.textbox.value = '';
  6027. }
  6028. this.position(this.quill.getBounds(this.quill.selection.savedRange));
  6029. this.textbox.select();
  6030. this.textbox.setAttribute('placeholder', this.textbox.getAttribute('data-' + mode) || '');
  6031. this.root.setAttribute('data-mode', mode);
  6032. }
  6033. }, {
  6034. key: 'restoreFocus',
  6035. value: function restoreFocus() {
  6036. var scrollTop = this.quill.scrollingContainer.scrollTop;
  6037. this.quill.focus();
  6038. this.quill.scrollingContainer.scrollTop = scrollTop;
  6039. }
  6040. }, {
  6041. key: 'save',
  6042. value: function save() {
  6043. var value = this.textbox.value;
  6044. switch (this.root.getAttribute('data-mode')) {
  6045. case 'link':
  6046. {
  6047. var scrollTop = this.quill.root.scrollTop;
  6048. if (this.linkRange) {
  6049. this.quill.formatText(this.linkRange, 'link', value, _emitter2.default.sources.USER);
  6050. delete this.linkRange;
  6051. } else {
  6052. this.restoreFocus();
  6053. this.quill.format('link', value, _emitter2.default.sources.USER);
  6054. }
  6055. this.quill.root.scrollTop = scrollTop;
  6056. break;
  6057. }
  6058. case 'video':
  6059. {
  6060. value = extractVideoUrl(value);
  6061. } // eslint-disable-next-line no-fallthrough
  6062. case 'formula':
  6063. {
  6064. if (!value) break;
  6065. var range = this.quill.getSelection(true);
  6066. if (range != null) {
  6067. var index = range.index + range.length;
  6068. this.quill.insertEmbed(index, this.root.getAttribute('data-mode'), value, _emitter2.default.sources.USER);
  6069. if (this.root.getAttribute('data-mode') === 'formula') {
  6070. this.quill.insertText(index + 1, ' ', _emitter2.default.sources.USER);
  6071. }
  6072. this.quill.setSelection(index + 2, _emitter2.default.sources.USER);
  6073. }
  6074. break;
  6075. }
  6076. default:
  6077. }
  6078. this.textbox.value = '';
  6079. this.hide();
  6080. }
  6081. }]);
  6082. return BaseTooltip;
  6083. }(_tooltip2.default);
  6084. function extractVideoUrl(url) {
  6085. var match = url.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/) || url.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);
  6086. if (match) {
  6087. return (match[1] || 'https') + '://www.youtube.com/embed/' + match[2] + '?showinfo=0';
  6088. }
  6089. if (match = url.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/)) {
  6090. // eslint-disable-line no-cond-assign
  6091. return (match[1] || 'https') + '://player.vimeo.com/video/' + match[2] + '/';
  6092. }
  6093. return url;
  6094. }
  6095. function fillSelect(select, values) {
  6096. var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  6097. values.forEach(function (value) {
  6098. var option = document.createElement('option');
  6099. if (value === defaultValue) {
  6100. option.setAttribute('selected', 'selected');
  6101. } else {
  6102. option.setAttribute('value', value);
  6103. }
  6104. select.appendChild(option);
  6105. });
  6106. }
  6107. exports.BaseTooltip = BaseTooltip;
  6108. exports.default = BaseTheme;
  6109. /***/ }),
  6110. /* 44 */
  6111. /***/ (function(module, exports, __webpack_require__) {
  6112. "use strict";
  6113. Object.defineProperty(exports, "__esModule", { value: true });
  6114. var LinkedList = /** @class */ (function () {
  6115. function LinkedList() {
  6116. this.head = this.tail = null;
  6117. this.length = 0;
  6118. }
  6119. LinkedList.prototype.append = function () {
  6120. var nodes = [];
  6121. for (var _i = 0; _i < arguments.length; _i++) {
  6122. nodes[_i] = arguments[_i];
  6123. }
  6124. this.insertBefore(nodes[0], null);
  6125. if (nodes.length > 1) {
  6126. this.append.apply(this, nodes.slice(1));
  6127. }
  6128. };
  6129. LinkedList.prototype.contains = function (node) {
  6130. var cur, next = this.iterator();
  6131. while ((cur = next())) {
  6132. if (cur === node)
  6133. return true;
  6134. }
  6135. return false;
  6136. };
  6137. LinkedList.prototype.insertBefore = function (node, refNode) {
  6138. if (!node)
  6139. return;
  6140. node.next = refNode;
  6141. if (refNode != null) {
  6142. node.prev = refNode.prev;
  6143. if (refNode.prev != null) {
  6144. refNode.prev.next = node;
  6145. }
  6146. refNode.prev = node;
  6147. if (refNode === this.head) {
  6148. this.head = node;
  6149. }
  6150. }
  6151. else if (this.tail != null) {
  6152. this.tail.next = node;
  6153. node.prev = this.tail;
  6154. this.tail = node;
  6155. }
  6156. else {
  6157. node.prev = null;
  6158. this.head = this.tail = node;
  6159. }
  6160. this.length += 1;
  6161. };
  6162. LinkedList.prototype.offset = function (target) {
  6163. var index = 0, cur = this.head;
  6164. while (cur != null) {
  6165. if (cur === target)
  6166. return index;
  6167. index += cur.length();
  6168. cur = cur.next;
  6169. }
  6170. return -1;
  6171. };
  6172. LinkedList.prototype.remove = function (node) {
  6173. if (!this.contains(node))
  6174. return;
  6175. if (node.prev != null)
  6176. node.prev.next = node.next;
  6177. if (node.next != null)
  6178. node.next.prev = node.prev;
  6179. if (node === this.head)
  6180. this.head = node.next;
  6181. if (node === this.tail)
  6182. this.tail = node.prev;
  6183. this.length -= 1;
  6184. };
  6185. LinkedList.prototype.iterator = function (curNode) {
  6186. if (curNode === void 0) { curNode = this.head; }
  6187. // TODO use yield when we can
  6188. return function () {
  6189. var ret = curNode;
  6190. if (curNode != null)
  6191. curNode = curNode.next;
  6192. return ret;
  6193. };
  6194. };
  6195. LinkedList.prototype.find = function (index, inclusive) {
  6196. if (inclusive === void 0) { inclusive = false; }
  6197. var cur, next = this.iterator();
  6198. while ((cur = next())) {
  6199. var length = cur.length();
  6200. if (index < length ||
  6201. (inclusive && index === length && (cur.next == null || cur.next.length() !== 0))) {
  6202. return [cur, index];
  6203. }
  6204. index -= length;
  6205. }
  6206. return [null, 0];
  6207. };
  6208. LinkedList.prototype.forEach = function (callback) {
  6209. var cur, next = this.iterator();
  6210. while ((cur = next())) {
  6211. callback(cur);
  6212. }
  6213. };
  6214. LinkedList.prototype.forEachAt = function (index, length, callback) {
  6215. if (length <= 0)
  6216. return;
  6217. var _a = this.find(index), startNode = _a[0], offset = _a[1];
  6218. var cur, curIndex = index - offset, next = this.iterator(startNode);
  6219. while ((cur = next()) && curIndex < index + length) {
  6220. var curLength = cur.length();
  6221. if (index > curIndex) {
  6222. callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index));
  6223. }
  6224. else {
  6225. callback(cur, 0, Math.min(curLength, index + length - curIndex));
  6226. }
  6227. curIndex += curLength;
  6228. }
  6229. };
  6230. LinkedList.prototype.map = function (callback) {
  6231. return this.reduce(function (memo, cur) {
  6232. memo.push(callback(cur));
  6233. return memo;
  6234. }, []);
  6235. };
  6236. LinkedList.prototype.reduce = function (callback, memo) {
  6237. var cur, next = this.iterator();
  6238. while ((cur = next())) {
  6239. memo = callback(memo, cur);
  6240. }
  6241. return memo;
  6242. };
  6243. return LinkedList;
  6244. }());
  6245. exports.default = LinkedList;
  6246. /***/ }),
  6247. /* 45 */
  6248. /***/ (function(module, exports, __webpack_require__) {
  6249. "use strict";
  6250. var __extends = (this && this.__extends) || (function () {
  6251. var extendStatics = Object.setPrototypeOf ||
  6252. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6253. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6254. return function (d, b) {
  6255. extendStatics(d, b);
  6256. function __() { this.constructor = d; }
  6257. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6258. };
  6259. })();
  6260. Object.defineProperty(exports, "__esModule", { value: true });
  6261. var container_1 = __webpack_require__(17);
  6262. var Registry = __webpack_require__(1);
  6263. var OBSERVER_CONFIG = {
  6264. attributes: true,
  6265. characterData: true,
  6266. characterDataOldValue: true,
  6267. childList: true,
  6268. subtree: true,
  6269. };
  6270. var MAX_OPTIMIZE_ITERATIONS = 100;
  6271. var ScrollBlot = /** @class */ (function (_super) {
  6272. __extends(ScrollBlot, _super);
  6273. function ScrollBlot(node) {
  6274. var _this = _super.call(this, node) || this;
  6275. _this.scroll = _this;
  6276. _this.observer = new MutationObserver(function (mutations) {
  6277. _this.update(mutations);
  6278. });
  6279. _this.observer.observe(_this.domNode, OBSERVER_CONFIG);
  6280. _this.attach();
  6281. return _this;
  6282. }
  6283. ScrollBlot.prototype.detach = function () {
  6284. _super.prototype.detach.call(this);
  6285. this.observer.disconnect();
  6286. };
  6287. ScrollBlot.prototype.deleteAt = function (index, length) {
  6288. this.update();
  6289. if (index === 0 && length === this.length()) {
  6290. this.children.forEach(function (child) {
  6291. child.remove();
  6292. });
  6293. }
  6294. else {
  6295. _super.prototype.deleteAt.call(this, index, length);
  6296. }
  6297. };
  6298. ScrollBlot.prototype.formatAt = function (index, length, name, value) {
  6299. this.update();
  6300. _super.prototype.formatAt.call(this, index, length, name, value);
  6301. };
  6302. ScrollBlot.prototype.insertAt = function (index, value, def) {
  6303. this.update();
  6304. _super.prototype.insertAt.call(this, index, value, def);
  6305. };
  6306. ScrollBlot.prototype.optimize = function (mutations, context) {
  6307. var _this = this;
  6308. if (mutations === void 0) { mutations = []; }
  6309. if (context === void 0) { context = {}; }
  6310. _super.prototype.optimize.call(this, context);
  6311. // We must modify mutations directly, cannot make copy and then modify
  6312. var records = [].slice.call(this.observer.takeRecords());
  6313. // Array.push currently seems to be implemented by a non-tail recursive function
  6314. // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords());
  6315. while (records.length > 0)
  6316. mutations.push(records.pop());
  6317. // TODO use WeakMap
  6318. var mark = function (blot, markParent) {
  6319. if (markParent === void 0) { markParent = true; }
  6320. if (blot == null || blot === _this)
  6321. return;
  6322. if (blot.domNode.parentNode == null)
  6323. return;
  6324. // @ts-ignore
  6325. if (blot.domNode[Registry.DATA_KEY].mutations == null) {
  6326. // @ts-ignore
  6327. blot.domNode[Registry.DATA_KEY].mutations = [];
  6328. }
  6329. if (markParent)
  6330. mark(blot.parent);
  6331. };
  6332. var optimize = function (blot) {
  6333. // Post-order traversal
  6334. if (
  6335. // @ts-ignore
  6336. blot.domNode[Registry.DATA_KEY] == null ||
  6337. // @ts-ignore
  6338. blot.domNode[Registry.DATA_KEY].mutations == null) {
  6339. return;
  6340. }
  6341. if (blot instanceof container_1.default) {
  6342. blot.children.forEach(optimize);
  6343. }
  6344. blot.optimize(context);
  6345. };
  6346. var remaining = mutations;
  6347. for (var i = 0; remaining.length > 0; i += 1) {
  6348. if (i >= MAX_OPTIMIZE_ITERATIONS) {
  6349. throw new Error('[Parchment] Maximum optimize iterations reached');
  6350. }
  6351. remaining.forEach(function (mutation) {
  6352. var blot = Registry.find(mutation.target, true);
  6353. if (blot == null)
  6354. return;
  6355. if (blot.domNode === mutation.target) {
  6356. if (mutation.type === 'childList') {
  6357. mark(Registry.find(mutation.previousSibling, false));
  6358. [].forEach.call(mutation.addedNodes, function (node) {
  6359. var child = Registry.find(node, false);
  6360. mark(child, false);
  6361. if (child instanceof container_1.default) {
  6362. child.children.forEach(function (grandChild) {
  6363. mark(grandChild, false);
  6364. });
  6365. }
  6366. });
  6367. }
  6368. else if (mutation.type === 'attributes') {
  6369. mark(blot.prev);
  6370. }
  6371. }
  6372. mark(blot);
  6373. });
  6374. this.children.forEach(optimize);
  6375. remaining = [].slice.call(this.observer.takeRecords());
  6376. records = remaining.slice();
  6377. while (records.length > 0)
  6378. mutations.push(records.pop());
  6379. }
  6380. };
  6381. ScrollBlot.prototype.update = function (mutations, context) {
  6382. var _this = this;
  6383. if (context === void 0) { context = {}; }
  6384. mutations = mutations || this.observer.takeRecords();
  6385. // TODO use WeakMap
  6386. mutations
  6387. .map(function (mutation) {
  6388. var blot = Registry.find(mutation.target, true);
  6389. if (blot == null)
  6390. return null;
  6391. // @ts-ignore
  6392. if (blot.domNode[Registry.DATA_KEY].mutations == null) {
  6393. // @ts-ignore
  6394. blot.domNode[Registry.DATA_KEY].mutations = [mutation];
  6395. return blot;
  6396. }
  6397. else {
  6398. // @ts-ignore
  6399. blot.domNode[Registry.DATA_KEY].mutations.push(mutation);
  6400. return null;
  6401. }
  6402. })
  6403. .forEach(function (blot) {
  6404. if (blot == null ||
  6405. blot === _this ||
  6406. //@ts-ignore
  6407. blot.domNode[Registry.DATA_KEY] == null)
  6408. return;
  6409. // @ts-ignore
  6410. blot.update(blot.domNode[Registry.DATA_KEY].mutations || [], context);
  6411. });
  6412. // @ts-ignore
  6413. if (this.domNode[Registry.DATA_KEY].mutations != null) {
  6414. // @ts-ignore
  6415. _super.prototype.update.call(this, this.domNode[Registry.DATA_KEY].mutations, context);
  6416. }
  6417. this.optimize(mutations, context);
  6418. };
  6419. ScrollBlot.blotName = 'scroll';
  6420. ScrollBlot.defaultChild = 'block';
  6421. ScrollBlot.scope = Registry.Scope.BLOCK_BLOT;
  6422. ScrollBlot.tagName = 'DIV';
  6423. return ScrollBlot;
  6424. }(container_1.default));
  6425. exports.default = ScrollBlot;
  6426. /***/ }),
  6427. /* 46 */
  6428. /***/ (function(module, exports, __webpack_require__) {
  6429. "use strict";
  6430. var __extends = (this && this.__extends) || (function () {
  6431. var extendStatics = Object.setPrototypeOf ||
  6432. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6433. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6434. return function (d, b) {
  6435. extendStatics(d, b);
  6436. function __() { this.constructor = d; }
  6437. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6438. };
  6439. })();
  6440. Object.defineProperty(exports, "__esModule", { value: true });
  6441. var format_1 = __webpack_require__(18);
  6442. var Registry = __webpack_require__(1);
  6443. // Shallow object comparison
  6444. function isEqual(obj1, obj2) {
  6445. if (Object.keys(obj1).length !== Object.keys(obj2).length)
  6446. return false;
  6447. // @ts-ignore
  6448. for (var prop in obj1) {
  6449. // @ts-ignore
  6450. if (obj1[prop] !== obj2[prop])
  6451. return false;
  6452. }
  6453. return true;
  6454. }
  6455. var InlineBlot = /** @class */ (function (_super) {
  6456. __extends(InlineBlot, _super);
  6457. function InlineBlot() {
  6458. return _super !== null && _super.apply(this, arguments) || this;
  6459. }
  6460. InlineBlot.formats = function (domNode) {
  6461. if (domNode.tagName === InlineBlot.tagName)
  6462. return undefined;
  6463. return _super.formats.call(this, domNode);
  6464. };
  6465. InlineBlot.prototype.format = function (name, value) {
  6466. var _this = this;
  6467. if (name === this.statics.blotName && !value) {
  6468. this.children.forEach(function (child) {
  6469. if (!(child instanceof format_1.default)) {
  6470. child = child.wrap(InlineBlot.blotName, true);
  6471. }
  6472. _this.attributes.copy(child);
  6473. });
  6474. this.unwrap();
  6475. }
  6476. else {
  6477. _super.prototype.format.call(this, name, value);
  6478. }
  6479. };
  6480. InlineBlot.prototype.formatAt = function (index, length, name, value) {
  6481. if (this.formats()[name] != null || Registry.query(name, Registry.Scope.ATTRIBUTE)) {
  6482. var blot = this.isolate(index, length);
  6483. blot.format(name, value);
  6484. }
  6485. else {
  6486. _super.prototype.formatAt.call(this, index, length, name, value);
  6487. }
  6488. };
  6489. InlineBlot.prototype.optimize = function (context) {
  6490. _super.prototype.optimize.call(this, context);
  6491. var formats = this.formats();
  6492. if (Object.keys(formats).length === 0) {
  6493. return this.unwrap(); // unformatted span
  6494. }
  6495. var next = this.next;
  6496. if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) {
  6497. next.moveChildren(this);
  6498. next.remove();
  6499. }
  6500. };
  6501. InlineBlot.blotName = 'inline';
  6502. InlineBlot.scope = Registry.Scope.INLINE_BLOT;
  6503. InlineBlot.tagName = 'SPAN';
  6504. return InlineBlot;
  6505. }(format_1.default));
  6506. exports.default = InlineBlot;
  6507. /***/ }),
  6508. /* 47 */
  6509. /***/ (function(module, exports, __webpack_require__) {
  6510. "use strict";
  6511. var __extends = (this && this.__extends) || (function () {
  6512. var extendStatics = Object.setPrototypeOf ||
  6513. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6514. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6515. return function (d, b) {
  6516. extendStatics(d, b);
  6517. function __() { this.constructor = d; }
  6518. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6519. };
  6520. })();
  6521. Object.defineProperty(exports, "__esModule", { value: true });
  6522. var format_1 = __webpack_require__(18);
  6523. var Registry = __webpack_require__(1);
  6524. var BlockBlot = /** @class */ (function (_super) {
  6525. __extends(BlockBlot, _super);
  6526. function BlockBlot() {
  6527. return _super !== null && _super.apply(this, arguments) || this;
  6528. }
  6529. BlockBlot.formats = function (domNode) {
  6530. var tagName = Registry.query(BlockBlot.blotName).tagName;
  6531. if (domNode.tagName === tagName)
  6532. return undefined;
  6533. return _super.formats.call(this, domNode);
  6534. };
  6535. BlockBlot.prototype.format = function (name, value) {
  6536. if (Registry.query(name, Registry.Scope.BLOCK) == null) {
  6537. return;
  6538. }
  6539. else if (name === this.statics.blotName && !value) {
  6540. this.replaceWith(BlockBlot.blotName);
  6541. }
  6542. else {
  6543. _super.prototype.format.call(this, name, value);
  6544. }
  6545. };
  6546. BlockBlot.prototype.formatAt = function (index, length, name, value) {
  6547. if (Registry.query(name, Registry.Scope.BLOCK) != null) {
  6548. this.format(name, value);
  6549. }
  6550. else {
  6551. _super.prototype.formatAt.call(this, index, length, name, value);
  6552. }
  6553. };
  6554. BlockBlot.prototype.insertAt = function (index, value, def) {
  6555. if (def == null || Registry.query(value, Registry.Scope.INLINE) != null) {
  6556. // Insert text or inline
  6557. _super.prototype.insertAt.call(this, index, value, def);
  6558. }
  6559. else {
  6560. var after = this.split(index);
  6561. var blot = Registry.create(value, def);
  6562. after.parent.insertBefore(blot, after);
  6563. }
  6564. };
  6565. BlockBlot.prototype.update = function (mutations, context) {
  6566. if (navigator.userAgent.match(/Trident/)) {
  6567. this.build();
  6568. }
  6569. else {
  6570. _super.prototype.update.call(this, mutations, context);
  6571. }
  6572. };
  6573. BlockBlot.blotName = 'block';
  6574. BlockBlot.scope = Registry.Scope.BLOCK_BLOT;
  6575. BlockBlot.tagName = 'P';
  6576. return BlockBlot;
  6577. }(format_1.default));
  6578. exports.default = BlockBlot;
  6579. /***/ }),
  6580. /* 48 */
  6581. /***/ (function(module, exports, __webpack_require__) {
  6582. "use strict";
  6583. var __extends = (this && this.__extends) || (function () {
  6584. var extendStatics = Object.setPrototypeOf ||
  6585. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6586. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6587. return function (d, b) {
  6588. extendStatics(d, b);
  6589. function __() { this.constructor = d; }
  6590. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6591. };
  6592. })();
  6593. Object.defineProperty(exports, "__esModule", { value: true });
  6594. var leaf_1 = __webpack_require__(19);
  6595. var EmbedBlot = /** @class */ (function (_super) {
  6596. __extends(EmbedBlot, _super);
  6597. function EmbedBlot() {
  6598. return _super !== null && _super.apply(this, arguments) || this;
  6599. }
  6600. EmbedBlot.formats = function (domNode) {
  6601. return undefined;
  6602. };
  6603. EmbedBlot.prototype.format = function (name, value) {
  6604. // super.formatAt wraps, which is what we want in general,
  6605. // but this allows subclasses to overwrite for formats
  6606. // that just apply to particular embeds
  6607. _super.prototype.formatAt.call(this, 0, this.length(), name, value);
  6608. };
  6609. EmbedBlot.prototype.formatAt = function (index, length, name, value) {
  6610. if (index === 0 && length === this.length()) {
  6611. this.format(name, value);
  6612. }
  6613. else {
  6614. _super.prototype.formatAt.call(this, index, length, name, value);
  6615. }
  6616. };
  6617. EmbedBlot.prototype.formats = function () {
  6618. return this.statics.formats(this.domNode);
  6619. };
  6620. return EmbedBlot;
  6621. }(leaf_1.default));
  6622. exports.default = EmbedBlot;
  6623. /***/ }),
  6624. /* 49 */
  6625. /***/ (function(module, exports, __webpack_require__) {
  6626. "use strict";
  6627. var __extends = (this && this.__extends) || (function () {
  6628. var extendStatics = Object.setPrototypeOf ||
  6629. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6630. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6631. return function (d, b) {
  6632. extendStatics(d, b);
  6633. function __() { this.constructor = d; }
  6634. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6635. };
  6636. })();
  6637. Object.defineProperty(exports, "__esModule", { value: true });
  6638. var leaf_1 = __webpack_require__(19);
  6639. var Registry = __webpack_require__(1);
  6640. var TextBlot = /** @class */ (function (_super) {
  6641. __extends(TextBlot, _super);
  6642. function TextBlot(node) {
  6643. var _this = _super.call(this, node) || this;
  6644. _this.text = _this.statics.value(_this.domNode);
  6645. return _this;
  6646. }
  6647. TextBlot.create = function (value) {
  6648. return document.createTextNode(value);
  6649. };
  6650. TextBlot.value = function (domNode) {
  6651. var text = domNode.data;
  6652. // @ts-ignore
  6653. if (text['normalize'])
  6654. text = text['normalize']();
  6655. return text;
  6656. };
  6657. TextBlot.prototype.deleteAt = function (index, length) {
  6658. this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length);
  6659. };
  6660. TextBlot.prototype.index = function (node, offset) {
  6661. if (this.domNode === node) {
  6662. return offset;
  6663. }
  6664. return -1;
  6665. };
  6666. TextBlot.prototype.insertAt = function (index, value, def) {
  6667. if (def == null) {
  6668. this.text = this.text.slice(0, index) + value + this.text.slice(index);
  6669. this.domNode.data = this.text;
  6670. }
  6671. else {
  6672. _super.prototype.insertAt.call(this, index, value, def);
  6673. }
  6674. };
  6675. TextBlot.prototype.length = function () {
  6676. return this.text.length;
  6677. };
  6678. TextBlot.prototype.optimize = function (context) {
  6679. _super.prototype.optimize.call(this, context);
  6680. this.text = this.statics.value(this.domNode);
  6681. if (this.text.length === 0) {
  6682. this.remove();
  6683. }
  6684. else if (this.next instanceof TextBlot && this.next.prev === this) {
  6685. this.insertAt(this.length(), this.next.value());
  6686. this.next.remove();
  6687. }
  6688. };
  6689. TextBlot.prototype.position = function (index, inclusive) {
  6690. if (inclusive === void 0) { inclusive = false; }
  6691. return [this.domNode, index];
  6692. };
  6693. TextBlot.prototype.split = function (index, force) {
  6694. if (force === void 0) { force = false; }
  6695. if (!force) {
  6696. if (index === 0)
  6697. return this;
  6698. if (index === this.length())
  6699. return this.next;
  6700. }
  6701. var after = Registry.create(this.domNode.splitText(index));
  6702. this.parent.insertBefore(after, this.next);
  6703. this.text = this.statics.value(this.domNode);
  6704. return after;
  6705. };
  6706. TextBlot.prototype.update = function (mutations, context) {
  6707. var _this = this;
  6708. if (mutations.some(function (mutation) {
  6709. return mutation.type === 'characterData' && mutation.target === _this.domNode;
  6710. })) {
  6711. this.text = this.statics.value(this.domNode);
  6712. }
  6713. };
  6714. TextBlot.prototype.value = function () {
  6715. return this.text;
  6716. };
  6717. TextBlot.blotName = 'text';
  6718. TextBlot.scope = Registry.Scope.INLINE_BLOT;
  6719. return TextBlot;
  6720. }(leaf_1.default));
  6721. exports.default = TextBlot;
  6722. /***/ }),
  6723. /* 50 */
  6724. /***/ (function(module, exports, __webpack_require__) {
  6725. "use strict";
  6726. var elem = document.createElement('div');
  6727. elem.classList.toggle('test-class', false);
  6728. if (elem.classList.contains('test-class')) {
  6729. var _toggle = DOMTokenList.prototype.toggle;
  6730. DOMTokenList.prototype.toggle = function (token, force) {
  6731. if (arguments.length > 1 && !this.contains(token) === !force) {
  6732. return force;
  6733. } else {
  6734. return _toggle.call(this, token);
  6735. }
  6736. };
  6737. }
  6738. if (!String.prototype.startsWith) {
  6739. String.prototype.startsWith = function (searchString, position) {
  6740. position = position || 0;
  6741. return this.substr(position, searchString.length) === searchString;
  6742. };
  6743. }
  6744. if (!String.prototype.endsWith) {
  6745. String.prototype.endsWith = function (searchString, position) {
  6746. var subjectString = this.toString();
  6747. if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
  6748. position = subjectString.length;
  6749. }
  6750. position -= searchString.length;
  6751. var lastIndex = subjectString.indexOf(searchString, position);
  6752. return lastIndex !== -1 && lastIndex === position;
  6753. };
  6754. }
  6755. if (!Array.prototype.find) {
  6756. Object.defineProperty(Array.prototype, "find", {
  6757. value: function value(predicate) {
  6758. if (this === null) {
  6759. throw new TypeError('Array.prototype.find called on null or undefined');
  6760. }
  6761. if (typeof predicate !== 'function') {
  6762. throw new TypeError('predicate must be a function');
  6763. }
  6764. var list = Object(this);
  6765. var length = list.length >>> 0;
  6766. var thisArg = arguments[1];
  6767. var value;
  6768. for (var i = 0; i < length; i++) {
  6769. value = list[i];
  6770. if (predicate.call(thisArg, value, i, list)) {
  6771. return value;
  6772. }
  6773. }
  6774. return undefined;
  6775. }
  6776. });
  6777. }
  6778. document.addEventListener("DOMContentLoaded", function () {
  6779. // Disable resizing in Firefox
  6780. document.execCommand("enableObjectResizing", false, false);
  6781. // Disable automatic linkifying in IE11
  6782. document.execCommand("autoUrlDetect", false, false);
  6783. });
  6784. /***/ }),
  6785. /* 51 */
  6786. /***/ (function(module, exports) {
  6787. /**
  6788. * This library modifies the diff-patch-match library by Neil Fraser
  6789. * by removing the patch and match functionality and certain advanced
  6790. * options in the diff function. The original license is as follows:
  6791. *
  6792. * ===
  6793. *
  6794. * Diff Match and Patch
  6795. *
  6796. * Copyright 2006 Google Inc.
  6797. * http://code.google.com/p/google-diff-match-patch/
  6798. *
  6799. * Licensed under the Apache License, Version 2.0 (the "License");
  6800. * you may not use this file except in compliance with the License.
  6801. * You may obtain a copy of the License at
  6802. *
  6803. * http://www.apache.org/licenses/LICENSE-2.0
  6804. *
  6805. * Unless required by applicable law or agreed to in writing, software
  6806. * distributed under the License is distributed on an "AS IS" BASIS,
  6807. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  6808. * See the License for the specific language governing permissions and
  6809. * limitations under the License.
  6810. */
  6811. /**
  6812. * The data structure representing a diff is an array of tuples:
  6813. * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
  6814. * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
  6815. */
  6816. var DIFF_DELETE = -1;
  6817. var DIFF_INSERT = 1;
  6818. var DIFF_EQUAL = 0;
  6819. /**
  6820. * Find the differences between two texts. Simplifies the problem by stripping
  6821. * any common prefix or suffix off the texts before diffing.
  6822. * @param {string} text1 Old string to be diffed.
  6823. * @param {string} text2 New string to be diffed.
  6824. * @param {Int} cursor_pos Expected edit position in text1 (optional)
  6825. * @return {Array} Array of diff tuples.
  6826. */
  6827. function diff_main(text1, text2, cursor_pos) {
  6828. // Check for equality (speedup).
  6829. if (text1 == text2) {
  6830. if (text1) {
  6831. return [[DIFF_EQUAL, text1]];
  6832. }
  6833. return [];
  6834. }
  6835. // Check cursor_pos within bounds
  6836. if (cursor_pos < 0 || text1.length < cursor_pos) {
  6837. cursor_pos = null;
  6838. }
  6839. // Trim off common prefix (speedup).
  6840. var commonlength = diff_commonPrefix(text1, text2);
  6841. var commonprefix = text1.substring(0, commonlength);
  6842. text1 = text1.substring(commonlength);
  6843. text2 = text2.substring(commonlength);
  6844. // Trim off common suffix (speedup).
  6845. commonlength = diff_commonSuffix(text1, text2);
  6846. var commonsuffix = text1.substring(text1.length - commonlength);
  6847. text1 = text1.substring(0, text1.length - commonlength);
  6848. text2 = text2.substring(0, text2.length - commonlength);
  6849. // Compute the diff on the middle block.
  6850. var diffs = diff_compute_(text1, text2);
  6851. // Restore the prefix and suffix.
  6852. if (commonprefix) {
  6853. diffs.unshift([DIFF_EQUAL, commonprefix]);
  6854. }
  6855. if (commonsuffix) {
  6856. diffs.push([DIFF_EQUAL, commonsuffix]);
  6857. }
  6858. diff_cleanupMerge(diffs);
  6859. if (cursor_pos != null) {
  6860. diffs = fix_cursor(diffs, cursor_pos);
  6861. }
  6862. diffs = fix_emoji(diffs);
  6863. return diffs;
  6864. };
  6865. /**
  6866. * Find the differences between two texts. Assumes that the texts do not
  6867. * have any common prefix or suffix.
  6868. * @param {string} text1 Old string to be diffed.
  6869. * @param {string} text2 New string to be diffed.
  6870. * @return {Array} Array of diff tuples.
  6871. */
  6872. function diff_compute_(text1, text2) {
  6873. var diffs;
  6874. if (!text1) {
  6875. // Just add some text (speedup).
  6876. return [[DIFF_INSERT, text2]];
  6877. }
  6878. if (!text2) {
  6879. // Just delete some text (speedup).
  6880. return [[DIFF_DELETE, text1]];
  6881. }
  6882. var longtext = text1.length > text2.length ? text1 : text2;
  6883. var shorttext = text1.length > text2.length ? text2 : text1;
  6884. var i = longtext.indexOf(shorttext);
  6885. if (i != -1) {
  6886. // Shorter text is inside the longer text (speedup).
  6887. diffs = [[DIFF_INSERT, longtext.substring(0, i)],
  6888. [DIFF_EQUAL, shorttext],
  6889. [DIFF_INSERT, longtext.substring(i + shorttext.length)]];
  6890. // Swap insertions for deletions if diff is reversed.
  6891. if (text1.length > text2.length) {
  6892. diffs[0][0] = diffs[2][0] = DIFF_DELETE;
  6893. }
  6894. return diffs;
  6895. }
  6896. if (shorttext.length == 1) {
  6897. // Single character string.
  6898. // After the previous speedup, the character can't be an equality.
  6899. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  6900. }
  6901. // Check to see if the problem can be split in two.
  6902. var hm = diff_halfMatch_(text1, text2);
  6903. if (hm) {
  6904. // A half-match was found, sort out the return data.
  6905. var text1_a = hm[0];
  6906. var text1_b = hm[1];
  6907. var text2_a = hm[2];
  6908. var text2_b = hm[3];
  6909. var mid_common = hm[4];
  6910. // Send both pairs off for separate processing.
  6911. var diffs_a = diff_main(text1_a, text2_a);
  6912. var diffs_b = diff_main(text1_b, text2_b);
  6913. // Merge the results.
  6914. return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
  6915. }
  6916. return diff_bisect_(text1, text2);
  6917. };
  6918. /**
  6919. * Find the 'middle snake' of a diff, split the problem in two
  6920. * and return the recursively constructed diff.
  6921. * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
  6922. * @param {string} text1 Old string to be diffed.
  6923. * @param {string} text2 New string to be diffed.
  6924. * @return {Array} Array of diff tuples.
  6925. * @private
  6926. */
  6927. function diff_bisect_(text1, text2) {
  6928. // Cache the text lengths to prevent multiple calls.
  6929. var text1_length = text1.length;
  6930. var text2_length = text2.length;
  6931. var max_d = Math.ceil((text1_length + text2_length) / 2);
  6932. var v_offset = max_d;
  6933. var v_length = 2 * max_d;
  6934. var v1 = new Array(v_length);
  6935. var v2 = new Array(v_length);
  6936. // Setting all elements to -1 is faster in Chrome & Firefox than mixing
  6937. // integers and undefined.
  6938. for (var x = 0; x < v_length; x++) {
  6939. v1[x] = -1;
  6940. v2[x] = -1;
  6941. }
  6942. v1[v_offset + 1] = 0;
  6943. v2[v_offset + 1] = 0;
  6944. var delta = text1_length - text2_length;
  6945. // If the total number of characters is odd, then the front path will collide
  6946. // with the reverse path.
  6947. var front = (delta % 2 != 0);
  6948. // Offsets for start and end of k loop.
  6949. // Prevents mapping of space beyond the grid.
  6950. var k1start = 0;
  6951. var k1end = 0;
  6952. var k2start = 0;
  6953. var k2end = 0;
  6954. for (var d = 0; d < max_d; d++) {
  6955. // Walk the front path one step.
  6956. for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
  6957. var k1_offset = v_offset + k1;
  6958. var x1;
  6959. if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
  6960. x1 = v1[k1_offset + 1];
  6961. } else {
  6962. x1 = v1[k1_offset - 1] + 1;
  6963. }
  6964. var y1 = x1 - k1;
  6965. while (x1 < text1_length && y1 < text2_length &&
  6966. text1.charAt(x1) == text2.charAt(y1)) {
  6967. x1++;
  6968. y1++;
  6969. }
  6970. v1[k1_offset] = x1;
  6971. if (x1 > text1_length) {
  6972. // Ran off the right of the graph.
  6973. k1end += 2;
  6974. } else if (y1 > text2_length) {
  6975. // Ran off the bottom of the graph.
  6976. k1start += 2;
  6977. } else if (front) {
  6978. var k2_offset = v_offset + delta - k1;
  6979. if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
  6980. // Mirror x2 onto top-left coordinate system.
  6981. var x2 = text1_length - v2[k2_offset];
  6982. if (x1 >= x2) {
  6983. // Overlap detected.
  6984. return diff_bisectSplit_(text1, text2, x1, y1);
  6985. }
  6986. }
  6987. }
  6988. }
  6989. // Walk the reverse path one step.
  6990. for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
  6991. var k2_offset = v_offset + k2;
  6992. var x2;
  6993. if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
  6994. x2 = v2[k2_offset + 1];
  6995. } else {
  6996. x2 = v2[k2_offset - 1] + 1;
  6997. }
  6998. var y2 = x2 - k2;
  6999. while (x2 < text1_length && y2 < text2_length &&
  7000. text1.charAt(text1_length - x2 - 1) ==
  7001. text2.charAt(text2_length - y2 - 1)) {
  7002. x2++;
  7003. y2++;
  7004. }
  7005. v2[k2_offset] = x2;
  7006. if (x2 > text1_length) {
  7007. // Ran off the left of the graph.
  7008. k2end += 2;
  7009. } else if (y2 > text2_length) {
  7010. // Ran off the top of the graph.
  7011. k2start += 2;
  7012. } else if (!front) {
  7013. var k1_offset = v_offset + delta - k2;
  7014. if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
  7015. var x1 = v1[k1_offset];
  7016. var y1 = v_offset + x1 - k1_offset;
  7017. // Mirror x2 onto top-left coordinate system.
  7018. x2 = text1_length - x2;
  7019. if (x1 >= x2) {
  7020. // Overlap detected.
  7021. return diff_bisectSplit_(text1, text2, x1, y1);
  7022. }
  7023. }
  7024. }
  7025. }
  7026. }
  7027. // Diff took too long and hit the deadline or
  7028. // number of diffs equals number of characters, no commonality at all.
  7029. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  7030. };
  7031. /**
  7032. * Given the location of the 'middle snake', split the diff in two parts
  7033. * and recurse.
  7034. * @param {string} text1 Old string to be diffed.
  7035. * @param {string} text2 New string to be diffed.
  7036. * @param {number} x Index of split point in text1.
  7037. * @param {number} y Index of split point in text2.
  7038. * @return {Array} Array of diff tuples.
  7039. */
  7040. function diff_bisectSplit_(text1, text2, x, y) {
  7041. var text1a = text1.substring(0, x);
  7042. var text2a = text2.substring(0, y);
  7043. var text1b = text1.substring(x);
  7044. var text2b = text2.substring(y);
  7045. // Compute both diffs serially.
  7046. var diffs = diff_main(text1a, text2a);
  7047. var diffsb = diff_main(text1b, text2b);
  7048. return diffs.concat(diffsb);
  7049. };
  7050. /**
  7051. * Determine the common prefix of two strings.
  7052. * @param {string} text1 First string.
  7053. * @param {string} text2 Second string.
  7054. * @return {number} The number of characters common to the start of each
  7055. * string.
  7056. */
  7057. function diff_commonPrefix(text1, text2) {
  7058. // Quick check for common null cases.
  7059. if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
  7060. return 0;
  7061. }
  7062. // Binary search.
  7063. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  7064. var pointermin = 0;
  7065. var pointermax = Math.min(text1.length, text2.length);
  7066. var pointermid = pointermax;
  7067. var pointerstart = 0;
  7068. while (pointermin < pointermid) {
  7069. if (text1.substring(pointerstart, pointermid) ==
  7070. text2.substring(pointerstart, pointermid)) {
  7071. pointermin = pointermid;
  7072. pointerstart = pointermin;
  7073. } else {
  7074. pointermax = pointermid;
  7075. }
  7076. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  7077. }
  7078. return pointermid;
  7079. };
  7080. /**
  7081. * Determine the common suffix of two strings.
  7082. * @param {string} text1 First string.
  7083. * @param {string} text2 Second string.
  7084. * @return {number} The number of characters common to the end of each string.
  7085. */
  7086. function diff_commonSuffix(text1, text2) {
  7087. // Quick check for common null cases.
  7088. if (!text1 || !text2 ||
  7089. text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
  7090. return 0;
  7091. }
  7092. // Binary search.
  7093. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  7094. var pointermin = 0;
  7095. var pointermax = Math.min(text1.length, text2.length);
  7096. var pointermid = pointermax;
  7097. var pointerend = 0;
  7098. while (pointermin < pointermid) {
  7099. if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==
  7100. text2.substring(text2.length - pointermid, text2.length - pointerend)) {
  7101. pointermin = pointermid;
  7102. pointerend = pointermin;
  7103. } else {
  7104. pointermax = pointermid;
  7105. }
  7106. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  7107. }
  7108. return pointermid;
  7109. };
  7110. /**
  7111. * Do the two texts share a substring which is at least half the length of the
  7112. * longer text?
  7113. * This speedup can produce non-minimal diffs.
  7114. * @param {string} text1 First string.
  7115. * @param {string} text2 Second string.
  7116. * @return {Array.<string>} Five element Array, containing the prefix of
  7117. * text1, the suffix of text1, the prefix of text2, the suffix of
  7118. * text2 and the common middle. Or null if there was no match.
  7119. */
  7120. function diff_halfMatch_(text1, text2) {
  7121. var longtext = text1.length > text2.length ? text1 : text2;
  7122. var shorttext = text1.length > text2.length ? text2 : text1;
  7123. if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
  7124. return null; // Pointless.
  7125. }
  7126. /**
  7127. * Does a substring of shorttext exist within longtext such that the substring
  7128. * is at least half the length of longtext?
  7129. * Closure, but does not reference any external variables.
  7130. * @param {string} longtext Longer string.
  7131. * @param {string} shorttext Shorter string.
  7132. * @param {number} i Start index of quarter length substring within longtext.
  7133. * @return {Array.<string>} Five element Array, containing the prefix of
  7134. * longtext, the suffix of longtext, the prefix of shorttext, the suffix
  7135. * of shorttext and the common middle. Or null if there was no match.
  7136. * @private
  7137. */
  7138. function diff_halfMatchI_(longtext, shorttext, i) {
  7139. // Start with a 1/4 length substring at position i as a seed.
  7140. var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
  7141. var j = -1;
  7142. var best_common = '';
  7143. var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
  7144. while ((j = shorttext.indexOf(seed, j + 1)) != -1) {
  7145. var prefixLength = diff_commonPrefix(longtext.substring(i),
  7146. shorttext.substring(j));
  7147. var suffixLength = diff_commonSuffix(longtext.substring(0, i),
  7148. shorttext.substring(0, j));
  7149. if (best_common.length < suffixLength + prefixLength) {
  7150. best_common = shorttext.substring(j - suffixLength, j) +
  7151. shorttext.substring(j, j + prefixLength);
  7152. best_longtext_a = longtext.substring(0, i - suffixLength);
  7153. best_longtext_b = longtext.substring(i + prefixLength);
  7154. best_shorttext_a = shorttext.substring(0, j - suffixLength);
  7155. best_shorttext_b = shorttext.substring(j + prefixLength);
  7156. }
  7157. }
  7158. if (best_common.length * 2 >= longtext.length) {
  7159. return [best_longtext_a, best_longtext_b,
  7160. best_shorttext_a, best_shorttext_b, best_common];
  7161. } else {
  7162. return null;
  7163. }
  7164. }
  7165. // First check if the second quarter is the seed for a half-match.
  7166. var hm1 = diff_halfMatchI_(longtext, shorttext,
  7167. Math.ceil(longtext.length / 4));
  7168. // Check again based on the third quarter.
  7169. var hm2 = diff_halfMatchI_(longtext, shorttext,
  7170. Math.ceil(longtext.length / 2));
  7171. var hm;
  7172. if (!hm1 && !hm2) {
  7173. return null;
  7174. } else if (!hm2) {
  7175. hm = hm1;
  7176. } else if (!hm1) {
  7177. hm = hm2;
  7178. } else {
  7179. // Both matched. Select the longest.
  7180. hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
  7181. }
  7182. // A half-match was found, sort out the return data.
  7183. var text1_a, text1_b, text2_a, text2_b;
  7184. if (text1.length > text2.length) {
  7185. text1_a = hm[0];
  7186. text1_b = hm[1];
  7187. text2_a = hm[2];
  7188. text2_b = hm[3];
  7189. } else {
  7190. text2_a = hm[0];
  7191. text2_b = hm[1];
  7192. text1_a = hm[2];
  7193. text1_b = hm[3];
  7194. }
  7195. var mid_common = hm[4];
  7196. return [text1_a, text1_b, text2_a, text2_b, mid_common];
  7197. };
  7198. /**
  7199. * Reorder and merge like edit sections. Merge equalities.
  7200. * Any edit section can move as long as it doesn't cross an equality.
  7201. * @param {Array} diffs Array of diff tuples.
  7202. */
  7203. function diff_cleanupMerge(diffs) {
  7204. diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
  7205. var pointer = 0;
  7206. var count_delete = 0;
  7207. var count_insert = 0;
  7208. var text_delete = '';
  7209. var text_insert = '';
  7210. var commonlength;
  7211. while (pointer < diffs.length) {
  7212. switch (diffs[pointer][0]) {
  7213. case DIFF_INSERT:
  7214. count_insert++;
  7215. text_insert += diffs[pointer][1];
  7216. pointer++;
  7217. break;
  7218. case DIFF_DELETE:
  7219. count_delete++;
  7220. text_delete += diffs[pointer][1];
  7221. pointer++;
  7222. break;
  7223. case DIFF_EQUAL:
  7224. // Upon reaching an equality, check for prior redundancies.
  7225. if (count_delete + count_insert > 1) {
  7226. if (count_delete !== 0 && count_insert !== 0) {
  7227. // Factor out any common prefixies.
  7228. commonlength = diff_commonPrefix(text_insert, text_delete);
  7229. if (commonlength !== 0) {
  7230. if ((pointer - count_delete - count_insert) > 0 &&
  7231. diffs[pointer - count_delete - count_insert - 1][0] ==
  7232. DIFF_EQUAL) {
  7233. diffs[pointer - count_delete - count_insert - 1][1] +=
  7234. text_insert.substring(0, commonlength);
  7235. } else {
  7236. diffs.splice(0, 0, [DIFF_EQUAL,
  7237. text_insert.substring(0, commonlength)]);
  7238. pointer++;
  7239. }
  7240. text_insert = text_insert.substring(commonlength);
  7241. text_delete = text_delete.substring(commonlength);
  7242. }
  7243. // Factor out any common suffixies.
  7244. commonlength = diff_commonSuffix(text_insert, text_delete);
  7245. if (commonlength !== 0) {
  7246. diffs[pointer][1] = text_insert.substring(text_insert.length -
  7247. commonlength) + diffs[pointer][1];
  7248. text_insert = text_insert.substring(0, text_insert.length -
  7249. commonlength);
  7250. text_delete = text_delete.substring(0, text_delete.length -
  7251. commonlength);
  7252. }
  7253. }
  7254. // Delete the offending records and add the merged ones.
  7255. if (count_delete === 0) {
  7256. diffs.splice(pointer - count_insert,
  7257. count_delete + count_insert, [DIFF_INSERT, text_insert]);
  7258. } else if (count_insert === 0) {
  7259. diffs.splice(pointer - count_delete,
  7260. count_delete + count_insert, [DIFF_DELETE, text_delete]);
  7261. } else {
  7262. diffs.splice(pointer - count_delete - count_insert,
  7263. count_delete + count_insert, [DIFF_DELETE, text_delete],
  7264. [DIFF_INSERT, text_insert]);
  7265. }
  7266. pointer = pointer - count_delete - count_insert +
  7267. (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
  7268. } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
  7269. // Merge this equality with the previous one.
  7270. diffs[pointer - 1][1] += diffs[pointer][1];
  7271. diffs.splice(pointer, 1);
  7272. } else {
  7273. pointer++;
  7274. }
  7275. count_insert = 0;
  7276. count_delete = 0;
  7277. text_delete = '';
  7278. text_insert = '';
  7279. break;
  7280. }
  7281. }
  7282. if (diffs[diffs.length - 1][1] === '') {
  7283. diffs.pop(); // Remove the dummy entry at the end.
  7284. }
  7285. // Second pass: look for single edits surrounded on both sides by equalities
  7286. // which can be shifted sideways to eliminate an equality.
  7287. // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
  7288. var changes = false;
  7289. pointer = 1;
  7290. // Intentionally ignore the first and last element (don't need checking).
  7291. while (pointer < diffs.length - 1) {
  7292. if (diffs[pointer - 1][0] == DIFF_EQUAL &&
  7293. diffs[pointer + 1][0] == DIFF_EQUAL) {
  7294. // This is a single edit surrounded by equalities.
  7295. if (diffs[pointer][1].substring(diffs[pointer][1].length -
  7296. diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
  7297. // Shift the edit over the previous equality.
  7298. diffs[pointer][1] = diffs[pointer - 1][1] +
  7299. diffs[pointer][1].substring(0, diffs[pointer][1].length -
  7300. diffs[pointer - 1][1].length);
  7301. diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
  7302. diffs.splice(pointer - 1, 1);
  7303. changes = true;
  7304. } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==
  7305. diffs[pointer + 1][1]) {
  7306. // Shift the edit over the next equality.
  7307. diffs[pointer - 1][1] += diffs[pointer + 1][1];
  7308. diffs[pointer][1] =
  7309. diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
  7310. diffs[pointer + 1][1];
  7311. diffs.splice(pointer + 1, 1);
  7312. changes = true;
  7313. }
  7314. }
  7315. pointer++;
  7316. }
  7317. // If shifts were made, the diff needs reordering and another shift sweep.
  7318. if (changes) {
  7319. diff_cleanupMerge(diffs);
  7320. }
  7321. };
  7322. var diff = diff_main;
  7323. diff.INSERT = DIFF_INSERT;
  7324. diff.DELETE = DIFF_DELETE;
  7325. diff.EQUAL = DIFF_EQUAL;
  7326. module.exports = diff;
  7327. /*
  7328. * Modify a diff such that the cursor position points to the start of a change:
  7329. * E.g.
  7330. * cursor_normalize_diff([[DIFF_EQUAL, 'abc']], 1)
  7331. * => [1, [[DIFF_EQUAL, 'a'], [DIFF_EQUAL, 'bc']]]
  7332. * cursor_normalize_diff([[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xyz']], 2)
  7333. * => [2, [[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xy'], [DIFF_DELETE, 'z']]]
  7334. *
  7335. * @param {Array} diffs Array of diff tuples
  7336. * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
  7337. * @return {Array} A tuple [cursor location in the modified diff, modified diff]
  7338. */
  7339. function cursor_normalize_diff (diffs, cursor_pos) {
  7340. if (cursor_pos === 0) {
  7341. return [DIFF_EQUAL, diffs];
  7342. }
  7343. for (var current_pos = 0, i = 0; i < diffs.length; i++) {
  7344. var d = diffs[i];
  7345. if (d[0] === DIFF_DELETE || d[0] === DIFF_EQUAL) {
  7346. var next_pos = current_pos + d[1].length;
  7347. if (cursor_pos === next_pos) {
  7348. return [i + 1, diffs];
  7349. } else if (cursor_pos < next_pos) {
  7350. // copy to prevent side effects
  7351. diffs = diffs.slice();
  7352. // split d into two diff changes
  7353. var split_pos = cursor_pos - current_pos;
  7354. var d_left = [d[0], d[1].slice(0, split_pos)];
  7355. var d_right = [d[0], d[1].slice(split_pos)];
  7356. diffs.splice(i, 1, d_left, d_right);
  7357. return [i + 1, diffs];
  7358. } else {
  7359. current_pos = next_pos;
  7360. }
  7361. }
  7362. }
  7363. throw new Error('cursor_pos is out of bounds!')
  7364. }
  7365. /*
  7366. * Modify a diff such that the edit position is "shifted" to the proposed edit location (cursor_position).
  7367. *
  7368. * Case 1)
  7369. * Check if a naive shift is possible:
  7370. * [0, X], [ 1, Y] -> [ 1, Y], [0, X] (if X + Y === Y + X)
  7371. * [0, X], [-1, Y] -> [-1, Y], [0, X] (if X + Y === Y + X) - holds same result
  7372. * Case 2)
  7373. * Check if the following shifts are possible:
  7374. * [0, 'pre'], [ 1, 'prefix'] -> [ 1, 'pre'], [0, 'pre'], [ 1, 'fix']
  7375. * [0, 'pre'], [-1, 'prefix'] -> [-1, 'pre'], [0, 'pre'], [-1, 'fix']
  7376. * ^ ^
  7377. * d d_next
  7378. *
  7379. * @param {Array} diffs Array of diff tuples
  7380. * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
  7381. * @return {Array} Array of diff tuples
  7382. */
  7383. function fix_cursor (diffs, cursor_pos) {
  7384. var norm = cursor_normalize_diff(diffs, cursor_pos);
  7385. var ndiffs = norm[1];
  7386. var cursor_pointer = norm[0];
  7387. var d = ndiffs[cursor_pointer];
  7388. var d_next = ndiffs[cursor_pointer + 1];
  7389. if (d == null) {
  7390. // Text was deleted from end of original string,
  7391. // cursor is now out of bounds in new string
  7392. return diffs;
  7393. } else if (d[0] !== DIFF_EQUAL) {
  7394. // A modification happened at the cursor location.
  7395. // This is the expected outcome, so we can return the original diff.
  7396. return diffs;
  7397. } else {
  7398. if (d_next != null && d[1] + d_next[1] === d_next[1] + d[1]) {
  7399. // Case 1)
  7400. // It is possible to perform a naive shift
  7401. ndiffs.splice(cursor_pointer, 2, d_next, d)
  7402. return merge_tuples(ndiffs, cursor_pointer, 2)
  7403. } else if (d_next != null && d_next[1].indexOf(d[1]) === 0) {
  7404. // Case 2)
  7405. // d[1] is a prefix of d_next[1]
  7406. // We can assume that d_next[0] !== 0, since d[0] === 0
  7407. // Shift edit locations..
  7408. ndiffs.splice(cursor_pointer, 2, [d_next[0], d[1]], [0, d[1]]);
  7409. var suffix = d_next[1].slice(d[1].length);
  7410. if (suffix.length > 0) {
  7411. ndiffs.splice(cursor_pointer + 2, 0, [d_next[0], suffix]);
  7412. }
  7413. return merge_tuples(ndiffs, cursor_pointer, 3)
  7414. } else {
  7415. // Not possible to perform any modification
  7416. return diffs;
  7417. }
  7418. }
  7419. }
  7420. /*
  7421. * Check diff did not split surrogate pairs.
  7422. * Ex. [0, '\uD83D'], [-1, '\uDC36'], [1, '\uDC2F'] -> [-1, '\uD83D\uDC36'], [1, '\uD83D\uDC2F']
  7423. * '\uD83D\uDC36' === '🐶', '\uD83D\uDC2F' === '🐯'
  7424. *
  7425. * @param {Array} diffs Array of diff tuples
  7426. * @return {Array} Array of diff tuples
  7427. */
  7428. function fix_emoji (diffs) {
  7429. var compact = false;
  7430. var starts_with_pair_end = function(str) {
  7431. return str.charCodeAt(0) >= 0xDC00 && str.charCodeAt(0) <= 0xDFFF;
  7432. }
  7433. var ends_with_pair_start = function(str) {
  7434. return str.charCodeAt(str.length-1) >= 0xD800 && str.charCodeAt(str.length-1) <= 0xDBFF;
  7435. }
  7436. for (var i = 2; i < diffs.length; i += 1) {
  7437. if (diffs[i-2][0] === DIFF_EQUAL && ends_with_pair_start(diffs[i-2][1]) &&
  7438. diffs[i-1][0] === DIFF_DELETE && starts_with_pair_end(diffs[i-1][1]) &&
  7439. diffs[i][0] === DIFF_INSERT && starts_with_pair_end(diffs[i][1])) {
  7440. compact = true;
  7441. diffs[i-1][1] = diffs[i-2][1].slice(-1) + diffs[i-1][1];
  7442. diffs[i][1] = diffs[i-2][1].slice(-1) + diffs[i][1];
  7443. diffs[i-2][1] = diffs[i-2][1].slice(0, -1);
  7444. }
  7445. }
  7446. if (!compact) {
  7447. return diffs;
  7448. }
  7449. var fixed_diffs = [];
  7450. for (var i = 0; i < diffs.length; i += 1) {
  7451. if (diffs[i][1].length > 0) {
  7452. fixed_diffs.push(diffs[i]);
  7453. }
  7454. }
  7455. return fixed_diffs;
  7456. }
  7457. /*
  7458. * Try to merge tuples with their neigbors in a given range.
  7459. * E.g. [0, 'a'], [0, 'b'] -> [0, 'ab']
  7460. *
  7461. * @param {Array} diffs Array of diff tuples.
  7462. * @param {Int} start Position of the first element to merge (diffs[start] is also merged with diffs[start - 1]).
  7463. * @param {Int} length Number of consecutive elements to check.
  7464. * @return {Array} Array of merged diff tuples.
  7465. */
  7466. function merge_tuples (diffs, start, length) {
  7467. // Check from (start-1) to (start+length).
  7468. for (var i = start + length - 1; i >= 0 && i >= start - 1; i--) {
  7469. if (i + 1 < diffs.length) {
  7470. var left_d = diffs[i];
  7471. var right_d = diffs[i+1];
  7472. if (left_d[0] === right_d[1]) {
  7473. diffs.splice(i, 2, [left_d[0], left_d[1] + right_d[1]]);
  7474. }
  7475. }
  7476. }
  7477. return diffs;
  7478. }
  7479. /***/ }),
  7480. /* 52 */
  7481. /***/ (function(module, exports) {
  7482. exports = module.exports = typeof Object.keys === 'function'
  7483. ? Object.keys : shim;
  7484. exports.shim = shim;
  7485. function shim (obj) {
  7486. var keys = [];
  7487. for (var key in obj) keys.push(key);
  7488. return keys;
  7489. }
  7490. /***/ }),
  7491. /* 53 */
  7492. /***/ (function(module, exports) {
  7493. var supportsArgumentsClass = (function(){
  7494. return Object.prototype.toString.call(arguments)
  7495. })() == '[object Arguments]';
  7496. exports = module.exports = supportsArgumentsClass ? supported : unsupported;
  7497. exports.supported = supported;
  7498. function supported(object) {
  7499. return Object.prototype.toString.call(object) == '[object Arguments]';
  7500. };
  7501. exports.unsupported = unsupported;
  7502. function unsupported(object){
  7503. return object &&
  7504. typeof object == 'object' &&
  7505. typeof object.length == 'number' &&
  7506. Object.prototype.hasOwnProperty.call(object, 'callee') &&
  7507. !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
  7508. false;
  7509. };
  7510. /***/ }),
  7511. /* 54 */
  7512. /***/ (function(module, exports) {
  7513. 'use strict';
  7514. var has = Object.prototype.hasOwnProperty
  7515. , prefix = '~';
  7516. /**
  7517. * Constructor to create a storage for our `EE` objects.
  7518. * An `Events` instance is a plain object whose properties are event names.
  7519. *
  7520. * @constructor
  7521. * @api private
  7522. */
  7523. function Events() {}
  7524. //
  7525. // We try to not inherit from `Object.prototype`. In some engines creating an
  7526. // instance in this way is faster than calling `Object.create(null)` directly.
  7527. // If `Object.create(null)` is not supported we prefix the event names with a
  7528. // character to make sure that the built-in object properties are not
  7529. // overridden or used as an attack vector.
  7530. //
  7531. if (Object.create) {
  7532. Events.prototype = Object.create(null);
  7533. //
  7534. // This hack is needed because the `__proto__` property is still inherited in
  7535. // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
  7536. //
  7537. if (!new Events().__proto__) prefix = false;
  7538. }
  7539. /**
  7540. * Representation of a single event listener.
  7541. *
  7542. * @param {Function} fn The listener function.
  7543. * @param {Mixed} context The context to invoke the listener with.
  7544. * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
  7545. * @constructor
  7546. * @api private
  7547. */
  7548. function EE(fn, context, once) {
  7549. this.fn = fn;
  7550. this.context = context;
  7551. this.once = once || false;
  7552. }
  7553. /**
  7554. * Minimal `EventEmitter` interface that is molded against the Node.js
  7555. * `EventEmitter` interface.
  7556. *
  7557. * @constructor
  7558. * @api public
  7559. */
  7560. function EventEmitter() {
  7561. this._events = new Events();
  7562. this._eventsCount = 0;
  7563. }
  7564. /**
  7565. * Return an array listing the events for which the emitter has registered
  7566. * listeners.
  7567. *
  7568. * @returns {Array}
  7569. * @api public
  7570. */
  7571. EventEmitter.prototype.eventNames = function eventNames() {
  7572. var names = []
  7573. , events
  7574. , name;
  7575. if (this._eventsCount === 0) return names;
  7576. for (name in (events = this._events)) {
  7577. if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
  7578. }
  7579. if (Object.getOwnPropertySymbols) {
  7580. return names.concat(Object.getOwnPropertySymbols(events));
  7581. }
  7582. return names;
  7583. };
  7584. /**
  7585. * Return the listeners registered for a given event.
  7586. *
  7587. * @param {String|Symbol} event The event name.
  7588. * @param {Boolean} exists Only check if there are listeners.
  7589. * @returns {Array|Boolean}
  7590. * @api public
  7591. */
  7592. EventEmitter.prototype.listeners = function listeners(event, exists) {
  7593. var evt = prefix ? prefix + event : event
  7594. , available = this._events[evt];
  7595. if (exists) return !!available;
  7596. if (!available) return [];
  7597. if (available.fn) return [available.fn];
  7598. for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
  7599. ee[i] = available[i].fn;
  7600. }
  7601. return ee;
  7602. };
  7603. /**
  7604. * Calls each of the listeners registered for a given event.
  7605. *
  7606. * @param {String|Symbol} event The event name.
  7607. * @returns {Boolean} `true` if the event had listeners, else `false`.
  7608. * @api public
  7609. */
  7610. EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
  7611. var evt = prefix ? prefix + event : event;
  7612. if (!this._events[evt]) return false;
  7613. var listeners = this._events[evt]
  7614. , len = arguments.length
  7615. , args
  7616. , i;
  7617. if (listeners.fn) {
  7618. if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
  7619. switch (len) {
  7620. case 1: return listeners.fn.call(listeners.context), true;
  7621. case 2: return listeners.fn.call(listeners.context, a1), true;
  7622. case 3: return listeners.fn.call(listeners.context, a1, a2), true;
  7623. case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
  7624. case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
  7625. case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
  7626. }
  7627. for (i = 1, args = new Array(len -1); i < len; i++) {
  7628. args[i - 1] = arguments[i];
  7629. }
  7630. listeners.fn.apply(listeners.context, args);
  7631. } else {
  7632. var length = listeners.length
  7633. , j;
  7634. for (i = 0; i < length; i++) {
  7635. if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
  7636. switch (len) {
  7637. case 1: listeners[i].fn.call(listeners[i].context); break;
  7638. case 2: listeners[i].fn.call(listeners[i].context, a1); break;
  7639. case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
  7640. case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
  7641. default:
  7642. if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
  7643. args[j - 1] = arguments[j];
  7644. }
  7645. listeners[i].fn.apply(listeners[i].context, args);
  7646. }
  7647. }
  7648. }
  7649. return true;
  7650. };
  7651. /**
  7652. * Add a listener for a given event.
  7653. *
  7654. * @param {String|Symbol} event The event name.
  7655. * @param {Function} fn The listener function.
  7656. * @param {Mixed} [context=this] The context to invoke the listener with.
  7657. * @returns {EventEmitter} `this`.
  7658. * @api public
  7659. */
  7660. EventEmitter.prototype.on = function on(event, fn, context) {
  7661. var listener = new EE(fn, context || this)
  7662. , evt = prefix ? prefix + event : event;
  7663. if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
  7664. else if (!this._events[evt].fn) this._events[evt].push(listener);
  7665. else this._events[evt] = [this._events[evt], listener];
  7666. return this;
  7667. };
  7668. /**
  7669. * Add a one-time listener for a given event.
  7670. *
  7671. * @param {String|Symbol} event The event name.
  7672. * @param {Function} fn The listener function.
  7673. * @param {Mixed} [context=this] The context to invoke the listener with.
  7674. * @returns {EventEmitter} `this`.
  7675. * @api public
  7676. */
  7677. EventEmitter.prototype.once = function once(event, fn, context) {
  7678. var listener = new EE(fn, context || this, true)
  7679. , evt = prefix ? prefix + event : event;
  7680. if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
  7681. else if (!this._events[evt].fn) this._events[evt].push(listener);
  7682. else this._events[evt] = [this._events[evt], listener];
  7683. return this;
  7684. };
  7685. /**
  7686. * Remove the listeners of a given event.
  7687. *
  7688. * @param {String|Symbol} event The event name.
  7689. * @param {Function} fn Only remove the listeners that match this function.
  7690. * @param {Mixed} context Only remove the listeners that have this context.
  7691. * @param {Boolean} once Only remove one-time listeners.
  7692. * @returns {EventEmitter} `this`.
  7693. * @api public
  7694. */
  7695. EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
  7696. var evt = prefix ? prefix + event : event;
  7697. if (!this._events[evt]) return this;
  7698. if (!fn) {
  7699. if (--this._eventsCount === 0) this._events = new Events();
  7700. else delete this._events[evt];
  7701. return this;
  7702. }
  7703. var listeners = this._events[evt];
  7704. if (listeners.fn) {
  7705. if (
  7706. listeners.fn === fn
  7707. && (!once || listeners.once)
  7708. && (!context || listeners.context === context)
  7709. ) {
  7710. if (--this._eventsCount === 0) this._events = new Events();
  7711. else delete this._events[evt];
  7712. }
  7713. } else {
  7714. for (var i = 0, events = [], length = listeners.length; i < length; i++) {
  7715. if (
  7716. listeners[i].fn !== fn
  7717. || (once && !listeners[i].once)
  7718. || (context && listeners[i].context !== context)
  7719. ) {
  7720. events.push(listeners[i]);
  7721. }
  7722. }
  7723. //
  7724. // Reset the array, or remove it completely if we have no more listeners.
  7725. //
  7726. if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
  7727. else if (--this._eventsCount === 0) this._events = new Events();
  7728. else delete this._events[evt];
  7729. }
  7730. return this;
  7731. };
  7732. /**
  7733. * Remove all listeners, or those of the specified event.
  7734. *
  7735. * @param {String|Symbol} [event] The event name.
  7736. * @returns {EventEmitter} `this`.
  7737. * @api public
  7738. */
  7739. EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
  7740. var evt;
  7741. if (event) {
  7742. evt = prefix ? prefix + event : event;
  7743. if (this._events[evt]) {
  7744. if (--this._eventsCount === 0) this._events = new Events();
  7745. else delete this._events[evt];
  7746. }
  7747. } else {
  7748. this._events = new Events();
  7749. this._eventsCount = 0;
  7750. }
  7751. return this;
  7752. };
  7753. //
  7754. // Alias methods names because people roll like that.
  7755. //
  7756. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  7757. EventEmitter.prototype.addListener = EventEmitter.prototype.on;
  7758. //
  7759. // This function doesn't apply anymore.
  7760. //
  7761. EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
  7762. return this;
  7763. };
  7764. //
  7765. // Expose the prefix.
  7766. //
  7767. EventEmitter.prefixed = prefix;
  7768. //
  7769. // Allow `EventEmitter` to be imported as module namespace.
  7770. //
  7771. EventEmitter.EventEmitter = EventEmitter;
  7772. //
  7773. // Expose the module.
  7774. //
  7775. if ('undefined' !== typeof module) {
  7776. module.exports = EventEmitter;
  7777. }
  7778. /***/ }),
  7779. /* 55 */
  7780. /***/ (function(module, exports, __webpack_require__) {
  7781. "use strict";
  7782. Object.defineProperty(exports, "__esModule", {
  7783. value: true
  7784. });
  7785. exports.matchText = exports.matchSpacing = exports.matchNewline = exports.matchBlot = exports.matchAttributor = exports.default = undefined;
  7786. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  7787. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  7788. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7789. var _extend2 = __webpack_require__(3);
  7790. var _extend3 = _interopRequireDefault(_extend2);
  7791. var _quillDelta = __webpack_require__(2);
  7792. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  7793. var _parchment = __webpack_require__(0);
  7794. var _parchment2 = _interopRequireDefault(_parchment);
  7795. var _quill = __webpack_require__(5);
  7796. var _quill2 = _interopRequireDefault(_quill);
  7797. var _logger = __webpack_require__(10);
  7798. var _logger2 = _interopRequireDefault(_logger);
  7799. var _module = __webpack_require__(9);
  7800. var _module2 = _interopRequireDefault(_module);
  7801. var _align = __webpack_require__(36);
  7802. var _background = __webpack_require__(37);
  7803. var _code = __webpack_require__(13);
  7804. var _code2 = _interopRequireDefault(_code);
  7805. var _color = __webpack_require__(26);
  7806. var _direction = __webpack_require__(38);
  7807. var _font = __webpack_require__(39);
  7808. var _size = __webpack_require__(40);
  7809. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7810. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  7811. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7812. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7813. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7814. var debug = (0, _logger2.default)('quill:clipboard');
  7815. var DOM_KEY = '__ql-matcher';
  7816. var CLIPBOARD_CONFIG = [[Node.TEXT_NODE, matchText], [Node.TEXT_NODE, matchNewline], ['br', matchBreak], [Node.ELEMENT_NODE, matchNewline], [Node.ELEMENT_NODE, matchBlot], [Node.ELEMENT_NODE, matchSpacing], [Node.ELEMENT_NODE, matchAttributor], [Node.ELEMENT_NODE, matchStyles], ['li', matchIndent], ['b', matchAlias.bind(matchAlias, 'bold')], ['i', matchAlias.bind(matchAlias, 'italic')], ['style', matchIgnore]];
  7817. var ATTRIBUTE_ATTRIBUTORS = [_align.AlignAttribute, _direction.DirectionAttribute].reduce(function (memo, attr) {
  7818. memo[attr.keyName] = attr;
  7819. return memo;
  7820. }, {});
  7821. var STYLE_ATTRIBUTORS = [_align.AlignStyle, _background.BackgroundStyle, _color.ColorStyle, _direction.DirectionStyle, _font.FontStyle, _size.SizeStyle].reduce(function (memo, attr) {
  7822. memo[attr.keyName] = attr;
  7823. return memo;
  7824. }, {});
  7825. var Clipboard = function (_Module) {
  7826. _inherits(Clipboard, _Module);
  7827. function Clipboard(quill, options) {
  7828. _classCallCheck(this, Clipboard);
  7829. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this, quill, options));
  7830. _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this));
  7831. _this.container = _this.quill.addContainer('ql-clipboard');
  7832. _this.container.setAttribute('contenteditable', true);
  7833. _this.container.setAttribute('tabindex', -1);
  7834. _this.matchers = [];
  7835. CLIPBOARD_CONFIG.concat(_this.options.matchers).forEach(function (_ref) {
  7836. var _ref2 = _slicedToArray(_ref, 2),
  7837. selector = _ref2[0],
  7838. matcher = _ref2[1];
  7839. if (!options.matchVisual && matcher === matchSpacing) return;
  7840. _this.addMatcher(selector, matcher);
  7841. });
  7842. return _this;
  7843. }
  7844. _createClass(Clipboard, [{
  7845. key: 'addMatcher',
  7846. value: function addMatcher(selector, matcher) {
  7847. this.matchers.push([selector, matcher]);
  7848. }
  7849. }, {
  7850. key: 'convert',
  7851. value: function convert(html) {
  7852. if (typeof html === 'string') {
  7853. this.container.innerHTML = html.replace(/\>\r?\n +\</g, '><'); // Remove spaces between tags
  7854. return this.convert();
  7855. }
  7856. var formats = this.quill.getFormat(this.quill.selection.savedRange.index);
  7857. if (formats[_code2.default.blotName]) {
  7858. var text = this.container.innerText;
  7859. this.container.innerHTML = '';
  7860. return new _quillDelta2.default().insert(text, _defineProperty({}, _code2.default.blotName, formats[_code2.default.blotName]));
  7861. }
  7862. var _prepareMatching = this.prepareMatching(),
  7863. _prepareMatching2 = _slicedToArray(_prepareMatching, 2),
  7864. elementMatchers = _prepareMatching2[0],
  7865. textMatchers = _prepareMatching2[1];
  7866. var delta = traverse(this.container, elementMatchers, textMatchers);
  7867. // Remove trailing newline
  7868. if (deltaEndsWith(delta, '\n') && delta.ops[delta.ops.length - 1].attributes == null) {
  7869. delta = delta.compose(new _quillDelta2.default().retain(delta.length() - 1).delete(1));
  7870. }
  7871. debug.log('convert', this.container.innerHTML, delta);
  7872. this.container.innerHTML = '';
  7873. return delta;
  7874. }
  7875. }, {
  7876. key: 'dangerouslyPasteHTML',
  7877. value: function dangerouslyPasteHTML(index, html) {
  7878. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _quill2.default.sources.API;
  7879. if (typeof index === 'string') {
  7880. this.quill.setContents(this.convert(index), html);
  7881. this.quill.setSelection(0, _quill2.default.sources.SILENT);
  7882. } else {
  7883. var paste = this.convert(html);
  7884. this.quill.updateContents(new _quillDelta2.default().retain(index).concat(paste), source);
  7885. this.quill.setSelection(index + paste.length(), _quill2.default.sources.SILENT);
  7886. }
  7887. }
  7888. }, {
  7889. key: 'onPaste',
  7890. value: function onPaste(e) {
  7891. var _this2 = this;
  7892. if (e.defaultPrevented || !this.quill.isEnabled()) return;
  7893. var range = this.quill.getSelection();
  7894. var delta = new _quillDelta2.default().retain(range.index);
  7895. var scrollTop = this.quill.scrollingContainer.scrollTop;
  7896. this.container.focus();
  7897. this.quill.selection.update(_quill2.default.sources.SILENT);
  7898. setTimeout(function () {
  7899. delta = delta.concat(_this2.convert()).delete(range.length);
  7900. _this2.quill.updateContents(delta, _quill2.default.sources.USER);
  7901. // range.length contributes to delta.length()
  7902. _this2.quill.setSelection(delta.length() - range.length, _quill2.default.sources.SILENT);
  7903. _this2.quill.scrollingContainer.scrollTop = scrollTop;
  7904. _this2.quill.focus();
  7905. }, 1);
  7906. }
  7907. }, {
  7908. key: 'prepareMatching',
  7909. value: function prepareMatching() {
  7910. var _this3 = this;
  7911. var elementMatchers = [],
  7912. textMatchers = [];
  7913. this.matchers.forEach(function (pair) {
  7914. var _pair = _slicedToArray(pair, 2),
  7915. selector = _pair[0],
  7916. matcher = _pair[1];
  7917. switch (selector) {
  7918. case Node.TEXT_NODE:
  7919. textMatchers.push(matcher);
  7920. break;
  7921. case Node.ELEMENT_NODE:
  7922. elementMatchers.push(matcher);
  7923. break;
  7924. default:
  7925. [].forEach.call(_this3.container.querySelectorAll(selector), function (node) {
  7926. // TODO use weakmap
  7927. node[DOM_KEY] = node[DOM_KEY] || [];
  7928. node[DOM_KEY].push(matcher);
  7929. });
  7930. break;
  7931. }
  7932. });
  7933. return [elementMatchers, textMatchers];
  7934. }
  7935. }]);
  7936. return Clipboard;
  7937. }(_module2.default);
  7938. Clipboard.DEFAULTS = {
  7939. matchers: [],
  7940. matchVisual: true
  7941. };
  7942. function applyFormat(delta, format, value) {
  7943. if ((typeof format === 'undefined' ? 'undefined' : _typeof(format)) === 'object') {
  7944. return Object.keys(format).reduce(function (delta, key) {
  7945. return applyFormat(delta, key, format[key]);
  7946. }, delta);
  7947. } else {
  7948. return delta.reduce(function (delta, op) {
  7949. if (op.attributes && op.attributes[format]) {
  7950. return delta.push(op);
  7951. } else {
  7952. return delta.insert(op.insert, (0, _extend3.default)({}, _defineProperty({}, format, value), op.attributes));
  7953. }
  7954. }, new _quillDelta2.default());
  7955. }
  7956. }
  7957. function computeStyle(node) {
  7958. if (node.nodeType !== Node.ELEMENT_NODE) return {};
  7959. var DOM_KEY = '__ql-computed-style';
  7960. return node[DOM_KEY] || (node[DOM_KEY] = window.getComputedStyle(node));
  7961. }
  7962. function deltaEndsWith(delta, text) {
  7963. var endText = "";
  7964. for (var i = delta.ops.length - 1; i >= 0 && endText.length < text.length; --i) {
  7965. var op = delta.ops[i];
  7966. if (typeof op.insert !== 'string') break;
  7967. endText = op.insert + endText;
  7968. }
  7969. return endText.slice(-1 * text.length) === text;
  7970. }
  7971. function isLine(node) {
  7972. if (node.childNodes.length === 0) return false; // Exclude embed blocks
  7973. var style = computeStyle(node);
  7974. return ['block', 'list-item'].indexOf(style.display) > -1;
  7975. }
  7976. function traverse(node, elementMatchers, textMatchers) {
  7977. // Post-order
  7978. if (node.nodeType === node.TEXT_NODE) {
  7979. return textMatchers.reduce(function (delta, matcher) {
  7980. return matcher(node, delta);
  7981. }, new _quillDelta2.default());
  7982. } else if (node.nodeType === node.ELEMENT_NODE) {
  7983. return [].reduce.call(node.childNodes || [], function (delta, childNode) {
  7984. var childrenDelta = traverse(childNode, elementMatchers, textMatchers);
  7985. if (childNode.nodeType === node.ELEMENT_NODE) {
  7986. childrenDelta = elementMatchers.reduce(function (childrenDelta, matcher) {
  7987. return matcher(childNode, childrenDelta);
  7988. }, childrenDelta);
  7989. childrenDelta = (childNode[DOM_KEY] || []).reduce(function (childrenDelta, matcher) {
  7990. return matcher(childNode, childrenDelta);
  7991. }, childrenDelta);
  7992. }
  7993. return delta.concat(childrenDelta);
  7994. }, new _quillDelta2.default());
  7995. } else {
  7996. return new _quillDelta2.default();
  7997. }
  7998. }
  7999. function matchAlias(format, node, delta) {
  8000. return applyFormat(delta, format, true);
  8001. }
  8002. function matchAttributor(node, delta) {
  8003. var attributes = _parchment2.default.Attributor.Attribute.keys(node);
  8004. var classes = _parchment2.default.Attributor.Class.keys(node);
  8005. var styles = _parchment2.default.Attributor.Style.keys(node);
  8006. var formats = {};
  8007. attributes.concat(classes).concat(styles).forEach(function (name) {
  8008. var attr = _parchment2.default.query(name, _parchment2.default.Scope.ATTRIBUTE);
  8009. if (attr != null) {
  8010. formats[attr.attrName] = attr.value(node);
  8011. if (formats[attr.attrName]) return;
  8012. }
  8013. attr = ATTRIBUTE_ATTRIBUTORS[name];
  8014. if (attr != null && (attr.attrName === name || attr.keyName === name)) {
  8015. formats[attr.attrName] = attr.value(node) || undefined;
  8016. }
  8017. attr = STYLE_ATTRIBUTORS[name];
  8018. if (attr != null && (attr.attrName === name || attr.keyName === name)) {
  8019. attr = STYLE_ATTRIBUTORS[name];
  8020. formats[attr.attrName] = attr.value(node) || undefined;
  8021. }
  8022. });
  8023. if (Object.keys(formats).length > 0) {
  8024. delta = applyFormat(delta, formats);
  8025. }
  8026. return delta;
  8027. }
  8028. function matchBlot(node, delta) {
  8029. var match = _parchment2.default.query(node);
  8030. if (match == null) return delta;
  8031. if (match.prototype instanceof _parchment2.default.Embed) {
  8032. var embed = {};
  8033. var value = match.value(node);
  8034. if (value != null) {
  8035. embed[match.blotName] = value;
  8036. delta = new _quillDelta2.default().insert(embed, match.formats(node));
  8037. }
  8038. } else if (typeof match.formats === 'function') {
  8039. delta = applyFormat(delta, match.blotName, match.formats(node));
  8040. }
  8041. return delta;
  8042. }
  8043. function matchBreak(node, delta) {
  8044. if (!deltaEndsWith(delta, '\n')) {
  8045. delta.insert('\n');
  8046. }
  8047. return delta;
  8048. }
  8049. function matchIgnore() {
  8050. return new _quillDelta2.default();
  8051. }
  8052. function matchIndent(node, delta) {
  8053. var match = _parchment2.default.query(node);
  8054. if (match == null || match.blotName !== 'list-item' || !deltaEndsWith(delta, '\n')) {
  8055. return delta;
  8056. }
  8057. var indent = -1,
  8058. parent = node.parentNode;
  8059. while (!parent.classList.contains('ql-clipboard')) {
  8060. if ((_parchment2.default.query(parent) || {}).blotName === 'list') {
  8061. indent += 1;
  8062. }
  8063. parent = parent.parentNode;
  8064. }
  8065. if (indent <= 0) return delta;
  8066. return delta.compose(new _quillDelta2.default().retain(delta.length() - 1).retain(1, { indent: indent }));
  8067. }
  8068. function matchNewline(node, delta) {
  8069. if (!deltaEndsWith(delta, '\n')) {
  8070. if (isLine(node) || delta.length() > 0 && node.nextSibling && isLine(node.nextSibling)) {
  8071. delta.insert('\n');
  8072. }
  8073. }
  8074. return delta;
  8075. }
  8076. function matchSpacing(node, delta) {
  8077. if (isLine(node) && node.nextElementSibling != null && !deltaEndsWith(delta, '\n\n')) {
  8078. var nodeHeight = node.offsetHeight + parseFloat(computeStyle(node).marginTop) + parseFloat(computeStyle(node).marginBottom);
  8079. if (node.nextElementSibling.offsetTop > node.offsetTop + nodeHeight * 1.5) {
  8080. delta.insert('\n');
  8081. }
  8082. }
  8083. return delta;
  8084. }
  8085. function matchStyles(node, delta) {
  8086. var formats = {};
  8087. var style = node.style || {};
  8088. if (style.fontStyle && computeStyle(node).fontStyle === 'italic') {
  8089. formats.italic = true;
  8090. }
  8091. if (style.fontWeight && (computeStyle(node).fontWeight.startsWith('bold') || parseInt(computeStyle(node).fontWeight) >= 700)) {
  8092. formats.bold = true;
  8093. }
  8094. if (Object.keys(formats).length > 0) {
  8095. delta = applyFormat(delta, formats);
  8096. }
  8097. if (parseFloat(style.textIndent || 0) > 0) {
  8098. // Could be 0.5in
  8099. delta = new _quillDelta2.default().insert('\t').concat(delta);
  8100. }
  8101. return delta;
  8102. }
  8103. function matchText(node, delta) {
  8104. var text = node.data;
  8105. // Word represents empty line with <o:p>&nbsp;</o:p>
  8106. if (node.parentNode.tagName === 'O:P') {
  8107. return delta.insert(text.trim());
  8108. }
  8109. if (text.trim().length === 0 && node.parentNode.classList.contains('ql-clipboard')) {
  8110. return delta;
  8111. }
  8112. if (!computeStyle(node.parentNode).whiteSpace.startsWith('pre')) {
  8113. // eslint-disable-next-line func-style
  8114. var replacer = function replacer(collapse, match) {
  8115. match = match.replace(/[^\u00a0]/g, ''); // \u00a0 is nbsp;
  8116. return match.length < 1 && collapse ? ' ' : match;
  8117. };
  8118. text = text.replace(/\r\n/g, ' ').replace(/\n/g, ' ');
  8119. text = text.replace(/\s\s+/g, replacer.bind(replacer, true)); // collapse whitespace
  8120. if (node.previousSibling == null && isLine(node.parentNode) || node.previousSibling != null && isLine(node.previousSibling)) {
  8121. text = text.replace(/^\s+/, replacer.bind(replacer, false));
  8122. }
  8123. if (node.nextSibling == null && isLine(node.parentNode) || node.nextSibling != null && isLine(node.nextSibling)) {
  8124. text = text.replace(/\s+$/, replacer.bind(replacer, false));
  8125. }
  8126. }
  8127. return delta.insert(text);
  8128. }
  8129. exports.default = Clipboard;
  8130. exports.matchAttributor = matchAttributor;
  8131. exports.matchBlot = matchBlot;
  8132. exports.matchNewline = matchNewline;
  8133. exports.matchSpacing = matchSpacing;
  8134. exports.matchText = matchText;
  8135. /***/ }),
  8136. /* 56 */
  8137. /***/ (function(module, exports, __webpack_require__) {
  8138. "use strict";
  8139. Object.defineProperty(exports, "__esModule", {
  8140. value: true
  8141. });
  8142. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8143. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8144. var _inline = __webpack_require__(6);
  8145. var _inline2 = _interopRequireDefault(_inline);
  8146. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8147. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8148. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8149. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8150. var Bold = function (_Inline) {
  8151. _inherits(Bold, _Inline);
  8152. function Bold() {
  8153. _classCallCheck(this, Bold);
  8154. return _possibleConstructorReturn(this, (Bold.__proto__ || Object.getPrototypeOf(Bold)).apply(this, arguments));
  8155. }
  8156. _createClass(Bold, [{
  8157. key: 'optimize',
  8158. value: function optimize(context) {
  8159. _get(Bold.prototype.__proto__ || Object.getPrototypeOf(Bold.prototype), 'optimize', this).call(this, context);
  8160. if (this.domNode.tagName !== this.statics.tagName[0]) {
  8161. this.replaceWith(this.statics.blotName);
  8162. }
  8163. }
  8164. }], [{
  8165. key: 'create',
  8166. value: function create() {
  8167. return _get(Bold.__proto__ || Object.getPrototypeOf(Bold), 'create', this).call(this);
  8168. }
  8169. }, {
  8170. key: 'formats',
  8171. value: function formats() {
  8172. return true;
  8173. }
  8174. }]);
  8175. return Bold;
  8176. }(_inline2.default);
  8177. Bold.blotName = 'bold';
  8178. Bold.tagName = ['STRONG', 'B'];
  8179. exports.default = Bold;
  8180. /***/ }),
  8181. /* 57 */
  8182. /***/ (function(module, exports, __webpack_require__) {
  8183. "use strict";
  8184. Object.defineProperty(exports, "__esModule", {
  8185. value: true
  8186. });
  8187. exports.addControls = exports.default = undefined;
  8188. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  8189. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8190. var _quillDelta = __webpack_require__(2);
  8191. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  8192. var _parchment = __webpack_require__(0);
  8193. var _parchment2 = _interopRequireDefault(_parchment);
  8194. var _quill = __webpack_require__(5);
  8195. var _quill2 = _interopRequireDefault(_quill);
  8196. var _logger = __webpack_require__(10);
  8197. var _logger2 = _interopRequireDefault(_logger);
  8198. var _module = __webpack_require__(9);
  8199. var _module2 = _interopRequireDefault(_module);
  8200. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8201. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  8202. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8203. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8204. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8205. var debug = (0, _logger2.default)('quill:toolbar');
  8206. var Toolbar = function (_Module) {
  8207. _inherits(Toolbar, _Module);
  8208. function Toolbar(quill, options) {
  8209. _classCallCheck(this, Toolbar);
  8210. var _this = _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).call(this, quill, options));
  8211. if (Array.isArray(_this.options.container)) {
  8212. var container = document.createElement('div');
  8213. addControls(container, _this.options.container);
  8214. quill.container.parentNode.insertBefore(container, quill.container);
  8215. _this.container = container;
  8216. } else if (typeof _this.options.container === 'string') {
  8217. _this.container = document.querySelector(_this.options.container);
  8218. } else {
  8219. _this.container = _this.options.container;
  8220. }
  8221. if (!(_this.container instanceof HTMLElement)) {
  8222. var _ret;
  8223. return _ret = debug.error('Container required for toolbar', _this.options), _possibleConstructorReturn(_this, _ret);
  8224. }
  8225. _this.container.classList.add('ql-toolbar');
  8226. _this.controls = [];
  8227. _this.handlers = {};
  8228. Object.keys(_this.options.handlers).forEach(function (format) {
  8229. _this.addHandler(format, _this.options.handlers[format]);
  8230. });
  8231. [].forEach.call(_this.container.querySelectorAll('button, select'), function (input) {
  8232. _this.attach(input);
  8233. });
  8234. _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (type, range) {
  8235. if (type === _quill2.default.events.SELECTION_CHANGE) {
  8236. _this.update(range);
  8237. }
  8238. });
  8239. _this.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
  8240. var _this$quill$selection = _this.quill.selection.getRange(),
  8241. _this$quill$selection2 = _slicedToArray(_this$quill$selection, 1),
  8242. range = _this$quill$selection2[0]; // quill.getSelection triggers update
  8243. _this.update(range);
  8244. });
  8245. return _this;
  8246. }
  8247. _createClass(Toolbar, [{
  8248. key: 'addHandler',
  8249. value: function addHandler(format, handler) {
  8250. this.handlers[format] = handler;
  8251. }
  8252. }, {
  8253. key: 'attach',
  8254. value: function attach(input) {
  8255. var _this2 = this;
  8256. var format = [].find.call(input.classList, function (className) {
  8257. return className.indexOf('ql-') === 0;
  8258. });
  8259. if (!format) return;
  8260. format = format.slice('ql-'.length);
  8261. if (input.tagName === 'BUTTON') {
  8262. input.setAttribute('type', 'button');
  8263. }
  8264. if (this.handlers[format] == null) {
  8265. if (this.quill.scroll.whitelist != null && this.quill.scroll.whitelist[format] == null) {
  8266. debug.warn('ignoring attaching to disabled format', format, input);
  8267. return;
  8268. }
  8269. if (_parchment2.default.query(format) == null) {
  8270. debug.warn('ignoring attaching to nonexistent format', format, input);
  8271. return;
  8272. }
  8273. }
  8274. var eventName = input.tagName === 'SELECT' ? 'change' : 'click';
  8275. input.addEventListener(eventName, function (e) {
  8276. var value = void 0;
  8277. if (input.tagName === 'SELECT') {
  8278. if (input.selectedIndex < 0) return;
  8279. var selected = input.options[input.selectedIndex];
  8280. if (selected.hasAttribute('selected')) {
  8281. value = false;
  8282. } else {
  8283. value = selected.value || false;
  8284. }
  8285. } else {
  8286. if (input.classList.contains('ql-active')) {
  8287. value = false;
  8288. } else {
  8289. value = input.value || !input.hasAttribute('value');
  8290. }
  8291. e.preventDefault();
  8292. }
  8293. _this2.quill.focus();
  8294. var _quill$selection$getR = _this2.quill.selection.getRange(),
  8295. _quill$selection$getR2 = _slicedToArray(_quill$selection$getR, 1),
  8296. range = _quill$selection$getR2[0];
  8297. if (_this2.handlers[format] != null) {
  8298. _this2.handlers[format].call(_this2, value);
  8299. } else if (_parchment2.default.query(format).prototype instanceof _parchment2.default.Embed) {
  8300. value = prompt('Enter ' + format);
  8301. if (!value) return;
  8302. _this2.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert(_defineProperty({}, format, value)), _quill2.default.sources.USER);
  8303. } else {
  8304. _this2.quill.format(format, value, _quill2.default.sources.USER);
  8305. }
  8306. _this2.update(range);
  8307. });
  8308. // TODO use weakmap
  8309. this.controls.push([format, input]);
  8310. }
  8311. }, {
  8312. key: 'update',
  8313. value: function update(range) {
  8314. var formats = range == null ? {} : this.quill.getFormat(range);
  8315. this.controls.forEach(function (pair) {
  8316. var _pair = _slicedToArray(pair, 2),
  8317. format = _pair[0],
  8318. input = _pair[1];
  8319. if (input.tagName === 'SELECT') {
  8320. var option = void 0;
  8321. if (range == null) {
  8322. option = null;
  8323. } else if (formats[format] == null) {
  8324. option = input.querySelector('option[selected]');
  8325. } else if (!Array.isArray(formats[format])) {
  8326. var value = formats[format];
  8327. if (typeof value === 'string') {
  8328. value = value.replace(/\"/g, '\\"');
  8329. }
  8330. option = input.querySelector('option[value="' + value + '"]');
  8331. }
  8332. if (option == null) {
  8333. input.value = ''; // TODO make configurable?
  8334. input.selectedIndex = -1;
  8335. } else {
  8336. option.selected = true;
  8337. }
  8338. } else {
  8339. if (range == null) {
  8340. input.classList.remove('ql-active');
  8341. } else if (input.hasAttribute('value')) {
  8342. // both being null should match (default values)
  8343. // '1' should match with 1 (headers)
  8344. var isActive = formats[format] === input.getAttribute('value') || formats[format] != null && formats[format].toString() === input.getAttribute('value') || formats[format] == null && !input.getAttribute('value');
  8345. input.classList.toggle('ql-active', isActive);
  8346. } else {
  8347. input.classList.toggle('ql-active', formats[format] != null);
  8348. }
  8349. }
  8350. });
  8351. }
  8352. }]);
  8353. return Toolbar;
  8354. }(_module2.default);
  8355. Toolbar.DEFAULTS = {};
  8356. function addButton(container, format, value) {
  8357. var input = document.createElement('button');
  8358. input.setAttribute('type', 'button');
  8359. input.classList.add('ql-' + format);
  8360. if (value != null) {
  8361. input.value = value;
  8362. }
  8363. container.appendChild(input);
  8364. }
  8365. function addControls(container, groups) {
  8366. if (!Array.isArray(groups[0])) {
  8367. groups = [groups];
  8368. }
  8369. groups.forEach(function (controls) {
  8370. var group = document.createElement('span');
  8371. group.classList.add('ql-formats');
  8372. controls.forEach(function (control) {
  8373. if (typeof control === 'string') {
  8374. addButton(group, control);
  8375. } else {
  8376. var format = Object.keys(control)[0];
  8377. var value = control[format];
  8378. if (Array.isArray(value)) {
  8379. addSelect(group, format, value);
  8380. } else {
  8381. addButton(group, format, value);
  8382. }
  8383. }
  8384. });
  8385. container.appendChild(group);
  8386. });
  8387. }
  8388. function addSelect(container, format, values) {
  8389. var input = document.createElement('select');
  8390. input.classList.add('ql-' + format);
  8391. values.forEach(function (value) {
  8392. var option = document.createElement('option');
  8393. if (value !== false) {
  8394. option.setAttribute('value', value);
  8395. } else {
  8396. option.setAttribute('selected', 'selected');
  8397. }
  8398. input.appendChild(option);
  8399. });
  8400. container.appendChild(input);
  8401. }
  8402. Toolbar.DEFAULTS = {
  8403. container: null,
  8404. handlers: {
  8405. clean: function clean() {
  8406. var _this3 = this;
  8407. var range = this.quill.getSelection();
  8408. if (range == null) return;
  8409. if (range.length == 0) {
  8410. var formats = this.quill.getFormat();
  8411. Object.keys(formats).forEach(function (name) {
  8412. // Clean functionality in existing apps only clean inline formats
  8413. if (_parchment2.default.query(name, _parchment2.default.Scope.INLINE) != null) {
  8414. _this3.quill.format(name, false);
  8415. }
  8416. });
  8417. } else {
  8418. this.quill.removeFormat(range, _quill2.default.sources.USER);
  8419. }
  8420. },
  8421. direction: function direction(value) {
  8422. var align = this.quill.getFormat()['align'];
  8423. if (value === 'rtl' && align == null) {
  8424. this.quill.format('align', 'right', _quill2.default.sources.USER);
  8425. } else if (!value && align === 'right') {
  8426. this.quill.format('align', false, _quill2.default.sources.USER);
  8427. }
  8428. this.quill.format('direction', value, _quill2.default.sources.USER);
  8429. },
  8430. indent: function indent(value) {
  8431. var range = this.quill.getSelection();
  8432. var formats = this.quill.getFormat(range);
  8433. var indent = parseInt(formats.indent || 0);
  8434. if (value === '+1' || value === '-1') {
  8435. var modifier = value === '+1' ? 1 : -1;
  8436. if (formats.direction === 'rtl') modifier *= -1;
  8437. this.quill.format('indent', indent + modifier, _quill2.default.sources.USER);
  8438. }
  8439. },
  8440. link: function link(value) {
  8441. if (value === true) {
  8442. value = prompt('Enter link URL:');
  8443. }
  8444. this.quill.format('link', value, _quill2.default.sources.USER);
  8445. },
  8446. list: function list(value) {
  8447. var range = this.quill.getSelection();
  8448. var formats = this.quill.getFormat(range);
  8449. if (value === 'check') {
  8450. if (formats['list'] === 'checked' || formats['list'] === 'unchecked') {
  8451. this.quill.format('list', false, _quill2.default.sources.USER);
  8452. } else {
  8453. this.quill.format('list', 'unchecked', _quill2.default.sources.USER);
  8454. }
  8455. } else {
  8456. this.quill.format('list', value, _quill2.default.sources.USER);
  8457. }
  8458. }
  8459. }
  8460. };
  8461. exports.default = Toolbar;
  8462. exports.addControls = addControls;
  8463. /***/ }),
  8464. /* 58 */
  8465. /***/ (function(module, exports) {
  8466. module.exports = "<svg viewbox=\"0 0 18 18\"> <polyline class=\"ql-even ql-stroke\" points=\"5 7 3 9 5 11\"></polyline> <polyline class=\"ql-even ql-stroke\" points=\"13 7 15 9 13 11\"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>";
  8467. /***/ }),
  8468. /* 59 */
  8469. /***/ (function(module, exports, __webpack_require__) {
  8470. "use strict";
  8471. Object.defineProperty(exports, "__esModule", {
  8472. value: true
  8473. });
  8474. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8475. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8476. var _picker = __webpack_require__(28);
  8477. var _picker2 = _interopRequireDefault(_picker);
  8478. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8479. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8480. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8481. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8482. var ColorPicker = function (_Picker) {
  8483. _inherits(ColorPicker, _Picker);
  8484. function ColorPicker(select, label) {
  8485. _classCallCheck(this, ColorPicker);
  8486. var _this = _possibleConstructorReturn(this, (ColorPicker.__proto__ || Object.getPrototypeOf(ColorPicker)).call(this, select));
  8487. _this.label.innerHTML = label;
  8488. _this.container.classList.add('ql-color-picker');
  8489. [].slice.call(_this.container.querySelectorAll('.ql-picker-item'), 0, 7).forEach(function (item) {
  8490. item.classList.add('ql-primary');
  8491. });
  8492. return _this;
  8493. }
  8494. _createClass(ColorPicker, [{
  8495. key: 'buildItem',
  8496. value: function buildItem(option) {
  8497. var item = _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'buildItem', this).call(this, option);
  8498. item.style.backgroundColor = option.getAttribute('value') || '';
  8499. return item;
  8500. }
  8501. }, {
  8502. key: 'selectItem',
  8503. value: function selectItem(item, trigger) {
  8504. _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'selectItem', this).call(this, item, trigger);
  8505. var colorLabel = this.label.querySelector('.ql-color-label');
  8506. var value = item ? item.getAttribute('data-value') || '' : '';
  8507. if (colorLabel) {
  8508. if (colorLabel.tagName === 'line') {
  8509. colorLabel.style.stroke = value;
  8510. } else {
  8511. colorLabel.style.fill = value;
  8512. }
  8513. }
  8514. }
  8515. }]);
  8516. return ColorPicker;
  8517. }(_picker2.default);
  8518. exports.default = ColorPicker;
  8519. /***/ }),
  8520. /* 60 */
  8521. /***/ (function(module, exports, __webpack_require__) {
  8522. "use strict";
  8523. Object.defineProperty(exports, "__esModule", {
  8524. value: true
  8525. });
  8526. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8527. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8528. var _picker = __webpack_require__(28);
  8529. var _picker2 = _interopRequireDefault(_picker);
  8530. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8531. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8532. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8533. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8534. var IconPicker = function (_Picker) {
  8535. _inherits(IconPicker, _Picker);
  8536. function IconPicker(select, icons) {
  8537. _classCallCheck(this, IconPicker);
  8538. var _this = _possibleConstructorReturn(this, (IconPicker.__proto__ || Object.getPrototypeOf(IconPicker)).call(this, select));
  8539. _this.container.classList.add('ql-icon-picker');
  8540. [].forEach.call(_this.container.querySelectorAll('.ql-picker-item'), function (item) {
  8541. item.innerHTML = icons[item.getAttribute('data-value') || ''];
  8542. });
  8543. _this.defaultItem = _this.container.querySelector('.ql-selected');
  8544. _this.selectItem(_this.defaultItem);
  8545. return _this;
  8546. }
  8547. _createClass(IconPicker, [{
  8548. key: 'selectItem',
  8549. value: function selectItem(item, trigger) {
  8550. _get(IconPicker.prototype.__proto__ || Object.getPrototypeOf(IconPicker.prototype), 'selectItem', this).call(this, item, trigger);
  8551. item = item || this.defaultItem;
  8552. this.label.innerHTML = item.innerHTML;
  8553. }
  8554. }]);
  8555. return IconPicker;
  8556. }(_picker2.default);
  8557. exports.default = IconPicker;
  8558. /***/ }),
  8559. /* 61 */
  8560. /***/ (function(module, exports, __webpack_require__) {
  8561. "use strict";
  8562. Object.defineProperty(exports, "__esModule", {
  8563. value: true
  8564. });
  8565. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8566. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8567. var Tooltip = function () {
  8568. function Tooltip(quill, boundsContainer) {
  8569. var _this = this;
  8570. _classCallCheck(this, Tooltip);
  8571. this.quill = quill;
  8572. this.boundsContainer = boundsContainer || document.body;
  8573. this.root = quill.addContainer('ql-tooltip');
  8574. this.root.innerHTML = this.constructor.TEMPLATE;
  8575. if (this.quill.root === this.quill.scrollingContainer) {
  8576. this.quill.root.addEventListener('scroll', function () {
  8577. _this.root.style.marginTop = -1 * _this.quill.root.scrollTop + 'px';
  8578. });
  8579. }
  8580. this.hide();
  8581. }
  8582. _createClass(Tooltip, [{
  8583. key: 'hide',
  8584. value: function hide() {
  8585. this.root.classList.add('ql-hidden');
  8586. }
  8587. }, {
  8588. key: 'position',
  8589. value: function position(reference) {
  8590. var left = reference.left + reference.width / 2 - this.root.offsetWidth / 2;
  8591. // root.scrollTop should be 0 if scrollContainer !== root
  8592. var top = reference.bottom + this.quill.root.scrollTop;
  8593. this.root.style.left = left + 'px';
  8594. this.root.style.top = top + 'px';
  8595. this.root.classList.remove('ql-flip');
  8596. var containerBounds = this.boundsContainer.getBoundingClientRect();
  8597. var rootBounds = this.root.getBoundingClientRect();
  8598. var shift = 0;
  8599. if (rootBounds.right > containerBounds.right) {
  8600. shift = containerBounds.right - rootBounds.right;
  8601. this.root.style.left = left + shift + 'px';
  8602. }
  8603. if (rootBounds.left < containerBounds.left) {
  8604. shift = containerBounds.left - rootBounds.left;
  8605. this.root.style.left = left + shift + 'px';
  8606. }
  8607. if (rootBounds.bottom > containerBounds.bottom) {
  8608. var height = rootBounds.bottom - rootBounds.top;
  8609. var verticalShift = reference.bottom - reference.top + height;
  8610. this.root.style.top = top - verticalShift + 'px';
  8611. this.root.classList.add('ql-flip');
  8612. }
  8613. return shift;
  8614. }
  8615. }, {
  8616. key: 'show',
  8617. value: function show() {
  8618. this.root.classList.remove('ql-editing');
  8619. this.root.classList.remove('ql-hidden');
  8620. }
  8621. }]);
  8622. return Tooltip;
  8623. }();
  8624. exports.default = Tooltip;
  8625. /***/ }),
  8626. /* 62 */
  8627. /***/ (function(module, exports, __webpack_require__) {
  8628. "use strict";
  8629. Object.defineProperty(exports, "__esModule", {
  8630. value: true
  8631. });
  8632. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  8633. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8634. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8635. var _extend = __webpack_require__(3);
  8636. var _extend2 = _interopRequireDefault(_extend);
  8637. var _emitter = __webpack_require__(8);
  8638. var _emitter2 = _interopRequireDefault(_emitter);
  8639. var _base = __webpack_require__(43);
  8640. var _base2 = _interopRequireDefault(_base);
  8641. var _link = __webpack_require__(27);
  8642. var _link2 = _interopRequireDefault(_link);
  8643. var _selection = __webpack_require__(15);
  8644. var _icons = __webpack_require__(41);
  8645. var _icons2 = _interopRequireDefault(_icons);
  8646. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8647. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8648. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8649. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8650. var TOOLBAR_CONFIG = [[{ header: ['1', '2', '3', false] }], ['bold', 'italic', 'underline', 'link'], [{ list: 'ordered' }, { list: 'bullet' }], ['clean']];
  8651. var SnowTheme = function (_BaseTheme) {
  8652. _inherits(SnowTheme, _BaseTheme);
  8653. function SnowTheme(quill, options) {
  8654. _classCallCheck(this, SnowTheme);
  8655. if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
  8656. options.modules.toolbar.container = TOOLBAR_CONFIG;
  8657. }
  8658. var _this = _possibleConstructorReturn(this, (SnowTheme.__proto__ || Object.getPrototypeOf(SnowTheme)).call(this, quill, options));
  8659. _this.quill.container.classList.add('ql-snow');
  8660. return _this;
  8661. }
  8662. _createClass(SnowTheme, [{
  8663. key: 'extendToolbar',
  8664. value: function extendToolbar(toolbar) {
  8665. toolbar.container.classList.add('ql-snow');
  8666. this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
  8667. this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
  8668. this.tooltip = new SnowTooltip(this.quill, this.options.bounds);
  8669. if (toolbar.container.querySelector('.ql-link')) {
  8670. this.quill.keyboard.addBinding({ key: 'K', shortKey: true }, function (range, context) {
  8671. toolbar.handlers['link'].call(toolbar, !context.format.link);
  8672. });
  8673. }
  8674. }
  8675. }]);
  8676. return SnowTheme;
  8677. }(_base2.default);
  8678. SnowTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
  8679. modules: {
  8680. toolbar: {
  8681. handlers: {
  8682. link: function link(value) {
  8683. if (value) {
  8684. var range = this.quill.getSelection();
  8685. if (range == null || range.length == 0) return;
  8686. var preview = this.quill.getText(range);
  8687. if (/^\S+@\S+\.\S+$/.test(preview) && preview.indexOf('mailto:') !== 0) {
  8688. preview = 'mailto:' + preview;
  8689. }
  8690. var tooltip = this.quill.theme.tooltip;
  8691. tooltip.edit('link', preview);
  8692. } else {
  8693. this.quill.format('link', false);
  8694. }
  8695. }
  8696. }
  8697. }
  8698. }
  8699. });
  8700. var SnowTooltip = function (_BaseTooltip) {
  8701. _inherits(SnowTooltip, _BaseTooltip);
  8702. function SnowTooltip(quill, bounds) {
  8703. _classCallCheck(this, SnowTooltip);
  8704. var _this2 = _possibleConstructorReturn(this, (SnowTooltip.__proto__ || Object.getPrototypeOf(SnowTooltip)).call(this, quill, bounds));
  8705. _this2.preview = _this2.root.querySelector('a.ql-preview');
  8706. return _this2;
  8707. }
  8708. _createClass(SnowTooltip, [{
  8709. key: 'listen',
  8710. value: function listen() {
  8711. var _this3 = this;
  8712. _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'listen', this).call(this);
  8713. this.root.querySelector('a.ql-action').addEventListener('click', function (event) {
  8714. if (_this3.root.classList.contains('ql-editing')) {
  8715. _this3.save();
  8716. } else {
  8717. _this3.edit('link', _this3.preview.textContent);
  8718. }
  8719. event.preventDefault();
  8720. });
  8721. this.root.querySelector('a.ql-remove').addEventListener('click', function (event) {
  8722. if (_this3.linkRange != null) {
  8723. var range = _this3.linkRange;
  8724. _this3.restoreFocus();
  8725. _this3.quill.formatText(range, 'link', false, _emitter2.default.sources.USER);
  8726. delete _this3.linkRange;
  8727. }
  8728. event.preventDefault();
  8729. _this3.hide();
  8730. });
  8731. this.quill.on(_emitter2.default.events.SELECTION_CHANGE, function (range, oldRange, source) {
  8732. if (range == null) return;
  8733. if (range.length === 0 && source === _emitter2.default.sources.USER) {
  8734. var _quill$scroll$descend = _this3.quill.scroll.descendant(_link2.default, range.index),
  8735. _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
  8736. link = _quill$scroll$descend2[0],
  8737. offset = _quill$scroll$descend2[1];
  8738. if (link != null) {
  8739. _this3.linkRange = new _selection.Range(range.index - offset, link.length());
  8740. var preview = _link2.default.formats(link.domNode);
  8741. _this3.preview.textContent = preview;
  8742. _this3.preview.setAttribute('href', preview);
  8743. _this3.show();
  8744. _this3.position(_this3.quill.getBounds(_this3.linkRange));
  8745. return;
  8746. }
  8747. } else {
  8748. delete _this3.linkRange;
  8749. }
  8750. _this3.hide();
  8751. });
  8752. }
  8753. }, {
  8754. key: 'show',
  8755. value: function show() {
  8756. _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'show', this).call(this);
  8757. this.root.removeAttribute('data-mode');
  8758. }
  8759. }]);
  8760. return SnowTooltip;
  8761. }(_base.BaseTooltip);
  8762. SnowTooltip.TEMPLATE = ['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-action"></a>', '<a class="ql-remove"></a>'].join('');
  8763. exports.default = SnowTheme;
  8764. /***/ }),
  8765. /* 63 */
  8766. /***/ (function(module, exports, __webpack_require__) {
  8767. "use strict";
  8768. Object.defineProperty(exports, "__esModule", {
  8769. value: true
  8770. });
  8771. var _core = __webpack_require__(29);
  8772. var _core2 = _interopRequireDefault(_core);
  8773. var _align = __webpack_require__(36);
  8774. var _direction = __webpack_require__(38);
  8775. var _indent = __webpack_require__(64);
  8776. var _blockquote = __webpack_require__(65);
  8777. var _blockquote2 = _interopRequireDefault(_blockquote);
  8778. var _header = __webpack_require__(66);
  8779. var _header2 = _interopRequireDefault(_header);
  8780. var _list = __webpack_require__(67);
  8781. var _list2 = _interopRequireDefault(_list);
  8782. var _background = __webpack_require__(37);
  8783. var _color = __webpack_require__(26);
  8784. var _font = __webpack_require__(39);
  8785. var _size = __webpack_require__(40);
  8786. var _bold = __webpack_require__(56);
  8787. var _bold2 = _interopRequireDefault(_bold);
  8788. var _italic = __webpack_require__(68);
  8789. var _italic2 = _interopRequireDefault(_italic);
  8790. var _link = __webpack_require__(27);
  8791. var _link2 = _interopRequireDefault(_link);
  8792. var _script = __webpack_require__(69);
  8793. var _script2 = _interopRequireDefault(_script);
  8794. var _strike = __webpack_require__(70);
  8795. var _strike2 = _interopRequireDefault(_strike);
  8796. var _underline = __webpack_require__(71);
  8797. var _underline2 = _interopRequireDefault(_underline);
  8798. var _image = __webpack_require__(72);
  8799. var _image2 = _interopRequireDefault(_image);
  8800. var _video = __webpack_require__(73);
  8801. var _video2 = _interopRequireDefault(_video);
  8802. var _code = __webpack_require__(13);
  8803. var _code2 = _interopRequireDefault(_code);
  8804. var _formula = __webpack_require__(74);
  8805. var _formula2 = _interopRequireDefault(_formula);
  8806. var _syntax = __webpack_require__(75);
  8807. var _syntax2 = _interopRequireDefault(_syntax);
  8808. var _toolbar = __webpack_require__(57);
  8809. var _toolbar2 = _interopRequireDefault(_toolbar);
  8810. var _icons = __webpack_require__(41);
  8811. var _icons2 = _interopRequireDefault(_icons);
  8812. var _picker = __webpack_require__(28);
  8813. var _picker2 = _interopRequireDefault(_picker);
  8814. var _colorPicker = __webpack_require__(59);
  8815. var _colorPicker2 = _interopRequireDefault(_colorPicker);
  8816. var _iconPicker = __webpack_require__(60);
  8817. var _iconPicker2 = _interopRequireDefault(_iconPicker);
  8818. var _tooltip = __webpack_require__(61);
  8819. var _tooltip2 = _interopRequireDefault(_tooltip);
  8820. var _bubble = __webpack_require__(108);
  8821. var _bubble2 = _interopRequireDefault(_bubble);
  8822. var _snow = __webpack_require__(62);
  8823. var _snow2 = _interopRequireDefault(_snow);
  8824. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8825. _core2.default.register({
  8826. 'attributors/attribute/direction': _direction.DirectionAttribute,
  8827. 'attributors/class/align': _align.AlignClass,
  8828. 'attributors/class/background': _background.BackgroundClass,
  8829. 'attributors/class/color': _color.ColorClass,
  8830. 'attributors/class/direction': _direction.DirectionClass,
  8831. 'attributors/class/font': _font.FontClass,
  8832. 'attributors/class/size': _size.SizeClass,
  8833. 'attributors/style/align': _align.AlignStyle,
  8834. 'attributors/style/background': _background.BackgroundStyle,
  8835. 'attributors/style/color': _color.ColorStyle,
  8836. 'attributors/style/direction': _direction.DirectionStyle,
  8837. 'attributors/style/font': _font.FontStyle,
  8838. 'attributors/style/size': _size.SizeStyle
  8839. }, true);
  8840. _core2.default.register({
  8841. 'formats/align': _align.AlignClass,
  8842. 'formats/direction': _direction.DirectionClass,
  8843. 'formats/indent': _indent.IndentClass,
  8844. 'formats/background': _background.BackgroundStyle,
  8845. 'formats/color': _color.ColorStyle,
  8846. 'formats/font': _font.FontClass,
  8847. 'formats/size': _size.SizeClass,
  8848. 'formats/blockquote': _blockquote2.default,
  8849. 'formats/code-block': _code2.default,
  8850. 'formats/header': _header2.default,
  8851. 'formats/list': _list2.default,
  8852. 'formats/bold': _bold2.default,
  8853. 'formats/code': _code.Code,
  8854. 'formats/italic': _italic2.default,
  8855. 'formats/link': _link2.default,
  8856. 'formats/script': _script2.default,
  8857. 'formats/strike': _strike2.default,
  8858. 'formats/underline': _underline2.default,
  8859. 'formats/image': _image2.default,
  8860. 'formats/video': _video2.default,
  8861. 'formats/list/item': _list.ListItem,
  8862. 'modules/formula': _formula2.default,
  8863. 'modules/syntax': _syntax2.default,
  8864. 'modules/toolbar': _toolbar2.default,
  8865. 'themes/bubble': _bubble2.default,
  8866. 'themes/snow': _snow2.default,
  8867. 'ui/icons': _icons2.default,
  8868. 'ui/picker': _picker2.default,
  8869. 'ui/icon-picker': _iconPicker2.default,
  8870. 'ui/color-picker': _colorPicker2.default,
  8871. 'ui/tooltip': _tooltip2.default
  8872. }, true);
  8873. exports.default = _core2.default;
  8874. /***/ }),
  8875. /* 64 */
  8876. /***/ (function(module, exports, __webpack_require__) {
  8877. "use strict";
  8878. Object.defineProperty(exports, "__esModule", {
  8879. value: true
  8880. });
  8881. exports.IndentClass = undefined;
  8882. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8883. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8884. var _parchment = __webpack_require__(0);
  8885. var _parchment2 = _interopRequireDefault(_parchment);
  8886. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8887. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8888. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8889. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8890. var IdentAttributor = function (_Parchment$Attributor) {
  8891. _inherits(IdentAttributor, _Parchment$Attributor);
  8892. function IdentAttributor() {
  8893. _classCallCheck(this, IdentAttributor);
  8894. return _possibleConstructorReturn(this, (IdentAttributor.__proto__ || Object.getPrototypeOf(IdentAttributor)).apply(this, arguments));
  8895. }
  8896. _createClass(IdentAttributor, [{
  8897. key: 'add',
  8898. value: function add(node, value) {
  8899. if (value === '+1' || value === '-1') {
  8900. var indent = this.value(node) || 0;
  8901. value = value === '+1' ? indent + 1 : indent - 1;
  8902. }
  8903. if (value === 0) {
  8904. this.remove(node);
  8905. return true;
  8906. } else {
  8907. return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'add', this).call(this, node, value);
  8908. }
  8909. }
  8910. }, {
  8911. key: 'canAdd',
  8912. value: function canAdd(node, value) {
  8913. return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, value) || _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, parseInt(value));
  8914. }
  8915. }, {
  8916. key: 'value',
  8917. value: function value(node) {
  8918. return parseInt(_get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'value', this).call(this, node)) || undefined; // Don't return NaN
  8919. }
  8920. }]);
  8921. return IdentAttributor;
  8922. }(_parchment2.default.Attributor.Class);
  8923. var IndentClass = new IdentAttributor('indent', 'ql-indent', {
  8924. scope: _parchment2.default.Scope.BLOCK,
  8925. whitelist: [1, 2, 3, 4, 5, 6, 7, 8]
  8926. });
  8927. exports.IndentClass = IndentClass;
  8928. /***/ }),
  8929. /* 65 */
  8930. /***/ (function(module, exports, __webpack_require__) {
  8931. "use strict";
  8932. Object.defineProperty(exports, "__esModule", {
  8933. value: true
  8934. });
  8935. var _block = __webpack_require__(4);
  8936. var _block2 = _interopRequireDefault(_block);
  8937. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8938. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8939. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8940. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8941. var Blockquote = function (_Block) {
  8942. _inherits(Blockquote, _Block);
  8943. function Blockquote() {
  8944. _classCallCheck(this, Blockquote);
  8945. return _possibleConstructorReturn(this, (Blockquote.__proto__ || Object.getPrototypeOf(Blockquote)).apply(this, arguments));
  8946. }
  8947. return Blockquote;
  8948. }(_block2.default);
  8949. Blockquote.blotName = 'blockquote';
  8950. Blockquote.tagName = 'blockquote';
  8951. exports.default = Blockquote;
  8952. /***/ }),
  8953. /* 66 */
  8954. /***/ (function(module, exports, __webpack_require__) {
  8955. "use strict";
  8956. Object.defineProperty(exports, "__esModule", {
  8957. value: true
  8958. });
  8959. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8960. var _block = __webpack_require__(4);
  8961. var _block2 = _interopRequireDefault(_block);
  8962. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8963. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8964. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8965. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8966. var Header = function (_Block) {
  8967. _inherits(Header, _Block);
  8968. function Header() {
  8969. _classCallCheck(this, Header);
  8970. return _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).apply(this, arguments));
  8971. }
  8972. _createClass(Header, null, [{
  8973. key: 'formats',
  8974. value: function formats(domNode) {
  8975. return this.tagName.indexOf(domNode.tagName) + 1;
  8976. }
  8977. }]);
  8978. return Header;
  8979. }(_block2.default);
  8980. Header.blotName = 'header';
  8981. Header.tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
  8982. exports.default = Header;
  8983. /***/ }),
  8984. /* 67 */
  8985. /***/ (function(module, exports, __webpack_require__) {
  8986. "use strict";
  8987. Object.defineProperty(exports, "__esModule", {
  8988. value: true
  8989. });
  8990. exports.default = exports.ListItem = undefined;
  8991. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8992. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8993. var _parchment = __webpack_require__(0);
  8994. var _parchment2 = _interopRequireDefault(_parchment);
  8995. var _block = __webpack_require__(4);
  8996. var _block2 = _interopRequireDefault(_block);
  8997. var _container = __webpack_require__(25);
  8998. var _container2 = _interopRequireDefault(_container);
  8999. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9000. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  9001. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9002. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9003. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9004. var ListItem = function (_Block) {
  9005. _inherits(ListItem, _Block);
  9006. function ListItem() {
  9007. _classCallCheck(this, ListItem);
  9008. return _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).apply(this, arguments));
  9009. }
  9010. _createClass(ListItem, [{
  9011. key: 'format',
  9012. value: function format(name, value) {
  9013. if (name === List.blotName && !value) {
  9014. this.replaceWith(_parchment2.default.create(this.statics.scope));
  9015. } else {
  9016. _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'format', this).call(this, name, value);
  9017. }
  9018. }
  9019. }, {
  9020. key: 'remove',
  9021. value: function remove() {
  9022. if (this.prev == null && this.next == null) {
  9023. this.parent.remove();
  9024. } else {
  9025. _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'remove', this).call(this);
  9026. }
  9027. }
  9028. }, {
  9029. key: 'replaceWith',
  9030. value: function replaceWith(name, value) {
  9031. this.parent.isolate(this.offset(this.parent), this.length());
  9032. if (name === this.parent.statics.blotName) {
  9033. this.parent.replaceWith(name, value);
  9034. return this;
  9035. } else {
  9036. this.parent.unwrap();
  9037. return _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'replaceWith', this).call(this, name, value);
  9038. }
  9039. }
  9040. }], [{
  9041. key: 'formats',
  9042. value: function formats(domNode) {
  9043. return domNode.tagName === this.tagName ? undefined : _get(ListItem.__proto__ || Object.getPrototypeOf(ListItem), 'formats', this).call(this, domNode);
  9044. }
  9045. }]);
  9046. return ListItem;
  9047. }(_block2.default);
  9048. ListItem.blotName = 'list-item';
  9049. ListItem.tagName = 'LI';
  9050. var List = function (_Container) {
  9051. _inherits(List, _Container);
  9052. _createClass(List, null, [{
  9053. key: 'create',
  9054. value: function create(value) {
  9055. var tagName = value === 'ordered' ? 'OL' : 'UL';
  9056. var node = _get(List.__proto__ || Object.getPrototypeOf(List), 'create', this).call(this, tagName);
  9057. if (value === 'checked' || value === 'unchecked') {
  9058. node.setAttribute('data-checked', value === 'checked');
  9059. }
  9060. return node;
  9061. }
  9062. }, {
  9063. key: 'formats',
  9064. value: function formats(domNode) {
  9065. if (domNode.tagName === 'OL') return 'ordered';
  9066. if (domNode.tagName === 'UL') {
  9067. if (domNode.hasAttribute('data-checked')) {
  9068. return domNode.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked';
  9069. } else {
  9070. return 'bullet';
  9071. }
  9072. }
  9073. return undefined;
  9074. }
  9075. }]);
  9076. function List(domNode) {
  9077. _classCallCheck(this, List);
  9078. var _this2 = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, domNode));
  9079. var listEventHandler = function listEventHandler(e) {
  9080. if (e.target.parentNode !== domNode) return;
  9081. var format = _this2.statics.formats(domNode);
  9082. var blot = _parchment2.default.find(e.target);
  9083. if (format === 'checked') {
  9084. blot.format('list', 'unchecked');
  9085. } else if (format === 'unchecked') {
  9086. blot.format('list', 'checked');
  9087. }
  9088. };
  9089. domNode.addEventListener('touchstart', listEventHandler);
  9090. domNode.addEventListener('mousedown', listEventHandler);
  9091. return _this2;
  9092. }
  9093. _createClass(List, [{
  9094. key: 'format',
  9095. value: function format(name, value) {
  9096. if (this.children.length > 0) {
  9097. this.children.tail.format(name, value);
  9098. }
  9099. }
  9100. }, {
  9101. key: 'formats',
  9102. value: function formats() {
  9103. // We don't inherit from FormatBlot
  9104. return _defineProperty({}, this.statics.blotName, this.statics.formats(this.domNode));
  9105. }
  9106. }, {
  9107. key: 'insertBefore',
  9108. value: function insertBefore(blot, ref) {
  9109. if (blot instanceof ListItem) {
  9110. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'insertBefore', this).call(this, blot, ref);
  9111. } else {
  9112. var index = ref == null ? this.length() : ref.offset(this);
  9113. var after = this.split(index);
  9114. after.parent.insertBefore(blot, after);
  9115. }
  9116. }
  9117. }, {
  9118. key: 'optimize',
  9119. value: function optimize(context) {
  9120. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'optimize', this).call(this, context);
  9121. var next = this.next;
  9122. if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute('data-checked') === this.domNode.getAttribute('data-checked')) {
  9123. next.moveChildren(this);
  9124. next.remove();
  9125. }
  9126. }
  9127. }, {
  9128. key: 'replace',
  9129. value: function replace(target) {
  9130. if (target.statics.blotName !== this.statics.blotName) {
  9131. var item = _parchment2.default.create(this.statics.defaultChild);
  9132. target.moveChildren(item);
  9133. this.appendChild(item);
  9134. }
  9135. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'replace', this).call(this, target);
  9136. }
  9137. }]);
  9138. return List;
  9139. }(_container2.default);
  9140. List.blotName = 'list';
  9141. List.scope = _parchment2.default.Scope.BLOCK_BLOT;
  9142. List.tagName = ['OL', 'UL'];
  9143. List.defaultChild = 'list-item';
  9144. List.allowedChildren = [ListItem];
  9145. exports.ListItem = ListItem;
  9146. exports.default = List;
  9147. /***/ }),
  9148. /* 68 */
  9149. /***/ (function(module, exports, __webpack_require__) {
  9150. "use strict";
  9151. Object.defineProperty(exports, "__esModule", {
  9152. value: true
  9153. });
  9154. var _bold = __webpack_require__(56);
  9155. var _bold2 = _interopRequireDefault(_bold);
  9156. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9157. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9158. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9159. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9160. var Italic = function (_Bold) {
  9161. _inherits(Italic, _Bold);
  9162. function Italic() {
  9163. _classCallCheck(this, Italic);
  9164. return _possibleConstructorReturn(this, (Italic.__proto__ || Object.getPrototypeOf(Italic)).apply(this, arguments));
  9165. }
  9166. return Italic;
  9167. }(_bold2.default);
  9168. Italic.blotName = 'italic';
  9169. Italic.tagName = ['EM', 'I'];
  9170. exports.default = Italic;
  9171. /***/ }),
  9172. /* 69 */
  9173. /***/ (function(module, exports, __webpack_require__) {
  9174. "use strict";
  9175. Object.defineProperty(exports, "__esModule", {
  9176. value: true
  9177. });
  9178. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9179. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9180. var _inline = __webpack_require__(6);
  9181. var _inline2 = _interopRequireDefault(_inline);
  9182. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9183. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9184. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9185. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9186. var Script = function (_Inline) {
  9187. _inherits(Script, _Inline);
  9188. function Script() {
  9189. _classCallCheck(this, Script);
  9190. return _possibleConstructorReturn(this, (Script.__proto__ || Object.getPrototypeOf(Script)).apply(this, arguments));
  9191. }
  9192. _createClass(Script, null, [{
  9193. key: 'create',
  9194. value: function create(value) {
  9195. if (value === 'super') {
  9196. return document.createElement('sup');
  9197. } else if (value === 'sub') {
  9198. return document.createElement('sub');
  9199. } else {
  9200. return _get(Script.__proto__ || Object.getPrototypeOf(Script), 'create', this).call(this, value);
  9201. }
  9202. }
  9203. }, {
  9204. key: 'formats',
  9205. value: function formats(domNode) {
  9206. if (domNode.tagName === 'SUB') return 'sub';
  9207. if (domNode.tagName === 'SUP') return 'super';
  9208. return undefined;
  9209. }
  9210. }]);
  9211. return Script;
  9212. }(_inline2.default);
  9213. Script.blotName = 'script';
  9214. Script.tagName = ['SUB', 'SUP'];
  9215. exports.default = Script;
  9216. /***/ }),
  9217. /* 70 */
  9218. /***/ (function(module, exports, __webpack_require__) {
  9219. "use strict";
  9220. Object.defineProperty(exports, "__esModule", {
  9221. value: true
  9222. });
  9223. var _inline = __webpack_require__(6);
  9224. var _inline2 = _interopRequireDefault(_inline);
  9225. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9226. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9227. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9228. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9229. var Strike = function (_Inline) {
  9230. _inherits(Strike, _Inline);
  9231. function Strike() {
  9232. _classCallCheck(this, Strike);
  9233. return _possibleConstructorReturn(this, (Strike.__proto__ || Object.getPrototypeOf(Strike)).apply(this, arguments));
  9234. }
  9235. return Strike;
  9236. }(_inline2.default);
  9237. Strike.blotName = 'strike';
  9238. Strike.tagName = 'S';
  9239. exports.default = Strike;
  9240. /***/ }),
  9241. /* 71 */
  9242. /***/ (function(module, exports, __webpack_require__) {
  9243. "use strict";
  9244. Object.defineProperty(exports, "__esModule", {
  9245. value: true
  9246. });
  9247. var _inline = __webpack_require__(6);
  9248. var _inline2 = _interopRequireDefault(_inline);
  9249. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9250. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9251. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9252. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9253. var Underline = function (_Inline) {
  9254. _inherits(Underline, _Inline);
  9255. function Underline() {
  9256. _classCallCheck(this, Underline);
  9257. return _possibleConstructorReturn(this, (Underline.__proto__ || Object.getPrototypeOf(Underline)).apply(this, arguments));
  9258. }
  9259. return Underline;
  9260. }(_inline2.default);
  9261. Underline.blotName = 'underline';
  9262. Underline.tagName = 'U';
  9263. exports.default = Underline;
  9264. /***/ }),
  9265. /* 72 */
  9266. /***/ (function(module, exports, __webpack_require__) {
  9267. "use strict";
  9268. Object.defineProperty(exports, "__esModule", {
  9269. value: true
  9270. });
  9271. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9272. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9273. var _parchment = __webpack_require__(0);
  9274. var _parchment2 = _interopRequireDefault(_parchment);
  9275. var _link = __webpack_require__(27);
  9276. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9277. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9278. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9279. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9280. var ATTRIBUTES = ['alt', 'height', 'width'];
  9281. var Image = function (_Parchment$Embed) {
  9282. _inherits(Image, _Parchment$Embed);
  9283. function Image() {
  9284. _classCallCheck(this, Image);
  9285. return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments));
  9286. }
  9287. _createClass(Image, [{
  9288. key: 'format',
  9289. value: function format(name, value) {
  9290. if (ATTRIBUTES.indexOf(name) > -1) {
  9291. if (value) {
  9292. this.domNode.setAttribute(name, value);
  9293. } else {
  9294. this.domNode.removeAttribute(name);
  9295. }
  9296. } else {
  9297. _get(Image.prototype.__proto__ || Object.getPrototypeOf(Image.prototype), 'format', this).call(this, name, value);
  9298. }
  9299. }
  9300. }], [{
  9301. key: 'create',
  9302. value: function create(value) {
  9303. var node = _get(Image.__proto__ || Object.getPrototypeOf(Image), 'create', this).call(this, value);
  9304. if (typeof value === 'string') {
  9305. node.setAttribute('src', this.sanitize(value));
  9306. }
  9307. return node;
  9308. }
  9309. }, {
  9310. key: 'formats',
  9311. value: function formats(domNode) {
  9312. return ATTRIBUTES.reduce(function (formats, attribute) {
  9313. if (domNode.hasAttribute(attribute)) {
  9314. formats[attribute] = domNode.getAttribute(attribute);
  9315. }
  9316. return formats;
  9317. }, {});
  9318. }
  9319. }, {
  9320. key: 'match',
  9321. value: function match(url) {
  9322. return (/\.(jpe?g|gif|png)$/.test(url) || /^data:image\/.+;base64/.test(url)
  9323. );
  9324. }
  9325. }, {
  9326. key: 'sanitize',
  9327. value: function sanitize(url) {
  9328. return (0, _link.sanitize)(url, ['http', 'https', 'data']) ? url : '//:0';
  9329. }
  9330. }, {
  9331. key: 'value',
  9332. value: function value(domNode) {
  9333. return domNode.getAttribute('src');
  9334. }
  9335. }]);
  9336. return Image;
  9337. }(_parchment2.default.Embed);
  9338. Image.blotName = 'image';
  9339. Image.tagName = 'IMG';
  9340. exports.default = Image;
  9341. /***/ }),
  9342. /* 73 */
  9343. /***/ (function(module, exports, __webpack_require__) {
  9344. "use strict";
  9345. Object.defineProperty(exports, "__esModule", {
  9346. value: true
  9347. });
  9348. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9349. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9350. var _block = __webpack_require__(4);
  9351. var _link = __webpack_require__(27);
  9352. var _link2 = _interopRequireDefault(_link);
  9353. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9354. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9355. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9356. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9357. var ATTRIBUTES = ['height', 'width'];
  9358. var Video = function (_BlockEmbed) {
  9359. _inherits(Video, _BlockEmbed);
  9360. function Video() {
  9361. _classCallCheck(this, Video);
  9362. return _possibleConstructorReturn(this, (Video.__proto__ || Object.getPrototypeOf(Video)).apply(this, arguments));
  9363. }
  9364. _createClass(Video, [{
  9365. key: 'format',
  9366. value: function format(name, value) {
  9367. if (ATTRIBUTES.indexOf(name) > -1) {
  9368. if (value) {
  9369. this.domNode.setAttribute(name, value);
  9370. } else {
  9371. this.domNode.removeAttribute(name);
  9372. }
  9373. } else {
  9374. _get(Video.prototype.__proto__ || Object.getPrototypeOf(Video.prototype), 'format', this).call(this, name, value);
  9375. }
  9376. }
  9377. }], [{
  9378. key: 'create',
  9379. value: function create(value) {
  9380. var node = _get(Video.__proto__ || Object.getPrototypeOf(Video), 'create', this).call(this, value);
  9381. node.setAttribute('frameborder', '0');
  9382. node.setAttribute('allowfullscreen', true);
  9383. node.setAttribute('src', this.sanitize(value));
  9384. return node;
  9385. }
  9386. }, {
  9387. key: 'formats',
  9388. value: function formats(domNode) {
  9389. return ATTRIBUTES.reduce(function (formats, attribute) {
  9390. if (domNode.hasAttribute(attribute)) {
  9391. formats[attribute] = domNode.getAttribute(attribute);
  9392. }
  9393. return formats;
  9394. }, {});
  9395. }
  9396. }, {
  9397. key: 'sanitize',
  9398. value: function sanitize(url) {
  9399. return _link2.default.sanitize(url);
  9400. }
  9401. }, {
  9402. key: 'value',
  9403. value: function value(domNode) {
  9404. return domNode.getAttribute('src');
  9405. }
  9406. }]);
  9407. return Video;
  9408. }(_block.BlockEmbed);
  9409. Video.blotName = 'video';
  9410. Video.className = 'ql-video';
  9411. Video.tagName = 'IFRAME';
  9412. exports.default = Video;
  9413. /***/ }),
  9414. /* 74 */
  9415. /***/ (function(module, exports, __webpack_require__) {
  9416. "use strict";
  9417. Object.defineProperty(exports, "__esModule", {
  9418. value: true
  9419. });
  9420. exports.default = exports.FormulaBlot = undefined;
  9421. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9422. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9423. var _embed = __webpack_require__(35);
  9424. var _embed2 = _interopRequireDefault(_embed);
  9425. var _quill = __webpack_require__(5);
  9426. var _quill2 = _interopRequireDefault(_quill);
  9427. var _module = __webpack_require__(9);
  9428. var _module2 = _interopRequireDefault(_module);
  9429. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9430. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9431. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9432. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9433. var FormulaBlot = function (_Embed) {
  9434. _inherits(FormulaBlot, _Embed);
  9435. function FormulaBlot() {
  9436. _classCallCheck(this, FormulaBlot);
  9437. return _possibleConstructorReturn(this, (FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot)).apply(this, arguments));
  9438. }
  9439. _createClass(FormulaBlot, null, [{
  9440. key: 'create',
  9441. value: function create(value) {
  9442. var node = _get(FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot), 'create', this).call(this, value);
  9443. if (typeof value === 'string') {
  9444. window.katex.render(value, node, {
  9445. throwOnError: false,
  9446. errorColor: '#f00'
  9447. });
  9448. node.setAttribute('data-value', value);
  9449. }
  9450. return node;
  9451. }
  9452. }, {
  9453. key: 'value',
  9454. value: function value(domNode) {
  9455. return domNode.getAttribute('data-value');
  9456. }
  9457. }]);
  9458. return FormulaBlot;
  9459. }(_embed2.default);
  9460. FormulaBlot.blotName = 'formula';
  9461. FormulaBlot.className = 'ql-formula';
  9462. FormulaBlot.tagName = 'SPAN';
  9463. var Formula = function (_Module) {
  9464. _inherits(Formula, _Module);
  9465. _createClass(Formula, null, [{
  9466. key: 'register',
  9467. value: function register() {
  9468. _quill2.default.register(FormulaBlot, true);
  9469. }
  9470. }]);
  9471. function Formula() {
  9472. _classCallCheck(this, Formula);
  9473. var _this2 = _possibleConstructorReturn(this, (Formula.__proto__ || Object.getPrototypeOf(Formula)).call(this));
  9474. if (window.katex == null) {
  9475. throw new Error('Formula module requires KaTeX.');
  9476. }
  9477. return _this2;
  9478. }
  9479. return Formula;
  9480. }(_module2.default);
  9481. exports.FormulaBlot = FormulaBlot;
  9482. exports.default = Formula;
  9483. /***/ }),
  9484. /* 75 */
  9485. /***/ (function(module, exports, __webpack_require__) {
  9486. "use strict";
  9487. Object.defineProperty(exports, "__esModule", {
  9488. value: true
  9489. });
  9490. exports.default = exports.CodeToken = exports.CodeBlock = undefined;
  9491. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9492. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9493. var _parchment = __webpack_require__(0);
  9494. var _parchment2 = _interopRequireDefault(_parchment);
  9495. var _quill = __webpack_require__(5);
  9496. var _quill2 = _interopRequireDefault(_quill);
  9497. var _module = __webpack_require__(9);
  9498. var _module2 = _interopRequireDefault(_module);
  9499. var _code = __webpack_require__(13);
  9500. var _code2 = _interopRequireDefault(_code);
  9501. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9502. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9503. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9504. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9505. var SyntaxCodeBlock = function (_CodeBlock) {
  9506. _inherits(SyntaxCodeBlock, _CodeBlock);
  9507. function SyntaxCodeBlock() {
  9508. _classCallCheck(this, SyntaxCodeBlock);
  9509. return _possibleConstructorReturn(this, (SyntaxCodeBlock.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock)).apply(this, arguments));
  9510. }
  9511. _createClass(SyntaxCodeBlock, [{
  9512. key: 'replaceWith',
  9513. value: function replaceWith(block) {
  9514. this.domNode.textContent = this.domNode.textContent;
  9515. this.attach();
  9516. _get(SyntaxCodeBlock.prototype.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock.prototype), 'replaceWith', this).call(this, block);
  9517. }
  9518. }, {
  9519. key: 'highlight',
  9520. value: function highlight(_highlight) {
  9521. var text = this.domNode.textContent;
  9522. if (this.cachedText !== text) {
  9523. if (text.trim().length > 0 || this.cachedText == null) {
  9524. this.domNode.innerHTML = _highlight(text);
  9525. this.domNode.normalize();
  9526. this.attach();
  9527. }
  9528. this.cachedText = text;
  9529. }
  9530. }
  9531. }]);
  9532. return SyntaxCodeBlock;
  9533. }(_code2.default);
  9534. SyntaxCodeBlock.className = 'ql-syntax';
  9535. var CodeToken = new _parchment2.default.Attributor.Class('token', 'hljs', {
  9536. scope: _parchment2.default.Scope.INLINE
  9537. });
  9538. var Syntax = function (_Module) {
  9539. _inherits(Syntax, _Module);
  9540. _createClass(Syntax, null, [{
  9541. key: 'register',
  9542. value: function register() {
  9543. _quill2.default.register(CodeToken, true);
  9544. _quill2.default.register(SyntaxCodeBlock, true);
  9545. }
  9546. }]);
  9547. function Syntax(quill, options) {
  9548. _classCallCheck(this, Syntax);
  9549. var _this2 = _possibleConstructorReturn(this, (Syntax.__proto__ || Object.getPrototypeOf(Syntax)).call(this, quill, options));
  9550. if (typeof _this2.options.highlight !== 'function') {
  9551. throw new Error('Syntax module requires highlight.js. Please include the library on the page before Quill.');
  9552. }
  9553. var timer = null;
  9554. _this2.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
  9555. clearTimeout(timer);
  9556. timer = setTimeout(function () {
  9557. _this2.highlight();
  9558. timer = null;
  9559. }, _this2.options.interval);
  9560. });
  9561. _this2.highlight();
  9562. return _this2;
  9563. }
  9564. _createClass(Syntax, [{
  9565. key: 'highlight',
  9566. value: function highlight() {
  9567. var _this3 = this;
  9568. if (this.quill.selection.composing) return;
  9569. this.quill.update(_quill2.default.sources.USER);
  9570. var range = this.quill.getSelection();
  9571. this.quill.scroll.descendants(SyntaxCodeBlock).forEach(function (code) {
  9572. code.highlight(_this3.options.highlight);
  9573. });
  9574. this.quill.update(_quill2.default.sources.SILENT);
  9575. if (range != null) {
  9576. this.quill.setSelection(range, _quill2.default.sources.SILENT);
  9577. }
  9578. }
  9579. }]);
  9580. return Syntax;
  9581. }(_module2.default);
  9582. Syntax.DEFAULTS = {
  9583. highlight: function () {
  9584. if (window.hljs == null) return null;
  9585. return function (text) {
  9586. var result = window.hljs.highlightAuto(text);
  9587. return result.value;
  9588. };
  9589. }(),
  9590. interval: 1000
  9591. };
  9592. exports.CodeBlock = SyntaxCodeBlock;
  9593. exports.CodeToken = CodeToken;
  9594. exports.default = Syntax;
  9595. /***/ }),
  9596. /* 76 */
  9597. /***/ (function(module, exports) {
  9598. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>";
  9599. /***/ }),
  9600. /* 77 */
  9601. /***/ (function(module, exports) {
  9602. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>";
  9603. /***/ }),
  9604. /* 78 */
  9605. /***/ (function(module, exports) {
  9606. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>";
  9607. /***/ }),
  9608. /* 79 */
  9609. /***/ (function(module, exports) {
  9610. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>";
  9611. /***/ }),
  9612. /* 80 */
  9613. /***/ (function(module, exports) {
  9614. module.exports = "<svg viewbox=\"0 0 18 18\"> <g class=\"ql-fill ql-color-label\"> <polygon points=\"6 6.868 6 6 5 6 5 7 5.942 7 6 6.868\"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points=\"6.817 5 6 5 6 6 6.38 6 6.817 5\"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points=\"4 11.439 4 11 3 11 3 12 3.755 12 4 11.439\"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points=\"4.63 10 4 10 4 11 4.192 11 4.63 10\"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <polygon points=\"13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174\"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points=\"12 6.868 12 6 11.62 6 12 6.868\"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points=\"12.933 9 13 9 13 8 12.495 8 12.933 9\"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points=\"5.5 13 9 5 12.5 13\"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>";
  9615. /***/ }),
  9616. /* 81 */
  9617. /***/ (function(module, exports) {
  9618. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=\"ql-fill ql-stroke\" height=3 width=3 x=4 y=5></rect> <rect class=\"ql-fill ql-stroke\" height=3 width=3 x=11 y=5></rect> <path class=\"ql-even ql-fill ql-stroke\" d=M7,8c0,4.031-3,5-3,5></path> <path class=\"ql-even ql-fill ql-stroke\" d=M14,8c0,4.031-3,5-3,5></path> </svg>";
  9619. /***/ }),
  9620. /* 82 */
  9621. /***/ (function(module, exports) {
  9622. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-stroke d=M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z></path> <path class=ql-stroke d=M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z></path> </svg>";
  9623. /***/ }),
  9624. /* 83 */
  9625. /***/ (function(module, exports) {
  9626. module.exports = "<svg class=\"\" viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>";
  9627. /***/ }),
  9628. /* 84 */
  9629. /***/ (function(module, exports) {
  9630. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=\"ql-color-label ql-stroke ql-transparent\" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points=\"5.5 11 9 3 12.5 11\"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>";
  9631. /***/ }),
  9632. /* 85 */
  9633. /***/ (function(module, exports) {
  9634. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=\"ql-stroke ql-fill\" points=\"3 11 5 9 3 7 3 11\"></polygon> <line class=\"ql-stroke ql-fill\" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>";
  9635. /***/ }),
  9636. /* 86 */
  9637. /***/ (function(module, exports) {
  9638. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=\"ql-stroke ql-fill\" points=\"15 12 13 10 15 8 15 12\"></polygon> <line class=\"ql-stroke ql-fill\" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>";
  9639. /***/ }),
  9640. /* 87 */
  9641. /***/ (function(module, exports) {
  9642. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>";
  9643. /***/ }),
  9644. /* 88 */
  9645. /***/ (function(module, exports) {
  9646. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>";
  9647. /***/ }),
  9648. /* 89 */
  9649. /***/ (function(module, exports) {
  9650. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>";
  9651. /***/ }),
  9652. /* 90 */
  9653. /***/ (function(module, exports) {
  9654. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform=\"translate(24 18) rotate(-180)\"/> </svg>";
  9655. /***/ }),
  9656. /* 91 */
  9657. /***/ (function(module, exports) {
  9658. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <path class=ql-fill d=M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z></path> </svg>";
  9659. /***/ }),
  9660. /* 92 */
  9661. /***/ (function(module, exports) {
  9662. module.exports = "<svg viewBox=\"0 0 18 18\"> <path class=ql-fill d=M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z /> </svg>";
  9663. /***/ }),
  9664. /* 93 */
  9665. /***/ (function(module, exports) {
  9666. module.exports = "<svg viewBox=\"0 0 18 18\"> <path class=ql-fill d=M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z /> </svg>";
  9667. /***/ }),
  9668. /* 94 */
  9669. /***/ (function(module, exports) {
  9670. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>";
  9671. /***/ }),
  9672. /* 95 */
  9673. /***/ (function(module, exports) {
  9674. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class=\"ql-even ql-fill\" points=\"5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12\"></polyline> </svg>";
  9675. /***/ }),
  9676. /* 96 */
  9677. /***/ (function(module, exports) {
  9678. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=\"ql-fill ql-stroke\" points=\"3 7 3 11 5 9 3 7\"></polyline> </svg>";
  9679. /***/ }),
  9680. /* 97 */
  9681. /***/ (function(module, exports) {
  9682. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points=\"5 7 5 11 3 9 5 7\"></polyline> </svg>";
  9683. /***/ }),
  9684. /* 98 */
  9685. /***/ (function(module, exports) {
  9686. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <path class=\"ql-even ql-stroke\" d=M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z></path> <path class=\"ql-even ql-stroke\" d=M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z></path> </svg>";
  9687. /***/ }),
  9688. /* 99 */
  9689. /***/ (function(module, exports) {
  9690. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class=\"ql-stroke ql-thin\" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <path class=ql-fill d=M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z></path> <path class=\"ql-stroke ql-thin\" d=M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156></path> <path class=\"ql-stroke ql-thin\" d=M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109></path> </svg>";
  9691. /***/ }),
  9692. /* 100 */
  9693. /***/ (function(module, exports) {
  9694. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>";
  9695. /***/ }),
  9696. /* 101 */
  9697. /***/ (function(module, exports) {
  9698. module.exports = "<svg class=\"\" viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points=\"3 4 4 5 6 3\"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points=\"3 14 4 15 6 13\"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points=\"3 9 4 10 6 8\"></polyline> </svg>";
  9699. /***/ }),
  9700. /* 102 */
  9701. /***/ (function(module, exports) {
  9702. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z /> <path class=ql-fill d=M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z /> </svg>";
  9703. /***/ }),
  9704. /* 103 */
  9705. /***/ (function(module, exports) {
  9706. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z /> <path class=ql-fill d=M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z /> </svg>";
  9707. /***/ }),
  9708. /* 104 */
  9709. /***/ (function(module, exports) {
  9710. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=\"ql-stroke ql-thin\" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <path class=ql-fill d=M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z></path> <path class=ql-fill d=M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z></path> </svg>";
  9711. /***/ }),
  9712. /* 105 */
  9713. /***/ (function(module, exports) {
  9714. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-stroke d=M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>";
  9715. /***/ }),
  9716. /* 106 */
  9717. /***/ (function(module, exports) {
  9718. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>";
  9719. /***/ }),
  9720. /* 107 */
  9721. /***/ (function(module, exports) {
  9722. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=ql-stroke points=\"7 11 9 13 11 11 7 11\"></polygon> <polygon class=ql-stroke points=\"7 7 9 5 11 7 7 7\"></polygon> </svg>";
  9723. /***/ }),
  9724. /* 108 */
  9725. /***/ (function(module, exports, __webpack_require__) {
  9726. "use strict";
  9727. Object.defineProperty(exports, "__esModule", {
  9728. value: true
  9729. });
  9730. exports.default = exports.BubbleTooltip = undefined;
  9731. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9732. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9733. var _extend = __webpack_require__(3);
  9734. var _extend2 = _interopRequireDefault(_extend);
  9735. var _emitter = __webpack_require__(8);
  9736. var _emitter2 = _interopRequireDefault(_emitter);
  9737. var _base = __webpack_require__(43);
  9738. var _base2 = _interopRequireDefault(_base);
  9739. var _selection = __webpack_require__(15);
  9740. var _icons = __webpack_require__(41);
  9741. var _icons2 = _interopRequireDefault(_icons);
  9742. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9743. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9744. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9745. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9746. var TOOLBAR_CONFIG = [['bold', 'italic', 'link'], [{ header: 1 }, { header: 2 }, 'blockquote']];
  9747. var BubbleTheme = function (_BaseTheme) {
  9748. _inherits(BubbleTheme, _BaseTheme);
  9749. function BubbleTheme(quill, options) {
  9750. _classCallCheck(this, BubbleTheme);
  9751. if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
  9752. options.modules.toolbar.container = TOOLBAR_CONFIG;
  9753. }
  9754. var _this = _possibleConstructorReturn(this, (BubbleTheme.__proto__ || Object.getPrototypeOf(BubbleTheme)).call(this, quill, options));
  9755. _this.quill.container.classList.add('ql-bubble');
  9756. return _this;
  9757. }
  9758. _createClass(BubbleTheme, [{
  9759. key: 'extendToolbar',
  9760. value: function extendToolbar(toolbar) {
  9761. this.tooltip = new BubbleTooltip(this.quill, this.options.bounds);
  9762. this.tooltip.root.appendChild(toolbar.container);
  9763. this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
  9764. this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
  9765. }
  9766. }]);
  9767. return BubbleTheme;
  9768. }(_base2.default);
  9769. BubbleTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
  9770. modules: {
  9771. toolbar: {
  9772. handlers: {
  9773. link: function link(value) {
  9774. if (!value) {
  9775. this.quill.format('link', false);
  9776. } else {
  9777. this.quill.theme.tooltip.edit();
  9778. }
  9779. }
  9780. }
  9781. }
  9782. }
  9783. });
  9784. var BubbleTooltip = function (_BaseTooltip) {
  9785. _inherits(BubbleTooltip, _BaseTooltip);
  9786. function BubbleTooltip(quill, bounds) {
  9787. _classCallCheck(this, BubbleTooltip);
  9788. var _this2 = _possibleConstructorReturn(this, (BubbleTooltip.__proto__ || Object.getPrototypeOf(BubbleTooltip)).call(this, quill, bounds));
  9789. _this2.quill.on(_emitter2.default.events.EDITOR_CHANGE, function (type, range, oldRange, source) {
  9790. if (type !== _emitter2.default.events.SELECTION_CHANGE) return;
  9791. if (range != null && range.length > 0 && source === _emitter2.default.sources.USER) {
  9792. _this2.show();
  9793. // Lock our width so we will expand beyond our offsetParent boundaries
  9794. _this2.root.style.left = '0px';
  9795. _this2.root.style.width = '';
  9796. _this2.root.style.width = _this2.root.offsetWidth + 'px';
  9797. var lines = _this2.quill.getLines(range.index, range.length);
  9798. if (lines.length === 1) {
  9799. _this2.position(_this2.quill.getBounds(range));
  9800. } else {
  9801. var lastLine = lines[lines.length - 1];
  9802. var index = _this2.quill.getIndex(lastLine);
  9803. var length = Math.min(lastLine.length() - 1, range.index + range.length - index);
  9804. var _bounds = _this2.quill.getBounds(new _selection.Range(index, length));
  9805. _this2.position(_bounds);
  9806. }
  9807. } else if (document.activeElement !== _this2.textbox && _this2.quill.hasFocus()) {
  9808. _this2.hide();
  9809. }
  9810. });
  9811. return _this2;
  9812. }
  9813. _createClass(BubbleTooltip, [{
  9814. key: 'listen',
  9815. value: function listen() {
  9816. var _this3 = this;
  9817. _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'listen', this).call(this);
  9818. this.root.querySelector('.ql-close').addEventListener('click', function () {
  9819. _this3.root.classList.remove('ql-editing');
  9820. });
  9821. this.quill.on(_emitter2.default.events.SCROLL_OPTIMIZE, function () {
  9822. // Let selection be restored by toolbar handlers before repositioning
  9823. setTimeout(function () {
  9824. if (_this3.root.classList.contains('ql-hidden')) return;
  9825. var range = _this3.quill.getSelection();
  9826. if (range != null) {
  9827. _this3.position(_this3.quill.getBounds(range));
  9828. }
  9829. }, 1);
  9830. });
  9831. }
  9832. }, {
  9833. key: 'cancel',
  9834. value: function cancel() {
  9835. this.show();
  9836. }
  9837. }, {
  9838. key: 'position',
  9839. value: function position(reference) {
  9840. var shift = _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'position', this).call(this, reference);
  9841. var arrow = this.root.querySelector('.ql-tooltip-arrow');
  9842. arrow.style.marginLeft = '';
  9843. if (shift === 0) return shift;
  9844. arrow.style.marginLeft = -1 * shift - arrow.offsetWidth / 2 + 'px';
  9845. }
  9846. }]);
  9847. return BubbleTooltip;
  9848. }(_base.BaseTooltip);
  9849. BubbleTooltip.TEMPLATE = ['<span class="ql-tooltip-arrow"></span>', '<div class="ql-tooltip-editor">', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-close"></a>', '</div>'].join('');
  9850. exports.BubbleTooltip = BubbleTooltip;
  9851. exports.default = BubbleTheme;
  9852. /***/ }),
  9853. /* 109 */
  9854. /***/ (function(module, exports, __webpack_require__) {
  9855. module.exports = __webpack_require__(63);
  9856. /***/ })
  9857. /******/ ])["default"];
  9858. });
  9859. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("fd40").Buffer))
  9860. /***/ }),
  9861. /***/ "0a60":
  9862. /***/ (function(module, exports) {
  9863. exports.f = Object.getOwnPropertySymbols;
  9864. /***/ }),
  9865. /***/ "0fc1":
  9866. /***/ (function(module, exports, __webpack_require__) {
  9867. var DESCRIPTORS = __webpack_require__("1e2c");
  9868. var definePropertyModule = __webpack_require__("d910");
  9869. var createPropertyDescriptor = __webpack_require__("38b9");
  9870. module.exports = DESCRIPTORS ? function (object, key, value) {
  9871. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  9872. } : function (object, key, value) {
  9873. object[key] = value;
  9874. return object;
  9875. };
  9876. /***/ }),
  9877. /***/ "1025":
  9878. /***/ (function(module, exports, __webpack_require__) {
  9879. var store = __webpack_require__("3a08");
  9880. var functionToString = Function.toString;
  9881. // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
  9882. if (typeof store.inspectSource != 'function') {
  9883. store.inspectSource = function (it) {
  9884. return functionToString.call(it);
  9885. };
  9886. }
  9887. module.exports = store.inspectSource;
  9888. /***/ }),
  9889. /***/ "121a":
  9890. /***/ (function(module, exports, __webpack_require__) {
  9891. // extracted by mini-css-extract-plugin
  9892. /***/ }),
  9893. /***/ "18f6":
  9894. /***/ (function(module, exports) {
  9895. // IE8- don't enum bug keys
  9896. module.exports = [
  9897. 'constructor',
  9898. 'hasOwnProperty',
  9899. 'isPrototypeOf',
  9900. 'propertyIsEnumerable',
  9901. 'toLocaleString',
  9902. 'toString',
  9903. 'valueOf'
  9904. ];
  9905. /***/ }),
  9906. /***/ "1944":
  9907. /***/ (function(module, exports, __webpack_require__) {
  9908. var global = __webpack_require__("d890");
  9909. var createNonEnumerableProperty = __webpack_require__("0fc1");
  9910. var has = __webpack_require__("faa8");
  9911. var setGlobal = __webpack_require__("e4db");
  9912. var inspectSource = __webpack_require__("1025");
  9913. var InternalStateModule = __webpack_require__("b702");
  9914. var getInternalState = InternalStateModule.get;
  9915. var enforceInternalState = InternalStateModule.enforce;
  9916. var TEMPLATE = String(String).split('String');
  9917. (module.exports = function (O, key, value, options) {
  9918. var unsafe = options ? !!options.unsafe : false;
  9919. var simple = options ? !!options.enumerable : false;
  9920. var noTargetGet = options ? !!options.noTargetGet : false;
  9921. if (typeof value == 'function') {
  9922. if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
  9923. enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
  9924. }
  9925. if (O === global) {
  9926. if (simple) O[key] = value;
  9927. else setGlobal(key, value);
  9928. return;
  9929. } else if (!unsafe) {
  9930. delete O[key];
  9931. } else if (!noTargetGet && O[key]) {
  9932. simple = true;
  9933. }
  9934. if (simple) O[key] = value;
  9935. else createNonEnumerableProperty(O, key, value);
  9936. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  9937. })(Function.prototype, 'toString', function toString() {
  9938. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  9939. });
  9940. /***/ }),
  9941. /***/ "1b99":
  9942. /***/ (function(module, exports, __webpack_require__) {
  9943. var global = __webpack_require__("d890");
  9944. module.exports = global;
  9945. /***/ }),
  9946. /***/ "1bbd":
  9947. /***/ (function(module, exports, __webpack_require__) {
  9948. "use strict";
  9949. var toPrimitive = __webpack_require__("9f67");
  9950. var definePropertyModule = __webpack_require__("d910");
  9951. var createPropertyDescriptor = __webpack_require__("38b9");
  9952. module.exports = function (object, key, value) {
  9953. var propertyKey = toPrimitive(key);
  9954. if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  9955. else object[propertyKey] = value;
  9956. };
  9957. /***/ }),
  9958. /***/ "1c8b":
  9959. /***/ (function(module, exports, __webpack_require__) {
  9960. var global = __webpack_require__("d890");
  9961. var getOwnPropertyDescriptor = __webpack_require__("aa6b").f;
  9962. var createNonEnumerableProperty = __webpack_require__("0fc1");
  9963. var redefine = __webpack_require__("1944");
  9964. var setGlobal = __webpack_require__("e4db");
  9965. var copyConstructorProperties = __webpack_require__("c69d");
  9966. var isForced = __webpack_require__("e8d6");
  9967. /*
  9968. options.target - name of the target object
  9969. options.global - target is the global object
  9970. options.stat - export as static methods of target
  9971. options.proto - export as prototype methods of target
  9972. options.real - real prototype method for the `pure` version
  9973. options.forced - export even if the native feature is available
  9974. options.bind - bind methods to the target, required for the `pure` version
  9975. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  9976. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  9977. options.sham - add a flag to not completely full polyfills
  9978. options.enumerable - export as enumerable property
  9979. options.noTargetGet - prevent calling a getter on target
  9980. */
  9981. module.exports = function (options, source) {
  9982. var TARGET = options.target;
  9983. var GLOBAL = options.global;
  9984. var STATIC = options.stat;
  9985. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  9986. if (GLOBAL) {
  9987. target = global;
  9988. } else if (STATIC) {
  9989. target = global[TARGET] || setGlobal(TARGET, {});
  9990. } else {
  9991. target = (global[TARGET] || {}).prototype;
  9992. }
  9993. if (target) for (key in source) {
  9994. sourceProperty = source[key];
  9995. if (options.noTargetGet) {
  9996. descriptor = getOwnPropertyDescriptor(target, key);
  9997. targetProperty = descriptor && descriptor.value;
  9998. } else targetProperty = target[key];
  9999. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  10000. // contained in target
  10001. if (!FORCED && targetProperty !== undefined) {
  10002. if (typeof sourceProperty === typeof targetProperty) continue;
  10003. copyConstructorProperties(sourceProperty, targetProperty);
  10004. }
  10005. // add a flag to not completely full polyfills
  10006. if (options.sham || (targetProperty && targetProperty.sham)) {
  10007. createNonEnumerableProperty(sourceProperty, 'sham', true);
  10008. }
  10009. // extend global
  10010. redefine(target, key, sourceProperty, options);
  10011. }
  10012. };
  10013. /***/ }),
  10014. /***/ "1ca1":
  10015. /***/ (function(module, exports, __webpack_require__) {
  10016. var isObject = __webpack_require__("a719");
  10017. var isArray = __webpack_require__("74e7");
  10018. var wellKnownSymbol = __webpack_require__("90fb");
  10019. var SPECIES = wellKnownSymbol('species');
  10020. // `ArraySpeciesCreate` abstract operation
  10021. // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
  10022. module.exports = function (originalArray, length) {
  10023. var C;
  10024. if (isArray(originalArray)) {
  10025. C = originalArray.constructor;
  10026. // cross-realm fallback
  10027. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  10028. else if (isObject(C)) {
  10029. C = C[SPECIES];
  10030. if (C === null) C = undefined;
  10031. }
  10032. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  10033. };
  10034. /***/ }),
  10035. /***/ "1e2c":
  10036. /***/ (function(module, exports, __webpack_require__) {
  10037. var fails = __webpack_require__("efe2");
  10038. // Thank's IE8 for his funny defineProperty
  10039. module.exports = !fails(function () {
  10040. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  10041. });
  10042. /***/ }),
  10043. /***/ "1ea7":
  10044. /***/ (function(module, exports, __webpack_require__) {
  10045. var fails = __webpack_require__("efe2");
  10046. var wellKnownSymbol = __webpack_require__("90fb");
  10047. var V8_VERSION = __webpack_require__("f594");
  10048. var SPECIES = wellKnownSymbol('species');
  10049. module.exports = function (METHOD_NAME) {
  10050. // We can't use this feature detection in V8 since it causes
  10051. // deoptimization and serious performance degradation
  10052. // https://github.com/zloirock/core-js/issues/677
  10053. return V8_VERSION >= 51 || !fails(function () {
  10054. var array = [];
  10055. var constructor = array.constructor = {};
  10056. constructor[SPECIES] = function () {
  10057. return { foo: 1 };
  10058. };
  10059. return array[METHOD_NAME](Boolean).foo !== 1;
  10060. });
  10061. };
  10062. /***/ }),
  10063. /***/ "2039":
  10064. /***/ (function(module, exports, __webpack_require__) {
  10065. var DESCRIPTORS = __webpack_require__("1e2c");
  10066. var fails = __webpack_require__("efe2");
  10067. var createElement = __webpack_require__("ae25");
  10068. // Thank's IE8 for his funny defineProperty
  10069. module.exports = !DESCRIPTORS && !fails(function () {
  10070. return Object.defineProperty(createElement('div'), 'a', {
  10071. get: function () { return 7; }
  10072. }).a != 7;
  10073. });
  10074. /***/ }),
  10075. /***/ "2118":
  10076. /***/ (function(module, exports) {
  10077. var toString = {}.toString;
  10078. module.exports = function (it) {
  10079. return toString.call(it).slice(8, -1);
  10080. };
  10081. /***/ }),
  10082. /***/ "2732":
  10083. /***/ (function(module, exports) {
  10084. // `RequireObjectCoercible` abstract operation
  10085. // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
  10086. module.exports = function (it) {
  10087. if (it == undefined) throw TypeError("Can't call method on " + it);
  10088. return it;
  10089. };
  10090. /***/ }),
  10091. /***/ "27cd":
  10092. /***/ (function(module, exports, __webpack_require__) {
  10093. "use strict";
  10094. exports.byteLength = byteLength
  10095. exports.toByteArray = toByteArray
  10096. exports.fromByteArray = fromByteArray
  10097. var lookup = []
  10098. var revLookup = []
  10099. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  10100. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  10101. for (var i = 0, len = code.length; i < len; ++i) {
  10102. lookup[i] = code[i]
  10103. revLookup[code.charCodeAt(i)] = i
  10104. }
  10105. // Support decoding URL-safe base64 strings, as Node.js does.
  10106. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  10107. revLookup['-'.charCodeAt(0)] = 62
  10108. revLookup['_'.charCodeAt(0)] = 63
  10109. function getLens (b64) {
  10110. var len = b64.length
  10111. if (len % 4 > 0) {
  10112. throw new Error('Invalid string. Length must be a multiple of 4')
  10113. }
  10114. // Trim off extra bytes after placeholder bytes are found
  10115. // See: https://github.com/beatgammit/base64-js/issues/42
  10116. var validLen = b64.indexOf('=')
  10117. if (validLen === -1) validLen = len
  10118. var placeHoldersLen = validLen === len
  10119. ? 0
  10120. : 4 - (validLen % 4)
  10121. return [validLen, placeHoldersLen]
  10122. }
  10123. // base64 is 4/3 + up to two characters of the original data
  10124. function byteLength (b64) {
  10125. var lens = getLens(b64)
  10126. var validLen = lens[0]
  10127. var placeHoldersLen = lens[1]
  10128. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  10129. }
  10130. function _byteLength (b64, validLen, placeHoldersLen) {
  10131. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  10132. }
  10133. function toByteArray (b64) {
  10134. var tmp
  10135. var lens = getLens(b64)
  10136. var validLen = lens[0]
  10137. var placeHoldersLen = lens[1]
  10138. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  10139. var curByte = 0
  10140. // if there are placeholders, only get up to the last complete 4 chars
  10141. var len = placeHoldersLen > 0
  10142. ? validLen - 4
  10143. : validLen
  10144. var i
  10145. for (i = 0; i < len; i += 4) {
  10146. tmp =
  10147. (revLookup[b64.charCodeAt(i)] << 18) |
  10148. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  10149. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  10150. revLookup[b64.charCodeAt(i + 3)]
  10151. arr[curByte++] = (tmp >> 16) & 0xFF
  10152. arr[curByte++] = (tmp >> 8) & 0xFF
  10153. arr[curByte++] = tmp & 0xFF
  10154. }
  10155. if (placeHoldersLen === 2) {
  10156. tmp =
  10157. (revLookup[b64.charCodeAt(i)] << 2) |
  10158. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  10159. arr[curByte++] = tmp & 0xFF
  10160. }
  10161. if (placeHoldersLen === 1) {
  10162. tmp =
  10163. (revLookup[b64.charCodeAt(i)] << 10) |
  10164. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  10165. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  10166. arr[curByte++] = (tmp >> 8) & 0xFF
  10167. arr[curByte++] = tmp & 0xFF
  10168. }
  10169. return arr
  10170. }
  10171. function tripletToBase64 (num) {
  10172. return lookup[num >> 18 & 0x3F] +
  10173. lookup[num >> 12 & 0x3F] +
  10174. lookup[num >> 6 & 0x3F] +
  10175. lookup[num & 0x3F]
  10176. }
  10177. function encodeChunk (uint8, start, end) {
  10178. var tmp
  10179. var output = []
  10180. for (var i = start; i < end; i += 3) {
  10181. tmp =
  10182. ((uint8[i] << 16) & 0xFF0000) +
  10183. ((uint8[i + 1] << 8) & 0xFF00) +
  10184. (uint8[i + 2] & 0xFF)
  10185. output.push(tripletToBase64(tmp))
  10186. }
  10187. return output.join('')
  10188. }
  10189. function fromByteArray (uint8) {
  10190. var tmp
  10191. var len = uint8.length
  10192. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  10193. var parts = []
  10194. var maxChunkLength = 16383 // must be multiple of 3
  10195. // go through the array every three bytes, we'll deal with trailing stuff later
  10196. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  10197. parts.push(encodeChunk(
  10198. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  10199. ))
  10200. }
  10201. // pad the end with zeros, but make sure to not forget the extra bytes
  10202. if (extraBytes === 1) {
  10203. tmp = uint8[len - 1]
  10204. parts.push(
  10205. lookup[tmp >> 2] +
  10206. lookup[(tmp << 4) & 0x3F] +
  10207. '=='
  10208. )
  10209. } else if (extraBytes === 2) {
  10210. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  10211. parts.push(
  10212. lookup[tmp >> 10] +
  10213. lookup[(tmp >> 4) & 0x3F] +
  10214. lookup[(tmp << 2) & 0x3F] +
  10215. '='
  10216. )
  10217. }
  10218. return parts.join('')
  10219. }
  10220. /***/ }),
  10221. /***/ "3553":
  10222. /***/ (function(module, exports, __webpack_require__) {
  10223. var requireObjectCoercible = __webpack_require__("2732");
  10224. // `ToObject` abstract operation
  10225. // https://tc39.github.io/ecma262/#sec-toobject
  10226. module.exports = function (argument) {
  10227. return Object(requireObjectCoercible(argument));
  10228. };
  10229. /***/ }),
  10230. /***/ "38b9":
  10231. /***/ (function(module, exports) {
  10232. module.exports = function (bitmap, value) {
  10233. return {
  10234. enumerable: !(bitmap & 1),
  10235. configurable: !(bitmap & 2),
  10236. writable: !(bitmap & 4),
  10237. value: value
  10238. };
  10239. };
  10240. /***/ }),
  10241. /***/ "3a08":
  10242. /***/ (function(module, exports, __webpack_require__) {
  10243. var global = __webpack_require__("d890");
  10244. var setGlobal = __webpack_require__("e4db");
  10245. var SHARED = '__core-js_shared__';
  10246. var store = global[SHARED] || setGlobal(SHARED, {});
  10247. module.exports = store;
  10248. /***/ }),
  10249. /***/ "3da3":
  10250. /***/ (function(module, exports) {
  10251. var ceil = Math.ceil;
  10252. var floor = Math.floor;
  10253. // `ToInteger` abstract operation
  10254. // https://tc39.github.io/ecma262/#sec-tointeger
  10255. module.exports = function (argument) {
  10256. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  10257. };
  10258. /***/ }),
  10259. /***/ "45af":
  10260. /***/ (function(module, exports, __webpack_require__) {
  10261. var toIndexedObject = __webpack_require__("da10");
  10262. var toLength = __webpack_require__("d88d");
  10263. var toAbsoluteIndex = __webpack_require__("e1d6");
  10264. // `Array.prototype.{ indexOf, includes }` methods implementation
  10265. var createMethod = function (IS_INCLUDES) {
  10266. return function ($this, el, fromIndex) {
  10267. var O = toIndexedObject($this);
  10268. var length = toLength(O.length);
  10269. var index = toAbsoluteIndex(fromIndex, length);
  10270. var value;
  10271. // Array#includes uses SameValueZero equality algorithm
  10272. // eslint-disable-next-line no-self-compare
  10273. if (IS_INCLUDES && el != el) while (length > index) {
  10274. value = O[index++];
  10275. // eslint-disable-next-line no-self-compare
  10276. if (value != value) return true;
  10277. // Array#indexOf ignores holes, Array#includes - not
  10278. } else for (;length > index; index++) {
  10279. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  10280. } return !IS_INCLUDES && -1;
  10281. };
  10282. };
  10283. module.exports = {
  10284. // `Array.prototype.includes` method
  10285. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  10286. includes: createMethod(true),
  10287. // `Array.prototype.indexOf` method
  10288. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  10289. indexOf: createMethod(false)
  10290. };
  10291. /***/ }),
  10292. /***/ "4fda":
  10293. /***/ (function(module, exports, __webpack_require__) {
  10294. var getBuiltIn = __webpack_require__("6d7a");
  10295. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  10296. /***/ }),
  10297. /***/ "50fb":
  10298. /***/ (function(module, exports, __webpack_require__) {
  10299. var anObject = __webpack_require__("857c");
  10300. var aPossiblePrototype = __webpack_require__("d1fd");
  10301. // `Object.setPrototypeOf` method
  10302. // https://tc39.github.io/ecma262/#sec-object.setprototypeof
  10303. // Works with __proto__ only. Old v8 can't work with null proto objects.
  10304. /* eslint-disable no-proto */
  10305. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  10306. var CORRECT_SETTER = false;
  10307. var test = {};
  10308. var setter;
  10309. try {
  10310. setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
  10311. setter.call(test, []);
  10312. CORRECT_SETTER = test instanceof Array;
  10313. } catch (error) { /* empty */ }
  10314. return function setPrototypeOf(O, proto) {
  10315. anObject(O);
  10316. aPossiblePrototype(proto);
  10317. if (CORRECT_SETTER) setter.call(O, proto);
  10318. else O.__proto__ = proto;
  10319. return O;
  10320. };
  10321. }() : undefined);
  10322. /***/ }),
  10323. /***/ "513c":
  10324. /***/ (function(module, exports, __webpack_require__) {
  10325. "use strict";
  10326. var DESCRIPTORS = __webpack_require__("1e2c");
  10327. var global = __webpack_require__("d890");
  10328. var isForced = __webpack_require__("e8d6");
  10329. var redefine = __webpack_require__("1944");
  10330. var has = __webpack_require__("faa8");
  10331. var classof = __webpack_require__("2118");
  10332. var inheritIfRequired = __webpack_require__("7063");
  10333. var toPrimitive = __webpack_require__("9f67");
  10334. var fails = __webpack_require__("efe2");
  10335. var create = __webpack_require__("6d60");
  10336. var getOwnPropertyNames = __webpack_require__("b338").f;
  10337. var getOwnPropertyDescriptor = __webpack_require__("aa6b").f;
  10338. var defineProperty = __webpack_require__("d910").f;
  10339. var trim = __webpack_require__("c10f").trim;
  10340. var NUMBER = 'Number';
  10341. var NativeNumber = global[NUMBER];
  10342. var NumberPrototype = NativeNumber.prototype;
  10343. // Opera ~12 has broken Object#toString
  10344. var BROKEN_CLASSOF = classof(create(NumberPrototype)) == NUMBER;
  10345. // `ToNumber` abstract operation
  10346. // https://tc39.github.io/ecma262/#sec-tonumber
  10347. var toNumber = function (argument) {
  10348. var it = toPrimitive(argument, false);
  10349. var first, third, radix, maxCode, digits, length, index, code;
  10350. if (typeof it == 'string' && it.length > 2) {
  10351. it = trim(it);
  10352. first = it.charCodeAt(0);
  10353. if (first === 43 || first === 45) {
  10354. third = it.charCodeAt(2);
  10355. if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
  10356. } else if (first === 48) {
  10357. switch (it.charCodeAt(1)) {
  10358. case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
  10359. case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
  10360. default: return +it;
  10361. }
  10362. digits = it.slice(2);
  10363. length = digits.length;
  10364. for (index = 0; index < length; index++) {
  10365. code = digits.charCodeAt(index);
  10366. // parseInt parses a string to a first unavailable symbol
  10367. // but ToNumber should return NaN if a string contains unavailable symbols
  10368. if (code < 48 || code > maxCode) return NaN;
  10369. } return parseInt(digits, radix);
  10370. }
  10371. } return +it;
  10372. };
  10373. // `Number` constructor
  10374. // https://tc39.github.io/ecma262/#sec-number-constructor
  10375. if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
  10376. var NumberWrapper = function Number(value) {
  10377. var it = arguments.length < 1 ? 0 : value;
  10378. var dummy = this;
  10379. return dummy instanceof NumberWrapper
  10380. // check on 1..constructor(foo) case
  10381. && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classof(dummy) != NUMBER)
  10382. ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
  10383. };
  10384. for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : (
  10385. // ES3:
  10386. 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  10387. // ES2015 (in case, if modules with ES2015 Number statics required before):
  10388. 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
  10389. 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
  10390. ).split(','), j = 0, key; keys.length > j; j++) {
  10391. if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) {
  10392. defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));
  10393. }
  10394. }
  10395. NumberWrapper.prototype = NumberPrototype;
  10396. NumberPrototype.constructor = NumberWrapper;
  10397. redefine(global, NUMBER, NumberWrapper);
  10398. }
  10399. /***/ }),
  10400. /***/ "571a":
  10401. /***/ (function(module, exports) {
  10402. var toString = {}.toString;
  10403. module.exports = Array.isArray || function (arr) {
  10404. return toString.call(arr) == '[object Array]';
  10405. };
  10406. /***/ }),
  10407. /***/ "604f":
  10408. /***/ (function(module, exports, __webpack_require__) {
  10409. var global = __webpack_require__("d890");
  10410. var inspectSource = __webpack_require__("1025");
  10411. var WeakMap = global.WeakMap;
  10412. module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
  10413. /***/ }),
  10414. /***/ "692f":
  10415. /***/ (function(module, exports, __webpack_require__) {
  10416. var fails = __webpack_require__("efe2");
  10417. var classof = __webpack_require__("2118");
  10418. var split = ''.split;
  10419. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  10420. module.exports = fails(function () {
  10421. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  10422. // eslint-disable-next-line no-prototype-builtins
  10423. return !Object('z').propertyIsEnumerable(0);
  10424. }) ? function (it) {
  10425. return classof(it) == 'String' ? split.call(it, '') : Object(it);
  10426. } : Object;
  10427. /***/ }),
  10428. /***/ "6d28":
  10429. /***/ (function(module, exports, __webpack_require__) {
  10430. var IS_PURE = __webpack_require__("9b9d");
  10431. var store = __webpack_require__("3a08");
  10432. (module.exports = function (key, value) {
  10433. return store[key] || (store[key] = value !== undefined ? value : {});
  10434. })('versions', []).push({
  10435. version: '3.6.5',
  10436. mode: IS_PURE ? 'pure' : 'global',
  10437. copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
  10438. });
  10439. /***/ }),
  10440. /***/ "6d60":
  10441. /***/ (function(module, exports, __webpack_require__) {
  10442. var anObject = __webpack_require__("857c");
  10443. var defineProperties = __webpack_require__("dbe8");
  10444. var enumBugKeys = __webpack_require__("18f6");
  10445. var hiddenKeys = __webpack_require__("d5a8");
  10446. var html = __webpack_require__("6fdf");
  10447. var documentCreateElement = __webpack_require__("ae25");
  10448. var sharedKey = __webpack_require__("7db2");
  10449. var GT = '>';
  10450. var LT = '<';
  10451. var PROTOTYPE = 'prototype';
  10452. var SCRIPT = 'script';
  10453. var IE_PROTO = sharedKey('IE_PROTO');
  10454. var EmptyConstructor = function () { /* empty */ };
  10455. var scriptTag = function (content) {
  10456. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  10457. };
  10458. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  10459. var NullProtoObjectViaActiveX = function (activeXDocument) {
  10460. activeXDocument.write(scriptTag(''));
  10461. activeXDocument.close();
  10462. var temp = activeXDocument.parentWindow.Object;
  10463. activeXDocument = null; // avoid memory leak
  10464. return temp;
  10465. };
  10466. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  10467. var NullProtoObjectViaIFrame = function () {
  10468. // Thrash, waste and sodomy: IE GC bug
  10469. var iframe = documentCreateElement('iframe');
  10470. var JS = 'java' + SCRIPT + ':';
  10471. var iframeDocument;
  10472. iframe.style.display = 'none';
  10473. html.appendChild(iframe);
  10474. // https://github.com/zloirock/core-js/issues/475
  10475. iframe.src = String(JS);
  10476. iframeDocument = iframe.contentWindow.document;
  10477. iframeDocument.open();
  10478. iframeDocument.write(scriptTag('document.F=Object'));
  10479. iframeDocument.close();
  10480. return iframeDocument.F;
  10481. };
  10482. // Check for document.domain and active x support
  10483. // No need to use active x approach when document.domain is not set
  10484. // see https://github.com/es-shims/es5-shim/issues/150
  10485. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  10486. // avoid IE GC bug
  10487. var activeXDocument;
  10488. var NullProtoObject = function () {
  10489. try {
  10490. /* global ActiveXObject */
  10491. activeXDocument = document.domain && new ActiveXObject('htmlfile');
  10492. } catch (error) { /* ignore */ }
  10493. NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
  10494. var length = enumBugKeys.length;
  10495. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  10496. return NullProtoObject();
  10497. };
  10498. hiddenKeys[IE_PROTO] = true;
  10499. // `Object.create` method
  10500. // https://tc39.github.io/ecma262/#sec-object.create
  10501. module.exports = Object.create || function create(O, Properties) {
  10502. var result;
  10503. if (O !== null) {
  10504. EmptyConstructor[PROTOTYPE] = anObject(O);
  10505. result = new EmptyConstructor();
  10506. EmptyConstructor[PROTOTYPE] = null;
  10507. // add "__proto__" for Object.getPrototypeOf polyfill
  10508. result[IE_PROTO] = O;
  10509. } else result = NullProtoObject();
  10510. return Properties === undefined ? result : defineProperties(result, Properties);
  10511. };
  10512. /***/ }),
  10513. /***/ "6d7a":
  10514. /***/ (function(module, exports, __webpack_require__) {
  10515. var path = __webpack_require__("1b99");
  10516. var global = __webpack_require__("d890");
  10517. var aFunction = function (variable) {
  10518. return typeof variable == 'function' ? variable : undefined;
  10519. };
  10520. module.exports = function (namespace, method) {
  10521. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
  10522. : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
  10523. };
  10524. /***/ }),
  10525. /***/ "6fdf":
  10526. /***/ (function(module, exports, __webpack_require__) {
  10527. var getBuiltIn = __webpack_require__("6d7a");
  10528. module.exports = getBuiltIn('document', 'documentElement');
  10529. /***/ }),
  10530. /***/ "7063":
  10531. /***/ (function(module, exports, __webpack_require__) {
  10532. var isObject = __webpack_require__("a719");
  10533. var setPrototypeOf = __webpack_require__("50fb");
  10534. // makes subclassing work correct for wrapped built-ins
  10535. module.exports = function ($this, dummy, Wrapper) {
  10536. var NewTarget, NewTargetPrototype;
  10537. if (
  10538. // it can work only with native `setPrototypeOf`
  10539. setPrototypeOf &&
  10540. // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
  10541. typeof (NewTarget = dummy.constructor) == 'function' &&
  10542. NewTarget !== Wrapper &&
  10543. isObject(NewTargetPrototype = NewTarget.prototype) &&
  10544. NewTargetPrototype !== Wrapper.prototype
  10545. ) setPrototypeOf($this, NewTargetPrototype);
  10546. return $this;
  10547. };
  10548. /***/ }),
  10549. /***/ "74cb":
  10550. /***/ (function(module, exports, __webpack_require__) {
  10551. var NATIVE_SYMBOL = __webpack_require__("c54b");
  10552. module.exports = NATIVE_SYMBOL
  10553. // eslint-disable-next-line no-undef
  10554. && !Symbol.sham
  10555. // eslint-disable-next-line no-undef
  10556. && typeof Symbol.iterator == 'symbol';
  10557. /***/ }),
  10558. /***/ "74e7":
  10559. /***/ (function(module, exports, __webpack_require__) {
  10560. var classof = __webpack_require__("2118");
  10561. // `IsArray` abstract operation
  10562. // https://tc39.github.io/ecma262/#sec-isarray
  10563. module.exports = Array.isArray || function isArray(arg) {
  10564. return classof(arg) == 'Array';
  10565. };
  10566. /***/ }),
  10567. /***/ "79e4":
  10568. /***/ (function(module, exports, __webpack_require__) {
  10569. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller
  10570. // MIT license
  10571. // source: https://github.com/amiller-gh/currentScript-polyfill
  10572. // added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505
  10573. (function (root, factory) {
  10574. if (true) {
  10575. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  10576. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  10577. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  10578. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  10579. } else {}
  10580. }(typeof self !== 'undefined' ? self : this, function () {
  10581. function getCurrentScript () {
  10582. var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')
  10583. // for chrome
  10584. if (!descriptor && 'currentScript' in document && document.currentScript) {
  10585. return document.currentScript
  10586. }
  10587. // for other browsers with native support for currentScript
  10588. if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {
  10589. return document.currentScript
  10590. }
  10591. // IE 8-10 support script readyState
  10592. // IE 11+ & Firefox support stack trace
  10593. try {
  10594. throw new Error();
  10595. }
  10596. catch (err) {
  10597. // Find the second match for the "at" string to get file src url from stack.
  10598. var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
  10599. ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
  10600. stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
  10601. scriptLocation = (stackDetails && stackDetails[1]) || false,
  10602. line = (stackDetails && stackDetails[2]) || false,
  10603. currentLocation = document.location.href.replace(document.location.hash, ''),
  10604. pageSource,
  10605. inlineScriptSourceRegExp,
  10606. inlineScriptSource,
  10607. scripts = document.getElementsByTagName('script'); // Live NodeList collection
  10608. if (scriptLocation === currentLocation) {
  10609. pageSource = document.documentElement.outerHTML;
  10610. inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
  10611. inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
  10612. }
  10613. for (var i = 0; i < scripts.length; i++) {
  10614. // If ready state is interactive, return the script tag
  10615. if (scripts[i].readyState === 'interactive') {
  10616. return scripts[i];
  10617. }
  10618. // If src matches, return the script tag
  10619. if (scripts[i].src === scriptLocation) {
  10620. return scripts[i];
  10621. }
  10622. // If inline source matches, return the script tag
  10623. if (
  10624. scriptLocation === currentLocation &&
  10625. scripts[i].innerHTML &&
  10626. scripts[i].innerHTML.trim() === inlineScriptSource
  10627. ) {
  10628. return scripts[i];
  10629. }
  10630. }
  10631. // If no match, return null
  10632. return null;
  10633. }
  10634. };
  10635. return getCurrentScript
  10636. }));
  10637. /***/ }),
  10638. /***/ "7db2":
  10639. /***/ (function(module, exports, __webpack_require__) {
  10640. var shared = __webpack_require__("6d28");
  10641. var uid = __webpack_require__("7e8b");
  10642. var keys = shared('keys');
  10643. module.exports = function (key) {
  10644. return keys[key] || (keys[key] = uid(key));
  10645. };
  10646. /***/ }),
  10647. /***/ "7e41":
  10648. /***/ (function(module, exports, __webpack_require__) {
  10649. // extracted by mini-css-extract-plugin
  10650. /***/ }),
  10651. /***/ "7e8b":
  10652. /***/ (function(module, exports) {
  10653. var id = 0;
  10654. var postfix = Math.random();
  10655. module.exports = function (key) {
  10656. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  10657. };
  10658. /***/ }),
  10659. /***/ "857c":
  10660. /***/ (function(module, exports, __webpack_require__) {
  10661. var isObject = __webpack_require__("a719");
  10662. module.exports = function (it) {
  10663. if (!isObject(it)) {
  10664. throw TypeError(String(it) + ' is not an object');
  10665. } return it;
  10666. };
  10667. /***/ }),
  10668. /***/ "8d44":
  10669. /***/ (function(module, exports, __webpack_require__) {
  10670. var getBuiltIn = __webpack_require__("6d7a");
  10671. var getOwnPropertyNamesModule = __webpack_require__("b338");
  10672. var getOwnPropertySymbolsModule = __webpack_require__("0a60");
  10673. var anObject = __webpack_require__("857c");
  10674. // all object keys, includes non-enumerable and symbols
  10675. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  10676. var keys = getOwnPropertyNamesModule.f(anObject(it));
  10677. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  10678. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  10679. };
  10680. /***/ }),
  10681. /***/ "90fb":
  10682. /***/ (function(module, exports, __webpack_require__) {
  10683. var global = __webpack_require__("d890");
  10684. var shared = __webpack_require__("6d28");
  10685. var has = __webpack_require__("faa8");
  10686. var uid = __webpack_require__("7e8b");
  10687. var NATIVE_SYMBOL = __webpack_require__("c54b");
  10688. var USE_SYMBOL_AS_UID = __webpack_require__("74cb");
  10689. var WellKnownSymbolsStore = shared('wks');
  10690. var Symbol = global.Symbol;
  10691. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  10692. module.exports = function (name) {
  10693. if (!has(WellKnownSymbolsStore, name)) {
  10694. if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name];
  10695. else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  10696. } return WellKnownSymbolsStore[name];
  10697. };
  10698. /***/ }),
  10699. /***/ "96be":
  10700. /***/ (function(module, exports, __webpack_require__) {
  10701. // extracted by mini-css-extract-plugin
  10702. /***/ }),
  10703. /***/ "9896":
  10704. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  10705. "use strict";
  10706. // ESM COMPAT FLAG
  10707. __webpack_require__.r(__webpack_exports__);
  10708. // CONCATENATED MODULE: ./node_modules/_@vue_cli-service@4.4.6@@vue/cli-service/lib/commands/build/setPublicPath.js
  10709. // This file is imported into lib/wc client bundles.
  10710. if (typeof window !== 'undefined') {
  10711. var currentScript = window.document.currentScript
  10712. if (true) {
  10713. var getCurrentScript = __webpack_require__("79e4")
  10714. currentScript = getCurrentScript()
  10715. // for backward compatibility, because previously we directly included the polyfill
  10716. if (!('currentScript' in document)) {
  10717. Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
  10718. }
  10719. }
  10720. var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
  10721. if (src) {
  10722. __webpack_require__.p = src[1] // eslint-disable-line
  10723. }
  10724. }
  10725. // Indicate to webpack that this file can be concatenated
  10726. /* harmony default export */ var setPublicPath = (null);
  10727. // CONCATENATED MODULE: ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5873f86c-vue-loader-template"}!./node_modules/_vue-loader@15.9.3@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options!./src/components/index.vue?vue&type=template&id=0a189f7e&
  10728. var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vab-quill",class:_vm.classes},[_c('div',{ref:"editor",style:(_vm.styles)})])}
  10729. var staticRenderFns = []
  10730. // CONCATENATED MODULE: ./src/components/index.vue?vue&type=template&id=0a189f7e&
  10731. // EXTERNAL MODULE: ./node_modules/_core-js@3.6.5@core-js/modules/es.array.concat.js
  10732. var es_array_concat = __webpack_require__("b4fb");
  10733. // EXTERNAL MODULE: ./node_modules/_core-js@3.6.5@core-js/modules/es.number.constructor.js
  10734. var es_number_constructor = __webpack_require__("513c");
  10735. // EXTERNAL MODULE: ./node_modules/_quill@1.3.7@quill/dist/quill.js
  10736. var quill = __webpack_require__("0126");
  10737. var quill_default = /*#__PURE__*/__webpack_require__.n(quill);
  10738. // EXTERNAL MODULE: ./node_modules/_quill@1.3.7@quill/dist/quill.core.css
  10739. var quill_core = __webpack_require__("121a");
  10740. // EXTERNAL MODULE: ./node_modules/_quill@1.3.7@quill/dist/quill.snow.css
  10741. var quill_snow = __webpack_require__("7e41");
  10742. // EXTERNAL MODULE: ./node_modules/_quill@1.3.7@quill/dist/quill.bubble.css
  10743. var quill_bubble = __webpack_require__("96be");
  10744. // CONCATENATED MODULE: ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.1.0@babel-loader/lib!./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options!./src/components/index.vue?vue&type=script&lang=js&
  10745. //
  10746. //
  10747. //
  10748. //
  10749. //
  10750. //
  10751. /* harmony default export */ var componentsvue_type_script_lang_js_ = ({
  10752. name: "VabQuill",
  10753. props: {
  10754. value: {
  10755. type: String,
  10756. default: ""
  10757. },
  10758. border: {
  10759. type: Boolean,
  10760. default: false
  10761. },
  10762. height: {
  10763. type: Number,
  10764. default: null
  10765. },
  10766. minHeight: {
  10767. type: Number,
  10768. default: null
  10769. }
  10770. },
  10771. data: function data() {
  10772. return {
  10773. Quill: null,
  10774. currentValue: "",
  10775. options: {
  10776. theme: "snow",
  10777. bounds: document.body,
  10778. debug: "warn",
  10779. modules: {
  10780. toolbar: [["bold", "italic", "underline", "strike"], [{
  10781. header: [1, 2, 3, 4, 5, 6, false]
  10782. }], [{
  10783. size: ["small", false, "large", "huge"]
  10784. }], [{
  10785. color: []
  10786. }, {
  10787. background: []
  10788. }], ["blockquote", "code-block"], [{
  10789. list: "ordered"
  10790. }, {
  10791. list: "bullet"
  10792. }], [{
  10793. indent: "-1"
  10794. }, {
  10795. indent: "+1"
  10796. }], [{
  10797. align: []
  10798. }], [{
  10799. direction: "rtl"
  10800. }], ["clean"], ["link", "image"]]
  10801. },
  10802. placeholder: "内容...",
  10803. readOnly: false
  10804. }
  10805. };
  10806. },
  10807. computed: {
  10808. classes: function classes() {
  10809. return [{
  10810. "vab-quill-no-border": !this.border
  10811. }];
  10812. },
  10813. styles: function styles() {
  10814. var style = {};
  10815. if (this.minHeight) {
  10816. style.minHeight = "".concat(this.minHeight, "px");
  10817. }
  10818. if (this.height) {
  10819. style.height = "".concat(this.height, "px");
  10820. }
  10821. return style;
  10822. }
  10823. },
  10824. watch: {
  10825. value: {
  10826. handler: function handler(val) {
  10827. if (val !== this.currentValue) {
  10828. this.currentValue = val;
  10829. if (this.Quill) {
  10830. this.Quill.pasteHTML(this.value);
  10831. }
  10832. }
  10833. },
  10834. immediate: true
  10835. }
  10836. },
  10837. mounted: function mounted() {
  10838. this.init();
  10839. },
  10840. beforeDestroy: function beforeDestroy() {
  10841. this.Quill = null;
  10842. },
  10843. methods: {
  10844. init: function init() {
  10845. var _this = this;
  10846. var editor = this.$refs.editor;
  10847. this.Quill = new quill_default.a(editor, this.options);
  10848. this.Quill.pasteHTML(this.currentValue);
  10849. this.Quill.on("text-change", function (delta, oldDelta, source) {
  10850. var html = _this.$refs.editor.children[0].innerHTML;
  10851. var text = _this.Quill.getText();
  10852. var quill = _this.Quill;
  10853. _this.currentValue = html;
  10854. _this.$emit("input", html);
  10855. _this.$emit("on-change", {
  10856. html: html,
  10857. text: text,
  10858. quill: quill
  10859. });
  10860. });
  10861. this.Quill.on("text-change", function (delta, oldDelta, source) {
  10862. _this.$emit("on-text-change", delta, oldDelta, source);
  10863. });
  10864. this.Quill.on("selection-change", function (range, oldRange, source) {
  10865. _this.$emit("on-selection-change", range, oldRange, source);
  10866. });
  10867. this.Quill.on("editor-change", function (eventName) {
  10868. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  10869. args[_key - 1] = arguments[_key];
  10870. }
  10871. _this.$emit.apply(_this, ["on-editor-change", eventName].concat(args));
  10872. });
  10873. }
  10874. }
  10875. });
  10876. // CONCATENATED MODULE: ./src/components/index.vue?vue&type=script&lang=js&
  10877. /* harmony default export */ var src_componentsvue_type_script_lang_js_ = (componentsvue_type_script_lang_js_);
  10878. // CONCATENATED MODULE: ./node_modules/_vue-loader@15.9.3@vue-loader/lib/runtime/componentNormalizer.js
  10879. /* globals __VUE_SSR_CONTEXT__ */
  10880. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  10881. // This module is a runtime utility for cleaner component module output and will
  10882. // be included in the final webpack user bundle.
  10883. function normalizeComponent (
  10884. scriptExports,
  10885. render,
  10886. staticRenderFns,
  10887. functionalTemplate,
  10888. injectStyles,
  10889. scopeId,
  10890. moduleIdentifier, /* server only */
  10891. shadowMode /* vue-cli only */
  10892. ) {
  10893. // Vue.extend constructor export interop
  10894. var options = typeof scriptExports === 'function'
  10895. ? scriptExports.options
  10896. : scriptExports
  10897. // render functions
  10898. if (render) {
  10899. options.render = render
  10900. options.staticRenderFns = staticRenderFns
  10901. options._compiled = true
  10902. }
  10903. // functional template
  10904. if (functionalTemplate) {
  10905. options.functional = true
  10906. }
  10907. // scopedId
  10908. if (scopeId) {
  10909. options._scopeId = 'data-v-' + scopeId
  10910. }
  10911. var hook
  10912. if (moduleIdentifier) { // server build
  10913. hook = function (context) {
  10914. // 2.3 injection
  10915. context =
  10916. context || // cached call
  10917. (this.$vnode && this.$vnode.ssrContext) || // stateful
  10918. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  10919. // 2.2 with runInNewContext: true
  10920. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  10921. context = __VUE_SSR_CONTEXT__
  10922. }
  10923. // inject component styles
  10924. if (injectStyles) {
  10925. injectStyles.call(this, context)
  10926. }
  10927. // register component module identifier for async chunk inferrence
  10928. if (context && context._registeredComponents) {
  10929. context._registeredComponents.add(moduleIdentifier)
  10930. }
  10931. }
  10932. // used by ssr in case component is cached and beforeCreate
  10933. // never gets called
  10934. options._ssrRegister = hook
  10935. } else if (injectStyles) {
  10936. hook = shadowMode
  10937. ? function () {
  10938. injectStyles.call(
  10939. this,
  10940. (options.functional ? this.parent : this).$root.$options.shadowRoot
  10941. )
  10942. }
  10943. : injectStyles
  10944. }
  10945. if (hook) {
  10946. if (options.functional) {
  10947. // for template-only hot-reload because in that case the render fn doesn't
  10948. // go through the normalizer
  10949. options._injectStyles = hook
  10950. // register for functional component in vue file
  10951. var originalRender = options.render
  10952. options.render = function renderWithStyleInjection (h, context) {
  10953. hook.call(context)
  10954. return originalRender(h, context)
  10955. }
  10956. } else {
  10957. // inject component registration as beforeCreate hook
  10958. var existing = options.beforeCreate
  10959. options.beforeCreate = existing
  10960. ? [].concat(existing, hook)
  10961. : [hook]
  10962. }
  10963. }
  10964. return {
  10965. exports: scriptExports,
  10966. options: options
  10967. }
  10968. }
  10969. // CONCATENATED MODULE: ./src/components/index.vue
  10970. /* normalize component */
  10971. var component = normalizeComponent(
  10972. src_componentsvue_type_script_lang_js_,
  10973. render,
  10974. staticRenderFns,
  10975. false,
  10976. null,
  10977. null,
  10978. null
  10979. )
  10980. /* harmony default export */ var components = (component.exports);
  10981. // CONCATENATED MODULE: ./src/components/export.js
  10982. /* harmony default export */ var components_export = (components);
  10983. if (typeof window !== "undefined" && window.Vue) {
  10984. window.Vue.component("zx-quill", components);
  10985. }
  10986. // CONCATENATED MODULE: ./node_modules/_@vue_cli-service@4.4.6@@vue/cli-service/lib/commands/build/entry-lib.js
  10987. /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (components_export);
  10988. /***/ }),
  10989. /***/ "9b9d":
  10990. /***/ (function(module, exports) {
  10991. module.exports = false;
  10992. /***/ }),
  10993. /***/ "9edd":
  10994. /***/ (function(module, exports) {
  10995. var g;
  10996. // This works in non-strict mode
  10997. g = (function() {
  10998. return this;
  10999. })();
  11000. try {
  11001. // This works if eval is allowed (see CSP)
  11002. g = g || new Function("return this")();
  11003. } catch (e) {
  11004. // This works if the window reference is available
  11005. if (typeof window === "object") g = window;
  11006. }
  11007. // g can still be undefined, but nothing to do about it...
  11008. // We return undefined, instead of nothing here, so it's
  11009. // easier to handle this case. if(!global) { ...}
  11010. module.exports = g;
  11011. /***/ }),
  11012. /***/ "9f67":
  11013. /***/ (function(module, exports, __webpack_require__) {
  11014. var isObject = __webpack_require__("a719");
  11015. // `ToPrimitive` abstract operation
  11016. // https://tc39.github.io/ecma262/#sec-toprimitive
  11017. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  11018. // and the second argument - flag - preferred type is a string
  11019. module.exports = function (input, PREFERRED_STRING) {
  11020. if (!isObject(input)) return input;
  11021. var fn, val;
  11022. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  11023. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  11024. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  11025. throw TypeError("Can't convert object to primitive value");
  11026. };
  11027. /***/ }),
  11028. /***/ "a719":
  11029. /***/ (function(module, exports) {
  11030. module.exports = function (it) {
  11031. return typeof it === 'object' ? it !== null : typeof it === 'function';
  11032. };
  11033. /***/ }),
  11034. /***/ "aa6b":
  11035. /***/ (function(module, exports, __webpack_require__) {
  11036. var DESCRIPTORS = __webpack_require__("1e2c");
  11037. var propertyIsEnumerableModule = __webpack_require__("ef71");
  11038. var createPropertyDescriptor = __webpack_require__("38b9");
  11039. var toIndexedObject = __webpack_require__("da10");
  11040. var toPrimitive = __webpack_require__("9f67");
  11041. var has = __webpack_require__("faa8");
  11042. var IE8_DOM_DEFINE = __webpack_require__("2039");
  11043. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  11044. // `Object.getOwnPropertyDescriptor` method
  11045. // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
  11046. exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  11047. O = toIndexedObject(O);
  11048. P = toPrimitive(P, true);
  11049. if (IE8_DOM_DEFINE) try {
  11050. return nativeGetOwnPropertyDescriptor(O, P);
  11051. } catch (error) { /* empty */ }
  11052. if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
  11053. };
  11054. /***/ }),
  11055. /***/ "ae25":
  11056. /***/ (function(module, exports, __webpack_require__) {
  11057. var global = __webpack_require__("d890");
  11058. var isObject = __webpack_require__("a719");
  11059. var document = global.document;
  11060. // typeof document.createElement is 'object' in old IE
  11061. var EXISTS = isObject(document) && isObject(document.createElement);
  11062. module.exports = function (it) {
  11063. return EXISTS ? document.createElement(it) : {};
  11064. };
  11065. /***/ }),
  11066. /***/ "b338":
  11067. /***/ (function(module, exports, __webpack_require__) {
  11068. var internalObjectKeys = __webpack_require__("ead4");
  11069. var enumBugKeys = __webpack_require__("18f6");
  11070. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  11071. // `Object.getOwnPropertyNames` method
  11072. // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
  11073. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  11074. return internalObjectKeys(O, hiddenKeys);
  11075. };
  11076. /***/ }),
  11077. /***/ "b4fb":
  11078. /***/ (function(module, exports, __webpack_require__) {
  11079. "use strict";
  11080. var $ = __webpack_require__("1c8b");
  11081. var fails = __webpack_require__("efe2");
  11082. var isArray = __webpack_require__("74e7");
  11083. var isObject = __webpack_require__("a719");
  11084. var toObject = __webpack_require__("3553");
  11085. var toLength = __webpack_require__("d88d");
  11086. var createProperty = __webpack_require__("1bbd");
  11087. var arraySpeciesCreate = __webpack_require__("1ca1");
  11088. var arrayMethodHasSpeciesSupport = __webpack_require__("1ea7");
  11089. var wellKnownSymbol = __webpack_require__("90fb");
  11090. var V8_VERSION = __webpack_require__("f594");
  11091. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  11092. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  11093. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  11094. // We can't use this feature detection in V8 since it causes
  11095. // deoptimization and serious performance degradation
  11096. // https://github.com/zloirock/core-js/issues/679
  11097. var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
  11098. var array = [];
  11099. array[IS_CONCAT_SPREADABLE] = false;
  11100. return array.concat()[0] !== array;
  11101. });
  11102. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  11103. var isConcatSpreadable = function (O) {
  11104. if (!isObject(O)) return false;
  11105. var spreadable = O[IS_CONCAT_SPREADABLE];
  11106. return spreadable !== undefined ? !!spreadable : isArray(O);
  11107. };
  11108. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  11109. // `Array.prototype.concat` method
  11110. // https://tc39.github.io/ecma262/#sec-array.prototype.concat
  11111. // with adding support of @@isConcatSpreadable and @@species
  11112. $({ target: 'Array', proto: true, forced: FORCED }, {
  11113. concat: function concat(arg) { // eslint-disable-line no-unused-vars
  11114. var O = toObject(this);
  11115. var A = arraySpeciesCreate(O, 0);
  11116. var n = 0;
  11117. var i, k, length, len, E;
  11118. for (i = -1, length = arguments.length; i < length; i++) {
  11119. E = i === -1 ? O : arguments[i];
  11120. if (isConcatSpreadable(E)) {
  11121. len = toLength(E.length);
  11122. if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  11123. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  11124. } else {
  11125. if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  11126. createProperty(A, n++, E);
  11127. }
  11128. }
  11129. A.length = n;
  11130. return A;
  11131. }
  11132. });
  11133. /***/ }),
  11134. /***/ "b702":
  11135. /***/ (function(module, exports, __webpack_require__) {
  11136. var NATIVE_WEAK_MAP = __webpack_require__("604f");
  11137. var global = __webpack_require__("d890");
  11138. var isObject = __webpack_require__("a719");
  11139. var createNonEnumerableProperty = __webpack_require__("0fc1");
  11140. var objectHas = __webpack_require__("faa8");
  11141. var sharedKey = __webpack_require__("7db2");
  11142. var hiddenKeys = __webpack_require__("d5a8");
  11143. var WeakMap = global.WeakMap;
  11144. var set, get, has;
  11145. var enforce = function (it) {
  11146. return has(it) ? get(it) : set(it, {});
  11147. };
  11148. var getterFor = function (TYPE) {
  11149. return function (it) {
  11150. var state;
  11151. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  11152. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  11153. } return state;
  11154. };
  11155. };
  11156. if (NATIVE_WEAK_MAP) {
  11157. var store = new WeakMap();
  11158. var wmget = store.get;
  11159. var wmhas = store.has;
  11160. var wmset = store.set;
  11161. set = function (it, metadata) {
  11162. wmset.call(store, it, metadata);
  11163. return metadata;
  11164. };
  11165. get = function (it) {
  11166. return wmget.call(store, it) || {};
  11167. };
  11168. has = function (it) {
  11169. return wmhas.call(store, it);
  11170. };
  11171. } else {
  11172. var STATE = sharedKey('state');
  11173. hiddenKeys[STATE] = true;
  11174. set = function (it, metadata) {
  11175. createNonEnumerableProperty(it, STATE, metadata);
  11176. return metadata;
  11177. };
  11178. get = function (it) {
  11179. return objectHas(it, STATE) ? it[STATE] : {};
  11180. };
  11181. has = function (it) {
  11182. return objectHas(it, STATE);
  11183. };
  11184. }
  11185. module.exports = {
  11186. set: set,
  11187. get: get,
  11188. has: has,
  11189. enforce: enforce,
  11190. getterFor: getterFor
  11191. };
  11192. /***/ }),
  11193. /***/ "c10f":
  11194. /***/ (function(module, exports, __webpack_require__) {
  11195. var requireObjectCoercible = __webpack_require__("2732");
  11196. var whitespaces = __webpack_require__("fc8c");
  11197. var whitespace = '[' + whitespaces + ']';
  11198. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  11199. var rtrim = RegExp(whitespace + whitespace + '*$');
  11200. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  11201. var createMethod = function (TYPE) {
  11202. return function ($this) {
  11203. var string = String(requireObjectCoercible($this));
  11204. if (TYPE & 1) string = string.replace(ltrim, '');
  11205. if (TYPE & 2) string = string.replace(rtrim, '');
  11206. return string;
  11207. };
  11208. };
  11209. module.exports = {
  11210. // `String.prototype.{ trimLeft, trimStart }` methods
  11211. // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
  11212. start: createMethod(1),
  11213. // `String.prototype.{ trimRight, trimEnd }` methods
  11214. // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
  11215. end: createMethod(2),
  11216. // `String.prototype.trim` method
  11217. // https://tc39.github.io/ecma262/#sec-string.prototype.trim
  11218. trim: createMethod(3)
  11219. };
  11220. /***/ }),
  11221. /***/ "c54b":
  11222. /***/ (function(module, exports, __webpack_require__) {
  11223. var fails = __webpack_require__("efe2");
  11224. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  11225. // Chrome 38 Symbol has incorrect toString conversion
  11226. // eslint-disable-next-line no-undef
  11227. return !String(Symbol());
  11228. });
  11229. /***/ }),
  11230. /***/ "c69d":
  11231. /***/ (function(module, exports, __webpack_require__) {
  11232. var has = __webpack_require__("faa8");
  11233. var ownKeys = __webpack_require__("8d44");
  11234. var getOwnPropertyDescriptorModule = __webpack_require__("aa6b");
  11235. var definePropertyModule = __webpack_require__("d910");
  11236. module.exports = function (target, source) {
  11237. var keys = ownKeys(source);
  11238. var defineProperty = definePropertyModule.f;
  11239. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  11240. for (var i = 0; i < keys.length; i++) {
  11241. var key = keys[i];
  11242. if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  11243. }
  11244. };
  11245. /***/ }),
  11246. /***/ "cbab":
  11247. /***/ (function(module, exports, __webpack_require__) {
  11248. var internalObjectKeys = __webpack_require__("ead4");
  11249. var enumBugKeys = __webpack_require__("18f6");
  11250. // `Object.keys` method
  11251. // https://tc39.github.io/ecma262/#sec-object.keys
  11252. module.exports = Object.keys || function keys(O) {
  11253. return internalObjectKeys(O, enumBugKeys);
  11254. };
  11255. /***/ }),
  11256. /***/ "d1fd":
  11257. /***/ (function(module, exports, __webpack_require__) {
  11258. var isObject = __webpack_require__("a719");
  11259. module.exports = function (it) {
  11260. if (!isObject(it) && it !== null) {
  11261. throw TypeError("Can't set " + String(it) + ' as a prototype');
  11262. } return it;
  11263. };
  11264. /***/ }),
  11265. /***/ "d5a8":
  11266. /***/ (function(module, exports) {
  11267. module.exports = {};
  11268. /***/ }),
  11269. /***/ "d88d":
  11270. /***/ (function(module, exports, __webpack_require__) {
  11271. var toInteger = __webpack_require__("3da3");
  11272. var min = Math.min;
  11273. // `ToLength` abstract operation
  11274. // https://tc39.github.io/ecma262/#sec-tolength
  11275. module.exports = function (argument) {
  11276. return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  11277. };
  11278. /***/ }),
  11279. /***/ "d890":
  11280. /***/ (function(module, exports, __webpack_require__) {
  11281. /* WEBPACK VAR INJECTION */(function(global) {var check = function (it) {
  11282. return it && it.Math == Math && it;
  11283. };
  11284. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  11285. module.exports =
  11286. // eslint-disable-next-line no-undef
  11287. check(typeof globalThis == 'object' && globalThis) ||
  11288. check(typeof window == 'object' && window) ||
  11289. check(typeof self == 'object' && self) ||
  11290. check(typeof global == 'object' && global) ||
  11291. // eslint-disable-next-line no-new-func
  11292. Function('return this')();
  11293. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("9edd")))
  11294. /***/ }),
  11295. /***/ "d910":
  11296. /***/ (function(module, exports, __webpack_require__) {
  11297. var DESCRIPTORS = __webpack_require__("1e2c");
  11298. var IE8_DOM_DEFINE = __webpack_require__("2039");
  11299. var anObject = __webpack_require__("857c");
  11300. var toPrimitive = __webpack_require__("9f67");
  11301. var nativeDefineProperty = Object.defineProperty;
  11302. // `Object.defineProperty` method
  11303. // https://tc39.github.io/ecma262/#sec-object.defineproperty
  11304. exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  11305. anObject(O);
  11306. P = toPrimitive(P, true);
  11307. anObject(Attributes);
  11308. if (IE8_DOM_DEFINE) try {
  11309. return nativeDefineProperty(O, P, Attributes);
  11310. } catch (error) { /* empty */ }
  11311. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  11312. if ('value' in Attributes) O[P] = Attributes.value;
  11313. return O;
  11314. };
  11315. /***/ }),
  11316. /***/ "da10":
  11317. /***/ (function(module, exports, __webpack_require__) {
  11318. // toObject with fallback for non-array-like ES3 strings
  11319. var IndexedObject = __webpack_require__("692f");
  11320. var requireObjectCoercible = __webpack_require__("2732");
  11321. module.exports = function (it) {
  11322. return IndexedObject(requireObjectCoercible(it));
  11323. };
  11324. /***/ }),
  11325. /***/ "dbe8":
  11326. /***/ (function(module, exports, __webpack_require__) {
  11327. var DESCRIPTORS = __webpack_require__("1e2c");
  11328. var definePropertyModule = __webpack_require__("d910");
  11329. var anObject = __webpack_require__("857c");
  11330. var objectKeys = __webpack_require__("cbab");
  11331. // `Object.defineProperties` method
  11332. // https://tc39.github.io/ecma262/#sec-object.defineproperties
  11333. module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
  11334. anObject(O);
  11335. var keys = objectKeys(Properties);
  11336. var length = keys.length;
  11337. var index = 0;
  11338. var key;
  11339. while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
  11340. return O;
  11341. };
  11342. /***/ }),
  11343. /***/ "e1d6":
  11344. /***/ (function(module, exports, __webpack_require__) {
  11345. var toInteger = __webpack_require__("3da3");
  11346. var max = Math.max;
  11347. var min = Math.min;
  11348. // Helper for a popular repeating case of the spec:
  11349. // Let integer be ? ToInteger(index).
  11350. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  11351. module.exports = function (index, length) {
  11352. var integer = toInteger(index);
  11353. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  11354. };
  11355. /***/ }),
  11356. /***/ "e4db":
  11357. /***/ (function(module, exports, __webpack_require__) {
  11358. var global = __webpack_require__("d890");
  11359. var createNonEnumerableProperty = __webpack_require__("0fc1");
  11360. module.exports = function (key, value) {
  11361. try {
  11362. createNonEnumerableProperty(global, key, value);
  11363. } catch (error) {
  11364. global[key] = value;
  11365. } return value;
  11366. };
  11367. /***/ }),
  11368. /***/ "e8d6":
  11369. /***/ (function(module, exports, __webpack_require__) {
  11370. var fails = __webpack_require__("efe2");
  11371. var replacement = /#|\.prototype\./;
  11372. var isForced = function (feature, detection) {
  11373. var value = data[normalize(feature)];
  11374. return value == POLYFILL ? true
  11375. : value == NATIVE ? false
  11376. : typeof detection == 'function' ? fails(detection)
  11377. : !!detection;
  11378. };
  11379. var normalize = isForced.normalize = function (string) {
  11380. return String(string).replace(replacement, '.').toLowerCase();
  11381. };
  11382. var data = isForced.data = {};
  11383. var NATIVE = isForced.NATIVE = 'N';
  11384. var POLYFILL = isForced.POLYFILL = 'P';
  11385. module.exports = isForced;
  11386. /***/ }),
  11387. /***/ "ead4":
  11388. /***/ (function(module, exports, __webpack_require__) {
  11389. var has = __webpack_require__("faa8");
  11390. var toIndexedObject = __webpack_require__("da10");
  11391. var indexOf = __webpack_require__("45af").indexOf;
  11392. var hiddenKeys = __webpack_require__("d5a8");
  11393. module.exports = function (object, names) {
  11394. var O = toIndexedObject(object);
  11395. var i = 0;
  11396. var result = [];
  11397. var key;
  11398. for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
  11399. // Don't enum bug & hidden keys
  11400. while (names.length > i) if (has(O, key = names[i++])) {
  11401. ~indexOf(result, key) || result.push(key);
  11402. }
  11403. return result;
  11404. };
  11405. /***/ }),
  11406. /***/ "ef71":
  11407. /***/ (function(module, exports, __webpack_require__) {
  11408. "use strict";
  11409. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  11410. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  11411. // Nashorn ~ JDK8 bug
  11412. var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  11413. // `Object.prototype.propertyIsEnumerable` method implementation
  11414. // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
  11415. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  11416. var descriptor = getOwnPropertyDescriptor(this, V);
  11417. return !!descriptor && descriptor.enumerable;
  11418. } : nativePropertyIsEnumerable;
  11419. /***/ }),
  11420. /***/ "efe2":
  11421. /***/ (function(module, exports) {
  11422. module.exports = function (exec) {
  11423. try {
  11424. return !!exec();
  11425. } catch (error) {
  11426. return true;
  11427. }
  11428. };
  11429. /***/ }),
  11430. /***/ "f594":
  11431. /***/ (function(module, exports, __webpack_require__) {
  11432. var global = __webpack_require__("d890");
  11433. var userAgent = __webpack_require__("4fda");
  11434. var process = global.process;
  11435. var versions = process && process.versions;
  11436. var v8 = versions && versions.v8;
  11437. var match, version;
  11438. if (v8) {
  11439. match = v8.split('.');
  11440. version = match[0] + match[1];
  11441. } else if (userAgent) {
  11442. match = userAgent.match(/Edge\/(\d+)/);
  11443. if (!match || match[1] >= 74) {
  11444. match = userAgent.match(/Chrome\/(\d+)/);
  11445. if (match) version = match[1];
  11446. }
  11447. }
  11448. module.exports = version && +version;
  11449. /***/ }),
  11450. /***/ "faa8":
  11451. /***/ (function(module, exports) {
  11452. var hasOwnProperty = {}.hasOwnProperty;
  11453. module.exports = function (it, key) {
  11454. return hasOwnProperty.call(it, key);
  11455. };
  11456. /***/ }),
  11457. /***/ "fb22":
  11458. /***/ (function(module, exports) {
  11459. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  11460. var e, m
  11461. var eLen = (nBytes * 8) - mLen - 1
  11462. var eMax = (1 << eLen) - 1
  11463. var eBias = eMax >> 1
  11464. var nBits = -7
  11465. var i = isLE ? (nBytes - 1) : 0
  11466. var d = isLE ? -1 : 1
  11467. var s = buffer[offset + i]
  11468. i += d
  11469. e = s & ((1 << (-nBits)) - 1)
  11470. s >>= (-nBits)
  11471. nBits += eLen
  11472. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11473. m = e & ((1 << (-nBits)) - 1)
  11474. e >>= (-nBits)
  11475. nBits += mLen
  11476. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11477. if (e === 0) {
  11478. e = 1 - eBias
  11479. } else if (e === eMax) {
  11480. return m ? NaN : ((s ? -1 : 1) * Infinity)
  11481. } else {
  11482. m = m + Math.pow(2, mLen)
  11483. e = e - eBias
  11484. }
  11485. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  11486. }
  11487. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  11488. var e, m, c
  11489. var eLen = (nBytes * 8) - mLen - 1
  11490. var eMax = (1 << eLen) - 1
  11491. var eBias = eMax >> 1
  11492. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  11493. var i = isLE ? 0 : (nBytes - 1)
  11494. var d = isLE ? 1 : -1
  11495. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  11496. value = Math.abs(value)
  11497. if (isNaN(value) || value === Infinity) {
  11498. m = isNaN(value) ? 1 : 0
  11499. e = eMax
  11500. } else {
  11501. e = Math.floor(Math.log(value) / Math.LN2)
  11502. if (value * (c = Math.pow(2, -e)) < 1) {
  11503. e--
  11504. c *= 2
  11505. }
  11506. if (e + eBias >= 1) {
  11507. value += rt / c
  11508. } else {
  11509. value += rt * Math.pow(2, 1 - eBias)
  11510. }
  11511. if (value * c >= 2) {
  11512. e++
  11513. c /= 2
  11514. }
  11515. if (e + eBias >= eMax) {
  11516. m = 0
  11517. e = eMax
  11518. } else if (e + eBias >= 1) {
  11519. m = ((value * c) - 1) * Math.pow(2, mLen)
  11520. e = e + eBias
  11521. } else {
  11522. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  11523. e = 0
  11524. }
  11525. }
  11526. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  11527. e = (e << mLen) | m
  11528. eLen += mLen
  11529. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  11530. buffer[offset + i - d] |= s * 128
  11531. }
  11532. /***/ }),
  11533. /***/ "fc8c":
  11534. /***/ (function(module, exports) {
  11535. // a string of all valid unicode whitespaces
  11536. // eslint-disable-next-line max-len
  11537. module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  11538. /***/ }),
  11539. /***/ "fd40":
  11540. /***/ (function(module, exports, __webpack_require__) {
  11541. "use strict";
  11542. /* WEBPACK VAR INJECTION */(function(global) {/*!
  11543. * The buffer module from node.js, for the browser.
  11544. *
  11545. * @author Feross Aboukhadijeh <http://feross.org>
  11546. * @license MIT
  11547. */
  11548. /* eslint-disable no-proto */
  11549. var base64 = __webpack_require__("27cd")
  11550. var ieee754 = __webpack_require__("fb22")
  11551. var isArray = __webpack_require__("571a")
  11552. exports.Buffer = Buffer
  11553. exports.SlowBuffer = SlowBuffer
  11554. exports.INSPECT_MAX_BYTES = 50
  11555. /**
  11556. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  11557. * === true Use Uint8Array implementation (fastest)
  11558. * === false Use Object implementation (most compatible, even IE6)
  11559. *
  11560. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  11561. * Opera 11.6+, iOS 4.2+.
  11562. *
  11563. * Due to various browser bugs, sometimes the Object implementation will be used even
  11564. * when the browser supports typed arrays.
  11565. *
  11566. * Note:
  11567. *
  11568. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  11569. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  11570. *
  11571. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  11572. *
  11573. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  11574. * incorrect length in some situations.
  11575. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  11576. * get the Object implementation, which is slower but behaves correctly.
  11577. */
  11578. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  11579. ? global.TYPED_ARRAY_SUPPORT
  11580. : typedArraySupport()
  11581. /*
  11582. * Export kMaxLength after typed array support is determined.
  11583. */
  11584. exports.kMaxLength = kMaxLength()
  11585. function typedArraySupport () {
  11586. try {
  11587. var arr = new Uint8Array(1)
  11588. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  11589. return arr.foo() === 42 && // typed array instances can be augmented
  11590. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  11591. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  11592. } catch (e) {
  11593. return false
  11594. }
  11595. }
  11596. function kMaxLength () {
  11597. return Buffer.TYPED_ARRAY_SUPPORT
  11598. ? 0x7fffffff
  11599. : 0x3fffffff
  11600. }
  11601. function createBuffer (that, length) {
  11602. if (kMaxLength() < length) {
  11603. throw new RangeError('Invalid typed array length')
  11604. }
  11605. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11606. // Return an augmented `Uint8Array` instance, for best performance
  11607. that = new Uint8Array(length)
  11608. that.__proto__ = Buffer.prototype
  11609. } else {
  11610. // Fallback: Return an object instance of the Buffer class
  11611. if (that === null) {
  11612. that = new Buffer(length)
  11613. }
  11614. that.length = length
  11615. }
  11616. return that
  11617. }
  11618. /**
  11619. * The Buffer constructor returns instances of `Uint8Array` that have their
  11620. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  11621. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  11622. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  11623. * returns a single octet.
  11624. *
  11625. * The `Uint8Array` prototype remains unmodified.
  11626. */
  11627. function Buffer (arg, encodingOrOffset, length) {
  11628. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  11629. return new Buffer(arg, encodingOrOffset, length)
  11630. }
  11631. // Common case.
  11632. if (typeof arg === 'number') {
  11633. if (typeof encodingOrOffset === 'string') {
  11634. throw new Error(
  11635. 'If encoding is specified then the first argument must be a string'
  11636. )
  11637. }
  11638. return allocUnsafe(this, arg)
  11639. }
  11640. return from(this, arg, encodingOrOffset, length)
  11641. }
  11642. Buffer.poolSize = 8192 // not used by this implementation
  11643. // TODO: Legacy, not needed anymore. Remove in next major version.
  11644. Buffer._augment = function (arr) {
  11645. arr.__proto__ = Buffer.prototype
  11646. return arr
  11647. }
  11648. function from (that, value, encodingOrOffset, length) {
  11649. if (typeof value === 'number') {
  11650. throw new TypeError('"value" argument must not be a number')
  11651. }
  11652. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  11653. return fromArrayBuffer(that, value, encodingOrOffset, length)
  11654. }
  11655. if (typeof value === 'string') {
  11656. return fromString(that, value, encodingOrOffset)
  11657. }
  11658. return fromObject(that, value)
  11659. }
  11660. /**
  11661. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  11662. * if value is a number.
  11663. * Buffer.from(str[, encoding])
  11664. * Buffer.from(array)
  11665. * Buffer.from(buffer)
  11666. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  11667. **/
  11668. Buffer.from = function (value, encodingOrOffset, length) {
  11669. return from(null, value, encodingOrOffset, length)
  11670. }
  11671. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11672. Buffer.prototype.__proto__ = Uint8Array.prototype
  11673. Buffer.__proto__ = Uint8Array
  11674. if (typeof Symbol !== 'undefined' && Symbol.species &&
  11675. Buffer[Symbol.species] === Buffer) {
  11676. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  11677. Object.defineProperty(Buffer, Symbol.species, {
  11678. value: null,
  11679. configurable: true
  11680. })
  11681. }
  11682. }
  11683. function assertSize (size) {
  11684. if (typeof size !== 'number') {
  11685. throw new TypeError('"size" argument must be a number')
  11686. } else if (size < 0) {
  11687. throw new RangeError('"size" argument must not be negative')
  11688. }
  11689. }
  11690. function alloc (that, size, fill, encoding) {
  11691. assertSize(size)
  11692. if (size <= 0) {
  11693. return createBuffer(that, size)
  11694. }
  11695. if (fill !== undefined) {
  11696. // Only pay attention to encoding if it's a string. This
  11697. // prevents accidentally sending in a number that would
  11698. // be interpretted as a start offset.
  11699. return typeof encoding === 'string'
  11700. ? createBuffer(that, size).fill(fill, encoding)
  11701. : createBuffer(that, size).fill(fill)
  11702. }
  11703. return createBuffer(that, size)
  11704. }
  11705. /**
  11706. * Creates a new filled Buffer instance.
  11707. * alloc(size[, fill[, encoding]])
  11708. **/
  11709. Buffer.alloc = function (size, fill, encoding) {
  11710. return alloc(null, size, fill, encoding)
  11711. }
  11712. function allocUnsafe (that, size) {
  11713. assertSize(size)
  11714. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  11715. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  11716. for (var i = 0; i < size; ++i) {
  11717. that[i] = 0
  11718. }
  11719. }
  11720. return that
  11721. }
  11722. /**
  11723. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  11724. * */
  11725. Buffer.allocUnsafe = function (size) {
  11726. return allocUnsafe(null, size)
  11727. }
  11728. /**
  11729. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  11730. */
  11731. Buffer.allocUnsafeSlow = function (size) {
  11732. return allocUnsafe(null, size)
  11733. }
  11734. function fromString (that, string, encoding) {
  11735. if (typeof encoding !== 'string' || encoding === '') {
  11736. encoding = 'utf8'
  11737. }
  11738. if (!Buffer.isEncoding(encoding)) {
  11739. throw new TypeError('"encoding" must be a valid string encoding')
  11740. }
  11741. var length = byteLength(string, encoding) | 0
  11742. that = createBuffer(that, length)
  11743. var actual = that.write(string, encoding)
  11744. if (actual !== length) {
  11745. // Writing a hex string, for example, that contains invalid characters will
  11746. // cause everything after the first invalid character to be ignored. (e.g.
  11747. // 'abxxcd' will be treated as 'ab')
  11748. that = that.slice(0, actual)
  11749. }
  11750. return that
  11751. }
  11752. function fromArrayLike (that, array) {
  11753. var length = array.length < 0 ? 0 : checked(array.length) | 0
  11754. that = createBuffer(that, length)
  11755. for (var i = 0; i < length; i += 1) {
  11756. that[i] = array[i] & 255
  11757. }
  11758. return that
  11759. }
  11760. function fromArrayBuffer (that, array, byteOffset, length) {
  11761. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  11762. if (byteOffset < 0 || array.byteLength < byteOffset) {
  11763. throw new RangeError('\'offset\' is out of bounds')
  11764. }
  11765. if (array.byteLength < byteOffset + (length || 0)) {
  11766. throw new RangeError('\'length\' is out of bounds')
  11767. }
  11768. if (byteOffset === undefined && length === undefined) {
  11769. array = new Uint8Array(array)
  11770. } else if (length === undefined) {
  11771. array = new Uint8Array(array, byteOffset)
  11772. } else {
  11773. array = new Uint8Array(array, byteOffset, length)
  11774. }
  11775. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11776. // Return an augmented `Uint8Array` instance, for best performance
  11777. that = array
  11778. that.__proto__ = Buffer.prototype
  11779. } else {
  11780. // Fallback: Return an object instance of the Buffer class
  11781. that = fromArrayLike(that, array)
  11782. }
  11783. return that
  11784. }
  11785. function fromObject (that, obj) {
  11786. if (Buffer.isBuffer(obj)) {
  11787. var len = checked(obj.length) | 0
  11788. that = createBuffer(that, len)
  11789. if (that.length === 0) {
  11790. return that
  11791. }
  11792. obj.copy(that, 0, 0, len)
  11793. return that
  11794. }
  11795. if (obj) {
  11796. if ((typeof ArrayBuffer !== 'undefined' &&
  11797. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  11798. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  11799. return createBuffer(that, 0)
  11800. }
  11801. return fromArrayLike(that, obj)
  11802. }
  11803. if (obj.type === 'Buffer' && isArray(obj.data)) {
  11804. return fromArrayLike(that, obj.data)
  11805. }
  11806. }
  11807. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  11808. }
  11809. function checked (length) {
  11810. // Note: cannot use `length < kMaxLength()` here because that fails when
  11811. // length is NaN (which is otherwise coerced to zero.)
  11812. if (length >= kMaxLength()) {
  11813. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  11814. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  11815. }
  11816. return length | 0
  11817. }
  11818. function SlowBuffer (length) {
  11819. if (+length != length) { // eslint-disable-line eqeqeq
  11820. length = 0
  11821. }
  11822. return Buffer.alloc(+length)
  11823. }
  11824. Buffer.isBuffer = function isBuffer (b) {
  11825. return !!(b != null && b._isBuffer)
  11826. }
  11827. Buffer.compare = function compare (a, b) {
  11828. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  11829. throw new TypeError('Arguments must be Buffers')
  11830. }
  11831. if (a === b) return 0
  11832. var x = a.length
  11833. var y = b.length
  11834. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  11835. if (a[i] !== b[i]) {
  11836. x = a[i]
  11837. y = b[i]
  11838. break
  11839. }
  11840. }
  11841. if (x < y) return -1
  11842. if (y < x) return 1
  11843. return 0
  11844. }
  11845. Buffer.isEncoding = function isEncoding (encoding) {
  11846. switch (String(encoding).toLowerCase()) {
  11847. case 'hex':
  11848. case 'utf8':
  11849. case 'utf-8':
  11850. case 'ascii':
  11851. case 'latin1':
  11852. case 'binary':
  11853. case 'base64':
  11854. case 'ucs2':
  11855. case 'ucs-2':
  11856. case 'utf16le':
  11857. case 'utf-16le':
  11858. return true
  11859. default:
  11860. return false
  11861. }
  11862. }
  11863. Buffer.concat = function concat (list, length) {
  11864. if (!isArray(list)) {
  11865. throw new TypeError('"list" argument must be an Array of Buffers')
  11866. }
  11867. if (list.length === 0) {
  11868. return Buffer.alloc(0)
  11869. }
  11870. var i
  11871. if (length === undefined) {
  11872. length = 0
  11873. for (i = 0; i < list.length; ++i) {
  11874. length += list[i].length
  11875. }
  11876. }
  11877. var buffer = Buffer.allocUnsafe(length)
  11878. var pos = 0
  11879. for (i = 0; i < list.length; ++i) {
  11880. var buf = list[i]
  11881. if (!Buffer.isBuffer(buf)) {
  11882. throw new TypeError('"list" argument must be an Array of Buffers')
  11883. }
  11884. buf.copy(buffer, pos)
  11885. pos += buf.length
  11886. }
  11887. return buffer
  11888. }
  11889. function byteLength (string, encoding) {
  11890. if (Buffer.isBuffer(string)) {
  11891. return string.length
  11892. }
  11893. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  11894. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  11895. return string.byteLength
  11896. }
  11897. if (typeof string !== 'string') {
  11898. string = '' + string
  11899. }
  11900. var len = string.length
  11901. if (len === 0) return 0
  11902. // Use a for loop to avoid recursion
  11903. var loweredCase = false
  11904. for (;;) {
  11905. switch (encoding) {
  11906. case 'ascii':
  11907. case 'latin1':
  11908. case 'binary':
  11909. return len
  11910. case 'utf8':
  11911. case 'utf-8':
  11912. case undefined:
  11913. return utf8ToBytes(string).length
  11914. case 'ucs2':
  11915. case 'ucs-2':
  11916. case 'utf16le':
  11917. case 'utf-16le':
  11918. return len * 2
  11919. case 'hex':
  11920. return len >>> 1
  11921. case 'base64':
  11922. return base64ToBytes(string).length
  11923. default:
  11924. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  11925. encoding = ('' + encoding).toLowerCase()
  11926. loweredCase = true
  11927. }
  11928. }
  11929. }
  11930. Buffer.byteLength = byteLength
  11931. function slowToString (encoding, start, end) {
  11932. var loweredCase = false
  11933. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  11934. // property of a typed array.
  11935. // This behaves neither like String nor Uint8Array in that we set start/end
  11936. // to their upper/lower bounds if the value passed is out of range.
  11937. // undefined is handled specially as per ECMA-262 6th Edition,
  11938. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  11939. if (start === undefined || start < 0) {
  11940. start = 0
  11941. }
  11942. // Return early if start > this.length. Done here to prevent potential uint32
  11943. // coercion fail below.
  11944. if (start > this.length) {
  11945. return ''
  11946. }
  11947. if (end === undefined || end > this.length) {
  11948. end = this.length
  11949. }
  11950. if (end <= 0) {
  11951. return ''
  11952. }
  11953. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  11954. end >>>= 0
  11955. start >>>= 0
  11956. if (end <= start) {
  11957. return ''
  11958. }
  11959. if (!encoding) encoding = 'utf8'
  11960. while (true) {
  11961. switch (encoding) {
  11962. case 'hex':
  11963. return hexSlice(this, start, end)
  11964. case 'utf8':
  11965. case 'utf-8':
  11966. return utf8Slice(this, start, end)
  11967. case 'ascii':
  11968. return asciiSlice(this, start, end)
  11969. case 'latin1':
  11970. case 'binary':
  11971. return latin1Slice(this, start, end)
  11972. case 'base64':
  11973. return base64Slice(this, start, end)
  11974. case 'ucs2':
  11975. case 'ucs-2':
  11976. case 'utf16le':
  11977. case 'utf-16le':
  11978. return utf16leSlice(this, start, end)
  11979. default:
  11980. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  11981. encoding = (encoding + '').toLowerCase()
  11982. loweredCase = true
  11983. }
  11984. }
  11985. }
  11986. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  11987. // Buffer instances.
  11988. Buffer.prototype._isBuffer = true
  11989. function swap (b, n, m) {
  11990. var i = b[n]
  11991. b[n] = b[m]
  11992. b[m] = i
  11993. }
  11994. Buffer.prototype.swap16 = function swap16 () {
  11995. var len = this.length
  11996. if (len % 2 !== 0) {
  11997. throw new RangeError('Buffer size must be a multiple of 16-bits')
  11998. }
  11999. for (var i = 0; i < len; i += 2) {
  12000. swap(this, i, i + 1)
  12001. }
  12002. return this
  12003. }
  12004. Buffer.prototype.swap32 = function swap32 () {
  12005. var len = this.length
  12006. if (len % 4 !== 0) {
  12007. throw new RangeError('Buffer size must be a multiple of 32-bits')
  12008. }
  12009. for (var i = 0; i < len; i += 4) {
  12010. swap(this, i, i + 3)
  12011. swap(this, i + 1, i + 2)
  12012. }
  12013. return this
  12014. }
  12015. Buffer.prototype.swap64 = function swap64 () {
  12016. var len = this.length
  12017. if (len % 8 !== 0) {
  12018. throw new RangeError('Buffer size must be a multiple of 64-bits')
  12019. }
  12020. for (var i = 0; i < len; i += 8) {
  12021. swap(this, i, i + 7)
  12022. swap(this, i + 1, i + 6)
  12023. swap(this, i + 2, i + 5)
  12024. swap(this, i + 3, i + 4)
  12025. }
  12026. return this
  12027. }
  12028. Buffer.prototype.toString = function toString () {
  12029. var length = this.length | 0
  12030. if (length === 0) return ''
  12031. if (arguments.length === 0) return utf8Slice(this, 0, length)
  12032. return slowToString.apply(this, arguments)
  12033. }
  12034. Buffer.prototype.equals = function equals (b) {
  12035. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  12036. if (this === b) return true
  12037. return Buffer.compare(this, b) === 0
  12038. }
  12039. Buffer.prototype.inspect = function inspect () {
  12040. var str = ''
  12041. var max = exports.INSPECT_MAX_BYTES
  12042. if (this.length > 0) {
  12043. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  12044. if (this.length > max) str += ' ... '
  12045. }
  12046. return '<Buffer ' + str + '>'
  12047. }
  12048. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  12049. if (!Buffer.isBuffer(target)) {
  12050. throw new TypeError('Argument must be a Buffer')
  12051. }
  12052. if (start === undefined) {
  12053. start = 0
  12054. }
  12055. if (end === undefined) {
  12056. end = target ? target.length : 0
  12057. }
  12058. if (thisStart === undefined) {
  12059. thisStart = 0
  12060. }
  12061. if (thisEnd === undefined) {
  12062. thisEnd = this.length
  12063. }
  12064. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  12065. throw new RangeError('out of range index')
  12066. }
  12067. if (thisStart >= thisEnd && start >= end) {
  12068. return 0
  12069. }
  12070. if (thisStart >= thisEnd) {
  12071. return -1
  12072. }
  12073. if (start >= end) {
  12074. return 1
  12075. }
  12076. start >>>= 0
  12077. end >>>= 0
  12078. thisStart >>>= 0
  12079. thisEnd >>>= 0
  12080. if (this === target) return 0
  12081. var x = thisEnd - thisStart
  12082. var y = end - start
  12083. var len = Math.min(x, y)
  12084. var thisCopy = this.slice(thisStart, thisEnd)
  12085. var targetCopy = target.slice(start, end)
  12086. for (var i = 0; i < len; ++i) {
  12087. if (thisCopy[i] !== targetCopy[i]) {
  12088. x = thisCopy[i]
  12089. y = targetCopy[i]
  12090. break
  12091. }
  12092. }
  12093. if (x < y) return -1
  12094. if (y < x) return 1
  12095. return 0
  12096. }
  12097. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  12098. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  12099. //
  12100. // Arguments:
  12101. // - buffer - a Buffer to search
  12102. // - val - a string, Buffer, or number
  12103. // - byteOffset - an index into `buffer`; will be clamped to an int32
  12104. // - encoding - an optional encoding, relevant is val is a string
  12105. // - dir - true for indexOf, false for lastIndexOf
  12106. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  12107. // Empty buffer means no match
  12108. if (buffer.length === 0) return -1
  12109. // Normalize byteOffset
  12110. if (typeof byteOffset === 'string') {
  12111. encoding = byteOffset
  12112. byteOffset = 0
  12113. } else if (byteOffset > 0x7fffffff) {
  12114. byteOffset = 0x7fffffff
  12115. } else if (byteOffset < -0x80000000) {
  12116. byteOffset = -0x80000000
  12117. }
  12118. byteOffset = +byteOffset // Coerce to Number.
  12119. if (isNaN(byteOffset)) {
  12120. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  12121. byteOffset = dir ? 0 : (buffer.length - 1)
  12122. }
  12123. // Normalize byteOffset: negative offsets start from the end of the buffer
  12124. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  12125. if (byteOffset >= buffer.length) {
  12126. if (dir) return -1
  12127. else byteOffset = buffer.length - 1
  12128. } else if (byteOffset < 0) {
  12129. if (dir) byteOffset = 0
  12130. else return -1
  12131. }
  12132. // Normalize val
  12133. if (typeof val === 'string') {
  12134. val = Buffer.from(val, encoding)
  12135. }
  12136. // Finally, search either indexOf (if dir is true) or lastIndexOf
  12137. if (Buffer.isBuffer(val)) {
  12138. // Special case: looking for empty string/buffer always fails
  12139. if (val.length === 0) {
  12140. return -1
  12141. }
  12142. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  12143. } else if (typeof val === 'number') {
  12144. val = val & 0xFF // Search for a byte value [0-255]
  12145. if (Buffer.TYPED_ARRAY_SUPPORT &&
  12146. typeof Uint8Array.prototype.indexOf === 'function') {
  12147. if (dir) {
  12148. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  12149. } else {
  12150. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  12151. }
  12152. }
  12153. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  12154. }
  12155. throw new TypeError('val must be string, number or Buffer')
  12156. }
  12157. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  12158. var indexSize = 1
  12159. var arrLength = arr.length
  12160. var valLength = val.length
  12161. if (encoding !== undefined) {
  12162. encoding = String(encoding).toLowerCase()
  12163. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  12164. encoding === 'utf16le' || encoding === 'utf-16le') {
  12165. if (arr.length < 2 || val.length < 2) {
  12166. return -1
  12167. }
  12168. indexSize = 2
  12169. arrLength /= 2
  12170. valLength /= 2
  12171. byteOffset /= 2
  12172. }
  12173. }
  12174. function read (buf, i) {
  12175. if (indexSize === 1) {
  12176. return buf[i]
  12177. } else {
  12178. return buf.readUInt16BE(i * indexSize)
  12179. }
  12180. }
  12181. var i
  12182. if (dir) {
  12183. var foundIndex = -1
  12184. for (i = byteOffset; i < arrLength; i++) {
  12185. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  12186. if (foundIndex === -1) foundIndex = i
  12187. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  12188. } else {
  12189. if (foundIndex !== -1) i -= i - foundIndex
  12190. foundIndex = -1
  12191. }
  12192. }
  12193. } else {
  12194. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  12195. for (i = byteOffset; i >= 0; i--) {
  12196. var found = true
  12197. for (var j = 0; j < valLength; j++) {
  12198. if (read(arr, i + j) !== read(val, j)) {
  12199. found = false
  12200. break
  12201. }
  12202. }
  12203. if (found) return i
  12204. }
  12205. }
  12206. return -1
  12207. }
  12208. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  12209. return this.indexOf(val, byteOffset, encoding) !== -1
  12210. }
  12211. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  12212. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  12213. }
  12214. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  12215. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  12216. }
  12217. function hexWrite (buf, string, offset, length) {
  12218. offset = Number(offset) || 0
  12219. var remaining = buf.length - offset
  12220. if (!length) {
  12221. length = remaining
  12222. } else {
  12223. length = Number(length)
  12224. if (length > remaining) {
  12225. length = remaining
  12226. }
  12227. }
  12228. // must be an even number of digits
  12229. var strLen = string.length
  12230. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  12231. if (length > strLen / 2) {
  12232. length = strLen / 2
  12233. }
  12234. for (var i = 0; i < length; ++i) {
  12235. var parsed = parseInt(string.substr(i * 2, 2), 16)
  12236. if (isNaN(parsed)) return i
  12237. buf[offset + i] = parsed
  12238. }
  12239. return i
  12240. }
  12241. function utf8Write (buf, string, offset, length) {
  12242. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  12243. }
  12244. function asciiWrite (buf, string, offset, length) {
  12245. return blitBuffer(asciiToBytes(string), buf, offset, length)
  12246. }
  12247. function latin1Write (buf, string, offset, length) {
  12248. return asciiWrite(buf, string, offset, length)
  12249. }
  12250. function base64Write (buf, string, offset, length) {
  12251. return blitBuffer(base64ToBytes(string), buf, offset, length)
  12252. }
  12253. function ucs2Write (buf, string, offset, length) {
  12254. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  12255. }
  12256. Buffer.prototype.write = function write (string, offset, length, encoding) {
  12257. // Buffer#write(string)
  12258. if (offset === undefined) {
  12259. encoding = 'utf8'
  12260. length = this.length
  12261. offset = 0
  12262. // Buffer#write(string, encoding)
  12263. } else if (length === undefined && typeof offset === 'string') {
  12264. encoding = offset
  12265. length = this.length
  12266. offset = 0
  12267. // Buffer#write(string, offset[, length][, encoding])
  12268. } else if (isFinite(offset)) {
  12269. offset = offset | 0
  12270. if (isFinite(length)) {
  12271. length = length | 0
  12272. if (encoding === undefined) encoding = 'utf8'
  12273. } else {
  12274. encoding = length
  12275. length = undefined
  12276. }
  12277. // legacy write(string, encoding, offset, length) - remove in v0.13
  12278. } else {
  12279. throw new Error(
  12280. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  12281. )
  12282. }
  12283. var remaining = this.length - offset
  12284. if (length === undefined || length > remaining) length = remaining
  12285. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  12286. throw new RangeError('Attempt to write outside buffer bounds')
  12287. }
  12288. if (!encoding) encoding = 'utf8'
  12289. var loweredCase = false
  12290. for (;;) {
  12291. switch (encoding) {
  12292. case 'hex':
  12293. return hexWrite(this, string, offset, length)
  12294. case 'utf8':
  12295. case 'utf-8':
  12296. return utf8Write(this, string, offset, length)
  12297. case 'ascii':
  12298. return asciiWrite(this, string, offset, length)
  12299. case 'latin1':
  12300. case 'binary':
  12301. return latin1Write(this, string, offset, length)
  12302. case 'base64':
  12303. // Warning: maxLength not taken into account in base64Write
  12304. return base64Write(this, string, offset, length)
  12305. case 'ucs2':
  12306. case 'ucs-2':
  12307. case 'utf16le':
  12308. case 'utf-16le':
  12309. return ucs2Write(this, string, offset, length)
  12310. default:
  12311. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  12312. encoding = ('' + encoding).toLowerCase()
  12313. loweredCase = true
  12314. }
  12315. }
  12316. }
  12317. Buffer.prototype.toJSON = function toJSON () {
  12318. return {
  12319. type: 'Buffer',
  12320. data: Array.prototype.slice.call(this._arr || this, 0)
  12321. }
  12322. }
  12323. function base64Slice (buf, start, end) {
  12324. if (start === 0 && end === buf.length) {
  12325. return base64.fromByteArray(buf)
  12326. } else {
  12327. return base64.fromByteArray(buf.slice(start, end))
  12328. }
  12329. }
  12330. function utf8Slice (buf, start, end) {
  12331. end = Math.min(buf.length, end)
  12332. var res = []
  12333. var i = start
  12334. while (i < end) {
  12335. var firstByte = buf[i]
  12336. var codePoint = null
  12337. var bytesPerSequence = (firstByte > 0xEF) ? 4
  12338. : (firstByte > 0xDF) ? 3
  12339. : (firstByte > 0xBF) ? 2
  12340. : 1
  12341. if (i + bytesPerSequence <= end) {
  12342. var secondByte, thirdByte, fourthByte, tempCodePoint
  12343. switch (bytesPerSequence) {
  12344. case 1:
  12345. if (firstByte < 0x80) {
  12346. codePoint = firstByte
  12347. }
  12348. break
  12349. case 2:
  12350. secondByte = buf[i + 1]
  12351. if ((secondByte & 0xC0) === 0x80) {
  12352. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  12353. if (tempCodePoint > 0x7F) {
  12354. codePoint = tempCodePoint
  12355. }
  12356. }
  12357. break
  12358. case 3:
  12359. secondByte = buf[i + 1]
  12360. thirdByte = buf[i + 2]
  12361. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  12362. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  12363. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  12364. codePoint = tempCodePoint
  12365. }
  12366. }
  12367. break
  12368. case 4:
  12369. secondByte = buf[i + 1]
  12370. thirdByte = buf[i + 2]
  12371. fourthByte = buf[i + 3]
  12372. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  12373. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  12374. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  12375. codePoint = tempCodePoint
  12376. }
  12377. }
  12378. }
  12379. }
  12380. if (codePoint === null) {
  12381. // we did not generate a valid codePoint so insert a
  12382. // replacement char (U+FFFD) and advance only 1 byte
  12383. codePoint = 0xFFFD
  12384. bytesPerSequence = 1
  12385. } else if (codePoint > 0xFFFF) {
  12386. // encode to utf16 (surrogate pair dance)
  12387. codePoint -= 0x10000
  12388. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  12389. codePoint = 0xDC00 | codePoint & 0x3FF
  12390. }
  12391. res.push(codePoint)
  12392. i += bytesPerSequence
  12393. }
  12394. return decodeCodePointsArray(res)
  12395. }
  12396. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  12397. // the lowest limit is Chrome, with 0x10000 args.
  12398. // We go 1 magnitude less, for safety
  12399. var MAX_ARGUMENTS_LENGTH = 0x1000
  12400. function decodeCodePointsArray (codePoints) {
  12401. var len = codePoints.length
  12402. if (len <= MAX_ARGUMENTS_LENGTH) {
  12403. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  12404. }
  12405. // Decode in chunks to avoid "call stack size exceeded".
  12406. var res = ''
  12407. var i = 0
  12408. while (i < len) {
  12409. res += String.fromCharCode.apply(
  12410. String,
  12411. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  12412. )
  12413. }
  12414. return res
  12415. }
  12416. function asciiSlice (buf, start, end) {
  12417. var ret = ''
  12418. end = Math.min(buf.length, end)
  12419. for (var i = start; i < end; ++i) {
  12420. ret += String.fromCharCode(buf[i] & 0x7F)
  12421. }
  12422. return ret
  12423. }
  12424. function latin1Slice (buf, start, end) {
  12425. var ret = ''
  12426. end = Math.min(buf.length, end)
  12427. for (var i = start; i < end; ++i) {
  12428. ret += String.fromCharCode(buf[i])
  12429. }
  12430. return ret
  12431. }
  12432. function hexSlice (buf, start, end) {
  12433. var len = buf.length
  12434. if (!start || start < 0) start = 0
  12435. if (!end || end < 0 || end > len) end = len
  12436. var out = ''
  12437. for (var i = start; i < end; ++i) {
  12438. out += toHex(buf[i])
  12439. }
  12440. return out
  12441. }
  12442. function utf16leSlice (buf, start, end) {
  12443. var bytes = buf.slice(start, end)
  12444. var res = ''
  12445. for (var i = 0; i < bytes.length; i += 2) {
  12446. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  12447. }
  12448. return res
  12449. }
  12450. Buffer.prototype.slice = function slice (start, end) {
  12451. var len = this.length
  12452. start = ~~start
  12453. end = end === undefined ? len : ~~end
  12454. if (start < 0) {
  12455. start += len
  12456. if (start < 0) start = 0
  12457. } else if (start > len) {
  12458. start = len
  12459. }
  12460. if (end < 0) {
  12461. end += len
  12462. if (end < 0) end = 0
  12463. } else if (end > len) {
  12464. end = len
  12465. }
  12466. if (end < start) end = start
  12467. var newBuf
  12468. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12469. newBuf = this.subarray(start, end)
  12470. newBuf.__proto__ = Buffer.prototype
  12471. } else {
  12472. var sliceLen = end - start
  12473. newBuf = new Buffer(sliceLen, undefined)
  12474. for (var i = 0; i < sliceLen; ++i) {
  12475. newBuf[i] = this[i + start]
  12476. }
  12477. }
  12478. return newBuf
  12479. }
  12480. /*
  12481. * Need to make sure that buffer isn't trying to write out of bounds.
  12482. */
  12483. function checkOffset (offset, ext, length) {
  12484. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  12485. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  12486. }
  12487. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  12488. offset = offset | 0
  12489. byteLength = byteLength | 0
  12490. if (!noAssert) checkOffset(offset, byteLength, this.length)
  12491. var val = this[offset]
  12492. var mul = 1
  12493. var i = 0
  12494. while (++i < byteLength && (mul *= 0x100)) {
  12495. val += this[offset + i] * mul
  12496. }
  12497. return val
  12498. }
  12499. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  12500. offset = offset | 0
  12501. byteLength = byteLength | 0
  12502. if (!noAssert) {
  12503. checkOffset(offset, byteLength, this.length)
  12504. }
  12505. var val = this[offset + --byteLength]
  12506. var mul = 1
  12507. while (byteLength > 0 && (mul *= 0x100)) {
  12508. val += this[offset + --byteLength] * mul
  12509. }
  12510. return val
  12511. }
  12512. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  12513. if (!noAssert) checkOffset(offset, 1, this.length)
  12514. return this[offset]
  12515. }
  12516. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  12517. if (!noAssert) checkOffset(offset, 2, this.length)
  12518. return this[offset] | (this[offset + 1] << 8)
  12519. }
  12520. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  12521. if (!noAssert) checkOffset(offset, 2, this.length)
  12522. return (this[offset] << 8) | this[offset + 1]
  12523. }
  12524. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  12525. if (!noAssert) checkOffset(offset, 4, this.length)
  12526. return ((this[offset]) |
  12527. (this[offset + 1] << 8) |
  12528. (this[offset + 2] << 16)) +
  12529. (this[offset + 3] * 0x1000000)
  12530. }
  12531. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  12532. if (!noAssert) checkOffset(offset, 4, this.length)
  12533. return (this[offset] * 0x1000000) +
  12534. ((this[offset + 1] << 16) |
  12535. (this[offset + 2] << 8) |
  12536. this[offset + 3])
  12537. }
  12538. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  12539. offset = offset | 0
  12540. byteLength = byteLength | 0
  12541. if (!noAssert) checkOffset(offset, byteLength, this.length)
  12542. var val = this[offset]
  12543. var mul = 1
  12544. var i = 0
  12545. while (++i < byteLength && (mul *= 0x100)) {
  12546. val += this[offset + i] * mul
  12547. }
  12548. mul *= 0x80
  12549. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  12550. return val
  12551. }
  12552. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  12553. offset = offset | 0
  12554. byteLength = byteLength | 0
  12555. if (!noAssert) checkOffset(offset, byteLength, this.length)
  12556. var i = byteLength
  12557. var mul = 1
  12558. var val = this[offset + --i]
  12559. while (i > 0 && (mul *= 0x100)) {
  12560. val += this[offset + --i] * mul
  12561. }
  12562. mul *= 0x80
  12563. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  12564. return val
  12565. }
  12566. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  12567. if (!noAssert) checkOffset(offset, 1, this.length)
  12568. if (!(this[offset] & 0x80)) return (this[offset])
  12569. return ((0xff - this[offset] + 1) * -1)
  12570. }
  12571. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  12572. if (!noAssert) checkOffset(offset, 2, this.length)
  12573. var val = this[offset] | (this[offset + 1] << 8)
  12574. return (val & 0x8000) ? val | 0xFFFF0000 : val
  12575. }
  12576. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  12577. if (!noAssert) checkOffset(offset, 2, this.length)
  12578. var val = this[offset + 1] | (this[offset] << 8)
  12579. return (val & 0x8000) ? val | 0xFFFF0000 : val
  12580. }
  12581. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  12582. if (!noAssert) checkOffset(offset, 4, this.length)
  12583. return (this[offset]) |
  12584. (this[offset + 1] << 8) |
  12585. (this[offset + 2] << 16) |
  12586. (this[offset + 3] << 24)
  12587. }
  12588. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  12589. if (!noAssert) checkOffset(offset, 4, this.length)
  12590. return (this[offset] << 24) |
  12591. (this[offset + 1] << 16) |
  12592. (this[offset + 2] << 8) |
  12593. (this[offset + 3])
  12594. }
  12595. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  12596. if (!noAssert) checkOffset(offset, 4, this.length)
  12597. return ieee754.read(this, offset, true, 23, 4)
  12598. }
  12599. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  12600. if (!noAssert) checkOffset(offset, 4, this.length)
  12601. return ieee754.read(this, offset, false, 23, 4)
  12602. }
  12603. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  12604. if (!noAssert) checkOffset(offset, 8, this.length)
  12605. return ieee754.read(this, offset, true, 52, 8)
  12606. }
  12607. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  12608. if (!noAssert) checkOffset(offset, 8, this.length)
  12609. return ieee754.read(this, offset, false, 52, 8)
  12610. }
  12611. function checkInt (buf, value, offset, ext, max, min) {
  12612. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  12613. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  12614. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  12615. }
  12616. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  12617. value = +value
  12618. offset = offset | 0
  12619. byteLength = byteLength | 0
  12620. if (!noAssert) {
  12621. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  12622. checkInt(this, value, offset, byteLength, maxBytes, 0)
  12623. }
  12624. var mul = 1
  12625. var i = 0
  12626. this[offset] = value & 0xFF
  12627. while (++i < byteLength && (mul *= 0x100)) {
  12628. this[offset + i] = (value / mul) & 0xFF
  12629. }
  12630. return offset + byteLength
  12631. }
  12632. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  12633. value = +value
  12634. offset = offset | 0
  12635. byteLength = byteLength | 0
  12636. if (!noAssert) {
  12637. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  12638. checkInt(this, value, offset, byteLength, maxBytes, 0)
  12639. }
  12640. var i = byteLength - 1
  12641. var mul = 1
  12642. this[offset + i] = value & 0xFF
  12643. while (--i >= 0 && (mul *= 0x100)) {
  12644. this[offset + i] = (value / mul) & 0xFF
  12645. }
  12646. return offset + byteLength
  12647. }
  12648. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  12649. value = +value
  12650. offset = offset | 0
  12651. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  12652. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  12653. this[offset] = (value & 0xff)
  12654. return offset + 1
  12655. }
  12656. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  12657. if (value < 0) value = 0xffff + value + 1
  12658. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  12659. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  12660. (littleEndian ? i : 1 - i) * 8
  12661. }
  12662. }
  12663. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  12664. value = +value
  12665. offset = offset | 0
  12666. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  12667. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12668. this[offset] = (value & 0xff)
  12669. this[offset + 1] = (value >>> 8)
  12670. } else {
  12671. objectWriteUInt16(this, value, offset, true)
  12672. }
  12673. return offset + 2
  12674. }
  12675. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  12676. value = +value
  12677. offset = offset | 0
  12678. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  12679. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12680. this[offset] = (value >>> 8)
  12681. this[offset + 1] = (value & 0xff)
  12682. } else {
  12683. objectWriteUInt16(this, value, offset, false)
  12684. }
  12685. return offset + 2
  12686. }
  12687. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  12688. if (value < 0) value = 0xffffffff + value + 1
  12689. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  12690. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  12691. }
  12692. }
  12693. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  12694. value = +value
  12695. offset = offset | 0
  12696. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  12697. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12698. this[offset + 3] = (value >>> 24)
  12699. this[offset + 2] = (value >>> 16)
  12700. this[offset + 1] = (value >>> 8)
  12701. this[offset] = (value & 0xff)
  12702. } else {
  12703. objectWriteUInt32(this, value, offset, true)
  12704. }
  12705. return offset + 4
  12706. }
  12707. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  12708. value = +value
  12709. offset = offset | 0
  12710. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  12711. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12712. this[offset] = (value >>> 24)
  12713. this[offset + 1] = (value >>> 16)
  12714. this[offset + 2] = (value >>> 8)
  12715. this[offset + 3] = (value & 0xff)
  12716. } else {
  12717. objectWriteUInt32(this, value, offset, false)
  12718. }
  12719. return offset + 4
  12720. }
  12721. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  12722. value = +value
  12723. offset = offset | 0
  12724. if (!noAssert) {
  12725. var limit = Math.pow(2, 8 * byteLength - 1)
  12726. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  12727. }
  12728. var i = 0
  12729. var mul = 1
  12730. var sub = 0
  12731. this[offset] = value & 0xFF
  12732. while (++i < byteLength && (mul *= 0x100)) {
  12733. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  12734. sub = 1
  12735. }
  12736. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  12737. }
  12738. return offset + byteLength
  12739. }
  12740. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  12741. value = +value
  12742. offset = offset | 0
  12743. if (!noAssert) {
  12744. var limit = Math.pow(2, 8 * byteLength - 1)
  12745. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  12746. }
  12747. var i = byteLength - 1
  12748. var mul = 1
  12749. var sub = 0
  12750. this[offset + i] = value & 0xFF
  12751. while (--i >= 0 && (mul *= 0x100)) {
  12752. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  12753. sub = 1
  12754. }
  12755. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  12756. }
  12757. return offset + byteLength
  12758. }
  12759. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  12760. value = +value
  12761. offset = offset | 0
  12762. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  12763. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  12764. if (value < 0) value = 0xff + value + 1
  12765. this[offset] = (value & 0xff)
  12766. return offset + 1
  12767. }
  12768. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  12769. value = +value
  12770. offset = offset | 0
  12771. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  12772. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12773. this[offset] = (value & 0xff)
  12774. this[offset + 1] = (value >>> 8)
  12775. } else {
  12776. objectWriteUInt16(this, value, offset, true)
  12777. }
  12778. return offset + 2
  12779. }
  12780. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  12781. value = +value
  12782. offset = offset | 0
  12783. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  12784. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12785. this[offset] = (value >>> 8)
  12786. this[offset + 1] = (value & 0xff)
  12787. } else {
  12788. objectWriteUInt16(this, value, offset, false)
  12789. }
  12790. return offset + 2
  12791. }
  12792. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  12793. value = +value
  12794. offset = offset | 0
  12795. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  12796. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12797. this[offset] = (value & 0xff)
  12798. this[offset + 1] = (value >>> 8)
  12799. this[offset + 2] = (value >>> 16)
  12800. this[offset + 3] = (value >>> 24)
  12801. } else {
  12802. objectWriteUInt32(this, value, offset, true)
  12803. }
  12804. return offset + 4
  12805. }
  12806. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  12807. value = +value
  12808. offset = offset | 0
  12809. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  12810. if (value < 0) value = 0xffffffff + value + 1
  12811. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12812. this[offset] = (value >>> 24)
  12813. this[offset + 1] = (value >>> 16)
  12814. this[offset + 2] = (value >>> 8)
  12815. this[offset + 3] = (value & 0xff)
  12816. } else {
  12817. objectWriteUInt32(this, value, offset, false)
  12818. }
  12819. return offset + 4
  12820. }
  12821. function checkIEEE754 (buf, value, offset, ext, max, min) {
  12822. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  12823. if (offset < 0) throw new RangeError('Index out of range')
  12824. }
  12825. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  12826. if (!noAssert) {
  12827. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  12828. }
  12829. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  12830. return offset + 4
  12831. }
  12832. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  12833. return writeFloat(this, value, offset, true, noAssert)
  12834. }
  12835. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  12836. return writeFloat(this, value, offset, false, noAssert)
  12837. }
  12838. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  12839. if (!noAssert) {
  12840. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  12841. }
  12842. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  12843. return offset + 8
  12844. }
  12845. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  12846. return writeDouble(this, value, offset, true, noAssert)
  12847. }
  12848. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  12849. return writeDouble(this, value, offset, false, noAssert)
  12850. }
  12851. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  12852. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  12853. if (!start) start = 0
  12854. if (!end && end !== 0) end = this.length
  12855. if (targetStart >= target.length) targetStart = target.length
  12856. if (!targetStart) targetStart = 0
  12857. if (end > 0 && end < start) end = start
  12858. // Copy 0 bytes; we're done
  12859. if (end === start) return 0
  12860. if (target.length === 0 || this.length === 0) return 0
  12861. // Fatal error conditions
  12862. if (targetStart < 0) {
  12863. throw new RangeError('targetStart out of bounds')
  12864. }
  12865. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  12866. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  12867. // Are we oob?
  12868. if (end > this.length) end = this.length
  12869. if (target.length - targetStart < end - start) {
  12870. end = target.length - targetStart + start
  12871. }
  12872. var len = end - start
  12873. var i
  12874. if (this === target && start < targetStart && targetStart < end) {
  12875. // descending copy from end
  12876. for (i = len - 1; i >= 0; --i) {
  12877. target[i + targetStart] = this[i + start]
  12878. }
  12879. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  12880. // ascending copy from start
  12881. for (i = 0; i < len; ++i) {
  12882. target[i + targetStart] = this[i + start]
  12883. }
  12884. } else {
  12885. Uint8Array.prototype.set.call(
  12886. target,
  12887. this.subarray(start, start + len),
  12888. targetStart
  12889. )
  12890. }
  12891. return len
  12892. }
  12893. // Usage:
  12894. // buffer.fill(number[, offset[, end]])
  12895. // buffer.fill(buffer[, offset[, end]])
  12896. // buffer.fill(string[, offset[, end]][, encoding])
  12897. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  12898. // Handle string cases:
  12899. if (typeof val === 'string') {
  12900. if (typeof start === 'string') {
  12901. encoding = start
  12902. start = 0
  12903. end = this.length
  12904. } else if (typeof end === 'string') {
  12905. encoding = end
  12906. end = this.length
  12907. }
  12908. if (val.length === 1) {
  12909. var code = val.charCodeAt(0)
  12910. if (code < 256) {
  12911. val = code
  12912. }
  12913. }
  12914. if (encoding !== undefined && typeof encoding !== 'string') {
  12915. throw new TypeError('encoding must be a string')
  12916. }
  12917. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  12918. throw new TypeError('Unknown encoding: ' + encoding)
  12919. }
  12920. } else if (typeof val === 'number') {
  12921. val = val & 255
  12922. }
  12923. // Invalid ranges are not set to a default, so can range check early.
  12924. if (start < 0 || this.length < start || this.length < end) {
  12925. throw new RangeError('Out of range index')
  12926. }
  12927. if (end <= start) {
  12928. return this
  12929. }
  12930. start = start >>> 0
  12931. end = end === undefined ? this.length : end >>> 0
  12932. if (!val) val = 0
  12933. var i
  12934. if (typeof val === 'number') {
  12935. for (i = start; i < end; ++i) {
  12936. this[i] = val
  12937. }
  12938. } else {
  12939. var bytes = Buffer.isBuffer(val)
  12940. ? val
  12941. : utf8ToBytes(new Buffer(val, encoding).toString())
  12942. var len = bytes.length
  12943. for (i = 0; i < end - start; ++i) {
  12944. this[i + start] = bytes[i % len]
  12945. }
  12946. }
  12947. return this
  12948. }
  12949. // HELPER FUNCTIONS
  12950. // ================
  12951. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  12952. function base64clean (str) {
  12953. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  12954. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  12955. // Node converts strings with length < 2 to ''
  12956. if (str.length < 2) return ''
  12957. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  12958. while (str.length % 4 !== 0) {
  12959. str = str + '='
  12960. }
  12961. return str
  12962. }
  12963. function stringtrim (str) {
  12964. if (str.trim) return str.trim()
  12965. return str.replace(/^\s+|\s+$/g, '')
  12966. }
  12967. function toHex (n) {
  12968. if (n < 16) return '0' + n.toString(16)
  12969. return n.toString(16)
  12970. }
  12971. function utf8ToBytes (string, units) {
  12972. units = units || Infinity
  12973. var codePoint
  12974. var length = string.length
  12975. var leadSurrogate = null
  12976. var bytes = []
  12977. for (var i = 0; i < length; ++i) {
  12978. codePoint = string.charCodeAt(i)
  12979. // is surrogate component
  12980. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  12981. // last char was a lead
  12982. if (!leadSurrogate) {
  12983. // no lead yet
  12984. if (codePoint > 0xDBFF) {
  12985. // unexpected trail
  12986. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  12987. continue
  12988. } else if (i + 1 === length) {
  12989. // unpaired lead
  12990. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  12991. continue
  12992. }
  12993. // valid lead
  12994. leadSurrogate = codePoint
  12995. continue
  12996. }
  12997. // 2 leads in a row
  12998. if (codePoint < 0xDC00) {
  12999. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  13000. leadSurrogate = codePoint
  13001. continue
  13002. }
  13003. // valid surrogate pair
  13004. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  13005. } else if (leadSurrogate) {
  13006. // valid bmp char, but last char was a lead
  13007. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  13008. }
  13009. leadSurrogate = null
  13010. // encode utf8
  13011. if (codePoint < 0x80) {
  13012. if ((units -= 1) < 0) break
  13013. bytes.push(codePoint)
  13014. } else if (codePoint < 0x800) {
  13015. if ((units -= 2) < 0) break
  13016. bytes.push(
  13017. codePoint >> 0x6 | 0xC0,
  13018. codePoint & 0x3F | 0x80
  13019. )
  13020. } else if (codePoint < 0x10000) {
  13021. if ((units -= 3) < 0) break
  13022. bytes.push(
  13023. codePoint >> 0xC | 0xE0,
  13024. codePoint >> 0x6 & 0x3F | 0x80,
  13025. codePoint & 0x3F | 0x80
  13026. )
  13027. } else if (codePoint < 0x110000) {
  13028. if ((units -= 4) < 0) break
  13029. bytes.push(
  13030. codePoint >> 0x12 | 0xF0,
  13031. codePoint >> 0xC & 0x3F | 0x80,
  13032. codePoint >> 0x6 & 0x3F | 0x80,
  13033. codePoint & 0x3F | 0x80
  13034. )
  13035. } else {
  13036. throw new Error('Invalid code point')
  13037. }
  13038. }
  13039. return bytes
  13040. }
  13041. function asciiToBytes (str) {
  13042. var byteArray = []
  13043. for (var i = 0; i < str.length; ++i) {
  13044. // Node's code seems to be doing this and not & 0x7F..
  13045. byteArray.push(str.charCodeAt(i) & 0xFF)
  13046. }
  13047. return byteArray
  13048. }
  13049. function utf16leToBytes (str, units) {
  13050. var c, hi, lo
  13051. var byteArray = []
  13052. for (var i = 0; i < str.length; ++i) {
  13053. if ((units -= 2) < 0) break
  13054. c = str.charCodeAt(i)
  13055. hi = c >> 8
  13056. lo = c % 256
  13057. byteArray.push(lo)
  13058. byteArray.push(hi)
  13059. }
  13060. return byteArray
  13061. }
  13062. function base64ToBytes (str) {
  13063. return base64.toByteArray(base64clean(str))
  13064. }
  13065. function blitBuffer (src, dst, offset, length) {
  13066. for (var i = 0; i < length; ++i) {
  13067. if ((i + offset >= dst.length) || (i >= src.length)) break
  13068. dst[i + offset] = src[i]
  13069. }
  13070. return i
  13071. }
  13072. function isnan (val) {
  13073. return val !== val // eslint-disable-line no-self-compare
  13074. }
  13075. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("9edd")))
  13076. /***/ })
  13077. /******/ });
  13078. });