trix.js 347 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420
  1. /*
  2. Trix 1.2.0
  3. Copyright © 2019 Basecamp, LLC
  4. http://trix-editor.org/
  5. */
  6. (function () {
  7. }).call(this), function () {
  8. var t;
  9. null == window.Set && (window.Set = t = function () {
  10. function t() {
  11. this.clear()
  12. }
  13. return t.prototype.clear = function () {
  14. return this.values = []
  15. }, t.prototype.has = function (t) {
  16. return -1 !== this.values.indexOf(t)
  17. }, t.prototype.add = function (t) {
  18. return this.has(t) || this.values.push(t), this
  19. }, t.prototype["delete"] = function (t) {
  20. var e;
  21. return -1 === (e = this.values.indexOf(t)) ? !1 : (this.values.splice(e, 1), !0)
  22. }, t.prototype.forEach = function () {
  23. var t;
  24. return (t = this.values).forEach.apply(t, arguments)
  25. }, t
  26. }())
  27. }.call(this), function (t) {
  28. function e() {
  29. }
  30. function n(t, e) {
  31. return function () {
  32. t.apply(e, arguments)
  33. }
  34. }
  35. function i(t) {
  36. if ("object" != typeof this) throw new TypeError("Promises must be constructed via new");
  37. if ("function" != typeof t) throw new TypeError("not a function");
  38. this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], c(t, this)
  39. }
  40. function o(t, e) {
  41. for (; 3 === t._state;) t = t._value;
  42. return 0 === t._state ? void t._deferreds.push(e) : (t._handled = !0, void h(function () {
  43. var n = 1 === t._state ? e.onFulfilled : e.onRejected;
  44. if (null === n) return void (1 === t._state ? r : s)(e.promise, t._value);
  45. var i;
  46. try {
  47. i = n(t._value)
  48. } catch (o) {
  49. return void s(e.promise, o)
  50. }
  51. r(e.promise, i)
  52. }))
  53. }
  54. function r(t, e) {
  55. try {
  56. if (e === t) throw new TypeError("A promise cannot be resolved with itself.");
  57. if (e && ("object" == typeof e || "function" == typeof e)) {
  58. var o = e.then;
  59. if (e instanceof i) return t._state = 3, t._value = e, void a(t);
  60. if ("function" == typeof o) return void c(n(o, e), t)
  61. }
  62. t._state = 1, t._value = e, a(t)
  63. } catch (r) {
  64. s(t, r)
  65. }
  66. }
  67. function s(t, e) {
  68. t._state = 2, t._value = e, a(t)
  69. }
  70. function a(t) {
  71. 2 === t._state && 0 === t._deferreds.length && setTimeout(function () {
  72. t._handled || p(t._value)
  73. }, 1);
  74. for (var e = 0, n = t._deferreds.length; n > e; e++) o(t, t._deferreds[e]);
  75. t._deferreds = null
  76. }
  77. function u(t, e, n) {
  78. this.onFulfilled = "function" == typeof t ? t : null, this.onRejected = "function" == typeof e ? e : null, this.promise = n
  79. }
  80. function c(t, e) {
  81. var n = !1;
  82. try {
  83. t(function (t) {
  84. n || (n = !0, r(e, t))
  85. }, function (t) {
  86. n || (n = !0, s(e, t))
  87. })
  88. } catch (i) {
  89. if (n) return;
  90. n = !0, s(e, i)
  91. }
  92. }
  93. var l = setTimeout, h = "function" == typeof setImmediate && setImmediate || function (t) {
  94. l(t, 1)
  95. }, p = function (t) {
  96. "undefined" != typeof console && console && console.warn("Possible Unhandled Promise Rejection:", t)
  97. };
  98. i.prototype["catch"] = function (t) {
  99. return this.then(null, t)
  100. }, i.prototype.then = function (t, n) {
  101. var r = new i(e);
  102. return o(this, new u(t, n, r)), r
  103. }, i.all = function (t) {
  104. var e = Array.prototype.slice.call(t);
  105. return new i(function (t, n) {
  106. function i(r, s) {
  107. try {
  108. if (s && ("object" == typeof s || "function" == typeof s)) {
  109. var a = s.then;
  110. if ("function" == typeof a) return void a.call(s, function (t) {
  111. i(r, t)
  112. }, n)
  113. }
  114. e[r] = s, 0 === --o && t(e)
  115. } catch (u) {
  116. n(u)
  117. }
  118. }
  119. if (0 === e.length) return t([]);
  120. for (var o = e.length, r = 0; r < e.length; r++) i(r, e[r])
  121. })
  122. }, i.resolve = function (t) {
  123. return t && "object" == typeof t && t.constructor === i ? t : new i(function (e) {
  124. e(t)
  125. })
  126. }, i.reject = function (t) {
  127. return new i(function (e, n) {
  128. n(t)
  129. })
  130. }, i.race = function (t) {
  131. return new i(function (e, n) {
  132. for (var i = 0, o = t.length; o > i; i++) t[i].then(e, n)
  133. })
  134. }, i._setImmediateFn = function (t) {
  135. h = t
  136. }, i._setUnhandledRejectionFn = function (t) {
  137. p = t
  138. }, "undefined" != typeof module && module.exports ? module.exports = i : t.Promise || (t.Promise = i)
  139. }(this), function () {
  140. var t = "object" == typeof window.customElements, e = "function" == typeof document.registerElement, n = t || e;
  141. n || (/**
  142. * @license
  143. * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
  144. * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
  145. * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
  146. * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
  147. * Code distributed by Google as part of the polymer project is also
  148. * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
  149. */
  150. "undefined" == typeof WeakMap && !function () {
  151. var t = Object.defineProperty, e = Date.now() % 1e9, n = function () {
  152. this.name = "__st" + (1e9 * Math.random() >>> 0) + (e++ + "__")
  153. };
  154. n.prototype = {
  155. set: function (e, n) {
  156. var i = e[this.name];
  157. return i && i[0] === e ? i[1] = n : t(e, this.name, {value: [e, n], writable: !0}), this
  158. }, get: function (t) {
  159. var e;
  160. return (e = t[this.name]) && e[0] === t ? e[1] : void 0
  161. }, "delete": function (t) {
  162. var e = t[this.name];
  163. return e && e[0] === t ? (e[0] = e[1] = void 0, !0) : !1
  164. }, has: function (t) {
  165. var e = t[this.name];
  166. return e ? e[0] === t : !1
  167. }
  168. }, window.WeakMap = n
  169. }(), function (t) {
  170. function e(t) {
  171. A.push(t), b || (b = !0, g(i))
  172. }
  173. function n(t) {
  174. return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(t) || t
  175. }
  176. function i() {
  177. b = !1;
  178. var t = A;
  179. A = [], t.sort(function (t, e) {
  180. return t.uid_ - e.uid_
  181. });
  182. var e = !1;
  183. t.forEach(function (t) {
  184. var n = t.takeRecords();
  185. o(t), n.length && (t.callback_(n, t), e = !0)
  186. }), e && i()
  187. }
  188. function o(t) {
  189. t.nodes_.forEach(function (e) {
  190. var n = m.get(e);
  191. n && n.forEach(function (e) {
  192. e.observer === t && e.removeTransientObservers()
  193. })
  194. })
  195. }
  196. function r(t, e) {
  197. for (var n = t; n; n = n.parentNode) {
  198. var i = m.get(n);
  199. if (i) for (var o = 0; o < i.length; o++) {
  200. var r = i[o], s = r.options;
  201. if (n === t || s.subtree) {
  202. var a = e(s);
  203. a && r.enqueue(a)
  204. }
  205. }
  206. }
  207. }
  208. function s(t) {
  209. this.callback_ = t, this.nodes_ = [], this.records_ = [], this.uid_ = ++C
  210. }
  211. function a(t, e) {
  212. this.type = t, this.target = e, this.addedNodes = [], this.removedNodes = [], this.previousSibling = null, this.nextSibling = null, this.attributeName = null, this.attributeNamespace = null, this.oldValue = null
  213. }
  214. function u(t) {
  215. var e = new a(t.type, t.target);
  216. return e.addedNodes = t.addedNodes.slice(), e.removedNodes = t.removedNodes.slice(), e.previousSibling = t.previousSibling, e.nextSibling = t.nextSibling, e.attributeName = t.attributeName, e.attributeNamespace = t.attributeNamespace, e.oldValue = t.oldValue, e
  217. }
  218. function c(t, e) {
  219. return x = new a(t, e)
  220. }
  221. function l(t) {
  222. return w ? w : (w = u(x), w.oldValue = t, w)
  223. }
  224. function h() {
  225. x = w = void 0
  226. }
  227. function p(t) {
  228. return t === w || t === x
  229. }
  230. function d(t, e) {
  231. return t === e ? t : w && p(t) ? w : null
  232. }
  233. function f(t, e, n) {
  234. this.observer = t, this.target = e, this.options = n, this.transientObservedNodes = []
  235. }
  236. if (!t.JsMutationObserver) {
  237. var g, m = new WeakMap;
  238. if (/Trident|Edge/.test(navigator.userAgent)) g = setTimeout; else if (window.setImmediate) g = window.setImmediate; else {
  239. var v = [], y = String(Math.random());
  240. window.addEventListener("message", function (t) {
  241. if (t.data === y) {
  242. var e = v;
  243. v = [], e.forEach(function (t) {
  244. t()
  245. })
  246. }
  247. }), g = function (t) {
  248. v.push(t), window.postMessage(y, "*")
  249. }
  250. }
  251. var b = !1, A = [], C = 0;
  252. s.prototype = {
  253. observe: function (t, e) {
  254. if (t = n(t), !e.childList && !e.attributes && !e.characterData || e.attributeOldValue && !e.attributes || e.attributeFilter && e.attributeFilter.length && !e.attributes || e.characterDataOldValue && !e.characterData) throw new SyntaxError;
  255. var i = m.get(t);
  256. i || m.set(t, i = []);
  257. for (var o, r = 0; r < i.length; r++) if (i[r].observer === this) {
  258. o = i[r], o.removeListeners(), o.options = e;
  259. break
  260. }
  261. o || (o = new f(this, t, e), i.push(o), this.nodes_.push(t)), o.addListeners()
  262. }, disconnect: function () {
  263. this.nodes_.forEach(function (t) {
  264. for (var e = m.get(t), n = 0; n < e.length; n++) {
  265. var i = e[n];
  266. if (i.observer === this) {
  267. i.removeListeners(), e.splice(n, 1);
  268. break
  269. }
  270. }
  271. }, this), this.records_ = []
  272. }, takeRecords: function () {
  273. var t = this.records_;
  274. return this.records_ = [], t
  275. }
  276. };
  277. var x, w;
  278. f.prototype = {
  279. enqueue: function (t) {
  280. var n = this.observer.records_, i = n.length;
  281. if (n.length > 0) {
  282. var o = n[i - 1], r = d(o, t);
  283. if (r) return void (n[i - 1] = r)
  284. } else e(this.observer);
  285. n[i] = t
  286. }, addListeners: function () {
  287. this.addListeners_(this.target)
  288. }, addListeners_: function (t) {
  289. var e = this.options;
  290. e.attributes && t.addEventListener("DOMAttrModified", this, !0), e.characterData && t.addEventListener("DOMCharacterDataModified", this, !0), e.childList && t.addEventListener("DOMNodeInserted", this, !0), (e.childList || e.subtree) && t.addEventListener("DOMNodeRemoved", this, !0)
  291. }, removeListeners: function () {
  292. this.removeListeners_(this.target)
  293. }, removeListeners_: function (t) {
  294. var e = this.options;
  295. e.attributes && t.removeEventListener("DOMAttrModified", this, !0), e.characterData && t.removeEventListener("DOMCharacterDataModified", this, !0), e.childList && t.removeEventListener("DOMNodeInserted", this, !0), (e.childList || e.subtree) && t.removeEventListener("DOMNodeRemoved", this, !0)
  296. }, addTransientObserver: function (t) {
  297. if (t !== this.target) {
  298. this.addListeners_(t), this.transientObservedNodes.push(t);
  299. var e = m.get(t);
  300. e || m.set(t, e = []), e.push(this)
  301. }
  302. }, removeTransientObservers: function () {
  303. var t = this.transientObservedNodes;
  304. this.transientObservedNodes = [], t.forEach(function (t) {
  305. this.removeListeners_(t);
  306. for (var e = m.get(t), n = 0; n < e.length; n++) if (e[n] === this) {
  307. e.splice(n, 1);
  308. break
  309. }
  310. }, this)
  311. }, handleEvent: function (t) {
  312. switch (t.stopImmediatePropagation(), t.type) {
  313. case"DOMAttrModified":
  314. var e = t.attrName, n = t.relatedNode.namespaceURI, i = t.target,
  315. o = new c("attributes", i);
  316. o.attributeName = e, o.attributeNamespace = n;
  317. var s = t.attrChange === MutationEvent.ADDITION ? null : t.prevValue;
  318. r(i, function (t) {
  319. return !t.attributes || t.attributeFilter && t.attributeFilter.length && -1 === t.attributeFilter.indexOf(e) && -1 === t.attributeFilter.indexOf(n) ? void 0 : t.attributeOldValue ? l(s) : o
  320. });
  321. break;
  322. case"DOMCharacterDataModified":
  323. var i = t.target, o = c("characterData", i), s = t.prevValue;
  324. r(i, function (t) {
  325. return t.characterData ? t.characterDataOldValue ? l(s) : o : void 0
  326. });
  327. break;
  328. case"DOMNodeRemoved":
  329. this.addTransientObserver(t.target);
  330. case"DOMNodeInserted":
  331. var a, u, p = t.target;
  332. "DOMNodeInserted" === t.type ? (a = [p], u = []) : (a = [], u = [p]);
  333. var d = p.previousSibling, f = p.nextSibling, o = c("childList", t.target.parentNode);
  334. o.addedNodes = a, o.removedNodes = u, o.previousSibling = d, o.nextSibling = f, r(t.relatedNode, function (t) {
  335. return t.childList ? o : void 0
  336. })
  337. }
  338. h()
  339. }
  340. }, t.JsMutationObserver = s, t.MutationObserver || (t.MutationObserver = s, s._isPolyfilled = !0)
  341. }
  342. }(self), function () {
  343. "use strict";
  344. if (!window.performance || !window.performance.now) {
  345. var t = Date.now();
  346. window.performance = {
  347. now: function () {
  348. return Date.now() - t
  349. }
  350. }
  351. }
  352. window.requestAnimationFrame || (window.requestAnimationFrame = function () {
  353. var t = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
  354. return t ? function (e) {
  355. return t(function () {
  356. e(performance.now())
  357. })
  358. } : function (t) {
  359. return window.setTimeout(t, 1e3 / 60)
  360. }
  361. }()), window.cancelAnimationFrame || (window.cancelAnimationFrame = function () {
  362. return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function (t) {
  363. clearTimeout(t)
  364. }
  365. }());
  366. var e = function () {
  367. var t = document.createEvent("Event");
  368. return t.initEvent("foo", !0, !0), t.preventDefault(), t.defaultPrevented
  369. }();
  370. if (!e) {
  371. var n = Event.prototype.preventDefault;
  372. Event.prototype.preventDefault = function () {
  373. this.cancelable && (n.call(this), Object.defineProperty(this, "defaultPrevented", {
  374. get: function () {
  375. return !0
  376. }, configurable: !0
  377. }))
  378. }
  379. }
  380. var i = /Trident/.test(navigator.userAgent);
  381. if ((!window.CustomEvent || i && "function" != typeof window.CustomEvent) && (window.CustomEvent = function (t, e) {
  382. e = e || {};
  383. var n = document.createEvent("CustomEvent");
  384. return n.initCustomEvent(t, Boolean(e.bubbles), Boolean(e.cancelable), e.detail), n
  385. }, window.CustomEvent.prototype = window.Event.prototype), !window.Event || i && "function" != typeof window.Event) {
  386. var o = window.Event;
  387. window.Event = function (t, e) {
  388. e = e || {};
  389. var n = document.createEvent("Event");
  390. return n.initEvent(t, Boolean(e.bubbles), Boolean(e.cancelable)), n
  391. }, window.Event.prototype = o.prototype
  392. }
  393. }(window.WebComponents), window.CustomElements = window.CustomElements || {flags: {}}, function (t) {
  394. var e = t.flags, n = [], i = function (t) {
  395. n.push(t)
  396. }, o = function () {
  397. n.forEach(function (e) {
  398. e(t)
  399. })
  400. };
  401. t.addModule = i, t.initializeModules = o, t.hasNative = Boolean(document.registerElement), t.isIE = /Trident/.test(navigator.userAgent), t.useNative = !e.register && t.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || window.HTMLImports.useNative)
  402. }(window.CustomElements), window.CustomElements.addModule(function (t) {
  403. function e(t, e) {
  404. n(t, function (t) {
  405. return e(t) ? !0 : void i(t, e)
  406. }), i(t, e)
  407. }
  408. function n(t, e, i) {
  409. var o = t.firstElementChild;
  410. if (!o) for (o = t.firstChild; o && o.nodeType !== Node.ELEMENT_NODE;) o = o.nextSibling;
  411. for (; o;) e(o, i) !== !0 && n(o, e, i), o = o.nextElementSibling;
  412. return null
  413. }
  414. function i(t, n) {
  415. for (var i = t.shadowRoot; i;) e(i, n), i = i.olderShadowRoot
  416. }
  417. function o(t, e) {
  418. r(t, e, [])
  419. }
  420. function r(t, e, n) {
  421. if (t = window.wrap(t), !(n.indexOf(t) >= 0)) {
  422. n.push(t);
  423. for (var i, o = t.querySelectorAll("link[rel=" + s + "]"), a = 0, u = o.length; u > a && (i = o[a]); a++) i.import && r(i.import, e, n);
  424. e(t)
  425. }
  426. }
  427. var s = window.HTMLImports ? window.HTMLImports.IMPORT_LINK_TYPE : "none";
  428. t.forDocumentTree = o, t.forSubtree = e
  429. }), window.CustomElements.addModule(function (t) {
  430. function e(t, e) {
  431. return n(t, e) || i(t, e)
  432. }
  433. function n(e, n) {
  434. return t.upgrade(e, n) ? !0 : void (n && s(e))
  435. }
  436. function i(t, e) {
  437. b(t, function (t) {
  438. return n(t, e) ? !0 : void 0
  439. })
  440. }
  441. function o(t) {
  442. w.push(t), x || (x = !0, setTimeout(r))
  443. }
  444. function r() {
  445. x = !1;
  446. for (var t, e = w, n = 0, i = e.length; i > n && (t = e[n]); n++) t();
  447. w = []
  448. }
  449. function s(t) {
  450. C ? o(function () {
  451. a(t)
  452. }) : a(t)
  453. }
  454. function a(t) {
  455. t.__upgraded__ && !t.__attached && (t.__attached = !0, t.attachedCallback && t.attachedCallback())
  456. }
  457. function u(t) {
  458. c(t), b(t, function (t) {
  459. c(t)
  460. })
  461. }
  462. function c(t) {
  463. C ? o(function () {
  464. l(t)
  465. }) : l(t)
  466. }
  467. function l(t) {
  468. t.__upgraded__ && t.__attached && (t.__attached = !1, t.detachedCallback && t.detachedCallback())
  469. }
  470. function h(t) {
  471. for (var e = t, n = window.wrap(document); e;) {
  472. if (e == n) return !0;
  473. e = e.parentNode || e.nodeType === Node.DOCUMENT_FRAGMENT_NODE && e.host
  474. }
  475. }
  476. function p(t) {
  477. if (t.shadowRoot && !t.shadowRoot.__watched) {
  478. y.dom && console.log("watching shadow-root for: ", t.localName);
  479. for (var e = t.shadowRoot; e;) g(e), e = e.olderShadowRoot
  480. }
  481. }
  482. function d(t, n) {
  483. if (y.dom) {
  484. var i = n[0];
  485. if (i && "childList" === i.type && i.addedNodes && i.addedNodes) {
  486. for (var o = i.addedNodes[0]; o && o !== document && !o.host;) o = o.parentNode;
  487. var r = o && (o.URL || o._URL || o.host && o.host.localName) || "";
  488. r = r.split("/?").shift().split("/").pop()
  489. }
  490. console.group("mutations (%d) [%s]", n.length, r || "")
  491. }
  492. var s = h(t);
  493. n.forEach(function (t) {
  494. "childList" === t.type && (E(t.addedNodes, function (t) {
  495. t.localName && e(t, s)
  496. }), E(t.removedNodes, function (t) {
  497. t.localName && u(t)
  498. }))
  499. }), y.dom && console.groupEnd()
  500. }
  501. function f(t) {
  502. for (t = window.wrap(t), t || (t = window.wrap(document)); t.parentNode;) t = t.parentNode;
  503. var e = t.__observer;
  504. e && (d(t, e.takeRecords()), r())
  505. }
  506. function g(t) {
  507. if (!t.__observer) {
  508. var e = new MutationObserver(d.bind(this, t));
  509. e.observe(t, {childList: !0, subtree: !0}), t.__observer = e
  510. }
  511. }
  512. function m(t) {
  513. t = window.wrap(t), y.dom && console.group("upgradeDocument: ", t.baseURI.split("/").pop());
  514. var n = t === window.wrap(document);
  515. e(t, n), g(t), y.dom && console.groupEnd()
  516. }
  517. function v(t) {
  518. A(t, m)
  519. }
  520. var y = t.flags, b = t.forSubtree, A = t.forDocumentTree,
  521. C = window.MutationObserver._isPolyfilled && y["throttle-attached"];
  522. t.hasPolyfillMutations = C, t.hasThrottledAttached = C;
  523. var x = !1, w = [], E = Array.prototype.forEach.call.bind(Array.prototype.forEach),
  524. S = Element.prototype.createShadowRoot;
  525. S && (Element.prototype.createShadowRoot = function () {
  526. var t = S.call(this);
  527. return window.CustomElements.watchShadow(this), t
  528. }), t.watchShadow = p, t.upgradeDocumentTree = v, t.upgradeDocument = m, t.upgradeSubtree = i, t.upgradeAll = e, t.attached = s, t.takeRecords = f
  529. }), window.CustomElements.addModule(function (t) {
  530. function e(e, i) {
  531. if ("template" === e.localName && window.HTMLTemplateElement && HTMLTemplateElement.decorate && HTMLTemplateElement.decorate(e), !e.__upgraded__ && e.nodeType === Node.ELEMENT_NODE) {
  532. var o = e.getAttribute("is"),
  533. r = t.getRegisteredDefinition(e.localName) || t.getRegisteredDefinition(o);
  534. if (r && (o && r.tag == e.localName || !o && !r.extends)) return n(e, r, i)
  535. }
  536. }
  537. function n(e, n, o) {
  538. return s.upgrade && console.group("upgrade:", e.localName), n.is && e.setAttribute("is", n.is), i(e, n), e.__upgraded__ = !0, r(e), o && t.attached(e), t.upgradeSubtree(e, o), s.upgrade && console.groupEnd(), e
  539. }
  540. function i(t, e) {
  541. Object.__proto__ ? t.__proto__ = e.prototype : (o(t, e.prototype, e.native), t.__proto__ = e.prototype)
  542. }
  543. function o(t, e, n) {
  544. for (var i = {}, o = e; o !== n && o !== HTMLElement.prototype;) {
  545. for (var r, s = Object.getOwnPropertyNames(o), a = 0; r = s[a]; a++) i[r] || (Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(o, r)), i[r] = 1);
  546. o = Object.getPrototypeOf(o)
  547. }
  548. }
  549. function r(t) {
  550. t.createdCallback && t.createdCallback()
  551. }
  552. var s = t.flags;
  553. t.upgrade = e, t.upgradeWithDefinition = n, t.implementPrototype = i
  554. }), window.CustomElements.addModule(function (t) {
  555. function e(e, i) {
  556. var u = i || {};
  557. if (!e) throw new Error("document.registerElement: first argument `name` must not be empty");
  558. if (e.indexOf("-") < 0) throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(e) + "'.");
  559. if (o(e)) throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(e) + "'. The type name is invalid.");
  560. if (c(e)) throw new Error("DuplicateDefinitionError: a type with name '" + String(e) + "' is already registered");
  561. return u.prototype || (u.prototype = Object.create(HTMLElement.prototype)), u.__name = e.toLowerCase(), u.extends && (u.extends = u.extends.toLowerCase()), u.lifecycle = u.lifecycle || {}, u.ancestry = r(u.extends), s(u), a(u), n(u.prototype), l(u.__name, u), u.ctor = h(u), u.ctor.prototype = u.prototype, u.prototype.constructor = u.ctor, t.ready && m(document), u.ctor
  562. }
  563. function n(t) {
  564. if (!t.setAttribute._polyfilled) {
  565. var e = t.setAttribute;
  566. t.setAttribute = function (t, n) {
  567. i.call(this, t, n, e)
  568. };
  569. var n = t.removeAttribute;
  570. t.removeAttribute = function (t) {
  571. i.call(this, t, null, n)
  572. }, t.setAttribute._polyfilled = !0
  573. }
  574. }
  575. function i(t, e, n) {
  576. t = t.toLowerCase();
  577. var i = this.getAttribute(t);
  578. n.apply(this, arguments);
  579. var o = this.getAttribute(t);
  580. this.attributeChangedCallback && o !== i && this.attributeChangedCallback(t, i, o)
  581. }
  582. function o(t) {
  583. for (var e = 0; e < C.length; e++) if (t === C[e]) return !0
  584. }
  585. function r(t) {
  586. var e = c(t);
  587. return e ? r(e.extends).concat([e]) : []
  588. }
  589. function s(t) {
  590. for (var e, n = t.extends, i = 0; e = t.ancestry[i]; i++) n = e.is && e.tag;
  591. t.tag = n || t.__name, n && (t.is = t.__name)
  592. }
  593. function a(t) {
  594. if (!Object.__proto__) {
  595. var e = HTMLElement.prototype;
  596. if (t.is) {
  597. var n = document.createElement(t.tag);
  598. e = Object.getPrototypeOf(n)
  599. }
  600. for (var i, o = t.prototype, r = !1; o;) o == e && (r = !0), i = Object.getPrototypeOf(o), i && (o.__proto__ = i), o = i;
  601. r || console.warn(t.tag + " prototype not found in prototype chain for " + t.is), t.native = e
  602. }
  603. }
  604. function u(t) {
  605. return y(E(t.tag), t)
  606. }
  607. function c(t) {
  608. return t ? x[t.toLowerCase()] : void 0
  609. }
  610. function l(t, e) {
  611. x[t] = e
  612. }
  613. function h(t) {
  614. return function () {
  615. return u(t)
  616. }
  617. }
  618. function p(t, e, n) {
  619. return t === w ? d(e, n) : S(t, e)
  620. }
  621. function d(t, e) {
  622. t && (t = t.toLowerCase()), e && (e = e.toLowerCase());
  623. var n = c(e || t);
  624. if (n) {
  625. if (t == n.tag && e == n.is) return new n.ctor;
  626. if (!e && !n.is) return new n.ctor
  627. }
  628. var i;
  629. return e ? (i = d(t), i.setAttribute("is", e), i) : (i = E(t), t.indexOf("-") >= 0 && b(i, HTMLElement), i)
  630. }
  631. function f(t, e) {
  632. var n = t[e];
  633. t[e] = function () {
  634. var t = n.apply(this, arguments);
  635. return v(t), t
  636. }
  637. }
  638. var g, m = (t.isIE, t.upgradeDocumentTree), v = t.upgradeAll, y = t.upgradeWithDefinition,
  639. b = t.implementPrototype, A = t.useNative,
  640. C = ["annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph"],
  641. x = {}, w = "http://www.w3.org/1999/xhtml", E = document.createElement.bind(document),
  642. S = document.createElementNS.bind(document);
  643. g = Object.__proto__ || A ? function (t, e) {
  644. return t instanceof e
  645. } : function (t, e) {
  646. if (t instanceof e) return !0;
  647. for (var n = t; n;) {
  648. if (n === e.prototype) return !0;
  649. n = n.__proto__
  650. }
  651. return !1
  652. }, f(Node.prototype, "cloneNode"), f(document, "importNode"), document.registerElement = e, document.createElement = d, document.createElementNS = p, t.registry = x, t.instanceof = g, t.reservedTagList = C, t.getRegisteredDefinition = c, document.register = document.registerElement
  653. }), function (t) {
  654. function e() {
  655. r(window.wrap(document)), window.CustomElements.ready = !0;
  656. var t = window.requestAnimationFrame || function (t) {
  657. setTimeout(t, 16)
  658. };
  659. t(function () {
  660. setTimeout(function () {
  661. window.CustomElements.readyTime = Date.now(), window.HTMLImports && (window.CustomElements.elapsed = window.CustomElements.readyTime - window.HTMLImports.readyTime), document.dispatchEvent(new CustomEvent("WebComponentsReady", {bubbles: !0}))
  662. })
  663. })
  664. }
  665. var n = t.useNative, i = t.initializeModules;
  666. if (t.isIE, n) {
  667. var o = function () {
  668. };
  669. t.watchShadow = o, t.upgrade = o, t.upgradeAll = o, t.upgradeDocumentTree = o, t.upgradeSubtree = o, t.takeRecords = o, t.instanceof = function (t, e) {
  670. return t instanceof e
  671. }
  672. } else i();
  673. var r = t.upgradeDocumentTree, s = t.upgradeDocument;
  674. if (window.wrap || (window.ShadowDOMPolyfill ? (window.wrap = window.ShadowDOMPolyfill.wrapIfNeeded, window.unwrap = window.ShadowDOMPolyfill.unwrapIfNeeded) : window.wrap = window.unwrap = function (t) {
  675. return t
  676. }), window.HTMLImports && (window.HTMLImports.__importsParsingHook = function (t) {
  677. t.import && s(wrap(t.import))
  678. }), "complete" === document.readyState || t.flags.eager) e(); else if ("interactive" !== document.readyState || window.attachEvent || window.HTMLImports && !window.HTMLImports.ready) {
  679. var a = window.HTMLImports && !window.HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
  680. window.addEventListener(a, e)
  681. } else e()
  682. }(window.CustomElements))
  683. }.call(this), function () {
  684. }.call(this), function () {
  685. var t = this;
  686. (function () {
  687. (function () {
  688. this.Trix = {
  689. VERSION: "1.2.0",
  690. ZERO_WIDTH_SPACE: "\ufeff",
  691. NON_BREAKING_SPACE: "\xa0",
  692. OBJECT_REPLACEMENT_CHARACTER: "\ufffc",
  693. browser: {
  694. composesExistingText: /Android.*Chrome/.test(navigator.userAgent),
  695. forcesObjectResizing: /Trident.*rv:11/.test(navigator.userAgent),
  696. supportsInputEvents: function () {
  697. var t, e, n, i;
  698. if ("undefined" == typeof InputEvent) return !1;
  699. for (i = ["data", "getTargetRanges", "inputType"], t = 0, e = i.length; e > t; t++) if (n = i[t], !(n in InputEvent.prototype)) return !1;
  700. return !0
  701. }()
  702. },
  703. config: {}
  704. }
  705. }).call(this)
  706. }).call(t);
  707. var e = t.Trix;
  708. (function () {
  709. (function () {
  710. e.BasicObject = function () {
  711. function t() {
  712. }
  713. var e, n, i;
  714. return t.proxyMethod = function (t) {
  715. var i, o, r, s, a;
  716. return r = n(t), i = r.name, s = r.toMethod, a = r.toProperty, o = r.optional, this.prototype[i] = function () {
  717. var t, n;
  718. return t = null != s ? o ? "function" == typeof this[s] ? this[s]() : void 0 : this[s]() : null != a ? this[a] : void 0, o ? (n = null != t ? t[i] : void 0, null != n ? e.call(n, t, arguments) : void 0) : (n = t[i], e.call(n, t, arguments))
  719. }
  720. }, n = function (t) {
  721. var e, n;
  722. if (!(n = t.match(i))) throw new Error("can't parse @proxyMethod expression: " + t);
  723. return e = {name: n[4]}, null != n[2] ? e.toMethod = n[1] : e.toProperty = n[1], null != n[3] && (e.optional = !0), e
  724. }, e = Function.prototype.apply, i = /^(.+?)(\(\))?(\?)?\.(.+?)$/, t
  725. }()
  726. }).call(this), function () {
  727. var t = function (t, e) {
  728. function i() {
  729. this.constructor = t
  730. }
  731. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  732. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  733. }, n = {}.hasOwnProperty;
  734. e.Object = function (n) {
  735. function i() {
  736. this.id = ++o
  737. }
  738. var o;
  739. return t(i, n), o = 0, i.fromJSONString = function (t) {
  740. return this.fromJSON(JSON.parse(t))
  741. }, i.prototype.hasSameConstructorAs = function (t) {
  742. return this.constructor === (null != t ? t.constructor : void 0)
  743. }, i.prototype.isEqualTo = function (t) {
  744. return this === t
  745. }, i.prototype.inspect = function () {
  746. var t, e, n;
  747. return t = function () {
  748. var t, i, o;
  749. i = null != (t = this.contentsForInspection()) ? t : {}, o = [];
  750. for (e in i) n = i[e], o.push(e + "=" + n);
  751. return o
  752. }.call(this), "#<" + this.constructor.name + ":" + this.id + (t.length ? " " + t.join(", ") : "") + ">"
  753. }, i.prototype.contentsForInspection = function () {
  754. }, i.prototype.toJSONString = function () {
  755. return JSON.stringify(this)
  756. }, i.prototype.toUTF16String = function () {
  757. return e.UTF16String.box(this)
  758. }, i.prototype.getCacheKey = function () {
  759. return this.id.toString()
  760. }, i
  761. }(e.BasicObject)
  762. }.call(this), function () {
  763. e.extend = function (t) {
  764. var e, n;
  765. for (e in t) n = t[e], this[e] = n;
  766. return this
  767. }
  768. }.call(this), function () {
  769. e.extend({
  770. defer: function (t) {
  771. return setTimeout(t, 1)
  772. }
  773. })
  774. }.call(this), function () {
  775. var t, n;
  776. e.extend({
  777. normalizeSpaces: function (t) {
  778. return t.replace(RegExp("" + e.ZERO_WIDTH_SPACE, "g"), "").replace(RegExp("" + e.NON_BREAKING_SPACE, "g"), " ")
  779. },
  780. normalizeNewlines: function (t) {
  781. return t.replace(/\r\n/g, "\n")
  782. },
  783. breakableWhitespacePattern: RegExp("[^\\S" + e.NON_BREAKING_SPACE + "]"),
  784. squishBreakableWhitespace: function (t) {
  785. return t.replace(RegExp("" + e.breakableWhitespacePattern.source, "g"), " ").replace(/\ {2,}/g, " ")
  786. },
  787. escapeHTML: function (t) {
  788. var e;
  789. return e = document.createElement("div"), e.textContent = t, e.innerHTML
  790. },
  791. summarizeStringChange: function (t, i) {
  792. var o, r, s, a;
  793. return t = e.UTF16String.box(t), i = e.UTF16String.box(i), i.length < t.length ? (r = n(t, i), a = r[0], o = r[1]) : (s = n(i, t), o = s[0], a = s[1]), {
  794. added: o,
  795. removed: a
  796. }
  797. }
  798. }), n = function (n, i) {
  799. var o, r, s, a, u;
  800. return n.isEqualTo(i) ? ["", ""] : (r = t(n, i), a = r.utf16String.length, s = a ? (u = r.offset, r, o = n.codepoints.slice(0, u).concat(n.codepoints.slice(u + a)), t(i, e.UTF16String.fromCodepoints(o))) : t(i, n), [r.utf16String.toString(), s.utf16String.toString()])
  801. }, t = function (t, e) {
  802. var n, i, o;
  803. for (n = 0, i = t.length, o = e.length; i > n && t.charAt(n).isEqualTo(e.charAt(n));) n++;
  804. for (; i > n + 1 && t.charAt(i - 1).isEqualTo(e.charAt(o - 1));) i--, o--;
  805. return {utf16String: t.slice(n, i), offset: n}
  806. }
  807. }.call(this), function () {
  808. e.extend({
  809. copyObject: function (t) {
  810. var e, n, i;
  811. null == t && (t = {}), n = {};
  812. for (e in t) i = t[e], n[e] = i;
  813. return n
  814. }, objectsAreEqual: function (t, e) {
  815. var n, i;
  816. if (null == t && (t = {}), null == e && (e = {}), Object.keys(t).length !== Object.keys(e).length) return !1;
  817. for (n in t) if (i = t[n], i !== e[n]) return !1;
  818. return !0
  819. }
  820. })
  821. }.call(this), function () {
  822. var t = [].slice;
  823. e.extend({
  824. arraysAreEqual: function (t, e) {
  825. var n, i, o, r;
  826. if (null == t && (t = []), null == e && (e = []), t.length !== e.length) return !1;
  827. for (i = n = 0, o = t.length; o > n; i = ++n) if (r = t[i], r !== e[i]) return !1;
  828. return !0
  829. }, arrayStartsWith: function (t, n) {
  830. return null == t && (t = []), null == n && (n = []), e.arraysAreEqual(t.slice(0, n.length), n)
  831. }, spliceArray: function () {
  832. var e, n, i;
  833. return n = arguments[0], e = 2 <= arguments.length ? t.call(arguments, 1) : [], i = n.slice(0), i.splice.apply(i, e), i
  834. }, summarizeArrayChange: function (t, e) {
  835. var n, i, o, r, s, a, u, c, l, h, p;
  836. for (null == t && (t = []), null == e && (e = []), n = [], h = [], o = new Set, r = 0, u = t.length; u > r; r++) p = t[r], o.add(p);
  837. for (i = new Set, s = 0, c = e.length; c > s; s++) p = e[s], i.add(p), o.has(p) || n.push(p);
  838. for (a = 0, l = t.length; l > a; a++) p = t[a], i.has(p) || h.push(p);
  839. return {added: n, removed: h}
  840. }
  841. })
  842. }.call(this), function () {
  843. var t, n, i, o;
  844. t = null, n = null, o = null, i = null, e.extend({
  845. getAllAttributeNames: function () {
  846. return null != t ? t : t = e.getTextAttributeNames().concat(e.getBlockAttributeNames())
  847. }, getBlockConfig: function (t) {
  848. return e.config.blockAttributes[t]
  849. }, getBlockAttributeNames: function () {
  850. return null != n ? n : n = Object.keys(e.config.blockAttributes)
  851. }, getTextConfig: function (t) {
  852. return e.config.textAttributes[t]
  853. }, getTextAttributeNames: function () {
  854. return null != o ? o : o = Object.keys(e.config.textAttributes)
  855. }, getListAttributeNames: function () {
  856. var t, n;
  857. return null != i ? i : i = function () {
  858. var i, o;
  859. i = e.config.blockAttributes, o = [];
  860. for (t in i) n = i[t].listAttribute, null != n && o.push(n);
  861. return o
  862. }()
  863. }
  864. })
  865. }.call(this), function () {
  866. var t, n, i, o, r, s = [].indexOf || function (t) {
  867. for (var e = 0, n = this.length; n > e; e++) if (e in this && this[e] === t) return e;
  868. return -1
  869. };
  870. t = document.documentElement, n = null != (i = null != (o = null != (r = t.matchesSelector) ? r : t.webkitMatchesSelector) ? o : t.msMatchesSelector) ? i : t.mozMatchesSelector, e.extend({
  871. handleEvent: function (n, i) {
  872. var o, r, s, a, u, c, l, h, p, d, f, g;
  873. return h = null != i ? i : {}, c = h.onElement, u = h.matchingSelector, g = h.withCallback, a = h.inPhase, l = h.preventDefault, d = h.times, r = null != c ? c : t, p = u, o = g, f = "capturing" === a, s = function (t) {
  874. var n;
  875. return null != d && 0 === --d && s.destroy(), n = e.findClosestElementFromNode(t.target, {matchingSelector: p}), null != n && (null != g && g.call(n, t, n), l) ? t.preventDefault() : void 0
  876. }, s.destroy = function () {
  877. return r.removeEventListener(n, s, f)
  878. }, r.addEventListener(n, s, f), s
  879. }, handleEventOnce: function (t, n) {
  880. return null == n && (n = {}), n.times = 1, e.handleEvent(t, n)
  881. }, triggerEvent: function (n, i) {
  882. var o, r, s, a, u, c, l;
  883. return l = null != i ? i : {}, c = l.onElement, r = l.bubbles, s = l.cancelable, o = l.attributes, a = null != c ? c : t, r = r !== !1, s = s !== !1, u = document.createEvent("Events"), u.initEvent(n, r, s), null != o && e.extend.call(u, o), a.dispatchEvent(u)
  884. }, elementMatchesSelector: function (t, e) {
  885. return 1 === (null != t ? t.nodeType : void 0) ? n.call(t, e) : void 0
  886. }, findClosestElementFromNode: function (t, n) {
  887. var i, o, r;
  888. for (o = null != n ? n : {}, i = o.matchingSelector, r = o.untilNode; null != t && t.nodeType !== Node.ELEMENT_NODE;) t = t.parentNode;
  889. if (null != t) {
  890. if (null == i) return t;
  891. if (t.closest && null == r) return t.closest(i);
  892. for (; t && t !== r;) {
  893. if (e.elementMatchesSelector(t, i)) return t;
  894. t = t.parentNode
  895. }
  896. }
  897. }, findInnerElement: function (t) {
  898. for (; null != t ? t.firstElementChild : void 0;) t = t.firstElementChild;
  899. return t
  900. }, innerElementIsActive: function (t) {
  901. return document.activeElement !== t && e.elementContainsNode(t, document.activeElement)
  902. }, elementContainsNode: function (t, e) {
  903. if (t && e) for (; e;) {
  904. if (e === t) return !0;
  905. e = e.parentNode
  906. }
  907. }, findNodeFromContainerAndOffset: function (t, e) {
  908. var n;
  909. if (t) return t.nodeType === Node.TEXT_NODE ? t : 0 === e ? null != (n = t.firstChild) ? n : t : t.childNodes.item(e - 1)
  910. }, findElementFromContainerAndOffset: function (t, n) {
  911. var i;
  912. return i = e.findNodeFromContainerAndOffset(t, n), e.findClosestElementFromNode(i)
  913. }, findChildIndexOfNode: function (t) {
  914. var e;
  915. if (null != t ? t.parentNode : void 0) {
  916. for (e = 0; t = t.previousSibling;) e++;
  917. return e
  918. }
  919. }, removeNode: function (t) {
  920. var e;
  921. return null != t && null != (e = t.parentNode) ? e.removeChild(t) : void 0
  922. }, walkTree: function (t, e) {
  923. var n, i, o, r, s;
  924. return o = null != e ? e : {}, i = o.onlyNodesOfType, r = o.usingFilter, n = o.expandEntityReferences, s = function () {
  925. switch (i) {
  926. case"element":
  927. return NodeFilter.SHOW_ELEMENT;
  928. case"text":
  929. return NodeFilter.SHOW_TEXT;
  930. case"comment":
  931. return NodeFilter.SHOW_COMMENT;
  932. default:
  933. return NodeFilter.SHOW_ALL
  934. }
  935. }(), document.createTreeWalker(t, s, null != r ? r : null, n === !0)
  936. }, tagName: function (t) {
  937. var e;
  938. return null != t && null != (e = t.tagName) ? e.toLowerCase() : void 0
  939. }, makeElement: function (t, e) {
  940. var n, i, o, r, s, a, u, c, l, h;
  941. if (null == e && (e = {}), "object" == typeof t ? (e = t, t = e.tagName) : e = {attributes: e}, i = document.createElement(t), null != e.editable && (null == e.attributes && (e.attributes = {}), e.attributes.contenteditable = e.editable), e.attributes) {
  942. a = e.attributes;
  943. for (r in a) h = a[r], i.setAttribute(r, h)
  944. }
  945. if (e.style) {
  946. u = e.style;
  947. for (r in u) h = u[r], i.style[r] = h
  948. }
  949. if (e.data) {
  950. c = e.data;
  951. for (r in c) h = c[r], i.dataset[r] = h
  952. }
  953. if (e.className) for (l = e.className.split(" "), o = 0, s = l.length; s > o; o++) n = l[o], i.classList.add(n);
  954. return e.textContent && (i.textContent = e.textContent), i
  955. }, getBlockTagNames: function () {
  956. var t, n;
  957. return null != e.blockTagNames ? e.blockTagNames : e.blockTagNames = function () {
  958. var i, o;
  959. i = e.config.blockAttributes, o = [];
  960. for (t in i) n = i[t].tagName, n && o.push(n);
  961. return o
  962. }()
  963. }, nodeIsBlockContainer: function (t) {
  964. return e.nodeIsBlockStartComment(null != t ? t.firstChild : void 0)
  965. }, nodeProbablyIsBlockContainer: function (t) {
  966. var n, i;
  967. return n = e.tagName(t), s.call(e.getBlockTagNames(), n) >= 0 && (i = e.tagName(t.firstChild), s.call(e.getBlockTagNames(), i) < 0)
  968. }, nodeIsBlockStart: function (t, n) {
  969. var i;
  970. return i = (null != n ? n : {strict: !0}).strict, i ? e.nodeIsBlockStartComment(t) : e.nodeIsBlockStartComment(t) || !e.nodeIsBlockStartComment(t.firstChild) && e.nodeProbablyIsBlockContainer(t)
  971. }, nodeIsBlockStartComment: function (t) {
  972. return e.nodeIsCommentNode(t) && "block" === (null != t ? t.data : void 0)
  973. }, nodeIsCommentNode: function (t) {
  974. return (null != t ? t.nodeType : void 0) === Node.COMMENT_NODE
  975. }, nodeIsCursorTarget: function (t, n) {
  976. var i;
  977. return i = (null != n ? n : {}).name, t ? e.nodeIsTextNode(t) ? t.data === e.ZERO_WIDTH_SPACE ? i ? t.parentNode.dataset.trixCursorTarget === i : !0 : void 0 : e.nodeIsCursorTarget(t.firstChild) : void 0
  978. }, nodeIsAttachmentElement: function (t) {
  979. return e.elementMatchesSelector(t, e.AttachmentView.attachmentSelector)
  980. }, nodeIsEmptyTextNode: function (t) {
  981. return e.nodeIsTextNode(t) && "" === (null != t ? t.data : void 0)
  982. }, nodeIsTextNode: function (t) {
  983. return (null != t ? t.nodeType : void 0) === Node.TEXT_NODE
  984. }
  985. })
  986. }.call(this), function () {
  987. var t, n, i, o, r;
  988. t = e.copyObject, o = e.objectsAreEqual, e.extend({
  989. normalizeRange: i = function (t) {
  990. var e;
  991. if (null != t) return Array.isArray(t) || (t = [t, t]), [n(t[0]), n(null != (e = t[1]) ? e : t[0])]
  992. }, rangeIsCollapsed: function (t) {
  993. var e, n, o;
  994. if (null != t) return n = i(t), o = n[0], e = n[1], r(o, e)
  995. }, rangesAreEqual: function (t, e) {
  996. var n, o, s, a, u, c;
  997. if (null != t && null != e) return s = i(t), o = s[0], n = s[1], a = i(e), c = a[0], u = a[1], r(o, c) && r(n, u)
  998. }
  999. }), n = function (e) {
  1000. return "number" == typeof e ? e : t(e)
  1001. }, r = function (t, e) {
  1002. return "number" == typeof t ? t === e : o(t, e)
  1003. }
  1004. }.call(this), function () {
  1005. var t, n, i, o, r;
  1006. e.registerElement = function (t, e) {
  1007. var s, a;
  1008. return null == e && (e = {}), t = t.toLowerCase(), e = r(e), a = o(e), (s = a.defaultCSS) && (delete a.defaultCSS, n(s, t)), i(t, a)
  1009. }, n = function (e, n) {
  1010. var i;
  1011. return i = t(n), i.textContent = e.replace(/%t/g, n)
  1012. }, t = function (t) {
  1013. var e;
  1014. return e = document.createElement("style"), e.setAttribute("type", "text/css"), e.setAttribute("data-tag-name", t.toLowerCase()), document.head.insertBefore(e, document.head.firstChild), e
  1015. }, o = function (t) {
  1016. var e, n, i;
  1017. n = {};
  1018. for (e in t) i = t[e], n[e] = "function" == typeof i ? {value: i} : i;
  1019. return n
  1020. }, r = function () {
  1021. var t;
  1022. return t = function (t) {
  1023. var e, n, i, o, r;
  1024. for (e = {}, r = ["initialize", "connect", "disconnect"], n = 0, o = r.length; o > n; n++) i = r[n], e[i] = t[i], delete t[i];
  1025. return e
  1026. }, window.customElements ? function (e) {
  1027. var n, i, o, r, s;
  1028. return s = t(e), o = s.initialize, n = s.connect, i = s.disconnect, o && (r = n, n = function () {
  1029. return this.initialized || (this.initialized = !0, o.call(this)), null != r ? r.call(this) : void 0
  1030. }), n && (e.connectedCallback = n), i && (e.disconnectedCallback = i), e
  1031. } : function (e) {
  1032. var n, i, o, r;
  1033. return r = t(e), o = r.initialize, n = r.connect, i = r.disconnect, o && (e.createdCallback = o), n && (e.attachedCallback = n), i && (e.detachedCallback = i), e
  1034. }
  1035. }(), i = function () {
  1036. return window.customElements ? function (t, e) {
  1037. var n;
  1038. return n = function () {
  1039. return Reflect.construct(HTMLElement, [], n)
  1040. }, n.prototype = Object.create(HTMLElement.prototype, e), window.customElements.define(t, n), n
  1041. } : function (t, e) {
  1042. var n, i;
  1043. return i = Object.create(HTMLElement.prototype, e), n = document.registerElement(t, {prototype: i}), Object.defineProperty(i, "constructor", {value: n}), n
  1044. }
  1045. }()
  1046. }.call(this), function () {
  1047. var t, n;
  1048. e.extend({
  1049. getDOMSelection: function () {
  1050. var t;
  1051. return t = window.getSelection(), t.rangeCount > 0 ? t : void 0
  1052. }, getDOMRange: function () {
  1053. var n, i;
  1054. return (n = null != (i = e.getDOMSelection()) ? i.getRangeAt(0) : void 0) && !t(n) ? n : void 0
  1055. }, setDOMRange: function (t) {
  1056. var n;
  1057. return n = window.getSelection(), n.removeAllRanges(), n.addRange(t), e.selectionChangeObserver.update()
  1058. }
  1059. }), t = function (t) {
  1060. return n(t.startContainer) || n(t.endContainer)
  1061. }, n = function (t) {
  1062. return !Object.getPrototypeOf(t)
  1063. }
  1064. }.call(this), function () {
  1065. var t;
  1066. t = {"application/x-trix-feature-detection": "Http.aa.test"}, e.extend({
  1067. dataTransferIsPlainText: function (t) {
  1068. var e, n, i;
  1069. return i = t.getData("text/plain"), n = t.getData("text/html"), i && n ? (e = document.createElement("div"), e.innerHTML = n, e.textContent === i ? !e.querySelector(":not(meta)") : void 0) : null != i ? i.length : void 0
  1070. }, dataTransferIsWritable: function (e) {
  1071. var n, i;
  1072. if (null != (null != e ? e.setData : void 0)) {
  1073. for (n in t) if (i = t[n], !function () {
  1074. try {
  1075. return e.setData(n, i), e.getData(n) === i
  1076. } catch (t) {
  1077. }
  1078. }()) return;
  1079. return !0
  1080. }
  1081. }, keyEventIsKeyboardCommand: function () {
  1082. return /Mac|^iP/.test(navigator.platform) ? function (t) {
  1083. return t.metaKey
  1084. } : function (t) {
  1085. return t.ctrlKey
  1086. }
  1087. }()
  1088. })
  1089. }.call(this), function () {
  1090. }.call(this), function () {
  1091. var t, n = function (t, e) {
  1092. function n() {
  1093. this.constructor = t
  1094. }
  1095. for (var o in e) i.call(e, o) && (t[o] = e[o]);
  1096. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  1097. }, i = {}.hasOwnProperty;
  1098. t = e.arraysAreEqual, e.Hash = function (i) {
  1099. function o(t) {
  1100. null == t && (t = {}), this.values = s(t), o.__super__.constructor.apply(this, arguments)
  1101. }
  1102. var r, s, a, u, c;
  1103. return n(o, i), o.fromCommonAttributesOfObjects = function (t) {
  1104. var e, n, i, o, s, a;
  1105. if (null == t && (t = []), !t.length) return new this;
  1106. for (e = r(t[0]), i = e.getKeys(), a = t.slice(1), n = 0, o = a.length; o > n; n++) s = a[n], i = e.getKeysCommonToHash(r(s)), e = e.slice(i);
  1107. return e
  1108. }, o.box = function (t) {
  1109. return r(t)
  1110. }, o.prototype.add = function (t, e) {
  1111. return this.merge(u(t, e))
  1112. }, o.prototype.remove = function (t) {
  1113. return new e.Hash(s(this.values, t))
  1114. }, o.prototype.get = function (t) {
  1115. return this.values[t]
  1116. }, o.prototype.has = function (t) {
  1117. return t in this.values
  1118. }, o.prototype.merge = function (t) {
  1119. return new e.Hash(a(this.values, c(t)))
  1120. }, o.prototype.slice = function (t) {
  1121. var n, i, o, r;
  1122. for (r = {}, n = 0, o = t.length; o > n; n++) i = t[n], this.has(i) && (r[i] = this.values[i]);
  1123. return new e.Hash(r)
  1124. }, o.prototype.getKeys = function () {
  1125. return Object.keys(this.values)
  1126. }, o.prototype.getKeysCommonToHash = function (t) {
  1127. var e, n, i, o, s;
  1128. for (t = r(t), o = this.getKeys(), s = [], e = 0, i = o.length; i > e; e++) n = o[e], this.values[n] === t.values[n] && s.push(n);
  1129. return s
  1130. }, o.prototype.isEqualTo = function (e) {
  1131. return t(this.toArray(), r(e).toArray())
  1132. }, o.prototype.isEmpty = function () {
  1133. return 0 === this.getKeys().length
  1134. }, o.prototype.toArray = function () {
  1135. var t, e, n;
  1136. return (null != this.array ? this.array : this.array = function () {
  1137. var i;
  1138. e = [], i = this.values;
  1139. for (t in i) n = i[t], e.push(t, n);
  1140. return e
  1141. }.call(this)).slice(0)
  1142. }, o.prototype.toObject = function () {
  1143. return s(this.values)
  1144. }, o.prototype.toJSON = function () {
  1145. return this.toObject()
  1146. }, o.prototype.contentsForInspection = function () {
  1147. return {values: JSON.stringify(this.values)}
  1148. }, u = function (t, e) {
  1149. var n;
  1150. return n = {}, n[t] = e, n
  1151. }, a = function (t, e) {
  1152. var n, i, o;
  1153. i = s(t);
  1154. for (n in e) o = e[n], i[n] = o;
  1155. return i
  1156. }, s = function (t, e) {
  1157. var n, i, o, r, s;
  1158. for (r = {}, s = Object.keys(t).sort(), n = 0, o = s.length; o > n; n++) i = s[n], i !== e && (r[i] = t[i]);
  1159. return r
  1160. }, r = function (t) {
  1161. return t instanceof e.Hash ? t : new e.Hash(t)
  1162. }, c = function (t) {
  1163. return t instanceof e.Hash ? t.values : t
  1164. }, o
  1165. }(e.Object)
  1166. }.call(this), function () {
  1167. e.ObjectGroup = function () {
  1168. function t(t, e) {
  1169. var n, i;
  1170. this.objects = null != t ? t : [], i = e.depth, n = e.asTree, n && (this.depth = i, this.objects = this.constructor.groupObjects(this.objects, {
  1171. asTree: n,
  1172. depth: this.depth + 1
  1173. }))
  1174. }
  1175. return t.groupObjects = function (t, e) {
  1176. var n, i, o, r, s, a, u, c, l;
  1177. for (null == t && (t = []), l = null != e ? e : {}, o = l.depth, n = l.asTree, n && null == o && (o = 0), c = [], s = 0, a = t.length; a > s; s++) {
  1178. if (u = t[s], r) {
  1179. if (("function" == typeof u.canBeGrouped ? u.canBeGrouped(o) : void 0) && ("function" == typeof (i = r[r.length - 1]).canBeGroupedWith ? i.canBeGroupedWith(u, o) : void 0)) {
  1180. r.push(u);
  1181. continue
  1182. }
  1183. c.push(new this(r, {depth: o, asTree: n})), r = null
  1184. }
  1185. ("function" == typeof u.canBeGrouped ? u.canBeGrouped(o) : void 0) ? r = [u] : c.push(u)
  1186. }
  1187. return r && c.push(new this(r, {depth: o, asTree: n})), c
  1188. }, t.prototype.getObjects = function () {
  1189. return this.objects
  1190. }, t.prototype.getDepth = function () {
  1191. return this.depth
  1192. }, t.prototype.getCacheKey = function () {
  1193. var t, e, n, i, o;
  1194. for (e = ["objectGroup"], o = this.getObjects(), t = 0, n = o.length; n > t; t++) i = o[t], e.push(i.getCacheKey());
  1195. return e.join("/")
  1196. }, t
  1197. }()
  1198. }.call(this), function () {
  1199. var t = function (t, e) {
  1200. function i() {
  1201. this.constructor = t
  1202. }
  1203. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  1204. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  1205. }, n = {}.hasOwnProperty;
  1206. e.ObjectMap = function (e) {
  1207. function n(t) {
  1208. var e, n, i, o, r;
  1209. for (null == t && (t = []), this.objects = {}, i = 0, o = t.length; o > i; i++) r = t[i], n = JSON.stringify(r), null == (e = this.objects)[n] && (e[n] = r)
  1210. }
  1211. return t(n, e), n.prototype.find = function (t) {
  1212. var e;
  1213. return e = JSON.stringify(t), this.objects[e]
  1214. }, n
  1215. }(e.BasicObject)
  1216. }.call(this), function () {
  1217. e.ElementStore = function () {
  1218. function t(t) {
  1219. this.reset(t)
  1220. }
  1221. var e;
  1222. return t.prototype.add = function (t) {
  1223. var n;
  1224. return n = e(t), this.elements[n] = t
  1225. }, t.prototype.remove = function (t) {
  1226. var n, i;
  1227. return n = e(t), (i = this.elements[n]) ? (delete this.elements[n], i) : void 0
  1228. }, t.prototype.reset = function (t) {
  1229. var e, n, i;
  1230. for (null == t && (t = []), this.elements = {}, n = 0, i = t.length; i > n; n++) e = t[n], this.add(e);
  1231. return t
  1232. }, e = function (t) {
  1233. return t.dataset.trixStoreKey
  1234. }, t
  1235. }()
  1236. }.call(this), function () {
  1237. }.call(this), function () {
  1238. var t = function (t, e) {
  1239. function i() {
  1240. this.constructor = t
  1241. }
  1242. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  1243. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  1244. }, n = {}.hasOwnProperty;
  1245. e.Operation = function (e) {
  1246. function n() {
  1247. return n.__super__.constructor.apply(this, arguments)
  1248. }
  1249. return t(n, e), n.prototype.isPerforming = function () {
  1250. return this.performing === !0
  1251. }, n.prototype.hasPerformed = function () {
  1252. return this.performed === !0
  1253. }, n.prototype.hasSucceeded = function () {
  1254. return this.performed && this.succeeded
  1255. }, n.prototype.hasFailed = function () {
  1256. return this.performed && !this.succeeded
  1257. }, n.prototype.getPromise = function () {
  1258. return null != this.promise ? this.promise : this.promise = new Promise(function (t) {
  1259. return function (e, n) {
  1260. return t.performing = !0, t.perform(function (i, o) {
  1261. return t.succeeded = i, t.performing = !1, t.performed = !0, t.succeeded ? e(o) : n(o)
  1262. })
  1263. }
  1264. }(this))
  1265. }, n.prototype.perform = function (t) {
  1266. return t(!1)
  1267. }, n.prototype.release = function () {
  1268. var t;
  1269. return null != (t = this.promise) && "function" == typeof t.cancel && t.cancel(), this.promise = null, this.performing = null, this.performed = null, this.succeeded = null
  1270. }, n.proxyMethod("getPromise().then"), n.proxyMethod("getPromise().catch"), n
  1271. }(e.BasicObject)
  1272. }.call(this), function () {
  1273. var t, n, i, o, r, s = function (t, e) {
  1274. function n() {
  1275. this.constructor = t
  1276. }
  1277. for (var i in e) a.call(e, i) && (t[i] = e[i]);
  1278. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  1279. }, a = {}.hasOwnProperty;
  1280. e.UTF16String = function (t) {
  1281. function e(t, e) {
  1282. this.ucs2String = t, this.codepoints = e, this.length = this.codepoints.length, this.ucs2Length = this.ucs2String.length
  1283. }
  1284. return s(e, t), e.box = function (t) {
  1285. return null == t && (t = ""), t instanceof this ? t : this.fromUCS2String(null != t ? t.toString() : void 0)
  1286. }, e.fromUCS2String = function (t) {
  1287. return new this(t, o(t))
  1288. }, e.fromCodepoints = function (t) {
  1289. return new this(r(t), t)
  1290. }, e.prototype.offsetToUCS2Offset = function (t) {
  1291. return r(this.codepoints.slice(0, Math.max(0, t))).length
  1292. }, e.prototype.offsetFromUCS2Offset = function (t) {
  1293. return o(this.ucs2String.slice(0, Math.max(0, t))).length
  1294. }, e.prototype.slice = function () {
  1295. var t;
  1296. return this.constructor.fromCodepoints((t = this.codepoints).slice.apply(t, arguments))
  1297. }, e.prototype.charAt = function (t) {
  1298. return this.slice(t, t + 1)
  1299. }, e.prototype.isEqualTo = function (t) {
  1300. return this.constructor.box(t).ucs2String === this.ucs2String
  1301. }, e.prototype.toJSON = function () {
  1302. return this.ucs2String
  1303. }, e.prototype.getCacheKey = function () {
  1304. return this.ucs2String
  1305. }, e.prototype.toString = function () {
  1306. return this.ucs2String
  1307. }, e
  1308. }(e.BasicObject), t = 1 === ("function" == typeof Array.from ? Array.from("\ud83d\udc7c").length : void 0), n = null != ("function" == typeof " ".codePointAt ? " ".codePointAt(0) : void 0), i = " \ud83d\udc7c" === ("function" == typeof String.fromCodePoint ? String.fromCodePoint(32, 128124) : void 0), o = t && n ? function (t) {
  1309. return Array.from(t).map(function (t) {
  1310. return t.codePointAt(0)
  1311. })
  1312. } : function (t) {
  1313. var e, n, i, o, r;
  1314. for (o = [], e = 0, i = t.length; i > e;) r = t.charCodeAt(e++), r >= 55296 && 56319 >= r && i > e && (n = t.charCodeAt(e++), 56320 === (64512 & n) ? r = ((1023 & r) << 10) + (1023 & n) + 65536 : e--), o.push(r);
  1315. return o
  1316. }, r = i ? function (t) {
  1317. return String.fromCodePoint.apply(String, t)
  1318. } : function (t) {
  1319. var e, n, i;
  1320. return e = function () {
  1321. var e, o, r;
  1322. for (r = [], e = 0, o = t.length; o > e; e++) i = t[e], n = "", i > 65535 && (i -= 65536, n += String.fromCharCode(i >>> 10 & 1023 | 55296), i = 56320 | 1023 & i), r.push(n + String.fromCharCode(i));
  1323. return r
  1324. }(), e.join("")
  1325. }
  1326. }.call(this), function () {
  1327. }.call(this), function () {
  1328. }.call(this), function () {
  1329. e.config.lang = {
  1330. attachFiles: "Attach Files",
  1331. bold: "Bold",
  1332. bullets: "Bullets",
  1333. "byte": "Byte",
  1334. bytes: "Bytes",
  1335. captionPlaceholder: "Add a caption\u2026",
  1336. code: "Code",
  1337. heading1: "Heading",
  1338. indent: "Increase Level",
  1339. italic: "Italic",
  1340. link: "Link",
  1341. numbers: "Numbers",
  1342. outdent: "Decrease Level",
  1343. quote: "Quote",
  1344. redo: "Redo",
  1345. remove: "Remove",
  1346. strike: "Strikethrough",
  1347. undo: "Undo",
  1348. unlink: "Unlink",
  1349. url: "URL",
  1350. urlPlaceholder: "Enter a URL\u2026",
  1351. GB: "GB",
  1352. KB: "KB",
  1353. MB: "MB",
  1354. PB: "PB",
  1355. TB: "TB"
  1356. }
  1357. }.call(this), function () {
  1358. e.config.css = {
  1359. attachment: "attachment",
  1360. attachmentCaption: "attachment__caption",
  1361. attachmentCaptionEditor: "attachment__caption-editor",
  1362. attachmentMetadata: "attachment__metadata",
  1363. attachmentMetadataContainer: "attachment__metadata-container",
  1364. attachmentName: "attachment__name",
  1365. attachmentProgress: "attachment__progress",
  1366. attachmentSize: "attachment__size",
  1367. attachmentToolbar: "attachment__toolbar",
  1368. attachmentGallery: "attachment-gallery"
  1369. }
  1370. }.call(this), function () {
  1371. var t;
  1372. e.config.blockAttributes = t = {
  1373. "default": {tagName: "div", parse: !1},
  1374. quote: {tagName: "blockquote", nestable: !0},
  1375. heading1: {tagName: "h1", terminal: !0, breakOnReturn: !0, group: !1},
  1376. code: {tagName: "pre", terminal: !0, text: {plaintext: !0}},
  1377. bulletList: {tagName: "ul", parse: !1},
  1378. bullet: {
  1379. tagName: "li", listAttribute: "bulletList", group: !1, nestable: !0, test: function (n) {
  1380. return e.tagName(n.parentNode) === t[this.listAttribute].tagName
  1381. }
  1382. },
  1383. numberList: {tagName: "ol", parse: !1},
  1384. number: {
  1385. tagName: "li", listAttribute: "numberList", group: !1, nestable: !0, test: function (n) {
  1386. return e.tagName(n.parentNode) === t[this.listAttribute].tagName
  1387. }
  1388. },
  1389. attachmentGallery: {tagName: "div", exclusive: !0, terminal: !0, parse: !1, group: !1}
  1390. }
  1391. }.call(this), function () {
  1392. var t, n;
  1393. t = e.config.lang, n = [t.bytes, t.KB, t.MB, t.GB, t.TB, t.PB], e.config.fileSize = {
  1394. prefix: "IEC",
  1395. precision: 2,
  1396. formatter: function (e) {
  1397. var i, o, r, s, a;
  1398. switch (e) {
  1399. case 0:
  1400. return "0 " + t.bytes;
  1401. case 1:
  1402. return "1 " + t.byte;
  1403. default:
  1404. return i = function () {
  1405. switch (this.prefix) {
  1406. case"SI":
  1407. return 1e3;
  1408. case"IEC":
  1409. return 1024
  1410. }
  1411. }.call(this), o = Math.floor(Math.log(e) / Math.log(i)), r = e / Math.pow(i, o), s = r.toFixed(this.precision), a = s.replace(/0*$/, "").replace(/\.$/, ""), a + " " + n[o]
  1412. }
  1413. }
  1414. }
  1415. }.call(this), function () {
  1416. e.config.textAttributes = {
  1417. bold: {
  1418. tagName: "strong", inheritable: !0, parser: function (t) {
  1419. var e;
  1420. return e = window.getComputedStyle(t), "bold" === e.fontWeight || e.fontWeight >= 600
  1421. }
  1422. }, italic: {
  1423. tagName: "em", inheritable: !0, parser: function (t) {
  1424. var e;
  1425. return e = window.getComputedStyle(t), "italic" === e.fontStyle
  1426. }
  1427. }, href: {
  1428. groupTagName: "a", parser: function (t) {
  1429. var n, i, o;
  1430. return n = e.AttachmentView.attachmentSelector, o = "a:not(" + n + ")", (i = e.findClosestElementFromNode(t, {matchingSelector: o})) ? i.getAttribute("href") : void 0
  1431. }
  1432. }, strike: {tagName: "del", inheritable: !0}, frozen: {style: {backgroundColor: "highlight"}}
  1433. }
  1434. }.call(this), function () {
  1435. var t, n, i, o, r;
  1436. r = "[data-trix-serialize=false]", o = ["contenteditable", "data-trix-id", "data-trix-store-key", "data-trix-mutable", "data-trix-placeholder", "tabindex"], n = "data-trix-serialized-attributes", i = "[" + n + "]", t = new RegExp("<!--block-->", "g"), e.extend({
  1437. serializers: {
  1438. "application/json": function (t) {
  1439. var n;
  1440. if (t instanceof e.Document) n = t; else {
  1441. if (!(t instanceof HTMLElement)) throw new Error("unserializable object");
  1442. n = e.Document.fromHTML(t.innerHTML)
  1443. }
  1444. return n.toSerializableDocument().toJSONString()
  1445. }, "text/html": function (s) {
  1446. var a, u, c, l, h, p, d, f, g, m, v, y, b, A, C, x, w;
  1447. if (s instanceof e.Document) l = e.DocumentView.render(s); else {
  1448. if (!(s instanceof HTMLElement)) throw new Error("unserializable object");
  1449. l = s.cloneNode(!0)
  1450. }
  1451. for (A = l.querySelectorAll(r), h = 0, g = A.length; g > h; h++) c = A[h], e.removeNode(c);
  1452. for (p = 0, m = o.length; m > p; p++) for (a = o[p], C = l.querySelectorAll("[" + a + "]"), d = 0, v = C.length; v > d; d++) c = C[d], c.removeAttribute(a);
  1453. for (x = l.querySelectorAll(i), f = 0, y = x.length; y > f; f++) {
  1454. c = x[f];
  1455. try {
  1456. u = JSON.parse(c.getAttribute(n)), c.removeAttribute(n);
  1457. for (b in u) w = u[b], c.setAttribute(b, w)
  1458. } catch (E) {
  1459. }
  1460. }
  1461. return l.innerHTML.replace(t, "")
  1462. }
  1463. }, deserializers: {
  1464. "application/json": function (t) {
  1465. return e.Document.fromJSONString(t)
  1466. }, "text/html": function (t) {
  1467. return e.Document.fromHTML(t)
  1468. }
  1469. }, serializeToContentType: function (t, n) {
  1470. var i;
  1471. if (i = e.serializers[n]) return i(t);
  1472. throw new Error("unknown content type: " + n)
  1473. }, deserializeFromContentType: function (t, n) {
  1474. var i;
  1475. if (i = e.deserializers[n]) return i(t);
  1476. throw new Error("unknown content type: " + n)
  1477. }
  1478. })
  1479. }.call(this), function () {
  1480. var t;
  1481. t = e.config.lang, e.config.toolbar = {
  1482. getDefaultHTML: function () {
  1483. return '<div class="trix-button-row">\n <span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="' + t.bold + '" tabindex="-1">' + t.bold + '</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="' + t.italic + '" tabindex="-1">' + t.italic + '</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="' + t.strike + '" tabindex="-1">' + t.strike + '</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="' + t.link + '" tabindex="-1">' + t.link + '</button>\n </span>\n\n <span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-heading-1" data-trix-attribute="heading1" title="' + t.heading1 + '" tabindex="-1">' + t.heading1 + '</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="' + t.quote + '" tabindex="-1">' + t.quote + '</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="' + t.code + '" tabindex="-1">' + t.code + '</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="' + t.bullets + '" tabindex="-1">' + t.bullets + '</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="' + t.numbers + '" tabindex="-1">' + t.numbers + '</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="' + t.outdent + '" tabindex="-1">' + t.outdent + '</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="' + t.indent + '" tabindex="-1">' + t.indent + '</button>\n </span>\n\n <span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="' + t.attachFiles + '" tabindex="-1">' + t.attachFiles + '</button>\n </span>\n\n <span class="trix-button-group-spacer"></span>\n\n <span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">\n <button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="' + t.undo + '" tabindex="-1">' + t.undo + '</button>\n <button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="' + t.redo + '" tabindex="-1">' + t.redo + '</button>\n </span>\n</div>\n\n<div class="trix-dialogs" data-trix-dialogs>\n <div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">\n <div class="trix-dialog__link-fields">\n <input type="url" name="href" class="trix-input trix-input--dialog" placeholder="' + t.urlPlaceholder + '" aria-label="' + t.url + '" required data-trix-input>\n <div class="trix-button-group">\n <input type="button" class="trix-button trix-button--dialog" value="' + t.link + '" data-trix-method="setAttribute">\n <input type="button" class="trix-button trix-button--dialog" value="' + t.unlink + '" data-trix-method="removeAttribute">\n </div>\n </div>\n </div>\n</div>'
  1484. }
  1485. }
  1486. }.call(this), function () {
  1487. e.config.undoInterval = 5e3
  1488. }.call(this), function () {
  1489. e.config.attachments = {
  1490. preview: {presentation: "gallery", caption: {name: !0, size: !0}},
  1491. file: {caption: {size: !0}}
  1492. }
  1493. }.call(this), function () {
  1494. e.config.keyNames = {
  1495. 8: "backspace",
  1496. 9: "tab",
  1497. 13: "return",
  1498. 27: "escape",
  1499. 37: "left",
  1500. 39: "right",
  1501. 46: "delete",
  1502. 68: "d",
  1503. 72: "h",
  1504. 79: "o"
  1505. }
  1506. }.call(this), function () {
  1507. e.config.input = {
  1508. level2Enabled: !0, getLevel: function () {
  1509. return this.level2Enabled && e.browser.supportsInputEvents ? 2 : 0
  1510. }, pickFiles: function (t) {
  1511. var n;
  1512. return n = e.makeElement("input", {
  1513. type: "file",
  1514. multiple: !0,
  1515. hidden: !0,
  1516. id: this.fileInputId
  1517. }), n.addEventListener("change", function () {
  1518. return t(n.files), e.removeNode(n)
  1519. }), e.removeNode(document.getElementById(this.fileInputId)), document.body.appendChild(n), n.click()
  1520. }, fileInputId: "trix-file-input-" + Date.now().toString(16)
  1521. }
  1522. }.call(this), function () {
  1523. }.call(this), function () {
  1524. e.registerElement("trix-toolbar", {
  1525. defaultCSS: "%t {\n display: block;\n}\n\n%t {\n white-space: nowrap;\n}\n\n%t [data-trix-dialog] {\n display: none;\n}\n\n%t [data-trix-dialog][data-trix-active] {\n display: block;\n}\n\n%t [data-trix-dialog] [data-trix-validate]:invalid {\n background-color: #ffdddd;\n}",
  1526. initialize: function () {
  1527. return "" === this.innerHTML ? this.innerHTML = e.config.toolbar.getDefaultHTML() : void 0
  1528. }
  1529. })
  1530. }.call(this), function () {
  1531. var t = function (t, e) {
  1532. function i() {
  1533. this.constructor = t
  1534. }
  1535. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  1536. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  1537. }, n = {}.hasOwnProperty, i = [].indexOf || function (t) {
  1538. for (var e = 0, n = this.length; n > e; e++) if (e in this && this[e] === t) return e;
  1539. return -1
  1540. };
  1541. e.ObjectView = function (n) {
  1542. function o(t, e) {
  1543. this.object = t, this.options = null != e ? e : {}, this.childViews = [], this.rootView = this
  1544. }
  1545. return t(o, n), o.prototype.getNodes = function () {
  1546. var t, e, n, i, o;
  1547. for (null == this.nodes && (this.nodes = this.createNodes()), i = this.nodes, o = [], t = 0, e = i.length; e > t; t++) n = i[t], o.push(n.cloneNode(!0));
  1548. return o
  1549. }, o.prototype.invalidate = function () {
  1550. var t;
  1551. return this.nodes = null, null != (t = this.parentView) ? t.invalidate() : void 0
  1552. }, o.prototype.invalidateViewForObject = function (t) {
  1553. var e;
  1554. return null != (e = this.findViewForObject(t)) ? e.invalidate() : void 0
  1555. }, o.prototype.findOrCreateCachedChildView = function (t, e) {
  1556. var n;
  1557. return (n = this.getCachedViewForObject(e)) ? this.recordChildView(n) : (n = this.createChildView.apply(this, arguments), this.cacheViewForObject(n, e)), n
  1558. }, o.prototype.createChildView = function (t, n, i) {
  1559. var o;
  1560. return null == i && (i = {}), n instanceof e.ObjectGroup && (i.viewClass = t, t = e.ObjectGroupView), o = new t(n, i), this.recordChildView(o)
  1561. }, o.prototype.recordChildView = function (t) {
  1562. return t.parentView = this, t.rootView = this.rootView, i.call(this.childViews, t) < 0 && this.childViews.push(t), t
  1563. }, o.prototype.getAllChildViews = function () {
  1564. var t, e, n, i, o;
  1565. for (o = [], i = this.childViews, e = 0, n = i.length; n > e; e++) t = i[e], o.push(t), o = o.concat(t.getAllChildViews());
  1566. return o
  1567. }, o.prototype.findElement = function () {
  1568. return this.findElementForObject(this.object)
  1569. }, o.prototype.findElementForObject = function (t) {
  1570. var e;
  1571. return (e = null != t ? t.id : void 0) ? this.rootView.element.querySelector("[data-trix-id='" + e + "']") : void 0
  1572. }, o.prototype.findViewForObject = function (t) {
  1573. var e, n, i, o;
  1574. for (i = this.getAllChildViews(), e = 0, n = i.length; n > e; e++) if (o = i[e], o.object === t) return o
  1575. }, o.prototype.getViewCache = function () {
  1576. return this.rootView !== this ? this.rootView.getViewCache() : this.isViewCachingEnabled() ? null != this.viewCache ? this.viewCache : this.viewCache = {} : void 0
  1577. }, o.prototype.isViewCachingEnabled = function () {
  1578. return this.shouldCacheViews !== !1
  1579. }, o.prototype.enableViewCaching = function () {
  1580. return this.shouldCacheViews = !0
  1581. }, o.prototype.disableViewCaching = function () {
  1582. return this.shouldCacheViews = !1
  1583. }, o.prototype.getCachedViewForObject = function (t) {
  1584. var e;
  1585. return null != (e = this.getViewCache()) ? e[t.getCacheKey()] : void 0
  1586. }, o.prototype.cacheViewForObject = function (t, e) {
  1587. var n;
  1588. return null != (n = this.getViewCache()) ? n[e.getCacheKey()] = t : void 0
  1589. }, o.prototype.garbageCollectCachedViews = function () {
  1590. var t, e, n, o, r, s;
  1591. if (t = this.getViewCache()) {
  1592. s = this.getAllChildViews().concat(this), n = function () {
  1593. var t, e, n;
  1594. for (n = [], t = 0, e = s.length; e > t; t++) r = s[t], n.push(r.object.getCacheKey());
  1595. return n
  1596. }(), o = [];
  1597. for (e in t) i.call(n, e) < 0 && o.push(delete t[e]);
  1598. return o
  1599. }
  1600. }, o
  1601. }(e.BasicObject)
  1602. }.call(this), function () {
  1603. var t = function (t, e) {
  1604. function i() {
  1605. this.constructor = t
  1606. }
  1607. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  1608. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  1609. }, n = {}.hasOwnProperty;
  1610. e.ObjectGroupView = function (e) {
  1611. function n() {
  1612. n.__super__.constructor.apply(this, arguments), this.objectGroup = this.object, this.viewClass = this.options.viewClass, delete this.options.viewClass
  1613. }
  1614. return t(n, e), n.prototype.getChildViews = function () {
  1615. var t, e, n, i;
  1616. if (!this.childViews.length) for (i = this.objectGroup.getObjects(), t = 0, e = i.length; e > t; t++) n = i[t], this.findOrCreateCachedChildView(this.viewClass, n, this.options);
  1617. return this.childViews
  1618. }, n.prototype.createNodes = function () {
  1619. var t, e, n, i, o, r, s, a, u;
  1620. for (t = this.createContainerElement(), s = this.getChildViews(), e = 0, i = s.length; i > e; e++) for (u = s[e], a = u.getNodes(), n = 0, o = a.length; o > n; n++) r = a[n], t.appendChild(r);
  1621. return [t]
  1622. }, n.prototype.createContainerElement = function (t) {
  1623. return null == t && (t = this.objectGroup.getDepth()), this.getChildViews()[0].createContainerElement(t)
  1624. }, n
  1625. }(e.ObjectView)
  1626. }.call(this), function () {
  1627. var t = function (t, e) {
  1628. function i() {
  1629. this.constructor = t
  1630. }
  1631. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  1632. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  1633. }, n = {}.hasOwnProperty;
  1634. e.Controller = function (e) {
  1635. function n() {
  1636. return n.__super__.constructor.apply(this, arguments)
  1637. }
  1638. return t(n, e), n
  1639. }(e.BasicObject)
  1640. }.call(this), function () {
  1641. var t, n, i, o, r, s, a = function (t, e) {
  1642. return function () {
  1643. return t.apply(e, arguments)
  1644. }
  1645. }, u = function (t, e) {
  1646. function n() {
  1647. this.constructor = t
  1648. }
  1649. for (var i in e) c.call(e, i) && (t[i] = e[i]);
  1650. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  1651. }, c = {}.hasOwnProperty, l = [].indexOf || function (t) {
  1652. for (var e = 0, n = this.length; n > e; e++) if (e in this && this[e] === t) return e;
  1653. return -1
  1654. };
  1655. t = e.findClosestElementFromNode, i = e.nodeIsEmptyTextNode, n = e.nodeIsBlockStartComment, o = e.normalizeSpaces, r = e.summarizeStringChange, s = e.tagName, e.MutationObserver = function (e) {
  1656. function c(t) {
  1657. this.element = t, this.didMutate = a(this.didMutate, this), this.observer = new window.MutationObserver(this.didMutate), this.start()
  1658. }
  1659. var h, p, d, f;
  1660. return u(c, e), p = "data-trix-mutable", d = "[" + p + "]", f = {
  1661. attributes: !0,
  1662. childList: !0,
  1663. characterData: !0,
  1664. characterDataOldValue: !0,
  1665. subtree: !0
  1666. }, c.prototype.start = function () {
  1667. return this.reset(), this.observer.observe(this.element, f)
  1668. }, c.prototype.stop = function () {
  1669. return this.observer.disconnect()
  1670. }, c.prototype.didMutate = function (t) {
  1671. var e, n;
  1672. return (e = this.mutations).push.apply(e, this.findSignificantMutations(t)), this.mutations.length ? (null != (n = this.delegate) && "function" == typeof n.elementDidMutate && n.elementDidMutate(this.getMutationSummary()), this.reset()) : void 0
  1673. }, c.prototype.reset = function () {
  1674. return this.mutations = []
  1675. }, c.prototype.findSignificantMutations = function (t) {
  1676. var e, n, i, o;
  1677. for (o = [], e = 0, n = t.length; n > e; e++) i = t[e], this.mutationIsSignificant(i) && o.push(i);
  1678. return o
  1679. }, c.prototype.mutationIsSignificant = function (t) {
  1680. var e, n, i, o;
  1681. if (this.nodeIsMutable(t.target)) return !1;
  1682. for (o = this.nodesModifiedByMutation(t), e = 0, n = o.length; n > e; e++) if (i = o[e], this.nodeIsSignificant(i)) return !0;
  1683. return !1
  1684. }, c.prototype.nodeIsSignificant = function (t) {
  1685. return t !== this.element && !this.nodeIsMutable(t) && !i(t)
  1686. }, c.prototype.nodeIsMutable = function (e) {
  1687. return t(e, {matchingSelector: d})
  1688. }, c.prototype.nodesModifiedByMutation = function (t) {
  1689. var e;
  1690. switch (e = [], t.type) {
  1691. case"attributes":
  1692. t.attributeName !== p && e.push(t.target);
  1693. break;
  1694. case"characterData":
  1695. e.push(t.target.parentNode), e.push(t.target);
  1696. break;
  1697. case"childList":
  1698. e.push.apply(e, t.addedNodes), e.push.apply(e, t.removedNodes)
  1699. }
  1700. return e
  1701. }, c.prototype.getMutationSummary = function () {
  1702. return this.getTextMutationSummary()
  1703. }, c.prototype.getTextMutationSummary = function () {
  1704. var t, e, n, i, o, r, s, a, u, c, h;
  1705. for (a = this.getTextChangesFromCharacterData(), n = a.additions, o = a.deletions, h = this.getTextChangesFromChildList(), u = h.additions, r = 0, s = u.length; s > r; r++) e = u[r], l.call(n, e) < 0 && n.push(e);
  1706. return o.push.apply(o, h.deletions), c = {}, (t = n.join("")) && (c.textAdded = t), (i = o.join("")) && (c.textDeleted = i), c
  1707. }, c.prototype.getMutationsByType = function (t) {
  1708. var e, n, i, o, r;
  1709. for (o = this.mutations, r = [], e = 0, n = o.length; n > e; e++) i = o[e], i.type === t && r.push(i);
  1710. return r
  1711. }, c.prototype.getTextChangesFromChildList = function () {
  1712. var t, e, i, r, s, a, u, c, l, p, d;
  1713. for (t = [], u = [], a = this.getMutationsByType("childList"), e = 0, r = a.length; r > e; e++) s = a[e], t.push.apply(t, s.addedNodes), u.push.apply(u, s.removedNodes);
  1714. return c = 0 === t.length && 1 === u.length && n(u[0]), c ? (p = [], d = ["\n"]) : (p = h(t), d = h(u)), {
  1715. additions: function () {
  1716. var t, e, n;
  1717. for (n = [], i = t = 0, e = p.length; e > t; i = ++t) l = p[i], l !== d[i] && n.push(o(l));
  1718. return n
  1719. }(), deletions: function () {
  1720. var t, e, n;
  1721. for (n = [], i = t = 0, e = d.length; e > t; i = ++t) l = d[i], l !== p[i] && n.push(o(l));
  1722. return n
  1723. }()
  1724. }
  1725. }, c.prototype.getTextChangesFromCharacterData = function () {
  1726. var t, e, n, i, s, a, u, c;
  1727. return e = this.getMutationsByType("characterData"), e.length && (c = e[0], n = e[e.length - 1], s = o(c.oldValue), i = o(n.target.data), a = r(s, i), t = a.added, u = a.removed), {
  1728. additions: t ? [t] : [],
  1729. deletions: u ? [u] : []
  1730. }
  1731. }, h = function (t) {
  1732. var e, n, i, o;
  1733. for (null == t && (t = []), o = [], e = 0, n = t.length; n > e; e++) switch (i = t[e], i.nodeType) {
  1734. case Node.TEXT_NODE:
  1735. o.push(i.data);
  1736. break;
  1737. case Node.ELEMENT_NODE:
  1738. "br" === s(i) ? o.push("\n") : o.push.apply(o, h(i.childNodes))
  1739. }
  1740. return o
  1741. }, c
  1742. }(e.BasicObject)
  1743. }.call(this), function () {
  1744. var t = function (t, e) {
  1745. function i() {
  1746. this.constructor = t
  1747. }
  1748. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  1749. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  1750. }, n = {}.hasOwnProperty;
  1751. e.FileVerificationOperation = function (e) {
  1752. function n(t) {
  1753. this.file = t
  1754. }
  1755. return t(n, e), n.prototype.perform = function (t) {
  1756. var e;
  1757. return e = new FileReader, e.onerror = function () {
  1758. return t(!1)
  1759. }, e.onload = function (n) {
  1760. return function () {
  1761. e.onerror = null;
  1762. try {
  1763. e.abort()
  1764. } catch (i) {
  1765. }
  1766. return t(!0, n.file)
  1767. }
  1768. }(this), e.readAsArrayBuffer(this.file)
  1769. }, n
  1770. }(e.Operation)
  1771. }.call(this), function () {
  1772. var t, n, i = function (t, e) {
  1773. function n() {
  1774. this.constructor = t
  1775. }
  1776. for (var i in e) o.call(e, i) && (t[i] = e[i]);
  1777. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  1778. }, o = {}.hasOwnProperty;
  1779. t = e.handleEvent, n = e.innerElementIsActive, e.InputController = function (o) {
  1780. function r(n) {
  1781. var i;
  1782. this.element = n, this.mutationObserver = new e.MutationObserver(this.element), this.mutationObserver.delegate = this;
  1783. for (i in this.events) t(i, {onElement: this.element, withCallback: this.handlerFor(i)})
  1784. }
  1785. return i(r, o), r.prototype.events = {}, r.prototype.elementDidMutate = function () {
  1786. }, r.prototype.editorWillSyncDocumentView = function () {
  1787. return this.mutationObserver.stop()
  1788. }, r.prototype.editorDidSyncDocumentView = function () {
  1789. return this.mutationObserver.start()
  1790. }, r.prototype.requestRender = function () {
  1791. var t;
  1792. return null != (t = this.delegate) && "function" == typeof t.inputControllerDidRequestRender ? t.inputControllerDidRequestRender() : void 0
  1793. }, r.prototype.requestReparse = function () {
  1794. var t;
  1795. return null != (t = this.delegate) && "function" == typeof t.inputControllerDidRequestReparse && t.inputControllerDidRequestReparse(), this.requestRender()
  1796. }, r.prototype.attachFiles = function (t) {
  1797. var n, i;
  1798. return i = function () {
  1799. var i, o, r;
  1800. for (r = [], i = 0, o = t.length; o > i; i++) n = t[i], r.push(new e.FileVerificationOperation(n));
  1801. return r
  1802. }(), Promise.all(i).then(function (t) {
  1803. return function (e) {
  1804. return t.handleInput(function () {
  1805. var t, n;
  1806. return null != (t = this.delegate) && t.inputControllerWillAttachFiles(), null != (n = this.responder) && n.insertFiles(e), this.requestRender()
  1807. })
  1808. }
  1809. }(this))
  1810. }, r.prototype.handlerFor = function (t) {
  1811. return function (e) {
  1812. return function (i) {
  1813. return i.defaultPrevented ? void 0 : e.handleInput(function () {
  1814. return n(this.element) ? void 0 : (this.eventName = t, this.events[t].call(this, i))
  1815. })
  1816. }
  1817. }(this)
  1818. }, r.prototype.handleInput = function (t) {
  1819. var e, n;
  1820. try {
  1821. return null != (e = this.delegate) && e.inputControllerWillHandleInput(), t.call(this)
  1822. } finally {
  1823. null != (n = this.delegate) && n.inputControllerDidHandleInput()
  1824. }
  1825. }, r
  1826. }(e.BasicObject)
  1827. }.call(this), function () {
  1828. var t, n, i, o, r, s, a, u, c, l, h, p, d, f = function (t, e) {
  1829. function n() {
  1830. this.constructor = t
  1831. }
  1832. for (var i in e) g.call(e, i) && (t[i] = e[i]);
  1833. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  1834. }, g = {}.hasOwnProperty, m = [].indexOf || function (t) {
  1835. for (var e = 0, n = this.length; n > e; e++) if (e in this && this[e] === t) return e;
  1836. return -1
  1837. };
  1838. c = e.makeElement, l = e.objectsAreEqual, d = e.tagName, n = e.browser, a = e.keyEventIsKeyboardCommand, o = e.dataTransferIsWritable, i = e.dataTransferIsPlainText, u = e.config.keyNames, e.Level0InputController = function (n) {
  1839. function s() {
  1840. s.__super__.constructor.apply(this, arguments), this.resetInputSummary()
  1841. }
  1842. var d;
  1843. return f(s, n), d = 0, s.prototype.setInputSummary = function (t) {
  1844. var e, n;
  1845. null == t && (t = {}), this.inputSummary.eventName = this.eventName;
  1846. for (e in t) n = t[e], this.inputSummary[e] = n;
  1847. return this.inputSummary
  1848. }, s.prototype.resetInputSummary = function () {
  1849. return this.inputSummary = {}
  1850. }, s.prototype.reset = function () {
  1851. return this.resetInputSummary(), e.selectionChangeObserver.reset()
  1852. }, s.prototype.elementDidMutate = function (t) {
  1853. var e;
  1854. return this.isComposing() ? null != (e = this.delegate) && "function" == typeof e.inputControllerDidAllowUnhandledInput ? e.inputControllerDidAllowUnhandledInput() : void 0 : this.handleInput(function () {
  1855. return this.mutationIsSignificant(t) && (this.mutationIsExpected(t) ? this.requestRender() : this.requestReparse()), this.reset()
  1856. })
  1857. }, s.prototype.mutationIsExpected = function (t) {
  1858. var e, n, i, o, r, s, a, u, c, l;
  1859. return a = t.textAdded, u = t.textDeleted, this.inputSummary.preferDocument ? !0 : (e = null != a ? a === this.inputSummary.textAdded : !this.inputSummary.textAdded, n = null != u ? this.inputSummary.didDelete : !this.inputSummary.didDelete, c = ("\n" === a || " \n" === a) && !e, l = "\n" === u && !n, s = c && !l || l && !c, s && (o = this.getSelectedRange()) && (i = c ? a.replace(/\n$/, "").length || -1 : (null != a ? a.length : void 0) || 1, null != (r = this.responder) ? r.positionIsBlockBreak(o[1] + i) : void 0) ? !0 : e && n)
  1860. }, s.prototype.mutationIsSignificant = function (t) {
  1861. var e, n, i;
  1862. return i = Object.keys(t).length > 0, e = "" === (null != (n = this.compositionInput) ? n.getEndData() : void 0), i || !e
  1863. }, s.prototype.events = {
  1864. keydown: function (t) {
  1865. var n, i, o, r, s, c, l, h, p;
  1866. if (this.isComposing() || this.resetInputSummary(), this.inputSummary.didInput = !0, r = u[t.keyCode]) {
  1867. for (i = this.keys, h = ["ctrl", "alt", "shift", "meta"], o = 0, c = h.length; c > o; o++) l = h[o], t[l + "Key"] && ("ctrl" === l && (l = "control"), i = null != i ? i[l] : void 0);
  1868. null != (null != i ? i[r] : void 0) && (this.setInputSummary({keyName: r}), e.selectionChangeObserver.reset(), i[r].call(this, t))
  1869. }
  1870. return a(t) && (n = String.fromCharCode(t.keyCode).toLowerCase()) && (s = function () {
  1871. var e, n, i, o;
  1872. for (i = ["alt", "shift"], o = [], e = 0, n = i.length; n > e; e++) l = i[e], t[l + "Key"] && o.push(l);
  1873. return o
  1874. }(), s.push(n), null != (p = this.delegate) ? p.inputControllerDidReceiveKeyboardCommand(s) : void 0) ? t.preventDefault() : void 0
  1875. }, keypress: function (t) {
  1876. var e, n, i;
  1877. if (null == this.inputSummary.eventName && !t.metaKey && (!t.ctrlKey || t.altKey)) return (i = p(t)) ? (null != (e = this.delegate) && e.inputControllerWillPerformTyping(), null != (n = this.responder) && n.insertString(i), this.setInputSummary({
  1878. textAdded: i,
  1879. didDelete: this.selectionIsExpanded()
  1880. })) : void 0
  1881. }, textInput: function (t) {
  1882. var e, n, i, o;
  1883. return e = t.data, o = this.inputSummary.textAdded, o && o !== e && o.toUpperCase() === e ? (n = this.getSelectedRange(), this.setSelectedRange([n[0], n[1] + o.length]), null != (i = this.responder) && i.insertString(e), this.setInputSummary({textAdded: e}), this.setSelectedRange(n)) : void 0
  1884. }, dragenter: function (t) {
  1885. return t.preventDefault()
  1886. }, dragstart: function (t) {
  1887. var e, n;
  1888. return n = t.target, this.serializeSelectionToDataTransfer(t.dataTransfer), this.draggedRange = this.getSelectedRange(), null != (e = this.delegate) && "function" == typeof e.inputControllerDidStartDrag ? e.inputControllerDidStartDrag() : void 0
  1889. }, dragover: function (t) {
  1890. var e, n;
  1891. return !this.draggedRange && !this.canAcceptDataTransfer(t.dataTransfer) || (t.preventDefault(), e = {
  1892. x: t.clientX,
  1893. y: t.clientY
  1894. }, l(e, this.draggingPoint)) ? void 0 : (this.draggingPoint = e, null != (n = this.delegate) && "function" == typeof n.inputControllerDidReceiveDragOverPoint ? n.inputControllerDidReceiveDragOverPoint(this.draggingPoint) : void 0)
  1895. }, dragend: function () {
  1896. var t;
  1897. return null != (t = this.delegate) && "function" == typeof t.inputControllerDidCancelDrag && t.inputControllerDidCancelDrag(), this.draggedRange = null, this.draggingPoint = null
  1898. }, drop: function (t) {
  1899. var n, i, o, r, s, a, u, c, l;
  1900. return t.preventDefault(), o = null != (s = t.dataTransfer) ? s.files : void 0, r = {
  1901. x: t.clientX,
  1902. y: t.clientY
  1903. }, null != (a = this.responder) && a.setLocationRangeFromPointRange(r), (null != o ? o.length : void 0) ? this.attachFiles(o) : this.draggedRange ? (null != (u = this.delegate) && u.inputControllerWillMoveText(), null != (c = this.responder) && c.moveTextFromRange(this.draggedRange), this.draggedRange = null, this.requestRender()) : (i = t.dataTransfer.getData("application/x-trix-document")) && (n = e.Document.fromJSONString(i), null != (l = this.responder) && l.insertDocument(n), this.requestRender()), this.draggedRange = null, this.draggingPoint = null
  1904. }, cut: function (t) {
  1905. var e, n;
  1906. return (null != (e = this.responder) ? e.selectionIsExpanded() : void 0) && (this.serializeSelectionToDataTransfer(t.clipboardData) && t.preventDefault(), null != (n = this.delegate) && n.inputControllerWillCutText(), this.deleteInDirection("backward"), t.defaultPrevented) ? this.requestRender() : void 0
  1907. }, copy: function (t) {
  1908. var e;
  1909. return (null != (e = this.responder) ? e.selectionIsExpanded() : void 0) && this.serializeSelectionToDataTransfer(t.clipboardData) ? t.preventDefault() : void 0
  1910. }, paste: function (t) {
  1911. var n, o, s, a, u, c, l, p, f, g, v, y, b, A, C, x, w, E, S, R, k, D;
  1912. return n = null != (p = t.clipboardData) ? p : t.testClipboardData, l = {clipboard: n}, null == n || h(t) ? void this.getPastedHTMLUsingHiddenElement(function (t) {
  1913. return function (e) {
  1914. var n, i, o;
  1915. return l.type = "text/html", l.html = e, null != (n = t.delegate) && n.inputControllerWillPaste(l), null != (i = t.responder) && i.insertHTML(l.html), t.requestRender(), null != (o = t.delegate) ? o.inputControllerDidPaste(l) : void 0
  1916. }
  1917. }(this)) : ((a = n.getData("URL")) ? (l.type = "URL", l.href = a, l.string = (c = n.getData("public.url-name")) ? e.squishBreakableWhitespace(c).trim() : a, null != (f = this.delegate) && f.inputControllerWillPaste(l), this.setInputSummary({
  1918. textAdded: l.string,
  1919. didDelete: this.selectionIsExpanded()
  1920. }), null != (C = this.responder) && C.insertText(e.Text.textForStringWithAttributes(l.string, {href: l.href})), this.requestRender(), null != (x = this.delegate) && x.inputControllerDidPaste(l)) : i(n) ? (l.type = "text/plain", l.string = n.getData("text/plain"), null != (w = this.delegate) && w.inputControllerWillPaste(l), this.setInputSummary({
  1921. textAdded: l.string,
  1922. didDelete: this.selectionIsExpanded()
  1923. }), null != (E = this.responder) && E.insertString(l.string), this.requestRender(), null != (S = this.delegate) && S.inputControllerDidPaste(l)) : (u = n.getData("text/html")) ? (l.type = "text/html", l.html = u, null != (R = this.delegate) && R.inputControllerWillPaste(l), null != (k = this.responder) && k.insertHTML(l.html), this.requestRender(), null != (D = this.delegate) && D.inputControllerDidPaste(l)) : m.call(n.types, "Files") >= 0 && (s = null != (g = n.items) && null != (v = g[0]) && "function" == typeof v.getAsFile ? v.getAsFile() : void 0) && (!s.name && (o = r(s)) && (s.name = "pasted-file-" + ++d + "." + o), l.type = "File", l.file = s, null != (y = this.delegate) && y.inputControllerWillAttachFiles(), null != (b = this.responder) && b.insertFile(l.file), this.requestRender(), null != (A = this.delegate) && A.inputControllerDidPaste(l)), t.preventDefault())
  1924. }, compositionstart: function (t) {
  1925. return this.getCompositionInput().start(t.data)
  1926. }, compositionupdate: function (t) {
  1927. return this.getCompositionInput().update(t.data)
  1928. }, compositionend: function (t) {
  1929. return this.getCompositionInput().end(t.data)
  1930. }, beforeinput: function () {
  1931. return this.inputSummary.didInput = !0
  1932. }, input: function (t) {
  1933. return this.inputSummary.didInput = !0, t.stopPropagation()
  1934. }
  1935. }, s.prototype.keys = {
  1936. backspace: function (t) {
  1937. var e;
  1938. return null != (e = this.delegate) && e.inputControllerWillPerformTyping(), this.deleteInDirection("backward", t)
  1939. }, "delete": function (t) {
  1940. var e;
  1941. return null != (e = this.delegate) && e.inputControllerWillPerformTyping(), this.deleteInDirection("forward", t)
  1942. }, "return": function () {
  1943. var t, e;
  1944. return this.setInputSummary({preferDocument: !0}), null != (t = this.delegate) && t.inputControllerWillPerformTyping(), null != (e = this.responder) ? e.insertLineBreak() : void 0
  1945. }, tab: function (t) {
  1946. var e, n;
  1947. return (null != (e = this.responder) ? e.canIncreaseNestingLevel() : void 0) ? (null != (n = this.responder) && n.increaseNestingLevel(), this.requestRender(), t.preventDefault()) : void 0
  1948. }, left: function (t) {
  1949. var e;
  1950. return this.selectionIsInCursorTarget() ? (t.preventDefault(), null != (e = this.responder) ? e.moveCursorInDirection("backward") : void 0) : void 0
  1951. }, right: function (t) {
  1952. var e;
  1953. return this.selectionIsInCursorTarget() ? (t.preventDefault(), null != (e = this.responder) ? e.moveCursorInDirection("forward") : void 0) : void 0
  1954. }, control: {
  1955. d: function (t) {
  1956. var e;
  1957. return null != (e = this.delegate) && e.inputControllerWillPerformTyping(), this.deleteInDirection("forward", t)
  1958. }, h: function (t) {
  1959. var e;
  1960. return null != (e = this.delegate) && e.inputControllerWillPerformTyping(), this.deleteInDirection("backward", t)
  1961. }, o: function (t) {
  1962. var e, n;
  1963. return t.preventDefault(), null != (e = this.delegate) && e.inputControllerWillPerformTyping(), null != (n = this.responder) && n.insertString("\n", {updatePosition: !1}), this.requestRender()
  1964. }
  1965. }, shift: {
  1966. "return": function (t) {
  1967. var e, n;
  1968. return null != (e = this.delegate) && e.inputControllerWillPerformTyping(), null != (n = this.responder) && n.insertString("\n"), this.requestRender(), t.preventDefault()
  1969. }, tab: function (t) {
  1970. var e, n;
  1971. return (null != (e = this.responder) ? e.canDecreaseNestingLevel() : void 0) ? (null != (n = this.responder) && n.decreaseNestingLevel(), this.requestRender(), t.preventDefault()) : void 0
  1972. }, left: function (t) {
  1973. return this.selectionIsInCursorTarget() ? (t.preventDefault(), this.expandSelectionInDirection("backward")) : void 0
  1974. }, right: function (t) {
  1975. return this.selectionIsInCursorTarget() ? (t.preventDefault(), this.expandSelectionInDirection("forward")) : void 0
  1976. }
  1977. }, alt: {
  1978. backspace: function () {
  1979. var t;
  1980. return this.setInputSummary({preferDocument: !1}), null != (t = this.delegate) ? t.inputControllerWillPerformTyping() : void 0
  1981. }
  1982. }, meta: {
  1983. backspace: function () {
  1984. var t;
  1985. return this.setInputSummary({preferDocument: !1}), null != (t = this.delegate) ? t.inputControllerWillPerformTyping() : void 0
  1986. }
  1987. }
  1988. }, s.prototype.getCompositionInput = function () {
  1989. return this.isComposing() ? this.compositionInput : this.compositionInput = new t(this)
  1990. }, s.prototype.isComposing = function () {
  1991. return null != this.compositionInput && !this.compositionInput.isEnded()
  1992. }, s.prototype.deleteInDirection = function (t, e) {
  1993. var n;
  1994. return (null != (n = this.responder) ? n.deleteInDirection(t) : void 0) !== !1 ? this.setInputSummary({didDelete: !0}) : e ? (e.preventDefault(), this.requestRender()) : void 0
  1995. }, s.prototype.serializeSelectionToDataTransfer = function (t) {
  1996. var n, i;
  1997. if (o(t)) return n = null != (i = this.responder) ? i.getSelectedDocument().toSerializableDocument() : void 0, t.setData("application/x-trix-document", JSON.stringify(n)), t.setData("text/html", e.DocumentView.render(n).innerHTML), t.setData("text/plain", n.toString().replace(/\n$/, "")), !0
  1998. }, s.prototype.canAcceptDataTransfer = function (t) {
  1999. var e, n, i, o, r, s;
  2000. for (s = {}, o = null != (i = null != t ? t.types : void 0) ? i : [], e = 0, n = o.length; n > e; e++) r = o[e], s[r] = !0;
  2001. return s.Files || s["application/x-trix-document"] || s["text/html"] || s["text/plain"]
  2002. }, s.prototype.getPastedHTMLUsingHiddenElement = function (t) {
  2003. var n, i, o;
  2004. return i = this.getSelectedRange(), o = {
  2005. position: "absolute",
  2006. left: window.pageXOffset + "px",
  2007. top: window.pageYOffset + "px",
  2008. opacity: 0
  2009. }, n = c({
  2010. style: o,
  2011. tagName: "div",
  2012. editable: !0
  2013. }), document.body.appendChild(n), n.focus(), requestAnimationFrame(function (o) {
  2014. return function () {
  2015. var r;
  2016. return r = n.innerHTML, e.removeNode(n), o.setSelectedRange(i), t(r)
  2017. }
  2018. }(this))
  2019. }, s.proxyMethod("responder?.getSelectedRange"), s.proxyMethod("responder?.setSelectedRange"), s.proxyMethod("responder?.expandSelectionInDirection"), s.proxyMethod("responder?.selectionIsInCursorTarget"), s.proxyMethod("responder?.selectionIsExpanded"), s
  2020. }(e.InputController), r = function (t) {
  2021. var e, n;
  2022. return null != (e = t.type) && null != (n = e.match(/\/(\w+)$/)) ? n[1] : void 0
  2023. }, s = null != ("function" == typeof " ".codePointAt ? " ".codePointAt(0) : void 0), p = function (t) {
  2024. var n;
  2025. return t.key && s && t.key.codePointAt(0) === t.keyCode ? t.key : (null === t.which ? n = t.keyCode : 0 !== t.which && 0 !== t.charCode && (n = t.charCode), null != n && "escape" !== u[n] ? e.UTF16String.fromCodepoints([n]).toString() : void 0)
  2026. }, h = function (t) {
  2027. var e, n, i, o, r, s, a, u, c, l;
  2028. if (u = t.clipboardData) {
  2029. if (m.call(u.types, "text/html") >= 0) {
  2030. for (c = u.types, i = 0, s = c.length; s > i; i++) if (l = c[i], e = /^CorePasteboardFlavorType/.test(l), n = /^dyn\./.test(l) && u.getData(l), a = e || n) return !0;
  2031. return !1
  2032. }
  2033. return o = m.call(u.types, "com.apple.webarchive") >= 0, r = m.call(u.types, "com.apple.flat-rtfd") >= 0, o || r
  2034. }
  2035. }, t = function (t) {
  2036. function e(t) {
  2037. var e;
  2038. this.inputController = t, e = this.inputController, this.responder = e.responder, this.delegate = e.delegate, this.inputSummary = e.inputSummary, this.data = {}
  2039. }
  2040. return f(e, t), e.prototype.start = function (t) {
  2041. var e, n;
  2042. return this.data.start = t, this.isSignificant() ? ("keypress" === this.inputSummary.eventName && this.inputSummary.textAdded && null != (e = this.responder) && e.deleteInDirection("left"), this.selectionIsExpanded() || (this.insertPlaceholder(), this.requestRender()), this.range = null != (n = this.responder) ? n.getSelectedRange() : void 0) : void 0
  2043. }, e.prototype.update = function (t) {
  2044. var e;
  2045. return this.data.update = t, this.isSignificant() && (e = this.selectPlaceholder()) ? (this.forgetPlaceholder(), this.range = e) : void 0
  2046. }, e.prototype.end = function (t) {
  2047. var e, n, i, o;
  2048. return this.data.end = t, this.isSignificant() ? (this.forgetPlaceholder(), this.canApplyToDocument() ? (this.setInputSummary({
  2049. preferDocument: !0,
  2050. didInput: !1
  2051. }), null != (e = this.delegate) && e.inputControllerWillPerformTyping(), null != (n = this.responder) && n.setSelectedRange(this.range), null != (i = this.responder) && i.insertString(this.data.end), null != (o = this.responder) ? o.setSelectedRange(this.range[0] + this.data.end.length) : void 0) : null != this.data.start || null != this.data.update ? (this.requestReparse(), this.inputController.reset()) : void 0) : this.inputController.reset()
  2052. }, e.prototype.getEndData = function () {
  2053. return this.data.end
  2054. }, e.prototype.isEnded = function () {
  2055. return null != this.getEndData()
  2056. }, e.prototype.isSignificant = function () {
  2057. return n.composesExistingText ? this.inputSummary.didInput : !0
  2058. }, e.prototype.canApplyToDocument = function () {
  2059. var t, e;
  2060. return 0 === (null != (t = this.data.start) ? t.length : void 0) && (null != (e = this.data.end) ? e.length : void 0) > 0 && null != this.range
  2061. }, e.proxyMethod("inputController.setInputSummary"), e.proxyMethod("inputController.requestRender"), e.proxyMethod("inputController.requestReparse"), e.proxyMethod("responder?.selectionIsExpanded"), e.proxyMethod("responder?.insertPlaceholder"), e.proxyMethod("responder?.selectPlaceholder"), e.proxyMethod("responder?.forgetPlaceholder"), e
  2062. }(e.BasicObject)
  2063. }.call(this), function () {
  2064. var t, n, i, o = function (t, e) {
  2065. return function () {
  2066. return t.apply(e, arguments)
  2067. }
  2068. }, r = function (t, e) {
  2069. function n() {
  2070. this.constructor = t
  2071. }
  2072. for (var i in e) s.call(e, i) && (t[i] = e[i]);
  2073. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  2074. }, s = {}.hasOwnProperty, a = [].indexOf || function (t) {
  2075. for (var e = 0, n = this.length; n > e; e++) if (e in this && this[e] === t) return e;
  2076. return -1
  2077. };
  2078. t = e.dataTransferIsPlainText, n = e.keyEventIsKeyboardCommand, i = e.objectsAreEqual, e.Level2InputController = function (s) {
  2079. function u() {
  2080. return this.render = o(this.render, this), u.__super__.constructor.apply(this, arguments)
  2081. }
  2082. var c, l, h, p, d, f;
  2083. return r(u, s), u.prototype.elementDidMutate = function () {
  2084. var t;
  2085. return this.scheduledRender ? this.composing && null != (t = this.delegate) && "function" == typeof t.inputControllerDidAllowUnhandledInput ? t.inputControllerDidAllowUnhandledInput() : void 0 : this.reparse()
  2086. }, u.prototype.scheduleRender = function () {
  2087. return null != this.scheduledRender ? this.scheduledRender : this.scheduledRender = requestAnimationFrame(this.render)
  2088. }, u.prototype.render = function () {
  2089. var t;
  2090. return cancelAnimationFrame(this.scheduledRender), this.scheduledRender = null, this.composing || null != (t = this.delegate) && t.render(), "function" == typeof this.afterRender && this.afterRender(), this.afterRender = null
  2091. }, u.prototype.reparse = function () {
  2092. var t;
  2093. return null != (t = this.delegate) ? t.reparse() : void 0
  2094. }, u.prototype.events = {
  2095. keydown: function (t) {
  2096. var e, i, o, r;
  2097. if (n(t)) {
  2098. if (e = l(t), null != (r = this.delegate) ? r.inputControllerDidReceiveKeyboardCommand(e) : void 0) return t.preventDefault()
  2099. } else if (o = t.key, t.altKey && (o += "+Alt"), t.shiftKey && (o += "+Shift"), i = this.keys[o]) return this.withEvent(t, i)
  2100. }, paste: function (t) {
  2101. var n, i, o, r, s, a, u, c, l;
  2102. return h(t) ? (t.preventDefault(), this.attachFiles(t.clipboardData.files)) : p(t) ? (t.preventDefault(), i = {
  2103. type: "text/plain",
  2104. string: t.clipboardData.getData("text/plain")
  2105. }, null != (o = this.delegate) && o.inputControllerWillPaste(i), null != (r = this.responder) && r.insertString(i.string), this.render(), null != (s = this.delegate) ? s.inputControllerDidPaste(i) : void 0) : (n = null != (a = t.clipboardData) ? a.getData("URL") : void 0) ? (t.preventDefault(), i = {
  2106. type: "URL",
  2107. href: n,
  2108. string: n
  2109. }, null != (u = this.delegate) && u.inputControllerWillPaste(i), null != (c = this.responder) && c.insertText(e.Text.textForStringWithAttributes(i.string, {href: i.href})), this.render(), null != (l = this.delegate) ? l.inputControllerDidPaste(i) : void 0) : void 0
  2110. }, beforeinput: function (t) {
  2111. var e;
  2112. return (e = this.inputTypes[t.inputType]) ? (this.withEvent(t, e), this.scheduleRender()) : void 0
  2113. }, input: function () {
  2114. return e.selectionChangeObserver.reset()
  2115. }, dragstart: function (t) {
  2116. var e, n;
  2117. return (null != (e = this.responder) ? e.selectionContainsAttachments() : void 0) ? (t.dataTransfer.setData("application/x-trix-dragging", !0), this.dragging = {
  2118. range: null != (n = this.responder) ? n.getSelectedRange() : void 0,
  2119. point: d(t)
  2120. }) : void 0
  2121. }, dragenter: function (t) {
  2122. return c(t) ? t.preventDefault() : void 0
  2123. }, dragover: function (t) {
  2124. var e, n;
  2125. return this.dragging && (t.preventDefault(), e = d(t), !i(e, this.dragging.point)) ? (this.dragging.point = e, null != (n = this.responder) ? n.setLocationRangeFromPointRange(e) : void 0) : void 0
  2126. }, drop: function (t) {
  2127. var e, n, i, o;
  2128. return this.dragging ? (t.preventDefault(), null != (n = this.delegate) && n.inputControllerWillMoveText(), null != (i = this.responder) && i.moveTextFromRange(this.dragging.range), this.dragging = null, this.scheduleRender()) : c(t) ? (t.preventDefault(), e = d(t), null != (o = this.responder) && o.setLocationRangeFromPointRange(e), this.attachFiles(t.dataTransfer.files)) : void 0
  2129. }, dragend: function () {
  2130. var t;
  2131. return this.dragging ? (null != (t = this.responder) && t.setSelectedRange(this.dragging.range), this.dragging = null) : void 0
  2132. }, compositionend: function () {
  2133. return this.composing ? (this.composing = !1, this.scheduleRender()) : void 0
  2134. }
  2135. }, u.prototype.keys = {
  2136. ArrowLeft: function () {
  2137. var t, e;
  2138. return (null != (t = this.responder) ? t.shouldManageMovingCursorInDirection("backward") : void 0) ? (this.event.preventDefault(), null != (e = this.responder) ? e.moveCursorInDirection("backward") : void 0) : void 0
  2139. }, ArrowRight: function () {
  2140. var t, e;
  2141. return (null != (t = this.responder) ? t.shouldManageMovingCursorInDirection("forward") : void 0) ? (this.event.preventDefault(), null != (e = this.responder) ? e.moveCursorInDirection("forward") : void 0) : void 0
  2142. }, Backspace: function () {
  2143. var t, e, n;
  2144. return (null != (t = this.responder) ? t.shouldManageDeletingInDirection("backward") : void 0) ? (this.event.preventDefault(), null != (e = this.delegate) && e.inputControllerWillPerformTyping(), null != (n = this.responder) && n.deleteInDirection("backward"), this.render()) : void 0
  2145. }, Tab: function () {
  2146. var t, e;
  2147. return (null != (t = this.responder) ? t.canIncreaseNestingLevel() : void 0) ? (this.event.preventDefault(), null != (e = this.responder) && e.increaseNestingLevel(), this.render()) : void 0
  2148. }, "Tab+Shift": function () {
  2149. var t, e;
  2150. return (null != (t = this.responder) ? t.canDecreaseNestingLevel() : void 0) ? (this.event.preventDefault(), null != (e = this.responder) && e.decreaseNestingLevel(), this.render()) : void 0
  2151. }
  2152. }, u.prototype.inputTypes = {
  2153. deleteByComposition: function () {
  2154. return this.deleteInDirection("backward", {recordUndoEntry: !1})
  2155. }, deleteByCut: function () {
  2156. return this.deleteInDirection("backward")
  2157. }, deleteByDrag: function () {
  2158. return this.event.preventDefault(), this.withTargetDOMRange(function () {
  2159. var t;
  2160. return this.deleteByDragRange = null != (t = this.responder) ? t.getSelectedRange() : void 0
  2161. })
  2162. }, deleteCompositionText: function () {
  2163. return this.deleteInDirection("backward", {recordUndoEntry: !1})
  2164. }, deleteContent: function () {
  2165. return this.deleteInDirection("backward")
  2166. }, deleteContentBackward: function () {
  2167. return this.deleteInDirection("backward")
  2168. }, deleteContentForward: function () {
  2169. return this.deleteInDirection("forward")
  2170. }, deleteEntireSoftLine: function () {
  2171. return this.deleteInDirection("forward")
  2172. }, deleteHardLineBackward: function () {
  2173. return this.deleteInDirection("backward")
  2174. }, deleteHardLineForward: function () {
  2175. return this.deleteInDirection("forward")
  2176. }, deleteSoftLineBackward: function () {
  2177. return this.deleteInDirection("backward")
  2178. }, deleteSoftLineForward: function () {
  2179. return this.deleteInDirection("forward")
  2180. }, deleteWordBackward: function () {
  2181. return this.deleteInDirection("backward")
  2182. }, deleteWordForward: function () {
  2183. return this.deleteInDirection("forward")
  2184. }, formatBackColor: function () {
  2185. return this.activateAttributeIfSupported("backgroundColor", this.event.data)
  2186. }, formatBold: function () {
  2187. return this.toggleAttributeIfSupported("bold")
  2188. }, formatFontColor: function () {
  2189. return this.activateAttributeIfSupported("color", this.event.data)
  2190. }, formatFontName: function () {
  2191. return this.activateAttributeIfSupported("font", this.event.data)
  2192. }, formatIndent: function () {
  2193. var t;
  2194. return (null != (t = this.responder) ? t.canIncreaseNestingLevel() : void 0) ? this.withTargetDOMRange(function () {
  2195. var t;
  2196. return null != (t = this.responder) ? t.increaseNestingLevel() : void 0
  2197. }) : void 0
  2198. }, formatItalic: function () {
  2199. return this.toggleAttributeIfSupported("italic")
  2200. }, formatJustifyCenter: function () {
  2201. return this.toggleAttributeIfSupported("justifyCenter")
  2202. }, formatJustifyFull: function () {
  2203. return this.toggleAttributeIfSupported("justifyFull")
  2204. }, formatJustifyLeft: function () {
  2205. return this.toggleAttributeIfSupported("justifyLeft")
  2206. }, formatJustifyRight: function () {
  2207. return this.toggleAttributeIfSupported("justifyRight")
  2208. }, formatOutdent: function () {
  2209. var t;
  2210. return (null != (t = this.responder) ? t.canDecreaseNestingLevel() : void 0) ? this.withTargetDOMRange(function () {
  2211. var t;
  2212. return null != (t = this.responder) ? t.decreaseNestingLevel() : void 0
  2213. }) : void 0
  2214. }, formatRemove: function () {
  2215. return this.withTargetDOMRange(function () {
  2216. var t, e, n, i;
  2217. i = [];
  2218. for (t in null != (e = this.responder) ? e.getCurrentAttributes() : void 0) i.push(null != (n = this.responder) ? n.removeCurrentAttribute(t) : void 0);
  2219. return i
  2220. })
  2221. }, formatSetBlockTextDirection: function () {
  2222. return this.activateAttributeIfSupported("blockDir", this.event.data)
  2223. }, formatSetInlineTextDirection: function () {
  2224. return this.activateAttributeIfSupported("textDir", this.event.data)
  2225. }, formatStrikeThrough: function () {
  2226. return this.toggleAttributeIfSupported("strike")
  2227. }, formatSubscript: function () {
  2228. return this.toggleAttributeIfSupported("sub")
  2229. }, formatSuperscript: function () {
  2230. return this.toggleAttributeIfSupported("sup")
  2231. }, formatUnderline: function () {
  2232. return this.toggleAttributeIfSupported("underline")
  2233. }, historyRedo: function () {
  2234. var t;
  2235. return null != (t = this.delegate) ? t.inputControllerWillPerformRedo() : void 0
  2236. }, historyUndo: function () {
  2237. var t;
  2238. return null != (t = this.delegate) ? t.inputControllerWillPerformUndo() : void 0
  2239. }, insertCompositionText: function () {
  2240. return this.composing = !0, this.insertString(this.event.data)
  2241. }, insertFromComposition: function () {
  2242. return this.composing = !1, this.insertString(this.event.data)
  2243. }, insertFromDrop: function () {
  2244. var t, e;
  2245. return (t = this.deleteByDragRange) ? (this.deleteByDragRange = null, null != (e = this.delegate) && e.inputControllerWillMoveText(), this.withTargetDOMRange(function () {
  2246. var e;
  2247. return null != (e = this.responder) ? e.moveTextFromRange(t) : void 0
  2248. })) : void 0
  2249. }, insertFromPaste: function () {
  2250. var n, i, o, r, s, a, u, c, l, h;
  2251. return n = this.event.dataTransfer, s = {dataTransfer: n}, (i = n.getData("URL")) ? (s.type = "URL", s.href = i, s.string = (r = n.getData("public.url-name")) ? e.squishBreakableWhitespace(r).trim() : i, null != (a = this.delegate) && a.inputControllerWillPaste(s), this.withTargetDOMRange(function () {
  2252. var t;
  2253. return null != (t = this.responder) ? t.insertText(e.Text.textForStringWithAttributes(s.string, {href: s.href})) : void 0
  2254. }), this.afterRender = function (t) {
  2255. return function () {
  2256. var e;
  2257. return null != (e = t.delegate) ? e.inputControllerDidPaste(s) : void 0
  2258. }
  2259. }(this)) : t(n) ? (s.type = "text/plain", s.string = n.getData("text/plain"), null != (u = this.delegate) && u.inputControllerWillPaste(s), this.withTargetDOMRange(function () {
  2260. var t;
  2261. return null != (t = this.responder) ? t.insertString(s.string) : void 0
  2262. }), this.afterRender = function (t) {
  2263. return function () {
  2264. var e;
  2265. return null != (e = t.delegate) ? e.inputControllerDidPaste(s) : void 0
  2266. }
  2267. }(this)) : (o = n.getData("text/html")) ? (s.type = "text/html", s.html = o, null != (c = this.delegate) && c.inputControllerWillPaste(s), this.withTargetDOMRange(function () {
  2268. var t;
  2269. return null != (t = this.responder) ? t.insertHTML(s.html) : void 0
  2270. }), this.afterRender = function (t) {
  2271. return function () {
  2272. var e;
  2273. return null != (e = t.delegate) ? e.inputControllerDidPaste(s) : void 0
  2274. }
  2275. }(this)) : (null != (l = n.files) ? l.length : void 0) ? (s.type = "File", s.file = n.files[0], null != (h = this.delegate) && h.inputControllerWillPaste(s), this.withTargetDOMRange(function () {
  2276. var t;
  2277. return null != (t = this.responder) ? t.insertFile(s.file) : void 0
  2278. }), this.afterRender = function (t) {
  2279. return function () {
  2280. var e;
  2281. return null != (e = t.delegate) ? e.inputControllerDidPaste(s) : void 0
  2282. }
  2283. }(this)) : void 0
  2284. }, insertFromYank: function () {
  2285. return this.insertString(this.event.data)
  2286. }, insertLineBreak: function () {
  2287. return this.insertString("\n")
  2288. }, insertLink: function () {
  2289. return this.activateAttributeIfSupported("href", this.event.data)
  2290. }, insertOrderedList: function () {
  2291. return this.toggleAttributeIfSupported("number")
  2292. }, insertParagraph: function () {
  2293. var t;
  2294. return null != (t = this.delegate) && t.inputControllerWillPerformTyping(), this.withTargetDOMRange(function () {
  2295. var t;
  2296. return null != (t = this.responder) ? t.insertLineBreak() : void 0
  2297. })
  2298. }, insertReplacementText: function () {
  2299. return this.insertString(this.event.dataTransfer.getData("text/plain"), {updatePosition: !1})
  2300. }, insertText: function () {
  2301. var t, e;
  2302. return this.insertString(null != (t = this.event.data) ? t : null != (e = this.event.dataTransfer) ? e.getData("text/plain") : void 0)
  2303. }, insertTranspose: function () {
  2304. return this.insertString(this.event.data)
  2305. }, insertUnorderedList: function () {
  2306. return this.toggleAttributeIfSupported("bullet")
  2307. }
  2308. }, u.prototype.insertString = function (t, e) {
  2309. var n;
  2310. return null == t && (t = ""), null != (n = this.delegate) && n.inputControllerWillPerformTyping(), this.withTargetDOMRange(function () {
  2311. var n;
  2312. return null != (n = this.responder) ? n.insertString(t, e) : void 0
  2313. })
  2314. }, u.prototype.toggleAttributeIfSupported = function (t) {
  2315. var n;
  2316. return a.call(e.getAllAttributeNames(), t) >= 0 ? (null != (n = this.delegate) && n.inputControllerWillPerformFormatting(t), this.withTargetDOMRange(function () {
  2317. var e;
  2318. return null != (e = this.responder) ? e.toggleCurrentAttribute(t) : void 0
  2319. })) : void 0
  2320. }, u.prototype.activateAttributeIfSupported = function (t, n) {
  2321. var i;
  2322. return a.call(e.getAllAttributeNames(), t) >= 0 ? (null != (i = this.delegate) && i.inputControllerWillPerformFormatting(t), this.withTargetDOMRange(function () {
  2323. var e;
  2324. return null != (e = this.responder) ? e.setCurrentAttribute(t, n) : void 0
  2325. })) : void 0
  2326. }, u.prototype.deleteInDirection = function (t, e) {
  2327. var n, i, o, r;
  2328. return o = (null != e ? e : {recordUndoEntry: !0}).recordUndoEntry, o && null != (r = this.delegate) && r.inputControllerWillPerformTyping(), i = function (e) {
  2329. return function () {
  2330. var n;
  2331. return null != (n = e.responder) ? n.deleteInDirection(t) : void 0
  2332. }
  2333. }(this), (n = this.getTargetDOMRange({minLength: 2})) ? this.withTargetDOMRange(n, i) : i()
  2334. }, u.prototype.withTargetDOMRange = function (t, n) {
  2335. var i;
  2336. return "function" == typeof t && (n = t, t = this.getTargetDOMRange()), t ? null != (i = this.responder) ? i.withTargetDOMRange(t, n.bind(this)) : void 0 : (e.selectionChangeObserver.reset(), n.call(this))
  2337. }, u.prototype.getTargetDOMRange = function (t) {
  2338. var e, n, i, o;
  2339. return i = (null != t ? t : {minLength: 0}).minLength, (o = "function" == typeof (e = this.event).getTargetRanges ? e.getTargetRanges() : void 0) && o.length && (n = f(o[0]), 0 === i || n.toString().length >= i) ? n : void 0
  2340. }, f = function (t) {
  2341. var e;
  2342. return e = document.createRange(), e.setStart(t.startContainer, t.startOffset), e.setEnd(t.endContainer, t.endOffset), e
  2343. }, u.prototype.withEvent = function (t, e) {
  2344. var n;
  2345. this.event = t;
  2346. try {
  2347. n = e.call(this)
  2348. } finally {
  2349. this.event = null
  2350. }
  2351. return n
  2352. }, c = function (t) {
  2353. var e, n;
  2354. return a.call(null != (e = null != (n = t.dataTransfer) ? n.types : void 0) ? e : [], "Files") >= 0
  2355. }, h = function (t) {
  2356. var e;
  2357. return (e = t.clipboardData) ? a.call(e.types, "Files") >= 0 && 1 === e.types.length && e.files.length >= 1 : void 0
  2358. }, p = function (t) {
  2359. var e;
  2360. return (e = t.clipboardData) ? a.call(e.types, "text/plain") >= 0 && 1 === e.types.length : void 0
  2361. }, l = function (t) {
  2362. var e;
  2363. return e = [], t.altKey && e.push("alt"), t.shiftKey && e.push("shift"), e.push(t.key), e
  2364. }, d = function (t) {
  2365. return {x: t.clientX, y: t.clientY}
  2366. }, u
  2367. }(e.InputController)
  2368. }.call(this), function () {
  2369. var t, n, i, o, r, s, a, u, c, l = function (t, e) {
  2370. return function () {
  2371. return t.apply(e, arguments)
  2372. }
  2373. }, h = function (t, e) {
  2374. function n() {
  2375. this.constructor = t
  2376. }
  2377. for (var i in e) p.call(e, i) && (t[i] = e[i]);
  2378. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  2379. }, p = {}.hasOwnProperty;
  2380. n = e.defer, i = e.escapeHTML, o = e.handleEvent, a = e.makeElement, c = e.tagName, u = e.config, s = u.lang, t = u.css, r = u.keyNames, e.AttachmentEditorController = function (u) {
  2381. function p(t, e, n, i) {
  2382. this.attachmentPiece = t, this.element = e, this.container = n, this.options = null != i ? i : {}, this.didBlurCaption = l(this.didBlurCaption, this), this.didChangeCaption = l(this.didChangeCaption, this), this.didInputCaption = l(this.didInputCaption, this), this.didKeyDownCaption = l(this.didKeyDownCaption, this), this.didClickActionButton = l(this.didClickActionButton, this), this.didClickToolbar = l(this.didClickToolbar, this), this.attachment = this.attachmentPiece.attachment, "a" === c(this.element) && (this.element = this.element.firstChild), this.install()
  2383. }
  2384. var d;
  2385. return h(p, u), d = function (t) {
  2386. return function () {
  2387. var e;
  2388. return e = t.apply(this, arguments), e["do"](), null == this.undos && (this.undos = []), this.undos.push(e.undo)
  2389. }
  2390. }, p.prototype.install = function () {
  2391. return this.makeElementMutable(), this.addToolbar(), this.attachment.isPreviewable() ? this.installCaptionEditor() : void 0
  2392. }, p.prototype.uninstall = function () {
  2393. var t, e;
  2394. for (this.savePendingCaption(); e = this.undos.pop();) e();
  2395. return null != (t = this.delegate) ? t.didUninstallAttachmentEditor(this) : void 0
  2396. }, p.prototype.savePendingCaption = function () {
  2397. var t, e, n;
  2398. return null != this.pendingCaption ? (t = this.pendingCaption, this.pendingCaption = null, t ? null != (e = this.delegate) && "function" == typeof e.attachmentEditorDidRequestUpdatingAttributesForAttachment ? e.attachmentEditorDidRequestUpdatingAttributesForAttachment({caption: t}, this.attachment) : void 0 : null != (n = this.delegate) && "function" == typeof n.attachmentEditorDidRequestRemovingAttributeForAttachment ? n.attachmentEditorDidRequestRemovingAttributeForAttachment("caption", this.attachment) : void 0) : void 0
  2399. }, p.prototype.makeElementMutable = d(function () {
  2400. return {
  2401. "do": function (t) {
  2402. return function () {
  2403. return t.element.dataset.trixMutable = !0
  2404. }
  2405. }(this), undo: function (t) {
  2406. return function () {
  2407. return delete t.element.dataset.trixMutable
  2408. }
  2409. }(this)
  2410. }
  2411. }), p.prototype.addToolbar = d(function () {
  2412. var n, r, u;
  2413. return n = a({
  2414. tagName: "div",
  2415. className: t.attachmentToolbar,
  2416. data: {trixMutable: !0}
  2417. }), n.innerHTML = '<div class="trix-button-row">\n <span class="trix-button-group trix-button-group--actions">\n <button type="button" data-trix-action="remove" class="trix-button trix-button--remove" title="' + s.remove + '">' + s.remove + "</button>\n </span>\n</div>", this.attachment.isPreviewable() && (r = i(this.attachment.getFilename()), u = i(this.attachment.getFormattedFilesize()), n.innerHTML += '<div class="' + t.attachmentMetadataContainer + '">\n <span class="' + t.attachmentMetadata + '">\n <span class="' + t.attachmentName + '" title="' + r + '">' + r + '</span>\n <span class="' + t.attachmentSize + '">' + u + "</span>\n </span>\n</div>"), o("click", {
  2418. onElement: n,
  2419. withCallback: this.didClickToolbar
  2420. }), o("click", {
  2421. onElement: n,
  2422. matchingSelector: "[data-trix-action]",
  2423. withCallback: this.didClickActionButton
  2424. }), {
  2425. "do": function (t) {
  2426. return function () {
  2427. return t.element.appendChild(n)
  2428. }
  2429. }(this), undo: function () {
  2430. return function () {
  2431. return e.removeNode(n)
  2432. }
  2433. }(this)
  2434. }
  2435. }), p.prototype.installCaptionEditor = d(function () {
  2436. var i, r, u, c, l;
  2437. return c = a({
  2438. tagName: "textarea",
  2439. className: t.attachmentCaptionEditor,
  2440. attributes: {placeholder: s.captionPlaceholder},
  2441. data: {trixMutable: !0}
  2442. }), c.value = this.attachmentPiece.getCaption(), l = c.cloneNode(), l.classList.add("trix-autoresize-clone"), l.tabIndex = -1, i = function () {
  2443. return l.value = c.value, c.style.height = l.scrollHeight + "px"
  2444. }, o("input", {onElement: c, withCallback: i}), o("input", {
  2445. onElement: c,
  2446. withCallback: this.didInputCaption
  2447. }), o("keydown", {onElement: c, withCallback: this.didKeyDownCaption}), o("change", {
  2448. onElement: c,
  2449. withCallback: this.didChangeCaption
  2450. }), o("blur", {
  2451. onElement: c,
  2452. withCallback: this.didBlurCaption
  2453. }), u = this.element.querySelector("figcaption"), r = u.cloneNode(), {
  2454. "do": function (e) {
  2455. return function () {
  2456. return u.style.display = "none", r.appendChild(c), r.appendChild(l), r.classList.add(t.attachmentCaption + "--editing"), u.parentElement.insertBefore(r, u), i(), e.options.editCaption ? n(function () {
  2457. return c.focus()
  2458. }) : void 0
  2459. }
  2460. }(this), undo: function () {
  2461. return e.removeNode(r), u.style.display = null
  2462. }
  2463. }
  2464. }), p.prototype.didClickToolbar = function (t) {
  2465. return t.preventDefault(), t.stopPropagation()
  2466. }, p.prototype.didClickActionButton = function (t) {
  2467. var e, n;
  2468. switch (e = t.target.getAttribute("data-trix-action")) {
  2469. case"remove":
  2470. return null != (n = this.delegate) ? n.attachmentEditorDidRequestRemovalOfAttachment(this.attachment) : void 0
  2471. }
  2472. }, p.prototype.didKeyDownCaption = function (t) {
  2473. var e;
  2474. return "return" === r[t.keyCode] ? (t.preventDefault(), this.savePendingCaption(), null != (e = this.delegate) && "function" == typeof e.attachmentEditorDidRequestDeselectingAttachment ? e.attachmentEditorDidRequestDeselectingAttachment(this.attachment) : void 0) : void 0
  2475. }, p.prototype.didInputCaption = function (t) {
  2476. return this.pendingCaption = t.target.value.replace(/\s/g, " ").trim()
  2477. }, p.prototype.didChangeCaption = function () {
  2478. return this.savePendingCaption()
  2479. }, p.prototype.didBlurCaption = function () {
  2480. return this.savePendingCaption()
  2481. }, p
  2482. }(e.BasicObject)
  2483. }.call(this), function () {
  2484. var t, n, i, o = function (t, e) {
  2485. function n() {
  2486. this.constructor = t
  2487. }
  2488. for (var i in e) r.call(e, i) && (t[i] = e[i]);
  2489. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  2490. }, r = {}.hasOwnProperty;
  2491. i = e.makeElement, t = e.config.css, e.AttachmentView = function (r) {
  2492. function s() {
  2493. s.__super__.constructor.apply(this, arguments), this.attachment = this.object, this.attachment.uploadProgressDelegate = this, this.attachmentPiece = this.options.piece
  2494. }
  2495. var a;
  2496. return o(s, r), s.attachmentSelector = "[data-trix-attachment]", s.prototype.createContentNodes = function () {
  2497. return []
  2498. }, s.prototype.createNodes = function () {
  2499. var e, n, o, r, s, u, c;
  2500. if (e = r = i({
  2501. tagName: "figure",
  2502. className: this.getClassName(),
  2503. data: this.getData(),
  2504. editable: !1
  2505. }), (n = this.getHref()) && (r = i({
  2506. tagName: "a",
  2507. editable: !1,
  2508. attributes: {href: n, tabindex: -1}
  2509. }), e.appendChild(r)), this.attachment.hasContent()) r.innerHTML = this.attachment.getContent(); else for (c = this.createContentNodes(), o = 0, s = c.length; s > o; o++) u = c[o], r.appendChild(u);
  2510. return r.appendChild(this.createCaptionElement()), this.attachment.isPending() && (this.progressElement = i({
  2511. tagName: "progress",
  2512. attributes: {
  2513. "class": t.attachmentProgress,
  2514. value: this.attachment.getUploadProgress(),
  2515. max: 100
  2516. },
  2517. data: {trixMutable: !0, trixStoreKey: ["progressElement", this.attachment.id].join("/")}
  2518. }), e.appendChild(this.progressElement)), [a("left"), e, a("right")]
  2519. }, s.prototype.createCaptionElement = function () {
  2520. var e, n, o, r, s, a, u;
  2521. return o = i({
  2522. tagName: "figcaption",
  2523. className: t.attachmentCaption
  2524. }), (e = this.attachmentPiece.getCaption()) ? (o.classList.add(t.attachmentCaption + "--edited"), o.textContent = e) : (n = this.getCaptionConfig(), n.name && (r = this.attachment.getFilename()), n.size && (a = this.attachment.getFormattedFilesize()), r && (s = i({
  2525. tagName: "span",
  2526. className: t.attachmentName,
  2527. textContent: r
  2528. }), o.appendChild(s)), a && (r && o.appendChild(document.createTextNode(" ")), u = i({
  2529. tagName: "span",
  2530. className: t.attachmentSize,
  2531. textContent: a
  2532. }), o.appendChild(u))), o
  2533. }, s.prototype.getClassName = function () {
  2534. var e, n;
  2535. return n = [t.attachment, t.attachment + "--" + this.attachment.getType()], (e = this.attachment.getExtension()) && n.push(t.attachment + "--" + e), n.join(" ")
  2536. }, s.prototype.getData = function () {
  2537. var t, e;
  2538. return e = {
  2539. trixAttachment: JSON.stringify(this.attachment),
  2540. trixContentType: this.attachment.getContentType(),
  2541. trixId: this.attachment.id
  2542. }, t = this.attachmentPiece.attributes, t.isEmpty() || (e.trixAttributes = JSON.stringify(t)), this.attachment.isPending() && (e.trixSerialize = !1), e
  2543. }, s.prototype.getHref = function () {
  2544. return n(this.attachment.getContent(), "a") ? void 0 : this.attachment.getHref()
  2545. }, s.prototype.getCaptionConfig = function () {
  2546. var t, n, i;
  2547. return i = this.attachment.getType(), t = e.copyObject(null != (n = e.config.attachments[i]) ? n.caption : void 0), "file" === i && (t.name = !0), t
  2548. }, s.prototype.findProgressElement = function () {
  2549. var t;
  2550. return null != (t = this.findElement()) ? t.querySelector("progress") : void 0
  2551. }, a = function (t) {
  2552. return i({
  2553. tagName: "span",
  2554. textContent: e.ZERO_WIDTH_SPACE,
  2555. data: {trixCursorTarget: t, trixSerialize: !1}
  2556. })
  2557. }, s.prototype.attachmentDidChangeUploadProgress = function () {
  2558. var t, e;
  2559. return e = this.attachment.getUploadProgress(), null != (t = this.findProgressElement()) ? t.value = e : void 0
  2560. }, s
  2561. }(e.ObjectView), n = function (t, e) {
  2562. var n;
  2563. return n = i("div"), n.innerHTML = null != t ? t : "", n.querySelector(e)
  2564. }
  2565. }.call(this), function () {
  2566. var t, n = function (t, e) {
  2567. function n() {
  2568. this.constructor = t
  2569. }
  2570. for (var o in e) i.call(e, o) && (t[o] = e[o]);
  2571. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  2572. }, i = {}.hasOwnProperty;
  2573. t = e.makeElement, e.PreviewableAttachmentView = function (i) {
  2574. function o() {
  2575. o.__super__.constructor.apply(this, arguments), this.attachment.previewDelegate = this
  2576. }
  2577. return n(o, i), o.prototype.createContentNodes = function () {
  2578. return this.image = t({
  2579. tagName: "img",
  2580. attributes: {src: ""},
  2581. data: {trixMutable: !0}
  2582. }), this.refresh(this.image), [this.image]
  2583. }, o.prototype.createCaptionElement = function () {
  2584. var t;
  2585. return t = o.__super__.createCaptionElement.apply(this, arguments), t.textContent || t.setAttribute("data-trix-placeholder", e.config.lang.captionPlaceholder), t
  2586. }, o.prototype.refresh = function (t) {
  2587. var e;
  2588. return null == t && (t = null != (e = this.findElement()) ? e.querySelector("img") : void 0), t ? this.updateAttributesForImage(t) : void 0
  2589. }, o.prototype.updateAttributesForImage = function (t) {
  2590. var e, n, i, o, r, s;
  2591. return r = this.attachment.getURL(), n = this.attachment.getPreviewURL(), t.src = n || r, n === r ? t.removeAttribute("data-trix-serialized-attributes") : (i = JSON.stringify({src: r}), t.setAttribute("data-trix-serialized-attributes", i)), s = this.attachment.getWidth(), e = this.attachment.getHeight(), null != s && (t.width = s), null != e && (t.height = e), o = ["imageElement", this.attachment.id, t.src, t.width, t.height].join("/"), t.dataset.trixStoreKey = o
  2592. }, o.prototype.attachmentDidChangeAttributes = function () {
  2593. return this.refresh(this.image), this.refresh()
  2594. }, o
  2595. }(e.AttachmentView)
  2596. }.call(this), function () {
  2597. var t, n, i, o = function (t, e) {
  2598. function n() {
  2599. this.constructor = t
  2600. }
  2601. for (var i in e) r.call(e, i) && (t[i] = e[i]);
  2602. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  2603. }, r = {}.hasOwnProperty;
  2604. i = e.makeElement, t = e.findInnerElement, n = e.getTextConfig, e.PieceView = function (r) {
  2605. function s() {
  2606. var t;
  2607. s.__super__.constructor.apply(this, arguments), this.piece = this.object, this.attributes = this.piece.getAttributes(), t = this.options, this.textConfig = t.textConfig, this.context = t.context, this.piece.attachment ? this.attachment = this.piece.attachment : this.string = this.piece.toString()
  2608. }
  2609. var a;
  2610. return o(s, r), s.prototype.createNodes = function () {
  2611. var e, n, i, o, r, s;
  2612. if (s = this.attachment ? this.createAttachmentNodes() : this.createStringNodes(), e = this.createElement()) {
  2613. for (i = t(e), n = 0, o = s.length; o > n; n++) r = s[n], i.appendChild(r);
  2614. s = [e]
  2615. }
  2616. return s
  2617. }, s.prototype.createAttachmentNodes = function () {
  2618. var t, n;
  2619. return t = this.attachment.isPreviewable() ? e.PreviewableAttachmentView : e.AttachmentView, n = this.createChildView(t, this.piece.attachment, {piece: this.piece}), n.getNodes()
  2620. }, s.prototype.createStringNodes = function () {
  2621. var t, e, n, o, r, s, a, u, c, l;
  2622. if (null != (u = this.textConfig) ? u.plaintext : void 0) return [document.createTextNode(this.string)];
  2623. for (a = [], c = this.string.split("\n"), n = e = 0, o = c.length; o > e; n = ++e) l = c[n], n > 0 && (t = i("br"), a.push(t)), (r = l.length) && (s = document.createTextNode(this.preserveSpaces(l)), a.push(s));
  2624. return a
  2625. }, s.prototype.createElement = function () {
  2626. var t, e, o, r, s, a, u, c, l;
  2627. c = {}, a = this.attributes;
  2628. for (r in a) if (l = a[r], (t = n(r)) && (t.tagName && (s = i(t.tagName), o ? (o.appendChild(s), o = s) : e = o = s), t.styleProperty && (c[t.styleProperty] = l), t.style)) {
  2629. u = t.style;
  2630. for (r in u) l = u[r], c[r] = l
  2631. }
  2632. if (Object.keys(c).length) {
  2633. null == e && (e = i("span"));
  2634. for (r in c) l = c[r], e.style[r] = l
  2635. }
  2636. return e
  2637. }, s.prototype.createContainerElement = function () {
  2638. var t, e, o, r, s;
  2639. r = this.attributes;
  2640. for (o in r) if (s = r[o], (e = n(o)) && e.groupTagName) return t = {}, t[o] = s, i(e.groupTagName, t)
  2641. }, a = e.NON_BREAKING_SPACE, s.prototype.preserveSpaces = function (t) {
  2642. return this.context.isLast && (t = t.replace(/\ $/, a)), t = t.replace(/(\S)\ {3}(\S)/g, "$1 " + a + " $2").replace(/\ {2}/g, a + " ").replace(/\ {2}/g, " " + a), (this.context.isFirst || this.context.followsWhitespace) && (t = t.replace(/^\ /, a)), t
  2643. }, s
  2644. }(e.ObjectView)
  2645. }.call(this), function () {
  2646. var t = function (t, e) {
  2647. function i() {
  2648. this.constructor = t
  2649. }
  2650. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  2651. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  2652. }, n = {}.hasOwnProperty;
  2653. e.TextView = function (n) {
  2654. function i() {
  2655. i.__super__.constructor.apply(this, arguments), this.text = this.object, this.textConfig = this.options.textConfig
  2656. }
  2657. var o;
  2658. return t(i, n), i.prototype.createNodes = function () {
  2659. var t, n, i, r, s, a, u, c, l, h;
  2660. for (a = [], c = e.ObjectGroup.groupObjects(this.getPieces()), r = c.length - 1, i = n = 0, s = c.length; s > n; i = ++n) u = c[i], t = {}, 0 === i && (t.isFirst = !0), i === r && (t.isLast = !0), o(l) && (t.followsWhitespace = !0), h = this.findOrCreateCachedChildView(e.PieceView, u, {
  2661. textConfig: this.textConfig,
  2662. context: t
  2663. }), a.push.apply(a, h.getNodes()), l = u;
  2664. return a
  2665. }, i.prototype.getPieces = function () {
  2666. var t, e, n, i, o;
  2667. for (i = this.text.getPieces(), o = [], t = 0, e = i.length; e > t; t++) n = i[t], n.hasAttribute("blockBreak") || o.push(n);
  2668. return o
  2669. }, o = function (t) {
  2670. return /\s$/.test(null != t ? t.toString() : void 0)
  2671. }, i
  2672. }(e.ObjectView)
  2673. }.call(this), function () {
  2674. var t, n, i, o = function (t, e) {
  2675. function n() {
  2676. this.constructor = t
  2677. }
  2678. for (var i in e) r.call(e, i) && (t[i] = e[i]);
  2679. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  2680. }, r = {}.hasOwnProperty;
  2681. i = e.makeElement, n = e.getBlockConfig, t = e.config.css, e.BlockView = function (r) {
  2682. function s() {
  2683. s.__super__.constructor.apply(this, arguments), this.block = this.object, this.attributes = this.block.getAttributes()
  2684. }
  2685. return o(s, r), s.prototype.createNodes = function () {
  2686. var t, o, r, s, a, u, c, l, h;
  2687. if (t = document.createComment("block"), u = [t], this.block.isEmpty() ? u.push(i("br")) : (l = null != (c = n(this.block.getLastAttribute())) ? c.text : void 0, h = this.findOrCreateCachedChildView(e.TextView, this.block.text, {textConfig: l}), u.push.apply(u, h.getNodes()), this.shouldAddExtraNewlineElement() && u.push(i("br"))), this.attributes.length) return u;
  2688. for (o = i(e.config.blockAttributes["default"].tagName), r = 0, s = u.length; s > r; r++) a = u[r], o.appendChild(a);
  2689. return [o]
  2690. }, s.prototype.createContainerElement = function (e) {
  2691. var o, r, s, a;
  2692. return o = this.attributes[e], a = n(o).tagName, r = {tagName: a}, "attachmentGallery" === o && (s = this.block.getBlockBreakPosition(), r.className = t.attachmentGallery + " " + t.attachmentGallery + "--" + s), i(r)
  2693. }, s.prototype.shouldAddExtraNewlineElement = function () {
  2694. return /\n\n$/.test(this.block.toString())
  2695. }, s
  2696. }(e.ObjectView)
  2697. }.call(this), function () {
  2698. var t, n, i = function (t, e) {
  2699. function n() {
  2700. this.constructor = t
  2701. }
  2702. for (var i in e) o.call(e, i) && (t[i] = e[i]);
  2703. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  2704. }, o = {}.hasOwnProperty;
  2705. t = e.defer, n = e.makeElement, e.DocumentView = function (o) {
  2706. function r() {
  2707. r.__super__.constructor.apply(this, arguments), this.element = this.options.element, this.elementStore = new e.ElementStore, this.setDocument(this.object)
  2708. }
  2709. var s, a, u;
  2710. return i(r, o), r.render = function (t) {
  2711. var e, i;
  2712. return e = n("div"), i = new this(t, {element: e}), i.render(), i.sync(), e
  2713. }, r.prototype.setDocument = function (t) {
  2714. return t.isEqualTo(this.document) ? void 0 : this.document = this.object = t
  2715. }, r.prototype.render = function () {
  2716. var t, i, o, r, s, a, u;
  2717. if (this.childViews = [], this.shadowElement = n("div"), !this.document.isEmpty()) {
  2718. for (s = e.ObjectGroup.groupObjects(this.document.getBlocks(), {asTree: !0}), a = [], t = 0, i = s.length; i > t; t++) r = s[t], u = this.findOrCreateCachedChildView(e.BlockView, r), a.push(function () {
  2719. var t, e, n, i;
  2720. for (n = u.getNodes(), i = [], t = 0, e = n.length; e > t; t++) o = n[t], i.push(this.shadowElement.appendChild(o));
  2721. return i
  2722. }.call(this));
  2723. return a
  2724. }
  2725. }, r.prototype.isSynced = function () {
  2726. return s(this.shadowElement, this.element)
  2727. }, r.prototype.sync = function () {
  2728. var t;
  2729. for (t = this.createDocumentFragmentForSync(); this.element.lastChild;) this.element.removeChild(this.element.lastChild);
  2730. return this.element.appendChild(t), this.didSync()
  2731. }, r.prototype.didSync = function () {
  2732. return this.elementStore.reset(a(this.element)), t(function (t) {
  2733. return function () {
  2734. return t.garbageCollectCachedViews()
  2735. }
  2736. }(this))
  2737. }, r.prototype.createDocumentFragmentForSync = function () {
  2738. var t, e, n, i, o, r, s, u, c, l;
  2739. for (e = document.createDocumentFragment(), u = this.shadowElement.childNodes, n = 0, o = u.length; o > n; n++) s = u[n], e.appendChild(s.cloneNode(!0));
  2740. for (c = a(e), i = 0, r = c.length; r > i; i++) t = c[i], (l = this.elementStore.remove(t)) && t.parentNode.replaceChild(l, t);
  2741. return e
  2742. }, a = function (t) {
  2743. return t.querySelectorAll("[data-trix-store-key]")
  2744. }, s = function (t, e) {
  2745. return u(t.innerHTML) === u(e.innerHTML)
  2746. }, u = function (t) {
  2747. return t.replace(/&nbsp;/g, " ")
  2748. }, r
  2749. }(e.ObjectView)
  2750. }.call(this), function () {
  2751. var t, n, i, o, r, s = function (t, e) {
  2752. return function () {
  2753. return t.apply(e, arguments)
  2754. }
  2755. }, a = function (t, e) {
  2756. function n() {
  2757. this.constructor = t
  2758. }
  2759. for (var i in e) u.call(e, i) && (t[i] = e[i]);
  2760. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  2761. }, u = {}.hasOwnProperty;
  2762. i = e.findClosestElementFromNode, o = e.handleEvent, r = e.innerElementIsActive, n = e.defer, t = e.AttachmentView.attachmentSelector, e.CompositionController = function (u) {
  2763. function c(n, i) {
  2764. this.element = n, this.composition = i, this.didClickAttachment = s(this.didClickAttachment, this), this.didBlur = s(this.didBlur, this), this.didFocus = s(this.didFocus, this), this.documentView = new e.DocumentView(this.composition.document, {element: this.element}), o("focus", {
  2765. onElement: this.element,
  2766. withCallback: this.didFocus
  2767. }), o("blur", {
  2768. onElement: this.element,
  2769. withCallback: this.didBlur
  2770. }), o("click", {
  2771. onElement: this.element,
  2772. matchingSelector: "a[contenteditable=false]",
  2773. preventDefault: !0
  2774. }), o("mousedown", {
  2775. onElement: this.element,
  2776. matchingSelector: t,
  2777. withCallback: this.didClickAttachment
  2778. }), o("click", {onElement: this.element, matchingSelector: "a" + t, preventDefault: !0})
  2779. }
  2780. return a(c, u), c.prototype.didFocus = function () {
  2781. var t, e, n;
  2782. return t = function (t) {
  2783. return function () {
  2784. var e;
  2785. return t.focused ? void 0 : (t.focused = !0, null != (e = t.delegate) && "function" == typeof e.compositionControllerDidFocus ? e.compositionControllerDidFocus() : void 0)
  2786. }
  2787. }(this), null != (e = null != (n = this.blurPromise) ? n.then(t) : void 0) ? e : t()
  2788. }, c.prototype.didBlur = function () {
  2789. return this.blurPromise = new Promise(function (t) {
  2790. return function (e) {
  2791. return n(function () {
  2792. var n;
  2793. return r(t.element) || (t.focused = null, null != (n = t.delegate) && "function" == typeof n.compositionControllerDidBlur && n.compositionControllerDidBlur()), t.blurPromise = null, e()
  2794. })
  2795. }
  2796. }(this))
  2797. }, c.prototype.didClickAttachment = function (t, e) {
  2798. var n, o, r;
  2799. return n = this.findAttachmentForElement(e), o = null != i(t.target, {matchingSelector: "figcaption"}), null != (r = this.delegate) && "function" == typeof r.compositionControllerDidSelectAttachment ? r.compositionControllerDidSelectAttachment(n, {editCaption: o}) : void 0
  2800. }, c.prototype.getSerializableElement = function () {
  2801. return this.isEditingAttachment() ? this.documentView.shadowElement : this.element
  2802. }, c.prototype.render = function () {
  2803. var t, e, n;
  2804. return this.revision !== this.composition.revision && (this.documentView.setDocument(this.composition.document), this.documentView.render(), this.revision = this.composition.revision), this.canSyncDocumentView() && !this.documentView.isSynced() && (null != (t = this.delegate) && "function" == typeof t.compositionControllerWillSyncDocumentView && t.compositionControllerWillSyncDocumentView(), this.documentView.sync(), null != (e = this.delegate) && "function" == typeof e.compositionControllerDidSyncDocumentView && e.compositionControllerDidSyncDocumentView()), null != (n = this.delegate) && "function" == typeof n.compositionControllerDidRender ? n.compositionControllerDidRender() : void 0
  2805. }, c.prototype.rerenderViewForObject = function (t) {
  2806. return this.invalidateViewForObject(t), this.render()
  2807. }, c.prototype.invalidateViewForObject = function (t) {
  2808. return this.documentView.invalidateViewForObject(t)
  2809. }, c.prototype.isViewCachingEnabled = function () {
  2810. return this.documentView.isViewCachingEnabled()
  2811. }, c.prototype.enableViewCaching = function () {
  2812. return this.documentView.enableViewCaching()
  2813. }, c.prototype.disableViewCaching = function () {
  2814. return this.documentView.disableViewCaching()
  2815. }, c.prototype.refreshViewCache = function () {
  2816. return this.documentView.garbageCollectCachedViews()
  2817. }, c.prototype.isEditingAttachment = function () {
  2818. return null != this.attachmentEditor
  2819. }, c.prototype.installAttachmentEditorForAttachment = function (t, n) {
  2820. var i, o, r;
  2821. if ((null != (r = this.attachmentEditor) ? r.attachment : void 0) !== t && (o = this.documentView.findElementForObject(t))) return this.uninstallAttachmentEditor(), i = this.composition.document.getAttachmentPieceForAttachment(t), this.attachmentEditor = new e.AttachmentEditorController(i, o, this.element, n), this.attachmentEditor.delegate = this
  2822. }, c.prototype.uninstallAttachmentEditor = function () {
  2823. var t;
  2824. return null != (t = this.attachmentEditor) ? t.uninstall() : void 0
  2825. }, c.prototype.didUninstallAttachmentEditor = function () {
  2826. return this.attachmentEditor = null, this.render()
  2827. }, c.prototype.attachmentEditorDidRequestUpdatingAttributesForAttachment = function (t, e) {
  2828. var n;
  2829. return null != (n = this.delegate) && "function" == typeof n.compositionControllerWillUpdateAttachment && n.compositionControllerWillUpdateAttachment(e), this.composition.updateAttributesForAttachment(t, e)
  2830. }, c.prototype.attachmentEditorDidRequestRemovingAttributeForAttachment = function (t, e) {
  2831. var n;
  2832. return null != (n = this.delegate) && "function" == typeof n.compositionControllerWillUpdateAttachment && n.compositionControllerWillUpdateAttachment(e), this.composition.removeAttributeForAttachment(t, e)
  2833. }, c.prototype.attachmentEditorDidRequestRemovalOfAttachment = function (t) {
  2834. var e;
  2835. return null != (e = this.delegate) && "function" == typeof e.compositionControllerDidRequestRemovalOfAttachment ? e.compositionControllerDidRequestRemovalOfAttachment(t) : void 0
  2836. }, c.prototype.attachmentEditorDidRequestDeselectingAttachment = function (t) {
  2837. var e;
  2838. return null != (e = this.delegate) && "function" == typeof e.compositionControllerDidRequestDeselectingAttachment ? e.compositionControllerDidRequestDeselectingAttachment(t) : void 0
  2839. }, c.prototype.canSyncDocumentView = function () {
  2840. return !this.isEditingAttachment()
  2841. }, c.prototype.findAttachmentForElement = function (t) {
  2842. return this.composition.document.getAttachmentById(parseInt(t.dataset.trixId, 10))
  2843. }, c
  2844. }(e.BasicObject)
  2845. }.call(this), function () {
  2846. var t, n, i, o = function (t, e) {
  2847. return function () {
  2848. return t.apply(e, arguments)
  2849. }
  2850. }, r = function (t, e) {
  2851. function n() {
  2852. this.constructor = t
  2853. }
  2854. for (var i in e) s.call(e, i) && (t[i] = e[i]);
  2855. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  2856. }, s = {}.hasOwnProperty;
  2857. n = e.handleEvent, i = e.triggerEvent, t = e.findClosestElementFromNode, e.ToolbarController = function (e) {
  2858. function s(t) {
  2859. this.element = t, this.didKeyDownDialogInput = o(this.didKeyDownDialogInput, this), this.didClickDialogButton = o(this.didClickDialogButton, this), this.didClickAttributeButton = o(this.didClickAttributeButton, this), this.didClickActionButton = o(this.didClickActionButton, this), this.attributes = {}, this.actions = {}, this.resetDialogInputs(), n("mousedown", {
  2860. onElement: this.element,
  2861. matchingSelector: a,
  2862. withCallback: this.didClickActionButton
  2863. }), n("mousedown", {
  2864. onElement: this.element,
  2865. matchingSelector: c,
  2866. withCallback: this.didClickAttributeButton
  2867. }), n("click", {
  2868. onElement: this.element,
  2869. matchingSelector: v,
  2870. preventDefault: !0
  2871. }), n("click", {
  2872. onElement: this.element,
  2873. matchingSelector: l,
  2874. withCallback: this.didClickDialogButton
  2875. }), n("keydown", {
  2876. onElement: this.element,
  2877. matchingSelector: h,
  2878. withCallback: this.didKeyDownDialogInput
  2879. })
  2880. }
  2881. var a, u, c, l, h, p, d, f, g, m, v;
  2882. return r(s, e), c = "[data-trix-attribute]", a = "[data-trix-action]", v = c + ", " + a, p = "[data-trix-dialog]", u = p + "[data-trix-active]", l = p + " [data-trix-method]", h = p + " [data-trix-input]", s.prototype.didClickActionButton = function (t, e) {
  2883. var n, i, o;
  2884. return null != (i = this.delegate) && i.toolbarDidClickButton(), t.preventDefault(), n = d(e), this.getDialog(n) ? this.toggleDialog(n) : null != (o = this.delegate) ? o.toolbarDidInvokeAction(n) : void 0
  2885. }, s.prototype.didClickAttributeButton = function (t, e) {
  2886. var n, i, o;
  2887. return null != (i = this.delegate) && i.toolbarDidClickButton(), t.preventDefault(), n = f(e), this.getDialog(n) ? this.toggleDialog(n) : null != (o = this.delegate) && o.toolbarDidToggleAttribute(n), this.refreshAttributeButtons()
  2888. }, s.prototype.didClickDialogButton = function (e, n) {
  2889. var i, o;
  2890. return i = t(n, {matchingSelector: p}), o = n.getAttribute("data-trix-method"), this[o].call(this, i)
  2891. }, s.prototype.didKeyDownDialogInput = function (t, e) {
  2892. var n, i;
  2893. return 13 === t.keyCode && (t.preventDefault(), n = e.getAttribute("name"), i = this.getDialog(n), this.setAttribute(i)), 27 === t.keyCode ? (t.preventDefault(), this.hideDialog()) : void 0
  2894. }, s.prototype.updateActions = function (t) {
  2895. return this.actions = t, this.refreshActionButtons()
  2896. }, s.prototype.refreshActionButtons = function () {
  2897. return this.eachActionButton(function (t) {
  2898. return function (e, n) {
  2899. return e.disabled = t.actions[n] === !1
  2900. }
  2901. }(this))
  2902. }, s.prototype.eachActionButton = function (t) {
  2903. var e, n, i, o, r;
  2904. for (o = this.element.querySelectorAll(a), r = [], n = 0, i = o.length; i > n; n++) e = o[n], r.push(t(e, d(e)));
  2905. return r
  2906. }, s.prototype.updateAttributes = function (t) {
  2907. return this.attributes = t, this.refreshAttributeButtons()
  2908. }, s.prototype.refreshAttributeButtons = function () {
  2909. return this.eachAttributeButton(function (t) {
  2910. return function (e, n) {
  2911. return e.disabled = t.attributes[n] === !1, t.attributes[n] || t.dialogIsVisible(n) ? (e.setAttribute("data-trix-active", ""), e.classList.add("trix-active")) : (e.removeAttribute("data-trix-active"), e.classList.remove("trix-active"))
  2912. }
  2913. }(this))
  2914. }, s.prototype.eachAttributeButton = function (t) {
  2915. var e, n, i, o, r;
  2916. for (o = this.element.querySelectorAll(c), r = [], n = 0, i = o.length; i > n; n++) e = o[n], r.push(t(e, f(e)));
  2917. return r
  2918. }, s.prototype.applyKeyboardCommand = function (t) {
  2919. var e, n, o, r, s, a, u;
  2920. for (s = JSON.stringify(t.sort()), u = this.element.querySelectorAll("[data-trix-key]"), r = 0, a = u.length; a > r; r++) if (e = u[r], o = e.getAttribute("data-trix-key").split("+"), n = JSON.stringify(o.sort()), n === s) return i("mousedown", {onElement: e}), !0;
  2921. return !1
  2922. }, s.prototype.dialogIsVisible = function (t) {
  2923. var e;
  2924. return (e = this.getDialog(t)) ? e.hasAttribute("data-trix-active") : void 0
  2925. }, s.prototype.toggleDialog = function (t) {
  2926. return this.dialogIsVisible(t) ? this.hideDialog() : this.showDialog(t)
  2927. }, s.prototype.showDialog = function (t) {
  2928. var e, n, i, o, r, s, a, u, c, l;
  2929. for (this.hideDialog(), null != (a = this.delegate) && a.toolbarWillShowDialog(), i = this.getDialog(t), i.setAttribute("data-trix-active", ""), i.classList.add("trix-active"), u = i.querySelectorAll("input[disabled]"), o = 0, s = u.length; s > o; o++) n = u[o], n.removeAttribute("disabled");
  2930. return (e = f(i)) && (r = m(i, t)) && (r.value = null != (c = this.attributes[e]) ? c : "", r.select()), null != (l = this.delegate) ? l.toolbarDidShowDialog(t) : void 0
  2931. }, s.prototype.setAttribute = function (t) {
  2932. var e, n, i;
  2933. return e = f(t), n = m(t, e), n.willValidate && !n.checkValidity() ? (n.setAttribute("data-trix-validate", ""), n.classList.add("trix-validate"), n.focus()) : (null != (i = this.delegate) && i.toolbarDidUpdateAttribute(e, n.value), this.hideDialog())
  2934. }, s.prototype.removeAttribute = function (t) {
  2935. var e, n;
  2936. return e = f(t), null != (n = this.delegate) && n.toolbarDidRemoveAttribute(e), this.hideDialog()
  2937. }, s.prototype.hideDialog = function () {
  2938. var t, e;
  2939. return (t = this.element.querySelector(u)) ? (t.removeAttribute("data-trix-active"), t.classList.remove("trix-active"), this.resetDialogInputs(), null != (e = this.delegate) ? e.toolbarDidHideDialog(g(t)) : void 0) : void 0
  2940. }, s.prototype.resetDialogInputs = function () {
  2941. var t, e, n, i, o;
  2942. for (i = this.element.querySelectorAll(h), o = [], t = 0, n = i.length; n > t; t++) e = i[t], e.setAttribute("disabled", "disabled"), e.removeAttribute("data-trix-validate"), o.push(e.classList.remove("trix-validate"));
  2943. return o
  2944. }, s.prototype.getDialog = function (t) {
  2945. return this.element.querySelector("[data-trix-dialog=" + t + "]")
  2946. }, m = function (t, e) {
  2947. return null == e && (e = f(t)), t.querySelector("[data-trix-input][name='" + e + "']")
  2948. }, d = function (t) {
  2949. return t.getAttribute("data-trix-action")
  2950. }, f = function (t) {
  2951. var e;
  2952. return null != (e = t.getAttribute("data-trix-attribute")) ? e : t.getAttribute("data-trix-dialog-attribute")
  2953. }, g = function (t) {
  2954. return t.getAttribute("data-trix-dialog")
  2955. }, s
  2956. }(e.BasicObject)
  2957. }.call(this), function () {
  2958. var t = function (t, e) {
  2959. function i() {
  2960. this.constructor = t
  2961. }
  2962. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  2963. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  2964. }, n = {}.hasOwnProperty;
  2965. e.ImagePreloadOperation = function (e) {
  2966. function n(t) {
  2967. this.url = t
  2968. }
  2969. return t(n, e), n.prototype.perform = function (t) {
  2970. var e;
  2971. return e = new Image, e.onload = function (n) {
  2972. return function () {
  2973. return e.width = n.width = e.naturalWidth, e.height = n.height = e.naturalHeight, t(!0, e)
  2974. }
  2975. }(this), e.onerror = function () {
  2976. return t(!1)
  2977. }, e.src = this.url
  2978. }, n
  2979. }(e.Operation)
  2980. }.call(this), function () {
  2981. var t = function (t, e) {
  2982. return function () {
  2983. return t.apply(e, arguments)
  2984. }
  2985. }, n = function (t, e) {
  2986. function n() {
  2987. this.constructor = t
  2988. }
  2989. for (var o in e) i.call(e, o) && (t[o] = e[o]);
  2990. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  2991. }, i = {}.hasOwnProperty;
  2992. e.Attachment = function (i) {
  2993. function o(n) {
  2994. null == n && (n = {}), this.releaseFile = t(this.releaseFile, this), o.__super__.constructor.apply(this, arguments), this.attributes = e.Hash.box(n), this.didChangeAttributes()
  2995. }
  2996. return n(o, i), o.previewablePattern = /^image(\/(gif|png|jpe?g)|$)/, o.attachmentForFile = function (t) {
  2997. var e, n;
  2998. return n = this.attributesForFile(t), e = new this(n), e.setFile(t), e
  2999. }, o.attributesForFile = function (t) {
  3000. return new e.Hash({filename: t.name, filesize: t.size, contentType: t.type})
  3001. }, o.fromJSON = function (t) {
  3002. return new this(t)
  3003. }, o.prototype.getAttribute = function (t) {
  3004. return this.attributes.get(t)
  3005. }, o.prototype.hasAttribute = function (t) {
  3006. return this.attributes.has(t)
  3007. }, o.prototype.getAttributes = function () {
  3008. return this.attributes.toObject()
  3009. }, o.prototype.setAttributes = function (t) {
  3010. var e, n, i;
  3011. return null == t && (t = {}), e = this.attributes.merge(t), this.attributes.isEqualTo(e) ? void 0 : (this.attributes = e, this.didChangeAttributes(), null != (n = this.previewDelegate) && "function" == typeof n.attachmentDidChangeAttributes && n.attachmentDidChangeAttributes(this), null != (i = this.delegate) && "function" == typeof i.attachmentDidChangeAttributes ? i.attachmentDidChangeAttributes(this) : void 0)
  3012. }, o.prototype.didChangeAttributes = function () {
  3013. return this.isPreviewable() ? this.preloadURL() : void 0
  3014. }, o.prototype.isPending = function () {
  3015. return null != this.file && !(this.getURL() || this.getHref())
  3016. }, o.prototype.isPreviewable = function () {
  3017. return this.attributes.has("previewable") ? this.attributes.get("previewable") : this.constructor.previewablePattern.test(this.getContentType())
  3018. }, o.prototype.getType = function () {
  3019. return this.hasContent() ? "content" : this.isPreviewable() ? "preview" : "file"
  3020. }, o.prototype.getURL = function () {
  3021. return this.attributes.get("url")
  3022. }, o.prototype.getHref = function () {
  3023. return this.attributes.get("href")
  3024. }, o.prototype.getFilename = function () {
  3025. var t;
  3026. return null != (t = this.attributes.get("filename")) ? t : ""
  3027. }, o.prototype.getFilesize = function () {
  3028. return this.attributes.get("filesize")
  3029. }, o.prototype.getFormattedFilesize = function () {
  3030. var t;
  3031. return t = this.attributes.get("filesize"), "number" == typeof t ? e.config.fileSize.formatter(t) : ""
  3032. }, o.prototype.getExtension = function () {
  3033. var t;
  3034. return null != (t = this.getFilename().match(/\.(\w+)$/)) ? t[1].toLowerCase() : void 0
  3035. }, o.prototype.getContentType = function () {
  3036. return this.attributes.get("contentType")
  3037. }, o.prototype.hasContent = function () {
  3038. return this.attributes.has("content")
  3039. }, o.prototype.getContent = function () {
  3040. return this.attributes.get("content")
  3041. }, o.prototype.getWidth = function () {
  3042. return this.attributes.get("width")
  3043. }, o.prototype.getHeight = function () {
  3044. return this.attributes.get("height")
  3045. }, o.prototype.getFile = function () {
  3046. return this.file
  3047. }, o.prototype.setFile = function (t) {
  3048. return this.file = t, this.isPreviewable() ? this.preloadFile() : void 0
  3049. }, o.prototype.releaseFile = function () {
  3050. return this.releasePreloadedFile(), this.file = null
  3051. }, o.prototype.getUploadProgress = function () {
  3052. var t;
  3053. return null != (t = this.uploadProgress) ? t : 0
  3054. }, o.prototype.setUploadProgress = function (t) {
  3055. var e;
  3056. return this.uploadProgress !== t ? (this.uploadProgress = t, null != (e = this.uploadProgressDelegate) && "function" == typeof e.attachmentDidChangeUploadProgress ? e.attachmentDidChangeUploadProgress(this) : void 0) : void 0
  3057. }, o.prototype.toJSON = function () {
  3058. return this.getAttributes()
  3059. }, o.prototype.getCacheKey = function () {
  3060. return [o.__super__.getCacheKey.apply(this, arguments), this.attributes.getCacheKey(), this.getPreviewURL()].join("/")
  3061. }, o.prototype.getPreviewURL = function () {
  3062. return this.previewURL || this.preloadingURL
  3063. }, o.prototype.setPreviewURL = function (t) {
  3064. var e, n;
  3065. return t !== this.getPreviewURL() ? (this.previewURL = t, null != (e = this.previewDelegate) && "function" == typeof e.attachmentDidChangeAttributes && e.attachmentDidChangeAttributes(this), null != (n = this.delegate) && "function" == typeof n.attachmentDidChangePreviewURL ? n.attachmentDidChangePreviewURL(this) : void 0) : void 0
  3066. }, o.prototype.preloadURL = function () {
  3067. return this.preload(this.getURL(), this.releaseFile)
  3068. }, o.prototype.preloadFile = function () {
  3069. return this.file ? (this.fileObjectURL = URL.createObjectURL(this.file), this.preload(this.fileObjectURL)) : void 0
  3070. }, o.prototype.releasePreloadedFile = function () {
  3071. return this.fileObjectURL ? (URL.revokeObjectURL(this.fileObjectURL), this.fileObjectURL = null) : void 0
  3072. }, o.prototype.preload = function (t, n) {
  3073. var i;
  3074. return t && t !== this.getPreviewURL() ? (this.preloadingURL = t, i = new e.ImagePreloadOperation(t), i.then(function (e) {
  3075. return function (i) {
  3076. var o, r;
  3077. return r = i.width, o = i.height, e.setAttributes({
  3078. width: r,
  3079. height: o
  3080. }), e.preloadingURL = null, e.setPreviewURL(t), "function" == typeof n ? n() : void 0
  3081. }
  3082. }(this))) : void 0
  3083. }, o
  3084. }(e.Object)
  3085. }.call(this), function () {
  3086. var t = function (t, e) {
  3087. function i() {
  3088. this.constructor = t
  3089. }
  3090. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  3091. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  3092. }, n = {}.hasOwnProperty;
  3093. e.Piece = function (n) {
  3094. function i(t, n) {
  3095. null == n && (n = {}), i.__super__.constructor.apply(this, arguments), this.attributes = e.Hash.box(n)
  3096. }
  3097. return t(i, n), i.types = {}, i.registerType = function (t, e) {
  3098. return e.type = t, this.types[t] = e
  3099. }, i.fromJSON = function (t) {
  3100. var e;
  3101. return (e = this.types[t.type]) ? e.fromJSON(t) : void 0
  3102. }, i.prototype.copyWithAttributes = function (t) {
  3103. return new this.constructor(this.getValue(), t)
  3104. }, i.prototype.copyWithAdditionalAttributes = function (t) {
  3105. return this.copyWithAttributes(this.attributes.merge(t))
  3106. }, i.prototype.copyWithoutAttribute = function (t) {
  3107. return this.copyWithAttributes(this.attributes.remove(t))
  3108. }, i.prototype.copy = function () {
  3109. return this.copyWithAttributes(this.attributes)
  3110. }, i.prototype.getAttribute = function (t) {
  3111. return this.attributes.get(t)
  3112. }, i.prototype.getAttributesHash = function () {
  3113. return this.attributes
  3114. }, i.prototype.getAttributes = function () {
  3115. return this.attributes.toObject()
  3116. }, i.prototype.getCommonAttributes = function () {
  3117. var t, e, n;
  3118. return (n = pieceList.getPieceAtIndex(0)) ? (t = n.attributes, e = t.getKeys(), pieceList.eachPiece(function (n) {
  3119. return e = t.getKeysCommonToHash(n.attributes), t = t.slice(e)
  3120. }), t.toObject()) : {}
  3121. }, i.prototype.hasAttribute = function (t) {
  3122. return this.attributes.has(t)
  3123. }, i.prototype.hasSameStringValueAsPiece = function (t) {
  3124. return null != t && this.toString() === t.toString()
  3125. }, i.prototype.hasSameAttributesAsPiece = function (t) {
  3126. return null != t && (this.attributes === t.attributes || this.attributes.isEqualTo(t.attributes))
  3127. }, i.prototype.isBlockBreak = function () {
  3128. return !1
  3129. }, i.prototype.isEqualTo = function (t) {
  3130. return i.__super__.isEqualTo.apply(this, arguments) || this.hasSameConstructorAs(t) && this.hasSameStringValueAsPiece(t) && this.hasSameAttributesAsPiece(t)
  3131. }, i.prototype.isEmpty = function () {
  3132. return 0 === this.length
  3133. }, i.prototype.isSerializable = function () {
  3134. return !0
  3135. }, i.prototype.toJSON = function () {
  3136. return {type: this.constructor.type, attributes: this.getAttributes()}
  3137. }, i.prototype.contentsForInspection = function () {
  3138. return {type: this.constructor.type, attributes: this.attributes.inspect()}
  3139. }, i.prototype.canBeGrouped = function () {
  3140. return this.hasAttribute("href")
  3141. }, i.prototype.canBeGroupedWith = function (t) {
  3142. return this.getAttribute("href") === t.getAttribute("href")
  3143. }, i.prototype.getLength = function () {
  3144. return this.length
  3145. }, i.prototype.canBeConsolidatedWith = function () {
  3146. return !1
  3147. }, i
  3148. }(e.Object)
  3149. }.call(this), function () {
  3150. var t = function (t, e) {
  3151. function i() {
  3152. this.constructor = t
  3153. }
  3154. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  3155. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  3156. }, n = {}.hasOwnProperty;
  3157. e.Piece.registerType("attachment", e.AttachmentPiece = function (n) {
  3158. function i(t) {
  3159. this.attachment = t, i.__super__.constructor.apply(this, arguments), this.length = 1, this.ensureAttachmentExclusivelyHasAttribute("href"), this.attachment.hasContent() || this.removeProhibitedAttributes()
  3160. }
  3161. return t(i, n), i.fromJSON = function (t) {
  3162. return new this(e.Attachment.fromJSON(t.attachment), t.attributes)
  3163. }, i.permittedAttributes = ["caption", "presentation"], i.prototype.ensureAttachmentExclusivelyHasAttribute = function (t) {
  3164. return this.hasAttribute(t) ? (this.attachment.hasAttribute(t) || this.attachment.setAttributes(this.attributes.slice(t)), this.attributes = this.attributes.remove(t)) : void 0
  3165. }, i.prototype.removeProhibitedAttributes = function () {
  3166. var t;
  3167. return t = this.attributes.slice(this.constructor.permittedAttributes), t.isEqualTo(this.attributes) ? void 0 : this.attributes = t
  3168. }, i.prototype.getValue = function () {
  3169. return this.attachment
  3170. }, i.prototype.isSerializable = function () {
  3171. return !this.attachment.isPending()
  3172. }, i.prototype.getCaption = function () {
  3173. var t;
  3174. return null != (t = this.attributes.get("caption")) ? t : ""
  3175. }, i.prototype.isEqualTo = function (t) {
  3176. var e;
  3177. return i.__super__.isEqualTo.apply(this, arguments) && this.attachment.id === (null != t && null != (e = t.attachment) ? e.id : void 0)
  3178. }, i.prototype.toString = function () {
  3179. return e.OBJECT_REPLACEMENT_CHARACTER
  3180. }, i.prototype.toJSON = function () {
  3181. var t;
  3182. return t = i.__super__.toJSON.apply(this, arguments), t.attachment = this.attachment, t
  3183. }, i.prototype.getCacheKey = function () {
  3184. return [i.__super__.getCacheKey.apply(this, arguments), this.attachment.getCacheKey()].join("/")
  3185. }, i.prototype.toConsole = function () {
  3186. return JSON.stringify(this.toString())
  3187. }, i
  3188. }(e.Piece))
  3189. }.call(this), function () {
  3190. var t, n = function (t, e) {
  3191. function n() {
  3192. this.constructor = t
  3193. }
  3194. for (var o in e) i.call(e, o) && (t[o] = e[o]);
  3195. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  3196. }, i = {}.hasOwnProperty;
  3197. t = e.normalizeNewlines, e.Piece.registerType("string", e.StringPiece = function (e) {
  3198. function i(e) {
  3199. i.__super__.constructor.apply(this, arguments), this.string = t(e), this.length = this.string.length
  3200. }
  3201. return n(i, e), i.fromJSON = function (t) {
  3202. return new this(t.string, t.attributes)
  3203. }, i.prototype.getValue = function () {
  3204. return this.string
  3205. }, i.prototype.toString = function () {
  3206. return this.string.toString()
  3207. }, i.prototype.isBlockBreak = function () {
  3208. return "\n" === this.toString() && this.getAttribute("blockBreak") === !0
  3209. }, i.prototype.toJSON = function () {
  3210. var t;
  3211. return t = i.__super__.toJSON.apply(this, arguments), t.string = this.string, t
  3212. }, i.prototype.canBeConsolidatedWith = function (t) {
  3213. return null != t && this.hasSameConstructorAs(t) && this.hasSameAttributesAsPiece(t)
  3214. }, i.prototype.consolidateWith = function (t) {
  3215. return new this.constructor(this.toString() + t.toString(), this.attributes)
  3216. }, i.prototype.splitAtOffset = function (t) {
  3217. var e, n;
  3218. return 0 === t ? (e = null, n = this) : t === this.length ? (e = this, n = null) : (e = new this.constructor(this.string.slice(0, t), this.attributes), n = new this.constructor(this.string.slice(t), this.attributes)), [e, n]
  3219. }, i.prototype.toConsole = function () {
  3220. var t;
  3221. return t = this.string, t.length > 15 && (t = t.slice(0, 14) + "\u2026"), JSON.stringify(t.toString())
  3222. }, i
  3223. }(e.Piece))
  3224. }.call(this), function () {
  3225. var t, n = function (t, e) {
  3226. function n() {
  3227. this.constructor = t
  3228. }
  3229. for (var o in e) i.call(e, o) && (t[o] = e[o]);
  3230. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  3231. }, i = {}.hasOwnProperty, o = [].slice;
  3232. t = e.spliceArray, e.SplittableList = function (e) {
  3233. function i(t) {
  3234. null == t && (t = []), i.__super__.constructor.apply(this, arguments), this.objects = t.slice(0), this.length = this.objects.length
  3235. }
  3236. var r, s, a;
  3237. return n(i, e), i.box = function (t) {
  3238. return t instanceof this ? t : new this(t)
  3239. }, i.prototype.indexOf = function (t) {
  3240. return this.objects.indexOf(t)
  3241. }, i.prototype.splice = function () {
  3242. var e;
  3243. return e = 1 <= arguments.length ? o.call(arguments, 0) : [], new this.constructor(t.apply(null, [this.objects].concat(o.call(e))))
  3244. }, i.prototype.eachObject = function (t) {
  3245. var e, n, i, o, r, s;
  3246. for (r = this.objects, s = [], n = e = 0, i = r.length; i > e; n = ++e) o = r[n], s.push(t(o, n));
  3247. return s
  3248. }, i.prototype.insertObjectAtIndex = function (t, e) {
  3249. return this.splice(e, 0, t)
  3250. }, i.prototype.insertSplittableListAtIndex = function (t, e) {
  3251. return this.splice.apply(this, [e, 0].concat(o.call(t.objects)))
  3252. }, i.prototype.insertSplittableListAtPosition = function (t, e) {
  3253. var n, i, o;
  3254. return o = this.splitObjectAtPosition(e), i = o[0], n = o[1], new this.constructor(i).insertSplittableListAtIndex(t, n)
  3255. }, i.prototype.editObjectAtIndex = function (t, e) {
  3256. return this.replaceObjectAtIndex(e(this.objects[t]), t)
  3257. }, i.prototype.replaceObjectAtIndex = function (t, e) {
  3258. return this.splice(e, 1, t)
  3259. }, i.prototype.removeObjectAtIndex = function (t) {
  3260. return this.splice(t, 1)
  3261. }, i.prototype.getObjectAtIndex = function (t) {
  3262. return this.objects[t]
  3263. }, i.prototype.getSplittableListInRange = function (t) {
  3264. var e, n, i, o;
  3265. return i = this.splitObjectsAtRange(t), n = i[0], e = i[1], o = i[2], new this.constructor(n.slice(e, o + 1))
  3266. }, i.prototype.selectSplittableList = function (t) {
  3267. var e, n;
  3268. return n = function () {
  3269. var n, i, o, r;
  3270. for (o = this.objects, r = [], n = 0, i = o.length; i > n; n++) e = o[n], t(e) && r.push(e);
  3271. return r
  3272. }.call(this), new this.constructor(n)
  3273. }, i.prototype.removeObjectsInRange = function (t) {
  3274. var e, n, i, o;
  3275. return i = this.splitObjectsAtRange(t), n = i[0], e = i[1], o = i[2], new this.constructor(n).splice(e, o - e + 1)
  3276. }, i.prototype.transformObjectsInRange = function (t, e) {
  3277. var n, i, o, r, s, a, u;
  3278. return s = this.splitObjectsAtRange(t), r = s[0], i = s[1], a = s[2], u = function () {
  3279. var t, s, u;
  3280. for (u = [], n = t = 0, s = r.length; s > t; n = ++t) o = r[n], u.push(n >= i && a >= n ? e(o) : o);
  3281. return u
  3282. }(), new this.constructor(u)
  3283. }, i.prototype.splitObjectsAtRange = function (t) {
  3284. var e, n, i, o, s, u;
  3285. return o = this.splitObjectAtPosition(a(t)), n = o[0], e = o[1], i = o[2], s = new this.constructor(n).splitObjectAtPosition(r(t) + i), n = s[0], u = s[1], [n, e, u - 1]
  3286. }, i.prototype.getObjectAtPosition = function (t) {
  3287. var e, n, i;
  3288. return i = this.findIndexAndOffsetAtPosition(t), e = i.index, n = i.offset, this.objects[e]
  3289. }, i.prototype.splitObjectAtPosition = function (t) {
  3290. var e, n, i, o, r, s, a, u, c, l;
  3291. return s = this.findIndexAndOffsetAtPosition(t), e = s.index, r = s.offset, o = this.objects.slice(0), null != e ? 0 === r ? (c = e, l = 0) : (i = this.getObjectAtIndex(e), a = i.splitAtOffset(r), n = a[0], u = a[1], o.splice(e, 1, n, u), c = e + 1, l = n.getLength() - r) : (c = o.length, l = 0), [o, c, l]
  3292. }, i.prototype.consolidate = function () {
  3293. var t, e, n, i, o, r;
  3294. for (i = [], o = this.objects[0], r = this.objects.slice(1), t = 0, e = r.length; e > t; t++) n = r[t], ("function" == typeof o.canBeConsolidatedWith ? o.canBeConsolidatedWith(n) : void 0) ? o = o.consolidateWith(n) : (i.push(o), o = n);
  3295. return null != o && i.push(o), new this.constructor(i)
  3296. }, i.prototype.consolidateFromIndexToIndex = function (t, e) {
  3297. var n, i, r;
  3298. return i = this.objects.slice(0), r = i.slice(t, e + 1), n = new this.constructor(r).consolidate().toArray(), this.splice.apply(this, [t, r.length].concat(o.call(n)))
  3299. }, i.prototype.findIndexAndOffsetAtPosition = function (t) {
  3300. var e, n, i, o, r, s, a;
  3301. for (e = 0, a = this.objects, i = n = 0, o = a.length; o > n; i = ++n) {
  3302. if (s = a[i], r = e + s.getLength(), t >= e && r > t) return {index: i, offset: t - e};
  3303. e = r
  3304. }
  3305. return {index: null, offset: null}
  3306. }, i.prototype.findPositionAtIndexAndOffset = function (t, e) {
  3307. var n, i, o, r, s, a;
  3308. for (s = 0, a = this.objects, n = i = 0, o = a.length; o > i; n = ++i) if (r = a[n], t > n) s += r.getLength(); else if (n === t) {
  3309. s += e;
  3310. break
  3311. }
  3312. return s
  3313. }, i.prototype.getEndPosition = function () {
  3314. var t, e;
  3315. return null != this.endPosition ? this.endPosition : this.endPosition = function () {
  3316. var n, i, o;
  3317. for (e = 0, o = this.objects, n = 0, i = o.length; i > n; n++) t = o[n], e += t.getLength();
  3318. return e
  3319. }.call(this)
  3320. }, i.prototype.toString = function () {
  3321. return this.objects.join("")
  3322. }, i.prototype.toArray = function () {
  3323. return this.objects.slice(0)
  3324. }, i.prototype.toJSON = function () {
  3325. return this.toArray()
  3326. }, i.prototype.isEqualTo = function (t) {
  3327. return i.__super__.isEqualTo.apply(this, arguments) || s(this.objects, null != t ? t.objects : void 0)
  3328. }, s = function (t, e) {
  3329. var n, i, o, r, s;
  3330. if (null == e && (e = []), t.length !== e.length) return !1;
  3331. for (s = !0, i = n = 0, o = t.length; o > n; i = ++n) r = t[i], s && !r.isEqualTo(e[i]) && (s = !1);
  3332. return s
  3333. }, i.prototype.contentsForInspection = function () {
  3334. var t;
  3335. return {
  3336. objects: "[" + function () {
  3337. var e, n, i, o;
  3338. for (i = this.objects, o = [], e = 0, n = i.length; n > e; e++) t = i[e], o.push(t.inspect());
  3339. return o
  3340. }.call(this).join(", ") + "]"
  3341. }
  3342. }, a = function (t) {
  3343. return t[0]
  3344. }, r = function (t) {
  3345. return t[1]
  3346. }, i
  3347. }(e.Object)
  3348. }.call(this), function () {
  3349. var t = function (t, e) {
  3350. function i() {
  3351. this.constructor = t
  3352. }
  3353. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  3354. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  3355. }, n = {}.hasOwnProperty;
  3356. e.Text = function (n) {
  3357. function i(t) {
  3358. var n;
  3359. null == t && (t = []), i.__super__.constructor.apply(this, arguments), this.pieceList = new e.SplittableList(function () {
  3360. var e, i, o;
  3361. for (o = [], e = 0, i = t.length; i > e; e++) n = t[e], n.isEmpty() || o.push(n);
  3362. return o
  3363. }())
  3364. }
  3365. return t(i, n), i.textForAttachmentWithAttributes = function (t, n) {
  3366. var i;
  3367. return i = new e.AttachmentPiece(t, n), new this([i])
  3368. }, i.textForStringWithAttributes = function (t, n) {
  3369. var i;
  3370. return i = new e.StringPiece(t, n), new this([i])
  3371. }, i.fromJSON = function (t) {
  3372. var n, i;
  3373. return i = function () {
  3374. var i, o, r;
  3375. for (r = [], i = 0, o = t.length; o > i; i++) n = t[i], r.push(e.Piece.fromJSON(n));
  3376. return r
  3377. }(), new this(i)
  3378. }, i.prototype.copy = function () {
  3379. return this.copyWithPieceList(this.pieceList)
  3380. }, i.prototype.copyWithPieceList = function (t) {
  3381. return new this.constructor(t.consolidate().toArray())
  3382. }, i.prototype.copyUsingObjectMap = function (t) {
  3383. var e, n;
  3384. return n = function () {
  3385. var n, i, o, r, s;
  3386. for (o = this.getPieces(), s = [], n = 0, i = o.length; i > n; n++) e = o[n], s.push(null != (r = t.find(e)) ? r : e);
  3387. return s
  3388. }.call(this), new this.constructor(n)
  3389. }, i.prototype.appendText = function (t) {
  3390. return this.insertTextAtPosition(t, this.getLength())
  3391. }, i.prototype.insertTextAtPosition = function (t, e) {
  3392. return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(t.pieceList, e))
  3393. }, i.prototype.removeTextAtRange = function (t) {
  3394. return this.copyWithPieceList(this.pieceList.removeObjectsInRange(t))
  3395. }, i.prototype.replaceTextAtRange = function (t, e) {
  3396. return this.removeTextAtRange(e).insertTextAtPosition(t, e[0])
  3397. }, i.prototype.moveTextFromRangeToPosition = function (t, e) {
  3398. var n, i;
  3399. if (!(t[0] <= e && e <= t[1])) return i = this.getTextAtRange(t), n = i.getLength(), t[0] < e && (e -= n), this.removeTextAtRange(t).insertTextAtPosition(i, e)
  3400. }, i.prototype.addAttributeAtRange = function (t, e, n) {
  3401. var i;
  3402. return i = {}, i[t] = e, this.addAttributesAtRange(i, n)
  3403. }, i.prototype.addAttributesAtRange = function (t, e) {
  3404. return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e, function (e) {
  3405. return e.copyWithAdditionalAttributes(t)
  3406. }))
  3407. }, i.prototype.removeAttributeAtRange = function (t, e) {
  3408. return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e, function (e) {
  3409. return e.copyWithoutAttribute(t)
  3410. }))
  3411. }, i.prototype.setAttributesAtRange = function (t, e) {
  3412. return this.copyWithPieceList(this.pieceList.transformObjectsInRange(e, function (e) {
  3413. return e.copyWithAttributes(t)
  3414. }))
  3415. }, i.prototype.getAttributesAtPosition = function (t) {
  3416. var e, n;
  3417. return null != (e = null != (n = this.pieceList.getObjectAtPosition(t)) ? n.getAttributes() : void 0) ? e : {}
  3418. }, i.prototype.getCommonAttributes = function () {
  3419. var t, n;
  3420. return t = function () {
  3421. var t, e, i, o;
  3422. for (i = this.pieceList.toArray(), o = [], t = 0, e = i.length; e > t; t++) n = i[t], o.push(n.getAttributes());
  3423. return o
  3424. }.call(this), e.Hash.fromCommonAttributesOfObjects(t).toObject()
  3425. }, i.prototype.getCommonAttributesAtRange = function (t) {
  3426. var e;
  3427. return null != (e = this.getTextAtRange(t).getCommonAttributes()) ? e : {}
  3428. }, i.prototype.getExpandedRangeForAttributeAtOffset = function (t, e) {
  3429. var n, i, o;
  3430. for (n = o = e, i = this.getLength(); n > 0 && this.getCommonAttributesAtRange([n - 1, o])[t];) n--;
  3431. for (; i > o && this.getCommonAttributesAtRange([e, o + 1])[t];) o++;
  3432. return [n, o]
  3433. }, i.prototype.getTextAtRange = function (t) {
  3434. return this.copyWithPieceList(this.pieceList.getSplittableListInRange(t))
  3435. }, i.prototype.getStringAtRange = function (t) {
  3436. return this.pieceList.getSplittableListInRange(t).toString()
  3437. }, i.prototype.getStringAtPosition = function (t) {
  3438. return this.getStringAtRange([t, t + 1])
  3439. }, i.prototype.startsWithString = function (t) {
  3440. return this.getStringAtRange([0, t.length]) === t
  3441. }, i.prototype.endsWithString = function (t) {
  3442. var e;
  3443. return e = this.getLength(), this.getStringAtRange([e - t.length, e]) === t
  3444. }, i.prototype.getAttachmentPieces = function () {
  3445. var t, e, n, i, o;
  3446. for (i = this.pieceList.toArray(), o = [], t = 0, e = i.length; e > t; t++) n = i[t], null != n.attachment && o.push(n);
  3447. return o
  3448. }, i.prototype.getAttachments = function () {
  3449. var t, e, n, i, o;
  3450. for (i = this.getAttachmentPieces(), o = [], t = 0, e = i.length; e > t; t++) n = i[t], o.push(n.attachment);
  3451. return o
  3452. }, i.prototype.getAttachmentAndPositionById = function (t) {
  3453. var e, n, i, o, r, s;
  3454. for (o = 0, r = this.pieceList.toArray(), e = 0, n = r.length; n > e; e++) {
  3455. if (i = r[e], (null != (s = i.attachment) ? s.id : void 0) === t) return {
  3456. attachment: i.attachment,
  3457. position: o
  3458. };
  3459. o += i.length
  3460. }
  3461. return {attachment: null, position: null}
  3462. }, i.prototype.getAttachmentById = function (t) {
  3463. var e, n, i;
  3464. return i = this.getAttachmentAndPositionById(t), e = i.attachment, n = i.position, e
  3465. }, i.prototype.getRangeOfAttachment = function (t) {
  3466. var e, n;
  3467. return n = this.getAttachmentAndPositionById(t.id), t = n.attachment, e = n.position, null != t ? [e, e + 1] : void 0
  3468. }, i.prototype.updateAttributesForAttachment = function (t, e) {
  3469. var n;
  3470. return (n = this.getRangeOfAttachment(e)) ? this.addAttributesAtRange(t, n) : this
  3471. }, i.prototype.getLength = function () {
  3472. return this.pieceList.getEndPosition()
  3473. }, i.prototype.isEmpty = function () {
  3474. return 0 === this.getLength()
  3475. }, i.prototype.isEqualTo = function (t) {
  3476. var e;
  3477. return i.__super__.isEqualTo.apply(this, arguments) || (null != t && null != (e = t.pieceList) ? e.isEqualTo(this.pieceList) : void 0)
  3478. }, i.prototype.isBlockBreak = function () {
  3479. return 1 === this.getLength() && this.pieceList.getObjectAtIndex(0).isBlockBreak()
  3480. }, i.prototype.eachPiece = function (t) {
  3481. return this.pieceList.eachObject(t)
  3482. }, i.prototype.getPieces = function () {
  3483. return this.pieceList.toArray()
  3484. }, i.prototype.getPieceAtPosition = function (t) {
  3485. return this.pieceList.getObjectAtPosition(t)
  3486. }, i.prototype.contentsForInspection = function () {
  3487. return {pieceList: this.pieceList.inspect()}
  3488. }, i.prototype.toSerializableText = function () {
  3489. var t;
  3490. return t = this.pieceList.selectSplittableList(function (t) {
  3491. return t.isSerializable()
  3492. }), this.copyWithPieceList(t)
  3493. }, i.prototype.toString = function () {
  3494. return this.pieceList.toString()
  3495. }, i.prototype.toJSON = function () {
  3496. return this.pieceList.toJSON()
  3497. }, i.prototype.toConsole = function () {
  3498. var t;
  3499. return JSON.stringify(function () {
  3500. var e, n, i, o;
  3501. for (i = this.pieceList.toArray(), o = [], e = 0, n = i.length; n > e; e++) t = i[e], o.push(JSON.parse(t.toConsole()));
  3502. return o
  3503. }.call(this))
  3504. }, i
  3505. }(e.Object)
  3506. }.call(this), function () {
  3507. var t, n, i, o, r, s = function (t, e) {
  3508. function n() {
  3509. this.constructor = t
  3510. }
  3511. for (var i in e) a.call(e, i) && (t[i] = e[i]);
  3512. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  3513. }, a = {}.hasOwnProperty, u = [].indexOf || function (t) {
  3514. for (var e = 0, n = this.length; n > e; e++) if (e in this && this[e] === t) return e;
  3515. return -1
  3516. }, c = [].slice;
  3517. t = e.arraysAreEqual, r = e.spliceArray, i = e.getBlockConfig, n = e.getBlockAttributeNames, o = e.getListAttributeNames, e.Block = function (n) {
  3518. function a(t, n) {
  3519. null == t && (t = new e.Text), null == n && (n = []), a.__super__.constructor.apply(this, arguments), this.text = h(t), this.attributes = n
  3520. }
  3521. var l, h, p, d, f, g, m, v, y;
  3522. return s(a, n), a.fromJSON = function (t) {
  3523. var n;
  3524. return n = e.Text.fromJSON(t.text), new this(n, t.attributes)
  3525. }, a.prototype.isEmpty = function () {
  3526. return this.text.isBlockBreak()
  3527. }, a.prototype.isEqualTo = function (e) {
  3528. return a.__super__.isEqualTo.apply(this, arguments) || this.text.isEqualTo(null != e ? e.text : void 0) && t(this.attributes, null != e ? e.attributes : void 0)
  3529. }, a.prototype.copyWithText = function (t) {
  3530. return new this.constructor(t, this.attributes)
  3531. }, a.prototype.copyWithoutText = function () {
  3532. return this.copyWithText(null)
  3533. }, a.prototype.copyWithAttributes = function (t) {
  3534. return new this.constructor(this.text, t)
  3535. }, a.prototype.copyWithoutAttributes = function () {
  3536. return this.copyWithAttributes(null)
  3537. }, a.prototype.copyUsingObjectMap = function (t) {
  3538. var e;
  3539. return this.copyWithText((e = t.find(this.text)) ? e : this.text.copyUsingObjectMap(t))
  3540. }, a.prototype.addAttribute = function (t) {
  3541. var e;
  3542. return e = this.attributes.concat(d(t)), this.copyWithAttributes(e)
  3543. }, a.prototype.removeAttribute = function (t) {
  3544. var e, n;
  3545. return n = i(t).listAttribute, e = g(g(this.attributes, t), n), this.copyWithAttributes(e)
  3546. }, a.prototype.removeLastAttribute = function () {
  3547. return this.removeAttribute(this.getLastAttribute())
  3548. }, a.prototype.getLastAttribute = function () {
  3549. return f(this.attributes)
  3550. }, a.prototype.getAttributes = function () {
  3551. return this.attributes.slice(0)
  3552. }, a.prototype.getAttributeLevel = function () {
  3553. return this.attributes.length
  3554. }, a.prototype.getAttributeAtLevel = function (t) {
  3555. return this.attributes[t - 1]
  3556. }, a.prototype.hasAttribute = function (t) {
  3557. return u.call(this.attributes, t) >= 0
  3558. }, a.prototype.hasAttributes = function () {
  3559. return this.getAttributeLevel() > 0
  3560. }, a.prototype.getLastNestableAttribute = function () {
  3561. return f(this.getNestableAttributes())
  3562. }, a.prototype.getNestableAttributes = function () {
  3563. var t, e, n, o, r;
  3564. for (o = this.attributes, r = [], e = 0, n = o.length; n > e; e++) t = o[e], i(t).nestable && r.push(t);
  3565. return r
  3566. }, a.prototype.getNestingLevel = function () {
  3567. return this.getNestableAttributes().length
  3568. }, a.prototype.decreaseNestingLevel = function () {
  3569. var t;
  3570. return (t = this.getLastNestableAttribute()) ? this.removeAttribute(t) : this
  3571. }, a.prototype.increaseNestingLevel = function () {
  3572. var t, e, n;
  3573. return (t = this.getLastNestableAttribute()) ? (n = this.attributes.lastIndexOf(t), e = r.apply(null, [this.attributes, n + 1, 0].concat(c.call(d(t)))), this.copyWithAttributes(e)) : this
  3574. }, a.prototype.getListItemAttributes = function () {
  3575. var t, e, n, o, r;
  3576. for (o = this.attributes, r = [], e = 0, n = o.length; n > e; e++) t = o[e], i(t).listAttribute && r.push(t);
  3577. return r
  3578. }, a.prototype.isListItem = function () {
  3579. var t;
  3580. return null != (t = i(this.getLastAttribute())) ? t.listAttribute : void 0
  3581. }, a.prototype.isTerminalBlock = function () {
  3582. var t;
  3583. return null != (t = i(this.getLastAttribute())) ? t.terminal : void 0
  3584. }, a.prototype.breaksOnReturn = function () {
  3585. var t;
  3586. return null != (t = i(this.getLastAttribute())) ? t.breakOnReturn : void 0
  3587. }, a.prototype.findLineBreakInDirectionFromPosition = function (t, e) {
  3588. var n, i;
  3589. return i = this.toString(), n = function () {
  3590. switch (t) {
  3591. case"forward":
  3592. return i.indexOf("\n", e);
  3593. case"backward":
  3594. return i.slice(0, e).lastIndexOf("\n")
  3595. }
  3596. }(), -1 !== n ? n : void 0
  3597. }, a.prototype.contentsForInspection = function () {
  3598. return {text: this.text.inspect(), attributes: this.attributes}
  3599. }, a.prototype.toString = function () {
  3600. return this.text.toString()
  3601. }, a.prototype.toJSON = function () {
  3602. return {text: this.text, attributes: this.attributes}
  3603. }, a.prototype.getLength = function () {
  3604. return this.text.getLength()
  3605. }, a.prototype.canBeConsolidatedWith = function (t) {
  3606. return !this.hasAttributes() && !t.hasAttributes()
  3607. }, a.prototype.consolidateWith = function (t) {
  3608. var n, i;
  3609. return n = e.Text.textForStringWithAttributes("\n"), i = this.getTextWithoutBlockBreak().appendText(n), this.copyWithText(i.appendText(t.text))
  3610. }, a.prototype.splitAtOffset = function (t) {
  3611. var e, n;
  3612. return 0 === t ? (e = null, n = this) : t === this.getLength() ? (e = this, n = null) : (e = this.copyWithText(this.text.getTextAtRange([0, t])), n = this.copyWithText(this.text.getTextAtRange([t, this.getLength()]))), [e, n]
  3613. }, a.prototype.getBlockBreakPosition = function () {
  3614. return this.text.getLength() - 1
  3615. }, a.prototype.getTextWithoutBlockBreak = function () {
  3616. return m(this.text) ? this.text.getTextAtRange([0, this.getBlockBreakPosition()]) : this.text.copy()
  3617. }, a.prototype.canBeGrouped = function (t) {
  3618. return this.attributes[t]
  3619. }, a.prototype.canBeGroupedWith = function (t, e) {
  3620. var n, r, s, a;
  3621. return s = t.getAttributes(), r = s[e], n = this.attributes[e], n === r && !(i(n).group === !1 && (a = s[e + 1], u.call(o(), a) < 0))
  3622. }, h = function (t) {
  3623. return t = y(t), t = l(t)
  3624. }, y = function (t) {
  3625. var n, i, o, r, s, a;
  3626. return r = !1, a = t.getPieces(), i = 2 <= a.length ? c.call(a, 0, n = a.length - 1) : (n = 0, []), o = a[n++], null == o ? t : (i = function () {
  3627. var t, e, n;
  3628. for (n = [], t = 0, e = i.length; e > t; t++) s = i[t], s.isBlockBreak() ? (r = !0, n.push(v(s))) : n.push(s);
  3629. return n
  3630. }(), r ? new e.Text(c.call(i).concat([o])) : t)
  3631. }, p = e.Text.textForStringWithAttributes("\n", {blockBreak: !0}), l = function (t) {
  3632. return m(t) ? t : t.appendText(p)
  3633. }, m = function (t) {
  3634. var e, n;
  3635. return n = t.getLength(), 0 === n ? !1 : (e = t.getTextAtRange([n - 1, n]), e.isBlockBreak())
  3636. }, v = function (t) {
  3637. return t.copyWithoutAttribute("blockBreak")
  3638. }, d = function (t) {
  3639. var e;
  3640. return e = i(t).listAttribute, null != e ? [e, t] : [t]
  3641. }, f = function (t) {
  3642. return t.slice(-1)[0]
  3643. }, g = function (t, e) {
  3644. var n;
  3645. return n = t.lastIndexOf(e), -1 === n ? t : r(t, n, 1)
  3646. }, a
  3647. }(e.Object)
  3648. }.call(this), function () {
  3649. var t, n, i, o = function (t, e) {
  3650. function n() {
  3651. this.constructor = t
  3652. }
  3653. for (var i in e) r.call(e, i) && (t[i] = e[i]);
  3654. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  3655. }, r = {}.hasOwnProperty, s = [].slice, a = [].indexOf || function (t) {
  3656. for (var e = 0, n = this.length; n > e; e++) if (e in this && this[e] === t) return e;
  3657. return -1
  3658. };
  3659. n = e.tagName, i = e.walkTree, t = e.nodeIsAttachmentElement, e.HTMLSanitizer = function (r) {
  3660. function u(t, e) {
  3661. this.allowedAttributes = (null != e ? e : {}).allowedAttributes, null == this.allowedAttributes && (this.allowedAttributes = c), this.body = l(t)
  3662. }
  3663. var c, l, h;
  3664. return o(u, r), c = "style href src width height class".split(" "), u.sanitize = function (t, e) {
  3665. var n;
  3666. return n = new this(t, e), n.sanitize(), n
  3667. }, u.prototype.sanitize = function () {
  3668. return this.sanitizeElements(), this.normalizeListElementNesting()
  3669. }, u.prototype.getHTML = function () {
  3670. return this.body.innerHTML
  3671. }, u.prototype.getBody = function () {
  3672. return this.body
  3673. }, u.prototype.sanitizeElements = function () {
  3674. var t, n, o, r, s;
  3675. for (s = i(this.body), r = []; s.nextNode();) switch (o = s.currentNode, o.nodeType) {
  3676. case Node.ELEMENT_NODE:
  3677. h(o) ? r.push(o) : this.sanitizeElement(o);
  3678. break;
  3679. case Node.COMMENT_NODE:
  3680. r.push(o)
  3681. }
  3682. for (t = 0, n = r.length; n > t; t++) o = r[t], e.removeNode(o);
  3683. return this.body
  3684. }, u.prototype.sanitizeElement = function (t) {
  3685. var e, n, i, o;
  3686. for (o = s.call(t.attributes), e = 0, n = o.length; n > e; e++) i = o[e].name, a.call(this.allowedAttributes, i) >= 0 || 0 === i.indexOf("data-trix") || t.removeAttribute(i);
  3687. return t
  3688. }, u.prototype.normalizeListElementNesting = function () {
  3689. var t, e, i, o, r;
  3690. for (r = s.call(this.body.querySelectorAll("ul,ol")), t = 0, e = r.length; e > t; t++) i = r[t], (o = i.previousElementSibling) && "li" === n(o) && o.appendChild(i);
  3691. return this.body
  3692. }, h = function (e) {
  3693. return (null != e ? e.nodeType : void 0) !== Node.ELEMENT_NODE || t(e) ? void 0 : "script" === n(e) || "false" === e.getAttribute("data-trix-serialize")
  3694. }, l = function (t) {
  3695. var e, n, i, o, r;
  3696. for (null == t && (t = ""), t = t.replace(/<\/html[^>]*>[^]*$/i, "</html>"), e = document.implementation.createHTMLDocument(""), e.documentElement.innerHTML = t, r = e.head.querySelectorAll("style"), i = 0, o = r.length; o > i; i++) n = r[i], e.body.appendChild(n);
  3697. return e.body
  3698. }, u
  3699. }(e.BasicObject)
  3700. }.call(this), function () {
  3701. var t, n, i, o, r, s, a, u, c, l, h, p = function (t, e) {
  3702. function n() {
  3703. this.constructor = t
  3704. }
  3705. for (var i in e) d.call(e, i) && (t[i] = e[i]);
  3706. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  3707. }, d = {}.hasOwnProperty, f = [].indexOf || function (t) {
  3708. for (var e = 0, n = this.length; n > e; e++) if (e in this && this[e] === t) return e;
  3709. return -1
  3710. };
  3711. t = e.arraysAreEqual, s = e.makeElement, l = e.tagName, r = e.getBlockTagNames, h = e.walkTree, o = e.findClosestElementFromNode, i = e.elementContainsNode, a = e.nodeIsAttachmentElement, u = e.normalizeSpaces, n = e.breakableWhitespacePattern, c = e.squishBreakableWhitespace, e.HTMLParser = function (d) {
  3712. function g(t, e) {
  3713. this.html = t, this.referenceElement = (null != e ? e : {}).referenceElement, this.blocks = [], this.blockElements = [], this.processedElements = []
  3714. }
  3715. var m, v, y, b, A, C, x, w, E, S, R, k;
  3716. return p(g, d), g.parse = function (t, e) {
  3717. var n;
  3718. return n = new this(t, e), n.parse(), n
  3719. }, g.prototype.getDocument = function () {
  3720. return e.Document.fromJSON(this.blocks)
  3721. }, g.prototype.parse = function () {
  3722. var t, n;
  3723. try {
  3724. for (this.createHiddenContainer(), t = e.HTMLSanitizer.sanitize(this.html).getHTML(), this.containerElement.innerHTML = t, n = h(this.containerElement, {usingFilter: w}); n.nextNode();) this.processNode(n.currentNode);
  3725. return this.translateBlockElementMarginsToNewlines()
  3726. } finally {
  3727. this.removeHiddenContainer()
  3728. }
  3729. }, g.prototype.createHiddenContainer = function () {
  3730. return this.referenceElement ? (this.containerElement = this.referenceElement.cloneNode(!1), this.containerElement.removeAttribute("id"), this.containerElement.setAttribute("data-trix-internal", ""), this.containerElement.style.display = "none", this.referenceElement.parentNode.insertBefore(this.containerElement, this.referenceElement.nextSibling)) : (this.containerElement = s({
  3731. tagName: "div",
  3732. style: {display: "none"}
  3733. }), document.body.appendChild(this.containerElement))
  3734. }, g.prototype.removeHiddenContainer = function () {
  3735. return e.removeNode(this.containerElement)
  3736. }, w = function (t) {
  3737. return "style" === l(t) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
  3738. }, g.prototype.processNode = function (t) {
  3739. switch (t.nodeType) {
  3740. case Node.TEXT_NODE:
  3741. return this.processTextNode(t);
  3742. case Node.ELEMENT_NODE:
  3743. return this.appendBlockForElement(t), this.processElement(t)
  3744. }
  3745. }, g.prototype.appendBlockForElement = function (e) {
  3746. var n, o, r, s;
  3747. if (r = this.isBlockElement(e), o = i(this.currentBlockElement, e), r && !this.isBlockElement(e.firstChild)) {
  3748. if (!(this.isInsignificantTextNode(e.firstChild) && this.isBlockElement(e.firstElementChild) || (n = this.getBlockAttributes(e), o && t(n, this.currentBlock.attributes)))) return this.currentBlock = this.appendBlockForAttributesWithElement(n, e), this.currentBlockElement = e
  3749. } else if (this.currentBlockElement && !o && !r) return (s = this.findParentBlockElement(e)) ? this.appendBlockForElement(s) : (this.currentBlock = this.appendEmptyBlock(), this.currentBlockElement = null)
  3750. }, g.prototype.findParentBlockElement = function (t) {
  3751. var e;
  3752. for (e = t.parentElement; e && e !== this.containerElement;) {
  3753. if (this.isBlockElement(e) && f.call(this.blockElements, e) >= 0) return e;
  3754. e = e.parentElement
  3755. }
  3756. return null
  3757. }, g.prototype.processTextNode = function (t) {
  3758. var e, n;
  3759. return this.isInsignificantTextNode(t) ? void 0 : (n = t.data, v(t.parentNode) || (n = c(n), R(null != (e = t.previousSibling) ? e.textContent : void 0) && (n = C(n))), this.appendStringWithAttributes(n, this.getTextAttributes(t.parentNode)))
  3760. }, g.prototype.processElement = function (t) {
  3761. var e, n, i, o, r;
  3762. if (a(t)) return e = y(t), Object.keys(e).length && (o = this.getTextAttributes(t), this.appendAttachmentWithAttributes(e, o), t.innerHTML = ""), this.processedElements.push(t);
  3763. switch (l(t)) {
  3764. case"br":
  3765. return this.isExtraBR(t) || this.isBlockElement(t.nextSibling) || this.appendStringWithAttributes("\n", this.getTextAttributes(t)), this.processedElements.push(t);
  3766. case"img":
  3767. e = {url: t.getAttribute("src"), contentType: "image"}, i = A(t);
  3768. for (n in i) r = i[n], e[n] = r;
  3769. return this.appendAttachmentWithAttributes(e, this.getTextAttributes(t)), this.processedElements.push(t);
  3770. case"tr":
  3771. if (t.parentNode.firstChild !== t) return this.appendStringWithAttributes("\n");
  3772. break;
  3773. case"td":
  3774. if (t.parentNode.firstChild !== t) return this.appendStringWithAttributes(" | ")
  3775. }
  3776. }, g.prototype.appendBlockForAttributesWithElement = function (t, e) {
  3777. var n;
  3778. return this.blockElements.push(e), n = m(t), this.blocks.push(n), n
  3779. }, g.prototype.appendEmptyBlock = function () {
  3780. return this.appendBlockForAttributesWithElement([], null)
  3781. }, g.prototype.appendStringWithAttributes = function (t, e) {
  3782. return this.appendPiece(S(t, e))
  3783. }, g.prototype.appendAttachmentWithAttributes = function (t, e) {
  3784. return this.appendPiece(E(t, e))
  3785. }, g.prototype.appendPiece = function (t) {
  3786. return 0 === this.blocks.length && this.appendEmptyBlock(), this.blocks[this.blocks.length - 1].text.push(t)
  3787. }, g.prototype.appendStringToTextAtIndex = function (t, e) {
  3788. var n, i;
  3789. return i = this.blocks[e].text, n = i[i.length - 1], "string" === (null != n ? n.type : void 0) ? n.string += t : i.push(S(t))
  3790. }, g.prototype.prependStringToTextAtIndex = function (t, e) {
  3791. var n, i;
  3792. return i = this.blocks[e].text, n = i[0], "string" === (null != n ? n.type : void 0) ? n.string = t + n.string : i.unshift(S(t))
  3793. }, S = function (t, e) {
  3794. var n;
  3795. return null == e && (e = {}), n = "string", t = u(t), {string: t, attributes: e, type: n}
  3796. }, E = function (t, e) {
  3797. var n;
  3798. return null == e && (e = {}), n = "attachment", {attachment: t, attributes: e, type: n}
  3799. }, m = function (t) {
  3800. var e;
  3801. return null == t && (t = {}), e = [], {text: e, attributes: t}
  3802. }, g.prototype.getTextAttributes = function (t) {
  3803. var n, i, r, s, u, c, l, h, p, d, f, g, m;
  3804. r = {}, d = e.config.textAttributes;
  3805. for (n in d) if (u = d[n], u.tagName && o(t, {
  3806. matchingSelector: u.tagName,
  3807. untilNode: this.containerElement
  3808. })) r[n] = !0; else if (u.parser) {
  3809. if (m = u.parser(t)) {
  3810. for (i = !1, f = this.findBlockElementAncestors(t), c = 0, p = f.length; p > c; c++) if (s = f[c], u.parser(s) === m) {
  3811. i = !0;
  3812. break
  3813. }
  3814. i || (r[n] = m)
  3815. }
  3816. } else u.styleProperty && (m = t.style[u.styleProperty]) && (r[n] = m);
  3817. if (a(t) && (l = t.getAttribute("data-trix-attributes"))) {
  3818. g = JSON.parse(l);
  3819. for (h in g) m = g[h], r[h] = m
  3820. }
  3821. return r
  3822. }, g.prototype.getBlockAttributes = function (t) {
  3823. var n, i, o, r;
  3824. for (i = []; t && t !== this.containerElement;) {
  3825. r = e.config.blockAttributes;
  3826. for (n in r) o = r[n], o.parse !== !1 && l(t) === o.tagName && (("function" == typeof o.test ? o.test(t) : void 0) || !o.test) && (i.push(n), o.listAttribute && i.push(o.listAttribute));
  3827. t = t.parentNode
  3828. }
  3829. return i.reverse()
  3830. }, g.prototype.findBlockElementAncestors = function (t) {
  3831. var e, n;
  3832. for (e = []; t && t !== this.containerElement;) n = l(t), f.call(r(), n) >= 0 && e.push(t), t = t.parentNode;
  3833. return e
  3834. }, y = function (t) {
  3835. return JSON.parse(t.getAttribute("data-trix-attachment"))
  3836. }, A = function (t) {
  3837. var e, n, i;
  3838. return i = t.getAttribute("width"), n = t.getAttribute("height"), e = {}, i && (e.width = parseInt(i, 10)), n && (e.height = parseInt(n, 10)), e
  3839. }, g.prototype.isBlockElement = function (t) {
  3840. var e;
  3841. if ((null != t ? t.nodeType : void 0) === Node.ELEMENT_NODE && !a(t) && !o(t, {
  3842. matchingSelector: "td",
  3843. untilNode: this.containerElement
  3844. })) return e = l(t), f.call(r(), e) >= 0 || "block" === window.getComputedStyle(t).display
  3845. }, g.prototype.isInsignificantTextNode = function (t) {
  3846. var e, n, i;
  3847. if ((null != t ? t.nodeType : void 0) === Node.TEXT_NODE && k(t.data) && (n = t.parentNode, i = t.previousSibling, e = t.nextSibling, (!x(n.previousSibling) || this.isBlockElement(n.previousSibling)) && !v(n))) return !i || this.isBlockElement(i) || !e || this.isBlockElement(e)
  3848. }, g.prototype.isExtraBR = function (t) {
  3849. return "br" === l(t) && this.isBlockElement(t.parentNode) && t.parentNode.lastChild === t
  3850. }, v = function (t) {
  3851. var e;
  3852. return e = window.getComputedStyle(t).whiteSpace, "pre" === e || "pre-wrap" === e || "pre-line" === e
  3853. }, x = function (t) {
  3854. return t && !R(t.textContent)
  3855. }, g.prototype.translateBlockElementMarginsToNewlines = function () {
  3856. var t, e, n, i, o, r, s, a;
  3857. for (e = this.getMarginOfDefaultBlockElement(), s = this.blocks, a = [], i = n = 0, o = s.length; o > n; i = ++n) t = s[i], (r = this.getMarginOfBlockElementAtIndex(i)) && (r.top > 2 * e.top && this.prependStringToTextAtIndex("\n", i), a.push(r.bottom > 2 * e.bottom ? this.appendStringToTextAtIndex("\n", i) : void 0));
  3858. return a
  3859. }, g.prototype.getMarginOfBlockElementAtIndex = function (t) {
  3860. var e, n;
  3861. return !(e = this.blockElements[t]) || !e.textContent || (n = l(e), f.call(r(), n) >= 0 || f.call(this.processedElements, e) >= 0) ? void 0 : b(e)
  3862. }, g.prototype.getMarginOfDefaultBlockElement = function () {
  3863. var t;
  3864. return t = s(e.config.blockAttributes["default"].tagName), this.containerElement.appendChild(t), b(t)
  3865. }, b = function (t) {
  3866. var e;
  3867. return e = window.getComputedStyle(t), "block" === e.display ? {
  3868. top: parseInt(e.marginTop),
  3869. bottom: parseInt(e.marginBottom)
  3870. } : void 0
  3871. }, C = function (t) {
  3872. return t.replace(RegExp("^" + n.source + "+"), "")
  3873. }, k = function (t) {
  3874. return RegExp("^" + n.source + "*$").test(t)
  3875. }, R = function (t) {
  3876. return /\s$/.test(t)
  3877. }, g
  3878. }(e.BasicObject)
  3879. }.call(this), function () {
  3880. var t, n, i, o, r = function (t, e) {
  3881. function n() {
  3882. this.constructor = t
  3883. }
  3884. for (var i in e) s.call(e, i) && (t[i] = e[i]);
  3885. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  3886. }, s = {}.hasOwnProperty, a = [].slice, u = [].indexOf || function (t) {
  3887. for (var e = 0, n = this.length; n > e; e++) if (e in this && this[e] === t) return e;
  3888. return -1
  3889. };
  3890. t = e.arraysAreEqual, i = e.normalizeRange, o = e.rangeIsCollapsed, n = e.getBlockConfig, e.Document = function (s) {
  3891. function c(t) {
  3892. null == t && (t = []), c.__super__.constructor.apply(this, arguments), 0 === t.length && (t = [new e.Block]), this.blockList = e.SplittableList.box(t)
  3893. }
  3894. var l;
  3895. return r(c, s), c.fromJSON = function (t) {
  3896. var n, i;
  3897. return i = function () {
  3898. var i, o, r;
  3899. for (r = [], i = 0, o = t.length; o > i; i++) n = t[i], r.push(e.Block.fromJSON(n));
  3900. return r
  3901. }(), new this(i)
  3902. }, c.fromHTML = function (t, n) {
  3903. return e.HTMLParser.parse(t, n).getDocument()
  3904. }, c.fromString = function (t, n) {
  3905. var i;
  3906. return i = e.Text.textForStringWithAttributes(t, n), new this([new e.Block(i)])
  3907. }, c.prototype.isEmpty = function () {
  3908. var t;
  3909. return 1 === this.blockList.length && (t = this.getBlockAtIndex(0), t.isEmpty() && !t.hasAttributes())
  3910. }, c.prototype.copy = function (t) {
  3911. var e;
  3912. return null == t && (t = {}), e = t.consolidateBlocks ? this.blockList.consolidate().toArray() : this.blockList.toArray(), new this.constructor(e)
  3913. }, c.prototype.copyUsingObjectsFromDocument = function (t) {
  3914. var n;
  3915. return n = new e.ObjectMap(t.getObjects()), this.copyUsingObjectMap(n)
  3916. }, c.prototype.copyUsingObjectMap = function (t) {
  3917. var e, n, i;
  3918. return n = function () {
  3919. var n, o, r, s;
  3920. for (r = this.getBlocks(), s = [], n = 0, o = r.length; o > n; n++) e = r[n], s.push((i = t.find(e)) ? i : e.copyUsingObjectMap(t));
  3921. return s
  3922. }.call(this), new this.constructor(n)
  3923. }, c.prototype.copyWithBaseBlockAttributes = function (t) {
  3924. var e, n, i;
  3925. return null == t && (t = []), i = function () {
  3926. var i, o, r, s;
  3927. for (r = this.getBlocks(), s = [], i = 0, o = r.length; o > i; i++) n = r[i], e = t.concat(n.getAttributes()), s.push(n.copyWithAttributes(e));
  3928. return s
  3929. }.call(this), new this.constructor(i)
  3930. }, c.prototype.replaceBlock = function (t, e) {
  3931. var n;
  3932. return n = this.blockList.indexOf(t), -1 === n ? this : new this.constructor(this.blockList.replaceObjectAtIndex(e, n))
  3933. }, c.prototype.insertDocumentAtRange = function (t, e) {
  3934. var n, r, s, a, u, c, l;
  3935. return r = t.blockList, u = (e = i(e))[0], c = this.locationFromPosition(u), s = c.index, a = c.offset, l = this, n = this.getBlockAtPosition(u), o(e) && n.isEmpty() && !n.hasAttributes() ? l = new this.constructor(l.blockList.removeObjectAtIndex(s)) : n.getBlockBreakPosition() === a && u++, l = l.removeTextAtRange(e), new this.constructor(l.blockList.insertSplittableListAtPosition(r, u))
  3936. }, c.prototype.mergeDocumentAtRange = function (e, n) {
  3937. var o, r, s, a, u, c, l, h, p, d, f, g;
  3938. return f = (n = i(n))[0], d = this.locationFromPosition(f), r = this.getBlockAtIndex(d.index).getAttributes(), o = e.getBaseBlockAttributes(), g = r.slice(-o.length), t(o, g) ? (l = r.slice(0, -o.length), c = e.copyWithBaseBlockAttributes(l)) : c = e.copy({consolidateBlocks: !0}).copyWithBaseBlockAttributes(r), s = c.getBlockCount(), a = c.getBlockAtIndex(0), t(r, a.getAttributes()) ? (u = a.getTextWithoutBlockBreak(), p = this.insertTextAtRange(u, n), s > 1 && (c = new this.constructor(c.getBlocks().slice(1)), h = f + u.getLength(), p = p.insertDocumentAtRange(c, h))) : p = this.insertDocumentAtRange(c, n), p
  3939. }, c.prototype.insertTextAtRange = function (t, e) {
  3940. var n, o, r, s, a;
  3941. return a = (e = i(e))[0], s = this.locationFromPosition(a), o = s.index, r = s.offset, n = this.removeTextAtRange(e), new this.constructor(n.blockList.editObjectAtIndex(o, function (e) {
  3942. return e.copyWithText(e.text.insertTextAtPosition(t, r))
  3943. }))
  3944. }, c.prototype.removeTextAtRange = function (t) {
  3945. var e, n, r, s, a, u, c, l, h, p, d, f, g, m, v, y, b, A, C, x, w;
  3946. return p = t = i(t), l = p[0], A = p[1], o(t) ? this : (d = this.locationRangeFromRange(t), u = d[0], y = d[1], a = u.index, c = u.offset, s = this.getBlockAtIndex(a), v = y.index, b = y.offset, m = this.getBlockAtIndex(v), f = A - l === 1 && s.getBlockBreakPosition() === c && m.getBlockBreakPosition() !== b && "\n" === m.text.getStringAtPosition(b), f ? r = this.blockList.editObjectAtIndex(v, function (t) {
  3947. return t.copyWithText(t.text.removeTextAtRange([b, b + 1]))
  3948. }) : (h = s.text.getTextAtRange([0, c]), C = m.text.getTextAtRange([b, m.getLength()]), x = h.appendText(C), g = a !== v && 0 === c, w = g && s.getAttributeLevel() >= m.getAttributeLevel(), n = w ? m.copyWithText(x) : s.copyWithText(x), e = v + 1 - a, r = this.blockList.splice(a, e, n)), new this.constructor(r))
  3949. }, c.prototype.moveTextFromRangeToPosition = function (t, e) {
  3950. var n, o, r, s, u, c, l, h, p, d;
  3951. return c = t = i(t), p = c[0], r = c[1], e >= p && r >= e ? this : (o = this.getDocumentAtRange(t), h = this.removeTextAtRange(t), u = e > p, u && (e -= o.getLength()), l = o.getBlocks(), s = l[0], n = 2 <= l.length ? a.call(l, 1) : [], 0 === n.length ? (d = s.getTextWithoutBlockBreak(), u && (e += 1)) : d = s.text, h = h.insertTextAtRange(d, e), 0 === n.length ? h : (o = new this.constructor(n), e += d.getLength(), h.insertDocumentAtRange(o, e)))
  3952. }, c.prototype.addAttributeAtRange = function (t, e, i) {
  3953. var o;
  3954. return o = this.blockList, this.eachBlockAtRange(i, function (i, r, s) {
  3955. return o = o.editObjectAtIndex(s, function () {
  3956. return n(t) ? i.addAttribute(t, e) : r[0] === r[1] ? i : i.copyWithText(i.text.addAttributeAtRange(t, e, r))
  3957. })
  3958. }), new this.constructor(o)
  3959. }, c.prototype.addAttribute = function (t, e) {
  3960. var n;
  3961. return n = this.blockList, this.eachBlock(function (i, o) {
  3962. return n = n.editObjectAtIndex(o, function () {
  3963. return i.addAttribute(t, e)
  3964. })
  3965. }), new this.constructor(n)
  3966. }, c.prototype.removeAttributeAtRange = function (t, e) {
  3967. var i;
  3968. return i = this.blockList, this.eachBlockAtRange(e, function (e, o, r) {
  3969. return n(t) ? i = i.editObjectAtIndex(r, function () {
  3970. return e.removeAttribute(t)
  3971. }) : o[0] !== o[1] ? i = i.editObjectAtIndex(r, function () {
  3972. return e.copyWithText(e.text.removeAttributeAtRange(t, o))
  3973. }) : void 0
  3974. }), new this.constructor(i)
  3975. }, c.prototype.updateAttributesForAttachment = function (t, e) {
  3976. var n, i, o, r;
  3977. return o = (i = this.getRangeOfAttachment(e))[0], n = this.locationFromPosition(o).index, r = this.getTextAtIndex(n), new this.constructor(this.blockList.editObjectAtIndex(n, function (n) {
  3978. return n.copyWithText(r.updateAttributesForAttachment(t, e))
  3979. }))
  3980. }, c.prototype.removeAttributeForAttachment = function (t, e) {
  3981. var n;
  3982. return n = this.getRangeOfAttachment(e), this.removeAttributeAtRange(t, n)
  3983. }, c.prototype.insertBlockBreakAtRange = function (t) {
  3984. var n, o, r, s;
  3985. return s = (t = i(t))[0], r = this.locationFromPosition(s).offset, o = this.removeTextAtRange(t), 0 === r && (n = [new e.Block]), new this.constructor(o.blockList.insertSplittableListAtPosition(new e.SplittableList(n), s))
  3986. }, c.prototype.applyBlockAttributeAtRange = function (t, e, i) {
  3987. var o, r, s, a;
  3988. return s = this.expandRangeToLineBreaksAndSplitBlocks(i), r = s.document, i = s.range, o = n(t), o.listAttribute ? (r = r.removeLastListAttributeAtRange(i, {exceptAttributeName: t}), a = r.convertLineBreaksToBlockBreaksInRange(i), r = a.document, i = a.range) : r = o.exclusive ? r.removeBlockAttributesAtRange(i) : o.terminal ? r.removeLastTerminalAttributeAtRange(i) : r.consolidateBlocksAtRange(i), r.addAttributeAtRange(t, e, i)
  3989. }, c.prototype.removeLastListAttributeAtRange = function (t, e) {
  3990. var i;
  3991. return null == e && (e = {}), i = this.blockList, this.eachBlockAtRange(t, function (t, o, r) {
  3992. var s;
  3993. if ((s = t.getLastAttribute()) && n(s).listAttribute && s !== e.exceptAttributeName) return i = i.editObjectAtIndex(r, function () {
  3994. return t.removeAttribute(s)
  3995. })
  3996. }), new this.constructor(i)
  3997. }, c.prototype.removeLastTerminalAttributeAtRange = function (t) {
  3998. var e;
  3999. return e = this.blockList, this.eachBlockAtRange(t, function (t, i, o) {
  4000. var r;
  4001. if ((r = t.getLastAttribute()) && n(r).terminal) return e = e.editObjectAtIndex(o, function () {
  4002. return t.removeAttribute(r)
  4003. })
  4004. }), new this.constructor(e)
  4005. }, c.prototype.removeBlockAttributesAtRange = function (t) {
  4006. var e;
  4007. return e = this.blockList, this.eachBlockAtRange(t, function (t, n, i) {
  4008. return t.hasAttributes() ? e = e.editObjectAtIndex(i, function () {
  4009. return t.copyWithoutAttributes()
  4010. }) : void 0
  4011. }), new this.constructor(e)
  4012. }, c.prototype.expandRangeToLineBreaksAndSplitBlocks = function (t) {
  4013. var e, n, o, r, s, a, u, c, l;
  4014. return a = t = i(t), l = a[0], r = a[1], c = this.locationFromPosition(l), o = this.locationFromPosition(r), e = this, u = e.getBlockAtIndex(c.index), null != (c.offset = u.findLineBreakInDirectionFromPosition("backward", c.offset)) && (s = e.positionFromLocation(c), e = e.insertBlockBreakAtRange([s, s + 1]), o.index += 1, o.offset -= e.getBlockAtIndex(c.index).getLength(), c.index += 1), c.offset = 0, 0 === o.offset && o.index > c.index ? (o.index -= 1, o.offset = e.getBlockAtIndex(o.index).getBlockBreakPosition()) : (n = e.getBlockAtIndex(o.index), "\n" === n.text.getStringAtRange([o.offset - 1, o.offset]) ? o.offset -= 1 : o.offset = n.findLineBreakInDirectionFromPosition("forward", o.offset), o.offset !== n.getBlockBreakPosition() && (s = e.positionFromLocation(o), e = e.insertBlockBreakAtRange([s, s + 1]))), l = e.positionFromLocation(c), r = e.positionFromLocation(o), t = i([l, r]), {
  4015. document: e,
  4016. range: t
  4017. }
  4018. }, c.prototype.convertLineBreaksToBlockBreaksInRange = function (t) {
  4019. var e, n, o;
  4020. return n = (t = i(t))[0], o = this.getStringAtRange(t).slice(0, -1), e = this, o.replace(/.*?\n/g, function (t) {
  4021. return n += t.length, e = e.insertBlockBreakAtRange([n - 1, n])
  4022. }), {document: e, range: t}
  4023. }, c.prototype.consolidateBlocksAtRange = function (t) {
  4024. var e, n, o, r, s;
  4025. return o = t = i(t), s = o[0], n = o[1], r = this.locationFromPosition(s).index, e = this.locationFromPosition(n).index, new this.constructor(this.blockList.consolidateFromIndexToIndex(r, e))
  4026. }, c.prototype.getDocumentAtRange = function (t) {
  4027. var e;
  4028. return t = i(t), e = this.blockList.getSplittableListInRange(t).toArray(), new this.constructor(e)
  4029. }, c.prototype.getStringAtRange = function (t) {
  4030. var e, n, o;
  4031. return o = t = i(t), n = o[o.length - 1], n !== this.getLength() && (e = -1), this.getDocumentAtRange(t).toString().slice(0, e)
  4032. }, c.prototype.getBlockAtIndex = function (t) {
  4033. return this.blockList.getObjectAtIndex(t)
  4034. }, c.prototype.getBlockAtPosition = function (t) {
  4035. var e;
  4036. return e = this.locationFromPosition(t).index, this.getBlockAtIndex(e)
  4037. }, c.prototype.getTextAtIndex = function (t) {
  4038. var e;
  4039. return null != (e = this.getBlockAtIndex(t)) ? e.text : void 0
  4040. }, c.prototype.getTextAtPosition = function (t) {
  4041. var e;
  4042. return e = this.locationFromPosition(t).index, this.getTextAtIndex(e)
  4043. }, c.prototype.getPieceAtPosition = function (t) {
  4044. var e, n, i;
  4045. return i = this.locationFromPosition(t), e = i.index, n = i.offset, this.getTextAtIndex(e).getPieceAtPosition(n)
  4046. }, c.prototype.getCharacterAtPosition = function (t) {
  4047. var e, n, i;
  4048. return i = this.locationFromPosition(t), e = i.index, n = i.offset, this.getTextAtIndex(e).getStringAtRange([n, n + 1])
  4049. }, c.prototype.getLength = function () {
  4050. return this.blockList.getEndPosition()
  4051. }, c.prototype.getBlocks = function () {
  4052. return this.blockList.toArray()
  4053. }, c.prototype.getBlockCount = function () {
  4054. return this.blockList.length
  4055. }, c.prototype.getEditCount = function () {
  4056. return this.editCount
  4057. }, c.prototype.eachBlock = function (t) {
  4058. return this.blockList.eachObject(t)
  4059. }, c.prototype.eachBlockAtRange = function (t, e) {
  4060. var n, o, r, s, a, u, c, l, h, p, d, f;
  4061. if (u = t = i(t), d = u[0], r = u[1], p = this.locationFromPosition(d), o = this.locationFromPosition(r), p.index === o.index) return n = this.getBlockAtIndex(p.index), f = [p.offset, o.offset], e(n, f, p.index);
  4062. for (h = [], a = s = c = p.index, l = o.index; l >= c ? l >= s : s >= l; a = l >= c ? ++s : --s) (n = this.getBlockAtIndex(a)) ? (f = function () {
  4063. switch (a) {
  4064. case p.index:
  4065. return [p.offset, n.text.getLength()];
  4066. case o.index:
  4067. return [0, o.offset];
  4068. default:
  4069. return [0, n.text.getLength()]
  4070. }
  4071. }(), h.push(e(n, f, a))) : h.push(void 0);
  4072. return h
  4073. }, c.prototype.getCommonAttributesAtRange = function (t) {
  4074. var n, r, s;
  4075. return r = (t = i(t))[0], o(t) ? this.getCommonAttributesAtPosition(r) : (s = [], n = [], this.eachBlockAtRange(t, function (t, e) {
  4076. return e[0] !== e[1] ? (s.push(t.text.getCommonAttributesAtRange(e)), n.push(l(t))) : void 0
  4077. }), e.Hash.fromCommonAttributesOfObjects(s).merge(e.Hash.fromCommonAttributesOfObjects(n)).toObject())
  4078. }, c.prototype.getCommonAttributesAtPosition = function (t) {
  4079. var n, i, o, r, s, a, c, h, p, d;
  4080. if (p = this.locationFromPosition(t), s = p.index, h = p.offset, o = this.getBlockAtIndex(s), !o) return {};
  4081. r = l(o), n = o.text.getAttributesAtPosition(h), i = o.text.getAttributesAtPosition(h - 1), a = function () {
  4082. var t, n;
  4083. t = e.config.textAttributes, n = [];
  4084. for (c in t) d = t[c], d.inheritable && n.push(c);
  4085. return n
  4086. }();
  4087. for (c in i) d = i[c], (d === n[c] || u.call(a, c) >= 0) && (r[c] = d);
  4088. return r
  4089. }, c.prototype.getRangeOfCommonAttributeAtPosition = function (t, e) {
  4090. var n, o, r, s, a, u, c, l, h;
  4091. return a = this.locationFromPosition(e), r = a.index, s = a.offset, h = this.getTextAtIndex(r), u = h.getExpandedRangeForAttributeAtOffset(t, s), l = u[0], o = u[1], c = this.positionFromLocation({
  4092. index: r,
  4093. offset: l
  4094. }), n = this.positionFromLocation({index: r, offset: o}), i([c, n])
  4095. }, c.prototype.getBaseBlockAttributes = function () {
  4096. var t, e, n, i, o, r, s;
  4097. for (t = this.getBlockAtIndex(0).getAttributes(), n = i = 1, s = this.getBlockCount(); s >= 1 ? s > i : i > s; n = s >= 1 ? ++i : --i) e = this.getBlockAtIndex(n).getAttributes(), r = Math.min(t.length, e.length), t = function () {
  4098. var n, i, s;
  4099. for (s = [], o = n = 0, i = r; (i >= 0 ? i > n : n > i) && e[o] === t[o]; o = i >= 0 ? ++n : --n) s.push(e[o]);
  4100. return s
  4101. }();
  4102. return t
  4103. }, l = function (t) {
  4104. var e, n;
  4105. return n = {}, (e = t.getLastAttribute()) && (n[e] = !0), n
  4106. }, c.prototype.getAttachmentById = function (t) {
  4107. var e, n, i, o;
  4108. for (o = this.getAttachments(), n = 0, i = o.length; i > n; n++) if (e = o[n], e.id === t) return e
  4109. }, c.prototype.getAttachmentPieces = function () {
  4110. var t;
  4111. return t = [], this.blockList.eachObject(function (e) {
  4112. var n;
  4113. return n = e.text, t = t.concat(n.getAttachmentPieces())
  4114. }), t
  4115. }, c.prototype.getAttachments = function () {
  4116. var t, e, n, i, o;
  4117. for (i = this.getAttachmentPieces(), o = [], t = 0, e = i.length; e > t; t++) n = i[t], o.push(n.attachment);
  4118. return o
  4119. }, c.prototype.getRangeOfAttachment = function (t) {
  4120. var e, n, o, r, s, a, u;
  4121. for (r = 0, s = this.blockList.toArray(), n = e = 0, o = s.length; o > e; n = ++e) {
  4122. if (a = s[n].text, u = a.getRangeOfAttachment(t)) return i([r + u[0], r + u[1]]);
  4123. r += a.getLength()
  4124. }
  4125. }, c.prototype.getLocationRangeOfAttachment = function (t) {
  4126. var e;
  4127. return e = this.getRangeOfAttachment(t), this.locationRangeFromRange(e)
  4128. }, c.prototype.getAttachmentPieceForAttachment = function (t) {
  4129. var e, n, i, o;
  4130. for (o = this.getAttachmentPieces(), e = 0, n = o.length; n > e; e++) if (i = o[e], i.attachment === t) return i
  4131. }, c.prototype.findRangesForBlockAttribute = function (t) {
  4132. var e, n, i, o, r, s, a;
  4133. for (r = 0, s = [], a = this.getBlocks(), n = 0, i = a.length; i > n; n++) e = a[n], o = e.getLength(), e.hasAttribute(t) && s.push([r, r + o]), r += o;
  4134. return s
  4135. }, c.prototype.findRangesForTextAttribute = function (t, e) {
  4136. var n, i, o, r, s, a, u, c, l, h;
  4137. for (h = (null != e ? e : {}).withValue, a = 0, u = [], c = [], r = function (e) {
  4138. return null != h ? e.getAttribute(t) === h : e.hasAttribute(t)
  4139. }, l = this.getPieces(), n = 0, i = l.length; i > n; n++) s = l[n], o = s.getLength(), r(s) && (u[1] === a ? u[1] = a + o : c.push(u = [a, a + o])), a += o;
  4140. return c
  4141. }, c.prototype.locationFromPosition = function (t) {
  4142. var e, n;
  4143. return n = this.blockList.findIndexAndOffsetAtPosition(Math.max(0, t)), null != n.index ? n : (e = this.getBlocks(), {
  4144. index: e.length - 1,
  4145. offset: e[e.length - 1].getLength()
  4146. })
  4147. }, c.prototype.positionFromLocation = function (t) {
  4148. return this.blockList.findPositionAtIndexAndOffset(t.index, t.offset)
  4149. }, c.prototype.locationRangeFromPosition = function (t) {
  4150. return i(this.locationFromPosition(t))
  4151. }, c.prototype.locationRangeFromRange = function (t) {
  4152. var e, n, o, r;
  4153. if (t = i(t)) return r = t[0], n = t[1], o = this.locationFromPosition(r), e = this.locationFromPosition(n), i([o, e])
  4154. }, c.prototype.rangeFromLocationRange = function (t) {
  4155. var e, n;
  4156. return t = i(t), e = this.positionFromLocation(t[0]), o(t) || (n = this.positionFromLocation(t[1])), i([e, n])
  4157. }, c.prototype.isEqualTo = function (t) {
  4158. return this.blockList.isEqualTo(null != t ? t.blockList : void 0)
  4159. }, c.prototype.getTexts = function () {
  4160. var t, e, n, i, o;
  4161. for (i = this.getBlocks(), o = [], e = 0, n = i.length; n > e; e++) t = i[e], o.push(t.text);
  4162. return o
  4163. }, c.prototype.getPieces = function () {
  4164. var t, e, n, i, o;
  4165. for (n = [], i = this.getTexts(), t = 0, e = i.length; e > t; t++) o = i[t], n.push.apply(n, o.getPieces());
  4166. return n
  4167. }, c.prototype.getObjects = function () {
  4168. return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())
  4169. }, c.prototype.toSerializableDocument = function () {
  4170. var t;
  4171. return t = [], this.blockList.eachObject(function (e) {
  4172. return t.push(e.copyWithText(e.text.toSerializableText()))
  4173. }), new this.constructor(t)
  4174. }, c.prototype.toString = function () {
  4175. return this.blockList.toString()
  4176. }, c.prototype.toJSON = function () {
  4177. return this.blockList.toJSON()
  4178. }, c.prototype.toConsole = function () {
  4179. var t;
  4180. return JSON.stringify(function () {
  4181. var e, n, i, o;
  4182. for (i = this.blockList.toArray(), o = [], e = 0, n = i.length; n > e; e++) t = i[e], o.push(JSON.parse(t.text.toConsole()));
  4183. return o
  4184. }.call(this))
  4185. }, c
  4186. }(e.Object)
  4187. }.call(this), function () {
  4188. e.LineBreakInsertion = function () {
  4189. function t(t) {
  4190. var e;
  4191. this.composition = t, this.document = this.composition.document, e = this.composition.getSelectedRange(), this.startPosition = e[0], this.endPosition = e[1], this.startLocation = this.document.locationFromPosition(this.startPosition), this.endLocation = this.document.locationFromPosition(this.endPosition), this.block = this.document.getBlockAtIndex(this.endLocation.index), this.breaksOnReturn = this.block.breaksOnReturn(), this.previousCharacter = this.block.text.getStringAtPosition(this.endLocation.offset - 1), this.nextCharacter = this.block.text.getStringAtPosition(this.endLocation.offset)
  4192. }
  4193. return t.prototype.shouldInsertBlockBreak = function () {
  4194. return this.block.hasAttributes() && this.block.isListItem() && !this.block.isEmpty() ? 0 !== this.startLocation.offset : this.breaksOnReturn && "\n" !== this.nextCharacter
  4195. }, t.prototype.shouldBreakFormattedBlock = function () {
  4196. return this.block.hasAttributes() && !this.block.isListItem() && (this.breaksOnReturn && "\n" === this.nextCharacter || "\n" === this.previousCharacter)
  4197. }, t.prototype.shouldDecreaseListLevel = function () {
  4198. return this.block.hasAttributes() && this.block.isListItem() && this.block.isEmpty()
  4199. }, t.prototype.shouldPrependListItem = function () {
  4200. return this.block.isListItem() && 0 === this.startLocation.offset && !this.block.isEmpty()
  4201. }, t.prototype.shouldRemoveLastBlockAttribute = function () {
  4202. return this.block.hasAttributes() && !this.block.isListItem() && this.block.isEmpty()
  4203. }, t
  4204. }()
  4205. }.call(this), function () {
  4206. var t, n, i, o, r, s, a, u, c, l, h = function (t, e) {
  4207. function n() {
  4208. this.constructor = t
  4209. }
  4210. for (var i in e) p.call(e, i) && (t[i] = e[i]);
  4211. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  4212. }, p = {}.hasOwnProperty;
  4213. s = e.normalizeRange, c = e.rangesAreEqual, u = e.rangeIsCollapsed, a = e.objectsAreEqual, t = e.arrayStartsWith, l = e.summarizeArrayChange, i = e.getAllAttributeNames, o = e.getBlockConfig, r = e.getTextConfig, n = e.extend, e.Composition = function (p) {
  4214. function d() {
  4215. this.document = new e.Document, this.attachments = [], this.currentAttributes = {}, this.revision = 0
  4216. }
  4217. var f;
  4218. return h(d, p), d.prototype.setDocument = function (t) {
  4219. var e;
  4220. return t.isEqualTo(this.document) ? void 0 : (this.document = t, this.refreshAttachments(), this.revision++, null != (e = this.delegate) && "function" == typeof e.compositionDidChangeDocument ? e.compositionDidChangeDocument(t) : void 0)
  4221. }, d.prototype.getSnapshot = function () {
  4222. return {document: this.document, selectedRange: this.getSelectedRange()}
  4223. }, d.prototype.loadSnapshot = function (t) {
  4224. var n, i, o, r;
  4225. return n = t.document, r = t.selectedRange, null != (i = this.delegate) && "function" == typeof i.compositionWillLoadSnapshot && i.compositionWillLoadSnapshot(), this.setDocument(null != n ? n : new e.Document), this.setSelection(null != r ? r : [0, 0]), null != (o = this.delegate) && "function" == typeof o.compositionDidLoadSnapshot ? o.compositionDidLoadSnapshot() : void 0
  4226. }, d.prototype.insertText = function (t, e) {
  4227. var n, i, o, r;
  4228. return r = (null != e ? e : {updatePosition: !0}).updatePosition, i = this.getSelectedRange(), this.setDocument(this.document.insertTextAtRange(t, i)), o = i[0], n = o + t.getLength(), r && this.setSelection(n), this.notifyDelegateOfInsertionAtRange([o, n])
  4229. }, d.prototype.insertBlock = function (t) {
  4230. var n;
  4231. return null == t && (t = new e.Block), n = new e.Document([t]), this.insertDocument(n)
  4232. }, d.prototype.insertDocument = function (t) {
  4233. var n, i, o;
  4234. return null == t && (t = new e.Document), i = this.getSelectedRange(), this.setDocument(this.document.insertDocumentAtRange(t, i)), o = i[0], n = o + t.getLength(), this.setSelection(n), this.notifyDelegateOfInsertionAtRange([o, n])
  4235. }, d.prototype.insertString = function (t, n) {
  4236. var i, o;
  4237. return i = this.getCurrentTextAttributes(), o = e.Text.textForStringWithAttributes(t, i), this.insertText(o, n)
  4238. }, d.prototype.insertBlockBreak = function () {
  4239. var t, e, n;
  4240. return e = this.getSelectedRange(), this.setDocument(this.document.insertBlockBreakAtRange(e)), n = e[0], t = n + 1, this.setSelection(t), this.notifyDelegateOfInsertionAtRange([n, t])
  4241. }, d.prototype.insertLineBreak = function () {
  4242. var t, n;
  4243. return n = new e.LineBreakInsertion(this), n.shouldDecreaseListLevel() ? (this.decreaseListLevel(), this.setSelection(n.startPosition)) : n.shouldPrependListItem() ? (t = new e.Document([n.block.copyWithoutText()]), this.insertDocument(t)) : n.shouldInsertBlockBreak() ? this.insertBlockBreak() : n.shouldRemoveLastBlockAttribute() ? this.removeLastBlockAttribute() : n.shouldBreakFormattedBlock() ? this.breakFormattedBlock(n) : this.insertString("\n")
  4244. }, d.prototype.insertHTML = function (t) {
  4245. var n, i, o, r;
  4246. return n = e.Document.fromHTML(t), o = this.getSelectedRange(), this.setDocument(this.document.mergeDocumentAtRange(n, o)), r = o[0], i = r + n.getLength() - 1, this.setSelection(i), this.notifyDelegateOfInsertionAtRange([r, i])
  4247. }, d.prototype.replaceHTML = function (t) {
  4248. var n, i, o;
  4249. return n = e.Document.fromHTML(t).copyUsingObjectsFromDocument(this.document), i = this.getLocationRange({strict: !1}), o = this.document.rangeFromLocationRange(i), this.setDocument(n), this.setSelection(o)
  4250. }, d.prototype.insertFile = function (t) {
  4251. return this.insertFiles([t])
  4252. }, d.prototype.insertFiles = function (t) {
  4253. var n, i, o, r, s, a;
  4254. for (i = [], r = 0, s = t.length; s > r; r++) o = t[r], (null != (a = this.delegate) ? a.compositionShouldAcceptFile(o) : void 0) && (n = e.Attachment.attachmentForFile(o), i.push(n));
  4255. return this.insertAttachments(i)
  4256. }, d.prototype.insertAttachment = function (t) {
  4257. return this.insertAttachments([t])
  4258. }, d.prototype.insertAttachments = function (t) {
  4259. var n, i, o, r, s, a, u, c, l;
  4260. for (c = new e.Text, r = 0, s = t.length; s > r; r++) n = t[r], l = n.getType(), a = null != (u = e.config.attachments[l]) ? u.presentation : void 0, o = this.getCurrentTextAttributes(), a && (o.presentation = a), i = e.Text.textForAttachmentWithAttributes(n, o), c = c.appendText(i);
  4261. return this.insertText(c)
  4262. }, d.prototype.shouldManageDeletingInDirection = function (t) {
  4263. var e;
  4264. if (e = this.getLocationRange(), u(e)) {
  4265. if ("backward" === t && 0 === e[0].offset) return !0;
  4266. if (this.shouldManageMovingCursorInDirection(t)) return !0
  4267. } else if (e[0].index !== e[1].index) return !0;
  4268. return !1
  4269. }, d.prototype.deleteInDirection = function (t, e) {
  4270. var n, i, o, r, s, a, c, l;
  4271. return r = (null != e ? e : {}).length, s = this.getLocationRange(), a = this.getSelectedRange(), c = u(a), c ? o = "backward" === t && 0 === s[0].offset : l = s[0].index !== s[1].index, o && this.canDecreaseBlockAttributeLevel() && (i = this.getBlock(), i.isListItem() ? this.decreaseListLevel() : this.decreaseBlockAttributeLevel(), this.setSelection(a[0]), i.isEmpty()) ? !1 : (c && (a = this.getExpandedRangeInDirection(t, {length: r}), "backward" === t && (n = this.getAttachmentAtRange(a))), n ? (this.editAttachment(n), !1) : (this.setDocument(this.document.removeTextAtRange(a)), this.setSelection(a[0]), o || l ? !1 : void 0))
  4272. }, d.prototype.moveTextFromRange = function (t) {
  4273. var e;
  4274. return e = this.getSelectedRange()[0], this.setDocument(this.document.moveTextFromRangeToPosition(t, e)), this.setSelection(e)
  4275. }, d.prototype.removeAttachment = function (t) {
  4276. var e;
  4277. return (e = this.document.getRangeOfAttachment(t)) ? (this.stopEditingAttachment(), this.setDocument(this.document.removeTextAtRange(e)), this.setSelection(e[0])) : void 0
  4278. }, d.prototype.removeLastBlockAttribute = function () {
  4279. var t, e, n, i;
  4280. return n = this.getSelectedRange(), i = n[0], e = n[1], t = this.document.getBlockAtPosition(e), this.removeCurrentAttribute(t.getLastAttribute()), this.setSelection(i)
  4281. }, f = " ", d.prototype.insertPlaceholder = function () {
  4282. return this.placeholderPosition = this.getPosition(), this.insertString(f)
  4283. }, d.prototype.selectPlaceholder = function () {
  4284. return null != this.placeholderPosition ? (this.setSelectedRange([this.placeholderPosition, this.placeholderPosition + f.length]), this.getSelectedRange()) : void 0
  4285. }, d.prototype.forgetPlaceholder = function () {
  4286. return this.placeholderPosition = null
  4287. }, d.prototype.hasCurrentAttribute = function (t) {
  4288. var e;
  4289. return e = this.currentAttributes[t], null != e && e !== !1
  4290. }, d.prototype.toggleCurrentAttribute = function (t) {
  4291. var e;
  4292. return (e = !this.currentAttributes[t]) ? this.setCurrentAttribute(t, e) : this.removeCurrentAttribute(t)
  4293. }, d.prototype.canSetCurrentAttribute = function (t) {
  4294. return o(t) ? this.canSetCurrentBlockAttribute(t) : this.canSetCurrentTextAttribute(t)
  4295. }, d.prototype.canSetCurrentTextAttribute = function () {
  4296. var t, e, n, i, o;
  4297. if (e = this.getSelectedDocument()) {
  4298. for (o = e.getAttachments(), n = 0, i = o.length; i > n; n++) if (t = o[n], !t.hasContent()) return !1;
  4299. return !0
  4300. }
  4301. }, d.prototype.canSetCurrentBlockAttribute = function () {
  4302. var t;
  4303. if (t = this.getBlock()) return !t.isTerminalBlock()
  4304. }, d.prototype.setCurrentAttribute = function (t, e) {
  4305. return o(t) ? this.setBlockAttribute(t, e) : (this.setTextAttribute(t, e), this.currentAttributes[t] = e, this.notifyDelegateOfCurrentAttributesChange())
  4306. }, d.prototype.setTextAttribute = function (t, n) {
  4307. var i, o, r, s;
  4308. if (o = this.getSelectedRange()) return r = o[0], i = o[1], r !== i ? this.setDocument(this.document.addAttributeAtRange(t, n, o)) : "href" === t ? (s = e.Text.textForStringWithAttributes(n, {href: n}), this.insertText(s)) : void 0
  4309. }, d.prototype.setBlockAttribute = function (t, e) {
  4310. var n, i;
  4311. if (i = this.getSelectedRange()) return this.canSetCurrentAttribute(t) ? (n = this.getBlock(), this.setDocument(this.document.applyBlockAttributeAtRange(t, e, i)), this.setSelection(i)) : void 0
  4312. }, d.prototype.removeCurrentAttribute = function (t) {
  4313. return o(t) ? (this.removeBlockAttribute(t), this.updateCurrentAttributes()) : (this.removeTextAttribute(t), delete this.currentAttributes[t], this.notifyDelegateOfCurrentAttributesChange())
  4314. }, d.prototype.removeTextAttribute = function (t) {
  4315. var e;
  4316. if (e = this.getSelectedRange()) return this.setDocument(this.document.removeAttributeAtRange(t, e))
  4317. }, d.prototype.removeBlockAttribute = function (t) {
  4318. var e;
  4319. if (e = this.getSelectedRange()) return this.setDocument(this.document.removeAttributeAtRange(t, e))
  4320. }, d.prototype.canDecreaseNestingLevel = function () {
  4321. var t;
  4322. return (null != (t = this.getBlock()) ? t.getNestingLevel() : void 0) > 0
  4323. }, d.prototype.canIncreaseNestingLevel = function () {
  4324. var e, n, i;
  4325. if (e = this.getBlock()) return (null != (i = o(e.getLastNestableAttribute())) ? i.listAttribute : 0) ? (n = this.getPreviousBlock()) ? t(n.getListItemAttributes(), e.getListItemAttributes()) : void 0 : e.getNestingLevel() > 0
  4326. }, d.prototype.decreaseNestingLevel = function () {
  4327. var t;
  4328. if (t = this.getBlock()) return this.setDocument(this.document.replaceBlock(t, t.decreaseNestingLevel()))
  4329. }, d.prototype.increaseNestingLevel = function () {
  4330. var t;
  4331. if (t = this.getBlock()) return this.setDocument(this.document.replaceBlock(t, t.increaseNestingLevel()))
  4332. }, d.prototype.canDecreaseBlockAttributeLevel = function () {
  4333. var t;
  4334. return (null != (t = this.getBlock()) ? t.getAttributeLevel() : void 0) > 0
  4335. }, d.prototype.decreaseBlockAttributeLevel = function () {
  4336. var t, e;
  4337. return (t = null != (e = this.getBlock()) ? e.getLastAttribute() : void 0) ? this.removeCurrentAttribute(t) : void 0
  4338. }, d.prototype.decreaseListLevel = function () {
  4339. var t, e, n, i, o, r;
  4340. for (r = this.getSelectedRange()[0], o = this.document.locationFromPosition(r).index, n = o, t = this.getBlock().getAttributeLevel(); (e = this.document.getBlockAtIndex(n + 1)) && e.isListItem() && e.getAttributeLevel() > t;) n++;
  4341. return r = this.document.positionFromLocation({
  4342. index: o,
  4343. offset: 0
  4344. }), i = this.document.positionFromLocation({
  4345. index: n,
  4346. offset: 0
  4347. }), this.setDocument(this.document.removeLastListAttributeAtRange([r, i]))
  4348. }, d.prototype.updateCurrentAttributes = function () {
  4349. var t, e, n, o, r, s;
  4350. if (s = this.getSelectedRange({ignoreLock: !0})) {
  4351. for (e = this.document.getCommonAttributesAtRange(s), r = i(), n = 0, o = r.length; o > n; n++) t = r[n], e[t] || this.canSetCurrentAttribute(t) || (e[t] = !1);
  4352. if (!a(e, this.currentAttributes)) return this.currentAttributes = e, this.notifyDelegateOfCurrentAttributesChange()
  4353. }
  4354. }, d.prototype.getCurrentAttributes = function () {
  4355. return n.call({}, this.currentAttributes)
  4356. }, d.prototype.getCurrentTextAttributes = function () {
  4357. var t, e, n, i;
  4358. t = {}, n = this.currentAttributes;
  4359. for (e in n) i = n[e], i !== !1 && r(e) && (t[e] = i);
  4360. return t
  4361. }, d.prototype.freezeSelection = function () {
  4362. return this.setCurrentAttribute("frozen", !0)
  4363. }, d.prototype.thawSelection = function () {
  4364. return this.removeCurrentAttribute("frozen")
  4365. }, d.prototype.hasFrozenSelection = function () {
  4366. return this.hasCurrentAttribute("frozen")
  4367. }, d.proxyMethod("getSelectionManager().getPointRange"), d.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"), d.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"), d.proxyMethod("getSelectionManager().locationIsCursorTarget"), d.proxyMethod("getSelectionManager().selectionIsExpanded"), d.proxyMethod("delegate?.getSelectionManager"), d.prototype.setSelection = function (t) {
  4368. var e, n;
  4369. return e = this.document.locationRangeFromRange(t), null != (n = this.delegate) ? n.compositionDidRequestChangingSelectionToLocationRange(e) : void 0
  4370. }, d.prototype.getSelectedRange = function () {
  4371. var t;
  4372. return (t = this.getLocationRange()) ? this.document.rangeFromLocationRange(t) : void 0
  4373. }, d.prototype.setSelectedRange = function (t) {
  4374. var e;
  4375. return e = this.document.locationRangeFromRange(t), this.getSelectionManager().setLocationRange(e)
  4376. }, d.prototype.getPosition = function () {
  4377. var t;
  4378. return (t = this.getLocationRange()) ? this.document.positionFromLocation(t[0]) : void 0
  4379. }, d.prototype.getLocationRange = function (t) {
  4380. var e, n;
  4381. return null != (e = null != (n = this.targetLocationRange) ? n : this.getSelectionManager().getLocationRange(t)) ? e : s({
  4382. index: 0,
  4383. offset: 0
  4384. })
  4385. }, d.prototype.withTargetLocationRange = function (t, e) {
  4386. var n;
  4387. this.targetLocationRange = t;
  4388. try {
  4389. n = e()
  4390. } finally {
  4391. this.targetLocationRange = null
  4392. }
  4393. return n
  4394. }, d.prototype.withTargetRange = function (t, e) {
  4395. var n;
  4396. return n = this.document.locationRangeFromRange(t), this.withTargetLocationRange(n, e)
  4397. }, d.prototype.withTargetDOMRange = function (t, e) {
  4398. var n;
  4399. return n = this.createLocationRangeFromDOMRange(t, {strict: !1}), this.withTargetLocationRange(n, e)
  4400. }, d.prototype.getExpandedRangeInDirection = function (t, e) {
  4401. var n, i, o, r;
  4402. return i = (null != e ? e : {}).length, o = this.getSelectedRange(), r = o[0], n = o[1], "backward" === t ? i ? r -= i : r = this.translateUTF16PositionFromOffset(r, -1) : i ? n += i : n = this.translateUTF16PositionFromOffset(n, 1), s([r, n])
  4403. }, d.prototype.shouldManageMovingCursorInDirection = function (t) {
  4404. var e;
  4405. return this.editingAttachment ? !0 : (e = this.getExpandedRangeInDirection(t), null != this.getAttachmentAtRange(e))
  4406. }, d.prototype.moveCursorInDirection = function (t) {
  4407. var e, n, i, o;
  4408. return this.editingAttachment ? i = this.document.getRangeOfAttachment(this.editingAttachment) : (o = this.getSelectedRange(), i = this.getExpandedRangeInDirection(t), n = !c(o, i)), this.setSelectedRange("backward" === t ? i[0] : i[1]), n && (e = this.getAttachmentAtRange(i)) ? this.editAttachment(e) : void 0
  4409. }, d.prototype.expandSelectionInDirection = function (t, e) {
  4410. var n, i;
  4411. return n = (null != e ? e : {}).length, i = this.getExpandedRangeInDirection(t, {length: n}), this.setSelectedRange(i)
  4412. }, d.prototype.expandSelectionForEditing = function () {
  4413. return this.hasCurrentAttribute("href") ? this.expandSelectionAroundCommonAttribute("href") : void 0
  4414. }, d.prototype.expandSelectionAroundCommonAttribute = function (t) {
  4415. var e, n;
  4416. return e = this.getPosition(), n = this.document.getRangeOfCommonAttributeAtPosition(t, e), this.setSelectedRange(n)
  4417. }, d.prototype.selectionContainsAttachments = function () {
  4418. var t;
  4419. return (null != (t = this.getSelectedAttachments()) ? t.length : void 0) > 0
  4420. }, d.prototype.selectionIsInCursorTarget = function () {
  4421. return this.editingAttachment || this.positionIsCursorTarget(this.getPosition())
  4422. }, d.prototype.positionIsCursorTarget = function (t) {
  4423. var e;
  4424. return (e = this.document.locationFromPosition(t)) ? this.locationIsCursorTarget(e) : void 0
  4425. }, d.prototype.positionIsBlockBreak = function (t) {
  4426. var e;
  4427. return null != (e = this.document.getPieceAtPosition(t)) ? e.isBlockBreak() : void 0
  4428. }, d.prototype.getSelectedDocument = function () {
  4429. var t;
  4430. return (t = this.getSelectedRange()) ? this.document.getDocumentAtRange(t) : void 0
  4431. }, d.prototype.getSelectedAttachments = function () {
  4432. var t;
  4433. return null != (t = this.getSelectedDocument()) ? t.getAttachments() : void 0
  4434. }, d.prototype.getAttachments = function () {
  4435. return this.attachments.slice(0)
  4436. }, d.prototype.refreshAttachments = function () {
  4437. var t, e, n, i, o, r, s, a, u, c, h, p;
  4438. for (n = this.document.getAttachments(), a = l(this.attachments, n), t = a.added, h = a.removed, this.attachments = n, i = 0, r = h.length; r > i; i++) e = h[i], e.delegate = null, null != (u = this.delegate) && "function" == typeof u.compositionDidRemoveAttachment && u.compositionDidRemoveAttachment(e);
  4439. for (p = [], o = 0, s = t.length; s > o; o++) e = t[o], e.delegate = this, p.push(null != (c = this.delegate) && "function" == typeof c.compositionDidAddAttachment ? c.compositionDidAddAttachment(e) : void 0);
  4440. return p
  4441. }, d.prototype.attachmentDidChangeAttributes = function (t) {
  4442. var e;
  4443. return this.revision++, null != (e = this.delegate) && "function" == typeof e.compositionDidEditAttachment ? e.compositionDidEditAttachment(t) : void 0
  4444. }, d.prototype.attachmentDidChangePreviewURL = function (t) {
  4445. var e;
  4446. return this.revision++, null != (e = this.delegate) && "function" == typeof e.compositionDidChangeAttachmentPreviewURL ? e.compositionDidChangeAttachmentPreviewURL(t) : void 0
  4447. }, d.prototype.editAttachment = function (t, e) {
  4448. var n;
  4449. if (t !== this.editingAttachment) return this.stopEditingAttachment(), this.editingAttachment = t, null != (n = this.delegate) && "function" == typeof n.compositionDidStartEditingAttachment ? n.compositionDidStartEditingAttachment(this.editingAttachment, e) : void 0
  4450. }, d.prototype.stopEditingAttachment = function () {
  4451. var t;
  4452. if (this.editingAttachment) return null != (t = this.delegate) && "function" == typeof t.compositionDidStopEditingAttachment && t.compositionDidStopEditingAttachment(this.editingAttachment), this.editingAttachment = null
  4453. }, d.prototype.updateAttributesForAttachment = function (t, e) {
  4454. return this.setDocument(this.document.updateAttributesForAttachment(t, e))
  4455. }, d.prototype.removeAttributeForAttachment = function (t, e) {
  4456. return this.setDocument(this.document.removeAttributeForAttachment(t, e))
  4457. }, d.prototype.breakFormattedBlock = function (t) {
  4458. var n, i, o, r, s;
  4459. return i = t.document, n = t.block, r = t.startPosition, s = [r - 1, r], n.getBlockBreakPosition() === t.startLocation.offset ? (n.breaksOnReturn() && "\n" === t.nextCharacter ? r += 1 : i = i.removeTextAtRange(s), s = [r, r]) : "\n" === t.nextCharacter ? "\n" === t.previousCharacter ? s = [r - 1, r + 1] : (s = [r, r + 1], r += 1) : t.startLocation.offset - 1 !== 0 && (r += 1), o = new e.Document([n.removeLastAttribute().copyWithoutText()]), this.setDocument(i.insertDocumentAtRange(o, s)), this.setSelection(r)
  4460. }, d.prototype.getPreviousBlock = function () {
  4461. var t, e;
  4462. return (e = this.getLocationRange()) && (t = e[0].index, t > 0) ? this.document.getBlockAtIndex(t - 1) : void 0
  4463. }, d.prototype.getBlock = function () {
  4464. var t;
  4465. return (t = this.getLocationRange()) ? this.document.getBlockAtIndex(t[0].index) : void 0
  4466. }, d.prototype.getAttachmentAtRange = function (t) {
  4467. var n;
  4468. return n = this.document.getDocumentAtRange(t), n.toString() === e.OBJECT_REPLACEMENT_CHARACTER + "\n" ? n.getAttachments()[0] : void 0
  4469. }, d.prototype.notifyDelegateOfCurrentAttributesChange = function () {
  4470. var t;
  4471. return null != (t = this.delegate) && "function" == typeof t.compositionDidChangeCurrentAttributes ? t.compositionDidChangeCurrentAttributes(this.currentAttributes) : void 0
  4472. }, d.prototype.notifyDelegateOfInsertionAtRange = function (t) {
  4473. var e;
  4474. return null != (e = this.delegate) && "function" == typeof e.compositionDidPerformInsertionAtRange ? e.compositionDidPerformInsertionAtRange(t) : void 0
  4475. }, d.prototype.translateUTF16PositionFromOffset = function (t, e) {
  4476. var n, i;
  4477. return i = this.document.toUTF16String(), n = i.offsetFromUCS2Offset(t), i.offsetToUCS2Offset(n + e)
  4478. }, d
  4479. }(e.BasicObject)
  4480. }.call(this), function () {
  4481. var t = function (t, e) {
  4482. function i() {
  4483. this.constructor = t
  4484. }
  4485. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  4486. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  4487. }, n = {}.hasOwnProperty;
  4488. e.UndoManager = function (e) {
  4489. function n(t) {
  4490. this.composition = t, this.undoEntries = [], this.redoEntries = []
  4491. }
  4492. var i;
  4493. return t(n, e), n.prototype.recordUndoEntry = function (t, e) {
  4494. var n, o, r, s, a;
  4495. return s = null != e ? e : {}, o = s.context, n = s.consolidatable, r = this.undoEntries.slice(-1)[0], n && i(r, t, o) ? void 0 : (a = this.createEntry({
  4496. description: t,
  4497. context: o
  4498. }), this.undoEntries.push(a), this.redoEntries = [])
  4499. }, n.prototype.undo = function () {
  4500. var t, e;
  4501. return (e = this.undoEntries.pop()) ? (t = this.createEntry(e), this.redoEntries.push(t), this.composition.loadSnapshot(e.snapshot)) : void 0
  4502. }, n.prototype.redo = function () {
  4503. var t, e;
  4504. return (t = this.redoEntries.pop()) ? (e = this.createEntry(t), this.undoEntries.push(e), this.composition.loadSnapshot(t.snapshot)) : void 0
  4505. }, n.prototype.canUndo = function () {
  4506. return this.undoEntries.length > 0
  4507. }, n.prototype.canRedo = function () {
  4508. return this.redoEntries.length > 0
  4509. }, n.prototype.createEntry = function (t) {
  4510. var e, n, i;
  4511. return i = null != t ? t : {}, n = i.description, e = i.context, {
  4512. description: null != n ? n.toString() : void 0,
  4513. context: JSON.stringify(e),
  4514. snapshot: this.composition.getSnapshot()
  4515. }
  4516. }, i = function (t, e, n) {
  4517. return (null != t ? t.description : void 0) === (null != e ? e.toString() : void 0) && (null != t ? t.context : void 0) === JSON.stringify(n)
  4518. }, n
  4519. }(e.BasicObject)
  4520. }.call(this), function () {
  4521. var t;
  4522. e.attachmentGalleryFilter = function (e) {
  4523. var n;
  4524. return n = new t(e), n.perform(), n.getSnapshot()
  4525. }, t = function () {
  4526. function t(t) {
  4527. this.document = t.document, this.selectedRange = t.selectedRange
  4528. }
  4529. var e, n, i;
  4530. return e = "attachmentGallery", n = "presentation", i = "gallery", t.prototype.perform = function () {
  4531. return this.removeBlockAttribute(), this.applyBlockAttribute()
  4532. }, t.prototype.getSnapshot = function () {
  4533. return {document: this.document, selectedRange: this.selectedRange}
  4534. }, t.prototype.removeBlockAttribute = function () {
  4535. var t, n, i, o, r;
  4536. for (o = this.findRangesOfBlocks(), r = [], t = 0, n = o.length; n > t; t++) i = o[t], r.push(this.document = this.document.removeAttributeAtRange(e, i));
  4537. return r
  4538. }, t.prototype.applyBlockAttribute = function () {
  4539. var t, n, i, o, r, s;
  4540. for (i = 0, r = this.findRangesOfPieces(), s = [], t = 0, n = r.length; n > t; t++) o = r[t], o[1] - o[0] > 1 && (o[0] += i, o[1] += i, "\n" !== this.document.getCharacterAtPosition(o[1]) && (this.document = this.document.insertBlockBreakAtRange(o[1]), o[1] < this.selectedRange[1] && this.moveSelectedRangeForward(), o[1]++, i++), 0 !== o[0] && "\n" !== this.document.getCharacterAtPosition(o[0] - 1) && (this.document = this.document.insertBlockBreakAtRange(o[0]), o[0] < this.selectedRange[0] && this.moveSelectedRangeForward(), o[0]++, i++), s.push(this.document = this.document.applyBlockAttributeAtRange(e, !0, o)));
  4541. return s
  4542. }, t.prototype.findRangesOfBlocks = function () {
  4543. return this.document.findRangesForBlockAttribute(e)
  4544. }, t.prototype.findRangesOfPieces = function () {
  4545. return this.document.findRangesForTextAttribute(n, {withValue: i})
  4546. }, t.prototype.moveSelectedRangeForward = function () {
  4547. return this.selectedRange[0] += 1, this.selectedRange[1] += 1
  4548. }, t
  4549. }()
  4550. }.call(this), function () {
  4551. var t = function (t, e) {
  4552. return function () {
  4553. return t.apply(e, arguments)
  4554. }
  4555. };
  4556. e.Editor = function () {
  4557. function n(n, o, r) {
  4558. this.composition = n, this.selectionManager = o, this.element = r, this.insertFiles = t(this.insertFiles, this), this.undoManager = new e.UndoManager(this.composition), this.filters = i.slice(0)
  4559. }
  4560. var i;
  4561. return i = [e.attachmentGalleryFilter], n.prototype.loadDocument = function (t) {
  4562. return this.loadSnapshot({document: t, selectedRange: [0, 0]})
  4563. }, n.prototype.loadHTML = function (t) {
  4564. return null == t && (t = ""), this.loadDocument(e.Document.fromHTML(t, {referenceElement: this.element}))
  4565. }, n.prototype.loadJSON = function (t) {
  4566. var n, i;
  4567. return n = t.document, i = t.selectedRange, n = e.Document.fromJSON(n), this.loadSnapshot({
  4568. document: n,
  4569. selectedRange: i
  4570. })
  4571. }, n.prototype.loadSnapshot = function (t) {
  4572. return this.undoManager = new e.UndoManager(this.composition), this.composition.loadSnapshot(t)
  4573. }, n.prototype.getDocument = function () {
  4574. return this.composition.document
  4575. }, n.prototype.getSelectedDocument = function () {
  4576. return this.composition.getSelectedDocument()
  4577. }, n.prototype.getSnapshot = function () {
  4578. return this.composition.getSnapshot()
  4579. }, n.prototype.toJSON = function () {
  4580. return this.getSnapshot()
  4581. }, n.prototype.deleteInDirection = function (t) {
  4582. return this.composition.deleteInDirection(t)
  4583. }, n.prototype.insertAttachment = function (t) {
  4584. return this.composition.insertAttachment(t)
  4585. }, n.prototype.insertDocument = function (t) {
  4586. return this.composition.insertDocument(t)
  4587. }, n.prototype.insertFile = function (t) {
  4588. return this.composition.insertFile(t)
  4589. }, n.prototype.insertFiles = function (t) {
  4590. return this.composition.insertFiles(t)
  4591. }, n.prototype.insertHTML = function (t) {
  4592. return this.composition.insertHTML(t)
  4593. }, n.prototype.insertString = function (t) {
  4594. return this.composition.insertString(t)
  4595. }, n.prototype.insertText = function (t) {
  4596. return this.composition.insertText(t)
  4597. }, n.prototype.insertLineBreak = function () {
  4598. return this.composition.insertLineBreak()
  4599. }, n.prototype.getSelectedRange = function () {
  4600. return this.composition.getSelectedRange()
  4601. }, n.prototype.getPosition = function () {
  4602. return this.composition.getPosition()
  4603. }, n.prototype.getClientRectAtPosition = function (t) {
  4604. var e;
  4605. return e = this.getDocument().locationRangeFromRange([t, t + 1]), this.selectionManager.getClientRectAtLocationRange(e)
  4606. }, n.prototype.expandSelectionInDirection = function (t) {
  4607. return this.composition.expandSelectionInDirection(t)
  4608. }, n.prototype.moveCursorInDirection = function (t) {
  4609. return this.composition.moveCursorInDirection(t)
  4610. }, n.prototype.setSelectedRange = function (t) {
  4611. return this.composition.setSelectedRange(t)
  4612. }, n.prototype.activateAttribute = function (t, e) {
  4613. return null == e && (e = !0), this.composition.setCurrentAttribute(t, e)
  4614. }, n.prototype.attributeIsActive = function (t) {
  4615. return this.composition.hasCurrentAttribute(t)
  4616. }, n.prototype.canActivateAttribute = function (t) {
  4617. return this.composition.canSetCurrentAttribute(t)
  4618. }, n.prototype.deactivateAttribute = function (t) {
  4619. return this.composition.removeCurrentAttribute(t)
  4620. }, n.prototype.canDecreaseNestingLevel = function () {
  4621. return this.composition.canDecreaseNestingLevel()
  4622. }, n.prototype.canIncreaseNestingLevel = function () {
  4623. return this.composition.canIncreaseNestingLevel()
  4624. }, n.prototype.decreaseNestingLevel = function () {
  4625. return this.canDecreaseNestingLevel() ? this.composition.decreaseNestingLevel() : void 0
  4626. }, n.prototype.increaseNestingLevel = function () {
  4627. return this.canIncreaseNestingLevel() ? this.composition.increaseNestingLevel() : void 0
  4628. }, n.prototype.canRedo = function () {
  4629. return this.undoManager.canRedo()
  4630. }, n.prototype.canUndo = function () {
  4631. return this.undoManager.canUndo()
  4632. }, n.prototype.recordUndoEntry = function (t, e) {
  4633. var n, i, o;
  4634. return o = null != e ? e : {}, i = o.context, n = o.consolidatable, this.undoManager.recordUndoEntry(t, {
  4635. context: i,
  4636. consolidatable: n
  4637. })
  4638. }, n.prototype.redo = function () {
  4639. return this.canRedo() ? this.undoManager.redo() : void 0
  4640. }, n.prototype.undo = function () {
  4641. return this.canUndo() ? this.undoManager.undo() : void 0
  4642. }, n
  4643. }()
  4644. }.call(this), function () {
  4645. var t = function (t, e) {
  4646. function i() {
  4647. this.constructor = t
  4648. }
  4649. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  4650. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  4651. }, n = {}.hasOwnProperty;
  4652. e.ManagedAttachment = function (e) {
  4653. function n(t, e) {
  4654. var n;
  4655. this.attachmentManager = t, this.attachment = e, n = this.attachment, this.id = n.id, this.file = n.file
  4656. }
  4657. return t(n, e), n.prototype.remove = function () {
  4658. return this.attachmentManager.requestRemovalOfAttachment(this.attachment)
  4659. }, n.proxyMethod("attachment.getAttribute"), n.proxyMethod("attachment.hasAttribute"), n.proxyMethod("attachment.setAttribute"), n.proxyMethod("attachment.getAttributes"), n.proxyMethod("attachment.setAttributes"), n.proxyMethod("attachment.isPending"), n.proxyMethod("attachment.isPreviewable"), n.proxyMethod("attachment.getURL"), n.proxyMethod("attachment.getHref"), n.proxyMethod("attachment.getFilename"), n.proxyMethod("attachment.getFilesize"), n.proxyMethod("attachment.getFormattedFilesize"), n.proxyMethod("attachment.getExtension"), n.proxyMethod("attachment.getContentType"), n.proxyMethod("attachment.getFile"), n.proxyMethod("attachment.setFile"), n.proxyMethod("attachment.releaseFile"), n.proxyMethod("attachment.getUploadProgress"), n.proxyMethod("attachment.setUploadProgress"), n
  4660. }(e.BasicObject)
  4661. }.call(this), function () {
  4662. var t = function (t, e) {
  4663. function i() {
  4664. this.constructor = t
  4665. }
  4666. for (var o in e) n.call(e, o) && (t[o] = e[o]);
  4667. return i.prototype = e.prototype, t.prototype = new i, t.__super__ = e.prototype, t
  4668. }, n = {}.hasOwnProperty;
  4669. e.AttachmentManager = function (n) {
  4670. function i(t) {
  4671. var e, n, i;
  4672. for (null == t && (t = []), this.managedAttachments = {}, n = 0, i = t.length; i > n; n++) e = t[n], this.manageAttachment(e)
  4673. }
  4674. return t(i, n), i.prototype.getAttachments = function () {
  4675. var t, e, n, i;
  4676. n = this.managedAttachments, i = [];
  4677. for (e in n) t = n[e], i.push(t);
  4678. return i
  4679. }, i.prototype.manageAttachment = function (t) {
  4680. var n, i;
  4681. return null != (n = this.managedAttachments)[i = t.id] ? n[i] : n[i] = new e.ManagedAttachment(this, t)
  4682. }, i.prototype.attachmentIsManaged = function (t) {
  4683. return t.id in this.managedAttachments
  4684. }, i.prototype.requestRemovalOfAttachment = function (t) {
  4685. var e;
  4686. return this.attachmentIsManaged(t) && null != (e = this.delegate) && "function" == typeof e.attachmentManagerDidRequestRemovalOfAttachment ? e.attachmentManagerDidRequestRemovalOfAttachment(t) : void 0
  4687. }, i.prototype.unmanageAttachment = function (t) {
  4688. var e;
  4689. return e = this.managedAttachments[t.id], delete this.managedAttachments[t.id], e
  4690. }, i
  4691. }(e.BasicObject)
  4692. }.call(this), function () {
  4693. var t, n, i, o, r, s, a, u, c, l, h;
  4694. t = e.elementContainsNode, n = e.findChildIndexOfNode, r = e.nodeIsBlockStart, s = e.nodeIsBlockStartComment, o = e.nodeIsBlockContainer, a = e.nodeIsCursorTarget, u = e.nodeIsEmptyTextNode, c = e.nodeIsTextNode, i = e.nodeIsAttachmentElement, l = e.tagName, h = e.walkTree, e.LocationMapper = function () {
  4695. function e(t) {
  4696. this.element = t
  4697. }
  4698. var p, d, f, g;
  4699. return e.prototype.findLocationFromContainerAndOffset = function (e, i, o) {
  4700. var s, u, l, p, g, m, v;
  4701. for (m = (null != o ? o : {strict: !0}).strict, u = 0, l = !1, p = {
  4702. index: 0,
  4703. offset: 0
  4704. }, (s = this.findAttachmentElementParentForNode(e)) && (e = s.parentNode, i = n(s)), v = h(this.element, {usingFilter: f}); v.nextNode();) {
  4705. if (g = v.currentNode, g === e && c(e)) {
  4706. a(g) || (p.offset += i);
  4707. break
  4708. }
  4709. if (g.parentNode === e) {
  4710. if (u++ === i) break
  4711. } else if (!t(e, g) && u > 0) break;
  4712. r(g, {strict: m}) ? (l && p.index++, p.offset = 0, l = !0) : p.offset += d(g)
  4713. }
  4714. return p
  4715. }, e.prototype.findContainerAndOffsetFromLocation = function (t) {
  4716. var e, i, s, u, l;
  4717. if (0 === t.index && 0 === t.offset) {
  4718. for (e = this.element, u = 0; e.firstChild;) if (e = e.firstChild, o(e)) {
  4719. u = 1;
  4720. break
  4721. }
  4722. return [e, u]
  4723. }
  4724. if (l = this.findNodeAndOffsetFromLocation(t), i = l[0], s = l[1], i) {
  4725. if (c(i)) 0 === d(i) ? (e = i.parentNode.parentNode, u = n(i.parentNode), a(i, {name: "right"}) && u++) : (e = i, u = t.offset - s); else {
  4726. if (e = i.parentNode, !r(i.previousSibling) && !o(e)) for (; i === e.lastChild && (i = e, e = e.parentNode, !o(e));) ;
  4727. u = n(i), 0 !== t.offset && u++
  4728. }
  4729. return [e, u]
  4730. }
  4731. }, e.prototype.findNodeAndOffsetFromLocation = function (t) {
  4732. var e, n, i, o, r, s, u, l;
  4733. for (u = 0, l = this.getSignificantNodesForIndex(t.index), n = 0, i = l.length; i > n; n++) {
  4734. if (e = l[n], o = d(e), t.offset <= u + o) if (c(e)) {
  4735. if (r = e, s = u, t.offset === s && a(r)) break
  4736. } else r || (r = e, s = u);
  4737. if (u += o, u > t.offset) break
  4738. }
  4739. return [r, s]
  4740. }, e.prototype.findAttachmentElementParentForNode = function (t) {
  4741. for (; t && t !== this.element;) {
  4742. if (i(t)) return t;
  4743. t = t.parentNode
  4744. }
  4745. }, e.prototype.getSignificantNodesForIndex = function (t) {
  4746. var e, n, i, o, r;
  4747. for (i = [], r = h(this.element, {usingFilter: p}), o = !1; r.nextNode();) if (n = r.currentNode, s(n)) {
  4748. if ("undefined" != typeof e && null !== e ? e++ : e = 0, e === t) o = !0; else if (o) break
  4749. } else o && i.push(n);
  4750. return i
  4751. }, d = function (t) {
  4752. var e;
  4753. return t.nodeType === Node.TEXT_NODE ? a(t) ? 0 : (e = t.textContent, e.length) : "br" === l(t) || i(t) ? 1 : 0
  4754. }, p = function (t) {
  4755. return g(t) === NodeFilter.FILTER_ACCEPT ? f(t) : NodeFilter.FILTER_REJECT
  4756. }, g = function (t) {
  4757. return u(t) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
  4758. }, f = function (t) {
  4759. return i(t.parentNode) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
  4760. }, e
  4761. }()
  4762. }.call(this), function () {
  4763. var t, n, i = [].slice;
  4764. t = e.getDOMRange, n = e.setDOMRange, e.PointMapper = function () {
  4765. function e() {
  4766. }
  4767. return e.prototype.createDOMRangeFromPoint = function (e) {
  4768. var i, o, r, s, a, u, c, l;
  4769. if (c = e.x, l = e.y, document.caretPositionFromPoint) return a = document.caretPositionFromPoint(c, l), r = a.offsetNode, o = a.offset, i = document.createRange(), i.setStart(r, o), i;
  4770. if (document.caretRangeFromPoint) return document.caretRangeFromPoint(c, l);
  4771. if (document.body.createTextRange) {
  4772. s = t();
  4773. try {
  4774. u = document.body.createTextRange(), u.moveToPoint(c, l), u.select()
  4775. } catch (h) {
  4776. }
  4777. return i = t(), n(s), i
  4778. }
  4779. }, e.prototype.getClientRectsForDOMRange = function (t) {
  4780. var e, n, o;
  4781. return n = i.call(t.getClientRects()), o = n[0], e = n[n.length - 1], [o, e]
  4782. }, e
  4783. }()
  4784. }.call(this), function () {
  4785. var t, n = function (t, e) {
  4786. return function () {
  4787. return t.apply(e, arguments)
  4788. }
  4789. }, i = function (t, e) {
  4790. function n() {
  4791. this.constructor = t
  4792. }
  4793. for (var i in e) o.call(e, i) && (t[i] = e[i]);
  4794. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  4795. }, o = {}.hasOwnProperty, r = [].indexOf || function (t) {
  4796. for (var e = 0, n = this.length; n > e; e++) if (e in this && this[e] === t) return e;
  4797. return -1
  4798. };
  4799. t = e.getDOMRange, e.SelectionChangeObserver = function (e) {
  4800. function o() {
  4801. this.run = n(this.run, this), this.update = n(this.update, this), this.selectionManagers = []
  4802. }
  4803. var s;
  4804. return i(o, e), o.prototype.start = function () {
  4805. return this.started ? void 0 : (this.started = !0, "onselectionchange" in document ? document.addEventListener("selectionchange", this.update, !0) : this.run())
  4806. }, o.prototype.stop = function () {
  4807. return this.started ? (this.started = !1, document.removeEventListener("selectionchange", this.update, !0)) : void 0
  4808. }, o.prototype.registerSelectionManager = function (t) {
  4809. return r.call(this.selectionManagers, t) < 0 ? (this.selectionManagers.push(t), this.start()) : void 0
  4810. }, o.prototype.unregisterSelectionManager = function (t) {
  4811. var e;
  4812. return this.selectionManagers = function () {
  4813. var n, i, o, r;
  4814. for (o = this.selectionManagers, r = [], n = 0, i = o.length; i > n; n++) e = o[n], e !== t && r.push(e);
  4815. return r
  4816. }.call(this), 0 === this.selectionManagers.length ? this.stop() : void 0
  4817. }, o.prototype.notifySelectionManagersOfSelectionChange = function () {
  4818. var t, e, n, i, o;
  4819. for (n = this.selectionManagers, i = [], t = 0, e = n.length; e > t; t++) o = n[t], i.push(o.selectionDidChange());
  4820. return i
  4821. }, o.prototype.update = function () {
  4822. var e;
  4823. return e = t(), s(e, this.domRange) ? void 0 : (this.domRange = e, this.notifySelectionManagersOfSelectionChange())
  4824. }, o.prototype.reset = function () {
  4825. return this.domRange = null, this.update()
  4826. }, o.prototype.run = function () {
  4827. return this.started ? (this.update(), requestAnimationFrame(this.run)) : void 0
  4828. }, s = function (t, e) {
  4829. return (null != t ? t.startContainer : void 0) === (null != e ? e.startContainer : void 0) && (null != t ? t.startOffset : void 0) === (null != e ? e.startOffset : void 0) && (null != t ? t.endContainer : void 0) === (null != e ? e.endContainer : void 0) && (null != t ? t.endOffset : void 0) === (null != e ? e.endOffset : void 0)
  4830. }, o
  4831. }(e.BasicObject), null == e.selectionChangeObserver && (e.selectionChangeObserver = new e.SelectionChangeObserver)
  4832. }.call(this), function () {
  4833. var t, n, i, o, r, s, a, u, c, l, h = function (t, e) {
  4834. return function () {
  4835. return t.apply(e, arguments)
  4836. }
  4837. }, p = function (t, e) {
  4838. function n() {
  4839. this.constructor = t
  4840. }
  4841. for (var i in e) d.call(e, i) && (t[i] = e[i]);
  4842. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  4843. }, d = {}.hasOwnProperty;
  4844. i = e.getDOMSelection, n = e.getDOMRange, l = e.setDOMRange, t = e.elementContainsNode, s = e.nodeIsCursorTarget, r = e.innerElementIsActive, o = e.handleEvent, a = e.normalizeRange, u = e.rangeIsCollapsed, c = e.rangesAreEqual, e.SelectionManager = function (d) {
  4845. function f(t) {
  4846. this.element = t, this.selectionDidChange = h(this.selectionDidChange, this), this.didMouseDown = h(this.didMouseDown, this), this.locationMapper = new e.LocationMapper(this.element), this.pointMapper = new e.PointMapper, this.lockCount = 0, o("mousedown", {
  4847. onElement: this.element,
  4848. withCallback: this.didMouseDown
  4849. })
  4850. }
  4851. return p(f, d), f.prototype.getLocationRange = function (t) {
  4852. var e, i;
  4853. return null == t && (t = {}), e = t.strict === !1 ? this.createLocationRangeFromDOMRange(n(), {strict: !1}) : t.ignoreLock ? this.currentLocationRange : null != (i = this.lockedLocationRange) ? i : this.currentLocationRange
  4854. }, f.prototype.setLocationRange = function (t) {
  4855. var e;
  4856. if (!this.lockedLocationRange) return t = a(t), (e = this.createDOMRangeFromLocationRange(t)) ? (l(e), this.updateCurrentLocationRange(t)) : void 0
  4857. }, f.prototype.setLocationRangeFromPointRange = function (t) {
  4858. var e, n;
  4859. return t = a(t), n = this.getLocationAtPoint(t[0]), e = this.getLocationAtPoint(t[1]), this.setLocationRange([n, e])
  4860. }, f.prototype.getClientRectAtLocationRange = function (t) {
  4861. var e;
  4862. return (e = this.createDOMRangeFromLocationRange(t)) ? this.getClientRectsForDOMRange(e)[1] : void 0
  4863. }, f.prototype.locationIsCursorTarget = function (t) {
  4864. var e, n, i;
  4865. return i = this.findNodeAndOffsetFromLocation(t), e = i[0], n = i[1], s(e)
  4866. }, f.prototype.lock = function () {
  4867. return 0 === this.lockCount++ ? (this.updateCurrentLocationRange(), this.lockedLocationRange = this.getLocationRange()) : void 0
  4868. }, f.prototype.unlock = function () {
  4869. var t;
  4870. return 0 === --this.lockCount && (t = this.lockedLocationRange, this.lockedLocationRange = null, null != t) ? this.setLocationRange(t) : void 0
  4871. }, f.prototype.clearSelection = function () {
  4872. var t;
  4873. return null != (t = i()) ? t.removeAllRanges() : void 0
  4874. }, f.prototype.selectionIsCollapsed = function () {
  4875. var t;
  4876. return (null != (t = n()) ? t.collapsed : void 0) === !0
  4877. }, f.prototype.selectionIsExpanded = function () {
  4878. return !this.selectionIsCollapsed()
  4879. }, f.prototype.createLocationRangeFromDOMRange = function (t, e) {
  4880. var n, i;
  4881. if (null != t && this.domRangeWithinElement(t) && (i = this.findLocationFromContainerAndOffset(t.startContainer, t.startOffset, e))) return t.collapsed || (n = this.findLocationFromContainerAndOffset(t.endContainer, t.endOffset, e)), a([i, n])
  4882. }, f.proxyMethod("locationMapper.findLocationFromContainerAndOffset"), f.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"), f.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"), f.proxyMethod("pointMapper.createDOMRangeFromPoint"), f.proxyMethod("pointMapper.getClientRectsForDOMRange"), f.prototype.didMouseDown = function () {
  4883. return this.pauseTemporarily()
  4884. }, f.prototype.pauseTemporarily = function () {
  4885. var e, n, i, r;
  4886. return this.paused = !0, n = function (e) {
  4887. return function () {
  4888. var n, o, s;
  4889. for (e.paused = !1, clearTimeout(r), o = 0, s = i.length; s > o; o++) n = i[o], n.destroy();
  4890. return t(document, e.element) ? e.selectionDidChange() : void 0
  4891. }
  4892. }(this), r = setTimeout(n, 200), i = function () {
  4893. var t, i, r, s;
  4894. for (r = ["mousemove", "keydown"], s = [], t = 0, i = r.length; i > t; t++) e = r[t], s.push(o(e, {
  4895. onElement: document,
  4896. withCallback: n
  4897. }));
  4898. return s
  4899. }()
  4900. }, f.prototype.selectionDidChange = function () {
  4901. return this.paused || r(this.element) ? void 0 : this.updateCurrentLocationRange()
  4902. }, f.prototype.updateCurrentLocationRange = function (t) {
  4903. var e;
  4904. return (null != t ? t : t = this.createLocationRangeFromDOMRange(n())) && !c(t, this.currentLocationRange) ? (this.currentLocationRange = t, null != (e = this.delegate) && "function" == typeof e.locationRangeDidChange ? e.locationRangeDidChange(this.currentLocationRange.slice(0)) : void 0) : void 0
  4905. }, f.prototype.createDOMRangeFromLocationRange = function (t) {
  4906. var e, n, i, o;
  4907. return i = this.findContainerAndOffsetFromLocation(t[0]), n = u(t) ? i : null != (o = this.findContainerAndOffsetFromLocation(t[1])) ? o : i, null != i && null != n ? (e = document.createRange(), e.setStart.apply(e, i), e.setEnd.apply(e, n), e) : void 0
  4908. }, f.prototype.getLocationAtPoint = function (t) {
  4909. var e, n;
  4910. return (e = this.createDOMRangeFromPoint(t)) && null != (n = this.createLocationRangeFromDOMRange(e)) ? n[0] : void 0
  4911. }, f.prototype.domRangeWithinElement = function (e) {
  4912. return e.collapsed ? t(this.element, e.startContainer) : t(this.element, e.startContainer) && t(this.element, e.endContainer)
  4913. }, f
  4914. }(e.BasicObject)
  4915. }.call(this), function () {
  4916. var t, n, i, o, r = function (t, e) {
  4917. function n() {
  4918. this.constructor = t
  4919. }
  4920. for (var i in e) s.call(e, i) && (t[i] = e[i]);
  4921. return n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype, t
  4922. }, s = {}.hasOwnProperty, a = [].slice;
  4923. i = e.rangeIsCollapsed, o = e.rangesAreEqual, n = e.objectsAreEqual, t = e.getBlockConfig, e.EditorController = function (s) {
  4924. function u(t) {
  4925. var n, i;
  4926. this.editorElement = t.editorElement, n = t.document, i = t.html, this.selectionManager = new e.SelectionManager(this.editorElement), this.selectionManager.delegate = this, this.composition = new e.Composition, this.composition.delegate = this, this.attachmentManager = new e.AttachmentManager(this.composition.getAttachments()), this.attachmentManager.delegate = this, this.inputController = new (e["Level" + e.config.input.getLevel() + "InputController"])(this.editorElement), this.inputController.delegate = this, this.inputController.responder = this.composition, this.compositionController = new e.CompositionController(this.editorElement, this.composition), this.compositionController.delegate = this, this.toolbarController = new e.ToolbarController(this.editorElement.toolbarElement), this.toolbarController.delegate = this, this.editor = new e.Editor(this.composition, this.selectionManager, this.editorElement), null != n ? this.editor.loadDocument(n) : this.editor.loadHTML(i)
  4927. }
  4928. var c;
  4929. return r(u, s), u.prototype.registerSelectionManager = function () {
  4930. return e.selectionChangeObserver.registerSelectionManager(this.selectionManager)
  4931. }, u.prototype.unregisterSelectionManager = function () {
  4932. return e.selectionChangeObserver.unregisterSelectionManager(this.selectionManager)
  4933. }, u.prototype.render = function () {
  4934. return this.compositionController.render()
  4935. }, u.prototype.reparse = function () {
  4936. return this.composition.replaceHTML(this.editorElement.innerHTML)
  4937. }, u.prototype.compositionDidChangeDocument = function () {
  4938. return this.notifyEditorElement("document-change"), this.handlingInput ? void 0 : this.render()
  4939. }, u.prototype.compositionDidChangeCurrentAttributes = function (t) {
  4940. return this.currentAttributes = t, this.toolbarController.updateAttributes(this.currentAttributes), this.updateCurrentActions(), this.notifyEditorElement("attributes-change", {attributes: this.currentAttributes})
  4941. }, u.prototype.compositionDidPerformInsertionAtRange = function (t) {
  4942. return this.pasting ? this.pastedRange = t : void 0
  4943. }, u.prototype.compositionShouldAcceptFile = function (t) {
  4944. return this.notifyEditorElement("file-accept", {file: t})
  4945. }, u.prototype.compositionDidAddAttachment = function (t) {
  4946. var e;
  4947. return e = this.attachmentManager.manageAttachment(t), this.notifyEditorElement("attachment-add", {attachment: e})
  4948. }, u.prototype.compositionDidEditAttachment = function (t) {
  4949. var e;
  4950. return this.compositionController.rerenderViewForObject(t), e = this.attachmentManager.manageAttachment(t), this.notifyEditorElement("attachment-edit", {attachment: e}), this.notifyEditorElement("change")
  4951. }, u.prototype.compositionDidChangeAttachmentPreviewURL = function (t) {
  4952. return this.compositionController.invalidateViewForObject(t), this.notifyEditorElement("change")
  4953. }, u.prototype.compositionDidRemoveAttachment = function (t) {
  4954. var e;
  4955. return e = this.attachmentManager.unmanageAttachment(t), this.notifyEditorElement("attachment-remove", {attachment: e})
  4956. }, u.prototype.compositionDidStartEditingAttachment = function (t, e) {
  4957. return this.attachmentLocationRange = this.composition.document.getLocationRangeOfAttachment(t), this.compositionController.installAttachmentEditorForAttachment(t, e), this.selectionManager.setLocationRange(this.attachmentLocationRange)
  4958. }, u.prototype.compositionDidStopEditingAttachment = function () {
  4959. return this.compositionController.uninstallAttachmentEditor(), this.attachmentLocationRange = null
  4960. }, u.prototype.compositionDidRequestChangingSelectionToLocationRange = function (t) {
  4961. return !this.loadingSnapshot || this.isFocused() ? (this.requestedLocationRange = t, this.compositionRevisionWhenLocationRangeRequested = this.composition.revision, this.handlingInput ? void 0 : this.render()) : void 0
  4962. }, u.prototype.compositionWillLoadSnapshot = function () {
  4963. return this.loadingSnapshot = !0
  4964. }, u.prototype.compositionDidLoadSnapshot = function () {
  4965. return this.compositionController.refreshViewCache(), this.render(), this.loadingSnapshot = !1
  4966. }, u.prototype.getSelectionManager = function () {
  4967. return this.selectionManager
  4968. }, u.proxyMethod("getSelectionManager().setLocationRange"), u.proxyMethod("getSelectionManager().getLocationRange"), u.prototype.attachmentManagerDidRequestRemovalOfAttachment = function (t) {
  4969. return this.removeAttachment(t)
  4970. }, u.prototype.compositionControllerWillSyncDocumentView = function () {
  4971. return this.inputController.editorWillSyncDocumentView(), this.selectionManager.lock(), this.selectionManager.clearSelection()
  4972. }, u.prototype.compositionControllerDidSyncDocumentView = function () {
  4973. return this.inputController.editorDidSyncDocumentView(), this.selectionManager.unlock(), this.updateCurrentActions(), this.notifyEditorElement("sync")
  4974. }, u.prototype.compositionControllerDidRender = function () {
  4975. return null != this.requestedLocationRange && (this.compositionRevisionWhenLocationRangeRequested === this.composition.revision && this.selectionManager.setLocationRange(this.requestedLocationRange), this.requestedLocationRange = null, this.compositionRevisionWhenLocationRangeRequested = null), this.renderedCompositionRevision !== this.composition.revision && (this.runEditorFilters(), this.composition.updateCurrentAttributes(), this.notifyEditorElement("render")), this.renderedCompositionRevision = this.composition.revision
  4976. }, u.prototype.compositionControllerDidFocus = function () {
  4977. return this.toolbarController.hideDialog(), this.notifyEditorElement("focus")
  4978. }, u.prototype.compositionControllerDidBlur = function () {
  4979. return this.notifyEditorElement("blur")
  4980. }, u.prototype.compositionControllerDidSelectAttachment = function (t, e) {
  4981. return this.composition.editAttachment(t, e)
  4982. }, u.prototype.compositionControllerDidRequestDeselectingAttachment = function (t) {
  4983. var e, n;
  4984. return e = null != (n = this.attachmentLocationRange) ? n : this.composition.document.getLocationRangeOfAttachment(t), this.selectionManager.setLocationRange(e[1])
  4985. }, u.prototype.compositionControllerWillUpdateAttachment = function (t) {
  4986. return this.editor.recordUndoEntry("Edit Attachment", {context: t.id, consolidatable: !0})
  4987. }, u.prototype.compositionControllerDidRequestRemovalOfAttachment = function (t) {
  4988. return this.removeAttachment(t)
  4989. }, u.prototype.inputControllerWillHandleInput = function () {
  4990. return this.handlingInput = !0, this.requestedRender = !1
  4991. }, u.prototype.inputControllerDidRequestRender = function () {
  4992. return this.requestedRender = !0
  4993. }, u.prototype.inputControllerDidHandleInput = function () {
  4994. return this.handlingInput = !1, this.requestedRender ? (this.requestedRender = !1, this.render()) : void 0
  4995. }, u.prototype.inputControllerDidAllowUnhandledInput = function () {
  4996. return this.notifyEditorElement("change")
  4997. }, u.prototype.inputControllerDidRequestReparse = function () {
  4998. return this.reparse()
  4999. }, u.prototype.inputControllerWillPerformTyping = function () {
  5000. return this.recordTypingUndoEntry()
  5001. }, u.prototype.inputControllerWillPerformFormatting = function (t) {
  5002. return this.recordFormattingUndoEntry(t)
  5003. }, u.prototype.inputControllerWillCutText = function () {
  5004. return this.editor.recordUndoEntry("Cut")
  5005. }, u.prototype.inputControllerWillPaste = function (t) {
  5006. return this.editor.recordUndoEntry("Paste"), this.pasting = !0, this.notifyEditorElement("before-paste", {paste: t})
  5007. }, u.prototype.inputControllerDidPaste = function (t) {
  5008. return t.range = this.pastedRange, this.pastedRange = null, this.pasting = null, this.notifyEditorElement("paste", {paste: t})
  5009. }, u.prototype.inputControllerWillMoveText = function () {
  5010. return this.editor.recordUndoEntry("Move")
  5011. }, u.prototype.inputControllerWillAttachFiles = function () {
  5012. return this.editor.recordUndoEntry("Drop Files")
  5013. }, u.prototype.inputControllerWillPerformUndo = function () {
  5014. return this.editor.undo()
  5015. }, u.prototype.inputControllerWillPerformRedo = function () {
  5016. return this.editor.redo()
  5017. }, u.prototype.inputControllerDidReceiveKeyboardCommand = function (t) {
  5018. return this.toolbarController.applyKeyboardCommand(t)
  5019. }, u.prototype.inputControllerDidStartDrag = function () {
  5020. return this.locationRangeBeforeDrag = this.selectionManager.getLocationRange()
  5021. }, u.prototype.inputControllerDidReceiveDragOverPoint = function (t) {
  5022. return this.selectionManager.setLocationRangeFromPointRange(t)
  5023. }, u.prototype.inputControllerDidCancelDrag = function () {
  5024. return this.selectionManager.setLocationRange(this.locationRangeBeforeDrag), this.locationRangeBeforeDrag = null
  5025. }, u.prototype.locationRangeDidChange = function (t) {
  5026. return this.composition.updateCurrentAttributes(), this.updateCurrentActions(), this.attachmentLocationRange && !o(this.attachmentLocationRange, t) && this.composition.stopEditingAttachment(), this.notifyEditorElement("selection-change")
  5027. }, u.prototype.toolbarDidClickButton = function () {
  5028. return this.getLocationRange() ? void 0 : this.setLocationRange({index: 0, offset: 0})
  5029. }, u.prototype.toolbarDidInvokeAction = function (t) {
  5030. return this.invokeAction(t)
  5031. }, u.prototype.toolbarDidToggleAttribute = function (t) {
  5032. return this.recordFormattingUndoEntry(t), this.composition.toggleCurrentAttribute(t), this.render(), this.selectionFrozen ? void 0 : this.editorElement.focus()
  5033. }, u.prototype.toolbarDidUpdateAttribute = function (t, e) {
  5034. return this.recordFormattingUndoEntry(t), this.composition.setCurrentAttribute(t, e), this.render(), this.selectionFrozen ? void 0 : this.editorElement.focus()
  5035. }, u.prototype.toolbarDidRemoveAttribute = function (t) {
  5036. return this.recordFormattingUndoEntry(t), this.composition.removeCurrentAttribute(t), this.render(), this.selectionFrozen ? void 0 : this.editorElement.focus()
  5037. }, u.prototype.toolbarWillShowDialog = function () {
  5038. return this.composition.expandSelectionForEditing(), this.freezeSelection()
  5039. }, u.prototype.toolbarDidShowDialog = function (t) {
  5040. return this.notifyEditorElement("toolbar-dialog-show", {dialogName: t})
  5041. }, u.prototype.toolbarDidHideDialog = function (t) {
  5042. return this.thawSelection(), this.editorElement.focus(), this.notifyEditorElement("toolbar-dialog-hide", {dialogName: t})
  5043. }, u.prototype.freezeSelection = function () {
  5044. return this.selectionFrozen ? void 0 : (this.selectionManager.lock(), this.composition.freezeSelection(), this.selectionFrozen = !0, this.render())
  5045. }, u.prototype.thawSelection = function () {
  5046. return this.selectionFrozen ? (this.composition.thawSelection(), this.selectionManager.unlock(), this.selectionFrozen = !1, this.render()) : void 0
  5047. }, u.prototype.actions = {
  5048. undo: {
  5049. test: function () {
  5050. return this.editor.canUndo()
  5051. }, perform: function () {
  5052. return this.editor.undo()
  5053. }
  5054. }, redo: {
  5055. test: function () {
  5056. return this.editor.canRedo()
  5057. }, perform: function () {
  5058. return this.editor.redo()
  5059. }
  5060. }, link: {
  5061. test: function () {
  5062. return this.editor.canActivateAttribute("href")
  5063. }
  5064. }, increaseNestingLevel: {
  5065. test: function () {
  5066. return this.editor.canIncreaseNestingLevel()
  5067. }, perform: function () {
  5068. return this.editor.increaseNestingLevel() && this.render()
  5069. }
  5070. }, decreaseNestingLevel: {
  5071. test: function () {
  5072. return this.editor.canDecreaseNestingLevel()
  5073. }, perform: function () {
  5074. return this.editor.decreaseNestingLevel() && this.render()
  5075. }
  5076. }, attachFiles: {
  5077. test: function () {
  5078. return !0
  5079. }, perform: function () {
  5080. return e.config.input.pickFiles(this.editor.insertFiles)
  5081. }
  5082. }
  5083. }, u.prototype.canInvokeAction = function (t) {
  5084. var e, n;
  5085. return this.actionIsExternal(t) ? !0 : !!(null != (e = this.actions[t]) && null != (n = e.test) ? n.call(this) : void 0)
  5086. }, u.prototype.invokeAction = function (t) {
  5087. var e, n;
  5088. return this.actionIsExternal(t) ? this.notifyEditorElement("action-invoke", {actionName: t}) : null != (e = this.actions[t]) && null != (n = e.perform) ? n.call(this) : void 0
  5089. }, u.prototype.actionIsExternal = function (t) {
  5090. return /^x-./.test(t)
  5091. }, u.prototype.getCurrentActions = function () {
  5092. var t, e;
  5093. e = {};
  5094. for (t in this.actions) e[t] = this.canInvokeAction(t);
  5095. return e
  5096. }, u.prototype.updateCurrentActions = function () {
  5097. var t;
  5098. return t = this.getCurrentActions(), n(t, this.currentActions) ? void 0 : (this.currentActions = t, this.toolbarController.updateActions(this.currentActions), this.notifyEditorElement("actions-change", {actions: this.currentActions}))
  5099. }, u.prototype.runEditorFilters = function () {
  5100. var t, e, n, i, o, r, s, a;
  5101. for (a = this.composition.getSnapshot(), o = this.editor.filters, n = 0, i = o.length; i > n; n++) e = o[n], t = a.document, s = a.selectedRange, a = null != (r = e.call(this.editor, a)) ? r : {}, null == a.document && (a.document = t), null == a.selectedRange && (a.selectedRange = s);
  5102. return c(a, this.composition.getSnapshot()) ? void 0 : this.composition.loadSnapshot(a)
  5103. }, c = function (t, e) {
  5104. return o(t.selectedRange, e.selectedRange) && t.document.isEqualTo(e.document)
  5105. }, u.prototype.updateInputElement = function () {
  5106. var t, n;
  5107. return t = this.compositionController.getSerializableElement(), n = e.serializeToContentType(t, "text/html"), this.editorElement.setInputElementValue(n)
  5108. }, u.prototype.notifyEditorElement = function (t, e) {
  5109. switch (t) {
  5110. case"document-change":
  5111. this.documentChangedSinceLastRender = !0;
  5112. break;
  5113. case"render":
  5114. this.documentChangedSinceLastRender && (this.documentChangedSinceLastRender = !1, this.notifyEditorElement("change"));
  5115. break;
  5116. case"change":
  5117. case"attachment-add":
  5118. case"attachment-edit":
  5119. case"attachment-remove":
  5120. this.updateInputElement()
  5121. }
  5122. return this.editorElement.notify(t, e)
  5123. }, u.prototype.removeAttachment = function (t) {
  5124. return this.editor.recordUndoEntry("Delete Attachment"), this.composition.removeAttachment(t), this.render()
  5125. }, u.prototype.recordFormattingUndoEntry = function (e) {
  5126. var n, o;
  5127. return n = t(e), o = this.selectionManager.getLocationRange(), n || !i(o) ? this.editor.recordUndoEntry("Formatting", {
  5128. context: this.getUndoContext(),
  5129. consolidatable: !0
  5130. }) : void 0
  5131. }, u.prototype.recordTypingUndoEntry = function () {
  5132. return this.editor.recordUndoEntry("Typing", {
  5133. context: this.getUndoContext(this.currentAttributes),
  5134. consolidatable: !0
  5135. })
  5136. }, u.prototype.getUndoContext = function () {
  5137. var t;
  5138. return t = 1 <= arguments.length ? a.call(arguments, 0) : [], [this.getLocationContext(), this.getTimeContext()].concat(a.call(t))
  5139. }, u.prototype.getLocationContext = function () {
  5140. var t;
  5141. return t = this.selectionManager.getLocationRange(), i(t) ? t[0].index : t
  5142. }, u.prototype.getTimeContext = function () {
  5143. return e.config.undoInterval > 0 ? Math.floor((new Date).getTime() / e.config.undoInterval) : 0
  5144. }, u.prototype.isFocused = function () {
  5145. var t;
  5146. return this.editorElement === (null != (t = this.editorElement.ownerDocument) ? t.activeElement : void 0)
  5147. }, u
  5148. }(e.Controller)
  5149. }.call(this), function () {
  5150. var t, n, i, o, r, s;
  5151. n = e.browser, r = e.makeElement, s = e.triggerEvent, i = e.handleEvent, o = e.handleEventOnce, t = e.AttachmentView.attachmentSelector, e.registerElement("trix-editor", function () {
  5152. var a, u, c, l, h, p, d, f;
  5153. return p = 0, u = function (t) {
  5154. return !document.querySelector(":focus") && t.hasAttribute("autofocus") && document.querySelector("[autofocus]") === t ? t.focus() : void 0
  5155. }, d = function (t) {
  5156. return t.hasAttribute("contenteditable") ? void 0 : (t.setAttribute("contenteditable", ""), o("focus", {
  5157. onElement: t,
  5158. withCallback: function () {
  5159. return c(t)
  5160. }
  5161. }))
  5162. }, a = function (t) {
  5163. return t.hasAttribute("role") ? void 0 : t.setAttribute("role", "textbox")
  5164. }, c = function (t) {
  5165. return h(t), f(t)
  5166. }, h = function (t) {
  5167. return ("function" == typeof document.queryCommandSupported ? document.queryCommandSupported("enableObjectResizing") : void 0) ? (document.execCommand("enableObjectResizing", !1, !1), i("mscontrolselect", {
  5168. onElement: t,
  5169. preventDefault: !0
  5170. })) : void 0
  5171. }, f = function () {
  5172. var t;
  5173. return ("function" == typeof document.queryCommandSupported ? document.queryCommandSupported("DefaultParagraphSeparator") : void 0) && (t = e.config.blockAttributes["default"].tagName, "div" === t || "p" === t) ? document.execCommand("DefaultParagraphSeparator", !1, t) : void 0
  5174. }, l = function () {
  5175. return n.forcesObjectResizing ? {display: "inline", width: "auto"} : {
  5176. display: "inline-block",
  5177. width: "1px"
  5178. }
  5179. }(), {
  5180. defaultCSS: "%t {\n display: block;\n}\n\n%t:empty:not(:focus)::before {\n content: attr(placeholder);\n color: graytext;\n cursor: text;\n}\n\n%t a[contenteditable=false] {\n cursor: text;\n}\n\n%t img {\n max-width: 100%;\n height: auto;\n}\n\n%t " + t + " figcaption textarea {\n resize: none;\n}\n\n%t " + t + " figcaption textarea.trix-autoresize-clone {\n position: absolute;\n left: -9999px;\n max-height: 0px;\n}\n\n%t " + t + " figcaption[data-trix-placeholder]:empty::before {\n content: attr(data-trix-placeholder);\n color: graytext;\n}\n\n%t [data-trix-cursor-target] {\n display: " + l.display + " !important;\n width: " + l.width + " !important;\n padding: 0 !important;\n margin: 0 !important;\n border: none !important;\n}\n\n%t [data-trix-cursor-target=left] {\n vertical-align: top !important;\n margin-left: -1px !important;\n}\n\n%t [data-trix-cursor-target=right] {\n vertical-align: bottom !important;\n margin-right: -1px !important;\n}",
  5181. trixId: {
  5182. get: function () {
  5183. return this.hasAttribute("trix-id") ? this.getAttribute("trix-id") : (this.setAttribute("trix-id", ++p), this.trixId)
  5184. }
  5185. },
  5186. toolbarElement: {
  5187. get: function () {
  5188. var t, e, n;
  5189. return this.hasAttribute("toolbar") ? null != (e = this.ownerDocument) ? e.getElementById(this.getAttribute("toolbar")) : void 0 : this.parentNode ? (n = "trix-toolbar-" + this.trixId, this.setAttribute("toolbar", n), t = r("trix-toolbar", {id: n}), this.parentNode.insertBefore(t, this), t) : void 0
  5190. }
  5191. },
  5192. inputElement: {
  5193. get: function () {
  5194. var t, e, n;
  5195. return this.hasAttribute("input") ? null != (n = this.ownerDocument) ? n.getElementById(this.getAttribute("input")) : void 0 : this.parentNode ? (e = "trix-input-" + this.trixId, this.setAttribute("input", e), t = r("input", {
  5196. type: "hidden",
  5197. id: e
  5198. }), this.parentNode.insertBefore(t, this.nextElementSibling), t) : void 0
  5199. }
  5200. },
  5201. editor: {
  5202. get: function () {
  5203. var t;
  5204. return null != (t = this.editorController) ? t.editor : void 0
  5205. }
  5206. },
  5207. name: {
  5208. get: function () {
  5209. var t;
  5210. return null != (t = this.inputElement) ? t.name : void 0
  5211. }
  5212. },
  5213. value: {
  5214. get: function () {
  5215. var t;
  5216. return null != (t = this.inputElement) ? t.value : void 0
  5217. }, set: function (t) {
  5218. var e;
  5219. return this.defaultValue = t, null != (e = this.editor) ? e.loadHTML(this.defaultValue) : void 0
  5220. }
  5221. },
  5222. notify: function (t, e) {
  5223. return this.editorController ? s("trix-" + t, {onElement: this, attributes: e}) : void 0
  5224. },
  5225. setInputElementValue: function (t) {
  5226. var e;
  5227. return null != (e = this.inputElement) ? e.value = t : void 0
  5228. },
  5229. initialize: function () {
  5230. return d(this), a(this)
  5231. },
  5232. connect: function () {
  5233. return this.hasAttribute("data-trix-internal") ? void 0 : (this.editorController || (s("trix-before-initialize", {onElement: this}), this.editorController = new e.EditorController({
  5234. editorElement: this,
  5235. html: this.defaultValue = this.value
  5236. }), requestAnimationFrame(function (t) {
  5237. return function () {
  5238. return s("trix-initialize", {onElement: t})
  5239. }
  5240. }(this))), this.editorController.registerSelectionManager(), this.registerResetListener(), u(this))
  5241. },
  5242. disconnect: function () {
  5243. var t;
  5244. return null != (t = this.editorController) && t.unregisterSelectionManager(), this.unregisterResetListener()
  5245. },
  5246. registerResetListener: function () {
  5247. return this.resetListener = this.resetBubbled.bind(this), window.addEventListener("reset", this.resetListener, !1)
  5248. },
  5249. unregisterResetListener: function () {
  5250. return window.removeEventListener("reset", this.resetListener, !1)
  5251. },
  5252. resetBubbled: function (t) {
  5253. var e;
  5254. return t.target !== (null != (e = this.inputElement) ? e.form : void 0) || t.defaultPrevented ? void 0 : this.reset()
  5255. },
  5256. reset: function () {
  5257. return this.value = this.defaultValue
  5258. }
  5259. }
  5260. }())
  5261. }.call(this), function () {
  5262. }.call(this)
  5263. }).call(this), "object" == typeof module && module.exports ? module.exports = e : "function" == typeof define && define.amd && define(e)
  5264. }.call(this);