dx-diagram.js 1023 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571
  1. /*!
  2. * DevExpress Diagram (dx-diagram)
  3. * Version: 0.0.30
  4. * Build date: Tue Jul 23 2019
  5. *
  6. * Copyright (c) 2012 - 2019 Developer Express Inc. ALL RIGHTS RESERVED
  7. * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
  8. */
  9. (function webpackUniversalModuleDefinition(root, factory) {
  10. if(typeof exports === 'object' && typeof module === 'object')
  11. module.exports = factory();
  12. else if(typeof define === 'function' && define.amd)
  13. define([], factory);
  14. else if(typeof exports === 'object')
  15. exports["diagram"] = factory();
  16. else
  17. root["DevExpress"] = root["DevExpress"] || {}, root["DevExpress"]["diagram"] = factory();
  18. })(window, function() {
  19. return /******/ (function(modules) { // webpackBootstrap
  20. /******/ // The module cache
  21. /******/ var installedModules = {};
  22. /******/
  23. /******/ // The require function
  24. /******/ function __webpack_require__(moduleId) {
  25. /******/
  26. /******/ // Check if module is in cache
  27. /******/ if(installedModules[moduleId]) {
  28. /******/ return installedModules[moduleId].exports;
  29. /******/ }
  30. /******/ // Create a new module (and put it into the cache)
  31. /******/ var module = installedModules[moduleId] = {
  32. /******/ i: moduleId,
  33. /******/ l: false,
  34. /******/ exports: {}
  35. /******/ };
  36. /******/
  37. /******/ // Execute the module function
  38. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  39. /******/
  40. /******/ // Flag the module as loaded
  41. /******/ module.l = true;
  42. /******/
  43. /******/ // Return the exports of the module
  44. /******/ return module.exports;
  45. /******/ }
  46. /******/
  47. /******/
  48. /******/ // expose the modules object (__webpack_modules__)
  49. /******/ __webpack_require__.m = modules;
  50. /******/
  51. /******/ // expose the module cache
  52. /******/ __webpack_require__.c = installedModules;
  53. /******/
  54. /******/ // define getter function for harmony exports
  55. /******/ __webpack_require__.d = function(exports, name, getter) {
  56. /******/ if(!__webpack_require__.o(exports, name)) {
  57. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  58. /******/ }
  59. /******/ };
  60. /******/
  61. /******/ // define __esModule on exports
  62. /******/ __webpack_require__.r = function(exports) {
  63. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  64. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  65. /******/ }
  66. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  67. /******/ };
  68. /******/
  69. /******/ // create a fake namespace object
  70. /******/ // mode & 1: value is a module id, require it
  71. /******/ // mode & 2: merge all properties of value into the ns
  72. /******/ // mode & 4: return value when already ns object
  73. /******/ // mode & 8|1: behave like require
  74. /******/ __webpack_require__.t = function(value, mode) {
  75. /******/ if(mode & 1) value = __webpack_require__(value);
  76. /******/ if(mode & 8) return value;
  77. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  78. /******/ var ns = Object.create(null);
  79. /******/ __webpack_require__.r(ns);
  80. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  81. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  82. /******/ return ns;
  83. /******/ };
  84. /******/
  85. /******/ // getDefaultExport function for compatibility with non-harmony modules
  86. /******/ __webpack_require__.n = function(module) {
  87. /******/ var getter = module && module.__esModule ?
  88. /******/ function getDefault() { return module['default']; } :
  89. /******/ function getModuleExports() { return module; };
  90. /******/ __webpack_require__.d(getter, 'a', getter);
  91. /******/ return getter;
  92. /******/ };
  93. /******/
  94. /******/ // Object.prototype.hasOwnProperty.call
  95. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  96. /******/
  97. /******/ // __webpack_public_path__
  98. /******/ __webpack_require__.p = "";
  99. /******/
  100. /******/
  101. /******/ // Load entry module and return exports
  102. /******/ return __webpack_require__(__webpack_require__.s = 46);
  103. /******/ })
  104. /************************************************************************/
  105. /******/ ([
  106. /* 0 */
  107. /***/ (function(module, exports, __webpack_require__) {
  108. "use strict";
  109. Object.defineProperty(exports, "__esModule", { value: true });
  110. var Size = /** @class */ (function () {
  111. function Size(width, height) {
  112. this.width = width;
  113. this.height = height;
  114. }
  115. Size.prototype.clone = function () { return new Size(this.width, this.height); };
  116. Size.prototype.toString = function () { return JSON.stringify(this); };
  117. Size.prototype.offset = function (offsetX, offsetY) {
  118. if (offsetX === void 0) { offsetX = 0; }
  119. if (offsetY === void 0) { offsetY = 0; }
  120. return new Size(Math.max(0, this.width + offsetX), Math.max(0, this.height + offsetY));
  121. };
  122. Size.prototype.multiply = function (multiplierW, multiplierH) {
  123. if (multiplierW === void 0) { multiplierW = 1; }
  124. if (multiplierH === void 0) { multiplierH = multiplierW; }
  125. return new Size(this.width * multiplierW, this.height * multiplierH);
  126. };
  127. Size.prototype.equals = function (size) {
  128. return size.width === this.width && size.height === this.height;
  129. };
  130. return Size;
  131. }());
  132. exports.Size = Size;
  133. var Point = /** @class */ (function () {
  134. function Point(x, y) {
  135. this.x = x;
  136. this.y = y;
  137. }
  138. Point.prototype.clone = function () { return new Point(this.x, this.y); };
  139. Point.prototype.toString = function () { return JSON.stringify(this); };
  140. Point.prototype.offset = function (offsetX, offsetY) {
  141. if (offsetX === void 0) { offsetX = 0; }
  142. if (offsetY === void 0) { offsetY = 0; }
  143. return new Point(this.x + offsetX, this.y + offsetY);
  144. };
  145. Point.prototype.multiply = function (multiplierX, multiplierY) {
  146. if (multiplierX === void 0) { multiplierX = 1; }
  147. if (multiplierY === void 0) { multiplierY = multiplierX; }
  148. return new Point(this.x * multiplierX, this.y * multiplierY);
  149. };
  150. Point.prototype.equals = function (pt) {
  151. return pt.x === this.x && pt.y === this.y;
  152. };
  153. Point.empty = function () {
  154. return new Point(-1, -1);
  155. };
  156. Point.plus = function (a, b) {
  157. return new Point(a.x + b.x, a.y + b.y);
  158. };
  159. Point.minus = function (a, b) {
  160. return new Point(a.x - b.x, a.y - b.y);
  161. };
  162. return Point;
  163. }());
  164. exports.Point = Point;
  165. var Offset = /** @class */ (function () {
  166. function Offset(left, top, right, bottom) {
  167. this.left = left;
  168. this.top = top;
  169. this.right = right;
  170. this.bottom = bottom;
  171. }
  172. Offset.prototype.clone = function () { return new Offset(this.left, this.top, this.right, this.bottom); };
  173. return Offset;
  174. }());
  175. exports.Offset = Offset;
  176. var Rectangle = /** @class */ (function () {
  177. function Rectangle(position, size) {
  178. this.position = position;
  179. this.size = size;
  180. }
  181. Object.defineProperty(Rectangle.prototype, "left", {
  182. get: function () {
  183. return this.position.x;
  184. },
  185. enumerable: true,
  186. configurable: true
  187. });
  188. Object.defineProperty(Rectangle.prototype, "top", {
  189. get: function () {
  190. return this.position.y;
  191. },
  192. enumerable: true,
  193. configurable: true
  194. });
  195. Object.defineProperty(Rectangle.prototype, "right", {
  196. get: function () {
  197. return this.position.x + this.size.width;
  198. },
  199. enumerable: true,
  200. configurable: true
  201. });
  202. Object.defineProperty(Rectangle.prototype, "bottom", {
  203. get: function () {
  204. return this.position.y + this.size.height;
  205. },
  206. enumerable: true,
  207. configurable: true
  208. });
  209. Object.defineProperty(Rectangle.prototype, "center", {
  210. get: function () {
  211. return new Point(this.position.x + this.size.width / 2, this.position.y + this.size.height / 2);
  212. },
  213. enumerable: true,
  214. configurable: true
  215. });
  216. Object.defineProperty(Rectangle.prototype, "width", {
  217. get: function () {
  218. return this.size.width;
  219. },
  220. enumerable: true,
  221. configurable: true
  222. });
  223. Object.defineProperty(Rectangle.prototype, "height", {
  224. get: function () {
  225. return this.size.height;
  226. },
  227. enumerable: true,
  228. configurable: true
  229. });
  230. Rectangle.prototype.clone = function () { return new Rectangle(this.position.clone(), this.size.clone()); };
  231. Rectangle.prototype.toString = function () { return JSON.stringify(this); };
  232. Rectangle.prototype.contains = function (point) {
  233. return this.left <= point.x && point.x <= this.right &&
  234. this.top <= point.y && point.y <= this.bottom;
  235. };
  236. Rectangle.prototype.intersectX = function (rect) {
  237. if (this.left > rect.right || rect.left > this.right)
  238. return false;
  239. return true;
  240. };
  241. Rectangle.prototype.intersectY = function (rect) {
  242. if (this.top > rect.bottom || rect.top > this.bottom)
  243. return false;
  244. return true;
  245. };
  246. Rectangle.prototype.intersect = function (rect) {
  247. return this.intersectX(rect) && this.intersectY(rect);
  248. };
  249. Rectangle.prototype.inflate = function (deltaX, deltaY) {
  250. deltaY = deltaY === undefined ? deltaX : deltaY;
  251. return new Rectangle(this.position.offset(-deltaX, -deltaY), this.size.offset(2 * deltaX, 2 * deltaY));
  252. };
  253. Rectangle.prototype.resize = function (deltaX, deltaY) {
  254. return new Rectangle(this.position, this.size.offset(deltaX, deltaY));
  255. };
  256. Rectangle.prototype.offset = function (offsetX, offsetY) {
  257. return new Rectangle(this.position.offset(offsetX, offsetY), this.size);
  258. };
  259. Rectangle.prototype.multiply = function (multiplier) {
  260. return new Rectangle(this.position.multiply(multiplier), this.size.multiply(multiplier));
  261. };
  262. Rectangle.create = function (x, y, width, height) {
  263. return new Rectangle(new Point(x, y), new Size(width, height));
  264. };
  265. Rectangle.createByPoints = function (point1, point2) {
  266. return Rectangle.createByPositions(point1.x, point1.y, point2.x, point2.y);
  267. };
  268. Rectangle.createByPositions = function (x1, y1, x2, y2) {
  269. var x = Math.min(x1, x2);
  270. var y = Math.min(y1, y2);
  271. var width = Math.abs(x2 - x1);
  272. var height = Math.abs(y2 - y1);
  273. return Rectangle.create(x, y, width, height);
  274. };
  275. return Rectangle;
  276. }());
  277. exports.Rectangle = Rectangle;
  278. var Segment = /** @class */ (function () {
  279. function Segment(startPoint, endPoint) {
  280. this.startPoint = startPoint;
  281. this.endPoint = endPoint;
  282. }
  283. Object.defineProperty(Segment.prototype, "distance", {
  284. get: function () {
  285. return GeometryUtils.getDistance(this.startPoint, this.endPoint);
  286. },
  287. enumerable: true,
  288. configurable: true
  289. });
  290. Segment.prototype.intersect = function (segment) {
  291. if (this.startPoint.equals(segment.startPoint) || this.endPoint.equals(segment.startPoint) ||
  292. this.startPoint.equals(segment.endPoint) || this.endPoint.equals(segment.endPoint))
  293. return true;
  294. return this.intersectCore(segment) && segment.intersectCore(this);
  295. };
  296. Segment.prototype.intersectRect = function (rectangle) {
  297. var ltPt = rectangle.position, lbPt = new Point(rectangle.left, rectangle.bottom), rtPt = new Point(rectangle.right, rectangle.top), rbPt = new Point(rectangle.right, rectangle.bottom);
  298. return rectangle.contains(this.startPoint) || rectangle.contains(this.endPoint) ||
  299. this.intersect(new Segment(ltPt, lbPt)) || this.intersect(new Segment(lbPt, rbPt)) ||
  300. this.intersect(new Segment(rbPt, rtPt)) || this.intersect(new Segment(rtPt, ltPt));
  301. };
  302. Segment.prototype.intersectCore = function (segment) {
  303. if (this.startPoint.x === this.endPoint.x) {
  304. if (this.startPoint.x - segment.endPoint.x !== 0)
  305. return (this.startPoint.x - segment.startPoint.x) / (this.startPoint.x - segment.endPoint.x) <= 0;
  306. if (segment.endPoint.y - this.endPoint.y !== 0)
  307. return (segment.endPoint.y - this.startPoint.y) / (segment.endPoint.y - this.endPoint.y) <= 0;
  308. }
  309. if (this.startPoint.y === this.endPoint.y) {
  310. if (this.startPoint.y - segment.endPoint.y !== 0)
  311. return (this.startPoint.y - segment.startPoint.y) / (this.startPoint.y - segment.endPoint.y) <= 0;
  312. if (segment.endPoint.x - this.endPoint.x !== 0)
  313. return (segment.endPoint.x - this.startPoint.x) / (segment.endPoint.x - this.endPoint.x) <= 0;
  314. }
  315. var tg = (this.endPoint.y - this.startPoint.y) / (this.endPoint.x - this.startPoint.x);
  316. var y1 = this.startPoint.y + (segment.startPoint.x - this.startPoint.x) * tg;
  317. var y2 = this.startPoint.y + (segment.endPoint.x - this.startPoint.x) * tg;
  318. var dy1 = segment.startPoint.y - y1;
  319. var dy2 = segment.endPoint.y - y2;
  320. if (dy1 === 0 && dy2 === 0) {
  321. return (this.startPoint.y - y1) / (this.endPoint.y - y1) <= 0 ||
  322. (this.startPoint.y - y2) / (this.endPoint.y - y2) <= 0;
  323. }
  324. return dy1 === 0 || dy2 === 0 || dy1 / dy2 < 0;
  325. };
  326. Segment.create = function (x1, y1, x2, y2) {
  327. return new Segment(new Point(x1, y1), new Point(x2, y2));
  328. };
  329. Segment.createByPoints = function (point1, point2) {
  330. return Segment.create(point1.x, point1.y, point2.x, point2.y);
  331. };
  332. return Segment;
  333. }());
  334. exports.Segment = Segment;
  335. var EventDispatcher = /** @class */ (function () {
  336. function EventDispatcher() {
  337. this.listeners = [];
  338. }
  339. EventDispatcher.prototype.add = function (listener) {
  340. if (!listener)
  341. throw new Error("Not Implemented");
  342. if (!this.hasEventListener(listener))
  343. this.listeners.push(listener);
  344. };
  345. EventDispatcher.prototype.remove = function (listener) {
  346. for (var i = 0, currentListener; currentListener = this.listeners[i]; i++) {
  347. if (currentListener === listener) {
  348. this.listeners.splice(i, 1);
  349. break;
  350. }
  351. }
  352. };
  353. EventDispatcher.prototype.raise = function (funcName) {
  354. var args = [];
  355. for (var _i = 1; _i < arguments.length; _i++) {
  356. args[_i - 1] = arguments[_i];
  357. }
  358. for (var i = 0, listener; listener = this.listeners[i]; i++) {
  359. listener[funcName].apply(listener, args);
  360. }
  361. };
  362. EventDispatcher.prototype.raise1 = function (action) {
  363. for (var i = 0, listener; listener = this.listeners[i]; i++) {
  364. action(listener);
  365. }
  366. };
  367. EventDispatcher.prototype.hasEventListener = function (listener) {
  368. for (var i = 0, l = this.listeners.length; i < l; i++)
  369. if (this.listeners[i] === listener)
  370. return true;
  371. return false;
  372. };
  373. return EventDispatcher;
  374. }());
  375. exports.EventDispatcher = EventDispatcher;
  376. var Utils = /** @class */ (function () {
  377. function Utils() {
  378. }
  379. //http://workservices01/OpenWiki/ow.asp?ASPxRichEdit_BinarySearch#preview
  380. // BINARY INDEX
  381. // Input array [4, 8, 10]
  382. // find binaryIndexOf normedBinaryIndexOf
  383. // (-inf, 3] -1 -1
  384. // 4 0 0
  385. // [5, 7] -2 0
  386. // 8 1 1
  387. // 9 -3 1
  388. // 10 2 2
  389. // [11, +inf) -4 2
  390. // case array.length == 0, then return -1
  391. // don't touch default value = -2! In some case binaryIndexOf call as ([], ()=>.., 0, [].length - 1)
  392. Utils.binaryIndexOf = function (array, comparer, minIndex, maxIndex) {
  393. if (minIndex === void 0) { minIndex = 0; }
  394. if (maxIndex === void 0) { maxIndex = -2; }
  395. var findFromZeroPosition = minIndex == 0;
  396. if (maxIndex == -2)
  397. maxIndex = array.length - 1;
  398. while (minIndex <= maxIndex) {
  399. var currentIndex = (minIndex + ((maxIndex - minIndex) >> 1));
  400. var compare = comparer(array[currentIndex]);
  401. if (compare < 0)
  402. minIndex = currentIndex + 1;
  403. else if (compare > 0)
  404. maxIndex = currentIndex - 1;
  405. else
  406. return currentIndex;
  407. }
  408. return findFromZeroPosition ? ~minIndex : -1;
  409. };
  410. Utils.normedBinaryIndexOf = function (array, comparer, minIndex, maxIndex) {
  411. if (minIndex === void 0) { minIndex = 0; }
  412. if (maxIndex === void 0) { maxIndex = -2; }
  413. var index = Utils.binaryIndexOf(array, comparer, minIndex, maxIndex);
  414. return Utils.binaryIndexNormalizator(index);
  415. };
  416. Utils.binaryIndexNormalizator = function (index) {
  417. return index < 0 ? ~index - 1 : index;
  418. };
  419. return Utils;
  420. }());
  421. exports.Utils = Utils;
  422. var GeometryUtils = /** @class */ (function () {
  423. function GeometryUtils() {
  424. }
  425. GeometryUtils.getCommonRectangle = function (rects) {
  426. if (!rects.length)
  427. return Rectangle.create(0, 0, 0, 0);
  428. var minX = Number.MAX_VALUE;
  429. var maxX = -Number.MAX_VALUE;
  430. var minY = Number.MAX_VALUE;
  431. var maxY = -Number.MAX_VALUE;
  432. rects.forEach(function (rect) {
  433. minX = Math.min(minX, rect.left);
  434. maxX = Math.max(maxX, rect.right);
  435. minY = Math.min(minY, rect.top);
  436. maxY = Math.max(maxY, rect.bottom);
  437. });
  438. return Rectangle.create(minX, minY, maxX - minX, maxY - minY);
  439. };
  440. GeometryUtils.findFreeSpace = function (rects, size, exact) {
  441. var xs = [0], xshash;
  442. var ys = [0];
  443. rects.forEach(function (r) {
  444. xs.push(r.left);
  445. xs.push(r.right);
  446. ys.push(r.top);
  447. ys.push(r.bottom);
  448. });
  449. xs = xs.sort(function (a, b) { return a - b; }).reduce(function (acc, v, index) { return (xs[index - 1] !== v && acc.push(v) && acc) || acc; }, []); // magic for distinct
  450. ys = ys.sort(function (a, b) { return a - b; }).reduce(function (acc, v, index) { return (ys[index - 1] !== v && acc.push(v) && acc) || acc; }, []);
  451. var matrix = ys.map(function (y) { return xs.map(function (x, i) { return xs[i + 1] - x; }); });
  452. var _loop_1 = function (i, rect) {
  453. var xi0 = Utils.binaryIndexOf(xs, function (a) { return a - rect.left; });
  454. var xi1 = Utils.binaryIndexOf(xs, function (a) { return a - rect.right; });
  455. var yi0 = Utils.binaryIndexOf(ys, function (a) { return a - rect.top; });
  456. var yi1 = Utils.binaryIndexOf(ys, function (a) { return a - rect.bottom; });
  457. for (var y = yi0; y < yi1; y++)
  458. for (var x = xi0; x < xi1; x++)
  459. matrix[y][x] *= -1;
  460. };
  461. for (var i = 0, rect = void 0; rect = rects[i]; i++) {
  462. _loop_1(i, rect);
  463. }
  464. for (var yi = 0; yi < ys.length; yi++) {
  465. for (var xi = 0; xi < xs.length - 1; xi++) {
  466. var checkResult = this.checkRect(matrix, ys, xs, yi, xi, size, exact);
  467. if (checkResult > 0)
  468. xi = checkResult;
  469. else if (checkResult === 0)
  470. return new Point(xs[xi], ys[yi]);
  471. }
  472. }
  473. return null;
  474. };
  475. GeometryUtils.checkRect = function (matrix, ys, xs, yimin, ximin, size, exact) {
  476. var height = 0;
  477. var width = 0;
  478. var ximax = xs.length - 2;
  479. for (var yi = yimin; yi < ys.length; yi++) {
  480. height = ys[yi + 1] - ys[yimin];
  481. for (var xi = ximin; xi <= ximax; xi++) {
  482. if (matrix[yi][xi] < 0)
  483. return xi === 0 ? -1 : xi; // move left?
  484. width = xs[xi + 1] - xs[ximin];
  485. if (size.width <= width || (!exact && xi === xs.length - 2 && size.width / 2 <= width)) {
  486. if (size.height <= height || (!exact && yi === ys.length - 2 && size.height / 2 <= height))
  487. return 0;
  488. ximax = xi;
  489. }
  490. }
  491. }
  492. };
  493. GeometryUtils.getArrowPoints = function (point, directionPoint, arrowHeight, arrowWidth) {
  494. if (point.x === directionPoint.x && point.y === directionPoint.y)
  495. return { point1: point.clone(), point2: point.clone() };
  496. var catX = directionPoint.x - point.x;
  497. var catY = directionPoint.y - point.y;
  498. var hypotenuse = Math.sqrt(Math.pow(catX, 2) + Math.pow(catY, 2));
  499. var cos = catX / hypotenuse;
  500. var sin = catY / hypotenuse;
  501. var x1 = point.x + arrowHeight * cos + arrowWidth * sin;
  502. var y1 = point.y + arrowHeight * sin - arrowWidth * cos;
  503. var x2 = point.x + arrowHeight * cos - arrowWidth * sin;
  504. var y2 = point.y + arrowHeight * sin + arrowWidth * cos;
  505. return { point1: new Point(x1, y1), point2: new Point(x2, y2) };
  506. };
  507. GeometryUtils.removeUnnecessaryLinePoints = function (points, removeCallback, checkCallback) {
  508. if (checkCallback === void 0) { checkCallback = (function (pt) { return pt !== undefined; }); }
  509. this.removeDuplicatedPoints(points, removeCallback, checkCallback);
  510. this.removeOneLinePoints(points, removeCallback, checkCallback);
  511. this.removeBackwardPoints(points, removeCallback, checkCallback);
  512. };
  513. GeometryUtils.removeBackwardPoints = function (points, removeCallback, checkCallback) {
  514. if (checkCallback === void 0) { checkCallback = (function (pt) { return pt !== undefined; }); }
  515. var index = 0;
  516. var point;
  517. while (point = points[index]) {
  518. if (points.length <= 2)
  519. break;
  520. var nextPoint = this.getNextPoint(points, index, true, checkCallback);
  521. var prevPoint = this.getNextPoint(points, index, false, checkCallback);
  522. if (prevPoint && nextPoint) {
  523. if (point.x == prevPoint.x && point.x == nextPoint.x) {
  524. if ((point.y > prevPoint.y && point.y > nextPoint.y) ||
  525. (point.y < prevPoint.y && point.y < nextPoint.y)) {
  526. if (removeCallback(points[index], index))
  527. continue;
  528. }
  529. }
  530. if (point.y == prevPoint.y && point.y == nextPoint.y) {
  531. if ((point.x > prevPoint.x && point.x > nextPoint.x) ||
  532. (point.x < prevPoint.x && point.x < nextPoint.x)) {
  533. if (removeCallback(points[index], index))
  534. continue;
  535. }
  536. }
  537. }
  538. index++;
  539. }
  540. };
  541. GeometryUtils.removeOneLinePoints = function (points, removeCallback, checkCallback) {
  542. if (checkCallback === void 0) { checkCallback = (function (pt) { return pt !== undefined; }); }
  543. var index = 0;
  544. var point;
  545. while (point = points[index]) {
  546. if (points.length <= 2)
  547. break;
  548. var nextPoint = this.getNextPoint(points, index, true, checkCallback);
  549. var prevPoint = this.getNextPoint(points, index, false, checkCallback);
  550. if (prevPoint && nextPoint) {
  551. if ((point.x == prevPoint.x && point.x == nextPoint.x) ||
  552. (point.y == prevPoint.y && point.y == nextPoint.y)) {
  553. if (removeCallback(points[index], index))
  554. continue;
  555. }
  556. var tg = (nextPoint.y - prevPoint.y) / (nextPoint.x - prevPoint.x);
  557. if (nextPoint.y - points[index].y == (nextPoint.x - points[index].x) * tg) {
  558. if (removeCallback(points[index], index))
  559. continue;
  560. }
  561. }
  562. index++;
  563. }
  564. };
  565. GeometryUtils.removeDuplicatedPoints = function (points, removeCallback, checkCallback) {
  566. if (checkCallback === void 0) { checkCallback = (function (pt) { return pt !== undefined; }); }
  567. var index = 0;
  568. var point;
  569. while (point = points[index]) {
  570. if (points.length <= 2)
  571. break;
  572. var nextPoint = this.getNextPoint(points, index, true, checkCallback);
  573. if (nextPoint) {
  574. if (point.x == nextPoint.x && point.y == nextPoint.y) {
  575. var indexToRemove = index + 1;
  576. if (indexToRemove === points.length - 1)
  577. indexToRemove--;
  578. if (removeCallback(points[indexToRemove], indexToRemove))
  579. continue;
  580. }
  581. }
  582. index++;
  583. }
  584. };
  585. GeometryUtils.getNextPoint = function (points, index, direction, checkCallback) {
  586. var result;
  587. var newIndex = index + (direction ? 1 : -1);
  588. while (result = points[newIndex]) {
  589. if (checkCallback(result))
  590. return result;
  591. newIndex = newIndex + (direction ? 1 : -1);
  592. }
  593. };
  594. GeometryUtils.getDistance = function (a, b) {
  595. return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
  596. };
  597. GeometryUtils.getPathLength = function (points) {
  598. var length = 0;
  599. var prevPt;
  600. points.forEach(function (pt) {
  601. if (prevPt !== undefined) {
  602. var lineLength = GeometryUtils.getDistance(pt, prevPt);
  603. length += lineLength;
  604. }
  605. prevPt = pt;
  606. });
  607. return length;
  608. };
  609. GeometryUtils.getPathPointByPosition = function (points, relativePosition) {
  610. if (!points.length)
  611. throw new Error("Invalid points");
  612. if (0 > relativePosition || relativePosition > 1)
  613. throw new Error("Invalid relative position");
  614. var length = this.getPathLength(points);
  615. if (points.length <= 2 && length === 0)
  616. return points[0];
  617. var targetLength = length * relativePosition;
  618. var currentLength = 0;
  619. for (var i = 1; i < points.length; i++) {
  620. var lineLength = GeometryUtils.getDistance(points[i], points[i - 1]);
  621. if (currentLength + lineLength >= targetLength) {
  622. var delta = targetLength - currentLength;
  623. var cos = (points[i].x - points[i - 1].x) / lineLength;
  624. var sin = (points[i].y - points[i - 1].y) / lineLength;
  625. return new Point(points[i - 1].x + cos * delta, points[i - 1].y + sin * delta);
  626. }
  627. currentLength += lineLength;
  628. }
  629. ;
  630. return points[points.length - 1];
  631. };
  632. GeometryUtils.getLineAngle = function (beginPoint, endPoint) {
  633. return Math.atan2(endPoint.y - beginPoint.y, endPoint.x - beginPoint.x);
  634. };
  635. GeometryUtils.getTriangleBeginAngle = function (beginPoint, endPoint, point) {
  636. var lineAngle = this.getLineAngle(beginPoint, endPoint);
  637. var beginPointAngle = this.getLineAngle(beginPoint, point);
  638. return Math.abs(beginPointAngle - lineAngle);
  639. };
  640. GeometryUtils.getTriangleEndAngle = function (beginPoint, endPoint, point) {
  641. var lineAngle = this.getLineAngle(beginPoint, endPoint);
  642. var endPointAngle = this.getLineAngle(point, endPoint);
  643. return Math.abs(lineAngle - endPointAngle);
  644. };
  645. GeometryUtils.getPathPointByPoint = function (points, point) {
  646. if (!points.length)
  647. throw new Error("Invalid points");
  648. if (points.length === 1)
  649. return points[0];
  650. var distance = Number.MAX_VALUE;
  651. var result;
  652. for (var i = 1; i < points.length; i++) {
  653. var beginPoint = points[i - 1];
  654. var endPoint = points[i];
  655. if (point.equals(beginPoint)) {
  656. result = beginPoint.clone();
  657. break;
  658. }
  659. if (point.equals(endPoint)) {
  660. result = endPoint.clone();
  661. break;
  662. }
  663. var beginAngle = this.getTriangleBeginAngle(beginPoint, endPoint, point);
  664. var endAngle = this.getTriangleEndAngle(beginPoint, endPoint, point);
  665. var beginDistance = GeometryUtils.getDistance(point, beginPoint);
  666. var endDistance = GeometryUtils.getDistance(point, endPoint);
  667. var orthOffset = beginDistance * Math.sin(beginAngle);
  668. var currentDistance = void 0;
  669. if (Math.PI / 2 <= beginAngle && beginAngle <= Math.PI * 3 / 2)
  670. currentDistance = beginDistance;
  671. else if (Math.PI / 2 <= endAngle && endAngle <= Math.PI * 3 / 2)
  672. currentDistance = endDistance;
  673. else
  674. currentDistance = Math.abs(orthOffset);
  675. if (currentDistance < distance) {
  676. distance = currentDistance;
  677. if (Math.PI / 2 <= beginAngle && beginAngle <= Math.PI * 3 / 2)
  678. result = beginPoint.clone();
  679. else if (Math.PI / 2 <= endAngle && endAngle <= Math.PI * 3 / 2)
  680. result = endPoint.clone();
  681. else {
  682. var lineAngle = this.getLineAngle(beginPoint, endPoint);
  683. var offsetX = Math.fround(Math.abs(orthOffset * Math.sin(lineAngle)));
  684. var offsetY = Math.fround(Math.abs(orthOffset * Math.cos(lineAngle)));
  685. var isAbove = point.y - beginPoint.y < Math.fround((point.x - beginPoint.x) * Math.tan(lineAngle));
  686. if (0 <= lineAngle && lineAngle <= Math.PI / 2) {
  687. offsetX *= isAbove ? -1 : 1;
  688. offsetY *= isAbove ? 1 : -1;
  689. }
  690. else if (Math.PI / 2 <= lineAngle && lineAngle <= Math.PI) {
  691. offsetX *= isAbove ? 1 : -1;
  692. offsetY *= isAbove ? 1 : -1;
  693. }
  694. else if (0 >= lineAngle && lineAngle >= -Math.PI / 2) {
  695. offsetX *= isAbove ? 1 : -1;
  696. offsetY *= isAbove ? 1 : -1;
  697. }
  698. else if (-Math.PI / 2 >= lineAngle && lineAngle >= -Math.PI) {
  699. offsetX *= isAbove ? -1 : 1;
  700. offsetY *= isAbove ? 1 : -1;
  701. }
  702. result = point.offset(offsetX, offsetY);
  703. }
  704. }
  705. }
  706. ;
  707. return result;
  708. };
  709. GeometryUtils.getPathPositionByPoint = function (points, point, maxPositionCount) {
  710. if (maxPositionCount === void 0) { maxPositionCount = 100; }
  711. point = this.getPathPointByPoint(points, point);
  712. var length = this.getPathLength(points);
  713. var currentLength = 0;
  714. for (var i = 1; i < points.length; i++) {
  715. var beginPoint = points[i - 1];
  716. var endPoint = points[i];
  717. var lineLength = GeometryUtils.getDistance(endPoint, beginPoint);
  718. var angle = Math.atan((endPoint.y - beginPoint.y) / (endPoint.x - beginPoint.x));
  719. if ((point.x === endPoint.x && point.x === beginPoint.x) || (point.y === endPoint.y && point.y === beginPoint.y) ||
  720. Math.fround(point.y - beginPoint.y) === Math.fround((point.x - beginPoint.x) * Math.tan(angle))) {
  721. if (Math.sin(angle) !== 0)
  722. currentLength += Math.abs((point.y - beginPoint.y) / Math.sin(angle));
  723. else
  724. currentLength += Math.abs(point.x - beginPoint.x);
  725. return Math.round(currentLength * maxPositionCount / length) / maxPositionCount;
  726. }
  727. currentLength += lineLength;
  728. }
  729. ;
  730. return 1;
  731. };
  732. GeometryUtils.arePointsEqual = function (points1, points2) {
  733. var count1 = points1.length;
  734. var count2 = points2.length;
  735. if (count1 != count2)
  736. return false;
  737. for (var i = 0; i < count1; i++)
  738. if (!points1[i].equals(points2[i]))
  739. return false;
  740. return true;
  741. };
  742. return GeometryUtils;
  743. }());
  744. exports.GeometryUtils = GeometryUtils;
  745. /***/ }),
  746. /* 1 */
  747. /***/ (function(module, exports, __webpack_require__) {
  748. "use strict";
  749. Object.defineProperty(exports, "__esModule", { value: true });
  750. var ShapeCategory;
  751. (function (ShapeCategory) {
  752. ShapeCategory[ShapeCategory["Undefined"] = 0] = "Undefined";
  753. ShapeCategory[ShapeCategory["General"] = 1] = "General";
  754. ShapeCategory[ShapeCategory["Flowchart"] = 2] = "Flowchart";
  755. ShapeCategory[ShapeCategory["Custom"] = 3] = "Custom";
  756. })(ShapeCategory = exports.ShapeCategory || (exports.ShapeCategory = {}));
  757. var ShapeType;
  758. (function (ShapeType) {
  759. // Standard
  760. ShapeType[ShapeType["Text"] = 0] = "Text";
  761. ShapeType[ShapeType["Rectangle"] = 1] = "Rectangle";
  762. ShapeType[ShapeType["Ellipsis"] = 2] = "Ellipsis";
  763. ShapeType[ShapeType["Cross"] = 3] = "Cross";
  764. ShapeType[ShapeType["Triangle"] = 4] = "Triangle";
  765. ShapeType[ShapeType["Diamond"] = 5] = "Diamond";
  766. ShapeType[ShapeType["Heart"] = 6] = "Heart";
  767. ShapeType[ShapeType["Pentagon"] = 7] = "Pentagon";
  768. ShapeType[ShapeType["Hexagon"] = 8] = "Hexagon";
  769. ShapeType[ShapeType["Octagon"] = 9] = "Octagon";
  770. ShapeType[ShapeType["Star"] = 10] = "Star";
  771. ShapeType[ShapeType["ArrowLeft"] = 11] = "ArrowLeft";
  772. ShapeType[ShapeType["ArrowTop"] = 12] = "ArrowTop";
  773. ShapeType[ShapeType["ArrowRight"] = 13] = "ArrowRight";
  774. ShapeType[ShapeType["ArrowBottom"] = 14] = "ArrowBottom";
  775. ShapeType[ShapeType["ArrowNorthSouth"] = 15] = "ArrowNorthSouth";
  776. ShapeType[ShapeType["ArrowEastWest"] = 16] = "ArrowEastWest";
  777. // Flowchart
  778. ShapeType[ShapeType["Process"] = 17] = "Process";
  779. ShapeType[ShapeType["Decision"] = 18] = "Decision";
  780. ShapeType[ShapeType["Terminator"] = 19] = "Terminator";
  781. ShapeType[ShapeType["PredefinedProcess"] = 20] = "PredefinedProcess";
  782. ShapeType[ShapeType["Document"] = 21] = "Document";
  783. ShapeType[ShapeType["MultipleDocuments"] = 22] = "MultipleDocuments";
  784. ShapeType[ShapeType["ManualInput"] = 23] = "ManualInput";
  785. ShapeType[ShapeType["Preparation"] = 24] = "Preparation";
  786. ShapeType[ShapeType["Data"] = 25] = "Data";
  787. ShapeType[ShapeType["Database"] = 26] = "Database";
  788. ShapeType[ShapeType["HardDisk"] = 27] = "HardDisk";
  789. ShapeType[ShapeType["InternalStorage"] = 28] = "InternalStorage";
  790. ShapeType[ShapeType["PaperTape"] = 29] = "PaperTape";
  791. ShapeType[ShapeType["ManualOperation"] = 30] = "ManualOperation";
  792. ShapeType[ShapeType["Delay"] = 31] = "Delay";
  793. ShapeType[ShapeType["StoredData"] = 32] = "StoredData";
  794. ShapeType[ShapeType["Display"] = 33] = "Display";
  795. ShapeType[ShapeType["Merge"] = 34] = "Merge";
  796. ShapeType[ShapeType["Or"] = 35] = "Or";
  797. ShapeType[ShapeType["SummingJunction"] = 36] = "SummingJunction";
  798. // Custom (must be last)
  799. ShapeType[ShapeType["Custom"] = 37] = "Custom";
  800. })(ShapeType = exports.ShapeType || (exports.ShapeType = {}));
  801. /***/ }),
  802. /* 2 */
  803. /***/ (function(module, exports, __webpack_require__) {
  804. "use strict";
  805. var __extends = (this && this.__extends) || (function () {
  806. var extendStatics = function (d, b) {
  807. extendStatics = Object.setPrototypeOf ||
  808. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  809. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  810. return extendStatics(d, b);
  811. };
  812. return function (d, b) {
  813. extendStatics(d, b);
  814. function __() { this.constructor = d; }
  815. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  816. };
  817. })();
  818. Object.defineProperty(exports, "__esModule", { value: true });
  819. var UnitConverter_1 = __webpack_require__(13);
  820. var RenderManager_1 = __webpack_require__(10);
  821. var Primitive_1 = __webpack_require__(15);
  822. var PathPrimitive = /** @class */ (function (_super) {
  823. __extends(PathPrimitive, _super);
  824. function PathPrimitive(commands, style, className, clipPathId, onApplyProperties) {
  825. var _this = _super.call(this, style, className, clipPathId, onApplyProperties) || this;
  826. _this.commands = commands;
  827. return _this;
  828. }
  829. PathPrimitive.prototype.createMainElement = function () {
  830. return document.createElementNS(RenderManager_1.svgNS, "path");
  831. };
  832. PathPrimitive.prototype.applyElementProperties = function (element) {
  833. element.setAttribute("d", this.commands.map(function (c) { return c.toString(); }).join(" "));
  834. _super.prototype.applyElementProperties.call(this, element);
  835. };
  836. return PathPrimitive;
  837. }(Primitive_1.SvgPrimitive));
  838. exports.PathPrimitive = PathPrimitive;
  839. var PathPrimitiveCommand = /** @class */ (function () {
  840. function PathPrimitiveCommand() {
  841. }
  842. PathPrimitiveCommand.prototype.getUnitVaue = function (value) {
  843. return typeof value === "number" ? UnitConverter_1.UnitConverter.twipsToPixels(value).toString() : value;
  844. };
  845. return PathPrimitiveCommand;
  846. }());
  847. exports.PathPrimitiveCommand = PathPrimitiveCommand;
  848. var PathPrimitiveMoveToCommand = /** @class */ (function (_super) {
  849. __extends(PathPrimitiveMoveToCommand, _super);
  850. function PathPrimitiveMoveToCommand(x, y) {
  851. var _this = _super.call(this) || this;
  852. _this.x = x;
  853. _this.y = y;
  854. return _this;
  855. }
  856. PathPrimitiveMoveToCommand.prototype.toString = function () {
  857. return "M " + this.getUnitVaue(this.x) + " " + this.getUnitVaue(this.y);
  858. };
  859. return PathPrimitiveMoveToCommand;
  860. }(PathPrimitiveCommand));
  861. exports.PathPrimitiveMoveToCommand = PathPrimitiveMoveToCommand;
  862. var PathPrimitiveLineToCommand = /** @class */ (function (_super) {
  863. __extends(PathPrimitiveLineToCommand, _super);
  864. function PathPrimitiveLineToCommand(x, y) {
  865. var _this = _super.call(this) || this;
  866. _this.x = x;
  867. _this.y = y;
  868. return _this;
  869. }
  870. PathPrimitiveLineToCommand.prototype.toString = function () {
  871. return "L " + this.getUnitVaue(this.x) + " " + this.getUnitVaue(this.y);
  872. };
  873. return PathPrimitiveLineToCommand;
  874. }(PathPrimitiveCommand));
  875. exports.PathPrimitiveLineToCommand = PathPrimitiveLineToCommand;
  876. var PathPrimitiveCubicCurveToCommand = /** @class */ (function (_super) {
  877. __extends(PathPrimitiveCubicCurveToCommand, _super);
  878. function PathPrimitiveCubicCurveToCommand(x1, y1, x2, y2, x3, y3) {
  879. var _this = _super.call(this) || this;
  880. _this.x1 = x1;
  881. _this.y1 = y1;
  882. _this.x2 = x2;
  883. _this.y2 = y2;
  884. _this.x3 = x3;
  885. _this.y3 = y3;
  886. return _this;
  887. }
  888. PathPrimitiveCubicCurveToCommand.prototype.toString = function () {
  889. return "C " + this.getUnitVaue(this.x1) + " " + this.getUnitVaue(this.y1) + "," +
  890. this.getUnitVaue(this.x2) + " " + this.getUnitVaue(this.y2) + "," +
  891. this.getUnitVaue(this.x3) + " " + this.getUnitVaue(this.y3);
  892. };
  893. return PathPrimitiveCubicCurveToCommand;
  894. }(PathPrimitiveCommand));
  895. exports.PathPrimitiveCubicCurveToCommand = PathPrimitiveCubicCurveToCommand;
  896. var PathPrimitiveQuadraticCurveToCommand = /** @class */ (function (_super) {
  897. __extends(PathPrimitiveQuadraticCurveToCommand, _super);
  898. function PathPrimitiveQuadraticCurveToCommand(x1, y1, x2, y2) {
  899. var _this = _super.call(this) || this;
  900. _this.x1 = x1;
  901. _this.y1 = y1;
  902. _this.x2 = x2;
  903. _this.y2 = y2;
  904. return _this;
  905. }
  906. PathPrimitiveQuadraticCurveToCommand.prototype.toString = function () {
  907. return "Q " + this.getUnitVaue(this.x1) + " " + this.getUnitVaue(this.y1) + "," +
  908. this.getUnitVaue(this.x2) + " " + this.getUnitVaue(this.y2);
  909. };
  910. return PathPrimitiveQuadraticCurveToCommand;
  911. }(PathPrimitiveCommand));
  912. exports.PathPrimitiveQuadraticCurveToCommand = PathPrimitiveQuadraticCurveToCommand;
  913. var PathPrimitiveArcToCommand = /** @class */ (function (_super) {
  914. __extends(PathPrimitiveArcToCommand, _super);
  915. function PathPrimitiveArcToCommand(rx, ry, xAxisRotation, largeArcFlag, sweepFag, x, y) {
  916. var _this = _super.call(this) || this;
  917. _this.rx = rx;
  918. _this.ry = ry;
  919. _this.xAxisRotation = xAxisRotation;
  920. _this.largeArcFlag = largeArcFlag;
  921. _this.sweepFag = sweepFag;
  922. _this.x = x;
  923. _this.y = y;
  924. return _this;
  925. }
  926. PathPrimitiveArcToCommand.prototype.toString = function () {
  927. return "A " + this.getUnitVaue(this.rx) + " " + this.getUnitVaue(this.ry) + " " +
  928. this.getUnitVaue(this.xAxisRotation) + " " +
  929. (this.largeArcFlag ? "1" : "0") + " " + (this.sweepFag ? "1" : "0") +
  930. this.getUnitVaue(this.x) + "," + this.getUnitVaue(this.y);
  931. };
  932. return PathPrimitiveArcToCommand;
  933. }(PathPrimitiveCommand));
  934. exports.PathPrimitiveArcToCommand = PathPrimitiveArcToCommand;
  935. var PathPrimitiveClosePathCommand = /** @class */ (function (_super) {
  936. __extends(PathPrimitiveClosePathCommand, _super);
  937. function PathPrimitiveClosePathCommand() {
  938. return _super.call(this) || this;
  939. }
  940. PathPrimitiveClosePathCommand.prototype.toString = function () {
  941. return "z";
  942. };
  943. return PathPrimitiveClosePathCommand;
  944. }(PathPrimitiveCommand));
  945. exports.PathPrimitiveClosePathCommand = PathPrimitiveClosePathCommand;
  946. /***/ }),
  947. /* 3 */
  948. /***/ (function(module, exports, __webpack_require__) {
  949. "use strict";
  950. Object.defineProperty(exports, "__esModule", { value: true });
  951. var Utils_1 = __webpack_require__(0);
  952. var Style_1 = __webpack_require__(47);
  953. var ConnectionPointSide;
  954. (function (ConnectionPointSide) {
  955. ConnectionPointSide[ConnectionPointSide["Undefined"] = -1] = "Undefined";
  956. ConnectionPointSide[ConnectionPointSide["North"] = 0] = "North";
  957. ConnectionPointSide[ConnectionPointSide["East"] = 1] = "East";
  958. ConnectionPointSide[ConnectionPointSide["South"] = 2] = "South";
  959. ConnectionPointSide[ConnectionPointSide["West"] = 3] = "West";
  960. })(ConnectionPointSide = exports.ConnectionPointSide || (exports.ConnectionPointSide = {}));
  961. ;
  962. var DiagramItem = /** @class */ (function () {
  963. function DiagramItem() {
  964. this.key = undefined;
  965. this.dataKey = undefined;
  966. this.attachedConnectors = [];
  967. this.zIndex = 0;
  968. this.locked = false;
  969. this.style = new Style_1.Style();
  970. this.styleText = new Style_1.StyleText();
  971. }
  972. DiagramItem.prototype.assign = function (item) {
  973. item.key = this.key;
  974. item.dataKey = this.dataKey;
  975. item.locked = this.locked;
  976. item.attachedConnectors = this.attachedConnectors.slice();
  977. item.style = this.style.clone();
  978. item.styleText = this.styleText.clone();
  979. item.zIndex = this.zIndex;
  980. };
  981. DiagramItem.prototype.invalidatePrimitives = function () {
  982. delete this.primitives;
  983. delete this.selectorPrimitives;
  984. };
  985. DiagramItem.prototype.getPrimitives = function () {
  986. if (!this.primitives)
  987. this.primitives = this.createPrimitives();
  988. return this.primitives;
  989. };
  990. DiagramItem.prototype.getSelectorPrimitives = function () {
  991. if (!this.selectorPrimitives)
  992. this.selectorPrimitives = this.createSelectorPrimitives();
  993. return this.selectorPrimitives;
  994. };
  995. DiagramItem.prototype.getConnectionPoint = function (index, targetPoint) {
  996. return this.getConnectionPointCore(index, targetPoint).toPoint();
  997. };
  998. DiagramItem.prototype.getConnectionPointCore = function (index, targetPoint) {
  999. if (index < 0 && targetPoint)
  1000. index = this.getNearestConnectionPoint(targetPoint);
  1001. return this.getConnectionPoints()[index];
  1002. };
  1003. DiagramItem.prototype.getNearestConnectionPoint = function (targetPoint) {
  1004. var distance = Number.MAX_VALUE;
  1005. var result;
  1006. this.getConnectionPoints().forEach(function (pt, index) {
  1007. var ptDistance = Utils_1.GeometryUtils.getDistance(pt, targetPoint);
  1008. if (ptDistance < distance) {
  1009. distance = ptDistance;
  1010. result = index;
  1011. }
  1012. });
  1013. return result;
  1014. };
  1015. DiagramItem.prototype.getConnectionPointIndex = function (side) {
  1016. var points = this.getConnectionPoints();
  1017. return points.reduce(function (prevIndex, pt, index) {
  1018. if (side === ConnectionPointSide.North && pt.y < points[prevIndex].y)
  1019. return index;
  1020. if (side === ConnectionPointSide.South && pt.y > points[prevIndex].y)
  1021. return index;
  1022. if (side === ConnectionPointSide.West && pt.x < points[prevIndex].x)
  1023. return index;
  1024. if (side === ConnectionPointSide.East && pt.x > points[prevIndex].x)
  1025. return index;
  1026. return prevIndex;
  1027. }, 0);
  1028. };
  1029. Object.defineProperty(DiagramItem.prototype, "isVisible", {
  1030. get: function () { return true; },
  1031. enumerable: true,
  1032. configurable: true
  1033. });
  1034. Object.defineProperty(DiagramItem.prototype, "allowHasText", {
  1035. get: function () { return true; },
  1036. enumerable: true,
  1037. configurable: true
  1038. });
  1039. DiagramItem.prototype.intersectedByRect = function (rect) {
  1040. return this.rectangle.intersect(rect);
  1041. };
  1042. return DiagramItem;
  1043. }());
  1044. exports.DiagramItem = DiagramItem;
  1045. /***/ }),
  1046. /* 4 */
  1047. /***/ (function(module, exports, __webpack_require__) {
  1048. "use strict";
  1049. var __extends = (this && this.__extends) || (function () {
  1050. var extendStatics = function (d, b) {
  1051. extendStatics = Object.setPrototypeOf ||
  1052. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1053. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1054. return extendStatics(d, b);
  1055. };
  1056. return function (d, b) {
  1057. extendStatics(d, b);
  1058. function __() { this.constructor = d; }
  1059. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1060. };
  1061. })();
  1062. Object.defineProperty(exports, "__esModule", { value: true });
  1063. var HistoryItem = /** @class */ (function () {
  1064. function HistoryItem() {
  1065. this.uniqueId = -1;
  1066. }
  1067. HistoryItem.prototype.changeModified = function () {
  1068. return true;
  1069. };
  1070. HistoryItem.prototype.getName = function () {
  1071. return this.constructor.name;
  1072. };
  1073. return HistoryItem;
  1074. }());
  1075. exports.HistoryItem = HistoryItem;
  1076. var CompositionHistoryItem = /** @class */ (function (_super) {
  1077. __extends(CompositionHistoryItem, _super);
  1078. function CompositionHistoryItem() {
  1079. var _this = _super !== null && _super.apply(this, arguments) || this;
  1080. _this.historyItems = [];
  1081. return _this;
  1082. }
  1083. CompositionHistoryItem.prototype.changeModified = function () {
  1084. var item;
  1085. for (var i = 0; item = this.historyItems[i]; i++) {
  1086. if (item.changeModified())
  1087. return true;
  1088. }
  1089. return false;
  1090. };
  1091. CompositionHistoryItem.prototype.redo = function (manipulator) {
  1092. var item;
  1093. for (var i = 0; item = this.historyItems[i]; i++)
  1094. item.redo(manipulator);
  1095. };
  1096. CompositionHistoryItem.prototype.undo = function (manipulator) {
  1097. var item;
  1098. for (var i = this.historyItems.length - 1; item = this.historyItems[i]; i--)
  1099. item.undo(manipulator);
  1100. };
  1101. CompositionHistoryItem.prototype.add = function (historyItem) {
  1102. if (historyItem == null)
  1103. throw new Error("cannot be null");
  1104. this.historyItems.push(historyItem);
  1105. };
  1106. return CompositionHistoryItem;
  1107. }(HistoryItem));
  1108. exports.CompositionHistoryItem = CompositionHistoryItem;
  1109. /***/ }),
  1110. /* 5 */
  1111. /***/ (function(module, exports, __webpack_require__) {
  1112. "use strict";
  1113. var __extends = (this && this.__extends) || (function () {
  1114. var extendStatics = function (d, b) {
  1115. extendStatics = Object.setPrototypeOf ||
  1116. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1117. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1118. return extendStatics(d, b);
  1119. };
  1120. return function (d, b) {
  1121. extendStatics(d, b);
  1122. function __() { this.constructor = d; }
  1123. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1124. };
  1125. })();
  1126. Object.defineProperty(exports, "__esModule", { value: true });
  1127. var DiagramItem_1 = __webpack_require__(3);
  1128. var Utils_1 = __webpack_require__(0);
  1129. var UnitConverter_1 = __webpack_require__(13);
  1130. var LinePrimitive_1 = __webpack_require__(69);
  1131. var ConnectorPointsCalculator_1 = __webpack_require__(105);
  1132. var ConnectorPointsOrthogonalCalculator_1 = __webpack_require__(106);
  1133. var ConnectorProperties_1 = __webpack_require__(28);
  1134. var ConnectorTexts_1 = __webpack_require__(112);
  1135. var TextPrimitive_1 = __webpack_require__(50);
  1136. var TextFilterPrimitive_1 = __webpack_require__(72);
  1137. var Event_1 = __webpack_require__(14);
  1138. var Utils_2 = __webpack_require__(26);
  1139. var ConnectorPosition;
  1140. (function (ConnectorPosition) {
  1141. ConnectorPosition[ConnectorPosition["Begin"] = 0] = "Begin";
  1142. ConnectorPosition[ConnectorPosition["End"] = 1] = "End";
  1143. })(ConnectorPosition = exports.ConnectorPosition || (exports.ConnectorPosition = {}));
  1144. var Connector = /** @class */ (function (_super) {
  1145. __extends(Connector, _super);
  1146. function Connector(points) {
  1147. var _this = _super.call(this) || this;
  1148. _this.beginConnectionPointIndex = -1;
  1149. _this.endConnectionPointIndex = -1;
  1150. _this.properties = new ConnectorProperties_1.ConnectorProperties();
  1151. _this.points = points.map(function (pt) { return pt.clone(); });
  1152. if (points.length < 2)
  1153. throw Error("Points count should be greater than 1");
  1154. _this.texts = new ConnectorTexts_1.ConnectorTexts();
  1155. return _this;
  1156. }
  1157. Connector.prototype.assign = function (item) {
  1158. _super.prototype.assign.call(this, item);
  1159. item.beginItem = this.beginItem;
  1160. item.beginConnectionPointIndex = this.beginConnectionPointIndex;
  1161. item.endItem = this.endItem;
  1162. item.endConnectionPointIndex = this.endConnectionPointIndex;
  1163. item.properties = this.properties.clone();
  1164. item.texts = this.texts.clone();
  1165. };
  1166. Connector.prototype.clone = function () {
  1167. var clone = new Connector(this.points);
  1168. this.assign(clone);
  1169. return clone;
  1170. };
  1171. Connector.prototype.getRenderPoints = function (keepSkipped) {
  1172. if (keepSkipped === void 0) { keepSkipped = false; }
  1173. if (this.renderPoints === undefined) {
  1174. this.renderPoints = this.getCalculator().getPoints();
  1175. this.renderPointsWithoutSkipped = this.renderPoints.filter(function (pt) { return !pt.skipped; });
  1176. }
  1177. return keepSkipped ? this.renderPoints : this.renderPointsWithoutSkipped;
  1178. };
  1179. Connector.prototype.getText = function (position) {
  1180. var textObj = this.texts.get(position);
  1181. return textObj ? textObj.value : "";
  1182. };
  1183. Connector.prototype.setText = function (position, text) {
  1184. if (!text || text === "")
  1185. this.texts.remove(position);
  1186. else
  1187. this.texts.set(position, new ConnectorTexts_1.ConnectorText(position, text));
  1188. };
  1189. Connector.prototype.getTextPoint = function (position) {
  1190. var points = this.getRenderPoints();
  1191. return Utils_1.GeometryUtils.getPathPointByPosition(points, position);
  1192. };
  1193. Connector.prototype.getTextPositionByPoint = function (point) {
  1194. var points = this.getRenderPoints();
  1195. var length = Utils_1.GeometryUtils.getPathLength(points);
  1196. var pos = Utils_1.GeometryUtils.getPathPositionByPoint(points, point);
  1197. var minTextHeight = UnitConverter_1.UnitConverter.pointsToTwips(parseInt(this.styleText["font-size"]));
  1198. if (minTextHeight > pos * length)
  1199. return minTextHeight / length;
  1200. if (minTextHeight > length - pos * length)
  1201. return (length - minTextHeight) / length;
  1202. return pos;
  1203. };
  1204. Connector.prototype.getTextRectangle = function (position) {
  1205. return new Utils_1.Rectangle(this.getTextPoint(position), new Utils_1.Size(0, 0));
  1206. };
  1207. Connector.prototype.getCalculator = function () {
  1208. return (this.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Straight) ?
  1209. new ConnectorPointsCalculator_1.ConnectorPointsCalculator(this) :
  1210. new ConnectorPointsOrthogonalCalculator_1.ConnectorPointsOrthogonalCalculator(this);
  1211. };
  1212. Connector.prototype.invalidateRenderPoints = function () {
  1213. delete this.renderPoints;
  1214. delete this.renderPointsWithoutSkipped;
  1215. };
  1216. Connector.prototype.createPrimitives = function () {
  1217. var _this = this;
  1218. var result = [];
  1219. var points = this.getRenderPoints();
  1220. points.forEach(function (pt, index) {
  1221. if (index > 0)
  1222. result.push(_this.createSegmentPrimitive(points[index - 1], pt, _this.style, null));
  1223. });
  1224. if (points.length > 1) {
  1225. if (this.properties.startLineEnding !== ConnectorProperties_1.ConnectorLineEnding.None)
  1226. result = result.concat(this.createLineEndingPrimitives(points[0], points[1]));
  1227. if (this.properties.endLineEnding !== ConnectorProperties_1.ConnectorLineEnding.None)
  1228. result = result.concat(this.createLineEndingPrimitives(points[points.length - 1], points[points.length - 2]));
  1229. }
  1230. return result.concat(this.createTextPrimitives());
  1231. };
  1232. Connector.prototype.createSelectorPrimitives = function () {
  1233. var _this = this;
  1234. var result = [];
  1235. var points = this.getRenderPoints();
  1236. points.forEach(function (pt, index) {
  1237. if (index > 0)
  1238. result.push(_this.createSegmentPrimitive(points[index - 1], pt, null, "selector"));
  1239. });
  1240. return result;
  1241. };
  1242. Connector.prototype.createTextPrimitives = function () {
  1243. var _this = this;
  1244. if (!this.allowHasText)
  1245. return [];
  1246. var result = [];
  1247. this.texts.forEach(function (textObj) {
  1248. var text = _this.getText(textObj.position);
  1249. if (text && text !== "") {
  1250. var pt = _this.getTextPoint(textObj.position);
  1251. var filterId = "filter" + _this.key;
  1252. result = result.concat([
  1253. new TextPrimitive_1.TextPrimitive(pt.x, pt.y, text, undefined, _this.styleText, true, null, filterId, function (el) {
  1254. Utils_2.RenderUtils.setElementEventData(el, Event_1.MouseEventElementType.ConnectorText, _this.key, textObj.position);
  1255. }),
  1256. new TextFilterPrimitive_1.TextFilterPrimitive(filterId)
  1257. ]);
  1258. }
  1259. });
  1260. return result;
  1261. };
  1262. Connector.prototype.createSegmentPrimitive = function (point1, point2, style, className) {
  1263. return new LinePrimitive_1.LinePrimitive(point1.x, point1.y, point2.x, point2.y, style, className);
  1264. };
  1265. Connector.prototype.createLineEndingPrimitives = function (point, directionPoint) {
  1266. var arrowHeight = Connector.arrowHeight;
  1267. if (point.x === directionPoint.x) {
  1268. var distance = Math.abs(point.y - directionPoint.y);
  1269. if (distance < arrowHeight)
  1270. arrowHeight = distance;
  1271. }
  1272. if (point.y === directionPoint.y) {
  1273. var distance = Math.abs(point.x - directionPoint.x);
  1274. if (distance < arrowHeight)
  1275. arrowHeight = distance;
  1276. }
  1277. var arrowPoints = Utils_1.GeometryUtils.getArrowPoints(point, directionPoint, arrowHeight, Connector.arrowWidth);
  1278. return [
  1279. new LinePrimitive_1.LinePrimitive(arrowPoints.point1.x, arrowPoints.point1.y, point.x, point.y, this.style),
  1280. new LinePrimitive_1.LinePrimitive(arrowPoints.point2.x, arrowPoints.point2.y, point.x, point.y, this.style)
  1281. ];
  1282. };
  1283. Connector.prototype.getExtremeItem = function (position) {
  1284. if (position === ConnectorPosition.Begin)
  1285. return this.beginItem;
  1286. if (position === ConnectorPosition.End)
  1287. return this.endItem;
  1288. return null;
  1289. };
  1290. Connector.prototype.getExtremeConnectionPointIndex = function (position) {
  1291. if (position === ConnectorPosition.Begin)
  1292. return this.beginConnectionPointIndex;
  1293. if (position === ConnectorPosition.End)
  1294. return this.endConnectionPointIndex;
  1295. return -1;
  1296. };
  1297. Object.defineProperty(Connector.prototype, "rectangle", {
  1298. get: function () {
  1299. var points = this.getRenderPoints();
  1300. var xarr = points.map(function (p) { return p.x; });
  1301. var yarr = points.map(function (p) { return p.y; });
  1302. var minX = xarr.reduce(function (prev, cur) { return Math.min(prev, cur); }, Number.MAX_VALUE);
  1303. var maxX = xarr.reduce(function (prev, cur) { return Math.max(prev, cur); }, -Number.MAX_VALUE);
  1304. var minY = yarr.reduce(function (prev, cur) { return Math.min(prev, cur); }, Number.MAX_VALUE);
  1305. var maxY = yarr.reduce(function (prev, cur) { return Math.max(prev, cur); }, -Number.MAX_VALUE);
  1306. return Utils_1.Rectangle.create(minX, minY, maxX - minX, maxY - minY);
  1307. },
  1308. enumerable: true,
  1309. configurable: true
  1310. });
  1311. Connector.prototype.getConnectionPoints = function () {
  1312. return [];
  1313. };
  1314. Connector.prototype.getConnectionPointsForSelection = function () {
  1315. return [];
  1316. };
  1317. Connector.prototype.getConnectionPointSide = function (index, targetPoint) {
  1318. return DiagramItem_1.ConnectionPointSide.Undefined;
  1319. };
  1320. Connector.prototype.getConnectionPointForSelectionSide = function (index) {
  1321. return DiagramItem_1.ConnectionPointSide.Undefined;
  1322. };
  1323. Connector.prototype.getSegments = function () {
  1324. var points = this.getRenderPoints();
  1325. var result = [];
  1326. points.forEach(function (pt, index) {
  1327. if (index > 0)
  1328. result.push(Utils_1.Segment.createByPoints(points[index - 1], pt));
  1329. });
  1330. return result;
  1331. };
  1332. Connector.prototype.intersectedByRect = function (rect) {
  1333. var result = false;
  1334. this.getSegments().forEach(function (s) {
  1335. if (s.intersectRect(rect)) {
  1336. result = true;
  1337. return;
  1338. }
  1339. });
  1340. return result;
  1341. };
  1342. Connector.arrowHeight = UnitConverter_1.UnitConverter.pixelsToTwips(8);
  1343. Connector.arrowWidth = UnitConverter_1.UnitConverter.pixelsToTwips(2);
  1344. Connector.minOffset = UnitConverter_1.UnitConverter.pixelsToTwips(18);
  1345. Connector.minTextHeight = UnitConverter_1.UnitConverter.pixelsToTwips(12);
  1346. return Connector;
  1347. }(DiagramItem_1.DiagramItem));
  1348. exports.Connector = Connector;
  1349. /***/ }),
  1350. /* 6 */
  1351. /***/ (function(module, exports, __webpack_require__) {
  1352. "use strict";
  1353. Object.defineProperty(exports, "__esModule", { value: true });
  1354. var SimpleCommandState = /** @class */ (function () {
  1355. function SimpleCommandState(enabled, value, items) {
  1356. this.visible = true;
  1357. this.denyUpdateValue = false;
  1358. this.enabled = enabled;
  1359. this.value = value;
  1360. this.items = items;
  1361. }
  1362. return SimpleCommandState;
  1363. }());
  1364. exports.SimpleCommandState = SimpleCommandState;
  1365. /***/ }),
  1366. /* 7 */
  1367. /***/ (function(module, exports, __webpack_require__) {
  1368. "use strict";
  1369. Object.defineProperty(exports, "__esModule", { value: true });
  1370. var CommandBase = /** @class */ (function () {
  1371. function CommandBase(control) {
  1372. this.control = control;
  1373. }
  1374. CommandBase.prototype.execute = function (parameter) {
  1375. var state = this.getState();
  1376. if (!state.enabled)
  1377. return false;
  1378. this.control.beginUpdate();
  1379. var executed = this.executeCore(state, parameter);
  1380. this.control.endUpdate();
  1381. return executed;
  1382. };
  1383. CommandBase.prototype.updateControlState = function () {
  1384. if (!this.lockUIUpdating()) {
  1385. this.control.barManager.updateItemsState();
  1386. }
  1387. };
  1388. CommandBase.prototype.lockUIUpdating = function () {
  1389. return false;
  1390. };
  1391. CommandBase.prototype.isEnabled = function () {
  1392. return true;
  1393. };
  1394. return CommandBase;
  1395. }());
  1396. exports.CommandBase = CommandBase;
  1397. /***/ }),
  1398. /* 8 */
  1399. /***/ (function(module, exports, __webpack_require__) {
  1400. "use strict";
  1401. Object.defineProperty(exports, "__esModule", { value: true });
  1402. var MoveShapeHistoryItem_1 = __webpack_require__(101);
  1403. var AddConnectionHistoryItem_1 = __webpack_require__(35);
  1404. var MoveConnectorPointHistoryItem_1 = __webpack_require__(36);
  1405. var ModelResizeHistoryItem_1 = __webpack_require__(114);
  1406. var UpdatePositionsOnPageResizeHistoryItem_1 = __webpack_require__(115);
  1407. var Connector_1 = __webpack_require__(5);
  1408. var DiagramItem_1 = __webpack_require__(3);
  1409. var Utils_1 = __webpack_require__(0);
  1410. var DeleteConnectorPointHistoryItem_1 = __webpack_require__(116);
  1411. var ResizeShapeHistoryItem_1 = __webpack_require__(117);
  1412. var DeleteConnectionHistoryItem_1 = __webpack_require__(73);
  1413. var DeleteShapeHistoryItem_1 = __webpack_require__(74);
  1414. var DeleteConnectorHistoryItem_1 = __webpack_require__(118);
  1415. var SetSelectionHistoryItem_1 = __webpack_require__(29);
  1416. var Shape_1 = __webpack_require__(9);
  1417. var ConnectorProperties_1 = __webpack_require__(28);
  1418. var UnitConverter_1 = __webpack_require__(13);
  1419. var DataSource_1 = __webpack_require__(37);
  1420. var AddShapeHistoryItem_1 = __webpack_require__(51);
  1421. var AddConnectorHistoryItem_1 = __webpack_require__(58);
  1422. var LayoutUtils_1 = __webpack_require__(59);
  1423. var Graph_1 = __webpack_require__(34);
  1424. var WideTree_1 = __webpack_require__(61);
  1425. var Sugiyama_1 = __webpack_require__(40);
  1426. var LayoutSettings_1 = __webpack_require__(18);
  1427. var Base_1 = __webpack_require__(19);
  1428. var CloneShapeHistoryItem_1 = __webpack_require__(154);
  1429. var CloneConnectorHistoryItem_1 = __webpack_require__(155);
  1430. var ModelUtils = /** @class */ (function () {
  1431. function ModelUtils() {
  1432. }
  1433. ModelUtils.setShapePosition = function (history, model, shapeKey, newPosition, redoMethod) {
  1434. var shape = model.findShape(shapeKey);
  1435. if (!shape.position.equals(newPosition))
  1436. redoMethod.call(history, new MoveShapeHistoryItem_1.MoveShapeHistoryItem(shapeKey, newPosition));
  1437. };
  1438. ModelUtils.setShapeSize = function (history, model, shapeKey, newPosition, newSize, redoMethod) {
  1439. var shape = model.findShape(shapeKey);
  1440. if (!shape.size.equals(newSize) || !shape.position.equals(newPosition))
  1441. redoMethod.call(history, new ResizeShapeHistoryItem_1.ResizeShapeHistoryItem(shapeKey, newPosition, newSize));
  1442. };
  1443. ModelUtils.setConnectorPoint = function (history, model, connectorKey, pointIndex, newPosition, redoMethod) {
  1444. var connector = model.findConnector(connectorKey);
  1445. if (!connector.points[pointIndex].equals(newPosition))
  1446. redoMethod.call(history, new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(connectorKey, pointIndex, newPosition));
  1447. };
  1448. ModelUtils.getSymmetricDifference = function (nodeKeyMap, allItems) {
  1449. return allItems.filter(function (i) {
  1450. if (i instanceof Connector_1.Connector)
  1451. return (!i.beginItem || !nodeKeyMap[i.beginItem.key]) && (!i.endItem || !nodeKeyMap[i.endItem.key]);
  1452. return !nodeKeyMap[i.key];
  1453. });
  1454. };
  1455. ModelUtils.offsetLayoutToFreeSpace = function (layout, occupiedRectangles) {
  1456. var graphItemRect = layout.getRectangle(true);
  1457. var freePoint = Utils_1.GeometryUtils.findFreeSpace(occupiedRectangles, graphItemRect.size.offset(this.spacing, this.spacing), false);
  1458. if (freePoint)
  1459. return layout.offsetNodes(freePoint.x + this.spacing, freePoint.y + this.spacing);
  1460. var maxX = occupiedRectangles.reduce(function (max, rect) { return rect.right > max ? rect.right : max; }, -1);
  1461. return layout.offsetNodes(maxX + this.spacing, graphItemRect.top === 0 ? this.spacing : 0);
  1462. };
  1463. ModelUtils.applyLayoutToNodes = function (history, model, layout, connectors) {
  1464. var connectorsSet = connectors.reduce(function (acc, c) { return acc[c.key] = true && acc; }, {});
  1465. layout.forEachNode(function (nl, nk) {
  1466. var shape = model.findShape(nk);
  1467. var delta = nl.position.offset(-shape.position.x, -shape.position.y);
  1468. ModelUtils.setShapePosition(history, model, nk, nl.position, history.addAndRedo);
  1469. if (delta.x && delta.y) {
  1470. shape.attachedConnectors
  1471. .filter(function (c) { return !connectorsSet[c.key]; })
  1472. .forEach(function (connector) {
  1473. ModelUtils.updateConnectorAttachedPoints(history, connector, history.addOrModifyAndRedo);
  1474. var beginPointIndex = connector.beginItem ? 1 : 0;
  1475. var endPointIndex = connector.endItem ? (connector.points.length - 2) : (connector.points.length - 1);
  1476. for (var i = beginPointIndex; i <= endPointIndex; i++)
  1477. history.addAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(connector.key, i, connector.points[i].offset(delta.x, delta.y)));
  1478. });
  1479. }
  1480. });
  1481. };
  1482. ModelUtils.applyLayoutToConnectors = function (history, layout, connectors) {
  1483. var _this = this;
  1484. connectors.filter(function (c) { return c.beginItem && c.endItem; }).forEach(function (connector) {
  1485. var edgeLayout = layout.edgeToPosition[connector.key];
  1486. if (edgeLayout) {
  1487. if (edgeLayout.beginIndex !== connector.beginConnectionPointIndex)
  1488. history.addAndRedo(new AddConnectionHistoryItem_1.SetConnectionPointIndexHistoryItem(connector, edgeLayout.beginIndex, Connector_1.ConnectorPosition.Begin));
  1489. if (edgeLayout.endIndex !== connector.endConnectionPointIndex)
  1490. history.addAndRedo(new AddConnectionHistoryItem_1.SetConnectionPointIndexHistoryItem(connector, edgeLayout.endIndex, Connector_1.ConnectorPosition.End));
  1491. }
  1492. _this.updateConnectorAttachedPoints(history, connector, history.addAndRedo);
  1493. if (edgeLayout) {
  1494. while (connector.points.length > 2)
  1495. history.addAndRedo(new DeleteConnectorPointHistoryItem_1.DeleteConnectorPointHistoryItem(connector.key, 1));
  1496. }
  1497. });
  1498. };
  1499. ModelUtils.adjustLayoutToSnapGrid = function (model, layout) {
  1500. var _this = this;
  1501. layout.nodeKeys.forEach(function (key) {
  1502. layout.nodeToLayout[key].position.x = _this.getSnappedPos(model, layout.nodeToLayout[key].position.x);
  1503. layout.nodeToLayout[key].position.y = _this.getSnappedPos(model, layout.nodeToLayout[key].position.y);
  1504. });
  1505. };
  1506. ModelUtils.updateConnectorAttachedPoints = function (history, connector, redoMethod) {
  1507. if (connector.beginItem) {
  1508. var pt = connector.beginItem.getConnectionPoint(connector.beginConnectionPointIndex, connector.points[1]);
  1509. if (!connector.points[0].equals(pt))
  1510. redoMethod.call(history, new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(connector.key, 0, pt));
  1511. }
  1512. if (connector.endItem) {
  1513. var pt = connector.endItem.getConnectionPoint(connector.endConnectionPointIndex, connector.points[connector.points.length - 2]);
  1514. if (!connector.points[connector.points.length - 1].equals(pt))
  1515. redoMethod.call(history, new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(connector.key, connector.points.length - 1, pt));
  1516. }
  1517. };
  1518. ModelUtils.removeUnnecessaryConnectorPoints = function (history, connector, exceptPoints, removeCallback) {
  1519. Utils_1.GeometryUtils.removeUnnecessaryLinePoints(connector.points, function (pt, index) {
  1520. var needRemove = true;
  1521. if (exceptPoints) {
  1522. exceptPoints.forEach(function (ept) {
  1523. if (ept && ept.equals(pt)) {
  1524. needRemove = false;
  1525. return;
  1526. }
  1527. });
  1528. }
  1529. if (needRemove) {
  1530. history.addOrModifyAndRedo(new DeleteConnectorPointHistoryItem_1.DeleteConnectorPointHistoryItem(connector.key, index));
  1531. if (removeCallback !== undefined)
  1532. removeCallback(index);
  1533. return true;
  1534. }
  1535. });
  1536. };
  1537. ModelUtils.removeConnectorIntermediatePoints = function (history, connector) {
  1538. if (connector.properties.lineOption !== ConnectorProperties_1.ConnectorLineOption.Orthogonal || connector.points.length <= 2)
  1539. return;
  1540. var removePoints = false;
  1541. if (this.isShapeIntersectConnectorPointsLine(connector.beginItem, connector))
  1542. removePoints = true;
  1543. if (this.isShapeIntersectConnectorPointsLine(connector.endItem, connector))
  1544. removePoints = true;
  1545. if (removePoints) {
  1546. while (connector.points.length > 2) {
  1547. history.addOrModifyAndRedo(new DeleteConnectorPointHistoryItem_1.DeleteConnectorPointHistoryItem(connector.key, 1));
  1548. }
  1549. }
  1550. };
  1551. ModelUtils.isShapeIntersectConnectorPointsLine = function (shape, connector) {
  1552. if (shape === undefined)
  1553. return false;
  1554. var offset = Connector_1.Connector.minOffset - UnitConverter_1.UnitConverter.pixelsToTwips(1);
  1555. var rect = shape.rectangle.inflate(offset, offset);
  1556. var prevPt;
  1557. for (var i = 1; i < connector.points.length - 1; i++) {
  1558. if (prevPt !== undefined) {
  1559. if (prevPt.x === connector.points[i].x) {
  1560. if (rect.left <= prevPt.x && prevPt.x <= rect.right)
  1561. return true;
  1562. }
  1563. if (prevPt.y === connector.points[i].y) {
  1564. if (rect.top <= prevPt.y && prevPt.y <= rect.bottom)
  1565. return true;
  1566. }
  1567. }
  1568. prevPt = connector.points[i];
  1569. }
  1570. return false;
  1571. };
  1572. ModelUtils.getSnappedPos = function (model, pos) {
  1573. return Math.round(pos / model.gridSize) * model.gridSize;
  1574. };
  1575. ModelUtils.tryUpdateModelSize = function (history, model, processPoints) {
  1576. var pageSizeOffset = this.getRequiredPageSizeChanges(model);
  1577. if (pageSizeOffset.bottom || pageSizeOffset.left || pageSizeOffset.right || pageSizeOffset.top) {
  1578. history.addOrModifyAndRedo(new ModelResizeHistoryItem_1.ModelResizeHistoryItem(pageSizeOffset));
  1579. if (pageSizeOffset.left || pageSizeOffset.top) {
  1580. history.addOrModifyAndRedo(new UpdatePositionsOnPageResizeHistoryItem_1.UpdatePositionsOnPageResizeHistoryItem(pageSizeOffset.left, pageSizeOffset.top));
  1581. if (processPoints !== undefined)
  1582. processPoints(pageSizeOffset.left, pageSizeOffset.top);
  1583. }
  1584. }
  1585. };
  1586. ModelUtils.deleteItems = function (history, model, selection, items) {
  1587. history.beginTransaction();
  1588. items.forEach(function (item) {
  1589. if (item instanceof Shape_1.Shape) {
  1590. var shape = item;
  1591. while (shape.attachedConnectors.length > 0) {
  1592. var connector = shape.attachedConnectors[0];
  1593. history.addAndRedo(new DeleteConnectionHistoryItem_1.DeleteConnectionHistoryItem(connector, connector.beginItem === shape ? Connector_1.ConnectorPosition.Begin : Connector_1.ConnectorPosition.End));
  1594. }
  1595. history.addAndRedo(new DeleteShapeHistoryItem_1.DeleteShapeHistoryItem(shape.key));
  1596. }
  1597. if (item instanceof Connector_1.Connector) {
  1598. var connector = item;
  1599. if (connector.beginItem)
  1600. history.addAndRedo(new DeleteConnectionHistoryItem_1.DeleteConnectionHistoryItem(connector, Connector_1.ConnectorPosition.Begin));
  1601. if (connector.endItem)
  1602. history.addAndRedo(new DeleteConnectionHistoryItem_1.DeleteConnectionHistoryItem(connector, Connector_1.ConnectorPosition.End));
  1603. history.addAndRedo(new DeleteConnectorHistoryItem_1.DeleteConnectorHistoryItem(connector.key));
  1604. }
  1605. });
  1606. this.tryUpdateModelSize(history, model);
  1607. history.addAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(selection, []));
  1608. history.endTransaction();
  1609. };
  1610. ModelUtils.deleteAllItems = function (history, model, selection) {
  1611. this.deleteItems(history, model, selection, model.items.slice());
  1612. };
  1613. ModelUtils.deleteSelection = function (history, model, selection) {
  1614. this.deleteItems(history, model, selection, selection.getSelectedItems());
  1615. };
  1616. ModelUtils.cloneSelectionToOffset = function (history, model, selection, dx, dy) {
  1617. history.beginTransaction();
  1618. var shapes = selection.getSelectedShapes();
  1619. var newShapesHash = {};
  1620. var ids = [];
  1621. shapes.forEach(function (shape, index) {
  1622. var newShape = shape.clone();
  1623. newShape.position = newShape.position.offset(dx, dy);
  1624. history.addOrModifyAndRedo(new CloneShapeHistoryItem_1.CloneShapeHistoryItem(newShape));
  1625. newShapesHash[shape.key] = newShape;
  1626. ids.push(newShape.key);
  1627. });
  1628. var connectors = selection.getSelectedConnectors();
  1629. connectors.forEach(function (connector, index) {
  1630. var newConnector = connector.clone();
  1631. newConnector.points.forEach(function (point) {
  1632. point.x += dx;
  1633. point.y += dy;
  1634. });
  1635. history.addOrModifyAndRedo(new CloneConnectorHistoryItem_1.CloneConnectorHistoryItem(newConnector, connector.beginItem ? newShapesHash[connector.beginItem.key] : null, connector.endItem ? newShapesHash[connector.endItem.key] : null));
  1636. ids.push(newConnector.key);
  1637. });
  1638. history.addOrModifyAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(selection, ids));
  1639. ModelUtils.tryUpdateModelSize(history, model);
  1640. history.endTransaction();
  1641. };
  1642. ModelUtils.createItemsByDataSource = function (history, model, selection, dataSource, layoutType, setDataKeys) {
  1643. var DEFAULT_STEP = 2000;
  1644. var rowIndex = 0;
  1645. var colIndex = 0;
  1646. var externalToInnerMap = {};
  1647. var shapes = [];
  1648. var connectors = [];
  1649. history.beginTransaction();
  1650. dataSource.nodes.forEach(function (node) {
  1651. var point = new Utils_1.Point(colIndex++ * DEFAULT_STEP, rowIndex * DEFAULT_STEP);
  1652. var dataKey = setDataKeys ? node.key : undefined;
  1653. var insert = new AddShapeHistoryItem_1.AddShapeHistoryItem(node.type, point, node.text, dataKey);
  1654. history.addAndRedo(insert);
  1655. if (node.key !== undefined)
  1656. externalToInnerMap[node.key] = insert.shapeKey;
  1657. if (colIndex > 4) {
  1658. colIndex = 0;
  1659. rowIndex++;
  1660. }
  1661. shapes.push(model.findShape(insert.shapeKey));
  1662. });
  1663. dataSource.edges.forEach(function (edge) {
  1664. var shape = model.findShape(externalToInnerMap[edge.to]);
  1665. var parentShape = model.findShape(externalToInnerMap[edge.from]);
  1666. if (shape && parentShape !== undefined) {
  1667. var dataKey = setDataKeys ? edge.key : undefined;
  1668. var insert = new AddConnectorHistoryItem_1.AddConnectorHistoryItem([shape.position.clone(), parentShape.position.clone()], dataKey);
  1669. history.addAndRedo(insert);
  1670. var connector = model.findConnector(insert.connectorKey);
  1671. history.addAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(connector, parentShape, 0, Connector_1.ConnectorPosition.Begin));
  1672. history.addAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(connector, shape, 0, Connector_1.ConnectorPosition.End));
  1673. connectors.push(model.findConnector(insert.connectorKey));
  1674. }
  1675. });
  1676. var graph = Graph_1.Graph.create(shapes, connectors).cast(LayoutUtils_1.LayoutUtils.shapeToLayout);
  1677. var layout = layoutType === DataSource_1.DataLayoutType.Tree ?
  1678. new WideTree_1.TreeLayoutBuilder(new LayoutSettings_1.TreeLayoutSettings(), graph).build() :
  1679. new Sugiyama_1.SugiyamaLayoutBuilder(new LayoutSettings_1.LayoutSettings(), graph).build();
  1680. var nonGraphItems = ModelUtils.getSymmetricDifference(layout.nodeToLayout, model.items);
  1681. layout = ModelUtils.offsetLayoutToFreeSpace(layout, nonGraphItems.map(function (i) { return i.rectangle; }));
  1682. ModelUtils.applyLayoutToNodes(history, model, layout, connectors);
  1683. ModelUtils.applyLayoutToConnectors(history, layout, connectors);
  1684. var items = connectors.map(function (c) { return c.key; }).concat(shapes.map(function (s) { return s.key; }));
  1685. history.addAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(selection, items));
  1686. ModelUtils.tryUpdateModelSize(history, model);
  1687. history.endTransaction();
  1688. };
  1689. ModelUtils.getRequiredPageSizeChanges = function (model) {
  1690. var rectangle = model.getRectangle();
  1691. var leftPageOffset = -Math.floor(rectangle.left / model.pageWidth);
  1692. var topPageOffset = -Math.floor(rectangle.top / model.pageHeight);
  1693. var rightPageOffset = -Math.floor((model.size.width - rectangle.right) / model.pageWidth);
  1694. var bottomPageOffset = -Math.floor((model.size.height - rectangle.bottom) / model.pageHeight);
  1695. return new Utils_1.Offset(leftPageOffset * model.pageWidth, topPageOffset * model.pageHeight, rightPageOffset * model.pageWidth, bottomPageOffset * model.pageHeight);
  1696. };
  1697. ModelUtils.getPositionByDirection = function (isStart, hor, vert) {
  1698. vert = vert * (isStart ? 1 : -1);
  1699. hor = hor * (isStart ? 1 : -1);
  1700. if (vert > 0)
  1701. return DiagramItem_1.ConnectionPointSide.South;
  1702. else if (vert < 0)
  1703. return DiagramItem_1.ConnectionPointSide.North;
  1704. else {
  1705. if (hor > 0)
  1706. return DiagramItem_1.ConnectionPointSide.East;
  1707. else if (hor < 0)
  1708. return DiagramItem_1.ConnectionPointSide.West;
  1709. }
  1710. return DiagramItem_1.ConnectionPointSide.Undefined;
  1711. };
  1712. ModelUtils.getNextItemKey = function (keys, checkKey, baseKey) {
  1713. if (!keys.length && baseKey === undefined)
  1714. return "0";
  1715. for (var i = keys.length - 1; i >= 0; i--) {
  1716. baseKey = baseKey || keys[i];
  1717. if (baseKey !== undefined && baseKey !== null)
  1718. break;
  1719. }
  1720. var key = this.generateNextItemKey(baseKey || "0");
  1721. while (!checkKey(key)) {
  1722. key = this.generateNextItemKey(key);
  1723. }
  1724. return key;
  1725. };
  1726. ModelUtils.generateNextItemKey = function (key) {
  1727. for (var i = key.length - 1; i >= 0; i--) {
  1728. if (!this.isDigit(key[i])) {
  1729. if (i === key.length - 1)
  1730. key = key + "0";
  1731. break;
  1732. }
  1733. var code = key.charCodeAt(i);
  1734. var char = String.fromCharCode(code + 1);
  1735. if (char > "9") {
  1736. char = "0";
  1737. if (i === 0 || !this.isDigit(key[i - 1]))
  1738. char = "1" + char;
  1739. }
  1740. key = key.substr(0, i) + char + key.substr(i + 1);
  1741. if (char !== "0" && char !== "10")
  1742. break;
  1743. else if (char === "10")
  1744. i--;
  1745. }
  1746. return key;
  1747. };
  1748. ModelUtils.isDigit = function (char) {
  1749. return "0" <= char && char <= "9";
  1750. };
  1751. ModelUtils.getGuidItemKey = function () {
  1752. return Base_1.CreateGuid();
  1753. };
  1754. ModelUtils.spacing = 200;
  1755. return ModelUtils;
  1756. }());
  1757. exports.ModelUtils = ModelUtils;
  1758. /***/ }),
  1759. /* 9 */
  1760. /***/ (function(module, exports, __webpack_require__) {
  1761. "use strict";
  1762. var __extends = (this && this.__extends) || (function () {
  1763. var extendStatics = function (d, b) {
  1764. extendStatics = Object.setPrototypeOf ||
  1765. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1766. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1767. return extendStatics(d, b);
  1768. };
  1769. return function (d, b) {
  1770. extendStatics(d, b);
  1771. function __() { this.constructor = d; }
  1772. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1773. };
  1774. })();
  1775. Object.defineProperty(exports, "__esModule", { value: true });
  1776. var Utils_1 = __webpack_require__(0);
  1777. var ShapeParameters_1 = __webpack_require__(25);
  1778. var UnitConverter_1 = __webpack_require__(13);
  1779. var DiagramItem_1 = __webpack_require__(3);
  1780. var ConnectionPoint_1 = __webpack_require__(32);
  1781. var Shape = /** @class */ (function (_super) {
  1782. __extends(Shape, _super);
  1783. function Shape(description, position) {
  1784. var _this = _super.call(this) || this;
  1785. _this.description = description;
  1786. _this.position = position.clone();
  1787. _this.size = description.defaultSize.clone();
  1788. _this.text = description.defualtText;
  1789. _this.parameters = new ShapeParameters_1.ShapeParameters();
  1790. description.createParameters(_this.parameters);
  1791. return _this;
  1792. }
  1793. Shape.prototype.assign = function (item) {
  1794. _super.prototype.assign.call(this, item);
  1795. item.size = this.size.clone();
  1796. item.text = this.text;
  1797. item.parameters = this.parameters.clone();
  1798. };
  1799. Shape.prototype.clone = function () {
  1800. var clone = new Shape(this.description, this.position.clone());
  1801. this.assign(clone);
  1802. return clone;
  1803. };
  1804. Object.defineProperty(Shape.prototype, "allowHasText", {
  1805. get: function () { return this.description.allowHasText; },
  1806. enumerable: true,
  1807. configurable: true
  1808. });
  1809. Shape.prototype.createPrimitives = function () {
  1810. return this.description.createPrimitives(this);
  1811. };
  1812. Shape.prototype.createSelectorPrimitives = function () {
  1813. return this.description.createSelectorPrimitives(this);
  1814. };
  1815. Shape.prototype.normalizeX = function (x) {
  1816. return Math.max(this.position.x, Math.min(x, this.position.x + this.size.width));
  1817. };
  1818. Shape.prototype.normalizeY = function (y) {
  1819. return Math.max(this.position.y, Math.min(y, this.position.y + this.size.height));
  1820. };
  1821. Shape.prototype.getConnectionPoints = function () {
  1822. var _this = this;
  1823. var result = this.description.getConnectionPoints().map(function (pt, index) {
  1824. var point = new ConnectionPoint_1.ConnectionPoint(_this.position.x + pt.x * _this.size.width, _this.position.y + pt.y * _this.size.height, pt.side);
  1825. _this.description.processConnectionPoint(_this, point, index);
  1826. return point;
  1827. });
  1828. return result;
  1829. };
  1830. Shape.prototype.getConnectionPointsForSelection = function () {
  1831. var _this = this;
  1832. var result = this.description.getConnectionPointsForSelection().map(function (pt, index) {
  1833. var point = new ConnectionPoint_1.ConnectionPoint(_this.position.x + pt.x * _this.size.width, _this.position.y + pt.y * _this.size.height, pt.side);
  1834. return point;
  1835. });
  1836. return result;
  1837. };
  1838. Shape.prototype.getConnectionPointSide = function (index, targetPoint) {
  1839. var point = this.getConnectionPointCore(index, targetPoint);
  1840. if (point.side !== DiagramItem_1.ConnectionPointSide.Undefined)
  1841. return point.side;
  1842. return this.getConnectionPointSideByGeometry(point);
  1843. };
  1844. Shape.prototype.getConnectionPointForSelectionSide = function (index) {
  1845. var point = this.getConnectionPointsForSelection()[index];
  1846. if (point.side !== DiagramItem_1.ConnectionPointSide.Undefined)
  1847. return point.side;
  1848. return this.getConnectionPointSideByGeometry(point);
  1849. };
  1850. Shape.prototype.getConnectionPointSideByGeometry = function (point) {
  1851. var pt = point.offset(-this.position.x, -this.position.y).multiply(1 / this.size.width, 1 / this.size.height);
  1852. if (pt.x >= pt.y && (pt.x > 0 || pt.y > 0)) {
  1853. if (pt.x < 0.5 || (1 - pt.x) >= pt.y)
  1854. return DiagramItem_1.ConnectionPointSide.North;
  1855. return DiagramItem_1.ConnectionPointSide.East;
  1856. }
  1857. else {
  1858. if (pt.x > 0.5 || (1 - pt.x) <= pt.y)
  1859. return DiagramItem_1.ConnectionPointSide.South;
  1860. return DiagramItem_1.ConnectionPointSide.West;
  1861. }
  1862. };
  1863. Object.defineProperty(Shape.prototype, "rectangle", {
  1864. get: function () {
  1865. return new Utils_1.Rectangle(this.position, this.size);
  1866. },
  1867. enumerable: true,
  1868. configurable: true
  1869. });
  1870. Object.defineProperty(Shape.prototype, "textRectangle", {
  1871. get: function () {
  1872. return this.description.getTextRectangle(this.rectangle);
  1873. },
  1874. enumerable: true,
  1875. configurable: true
  1876. });
  1877. Shape.lineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(2);
  1878. return Shape;
  1879. }(DiagramItem_1.DiagramItem));
  1880. exports.Shape = Shape;
  1881. /***/ }),
  1882. /* 10 */
  1883. /***/ (function(module, exports, __webpack_require__) {
  1884. "use strict";
  1885. Object.defineProperty(exports, "__esModule", { value: true });
  1886. var ModelChange_1 = __webpack_require__(48);
  1887. var Event_1 = __webpack_require__(14);
  1888. var Evt_1 = __webpack_require__(49);
  1889. var Utils_1 = __webpack_require__(0);
  1890. var Base_1 = __webpack_require__(19);
  1891. var UnitConverter_1 = __webpack_require__(13);
  1892. var KeyCode_1 = __webpack_require__(16);
  1893. var Browser_1 = __webpack_require__(20);
  1894. var Shape_1 = __webpack_require__(9);
  1895. var Connector_1 = __webpack_require__(5);
  1896. var Utils_2 = __webpack_require__(26);
  1897. var TouchUIHelper_1 = __webpack_require__(70);
  1898. exports.svgNS = "http://www.w3.org/2000/svg";
  1899. var RenderManager = /** @class */ (function () {
  1900. function RenderManager(parent, eventManager) {
  1901. this.scrollYVisible = false;
  1902. this.scrollXVisible = false;
  1903. this.scrollTimer = -1;
  1904. this.allowChangeScrolling = false;
  1905. this.zoomLevel = 1;
  1906. this.moveLocked = false;
  1907. this.focusLocked = false;
  1908. this.focused = false;
  1909. this.eventManager = eventManager;
  1910. this.createElements(parent);
  1911. window.addEventListener("resize", this.onWindowResize.bind(this));
  1912. }
  1913. RenderManager.prototype.createElements = function (parent) {
  1914. if (this.mainElement)
  1915. return;
  1916. var element = document.createElement("DIV");
  1917. element.setAttribute("class", "dxdi-control");
  1918. element.addEventListener(TouchUIHelper_1.TouchUIHelper.touchMouseDownEventName, this.onMouseDown.bind(this));
  1919. document.addEventListener(TouchUIHelper_1.TouchUIHelper.touchMouseMoveEventName, this.onMouseMove.bind(this));
  1920. element.addEventListener(TouchUIHelper_1.TouchUIHelper.touchMouseUpEventName, this.onMouseUp.bind(this));
  1921. element.addEventListener("mouseenter", this.onMouseEnter.bind(this));
  1922. element.addEventListener("mouseleave", this.onMouseLeave.bind(this));
  1923. element.addEventListener("dblclick", this.onDblClick.bind(this));
  1924. document.addEventListener("paste", this.onPaste.bind(this));
  1925. parent.appendChild(element);
  1926. this.mainElement = element;
  1927. element = document.createElement("DIV");
  1928. element.setAttribute("class", "dxdi-canvas-container");
  1929. this.mainElement.appendChild(element);
  1930. this.containerElement = element;
  1931. var svgElement = RenderManager.createSvgElement();
  1932. this.containerElement.appendChild(svgElement);
  1933. this.svgElement = svgElement;
  1934. this.updateMainElementSize();
  1935. this.createInputElement(this.mainElement);
  1936. this.createClipboardInputElement(this.mainElement);
  1937. this.setInputElementFocusHandlerMode();
  1938. };
  1939. RenderManager.createSvgElement = function (forExport) {
  1940. if (forExport === void 0) { forExport = false; }
  1941. var svgElement = document.createElementNS(exports.svgNS, "svg");
  1942. svgElement.className.baseVal = "dxdi-canvas" + (forExport ? " export" : "");
  1943. return svgElement;
  1944. };
  1945. RenderManager.prototype.createInputElement = function (parent) {
  1946. this.inputElementContainer = document.createElement("div");
  1947. parent.appendChild(this.inputElementContainer);
  1948. this.inputElement = document.createElement("div");
  1949. this.inputElement.setAttribute("contenteditable", "true");
  1950. this.inputElementContainer.appendChild(this.inputElement);
  1951. this.inputElement.addEventListener("blur", this.onInputBlur.bind(this));
  1952. this.inputElement.addEventListener("focus", this.onInputFocus.bind(this));
  1953. this.inputElement.addEventListener("keydown", this.onKeyDown.bind(this));
  1954. };
  1955. RenderManager.prototype.createClipboardInputElement = function (parent) {
  1956. this.clipboardInputElement = document.createElement("textarea");
  1957. this.clipboardInputElement.setAttribute("class", "dxdi-clipboard-input");
  1958. parent.appendChild(this.clipboardInputElement);
  1959. };
  1960. RenderManager.prototype.setInputElementFocusHandlerMode = function () {
  1961. this.inputElementContainer.setAttribute("class", "dxdi-input focus");
  1962. };
  1963. RenderManager.prototype.setInputElementTextInputMode = function (text, position, size, style, className) {
  1964. this.inputElementContainer.setAttribute("class", "dxdi-input " + className);
  1965. this.inputElement.innerText = text;
  1966. this.setTextInputElementBounds(position, size);
  1967. this.setTextInputElementStyle(style);
  1968. this.captureFocus(true);
  1969. };
  1970. RenderManager.prototype.setTextInputElementBounds = function (position, size) {
  1971. var left = Base_1.GetAbsolutePositionX(this.svgElement) + (UnitConverter_1.UnitConverter.twipsToPixels(position.x) * this.zoomLevel);
  1972. Base_1.SetAbsoluteX(this.inputElementContainer, left);
  1973. var top = Base_1.GetAbsolutePositionY(this.svgElement) + (UnitConverter_1.UnitConverter.twipsToPixels(position.y) * this.zoomLevel);
  1974. Base_1.SetAbsoluteY(this.inputElementContainer, top);
  1975. this.inputElementContainer.style.width = (size !== undefined) ? UnitConverter_1.UnitConverter.twipsToPixels(size.width) + "px" : "0px";
  1976. this.inputElementContainer.style.height = (size !== undefined) ? UnitConverter_1.UnitConverter.twipsToPixels(size.height) + "px" : "0px";
  1977. this.inputElementContainer.style.transform = "scale(" + this.zoomLevel + ")";
  1978. this.inputElement.style.width = (size !== undefined) ? UnitConverter_1.UnitConverter.twipsToPixels(size.width) + "px" : "";
  1979. this.inputElement.style.height = (size !== undefined) ? UnitConverter_1.UnitConverter.twipsToPixels(size.height) + "px" : "auto";
  1980. };
  1981. RenderManager.prototype.setTextInputElementStyle = function (style) {
  1982. Utils_2.RenderUtils.applyStyleToElement(style, this.inputElement);
  1983. };
  1984. RenderManager.prototype.applyPageChange = function (change) {
  1985. var zoomChange = this.zoomLevel !== change.model.zoomLevel;
  1986. this.zoomLevel = change.model.zoomLevel;
  1987. this.updateSvgElementSize(change.model.size);
  1988. this.initializeSvgPositionProperties(change.type === ModelChange_1.PageChangeType.Create || zoomChange);
  1989. if (change.offset !== undefined)
  1990. this.changeSvgPositionProperties(change.offset);
  1991. this.updateSvgElementPosition();
  1992. this.normalizeSvgElementPosition();
  1993. };
  1994. RenderManager.prototype.setClipboardData = function (data) {
  1995. this.clipboardInputElement.value = data;
  1996. this.clipboardInputElement.focus();
  1997. this.clipboardInputElement.select();
  1998. document.execCommand('copy');
  1999. this.captureFocus();
  2000. };
  2001. RenderManager.prototype.getClipboardData = function (callback) {
  2002. var _this = this;
  2003. if (navigator && navigator["clipboard"]) {
  2004. navigator["clipboard"].readText().then(function (clipText) {
  2005. callback(clipText);
  2006. _this.captureFocus();
  2007. }).catch(function () {
  2008. callback("");
  2009. _this.captureFocus();
  2010. });
  2011. }
  2012. else {
  2013. this.clipboardInputElement.value = "";
  2014. this.clipboardInputElement.focus();
  2015. this.clipboardInputElement.select();
  2016. document.execCommand('Paste');
  2017. callback(this.clipboardInputElement.value);
  2018. this.captureFocus();
  2019. }
  2020. };
  2021. RenderManager.prototype.initializeSvgPositionProperties = function (recreate) {
  2022. var svgWidth = parseInt(this.svgElement.style.width);
  2023. var svgHeight = parseInt(this.svgElement.style.height);
  2024. if (recreate || this.svgPositionProperties === undefined) {
  2025. var paddingLeft = Math.max((this.mainElement.clientWidth - svgWidth) / 2, RenderManager.minPadding);
  2026. var paddingTop = Math.max((this.mainElement.clientHeight - svgHeight) / 2, RenderManager.minPadding);
  2027. this.svgPositionProperties = {
  2028. width: svgWidth,
  2029. height: svgHeight,
  2030. containerPaddingLeft: paddingLeft,
  2031. containerPaddingTop: paddingTop,
  2032. containerPaddingRight: paddingLeft,
  2033. containerPaddingBottom: paddingTop,
  2034. containerScrollLeft: this.mainElement.scrollLeft,
  2035. containerScrollTop: this.mainElement.scrollTop
  2036. };
  2037. }
  2038. else {
  2039. this.svgPositionProperties.width = svgWidth;
  2040. this.svgPositionProperties.height = svgHeight;
  2041. this.svgPositionProperties.containerScrollLeft = this.mainElement.scrollLeft;
  2042. this.svgPositionProperties.containerScrollTop = this.mainElement.scrollTop;
  2043. }
  2044. };
  2045. RenderManager.prototype.changeSvgPositionProperties = function (offset) {
  2046. var leftChange = UnitConverter_1.UnitConverter.twipsToPixels(offset.left) * this.zoomLevel;
  2047. if (leftChange < 0) {
  2048. if (this.svgPositionProperties.containerScrollLeft > -leftChange)
  2049. this.svgPositionProperties.containerScrollLeft += leftChange;
  2050. else
  2051. this.svgPositionProperties.containerPaddingLeft -= leftChange;
  2052. }
  2053. else if (leftChange > 0) {
  2054. this.svgPositionProperties.containerScrollLeft += leftChange;
  2055. }
  2056. var rightChange = UnitConverter_1.UnitConverter.twipsToPixels(offset.right) * this.zoomLevel;
  2057. if (rightChange < 0) {
  2058. this.svgPositionProperties.containerPaddingRight -= rightChange;
  2059. if (this.svgPositionProperties.containerScrollLeft > this.svgPositionProperties.containerPaddingRight) {
  2060. }
  2061. }
  2062. else if (rightChange > 0) {
  2063. this.svgPositionProperties.containerPaddingRight = this.svgPositionProperties.containerPaddingLeft;
  2064. if (this.svgPositionProperties.containerScrollLeft > this.svgPositionProperties.containerPaddingLeft) {
  2065. this.svgPositionProperties.containerScrollLeft -= this.svgPositionProperties.containerPaddingLeft - RenderManager.minPadding;
  2066. this.svgPositionProperties.containerPaddingLeft = RenderManager.minPadding;
  2067. }
  2068. }
  2069. var topChange = UnitConverter_1.UnitConverter.twipsToPixels(offset.top) * this.zoomLevel;
  2070. if (offset.top < 0) {
  2071. if (this.svgPositionProperties.containerScrollTop > -topChange)
  2072. this.svgPositionProperties.containerScrollTop += topChange;
  2073. else
  2074. this.svgPositionProperties.containerPaddingTop -= topChange;
  2075. }
  2076. if (topChange > 0) {
  2077. this.svgPositionProperties.containerScrollTop += topChange;
  2078. }
  2079. var bottomChange = UnitConverter_1.UnitConverter.twipsToPixels(offset.bottom) * this.zoomLevel;
  2080. if (bottomChange < 0) {
  2081. this.svgPositionProperties.containerPaddingBottom -= bottomChange;
  2082. }
  2083. else if (bottomChange > 0) {
  2084. this.svgPositionProperties.containerPaddingBottom = this.svgPositionProperties.containerPaddingTop;
  2085. if (this.svgPositionProperties.containerScrollTop > this.svgPositionProperties.containerPaddingTop) {
  2086. this.svgPositionProperties.containerScrollTop -= this.svgPositionProperties.containerPaddingTop - RenderManager.minPadding;
  2087. this.svgPositionProperties.containerPaddingTop = RenderManager.minPadding;
  2088. }
  2089. }
  2090. };
  2091. RenderManager.prototype.updateMainElementSize = function () {
  2092. var parentElement = this.mainElement.parentNode;
  2093. this.mainElement.style.width = "0px";
  2094. this.mainElement.style.width = parentElement.offsetWidth + "px";
  2095. this.mainElement.style.height = "0px";
  2096. this.mainElement.style.height = parentElement.offsetHeight + "px";
  2097. };
  2098. RenderManager.prototype.updateSvgElementSize = function (modelSize) {
  2099. var width = UnitConverter_1.UnitConverter.twipsToPixels(modelSize.width) * this.zoomLevel;
  2100. var height = UnitConverter_1.UnitConverter.twipsToPixels(modelSize.height) * this.zoomLevel;
  2101. Utils_2.RenderUtils.updateSvgElementSize(this.svgElement, width, height);
  2102. };
  2103. RenderManager.prototype.getSvgContainerWidth = function () {
  2104. return this.svgPositionProperties.width +
  2105. this.svgPositionProperties.containerPaddingLeft +
  2106. this.svgPositionProperties.containerPaddingRight;
  2107. };
  2108. RenderManager.prototype.getSvgContainerHeight = function () {
  2109. return this.svgPositionProperties.height +
  2110. this.svgPositionProperties.containerPaddingTop +
  2111. this.svgPositionProperties.containerPaddingBottom;
  2112. };
  2113. RenderManager.prototype.updateSvgElementPosition = function () {
  2114. this.containerElement.style.paddingLeft = this.svgPositionProperties.containerPaddingLeft + "px";
  2115. this.containerElement.style.paddingRight = this.svgPositionProperties.containerPaddingRight + "px";
  2116. this.containerElement.style.paddingTop = this.svgPositionProperties.containerPaddingTop + "px";
  2117. this.containerElement.style.paddingBottom = this.svgPositionProperties.containerPaddingBottom + "px";
  2118. this.containerElement.style.width = this.getSvgContainerWidth() + "px";
  2119. this.containerElement.style.height = this.getSvgContainerHeight() + "px";
  2120. this.mainElement.scrollLeft = this.svgPositionProperties.containerScrollLeft;
  2121. this.mainElement.scrollTop = this.svgPositionProperties.containerScrollTop;
  2122. };
  2123. RenderManager.prototype.normalizeSvgElementPosition = function () {
  2124. var xCorr = this.mainElement.scrollWidth - this.mainElement.offsetWidth - this.mainElement.scrollLeft;
  2125. if (xCorr > 0) {
  2126. var padding = this.svgPositionProperties.containerPaddingRight - xCorr;
  2127. this.svgPositionProperties.containerPaddingRight = Math.max(padding, RenderManager.minPadding);
  2128. this.containerElement.style.paddingRight = this.svgPositionProperties.containerPaddingRight + "px";
  2129. this.containerElement.style.width = this.getSvgContainerWidth() + "px";
  2130. }
  2131. var yCorr = this.mainElement.scrollHeight - this.mainElement.offsetHeight - this.mainElement.scrollTop;
  2132. if (yCorr > 0) {
  2133. var padding = this.svgPositionProperties.containerPaddingBottom - yCorr;
  2134. this.svgPositionProperties.containerPaddingBottom = Math.max(padding, RenderManager.minPadding);
  2135. this.containerElement.style.paddingBottom = this.svgPositionProperties.containerPaddingBottom + "px";
  2136. this.containerElement.style.height = this.getSvgContainerHeight() + "px";
  2137. }
  2138. };
  2139. RenderManager.prototype.changeScrollPosition = function (evt, raiseMouseMove) {
  2140. var x = evt.pageX - Base_1.GetAbsolutePositionX(this.mainElement);
  2141. var y = evt.pageY - Base_1.GetAbsolutePositionY(this.mainElement);
  2142. var width = this.mainElement.offsetWidth;
  2143. if (this.mainElement.offsetWidth < this.mainElement.scrollWidth)
  2144. width -= RenderManager.scrollBarWidth;
  2145. var height = this.mainElement.offsetHeight;
  2146. if (this.mainElement.offsetHeight < this.mainElement.scrollHeight)
  2147. height -= RenderManager.scrollBarWidth;
  2148. var changed = false;
  2149. if (x <= RenderManager.scrollEdge) {
  2150. this.mainElement.scrollLeft -= this.getScrollingOffset(x);
  2151. changed = true;
  2152. }
  2153. else if (width - RenderManager.scrollEdge <= x) {
  2154. this.mainElement.scrollLeft += this.getScrollingOffset(width - x);
  2155. changed = true;
  2156. }
  2157. if (y <= RenderManager.scrollEdge) {
  2158. this.mainElement.scrollTop -= this.getScrollingOffset(y);
  2159. changed = true;
  2160. }
  2161. else if (height - RenderManager.scrollEdge <= y) {
  2162. this.mainElement.scrollTop += this.getScrollingOffset(height - y);
  2163. changed = true;
  2164. }
  2165. if (changed) {
  2166. this.scrollTimer = window.setTimeout(function () { this.changeScrollPosition(evt, true); }.bind(this), RenderManager.scrollDelay);
  2167. }
  2168. if (raiseMouseMove)
  2169. this.onMouseMoveCore(evt);
  2170. };
  2171. RenderManager.prototype.clearScrollTimer = function () {
  2172. if (this.scrollTimer > -1) {
  2173. window.clearTimeout(this.scrollTimer);
  2174. this.scrollTimer = -1;
  2175. }
  2176. };
  2177. RenderManager.prototype.getScrollingOffset = function (edgeOffset) {
  2178. var offset = Math.pow((RenderManager.scrollEdge - edgeOffset) / RenderManager.scrollRatio, 2);
  2179. return Math.min(offset, RenderManager.scrollMaxOffset);
  2180. };
  2181. RenderManager.prototype.captureFocus = function (selectAll) {
  2182. if (selectAll === void 0) { selectAll = false; }
  2183. this.inputElement.focus();
  2184. if (selectAll) {
  2185. var element = this.inputElement;
  2186. window.setTimeout(function () {
  2187. var selection = window.getSelection();
  2188. var range = document.createRange();
  2189. range.selectNodeContents(element);
  2190. selection.removeAllRanges();
  2191. selection.addRange(range);
  2192. }, 100);
  2193. }
  2194. };
  2195. RenderManager.prototype.updateLayout = function () {
  2196. this.updateMainElementSize();
  2197. this.initializeSvgPositionProperties(true);
  2198. this.updateSvgElementPosition();
  2199. };
  2200. RenderManager.prototype.isFocused = function () {
  2201. return this.focused;
  2202. };
  2203. // Notifications
  2204. RenderManager.prototype.NotifyTextInputStart = function (item, text, position, size) {
  2205. var className = "";
  2206. if (item instanceof Shape_1.Shape)
  2207. className = "shape-text";
  2208. else if (item instanceof Connector_1.Connector)
  2209. className = "connector-text";
  2210. this.setInputElementTextInputMode(text, position, size, item.styleText, className);
  2211. };
  2212. RenderManager.prototype.NotifyTextInputEnd = function (item) {
  2213. this.setInputElementFocusHandlerMode();
  2214. };
  2215. RenderManager.prototype.NotifyModelChanged = function (changes) {
  2216. for (var i = 0, change = void 0; change = changes[i]; i++) {
  2217. if (change instanceof ModelChange_1.PageChange)
  2218. this.applyPageChange(change);
  2219. }
  2220. };
  2221. // Window handlers
  2222. RenderManager.prototype.onWindowResize = function (evt) {
  2223. this.updateLayout();
  2224. };
  2225. // Mouse handlers
  2226. RenderManager.prototype.onMouseDown = function (evt) {
  2227. var _this = this;
  2228. this.lockMouseMove();
  2229. this.lockFocus();
  2230. this.allowChangeScrolling = true;
  2231. this.raiseEvent(evt, this.getDiagramMouseEvent(evt), function (e) { return _this.eventManager.onMouseDown(e); });
  2232. this.captureFocus();
  2233. };
  2234. RenderManager.prototype.onMouseMove = function (evt) {
  2235. if (this.moveLocked)
  2236. return;
  2237. this.clearScrollTimer();
  2238. if (!Evt_1.Evt.IsLeftButtonPressed(evt))
  2239. this.allowChangeScrolling = false;
  2240. if (this.allowChangeScrolling)
  2241. this.changeScrollPosition(evt, false);
  2242. this.onMouseMoveCore(evt);
  2243. };
  2244. RenderManager.prototype.onMouseMoveCore = function (evt) {
  2245. var _this = this;
  2246. this.raiseEvent(evt, this.getDiagramMouseEvent(evt), function (e) { return _this.eventManager.onMouseMove(e); });
  2247. };
  2248. RenderManager.prototype.onMouseUp = function (evt) {
  2249. var _this = this;
  2250. this.lockMouseMove();
  2251. this.clearScrollTimer();
  2252. this.raiseEvent(evt, this.getDiagramMouseEvent(evt), function (e) { return _this.eventManager.onMouseUp(e); });
  2253. this.allowChangeScrolling = false;
  2254. this.captureFocus();
  2255. };
  2256. RenderManager.prototype.onMouseEnter = function (evt) {
  2257. var _this = this;
  2258. if (Evt_1.Evt.IsLeftButtonPressed(evt)) {
  2259. setTimeout(function () {
  2260. _this.allowChangeScrolling = true;
  2261. }, 500);
  2262. }
  2263. this.raiseEvent(evt, this.getDiagramEvent(evt), function (e) { return _this.eventManager.onMouseEnter(e); });
  2264. };
  2265. RenderManager.prototype.onMouseLeave = function (evt) {
  2266. var _this = this;
  2267. this.raiseEvent(evt, this.getDiagramEvent(evt), function (e) { return _this.eventManager.onMouseLeave(e); });
  2268. };
  2269. RenderManager.prototype.onDblClick = function (evt) {
  2270. var _this = this;
  2271. this.raiseEvent(evt, this.getDiagramMouseEvent(evt), function (e) { return _this.eventManager.onDblClick(e); });
  2272. };
  2273. RenderManager.prototype.onKeyDown = function (evt) {
  2274. var _this = this;
  2275. this.raiseEvent(evt, this.getDiagramKeyboardEvent(evt), function (e) { return _this.eventManager.onKeyDown(e); });
  2276. };
  2277. RenderManager.prototype.onInputBlur = function (evt) {
  2278. var _this = this;
  2279. if (!this.focusLocked) {
  2280. this.focused = false;
  2281. Base_1.RemoveClassNameFromElement(this.mainElement, "focused");
  2282. }
  2283. this.raiseEvent(evt, this.getDiagramInputEvent(evt), function (e) { return _this.eventManager.onInputBlur(e); });
  2284. };
  2285. RenderManager.prototype.onInputFocus = function (evt) {
  2286. var _this = this;
  2287. this.focused = true;
  2288. this.focusLocked = false;
  2289. Base_1.AddClassNameToElement(this.mainElement, "focused");
  2290. this.raiseEvent(evt, this.getDiagramEvent(evt), function (e) { return _this.eventManager.onInputFocus(e); });
  2291. };
  2292. RenderManager.prototype.onPaste = function (evt) {
  2293. var _this = this;
  2294. this.raiseEvent(evt, this.getDiagramClipboardEvent(evt), function (e) { return _this.eventManager.onPaste(e); });
  2295. };
  2296. RenderManager.prototype.raiseEvent = function (evt, _evt, raiseFunc) {
  2297. raiseFunc(_evt);
  2298. if (_evt.preventDefault)
  2299. evt.preventDefault();
  2300. };
  2301. RenderManager.prototype.getDiagramEvent = function (evt) {
  2302. return new Event_1.DiagramEvent(this.getKeyModifiers(evt));
  2303. };
  2304. RenderManager.prototype.getDiagramInputEvent = function (evt) {
  2305. return new Event_1.DiagramInputEvent(this.getKeyModifiers(evt), evt.srcElement.innerText);
  2306. };
  2307. RenderManager.prototype.getDiagramMouseEvent = function (evt) {
  2308. var modifiers = this.getKeyModifiers(evt);
  2309. var button = this.isLeftButtonPressed(evt) ? Event_1.MouseButton.Left : Event_1.MouseButton.Right;
  2310. return new Event_1.DiagramMouseEvent(modifiers, button, this.getLayoutPoint(evt, true), this.getEventSource(evt));
  2311. };
  2312. RenderManager.prototype.getDiagramKeyboardEvent = function (evt) {
  2313. return new Event_1.DiagramKeyboardEvent(this.getKeyModifiers(evt), Evt_1.Evt.GetKeyCode(evt), evt.srcElement.innerText); // TODO: check it
  2314. };
  2315. RenderManager.prototype.getDiagramClipboardEvent = function (evt) {
  2316. var clipboardData;
  2317. if (evt.clipboardData !== undefined)
  2318. clipboardData = evt.clipboardData.getData('text/plain');
  2319. else
  2320. clipboardData = window["clipboardData"].getData('Text');
  2321. return new Event_1.DiagramClipboardEvent(this.getKeyModifiers(evt), clipboardData);
  2322. };
  2323. RenderManager.prototype.isLeftButtonPressed = function (evt) {
  2324. return !Browser_1.Browser.MSTouchUI ? Evt_1.Evt.IsLeftButtonPressed(evt) : evt.button != 2;
  2325. };
  2326. RenderManager.prototype.getKeyModifiers = function (evt) {
  2327. var result = 0;
  2328. if (evt.altKey)
  2329. result |= KeyCode_1.ModifierKey.Alt;
  2330. if (evt.ctrlKey)
  2331. result |= KeyCode_1.ModifierKey.Ctrl;
  2332. if (evt.shiftKey)
  2333. result |= KeyCode_1.ModifierKey.Shift;
  2334. if (evt.metaKey)
  2335. result |= KeyCode_1.ModifierKey.Meta;
  2336. return result;
  2337. };
  2338. RenderManager.prototype.getEventSource = function (evt) {
  2339. var element = evt.srcElement;
  2340. while (element && !this.isDocumentContainer(element)) {
  2341. var src_1 = Utils_2.RenderUtils.getElementEventData(element);
  2342. if (src_1 !== undefined)
  2343. return src_1;
  2344. element = element.parentNode;
  2345. }
  2346. var src = new Event_1.MouseEventSource();
  2347. if (element && this.isDocumentContainer(element))
  2348. src.type = Event_1.MouseEventElementType.Document;
  2349. return src;
  2350. };
  2351. RenderManager.prototype.isDocumentContainer = function (element) {
  2352. return Base_1.ElementHasCssClass(element, "dxdi-control") || Base_1.ElementHasCssClass(element, "dxdi-canvas");
  2353. };
  2354. RenderManager.prototype.lockMouseMove = function () {
  2355. var _this = this;
  2356. this.moveLocked = true;
  2357. setTimeout(function () { return _this.moveLocked = false; }, 10); // because chrome raises 2 events on click: buttonDown and move.
  2358. };
  2359. RenderManager.prototype.lockFocus = function () {
  2360. var _this = this;
  2361. this.focusLocked = true;
  2362. setTimeout(function () { return _this.focusLocked = false; }, 10);
  2363. };
  2364. RenderManager.prototype.getLayoutPoint = function (evt, checkScroll) {
  2365. var clientX = Evt_1.Evt.GetEventX(evt);
  2366. var clientY = Evt_1.Evt.GetEventY(evt);
  2367. var canvasX = Base_1.GetAbsolutePositionX(this.svgElement);
  2368. var canvasY = Base_1.GetAbsolutePositionY(this.svgElement);
  2369. if (checkScroll) {
  2370. if (this.scrollYVisible && canvasX + this.mainElement.offsetWidth - clientX < 0)
  2371. return Utils_1.Point.empty();
  2372. if (this.scrollXVisible && canvasY + this.mainElement.offsetHeight - clientY < 0)
  2373. return Utils_1.Point.empty();
  2374. }
  2375. return new Utils_1.Point(UnitConverter_1.UnitConverter.pixelsToTwipsF(clientX - canvasX) / this.zoomLevel, UnitConverter_1.UnitConverter.pixelsToTwipsF(clientY - canvasY) / this.zoomLevel);
  2376. };
  2377. RenderManager.minPadding = 8;
  2378. RenderManager.scrollEdge = 40;
  2379. RenderManager.scrollRatio = 5;
  2380. RenderManager.scrollMaxOffset = 60;
  2381. RenderManager.scrollDelay = 100;
  2382. RenderManager.scrollBarWidth = 16;
  2383. return RenderManager;
  2384. }());
  2385. exports.RenderManager = RenderManager;
  2386. /***/ }),
  2387. /* 11 */
  2388. /***/ (function(module, exports, __webpack_require__) {
  2389. "use strict";
  2390. Object.defineProperty(exports, "__esModule", { value: true });
  2391. var Utils_1 = __webpack_require__(0);
  2392. var TextPrimitive_1 = __webpack_require__(50);
  2393. var ClipPathPrimitive_1 = __webpack_require__(52);
  2394. var RectaglePrimitive_1 = __webpack_require__(53);
  2395. var DiagramItem_1 = __webpack_require__(3);
  2396. var UnitConverter_1 = __webpack_require__(13);
  2397. var Utils_2 = __webpack_require__(26);
  2398. var ConnectionPoint_1 = __webpack_require__(32);
  2399. exports.ShapeDefaultDimension = 1440;
  2400. exports.ShapeDefaultSize = new Utils_1.Size(exports.ShapeDefaultDimension, exports.ShapeDefaultDimension);
  2401. var ShapeDescription = /** @class */ (function () {
  2402. function ShapeDescription(title, defualtText, defaultSize) {
  2403. if (defaultSize === void 0) { defaultSize = exports.ShapeDefaultSize.clone(); }
  2404. this.title = title;
  2405. this.defualtText = defualtText;
  2406. this.defaultSize = defaultSize;
  2407. this.connectionPoints = this.createConnectionPoints();
  2408. this.connectionPointsWhileSelected = this.createConnectionPointsForSelection();
  2409. }
  2410. Object.defineProperty(ShapeDescription.prototype, "allowHasText", {
  2411. get: function () { return true; },
  2412. enumerable: true,
  2413. configurable: true
  2414. });
  2415. ShapeDescription.prototype.getConnectionPoints = function () {
  2416. return this.connectionPoints;
  2417. };
  2418. ShapeDescription.prototype.createConnectionPoints = function () {
  2419. return [
  2420. new ConnectionPoint_1.ConnectionPoint(0.5, 0, DiagramItem_1.ConnectionPointSide.North),
  2421. new ConnectionPoint_1.ConnectionPoint(1, 0.5, DiagramItem_1.ConnectionPointSide.East),
  2422. new ConnectionPoint_1.ConnectionPoint(0.5, 1, DiagramItem_1.ConnectionPointSide.South),
  2423. new ConnectionPoint_1.ConnectionPoint(0, 0.5, DiagramItem_1.ConnectionPointSide.West)
  2424. ];
  2425. };
  2426. ShapeDescription.prototype.getConnectionPointsForSelection = function () {
  2427. return this.connectionPointsWhileSelected;
  2428. };
  2429. ShapeDescription.prototype.createConnectionPointsForSelection = function () {
  2430. return [
  2431. new ConnectionPoint_1.ConnectionPoint(0.5, 0, DiagramItem_1.ConnectionPointSide.North),
  2432. new ConnectionPoint_1.ConnectionPoint(1, 0.5, DiagramItem_1.ConnectionPointSide.East),
  2433. new ConnectionPoint_1.ConnectionPoint(0.5, 1, DiagramItem_1.ConnectionPointSide.South),
  2434. new ConnectionPoint_1.ConnectionPoint(0, 0.5, DiagramItem_1.ConnectionPointSide.West)
  2435. ];
  2436. };
  2437. ShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  2438. };
  2439. ShapeDescription.prototype.createParameters = function (parameters) {
  2440. };
  2441. ShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
  2442. };
  2443. ShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
  2444. throw Error("Not implemented");
  2445. };
  2446. ShapeDescription.prototype.changeParameterValue = function (parameters, key, change) {
  2447. var p = parameters.get(key);
  2448. p.value = change(p);
  2449. };
  2450. ShapeDescription.prototype.getParameterPoints = function (shape) {
  2451. return [];
  2452. };
  2453. ShapeDescription.prototype.createTextPrimitives = function (shape, preventClipping) {
  2454. if (!this.allowHasText || shape.text === undefined || shape.text === "")
  2455. return [];
  2456. var rect = this.getTextRectangle(shape.rectangle);
  2457. var clipPathId = !preventClipping && Utils_2.RenderUtils.generateSvgElementId("clipText");
  2458. var textPoint = this.getTextPosition(rect, shape.styleText["text-anchor"]);
  2459. return [
  2460. new TextPrimitive_1.TextPrimitive(textPoint.x, textPoint.y, shape.text, rect.width, shape.styleText, false, clipPathId),
  2461. new ClipPathPrimitive_1.ClipPathPrimitive(clipPathId, [new RectaglePrimitive_1.RectanglePrimitive(rect.left, rect.top, rect.width, rect.height)]),
  2462. ];
  2463. };
  2464. ShapeDescription.prototype.getTextRectangle = function (rect) {
  2465. return rect;
  2466. };
  2467. ShapeDescription.prototype.createSelectorPrimitives = function (shape) {
  2468. return [
  2469. new RectaglePrimitive_1.RectanglePrimitive(shape.position.x, shape.position.y, shape.size.width, shape.size.height, null, "selector")
  2470. ];
  2471. };
  2472. ShapeDescription.prototype.getTextPosition = function (rect, textAnchor) {
  2473. var result = new Utils_1.Point(rect.left, rect.top + rect.height / 2);
  2474. if (!textAnchor || textAnchor === "middle")
  2475. result.x = rect.left + rect.width / 2;
  2476. else if (textAnchor === "end")
  2477. result.x = rect.left + rect.width - ShapeDescription.textSpacing;
  2478. else if (textAnchor === "start")
  2479. result.x = rect.left + ShapeDescription.textSpacing;
  2480. return result;
  2481. };
  2482. ShapeDescription.textSpacing = UnitConverter_1.UnitConverter.pixelsToTwips(2);
  2483. return ShapeDescription;
  2484. }());
  2485. exports.ShapeDescription = ShapeDescription;
  2486. /***/ }),
  2487. /* 12 */
  2488. /***/ (function(module, exports, __webpack_require__) {
  2489. "use strict";
  2490. var __extends = (this && this.__extends) || (function () {
  2491. var extendStatics = function (d, b) {
  2492. extendStatics = Object.setPrototypeOf ||
  2493. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  2494. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  2495. return extendStatics(d, b);
  2496. };
  2497. return function (d, b) {
  2498. extendStatics(d, b);
  2499. function __() { this.constructor = d; }
  2500. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2501. };
  2502. })();
  2503. Object.defineProperty(exports, "__esModule", { value: true });
  2504. var ShapeDescription_1 = __webpack_require__(11);
  2505. var Utils_1 = __webpack_require__(0);
  2506. var RectaglePrimitive_1 = __webpack_require__(53);
  2507. var ShapeType_1 = __webpack_require__(1);
  2508. var RectangleShapeDescription = /** @class */ (function (_super) {
  2509. __extends(RectangleShapeDescription, _super);
  2510. function RectangleShapeDescription(title, defaultText, defaultSize) {
  2511. if (title === void 0) { title = "Rectangle"; }
  2512. if (defaultText === void 0) { defaultText = ""; }
  2513. if (defaultSize === void 0) { defaultSize = new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.75); }
  2514. return _super.call(this, title, defaultText, defaultSize) || this;
  2515. }
  2516. Object.defineProperty(RectangleShapeDescription.prototype, "key", {
  2517. get: function () { return ShapeType_1.ShapeType.Rectangle; },
  2518. enumerable: true,
  2519. configurable: true
  2520. });
  2521. Object.defineProperty(RectangleShapeDescription.prototype, "category", {
  2522. get: function () { return ShapeType_1.ShapeCategory.General; },
  2523. enumerable: true,
  2524. configurable: true
  2525. });
  2526. RectangleShapeDescription.prototype.createPrimitives = function (shape) {
  2527. var _a = shape.rectangle, left = _a.left, top = _a.top, width = _a.width, height = _a.height;
  2528. var primitives = [];
  2529. return primitives.concat([
  2530. new RectaglePrimitive_1.RectanglePrimitive(left, top, width, height, shape.style),
  2531. ])
  2532. .concat(this.createTextPrimitives(shape));
  2533. };
  2534. return RectangleShapeDescription;
  2535. }(ShapeDescription_1.ShapeDescription));
  2536. exports.RectangleShapeDescription = RectangleShapeDescription;
  2537. /***/ }),
  2538. /* 13 */
  2539. /***/ (function(module, exports, __webpack_require__) {
  2540. "use strict";
  2541. var __extends = (this && this.__extends) || (function () {
  2542. var extendStatics = function (d, b) {
  2543. extendStatics = Object.setPrototypeOf ||
  2544. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  2545. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  2546. return extendStatics(d, b);
  2547. };
  2548. return function (d, b) {
  2549. extendStatics(d, b);
  2550. function __() { this.constructor = d; }
  2551. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2552. };
  2553. })();
  2554. Object.defineProperty(exports, "__esModule", { value: true });
  2555. var RichEditUnit;
  2556. (function (RichEditUnit) {
  2557. RichEditUnit[RichEditUnit["Centimeter"] = 0] = "Centimeter";
  2558. RichEditUnit[RichEditUnit["Inch"] = 1] = "Inch";
  2559. })(RichEditUnit = exports.RichEditUnit || (exports.RichEditUnit = {}));
  2560. var UnitConverter = /** @class */ (function () {
  2561. function UnitConverter() {
  2562. }
  2563. UnitConverter.getConverter = function (unit) {
  2564. switch (unit) {
  2565. case RichEditUnit.Centimeter: return new UIUnitConverterCentimeter();
  2566. case RichEditUnit.Inch: return new UIUnitConverterInch();
  2567. default: throw new Error();
  2568. }
  2569. };
  2570. // LAYOUT - PIXELS
  2571. // MODEL - TWIPS
  2572. // FORMS - CENTIMETERS / INCHES
  2573. // FONT - POINTS
  2574. // BORDER WIDTH ON UI - POINTS
  2575. // TO TWIPS (round and no round version)
  2576. UnitConverter.pixelsToTwips = function (value) {
  2577. return Math.round(UnitConverter.pixelsToTwipsF(value));
  2578. };
  2579. UnitConverter.inchesToTwips = function (value) {
  2580. return Math.round(UnitConverter.inchesToTwipsF(value));
  2581. };
  2582. UnitConverter.pointsToTwips = function (value) {
  2583. return Math.round(UnitConverter.pointsToTwipsF(value));
  2584. };
  2585. UnitConverter.picasToTwips = function (value) {
  2586. return Math.round(value * 1440 / UnitConverter.PICAS_PER_INCH);
  2587. };
  2588. UnitConverter.centimetersToTwips = function (value) {
  2589. return Math.round(UnitConverter.centimetersToTwipsF(value));
  2590. };
  2591. UnitConverter.pixelsToTwipsF = function (value) {
  2592. return value * 1440 / UnitConverter.DPI;
  2593. };
  2594. UnitConverter.inchesToTwipsF = function (value) {
  2595. return value * 1440;
  2596. };
  2597. UnitConverter.pointsToTwipsF = function (value) {
  2598. return value * 20;
  2599. };
  2600. UnitConverter.centimetersToTwipsF = function (value) {
  2601. return value * 1440 / UnitConverter.CENTIMETERS_PER_INCH;
  2602. };
  2603. UnitConverter.modelUnitsToDegrees = function (value) {
  2604. return value / 60000;
  2605. };
  2606. UnitConverter.modelUnitsToRadians = function (value) {
  2607. return value / 60000 * Math.PI / 180;
  2608. };
  2609. UnitConverter.degreesToModelUnits = function (value) {
  2610. return value * 60000;
  2611. };
  2612. UnitConverter.radiansToModelUnits = function (value) {
  2613. return value * 60000 / Math.PI * 180;
  2614. };
  2615. UnitConverter.radiansToDegrees = function (value) {
  2616. return value / Math.PI * 180;
  2617. };
  2618. UnitConverter.fdToModelUnits = function (value) {
  2619. return Math.round(value * 1875 / 2048);
  2620. };
  2621. UnitConverter.emuToTwips = function (val) {
  2622. return val / 635;
  2623. };
  2624. // TO PIXELS (round)
  2625. UnitConverter.twipsToPixels = function (value) {
  2626. return Math.round(UnitConverter.twipsToPixelsF(value));
  2627. };
  2628. UnitConverter.inchesToPixels = function (value) {
  2629. return Math.round(UnitConverter.DPI * value);
  2630. };
  2631. UnitConverter.centimeterToPixel = function (value) {
  2632. return Math.round(value / (UnitConverter.CENTIMETERS_PER_INCH / UnitConverter.DPI));
  2633. };
  2634. UnitConverter.pointsToPixels = function (value) {
  2635. return Math.round(value * UnitConverter.DPI / 72);
  2636. };
  2637. // TO PIXELS (no round)
  2638. UnitConverter.pointsToPixelsF = function (value) {
  2639. return value * UnitConverter.DPI / 72;
  2640. };
  2641. UnitConverter.twipsToPixelsF = function (value) {
  2642. return value * UnitConverter.DPI / 1440;
  2643. };
  2644. // TO POINTS (round)
  2645. UnitConverter.pixelsToPoints = function (value) {
  2646. return Math.round(value * 72 / UnitConverter.DPI);
  2647. };
  2648. UnitConverter.twipsToPoints = function (value) {
  2649. return Math.round(this.twipsToPointsF(value));
  2650. };
  2651. // TO POINTS (no round)
  2652. UnitConverter.twipsToPointsF = function (value) {
  2653. return value / 20;
  2654. };
  2655. // TO INCHES (no round)
  2656. UnitConverter.twipsToInches = function (value) {
  2657. return value / 1440;
  2658. };
  2659. UnitConverter.pixelsToInches = function (value) {
  2660. return value / UnitConverter.DPI;
  2661. };
  2662. // TO CENTIMETERS (no round)
  2663. UnitConverter.twipsToCentimeters = function (value) {
  2664. return value * UnitConverter.CENTIMETERS_PER_INCH / 1440;
  2665. };
  2666. UnitConverter.pixelToCentimeters = function (value) {
  2667. return value * UnitConverter.CENTIMETERS_PER_INCH / UnitConverter.DPI;
  2668. };
  2669. // ANOTHER
  2670. UnitConverter.hundredthsOfMillimeterToModelUnits = function (value) {
  2671. return 15 * value / 127;
  2672. };
  2673. UnitConverter.twipsToEmu = function (val) {
  2674. return val * 635;
  2675. };
  2676. UnitConverter.twipsToDegree = function (value) {
  2677. return value / 60000;
  2678. };
  2679. UnitConverter.DPI = 96;
  2680. UnitConverter.CENTIMETERS_PER_INCH = 2.54;
  2681. UnitConverter.PICAS_PER_INCH = 6;
  2682. return UnitConverter;
  2683. }());
  2684. exports.UnitConverter = UnitConverter;
  2685. var UIUnitConverterCentimeter = /** @class */ (function (_super) {
  2686. __extends(UIUnitConverterCentimeter, _super);
  2687. function UIUnitConverterCentimeter() {
  2688. return _super !== null && _super.apply(this, arguments) || this;
  2689. }
  2690. UIUnitConverterCentimeter.prototype.getUnits = function () {
  2691. return RichEditUnit.Centimeter;
  2692. };
  2693. UIUnitConverterCentimeter.prototype.twipsToUI = function (value) {
  2694. return UnitConverter.twipsToCentimeters(value);
  2695. };
  2696. UIUnitConverterCentimeter.prototype.UIToTwips = function (value) {
  2697. return UnitConverter.centimetersToTwips(value);
  2698. };
  2699. return UIUnitConverterCentimeter;
  2700. }(UnitConverter));
  2701. exports.UIUnitConverterCentimeter = UIUnitConverterCentimeter;
  2702. var UIUnitConverterInch = /** @class */ (function (_super) {
  2703. __extends(UIUnitConverterInch, _super);
  2704. function UIUnitConverterInch() {
  2705. return _super !== null && _super.apply(this, arguments) || this;
  2706. }
  2707. UIUnitConverterInch.prototype.getUnits = function () {
  2708. return RichEditUnit.Inch;
  2709. };
  2710. UIUnitConverterInch.prototype.twipsToUI = function (value) {
  2711. return UnitConverter.twipsToInches(value);
  2712. };
  2713. UIUnitConverterInch.prototype.UIToTwips = function (value) {
  2714. return UnitConverter.inchesToTwips(value);
  2715. };
  2716. return UIUnitConverterInch;
  2717. }(UnitConverter));
  2718. exports.UIUnitConverterInch = UIUnitConverterInch;
  2719. /***/ }),
  2720. /* 14 */
  2721. /***/ (function(module, exports, __webpack_require__) {
  2722. "use strict";
  2723. var __extends = (this && this.__extends) || (function () {
  2724. var extendStatics = function (d, b) {
  2725. extendStatics = Object.setPrototypeOf ||
  2726. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  2727. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  2728. return extendStatics(d, b);
  2729. };
  2730. return function (d, b) {
  2731. extendStatics(d, b);
  2732. function __() { this.constructor = d; }
  2733. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2734. };
  2735. })();
  2736. Object.defineProperty(exports, "__esModule", { value: true });
  2737. var MouseButton;
  2738. (function (MouseButton) {
  2739. MouseButton[MouseButton["None"] = 0] = "None";
  2740. MouseButton[MouseButton["Left"] = 1] = "Left";
  2741. MouseButton[MouseButton["Right"] = 2] = "Right";
  2742. MouseButton[MouseButton["Middle"] = 4] = "Middle";
  2743. })(MouseButton = exports.MouseButton || (exports.MouseButton = {}));
  2744. var MouseEventElementType;
  2745. (function (MouseEventElementType) {
  2746. MouseEventElementType[MouseEventElementType["Undefined"] = 0] = "Undefined";
  2747. MouseEventElementType[MouseEventElementType["Connector"] = 1] = "Connector";
  2748. MouseEventElementType[MouseEventElementType["ConnectorPoint"] = 2] = "ConnectorPoint";
  2749. MouseEventElementType[MouseEventElementType["ConnectorSide"] = 3] = "ConnectorSide";
  2750. MouseEventElementType[MouseEventElementType["ConnectorOrthogonalSide"] = 4] = "ConnectorOrthogonalSide";
  2751. MouseEventElementType[MouseEventElementType["ConnectorText"] = 5] = "ConnectorText";
  2752. MouseEventElementType[MouseEventElementType["Shape"] = 6] = "Shape";
  2753. MouseEventElementType[MouseEventElementType["ShapeResizeBox"] = 7] = "ShapeResizeBox";
  2754. MouseEventElementType[MouseEventElementType["ShapeParameterBox"] = 8] = "ShapeParameterBox";
  2755. MouseEventElementType[MouseEventElementType["SelectionRect"] = 9] = "SelectionRect";
  2756. MouseEventElementType[MouseEventElementType["ShapeConnectionPoint"] = 10] = "ShapeConnectionPoint";
  2757. MouseEventElementType[MouseEventElementType["ShapeConnection"] = 11] = "ShapeConnection";
  2758. MouseEventElementType[MouseEventElementType["Document"] = 12] = "Document";
  2759. })(MouseEventElementType = exports.MouseEventElementType || (exports.MouseEventElementType = {}));
  2760. var MouseEventSource = /** @class */ (function () {
  2761. function MouseEventSource(type, key, value) {
  2762. this.type = type;
  2763. this.key = key;
  2764. this.value = value;
  2765. }
  2766. return MouseEventSource;
  2767. }());
  2768. exports.MouseEventSource = MouseEventSource;
  2769. var ResizeEventSource;
  2770. (function (ResizeEventSource) {
  2771. ResizeEventSource[ResizeEventSource["Undefined"] = 0] = "Undefined";
  2772. ResizeEventSource[ResizeEventSource["ResizeBox_NW"] = 1] = "ResizeBox_NW";
  2773. ResizeEventSource[ResizeEventSource["ResizeBox_NE"] = 2] = "ResizeBox_NE";
  2774. ResizeEventSource[ResizeEventSource["ResizeBox_SE"] = 3] = "ResizeBox_SE";
  2775. ResizeEventSource[ResizeEventSource["ResizeBox_SW"] = 4] = "ResizeBox_SW";
  2776. ResizeEventSource[ResizeEventSource["ResizeBox_N"] = 5] = "ResizeBox_N";
  2777. ResizeEventSource[ResizeEventSource["ResizeBox_E"] = 6] = "ResizeBox_E";
  2778. ResizeEventSource[ResizeEventSource["ResizeBox_S"] = 7] = "ResizeBox_S";
  2779. ResizeEventSource[ResizeEventSource["ResizeBox_W"] = 8] = "ResizeBox_W";
  2780. })(ResizeEventSource = exports.ResizeEventSource || (exports.ResizeEventSource = {}));
  2781. var DiagramEvent = /** @class */ (function () {
  2782. function DiagramEvent(modifiers) {
  2783. this.modifiers = modifiers;
  2784. }
  2785. return DiagramEvent;
  2786. }());
  2787. exports.DiagramEvent = DiagramEvent;
  2788. var DiagramInputEvent = /** @class */ (function (_super) {
  2789. __extends(DiagramInputEvent, _super);
  2790. function DiagramInputEvent(modifiers, inputText) {
  2791. var _this = _super.call(this, modifiers) || this;
  2792. _this.inputText = inputText;
  2793. return _this;
  2794. }
  2795. return DiagramInputEvent;
  2796. }(DiagramEvent));
  2797. exports.DiagramInputEvent = DiagramInputEvent;
  2798. var DiagramMouseEvent = /** @class */ (function (_super) {
  2799. __extends(DiagramMouseEvent, _super);
  2800. function DiagramMouseEvent(modifiers, button, layoutPoint, source) {
  2801. var _this = _super.call(this, modifiers) || this;
  2802. _this.button = button;
  2803. _this.layoutPoint = layoutPoint;
  2804. _this.source = source;
  2805. _this.scrollX = 0;
  2806. _this.scrollY = 0;
  2807. return _this;
  2808. }
  2809. return DiagramMouseEvent;
  2810. }(DiagramEvent));
  2811. exports.DiagramMouseEvent = DiagramMouseEvent;
  2812. var DiagramKeyboardEvent = /** @class */ (function (_super) {
  2813. __extends(DiagramKeyboardEvent, _super);
  2814. function DiagramKeyboardEvent(modifiers, keyCode, inputText) {
  2815. var _this = _super.call(this, modifiers, inputText) || this;
  2816. _this.keyCode = keyCode;
  2817. return _this;
  2818. }
  2819. DiagramKeyboardEvent.prototype.getShortcutCode = function () {
  2820. return this.modifiers | this.keyCode;
  2821. };
  2822. return DiagramKeyboardEvent;
  2823. }(DiagramInputEvent));
  2824. exports.DiagramKeyboardEvent = DiagramKeyboardEvent;
  2825. var DiagramClipboardEvent = /** @class */ (function (_super) {
  2826. __extends(DiagramClipboardEvent, _super);
  2827. function DiagramClipboardEvent(modifiers, clipboardData) {
  2828. var _this = _super.call(this, modifiers) || this;
  2829. _this.clipboardData = clipboardData;
  2830. return _this;
  2831. }
  2832. return DiagramClipboardEvent;
  2833. }(DiagramEvent));
  2834. exports.DiagramClipboardEvent = DiagramClipboardEvent;
  2835. /***/ }),
  2836. /* 15 */
  2837. /***/ (function(module, exports, __webpack_require__) {
  2838. "use strict";
  2839. Object.defineProperty(exports, "__esModule", { value: true });
  2840. var UnitConverter_1 = __webpack_require__(13);
  2841. var Utils_1 = __webpack_require__(26);
  2842. var SvgPrimitive = /** @class */ (function () {
  2843. function SvgPrimitive(style, className, clipPathId, onApplyProperties) {
  2844. this.style = style;
  2845. this.className = className;
  2846. this.clipPathId = clipPathId;
  2847. this.onApplyProperties = onApplyProperties;
  2848. this.children = [];
  2849. }
  2850. SvgPrimitive.prototype.createElement = function () {
  2851. var el = this.createMainElement();
  2852. this.createChildElements(el);
  2853. return el;
  2854. };
  2855. SvgPrimitive.prototype.createChildElements = function (parent) {
  2856. for (var i = 0; i < this.children.length; i++)
  2857. parent.appendChild(this.children[i].createElement());
  2858. };
  2859. SvgPrimitive.prototype.applyElementProperties = function (element) {
  2860. this.applyElementStyleProperties(element);
  2861. if (this.className)
  2862. element.setAttribute("class", this.className);
  2863. if (this.clipPathId)
  2864. element.setAttribute("clip-path", "url(#" + this.clipPathId + ")");
  2865. if (this.onApplyProperties)
  2866. this.onApplyProperties(element);
  2867. this.applyChildrenProperties(element);
  2868. };
  2869. SvgPrimitive.prototype.applyChildrenProperties = function (element) {
  2870. for (var i = 0; i < this.children.length; i++)
  2871. this.children[i].applyElementProperties(element.childNodes[i]);
  2872. };
  2873. SvgPrimitive.prototype.applyElementStyleProperties = function (element) {
  2874. this.applyElementStylePropertiesCore(element);
  2875. };
  2876. SvgPrimitive.prototype.applyElementStylePropertiesCore = function (element, reverseTextAnchor) {
  2877. if (reverseTextAnchor === void 0) { reverseTextAnchor = false; }
  2878. if (this.style)
  2879. Utils_1.RenderUtils.applyStyleToElement(this.style, element, reverseTextAnchor);
  2880. };
  2881. SvgPrimitive.prototype.setUnitAttribute = function (element, key, value) {
  2882. if (value === undefined || value === null)
  2883. return;
  2884. var valueStr = typeof value === "number" ? UnitConverter_1.UnitConverter.twipsToPixels(value).toString() : value;
  2885. element.setAttribute(key, valueStr);
  2886. };
  2887. return SvgPrimitive;
  2888. }());
  2889. exports.SvgPrimitive = SvgPrimitive;
  2890. /***/ }),
  2891. /* 16 */
  2892. /***/ (function(module, exports, __webpack_require__) {
  2893. "use strict";
  2894. Object.defineProperty(exports, "__esModule", { value: true });
  2895. var ModifierKey;
  2896. (function (ModifierKey) {
  2897. ModifierKey[ModifierKey["None"] = 0] = "None";
  2898. ModifierKey[ModifierKey["Ctrl"] = 65536] = "Ctrl";
  2899. ModifierKey[ModifierKey["Shift"] = 262144] = "Shift";
  2900. ModifierKey[ModifierKey["Alt"] = 1048576] = "Alt";
  2901. ModifierKey[ModifierKey["Meta"] = 16777216] = "Meta";
  2902. })(ModifierKey = exports.ModifierKey || (exports.ModifierKey = {}));
  2903. var KeyCode;
  2904. (function (KeyCode) {
  2905. KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
  2906. KeyCode[KeyCode["Tab"] = 9] = "Tab";
  2907. KeyCode[KeyCode["Enter"] = 13] = "Enter";
  2908. KeyCode[KeyCode["Pause"] = 19] = "Pause";
  2909. KeyCode[KeyCode["CapsLock"] = 20] = "CapsLock";
  2910. KeyCode[KeyCode["Esc"] = 27] = "Esc";
  2911. KeyCode[KeyCode["Space"] = 32] = "Space";
  2912. KeyCode[KeyCode["PageUp"] = 33] = "PageUp";
  2913. KeyCode[KeyCode["PageDown"] = 34] = "PageDown";
  2914. KeyCode[KeyCode["End"] = 35] = "End";
  2915. KeyCode[KeyCode["Home"] = 36] = "Home";
  2916. KeyCode[KeyCode["Left"] = 37] = "Left";
  2917. KeyCode[KeyCode["Up"] = 38] = "Up";
  2918. KeyCode[KeyCode["Right"] = 39] = "Right";
  2919. KeyCode[KeyCode["Down"] = 40] = "Down";
  2920. KeyCode[KeyCode["Insert"] = 45] = "Insert";
  2921. KeyCode[KeyCode["Delete"] = 46] = "Delete";
  2922. KeyCode[KeyCode["Key_0"] = 48] = "Key_0";
  2923. KeyCode[KeyCode["Key_1"] = 49] = "Key_1";
  2924. KeyCode[KeyCode["Key_2"] = 50] = "Key_2";
  2925. KeyCode[KeyCode["Key_3"] = 51] = "Key_3";
  2926. KeyCode[KeyCode["Key_4"] = 52] = "Key_4";
  2927. KeyCode[KeyCode["Key_5"] = 53] = "Key_5";
  2928. KeyCode[KeyCode["Key_6"] = 54] = "Key_6";
  2929. KeyCode[KeyCode["Key_7"] = 55] = "Key_7";
  2930. KeyCode[KeyCode["Key_8"] = 56] = "Key_8";
  2931. KeyCode[KeyCode["Key_9"] = 57] = "Key_9";
  2932. KeyCode[KeyCode["Key_a"] = 65] = "Key_a";
  2933. KeyCode[KeyCode["Key_b"] = 66] = "Key_b";
  2934. KeyCode[KeyCode["Key_c"] = 67] = "Key_c";
  2935. KeyCode[KeyCode["Key_d"] = 68] = "Key_d";
  2936. KeyCode[KeyCode["Key_e"] = 69] = "Key_e";
  2937. KeyCode[KeyCode["Key_f"] = 70] = "Key_f";
  2938. KeyCode[KeyCode["Key_g"] = 71] = "Key_g";
  2939. KeyCode[KeyCode["Key_h"] = 72] = "Key_h";
  2940. KeyCode[KeyCode["Key_i"] = 73] = "Key_i";
  2941. KeyCode[KeyCode["Key_j"] = 74] = "Key_j";
  2942. KeyCode[KeyCode["Key_k"] = 75] = "Key_k";
  2943. KeyCode[KeyCode["Key_l"] = 76] = "Key_l";
  2944. KeyCode[KeyCode["Key_m"] = 77] = "Key_m";
  2945. KeyCode[KeyCode["Key_n"] = 78] = "Key_n";
  2946. KeyCode[KeyCode["Key_o"] = 79] = "Key_o";
  2947. KeyCode[KeyCode["Key_p"] = 80] = "Key_p";
  2948. KeyCode[KeyCode["Key_q"] = 81] = "Key_q";
  2949. KeyCode[KeyCode["Key_r"] = 82] = "Key_r";
  2950. KeyCode[KeyCode["Key_s"] = 83] = "Key_s";
  2951. KeyCode[KeyCode["Key_t"] = 84] = "Key_t";
  2952. KeyCode[KeyCode["Key_u"] = 85] = "Key_u";
  2953. KeyCode[KeyCode["Key_v"] = 86] = "Key_v";
  2954. KeyCode[KeyCode["Key_w"] = 87] = "Key_w";
  2955. KeyCode[KeyCode["Key_x"] = 88] = "Key_x";
  2956. KeyCode[KeyCode["Key_y"] = 89] = "Key_y";
  2957. KeyCode[KeyCode["Key_z"] = 90] = "Key_z";
  2958. KeyCode[KeyCode["Windows"] = 91] = "Windows";
  2959. KeyCode[KeyCode["ContextMenu"] = 93] = "ContextMenu";
  2960. KeyCode[KeyCode["Numpad_0"] = 96] = "Numpad_0";
  2961. KeyCode[KeyCode["Numpad_1"] = 97] = "Numpad_1";
  2962. KeyCode[KeyCode["Numpad_2"] = 98] = "Numpad_2";
  2963. KeyCode[KeyCode["Numpad_3"] = 99] = "Numpad_3";
  2964. KeyCode[KeyCode["Numpad_4"] = 100] = "Numpad_4";
  2965. KeyCode[KeyCode["Numpad_5"] = 101] = "Numpad_5";
  2966. KeyCode[KeyCode["Numpad_6"] = 102] = "Numpad_6";
  2967. KeyCode[KeyCode["Numpad_7"] = 103] = "Numpad_7";
  2968. KeyCode[KeyCode["Numpad_8"] = 104] = "Numpad_8";
  2969. KeyCode[KeyCode["Numpad_9"] = 105] = "Numpad_9";
  2970. KeyCode[KeyCode["Multiply"] = 106] = "Multiply";
  2971. KeyCode[KeyCode["Add"] = 107] = "Add";
  2972. KeyCode[KeyCode["Subtract"] = 109] = "Subtract";
  2973. KeyCode[KeyCode["Decimal"] = 110] = "Decimal";
  2974. KeyCode[KeyCode["Divide"] = 111] = "Divide";
  2975. KeyCode[KeyCode["F1"] = 112] = "F1";
  2976. KeyCode[KeyCode["F2"] = 113] = "F2";
  2977. KeyCode[KeyCode["F3"] = 114] = "F3";
  2978. KeyCode[KeyCode["F4"] = 115] = "F4";
  2979. KeyCode[KeyCode["F5"] = 116] = "F5";
  2980. KeyCode[KeyCode["F6"] = 117] = "F6";
  2981. KeyCode[KeyCode["F7"] = 118] = "F7";
  2982. KeyCode[KeyCode["F8"] = 119] = "F8";
  2983. KeyCode[KeyCode["F9"] = 120] = "F9";
  2984. KeyCode[KeyCode["F10"] = 121] = "F10";
  2985. KeyCode[KeyCode["F11"] = 122] = "F11";
  2986. KeyCode[KeyCode["F12"] = 123] = "F12";
  2987. KeyCode[KeyCode["NumLock"] = 144] = "NumLock";
  2988. KeyCode[KeyCode["ScrollLock"] = 145] = "ScrollLock";
  2989. KeyCode[KeyCode["Semicolon"] = 186] = "Semicolon";
  2990. KeyCode[KeyCode["Equals"] = 187] = "Equals";
  2991. KeyCode[KeyCode["Comma"] = 188] = "Comma";
  2992. KeyCode[KeyCode["Dash"] = 189] = "Dash";
  2993. KeyCode[KeyCode["Period"] = 190] = "Period";
  2994. KeyCode[KeyCode["ForwardSlash"] = 191] = "ForwardSlash";
  2995. KeyCode[KeyCode["GraveAccent"] = 192] = "GraveAccent";
  2996. KeyCode[KeyCode["OpenBracket"] = 219] = "OpenBracket";
  2997. KeyCode[KeyCode["BackSlash"] = 220] = "BackSlash";
  2998. KeyCode[KeyCode["CloseBracket"] = 221] = "CloseBracket";
  2999. KeyCode[KeyCode["SingleQuote"] = 222] = "SingleQuote";
  3000. })(KeyCode = exports.KeyCode || (exports.KeyCode = {}));
  3001. /***/ }),
  3002. /* 17 */
  3003. /***/ (function(module, exports, __webpack_require__) {
  3004. "use strict";
  3005. Object.defineProperty(exports, "__esModule", { value: true });
  3006. var ShapeParameterPoint = /** @class */ (function () {
  3007. function ShapeParameterPoint(key, point) {
  3008. this.key = key;
  3009. this.point = point;
  3010. }
  3011. return ShapeParameterPoint;
  3012. }());
  3013. exports.ShapeParameterPoint = ShapeParameterPoint;
  3014. /***/ }),
  3015. /* 18 */
  3016. /***/ (function(module, exports, __webpack_require__) {
  3017. "use strict";
  3018. var __extends = (this && this.__extends) || (function () {
  3019. var extendStatics = function (d, b) {
  3020. extendStatics = Object.setPrototypeOf ||
  3021. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3022. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  3023. return extendStatics(d, b);
  3024. };
  3025. return function (d, b) {
  3026. extendStatics(d, b);
  3027. function __() { this.constructor = d; }
  3028. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3029. };
  3030. })();
  3031. Object.defineProperty(exports, "__esModule", { value: true });
  3032. var Connector_1 = __webpack_require__(5);
  3033. var LayoutSettings = /** @class */ (function () {
  3034. function LayoutSettings(gridSize) {
  3035. this.orientation = OrientationKind.Vertical;
  3036. this.direction = LogicalDirectionKind.Forward;
  3037. this.componentSpacing = (gridSize && gridSize * 2 > 800) ? gridSize * 2 : 800;
  3038. var offset = (gridSize && gridSize > Connector_1.Connector.minOffset) ? gridSize : Connector_1.Connector.minOffset;
  3039. this.layerSpacing = offset * 2;
  3040. this.columnSpacing = offset;
  3041. }
  3042. return LayoutSettings;
  3043. }());
  3044. exports.LayoutSettings = LayoutSettings;
  3045. var TreeLayoutSettings = /** @class */ (function (_super) {
  3046. __extends(TreeLayoutSettings, _super);
  3047. function TreeLayoutSettings(gridSize) {
  3048. var _this = _super.call(this, gridSize) || this;
  3049. _this.alignment = Alignment.Center;
  3050. _this.subTreeColumnSpacing = _this.componentSpacing / 2;
  3051. return _this;
  3052. }
  3053. return TreeLayoutSettings;
  3054. }(LayoutSettings));
  3055. exports.TreeLayoutSettings = TreeLayoutSettings;
  3056. var LogicalDirectionKind;
  3057. (function (LogicalDirectionKind) {
  3058. LogicalDirectionKind[LogicalDirectionKind["Backward"] = 0] = "Backward";
  3059. LogicalDirectionKind[LogicalDirectionKind["Forward"] = 1] = "Forward";
  3060. })(LogicalDirectionKind = exports.LogicalDirectionKind || (exports.LogicalDirectionKind = {}));
  3061. var OrientationKind;
  3062. (function (OrientationKind) {
  3063. OrientationKind[OrientationKind["Horizontal"] = 0] = "Horizontal";
  3064. OrientationKind[OrientationKind["Vertical"] = 1] = "Vertical";
  3065. })(OrientationKind = exports.OrientationKind || (exports.OrientationKind = {}));
  3066. var Alignment;
  3067. (function (Alignment) {
  3068. Alignment[Alignment["Left"] = 0] = "Left";
  3069. Alignment[Alignment["Center"] = 1] = "Center";
  3070. })(Alignment = exports.Alignment || (exports.Alignment = {}));
  3071. /***/ }),
  3072. /* 19 */
  3073. /***/ (function(module, exports, __webpack_require__) {
  3074. "use strict";
  3075. Object.defineProperty(exports, "__esModule", { value: true });
  3076. var Browser_1 = __webpack_require__(20);
  3077. var Data_1 = __webpack_require__(102);
  3078. var Str_1 = __webpack_require__(103);
  3079. var Attr_1 = __webpack_require__(104);
  3080. var KeyCode_1 = __webpack_require__(16);
  3081. var Evt_1 = __webpack_require__(49);
  3082. function IsExists(obj) {
  3083. return (typeof (obj) != "undefined") && (obj != null);
  3084. }
  3085. exports.IsExists = IsExists;
  3086. function IsNumber(str) {
  3087. return !isNaN(parseFloat(str)) && isFinite(str);
  3088. }
  3089. exports.IsNumber = IsNumber;
  3090. ;
  3091. function SetStyles(element, styles, makeImportant) {
  3092. if (IsExists(styles.cssText))
  3093. element.style.cssText = styles.cssText;
  3094. if (IsExists(styles.className))
  3095. element.className = styles.className;
  3096. for (var property in styles) {
  3097. if (!styles.hasOwnProperty(property))
  3098. continue;
  3099. var value = styles[property];
  3100. switch (property) {
  3101. case "cssText":
  3102. case "className":
  3103. break;
  3104. case "float":
  3105. SetElementFloat(element, value);
  3106. break;
  3107. case "opacity":
  3108. SetElementOpacity(element, value);
  3109. break;
  3110. case "zIndex":
  3111. SetStylesCore(element, property, value, makeImportant);
  3112. break;
  3113. /*jshint -W086 */
  3114. case "fontWeight":
  3115. if (Browser_1.Browser.IE && Browser_1.Browser.Version < 9 && typeof (styles[property]) == "number")
  3116. value = styles[property].toString();
  3117. default:
  3118. SetStylesCore(element, property, value + (typeof (value) == "number" ? "px" : ""), makeImportant);
  3119. /*jshint +W086 */
  3120. }
  3121. }
  3122. }
  3123. exports.SetStyles = SetStyles;
  3124. ;
  3125. function SetStylesCore(element, property, value, makeImportant) {
  3126. if (makeImportant) {
  3127. var index = property.search("[A-Z]");
  3128. if (index != -1)
  3129. property = property.replace(property.charAt(index), "-" + property.charAt(index).toLowerCase());
  3130. if (element.style.setProperty)
  3131. element.style.setProperty(property, value, "important");
  3132. else
  3133. element.style.cssText += ";" + property + ":" + value + "!important";
  3134. }
  3135. else
  3136. element.style[property] = value;
  3137. }
  3138. exports.SetStylesCore = SetStylesCore;
  3139. function GetDocumentScrollTop() {
  3140. var isScrollBodyIE = Browser_1.Browser.IE && GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollTop > 0;
  3141. if (Browser_1.Browser.WebKitFamily || Browser_1.Browser.Edge || isScrollBodyIE) {
  3142. if (Browser_1.Browser.MacOSMobilePlatform) //B157267
  3143. return window.pageYOffset;
  3144. if (Browser_1.Browser.WebKitFamily)
  3145. return document.documentElement.scrollTop || document.body.scrollTop;
  3146. return document.body.scrollTop;
  3147. }
  3148. else
  3149. return document.documentElement.scrollTop;
  3150. }
  3151. exports.GetDocumentScrollTop = GetDocumentScrollTop;
  3152. function CloneObject(srcObject) {
  3153. if (typeof (srcObject) != 'object' || srcObject == null)
  3154. return srcObject;
  3155. var newObject = {};
  3156. /* jshint ignore:start */
  3157. for (var i in srcObject)
  3158. newObject[i] = srcObject[i];
  3159. /* jshint ignore:end */
  3160. return newObject;
  3161. }
  3162. exports.CloneObject = CloneObject;
  3163. function GetCurrentStyle(element) {
  3164. if (element.currentStyle)
  3165. return element.currentStyle;
  3166. else if (document.defaultView && document.defaultView.getComputedStyle) {
  3167. var result = document.defaultView.getComputedStyle(element, null);
  3168. if (!result && Browser_1.Browser.Firefox && window.frameElement) {
  3169. var changes = [];
  3170. var curElement = window.frameElement;
  3171. while (!(result = document.defaultView.getComputedStyle(element, null))) {
  3172. changes.push([curElement, curElement.style.display]);
  3173. SetStylesCore(curElement, "display", "block", true);
  3174. curElement = curElement.tagName == "BODY" ? curElement.ownerDocument.defaultView.frameElement : curElement.parentNode;
  3175. }
  3176. result = CloneObject(result);
  3177. for (var ch, i = 0; ch = changes[i]; i++)
  3178. SetStylesCore(ch[0], "display", ch[1], false);
  3179. document.body.offsetWidth; //T334387
  3180. }
  3181. return result;
  3182. }
  3183. return window.getComputedStyle(element, null);
  3184. }
  3185. exports.GetCurrentStyle = GetCurrentStyle;
  3186. function GetDocumentScrollLeft() {
  3187. var isScrollBodyIE = Browser_1.Browser.IE && GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollLeft > 0;
  3188. if (Browser_1.Browser.Edge || isScrollBodyIE)
  3189. return document.body ? document.body.scrollLeft : document.documentElement.scrollLeft;
  3190. if (Browser_1.Browser.WebKitFamily)
  3191. return document.documentElement.scrollLeft || document.body.scrollLeft;
  3192. return document.documentElement.scrollLeft;
  3193. }
  3194. exports.GetDocumentScrollLeft = GetDocumentScrollLeft;
  3195. exports.focusedElement = null;
  3196. function GetFocusedElement() {
  3197. var activeElement = GetActiveElement();
  3198. return activeElement ? activeElement : exports.focusedElement;
  3199. }
  3200. exports.GetFocusedElement = GetFocusedElement;
  3201. function GetActiveElement() {
  3202. try {
  3203. return document.activeElement;
  3204. }
  3205. catch (e) {
  3206. return null;
  3207. }
  3208. }
  3209. exports.GetActiveElement = GetActiveElement;
  3210. ;
  3211. function focusCore(element, selectAction) {
  3212. try {
  3213. element.focus();
  3214. if (Browser_1.Browser.IE && document.activeElement != element)
  3215. element.focus();
  3216. // Q339238
  3217. if (selectAction) {
  3218. var currentSelection = Selection.GetInfo(element);
  3219. // apply selection only if there is no selection present already
  3220. if (currentSelection.startPos == currentSelection.endPos) {
  3221. switch (selectAction) {
  3222. case "start":
  3223. Selection.SetCaretPosition(element, 0);
  3224. break;
  3225. case "all":
  3226. Selection.Set(element);
  3227. break;
  3228. }
  3229. }
  3230. }
  3231. }
  3232. catch (e) {
  3233. }
  3234. }
  3235. function SetFocus(element, selectAction) {
  3236. if (Browser_1.Browser.MacOSMobilePlatform) // Q471191
  3237. focusCore(element, selectAction);
  3238. else {
  3239. window.setTimeout(function () {
  3240. focusCore(element, selectAction);
  3241. }, 100);
  3242. }
  3243. }
  3244. exports.SetFocus = SetFocus;
  3245. function GetIsParent(parentElement, element) {
  3246. if (!parentElement || !element)
  3247. return false;
  3248. while (element) {
  3249. if (element === parentElement)
  3250. return true;
  3251. if (element.tagName === "BODY")
  3252. return false;
  3253. element = element.parentNode;
  3254. }
  3255. return false;
  3256. }
  3257. exports.GetIsParent = GetIsParent;
  3258. function ElementContainsCssClass(element, className) {
  3259. //B187659
  3260. try {
  3261. if (!element.className)
  3262. return false;
  3263. return element.className.indexOf(className) != -1;
  3264. }
  3265. catch (e) {
  3266. return false;
  3267. }
  3268. }
  3269. exports.ElementContainsCssClass = ElementContainsCssClass;
  3270. function AddClassNameToElement(element, className) {
  3271. if (!element || typeof (className) !== "string")
  3272. return;
  3273. className = className.trim();
  3274. if (!ElementHasCssClass(element, className) && className !== "")
  3275. element.className = (element.className === "") ? className : element.className + " " + className;
  3276. }
  3277. exports.AddClassNameToElement = AddClassNameToElement;
  3278. function ElementHasCssClass(element, className) {
  3279. //B220674
  3280. try {
  3281. var elementClasses;
  3282. var classList = element.classList;
  3283. if (!classList) {
  3284. if (!element.className)
  3285. return false;
  3286. elementClasses = element.className.split(" ");
  3287. }
  3288. var classNames = className.split(" ");
  3289. for (var i = classNames.length - 1; i >= 0; i--) {
  3290. if (classList) {
  3291. if (!classList.contains(classNames[i]))
  3292. return false;
  3293. continue;
  3294. }
  3295. if (Data_1.Data.ArrayIndexOf(elementClasses, classNames[i]) < 0)
  3296. return false;
  3297. }
  3298. return true;
  3299. }
  3300. catch (e) {
  3301. return false;
  3302. }
  3303. }
  3304. exports.ElementHasCssClass = ElementHasCssClass;
  3305. function RemoveClassNameFromElement(element, className) {
  3306. if (!element)
  3307. return;
  3308. var updClassName = " " + element.className + " ";
  3309. var newClassName = updClassName.replace(" " + className + " ", " ");
  3310. if (updClassName.length != newClassName.length)
  3311. element.className = Str_1.Str.Trim(newClassName);
  3312. }
  3313. exports.RemoveClassNameFromElement = RemoveClassNameFromElement;
  3314. function GetAbsolutePositionY(element) {
  3315. if (Browser_1.Browser.IE)
  3316. return getAbsolutePositionY_IE(element);
  3317. else if (Browser_1.Browser.Firefox && Browser_1.Browser.Version >= 3)
  3318. return getAbsolutePositionY_FF3(element);
  3319. else if (Browser_1.Browser.Opera)
  3320. return getAbsolutePositionY_Opera(element);
  3321. else if (Browser_1.Browser.NetscapeFamily && (!Browser_1.Browser.Firefox || Browser_1.Browser.Version < 3))
  3322. return getAbsolutePositionY_NS(element);
  3323. else if (Browser_1.Browser.WebKitFamily || Browser_1.Browser.Edge)
  3324. return getAbsolutePositionY_FF3(element);
  3325. else
  3326. return getAbsolutePositionY_Other(element);
  3327. }
  3328. exports.GetAbsolutePositionY = GetAbsolutePositionY;
  3329. function getAbsolutePositionY_Opera(curEl) {
  3330. var isFirstCycle = true;
  3331. if (curEl && curEl.tagName == "TR" && curEl.cells.length > 0)
  3332. curEl = curEl.cells[0];
  3333. var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
  3334. while (curEl != null) {
  3335. pos += curEl.offsetTop;
  3336. if (!isFirstCycle)
  3337. pos -= curEl.scrollTop;
  3338. curEl = curEl.offsetParent;
  3339. isFirstCycle = false;
  3340. }
  3341. pos += document.body.scrollTop;
  3342. return pos;
  3343. }
  3344. function getAbsolutePositionY_IE(element) {
  3345. if (element == null || Browser_1.Browser.IE && element.parentNode == null)
  3346. return 0; // B96664
  3347. return element.getBoundingClientRect().top + GetDocumentScrollTop();
  3348. }
  3349. function getAbsolutePositionY_FF3(element) {
  3350. if (element == null)
  3351. return 0;
  3352. var y = element.getBoundingClientRect().top + GetDocumentScrollTop();
  3353. return Math.round(y);
  3354. }
  3355. function getAbsolutePositionY_NS(curEl) {
  3356. var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
  3357. var isFirstCycle = true;
  3358. while (curEl != null) {
  3359. pos += curEl.offsetTop;
  3360. if (!isFirstCycle && curEl.offsetParent != null)
  3361. pos -= curEl.scrollTop;
  3362. if (!isFirstCycle && Browser_1.Browser.Firefox) {
  3363. var style = GetCurrentStyle(curEl);
  3364. if (curEl.tagName == "DIV" && style.overflow != "visible")
  3365. pos += PxToInt(style.borderTopWidth);
  3366. }
  3367. isFirstCycle = false;
  3368. curEl = curEl.offsetParent;
  3369. }
  3370. return pos;
  3371. }
  3372. function getAbsolutePositionY_Other(curEl) {
  3373. var pos = 0;
  3374. var isFirstCycle = true;
  3375. while (curEl != null) {
  3376. pos += curEl.offsetTop;
  3377. if (!isFirstCycle && curEl.offsetParent != null)
  3378. pos -= curEl.scrollTop;
  3379. isFirstCycle = false;
  3380. curEl = curEl.offsetParent;
  3381. }
  3382. return pos;
  3383. }
  3384. function getAbsoluteScrollOffset_OperaFF(curEl, isX) {
  3385. var pos = 0;
  3386. var isFirstCycle = true;
  3387. while (curEl != null) {
  3388. if (curEl.tagName == "BODY")
  3389. break;
  3390. var style = GetCurrentStyle(curEl);
  3391. if (style.position == "absolute")
  3392. break;
  3393. if (!isFirstCycle && curEl.tagName == "DIV" && (style.position == "" || style.position == "static"))
  3394. pos -= isX ? curEl.scrollLeft : curEl.scrollTop;
  3395. curEl = curEl.parentNode;
  3396. isFirstCycle = false;
  3397. }
  3398. return pos;
  3399. }
  3400. function PxToInt(px) {
  3401. return pxToNumber(px, parseInt);
  3402. }
  3403. exports.PxToInt = PxToInt;
  3404. ;
  3405. function PxToFloat(px) {
  3406. return pxToNumber(px, parseFloat);
  3407. }
  3408. exports.PxToFloat = PxToFloat;
  3409. ;
  3410. function pxToNumber(px, parseFunction) {
  3411. var result = 0;
  3412. if (px != null && px != "") {
  3413. try {
  3414. var indexOfPx = px.indexOf("px");
  3415. if (indexOfPx > -1)
  3416. result = parseFunction(px.substr(0, indexOfPx));
  3417. }
  3418. catch (e) { }
  3419. }
  3420. return result;
  3421. }
  3422. //function GetAbsolutePositionX(element: HTMLElement): number;
  3423. function GetAbsolutePositionX(element) {
  3424. if (Browser_1.Browser.IE)
  3425. return getAbsolutePositionX_IE(element);
  3426. else if (Browser_1.Browser.Firefox && Browser_1.Browser.Version >= 3)
  3427. return getAbsolutePositionX_FF3(element);
  3428. else if (Browser_1.Browser.Opera)
  3429. return getAbsolutePositionX_Opera(element);
  3430. else if (Browser_1.Browser.NetscapeFamily && (!Browser_1.Browser.Firefox || Browser_1.Browser.Version < 3))
  3431. return getAbsolutePositionX_NS(element);
  3432. else if (Browser_1.Browser.WebKitFamily || Browser_1.Browser.Edge)
  3433. return getAbsolutePositionX_FF3(element);
  3434. else
  3435. return getAbsolutePositionX_Other(element);
  3436. }
  3437. exports.GetAbsolutePositionX = GetAbsolutePositionX;
  3438. function getAbsolutePositionX_Opera(curEl) {
  3439. var isFirstCycle = true;
  3440. var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
  3441. while (curEl != null) {
  3442. pos += curEl.offsetLeft;
  3443. if (!isFirstCycle)
  3444. pos -= curEl.scrollLeft;
  3445. curEl = curEl.offsetParent;
  3446. isFirstCycle = false;
  3447. }
  3448. pos += document.body.scrollLeft;
  3449. return pos;
  3450. }
  3451. function getAbsolutePositionX_IE(element) {
  3452. if (element == null || Browser_1.Browser.IE && element.parentNode == null)
  3453. return 0; // B96664
  3454. return element.getBoundingClientRect().left + GetDocumentScrollLeft();
  3455. }
  3456. function getAbsolutePositionX_FF3(element) {
  3457. if (element == null)
  3458. return 0;
  3459. var x = element.getBoundingClientRect().left + GetDocumentScrollLeft();
  3460. return Math.round(x);
  3461. }
  3462. function getAbsolutePositionX_NS(curEl) {
  3463. var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
  3464. var isFirstCycle = true;
  3465. while (curEl != null) {
  3466. pos += curEl.offsetLeft;
  3467. if (!isFirstCycle && curEl.offsetParent != null)
  3468. pos -= curEl.scrollLeft;
  3469. if (!isFirstCycle && Browser_1.Browser.Firefox) {
  3470. var style = GetCurrentStyle(curEl);
  3471. if (curEl.tagName == "DIV" && style.overflow != "visible")
  3472. pos += PxToInt(style.borderLeftWidth);
  3473. }
  3474. isFirstCycle = false;
  3475. curEl = curEl.offsetParent;
  3476. }
  3477. return pos;
  3478. }
  3479. function getAbsolutePositionX_Other(curEl) {
  3480. var pos = 0;
  3481. var isFirstCycle = true;
  3482. while (curEl != null) {
  3483. pos += curEl.offsetLeft;
  3484. if (!isFirstCycle && curEl.offsetParent != null)
  3485. pos -= curEl.scrollLeft;
  3486. isFirstCycle = false;
  3487. curEl = curEl.offsetParent;
  3488. }
  3489. return pos;
  3490. }
  3491. function SetAbsoluteX(element, x) {
  3492. element.style.left = prepareClientPosForElement(x, element, true) + "px";
  3493. }
  3494. exports.SetAbsoluteX = SetAbsoluteX;
  3495. ;
  3496. function SetAbsoluteY(element, y) {
  3497. element.style.top = prepareClientPosForElement(y, element, false) + "px";
  3498. }
  3499. exports.SetAbsoluteY = SetAbsoluteY;
  3500. ;
  3501. function prepareClientPosForElement(pos, element, isX) {
  3502. pos -= getPositionElementOffset(element, isX);
  3503. return pos;
  3504. }
  3505. ;
  3506. function getPositionElementOffset(element, isX) {
  3507. var div = createElementMock(element);
  3508. if (div.style.position == "static")
  3509. div.style.position = "absolute";
  3510. element.parentNode.appendChild(div);
  3511. var realPos = isX ? GetAbsolutePositionX(div) : GetAbsolutePositionY(div);
  3512. element.parentNode.removeChild(div);
  3513. return Math.round(realPos);
  3514. }
  3515. ;
  3516. function createElementMock(element) {
  3517. var div = document.createElement('DIV');
  3518. div.style.top = "0px";
  3519. div.style.left = "0px";
  3520. div.style.visibility = "hidden";
  3521. div.style.position = GetCurrentStyle(element).position;
  3522. return div;
  3523. }
  3524. function IsPercentageSize(size) {
  3525. return size && size.indexOf('%') != -1;
  3526. }
  3527. exports.IsPercentageSize = IsPercentageSize;
  3528. ;
  3529. function GetChildNodes(parent, predicate) {
  3530. return RetrieveByPredicate(parent.childNodes, predicate);
  3531. }
  3532. exports.GetChildNodes = GetChildNodes;
  3533. ;
  3534. function GetNodes(parent, predicate) {
  3535. var c = parent.all || parent.getElementsByTagName('*');
  3536. return RetrieveByPredicate(c, predicate);
  3537. }
  3538. exports.GetNodes = GetNodes;
  3539. ;
  3540. function RetrieveByPredicate(scourceCollection, predicate) {
  3541. var result = [];
  3542. for (var i = 0; i < scourceCollection.length; i++) {
  3543. var element = scourceCollection[i];
  3544. if (!predicate || predicate(element))
  3545. result.push(element);
  3546. }
  3547. return result;
  3548. }
  3549. exports.RetrieveByPredicate = RetrieveByPredicate;
  3550. ;
  3551. function GetChildNodesByClassName(parent, className) {
  3552. if (!parent)
  3553. return [];
  3554. if (parent.querySelectorAll) {
  3555. var children = parent.querySelectorAll('.' + className);
  3556. return nodeListToArray(children, function (element) {
  3557. return element.parentNode === parent;
  3558. });
  3559. }
  3560. return GetChildNodes(parent, function (elem) { return elem.className && ElementHasCssClass(elem, className); });
  3561. }
  3562. exports.GetChildNodesByClassName = GetChildNodesByClassName;
  3563. function nodeListToArray(nodeList, filter) {
  3564. var result = [];
  3565. for (var i = 0, element; element = nodeList[i]; i++) {
  3566. if (filter && !filter(element))
  3567. continue;
  3568. result.push(element);
  3569. }
  3570. return result;
  3571. }
  3572. function GetNodesByClassName(parent, className) {
  3573. if (parent.querySelectorAll) {
  3574. var children = parent.querySelectorAll('.' + className);
  3575. return nodeListToArray(children, null);
  3576. }
  3577. return GetNodes(parent, function (elem) { return elem.className && ElementHasCssClass(elem, className); });
  3578. }
  3579. exports.GetNodesByClassName = GetNodesByClassName;
  3580. function GetParentByClassName(element, className) {
  3581. while (element != null) {
  3582. if (element.tagName == "BODY" || element.nodeName == "#document")
  3583. return null;
  3584. if (ElementContainsCssClass(element, className))
  3585. return element;
  3586. element = element.parentNode;
  3587. }
  3588. return null;
  3589. }
  3590. exports.GetParentByClassName = GetParentByClassName;
  3591. function GetParentByTagName(element, tagName) {
  3592. tagName = tagName.toUpperCase();
  3593. while (element) {
  3594. if (element.tagName === "BODY")
  3595. return null;
  3596. if (element.tagName === tagName)
  3597. return element;
  3598. element = element.parentNode;
  3599. }
  3600. return null;
  3601. }
  3602. exports.GetParentByTagName = GetParentByTagName;
  3603. var html2PlainTextFilter = null;
  3604. function setInnerHtmlInternal(el, trustedHtmlString) {
  3605. el.innerHTML = trustedHtmlString;
  3606. }
  3607. exports.setInnerHtmlInternal = setInnerHtmlInternal;
  3608. function SetElementDisplay(element, value, checkCurrentStyle, makeInline) {
  3609. if (!element)
  3610. return;
  3611. if (typeof (value) === "string")
  3612. element.style.display = value;
  3613. else if (!value)
  3614. element.style.display = "none";
  3615. else {
  3616. element.style.display = "";
  3617. if (checkCurrentStyle && GetCurrentStyle(element).display === "none") {
  3618. var displayAddon = makeInline ? "inline-" : "";
  3619. switch (element.tagName) {
  3620. case "TABLE": {
  3621. element.style.display = displayAddon + "table";
  3622. break;
  3623. }
  3624. default: {
  3625. element.style.display = displayAddon + "block";
  3626. break;
  3627. }
  3628. }
  3629. }
  3630. }
  3631. }
  3632. exports.SetElementDisplay = SetElementDisplay;
  3633. function GetInnerText(container) {
  3634. if (Browser_1.Browser.Safari && Browser_1.Browser.MajorVersion <= 5) {
  3635. var filter = getHtml2PlainTextFilter();
  3636. setInnerHtmlInternal(filter, container.innerHTML);
  3637. SetElementDisplay(filter, true, false, false);
  3638. var innerText = filter.innerText;
  3639. SetElementDisplay(filter, false, false, false);
  3640. return innerText;
  3641. }
  3642. else if (Browser_1.Browser.NetscapeFamily || Browser_1.Browser.WebKitFamily || (Browser_1.Browser.IE && Browser_1.Browser.Version >= 9) || Browser_1.Browser.Edge) {
  3643. return container.textContent;
  3644. }
  3645. else
  3646. return container.innerText;
  3647. }
  3648. exports.GetInnerText = GetInnerText;
  3649. function getHtml2PlainTextFilter() {
  3650. if (html2PlainTextFilter == null) {
  3651. html2PlainTextFilter = document.createElement("DIV");
  3652. html2PlainTextFilter.style.width = "0";
  3653. html2PlainTextFilter.style.height = "0";
  3654. html2PlainTextFilter.style.overflow = "visible";
  3655. SetElementDisplay(html2PlainTextFilter, false, false, false);
  3656. document.body.appendChild(html2PlainTextFilter);
  3657. }
  3658. return html2PlainTextFilter;
  3659. }
  3660. var verticalScrollBarWidth;
  3661. function GetVerticalScrollBarWidth() {
  3662. if (typeof (verticalScrollBarWidth) == "undefined") {
  3663. var container = document.createElement("DIV");
  3664. container.style.cssText = "position: absolute; top: 0px; left: 0px; visibility: hidden; width: 200px; height: 150px; overflow: hidden; box-sizing: content-box";
  3665. document.body.appendChild(container);
  3666. var child = document.createElement("P");
  3667. container.appendChild(child);
  3668. child.style.cssText = "width: 100%; height: 200px;";
  3669. var widthWithoutScrollBar = child.offsetWidth;
  3670. container.style.overflow = "scroll";
  3671. var widthWithScrollBar = child.offsetWidth;
  3672. if (widthWithoutScrollBar == widthWithScrollBar)
  3673. widthWithScrollBar = container.clientWidth;
  3674. verticalScrollBarWidth = widthWithoutScrollBar - widthWithScrollBar;
  3675. document.body.removeChild(container);
  3676. }
  3677. return verticalScrollBarWidth;
  3678. }
  3679. exports.GetVerticalScrollBarWidth = GetVerticalScrollBarWidth;
  3680. function GetHorizontalBordersWidth(element, style) {
  3681. if (!IsExists(style))
  3682. style = (Browser_1.Browser.IE && window.getComputedStyle) ? window.getComputedStyle(element) : GetCurrentStyle(element);
  3683. var res = 0;
  3684. if (style.borderLeftStyle != "none")
  3685. res += PxToFloat(style.borderLeftWidth);
  3686. if (style.borderRightStyle != "none")
  3687. res += PxToFloat(style.borderRightWidth);
  3688. return res;
  3689. }
  3690. exports.GetHorizontalBordersWidth = GetHorizontalBordersWidth;
  3691. function GetVerticalBordersWidth(element, style) {
  3692. if (!IsExists(style))
  3693. style = (Browser_1.Browser.IE && Browser_1.Browser.MajorVersion != 9 && window.getComputedStyle) ? window.getComputedStyle(element) : GetCurrentStyle(element);
  3694. var res = 0;
  3695. if (style.borderTopStyle != "none")
  3696. res += PxToFloat(style.borderTopWidth);
  3697. if (style.borderBottomStyle != "none")
  3698. res += PxToFloat(style.borderBottomWidth);
  3699. return res;
  3700. }
  3701. exports.GetVerticalBordersWidth = GetVerticalBordersWidth;
  3702. function SetElementVisibility(element, value) {
  3703. if (!element)
  3704. return;
  3705. if (typeof (value) === "string")
  3706. element.style.visibility = value;
  3707. else
  3708. element.style.visibility = value ? "visible" : "hidden";
  3709. }
  3710. exports.SetElementVisibility = SetElementVisibility;
  3711. ;
  3712. function SetElementFloat(element, value) {
  3713. if (IsExists(element.style.cssFloat))
  3714. element.style.cssFloat = value;
  3715. else if (IsExists(element.style.styleFloat))
  3716. element.style.styleFloat = value;
  3717. else
  3718. Attr_1.Attr.SetAttribute(element.style, "float", value);
  3719. }
  3720. exports.SetElementFloat = SetElementFloat;
  3721. ;
  3722. function SetElementOpacity(element, value) {
  3723. var useOpacityStyle = !Browser_1.Browser.IE || Browser_1.Browser.Version > 8;
  3724. if (useOpacityStyle) {
  3725. element.style.opacity = value;
  3726. }
  3727. else {
  3728. if (typeof (element.filters) === "object" && element.filters["DXImageTransform.Microsoft.Alpha"])
  3729. element.filters.item("DXImageTransform.Microsoft.Alpha").Opacity = value * 100;
  3730. else
  3731. element.style.filter = "alpha(opacity=" + (value * 100) + ")";
  3732. }
  3733. }
  3734. exports.SetElementOpacity = SetElementOpacity;
  3735. function CreateGuid() {
  3736. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  3737. var r = Math.random() * 16 | 0; // trunc fractional part
  3738. var v = c == 'x' ? r : r & 0x3 | 0x8;
  3739. return v.toString(16);
  3740. });
  3741. }
  3742. exports.CreateGuid = CreateGuid;
  3743. function IsUrlContainsClientScript(url) {
  3744. return url.toLowerCase().indexOf("javascript:") !== -1;
  3745. }
  3746. exports.IsUrlContainsClientScript = IsUrlContainsClientScript;
  3747. function IsExistsElement(element) {
  3748. return element && IsValidElement(element);
  3749. }
  3750. exports.IsExistsElement = IsExistsElement;
  3751. function IsValidElement(element) {
  3752. if (!element)
  3753. return false;
  3754. if (!(Browser_1.Browser.Firefox && Browser_1.Browser.Version < 4)) {
  3755. if (element.ownerDocument && element.ownerDocument.body && element.ownerDocument.body.compareDocumentPosition)
  3756. return element.ownerDocument.body.compareDocumentPosition(element) % 2 === 0;
  3757. }
  3758. if (!Browser_1.Browser.Opera && !(Browser_1.Browser.IE && Browser_1.Browser.Version < 9) && element.offsetParent && element.parentNode.tagName)
  3759. return true;
  3760. while (element != null) {
  3761. if (element.tagName == "BODY")
  3762. return true;
  3763. element = element.parentNode;
  3764. }
  3765. return false;
  3766. }
  3767. exports.IsValidElement = IsValidElement;
  3768. function IsInteractiveControl(element) {
  3769. return Data_1.Data.ArrayIndexOf(["A", "INPUT", "SELECT", "OPTION", "TEXTAREA", "BUTTON", "IFRAME"], element.tagName) > -1;
  3770. }
  3771. exports.IsInteractiveControl = IsInteractiveControl;
  3772. function IsActionElement(element) {
  3773. if (!IsExistsElement(element))
  3774. return false;
  3775. var tabIndex = parseInt(Attr_1.Attr.GetAttribute(element, Attr_1.Attr.GetTabIndexAttributeName()));
  3776. var hasTabIndex = !isNaN(tabIndex);
  3777. var hasNonNegativeTabIndex = hasTabIndex && tabIndex > -1;
  3778. var hasNegativeTabIndex = hasTabIndex && tabIndex < 0;
  3779. var tagName = element.tagName;
  3780. var focusableElementTags = ["BUTTON", "SELECT", "TEXTAREA", "OPTION", "IFRAME"];
  3781. var isFocusableCore = IsFocusable(element);
  3782. var isFocusableTag = focusableElementTags.indexOf(tagName) !== -1;
  3783. var isFocusableLink = tagName === "A" && (!!element.href || hasNonNegativeTabIndex);
  3784. var isFocusableInput = tagName === "INPUT" && element.type.toLowerCase() !== "hidden";
  3785. var isFocusableByTabIndex = tagName !== "INPUT" && hasNonNegativeTabIndex;
  3786. var isEditableDiv = tagName == "DIV" && element.contentEditable === "true";
  3787. return isFocusableCore && !hasNegativeTabIndex && (isFocusableTag || isFocusableLink || isFocusableInput || isFocusableByTabIndex || isEditableDiv);
  3788. }
  3789. exports.IsActionElement = IsActionElement;
  3790. function IsFocusable(element, skipContainerVisibilityCheck) {
  3791. if (skipContainerVisibilityCheck === void 0) { skipContainerVisibilityCheck = function () { return false; }; }
  3792. var current = element;
  3793. while (current && current.nodeType == 1) {
  3794. if (current == element || !skipContainerVisibilityCheck(current)) {
  3795. var tagName = current.tagName.toUpperCase();
  3796. if (tagName == "BODY")
  3797. return true;
  3798. var disabledElementTags = ["INPUT", "BUTTON", "TEXTAREA", "SELECT", "OPTION"];
  3799. if (disabledElementTags.indexOf(tagName) !== -1 && current.disabled || !GetElementDisplay(current, false) || !GetElementVisibility(current, false))
  3800. return false;
  3801. }
  3802. current = current.parentNode;
  3803. }
  3804. return true;
  3805. }
  3806. exports.IsFocusable = IsFocusable;
  3807. function GetElementDisplay(element, isCurrentStyle) {
  3808. if (isCurrentStyle)
  3809. return GetCurrentStyle(element).display != "none";
  3810. return element.style.display != "none";
  3811. }
  3812. exports.GetElementDisplay = GetElementDisplay;
  3813. function GetElementVisibility(element, isCurrentStyle) {
  3814. if (isCurrentStyle)
  3815. return GetCurrentStyle(element).visibility != "hidden";
  3816. return element.style.visibility != "hidden";
  3817. }
  3818. exports.GetElementVisibility = GetElementVisibility;
  3819. function GetClearClientHeight(element) {
  3820. return element.offsetHeight - GetTopBottomBordersAndPaddingsSummaryValue(element);
  3821. }
  3822. exports.GetClearClientHeight = GetClearClientHeight;
  3823. function GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle) {
  3824. return GetTopBottomPaddings(element, currentStyle) + GetVerticalBordersWidth(element, currentStyle);
  3825. }
  3826. exports.GetTopBottomBordersAndPaddingsSummaryValue = GetTopBottomBordersAndPaddingsSummaryValue;
  3827. ;
  3828. function GetTopBottomPaddings(element, style) {
  3829. var currentStyle = style ? style : GetCurrentStyle(element);
  3830. return PxToInt(currentStyle.paddingTop) + PxToInt(currentStyle.paddingBottom);
  3831. }
  3832. exports.GetTopBottomPaddings = GetTopBottomPaddings;
  3833. ;
  3834. function ParseShortcutString(shortcutString) {
  3835. if (!shortcutString)
  3836. return 0;
  3837. var isCtrlKey = false;
  3838. var isShiftKey = false;
  3839. var isAltKey = false;
  3840. var isMetaKey = false;
  3841. var keyCode = null;
  3842. var shcKeys = shortcutString.toString().split("+");
  3843. if (shcKeys.length > 0) {
  3844. for (var i = 0; i < shcKeys.length; i++) {
  3845. var key = Str_1.Str.Trim(shcKeys[i].toUpperCase());
  3846. switch (key) {
  3847. case "CONTROL":
  3848. case "CONTROLKEY":
  3849. case "CTRL":
  3850. isCtrlKey = true;
  3851. break;
  3852. case "SHIFT":
  3853. case "SHIFTKEY":
  3854. isShiftKey = true;
  3855. break;
  3856. case "ALT":
  3857. isAltKey = true;
  3858. break;
  3859. case "CMD":
  3860. isMetaKey = true;
  3861. break;
  3862. case "F1":
  3863. keyCode = KeyCode_1.KeyCode.F1;
  3864. break;
  3865. case "F2":
  3866. keyCode = KeyCode_1.KeyCode.F2;
  3867. break;
  3868. case "F3":
  3869. keyCode = KeyCode_1.KeyCode.F3;
  3870. break;
  3871. case "F4":
  3872. keyCode = KeyCode_1.KeyCode.F4;
  3873. break;
  3874. case "F5":
  3875. keyCode = KeyCode_1.KeyCode.F5;
  3876. break;
  3877. case "F6":
  3878. keyCode = KeyCode_1.KeyCode.F6;
  3879. break;
  3880. case "F7":
  3881. keyCode = KeyCode_1.KeyCode.F7;
  3882. break;
  3883. case "F8":
  3884. keyCode = KeyCode_1.KeyCode.F8;
  3885. break;
  3886. case "F9":
  3887. keyCode = KeyCode_1.KeyCode.F9;
  3888. break;
  3889. case "F10":
  3890. keyCode = KeyCode_1.KeyCode.F10;
  3891. break;
  3892. case "F11":
  3893. keyCode = KeyCode_1.KeyCode.F11;
  3894. break;
  3895. case "F12":
  3896. keyCode = KeyCode_1.KeyCode.F12;
  3897. break;
  3898. case "RETURN":
  3899. case "ENTER":
  3900. keyCode = KeyCode_1.KeyCode.Enter;
  3901. break;
  3902. case "HOME":
  3903. keyCode = KeyCode_1.KeyCode.Home;
  3904. break;
  3905. case "END":
  3906. keyCode = KeyCode_1.KeyCode.End;
  3907. break;
  3908. case "LEFT":
  3909. keyCode = KeyCode_1.KeyCode.Left;
  3910. break;
  3911. case "RIGHT":
  3912. keyCode = KeyCode_1.KeyCode.Right;
  3913. break;
  3914. case "UP":
  3915. keyCode = KeyCode_1.KeyCode.Up;
  3916. break;
  3917. case "DOWN":
  3918. keyCode = KeyCode_1.KeyCode.Down;
  3919. break;
  3920. case "PAGEUP":
  3921. keyCode = KeyCode_1.KeyCode.PageUp;
  3922. break;
  3923. case "PAGEDOWN":
  3924. keyCode = KeyCode_1.KeyCode.PageDown;
  3925. break;
  3926. case "SPACE":
  3927. keyCode = KeyCode_1.KeyCode.Space;
  3928. break;
  3929. case "TAB":
  3930. keyCode = KeyCode_1.KeyCode.Tab;
  3931. break;
  3932. case "BACKSPACE":
  3933. case "BACK":
  3934. keyCode = KeyCode_1.KeyCode.Backspace;
  3935. break;
  3936. case "CONTEXT":
  3937. keyCode = KeyCode_1.KeyCode.ContextMenu;
  3938. break;
  3939. case "ESCAPE":
  3940. case "ESC":
  3941. keyCode = KeyCode_1.KeyCode.Esc;
  3942. break;
  3943. case "DELETE":
  3944. case "DEL":
  3945. keyCode = KeyCode_1.KeyCode.Delete;
  3946. break;
  3947. case "INSERT":
  3948. case "INS":
  3949. keyCode = KeyCode_1.KeyCode.Insert;
  3950. break;
  3951. case "PLUS":
  3952. keyCode = "+".charCodeAt(0);
  3953. break;
  3954. default:
  3955. keyCode = key.charCodeAt(0);
  3956. break;
  3957. }
  3958. }
  3959. }
  3960. else
  3961. ShowErrorAlert("Invalid shortcut");
  3962. return GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey);
  3963. }
  3964. exports.ParseShortcutString = ParseShortcutString;
  3965. function ShowErrorAlert(message) {
  3966. message = Str_1.Str.DecodeHtmlViaTextArea(message);
  3967. if (IsExists(message) && message !== "")
  3968. alert(message);
  3969. }
  3970. exports.ShowErrorAlert = ShowErrorAlert;
  3971. ;
  3972. function GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey) {
  3973. var value = keyCode;
  3974. value |= isCtrlKey ? KeyCode_1.ModifierKey.Ctrl : 0;
  3975. value |= isShiftKey ? KeyCode_1.ModifierKey.Shift : 0;
  3976. value |= isAltKey ? KeyCode_1.ModifierKey.Alt : 0;
  3977. value |= isMetaKey ? KeyCode_1.ModifierKey.Meta : 0;
  3978. return value;
  3979. }
  3980. exports.GetShortcutCode = GetShortcutCode;
  3981. ;
  3982. function GetShortcutCodeByEvent(evt) {
  3983. return GetShortcutCode(Evt_1.Evt.GetKeyCode(evt), evt.ctrlKey, evt.shiftKey, evt.altKey, Browser_1.Browser.MacOSPlatform ? evt.metaKey : false);
  3984. }
  3985. exports.GetShortcutCodeByEvent = GetShortcutCodeByEvent;
  3986. ;
  3987. /***/ }),
  3988. /* 20 */
  3989. /***/ (function(module, exports, __webpack_require__) {
  3990. "use strict";
  3991. Object.defineProperty(exports, "__esModule", { value: true });
  3992. var Browser = /** @class */ (function () {
  3993. function Browser() {
  3994. }
  3995. Browser.IdentUserAgent = function (userAgent, ignoreDocumentMode) {
  3996. if (ignoreDocumentMode === void 0) { ignoreDocumentMode = false; }
  3997. var browserTypesOrderedList = ["Mozilla", "IE", "Firefox", "Netscape", "Safari", "Chrome", "Opera", "Opera10", "Edge"];
  3998. var defaultBrowserType = "IE";
  3999. var defaultPlatform = "Win";
  4000. var defaultVersions = { Safari: 2, Chrome: 0.1, Mozilla: 1.9, Netscape: 8, Firefox: 2, Opera: 9, IE: 6, Edge: 12 };
  4001. if (!userAgent || userAgent.length == 0) {
  4002. Browser.fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
  4003. return;
  4004. }
  4005. userAgent = userAgent.toLowerCase();
  4006. Browser.indentPlatformMajorVersion(userAgent);
  4007. try {
  4008. var platformIdentStrings = {
  4009. "Windows": "Win",
  4010. "Macintosh": "Mac",
  4011. "Mac OS": "Mac",
  4012. "Mac_PowerPC": "Mac",
  4013. "cpu os": "MacMobile",
  4014. "cpu iphone os": "MacMobile",
  4015. "Android": "Android",
  4016. "!Windows Phone": "WinPhone",
  4017. "!WPDesktop": "WinPhone",
  4018. "!ZuneWP": "WinPhone"
  4019. };
  4020. var optSlashOrSpace = "(?:/|\\s*)?";
  4021. var versionString = "(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)0*?)?";
  4022. var optVersion = "(?:" + versionString + ")?";
  4023. var patterns = {
  4024. Safari: "applewebkit(?:.*?(?:version/" + versionString + "[\\.\\w\\d]*?(?:\\s+mobile\/\\S*)?\\s+safari))?",
  4025. Chrome: "(?:chrome|crios)(?!frame)" + optSlashOrSpace + optVersion,
  4026. Mozilla: "mozilla(?:.*rv:" + optVersion + ".*Gecko)?",
  4027. Netscape: "(?:netscape|navigator)\\d*/?\\s*" + optVersion,
  4028. Firefox: "firefox" + optSlashOrSpace + optVersion,
  4029. Opera: "(?:opera|\sopr)" + optSlashOrSpace + optVersion,
  4030. Opera10: "opera.*\\s*version" + optSlashOrSpace + optVersion,
  4031. IE: "msie\\s*" + optVersion,
  4032. Edge: "edge" + optSlashOrSpace + optVersion
  4033. };
  4034. var browserType;
  4035. var version = -1;
  4036. for (var i = 0; i < browserTypesOrderedList.length; i++) {
  4037. var browserTypeCandidate = browserTypesOrderedList[i];
  4038. var regExp = new RegExp(patterns[browserTypeCandidate], "i");
  4039. if (regExp.compile)
  4040. regExp.compile(patterns[browserTypeCandidate], "i");
  4041. var matches = regExp.exec(userAgent);
  4042. if (matches && matches.index >= 0) {
  4043. if (browserType == "IE" && version >= 11 && browserTypeCandidate == "Safari") // WinPhone8.1 update
  4044. continue;
  4045. browserType = browserTypeCandidate;
  4046. if (browserType == "Opera10")
  4047. browserType = "Opera";
  4048. var tridentPattern = "trident" + optSlashOrSpace + optVersion;
  4049. version = Browser.GetBrowserVersion(userAgent, matches, tridentPattern, Browser.getIECompatibleVersionString());
  4050. if (browserType == "Mozilla" && version >= 11)
  4051. browserType = "IE";
  4052. }
  4053. }
  4054. if (!browserType)
  4055. browserType = defaultBrowserType;
  4056. var browserVersionDetected = version != -1;
  4057. if (!browserVersionDetected)
  4058. version = defaultVersions[browserType];
  4059. var platform;
  4060. var minOccurenceIndex = Number.MAX_VALUE;
  4061. for (var identStr in platformIdentStrings) {
  4062. if (!platformIdentStrings.hasOwnProperty(identStr))
  4063. continue;
  4064. var importantIdent = identStr.substr(0, 1) == "!";
  4065. var occurenceIndex = userAgent.indexOf((importantIdent ? identStr.substr(1) : identStr).toLowerCase());
  4066. if (occurenceIndex >= 0 && (occurenceIndex < minOccurenceIndex || importantIdent)) {
  4067. minOccurenceIndex = importantIdent ? 0 : occurenceIndex;
  4068. platform = platformIdentStrings[identStr];
  4069. }
  4070. }
  4071. var samsungPattern = "SM-[A-Z]";
  4072. var m = userAgent.toUpperCase().match(samsungPattern);
  4073. var isSamsungAndroidDevice = m && m.length > 0;
  4074. if (platform == "WinPhone" && version < 9)
  4075. version = Math.floor(Browser.getVersionFromTrident(userAgent, "trident" + optSlashOrSpace + optVersion));
  4076. if (!ignoreDocumentMode && browserType == "IE" && version > 7 && document.documentMode < version)
  4077. version = document.documentMode;
  4078. if (platform == "WinPhone")
  4079. version = Math.max(9, version);
  4080. if (!platform)
  4081. platform = defaultPlatform;
  4082. if (platform == platformIdentStrings["cpu os"] && !browserVersionDetected) // Terra browser
  4083. version = 4;
  4084. Browser.fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice);
  4085. }
  4086. catch (e) {
  4087. Browser.fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
  4088. }
  4089. };
  4090. Browser.GetBrowserVersion = function (userAgent, matches, tridentPattern, ieCompatibleVersionString) {
  4091. var version = Browser.getVersionFromMatches(matches);
  4092. if (ieCompatibleVersionString) {
  4093. var versionFromTrident = Browser.getVersionFromTrident(userAgent, tridentPattern);
  4094. if (ieCompatibleVersionString === "edge" || parseInt(ieCompatibleVersionString) === versionFromTrident)
  4095. return versionFromTrident;
  4096. }
  4097. return version;
  4098. };
  4099. Browser.getIECompatibleVersionString = function () {
  4100. if (document.compatible) {
  4101. for (var i = 0; i < document.compatible.length; i++)
  4102. if (document.compatible[i].userAgent === "IE" && document.compatible[i].version)
  4103. return document.compatible[i].version.toLowerCase();
  4104. }
  4105. return "";
  4106. };
  4107. Browser.fillUserAgentInfo = function (browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice) {
  4108. if (isSamsungAndroidDevice === void 0) { isSamsungAndroidDevice = false; }
  4109. for (var i = 0; i < browserTypesOrderedList.length; i++) {
  4110. var type = browserTypesOrderedList[i];
  4111. Browser[type] = type == browserType;
  4112. }
  4113. Browser.Version = Math.floor(10.0 * version) / 10.0;
  4114. Browser.MajorVersion = Math.floor(Browser.Version);
  4115. Browser.WindowsPlatform = platform == "Win" || platform == "WinPhone";
  4116. Browser.MacOSPlatform = platform == "Mac";
  4117. Browser.MacOSMobilePlatform = platform == "MacMobile";
  4118. Browser.AndroidMobilePlatform = platform == "Android";
  4119. Browser.WindowsPhonePlatform = platform == "WinPhone";
  4120. Browser.WebKitFamily = Browser.Safari || Browser.Chrome || Browser.Opera && Browser.MajorVersion >= 15;
  4121. Browser.NetscapeFamily = Browser.Netscape || Browser.Mozilla || Browser.Firefox;
  4122. Browser.HardwareAcceleration = (Browser.IE && Browser.MajorVersion >= 9) || (Browser.Firefox && Browser.MajorVersion >= 4) ||
  4123. (Browser.AndroidMobilePlatform && Browser.Chrome) || (Browser.Chrome && Browser.MajorVersion >= 37) ||
  4124. (Browser.Safari && !Browser.WindowsPlatform) || Browser.Edge || (Browser.Opera && Browser.MajorVersion >= 46);
  4125. Browser.WebKitTouchUI = Browser.MacOSMobilePlatform || Browser.AndroidMobilePlatform;
  4126. var isIETouchUI = Browser.IE && Browser.MajorVersion > 9 && Browser.WindowsPlatform && Browser.UserAgent.toLowerCase().indexOf("touch") >= 0;
  4127. Browser.MSTouchUI = isIETouchUI || (Browser.Edge && !!window.navigator.maxTouchPoints);
  4128. Browser.TouchUI = Browser.WebKitTouchUI || Browser.MSTouchUI;
  4129. Browser.MobileUI = Browser.WebKitTouchUI || Browser.WindowsPhonePlatform;
  4130. Browser.AndroidDefaultBrowser = Browser.AndroidMobilePlatform && !Browser.Chrome;
  4131. Browser.AndroidChromeBrowser = Browser.AndroidMobilePlatform && Browser.Chrome;
  4132. if (isSamsungAndroidDevice)
  4133. Browser.SamsungAndroidDevice = isSamsungAndroidDevice;
  4134. if (Browser.MSTouchUI) {
  4135. var isARMArchitecture = Browser.UserAgent.toLowerCase().indexOf("arm;") > -1;
  4136. Browser.VirtualKeyboardSupported = isARMArchitecture || Browser.WindowsPhonePlatform;
  4137. }
  4138. else {
  4139. Browser.VirtualKeyboardSupported = Browser.WebKitTouchUI;
  4140. }
  4141. Browser.fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList);
  4142. };
  4143. Browser.indentPlatformMajorVersion = function (userAgent) {
  4144. var regex = /(?:(?:windows nt|macintosh|mac os|cpu os|cpu iphone os|android|windows phone|linux) )(\d+)(?:[-0-9_.])*/;
  4145. var matches = regex.exec(userAgent);
  4146. if (matches)
  4147. Browser.PlaformMajorVersion = matches[1];
  4148. };
  4149. Browser.prototype.GetBrowserVersion = function (userAgent, matches, tridentPattern, ieCompatibleVersionString) {
  4150. var version = Browser.getVersionFromMatches(matches);
  4151. if (ieCompatibleVersionString) {
  4152. var versionFromTrident = Browser.getVersionFromTrident(userAgent, tridentPattern);
  4153. if (ieCompatibleVersionString === "edge" || parseInt(ieCompatibleVersionString) === versionFromTrident)
  4154. return versionFromTrident;
  4155. }
  4156. return version;
  4157. };
  4158. Browser.getVersionFromMatches = function (matches) {
  4159. var result = -1;
  4160. var versionStr = "";
  4161. if (matches[1]) {
  4162. versionStr += matches[1];
  4163. if (matches[2])
  4164. versionStr += "." + matches[2];
  4165. }
  4166. if (versionStr != "") {
  4167. result = parseFloat(versionStr);
  4168. if (isNaN(result))
  4169. result = -1;
  4170. }
  4171. return result;
  4172. };
  4173. Browser.getVersionFromTrident = function (userAgent, tridentPattern) {
  4174. var tridentDiffFromVersion = 4;
  4175. var matches = new RegExp(tridentPattern, "i").exec(userAgent);
  4176. return Browser.getVersionFromMatches(matches) + tridentDiffFromVersion;
  4177. };
  4178. Browser.fillDocumentElementBrowserTypeClassNames = function (browserTypesOrderedList) {
  4179. var documentElementClassName = "";
  4180. var browserTypeslist = browserTypesOrderedList.concat(["WindowsPlatform", "MacOSPlatform", "MacOSMobilePlatform", "AndroidMobilePlatform",
  4181. "WindowsPhonePlatform", "WebKitFamily", "WebKitTouchUI", "MSTouchUI", "TouchUI", "AndroidDefaultBrowser"]);
  4182. for (var i = 0; i < browserTypeslist.length; i++) {
  4183. var type = browserTypeslist[i];
  4184. if (Browser[type])
  4185. documentElementClassName += "dx" + type + " ";
  4186. }
  4187. documentElementClassName += "dxBrowserVersion-" + Browser.MajorVersion;
  4188. if (document && document.documentElement) {
  4189. if (document.documentElement.className != "")
  4190. documentElementClassName = " " + documentElementClassName;
  4191. document.documentElement.className += documentElementClassName;
  4192. Browser.Info = documentElementClassName;
  4193. }
  4194. };
  4195. Browser.UserAgent = window.navigator.userAgent.toLowerCase();
  4196. Browser._foo = Browser.IdentUserAgent(Browser.UserAgent); // to init
  4197. return Browser;
  4198. }());
  4199. exports.Browser = Browser;
  4200. /***/ }),
  4201. /* 21 */
  4202. /***/ (function(module, exports, __webpack_require__) {
  4203. "use strict";
  4204. Object.defineProperty(exports, "__esModule", { value: true });
  4205. var Shape_1 = __webpack_require__(9);
  4206. var Connector_1 = __webpack_require__(5);
  4207. var Utils_1 = __webpack_require__(0);
  4208. var UnitConverter_1 = __webpack_require__(13);
  4209. var ModelUtils_1 = __webpack_require__(8);
  4210. var DiagramUnit;
  4211. (function (DiagramUnit) {
  4212. DiagramUnit[DiagramUnit["In"] = 0] = "In";
  4213. DiagramUnit[DiagramUnit["Cm"] = 1] = "Cm";
  4214. DiagramUnit[DiagramUnit["Px"] = 2] = "Px";
  4215. })(DiagramUnit = exports.DiagramUnit || (exports.DiagramUnit = {}));
  4216. var DiagramModel = /** @class */ (function () {
  4217. function DiagramModel() {
  4218. this.items = [];
  4219. this.itemIndexByKey = {};
  4220. this.pageSize = new Utils_1.Size(8391, 11906);
  4221. this.pageLandscape = false;
  4222. this.pageColor = DiagramModel.defaultPageColor;
  4223. this.gridSize = 180;
  4224. this.showGrid = true;
  4225. this.snapToGrid = true;
  4226. this.units = DiagramUnit.Cm;
  4227. this.zoomLevel = 1;
  4228. this.size = this.pageSize.clone();
  4229. }
  4230. Object.defineProperty(DiagramModel.prototype, "pageWidth", {
  4231. get: function () {
  4232. return this.pageLandscape ? this.pageSize.height : this.pageSize.width;
  4233. },
  4234. enumerable: true,
  4235. configurable: true
  4236. });
  4237. Object.defineProperty(DiagramModel.prototype, "pageHeight", {
  4238. get: function () {
  4239. return this.pageLandscape ? this.pageSize.width : this.pageSize.height;
  4240. },
  4241. enumerable: true,
  4242. configurable: true
  4243. });
  4244. DiagramModel.prototype.getRectangle = function () {
  4245. return DiagramModel.getRectangle(this.items);
  4246. };
  4247. DiagramModel.getRectangle = function (items) {
  4248. return Utils_1.GeometryUtils.getCommonRectangle(items.map(function (i) { return i.rectangle; }));
  4249. };
  4250. DiagramModel.prototype.pushItem = function (item) {
  4251. var index = this.items.push(item);
  4252. this.itemIndexByKey[item.key] = index - 1;
  4253. };
  4254. DiagramModel.prototype.removeItem = function (item) {
  4255. var index = this.getItemIndex(item);
  4256. delete this.itemIndexByKey[item.key];
  4257. this.items.splice(index, 1);
  4258. this.updateIndicesHash(index);
  4259. };
  4260. DiagramModel.prototype.reorderItem = function (item, newIndex) {
  4261. var oldIndex = this.getItemIndex(item);
  4262. this.items.splice(oldIndex, 1);
  4263. this.items.splice(newIndex, 0, item);
  4264. this.updateIndicesHash(Math.min(oldIndex, newIndex));
  4265. };
  4266. DiagramModel.prototype.updateIndicesHash = function (startIndex) {
  4267. for (var i = startIndex; i < this.items.length; i++)
  4268. this.itemIndexByKey[this.items[i].key] = i;
  4269. };
  4270. DiagramModel.prototype.getItemIndex = function (item) {
  4271. return this.itemIndexByKey[item.key];
  4272. };
  4273. DiagramModel.prototype.findShape = function (key) {
  4274. var shape = this.findItem(key);
  4275. return shape instanceof Shape_1.Shape ? shape : undefined;
  4276. };
  4277. DiagramModel.prototype.findShapeCore = function (callback) {
  4278. var shape;
  4279. this.items.forEach(function (item) {
  4280. if (item instanceof Shape_1.Shape) {
  4281. if (callback(item)) {
  4282. shape = item;
  4283. return;
  4284. }
  4285. }
  4286. });
  4287. return shape;
  4288. };
  4289. DiagramModel.prototype.findShapeAtPosition = function (position) {
  4290. return this.findShapeCore(function (shape) { return shape.position.equals(position); });
  4291. };
  4292. DiagramModel.prototype.findShapeByDataKey = function (key) {
  4293. return this.findShapeCore(function (shape) { return shape.dataKey === key; });
  4294. };
  4295. DiagramModel.prototype.findConnector = function (key) {
  4296. var connector = this.findItem(key);
  4297. return connector instanceof Connector_1.Connector ? connector : undefined;
  4298. };
  4299. DiagramModel.prototype.findConnectorCore = function (callback) {
  4300. var connector;
  4301. this.items.forEach(function (item) {
  4302. if (item instanceof Connector_1.Connector) {
  4303. if (callback(item)) {
  4304. connector = item;
  4305. return;
  4306. }
  4307. }
  4308. });
  4309. return connector;
  4310. };
  4311. DiagramModel.prototype.findConnectorAtPoints = function (points) {
  4312. return this.findConnectorCore(function (connector) { return Utils_1.GeometryUtils.arePointsEqual(connector.points, points); });
  4313. };
  4314. DiagramModel.prototype.findConnectorByDataKey = function (key) {
  4315. return this.findConnectorCore(function (connector) { return connector.dataKey === key; });
  4316. };
  4317. DiagramModel.prototype.findItem = function (key) {
  4318. return this.items[this.itemIndexByKey[key]];
  4319. };
  4320. DiagramModel.isIntersectedItems = function (item1, item2) {
  4321. var result = false;
  4322. if (item1 instanceof Shape_1.Shape)
  4323. result = item2.intersectedByRect(item1.rectangle);
  4324. else if (item1 instanceof Connector_1.Connector) {
  4325. item1.getSegments().forEach(function (s1) {
  4326. if (item2 instanceof Shape_1.Shape)
  4327. result = result || s1.intersectRect(item2.rectangle);
  4328. else if (item2 instanceof Connector_1.Connector) {
  4329. item2.getSegments().forEach(function (s2) {
  4330. result = result || s1.intersect(s2);
  4331. });
  4332. }
  4333. });
  4334. }
  4335. return result;
  4336. };
  4337. DiagramModel.prototype.getIntersectItems = function (item) {
  4338. var result = [];
  4339. this.items.forEach(function (i) {
  4340. if (item !== i && (!(i instanceof Connector_1.Connector) || item.attachedConnectors.indexOf(i) === -1) &&
  4341. DiagramModel.isIntersectedItems(i, item))
  4342. result.push(i);
  4343. });
  4344. return result;
  4345. };
  4346. DiagramModel.prototype.getIntersectItemsMinZIndex = function (item) {
  4347. var items = this.getIntersectItems(item);
  4348. return items.map(function (i) { return i.zIndex; }).reduce(function (prev, cur) { return Math.min(prev, cur); }, Number.MAX_VALUE);
  4349. };
  4350. DiagramModel.prototype.getIntersectItemsMaxZIndex = function (item) {
  4351. var items = this.getIntersectItems(item);
  4352. return items.map(function (i) { return i.zIndex; }).reduce(function (prev, cur) { return Math.max(prev, cur); }, -Number.MAX_VALUE);
  4353. };
  4354. DiagramModel.prototype.iterateItems = function (callback) {
  4355. this.items.forEach(callback);
  4356. };
  4357. DiagramModel.prototype.invalidateItems = function () {
  4358. this.iterateItems(function (item) {
  4359. item.invalidatePrimitives();
  4360. if (item instanceof Connector_1.Connector)
  4361. item.invalidateRenderPoints();
  4362. });
  4363. };
  4364. DiagramModel.prototype.getNextKey = function (baseKey) {
  4365. var _this = this;
  4366. return ModelUtils_1.ModelUtils.getNextItemKey(this.items.map(function (item) { return item.key; }), function (key) { return _this.itemIndexByKey[key] === undefined; }, baseKey);
  4367. };
  4368. DiagramModel.prototype.getModelUnit = function (twipsValue) {
  4369. switch (this.units) {
  4370. case DiagramUnit.Cm:
  4371. return UnitConverter_1.UnitConverter.twipsToCentimeters(twipsValue);
  4372. case DiagramUnit.In:
  4373. return UnitConverter_1.UnitConverter.twipsToInches(twipsValue);
  4374. case DiagramUnit.Px:
  4375. return UnitConverter_1.UnitConverter.twipsToPixels(twipsValue);
  4376. }
  4377. };
  4378. DiagramModel.prototype.getModelUnitText = function (twipsValue, fractionDigits) {
  4379. if (fractionDigits === void 0) { fractionDigits = 2; }
  4380. switch (this.units) {
  4381. case DiagramUnit.Cm:
  4382. return +this.getModelUnit(twipsValue).toFixed(fractionDigits) + " cm";
  4383. case DiagramUnit.In:
  4384. return +this.getModelUnit(twipsValue).toFixed(fractionDigits) + " in";
  4385. case DiagramUnit.Px:
  4386. return this.getModelUnit(twipsValue).toFixed(0) + " px";
  4387. }
  4388. };
  4389. DiagramModel.prototype.getTwipsUnit = function (value) {
  4390. switch (this.units) {
  4391. case DiagramUnit.Cm:
  4392. return UnitConverter_1.UnitConverter.centimetersToTwips(value);
  4393. case DiagramUnit.In:
  4394. return UnitConverter_1.UnitConverter.inchesToTwips(value);
  4395. case DiagramUnit.Px:
  4396. return UnitConverter_1.UnitConverter.pixelsToTwips(value);
  4397. }
  4398. };
  4399. DiagramModel.defaultPageColor = "white";
  4400. return DiagramModel;
  4401. }());
  4402. exports.DiagramModel = DiagramModel;
  4403. /***/ }),
  4404. /* 22 */
  4405. /***/ (function(module, exports, __webpack_require__) {
  4406. "use strict";
  4407. Object.defineProperty(exports, "__esModule", { value: true });
  4408. var Edge = /** @class */ (function () {
  4409. function Edge(key, from, to, weight) {
  4410. if (weight === void 0) { weight = 1; }
  4411. this.weight = weight;
  4412. this.key = key;
  4413. this.from = from;
  4414. this.to = to;
  4415. }
  4416. Edge.prototype.getHashKey = function () {
  4417. return this.from + "_" + this.to;
  4418. };
  4419. Edge.prototype.reverse = function () {
  4420. return new Edge(this.key, this.to, this.from, this.weight);
  4421. };
  4422. return Edge;
  4423. }());
  4424. exports.Edge = Edge;
  4425. var PositionInfo = /** @class */ (function () {
  4426. function PositionInfo(item, position) {
  4427. this.item = item;
  4428. this.position = position;
  4429. }
  4430. return PositionInfo;
  4431. }());
  4432. exports.PositionInfo = PositionInfo;
  4433. var ConnectionMode;
  4434. (function (ConnectionMode) {
  4435. ConnectionMode[ConnectionMode["Outgoing"] = 1] = "Outgoing";
  4436. ConnectionMode[ConnectionMode["Incoming"] = 2] = "Incoming";
  4437. ConnectionMode[ConnectionMode["OutgoingAndIncoming"] = 3] = "OutgoingAndIncoming";
  4438. })(ConnectionMode = exports.ConnectionMode || (exports.ConnectionMode = {}));
  4439. /***/ }),
  4440. /* 23 */
  4441. /***/ (function(module, exports, __webpack_require__) {
  4442. "use strict";
  4443. var __extends = (this && this.__extends) || (function () {
  4444. var extendStatics = function (d, b) {
  4445. extendStatics = Object.setPrototypeOf ||
  4446. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4447. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  4448. return extendStatics(d, b);
  4449. };
  4450. return function (d, b) {
  4451. extendStatics(d, b);
  4452. function __() { this.constructor = d; }
  4453. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4454. };
  4455. })();
  4456. Object.defineProperty(exports, "__esModule", { value: true });
  4457. var CommandBase_1 = __webpack_require__(7);
  4458. var CommandStates_1 = __webpack_require__(6);
  4459. var ChangePagePropertyHistoryItem_1 = __webpack_require__(175);
  4460. var ModelUtils_1 = __webpack_require__(8);
  4461. var ChangePagePropertyCommand = /** @class */ (function (_super) {
  4462. __extends(ChangePagePropertyCommand, _super);
  4463. function ChangePagePropertyCommand() {
  4464. return _super !== null && _super.apply(this, arguments) || this;
  4465. }
  4466. ChangePagePropertyCommand.prototype.getState = function () {
  4467. return new CommandStates_1.SimpleCommandState(true, this.control.model[this.getPropertyName()], this.getPropertyOptions());
  4468. };
  4469. ChangePagePropertyCommand.prototype.executeCore = function (state, parameter) {
  4470. var _this = this;
  4471. this.control.history.beginTransaction();
  4472. var propertyName = this.getPropertyName();
  4473. var items = this.createHistoryItems(propertyName, parameter);
  4474. items.forEach(function (item) { _this.control.history.addAndRedo(item); });
  4475. ModelUtils_1.ModelUtils.tryUpdateModelSize(this.control.history, this.control.model);
  4476. this.control.history.endTransaction();
  4477. return true;
  4478. };
  4479. ChangePagePropertyCommand.prototype.createHistoryItems = function (propertyName, parameter) {
  4480. return [new ChangePagePropertyHistoryItem_1.ChangePagePropertyHistoryItem(propertyName, parameter)];
  4481. };
  4482. ChangePagePropertyCommand.prototype.getPropertyOptions = function () {
  4483. return null;
  4484. };
  4485. return ChangePagePropertyCommand;
  4486. }(CommandBase_1.CommandBase));
  4487. exports.ChangePagePropertyCommand = ChangePagePropertyCommand;
  4488. /***/ }),
  4489. /* 24 */
  4490. /***/ (function(module, exports, __webpack_require__) {
  4491. "use strict";
  4492. var __extends = (this && this.__extends) || (function () {
  4493. var extendStatics = function (d, b) {
  4494. extendStatics = Object.setPrototypeOf ||
  4495. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4496. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  4497. return extendStatics(d, b);
  4498. };
  4499. return function (d, b) {
  4500. extendStatics(d, b);
  4501. function __() { this.constructor = d; }
  4502. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4503. };
  4504. })();
  4505. Object.defineProperty(exports, "__esModule", { value: true });
  4506. var MouseHandlerStateBase_1 = __webpack_require__(45);
  4507. var Event_1 = __webpack_require__(14);
  4508. var MouseHandlerDraggingState = /** @class */ (function (_super) {
  4509. __extends(MouseHandlerDraggingState, _super);
  4510. function MouseHandlerDraggingState(handler, history) {
  4511. var _this = _super.call(this, handler) || this;
  4512. _this.history = history;
  4513. return _this;
  4514. }
  4515. MouseHandlerDraggingState.prototype.onMouseMove = function (evt) {
  4516. if (evt.button !== Event_1.MouseButton.Left) {
  4517. this.cancelChanges();
  4518. this.handler.switchToDefaultState();
  4519. }
  4520. else {
  4521. this.onApplyChanges(evt);
  4522. if (!this.modified)
  4523. this.handler.raiseDragStart(this.getDraggingElementKeys());
  4524. this.modified = true;
  4525. }
  4526. };
  4527. MouseHandlerDraggingState.prototype.cancelChanges = function () {
  4528. this.history.undoTransaction();
  4529. this.modified = false;
  4530. };
  4531. MouseHandlerDraggingState.prototype.onMouseUp = function (evt) {
  4532. this.handler.switchToDefaultState();
  4533. };
  4534. MouseHandlerDraggingState.prototype.start = function () {
  4535. this.history.beginTransaction();
  4536. };
  4537. MouseHandlerDraggingState.prototype.finish = function () {
  4538. if (this.modified) {
  4539. this.onFinishWithChanges();
  4540. this.modified = false;
  4541. this.history.endTransaction();
  4542. this.handler.raiseDragEnd(this.getDraggingElementKeys());
  4543. }
  4544. else
  4545. this.history.endTransaction();
  4546. };
  4547. MouseHandlerDraggingState.prototype.onFinishWithChanges = function () { };
  4548. MouseHandlerDraggingState.prototype.getSnappedPoint = function (evt, point) {
  4549. return this.handler.getSnappedPoint(evt, point);
  4550. };
  4551. return MouseHandlerDraggingState;
  4552. }(MouseHandlerStateBase_1.MouseHandlerCancellableState));
  4553. exports.MouseHandlerDraggingState = MouseHandlerDraggingState;
  4554. /***/ }),
  4555. /* 25 */
  4556. /***/ (function(module, exports, __webpack_require__) {
  4557. "use strict";
  4558. Object.defineProperty(exports, "__esModule", { value: true });
  4559. var ShapeParameter = /** @class */ (function () {
  4560. function ShapeParameter(key, value) {
  4561. this.key = key;
  4562. this.value = value;
  4563. }
  4564. return ShapeParameter;
  4565. }());
  4566. exports.ShapeParameter = ShapeParameter;
  4567. var ShapeParameters = /** @class */ (function () {
  4568. function ShapeParameters() {
  4569. this.items = {};
  4570. }
  4571. ShapeParameters.prototype.add = function (parameter) {
  4572. this.items[parameter.key] = parameter;
  4573. };
  4574. ShapeParameters.prototype.addRange = function (parameters) {
  4575. for (var i = 0; i < parameters.length; i++)
  4576. this.add(parameters[i]);
  4577. };
  4578. ShapeParameters.prototype.get = function (key) {
  4579. return this.items[key];
  4580. };
  4581. ShapeParameters.prototype.forEach = function (callback) {
  4582. for (var key in this.items)
  4583. if (this.items.hasOwnProperty(key))
  4584. callback(this.items[key]);
  4585. };
  4586. ShapeParameters.prototype.clone = function () {
  4587. var result = new ShapeParameters();
  4588. this.forEach(function (p) { result.add(new ShapeParameter(p.key, p.value)); });
  4589. return result;
  4590. };
  4591. ShapeParameters.prototype.toObject = function () {
  4592. var result = {};
  4593. var modified = false;
  4594. this.forEach(function (p) {
  4595. result[p.key] = { 'value': p.value };
  4596. modified = true;
  4597. });
  4598. return modified ? result : null;
  4599. };
  4600. ShapeParameters.prototype.fromObject = function (obj) {
  4601. this.forEach(function (p) {
  4602. var paramObj = obj[p.key];
  4603. if (paramObj) {
  4604. if (typeof paramObj["value"] === "number")
  4605. p.value = paramObj["value"];
  4606. }
  4607. });
  4608. };
  4609. return ShapeParameters;
  4610. }());
  4611. exports.ShapeParameters = ShapeParameters;
  4612. /***/ }),
  4613. /* 26 */
  4614. /***/ (function(module, exports, __webpack_require__) {
  4615. "use strict";
  4616. Object.defineProperty(exports, "__esModule", { value: true });
  4617. var Event_1 = __webpack_require__(14);
  4618. var __1 = __webpack_require__(46);
  4619. var Utils_1 = __webpack_require__(0);
  4620. var Base_1 = __webpack_require__(19);
  4621. var RenderUtils = /** @class */ (function () {
  4622. function RenderUtils() {
  4623. }
  4624. RenderUtils.updateSvgElementSize = function (svgElement, width, height) {
  4625. svgElement.style.width = width + "px";
  4626. svgElement.style.height = height + "px";
  4627. svgElement.setAttribute("viewBox", "0 0 " + width + " " + height);
  4628. };
  4629. RenderUtils.removeContent = function (element) {
  4630. while (element.firstChild)
  4631. element.removeChild(element.firstChild);
  4632. };
  4633. RenderUtils.setElementEventData = function (element, type, key, value) {
  4634. if (type === Event_1.MouseEventElementType.Undefined)
  4635. return;
  4636. element.setAttribute("data-type", type.toString());
  4637. if (key !== undefined)
  4638. element.setAttribute("data-key", key.toString());
  4639. if (value !== undefined)
  4640. element.setAttribute("data-value", value.toString());
  4641. };
  4642. RenderUtils.getElementEventData = function (element) {
  4643. if (element.getAttribute && element.getAttribute("data-type")) {
  4644. return new Event_1.MouseEventSource(parseInt(element.getAttribute("data-type")), element.getAttribute("data-key"), element.getAttribute("data-value"));
  4645. }
  4646. };
  4647. RenderUtils.getHtmlElementStylePropertyName = function (propertyName) {
  4648. switch (propertyName) {
  4649. case "fill":
  4650. return "color";
  4651. case "text-anchor":
  4652. return "text-align";
  4653. }
  4654. return propertyName;
  4655. };
  4656. RenderUtils.getStylePropertyValue = function (propertyName, propertyValue, reverseTextAnchor) {
  4657. if (reverseTextAnchor === void 0) { reverseTextAnchor = false; }
  4658. if (propertyName === "text-anchor" && reverseTextAnchor) {
  4659. if (propertyValue === "start")
  4660. return "end";
  4661. if (propertyValue === "end")
  4662. return "start";
  4663. }
  4664. return propertyValue;
  4665. };
  4666. RenderUtils.applyStyleToElement = function (style, element, reverseTextAnchor) {
  4667. var _this = this;
  4668. if (reverseTextAnchor === void 0) { reverseTextAnchor = false; }
  4669. var defaultStyle = style.getDefaultInstance();
  4670. style.forEach(function (propertyName) {
  4671. var propertyValue = style[propertyName];
  4672. var elPropertyName = (element instanceof HTMLElement) ? _this.getHtmlElementStylePropertyName(propertyName) : propertyName;
  4673. if (propertyValue !== undefined && propertyValue !== "" && propertyValue !== defaultStyle[propertyName])
  4674. element.style.setProperty(elPropertyName, _this.getStylePropertyValue(propertyName, propertyValue, reverseTextAnchor));
  4675. else
  4676. element.style.setProperty(elPropertyName, "");
  4677. });
  4678. };
  4679. RenderUtils.generateSvgElementId = function (prefix) {
  4680. return prefix + "_" + Base_1.CreateGuid();
  4681. };
  4682. RenderUtils.getSvgTextRectangle = function (textEl, lineWidth) {
  4683. if (lineWidth === void 0) { lineWidth = 0; }
  4684. var bBox;
  4685. try {
  4686. bBox = textEl.getBBox();
  4687. }
  4688. catch (_a) { } // TODO make measure in another way because of FF error
  4689. if (bBox) {
  4690. var x = __1.UnitConverter.pixelsToTwips(Math.round(bBox.x)) - lineWidth;
  4691. var y = __1.UnitConverter.pixelsToTwips(Math.round(bBox.y)) - lineWidth;
  4692. var width = __1.UnitConverter.pixelsToTwips(Math.round(bBox.width)) + 2 * lineWidth;
  4693. var height = __1.UnitConverter.pixelsToTwips(Math.round(bBox.height)) + 2 * lineWidth;
  4694. return Utils_1.Rectangle.create(x, y, width, height);
  4695. }
  4696. };
  4697. return RenderUtils;
  4698. }());
  4699. exports.RenderUtils = RenderUtils;
  4700. /***/ }),
  4701. /* 27 */
  4702. /***/ (function(module, exports, __webpack_require__) {
  4703. "use strict";
  4704. var __extends = (this && this.__extends) || (function () {
  4705. var extendStatics = function (d, b) {
  4706. extendStatics = Object.setPrototypeOf ||
  4707. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4708. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  4709. return extendStatics(d, b);
  4710. };
  4711. return function (d, b) {
  4712. extendStatics(d, b);
  4713. function __() { this.constructor = d; }
  4714. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4715. };
  4716. })();
  4717. Object.defineProperty(exports, "__esModule", { value: true });
  4718. var Utils_1 = __webpack_require__(0);
  4719. var ConnectorRenderPoint = /** @class */ (function (_super) {
  4720. __extends(ConnectorRenderPoint, _super);
  4721. function ConnectorRenderPoint(x, y, pointIndex, skipped) {
  4722. if (pointIndex === void 0) { pointIndex = -1; }
  4723. if (skipped === void 0) { skipped = false; }
  4724. var _this = _super.call(this, x, y) || this;
  4725. _this.pointIndex = pointIndex;
  4726. _this.skipped = skipped;
  4727. return _this;
  4728. }
  4729. ConnectorRenderPoint.prototype.offset = function (offsetX, offsetY) {
  4730. if (offsetX === void 0) { offsetX = 0; }
  4731. if (offsetY === void 0) { offsetY = 0; }
  4732. return new ConnectorRenderPoint(this.x + offsetX, this.y + offsetY);
  4733. };
  4734. ConnectorRenderPoint.prototype.multiply = function (multiplierX, multiplierY) {
  4735. if (multiplierX === void 0) { multiplierX = 1; }
  4736. if (multiplierY === void 0) { multiplierY = multiplierX; }
  4737. return new ConnectorRenderPoint(this.x * multiplierX, this.y * multiplierY);
  4738. };
  4739. ConnectorRenderPoint.prototype.clone = function () { return new ConnectorRenderPoint(this.x, this.y, this.pointIndex); };
  4740. return ConnectorRenderPoint;
  4741. }(Utils_1.Point));
  4742. exports.ConnectorRenderPoint = ConnectorRenderPoint;
  4743. /***/ }),
  4744. /* 28 */
  4745. /***/ (function(module, exports, __webpack_require__) {
  4746. "use strict";
  4747. Object.defineProperty(exports, "__esModule", { value: true });
  4748. var ConnectorLineOption;
  4749. (function (ConnectorLineOption) {
  4750. ConnectorLineOption[ConnectorLineOption["Straight"] = 0] = "Straight";
  4751. ConnectorLineOption[ConnectorLineOption["Orthogonal"] = 1] = "Orthogonal";
  4752. })(ConnectorLineOption = exports.ConnectorLineOption || (exports.ConnectorLineOption = {}));
  4753. var ConnectorLineEnding;
  4754. (function (ConnectorLineEnding) {
  4755. ConnectorLineEnding[ConnectorLineEnding["None"] = 0] = "None";
  4756. ConnectorLineEnding[ConnectorLineEnding["Arrow"] = 1] = "Arrow";
  4757. })(ConnectorLineEnding = exports.ConnectorLineEnding || (exports.ConnectorLineEnding = {}));
  4758. var ConnectorProperties = /** @class */ (function () {
  4759. function ConnectorProperties() {
  4760. this.lineOption = ConnectorLineOption.Orthogonal;
  4761. this.startLineEnding = ConnectorLineEnding.None;
  4762. this.endLineEnding = ConnectorLineEnding.Arrow;
  4763. }
  4764. ConnectorProperties.prototype.clone = function () {
  4765. var clone = new ConnectorProperties();
  4766. clone.lineOption = this.lineOption;
  4767. clone.startLineEnding = this.startLineEnding;
  4768. clone.endLineEnding = this.endLineEnding;
  4769. return clone;
  4770. };
  4771. ConnectorProperties.prototype.forEach = function (callback) {
  4772. for (var propertyName in this) {
  4773. if (this.hasOwnProperty(propertyName))
  4774. callback(propertyName);
  4775. }
  4776. };
  4777. ConnectorProperties.prototype.toObject = function () {
  4778. var result = {};
  4779. var modified = false;
  4780. if (this.lineOption !== ConnectorLineOption.Orthogonal) {
  4781. result["lineOption"] = this.lineOption;
  4782. modified = true;
  4783. }
  4784. if (this.startLineEnding !== ConnectorLineEnding.None) {
  4785. result["startLineEnding"] = this.startLineEnding;
  4786. modified = true;
  4787. }
  4788. if (this.endLineEnding !== ConnectorLineEnding.Arrow) {
  4789. result["endLineEnding"] = this.endLineEnding;
  4790. modified = true;
  4791. }
  4792. return modified ? result : null;
  4793. };
  4794. ConnectorProperties.prototype.fromObject = function (obj) {
  4795. if (typeof obj["lineOption"] === "number")
  4796. this.lineOption = obj["lineOption"];
  4797. if (typeof obj["startLineEnding"] === "number")
  4798. this.startLineEnding = obj["startLineEnding"];
  4799. if (typeof obj["endLineEnding"] === "number")
  4800. this.endLineEnding = obj["endLineEnding"];
  4801. };
  4802. return ConnectorProperties;
  4803. }());
  4804. exports.ConnectorProperties = ConnectorProperties;
  4805. /***/ }),
  4806. /* 29 */
  4807. /***/ (function(module, exports, __webpack_require__) {
  4808. "use strict";
  4809. var __extends = (this && this.__extends) || (function () {
  4810. var extendStatics = function (d, b) {
  4811. extendStatics = Object.setPrototypeOf ||
  4812. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4813. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  4814. return extendStatics(d, b);
  4815. };
  4816. return function (d, b) {
  4817. extendStatics(d, b);
  4818. function __() { this.constructor = d; }
  4819. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4820. };
  4821. })();
  4822. Object.defineProperty(exports, "__esModule", { value: true });
  4823. var HistoryItem_1 = __webpack_require__(4);
  4824. var SetSelectionHistoryItem = /** @class */ (function (_super) {
  4825. __extends(SetSelectionHistoryItem, _super);
  4826. function SetSelectionHistoryItem(selection, selectedKeys) {
  4827. var _this = _super.call(this) || this;
  4828. _this.selectedKeys = selectedKeys;
  4829. _this.selection = selection;
  4830. return _this;
  4831. }
  4832. SetSelectionHistoryItem.prototype.redo = function () {
  4833. this.oldSelection = this.selection.getKeys().slice(0);
  4834. this.selection.set(this.selectedKeys);
  4835. };
  4836. SetSelectionHistoryItem.prototype.undo = function () {
  4837. this.selection.set(this.oldSelection);
  4838. };
  4839. return SetSelectionHistoryItem;
  4840. }(HistoryItem_1.HistoryItem));
  4841. exports.SetSelectionHistoryItem = SetSelectionHistoryItem;
  4842. /***/ }),
  4843. /* 30 */
  4844. /***/ (function(module, exports, __webpack_require__) {
  4845. "use strict";
  4846. Object.defineProperty(exports, "__esModule", { value: true });
  4847. var ShapeType_1 = __webpack_require__(1);
  4848. var ProcessShapeDescription_1 = __webpack_require__(120);
  4849. var DecisionShapeDescription_1 = __webpack_require__(121);
  4850. var ManualInputShapeDescription_1 = __webpack_require__(122);
  4851. var DataShapeDescription_1 = __webpack_require__(123);
  4852. var TerminatorShapeDescription_1 = __webpack_require__(124);
  4853. var PredefinedProcessShapeDescription_1 = __webpack_require__(125);
  4854. var ArrowNorthSouthShapeDescription_1 = __webpack_require__(126);
  4855. var ArrowRightShapeDescription_1 = __webpack_require__(127);
  4856. var ArrowTopShapeDescription_1 = __webpack_require__(128);
  4857. var CrossShapeDescription_1 = __webpack_require__(129);
  4858. var DiamondShapeDescription_1 = __webpack_require__(75);
  4859. var EllipseShapeDescription_1 = __webpack_require__(56);
  4860. var HeartShapeDescription_1 = __webpack_require__(130);
  4861. var RectangleShapeDescription_1 = __webpack_require__(12);
  4862. var TextShapeDescription_1 = __webpack_require__(76);
  4863. var PentagonShapeDescription_1 = __webpack_require__(77);
  4864. var HexagonShapeDescription_1 = __webpack_require__(78);
  4865. var OctagonShapeDescription_1 = __webpack_require__(131);
  4866. var StarShapeDescription_1 = __webpack_require__(132);
  4867. var ArrowBottomShapeDescription_1 = __webpack_require__(133);
  4868. var ArrowEastWestShapeDescription_1 = __webpack_require__(134);
  4869. var ArrowLeftShapeDescription_1 = __webpack_require__(135);
  4870. var TriangleShapeDescription_1 = __webpack_require__(79);
  4871. var DocumentShapeDescription_1 = __webpack_require__(80);
  4872. var MultipleDocumentsShapeDescription_1 = __webpack_require__(136);
  4873. var PreparationShapeDescription_1 = __webpack_require__(137);
  4874. var HardDiskShapeDescription_1 = __webpack_require__(138);
  4875. var DatabaseShapeDescription_1 = __webpack_require__(139);
  4876. var InternalStorageShapeDescription_1 = __webpack_require__(140);
  4877. var PaperTapeShapeDescription_1 = __webpack_require__(141);
  4878. var ManualOperationShapeDescription_1 = __webpack_require__(142);
  4879. var DelayShapeDescription_1 = __webpack_require__(143);
  4880. var StoredDataShapeDescription_1 = __webpack_require__(144);
  4881. var MergeShapeDescription_1 = __webpack_require__(145);
  4882. var DisplayShapeDescription_1 = __webpack_require__(146);
  4883. var OrShapeDescription_1 = __webpack_require__(147);
  4884. var SummingJunctionShapeDescription_1 = __webpack_require__(148);
  4885. var CustomShapeDescription_1 = __webpack_require__(149);
  4886. var ShapeDescriptionManager = /** @class */ (function () {
  4887. function ShapeDescriptionManager() {
  4888. }
  4889. ShapeDescriptionManager.get = function (type) {
  4890. return this.descriptions[type];
  4891. };
  4892. ShapeDescriptionManager.getTypesByCategory = function (category) {
  4893. var result = [];
  4894. for (var key in this.descriptions) {
  4895. if (ShapeDescriptionManager.descriptions.hasOwnProperty(key)) {
  4896. if (!category || this.descriptions[key].category === category)
  4897. result.push(parseInt(key));
  4898. }
  4899. }
  4900. return result;
  4901. };
  4902. ShapeDescriptionManager.register = function (description) {
  4903. if (this.descriptions[description.key] !== undefined)
  4904. throw Error("Description key is duplicated");
  4905. this.descriptions[description.key] = description;
  4906. };
  4907. ShapeDescriptionManager.unregister = function (shapeType) {
  4908. delete this.descriptions[shapeType];
  4909. };
  4910. ShapeDescriptionManager.registerCustomShape = function (shape) {
  4911. if (shape.id === undefined)
  4912. throw Error("Custom shape id is not defined");
  4913. if (this.descriptions[ShapeType_1.ShapeType.Custom + shape.id] !== undefined)
  4914. throw Error("Custom shape id is duplicated");
  4915. this.register(new CustomShapeDescription_1.CustomShapeDescription(ShapeType_1.ShapeType.Custom + shape.id, shape.title, shape.svgUrl, shape.svgLeft, shape.svgTop, shape.svgWidth, shape.svgHeight, shape.defaultWidth, shape.defaultHeight, shape.defaultText, shape.allowHasText, shape.textLeft, shape.textTop, shape.textWidth, shape.textHeight, shape.connectionPoints, shape.category));
  4916. };
  4917. ShapeDescriptionManager.unregisterCustomShape = function (id) {
  4918. this.unregister(ShapeType_1.ShapeType.Custom + id);
  4919. };
  4920. ShapeDescriptionManager.descriptions = {};
  4921. return ShapeDescriptionManager;
  4922. }());
  4923. exports.ShapeDescriptionManager = ShapeDescriptionManager;
  4924. ShapeDescriptionManager.register(new ArrowBottomShapeDescription_1.ArrowBottomShapeDescription());
  4925. ShapeDescriptionManager.register(new ArrowEastWestShapeDescription_1.ArrowEastWestShapeDescription());
  4926. ShapeDescriptionManager.register(new ArrowLeftShapeDescription_1.ArrowLeftShapeDescription());
  4927. ShapeDescriptionManager.register(new ArrowNorthSouthShapeDescription_1.ArrowNorthSouthShapeDescription());
  4928. ShapeDescriptionManager.register(new ArrowRightShapeDescription_1.ArrowRightShapeDescription());
  4929. ShapeDescriptionManager.register(new ArrowTopShapeDescription_1.ArrowTopShapeDescription());
  4930. ShapeDescriptionManager.register(new CrossShapeDescription_1.CrossShapeDescription());
  4931. ShapeDescriptionManager.register(new DiamondShapeDescription_1.DiamondShapeDescription());
  4932. ShapeDescriptionManager.register(new EllipseShapeDescription_1.EllipseShapeDescription());
  4933. ShapeDescriptionManager.register(new HeartShapeDescription_1.HeartShapeDescription());
  4934. ShapeDescriptionManager.register(new RectangleShapeDescription_1.RectangleShapeDescription());
  4935. ShapeDescriptionManager.register(new TriangleShapeDescription_1.TriangleShapeDescription());
  4936. ShapeDescriptionManager.register(new TextShapeDescription_1.TextShapeDescription());
  4937. ShapeDescriptionManager.register(new PentagonShapeDescription_1.PentagonShapeDescription());
  4938. ShapeDescriptionManager.register(new HexagonShapeDescription_1.HexagonShapeDescription());
  4939. ShapeDescriptionManager.register(new OctagonShapeDescription_1.OctagonShapeDescription());
  4940. ShapeDescriptionManager.register(new StarShapeDescription_1.StarShapeDescription());
  4941. ShapeDescriptionManager.register(new ProcessShapeDescription_1.ProcessShapeDescription());
  4942. ShapeDescriptionManager.register(new DecisionShapeDescription_1.DecisionShapeDescription());
  4943. ShapeDescriptionManager.register(new TerminatorShapeDescription_1.TerminatorShapeDescription());
  4944. ShapeDescriptionManager.register(new PredefinedProcessShapeDescription_1.PredefinedProcessShapeDescription());
  4945. ShapeDescriptionManager.register(new DocumentShapeDescription_1.DocumentShapeDescription());
  4946. ShapeDescriptionManager.register(new MultipleDocumentsShapeDescription_1.MultipleDocumentsShapeDescription());
  4947. ShapeDescriptionManager.register(new ManualInputShapeDescription_1.ManualInputShapeDescription());
  4948. ShapeDescriptionManager.register(new PreparationShapeDescription_1.PreparationShapeDescription());
  4949. ShapeDescriptionManager.register(new DataShapeDescription_1.DataShapeDescription());
  4950. ShapeDescriptionManager.register(new DatabaseShapeDescription_1.DatabaseShapeDescription());
  4951. ShapeDescriptionManager.register(new HardDiskShapeDescription_1.HardDiskShapeDescription());
  4952. ShapeDescriptionManager.register(new InternalStorageShapeDescription_1.InternalStorageShapeDescription());
  4953. ShapeDescriptionManager.register(new PaperTapeShapeDescription_1.PaperTapeShapeDescription());
  4954. ShapeDescriptionManager.register(new ManualOperationShapeDescription_1.ManualOperationShapeDescription());
  4955. ShapeDescriptionManager.register(new DelayShapeDescription_1.DelayShapeDescription());
  4956. ShapeDescriptionManager.register(new StoredDataShapeDescription_1.StoredDataShapeDescription());
  4957. ShapeDescriptionManager.register(new DisplayShapeDescription_1.DisplayShapeDescription());
  4958. ShapeDescriptionManager.register(new MergeShapeDescription_1.MergeShapeDescription());
  4959. ShapeDescriptionManager.register(new OrShapeDescription_1.OrShapeDescription());
  4960. ShapeDescriptionManager.register(new SummingJunctionShapeDescription_1.SummingJunctionShapeDescription());
  4961. /***/ }),
  4962. /* 31 */
  4963. /***/ (function(module, exports, __webpack_require__) {
  4964. "use strict";
  4965. Object.defineProperty(exports, "__esModule", { value: true });
  4966. var Shape_1 = __webpack_require__(9);
  4967. var Connector_1 = __webpack_require__(5);
  4968. var Exporter = /** @class */ (function () {
  4969. function Exporter() {
  4970. }
  4971. Exporter.export = function (model) {
  4972. var obj = {
  4973. page: {},
  4974. connectors: [],
  4975. shapes: []
  4976. };
  4977. obj.page = {
  4978. "width": model.size.width,
  4979. "height": model.size.height,
  4980. "pageColor": model.pageColor,
  4981. "pageWidth": model.pageSize.width,
  4982. "pageHeight": model.pageSize.height,
  4983. "pageLandscape": model.pageLandscape,
  4984. "gridSize": model.gridSize,
  4985. "showGrid": model.showGrid,
  4986. "snapToGrid": model.snapToGrid,
  4987. "units": model.units
  4988. };
  4989. this.exportItemsCore(model.items, obj);
  4990. return JSON.stringify(obj);
  4991. };
  4992. Exporter.exportItems = function (items) {
  4993. var obj = {
  4994. connectors: [],
  4995. shapes: []
  4996. };
  4997. this.exportItemsCore(items, obj);
  4998. return JSON.stringify(obj);
  4999. };
  5000. Exporter.exportItemsCore = function (items, obj) {
  5001. var _this = this;
  5002. items.forEach(function (item) {
  5003. if (item instanceof Shape_1.Shape) {
  5004. obj.shapes.push(_this.exportShape(item));
  5005. }
  5006. if (item instanceof Connector_1.Connector) {
  5007. var connectorObj = _this.exportConnector(item);
  5008. if (item.beginItem) {
  5009. connectorObj["beginItemKey"] = item.beginItem.key;
  5010. connectorObj["beginConnectionPointIndex"] = item.beginConnectionPointIndex;
  5011. }
  5012. if (item.endItem) {
  5013. connectorObj["endItemKey"] = item.endItem.key;
  5014. connectorObj["endConnectionPointIndex"] = item.endConnectionPointIndex;
  5015. }
  5016. obj.connectors.push(connectorObj);
  5017. }
  5018. });
  5019. };
  5020. Exporter.exportItem = function (item) {
  5021. return {
  5022. "key": item.key,
  5023. "dataKey": item.dataKey,
  5024. "locked": item.locked,
  5025. "zIndex": item.zIndex
  5026. };
  5027. };
  5028. Exporter.exportShape = function (shape) {
  5029. var result = this.exportItem(shape);
  5030. result["type"] = shape.description.key;
  5031. result["text"] = shape.text;
  5032. result["x"] = shape.position.x;
  5033. result["y"] = shape.position.y;
  5034. result["width"] = shape.size.width;
  5035. result["height"] = shape.size.height;
  5036. var paramsObj = shape.parameters.toObject();
  5037. if (paramsObj)
  5038. result["parameters"] = paramsObj;
  5039. var styleObj = shape.style.toObject();
  5040. if (styleObj)
  5041. result["style"] = styleObj;
  5042. var styleTextObj = shape.styleText.toObject();
  5043. if (styleTextObj)
  5044. result["styleText"] = styleTextObj;
  5045. return result;
  5046. };
  5047. Exporter.exportConnector = function (connector) {
  5048. var result = this.exportItem(connector);
  5049. result["points"] = connector.points.map(function (p) { return { "x": p.x, "y": p.y }; });
  5050. var textObj = connector.texts.toObject();
  5051. if (textObj)
  5052. result["texts"] = textObj;
  5053. var propsObj = connector.properties.toObject();
  5054. if (propsObj)
  5055. result["properties"] = propsObj;
  5056. var styleObj = connector.style.toObject();
  5057. if (styleObj)
  5058. result["style"] = styleObj;
  5059. var styleTextObj = connector.styleText.toObject();
  5060. if (styleTextObj)
  5061. result["styleText"] = styleTextObj;
  5062. return result;
  5063. };
  5064. // Images
  5065. Exporter.exportSvg = function (canvasManager, callback) {
  5066. canvasManager.exportSvgImage(callback);
  5067. };
  5068. Exporter.exportPng = function (canvasManager, callback) {
  5069. canvasManager.exportPngImage(callback);
  5070. };
  5071. Exporter.exportJpg = function (canvasManager, callback) {
  5072. canvasManager.exportJpgImage(callback);
  5073. };
  5074. return Exporter;
  5075. }());
  5076. exports.Exporter = Exporter;
  5077. /***/ }),
  5078. /* 32 */
  5079. /***/ (function(module, exports, __webpack_require__) {
  5080. "use strict";
  5081. var __extends = (this && this.__extends) || (function () {
  5082. var extendStatics = function (d, b) {
  5083. extendStatics = Object.setPrototypeOf ||
  5084. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5085. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5086. return extendStatics(d, b);
  5087. };
  5088. return function (d, b) {
  5089. extendStatics(d, b);
  5090. function __() { this.constructor = d; }
  5091. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5092. };
  5093. })();
  5094. Object.defineProperty(exports, "__esModule", { value: true });
  5095. var Utils_1 = __webpack_require__(0);
  5096. var DiagramItem_1 = __webpack_require__(3);
  5097. var ConnectionPoint = /** @class */ (function (_super) {
  5098. __extends(ConnectionPoint, _super);
  5099. function ConnectionPoint(x, y, side) {
  5100. if (side === void 0) { side = DiagramItem_1.ConnectionPointSide.Undefined; }
  5101. var _this = _super.call(this, x, y) || this;
  5102. _this.side = side;
  5103. return _this;
  5104. }
  5105. ConnectionPoint.prototype.offset = function (offsetX, offsetY) {
  5106. if (offsetX === void 0) { offsetX = 0; }
  5107. if (offsetY === void 0) { offsetY = 0; }
  5108. return new ConnectionPoint(this.x + offsetX, this.y + offsetY);
  5109. };
  5110. ConnectionPoint.prototype.multiply = function (multiplierX, multiplierY) {
  5111. if (multiplierX === void 0) { multiplierX = 1; }
  5112. if (multiplierY === void 0) { multiplierY = multiplierX; }
  5113. return new ConnectionPoint(this.x * multiplierX, this.y * multiplierY);
  5114. };
  5115. ConnectionPoint.prototype.clone = function () { return new ConnectionPoint(this.x, this.y, this.side); };
  5116. ConnectionPoint.prototype.toPoint = function () { return new Utils_1.Point(this.x, this.y); };
  5117. return ConnectionPoint;
  5118. }(Utils_1.Point));
  5119. exports.ConnectionPoint = ConnectionPoint;
  5120. /***/ }),
  5121. /* 33 */
  5122. /***/ (function(module, exports, __webpack_require__) {
  5123. "use strict";
  5124. Object.defineProperty(exports, "__esModule", { value: true });
  5125. var DiagramItem_1 = __webpack_require__(3);
  5126. var Connector_1 = __webpack_require__(5);
  5127. var ConnectorPointsOrthogonalSideCalculatorBase = /** @class */ (function () {
  5128. function ConnectorPointsOrthogonalSideCalculatorBase(parent) {
  5129. this.parent = parent;
  5130. }
  5131. Object.defineProperty(ConnectorPointsOrthogonalSideCalculatorBase.prototype, "connector", {
  5132. get: function () { return this.parent.connector; },
  5133. enumerable: true,
  5134. configurable: true
  5135. });
  5136. Object.defineProperty(ConnectorPointsOrthogonalSideCalculatorBase.prototype, "beginRect", {
  5137. get: function () { return this.parent.beginRect; },
  5138. enumerable: true,
  5139. configurable: true
  5140. });
  5141. Object.defineProperty(ConnectorPointsOrthogonalSideCalculatorBase.prototype, "endRect", {
  5142. get: function () { return this.parent.endRect; },
  5143. enumerable: true,
  5144. configurable: true
  5145. });
  5146. ConnectorPointsOrthogonalSideCalculatorBase.prototype.getBeginOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  5147. originPoint = this.getCorrectOriginPoint(originPoint, originRect);
  5148. if (targetSide !== DiagramItem_1.ConnectionPointSide.Undefined) {
  5149. if (this.isBeginEndSame())
  5150. return this.getSameShapeOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5151. else if (this.isBeginEndOverlappedPoints(originPoint, targetPoint))
  5152. return this.getOverlappedPointsOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5153. else if (this.isBeginEndOverlapped())
  5154. return this.getBeginOverlappedShapeOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5155. }
  5156. else if (this.isOriginRectContainsTargetPoint(originRect, targetPoint))
  5157. return this.getOverlappedPointsOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5158. if (this.isOnSidePoint(originPoint, targetPoint))
  5159. return this.getBeginOnSideOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5160. return this.getBeginOffSideOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5161. };
  5162. ConnectorPointsOrthogonalSideCalculatorBase.prototype.getEndOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  5163. originPoint = this.getCorrectOriginPoint(originPoint, originRect);
  5164. if (targetSide !== DiagramItem_1.ConnectionPointSide.Undefined) {
  5165. if (this.isBeginEndSame())
  5166. return this.getSameShapeOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5167. else if (this.isBeginEndOverlappedPoints(targetPoint, originPoint))
  5168. return this.getOverlappedPointsOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5169. else if (this.isBeginEndOverlapped())
  5170. return this.getEndOverlappedShapeOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5171. }
  5172. else if (this.isOriginRectContainsTargetPoint(originRect, targetPoint))
  5173. return this.getOverlappedPointsOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5174. if (this.isOnSidePoint(originPoint, targetPoint))
  5175. return this.getEndOnSideOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5176. return this.getEndOffSideOffsetPoints(targetSide, originPoint, targetPoint, originRect);
  5177. };
  5178. ConnectorPointsOrthogonalSideCalculatorBase.prototype.getSide = function (originPoint, targetPoint) {
  5179. var diffX = Math.abs(targetPoint.x - originPoint.x);
  5180. var diffY = Math.abs(targetPoint.y - originPoint.y);
  5181. if (diffX > diffY) {
  5182. if (targetPoint.x > originPoint.x)
  5183. return DiagramItem_1.ConnectionPointSide.East;
  5184. else
  5185. return DiagramItem_1.ConnectionPointSide.West;
  5186. }
  5187. else {
  5188. if (targetPoint.y > originPoint.y)
  5189. return DiagramItem_1.ConnectionPointSide.South;
  5190. else
  5191. return DiagramItem_1.ConnectionPointSide.North;
  5192. }
  5193. };
  5194. ConnectorPointsOrthogonalSideCalculatorBase.prototype.getSideCalculator = function (originPoint, targetPoint) {
  5195. return this.parent.getSideCalculator(this.getSide(originPoint, targetPoint));
  5196. };
  5197. ConnectorPointsOrthogonalSideCalculatorBase.prototype.getMinOffset = function () {
  5198. return Connector_1.Connector.minOffset;
  5199. };
  5200. ConnectorPointsOrthogonalSideCalculatorBase.prototype.isBeginEndSame = function () {
  5201. return this.connector.beginItem === this.connector.endItem;
  5202. };
  5203. ConnectorPointsOrthogonalSideCalculatorBase.prototype.isBeginEndOverlapped = function () {
  5204. return this.beginRect && this.endRect && this.beginRect.intersect(this.endRect);
  5205. };
  5206. ConnectorPointsOrthogonalSideCalculatorBase.prototype.isBeginEndOverlappedX = function () {
  5207. return this.beginRect && this.endRect && this.beginRect.intersectX(this.endRect);
  5208. };
  5209. ConnectorPointsOrthogonalSideCalculatorBase.prototype.isBeginEndOverlappedY = function () {
  5210. return this.beginRect && this.endRect && this.beginRect.intersectY(this.endRect);
  5211. };
  5212. ConnectorPointsOrthogonalSideCalculatorBase.prototype.isBeginEndOverlappedPoints = function (beginPoint, endPoint) {
  5213. return this.beginRect && this.endRect && (this.beginRect.contains(endPoint) || this.endRect.contains(beginPoint));
  5214. };
  5215. ConnectorPointsOrthogonalSideCalculatorBase.prototype.isOriginRectContainsTargetPoint = function (originRect, targetPoint) {
  5216. return originRect && originRect.contains(targetPoint);
  5217. };
  5218. return ConnectorPointsOrthogonalSideCalculatorBase;
  5219. }());
  5220. exports.ConnectorPointsOrthogonalSideCalculatorBase = ConnectorPointsOrthogonalSideCalculatorBase;
  5221. /***/ }),
  5222. /* 34 */
  5223. /***/ (function(module, exports, __webpack_require__) {
  5224. "use strict";
  5225. var __extends = (this && this.__extends) || (function () {
  5226. var extendStatics = function (d, b) {
  5227. extendStatics = Object.setPrototypeOf ||
  5228. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5229. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5230. return extendStatics(d, b);
  5231. };
  5232. return function (d, b) {
  5233. extendStatics(d, b);
  5234. function __() { this.constructor = d; }
  5235. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5236. };
  5237. })();
  5238. Object.defineProperty(exports, "__esModule", { value: true });
  5239. var Structures_1 = __webpack_require__(22);
  5240. var Shape_1 = __webpack_require__(9);
  5241. var Utils_1 = __webpack_require__(0);
  5242. var ListUtils_1 = __webpack_require__(60);
  5243. var GraphBase = /** @class */ (function () {
  5244. function GraphBase(nodes, edges) {
  5245. this.nodeMap = {};
  5246. this.edgeMap = {};
  5247. this.nodes = [];
  5248. this.edges = [];
  5249. this.onInit();
  5250. nodes.forEach(this.addNode.bind(this));
  5251. edges.forEach(this.addEdge.bind(this));
  5252. }
  5253. Object.defineProperty(GraphBase.prototype, "items", {
  5254. get: function () {
  5255. return this.nodes.map(this.getNode.bind(this));
  5256. },
  5257. enumerable: true,
  5258. configurable: true
  5259. });
  5260. GraphBase.prototype.onInit = function () { };
  5261. GraphBase.prototype.addEdge = function (edge) {
  5262. this.edgeMap[edge.key] = edge;
  5263. this.edges.push(edge);
  5264. };
  5265. GraphBase.prototype.addNode = function (node) {
  5266. this.nodeMap[node.key] = node;
  5267. this.nodes.push(node.key);
  5268. };
  5269. GraphBase.prototype.getNode = function (key) {
  5270. return this.nodeMap[key];
  5271. };
  5272. GraphBase.prototype.getEdge = function (key) {
  5273. return this.edgeMap[key];
  5274. };
  5275. GraphBase.prototype.isEmpty = function () {
  5276. return !this.nodes.length && !this.edges.length;
  5277. };
  5278. GraphBase.prototype.getAdjacentEdges = function (nodeKey, connectionMode) {
  5279. if (connectionMode === void 0) { connectionMode = Structures_1.ConnectionMode.OutgoingAndIncoming; }
  5280. return this.edges.filter(function (e) {
  5281. return connectionMode & Structures_1.ConnectionMode.Incoming && e.to === nodeKey ||
  5282. connectionMode & Structures_1.ConnectionMode.Outgoing && e.from === nodeKey;
  5283. });
  5284. };
  5285. return GraphBase;
  5286. }());
  5287. var Graph = /** @class */ (function (_super) {
  5288. __extends(Graph, _super);
  5289. function Graph() {
  5290. return _super !== null && _super.apply(this, arguments) || this;
  5291. }
  5292. Graph.prototype.cast = function (castNode, castEdge) {
  5293. var _this = this;
  5294. var newNodes = this.nodes.map(function (nk) { return castNode(_this.getNode(nk)); });
  5295. var newEdges = this.edges.map(function (e) { return castEdge ? castEdge(e) : e; });
  5296. return new Graph(newNodes, newEdges);
  5297. };
  5298. Graph.prototype.getConnectedComponents = function () {
  5299. var iterator = this.createIterator(Structures_1.ConnectionMode.OutgoingAndIncoming);
  5300. iterator.visitEachEdgeOnce = true;
  5301. var components = [];
  5302. var _loop_1 = function (i) {
  5303. var nodes = [];
  5304. var edges = [];
  5305. iterator.onNode = function (n) { return nodes.push(n); };
  5306. iterator.onEdge = function (e) { return edges.push(e); };
  5307. iterator.iterate(this_1.nodes[i]);
  5308. if (nodes.length)
  5309. components.push(new Graph(nodes, edges));
  5310. };
  5311. var this_1 = this;
  5312. for (var i = 0; i < this.nodes.length; i++) {
  5313. _loop_1(i);
  5314. }
  5315. return components;
  5316. };
  5317. Graph.prototype.createIterator = function (connectionMode) {
  5318. var iterator = new GraphIterator(this, connectionMode);
  5319. iterator.comparer = function (a, b) { return a.weight - b.weight; };
  5320. return iterator;
  5321. };
  5322. Graph.prototype.getSpanningGraph = function (rootKey, connectionMode, edgeWeightFunc) {
  5323. var _this = this;
  5324. if (edgeWeightFunc === void 0) { edgeWeightFunc = undefined; }
  5325. if (!this.nodes.length)
  5326. return new Graph([], []);
  5327. if (!edgeWeightFunc)
  5328. edgeWeightFunc = function (e) { return e.weight; };
  5329. var sortedAdjacentEdges = [];
  5330. var spanningTreeNodesSet = new ListUtils_1.HashSet();
  5331. var spanningTreeEdgesSet = new ListUtils_1.HashSet([], function (e) { return e.getHashKey(); });
  5332. this.addNodeToSpanningGraph(rootKey, connectionMode, sortedAdjacentEdges, spanningTreeNodesSet, spanningTreeEdgesSet, edgeWeightFunc);
  5333. while (sortedAdjacentEdges.length && spanningTreeNodesSet.length !== this.nodes.length) {
  5334. var minWeighedEdge = sortedAdjacentEdges.shift();
  5335. spanningTreeEdgesSet.tryPush(minWeighedEdge);
  5336. var node = spanningTreeNodesSet.contains(minWeighedEdge.from) ? minWeighedEdge.to : minWeighedEdge.from;
  5337. this.addNodeToSpanningGraph(node, connectionMode, sortedAdjacentEdges, spanningTreeNodesSet, spanningTreeEdgesSet, edgeWeightFunc);
  5338. sortedAdjacentEdges = sortedAdjacentEdges.filter(function (e) { return !spanningTreeNodesSet.contains(e.from) || !spanningTreeNodesSet.contains(e.to); });
  5339. }
  5340. return new Graph(spanningTreeNodesSet.list().map(function (nk) { return _this.getNode(nk); }), spanningTreeEdgesSet.list());
  5341. };
  5342. Graph.prototype.addNodeToSpanningGraph = function (nodeKey, connectionMode, adjacentEdges, spanningTreeNodesSet, spanningTreeEdgesSet, edgeWeightFunc) {
  5343. spanningTreeNodesSet.tryPush(nodeKey);
  5344. this.getAdjacentEdges(nodeKey, connectionMode)
  5345. .filter(function (e) { return !spanningTreeEdgesSet.contains(e); })
  5346. .forEach(function (e) {
  5347. var weight = edgeWeightFunc(e);
  5348. var pos = Utils_1.Utils.binaryIndexOf(adjacentEdges, function (a) { return a.weight - weight; });
  5349. pos = pos < 0 ? ~pos : pos;
  5350. while (pos < adjacentEdges.length && edgeWeightFunc(adjacentEdges[pos]) === weight)
  5351. pos++;
  5352. adjacentEdges.splice(pos, 0, new Structures_1.Edge(e.key, e.from, e.to, weight));
  5353. });
  5354. };
  5355. Graph.create = function (shapes, connectors) {
  5356. var nodes = shapes;
  5357. var edges = connectors
  5358. .filter(function (i) { return i.beginItem && i.endItem instanceof Shape_1.Shape && i.endItem && i.endItem instanceof Shape_1.Shape && i.beginItem !== i.endItem; }) // TBD: ShapeItem?
  5359. .map(function (i) { return new Structures_1.Edge(i.key, i.beginItem && i.beginItem.key, i.endItem && i.endItem.key); });
  5360. return new Graph(nodes, edges);
  5361. };
  5362. return Graph;
  5363. }(GraphBase));
  5364. exports.Graph = Graph;
  5365. var FastGraph = /** @class */ (function (_super) {
  5366. __extends(FastGraph, _super);
  5367. function FastGraph() {
  5368. return _super !== null && _super.apply(this, arguments) || this;
  5369. }
  5370. FastGraph.prototype.onInit = function () {
  5371. this.parentToChildren = {};
  5372. this.childToParents = {};
  5373. };
  5374. FastGraph.prototype.addEdge = function (edge) {
  5375. _super.prototype.addEdge.call(this, edge);
  5376. (this.parentToChildren[edge.from] || (this.parentToChildren[edge.from] = [])).push(edge.to);
  5377. (this.childToParents[edge.to] || (this.childToParents[edge.to] = [])).push(edge.from);
  5378. };
  5379. FastGraph.prototype.getChildren = function (parent) {
  5380. return this.parentToChildren[parent] || [];
  5381. };
  5382. FastGraph.prototype.getParents = function (child) {
  5383. return this.childToParents[child] || [];
  5384. };
  5385. FastGraph.prototype.createIterator = function (connectionMode) {
  5386. return new GraphIterator(this, connectionMode);
  5387. };
  5388. return FastGraph;
  5389. }(GraphBase));
  5390. exports.FastGraph = FastGraph;
  5391. var GraphIterator = /** @class */ (function () {
  5392. function GraphIterator(graph, connectionMode) {
  5393. if (connectionMode === void 0) { connectionMode = Structures_1.ConnectionMode.OutgoingAndIncoming; }
  5394. this.graph = graph;
  5395. this.connectionMode = connectionMode;
  5396. this.visitEachEdgeOnce = true;
  5397. this.visitEachNodeOnce = true;
  5398. this.visitedNodes = {};
  5399. this.visitedEdges = {};
  5400. }
  5401. GraphIterator.prototype.iterate = function (nodeKey) {
  5402. if (!this.visitEachNodeOnce && !this.visitEachEdgeOnce && !this.skipNode)
  5403. throw "skipNode or visitEachNodeOnce or visitEachEdgeOnce must be set to avoid SOF";
  5404. this.iterateCore(nodeKey);
  5405. };
  5406. GraphIterator.prototype.iterateCore = function (nodeKey) {
  5407. var _this = this;
  5408. var node = this.graph.getNode(nodeKey);
  5409. if (this.skipNode && this.skipNode(node) || (this.visitEachNodeOnce && this.isNodeVisited(nodeKey)))
  5410. return;
  5411. this.visitedNodes[nodeKey] = true;
  5412. this.onNode && this.onNode(node);
  5413. var edges = this.graph.getAdjacentEdges(nodeKey, this.connectionMode);
  5414. if (this.skipEdge)
  5415. edges = edges.filter(function (e) { return !_this.skipEdge(e); });
  5416. if (this.connectionMode & Structures_1.ConnectionMode.Outgoing) {
  5417. var outgoing = edges.filter(function (e) { return e.from === nodeKey; });
  5418. if (this.comparer)
  5419. outgoing.sort(this.comparer);
  5420. outgoing.forEach(function (e) {
  5421. if (_this.visitEachEdgeOnce && _this.visitedEdges[e.key])
  5422. return;
  5423. _this.visitedEdges[e.key] = true;
  5424. _this.onEdge && _this.onEdge(e, true);
  5425. _this.iterateCore(e.to);
  5426. _this.onAfterEdge && _this.onAfterEdge(e, true);
  5427. });
  5428. }
  5429. this.onAllEdges && this.onAllEdges(node, true);
  5430. if (this.connectionMode & Structures_1.ConnectionMode.Incoming) {
  5431. var incoming = edges.filter(function (e) { return e.to === nodeKey; });
  5432. if (this.comparer)
  5433. incoming.sort(this.comparer);
  5434. incoming.forEach(function (e) {
  5435. if (_this.visitEachEdgeOnce && _this.visitedEdges[e.key])
  5436. return;
  5437. _this.visitedEdges[e.key] = true;
  5438. _this.onEdge && _this.onEdge(e, false);
  5439. _this.iterateCore(e.from);
  5440. _this.onAfterEdge && _this.onAfterEdge(e, false);
  5441. });
  5442. }
  5443. this.onAllEdges && this.onAllEdges(node, false);
  5444. };
  5445. GraphIterator.prototype.isNodeVisited = function (nodeKey) {
  5446. return !!this.visitedNodes[nodeKey];
  5447. };
  5448. GraphIterator.prototype.isEdgeVisited = function (edgeKey) {
  5449. return !!this.visitedEdges[edgeKey];
  5450. };
  5451. return GraphIterator;
  5452. }());
  5453. exports.GraphIterator = GraphIterator;
  5454. /***/ }),
  5455. /* 35 */
  5456. /***/ (function(module, exports, __webpack_require__) {
  5457. "use strict";
  5458. var __extends = (this && this.__extends) || (function () {
  5459. var extendStatics = function (d, b) {
  5460. extendStatics = Object.setPrototypeOf ||
  5461. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5462. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5463. return extendStatics(d, b);
  5464. };
  5465. return function (d, b) {
  5466. extendStatics(d, b);
  5467. function __() { this.constructor = d; }
  5468. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5469. };
  5470. })();
  5471. Object.defineProperty(exports, "__esModule", { value: true });
  5472. var HistoryItem_1 = __webpack_require__(4);
  5473. var Connector_1 = __webpack_require__(5);
  5474. var AddConnectionHistoryItem = /** @class */ (function (_super) {
  5475. __extends(AddConnectionHistoryItem, _super);
  5476. function AddConnectionHistoryItem(connector, item, connectionPointIndex, position) {
  5477. var _this = _super.call(this) || this;
  5478. _this.connectorKey = connector.key;
  5479. _this.itemKey = item.key;
  5480. _this.connectionPointIndex = connectionPointIndex;
  5481. _this.position = position;
  5482. return _this;
  5483. }
  5484. AddConnectionHistoryItem.prototype.redo = function (manipulator) {
  5485. var connector = manipulator.model.findConnector(this.connectorKey);
  5486. var item = manipulator.model.findItem(this.itemKey);
  5487. manipulator.addConnection(connector, item, this.connectionPointIndex, this.position);
  5488. };
  5489. AddConnectionHistoryItem.prototype.undo = function (manipulator) {
  5490. var connector = manipulator.model.findConnector(this.connectorKey);
  5491. manipulator.deleteConnection(connector, this.position);
  5492. };
  5493. return AddConnectionHistoryItem;
  5494. }(HistoryItem_1.HistoryItem));
  5495. exports.AddConnectionHistoryItem = AddConnectionHistoryItem;
  5496. var SetConnectionPointIndexHistoryItem = /** @class */ (function (_super) {
  5497. __extends(SetConnectionPointIndexHistoryItem, _super);
  5498. function SetConnectionPointIndexHistoryItem(connector, connectionPointIndex, position) {
  5499. var _this = _super.call(this) || this;
  5500. _this.connectorKey = connector.key;
  5501. _this.connectionPointIndex = connectionPointIndex;
  5502. _this.position = position;
  5503. return _this;
  5504. }
  5505. SetConnectionPointIndexHistoryItem.prototype.redo = function (manipulator) {
  5506. var connector = manipulator.model.findConnector(this.connectorKey);
  5507. this.oldConnectionPointIndex = this.position === Connector_1.ConnectorPosition.Begin ? connector.beginConnectionPointIndex : connector.endConnectionPointIndex;
  5508. manipulator.setConnectionPointIndex(connector, this.connectionPointIndex, this.position);
  5509. };
  5510. SetConnectionPointIndexHistoryItem.prototype.undo = function (manipulator) {
  5511. var connector = manipulator.model.findConnector(this.connectorKey);
  5512. manipulator.setConnectionPointIndex(connector, this.oldConnectionPointIndex, this.position);
  5513. };
  5514. return SetConnectionPointIndexHistoryItem;
  5515. }(HistoryItem_1.HistoryItem));
  5516. exports.SetConnectionPointIndexHistoryItem = SetConnectionPointIndexHistoryItem;
  5517. /***/ }),
  5518. /* 36 */
  5519. /***/ (function(module, exports, __webpack_require__) {
  5520. "use strict";
  5521. var __extends = (this && this.__extends) || (function () {
  5522. var extendStatics = function (d, b) {
  5523. extendStatics = Object.setPrototypeOf ||
  5524. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5525. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5526. return extendStatics(d, b);
  5527. };
  5528. return function (d, b) {
  5529. extendStatics(d, b);
  5530. function __() { this.constructor = d; }
  5531. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5532. };
  5533. })();
  5534. Object.defineProperty(exports, "__esModule", { value: true });
  5535. var HistoryItem_1 = __webpack_require__(4);
  5536. var MoveConnectorPointHistoryItem = /** @class */ (function (_super) {
  5537. __extends(MoveConnectorPointHistoryItem, _super);
  5538. function MoveConnectorPointHistoryItem(connectorKey, pointIndex, point) {
  5539. var _this = _super.call(this) || this;
  5540. _this.connectorKey = connectorKey;
  5541. _this.pointIndex = pointIndex;
  5542. _this.point = point;
  5543. return _this;
  5544. }
  5545. MoveConnectorPointHistoryItem.prototype.redo = function (manipulator) {
  5546. var connector = manipulator.model.findConnector(this.connectorKey);
  5547. this.oldPoint = connector.points[this.pointIndex].clone();
  5548. manipulator.moveConnectorPoint(connector, this.pointIndex, this.point);
  5549. };
  5550. MoveConnectorPointHistoryItem.prototype.undo = function (manipulator) {
  5551. var connector = manipulator.model.findConnector(this.connectorKey);
  5552. manipulator.moveConnectorPoint(connector, this.pointIndex, this.oldPoint);
  5553. };
  5554. return MoveConnectorPointHistoryItem;
  5555. }(HistoryItem_1.HistoryItem));
  5556. exports.MoveConnectorPointHistoryItem = MoveConnectorPointHistoryItem;
  5557. /***/ }),
  5558. /* 37 */
  5559. /***/ (function(module, exports, __webpack_require__) {
  5560. "use strict";
  5561. var __extends = (this && this.__extends) || (function () {
  5562. var extendStatics = function (d, b) {
  5563. extendStatics = Object.setPrototypeOf ||
  5564. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5565. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5566. return extendStatics(d, b);
  5567. };
  5568. return function (d, b) {
  5569. extendStatics(d, b);
  5570. function __() { this.constructor = d; }
  5571. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5572. };
  5573. })();
  5574. Object.defineProperty(exports, "__esModule", { value: true });
  5575. var ShapeType_1 = __webpack_require__(1);
  5576. var ModelUtils_1 = __webpack_require__(8);
  5577. var DataImporter_1 = __webpack_require__(119);
  5578. var DataLayoutType;
  5579. (function (DataLayoutType) {
  5580. DataLayoutType[DataLayoutType["Tree"] = 0] = "Tree";
  5581. DataLayoutType[DataLayoutType["Sugiyama"] = 1] = "Sugiyama";
  5582. })(DataLayoutType = exports.DataLayoutType || (exports.DataLayoutType = {}));
  5583. var DataSource = /** @class */ (function () {
  5584. function DataSource(key, name, nodeDataSource, edgeDataSource, nodeDataImporter, edgeDataImporter) {
  5585. this.nodes = [];
  5586. this.edges = [];
  5587. this.nodeKeyMap = {};
  5588. this.edgeKeyMap = {};
  5589. this.useNodeParentId = false;
  5590. this.useNodeItems = false;
  5591. if (key === undefined || key === null)
  5592. throw new Error("DataSource key must be specified");
  5593. this.key = key.toString();
  5594. this.name = name;
  5595. this.nodeDataImporter = this.createNodeDataImporter(nodeDataImporter);
  5596. this.edgeDataImporter = this.createEdgeDataImporter(edgeDataImporter);
  5597. this.nodeDataSource = nodeDataSource || [];
  5598. this.edgeDataSource = edgeDataSource || [];
  5599. this.fetchData();
  5600. }
  5601. DataSource.prototype.fetchData = function () {
  5602. var _this = this;
  5603. this.useNodeParentId = false;
  5604. this.useNodeItems = false;
  5605. this.nodeDataSource.forEach(function (nodeDataObj) {
  5606. _this.addNode(nodeDataObj);
  5607. });
  5608. if (this.useEdgesArray()) {
  5609. this.edgeDataSource.forEach(function (edgeDataObj) {
  5610. _this.addEdge(edgeDataObj);
  5611. });
  5612. }
  5613. else {
  5614. this.nodes.forEach(function (node) {
  5615. _this.addNodeEdgesByParentId(node);
  5616. });
  5617. }
  5618. };
  5619. DataSource.prototype.useEdgesArray = function () {
  5620. return Array.isArray(this.edgeDataSource) && this.edgeDataSource.length;
  5621. };
  5622. DataSource.prototype.addNode = function (nodeDataObj, parentNodeDataObj) {
  5623. var _this = this;
  5624. var node = this.addNodeInternal(nodeDataObj, this.nodeDataImporter.getText(nodeDataObj), this.nodeDataImporter.getType(nodeDataObj), parentNodeDataObj);
  5625. if (!this.useNodeParentId && !this.useEdgesArray()) {
  5626. var childNodeDataObjs = this.nodeDataImporter.getItems(nodeDataObj);
  5627. if (Array.isArray(childNodeDataObjs) && childNodeDataObjs.length) {
  5628. childNodeDataObjs.forEach(function (childNodeDataObj) {
  5629. var childNode = _this.addNode(childNodeDataObj, nodeDataObj);
  5630. _this.addEdgeInternal(undefined, node.key, childNode.key);
  5631. _this.useNodeItems = true;
  5632. });
  5633. }
  5634. }
  5635. return node;
  5636. };
  5637. DataSource.prototype.addNodeEdgesByParentId = function (node) {
  5638. if (!this.useNodeItems && !this.useEdgesArray()) {
  5639. var parentKey = this.nodeDataImporter.getParentKey(node.dataObj);
  5640. if (parentKey !== undefined && parentKey !== null) {
  5641. this.addEdgeInternal(undefined, this.getNodeKey(node.dataObj, this.nodeDataImporter.getParentKey), this.getNodeKey(node.dataObj, this.nodeDataImporter.getKey));
  5642. this.useNodeParentId = true;
  5643. }
  5644. }
  5645. };
  5646. DataSource.prototype.addNodeInternal = function (nodeDataObj, text, type, parentNodeDataObj) {
  5647. var externalKey = this.nodeDataImporter.getKey(nodeDataObj);
  5648. var key = (externalKey !== undefined && externalKey !== null) ? externalKey.toString() : ModelUtils_1.ModelUtils.getGuidItemKey();
  5649. var node = new DataSourceNodeItem(this.key, key, nodeDataObj, text, type || ShapeType_1.ShapeType.Rectangle, parentNodeDataObj);
  5650. this.nodes.push(node);
  5651. if (externalKey === undefined || externalKey === null) {
  5652. externalKey = key;
  5653. this.nodeDataImporter.setKey(nodeDataObj, key);
  5654. }
  5655. if (externalKey !== undefined && externalKey !== null)
  5656. this.nodeKeyMap[externalKey] = key;
  5657. return node;
  5658. };
  5659. DataSource.prototype.addEdge = function (edgeDataObj) {
  5660. return this.addEdgeInternal(edgeDataObj, this.getNodeKey(edgeDataObj, this.edgeDataImporter.getFrom), this.getNodeKey(edgeDataObj, this.edgeDataImporter.getTo));
  5661. };
  5662. DataSource.prototype.addEdgeInternal = function (edgeDataObj, from, to) {
  5663. var externalKey = edgeDataObj && this.edgeDataImporter.getKey(edgeDataObj);
  5664. var key = (externalKey !== undefined && externalKey !== null) ? externalKey.toString() : ModelUtils_1.ModelUtils.getGuidItemKey();
  5665. var edge = new DataSourceEdgeItem(this.key, key, edgeDataObj, from, to);
  5666. this.edges.push(edge);
  5667. if (externalKey === undefined || externalKey === null) {
  5668. externalKey = key;
  5669. if (edgeDataObj)
  5670. this.edgeDataImporter.setKey(edgeDataObj, key);
  5671. }
  5672. if (externalKey !== undefined && externalKey !== null)
  5673. this.edgeKeyMap[externalKey] = key;
  5674. return edge;
  5675. };
  5676. DataSource.prototype.findNode = function (key) {
  5677. return this.nodes.filter(function (i) { return key !== undefined && i.key === key; })[0];
  5678. };
  5679. DataSource.prototype.findEdge = function (key) {
  5680. return this.edges.filter(function (i) { return key !== undefined && i.key === key; })[0];
  5681. };
  5682. DataSource.prototype.getNodeKey = function (nodeDataObj, getKey) {
  5683. return this.nodeKeyMap[getKey(nodeDataObj)];
  5684. };
  5685. DataSource.prototype.createModelItems = function (history, model, selection, layoutType) {
  5686. ModelUtils_1.ModelUtils.createItemsByDataSource(history, model, selection, this, layoutType);
  5687. };
  5688. DataSource.prototype.createNodeDataImporter = function (importer) {
  5689. var result = new DataImporter_1.DataSourceNodeDataImporter();
  5690. if (importer) {
  5691. if (importer.getKey)
  5692. result.getKey = importer.getKey;
  5693. if (importer.setKey)
  5694. result.setKey = importer.setKey;
  5695. if (importer.getText)
  5696. result.getText = importer.getText;
  5697. if (importer.setText)
  5698. result.setText = importer.setText;
  5699. if (importer.getType)
  5700. result.getType = importer.getType;
  5701. if (importer.setType)
  5702. result.setType = importer.setType;
  5703. if (importer.getParentKey)
  5704. result.getParentKey = importer.getParentKey;
  5705. if (importer.setParentKey)
  5706. result.setParentKey = importer.setParentKey;
  5707. if (importer.getItems)
  5708. result.getItems = importer.getItems;
  5709. if (importer.setItems)
  5710. result.setItems = importer.setItems;
  5711. }
  5712. return result;
  5713. };
  5714. DataSource.prototype.createEdgeDataImporter = function (importer) {
  5715. var result = new DataImporter_1.DataSourceEdgeDataImporter();
  5716. if (importer) {
  5717. if (importer.getKey)
  5718. result.getKey = importer.getKey;
  5719. if (importer.setKey)
  5720. result.setKey = importer.setKey;
  5721. if (importer.getFrom)
  5722. result.getFrom = importer.getFrom;
  5723. if (importer.setFrom)
  5724. result.setFrom = importer.setFrom;
  5725. if (importer.getTo)
  5726. result.getTo = importer.getTo;
  5727. if (importer.setTo)
  5728. result.setTo = importer.setTo;
  5729. }
  5730. return result;
  5731. };
  5732. return DataSource;
  5733. }());
  5734. exports.DataSource = DataSource;
  5735. var DataSourceItem = /** @class */ (function () {
  5736. function DataSourceItem(sourceKey, key, dataObj) {
  5737. this.sourceKey = sourceKey;
  5738. this.key = key;
  5739. this.dataObj = dataObj;
  5740. }
  5741. return DataSourceItem;
  5742. }());
  5743. exports.DataSourceItem = DataSourceItem;
  5744. var DataSourceNodeItem = /** @class */ (function (_super) {
  5745. __extends(DataSourceNodeItem, _super);
  5746. function DataSourceNodeItem(sourceKey, key, dataObj, text, type, parentDataObj) {
  5747. var _this = _super.call(this, sourceKey, key, dataObj) || this;
  5748. _this.text = text;
  5749. _this.type = type;
  5750. _this.parentDataObj = parentDataObj;
  5751. return _this;
  5752. }
  5753. return DataSourceNodeItem;
  5754. }(DataSourceItem));
  5755. exports.DataSourceNodeItem = DataSourceNodeItem;
  5756. var DataSourceEdgeItem = /** @class */ (function (_super) {
  5757. __extends(DataSourceEdgeItem, _super);
  5758. function DataSourceEdgeItem(sourceKey, key, dataObj, from, to) {
  5759. var _this = _super.call(this, sourceKey, key, dataObj) || this;
  5760. _this.sourceKey = sourceKey;
  5761. _this.from = from;
  5762. _this.to = to;
  5763. return _this;
  5764. }
  5765. return DataSourceEdgeItem;
  5766. }(DataSourceItem));
  5767. exports.DataSourceEdgeItem = DataSourceEdgeItem;
  5768. /***/ }),
  5769. /* 38 */
  5770. /***/ (function(module, exports, __webpack_require__) {
  5771. "use strict";
  5772. var __extends = (this && this.__extends) || (function () {
  5773. var extendStatics = function (d, b) {
  5774. extendStatics = Object.setPrototypeOf ||
  5775. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5776. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5777. return extendStatics(d, b);
  5778. };
  5779. return function (d, b) {
  5780. extendStatics(d, b);
  5781. function __() { this.constructor = d; }
  5782. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5783. };
  5784. })();
  5785. Object.defineProperty(exports, "__esModule", { value: true });
  5786. var RenderManager_1 = __webpack_require__(10);
  5787. var Primitive_1 = __webpack_require__(15);
  5788. var EllipsePrimitive = /** @class */ (function (_super) {
  5789. __extends(EllipsePrimitive, _super);
  5790. function EllipsePrimitive(cx, cy, rx, ry, style, className) {
  5791. var _this = _super.call(this, style, className) || this;
  5792. _this.cx = cx;
  5793. _this.cy = cy;
  5794. _this.rx = rx;
  5795. _this.ry = ry;
  5796. return _this;
  5797. }
  5798. EllipsePrimitive.prototype.createMainElement = function () {
  5799. return document.createElementNS(RenderManager_1.svgNS, "ellipse");
  5800. };
  5801. EllipsePrimitive.prototype.applyElementProperties = function (element) {
  5802. this.setUnitAttribute(element, "cx", this.cx);
  5803. this.setUnitAttribute(element, "cy", this.cy);
  5804. this.setUnitAttribute(element, "rx", this.rx);
  5805. this.setUnitAttribute(element, "ry", this.ry);
  5806. _super.prototype.applyElementProperties.call(this, element);
  5807. };
  5808. return EllipsePrimitive;
  5809. }(Primitive_1.SvgPrimitive));
  5810. exports.EllipsePrimitive = EllipsePrimitive;
  5811. /***/ }),
  5812. /* 39 */
  5813. /***/ (function(module, exports, __webpack_require__) {
  5814. "use strict";
  5815. Object.defineProperty(exports, "__esModule", { value: true });
  5816. var Utils_1 = __webpack_require__(0);
  5817. var NodeInfo = /** @class */ (function () {
  5818. function NodeInfo(key, margin, size, connectionPoints) {
  5819. if (connectionPoints === void 0) { connectionPoints = []; }
  5820. this.key = key;
  5821. this.margin = margin;
  5822. this.size = size;
  5823. this.connectionPoints = connectionPoints;
  5824. }
  5825. return NodeInfo;
  5826. }());
  5827. exports.NodeInfo = NodeInfo;
  5828. var NodeLayout = /** @class */ (function () {
  5829. function NodeLayout(info, position) {
  5830. this.info = info;
  5831. this.position = position;
  5832. }
  5833. Object.defineProperty(NodeLayout.prototype, "key", {
  5834. get: function () { return this.info.key; },
  5835. enumerable: true,
  5836. configurable: true
  5837. });
  5838. Object.defineProperty(NodeLayout.prototype, "rectangle", {
  5839. get: function () {
  5840. return new Utils_1.Rectangle(this.position, this.info.size);
  5841. },
  5842. enumerable: true,
  5843. configurable: true
  5844. });
  5845. return NodeLayout;
  5846. }());
  5847. exports.NodeLayout = NodeLayout;
  5848. var EdgeLayout = /** @class */ (function () {
  5849. function EdgeLayout(key, beginIndex, endIndex) {
  5850. this.key = key;
  5851. this.beginIndex = beginIndex;
  5852. this.endIndex = endIndex;
  5853. }
  5854. return EdgeLayout;
  5855. }());
  5856. exports.EdgeLayout = EdgeLayout;
  5857. var Margin = /** @class */ (function () {
  5858. function Margin(top, right, bottom, left) {
  5859. if (right === void 0) { right = top; }
  5860. if (bottom === void 0) { bottom = top; }
  5861. if (left === void 0) { left = top; }
  5862. this.top = top;
  5863. this.right = right;
  5864. this.bottom = bottom;
  5865. this.left = left;
  5866. }
  5867. Margin.empty = function () {
  5868. return new Margin(0);
  5869. };
  5870. return Margin;
  5871. }());
  5872. exports.Margin = Margin;
  5873. /***/ }),
  5874. /* 40 */
  5875. /***/ (function(module, exports, __webpack_require__) {
  5876. "use strict";
  5877. var __extends = (this && this.__extends) || (function () {
  5878. var extendStatics = function (d, b) {
  5879. extendStatics = Object.setPrototypeOf ||
  5880. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5881. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5882. return extendStatics(d, b);
  5883. };
  5884. return function (d, b) {
  5885. extendStatics(d, b);
  5886. function __() { this.constructor = d; }
  5887. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5888. };
  5889. })();
  5890. Object.defineProperty(exports, "__esModule", { value: true });
  5891. var BaseBuilder_1 = __webpack_require__(82);
  5892. var Graph_1 = __webpack_require__(34);
  5893. var NodeLayout_1 = __webpack_require__(39);
  5894. var Structures_1 = __webpack_require__(22);
  5895. var ListUtils_1 = __webpack_require__(60);
  5896. var Utils_1 = __webpack_require__(0);
  5897. var LayoutSettings_1 = __webpack_require__(18);
  5898. var GraphLayout_1 = __webpack_require__(81);
  5899. var Connector_1 = __webpack_require__(5);
  5900. var CycleRemover_1 = __webpack_require__(153);
  5901. var SugiyamaLayoutBuilder = /** @class */ (function (_super) {
  5902. __extends(SugiyamaLayoutBuilder, _super);
  5903. function SugiyamaLayoutBuilder() {
  5904. return _super !== null && _super.apply(this, arguments) || this;
  5905. }
  5906. SugiyamaLayoutBuilder.prototype.build = function () {
  5907. var _this = this;
  5908. var offset = 0;
  5909. var layout = new GraphLayout_1.GraphLayout();
  5910. var nodeOrderer = new SugiyamaNodesOrderer();
  5911. this.graph.getConnectedComponents()
  5912. .forEach(function (component) {
  5913. var acyclicGraphInfo = CycleRemover_1.CycleRemover.removeCycles(component);
  5914. var layers = SugiyamaLayerDistributor.getLayers(acyclicGraphInfo.graph);
  5915. var orderedGraph = nodeOrderer.orderNodes(acyclicGraphInfo.graph, layers);
  5916. var removedEdges = Object.keys(acyclicGraphInfo.removedEdges).map(function (ek) { return component.getEdge(ek); });
  5917. var coordinatedGraph = nodeOrderer.assignAbsCoordinates(orderedGraph);
  5918. var componentLayout = _this.createInfoGraphLayout(coordinatedGraph, acyclicGraphInfo.reversedEdges, removedEdges);
  5919. layout.extend(_this.setComponentOffset(componentLayout, offset));
  5920. offset += _this.getComponentOffset(componentLayout);
  5921. });
  5922. return layout;
  5923. };
  5924. // Order Nodes
  5925. SugiyamaLayoutBuilder.prototype.createInfoGraphLayout = function (coordinatedGraph, reversedEdges, removedEdges) {
  5926. var _this = this;
  5927. var currentPosition = new Utils_1.Point(0, 0);
  5928. var items = coordinatedGraph.items;
  5929. var sortedLayers = new ListUtils_1.HashSet(items.map(function (n) { return n.layer; }).sort());
  5930. var absOffsetInfo = this.getAbsOffsetInfo(coordinatedGraph.items);
  5931. var positions = {};
  5932. var totalDepth = 0;
  5933. var leftEdge = Number.MAX_SAFE_INTEGER;
  5934. var rightEdge = Number.MIN_SAFE_INTEGER;
  5935. var _loop_1 = function (i) {
  5936. var layer = sortedLayers.item(i);
  5937. var maxDepthLayer = 0;
  5938. items
  5939. .filter(function (n) { return n.layer === layer; })
  5940. .sort(function (a, b) { return a.position - b.position; })
  5941. .forEach(function (n) {
  5942. var depthNodeSize = _this.getDepthNodeSize(n);
  5943. var directionOffset = _this.chooseDirectionValue(0, depthNodeSize);
  5944. var absPosition = _this.getAbsPosition(n.position, _this.getBreadthNodeSize(n), absOffsetInfo);
  5945. currentPosition = _this.setBreadth(currentPosition, absPosition);
  5946. var nodePosition = _this.setDepthOffset(currentPosition, -directionOffset);
  5947. positions[n.key] = nodePosition;
  5948. if (n.isDummy)
  5949. return;
  5950. var breadth = _this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal ? nodePosition.y : nodePosition.x;
  5951. leftEdge = Math.min(leftEdge, breadth);
  5952. rightEdge = Math.max(rightEdge, breadth + _this.getBreadthNodeSize(n));
  5953. maxDepthLayer = Math.max(maxDepthLayer, _this.getDepthNodeSize(n));
  5954. });
  5955. totalDepth += maxDepthLayer;
  5956. currentPosition = this_1.setBreadth(currentPosition, 0);
  5957. currentPosition = this_1.setDepthOffset(currentPosition, this_1.getDirectionValue(maxDepthLayer + this_1.settings.layerSpacing));
  5958. };
  5959. var this_1 = this;
  5960. for (var i = 0; i < sortedLayers.length; i++) {
  5961. _loop_1(i);
  5962. }
  5963. totalDepth += (sortedLayers.length - 1) * this.settings.layerSpacing;
  5964. var layout = new GraphLayout_1.GraphLayout();
  5965. this.createNodesLayout(coordinatedGraph, layout, leftEdge, totalDepth, positions);
  5966. this.createEdgesLayout(coordinatedGraph, layout, reversedEdges, removedEdges);
  5967. return layout;
  5968. //this.getDummyEdgesRoutes(infoGraph);
  5969. };
  5970. SugiyamaLayoutBuilder.prototype.createNodesLayout = function (infoGraph, layout, leftEdge, totalDepth, positions) {
  5971. var _this = this;
  5972. var offset = this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical ?
  5973. new Utils_1.Point(-leftEdge, this.chooseDirectionValue(0, totalDepth)) :
  5974. new Utils_1.Point(this.chooseDirectionValue(0, totalDepth), -leftEdge);
  5975. infoGraph.items.forEach(function (n) {
  5976. if (!n.isDummy) {
  5977. var node = _this.graph.getNode(n.key);
  5978. layout.addNode(new NodeLayout_1.NodeLayout(node, positions[n.key].offset(offset.x, offset.y)));
  5979. }
  5980. });
  5981. };
  5982. SugiyamaLayoutBuilder.prototype.createEdgesLayout = function (infoGraph, layout, reversedEdges, removedEdges) {
  5983. var DIRECT = this.getDirectEdgeLayout();
  5984. var TOP_TO_BOTTOM = this.getDiffLevelEdgeLayout(true);
  5985. var BOTTOM_TO_TOP = this.getDiffLevelEdgeLayout(false);
  5986. var TOP_TO_TOP = this.getSameLevelEdgeLayout(true);
  5987. var BOTTOM_TO_BOTTOM = this.getSameLevelEdgeLayout(false);
  5988. var occupied = {};
  5989. infoGraph.edges
  5990. .filter(function (e) { return !e.isDummy; })
  5991. .concat(removedEdges.map(function (e) { return new EdgeOnLayer(e.key, false, e.from, e.to); }))
  5992. .sort(function (a, b) {
  5993. return (infoGraph.getNode(a.originFrom).layer - infoGraph.getNode(b.originFrom).layer) ||
  5994. (infoGraph.getNode(a.to).layer - infoGraph.getNode(b.to).layer);
  5995. })
  5996. .forEach(function (e) {
  5997. var isReversed = reversedEdges[e.key];
  5998. var from = infoGraph.getNode(isReversed ? e.to : e.originFrom);
  5999. var to = infoGraph.getNode(isReversed ? e.originFrom : e.to);
  6000. if (to.layer - from.layer === 1)
  6001. layout.addEdge(new NodeLayout_1.EdgeLayout(e.key, DIRECT.from, DIRECT.to));
  6002. else {
  6003. var candidates_1 = [];
  6004. if (to.position - from.position >= 1) {
  6005. candidates_1.push(TOP_TO_BOTTOM);
  6006. candidates_1.push({ from: DIRECT.from, to: TOP_TO_BOTTOM.to });
  6007. candidates_1.push({ from: TOP_TO_BOTTOM.from, to: DIRECT.to });
  6008. }
  6009. else if (to.position - from.position <= -1) {
  6010. candidates_1.push(BOTTOM_TO_TOP);
  6011. candidates_1.push({ from: DIRECT.from, to: BOTTOM_TO_TOP.to });
  6012. candidates_1.push({ from: BOTTOM_TO_TOP.from, to: DIRECT.to });
  6013. }
  6014. else {
  6015. var oneliner = from.position === to.position && to.position === 0 ? [TOP_TO_TOP, BOTTOM_TO_BOTTOM] : [BOTTOM_TO_BOTTOM, TOP_TO_TOP];
  6016. oneliner.forEach(function (c) { return candidates_1.push(c); });
  6017. oneliner.forEach(function (c) {
  6018. candidates_1.push({ from: c.from, to: DIRECT.to });
  6019. candidates_1.push({ from: DIRECT.from, to: c.to });
  6020. });
  6021. }
  6022. candidates_1.push(DIRECT);
  6023. for (var i = 0, candidate = void 0; candidate = candidates_1[i]; i++) {
  6024. var fromKey = from.key + "_" + candidate.from;
  6025. var toKey = to.key + "_" + candidate.to;
  6026. if (occupied[fromKey] !== Connector_1.ConnectorPosition.End && occupied[toKey] !== Connector_1.ConnectorPosition.Begin) {
  6027. layout.addEdge(new NodeLayout_1.EdgeLayout(e.key, candidate.from, candidate.to));
  6028. occupied[fromKey] = Connector_1.ConnectorPosition.Begin;
  6029. occupied[toKey] = Connector_1.ConnectorPosition.End;
  6030. break;
  6031. }
  6032. }
  6033. }
  6034. });
  6035. };
  6036. SugiyamaLayoutBuilder.prototype.getDirectEdgeLayout = function () {
  6037. if (this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal)
  6038. return this.settings.direction === LayoutSettings_1.LogicalDirectionKind.Forward ? { from: 1, to: 3 } : { from: 3, to: 1 };
  6039. return this.settings.direction === LayoutSettings_1.LogicalDirectionKind.Forward ? { from: 2, to: 0 } : { from: 0, to: 2 };
  6040. };
  6041. SugiyamaLayoutBuilder.prototype.getDiffLevelEdgeLayout = function (topToBottom) {
  6042. if (this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal)
  6043. return topToBottom ? { from: 2, to: 0 } : { from: 0, to: 2 };
  6044. return topToBottom ? { from: 3, to: 1 } : { from: 1, to: 3 };
  6045. };
  6046. SugiyamaLayoutBuilder.prototype.getSameLevelEdgeLayout = function (topToBottom) {
  6047. if (this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal)
  6048. return topToBottom ? { from: 0, to: 0 } : { from: 2, to: 2 };
  6049. return topToBottom ? { from: 3, to: 3 } : { from: 1, to: 1 };
  6050. };
  6051. // private getDummyEdgesRoutes(infoGraph: FastGraph<NodeOnLayer, EdgeOnLayer>): {[nodeKey: string]: NodeOnLayer[]} {
  6052. // let resultRoutes: {[nodeKey: string]: NodeOnLayer[]} = {};
  6053. // let dummyEdgeRoutes: {[edgeHash: string]: NodeOnLayer[]} = {};
  6054. // infoGraph.edges
  6055. // .filter(e => !infoGraph.getNode(e.from).isDummy && infoGraph.getNode(e.to).isDummy)
  6056. // .forEach(rootEdge => {
  6057. // let edgeHash = rootEdge.getHashCode();
  6058. // dummyEdgeRoutes[edgeHash] = [];
  6059. // let iterator = infoGraph.createIterator(ConnectionMode.Outgoing);
  6060. // iterator.visitEachEdgeOnce = false;
  6061. // iterator.onNode = (n) => dummyEdgeRoutes[edgeHash].push(n);
  6062. // iterator.skipNode = (n) => !n.isDummy;
  6063. // iterator.skipEdge = (e) => false;
  6064. // iterator.onEdge = (e, out) => {
  6065. // if(!infoGraph.getNode(e.to).isDummy)
  6066. // resultRoutes[new EdgeOnLayer(e.key, e.isDummy, rootEdge.from, e.to).getHashCode()] = dummyEdgeRoutes[edgeHash];
  6067. // };
  6068. // iterator.iterate(rootEdge.to);
  6069. // });
  6070. // return resultRoutes;
  6071. // }
  6072. SugiyamaLayoutBuilder.prototype.getAbsOffsetInfo = function (nodesInfos) {
  6073. var _this = this;
  6074. var absOffsetMatrix = {};
  6075. var addCell = function (n, intAbsCoord) {
  6076. if (absOffsetMatrix[intAbsCoord] === undefined)
  6077. absOffsetMatrix[intAbsCoord] = _this.getBreadthNodeSize(n);
  6078. absOffsetMatrix[intAbsCoord] = Math.max(absOffsetMatrix[intAbsCoord], _this.getBreadthNodeSize(n));
  6079. };
  6080. nodesInfos.forEach(function (n) {
  6081. var intAbsCoord = Math.trunc(n.position);
  6082. addCell(n, intAbsCoord);
  6083. if (absOffsetMatrix[intAbsCoord] % 1 !== 0)
  6084. addCell(n, intAbsCoord + 1);
  6085. });
  6086. var absOffsetInfo = {};
  6087. var leftOffset = 0;
  6088. Object.keys(absOffsetMatrix).sort().forEach(function (coord) {
  6089. absOffsetInfo[coord] = { leftOffset: leftOffset, width: absOffsetMatrix[coord] };
  6090. leftOffset += absOffsetMatrix[coord] + _this.settings.columnSpacing;
  6091. });
  6092. return absOffsetInfo;
  6093. };
  6094. SugiyamaLayoutBuilder.prototype.setBreadth = function (position, breadthPosition) {
  6095. if (this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical)
  6096. return new Utils_1.Point(breadthPosition, position.y);
  6097. return new Utils_1.Point(position.x, breadthPosition);
  6098. };
  6099. SugiyamaLayoutBuilder.prototype.setDepthOffset = function (position, offset) {
  6100. if (this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal)
  6101. return new Utils_1.Point(position.x + offset, position.y);
  6102. return new Utils_1.Point(position.x, position.y + offset);
  6103. };
  6104. SugiyamaLayoutBuilder.prototype.getAbsPosition = function (absCoordinate, itemSize, absoluteOffsetInfo) {
  6105. var intAbsCoord = Math.trunc(absCoordinate);
  6106. var absLeftOffset = absoluteOffsetInfo[intAbsCoord].leftOffset;
  6107. var cellWidth = absoluteOffsetInfo[intAbsCoord].width;
  6108. if (absCoordinate % 1 === 0)
  6109. return absLeftOffset + (cellWidth - itemSize) / 2;
  6110. return absLeftOffset + cellWidth - (itemSize - this.settings.columnSpacing) / 2;
  6111. };
  6112. SugiyamaLayoutBuilder.prototype.getBreadthNodeSize = function (node) {
  6113. return node.isDummy ? 0 : this.getBreadthNodeSizeCore(this.graph.getNode(node.key));
  6114. };
  6115. SugiyamaLayoutBuilder.prototype.getDepthNodeSize = function (node) {
  6116. return node.isDummy ? 0 : this.getDepthNodeSizeCore(this.graph.getNode(node.key));
  6117. };
  6118. return SugiyamaLayoutBuilder;
  6119. }(BaseBuilder_1.LayoutBuilder));
  6120. exports.SugiyamaLayoutBuilder = SugiyamaLayoutBuilder;
  6121. var SugiyamaLayerDistributor = /** @class */ (function () {
  6122. function SugiyamaLayerDistributor() {
  6123. }
  6124. SugiyamaLayerDistributor.getLayers = function (acyclicGraph) {
  6125. var feasibleTree = this.getFeasibleTree(acyclicGraph);
  6126. return this.calcNodesLayers(feasibleTree);
  6127. };
  6128. SugiyamaLayerDistributor.getFeasibleTree = function (graph) {
  6129. var layers = this.initLayerAssignment(graph);
  6130. return graph.getSpanningGraph(graph.nodes[0], Structures_1.ConnectionMode.OutgoingAndIncoming, function (e) { return layers[e.to] - layers[e.from]; });
  6131. };
  6132. SugiyamaLayerDistributor.initLayerAssignment = function (graph) {
  6133. var layers = {};
  6134. var currentLayer = 0;
  6135. var actualAssignedNodes = {};
  6136. var assigningNodes = graph.nodes.filter(function (n) { return !graph.getAdjacentEdges(n, Structures_1.ConnectionMode.Incoming).length; });
  6137. var _loop_2 = function () {
  6138. assigningNodes.forEach(function (n) {
  6139. layers[n] = currentLayer;
  6140. actualAssignedNodes[n] = true;
  6141. });
  6142. Object.keys(actualAssignedNodes).forEach(function (n) {
  6143. if (graph.getAdjacentEdges(n, Structures_1.ConnectionMode.Outgoing).filter(function (e) { return layers[e.to] === undefined; }).length === 0)
  6144. delete actualAssignedNodes[n];
  6145. });
  6146. var assigningNodesSet = {};
  6147. Object.keys(actualAssignedNodes).forEach(function (n) {
  6148. graph.getAdjacentEdges(n, Structures_1.ConnectionMode.Outgoing)
  6149. .map(function (e) { return e.to; })
  6150. .filter(function (n) { return layers[n] === undefined && graph.getAdjacentEdges(n, Structures_1.ConnectionMode.Incoming).reduce(function (acc, e) { return acc && layers[e.from] !== undefined; }, true); })
  6151. .forEach(function (n) { return assigningNodesSet[n] = true; });
  6152. });
  6153. assigningNodes = Object.keys(assigningNodesSet);
  6154. currentLayer++;
  6155. };
  6156. while (assigningNodes.length) {
  6157. _loop_2();
  6158. }
  6159. return layers;
  6160. };
  6161. SugiyamaLayerDistributor.calcNodesLayers = function (graph) {
  6162. var layers = {};
  6163. var minLayer = Number.MAX_SAFE_INTEGER;
  6164. var currentLevel = 0;
  6165. var iterator = graph.createIterator(Structures_1.ConnectionMode.OutgoingAndIncoming);
  6166. iterator.visitEachEdgeOnce = false;
  6167. iterator.onNode = function (n) {
  6168. layers[n.key] = currentLevel;
  6169. minLayer = Math.min(minLayer, currentLevel);
  6170. };
  6171. iterator.skipNode = function (n) { return layers[n.key] !== undefined; };
  6172. iterator.skipEdge = function (e) { return layers[e.from] !== undefined && layers[e.to] !== undefined; };
  6173. iterator.onEdge = function (e, out) {
  6174. if (out)
  6175. currentLevel = layers[e.from] + 1;
  6176. else
  6177. currentLevel = layers[e.to] - 1;
  6178. };
  6179. iterator.iterate(graph.nodes[0]);
  6180. for (var key in layers) {
  6181. if (!layers.hasOwnProperty(key))
  6182. continue;
  6183. layers[key] -= minLayer;
  6184. }
  6185. return layers;
  6186. };
  6187. return SugiyamaLayerDistributor;
  6188. }());
  6189. exports.SugiyamaLayerDistributor = SugiyamaLayerDistributor;
  6190. var SugiyamaNodesOrderer = /** @class */ (function () {
  6191. function SugiyamaNodesOrderer() {
  6192. this.idCounter = -10000;
  6193. }
  6194. SugiyamaNodesOrderer.prototype.orderNodes = function (graph, layers) {
  6195. var maxIteration = 14; //magic number - http://www.graphviz.org/Documentation/TSE93.pdf PAGE (14)
  6196. var currentIteration = 1;
  6197. var graphInfo = this.initGraphInfo(graph, layers);
  6198. var nodeInfos = graphInfo.items;
  6199. var orderInfo = this.initOrder(nodeInfos);
  6200. var bestNodesPositions = this.getNodeToPositionMap(nodeInfos);
  6201. var bestCrossCount = this.getCrossCount(orderInfo, graphInfo);
  6202. var isParentToChildren = true;
  6203. while (currentIteration < maxIteration && bestCrossCount != 0) {
  6204. orderInfo = this.getNodesOrder(orderInfo, graphInfo, isParentToChildren);
  6205. var crossCount = this.getCrossCount(orderInfo, graphInfo);
  6206. if (crossCount < bestCrossCount) {
  6207. bestNodesPositions = this.getNodeToPositionMap(graphInfo.items);
  6208. bestCrossCount = crossCount;
  6209. }
  6210. isParentToChildren = !isParentToChildren;
  6211. currentIteration++;
  6212. }
  6213. //transpose() procedure doesn`t implement.
  6214. //http://www.graphviz.org/Documentation/TSE93.pdf PAGE(16)
  6215. graphInfo.items.forEach(function (n) { return n.position = bestNodesPositions[n.key]; });
  6216. return graphInfo;
  6217. };
  6218. SugiyamaNodesOrderer.prototype.getNodesOrder = function (current, graph, isParentToChildren) {
  6219. var _this = this;
  6220. var order = {};
  6221. var _loop_3 = function (layer) {
  6222. if (!current.hasOwnProperty(layer))
  6223. return "continue";
  6224. var nodePositions = {};
  6225. current[layer].forEach(function (ni) {
  6226. var adjacentNodesPositions = (isParentToChildren ? graph.getChildren(ni.key) : graph.getParents(ni.key))
  6227. .map(function (nk) { return graph.getNode(nk).position; });
  6228. nodePositions[ni.key] = _this.getNodePosition(adjacentNodesPositions);
  6229. });
  6230. order[layer] = this_2.sortNodes(nodePositions, graph);
  6231. };
  6232. var this_2 = this;
  6233. for (var layer in current) {
  6234. _loop_3(layer);
  6235. }
  6236. return order;
  6237. };
  6238. SugiyamaNodesOrderer.prototype.sortNodes = function (nodePositions, graph) {
  6239. return Object.keys(nodePositions)
  6240. .sort(function (a, b) { return nodePositions[a] - nodePositions[b]; })
  6241. .map(function (nk, index) {
  6242. var node = graph.getNode(nk);
  6243. node.position = index;
  6244. return node;
  6245. });
  6246. };
  6247. SugiyamaNodesOrderer.prototype.getNodePosition = function (adjacentNodesPositions) {
  6248. adjacentNodesPositions = adjacentNodesPositions.sort();
  6249. if (!adjacentNodesPositions.length)
  6250. return 0;
  6251. var medianIndex = Math.floor(adjacentNodesPositions.length / 2);
  6252. if (adjacentNodesPositions.length === 2 || adjacentNodesPositions.length % 2 === 1)
  6253. return adjacentNodesPositions[medianIndex];
  6254. var leftMedianPosition = adjacentNodesPositions[medianIndex - 1] - adjacentNodesPositions[0];
  6255. var rightMedianPosition = adjacentNodesPositions[adjacentNodesPositions.length - 1] - adjacentNodesPositions[medianIndex];
  6256. return Math.floor((adjacentNodesPositions[medianIndex - 1] * rightMedianPosition + adjacentNodesPositions[medianIndex] * leftMedianPosition) /
  6257. (leftMedianPosition + rightMedianPosition));
  6258. };
  6259. SugiyamaNodesOrderer.prototype.initOrder = function (nodeInfos) {
  6260. var result = {};
  6261. nodeInfos.forEach(function (ni) { return (result[ni.layer] || (result[ni.layer] = [])).push(ni); });
  6262. return result;
  6263. };
  6264. SugiyamaNodesOrderer.prototype.getCrossCount = function (orderInfo, graph) {
  6265. var count = 0;
  6266. var _loop_4 = function (layer) {
  6267. if (!orderInfo.hasOwnProperty(layer))
  6268. return "continue";
  6269. var viewedAdjacentNodesPositions = [];
  6270. orderInfo[layer].forEach(function (n) {
  6271. var positions = graph.getChildren(n.key).map(function (c) { return graph.getNode(c).position; });
  6272. positions.forEach(function (p) {
  6273. count += viewedAdjacentNodesPositions.filter(function (vp) { return p < vp; }).length;
  6274. });
  6275. viewedAdjacentNodesPositions.push.apply(viewedAdjacentNodesPositions, positions);
  6276. });
  6277. };
  6278. for (var layer in orderInfo) {
  6279. _loop_4(layer);
  6280. }
  6281. return count;
  6282. };
  6283. SugiyamaNodesOrderer.prototype.initGraphInfo = function (graph, layers) {
  6284. var _this = this;
  6285. var countNodesOnLayer = {};
  6286. var nodesInfoMap = {};
  6287. var nodeInfos = [];
  6288. var edgeInfos = [];
  6289. graph.nodes.forEach(function (n) {
  6290. var layer = layers[n];
  6291. if (countNodesOnLayer[layer] === undefined)
  6292. countNodesOnLayer[layer] = 0;
  6293. var info = new NodeOnLayer(n, false, layer, countNodesOnLayer[layer]++);
  6294. nodesInfoMap[n] = info;
  6295. nodeInfos.push(info);
  6296. });
  6297. graph.edges.forEach(function (e) {
  6298. var span = layers[e.to] - layers[e.from];
  6299. if (span > 1) {
  6300. var prevNodeInfo = nodesInfoMap[e.from];
  6301. for (var delta = 1; delta < span; delta++) {
  6302. var dNodeInfo = new NodeOnLayer(_this.createDummyID(), true, layers[e.from] + delta, countNodesOnLayer[layers[e.from] + delta]++);
  6303. edgeInfos.push(new EdgeOnLayer(_this.createDummyID(), true, prevNodeInfo.key, dNodeInfo.key));
  6304. nodeInfos.push(dNodeInfo);
  6305. prevNodeInfo = dNodeInfo;
  6306. }
  6307. edgeInfos.push(new EdgeOnLayer(e.key, false, prevNodeInfo.key, nodesInfoMap[e.to].key, nodesInfoMap[e.from].key));
  6308. }
  6309. else
  6310. edgeInfos.push(new EdgeOnLayer(e.key, false, nodesInfoMap[e.from].key, nodesInfoMap[e.to].key));
  6311. });
  6312. return new Graph_1.FastGraph(nodeInfos, edgeInfos);
  6313. };
  6314. SugiyamaNodesOrderer.prototype.createDummyID = function () {
  6315. return "dummy_" + --this.idCounter;
  6316. };
  6317. SugiyamaNodesOrderer.prototype.getNodeToPositionMap = function (nodeInfos) {
  6318. return nodeInfos.reduce(function (acc, ni) {
  6319. acc[ni.key] = ni.position;
  6320. return acc;
  6321. }, {});
  6322. };
  6323. // absolute positioning
  6324. SugiyamaNodesOrderer.prototype.assignAbsCoordinates = function (graph) {
  6325. var absCoordinates = this.getAbsCoodinate(graph);
  6326. return new Graph_1.FastGraph(graph.items.map(function (n) { return new NodeOnLayer(n.key, n.isDummy, n.layer, absCoordinates[n.key]); }), graph.edges.slice(0));
  6327. };
  6328. SugiyamaNodesOrderer.prototype.getAbsCoodinate = function (graph) {
  6329. var _this = this;
  6330. var orderInfo = graph.items.reduce(function (acc, n) {
  6331. acc[n.layer] = acc[n.layer] || [];
  6332. var pos = Utils_1.Utils.binaryIndexOf(acc[n.layer], function (ni) { return ni.position - n.position; });
  6333. acc[n.layer].splice(pos < 0 ? ~pos : pos, 0, n);
  6334. return acc;
  6335. }, {});
  6336. var medianPositions = [MedianAlignmentMode.TopLeft, MedianAlignmentMode.TopRight, MedianAlignmentMode.BottomLeft, MedianAlignmentMode.BottomRight]
  6337. .map(function (alignment) { return _this.getPositionByMedian(graph, alignment, orderInfo); });
  6338. var nodeToPosition = {};
  6339. graph.items.forEach(function (n) {
  6340. var posList = medianPositions.map(function (positions) { return positions[n.key]; }).sort();
  6341. nodeToPosition[n.key] = (posList[1] + posList[2]) / 2;
  6342. });
  6343. return nodeToPosition;
  6344. };
  6345. SugiyamaNodesOrderer.prototype.getPositionByMedian = function (graph, alignment, orderInfo) {
  6346. var nodeInfos = graph.items;
  6347. var positions = this.getNodeToPositionMap(nodeInfos);
  6348. var medians = this.getMedians(graph, nodeInfos, alignment);
  6349. medians = this.resolveMedianConflicts(graph, orderInfo, medians, alignment);
  6350. this.getSortedBlocks(graph, nodeInfos, medians, alignment)
  6351. .forEach(function (block) {
  6352. var maxPos = block.reduce(function (acc, n) { return positions[n.key] > acc ? positions[n.key] : acc; }, -2);
  6353. block.forEach(function (n) {
  6354. var delta = maxPos - positions[n.key];
  6355. if (delta > 0) {
  6356. orderInfo[n.layer]
  6357. .filter(function (ln) { return ln.position > n.position; })
  6358. .forEach(function (ln) { return positions[ln.key] += delta; });
  6359. }
  6360. positions[n.key] = maxPos;
  6361. });
  6362. });
  6363. return positions;
  6364. };
  6365. SugiyamaNodesOrderer.prototype.getSortedBlocks = function (graph, nodeInfos, medians, alignment) {
  6366. var blocks = [];
  6367. var isBottom = alignment === MedianAlignmentMode.BottomLeft || alignment === MedianAlignmentMode.BottomRight;
  6368. var allNodesInfo = new ListUtils_1.HashSet(nodeInfos.slice(0).sort(function (a, b) { return isBottom ? (a.layer - b.layer) : (b.layer - a.layer); }), function (n) { return n.key; });
  6369. while (allNodesInfo.length) {
  6370. var firstNode = allNodesInfo.item(0);
  6371. var block = this.getBlock(graph, firstNode, medians, alignment);
  6372. blocks.push(block);
  6373. block.forEach(function (n) { return allNodesInfo.remove(n); });
  6374. }
  6375. blocks.sort(function (x, y) {
  6376. var xMinNodeInfo = x.reduce(function (min, n) { return n.position < min.position ? n : min; }, x[0]);
  6377. var yOnMinXLayer = y.filter(function (n) { return n.layer == xMinNodeInfo.layer; })[0];
  6378. if (yOnMinXLayer)
  6379. return xMinNodeInfo.position - yOnMinXLayer.position;
  6380. var yMinNodeInfo = y.reduce(function (min, n) { return n.position < min.position ? n : min; }, y[0]);
  6381. var xOnMinXLayer = x.filter(function (n) { return n.layer == yMinNodeInfo.layer; })[0];
  6382. if (xOnMinXLayer)
  6383. return xOnMinXLayer.position - yMinNodeInfo.position;
  6384. return xMinNodeInfo.layer - yMinNodeInfo.layer;
  6385. });
  6386. return blocks;
  6387. };
  6388. SugiyamaNodesOrderer.prototype.getBlock = function (graph, root, medians, alignment) {
  6389. var block = [];
  6390. var median = null;
  6391. do {
  6392. if (median)
  6393. root = alignment === MedianAlignmentMode.TopLeft || alignment === MedianAlignmentMode.TopRight ? graph.getNode(median.from) : graph.getNode(median.to);
  6394. block.push(root);
  6395. median = medians[root.key];
  6396. } while (median);
  6397. return block;
  6398. };
  6399. SugiyamaNodesOrderer.prototype.resolveMedianConflicts = function (graph, layers, medians, alignment) {
  6400. var _this = this;
  6401. var filteredMedians = {};
  6402. var _loop_5 = function (layer) {
  6403. var minPos = undefined, maxPos = undefined;
  6404. if (!layers.hasOwnProperty(layer))
  6405. return "continue";
  6406. var nodeInfos = layers[layer];
  6407. if (alignment === MedianAlignmentMode.TopRight || alignment === MedianAlignmentMode.BottomRight)
  6408. nodeInfos = nodeInfos.slice(0).sort(function (a, b) { return b.position - a.position; }); // sorted descending
  6409. nodeInfos.forEach(function (n) {
  6410. var median = medians[n.key];
  6411. if (!median)
  6412. filteredMedians[n.key] = null;
  6413. else {
  6414. var medianItemKey = alignment === MedianAlignmentMode.TopLeft || alignment === MedianAlignmentMode.TopRight ? median.from : median.to;
  6415. var medianPosition = graph.getNode(medianItemKey).position;
  6416. if (_this.checkMedianConfict(minPos, maxPos, medianPosition, alignment))
  6417. filteredMedians[n.key] = null;
  6418. else {
  6419. minPos = minPos === undefined ? medianPosition : Math.min(minPos, medianPosition);
  6420. maxPos = maxPos === undefined ? medianPosition : Math.max(maxPos, medianPosition);
  6421. filteredMedians[n.key] = median;
  6422. }
  6423. }
  6424. });
  6425. };
  6426. for (var layer in layers) {
  6427. _loop_5(layer);
  6428. }
  6429. return filteredMedians;
  6430. };
  6431. SugiyamaNodesOrderer.prototype.checkMedianConfict = function (min, max, medianPosition, alignment) {
  6432. if (min === undefined || max === undefined)
  6433. return false;
  6434. if (alignment === MedianAlignmentMode.TopLeft || alignment === MedianAlignmentMode.BottomLeft)
  6435. return max >= medianPosition;
  6436. return min <= medianPosition;
  6437. };
  6438. SugiyamaNodesOrderer.prototype.getMedians = function (graph, nodeInfos, alignment) {
  6439. var _this = this;
  6440. var medians = {};
  6441. nodeInfos.forEach(function (n) {
  6442. var actualAdjacentEdges = _this.getActualAdjacentEdges(graph, n, alignment);
  6443. var medianPosition = _this.getMedianPosition(actualAdjacentEdges.length, alignment);
  6444. medians[n.key] = actualAdjacentEdges[medianPosition];
  6445. });
  6446. return medians;
  6447. };
  6448. SugiyamaNodesOrderer.prototype.getMedianPosition = function (length, alignment) {
  6449. if (length === 0)
  6450. return -1;
  6451. if (length % 2 !== 0)
  6452. return Math.floor(length / 2);
  6453. if (alignment === MedianAlignmentMode.TopLeft || alignment === MedianAlignmentMode.BottomLeft)
  6454. return Math.floor(length / 2) - 1;
  6455. if (alignment === MedianAlignmentMode.TopRight || alignment === MedianAlignmentMode.BottomRight)
  6456. return Math.floor(length / 2);
  6457. throw new Error("Invalid Operation");
  6458. };
  6459. SugiyamaNodesOrderer.prototype.getActualAdjacentEdges = function (graph, node, alignment) {
  6460. if (alignment === MedianAlignmentMode.TopLeft || alignment === MedianAlignmentMode.TopRight)
  6461. return graph.getAdjacentEdges(node.key, Structures_1.ConnectionMode.Incoming).sort(function (a, b) { return graph.getNode(a.from).position - graph.getNode(b.from).position; });
  6462. return graph.getAdjacentEdges(node.key, Structures_1.ConnectionMode.Outgoing).sort(function (a, b) { return graph.getNode(a.to).position - graph.getNode(b.to).position; });
  6463. };
  6464. return SugiyamaNodesOrderer;
  6465. }());
  6466. exports.SugiyamaNodesOrderer = SugiyamaNodesOrderer;
  6467. var NodeOnLayer = /** @class */ (function () {
  6468. function NodeOnLayer(key, isDummy, layer, position) {
  6469. this.key = key;
  6470. this.isDummy = isDummy;
  6471. this.layer = layer;
  6472. this.position = position;
  6473. }
  6474. NodeOnLayer.prototype.getHashCode = function () {
  6475. return this.key.toString();
  6476. };
  6477. return NodeOnLayer;
  6478. }());
  6479. exports.NodeOnLayer = NodeOnLayer;
  6480. var EdgeOnLayer = /** @class */ (function () {
  6481. function EdgeOnLayer(key, isDummy, from, to, originFrom) {
  6482. this.key = key;
  6483. this.isDummy = isDummy;
  6484. this.from = from;
  6485. this.to = to;
  6486. this._originFrom = originFrom;
  6487. }
  6488. EdgeOnLayer.prototype.getHashCode = function () {
  6489. return this.from + "-" + this.to;
  6490. };
  6491. Object.defineProperty(EdgeOnLayer.prototype, "originFrom", {
  6492. get: function () {
  6493. return this._originFrom !== undefined ? this._originFrom : this.from;
  6494. },
  6495. enumerable: true,
  6496. configurable: true
  6497. });
  6498. return EdgeOnLayer;
  6499. }());
  6500. exports.EdgeOnLayer = EdgeOnLayer;
  6501. var MedianAlignmentMode;
  6502. (function (MedianAlignmentMode) {
  6503. MedianAlignmentMode[MedianAlignmentMode["TopLeft"] = 0] = "TopLeft";
  6504. MedianAlignmentMode[MedianAlignmentMode["TopRight"] = 1] = "TopRight";
  6505. MedianAlignmentMode[MedianAlignmentMode["BottomLeft"] = 2] = "BottomLeft";
  6506. MedianAlignmentMode[MedianAlignmentMode["BottomRight"] = 3] = "BottomRight";
  6507. })(MedianAlignmentMode || (MedianAlignmentMode = {}));
  6508. /***/ }),
  6509. /* 41 */
  6510. /***/ (function(module, exports, __webpack_require__) {
  6511. "use strict";
  6512. var __extends = (this && this.__extends) || (function () {
  6513. var extendStatics = function (d, b) {
  6514. extendStatics = Object.setPrototypeOf ||
  6515. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6516. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6517. return extendStatics(d, b);
  6518. };
  6519. return function (d, b) {
  6520. extendStatics(d, b);
  6521. function __() { this.constructor = d; }
  6522. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6523. };
  6524. })();
  6525. Object.defineProperty(exports, "__esModule", { value: true });
  6526. var StylePropertyCommandBase_1 = __webpack_require__(85);
  6527. var ChangeStyleTextHistoryItem_1 = __webpack_require__(42);
  6528. var Style_1 = __webpack_require__(47);
  6529. var ToggleStyleTextPropertyCommand = /** @class */ (function (_super) {
  6530. __extends(ToggleStyleTextPropertyCommand, _super);
  6531. function ToggleStyleTextPropertyCommand() {
  6532. return _super !== null && _super.apply(this, arguments) || this;
  6533. }
  6534. ToggleStyleTextPropertyCommand.prototype.getStateValue = function () {
  6535. var value = this.control.selection.inputPosition.getStyleTextPropertyValue(this.getStyleProperty());
  6536. return value === this.getStylePropertyValue();
  6537. };
  6538. ToggleStyleTextPropertyCommand.prototype.executeCore = function (state) {
  6539. var _this = this;
  6540. this.control.history.beginTransaction();
  6541. var styleProperty = this.getStyleProperty();
  6542. var styleValue = state.value ? Style_1.StyleText.defaultInstace[styleProperty] : this.getStylePropertyValue();
  6543. var items = this.control.selection.getSelectedItems();
  6544. items.forEach(function (item) {
  6545. _this.control.history.addAndRedo(new ChangeStyleTextHistoryItem_1.ChangeStyleTextHistoryItem(item.key, styleProperty, styleValue));
  6546. });
  6547. this.control.selection.inputPosition.setStyleTextPropertyValue(this.getStyleProperty(), styleValue);
  6548. this.control.history.endTransaction();
  6549. return true;
  6550. };
  6551. ToggleStyleTextPropertyCommand.prototype.getStyleObj = function (item) {
  6552. return item.styleText;
  6553. };
  6554. return ToggleStyleTextPropertyCommand;
  6555. }(StylePropertyCommandBase_1.StylePropertyCommandBase));
  6556. exports.ToggleStyleTextPropertyCommand = ToggleStyleTextPropertyCommand;
  6557. /***/ }),
  6558. /* 42 */
  6559. /***/ (function(module, exports, __webpack_require__) {
  6560. "use strict";
  6561. var __extends = (this && this.__extends) || (function () {
  6562. var extendStatics = function (d, b) {
  6563. extendStatics = Object.setPrototypeOf ||
  6564. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6565. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6566. return extendStatics(d, b);
  6567. };
  6568. return function (d, b) {
  6569. extendStatics(d, b);
  6570. function __() { this.constructor = d; }
  6571. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6572. };
  6573. })();
  6574. Object.defineProperty(exports, "__esModule", { value: true });
  6575. var ChangeStyleHistoryItemBase_1 = __webpack_require__(86);
  6576. var ChangeStyleTextHistoryItem = /** @class */ (function (_super) {
  6577. __extends(ChangeStyleTextHistoryItem, _super);
  6578. function ChangeStyleTextHistoryItem(itemKey, styleProperty, styleValue) {
  6579. return _super.call(this, itemKey, styleProperty, styleValue) || this;
  6580. }
  6581. ChangeStyleTextHistoryItem.prototype.redo = function (manipulator) {
  6582. var item = manipulator.model.findItem(this.itemKey);
  6583. this.oldStyleValue = item.styleText[this.styleProperty];
  6584. manipulator.changeStyleText(item, this.styleProperty, this.styleValue);
  6585. };
  6586. ChangeStyleTextHistoryItem.prototype.undo = function (manipulator) {
  6587. var item = manipulator.model.findItem(this.itemKey);
  6588. manipulator.changeStyleText(item, this.styleProperty, this.oldStyleValue);
  6589. };
  6590. return ChangeStyleTextHistoryItem;
  6591. }(ChangeStyleHistoryItemBase_1.ChangeStyleHistoryItemBase));
  6592. exports.ChangeStyleTextHistoryItem = ChangeStyleTextHistoryItem;
  6593. /***/ }),
  6594. /* 43 */
  6595. /***/ (function(module, exports, __webpack_require__) {
  6596. "use strict";
  6597. var __extends = (this && this.__extends) || (function () {
  6598. var extendStatics = function (d, b) {
  6599. extendStatics = Object.setPrototypeOf ||
  6600. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6601. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6602. return extendStatics(d, b);
  6603. };
  6604. return function (d, b) {
  6605. extendStatics(d, b);
  6606. function __() { this.constructor = d; }
  6607. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6608. };
  6609. })();
  6610. Object.defineProperty(exports, "__esModule", { value: true });
  6611. var CommandBase_1 = __webpack_require__(7);
  6612. var CommandStates_1 = __webpack_require__(6);
  6613. var Graph_1 = __webpack_require__(34);
  6614. var Shape_1 = __webpack_require__(9);
  6615. var Connector_1 = __webpack_require__(5);
  6616. var Structures_1 = __webpack_require__(22);
  6617. var ModelUtils_1 = __webpack_require__(8);
  6618. var LayoutUtils_1 = __webpack_require__(59);
  6619. var LayoutSettings_1 = __webpack_require__(18);
  6620. var AutoLayoutCommandBase = /** @class */ (function (_super) {
  6621. __extends(AutoLayoutCommandBase, _super);
  6622. function AutoLayoutCommandBase() {
  6623. return _super !== null && _super.apply(this, arguments) || this;
  6624. }
  6625. AutoLayoutCommandBase.prototype.getState = function () {
  6626. return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty());
  6627. };
  6628. AutoLayoutCommandBase.prototype.executeCore = function (state, parameter) {
  6629. var _this = this;
  6630. this.control.history.beginTransaction();
  6631. var graph = this.getGraphBySelection();
  6632. var layout = this.createLayout(graph);
  6633. var nonGraphItems = ModelUtils_1.ModelUtils.getSymmetricDifference(layout.nodeToLayout, this.control.model.items);
  6634. layout = ModelUtils_1.ModelUtils.offsetLayoutToFreeSpace(layout, nonGraphItems.map(function (i) { return i.rectangle; }));
  6635. if (this.control.model.snapToGrid)
  6636. ModelUtils_1.ModelUtils.adjustLayoutToSnapGrid(this.control.model, layout);
  6637. ModelUtils_1.ModelUtils.applyLayoutToNodes(this.control.history, this.control.model, layout, graph.edges.map(function (e) { return _this.control.model.findConnector(e.key); }));
  6638. ModelUtils_1.ModelUtils.applyLayoutToConnectors(this.control.history, layout, graph.edges.map(function (e) { return _this.control.model.findConnector(e.key); }));
  6639. ModelUtils_1.ModelUtils.tryUpdateModelSize(this.control.history, this.control.model);
  6640. this.control.history.endTransaction();
  6641. return true;
  6642. };
  6643. AutoLayoutCommandBase.prototype.getGraphBySelection = function () {
  6644. var _this = this;
  6645. var selectedItems = this.control.selection.getSelectedItems();
  6646. var graph = new Graph_1.Graph([], []);
  6647. var knownIds = {};
  6648. selectedItems.forEach(function (c) { return _this.extendByConnectedComponents(c, graph, knownIds); });
  6649. graph.nodes = graph.nodes.sort(function (a, b) { return _this.control.model.findShape(a).key.localeCompare(_this.control.model.findShape(b).key); });
  6650. return graph;
  6651. };
  6652. AutoLayoutCommandBase.prototype.extendByConnectedComponents = function (item, graph, knownIds) {
  6653. var _this = this;
  6654. if (!item || knownIds[item.key])
  6655. return;
  6656. knownIds[item.key] = true;
  6657. if (item instanceof Connector_1.Connector && item.beginItem && item.endItem && item.beginItem !== item.endItem) {
  6658. graph.addEdge(new Structures_1.Edge(item.key, item.beginItem && item.beginItem.key, item.endItem && item.endItem.key));
  6659. this.extendByConnectedComponents(item.beginItem, graph, knownIds);
  6660. this.extendByConnectedComponents(item.endItem, graph, knownIds);
  6661. }
  6662. else if (item instanceof Shape_1.Shape) {
  6663. graph.addNode(LayoutUtils_1.LayoutUtils.shapeToLayout(item));
  6664. item.attachedConnectors.forEach(function (c) { return _this.extendByConnectedComponents(c, graph, knownIds); });
  6665. }
  6666. };
  6667. AutoLayoutCommandBase.prototype.createLayoutSettings = function () {
  6668. return (this.control.model.snapToGrid) ? new LayoutSettings_1.TreeLayoutSettings(this.control.model.gridSize) : new LayoutSettings_1.TreeLayoutSettings();
  6669. };
  6670. return AutoLayoutCommandBase;
  6671. }(CommandBase_1.CommandBase));
  6672. exports.AutoLayoutCommandBase = AutoLayoutCommandBase;
  6673. /***/ }),
  6674. /* 44 */
  6675. /***/ (function(module, exports, __webpack_require__) {
  6676. "use strict";
  6677. Object.defineProperty(exports, "__esModule", { value: true });
  6678. var ModelChange_1 = __webpack_require__(48);
  6679. var Shape_1 = __webpack_require__(9);
  6680. var Event_1 = __webpack_require__(14);
  6681. var Connector_1 = __webpack_require__(5);
  6682. var Utils_1 = __webpack_require__(0);
  6683. var UnitConverter_1 = __webpack_require__(13);
  6684. var Model_1 = __webpack_require__(21);
  6685. var ConnectorProperties_1 = __webpack_require__(28);
  6686. var DiagramItem_1 = __webpack_require__(3);
  6687. var TextPrimitive_1 = __webpack_require__(50);
  6688. var RectaglePrimitive_1 = __webpack_require__(53);
  6689. var EllipsePrimitive_1 = __webpack_require__(38);
  6690. var ClipPathPrimitive_1 = __webpack_require__(52);
  6691. var PatternPrimitive_1 = __webpack_require__(182);
  6692. var PathPrimitive_1 = __webpack_require__(2);
  6693. var GroupPrimitive_1 = __webpack_require__(183);
  6694. var MaskPrimitive_1 = __webpack_require__(184);
  6695. var TextFilterPrimitive_1 = __webpack_require__(72);
  6696. var RenderManager_1 = __webpack_require__(10);
  6697. var Browser_1 = __webpack_require__(20);
  6698. var LinePrimitive_1 = __webpack_require__(69);
  6699. var ExtensionLinesVisualizer_1 = __webpack_require__(92);
  6700. var Utils_2 = __webpack_require__(26);
  6701. var Base_1 = __webpack_require__(19);
  6702. var CanvasManager = /** @class */ (function () {
  6703. function CanvasManager(svgElement) {
  6704. this.itemSelectorGroupContainers = {};
  6705. this.itemSelectorElements = {};
  6706. this.itemGroupContainers = {};
  6707. this.itemElements = {};
  6708. this.itemSelectionRectElements = {};
  6709. this.connectorSelectionElements = {};
  6710. this.connectorSelectionTextElements = {};
  6711. this.connectorSelectionMaskTextElements = {};
  6712. this.selectionMarkElements = [];
  6713. this.lockedSelectionMarkElements = {};
  6714. this.parameterPointMarkElements = {};
  6715. this.connectionPointElements = [];
  6716. this.connectionTargetElements = [];
  6717. this.connectionMarkElements = [];
  6718. this.extensionLineElements = [];
  6719. this.gridPatternId = Utils_2.RenderUtils.generateSvgElementId("gridPattern");
  6720. this.pagesGridPatternId = Utils_2.RenderUtils.generateSvgElementId("pagesGridPattern");
  6721. this.pagesGridClipId = Utils_2.RenderUtils.generateSvgElementId("pagesGridClip");
  6722. this.initializeContainerElements(svgElement);
  6723. }
  6724. CanvasManager.prototype.initializeContainerElements = function (svgElement) {
  6725. this.svgElement = svgElement;
  6726. this.backgroundContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
  6727. this.itemSelectorsContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
  6728. this.itemsContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
  6729. this.itemSelectionContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
  6730. this.visualizersContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
  6731. this.selectionMarksContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
  6732. };
  6733. CanvasManager.prototype.clear = function () {
  6734. Utils_2.RenderUtils.removeContent(this.itemSelectorsContainer);
  6735. Utils_2.RenderUtils.removeContent(this.itemsContainer);
  6736. Utils_2.RenderUtils.removeContent(this.itemSelectionContainer);
  6737. Utils_2.RenderUtils.removeContent(this.selectionMarksContainer);
  6738. Utils_2.RenderUtils.removeContent(this.visualizersContainer);
  6739. this.itemSelectorGroupContainers = {};
  6740. this.itemSelectorElements = {};
  6741. this.itemGroupContainers = {};
  6742. this.itemElements = {};
  6743. this.itemSelectionRectElements = {};
  6744. this.connectorSelectionElements = {};
  6745. this.connectorSelectionTextElements = {};
  6746. this.connectorSelectionMaskTextElements = {};
  6747. this.selectionMarkElements = [];
  6748. this.lockedSelectionMarkElements = {};
  6749. this.parameterPointMarkElements = {};
  6750. this.selectionRectElement = undefined;
  6751. this.resizeInfoElement = undefined;
  6752. this.connectionPointElements = [];
  6753. this.connectionTargetElements = [];
  6754. this.connectionMarkElements = [];
  6755. this.extensionLineElements = [];
  6756. };
  6757. // Notifications
  6758. CanvasManager.prototype.NotifyModelChanged = function (changes) {
  6759. for (var i = 0, change = void 0; change = changes[i]; i++) {
  6760. if (change instanceof ModelChange_1.ShapeChange)
  6761. this.applyShapeChange(change);
  6762. else if (change instanceof ModelChange_1.ConnectorChange)
  6763. this.applyConnectorChange(change);
  6764. else if (change instanceof ModelChange_1.PageChange)
  6765. this.applyPageChange(change);
  6766. }
  6767. };
  6768. CanvasManager.prototype.NotifyRedrawSelection = function (selection) {
  6769. var _this = this;
  6770. this.hideSelection();
  6771. var items = selection.getSelectedItems(true);
  6772. var shapes = selection.getSelectedShapes(true);
  6773. var connectors = selection.getSelectedConnectors(true);
  6774. if (items.length <= 1) {
  6775. shapes.forEach(function (shape) {
  6776. if (shape.locked)
  6777. _this.showLockedSelectionMarks(shape);
  6778. else {
  6779. var shapeRect = _this.correctShapeSelectionRect(shape.rectangle.multiply(_this.zoomLevel), CanvasManager.selectionRectLineWidth);
  6780. _this.showShapeSelectionRect(shape, shapeRect, Event_1.MouseEventElementType.SelectionRect, "item-selection-rect");
  6781. _this.showShapeSelectionMarks(shape);
  6782. _this.showShapeParameterPoints(shape);
  6783. }
  6784. });
  6785. connectors.forEach(function (connector) {
  6786. if (connector.locked)
  6787. _this.showLockedSelectionMarks(connector);
  6788. else {
  6789. _this.showConnectorSelection(connector, "connector-selection");
  6790. _this.showConnectorSelectionMarks(connector);
  6791. }
  6792. });
  6793. }
  6794. else {
  6795. var rect = this.correctShapeSelectionRect(Model_1.DiagramModel.getRectangle(items.filter(function (item) { return !item.locked; })).multiply(this.zoomLevel), CanvasManager.selectionRectLineWidth);
  6796. this.showShapeSelectionRect(null, rect, Event_1.MouseEventElementType.SelectionRect, "items-selection-rect");
  6797. shapes.forEach(function (shape) {
  6798. if (shape.locked)
  6799. _this.showLockedSelectionMarks(shape);
  6800. else {
  6801. var shapeRect = _this.correctShapeSelectionRect(shape.rectangle.multiply(_this.zoomLevel), CanvasManager.multiSelectionRectLineWidth);
  6802. _this.showShapeSelectionRect(shape, shapeRect, Event_1.MouseEventElementType.SelectionRect, "item-multi-selection-rect");
  6803. _this.showShapeParameterPoints(shape);
  6804. }
  6805. });
  6806. connectors.forEach(function (connector) {
  6807. if (connector.locked)
  6808. _this.showLockedSelectionMarks(connector);
  6809. else
  6810. _this.showConnectorSelection(connector, "connector-multi-selection");
  6811. });
  6812. if (shapes.length > 0)
  6813. this.showSelectionMarks(rect, "-1");
  6814. }
  6815. };
  6816. CanvasManager.prototype.NotifySelectionRectShow = function (rect) {
  6817. this.showSelectionRect(rect.multiply(this.zoomLevel));
  6818. };
  6819. CanvasManager.prototype.NotifySelectionRectHide = function () {
  6820. this.hideSelectionRect();
  6821. };
  6822. CanvasManager.prototype.NotifyResizeInfoShow = function (point, text) {
  6823. this.showResizeInfo(point.multiply(this.zoomLevel), text);
  6824. };
  6825. CanvasManager.prototype.NotifyResizeInfoHide = function () {
  6826. this.hideResizeInfo();
  6827. };
  6828. CanvasManager.prototype.NotifyConnectionPointsShow = function (key, points, activePointIndex) {
  6829. var _this = this;
  6830. points.forEach(function (p, index) {
  6831. _this.showConnectionPoint(index, p.point.multiply(_this.zoomLevel), p.side, key, index, index === activePointIndex);
  6832. });
  6833. };
  6834. CanvasManager.prototype.NotifyConnectionPointsHide = function () {
  6835. this.hideConnectionPoints();
  6836. };
  6837. CanvasManager.prototype.NotifyConnectionMarksShow = function (key, points, activePointIndex) {
  6838. var _this = this;
  6839. points.forEach(function (p, index) {
  6840. var point = p.point.multiply(_this.zoomLevel);
  6841. switch (p.side) {
  6842. case DiagramItem_1.ConnectionPointSide.North:
  6843. point.y -= CanvasManager.connectionMarkShift;
  6844. break;
  6845. case DiagramItem_1.ConnectionPointSide.South:
  6846. point.y += CanvasManager.connectionMarkShift;
  6847. break;
  6848. case DiagramItem_1.ConnectionPointSide.East:
  6849. point.x += CanvasManager.connectionMarkShift;
  6850. break;
  6851. case DiagramItem_1.ConnectionPointSide.West:
  6852. point.x -= CanvasManager.connectionMarkShift;
  6853. break;
  6854. }
  6855. _this.showConnectionMark(index, point, p.side, key, index, index === activePointIndex);
  6856. });
  6857. };
  6858. CanvasManager.prototype.NotifyConnectionMarksHide = function () {
  6859. this.hideConnectionMarks();
  6860. };
  6861. CanvasManager.prototype.NotifyConnectionTargetShow = function (key, targetRect) {
  6862. var rect = this.correctShapeSelectionRect(targetRect.multiply(this.zoomLevel), CanvasManager.connectionTargetBorderWidth);
  6863. this.showConnectionTarget(0, rect);
  6864. };
  6865. CanvasManager.prototype.NotifyConnectionTargetHide = function () {
  6866. this.hideConnectionTarget();
  6867. };
  6868. CanvasManager.prototype.NotifyExtensionLinesShow = function (lines) {
  6869. var _this = this;
  6870. this.hideExtensionLines();
  6871. lines.forEach(function (line, index) {
  6872. _this.showExtensionLine(index, line.type, line.segment.startPoint.multiply(_this.zoomLevel), line.segment.endPoint.multiply(_this.zoomLevel), line.text);
  6873. });
  6874. };
  6875. CanvasManager.prototype.NotifyExtensionLinesHide = function () {
  6876. this.hideExtensionLines();
  6877. };
  6878. CanvasManager.prototype.NotifyDragStart = function (itemKeys) {
  6879. var _this = this;
  6880. itemKeys.forEach(function (itemKey) {
  6881. if (_this.itemSelectorElements[itemKey])
  6882. _this.itemSelectorElements[itemKey].style.pointerEvents = "none";
  6883. if (_this.itemElements[itemKey])
  6884. _this.itemElements[itemKey].style.pointerEvents = "none";
  6885. });
  6886. this.selectionMarksContainer.style.display = "none";
  6887. };
  6888. CanvasManager.prototype.NotifyDragEnd = function (itemKeys) {
  6889. var _this = this;
  6890. itemKeys.forEach(function (itemKey) {
  6891. if (_this.itemSelectorElements[itemKey])
  6892. _this.itemSelectorElements[itemKey].style.pointerEvents = "";
  6893. if (_this.itemElements[itemKey])
  6894. _this.itemElements[itemKey].style.pointerEvents = "";
  6895. });
  6896. this.selectionMarksContainer.style.display = "";
  6897. };
  6898. CanvasManager.prototype.NotifyTextInputStart = function (item, text, position, size) {
  6899. var element = this.itemElements[item.key];
  6900. var className = element.getAttribute("class");
  6901. element.setAttribute("class", className + " text-input");
  6902. this.visualizersContainer.style.display = "none";
  6903. };
  6904. CanvasManager.prototype.NotifyTextInputEnd = function (item) {
  6905. var element = this.itemElements[item.key];
  6906. var className = element.getAttribute("class");
  6907. element.setAttribute("class", className.replace(" text-input", ""));
  6908. this.visualizersContainer.style.display = "";
  6909. };
  6910. // Drawing
  6911. CanvasManager.prototype.applyShapeChange = function (change) {
  6912. var shape = change.shape;
  6913. var key = shape.key;
  6914. var itemParent = this.getItemGroupContainer(shape.zIndex);
  6915. var itemSelectorParent = this.getItemSelectorGroupContainer(shape.zIndex);
  6916. switch (change.type) {
  6917. case ModelChange_1.ItemChangeType.Create:
  6918. this.itemElements[key] = this.createItemElements(key, shape.getPrimitives(), itemParent, "shape", Event_1.MouseEventElementType.Shape);
  6919. this.itemSelectorElements[key] = this.createItemElements(key, shape.getSelectorPrimitives(), itemSelectorParent, "shape", Event_1.MouseEventElementType.Shape);
  6920. break;
  6921. case ModelChange_1.ItemChangeType.Remove:
  6922. this.removeItemElements(itemParent, this.itemElements[key]);
  6923. delete this.itemElements[key];
  6924. this.removeItemElements(itemSelectorParent, this.itemSelectorElements[key]);
  6925. delete this.itemSelectorElements[key];
  6926. break;
  6927. case ModelChange_1.ItemChangeType.UpdateStructure:
  6928. this.changeItemElements(shape.getPrimitives(), this.itemElements[key], true);
  6929. this.changeItemElements(shape.getSelectorPrimitives(), this.itemSelectorElements[key], true);
  6930. break;
  6931. case ModelChange_1.ItemChangeType.Update:
  6932. this.changeItemElements(shape.getPrimitives(), this.itemElements[key]);
  6933. this.changeItemElements(shape.getSelectorPrimitives(), this.itemSelectorElements[key]);
  6934. break;
  6935. case ModelChange_1.ItemChangeType.UpdateZIndex:
  6936. this.moveItemElements(itemParent, this.itemElements[key]);
  6937. this.moveItemElements(itemSelectorParent, this.itemSelectorElements[key]);
  6938. break;
  6939. }
  6940. };
  6941. CanvasManager.prototype.applyConnectorChange = function (change) {
  6942. var connector = change.connector;
  6943. var key = connector.key;
  6944. var itemParent = this.getItemGroupContainer(connector.zIndex);
  6945. var itemSelectorParent = this.getItemSelectorGroupContainer(connector.zIndex);
  6946. switch (change.type) {
  6947. case ModelChange_1.ItemChangeType.Create:
  6948. this.itemElements[key] = this.createItemElements(key, connector.getPrimitives(), itemParent, "connector", Event_1.MouseEventElementType.Connector);
  6949. this.itemSelectorElements[key] = this.createItemElements(key, connector.getSelectorPrimitives(), itemSelectorParent, "connector", Event_1.MouseEventElementType.Connector);
  6950. break;
  6951. case ModelChange_1.ItemChangeType.Remove:
  6952. this.removeItemElements(itemParent, this.itemElements[key]);
  6953. delete this.itemElements[key];
  6954. this.removeItemElements(itemSelectorParent, this.itemSelectorElements[key]);
  6955. delete this.itemSelectorElements[key];
  6956. this.invalidateConnectorSelectionTextElements(key);
  6957. break;
  6958. case ModelChange_1.ItemChangeType.UpdateStructure:
  6959. this.changeItemElements(connector.getPrimitives(), this.itemElements[key], true);
  6960. this.changeItemElements(connector.getSelectorPrimitives(), this.itemSelectorElements[key], true);
  6961. this.invalidateConnectorSelectionTextElements(key);
  6962. break;
  6963. case ModelChange_1.ItemChangeType.Update:
  6964. this.changeItemElements(connector.getPrimitives(), this.itemElements[key]);
  6965. this.changeItemElements(connector.getSelectorPrimitives(), this.itemSelectorElements[key]);
  6966. break;
  6967. case ModelChange_1.ItemChangeType.UpdateZIndex:
  6968. this.moveItemElements(itemParent, this.itemElements[key]);
  6969. this.moveItemElements(itemSelectorParent, this.itemSelectorElements[key]);
  6970. break;
  6971. }
  6972. };
  6973. CanvasManager.prototype.createItemElements = function (key, primitives, parent, className, type) {
  6974. var gEl = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], className), parent);
  6975. Utils_2.RenderUtils.setElementEventData(gEl, type, key);
  6976. this.createAndChangePrimitivesElements(primitives, gEl);
  6977. return gEl;
  6978. };
  6979. CanvasManager.prototype.changeItemElements = function (primitives, element, updateStructure) {
  6980. if (updateStructure === void 0) { updateStructure = false; }
  6981. if (updateStructure) {
  6982. Utils_2.RenderUtils.removeContent(element);
  6983. this.createAndChangePrimitivesElements(primitives, element);
  6984. }
  6985. else
  6986. this.changePrimitivesElements(primitives, element);
  6987. };
  6988. CanvasManager.prototype.removeItemElements = function (parent, element) {
  6989. if (element)
  6990. parent.removeChild(element);
  6991. };
  6992. CanvasManager.prototype.moveItemElements = function (parent, element, sibling) {
  6993. if (element) {
  6994. if (sibling !== undefined)
  6995. parent.insertBefore(element, sibling);
  6996. else
  6997. parent.appendChild(element);
  6998. }
  6999. };
  7000. CanvasManager.prototype.getItemGroupContainer = function (zIndex) {
  7001. if (this.itemGroupContainers[zIndex] === undefined) {
  7002. this.itemGroupContainers[zIndex] = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.itemsContainer, this.itemGroupContainers[zIndex + 1]);
  7003. }
  7004. return this.itemGroupContainers[zIndex];
  7005. };
  7006. CanvasManager.prototype.getItemSelectorGroupContainer = function (zIndex) {
  7007. if (this.itemSelectorGroupContainers[zIndex] === undefined) {
  7008. this.itemSelectorGroupContainers[zIndex] = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.itemSelectorsContainer, this.itemSelectorGroupContainers[zIndex + 1]);
  7009. }
  7010. return this.itemSelectorGroupContainers[zIndex];
  7011. };
  7012. CanvasManager.prototype.applyPageChange = function (change) {
  7013. this.zoomLevel = change.model.zoomLevel;
  7014. this.itemsContainer.style.transform = "scale(" + this.zoomLevel + ")";
  7015. this.itemSelectorsContainer.style.transform = "scale(" + this.zoomLevel + ")";
  7016. this.svgWidth = UnitConverter_1.UnitConverter.twipsToPixels(change.model.size.width) * this.zoomLevel;
  7017. this.svgHeight = UnitConverter_1.UnitConverter.twipsToPixels(change.model.size.height) * this.zoomLevel;
  7018. this.updateGridElements(change.model.showGrid, UnitConverter_1.UnitConverter.twipsToPixels(change.model.gridSize) * this.zoomLevel);
  7019. this.updatePagesGridElements(UnitConverter_1.UnitConverter.twipsToPixels(change.model.pageWidth) * this.zoomLevel, UnitConverter_1.UnitConverter.twipsToPixels(change.model.pageHeight) * this.zoomLevel);
  7020. this.svgElement.style.backgroundColor = change.model.pageColor;
  7021. var filterElements = Base_1.GetNodesByClassName(this.svgElement, "text-filter-flood");
  7022. for (var i = 0; i < filterElements.length; i++) {
  7023. filterElements[i].style.setProperty("flood-color", change.model.pageColor);
  7024. }
  7025. };
  7026. CanvasManager.prototype.getGridRectElement = function (primitive) {
  7027. if (this.gridRectElement === undefined)
  7028. this.gridRectElement = this.createPrimitiveElement(primitive, this.backgroundContainer);
  7029. return this.gridRectElement;
  7030. };
  7031. CanvasManager.prototype.getGridPatternElement = function (primitive) {
  7032. if (this.gridPatternElement === undefined)
  7033. this.gridPatternElement = this.createPrimitiveElement(primitive, this.backgroundContainer);
  7034. return this.gridPatternElement;
  7035. };
  7036. CanvasManager.prototype.updateGridElements = function (visible, size) {
  7037. var _this = this;
  7038. var gridRectPrimitive = new RectaglePrimitive_1.RectanglePrimitive("0", "0", "100%", "100%", null, null, null, function (element) {
  7039. element.style.setProperty("fill", "url('#" + _this.gridPatternId + "')");
  7040. });
  7041. var rectEl = this.getGridRectElement(gridRectPrimitive);
  7042. if (!visible)
  7043. rectEl.style.display = "none";
  7044. else {
  7045. rectEl.style.display = "";
  7046. this.changePrimitiveElement(gridRectPrimitive, rectEl);
  7047. var sizes = [0, 1, 2, 3, 4].map(function (i) { return Math.round(size * i); });
  7048. var outerPathCommands = [
  7049. new PathPrimitive_1.PathPrimitiveMoveToCommand(sizes[4].toString(), "0"),
  7050. new PathPrimitive_1.PathPrimitiveLineToCommand(sizes[4].toString(), sizes[4].toString()),
  7051. new PathPrimitive_1.PathPrimitiveLineToCommand("0", sizes[4].toString())
  7052. ];
  7053. var innerPathCommands = [];
  7054. for (var i = 1; i <= 3; i++) {
  7055. innerPathCommands.push(new PathPrimitive_1.PathPrimitiveMoveToCommand(sizes[i].toString(), "0"));
  7056. innerPathCommands.push(new PathPrimitive_1.PathPrimitiveLineToCommand(sizes[i].toString(), sizes[4].toString()));
  7057. }
  7058. for (var i = 1; i <= 3; i++) {
  7059. innerPathCommands.push(new PathPrimitive_1.PathPrimitiveMoveToCommand("0", sizes[i].toString()));
  7060. innerPathCommands.push(new PathPrimitive_1.PathPrimitiveLineToCommand(sizes[4].toString(), sizes[i].toString()));
  7061. }
  7062. var gridPatternPrimitive = new PatternPrimitive_1.PatternPrimitive(this.gridPatternId, [
  7063. new PathPrimitive_1.PathPrimitive(outerPathCommands, null, "grid-outer-line"),
  7064. new PathPrimitive_1.PathPrimitive(innerPathCommands, null, "grid-inner-line")
  7065. ], 0, 0, (size * 4 / this.svgWidth).toString(), (size * 4 / this.svgHeight).toString());
  7066. this.changePrimitiveElement(gridPatternPrimitive, this.getGridPatternElement(gridPatternPrimitive));
  7067. }
  7068. };
  7069. CanvasManager.prototype.getPagesGridRectElement = function (primitive) {
  7070. if (this.pagesGridRectElement === undefined)
  7071. this.pagesGridRectElement = this.createPrimitiveElement(primitive, this.backgroundContainer);
  7072. return this.pagesGridRectElement;
  7073. };
  7074. CanvasManager.prototype.getPagesGridClipPathElement = function (primitive) {
  7075. if (this.pagesGridClipPathElement === undefined)
  7076. this.pagesGridClipPathElement = this.createPrimitiveElement(primitive, this.backgroundContainer);
  7077. return this.pagesGridClipPathElement;
  7078. };
  7079. CanvasManager.prototype.getPagesGridPatternElement = function (primitive) {
  7080. if (this.pagesGridPatternElement === undefined)
  7081. this.pagesGridPatternElement = this.createPrimitiveElement(primitive, this.backgroundContainer);
  7082. return this.pagesGridPatternElement;
  7083. };
  7084. CanvasManager.prototype.updatePagesGridElements = function (width, height) {
  7085. var _this = this;
  7086. var pagesGridRectPrimitive = new RectaglePrimitive_1.RectanglePrimitive("0", "0", "100%", "100%", null, null, this.pagesGridClipId, function (element) {
  7087. element.style.setProperty("fill", "url('#" + _this.pagesGridPatternId + "')");
  7088. });
  7089. this.changePrimitiveElement(pagesGridRectPrimitive, this.getPagesGridRectElement(pagesGridRectPrimitive));
  7090. var horPages = Math.round(this.svgWidth / width);
  7091. var verPages = Math.round(this.svgHeight / height);
  7092. var pageGridPathCommands = [
  7093. new PathPrimitive_1.PathPrimitiveMoveToCommand((width - CanvasManager.pagesGridLineWidth / 2).toString(), "0"),
  7094. new PathPrimitive_1.PathPrimitiveLineToCommand((width - CanvasManager.pagesGridLineWidth / 2).toString(), (height - CanvasManager.pagesGridLineWidth / 2).toString()),
  7095. new PathPrimitive_1.PathPrimitiveLineToCommand("0", (height - CanvasManager.pagesGridLineWidth / 2).toString())
  7096. ];
  7097. var pagesGridPatternPrimitive = new PatternPrimitive_1.PatternPrimitive(this.pagesGridPatternId, [
  7098. new PathPrimitive_1.PathPrimitive(pageGridPathCommands, null, "pages-grid-line")
  7099. ], 0, 0, ((horPages > 1) ? 1 / horPages : 1).toString(), ((verPages > 1) ? 1 / verPages : 1).toString());
  7100. this.changePrimitiveElement(pagesGridPatternPrimitive, this.getPagesGridPatternElement(pagesGridPatternPrimitive));
  7101. var pagesGridClipPathPrimitive = new ClipPathPrimitive_1.ClipPathPrimitive(this.pagesGridClipId, [
  7102. new RectaglePrimitive_1.RectanglePrimitive(0, 0, (this.svgWidth - CanvasManager.pagesGridLineWidth * 2).toString(), (this.svgHeight - CanvasManager.pagesGridLineWidth * 2).toString())
  7103. ]);
  7104. this.changePrimitiveElement(pagesGridClipPathPrimitive, this.getPagesGridClipPathElement(pagesGridClipPathPrimitive));
  7105. };
  7106. // Selection
  7107. CanvasManager.prototype.hideSelection = function () {
  7108. this.hideItemSelectionRects();
  7109. this.hideConnectorSelection();
  7110. this.hideSelectionMarkElements();
  7111. this.hideLockedSelectionMarkElements();
  7112. this.hideParameterPointMarkElements();
  7113. };
  7114. CanvasManager.prototype.showShapeSelectionMarks = function (shape) {
  7115. var rect = new Utils_1.Rectangle(shape.position, shape.size).multiply(this.zoomLevel);
  7116. this.showSelectionMarks(rect, shape.key);
  7117. };
  7118. CanvasManager.prototype.showConnectorSelectionMarks = function (connector) {
  7119. var _this = this;
  7120. connector.points.forEach(function (pt, index) {
  7121. var isEdgePoint = (index === 0 || index === connector.points.length - 1);
  7122. var className = isEdgePoint ? "selection-mark" : "connector-point-mark";
  7123. var markSize = isEdgePoint ? CanvasManager.selectionMarkSize : CanvasManager.connectorPointMarkSize;
  7124. if (isEdgePoint || connector.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Straight) {
  7125. _this.showSelectionMark(index, pt.multiply(_this.zoomLevel), markSize, Event_1.MouseEventElementType.ConnectorPoint, connector.key, index, className);
  7126. }
  7127. else {
  7128. _this.showSelectionMark(index, pt.multiply(_this.zoomLevel), markSize, Event_1.MouseEventElementType.Undefined, "-1", -1, className + " disabled");
  7129. }
  7130. });
  7131. this.showConnectorSideMarks(connector);
  7132. };
  7133. CanvasManager.prototype.showConnectorSideMarks = function (connector) {
  7134. var _this = this;
  7135. var points = connector.getRenderPoints(true);
  7136. var type = (connector.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Straight) ?
  7137. Event_1.MouseEventElementType.ConnectorSide : Event_1.MouseEventElementType.ConnectorOrthogonalSide;
  7138. var prevPt, prevPtIndex;
  7139. points.forEach(function (pt, index) {
  7140. if (pt.skipped)
  7141. return;
  7142. if (prevPt !== undefined) {
  7143. if (_this.canShowConnectorSideMark(connector, pt, prevPt)) {
  7144. var classNameSuffix = connector.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Orthogonal ?
  7145. (pt.x - prevPt.x === 0 ? "vertical" : "horizontal") : "";
  7146. _this.showSelectionMark(connector.points.length + index - 1, new Utils_1.Point(prevPt.x + (pt.x - prevPt.x) / 2, prevPt.y + (pt.y - prevPt.y) / 2).multiply(_this.zoomLevel), CanvasManager.connectorSideMarkSize, type, connector.key, prevPtIndex + "_" + index, "connector-side-mark " + classNameSuffix);
  7147. }
  7148. }
  7149. prevPt = pt;
  7150. prevPtIndex = index;
  7151. });
  7152. };
  7153. CanvasManager.prototype.canShowConnectorSideMark = function (connector, point1, point2) {
  7154. if (connector.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Straight) {
  7155. var minSize = CanvasManager.selectionMarkSize + CanvasManager.connectorSideMarkSize;
  7156. return Utils_1.GeometryUtils.getDistance(point1, point2) > minSize;
  7157. }
  7158. if (connector.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Orthogonal) {
  7159. return ((point1.x - point2.x === 0 || Math.abs(point1.x - point2.x) > Connector_1.Connector.minOffset) &&
  7160. (point1.y - point2.y === 0 || Math.abs(point1.y - point2.y) > Connector_1.Connector.minOffset));
  7161. }
  7162. return false;
  7163. };
  7164. CanvasManager.prototype.showSelectionMarks = function (rect, key) {
  7165. this.showSelectionMark(0, new Utils_1.Point(rect.left, rect.top), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_NW, "selection-mark");
  7166. this.showSelectionMark(1, new Utils_1.Point(rect.left + rect.size.width / 2, rect.top), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_N, "selection-mark");
  7167. this.showSelectionMark(2, new Utils_1.Point(rect.right, rect.top), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_NE, "selection-mark");
  7168. this.showSelectionMark(3, new Utils_1.Point(rect.right, rect.top + rect.size.height / 2), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_E, "selection-mark");
  7169. this.showSelectionMark(4, new Utils_1.Point(rect.right, rect.bottom), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_SE, "selection-mark");
  7170. this.showSelectionMark(5, new Utils_1.Point(rect.left + rect.size.width / 2, rect.bottom), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_S, "selection-mark");
  7171. this.showSelectionMark(6, new Utils_1.Point(rect.left, rect.bottom), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_SW, "selection-mark");
  7172. this.showSelectionMark(7, new Utils_1.Point(rect.left, rect.top + rect.size.height / 2), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_W, "selection-mark");
  7173. };
  7174. CanvasManager.prototype.showSelectionMark = function (index, point, size, type, key, value, className) {
  7175. var primitive = new RectaglePrimitive_1.RectanglePrimitive(point.x - size / 2, point.y - size / 2, size, size, null, className);
  7176. var rectEl = this.getSelectionMarkElement(primitive, index);
  7177. this.changePrimitiveElement(primitive, rectEl);
  7178. Utils_2.RenderUtils.setElementEventData(rectEl, type, key, value);
  7179. };
  7180. CanvasManager.prototype.hideSelectionMarkElements = function () {
  7181. for (var i = 0; i < this.selectionMarkElements.length; i++) {
  7182. if (this.selectionMarkElements[i])
  7183. this.selectionMarkElements[i].style.display = "none";
  7184. }
  7185. };
  7186. CanvasManager.prototype.getSelectionMarkElement = function (primitive, index) {
  7187. var rectEl = this.selectionMarkElements[index];
  7188. if (rectEl !== undefined)
  7189. rectEl.style.display = "";
  7190. else {
  7191. rectEl = this.createPrimitiveElement(primitive, this.selectionMarksContainer);
  7192. this.selectionMarkElements[index] = rectEl;
  7193. }
  7194. return rectEl;
  7195. };
  7196. CanvasManager.prototype.showLockedSelectionMarks = function (item) {
  7197. var rect = item.rectangle.multiply(this.zoomLevel);
  7198. this.showLockedSelectionMark(item.key, 0, new Utils_1.Point(rect.left, rect.top), CanvasManager.lockedSelectionMarkSize, "locked-selection-mark");
  7199. this.showLockedSelectionMark(item.key, 1, new Utils_1.Point(rect.right, rect.top), CanvasManager.lockedSelectionMarkSize, "locked-selection-mark");
  7200. this.showLockedSelectionMark(item.key, 2, new Utils_1.Point(rect.right, rect.bottom), CanvasManager.lockedSelectionMarkSize, "locked-selection-mark");
  7201. this.showLockedSelectionMark(item.key, 3, new Utils_1.Point(rect.left, rect.bottom), CanvasManager.lockedSelectionMarkSize, "locked-selection-mark");
  7202. };
  7203. CanvasManager.prototype.showLockedSelectionMark = function (key, index, point, size, className) {
  7204. var primitive = new PathPrimitive_1.PathPrimitive([
  7205. new PathPrimitive_1.PathPrimitiveMoveToCommand(point.x - size / 2, point.y - size / 2),
  7206. new PathPrimitive_1.PathPrimitiveLineToCommand(point.x + size / 2, point.y + size / 2),
  7207. new PathPrimitive_1.PathPrimitiveMoveToCommand(point.x + size / 2, point.y - size / 2),
  7208. new PathPrimitive_1.PathPrimitiveLineToCommand(point.x - size / 2, point.y + size / 2)
  7209. ], null, className);
  7210. var pathEl = this.getLockedSelectionMarkElement(primitive, key, index);
  7211. this.changePrimitiveElement(primitive, pathEl);
  7212. };
  7213. CanvasManager.prototype.hideLockedSelectionMarkElements = function () {
  7214. for (var key in this.lockedSelectionMarkElements) {
  7215. if (this.lockedSelectionMarkElements.hasOwnProperty(key)) {
  7216. for (var i = 0; i < this.lockedSelectionMarkElements[key].length; i++)
  7217. this.lockedSelectionMarkElements[key][i].style.display = "none";
  7218. }
  7219. }
  7220. };
  7221. CanvasManager.prototype.getLockedSelectionMarkElement = function (primitive, key, index) {
  7222. var pathEl = this.lockedSelectionMarkElements[key] !== undefined ? this.lockedSelectionMarkElements[key][index] : undefined;
  7223. if (pathEl !== undefined)
  7224. pathEl.style.display = "";
  7225. else {
  7226. if (this.lockedSelectionMarkElements[key] === undefined)
  7227. this.lockedSelectionMarkElements[key] = [];
  7228. pathEl = this.createPrimitiveElement(primitive, this.selectionMarksContainer);
  7229. this.lockedSelectionMarkElements[key][index] = pathEl;
  7230. }
  7231. return pathEl;
  7232. };
  7233. CanvasManager.prototype.showShapeParameterPoints = function (shape) {
  7234. var _this = this;
  7235. shape.description.getParameterPoints(shape).forEach(function (pp, index) {
  7236. var size = CanvasManager.geomertyMarkSize;
  7237. var point = pp.point.multiply(_this.zoomLevel);
  7238. var primitive = new RectaglePrimitive_1.RectanglePrimitive(point.x - size / 2, point.y - size / 2, size, size, null, "geometry-mark");
  7239. var rectEl = _this.getParameterPointMarkElement(primitive, shape.key, index);
  7240. _this.changePrimitiveElement(primitive, rectEl);
  7241. Utils_2.RenderUtils.setElementEventData(rectEl, Event_1.MouseEventElementType.ShapeParameterBox, shape.key, pp.key);
  7242. });
  7243. };
  7244. CanvasManager.prototype.hideParameterPointMarkElements = function () {
  7245. for (var key in this.parameterPointMarkElements) {
  7246. if (this.parameterPointMarkElements.hasOwnProperty(key)) {
  7247. for (var i = 0; i < this.parameterPointMarkElements[key].length; i++)
  7248. this.parameterPointMarkElements[key][i].style.display = "none";
  7249. }
  7250. }
  7251. };
  7252. CanvasManager.prototype.getParameterPointMarkElement = function (primitive, key, index) {
  7253. var rectEl = this.parameterPointMarkElements[key] !== undefined ? this.parameterPointMarkElements[key][index] : undefined;
  7254. if (rectEl !== undefined)
  7255. rectEl.style.display = "";
  7256. else {
  7257. if (this.parameterPointMarkElements[key] === undefined)
  7258. this.parameterPointMarkElements[key] = [];
  7259. rectEl = this.createPrimitiveElement(primitive, this.selectionMarksContainer);
  7260. this.parameterPointMarkElements[key][index] = rectEl;
  7261. }
  7262. return rectEl;
  7263. };
  7264. CanvasManager.prototype.showShapeSelectionRect = function (shape, rect, type, className) {
  7265. var primitive = new RectaglePrimitive_1.RectanglePrimitive(rect.left, rect.top, rect.width, rect.height, null, className);
  7266. var rectEl = this.getItemSelectionRectElement(primitive, shape ? shape.key : "-1");
  7267. this.changePrimitiveElement(primitive, rectEl);
  7268. Utils_2.RenderUtils.setElementEventData(rectEl, type, "-1", -1);
  7269. };
  7270. CanvasManager.prototype.hideItemSelectionRects = function () {
  7271. for (var key in this.itemSelectionRectElements)
  7272. if (this.itemSelectionRectElements.hasOwnProperty(key))
  7273. this.itemSelectionRectElements[key].style.display = "none";
  7274. };
  7275. CanvasManager.prototype.getItemSelectionRectElement = function (primitive, key) {
  7276. var rectEl = this.itemSelectionRectElements[key];
  7277. if (rectEl !== undefined)
  7278. rectEl.style.display = "";
  7279. else {
  7280. rectEl = this.createPrimitiveElement(primitive, this.itemSelectionContainer);
  7281. this.itemSelectionRectElements[key] = rectEl;
  7282. }
  7283. return rectEl;
  7284. };
  7285. CanvasManager.prototype.showSelectionRect = function (rect) {
  7286. var primitive = new RectaglePrimitive_1.RectanglePrimitive(rect.left, rect.top, rect.size.width, rect.size.height, null, "selection-rect");
  7287. var rectEl = this.getSelectionRectElement(primitive);
  7288. this.changePrimitiveElement(primitive, rectEl);
  7289. };
  7290. CanvasManager.prototype.hideSelectionRect = function () {
  7291. if (this.selectionRectElement !== undefined)
  7292. this.selectionRectElement.style.display = "none";
  7293. };
  7294. CanvasManager.prototype.getSelectionRectElement = function (primitive) {
  7295. if (this.selectionRectElement !== undefined)
  7296. this.selectionRectElement.style.display = "";
  7297. else
  7298. this.selectionRectElement = this.createPrimitiveElement(primitive, this.visualizersContainer);
  7299. return this.selectionRectElement;
  7300. };
  7301. CanvasManager.prototype.showResizeInfo = function (point, text) {
  7302. var rectPrimitive = new RectaglePrimitive_1.RectanglePrimitive(point.x, point.y, 0, 0);
  7303. var primitive = new GroupPrimitive_1.GroupPrimitive([
  7304. rectPrimitive,
  7305. new TextPrimitive_1.TextPrimitive(point.x, point.y, text)
  7306. ], "resize-info");
  7307. var groupEl = this.getResizeInfoElement(primitive);
  7308. this.changePrimitiveElement(primitive, groupEl);
  7309. var textRect = Utils_2.RenderUtils.getSvgTextRectangle(groupEl.childNodes[1], CanvasManager.resizeInfoLineWidth)
  7310. .inflate(CanvasManager.resizeInfoTextOffset, CanvasManager.resizeInfoTextOffset);
  7311. rectPrimitive.x = textRect.left;
  7312. rectPrimitive.y = textRect.top;
  7313. rectPrimitive.width = textRect.width;
  7314. rectPrimitive.height = textRect.height;
  7315. this.changePrimitiveElement(primitive, groupEl);
  7316. };
  7317. CanvasManager.prototype.hideResizeInfo = function () {
  7318. if (this.resizeInfoElement !== undefined)
  7319. this.resizeInfoElement.style.display = "none";
  7320. };
  7321. CanvasManager.prototype.getResizeInfoElement = function (primitive) {
  7322. if (this.resizeInfoElement !== undefined)
  7323. this.resizeInfoElement.style.display = "";
  7324. else
  7325. this.resizeInfoElement = this.createPrimitiveElement(primitive, this.visualizersContainer);
  7326. return this.resizeInfoElement;
  7327. };
  7328. CanvasManager.prototype.showConnectorSelection = function (connector, className) {
  7329. var _this = this;
  7330. var points = connector.getRenderPoints();
  7331. var pathCommands = [];
  7332. var prevPt, firstPt, lastPt;
  7333. var difX = 0, difY = 0;
  7334. points.forEach(function (pt) {
  7335. pt = pt.multiply(_this.zoomLevel);
  7336. if (prevPt === undefined) {
  7337. firstPt = pt;
  7338. pathCommands.push(new PathPrimitive_1.PathPrimitiveMoveToCommand(pt.x, pt.y));
  7339. }
  7340. else {
  7341. pathCommands.push(new PathPrimitive_1.PathPrimitiveLineToCommand(pt.x, pt.y));
  7342. difX = Math.max(difX, Math.abs(prevPt.x - pt.x));
  7343. difY = Math.max(difY, Math.abs(prevPt.y - pt.y));
  7344. }
  7345. prevPt = pt;
  7346. });
  7347. lastPt = prevPt;
  7348. if (difX < CanvasManager.connectorSelectionLineWidth || difY < CanvasManager.connectorSelectionLineWidth) {
  7349. // Increase mask size
  7350. var offsetX = difX < CanvasManager.connectorSelectionLineWidth ? CanvasManager.connectorSelectionLineWidth : 0;
  7351. var offsetY = (difY < CanvasManager.connectorSelectionLineWidth ? CanvasManager.connectorSelectionLineWidth : 0);
  7352. pathCommands.push(new PathPrimitive_1.PathPrimitiveLineToCommand(lastPt.x - offsetX, lastPt.y - offsetY));
  7353. }
  7354. var maskId = Utils_2.RenderUtils.generateSvgElementId("maskSel");
  7355. var cliPathId = Utils_2.RenderUtils.generateSvgElementId("clipSel");
  7356. var primitive = new GroupPrimitive_1.GroupPrimitive([
  7357. new PathPrimitive_1.PathPrimitive(pathCommands, null, className, cliPathId, function (el) {
  7358. el.setAttribute("mask", "url(#" + maskId + ")");
  7359. }),
  7360. new MaskPrimitive_1.MaskPrimitive(maskId, [
  7361. new RectaglePrimitive_1.RectanglePrimitive("0", "0", "100%", "100%", null, "background"),
  7362. new PathPrimitive_1.PathPrimitive(pathCommands),
  7363. new RectaglePrimitive_1.RectanglePrimitive(firstPt.x - CanvasManager.connectorSelectionWidth / 2, firstPt.y - CanvasManager.connectorSelectionWidth / 2, CanvasManager.connectorSelectionWidth, CanvasManager.connectorSelectionWidth),
  7364. new RectaglePrimitive_1.RectanglePrimitive(lastPt.x - CanvasManager.connectorSelectionWidth / 2, lastPt.y - CanvasManager.connectorSelectionWidth / 2, CanvasManager.connectorSelectionWidth, CanvasManager.connectorSelectionWidth),
  7365. new GroupPrimitive_1.GroupPrimitive([])
  7366. ], "connector-selection-mask", "-1000%", "-1000%", "2100%", "2100%")
  7367. ]);
  7368. var gEl = this.getConnectorSelectionElement(primitive, connector.key);
  7369. this.changePrimitiveElement(primitive, gEl);
  7370. this.showConnectorTextsSelection(connector, gEl, gEl.querySelector("g"), className, maskId);
  7371. };
  7372. CanvasManager.prototype.showConnectorTextsSelection = function (connector, parent, maskParent, className, maskId) {
  7373. var _this = this;
  7374. var textRects = [];
  7375. if (maskParent && connector.allowHasText) {
  7376. var index_1 = 0;
  7377. connector.texts.forEach(function (textObj) {
  7378. var text = connector.getText(textObj.position);
  7379. if (text && text !== "") {
  7380. var position = connector.getTextPoint(textObj.position);
  7381. var filterId = Utils_2.RenderUtils.generateSvgElementId("filterSel");
  7382. var textPrimitive = new GroupPrimitive_1.GroupPrimitive([
  7383. new TextPrimitive_1.TextPrimitive(position.x, position.y, text, undefined, connector.styleText, true, null, filterId),
  7384. new TextFilterPrimitive_1.TextFilterPrimitive(filterId, false)
  7385. ]);
  7386. var gTextEl = _this.getConnectorSelectionMaskTextElement(textPrimitive, maskParent, connector.key, index_1);
  7387. _this.changePrimitiveElement(textPrimitive, gTextEl);
  7388. var textEl = gTextEl.querySelector("text");
  7389. var textRect = Utils_2.RenderUtils.getSvgTextRectangle(textEl, CanvasManager.connectorSelectionLineWidth);
  7390. if (textRect)
  7391. textRects.push(textRect.multiply(_this.zoomLevel));
  7392. }
  7393. index_1++;
  7394. });
  7395. }
  7396. for (var i = 0; i < textRects.length; i++) {
  7397. var textRectPrimitive = new RectaglePrimitive_1.RectanglePrimitive(textRects[i].left, textRects[i].top, textRects[i].width, textRects[i].height, null, className + " text", null);
  7398. var rectEl = this.getConnectorSelectionTextElement(textRectPrimitive, parent, connector.key, i);
  7399. this.changePrimitiveElement(textRectPrimitive, rectEl);
  7400. }
  7401. };
  7402. CanvasManager.prototype.hideConnectorSelection = function () {
  7403. for (var key in this.connectorSelectionElements) {
  7404. if (this.connectorSelectionElements.hasOwnProperty(key))
  7405. this.connectorSelectionElements[key].style.display = "none";
  7406. }
  7407. for (var key in this.connectorSelectionMaskTextElements) {
  7408. if (this.connectorSelectionMaskTextElements.hasOwnProperty(key)) {
  7409. for (var i = 0; i < this.connectorSelectionMaskTextElements[key].length; i++)
  7410. this.connectorSelectionMaskTextElements[key][i].style.display = "none";
  7411. }
  7412. }
  7413. for (var key in this.connectorSelectionTextElements) {
  7414. if (this.connectorSelectionTextElements.hasOwnProperty(key)) {
  7415. for (var i = 0; i < this.connectorSelectionTextElements[key].length; i++)
  7416. this.connectorSelectionTextElements[key][i].style.display = "none";
  7417. }
  7418. }
  7419. };
  7420. CanvasManager.prototype.getConnectorSelectionElement = function (primitive, key) {
  7421. var gEl = this.connectorSelectionElements[key];
  7422. if (gEl !== undefined)
  7423. gEl.style.display = "";
  7424. else {
  7425. gEl = this.createPrimitiveElement(primitive, this.itemSelectionContainer);
  7426. this.connectorSelectionElements[key] = gEl;
  7427. }
  7428. return gEl;
  7429. };
  7430. CanvasManager.prototype.getConnectorSelectionTextElement = function (primitive, parent, key, index) {
  7431. var textGroupEl = this.connectorSelectionTextElements[key] !== undefined ? this.connectorSelectionTextElements[key][index] : undefined;
  7432. if (textGroupEl !== undefined)
  7433. textGroupEl.style.display = "";
  7434. else {
  7435. if (this.connectorSelectionTextElements[key] === undefined)
  7436. this.connectorSelectionTextElements[key] = [];
  7437. textGroupEl = this.createPrimitiveElement(primitive, parent);
  7438. this.connectorSelectionTextElements[key][index] = textGroupEl;
  7439. }
  7440. return textGroupEl;
  7441. };
  7442. CanvasManager.prototype.getConnectorSelectionMaskTextElement = function (primitive, parent, key, index) {
  7443. var textGroupEl = this.connectorSelectionMaskTextElements[key] !== undefined ? this.connectorSelectionMaskTextElements[key][index] : undefined;
  7444. if (textGroupEl !== undefined)
  7445. textGroupEl.style.display = "";
  7446. else {
  7447. if (this.connectorSelectionMaskTextElements[key] === undefined)
  7448. this.connectorSelectionMaskTextElements[key] = [];
  7449. textGroupEl = this.createPrimitiveElement(primitive, parent);
  7450. this.connectorSelectionMaskTextElements[key][index] = textGroupEl;
  7451. }
  7452. return textGroupEl;
  7453. };
  7454. CanvasManager.prototype.invalidateConnectorSelectionTextElements = function (key) {
  7455. var gEl = this.connectorSelectionElements[key];
  7456. if (gEl) {
  7457. var textContainerEl = gEl.querySelector("g");
  7458. Utils_2.RenderUtils.removeContent(textContainerEl);
  7459. if (this.connectorSelectionMaskTextElements[key])
  7460. delete this.connectorSelectionMaskTextElements[key];
  7461. }
  7462. };
  7463. CanvasManager.prototype.showConnectionPoint = function (index, point, side, key, value, active) {
  7464. var className = "connection-point";
  7465. this.showConnectionPointCore(index * 2, point.x, point.y, CanvasManager.connectionPointLargeSize, CanvasManager.connectionPointLargeSize, Event_1.MouseEventElementType.ShapeConnectionPoint, key, value, className + " selector");
  7466. this.showConnectionPointCore(index * 2 + 1, point.x, point.y, CanvasManager.connectionPointSmallSize, CanvasManager.connectionPointSmallSize, Event_1.MouseEventElementType.ShapeConnectionPoint, key, value, className + (active ? " active" : ""));
  7467. };
  7468. CanvasManager.prototype.showConnectionPointCore = function (index, cx, cy, rx, ry, type, key, value, className) {
  7469. var primitive = new EllipsePrimitive_1.EllipsePrimitive(cx, cy, rx, ry, null, className);
  7470. var ellEl = this.getConnectionPointElement(primitive, index);
  7471. this.changePrimitiveElement(primitive, ellEl);
  7472. Utils_2.RenderUtils.setElementEventData(ellEl, type, key, value);
  7473. };
  7474. CanvasManager.prototype.hideConnectionPoints = function () {
  7475. for (var i = 0; i < this.connectionPointElements.length; i++)
  7476. this.connectionPointElements[i].style.display = "none";
  7477. };
  7478. CanvasManager.prototype.getConnectionPointElement = function (primitive, index) {
  7479. var ellEl = this.connectionPointElements[index];
  7480. if (ellEl !== undefined)
  7481. ellEl.style.display = "";
  7482. else {
  7483. ellEl = this.createPrimitiveElement(primitive, this.visualizersContainer);
  7484. this.connectionPointElements[index] = ellEl;
  7485. }
  7486. return ellEl;
  7487. };
  7488. CanvasManager.prototype.showConnectionTarget = function (index, targetRect) {
  7489. var primitive = new RectaglePrimitive_1.RectanglePrimitive(targetRect.left, targetRect.top, targetRect.width, targetRect.height, null, "connection-target");
  7490. var rectEl = this.getConnectionTargetElement(primitive, index);
  7491. this.changePrimitiveElement(primitive, rectEl);
  7492. };
  7493. CanvasManager.prototype.hideConnectionTarget = function () {
  7494. for (var i = 0; i < this.connectionTargetElements.length; i++)
  7495. this.connectionTargetElements[i].style.display = "none";
  7496. };
  7497. CanvasManager.prototype.getConnectionTargetElement = function (primitive, index) {
  7498. var ellEl = this.connectionTargetElements[index];
  7499. if (ellEl !== undefined)
  7500. ellEl.style.display = "";
  7501. else {
  7502. ellEl = this.createPrimitiveElement(primitive, this.itemSelectionContainer);
  7503. this.connectionTargetElements[index] = ellEl;
  7504. }
  7505. return ellEl;
  7506. };
  7507. CanvasManager.prototype.showConnectionMark = function (index, point, side, key, value, active) {
  7508. var className = "connection-mark";
  7509. this.showConnectionMarkSelector(index * 2, point.x - CanvasManager.connectionMarkLargeSize / 2, point.y - CanvasManager.connectionMarkLargeSize / 2, CanvasManager.connectionMarkLargeSize, CanvasManager.connectionMarkLargeSize, Event_1.MouseEventElementType.ShapeConnection, key, value, className + " selector");
  7510. this.showConnectionMarkArrow(index * 2 + 1, point.x - CanvasManager.connectionMarkSmallSize / 2, point.y - CanvasManager.connectionMarkSmallSize / 2, CanvasManager.connectionMarkSmallSize, CanvasManager.connectionMarkSmallSize, side, Event_1.MouseEventElementType.ShapeConnection, key, value, className + (active ? " active" : ""));
  7511. };
  7512. CanvasManager.prototype.showConnectionMarkArrow = function (index, x, y, width, height, side, type, key, value, className) {
  7513. var pathCommands = [];
  7514. switch (side) {
  7515. case DiagramItem_1.ConnectionPointSide.East:
  7516. pathCommands = [
  7517. new PathPrimitive_1.PathPrimitiveMoveToCommand(x, y + height / 3),
  7518. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height / 3),
  7519. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y),
  7520. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width, y + height / 2),
  7521. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height),
  7522. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height * 2 / 3),
  7523. new PathPrimitive_1.PathPrimitiveLineToCommand(x, y + height * 2 / 3),
  7524. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  7525. ];
  7526. break;
  7527. case DiagramItem_1.ConnectionPointSide.West:
  7528. pathCommands = [
  7529. new PathPrimitive_1.PathPrimitiveMoveToCommand(x + width, y + height / 3),
  7530. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height / 3),
  7531. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y),
  7532. new PathPrimitive_1.PathPrimitiveLineToCommand(x, y + height / 2),
  7533. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height),
  7534. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height * 2 / 3),
  7535. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width, y + height * 2 / 3),
  7536. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  7537. ];
  7538. break;
  7539. case DiagramItem_1.ConnectionPointSide.South:
  7540. pathCommands = [
  7541. new PathPrimitive_1.PathPrimitiveMoveToCommand(x + width * 2 / 3, y),
  7542. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width * 2 / 3, y + height / 2),
  7543. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width, y + height / 2),
  7544. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height),
  7545. new PathPrimitive_1.PathPrimitiveLineToCommand(x, y + height / 2),
  7546. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 3, y + height / 2),
  7547. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 3, y),
  7548. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  7549. ];
  7550. break;
  7551. case DiagramItem_1.ConnectionPointSide.North:
  7552. pathCommands = [
  7553. new PathPrimitive_1.PathPrimitiveMoveToCommand(x + width / 3, y + height),
  7554. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 3, y + height / 2),
  7555. new PathPrimitive_1.PathPrimitiveLineToCommand(x, y + height / 2),
  7556. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y),
  7557. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width, y + height / 2),
  7558. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width * 2 / 3, y + height / 2),
  7559. new PathPrimitive_1.PathPrimitiveLineToCommand(x + width * 2 / 3, y + height),
  7560. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  7561. ];
  7562. break;
  7563. }
  7564. var primitive = new PathPrimitive_1.PathPrimitive(pathCommands, null, className);
  7565. var ellEl = this.getConnectionMarkElement(primitive, index);
  7566. this.changePrimitiveElement(primitive, ellEl);
  7567. Utils_2.RenderUtils.setElementEventData(ellEl, Event_1.MouseEventElementType.ShapeConnection, key, value);
  7568. };
  7569. CanvasManager.prototype.showConnectionMarkSelector = function (index, x, y, width, height, type, key, value, className) {
  7570. var primitive = new RectaglePrimitive_1.RectanglePrimitive(x, y, width, height, null, className);
  7571. var ellEl = this.getConnectionMarkElement(primitive, index);
  7572. this.changePrimitiveElement(primitive, ellEl);
  7573. Utils_2.RenderUtils.setElementEventData(ellEl, Event_1.MouseEventElementType.ShapeConnection, key, value);
  7574. };
  7575. CanvasManager.prototype.hideConnectionMarks = function () {
  7576. for (var i = 0; i < this.connectionMarkElements.length; i++)
  7577. this.connectionMarkElements[i].style.display = "none";
  7578. };
  7579. CanvasManager.prototype.getConnectionMarkElement = function (primitive, index) {
  7580. var ellEl = this.connectionMarkElements[index];
  7581. if (ellEl !== undefined)
  7582. ellEl.style.display = "";
  7583. else {
  7584. ellEl = this.createPrimitiveElement(primitive, this.visualizersContainer);
  7585. this.connectionMarkElements[index] = ellEl;
  7586. }
  7587. return ellEl;
  7588. };
  7589. CanvasManager.prototype.showExtensionLine = function (index, type, startPoint, endPoint, text) {
  7590. var className = "extension-line";
  7591. if (type === ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterAfter || type === ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterBefore ||
  7592. type === ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterAbove || type === ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterBelow)
  7593. className += " center";
  7594. if (type === ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterToPageCenter || type === ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterToPageCenter ||
  7595. type === ExtensionLinesVisualizer_1.ExtensionLineType.LeftToPageCenter || type === ExtensionLinesVisualizer_1.ExtensionLineType.RightToPageCenter ||
  7596. type === ExtensionLinesVisualizer_1.ExtensionLineType.TopToPageCenter || type === ExtensionLinesVisualizer_1.ExtensionLineType.BottomToPageCenter)
  7597. className += " page";
  7598. var filterId = "filterEL" + index;
  7599. var x1_1 = 0, y1_1 = 0, x1_2 = 0, y1_2 = 0, x2_1 = 0, y2_1 = 0, x2_2 = 0, y2_2 = 0;
  7600. if (startPoint.y === endPoint.y) {
  7601. x1_1 = startPoint.x;
  7602. y1_1 = startPoint.y - CanvasManager.extensionLineEndingSize;
  7603. x1_2 = startPoint.x;
  7604. y1_2 = startPoint.y + CanvasManager.extensionLineEndingSize;
  7605. x2_1 = endPoint.x;
  7606. y2_1 = startPoint.y - CanvasManager.extensionLineEndingSize;
  7607. x2_2 = endPoint.x;
  7608. y2_2 = startPoint.y + CanvasManager.extensionLineEndingSize;
  7609. }
  7610. else if (startPoint.x === endPoint.x) {
  7611. x1_1 = startPoint.x - CanvasManager.extensionLineEndingSize;
  7612. y1_1 = startPoint.y;
  7613. x1_2 = startPoint.x + CanvasManager.extensionLineEndingSize;
  7614. y1_2 = startPoint.y;
  7615. x2_1 = startPoint.x - CanvasManager.extensionLineEndingSize;
  7616. y2_1 = endPoint.y;
  7617. x2_2 = startPoint.x + CanvasManager.extensionLineEndingSize;
  7618. y2_2 = endPoint.y;
  7619. }
  7620. var linePrimitives = [
  7621. new LinePrimitive_1.LinePrimitive(startPoint.x, startPoint.y, endPoint.x, endPoint.y),
  7622. new LinePrimitive_1.LinePrimitive(x1_1, y1_1, x1_2, y1_2),
  7623. new LinePrimitive_1.LinePrimitive(x2_1, y2_1, x2_2, y2_2),
  7624. new TextPrimitive_1.TextPrimitive((endPoint.x + startPoint.x) / 2, (endPoint.y + startPoint.y) / 2, text, undefined, null, false, null, filterId, function (el) {
  7625. el.style.display = text && text !== "" ? "inherit" : "none";
  7626. }),
  7627. new TextFilterPrimitive_1.TextFilterPrimitive(filterId)
  7628. ];
  7629. var primitive = new GroupPrimitive_1.GroupPrimitive(linePrimitives, className);
  7630. var ellEl = this.getExtensionLineElement(primitive, index);
  7631. this.changePrimitiveElement(primitive, ellEl);
  7632. };
  7633. CanvasManager.prototype.hideExtensionLines = function () {
  7634. for (var i = 0; i < this.extensionLineElements.length; i++) {
  7635. if (this.extensionLineElements[i])
  7636. this.extensionLineElements[i].style.display = "none";
  7637. }
  7638. };
  7639. CanvasManager.prototype.getExtensionLineElement = function (primitive, index) {
  7640. var ellEl = this.extensionLineElements[index];
  7641. if (ellEl !== undefined)
  7642. ellEl.style.display = "";
  7643. else {
  7644. ellEl = this.createPrimitiveElement(primitive, this.visualizersContainer);
  7645. this.extensionLineElements[index] = (ellEl);
  7646. }
  7647. return ellEl;
  7648. };
  7649. // Export
  7650. CanvasManager.prototype.getSvgImage = function () {
  7651. var svgEl = this.svgElement.cloneNode();
  7652. Utils_2.RenderUtils.updateSvgElementSize(svgEl, this.svgWidth / this.zoomLevel, this.svgHeight / this.zoomLevel);
  7653. var exportCssRules = this.getExportCssRules();
  7654. var useCssRules = exportCssRules && !Browser_1.Browser.IE;
  7655. if (useCssRules) {
  7656. var style = document.createElementNS(RenderManager_1.svgNS, "style");
  7657. style.innerHTML = exportCssRules;
  7658. svgEl.appendChild(style);
  7659. }
  7660. for (var i = 0; i < this.itemsContainer.childNodes.length; i++) {
  7661. var node = this.itemsContainer.childNodes[i].cloneNode(true);
  7662. if (!useCssRules)
  7663. this.inlineStyle(node, this.itemsContainer.childNodes[i]);
  7664. svgEl.appendChild(node);
  7665. }
  7666. return this.getSvgBase64String(svgEl);
  7667. };
  7668. CanvasManager.prototype.getSvgBase64String = function (svgElement) {
  7669. var xml = new XMLSerializer().serializeToString(svgElement);
  7670. return CanvasManager.base64Start + this.getBase64EncodeUnicode(xml);
  7671. };
  7672. CanvasManager.prototype.getBase64EncodeUnicode = function (s) {
  7673. return btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g, function (match, p1) { return String.fromCharCode(parseInt("0x" + p1, 16)); }));
  7674. };
  7675. CanvasManager.prototype.getExportCssRules = function () {
  7676. for (var i = 0; i < document.styleSheets.length; i++) {
  7677. var rules = this.getRules(document.styleSheets[i]);
  7678. if (rules) {
  7679. var cssText = "";
  7680. for (var j = 0; j < rules.length; j++) {
  7681. var rule = rules[j];
  7682. var selectorText = this.isCSSStyleRule(rule) ? rule.selectorText : null;
  7683. if (selectorText && this.checkSelector(selectorText))
  7684. cssText += rule.cssText + "\n";
  7685. }
  7686. if (cssText.length > 0)
  7687. return "\n" + cssText;
  7688. }
  7689. }
  7690. };
  7691. CanvasManager.prototype.checkSelector = function (selectorText) {
  7692. for (var i = 0; i < CanvasManager.exportStyleRules.length; i++) {
  7693. if (selectorText.indexOf(CanvasManager.exportStyleRules[i]) === 0)
  7694. return true;
  7695. }
  7696. return false;
  7697. };
  7698. CanvasManager.prototype.getRules = function (styleSheet) {
  7699. try {
  7700. return this.isCSSStyleSheet(styleSheet) ? styleSheet.rules || styleSheet.cssRules : null;
  7701. }
  7702. catch (_a) { } // Catch access dinied exception
  7703. };
  7704. CanvasManager.prototype.isCSSStyleSheet = function (stylesheet) {
  7705. return stylesheet.rules !== undefined;
  7706. };
  7707. CanvasManager.prototype.isCSSStyleRule = function (rule) {
  7708. return rule.selectorText !== undefined;
  7709. };
  7710. CanvasManager.prototype.inlineStyle = function (destNode, srcNode) {
  7711. for (var i = 0; i < destNode.childNodes.length; i++) {
  7712. var child = destNode.childNodes[i];
  7713. if (!child.tagName)
  7714. continue;
  7715. if (child.tagName === "g")
  7716. this.inlineStyle(child, srcNode.childNodes[i]);
  7717. else if (child.style) {
  7718. var style = window.getComputedStyle(srcNode.childNodes[i]);
  7719. if (style !== undefined) {
  7720. for (var index = 0; index < CanvasManager.exportStyleAttributes.length; index++) {
  7721. var styleProperty = CanvasManager.exportStyleAttributes[index];
  7722. child.style.setProperty(styleProperty, style.getPropertyValue(styleProperty));
  7723. }
  7724. }
  7725. }
  7726. }
  7727. };
  7728. CanvasManager.prototype.exportSvgImage = function (callback) {
  7729. callback(this.getSvgImage());
  7730. };
  7731. CanvasManager.prototype.exportBinaryImage = function (mimeType, width, height, callback) {
  7732. var canvasEl = document.createElement('canvas');
  7733. canvasEl.width = width;
  7734. canvasEl.height = height;
  7735. var imgEl = document.createElement('img');
  7736. imgEl.width = width;
  7737. imgEl.height = height;
  7738. imgEl.setAttribute('crossOrigin', 'anonymous');
  7739. imgEl.onload = function () {
  7740. var ctx = canvasEl.getContext("2d");
  7741. ctx.fillStyle = "white";
  7742. ctx.fillRect(0, 0, width, height);
  7743. ctx.drawImage(imgEl, 0, 0);
  7744. callback(canvasEl.toDataURL(mimeType));
  7745. };
  7746. imgEl.src = this.getSvgImage();
  7747. };
  7748. CanvasManager.prototype.exportPngImage = function (callback) {
  7749. this.exportBinaryImage("image/png", this.svgWidth, this.svgHeight, callback);
  7750. };
  7751. CanvasManager.prototype.exportJpgImage = function (callback) {
  7752. this.exportBinaryImage("image/jpeg", this.svgWidth, this.svgHeight, callback);
  7753. };
  7754. // Utils
  7755. CanvasManager.prototype.createAndChangePrimitivesElements = function (primitives, parent) {
  7756. var _this = this;
  7757. primitives.forEach(function (primitive) {
  7758. _this.createAndChangePrimitiveElement(primitive, parent);
  7759. });
  7760. };
  7761. CanvasManager.prototype.changePrimitivesElements = function (primitives, parent) {
  7762. var _this = this;
  7763. primitives.forEach(function (primitive, index) {
  7764. var element = parent.childNodes[index];
  7765. _this.changePrimitiveElement(primitive, element);
  7766. });
  7767. };
  7768. CanvasManager.prototype.createPrimitiveElement = function (primitive, parent, sibling) {
  7769. var element = primitive.createElement();
  7770. if (sibling !== undefined)
  7771. parent.insertBefore(element, sibling);
  7772. else
  7773. parent.appendChild(element);
  7774. return element;
  7775. };
  7776. CanvasManager.prototype.createAndChangePrimitiveElement = function (primitive, parent, sibling) {
  7777. var element = this.createPrimitiveElement(primitive, parent, sibling);
  7778. this.changePrimitiveElement(primitive, element);
  7779. return element;
  7780. };
  7781. CanvasManager.prototype.changePrimitiveElement = function (primitive, element) {
  7782. primitive.applyElementProperties(element);
  7783. };
  7784. CanvasManager.prototype.correctShapeSelectionRect = function (rect, lineWidth) {
  7785. var corr = Math.ceil(Shape_1.Shape.lineWidth / 2 * this.zoomLevel);
  7786. rect = rect.inflate(corr, corr);
  7787. var lwCorr = Math.floor(lineWidth / 2);
  7788. rect.position.x -= lwCorr;
  7789. rect.position.y -= lwCorr;
  7790. rect.size.width += lineWidth;
  7791. rect.size.height += lineWidth;
  7792. return rect;
  7793. };
  7794. CanvasManager.selectionMarkSize = UnitConverter_1.UnitConverter.pixelsToTwips(10);
  7795. CanvasManager.lockedSelectionMarkSize = UnitConverter_1.UnitConverter.pixelsToTwips(8);
  7796. CanvasManager.selectionRectLineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(1);
  7797. CanvasManager.multiSelectionRectLineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(1);
  7798. CanvasManager.connectionPointSmallSize = UnitConverter_1.UnitConverter.pixelsToTwips(5);
  7799. CanvasManager.connectionPointLargeSize = UnitConverter_1.UnitConverter.pixelsToTwips(8);
  7800. CanvasManager.connectionMarkSmallSize = UnitConverter_1.UnitConverter.pixelsToTwips(12);
  7801. CanvasManager.connectionMarkLargeSize = UnitConverter_1.UnitConverter.pixelsToTwips(16);
  7802. CanvasManager.connectionMarkShift = UnitConverter_1.UnitConverter.pixelsToTwips(16);
  7803. CanvasManager.connectionTargetBorderWidth = UnitConverter_1.UnitConverter.pixelsToTwips(2);
  7804. CanvasManager.connectorSelectionLineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(1);
  7805. CanvasManager.connectorSelectionWidth = UnitConverter_1.UnitConverter.pixelsToTwips(6);
  7806. CanvasManager.geomertyMarkSize = UnitConverter_1.UnitConverter.pixelsToTwips(8);
  7807. CanvasManager.connectorPointMarkSize = UnitConverter_1.UnitConverter.pixelsToTwips(6);
  7808. CanvasManager.connectorSideMarkSize = UnitConverter_1.UnitConverter.pixelsToTwips(6);
  7809. CanvasManager.extensionLineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(1);
  7810. CanvasManager.extensionLineOffset = UnitConverter_1.UnitConverter.pixelsToTwips(1);
  7811. CanvasManager.extensionLineEndingSize = UnitConverter_1.UnitConverter.pixelsToTwips(6);
  7812. CanvasManager.resizeInfoOffset = UnitConverter_1.UnitConverter.pixelsToTwips(16);
  7813. CanvasManager.resizeInfoTextOffset = UnitConverter_1.UnitConverter.pixelsToTwips(2);
  7814. CanvasManager.resizeInfoLineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(1);
  7815. CanvasManager.pagesGridLineWidth = 2;
  7816. CanvasManager.base64Start = 'data:image/svg+xml;base64,';
  7817. CanvasManager.exportStyleRules = [
  7818. ".dxdi-canvas .shape ", ".dxdi-canvas .connector "
  7819. ];
  7820. CanvasManager.exportStyleAttributes = [
  7821. "fill", "stroke", "stroke-width", "shape-rendering",
  7822. "font-family", "font-size", "font-weight", "font-style", "text-decoration", "text-anchor"
  7823. ];
  7824. return CanvasManager;
  7825. }());
  7826. exports.CanvasManager = CanvasManager;
  7827. /***/ }),
  7828. /* 45 */
  7829. /***/ (function(module, exports, __webpack_require__) {
  7830. "use strict";
  7831. var __extends = (this && this.__extends) || (function () {
  7832. var extendStatics = function (d, b) {
  7833. extendStatics = Object.setPrototypeOf ||
  7834. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  7835. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7836. return extendStatics(d, b);
  7837. };
  7838. return function (d, b) {
  7839. extendStatics(d, b);
  7840. function __() { this.constructor = d; }
  7841. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7842. };
  7843. })();
  7844. Object.defineProperty(exports, "__esModule", { value: true });
  7845. var KeyCode_1 = __webpack_require__(16);
  7846. var MouseHandlerStateBase = /** @class */ (function () {
  7847. function MouseHandlerStateBase(handler) {
  7848. this.handler = handler;
  7849. }
  7850. MouseHandlerStateBase.prototype.start = function () { };
  7851. MouseHandlerStateBase.prototype.finish = function () { };
  7852. MouseHandlerStateBase.prototype.onMouseDoubleClick = function (_evt) { };
  7853. MouseHandlerStateBase.prototype.onMouseDown = function (_evt) { };
  7854. MouseHandlerStateBase.prototype.onMouseUp = function (_evt) { };
  7855. MouseHandlerStateBase.prototype.onMouseMove = function (_evt) { };
  7856. MouseHandlerStateBase.prototype.onMouseWheel = function (_evt) { };
  7857. MouseHandlerStateBase.prototype.onDragStart = function (_evt) { };
  7858. MouseHandlerStateBase.prototype.onDragEnd = function (_evt) { };
  7859. MouseHandlerStateBase.prototype.onShortcut = function (_shortcutCode) { return false; };
  7860. return MouseHandlerStateBase;
  7861. }());
  7862. exports.MouseHandlerStateBase = MouseHandlerStateBase;
  7863. var MouseHandlerCancellableState = /** @class */ (function (_super) {
  7864. __extends(MouseHandlerCancellableState, _super);
  7865. function MouseHandlerCancellableState() {
  7866. return _super !== null && _super.apply(this, arguments) || this;
  7867. }
  7868. MouseHandlerCancellableState.prototype.onShortcut = function (code) {
  7869. if (code === KeyCode_1.KeyCode.Esc) {
  7870. this.cancelChanges();
  7871. this.handler.switchToDefaultState();
  7872. return true;
  7873. }
  7874. return false;
  7875. };
  7876. return MouseHandlerCancellableState;
  7877. }(MouseHandlerStateBase));
  7878. exports.MouseHandlerCancellableState = MouseHandlerCancellableState;
  7879. /***/ }),
  7880. /* 46 */
  7881. /***/ (function(module, exports, __webpack_require__) {
  7882. "use strict";
  7883. Object.defineProperty(exports, "__esModule", { value: true });
  7884. var CommandManager_1 = __webpack_require__(68);
  7885. exports.DiagramCommand = CommandManager_1.DiagramCommand;
  7886. var Diagram_1 = __webpack_require__(213);
  7887. exports.DiagramControl = Diagram_1.DiagramControl;
  7888. var Utils_1 = __webpack_require__(0);
  7889. exports.EventDispatcher = Utils_1.EventDispatcher;
  7890. var ShapeType_1 = __webpack_require__(1);
  7891. exports.ShapeType = ShapeType_1.ShapeType;
  7892. exports.ShapeCategory = ShapeType_1.ShapeCategory;
  7893. var UnitConverter_1 = __webpack_require__(13);
  7894. exports.UnitConverter = UnitConverter_1.UnitConverter;
  7895. var Browser_1 = __webpack_require__(20);
  7896. exports.Browser = Browser_1.Browser;
  7897. var DataSource_1 = __webpack_require__(37);
  7898. exports.DataLayoutType = DataSource_1.DataLayoutType;
  7899. __webpack_require__(247);
  7900. /***/ }),
  7901. /* 47 */
  7902. /***/ (function(module, exports, __webpack_require__) {
  7903. "use strict";
  7904. var __extends = (this && this.__extends) || (function () {
  7905. var extendStatics = function (d, b) {
  7906. extendStatics = Object.setPrototypeOf ||
  7907. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  7908. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7909. return extendStatics(d, b);
  7910. };
  7911. return function (d, b) {
  7912. extendStatics(d, b);
  7913. function __() { this.constructor = d; }
  7914. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7915. };
  7916. })();
  7917. Object.defineProperty(exports, "__esModule", { value: true });
  7918. var StyleBase = /** @class */ (function () {
  7919. function StyleBase() {
  7920. }
  7921. StyleBase.prototype.clone = function () {
  7922. var _this = this;
  7923. var style = this.createInstance();
  7924. this.forEach(function (propertyName) { style[propertyName] = _this[propertyName]; });
  7925. return style;
  7926. };
  7927. StyleBase.prototype.forEach = function (callback) {
  7928. for (var propertyName in this) {
  7929. if (this.hasOwnProperty(propertyName))
  7930. callback(propertyName);
  7931. }
  7932. };
  7933. StyleBase.prototype.toObject = function () {
  7934. var _this = this;
  7935. var result = {};
  7936. var modified = false;
  7937. var defaultStyle = this.getDefaultInstance();
  7938. this.forEach(function (key) {
  7939. if (_this[key] !== defaultStyle[key]) {
  7940. result[key] = _this[key];
  7941. modified = true;
  7942. }
  7943. });
  7944. return modified ? result : null;
  7945. };
  7946. StyleBase.prototype.fromObject = function (obj) {
  7947. for (var key in obj) {
  7948. if (obj.hasOwnProperty(key)) {
  7949. if (this[key] !== undefined)
  7950. this[key] = obj[key];
  7951. }
  7952. }
  7953. };
  7954. return StyleBase;
  7955. }());
  7956. exports.StyleBase = StyleBase;
  7957. var Style = /** @class */ (function (_super) {
  7958. __extends(Style, _super);
  7959. function Style() {
  7960. var _this = _super.call(this) || this;
  7961. // Default values must be the same with css
  7962. _this["fill"] = "white";
  7963. _this["stroke"] = "black";
  7964. return _this;
  7965. }
  7966. Style.prototype.createInstance = function () {
  7967. return new Style();
  7968. };
  7969. Style.prototype.getDefaultInstance = function () {
  7970. return Style.defaultInstace;
  7971. };
  7972. Style.defaultInstace = new Style();
  7973. return Style;
  7974. }(StyleBase));
  7975. exports.Style = Style;
  7976. var StyleText = /** @class */ (function (_super) {
  7977. __extends(StyleText, _super);
  7978. function StyleText() {
  7979. var _this = _super.call(this) || this;
  7980. // Default values must be the same with css
  7981. _this["fill"] = "black";
  7982. _this["font-family"] = "Arial";
  7983. _this["font-size"] = "10pt";
  7984. _this["font-weight"] = "";
  7985. _this["font-style"] = "";
  7986. _this["text-decoration"] = "";
  7987. _this["text-anchor"] = "middle";
  7988. return _this;
  7989. }
  7990. StyleText.prototype.createInstance = function () {
  7991. return new StyleText();
  7992. };
  7993. StyleText.prototype.getDefaultInstance = function () {
  7994. return StyleText.defaultInstace;
  7995. };
  7996. StyleText.defaultInstace = new StyleText();
  7997. return StyleText;
  7998. }(StyleBase));
  7999. exports.StyleText = StyleText;
  8000. /***/ }),
  8001. /* 48 */
  8002. /***/ (function(module, exports, __webpack_require__) {
  8003. "use strict";
  8004. var __extends = (this && this.__extends) || (function () {
  8005. var extendStatics = function (d, b) {
  8006. extendStatics = Object.setPrototypeOf ||
  8007. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8008. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8009. return extendStatics(d, b);
  8010. };
  8011. return function (d, b) {
  8012. extendStatics(d, b);
  8013. function __() { this.constructor = d; }
  8014. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8015. };
  8016. })();
  8017. Object.defineProperty(exports, "__esModule", { value: true });
  8018. var ItemChangeType;
  8019. (function (ItemChangeType) {
  8020. ItemChangeType[ItemChangeType["Create"] = 0] = "Create";
  8021. ItemChangeType[ItemChangeType["Update"] = 1] = "Update";
  8022. ItemChangeType[ItemChangeType["UpdateStructure"] = 2] = "UpdateStructure";
  8023. ItemChangeType[ItemChangeType["UpdateZIndex"] = 3] = "UpdateZIndex";
  8024. ItemChangeType[ItemChangeType["Remove"] = 4] = "Remove";
  8025. })(ItemChangeType = exports.ItemChangeType || (exports.ItemChangeType = {}));
  8026. var PageChangeType;
  8027. (function (PageChangeType) {
  8028. PageChangeType[PageChangeType["Create"] = 0] = "Create";
  8029. PageChangeType[PageChangeType["Update"] = 1] = "Update";
  8030. PageChangeType[PageChangeType["Remove"] = 2] = "Remove";
  8031. })(PageChangeType = exports.PageChangeType || (exports.PageChangeType = {}));
  8032. var ChangeBase = /** @class */ (function () {
  8033. function ChangeBase(key, type) {
  8034. this.key = key;
  8035. this.type = type;
  8036. }
  8037. return ChangeBase;
  8038. }());
  8039. exports.ChangeBase = ChangeBase;
  8040. var ShapeChange = /** @class */ (function (_super) {
  8041. __extends(ShapeChange, _super);
  8042. function ShapeChange(shape, type) {
  8043. var _this = _super.call(this, shape.key, type) || this;
  8044. _this.shape = shape;
  8045. return _this;
  8046. }
  8047. return ShapeChange;
  8048. }(ChangeBase));
  8049. exports.ShapeChange = ShapeChange;
  8050. var ConnectorChange = /** @class */ (function (_super) {
  8051. __extends(ConnectorChange, _super);
  8052. function ConnectorChange(connector, type) {
  8053. var _this = _super.call(this, connector.key, type) || this;
  8054. _this.connector = connector;
  8055. return _this;
  8056. }
  8057. return ConnectorChange;
  8058. }(ChangeBase));
  8059. exports.ConnectorChange = ConnectorChange;
  8060. var PageChange = /** @class */ (function (_super) {
  8061. __extends(PageChange, _super);
  8062. function PageChange(model, type, offset) {
  8063. var _this = _super.call(this, "-1", type) || this;
  8064. _this.model = model;
  8065. _this.offset = offset;
  8066. return _this;
  8067. }
  8068. return PageChange;
  8069. }(ChangeBase));
  8070. exports.PageChange = PageChange;
  8071. /***/ }),
  8072. /* 49 */
  8073. /***/ (function(module, exports, __webpack_require__) {
  8074. "use strict";
  8075. Object.defineProperty(exports, "__esModule", { value: true });
  8076. var Browser_1 = __webpack_require__(20);
  8077. var TouchUIHelper_1 = __webpack_require__(70);
  8078. var Base_1 = __webpack_require__(19);
  8079. var Evt = /** @class */ (function () {
  8080. function Evt() {
  8081. }
  8082. Evt.GetEvent = function (evt) {
  8083. return (typeof (event) != "undefined" && event != null && Browser_1.Browser.IE) ? event : evt;
  8084. };
  8085. Evt.AttachEventToElement = function (element, eventName, handler, onlyBubbling) {
  8086. if (onlyBubbling === void 0) { onlyBubbling = false; }
  8087. if (element.addEventListener)
  8088. element.addEventListener(eventName, handler, !onlyBubbling);
  8089. else
  8090. element.attachEvent("on" + eventName, handler);
  8091. };
  8092. Evt.AttachEventToDocument = function (eventName, handler) {
  8093. var attachingAllowed = TouchUIHelper_1.TouchUIHelper.onEventAttachingToDocument(eventName, handler);
  8094. if (attachingAllowed)
  8095. Evt.AttachEventToElement(document, eventName, handler);
  8096. };
  8097. Evt.PreventEvent = function (evt) {
  8098. if (evt.preventDefault)
  8099. evt.preventDefault();
  8100. else
  8101. evt.returnValue = false;
  8102. return false;
  8103. };
  8104. Evt.GetKeyCode = function (evt) {
  8105. return Browser_1.Browser.NetscapeFamily || Browser_1.Browser.Opera ? evt.which : evt.keyCode;
  8106. };
  8107. Evt.GetEventSource = function (evt) {
  8108. if (!Base_1.IsExists(evt))
  8109. return null;
  8110. return evt.srcElement ? evt.srcElement : evt.target;
  8111. };
  8112. Evt.GetMouseWheelEventName = function () {
  8113. if (Browser_1.Browser.Safari)
  8114. return "mousewheel";
  8115. if (Browser_1.Browser.NetscapeFamily && Browser_1.Browser.MajorVersion < 17)
  8116. return "DOMMouseScroll";
  8117. return "wheel";
  8118. };
  8119. Evt.IsLeftButtonPressed = function (evt) {
  8120. if (TouchUIHelper_1.TouchUIHelper.isTouchEvent(evt))
  8121. return true;
  8122. evt = Evt.GetEvent(evt);
  8123. if (!evt)
  8124. return false;
  8125. if (Browser_1.Browser.IE && Browser_1.Browser.Version < 11) {
  8126. if (Browser_1.Browser.MSTouchUI)
  8127. return true;
  8128. return evt.button % 2 == 1; // B213431
  8129. }
  8130. else if (Browser_1.Browser.WebKitFamily) {
  8131. if (evt.type === "pointermove")
  8132. return evt.buttons === 1;
  8133. return evt.which == 1;
  8134. }
  8135. else if (Browser_1.Browser.NetscapeFamily || Browser_1.Browser.Edge || (Browser_1.Browser.IE && Browser_1.Browser.Version >= 11)) {
  8136. if (evt.type === TouchUIHelper_1.TouchUIHelper.touchMouseMoveEventName)
  8137. return evt.buttons === 1;
  8138. return evt.which == 1;
  8139. }
  8140. else if (Browser_1.Browser.Opera)
  8141. return evt.button == 0;
  8142. return true;
  8143. };
  8144. Evt.PreventEventAndBubble = function (evt) {
  8145. Evt.PreventEvent(evt);
  8146. if (evt.stopPropagation)
  8147. evt.stopPropagation();
  8148. evt.cancelBubble = true;
  8149. return false;
  8150. };
  8151. Evt.clientEventRequiresDocScrollCorrection = function () {
  8152. var isSafariVerLess3 = Browser_1.Browser.Safari && Browser_1.Browser.Version < 3, isMacOSMobileVerLess51 = Browser_1.Browser.MacOSMobilePlatform && Browser_1.Browser.Version < 5.1;
  8153. return Browser_1.Browser.AndroidDefaultBrowser || Browser_1.Browser.AndroidChromeBrowser || !(isSafariVerLess3 || isMacOSMobileVerLess51);
  8154. };
  8155. Evt.GetEventX = function (evt) {
  8156. if (TouchUIHelper_1.TouchUIHelper.isTouchEvent(evt))
  8157. return TouchUIHelper_1.TouchUIHelper.getEventX(evt);
  8158. return evt.clientX + (Evt.clientEventRequiresDocScrollCorrection() ? Base_1.GetDocumentScrollLeft() : 0);
  8159. };
  8160. Evt.GetEventY = function (evt) {
  8161. if (TouchUIHelper_1.TouchUIHelper.isTouchEvent(evt))
  8162. return TouchUIHelper_1.TouchUIHelper.getEventY(evt);
  8163. return evt.clientY + (Evt.clientEventRequiresDocScrollCorrection() ? Base_1.GetDocumentScrollTop() : 0);
  8164. };
  8165. Evt.CancelBubble = function (evt) {
  8166. evt.cancelBubble = true;
  8167. return false;
  8168. };
  8169. return Evt;
  8170. }());
  8171. exports.Evt = Evt;
  8172. /***/ }),
  8173. /* 50 */
  8174. /***/ (function(module, exports, __webpack_require__) {
  8175. "use strict";
  8176. var __extends = (this && this.__extends) || (function () {
  8177. var extendStatics = function (d, b) {
  8178. extendStatics = Object.setPrototypeOf ||
  8179. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8180. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8181. return extendStatics(d, b);
  8182. };
  8183. return function (d, b) {
  8184. extendStatics(d, b);
  8185. function __() { this.constructor = d; }
  8186. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8187. };
  8188. })();
  8189. Object.defineProperty(exports, "__esModule", { value: true });
  8190. var RenderManager_1 = __webpack_require__(10);
  8191. var Primitive_1 = __webpack_require__(15);
  8192. var Utils_1 = __webpack_require__(26);
  8193. var TextPrimitive = /** @class */ (function (_super) {
  8194. __extends(TextPrimitive, _super);
  8195. function TextPrimitive(x, y, text, width, style, reverseTextAhchor, clipPathId, filterId, onApplyProperties) {
  8196. var _this = _super.call(this, style, "", clipPathId, onApplyProperties) || this;
  8197. _this.x = x;
  8198. _this.y = y;
  8199. _this.text = text;
  8200. _this.width = width;
  8201. _this.reverseTextAhchor = reverseTextAhchor;
  8202. _this.filterId = filterId;
  8203. _this.textSegmens = _this.text.split("\n").filter(function (s) { return s; });
  8204. return _this;
  8205. }
  8206. TextPrimitive.prototype.createMainElement = function () {
  8207. return document.createElementNS(RenderManager_1.svgNS, "text");
  8208. };
  8209. TextPrimitive.prototype.applyElementProperties = function (element) {
  8210. this.setUnitAttribute(element, "x", this.x);
  8211. this.setUnitAttribute(element, "y", this.y);
  8212. if (this.filterId)
  8213. element.setAttribute("filter", "url(#" + this.filterId + ")");
  8214. _super.prototype.applyElementProperties.call(this, element);
  8215. this.applyElementText(element);
  8216. };
  8217. TextPrimitive.prototype.applyElementText = function (element) {
  8218. var _this = this;
  8219. Utils_1.RenderUtils.removeContent(element);
  8220. var lineCount = 0;
  8221. this.textSegmens.forEach(function (txt, index) {
  8222. var tspan = _this.createTSpanElement(element);
  8223. lineCount++;
  8224. if (_this.width) {
  8225. var words = txt.split(" ");
  8226. var line = "", prevLine = "";
  8227. for (var i = 0; i < words.length; i++) {
  8228. line += (line.length ? " " : "") + words[i];
  8229. tspan.textContent = line;
  8230. var lineWidth = Utils_1.RenderUtils.getSvgTextRectangle(element).width;
  8231. if (lineWidth >= _this.width && prevLine !== "") {
  8232. tspan.textContent = prevLine;
  8233. prevLine = line = words[i];
  8234. tspan = _this.createTSpanElement(element);
  8235. tspan.textContent = line;
  8236. lineCount++;
  8237. }
  8238. else {
  8239. prevLine = line;
  8240. }
  8241. }
  8242. }
  8243. else {
  8244. tspan.textContent = txt;
  8245. }
  8246. });
  8247. var firstTSpan = element.firstChild;
  8248. if (firstTSpan) {
  8249. var dy = -((lineCount - 1) / 2) + TextPrimitive.baselineCorrection;
  8250. firstTSpan.setAttribute("dy", dy.toFixed(2) + "em");
  8251. }
  8252. };
  8253. TextPrimitive.prototype.createTSpanElement = function (parent) {
  8254. var tspan = document.createElementNS(RenderManager_1.svgNS, "tspan");
  8255. parent.appendChild(tspan);
  8256. this.setUnitAttribute(tspan, "x", this.x);
  8257. tspan.setAttribute("dy", "1.05em");
  8258. return tspan;
  8259. };
  8260. TextPrimitive.prototype.applyElementStyleProperties = function (element) {
  8261. this.applyElementStylePropertiesCore(element, this.reverseTextAhchor);
  8262. };
  8263. TextPrimitive.baselineCorrection = 0.35;
  8264. return TextPrimitive;
  8265. }(Primitive_1.SvgPrimitive));
  8266. exports.TextPrimitive = TextPrimitive;
  8267. /***/ }),
  8268. /* 51 */
  8269. /***/ (function(module, exports, __webpack_require__) {
  8270. "use strict";
  8271. var __extends = (this && this.__extends) || (function () {
  8272. var extendStatics = function (d, b) {
  8273. extendStatics = Object.setPrototypeOf ||
  8274. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8275. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8276. return extendStatics(d, b);
  8277. };
  8278. return function (d, b) {
  8279. extendStatics(d, b);
  8280. function __() { this.constructor = d; }
  8281. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8282. };
  8283. })();
  8284. Object.defineProperty(exports, "__esModule", { value: true });
  8285. var HistoryItem_1 = __webpack_require__(4);
  8286. var ShapeDescriptionManager_1 = __webpack_require__(30);
  8287. var Shape_1 = __webpack_require__(9);
  8288. var AddShapeHistoryItem = /** @class */ (function (_super) {
  8289. __extends(AddShapeHistoryItem, _super);
  8290. function AddShapeHistoryItem(shapeType, position, text, dataKey) {
  8291. var _this = _super.call(this) || this;
  8292. _this.shapeType = shapeType;
  8293. _this.position = position;
  8294. _this.text = text;
  8295. _this.dataKey = dataKey;
  8296. return _this;
  8297. }
  8298. AddShapeHistoryItem.prototype.redo = function (manipulator) {
  8299. var shape = new Shape_1.Shape(ShapeDescriptionManager_1.ShapeDescriptionManager.get(this.shapeType), this.position);
  8300. if (typeof this.text === "string")
  8301. shape.text = this.text;
  8302. if (this.dataKey !== undefined)
  8303. shape.dataKey = this.dataKey;
  8304. manipulator.addShape(shape, this.shapeKey);
  8305. this.shapeKey = shape.key;
  8306. };
  8307. AddShapeHistoryItem.prototype.undo = function (manipulator) {
  8308. manipulator.deleteShape(manipulator.model.findShape(this.shapeKey));
  8309. };
  8310. return AddShapeHistoryItem;
  8311. }(HistoryItem_1.HistoryItem));
  8312. exports.AddShapeHistoryItem = AddShapeHistoryItem;
  8313. /***/ }),
  8314. /* 52 */
  8315. /***/ (function(module, exports, __webpack_require__) {
  8316. "use strict";
  8317. var __extends = (this && this.__extends) || (function () {
  8318. var extendStatics = function (d, b) {
  8319. extendStatics = Object.setPrototypeOf ||
  8320. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8321. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8322. return extendStatics(d, b);
  8323. };
  8324. return function (d, b) {
  8325. extendStatics(d, b);
  8326. function __() { this.constructor = d; }
  8327. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8328. };
  8329. })();
  8330. Object.defineProperty(exports, "__esModule", { value: true });
  8331. var RenderManager_1 = __webpack_require__(10);
  8332. var Primitive_1 = __webpack_require__(15);
  8333. var ClipPathPrimitive = /** @class */ (function (_super) {
  8334. __extends(ClipPathPrimitive, _super);
  8335. function ClipPathPrimitive(id, children) {
  8336. var _this = _super.call(this) || this;
  8337. _this.id = id;
  8338. _this.children = children;
  8339. return _this;
  8340. }
  8341. ClipPathPrimitive.prototype.createMainElement = function () {
  8342. return document.createElementNS(RenderManager_1.svgNS, "clipPath");
  8343. };
  8344. ClipPathPrimitive.prototype.applyElementProperties = function (element) {
  8345. if (this.id)
  8346. element.setAttribute("id", this.id);
  8347. _super.prototype.applyElementProperties.call(this, element);
  8348. };
  8349. return ClipPathPrimitive;
  8350. }(Primitive_1.SvgPrimitive));
  8351. exports.ClipPathPrimitive = ClipPathPrimitive;
  8352. /***/ }),
  8353. /* 53 */
  8354. /***/ (function(module, exports, __webpack_require__) {
  8355. "use strict";
  8356. var __extends = (this && this.__extends) || (function () {
  8357. var extendStatics = function (d, b) {
  8358. extendStatics = Object.setPrototypeOf ||
  8359. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8360. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8361. return extendStatics(d, b);
  8362. };
  8363. return function (d, b) {
  8364. extendStatics(d, b);
  8365. function __() { this.constructor = d; }
  8366. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8367. };
  8368. })();
  8369. Object.defineProperty(exports, "__esModule", { value: true });
  8370. var RenderManager_1 = __webpack_require__(10);
  8371. var Primitive_1 = __webpack_require__(15);
  8372. var RectanglePrimitive = /** @class */ (function (_super) {
  8373. __extends(RectanglePrimitive, _super);
  8374. function RectanglePrimitive(x, y, width, height, style, className, clipPathId, onApplyProperties) {
  8375. var _this = _super.call(this, style, className, clipPathId, onApplyProperties) || this;
  8376. _this.x = x;
  8377. _this.y = y;
  8378. _this.width = width;
  8379. _this.height = height;
  8380. return _this;
  8381. }
  8382. RectanglePrimitive.prototype.createMainElement = function () {
  8383. return document.createElementNS(RenderManager_1.svgNS, "rect");
  8384. };
  8385. RectanglePrimitive.prototype.applyElementProperties = function (element) {
  8386. this.setUnitAttribute(element, "x", this.x);
  8387. this.setUnitAttribute(element, "y", this.y);
  8388. this.setUnitAttribute(element, "width", this.width);
  8389. this.setUnitAttribute(element, "height", this.height);
  8390. _super.prototype.applyElementProperties.call(this, element);
  8391. };
  8392. return RectanglePrimitive;
  8393. }(Primitive_1.SvgPrimitive));
  8394. exports.RectanglePrimitive = RectanglePrimitive;
  8395. /***/ }),
  8396. /* 54 */
  8397. /***/ (function(module, exports, __webpack_require__) {
  8398. "use strict";
  8399. var __extends = (this && this.__extends) || (function () {
  8400. var extendStatics = function (d, b) {
  8401. extendStatics = Object.setPrototypeOf ||
  8402. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8403. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8404. return extendStatics(d, b);
  8405. };
  8406. return function (d, b) {
  8407. extendStatics(d, b);
  8408. function __() { this.constructor = d; }
  8409. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8410. };
  8411. })();
  8412. Object.defineProperty(exports, "__esModule", { value: true });
  8413. var ShapeDescription_1 = __webpack_require__(11);
  8414. var Utils_1 = __webpack_require__(0);
  8415. var ShapeParameters_1 = __webpack_require__(25);
  8416. var ShapeType_1 = __webpack_require__(1);
  8417. var DiagramItem_1 = __webpack_require__(3);
  8418. exports.ArrowVerticalTriangleHeightParameterName = "th";
  8419. exports.ArrowVerticalLineWidthParameterName = "lw";
  8420. var ArrowVerticalShapeDescription = /** @class */ (function (_super) {
  8421. __extends(ArrowVerticalShapeDescription, _super);
  8422. function ArrowVerticalShapeDescription(title) {
  8423. return _super.call(this, title, "", new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension * 0.375, ShapeDescription_1.ShapeDefaultDimension)) || this;
  8424. }
  8425. Object.defineProperty(ArrowVerticalShapeDescription.prototype, "category", {
  8426. get: function () { return ShapeType_1.ShapeCategory.General; },
  8427. enumerable: true,
  8428. configurable: true
  8429. });
  8430. ArrowVerticalShapeDescription.prototype.createParameters = function (parameters) {
  8431. parameters.addRange([
  8432. new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalTriangleHeightParameterName, Math.sqrt(Math.pow(this.defaultSize.width, 2) - Math.pow(this.defaultSize.width / 2, 2))),
  8433. new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalLineWidthParameterName, this.defaultSize.width / 3)
  8434. ]);
  8435. };
  8436. ArrowVerticalShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
  8437. this.changeParameterValue(parameters, exports.ArrowVerticalTriangleHeightParameterName, function (p) { return Math.max(0, Math.min(shape.size.height, p.value)); });
  8438. this.changeParameterValue(parameters, exports.ArrowVerticalLineWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.width, p.value)); });
  8439. };
  8440. ArrowVerticalShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  8441. var delta = (shape.size.width - shape.parameters.get(exports.ArrowVerticalLineWidthParameterName).value) / 2;
  8442. var side = shape.getConnectionPointSide(index);
  8443. if (side === DiagramItem_1.ConnectionPointSide.East)
  8444. point.x -= delta;
  8445. else if (side === DiagramItem_1.ConnectionPointSide.West)
  8446. point.x += delta;
  8447. };
  8448. return ArrowVerticalShapeDescription;
  8449. }(ShapeDescription_1.ShapeDescription));
  8450. exports.ArrowVerticalShapeDescription = ArrowVerticalShapeDescription;
  8451. /***/ }),
  8452. /* 55 */
  8453. /***/ (function(module, exports, __webpack_require__) {
  8454. "use strict";
  8455. var __extends = (this && this.__extends) || (function () {
  8456. var extendStatics = function (d, b) {
  8457. extendStatics = Object.setPrototypeOf ||
  8458. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8459. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8460. return extendStatics(d, b);
  8461. };
  8462. return function (d, b) {
  8463. extendStatics(d, b);
  8464. function __() { this.constructor = d; }
  8465. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8466. };
  8467. })();
  8468. Object.defineProperty(exports, "__esModule", { value: true });
  8469. var ShapeDescription_1 = __webpack_require__(11);
  8470. var Utils_1 = __webpack_require__(0);
  8471. var ShapeParameters_1 = __webpack_require__(25);
  8472. var ShapeType_1 = __webpack_require__(1);
  8473. var DiagramItem_1 = __webpack_require__(3);
  8474. exports.ArrowVerticalTriangleWidthParameterName = "tw";
  8475. exports.ArrowVerticalLineHeightParameterName = "lh";
  8476. var ArrowHorizontalShapeDescription = /** @class */ (function (_super) {
  8477. __extends(ArrowHorizontalShapeDescription, _super);
  8478. function ArrowHorizontalShapeDescription(title) {
  8479. return _super.call(this, title, "", new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.375)) || this;
  8480. }
  8481. Object.defineProperty(ArrowHorizontalShapeDescription.prototype, "category", {
  8482. get: function () { return ShapeType_1.ShapeCategory.General; },
  8483. enumerable: true,
  8484. configurable: true
  8485. });
  8486. ArrowHorizontalShapeDescription.prototype.createParameters = function (parameters) {
  8487. parameters.addRange([
  8488. new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalTriangleWidthParameterName, Math.sqrt(Math.pow(this.defaultSize.height, 2) - Math.pow(this.defaultSize.height / 2, 2))),
  8489. new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalLineHeightParameterName, this.defaultSize.height / 3)
  8490. ]);
  8491. };
  8492. ArrowHorizontalShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
  8493. this.changeParameterValue(parameters, exports.ArrowVerticalTriangleWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.width, p.value)); });
  8494. this.changeParameterValue(parameters, exports.ArrowVerticalLineHeightParameterName, function (p) { return Math.max(0, Math.min(shape.size.height, p.value)); });
  8495. };
  8496. ArrowHorizontalShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  8497. var delta = (shape.size.height - shape.parameters.get(exports.ArrowVerticalLineHeightParameterName).value) / 2;
  8498. var side = shape.getConnectionPointSide(index);
  8499. if (side === DiagramItem_1.ConnectionPointSide.North)
  8500. point.y += delta;
  8501. else if (side === DiagramItem_1.ConnectionPointSide.South)
  8502. point.y -= delta;
  8503. };
  8504. return ArrowHorizontalShapeDescription;
  8505. }(ShapeDescription_1.ShapeDescription));
  8506. exports.ArrowHorizontalShapeDescription = ArrowHorizontalShapeDescription;
  8507. /***/ }),
  8508. /* 56 */
  8509. /***/ (function(module, exports, __webpack_require__) {
  8510. "use strict";
  8511. var __extends = (this && this.__extends) || (function () {
  8512. var extendStatics = function (d, b) {
  8513. extendStatics = Object.setPrototypeOf ||
  8514. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8515. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8516. return extendStatics(d, b);
  8517. };
  8518. return function (d, b) {
  8519. extendStatics(d, b);
  8520. function __() { this.constructor = d; }
  8521. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8522. };
  8523. })();
  8524. Object.defineProperty(exports, "__esModule", { value: true });
  8525. var ShapeDescription_1 = __webpack_require__(11);
  8526. var Utils_1 = __webpack_require__(0);
  8527. var EllipsePrimitive_1 = __webpack_require__(38);
  8528. var ShapeType_1 = __webpack_require__(1);
  8529. var EllipseShapeDescription = /** @class */ (function (_super) {
  8530. __extends(EllipseShapeDescription, _super);
  8531. function EllipseShapeDescription(title, defaultText) {
  8532. if (title === void 0) { title = "Ellipse"; }
  8533. if (defaultText === void 0) { defaultText = ""; }
  8534. return _super.call(this, title, defaultText, new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.75)) || this;
  8535. }
  8536. Object.defineProperty(EllipseShapeDescription.prototype, "key", {
  8537. get: function () { return ShapeType_1.ShapeType.Ellipsis; },
  8538. enumerable: true,
  8539. configurable: true
  8540. });
  8541. Object.defineProperty(EllipseShapeDescription.prototype, "category", {
  8542. get: function () { return ShapeType_1.ShapeCategory.General; },
  8543. enumerable: true,
  8544. configurable: true
  8545. });
  8546. EllipseShapeDescription.prototype.createPrimitives = function (shape) {
  8547. var rect = shape.rectangle;
  8548. var width = rect.width, height = rect.height;
  8549. var _a = rect.center, cx = _a.x, cy = _a.y;
  8550. var primitives = [];
  8551. return primitives.concat([
  8552. new EllipsePrimitive_1.EllipsePrimitive(cx, cy, width / 2, height / 2, shape.style),
  8553. ])
  8554. .concat(this.createTextPrimitives(shape));
  8555. };
  8556. return EllipseShapeDescription;
  8557. }(ShapeDescription_1.ShapeDescription));
  8558. exports.EllipseShapeDescription = EllipseShapeDescription;
  8559. /***/ }),
  8560. /* 57 */
  8561. /***/ (function(module, exports, __webpack_require__) {
  8562. "use strict";
  8563. var __extends = (this && this.__extends) || (function () {
  8564. var extendStatics = function (d, b) {
  8565. extendStatics = Object.setPrototypeOf ||
  8566. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8567. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8568. return extendStatics(d, b);
  8569. };
  8570. return function (d, b) {
  8571. extendStatics(d, b);
  8572. function __() { this.constructor = d; }
  8573. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8574. };
  8575. })();
  8576. Object.defineProperty(exports, "__esModule", { value: true });
  8577. var ShapeDescription_1 = __webpack_require__(11);
  8578. var ShapeType_1 = __webpack_require__(1);
  8579. var PolygonShapeDescription = /** @class */ (function (_super) {
  8580. __extends(PolygonShapeDescription, _super);
  8581. function PolygonShapeDescription(title, defaultText) {
  8582. var _this = _super.call(this, title, defaultText) || this;
  8583. _this.defaultSize.height = _this.calculateHeight(ShapeDescription_1.ShapeDefaultDimension);
  8584. return _this;
  8585. }
  8586. Object.defineProperty(PolygonShapeDescription.prototype, "category", {
  8587. get: function () { return ShapeType_1.ShapeCategory.General; },
  8588. enumerable: true,
  8589. configurable: true
  8590. });
  8591. Object.defineProperty(PolygonShapeDescription.prototype, "angle", {
  8592. get: function () {
  8593. return Math.PI * (this.angleCount - 2) / this.angleCount;
  8594. },
  8595. enumerable: true,
  8596. configurable: true
  8597. });
  8598. return PolygonShapeDescription;
  8599. }(ShapeDescription_1.ShapeDescription));
  8600. exports.PolygonShapeDescription = PolygonShapeDescription;
  8601. /***/ }),
  8602. /* 58 */
  8603. /***/ (function(module, exports, __webpack_require__) {
  8604. "use strict";
  8605. var __extends = (this && this.__extends) || (function () {
  8606. var extendStatics = function (d, b) {
  8607. extendStatics = Object.setPrototypeOf ||
  8608. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8609. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8610. return extendStatics(d, b);
  8611. };
  8612. return function (d, b) {
  8613. extendStatics(d, b);
  8614. function __() { this.constructor = d; }
  8615. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8616. };
  8617. })();
  8618. Object.defineProperty(exports, "__esModule", { value: true });
  8619. var HistoryItem_1 = __webpack_require__(4);
  8620. var Connector_1 = __webpack_require__(5);
  8621. var AddConnectorHistoryItem = /** @class */ (function (_super) {
  8622. __extends(AddConnectorHistoryItem, _super);
  8623. function AddConnectorHistoryItem(points, dataKey) {
  8624. var _this = _super.call(this) || this;
  8625. _this.points = points;
  8626. _this.dataKey = dataKey;
  8627. return _this;
  8628. }
  8629. AddConnectorHistoryItem.prototype.redo = function (manipulator) {
  8630. var connector = new Connector_1.Connector(this.points);
  8631. if (this.dataKey !== undefined)
  8632. connector.dataKey = this.dataKey;
  8633. manipulator.addConnector(connector, this.connectorKey);
  8634. this.connectorKey = connector.key;
  8635. };
  8636. AddConnectorHistoryItem.prototype.undo = function (manipulator) {
  8637. var connector = manipulator.model.findConnector(this.connectorKey);
  8638. manipulator.deleteConnector(connector);
  8639. };
  8640. return AddConnectorHistoryItem;
  8641. }(HistoryItem_1.HistoryItem));
  8642. exports.AddConnectorHistoryItem = AddConnectorHistoryItem;
  8643. /***/ }),
  8644. /* 59 */
  8645. /***/ (function(module, exports, __webpack_require__) {
  8646. "use strict";
  8647. Object.defineProperty(exports, "__esModule", { value: true });
  8648. var Connector_1 = __webpack_require__(5);
  8649. var NodeLayout_1 = __webpack_require__(39);
  8650. var ShapeDescriptionManager_1 = __webpack_require__(30);
  8651. var LayoutUtils = /** @class */ (function () {
  8652. function LayoutUtils() {
  8653. }
  8654. LayoutUtils.shapeToLayout = function (shape) {
  8655. var margin = new NodeLayout_1.Margin(0);
  8656. var shapeRect = shape.rectangle;
  8657. shape.attachedConnectors.filter(function (c) { return !c.beginItem || !c.endItem; }).forEach(function (c) {
  8658. var connRect = c.rectangle;
  8659. margin.left = Math.max(margin.left, shapeRect.left - connRect.left + Connector_1.Connector.minOffset);
  8660. margin.right = Math.max(margin.right, connRect.right - shapeRect.right + Connector_1.Connector.minOffset);
  8661. margin.top = Math.max(margin.top, shapeRect.top - connRect.top + Connector_1.Connector.minOffset);
  8662. margin.bottom = Math.max(margin.bottom, connRect.bottom - shapeRect.bottom + Connector_1.Connector.minOffset);
  8663. });
  8664. var layout = new NodeLayout_1.NodeInfo(shape.key, margin, shape.size.clone());
  8665. layout.connectionPoints = shape.description.getConnectionPoints();
  8666. return layout;
  8667. };
  8668. LayoutUtils.importNodeToLayout = function (node) {
  8669. var margin = new NodeLayout_1.Margin(0);
  8670. var description = ShapeDescriptionManager_1.ShapeDescriptionManager.get(node.type);
  8671. var layout = new NodeLayout_1.NodeInfo(node.key, margin, description.defaultSize.clone());
  8672. layout.connectionPoints = description.getConnectionPoints();
  8673. return layout;
  8674. };
  8675. return LayoutUtils;
  8676. }());
  8677. exports.LayoutUtils = LayoutUtils;
  8678. /***/ }),
  8679. /* 60 */
  8680. /***/ (function(module, exports, __webpack_require__) {
  8681. "use strict";
  8682. Object.defineProperty(exports, "__esModule", { value: true });
  8683. var HashSet = /** @class */ (function () {
  8684. function HashSet(list, getHashCode) {
  8685. if (list === void 0) { list = []; }
  8686. if (getHashCode === void 0) { getHashCode = function (item) { return item.toString(); }; }
  8687. var _this = this;
  8688. this.items = [];
  8689. this.map = {};
  8690. this.getHashCode = getHashCode;
  8691. list.forEach(function (i) { return _this.tryPush(i); });
  8692. }
  8693. HashSet.prototype.tryPush = function (item) {
  8694. var code = this.getHashCode(item);
  8695. if (this.map[code] === undefined) {
  8696. this.map[code] = this.items.push(item) - 1;
  8697. return true;
  8698. }
  8699. return false;
  8700. };
  8701. HashSet.prototype.contains = function (item) {
  8702. return this.map[this.getHashCode(item)] !== undefined;
  8703. };
  8704. HashSet.prototype.forEach = function (callback) {
  8705. this.items.forEach(callback);
  8706. };
  8707. HashSet.prototype.filter = function (predicate) {
  8708. return this.items.filter(predicate);
  8709. };
  8710. HashSet.prototype.list = function () {
  8711. return this.items.slice(0);
  8712. };
  8713. HashSet.prototype.item = function (index) {
  8714. return this.items[index];
  8715. };
  8716. HashSet.prototype.first = function () {
  8717. return this.items[0];
  8718. };
  8719. HashSet.prototype.remove = function (item) {
  8720. var code = this.getHashCode(item);
  8721. var index = this.map[code];
  8722. if (typeof index === "number") {
  8723. delete this.map[code];
  8724. this.items.splice(index, 1);
  8725. for (var i = index; i < this.items.length; i++)
  8726. this.map[this.getHashCode(this.items[i])]--;
  8727. }
  8728. else
  8729. throw "Item not found";
  8730. };
  8731. Object.defineProperty(HashSet.prototype, "length", {
  8732. get: function () { return this.items.length; },
  8733. enumerable: true,
  8734. configurable: true
  8735. });
  8736. return HashSet;
  8737. }());
  8738. exports.HashSet = HashSet;
  8739. /***/ }),
  8740. /* 61 */
  8741. /***/ (function(module, exports, __webpack_require__) {
  8742. "use strict";
  8743. var __extends = (this && this.__extends) || (function () {
  8744. var extendStatics = function (d, b) {
  8745. extendStatics = Object.setPrototypeOf ||
  8746. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8747. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8748. return extendStatics(d, b);
  8749. };
  8750. return function (d, b) {
  8751. extendStatics(d, b);
  8752. function __() { this.constructor = d; }
  8753. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8754. };
  8755. })();
  8756. Object.defineProperty(exports, "__esModule", { value: true });
  8757. var Forest_1 = __webpack_require__(151);
  8758. var GraphLayout_1 = __webpack_require__(81);
  8759. var NodeLayout_1 = __webpack_require__(39);
  8760. var Utils_1 = __webpack_require__(0);
  8761. var BaseBuilder_1 = __webpack_require__(82);
  8762. var Structures_1 = __webpack_require__(22);
  8763. var DiagramItem_1 = __webpack_require__(3);
  8764. var LayoutSettings_1 = __webpack_require__(18);
  8765. var TreeLayoutBuilder = /** @class */ (function (_super) {
  8766. __extends(TreeLayoutBuilder, _super);
  8767. function TreeLayoutBuilder() {
  8768. return _super !== null && _super.apply(this, arguments) || this;
  8769. }
  8770. TreeLayoutBuilder.prototype.build = function () {
  8771. var forest = Forest_1.Forest.create(this.graph);
  8772. var layouts = [];
  8773. for (var tree = void 0, i = 0; tree = forest.trees[i]; i++) {
  8774. var layout_1 = this.processTree(tree);
  8775. layouts.push(layout_1);
  8776. }
  8777. var offset = 0, layout = new GraphLayout_1.GraphLayout();
  8778. for (var layoutComponent = void 0, i = 0; layoutComponent = layouts[i]; i++) {
  8779. layout.extend(this.setComponentOffset(layoutComponent, offset));
  8780. offset += this.getComponentOffset(layoutComponent);
  8781. }
  8782. return layout;
  8783. };
  8784. TreeLayoutBuilder.prototype.processTree = function (tree) {
  8785. var layout = new GraphLayout_1.GraphLayout();
  8786. var rootLayout = new NodeLayout_1.NodeLayout(tree.root, new Utils_1.Point(tree.root.margin.left, tree.root.margin.top));
  8787. layout.addNode(rootLayout);
  8788. this.processChildren(rootLayout, tree, layout, 0);
  8789. if (this.settings.alignment === LayoutSettings_1.Alignment.Center)
  8790. this.processParents(layout, rootLayout, tree);
  8791. return layout;
  8792. };
  8793. TreeLayoutBuilder.prototype.processChildren = function (parent, tree, layout, nearbyPoint) {
  8794. var _this = this;
  8795. var children = tree.getChildren(parent.info);
  8796. var edges = this.graph.getAdjacentEdges(parent.key, Structures_1.ConnectionMode.Outgoing);
  8797. var distantPoint = nearbyPoint;
  8798. var prevSiblingLayout;
  8799. var _loop_1 = function (child, i) {
  8800. var nearbyMargin = this_1.isVertical() ? child.margin.left : child.margin.top;
  8801. if (prevSiblingLayout) {
  8802. var prevSiblingDistantPoint = this_1.getChangingCoordinateForLayer(prevSiblingLayout.position) + this_1.getSizeMeasurement(prevSiblingLayout.info.size);
  8803. var actualNearbyMargin = distantPoint - prevSiblingDistantPoint;
  8804. nearbyMargin = Math.max(0, nearbyMargin - actualNearbyMargin);
  8805. nearbyMargin += this_1.settings.columnSpacing;
  8806. }
  8807. var layerStartingPoint = this_1.isVertical() ? Math.max(parent.info.margin.bottom, child.margin.top) : Math.max(parent.info.margin.right, child.margin.left);
  8808. var nodePosition = this_1.isVertical() ?
  8809. new Utils_1.Point(distantPoint + nearbyMargin, parent.position.y + parent.info.size.height + layerStartingPoint + this_1.settings.layerSpacing) :
  8810. new Utils_1.Point(parent.position.x + parent.info.size.width + layerStartingPoint + this_1.settings.layerSpacing, distantPoint + nearbyMargin);
  8811. var childLayout = new NodeLayout_1.NodeLayout(child, nodePosition);
  8812. distantPoint = Math.max(this_1.getChangingCoordinateForLayer(childLayout.position) + this_1.getSizeMeasurement(childLayout.info.size), this_1.processChildren(childLayout, tree, layout, distantPoint));
  8813. layout.addNode(childLayout);
  8814. edges.filter(function (e) { return e.to === child.key; }).forEach(function (e) {
  8815. var beginIndex = _this.isVertical() ? DiagramItem_1.ConnectionPointSide.South : DiagramItem_1.ConnectionPointSide.East;
  8816. var endIndex = _this.isVertical() ? DiagramItem_1.ConnectionPointSide.North : DiagramItem_1.ConnectionPointSide.West;
  8817. layout.addEdge(new NodeLayout_1.EdgeLayout(e.key, beginIndex, endIndex));
  8818. });
  8819. prevSiblingLayout = childLayout;
  8820. };
  8821. var this_1 = this;
  8822. for (var child = void 0, i = 0; child = children[i]; i++) {
  8823. _loop_1(child, i);
  8824. }
  8825. return distantPoint + this.settings.subTreeColumnSpacing;
  8826. };
  8827. TreeLayoutBuilder.prototype.processParents = function (layout, parent, tree, parentNextSibling) {
  8828. var children = tree.getChildren(parent.info);
  8829. for (var child = void 0, i = children.length - 1; child = children[i]; i--)
  8830. this.processParents(layout, layout.nodeToLayout[child.key], tree, children[i + 1]);
  8831. if (children.length) {
  8832. var nearbyPoint = this.getChangingCoordinateForLayer(layout.nodeToLayout[children[0].key].position);
  8833. var distantPoint = this.getRectangleDistantEdge(layout.nodeToLayout[children[children.length - 1].key].rectangle);
  8834. var position = nearbyPoint + (distantPoint - nearbyPoint) / 2 - this.getSizeMeasurement(parent.info.size) / 2;
  8835. position = Math.max(this.getChangingCoordinateForLayer(parent.position), this.correctByMargin(position, parent, parentNextSibling && layout.nodeToLayout[parentNextSibling.key]));
  8836. if (this.isVertical())
  8837. parent.position.x = position;
  8838. else
  8839. parent.position.y = position;
  8840. }
  8841. };
  8842. TreeLayoutBuilder.prototype.getChangingCoordinateForLayer = function (point) {
  8843. return this.isVertical() ? point.x : point.y;
  8844. };
  8845. TreeLayoutBuilder.prototype.getRectangleDistantEdge = function (rectangle) {
  8846. return this.isVertical() ? rectangle.right : rectangle.bottom;
  8847. };
  8848. TreeLayoutBuilder.prototype.getSizeMeasurement = function (size) {
  8849. return this.isVertical() ? size.width : size.height;
  8850. };
  8851. TreeLayoutBuilder.prototype.correctByMargin = function (position, element, distant) {
  8852. if (distant) {
  8853. var distantPoint = this.isVertical() ? Math.max(distant.info.margin.left, element.info.margin.right) : Math.max(distant.info.margin.top, element.info.margin.bottom);
  8854. position = Math.min(position, this.getChangingCoordinateForLayer(distant.position) - distantPoint - this.getSizeMeasurement(element.info.size));
  8855. }
  8856. return position;
  8857. };
  8858. TreeLayoutBuilder.prototype.isVertical = function () {
  8859. return this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical;
  8860. };
  8861. return TreeLayoutBuilder;
  8862. }(BaseBuilder_1.LayoutBuilder));
  8863. exports.TreeLayoutBuilder = TreeLayoutBuilder;
  8864. /***/ }),
  8865. /* 62 */
  8866. /***/ (function(module, exports, __webpack_require__) {
  8867. "use strict";
  8868. var __extends = (this && this.__extends) || (function () {
  8869. var extendStatics = function (d, b) {
  8870. extendStatics = Object.setPrototypeOf ||
  8871. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8872. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8873. return extendStatics(d, b);
  8874. };
  8875. return function (d, b) {
  8876. extendStatics(d, b);
  8877. function __() { this.constructor = d; }
  8878. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8879. };
  8880. })();
  8881. Object.defineProperty(exports, "__esModule", { value: true });
  8882. var ChangeStylePropertyCommandBase_1 = __webpack_require__(87);
  8883. var ChangeStyleTextHistoryItem_1 = __webpack_require__(42);
  8884. var ChangeStyleTextPropertyCommand = /** @class */ (function (_super) {
  8885. __extends(ChangeStyleTextPropertyCommand, _super);
  8886. function ChangeStyleTextPropertyCommand() {
  8887. return _super !== null && _super.apply(this, arguments) || this;
  8888. }
  8889. ChangeStyleTextPropertyCommand.prototype.getStateValue = function () {
  8890. return this.control.selection.inputPosition.getStyleTextPropertyValue(this.getStyleProperty());
  8891. };
  8892. ChangeStyleTextPropertyCommand.prototype.getStyleObj = function (item) {
  8893. return item.styleText;
  8894. };
  8895. ChangeStyleTextPropertyCommand.prototype.createHistoryItem = function (item, styleProperty, styleValue) {
  8896. return new ChangeStyleTextHistoryItem_1.ChangeStyleTextHistoryItem(item.key, styleProperty, styleValue);
  8897. };
  8898. ChangeStyleTextPropertyCommand.prototype.updateInputPosition = function (value) {
  8899. this.control.selection.inputPosition.setStyleTextPropertyValue(this.getStyleProperty(), value);
  8900. };
  8901. return ChangeStyleTextPropertyCommand;
  8902. }(ChangeStylePropertyCommandBase_1.ChangeStylePropertyCommandBase));
  8903. exports.ChangeStyleTextPropertyCommand = ChangeStyleTextPropertyCommand;
  8904. /***/ }),
  8905. /* 63 */
  8906. /***/ (function(module, exports, __webpack_require__) {
  8907. "use strict";
  8908. var __extends = (this && this.__extends) || (function () {
  8909. var extendStatics = function (d, b) {
  8910. extendStatics = Object.setPrototypeOf ||
  8911. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8912. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8913. return extendStatics(d, b);
  8914. };
  8915. return function (d, b) {
  8916. extendStatics(d, b);
  8917. function __() { this.constructor = d; }
  8918. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8919. };
  8920. })();
  8921. Object.defineProperty(exports, "__esModule", { value: true });
  8922. var ChangeStyleHistoryItemBase_1 = __webpack_require__(86);
  8923. var ChangeStyleHistoryItem = /** @class */ (function (_super) {
  8924. __extends(ChangeStyleHistoryItem, _super);
  8925. function ChangeStyleHistoryItem(itemKey, styleProperty, styleValue) {
  8926. return _super.call(this, itemKey, styleProperty, styleValue) || this;
  8927. }
  8928. ChangeStyleHistoryItem.prototype.redo = function (manipulator) {
  8929. var item = manipulator.model.findItem(this.itemKey);
  8930. this.oldStyleValue = item.style[this.styleProperty];
  8931. manipulator.changeStyle(item, this.styleProperty, this.styleValue);
  8932. };
  8933. ChangeStyleHistoryItem.prototype.undo = function (manipulator) {
  8934. var item = manipulator.model.findItem(this.itemKey);
  8935. manipulator.changeStyle(item, this.styleProperty, this.oldStyleValue);
  8936. };
  8937. return ChangeStyleHistoryItem;
  8938. }(ChangeStyleHistoryItemBase_1.ChangeStyleHistoryItemBase));
  8939. exports.ChangeStyleHistoryItem = ChangeStyleHistoryItem;
  8940. /***/ }),
  8941. /* 64 */
  8942. /***/ (function(module, exports, __webpack_require__) {
  8943. "use strict";
  8944. var __extends = (this && this.__extends) || (function () {
  8945. var extendStatics = function (d, b) {
  8946. extendStatics = Object.setPrototypeOf ||
  8947. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  8948. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8949. return extendStatics(d, b);
  8950. };
  8951. return function (d, b) {
  8952. extendStatics(d, b);
  8953. function __() { this.constructor = d; }
  8954. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8955. };
  8956. })();
  8957. Object.defineProperty(exports, "__esModule", { value: true });
  8958. var CommandBase_1 = __webpack_require__(7);
  8959. var CommandStates_1 = __webpack_require__(6);
  8960. var CanvasManager_1 = __webpack_require__(44);
  8961. var RenderManager_1 = __webpack_require__(10);
  8962. var ExportImageCommand = /** @class */ (function (_super) {
  8963. __extends(ExportImageCommand, _super);
  8964. function ExportImageCommand() {
  8965. return _super !== null && _super.apply(this, arguments) || this;
  8966. }
  8967. ExportImageCommand.prototype.getState = function () {
  8968. return new CommandStates_1.SimpleCommandState(true);
  8969. };
  8970. ExportImageCommand.prototype.executeCore = function (state, parameter) {
  8971. var _this = this;
  8972. try {
  8973. var canvasManager = this.getCanvasManager();
  8974. var exportFunc = this.getExportFunc();
  8975. exportFunc(canvasManager, function (url) {
  8976. parameter(url);
  8977. _this.tryDisposeCanvasManager();
  8978. });
  8979. }
  8980. catch (e) {
  8981. this.tryDisposeCanvasManager();
  8982. throw e;
  8983. }
  8984. return true;
  8985. };
  8986. ExportImageCommand.prototype.getCanvasManager = function () {
  8987. if (this.control.canvasManager !== undefined)
  8988. return this.control.canvasManager;
  8989. if (this.canvasManager === undefined)
  8990. this.canvasManager = this.createCanvasManager();
  8991. return this.canvasManager;
  8992. };
  8993. ExportImageCommand.prototype.createCanvasManager = function () {
  8994. var svgElement = RenderManager_1.RenderManager.createSvgElement(true);
  8995. document.body.appendChild(svgElement);
  8996. var canvasManager = new CanvasManager_1.CanvasManager(svgElement);
  8997. this.control.modelManipulator.onModelChanged.add(canvasManager);
  8998. this.control.modelManipulator.onLoad();
  8999. return canvasManager;
  9000. };
  9001. ExportImageCommand.prototype.tryDisposeCanvasManager = function () {
  9002. if (this.canvasManager) {
  9003. document.body.removeChild(this.canvasManager.svgElement);
  9004. delete this.canvasManager;
  9005. }
  9006. };
  9007. return ExportImageCommand;
  9008. }(CommandBase_1.CommandBase));
  9009. exports.ExportImageCommand = ExportImageCommand;
  9010. /***/ }),
  9011. /* 65 */
  9012. /***/ (function(module, exports, __webpack_require__) {
  9013. "use strict";
  9014. var __extends = (this && this.__extends) || (function () {
  9015. var extendStatics = function (d, b) {
  9016. extendStatics = Object.setPrototypeOf ||
  9017. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9018. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  9019. return extendStatics(d, b);
  9020. };
  9021. return function (d, b) {
  9022. extendStatics(d, b);
  9023. function __() { this.constructor = d; }
  9024. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9025. };
  9026. })();
  9027. Object.defineProperty(exports, "__esModule", { value: true });
  9028. var CommandBase_1 = __webpack_require__(7);
  9029. var ClipboardCommand = /** @class */ (function (_super) {
  9030. __extends(ClipboardCommand, _super);
  9031. function ClipboardCommand() {
  9032. return _super !== null && _super.apply(this, arguments) || this;
  9033. }
  9034. ClipboardCommand.prototype.setClipboardData = function (data) {
  9035. if (this.control.renderManager)
  9036. this.control.renderManager.setClipboardData(data);
  9037. else
  9038. ClipboardCommand.clipboardData = data;
  9039. };
  9040. ClipboardCommand.prototype.getClipboardData = function (callback) {
  9041. if (this.control.renderManager)
  9042. this.control.renderManager.getClipboardData(callback);
  9043. else
  9044. callback(ClipboardCommand.clipboardData);
  9045. };
  9046. return ClipboardCommand;
  9047. }(CommandBase_1.CommandBase));
  9048. exports.ClipboardCommand = ClipboardCommand;
  9049. /***/ }),
  9050. /* 66 */
  9051. /***/ (function(module, exports, __webpack_require__) {
  9052. "use strict";
  9053. var __extends = (this && this.__extends) || (function () {
  9054. var extendStatics = function (d, b) {
  9055. extendStatics = Object.setPrototypeOf ||
  9056. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9057. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  9058. return extendStatics(d, b);
  9059. };
  9060. return function (d, b) {
  9061. extendStatics(d, b);
  9062. function __() { this.constructor = d; }
  9063. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9064. };
  9065. })();
  9066. Object.defineProperty(exports, "__esModule", { value: true });
  9067. var ModelUtils_1 = __webpack_require__(8);
  9068. var MouseHandlerMoveShapeStateBase_1 = __webpack_require__(95);
  9069. var KeyCode_1 = __webpack_require__(16);
  9070. var MouseHandlerMoveClonedShapeState = /** @class */ (function (_super) {
  9071. __extends(MouseHandlerMoveClonedShapeState, _super);
  9072. function MouseHandlerMoveClonedShapeState(handler, history, model, selection, moveStartPoint) {
  9073. var _this = _super.call(this, handler, history, model, selection) || this;
  9074. _this.model = model;
  9075. _this.selection = selection;
  9076. _this.moveStartPoint = moveStartPoint;
  9077. return _this;
  9078. }
  9079. MouseHandlerMoveClonedShapeState.prototype.onMouseDown = function (evt) {
  9080. var dx = this.moveStartPoint ? evt.layoutPoint.x - this.moveStartPoint.x : 0;
  9081. var dy = this.moveStartPoint ? evt.layoutPoint.y - this.moveStartPoint.y : 0;
  9082. ModelUtils_1.ModelUtils.cloneSelectionToOffset(this.history, this.model, this.selection, dx, dy);
  9083. _super.prototype.onMouseDown.call(this, evt);
  9084. };
  9085. MouseHandlerMoveClonedShapeState.isMoveClonedShapeEvent = function (evt) {
  9086. return evt.modifiers & KeyCode_1.ModifierKey.Ctrl && evt.modifiers & KeyCode_1.ModifierKey.Shift;
  9087. };
  9088. return MouseHandlerMoveClonedShapeState;
  9089. }(MouseHandlerMoveShapeStateBase_1.MouseHandlerMoveShapeStateBase));
  9090. exports.MouseHandlerMoveClonedShapeState = MouseHandlerMoveClonedShapeState;
  9091. /***/ }),
  9092. /* 67 */
  9093. /***/ (function(module, exports, __webpack_require__) {
  9094. "use strict";
  9095. Object.defineProperty(exports, "__esModule", { value: true });
  9096. var ConnectionPointInfo = /** @class */ (function () {
  9097. function ConnectionPointInfo(point, side) {
  9098. this.point = point;
  9099. this.side = side;
  9100. }
  9101. return ConnectionPointInfo;
  9102. }());
  9103. exports.ConnectionPointInfo = ConnectionPointInfo;
  9104. var ConnectionPointsVisualizerBase = /** @class */ (function () {
  9105. function ConnectionPointsVisualizerBase(dispatcher) {
  9106. this.dispatcher = dispatcher;
  9107. }
  9108. ConnectionPointsVisualizerBase.prototype.getKey = function () {
  9109. return this.key;
  9110. };
  9111. ConnectionPointsVisualizerBase.prototype.setPoints = function (key, points, pointIndex) {
  9112. if (this.key !== key || this.pointIndex !== pointIndex) {
  9113. this.key = key;
  9114. this.points = points;
  9115. this.pointIndex = pointIndex;
  9116. this.raiseShow();
  9117. }
  9118. };
  9119. ConnectionPointsVisualizerBase.prototype.setPointIndex = function (pointIndex) {
  9120. if (0 <= pointIndex && pointIndex < this.points.length && this.pointIndex !== pointIndex) {
  9121. this.pointIndex = pointIndex;
  9122. this.raiseShow();
  9123. }
  9124. };
  9125. ConnectionPointsVisualizerBase.prototype.update = function () {
  9126. this.raiseShow();
  9127. };
  9128. ConnectionPointsVisualizerBase.prototype.reset = function () {
  9129. if (this.key !== "-1") {
  9130. this.key = "-1";
  9131. this.points = [];
  9132. this.pointIndex = -1;
  9133. this.raiseHide();
  9134. }
  9135. };
  9136. return ConnectionPointsVisualizerBase;
  9137. }());
  9138. exports.ConnectionPointsVisualizerBase = ConnectionPointsVisualizerBase;
  9139. /***/ }),
  9140. /* 68 */
  9141. /***/ (function(module, exports, __webpack_require__) {
  9142. "use strict";
  9143. Object.defineProperty(exports, "__esModule", { value: true });
  9144. var DeleteCommand_1 = __webpack_require__(100);
  9145. var UndoCommand_1 = __webpack_require__(156);
  9146. var RedoCommand_1 = __webpack_require__(157);
  9147. var ImportCommand_1 = __webpack_require__(158);
  9148. var ExportCommand_1 = __webpack_require__(159);
  9149. var ToggleFontBoldCommand_1 = __webpack_require__(160);
  9150. var ToggleFontItalicCommand_1 = __webpack_require__(161);
  9151. var ToggleFontUnderlineCommand_1 = __webpack_require__(162);
  9152. var ChangeFontNameCommand_1 = __webpack_require__(163);
  9153. var ChangeFontSizeCommand_1 = __webpack_require__(164);
  9154. var ChangeFontColorCommand_1 = __webpack_require__(165);
  9155. var ChangeFillColorCommand_1 = __webpack_require__(166);
  9156. var ChangeStrokeColorCommand_1 = __webpack_require__(167);
  9157. var ImportDataSourceCommand_1 = __webpack_require__(168);
  9158. var ChangeTextAlignCommand_1 = __webpack_require__(169);
  9159. var ChangeConnectorLineEndingCommand_1 = __webpack_require__(170);
  9160. var ChangeConnectorLineOptionCommand_1 = __webpack_require__(171);
  9161. var SelectAllCommand_1 = __webpack_require__(172);
  9162. var KeyCode_1 = __webpack_require__(16);
  9163. var AutoLayoutTreeVerticalCommand_1 = __webpack_require__(173);
  9164. var ChangeSnapToGridCommand_1 = __webpack_require__(174);
  9165. var ChangeGridSizeCommand_1 = __webpack_require__(176);
  9166. var ChangePageLandscapeCommand_1 = __webpack_require__(177);
  9167. var ChangePageSizeCommand_1 = __webpack_require__(179);
  9168. var ExportPngCommand_1 = __webpack_require__(181);
  9169. var ExportSvgCommand_1 = __webpack_require__(185);
  9170. var ExportJpgCommand_1 = __webpack_require__(186);
  9171. var CopySelectionCommand_1 = __webpack_require__(187);
  9172. var CutSelectionCommand_1 = __webpack_require__(188);
  9173. var PasteSelectionCommand_1 = __webpack_require__(189);
  9174. var ImportBPMNCommand_1 = __webpack_require__(192);
  9175. var SendToBackCommand_1 = __webpack_require__(194);
  9176. var BringToFrontCommand_1 = __webpack_require__(195);
  9177. var AutoLayoutLayeredHorizontalCommand_1 = __webpack_require__(196);
  9178. var MoveCommands_1 = __webpack_require__(197);
  9179. var ChangeZoomLevelCommand_1 = __webpack_require__(198);
  9180. var BindDocumentCommand_1 = __webpack_require__(199);
  9181. var UnbindDocumentCommand_1 = __webpack_require__(201);
  9182. var AutoLayoutTreeHorizontalCommand_1 = __webpack_require__(202);
  9183. var AutoLayoutLayeredVerticalCommand_1 = __webpack_require__(203);
  9184. var CloseDataSourceCommand_1 = __webpack_require__(204);
  9185. var LockCommand_1 = __webpack_require__(205);
  9186. var UnlockCommand_1 = __webpack_require__(207);
  9187. var CloneCommand_1 = __webpack_require__(208);
  9188. var ChangeUnitsCommand_1 = __webpack_require__(209);
  9189. var ChangePageColorCommand_1 = __webpack_require__(210);
  9190. var ChangeShowGridCommand_1 = __webpack_require__(211);
  9191. var ToggleFullscreenCommand_1 = __webpack_require__(212);
  9192. var DiagramCommand;
  9193. (function (DiagramCommand) {
  9194. DiagramCommand[DiagramCommand["Undo"] = 0] = "Undo";
  9195. DiagramCommand[DiagramCommand["Redo"] = 1] = "Redo";
  9196. DiagramCommand[DiagramCommand["Cut"] = 2] = "Cut";
  9197. DiagramCommand[DiagramCommand["Copy"] = 3] = "Copy";
  9198. DiagramCommand[DiagramCommand["Paste"] = 4] = "Paste";
  9199. DiagramCommand[DiagramCommand["SelectAll"] = 5] = "SelectAll";
  9200. DiagramCommand[DiagramCommand["Delete"] = 6] = "Delete";
  9201. DiagramCommand[DiagramCommand["Import"] = 7] = "Import";
  9202. DiagramCommand[DiagramCommand["ImportBPMN"] = 8] = "ImportBPMN";
  9203. DiagramCommand[DiagramCommand["Export"] = 9] = "Export";
  9204. DiagramCommand[DiagramCommand["ExportSvg"] = 10] = "ExportSvg";
  9205. DiagramCommand[DiagramCommand["ExportPng"] = 11] = "ExportPng";
  9206. DiagramCommand[DiagramCommand["ExportJpg"] = 12] = "ExportJpg";
  9207. DiagramCommand[DiagramCommand["ImportDataSource"] = 13] = "ImportDataSource";
  9208. DiagramCommand[DiagramCommand["CloseDataSource"] = 14] = "CloseDataSource";
  9209. DiagramCommand[DiagramCommand["BindDocument"] = 15] = "BindDocument";
  9210. DiagramCommand[DiagramCommand["UnbindDocument"] = 16] = "UnbindDocument";
  9211. DiagramCommand[DiagramCommand["Bold"] = 17] = "Bold";
  9212. DiagramCommand[DiagramCommand["Italic"] = 18] = "Italic";
  9213. DiagramCommand[DiagramCommand["Underline"] = 19] = "Underline";
  9214. DiagramCommand[DiagramCommand["FontName"] = 20] = "FontName";
  9215. DiagramCommand[DiagramCommand["FontSize"] = 21] = "FontSize";
  9216. DiagramCommand[DiagramCommand["FontColor"] = 22] = "FontColor";
  9217. DiagramCommand[DiagramCommand["FillColor"] = 23] = "FillColor";
  9218. DiagramCommand[DiagramCommand["StrokeColor"] = 24] = "StrokeColor";
  9219. DiagramCommand[DiagramCommand["TextLeftAlign"] = 25] = "TextLeftAlign";
  9220. DiagramCommand[DiagramCommand["TextCenterAlign"] = 26] = "TextCenterAlign";
  9221. DiagramCommand[DiagramCommand["TextRightAlign"] = 27] = "TextRightAlign";
  9222. DiagramCommand[DiagramCommand["ConnectorLineOption"] = 28] = "ConnectorLineOption";
  9223. DiagramCommand[DiagramCommand["ConnectorStartLineEnding"] = 29] = "ConnectorStartLineEnding";
  9224. DiagramCommand[DiagramCommand["ConnectorEndLineEnding"] = 30] = "ConnectorEndLineEnding";
  9225. DiagramCommand[DiagramCommand["BringToFront"] = 31] = "BringToFront";
  9226. DiagramCommand[DiagramCommand["SendToBack"] = 32] = "SendToBack";
  9227. DiagramCommand[DiagramCommand["MoveLeft"] = 33] = "MoveLeft";
  9228. DiagramCommand[DiagramCommand["MoveStepLeft"] = 34] = "MoveStepLeft";
  9229. DiagramCommand[DiagramCommand["MoveRight"] = 35] = "MoveRight";
  9230. DiagramCommand[DiagramCommand["MoveStepRight"] = 36] = "MoveStepRight";
  9231. DiagramCommand[DiagramCommand["MoveUp"] = 37] = "MoveUp";
  9232. DiagramCommand[DiagramCommand["MoveStepUp"] = 38] = "MoveStepUp";
  9233. DiagramCommand[DiagramCommand["MoveDown"] = 39] = "MoveDown";
  9234. DiagramCommand[DiagramCommand["MoveStepDown"] = 40] = "MoveStepDown";
  9235. DiagramCommand[DiagramCommand["CloneLeft"] = 41] = "CloneLeft";
  9236. DiagramCommand[DiagramCommand["CloneRight"] = 42] = "CloneRight";
  9237. DiagramCommand[DiagramCommand["CloneUp"] = 43] = "CloneUp";
  9238. DiagramCommand[DiagramCommand["CloneDown"] = 44] = "CloneDown";
  9239. DiagramCommand[DiagramCommand["AutoLayoutTree"] = 45] = "AutoLayoutTree";
  9240. DiagramCommand[DiagramCommand["AutoLayoutFlow"] = 46] = "AutoLayoutFlow";
  9241. DiagramCommand[DiagramCommand["AutoLayoutTreeVertical"] = 47] = "AutoLayoutTreeVertical";
  9242. DiagramCommand[DiagramCommand["AutoLayoutTreeHorizontal"] = 48] = "AutoLayoutTreeHorizontal";
  9243. DiagramCommand[DiagramCommand["AutoLayoutLayeredVertical"] = 49] = "AutoLayoutLayeredVertical";
  9244. DiagramCommand[DiagramCommand["AutoLayoutLayeredHorizontal"] = 50] = "AutoLayoutLayeredHorizontal";
  9245. DiagramCommand[DiagramCommand["Lock"] = 51] = "Lock";
  9246. DiagramCommand[DiagramCommand["Unlock"] = 52] = "Unlock";
  9247. DiagramCommand[DiagramCommand["Units"] = 53] = "Units";
  9248. DiagramCommand[DiagramCommand["PageSize"] = 54] = "PageSize";
  9249. DiagramCommand[DiagramCommand["PageLandscape"] = 55] = "PageLandscape";
  9250. DiagramCommand[DiagramCommand["PageColor"] = 56] = "PageColor";
  9251. DiagramCommand[DiagramCommand["GridSize"] = 57] = "GridSize";
  9252. DiagramCommand[DiagramCommand["ShowGrid"] = 58] = "ShowGrid";
  9253. DiagramCommand[DiagramCommand["SnapToGrid"] = 59] = "SnapToGrid";
  9254. DiagramCommand[DiagramCommand["ZoomLevel"] = 60] = "ZoomLevel";
  9255. DiagramCommand[DiagramCommand["Fullscreen"] = 61] = "Fullscreen";
  9256. })(DiagramCommand = exports.DiagramCommand || (exports.DiagramCommand = {}));
  9257. var CommandManager = /** @class */ (function () {
  9258. function CommandManager(control) {
  9259. this.commands = {};
  9260. this.shortcutsToCommand = {};
  9261. this.lastCommandsChain = [];
  9262. this.executingCommandsChain = [];
  9263. this.executingCommandCounter = 0;
  9264. this.isPublicApiCall = false;
  9265. this.createCommand(control, DiagramCommand.Undo, UndoCommand_1.UndoCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.KeyCode.Key_z, KeyCode_1.ModifierKey.Meta | KeyCode_1.KeyCode.Key_z);
  9266. this.createCommand(control, DiagramCommand.Redo, RedoCommand_1.RedoCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.KeyCode.Key_y, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Key_z, KeyCode_1.ModifierKey.Meta | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Key_z);
  9267. this.createCommand(control, DiagramCommand.Cut, CutSelectionCommand_1.CutSelectionCommand, KeyCode_1.KeyCode.Key_x | KeyCode_1.ModifierKey.Ctrl, KeyCode_1.KeyCode.Key_x | KeyCode_1.ModifierKey.Meta);
  9268. this.createCommand(control, DiagramCommand.Copy, CopySelectionCommand_1.CopySelectionCommand, KeyCode_1.KeyCode.Key_c | KeyCode_1.ModifierKey.Ctrl, KeyCode_1.KeyCode.Key_c | KeyCode_1.ModifierKey.Meta);
  9269. this.createCommand(control, DiagramCommand.Paste, PasteSelectionCommand_1.PasteSelectionCommand);
  9270. this.createCommand(control, DiagramCommand.SelectAll, SelectAllCommand_1.SelectAllCommand, KeyCode_1.KeyCode.Key_a | KeyCode_1.ModifierKey.Ctrl, KeyCode_1.KeyCode.Key_a | KeyCode_1.ModifierKey.Meta);
  9271. this.createCommand(control, DiagramCommand.Delete, DeleteCommand_1.DeleteCommand, KeyCode_1.KeyCode.Delete, KeyCode_1.KeyCode.Backspace);
  9272. this.createCommand(control, DiagramCommand.Import, ImportCommand_1.ImportCommand);
  9273. this.createCommand(control, DiagramCommand.ImportBPMN, ImportBPMNCommand_1.ImportBPMNCommand);
  9274. this.createCommand(control, DiagramCommand.Export, ExportCommand_1.ExportCommand);
  9275. this.createCommand(control, DiagramCommand.ExportSvg, ExportSvgCommand_1.ExportSvgCommand);
  9276. this.createCommand(control, DiagramCommand.ExportPng, ExportPngCommand_1.ExportPngCommand);
  9277. this.createCommand(control, DiagramCommand.ExportJpg, ExportJpgCommand_1.ExportJpgCommand);
  9278. this.createCommand(control, DiagramCommand.ImportDataSource, ImportDataSourceCommand_1.ImportDataSourceCommand);
  9279. this.createCommand(control, DiagramCommand.CloseDataSource, CloseDataSourceCommand_1.CloseDataSourceCommand);
  9280. this.createCommand(control, DiagramCommand.BindDocument, BindDocumentCommand_1.BindDocumentCommand);
  9281. this.createCommand(control, DiagramCommand.UnbindDocument, UnbindDocumentCommand_1.UnbindDocumentCommand);
  9282. this.createCommand(control, DiagramCommand.Bold, ToggleFontBoldCommand_1.ToggleFontBoldCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.KeyCode.Key_b, KeyCode_1.ModifierKey.Meta | KeyCode_1.KeyCode.Key_b);
  9283. this.createCommand(control, DiagramCommand.Italic, ToggleFontItalicCommand_1.ToggleFontItalicCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.KeyCode.Key_i, KeyCode_1.ModifierKey.Meta | KeyCode_1.KeyCode.Key_i);
  9284. this.createCommand(control, DiagramCommand.Underline, ToggleFontUnderlineCommand_1.ToggleFontUnderlineCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.KeyCode.Key_u, KeyCode_1.ModifierKey.Meta | KeyCode_1.KeyCode.Key_u);
  9285. this.createCommand(control, DiagramCommand.FontName, ChangeFontNameCommand_1.ChangeFontNameCommand);
  9286. this.createCommand(control, DiagramCommand.FontSize, ChangeFontSizeCommand_1.ChangeFontSizeCommand);
  9287. this.createCommand(control, DiagramCommand.FontColor, ChangeFontColorCommand_1.ChangeFontColorCommand);
  9288. this.createCommand(control, DiagramCommand.FillColor, ChangeFillColorCommand_1.ChangeFillColorCommand);
  9289. this.createCommand(control, DiagramCommand.StrokeColor, ChangeStrokeColorCommand_1.ChangeStrokeColorCommand);
  9290. this.createCommand(control, DiagramCommand.TextLeftAlign, ChangeTextAlignCommand_1.TextLeftAlignCommand);
  9291. this.createCommand(control, DiagramCommand.TextCenterAlign, ChangeTextAlignCommand_1.TextCenterAlignCommand);
  9292. this.createCommand(control, DiagramCommand.TextRightAlign, ChangeTextAlignCommand_1.TextRightAlignCommand);
  9293. this.createCommand(control, DiagramCommand.ConnectorLineOption, ChangeConnectorLineOptionCommand_1.ChangeConnectorLineOptionCommand);
  9294. this.createCommand(control, DiagramCommand.ConnectorStartLineEnding, ChangeConnectorLineEndingCommand_1.ChangeConnectorStartLineEndingCommand);
  9295. this.createCommand(control, DiagramCommand.ConnectorEndLineEnding, ChangeConnectorLineEndingCommand_1.ChangeConnectorEndLineEndingCommand);
  9296. this.createCommand(control, DiagramCommand.BringToFront, BringToFrontCommand_1.BringToFrontCommand);
  9297. this.createCommand(control, DiagramCommand.SendToBack, SendToBackCommand_1.SendToBackCommand);
  9298. this.createCommand(control, DiagramCommand.MoveLeft, MoveCommands_1.MoveLeftCommand, KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Left);
  9299. this.createCommand(control, DiagramCommand.MoveStepLeft, MoveCommands_1.MoveStepLeftCommand, KeyCode_1.KeyCode.Left);
  9300. this.createCommand(control, DiagramCommand.MoveRight, MoveCommands_1.MoveRightCommand, KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Right);
  9301. this.createCommand(control, DiagramCommand.MoveStepRight, MoveCommands_1.MoveStepRightCommand, KeyCode_1.KeyCode.Right);
  9302. this.createCommand(control, DiagramCommand.MoveUp, MoveCommands_1.MoveUpCommand, KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Up);
  9303. this.createCommand(control, DiagramCommand.MoveStepUp, MoveCommands_1.MoveStepUpCommand, KeyCode_1.KeyCode.Up);
  9304. this.createCommand(control, DiagramCommand.MoveDown, MoveCommands_1.MoveDownCommand, KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Down);
  9305. this.createCommand(control, DiagramCommand.MoveStepDown, MoveCommands_1.MoveStepDownCommand, KeyCode_1.KeyCode.Down);
  9306. this.createCommand(control, DiagramCommand.CloneLeft, CloneCommand_1.CloneLeftCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Left);
  9307. this.createCommand(control, DiagramCommand.CloneRight, CloneCommand_1.CloneRightCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Right);
  9308. this.createCommand(control, DiagramCommand.CloneUp, CloneCommand_1.CloneUpCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Up);
  9309. this.createCommand(control, DiagramCommand.CloneDown, CloneCommand_1.CloneDownCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Down);
  9310. this.createCommand(control, DiagramCommand.Lock, LockCommand_1.LockCommand);
  9311. this.createCommand(control, DiagramCommand.Unlock, UnlockCommand_1.UnLockCommand);
  9312. this.createCommand(control, DiagramCommand.AutoLayoutTree, AutoLayoutTreeVerticalCommand_1.AutoLayoutTreeVerticalCommand); // TODO: remove after, need for BC
  9313. this.createCommand(control, DiagramCommand.AutoLayoutFlow, AutoLayoutLayeredHorizontalCommand_1.AutoLayoutLayeredHorizontalCommand); // TODO: remove after, need for BC
  9314. this.createCommand(control, DiagramCommand.Units, ChangeUnitsCommand_1.ChangeUnitsCommand);
  9315. this.createCommand(control, DiagramCommand.PageSize, ChangePageSizeCommand_1.ChangePageSizeCommand);
  9316. this.createCommand(control, DiagramCommand.PageLandscape, ChangePageLandscapeCommand_1.ChangePageLandscapeCommand);
  9317. this.createCommand(control, DiagramCommand.PageColor, ChangePageColorCommand_1.ChangePageColorCommand);
  9318. this.createCommand(control, DiagramCommand.GridSize, ChangeGridSizeCommand_1.ChangeGridSizeCommand);
  9319. this.createCommand(control, DiagramCommand.ShowGrid, ChangeShowGridCommand_1.ChangeShowGridCommand);
  9320. this.createCommand(control, DiagramCommand.SnapToGrid, ChangeSnapToGridCommand_1.ChangeSnapToGridCommand);
  9321. this.createCommand(control, DiagramCommand.ZoomLevel, ChangeZoomLevelCommand_1.ChangeZoomLevelCommand);
  9322. this.createCommand(control, DiagramCommand.AutoLayoutTreeVertical, AutoLayoutTreeVerticalCommand_1.AutoLayoutTreeVerticalCommand);
  9323. this.createCommand(control, DiagramCommand.AutoLayoutTreeHorizontal, AutoLayoutTreeHorizontalCommand_1.AutoLayoutTreeHorizontalCommand); // Not Implemented
  9324. this.createCommand(control, DiagramCommand.AutoLayoutLayeredVertical, AutoLayoutLayeredVerticalCommand_1.AutoLayoutLayeredVerticalCommand);
  9325. this.createCommand(control, DiagramCommand.AutoLayoutLayeredHorizontal, AutoLayoutLayeredHorizontalCommand_1.AutoLayoutLayeredHorizontalCommand);
  9326. this.createCommand(control, DiagramCommand.Fullscreen, ToggleFullscreenCommand_1.ToggleFullscreenCommand, KeyCode_1.KeyCode.F11);
  9327. }
  9328. CommandManager.prototype.getCommand = function (key) {
  9329. return this.commands[key];
  9330. };
  9331. CommandManager.prototype.beforeExecuting = function (command) {
  9332. this.executingCommandsChain.push(command);
  9333. this.executingCommandCounter++;
  9334. };
  9335. CommandManager.prototype.afterExecuting = function () {
  9336. this.executingCommandCounter--;
  9337. if (this.executingCommandCounter === 0) {
  9338. this.lastCommandsChain = this.executingCommandsChain;
  9339. this.executingCommandsChain = [];
  9340. }
  9341. };
  9342. CommandManager.prototype.assertLastExecutedCommandsChain = function (checkLength) {
  9343. var types = [];
  9344. for (var _i = 1; _i < arguments.length; _i++) {
  9345. types[_i - 1] = arguments[_i];
  9346. }
  9347. if (checkLength && this.lastCommandsChain.length !== types.length)
  9348. return false;
  9349. for (var i = 0, type; type = types[i]; i++) {
  9350. if (!this.lastCommandsChain[i] || !(this.lastCommandsChain[i] instanceof type))
  9351. return false;
  9352. }
  9353. return true;
  9354. };
  9355. CommandManager.prototype.processShortcut = function (code) {
  9356. var command = this.shortcutsToCommand[code];
  9357. if (command)
  9358. return command.execute();
  9359. return false;
  9360. };
  9361. CommandManager.prototype.processPaste = function (clipboardData) {
  9362. var command = this.getCommand(DiagramCommand.Paste);
  9363. if (command)
  9364. command.performPaste(clipboardData);
  9365. return true;
  9366. };
  9367. // ISelectionChangesListener
  9368. CommandManager.prototype.NotifySelectionChanged = function (_selection) {
  9369. this.lastCommandsChain = [];
  9370. };
  9371. CommandManager.prototype.NotifyScrollPositionChanged = function () { };
  9372. CommandManager.prototype.createCommand = function (control, commandId, commandType) {
  9373. var shortcuts = [];
  9374. for (var _i = 3; _i < arguments.length; _i++) {
  9375. shortcuts[_i - 3] = arguments[_i];
  9376. }
  9377. this.commands[commandId] = new commandType(control);
  9378. for (var i = 0; i < shortcuts.length; i++) {
  9379. var shortcut = shortcuts[i];
  9380. if (typeof shortcut === "number")
  9381. this.shortcutsToCommand[shortcut] = this.commands[commandId];
  9382. }
  9383. };
  9384. return CommandManager;
  9385. }());
  9386. exports.CommandManager = CommandManager;
  9387. /***/ }),
  9388. /* 69 */
  9389. /***/ (function(module, exports, __webpack_require__) {
  9390. "use strict";
  9391. var __extends = (this && this.__extends) || (function () {
  9392. var extendStatics = function (d, b) {
  9393. extendStatics = Object.setPrototypeOf ||
  9394. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9395. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  9396. return extendStatics(d, b);
  9397. };
  9398. return function (d, b) {
  9399. extendStatics(d, b);
  9400. function __() { this.constructor = d; }
  9401. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9402. };
  9403. })();
  9404. Object.defineProperty(exports, "__esModule", { value: true });
  9405. var RenderManager_1 = __webpack_require__(10);
  9406. var Primitive_1 = __webpack_require__(15);
  9407. var LinePrimitive = /** @class */ (function (_super) {
  9408. __extends(LinePrimitive, _super);
  9409. function LinePrimitive(x1, y1, x2, y2, style, className, clipPathId, onApplyProperties) {
  9410. var _this = _super.call(this, style, className, clipPathId, onApplyProperties) || this;
  9411. _this.x1 = x1;
  9412. _this.y1 = y1;
  9413. _this.x2 = x2;
  9414. _this.y2 = y2;
  9415. return _this;
  9416. }
  9417. LinePrimitive.prototype.createMainElement = function () {
  9418. return document.createElementNS(RenderManager_1.svgNS, "line");
  9419. };
  9420. LinePrimitive.prototype.applyElementProperties = function (element) {
  9421. this.setUnitAttribute(element, "x1", this.x1);
  9422. this.setUnitAttribute(element, "y1", this.y1);
  9423. this.setUnitAttribute(element, "x2", this.x2);
  9424. this.setUnitAttribute(element, "y2", this.y2);
  9425. _super.prototype.applyElementProperties.call(this, element);
  9426. };
  9427. return LinePrimitive;
  9428. }(Primitive_1.SvgPrimitive));
  9429. exports.LinePrimitive = LinePrimitive;
  9430. /***/ }),
  9431. /* 70 */
  9432. /***/ (function(module, exports, __webpack_require__) {
  9433. "use strict";
  9434. Object.defineProperty(exports, "__esModule", { value: true });
  9435. var Browser_1 = __webpack_require__(20);
  9436. var Base_1 = __webpack_require__(19);
  9437. var TouchUIHelper = /** @class */ (function () {
  9438. function TouchUIHelper() {
  9439. }
  9440. TouchUIHelper.onEventAttachingToDocument = function (eventName, func) {
  9441. if (Browser_1.Browser.MacOSMobilePlatform && TouchUIHelper.isTouchEventName(eventName)) {
  9442. if (!TouchUIHelper.documentTouchHandlers[eventName])
  9443. TouchUIHelper.documentTouchHandlers[eventName] = [];
  9444. TouchUIHelper.documentTouchHandlers[eventName].push(func);
  9445. return TouchUIHelper.documentEventAttachingAllowed;
  9446. }
  9447. return true;
  9448. };
  9449. TouchUIHelper.isTouchEventName = function (eventName) {
  9450. return Browser_1.Browser.WebKitTouchUI && (eventName.indexOf("touch") > -1 || eventName.indexOf("gesture") > -1);
  9451. };
  9452. TouchUIHelper.isTouchEvent = function (evt) {
  9453. if (!evt)
  9454. return false;
  9455. return Browser_1.Browser.WebKitTouchUI && Base_1.IsExists(evt.changedTouches);
  9456. };
  9457. TouchUIHelper.getEventX = function (evt) {
  9458. return Browser_1.Browser.IE ? evt.pageX : evt.changedTouches[0].pageX;
  9459. };
  9460. TouchUIHelper.getEventY = function (evt) {
  9461. return Browser_1.Browser.IE ? evt.pageY : evt.changedTouches[0].pageY;
  9462. };
  9463. TouchUIHelper.touchMouseDownEventName = Browser_1.Browser.WebKitTouchUI ? "touchstart" : (Browser_1.Browser.Edge && Browser_1.Browser.MSTouchUI && window.PointerEvent ? "pointerdown" : "mousedown");
  9464. TouchUIHelper.touchMouseUpEventName = Browser_1.Browser.WebKitTouchUI ? "touchend" : (Browser_1.Browser.Edge && Browser_1.Browser.MSTouchUI && window.PointerEvent ? "pointerup" : "mouseup");
  9465. TouchUIHelper.touchMouseMoveEventName = Browser_1.Browser.WebKitTouchUI ? "touchmove" : (Browser_1.Browser.Edge && Browser_1.Browser.MSTouchUI && window.PointerEvent ? "pointermove" : "mousemove");
  9466. TouchUIHelper.msTouchDraggableClassName = "dxMSTouchDraggable";
  9467. TouchUIHelper.documentTouchHandlers = {};
  9468. TouchUIHelper.documentEventAttachingAllowed = true;
  9469. return TouchUIHelper;
  9470. }());
  9471. exports.TouchUIHelper = TouchUIHelper;
  9472. //export class TouchUIHelper {
  9473. // isGesture: false;
  9474. // isMouseEventFromScrolling: false;
  9475. // isNativeScrollingAllowed: true;
  9476. // clickSensetivity: 10;
  9477. // documentTouchHandlers: {};
  9478. // documentEventAttachingAllowed: true;
  9479. // isTouchEvent(evt) {
  9480. // if (!evt)
  9481. // return false;
  9482. // return ASPx.Browser.WebKitTouchUI && ASPx.IsExists(evt.changedTouches);
  9483. // }
  9484. // getEventX(evt) {
  9485. // return ASPx.Browser.IE ? evt.pageX : evt.changedTouches[0].pageX;
  9486. // }
  9487. // getEventY (evt) {
  9488. // return ASPx.Browser.IE ? evt.pageY : evt.changedTouches[0].pageY;
  9489. // }
  9490. // getWebkitMajorVersion() {
  9491. // if (!this.webkitMajorVersion) {
  9492. // var regExp = new RegExp("applewebkit/(\\d+)", "i");
  9493. // var matches = regExp.exec(ASPx.Browser.UserAgent);
  9494. // if (matches && matches.index >= 1)
  9495. // this.webkitMajorVersion = matches[1];
  9496. // }
  9497. // return this.webkitMajorVersion;
  9498. // }
  9499. // getIsLandscapeOrientation() {
  9500. // if (ASPx.Browser.MacOSMobilePlatform || ASPx.Browser.AndroidMobilePlatform)
  9501. // return Math.abs(window.orientation) == 90;
  9502. // return ASPx.GetDocumentClientWidth() > ASPx.GetDocumentClientHeight();
  9503. // }
  9504. // nativeScrollingSupported() {
  9505. // var allowedSafariVersion = ASPx.Browser.Version >= 5.1 && ASPx.Browser.Version < 8; //T250059
  9506. // var allowedWebKitVersion = this.getWebkitMajorVersion() > 533 && (ASPx.Browser.Chrome || this.getWebkitMajorVersion() < 600);
  9507. // return (ASPx.Browser.MacOSMobilePlatform && (allowedSafariVersion || allowedWebKitVersion))
  9508. // || (ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 3) || (ASPx.Browser.MSTouchUI && (!ASPx.Browser.WindowsPhonePlatform || !ASPx.Browser.IE));
  9509. // }
  9510. // makeScrollableIfRequired(element, options) {
  9511. // if (ASPx.Browser.WebKitTouchUI && element) {
  9512. // var overflow = ASPx.GetCurrentStyle(element).overflow;
  9513. // if (element.tagName == "DIV" && overflow != "hidden" && overflow != "visible") {
  9514. // return this.MakeScrollable(element);
  9515. // }
  9516. // }
  9517. // }
  9518. // preventScrollOnEvent(evt) {
  9519. // }
  9520. // handleFastTapIfRequired(evt, action, preventCommonClickEvents) {
  9521. // if (ASPx.Browser.WebKitTouchUI && evt.type == 'touchstart' && action) {
  9522. // this.FastTapHelper.HandleFastTap(evt, action, preventCommonClickEvents);
  9523. // return true;
  9524. // }
  9525. // return false;
  9526. // }
  9527. // ensureDocumentSizesCorrect () {
  9528. // return (document.documentElement.clientWidth - document.documentElement.clientHeight) / (screen.width - screen.height) > 0;
  9529. // }
  9530. // ensureOrientationChanged(onOrientationChangedFunction) {
  9531. // if (ASPxClientUtils.iOSPlatform || this.ensureDocumentSizesCorrect())
  9532. // onOrientationChangedFunction();
  9533. // else {
  9534. // window.setTimeout(function () {
  9535. // this.ensureOrientationChanged(onOrientationChangedFunction);
  9536. // }.aspxBind(this), 100);
  9537. // }
  9538. // }
  9539. // onEventAttachingToDocument(eventName, func) {
  9540. // if (ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
  9541. // if (!this.documentTouchHandlers[eventName])
  9542. // this.documentTouchHandlers[eventName] = [];
  9543. // this.documentTouchHandlers[eventName].push(func);
  9544. // return this.documentEventAttachingAllowed;
  9545. // }
  9546. // return true;
  9547. // }
  9548. // onEventDettachedFromDocument(eventName, func) {
  9549. // if (ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
  9550. // var handlers = this.documentTouchHandlers[eventName];
  9551. // if (handlers)
  9552. // ASPx.Data.ArrayRemove(handlers, func);
  9553. // }
  9554. // }
  9555. // processDocumentTouchEventHandlers(proc) {
  9556. // var touchEventNames = ["touchstart", "touchend", "touchmove", "gesturestart", "gestureend"];
  9557. // for (var i = 0; i < touchEventNames.length; i++) {
  9558. // var eventName = touchEventNames[i];
  9559. // var handlers = this.documentTouchHandlers[eventName];
  9560. // if (handlers) {
  9561. // for (var j = 0; j < handlers.length; j++) {
  9562. // proc(eventName, handlers[j]);
  9563. // }
  9564. // }
  9565. // }
  9566. // }
  9567. // removeDocumentTouchEventHandlers() {
  9568. // if (ASPx.Browser.MacOSMobilePlatform) {
  9569. // this.documentEventAttachingAllowed = false;
  9570. // this.processDocumentTouchEventHandlers(ASPx.Evt.DetachEventFromDocumentCore);
  9571. // }
  9572. // }
  9573. // restoreDocumentTouchEventHandlers () {
  9574. // if (ASPx.Browser.MacOSMobilePlatform) {
  9575. // this.documentEventAttachingAllowed = true;
  9576. // this.processDocumentTouchEventHandlers(ASPx.Evt.AttachEventToDocumentCore);
  9577. // }
  9578. // }
  9579. // IsNativeScrolling() {
  9580. // return TouchUIHelper.nativeScrollingSupported() && TouchUIHelper.isNativeScrollingAllowed;
  9581. // }
  9582. // pointerEnabled: !!(window.PointerEvent || window.MSPointerEvent);
  9583. // pointerDownEventName: window.PointerEvent ? "pointerdown" : "MSPointerDown",
  9584. // pointerUpEventName: window.PointerEvent ? "pointerup" : "MSPointerUp",
  9585. // pointerCancelEventName: window.PointerEvent ? "pointercancel" : "MSPointerCancel",
  9586. // pointerMoveEventName: window.PointerEvent ? "pointermove" : "MSPointerMove",
  9587. // pointerOverEventName: window.PointerEvent ? "pointerover" : "MSPointerOver",
  9588. // pointerOutEventName: window.PointerEvent ? "pointerout" : "MSPointerOut",
  9589. // pointerType: {
  9590. // Touch: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 2 : "touch",
  9591. // Pen: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 3 : "pen",
  9592. // Mouse: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 4 : "mouse"
  9593. // }
  9594. // msGestureEnabled: !!(window.PointerEvent || window.MSPointerEvent) && typeof (MSGesture) != "undefined";
  9595. // msTouchCreateGesturesWrapper(element, onTap) {
  9596. // if (!TouchUIHelper.msGestureEnabled)
  9597. // return;
  9598. // var gesture = new MSGesture();
  9599. // gesture.target = element;
  9600. // ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerDownEventName, function (evt) {
  9601. // gesture.addPointer(evt.pointerId);
  9602. // });
  9603. // ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerUpEventName, function (evt) {
  9604. // gesture.stop();
  9605. // });
  9606. // if (onTap)
  9607. // ASPx.Evt.AttachEventToElement(element, "MSGestureTap", onTap);
  9608. // return gesture;
  9609. // }
  9610. //}
  9611. /***/ }),
  9612. /* 71 */
  9613. /***/ (function(module, exports, __webpack_require__) {
  9614. "use strict";
  9615. Object.defineProperty(exports, "__esModule", { value: true });
  9616. var ConnectorPointsCalculatorBase = /** @class */ (function () {
  9617. function ConnectorPointsCalculatorBase(connector) {
  9618. this.connector = connector;
  9619. }
  9620. return ConnectorPointsCalculatorBase;
  9621. }());
  9622. exports.ConnectorPointsCalculatorBase = ConnectorPointsCalculatorBase;
  9623. /***/ }),
  9624. /* 72 */
  9625. /***/ (function(module, exports, __webpack_require__) {
  9626. "use strict";
  9627. var __extends = (this && this.__extends) || (function () {
  9628. var extendStatics = function (d, b) {
  9629. extendStatics = Object.setPrototypeOf ||
  9630. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9631. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  9632. return extendStatics(d, b);
  9633. };
  9634. return function (d, b) {
  9635. extendStatics(d, b);
  9636. function __() { this.constructor = d; }
  9637. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9638. };
  9639. })();
  9640. Object.defineProperty(exports, "__esModule", { value: true });
  9641. var RenderManager_1 = __webpack_require__(10);
  9642. var FilterPrimitive_1 = __webpack_require__(113);
  9643. var Model_1 = __webpack_require__(21);
  9644. var TextFilterPrimitive = /** @class */ (function (_super) {
  9645. __extends(TextFilterPrimitive, _super);
  9646. function TextFilterPrimitive(id, useFloodColor, x, y, width, height) {
  9647. if (useFloodColor === void 0) { useFloodColor = true; }
  9648. if (x === void 0) { x = "-0.05"; }
  9649. if (y === void 0) { y = "-0.05"; }
  9650. if (width === void 0) { width = "1.1"; }
  9651. if (height === void 0) { height = "1.1"; }
  9652. var _this = _super.call(this, id, x, y, width, height) || this;
  9653. _this.id = id;
  9654. _this.useFloodColor = useFloodColor;
  9655. _this.x = x;
  9656. _this.y = y;
  9657. _this.width = width;
  9658. _this.height = height;
  9659. return _this;
  9660. }
  9661. TextFilterPrimitive.prototype.createChildElements = function (parent) {
  9662. var floodColor = this.getFloodColor(parent.parentElement);
  9663. var feFlood = document.createElementNS(RenderManager_1.svgNS, "feFlood");
  9664. if (this.useFloodColor) {
  9665. feFlood.setAttribute("flood-color", floodColor);
  9666. feFlood.setAttribute("class", "text-filter-flood");
  9667. if (floodColor !== Model_1.DiagramModel.defaultPageColor)
  9668. feFlood.style.setProperty("flood-color", floodColor);
  9669. }
  9670. parent.appendChild(feFlood);
  9671. var feComposite = document.createElementNS(RenderManager_1.svgNS, "feComposite");
  9672. feComposite.setAttribute("in", "SourceGraphic");
  9673. feComposite.setAttribute("operator", "atop");
  9674. parent.appendChild(feComposite);
  9675. };
  9676. TextFilterPrimitive.prototype.getFloodColor = function (element) {
  9677. while (element != null) {
  9678. if (element.tagName == "BODY" || element.nodeName == "#document")
  9679. break;
  9680. if (element.tagName === "svg" && element.style.backgroundColor !== "")
  9681. return element.style.backgroundColor;
  9682. element = element.parentNode;
  9683. }
  9684. return Model_1.DiagramModel.defaultPageColor;
  9685. };
  9686. return TextFilterPrimitive;
  9687. }(FilterPrimitive_1.FilterPrimitive));
  9688. exports.TextFilterPrimitive = TextFilterPrimitive;
  9689. /***/ }),
  9690. /* 73 */
  9691. /***/ (function(module, exports, __webpack_require__) {
  9692. "use strict";
  9693. var __extends = (this && this.__extends) || (function () {
  9694. var extendStatics = function (d, b) {
  9695. extendStatics = Object.setPrototypeOf ||
  9696. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9697. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  9698. return extendStatics(d, b);
  9699. };
  9700. return function (d, b) {
  9701. extendStatics(d, b);
  9702. function __() { this.constructor = d; }
  9703. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9704. };
  9705. })();
  9706. Object.defineProperty(exports, "__esModule", { value: true });
  9707. var HistoryItem_1 = __webpack_require__(4);
  9708. var Connector_1 = __webpack_require__(5);
  9709. var DeleteConnectionHistoryItem = /** @class */ (function (_super) {
  9710. __extends(DeleteConnectionHistoryItem, _super);
  9711. function DeleteConnectionHistoryItem(connector, position) {
  9712. var _this = _super.call(this) || this;
  9713. _this.connectorKey = connector.key;
  9714. _this.position = position;
  9715. _this.itemKey = connector.getExtremeItem(_this.position).key;
  9716. return _this;
  9717. }
  9718. DeleteConnectionHistoryItem.prototype.redo = function (manipulator) {
  9719. var connector = manipulator.model.findConnector(this.connectorKey);
  9720. this.oldConnectionPointIndex = this.position === Connector_1.ConnectorPosition.Begin ? connector.beginConnectionPointIndex : connector.endConnectionPointIndex;
  9721. manipulator.deleteConnection(connector, this.position);
  9722. };
  9723. DeleteConnectionHistoryItem.prototype.undo = function (manipulator) {
  9724. var connector = manipulator.model.findConnector(this.connectorKey);
  9725. var item = manipulator.model.findItem(this.itemKey);
  9726. manipulator.addConnection(connector, item, this.oldConnectionPointIndex, this.position);
  9727. };
  9728. return DeleteConnectionHistoryItem;
  9729. }(HistoryItem_1.HistoryItem));
  9730. exports.DeleteConnectionHistoryItem = DeleteConnectionHistoryItem;
  9731. /***/ }),
  9732. /* 74 */
  9733. /***/ (function(module, exports, __webpack_require__) {
  9734. "use strict";
  9735. var __extends = (this && this.__extends) || (function () {
  9736. var extendStatics = function (d, b) {
  9737. extendStatics = Object.setPrototypeOf ||
  9738. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9739. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  9740. return extendStatics(d, b);
  9741. };
  9742. return function (d, b) {
  9743. extendStatics(d, b);
  9744. function __() { this.constructor = d; }
  9745. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9746. };
  9747. })();
  9748. Object.defineProperty(exports, "__esModule", { value: true });
  9749. var HistoryItem_1 = __webpack_require__(4);
  9750. var DeleteShapeHistoryItem = /** @class */ (function (_super) {
  9751. __extends(DeleteShapeHistoryItem, _super);
  9752. function DeleteShapeHistoryItem(shapeKey) {
  9753. var _this = _super.call(this) || this;
  9754. _this.shapeKey = shapeKey;
  9755. return _this;
  9756. }
  9757. DeleteShapeHistoryItem.prototype.redo = function (manipulator) {
  9758. var shape = manipulator.model.findShape(this.shapeKey);
  9759. this.shape = shape.clone();
  9760. manipulator.deleteShape(shape);
  9761. };
  9762. DeleteShapeHistoryItem.prototype.undo = function (manipulator) {
  9763. manipulator.addShape(this.shape, this.shape.key);
  9764. };
  9765. return DeleteShapeHistoryItem;
  9766. }(HistoryItem_1.HistoryItem));
  9767. exports.DeleteShapeHistoryItem = DeleteShapeHistoryItem;
  9768. /***/ }),
  9769. /* 75 */
  9770. /***/ (function(module, exports, __webpack_require__) {
  9771. "use strict";
  9772. var __extends = (this && this.__extends) || (function () {
  9773. var extendStatics = function (d, b) {
  9774. extendStatics = Object.setPrototypeOf ||
  9775. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9776. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  9777. return extendStatics(d, b);
  9778. };
  9779. return function (d, b) {
  9780. extendStatics(d, b);
  9781. function __() { this.constructor = d; }
  9782. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9783. };
  9784. })();
  9785. Object.defineProperty(exports, "__esModule", { value: true });
  9786. var ShapeDescription_1 = __webpack_require__(11);
  9787. var PathPrimitive_1 = __webpack_require__(2);
  9788. var ShapeType_1 = __webpack_require__(1);
  9789. var DiamondShapeDescription = /** @class */ (function (_super) {
  9790. __extends(DiamondShapeDescription, _super);
  9791. function DiamondShapeDescription(title, defaultText, defaultSize) {
  9792. if (title === void 0) { title = "Diamond"; }
  9793. if (defaultText === void 0) { defaultText = ""; }
  9794. if (defaultSize === void 0) { defaultSize = ShapeDescription_1.ShapeDefaultSize.clone(); }
  9795. return _super.call(this, title, defaultText, defaultSize) || this;
  9796. }
  9797. Object.defineProperty(DiamondShapeDescription.prototype, "key", {
  9798. get: function () { return ShapeType_1.ShapeType.Diamond; },
  9799. enumerable: true,
  9800. configurable: true
  9801. });
  9802. Object.defineProperty(DiamondShapeDescription.prototype, "category", {
  9803. get: function () { return ShapeType_1.ShapeCategory.General; },
  9804. enumerable: true,
  9805. configurable: true
  9806. });
  9807. DiamondShapeDescription.prototype.createPrimitives = function (shape) {
  9808. var rect = shape.rectangle;
  9809. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom;
  9810. var _a = rect.center, cx = _a.x, cy = _a.y;
  9811. var primitives = [];
  9812. return primitives.concat([
  9813. new PathPrimitive_1.PathPrimitive([
  9814. new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
  9815. new PathPrimitive_1.PathPrimitiveLineToCommand(right, cy),
  9816. new PathPrimitive_1.PathPrimitiveLineToCommand(cx, bottom),
  9817. new PathPrimitive_1.PathPrimitiveLineToCommand(left, cy),
  9818. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  9819. ], shape.style)
  9820. ])
  9821. .concat(this.createTextPrimitives(shape));
  9822. };
  9823. return DiamondShapeDescription;
  9824. }(ShapeDescription_1.ShapeDescription));
  9825. exports.DiamondShapeDescription = DiamondShapeDescription;
  9826. /***/ }),
  9827. /* 76 */
  9828. /***/ (function(module, exports, __webpack_require__) {
  9829. "use strict";
  9830. var __extends = (this && this.__extends) || (function () {
  9831. var extendStatics = function (d, b) {
  9832. extendStatics = Object.setPrototypeOf ||
  9833. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9834. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  9835. return extendStatics(d, b);
  9836. };
  9837. return function (d, b) {
  9838. extendStatics(d, b);
  9839. function __() { this.constructor = d; }
  9840. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9841. };
  9842. })();
  9843. Object.defineProperty(exports, "__esModule", { value: true });
  9844. var ShapeDescription_1 = __webpack_require__(11);
  9845. var Utils_1 = __webpack_require__(0);
  9846. var ShapeType_1 = __webpack_require__(1);
  9847. var TextShapeDescription = /** @class */ (function (_super) {
  9848. __extends(TextShapeDescription, _super);
  9849. function TextShapeDescription() {
  9850. return _super.call(this, "Text", "Text", new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.5)) || this;
  9851. }
  9852. Object.defineProperty(TextShapeDescription.prototype, "key", {
  9853. get: function () { return ShapeType_1.ShapeType.Text; },
  9854. enumerable: true,
  9855. configurable: true
  9856. });
  9857. Object.defineProperty(TextShapeDescription.prototype, "category", {
  9858. get: function () { return ShapeType_1.ShapeCategory.General; },
  9859. enumerable: true,
  9860. configurable: true
  9861. });
  9862. TextShapeDescription.prototype.createPrimitives = function (shape, forToolbox) {
  9863. return this.createTextPrimitives(shape, forToolbox);
  9864. };
  9865. return TextShapeDescription;
  9866. }(ShapeDescription_1.ShapeDescription));
  9867. exports.TextShapeDescription = TextShapeDescription;
  9868. /***/ }),
  9869. /* 77 */
  9870. /***/ (function(module, exports, __webpack_require__) {
  9871. "use strict";
  9872. var __extends = (this && this.__extends) || (function () {
  9873. var extendStatics = function (d, b) {
  9874. extendStatics = Object.setPrototypeOf ||
  9875. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9876. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  9877. return extendStatics(d, b);
  9878. };
  9879. return function (d, b) {
  9880. extendStatics(d, b);
  9881. function __() { this.constructor = d; }
  9882. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9883. };
  9884. })();
  9885. Object.defineProperty(exports, "__esModule", { value: true });
  9886. var PathPrimitive_1 = __webpack_require__(2);
  9887. var ShapeType_1 = __webpack_require__(1);
  9888. var PolygonShapeDescription_1 = __webpack_require__(57);
  9889. var DiagramItem_1 = __webpack_require__(3);
  9890. var PentagonShapeDescription = /** @class */ (function (_super) {
  9891. __extends(PentagonShapeDescription, _super);
  9892. function PentagonShapeDescription(title, defaultText) {
  9893. if (title === void 0) { title = "Pentagon"; }
  9894. if (defaultText === void 0) { defaultText = ""; }
  9895. var _this = _super.call(this, title, defaultText) || this;
  9896. _this.defaultRatio = _this.defaultSize.height / _this.defaultSize.width;
  9897. return _this;
  9898. }
  9899. Object.defineProperty(PentagonShapeDescription.prototype, "key", {
  9900. get: function () { return ShapeType_1.ShapeType.Pentagon; },
  9901. enumerable: true,
  9902. configurable: true
  9903. });
  9904. Object.defineProperty(PentagonShapeDescription.prototype, "angleCount", {
  9905. get: function () { return 5; },
  9906. enumerable: true,
  9907. configurable: true
  9908. });
  9909. PentagonShapeDescription.prototype.createPrimitives = function (shape) {
  9910. var rect = shape.rectangle;
  9911. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  9912. var cx = rect.center.x;
  9913. var ratio = height / width / this.defaultRatio;
  9914. var angle = Math.PI - this.angle;
  9915. var py = width / 2 * Math.tan(angle / 2) * ratio;
  9916. var y = top + py;
  9917. var px = (height - py) / Math.tan(angle) / ratio;
  9918. var x1 = left + px;
  9919. var x2 = right - px;
  9920. var primitives = [];
  9921. return primitives.concat([
  9922. new PathPrimitive_1.PathPrimitive([
  9923. new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
  9924. new PathPrimitive_1.PathPrimitiveLineToCommand(right, y),
  9925. new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
  9926. new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
  9927. new PathPrimitive_1.PathPrimitiveLineToCommand(left, y),
  9928. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  9929. ], shape.style)
  9930. ])
  9931. .concat(this.createTextPrimitives(shape));
  9932. };
  9933. PentagonShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  9934. var side = shape.getConnectionPointSide(index);
  9935. if (side === DiagramItem_1.ConnectionPointSide.East || side === DiagramItem_1.ConnectionPointSide.West) {
  9936. var rect = shape.rectangle;
  9937. var top_1 = rect.top, width = rect.width, height = rect.height;
  9938. var ratio = height / width / this.defaultRatio;
  9939. var angle = Math.PI - this.angle;
  9940. var py = width / 2 * Math.tan(angle / 2) * ratio;
  9941. var y = top_1 + py;
  9942. if (side === DiagramItem_1.ConnectionPointSide.East)
  9943. point.y = y;
  9944. else if (side === DiagramItem_1.ConnectionPointSide.West)
  9945. point.y = y;
  9946. }
  9947. };
  9948. PentagonShapeDescription.prototype.calculateHeight = function (width) {
  9949. var angle = Math.PI - this.angle;
  9950. var h1 = width / 2 * Math.tan(angle / 2);
  9951. var side = width / 2 / Math.cos(angle / 2);
  9952. var h2 = side * Math.sin(angle);
  9953. return h1 + h2;
  9954. };
  9955. return PentagonShapeDescription;
  9956. }(PolygonShapeDescription_1.PolygonShapeDescription));
  9957. exports.PentagonShapeDescription = PentagonShapeDescription;
  9958. /***/ }),
  9959. /* 78 */
  9960. /***/ (function(module, exports, __webpack_require__) {
  9961. "use strict";
  9962. var __extends = (this && this.__extends) || (function () {
  9963. var extendStatics = function (d, b) {
  9964. extendStatics = Object.setPrototypeOf ||
  9965. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9966. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  9967. return extendStatics(d, b);
  9968. };
  9969. return function (d, b) {
  9970. extendStatics(d, b);
  9971. function __() { this.constructor = d; }
  9972. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9973. };
  9974. })();
  9975. Object.defineProperty(exports, "__esModule", { value: true });
  9976. var PathPrimitive_1 = __webpack_require__(2);
  9977. var ShapeType_1 = __webpack_require__(1);
  9978. var PolygonShapeDescription_1 = __webpack_require__(57);
  9979. var HexagonShapeDescription = /** @class */ (function (_super) {
  9980. __extends(HexagonShapeDescription, _super);
  9981. function HexagonShapeDescription(title, defaultText) {
  9982. if (title === void 0) { title = "Hexagon"; }
  9983. if (defaultText === void 0) { defaultText = ""; }
  9984. return _super.call(this, title, defaultText) || this;
  9985. }
  9986. Object.defineProperty(HexagonShapeDescription.prototype, "key", {
  9987. get: function () { return ShapeType_1.ShapeType.Hexagon; },
  9988. enumerable: true,
  9989. configurable: true
  9990. });
  9991. Object.defineProperty(HexagonShapeDescription.prototype, "angleCount", {
  9992. get: function () { return 6; },
  9993. enumerable: true,
  9994. configurable: true
  9995. });
  9996. HexagonShapeDescription.prototype.createPrimitives = function (shape) {
  9997. var rect = shape.rectangle;
  9998. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  9999. var cy = rect.center.y;
  10000. var angle = Math.PI - this.angle;
  10001. var sideX = width / (1 + 2 * Math.cos(angle));
  10002. var x1 = left + (width - sideX) / 2;
  10003. var x2 = x1 + sideX;
  10004. var primitives = [];
  10005. return primitives.concat([
  10006. new PathPrimitive_1.PathPrimitive([
  10007. new PathPrimitive_1.PathPrimitiveMoveToCommand(x1, top),
  10008. new PathPrimitive_1.PathPrimitiveLineToCommand(x2, top),
  10009. new PathPrimitive_1.PathPrimitiveLineToCommand(right, cy),
  10010. new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
  10011. new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
  10012. new PathPrimitive_1.PathPrimitiveLineToCommand(left, cy),
  10013. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  10014. ], shape.style)
  10015. ])
  10016. .concat(this.createTextPrimitives(shape));
  10017. };
  10018. HexagonShapeDescription.prototype.calculateHeight = function (width) {
  10019. var angle = Math.PI - this.angle;
  10020. var sideX = width / (1 + 2 * Math.cos(angle));
  10021. return 2 * sideX * Math.sin(angle);
  10022. };
  10023. return HexagonShapeDescription;
  10024. }(PolygonShapeDescription_1.PolygonShapeDescription));
  10025. exports.HexagonShapeDescription = HexagonShapeDescription;
  10026. /***/ }),
  10027. /* 79 */
  10028. /***/ (function(module, exports, __webpack_require__) {
  10029. "use strict";
  10030. var __extends = (this && this.__extends) || (function () {
  10031. var extendStatics = function (d, b) {
  10032. extendStatics = Object.setPrototypeOf ||
  10033. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10034. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10035. return extendStatics(d, b);
  10036. };
  10037. return function (d, b) {
  10038. extendStatics(d, b);
  10039. function __() { this.constructor = d; }
  10040. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10041. };
  10042. })();
  10043. Object.defineProperty(exports, "__esModule", { value: true });
  10044. var ShapeDescription_1 = __webpack_require__(11);
  10045. var PathPrimitive_1 = __webpack_require__(2);
  10046. var ShapeType_1 = __webpack_require__(1);
  10047. var ConnectionPoint_1 = __webpack_require__(32);
  10048. var DiagramItem_1 = __webpack_require__(3);
  10049. var TriangleShapeDescription = /** @class */ (function (_super) {
  10050. __extends(TriangleShapeDescription, _super);
  10051. function TriangleShapeDescription(title, defaultText) {
  10052. if (title === void 0) { title = "Triangle"; }
  10053. if (defaultText === void 0) { defaultText = ""; }
  10054. var _this = _super.call(this, title, defaultText) || this;
  10055. _this.defaultSize.height = _this.calculateHeight(ShapeDescription_1.ShapeDefaultDimension);
  10056. return _this;
  10057. }
  10058. Object.defineProperty(TriangleShapeDescription.prototype, "key", {
  10059. get: function () { return ShapeType_1.ShapeType.Triangle; },
  10060. enumerable: true,
  10061. configurable: true
  10062. });
  10063. Object.defineProperty(TriangleShapeDescription.prototype, "category", {
  10064. get: function () { return ShapeType_1.ShapeCategory.General; },
  10065. enumerable: true,
  10066. configurable: true
  10067. });
  10068. TriangleShapeDescription.prototype.createConnectionPoints = function () {
  10069. return [
  10070. new ConnectionPoint_1.ConnectionPoint(0.5, 0, DiagramItem_1.ConnectionPointSide.North),
  10071. new ConnectionPoint_1.ConnectionPoint(0.75, 0.5, DiagramItem_1.ConnectionPointSide.East),
  10072. new ConnectionPoint_1.ConnectionPoint(0.5, 1, DiagramItem_1.ConnectionPointSide.South),
  10073. new ConnectionPoint_1.ConnectionPoint(0.25, 0.5, DiagramItem_1.ConnectionPointSide.West)
  10074. ];
  10075. };
  10076. TriangleShapeDescription.prototype.createPrimitives = function (shape) {
  10077. var rect = shape.rectangle;
  10078. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom;
  10079. var primitives = [];
  10080. return primitives.concat([
  10081. new PathPrimitive_1.PathPrimitive([
  10082. new PathPrimitive_1.PathPrimitiveMoveToCommand(rect.center.x, top),
  10083. new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
  10084. new PathPrimitive_1.PathPrimitiveLineToCommand(left, bottom),
  10085. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  10086. ], shape.style)
  10087. ])
  10088. .concat(this.createTextPrimitives(shape));
  10089. };
  10090. TriangleShapeDescription.prototype.calculateHeight = function (width) {
  10091. return Math.sqrt(Math.pow(width, 2) - Math.pow(width / 2, 2));
  10092. };
  10093. return TriangleShapeDescription;
  10094. }(ShapeDescription_1.ShapeDescription));
  10095. exports.TriangleShapeDescription = TriangleShapeDescription;
  10096. /***/ }),
  10097. /* 80 */
  10098. /***/ (function(module, exports, __webpack_require__) {
  10099. "use strict";
  10100. var __extends = (this && this.__extends) || (function () {
  10101. var extendStatics = function (d, b) {
  10102. extendStatics = Object.setPrototypeOf ||
  10103. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10104. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10105. return extendStatics(d, b);
  10106. };
  10107. return function (d, b) {
  10108. extendStatics(d, b);
  10109. function __() { this.constructor = d; }
  10110. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10111. };
  10112. })();
  10113. Object.defineProperty(exports, "__esModule", { value: true });
  10114. var RectangleShapeDescription_1 = __webpack_require__(12);
  10115. var ShapeType_1 = __webpack_require__(1);
  10116. var PathPrimitive_1 = __webpack_require__(2);
  10117. var DiagramItem_1 = __webpack_require__(3);
  10118. var DocumentShapeDescription = /** @class */ (function (_super) {
  10119. __extends(DocumentShapeDescription, _super);
  10120. function DocumentShapeDescription(title, defaultText) {
  10121. if (title === void 0) { title = "Document"; }
  10122. if (defaultText === void 0) { defaultText = "Document"; }
  10123. return _super.call(this, title, defaultText) || this;
  10124. }
  10125. Object.defineProperty(DocumentShapeDescription.prototype, "key", {
  10126. get: function () { return ShapeType_1.ShapeType.Document; },
  10127. enumerable: true,
  10128. configurable: true
  10129. });
  10130. Object.defineProperty(DocumentShapeDescription.prototype, "category", {
  10131. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  10132. enumerable: true,
  10133. configurable: true
  10134. });
  10135. DocumentShapeDescription.prototype.createPrimitives = function (shape) {
  10136. var primitives = [];
  10137. return primitives
  10138. .concat(this.createDocumentPrimitives(shape.rectangle, shape.style))
  10139. .concat(this.createTextPrimitives(shape));
  10140. };
  10141. DocumentShapeDescription.prototype.createDocumentPrimitives = function (rect, style) {
  10142. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  10143. var cx = rect.center.x;
  10144. var dy = height * DocumentShapeDescription.curveOffsetRatio;
  10145. var primitives = [];
  10146. return primitives.concat([
  10147. new PathPrimitive_1.PathPrimitive([
  10148. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
  10149. new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
  10150. new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
  10151. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right - width * 0.25, bottom - 2 * dy, cx, bottom - dy),
  10152. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left + width * 0.25, bottom + dy, left, bottom - dy),
  10153. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  10154. ], style)
  10155. ]);
  10156. };
  10157. DocumentShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  10158. var side = shape.getConnectionPointSide(index);
  10159. if (side === DiagramItem_1.ConnectionPointSide.South)
  10160. point.y -= shape.size.height * DocumentShapeDescription.curveOffsetRatio;
  10161. };
  10162. DocumentShapeDescription.prototype.getTextRectangle = function (rect) {
  10163. return rect.resize(0, -rect.height * DocumentShapeDescription.curveOffsetRatio);
  10164. };
  10165. DocumentShapeDescription.curveOffsetRatio = 0.1;
  10166. return DocumentShapeDescription;
  10167. }(RectangleShapeDescription_1.RectangleShapeDescription));
  10168. exports.DocumentShapeDescription = DocumentShapeDescription;
  10169. /***/ }),
  10170. /* 81 */
  10171. /***/ (function(module, exports, __webpack_require__) {
  10172. "use strict";
  10173. Object.defineProperty(exports, "__esModule", { value: true });
  10174. var Utils_1 = __webpack_require__(0);
  10175. var NodeLayout_1 = __webpack_require__(39);
  10176. var GraphLayout = /** @class */ (function () {
  10177. function GraphLayout() {
  10178. this.nodeKeys = [];
  10179. this.nodeToLayout = {};
  10180. this.edgeToPosition = {};
  10181. }
  10182. GraphLayout.prototype.forEachNode = function (callback) {
  10183. var _this = this;
  10184. this.nodeKeys.forEach(function (nk) { return callback(_this.nodeToLayout[nk], nk); });
  10185. };
  10186. GraphLayout.prototype.addNode = function (nodeLayout) {
  10187. if (this.nodeToLayout[nodeLayout.key])
  10188. throw Error("Node layout is already registered");
  10189. this.nodeKeys.push(nodeLayout.key);
  10190. this.nodeToLayout[nodeLayout.key] = nodeLayout;
  10191. };
  10192. GraphLayout.prototype.addEdge = function (edgeLayout) {
  10193. if (this.edgeToPosition[edgeLayout.key])
  10194. throw Error("Edge layout is already registered");
  10195. this.edgeToPosition[edgeLayout.key] = edgeLayout;
  10196. };
  10197. GraphLayout.prototype.getRectangle = function (includeMargins) {
  10198. var _this = this;
  10199. return Utils_1.GeometryUtils.getCommonRectangle(this.nodeKeys.map(function (nk) { return _this.nodeToLayout[nk].rectangle; }));
  10200. };
  10201. GraphLayout.prototype.offsetNodes = function (deltaX, deltaY) {
  10202. var _this = this;
  10203. if (deltaX === void 0) { deltaX = 0; }
  10204. if (deltaY === void 0) { deltaY = 0; }
  10205. var layout = new GraphLayout();
  10206. this.nodeKeys.forEach(function (nk) {
  10207. var nl = _this.nodeToLayout[nk];
  10208. layout.addNode(new NodeLayout_1.NodeLayout(nl.info, nl.position.offset(deltaX, deltaY)));
  10209. });
  10210. layout.copyEdges(this);
  10211. return layout;
  10212. };
  10213. GraphLayout.prototype.extend = function (layout) {
  10214. var _this = this;
  10215. layout.forEachNode(function (nl) { return _this.addNode(nl); });
  10216. this.copyEdges(layout);
  10217. };
  10218. GraphLayout.prototype.copyEdges = function (source) {
  10219. var _this = this;
  10220. Object.keys(source.edgeToPosition).forEach(function (e) {
  10221. var edge = source.edgeToPosition[e];
  10222. _this.addEdge(new NodeLayout_1.EdgeLayout(edge.key, edge.beginIndex, edge.endIndex));
  10223. });
  10224. };
  10225. return GraphLayout;
  10226. }());
  10227. exports.GraphLayout = GraphLayout;
  10228. /***/ }),
  10229. /* 82 */
  10230. /***/ (function(module, exports, __webpack_require__) {
  10231. "use strict";
  10232. Object.defineProperty(exports, "__esModule", { value: true });
  10233. var LayoutSettings_1 = __webpack_require__(18);
  10234. var LayoutBuilder = /** @class */ (function () {
  10235. function LayoutBuilder(settings, graph) {
  10236. this.settings = settings;
  10237. this.graph = graph;
  10238. }
  10239. LayoutBuilder.prototype.getBreadthNodeSizeCore = function (node) {
  10240. return this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical ?
  10241. (node.size.width + node.margin.left + node.margin.right) :
  10242. (node.size.height + node.margin.top + node.margin.bottom);
  10243. };
  10244. LayoutBuilder.prototype.getDepthNodeSizeCore = function (node) {
  10245. return this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal ?
  10246. (node.size.width + node.margin.left + node.margin.right) :
  10247. (node.size.height + node.margin.top + node.margin.bottom);
  10248. };
  10249. LayoutBuilder.prototype.chooseDirectionValue = function (near, far) {
  10250. return this.settings.direction === LayoutSettings_1.LogicalDirectionKind.Forward ? near : far;
  10251. };
  10252. LayoutBuilder.prototype.getDirectionValue = function (value) {
  10253. return this.settings.direction === LayoutSettings_1.LogicalDirectionKind.Forward ? value : -value;
  10254. };
  10255. LayoutBuilder.prototype.getComponentOffset = function (graphLayout) {
  10256. var rect = graphLayout.getRectangle(true);
  10257. var offset = this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical ? rect.width : rect.height;
  10258. return offset + this.settings.componentSpacing;
  10259. };
  10260. LayoutBuilder.prototype.setComponentOffset = function (graphLayout, offset) {
  10261. return this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical ?
  10262. graphLayout.offsetNodes(offset) :
  10263. graphLayout.offsetNodes(0, offset);
  10264. };
  10265. return LayoutBuilder;
  10266. }());
  10267. exports.LayoutBuilder = LayoutBuilder;
  10268. /***/ }),
  10269. /* 83 */
  10270. /***/ (function(module, exports, __webpack_require__) {
  10271. "use strict";
  10272. var __extends = (this && this.__extends) || (function () {
  10273. var extendStatics = function (d, b) {
  10274. extendStatics = Object.setPrototypeOf ||
  10275. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10276. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10277. return extendStatics(d, b);
  10278. };
  10279. return function (d, b) {
  10280. extendStatics(d, b);
  10281. function __() { this.constructor = d; }
  10282. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10283. };
  10284. })();
  10285. Object.defineProperty(exports, "__esModule", { value: true });
  10286. var HistoryItem_1 = __webpack_require__(4);
  10287. var CloneHistoryItem = /** @class */ (function (_super) {
  10288. __extends(CloneHistoryItem, _super);
  10289. function CloneHistoryItem(item) {
  10290. var _this = _super.call(this) || this;
  10291. _this.item = item;
  10292. return _this;
  10293. }
  10294. CloneHistoryItem.prototype.redo = function (manipulator) {
  10295. this.clearConnections(this.item);
  10296. this.addItem(this.item, manipulator);
  10297. };
  10298. CloneHistoryItem.prototype.undo = function (manipulator) {
  10299. var item = manipulator.model.findItem(this.item.key);
  10300. this.clearConnections(item);
  10301. this.deleteItem(item, manipulator);
  10302. };
  10303. return CloneHistoryItem;
  10304. }(HistoryItem_1.HistoryItem));
  10305. exports.CloneHistoryItem = CloneHistoryItem;
  10306. /***/ }),
  10307. /* 84 */
  10308. /***/ (function(module, exports, __webpack_require__) {
  10309. "use strict";
  10310. Object.defineProperty(exports, "__esModule", { value: true });
  10311. var Model_1 = __webpack_require__(21);
  10312. var Shape_1 = __webpack_require__(9);
  10313. var Utils_1 = __webpack_require__(0);
  10314. var ShapeDescriptionManager_1 = __webpack_require__(30);
  10315. var Connector_1 = __webpack_require__(5);
  10316. var ShapeType_1 = __webpack_require__(1);
  10317. var Importer = /** @class */ (function () {
  10318. function Importer() {
  10319. }
  10320. Importer.import = function (json) {
  10321. var model = new Model_1.DiagramModel();
  10322. var obj = this.parseJSON(json);
  10323. this.importPageSettings(model, obj["page"]);
  10324. var shapes = this.importShapes(obj["shapes"]);
  10325. for (var i = 0; i < shapes.length; i++) {
  10326. var shape = shapes[i];
  10327. if (model.findItem(shape.key))
  10328. throw Error("Item key is duplicated");
  10329. model.pushItem(shape);
  10330. }
  10331. var connectors = this.importConnectors(obj["connectors"]);
  10332. for (var i = 0; i < connectors.length; i++) {
  10333. var connector = connectors[i];
  10334. connector.endItem = model.findItem(connector["endItemKey"]) || undefined;
  10335. delete connector["endItemKey"];
  10336. connector.beginItem = model.findItem(connector["beginItemKey"]) || undefined;
  10337. delete connector["beginItemKey"];
  10338. if (model.findItem(connector.key))
  10339. throw Error("Item key is duplicated");
  10340. model.pushItem(connector);
  10341. this.updateConnections(connector);
  10342. }
  10343. return model;
  10344. };
  10345. Importer.importItems = function (json, model) {
  10346. var result = [];
  10347. var obj = this.parseJSON(json);
  10348. var itemHash = {};
  10349. var shapes = this.importShapes(obj["shapes"]);
  10350. var key;
  10351. for (var i = 0; i < shapes.length; i++) {
  10352. var shape = shapes[i];
  10353. var oldKey = shape.key;
  10354. key = model.getNextKey(key);
  10355. shape.key = key;
  10356. itemHash[oldKey] = shape;
  10357. result.push(shape);
  10358. }
  10359. var connectors = this.importConnectors(obj["connectors"]);
  10360. for (var i = 0; i < connectors.length; i++) {
  10361. var connector = connectors[i];
  10362. var oldKey = connector.key;
  10363. key = model.getNextKey(key);
  10364. connector.key = key;
  10365. itemHash[oldKey] = connector;
  10366. var endItemKey = connector["endItemKey"];
  10367. connector.endItem = itemHash[endItemKey];
  10368. delete connector["endItemKey"];
  10369. var beginItemKey = connector["beginItemKey"];
  10370. connector.beginItem = itemHash[beginItemKey];
  10371. delete connector["beginItemKey"];
  10372. result.push(connector);
  10373. this.updateConnections(connector);
  10374. }
  10375. return result;
  10376. };
  10377. Importer.importItemsData = function (json, model) {
  10378. var obj = this.parseJSON(json);
  10379. var shapes = this.importShapes(obj["shapes"]);
  10380. for (var i = 0; i < shapes.length; i++) {
  10381. var srcShape = shapes[i];
  10382. var destShape = void 0;
  10383. if (srcShape.dataKey !== undefined)
  10384. destShape = model.findShapeByDataKey(srcShape.dataKey);
  10385. if (!destShape)
  10386. destShape = model.findShape(srcShape.key);
  10387. if (destShape) {
  10388. destShape.dataKey = srcShape.dataKey;
  10389. destShape.locked = srcShape.locked;
  10390. destShape.position = srcShape.position.clone();
  10391. destShape.size = srcShape.size.clone();
  10392. destShape.parameters = srcShape.parameters.clone();
  10393. destShape.style = srcShape.style.clone();
  10394. destShape.styleText = srcShape.styleText.clone();
  10395. destShape.zIndex = srcShape.zIndex;
  10396. }
  10397. }
  10398. var connectors = this.importConnectors(obj["connectors"]);
  10399. for (var i = 0; i < connectors.length; i++) {
  10400. var srcConnector = connectors[i];
  10401. var destConnector = void 0;
  10402. if (srcConnector.dataKey !== undefined)
  10403. destConnector = model.findConnectorByDataKey(srcConnector.dataKey);
  10404. if (!destConnector)
  10405. destConnector = model.findConnector(srcConnector.key);
  10406. if (destConnector) {
  10407. destConnector.dataKey = srcConnector.dataKey;
  10408. destConnector.locked = srcConnector.locked;
  10409. destConnector.points = srcConnector.points.slice();
  10410. destConnector.properties = srcConnector.properties.clone();
  10411. destConnector.style = srcConnector.style.clone();
  10412. destConnector.styleText = srcConnector.styleText.clone();
  10413. destConnector.zIndex = srcConnector.zIndex;
  10414. }
  10415. }
  10416. };
  10417. Importer.canImport = function (json) {
  10418. var obj = this.parseJSON(json);
  10419. return Array.isArray(obj["shapes"]) || Array.isArray(obj["connectors"]);
  10420. };
  10421. Importer.importPageSettings = function (model, pageObj) {
  10422. if (!pageObj)
  10423. return;
  10424. this.assert(pageObj["width"], "number");
  10425. this.assert(pageObj["height"], "number");
  10426. if (typeof pageObj["width"] === "number")
  10427. model.size.width = pageObj["width"];
  10428. if (typeof pageObj["height"] === "number")
  10429. model.size.height = pageObj["height"];
  10430. if (typeof pageObj["pageColor"] === "string")
  10431. model.pageColor = pageObj["pageColor"];
  10432. if (typeof pageObj["pageWidth"] === "number")
  10433. model.pageSize.width = pageObj["pageWidth"];
  10434. if (typeof pageObj["pageHeight"] === "number")
  10435. model.pageSize.height = pageObj["pageHeight"];
  10436. if (typeof pageObj["pageLandscape"] === "boolean")
  10437. model.pageLandscape = pageObj["pageLandscape"];
  10438. if (typeof pageObj["gridSize"] === "number")
  10439. model.gridSize = pageObj["gridSize"];
  10440. if (typeof pageObj["showGrid"] === "boolean")
  10441. model.showGrid = pageObj["showGrid"];
  10442. if (typeof pageObj["snapToGrid"] === "boolean")
  10443. model.snapToGrid = pageObj["snapToGrid"];
  10444. if (typeof pageObj["units"] === "number")
  10445. model.units = pageObj["units"];
  10446. };
  10447. Importer.importShapes = function (shapesObj) {
  10448. var result = [];
  10449. if (!shapesObj)
  10450. return result;
  10451. if (!Array.isArray(shapesObj))
  10452. throw Error("Invalid Format");
  10453. for (var i = 0; i < shapesObj.length; i++) {
  10454. var shapeObj = shapesObj[i];
  10455. result.push(this.importShape(shapeObj));
  10456. }
  10457. return result;
  10458. };
  10459. Importer.importShape = function (shapeObj) {
  10460. this.assert(shapeObj["key"], "string");
  10461. this.assert(shapeObj["x"], "number");
  10462. this.assert(shapeObj["y"], "number");
  10463. var position = new Utils_1.Point(shapeObj["x"], shapeObj["y"]);
  10464. this.assert(shapeObj["type"], "number");
  10465. var shapeType = shapeObj["type"];
  10466. var description = ShapeDescriptionManager_1.ShapeDescriptionManager.get(shapeType);
  10467. var shape = new Shape_1.Shape(description || ShapeDescriptionManager_1.ShapeDescriptionManager.get(ShapeType_1.ShapeType.Rectangle), position);
  10468. shape.key = shapeObj["key"];
  10469. if (typeof shapeObj["dataKey"] === "string")
  10470. shape.dataKey = shapeObj["dataKey"];
  10471. if (typeof shapeObj["locked"] === "boolean")
  10472. shape.locked = shapeObj["locked"];
  10473. if (typeof shapeObj["width"] === "number")
  10474. shape.size.width = shapeObj["width"];
  10475. if (typeof shapeObj["height"] === "number")
  10476. shape.size.height = shapeObj["height"];
  10477. if (typeof shapeObj["text"] === "string")
  10478. shape.text = shapeObj["text"];
  10479. if (shapeObj["parameters"]) {
  10480. shape.parameters.fromObject(shapeObj["parameters"]);
  10481. shape.description.normalizeParameters(shape, shape.parameters);
  10482. }
  10483. if (shapeObj["style"])
  10484. shape.style.fromObject(shapeObj["style"]);
  10485. if (shapeObj["styleText"])
  10486. shape.styleText.fromObject(shapeObj["styleText"]);
  10487. if (typeof shapeObj["zIndex"] === "number")
  10488. shape.zIndex = shapeObj["zIndex"];
  10489. return shape;
  10490. };
  10491. Importer.importConnectors = function (connectorsObj) {
  10492. var result = [];
  10493. if (!connectorsObj)
  10494. return result;
  10495. if (!Array.isArray(connectorsObj))
  10496. throw Error("Invalid Format");
  10497. for (var i = 0; i < connectorsObj.length; i++) {
  10498. var shapeObj = connectorsObj[i];
  10499. result.push(this.importConnector(shapeObj));
  10500. }
  10501. return result;
  10502. };
  10503. Importer.importConnector = function (connectorObj) {
  10504. var _this = this;
  10505. this.assert(connectorObj["key"], "string");
  10506. if (!Array.isArray(connectorObj["points"]))
  10507. throw Error("Invalid Format");
  10508. var points = connectorObj["points"].map(function (pt) {
  10509. _this.assert(pt["x"], "number");
  10510. _this.assert(pt["y"], "number");
  10511. return new Utils_1.Point(pt["x"], pt["y"]);
  10512. });
  10513. var connector = new Connector_1.Connector(points);
  10514. connector.key = connectorObj["key"];
  10515. if (typeof connectorObj["dataKey"] === "string")
  10516. connector.dataKey = connectorObj["dataKey"];
  10517. if (typeof connectorObj["locked"] === "boolean")
  10518. connector.locked = connectorObj["locked"];
  10519. connector.endConnectionPointIndex = typeof connectorObj["endConnectionPointIndex"] === "number" ? connectorObj["endConnectionPointIndex"] : -1;
  10520. connector.beginConnectionPointIndex = typeof connectorObj["beginConnectionPointIndex"] === "number" ? connectorObj["beginConnectionPointIndex"] : -1;
  10521. if (connectorObj["endItemKey"] !== undefined)
  10522. this.assert(connectorObj["endItemKey"], "string");
  10523. if (connectorObj["beginItemKey"] !== undefined)
  10524. this.assert(connectorObj["beginItemKey"], "string");
  10525. connector["endItemKey"] = connectorObj["endItemKey"];
  10526. connector["beginItemKey"] = connectorObj["beginItemKey"];
  10527. if (connectorObj["texts"])
  10528. connector.texts.fromObject(connectorObj["texts"]);
  10529. if (connectorObj["properties"])
  10530. connector.properties.fromObject(connectorObj["properties"]);
  10531. if (connectorObj["style"])
  10532. connector.style.fromObject(connectorObj["style"]);
  10533. if (connectorObj["styleText"])
  10534. connector.styleText.fromObject(connectorObj["styleText"]);
  10535. if (typeof connectorObj["zIndex"] === "number")
  10536. connector.zIndex = connectorObj["zIndex"];
  10537. return connector;
  10538. };
  10539. Importer.updateConnections = function (connector) {
  10540. if (connector.endItem) {
  10541. connector.endItem.attachedConnectors.push(connector);
  10542. connector.points[connector.points.length - 1] = connector.endItem.getConnectionPoint(connector.endConnectionPointIndex, connector.points[connector.points.length - 2]);
  10543. }
  10544. if (connector.beginItem) {
  10545. connector.beginItem.attachedConnectors.push(connector);
  10546. connector.points[0] = connector.beginItem.getConnectionPoint(connector.beginConnectionPointIndex, connector.points[1]);
  10547. }
  10548. };
  10549. Importer.parseJSON = function (json) {
  10550. if (!json || json === "")
  10551. return {};
  10552. try {
  10553. return JSON.parse(json);
  10554. }
  10555. catch (_a) {
  10556. return {};
  10557. }
  10558. };
  10559. Importer.assert = function (value, type) {
  10560. if (value === undefined)
  10561. throw Error("Invalid Format");
  10562. if (type !== undefined && typeof value !== type)
  10563. throw Error("Invalid Format");
  10564. };
  10565. return Importer;
  10566. }());
  10567. exports.Importer = Importer;
  10568. /***/ }),
  10569. /* 85 */
  10570. /***/ (function(module, exports, __webpack_require__) {
  10571. "use strict";
  10572. var __extends = (this && this.__extends) || (function () {
  10573. var extendStatics = function (d, b) {
  10574. extendStatics = Object.setPrototypeOf ||
  10575. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10576. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10577. return extendStatics(d, b);
  10578. };
  10579. return function (d, b) {
  10580. extendStatics(d, b);
  10581. function __() { this.constructor = d; }
  10582. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10583. };
  10584. })();
  10585. Object.defineProperty(exports, "__esModule", { value: true });
  10586. var CommandBase_1 = __webpack_require__(7);
  10587. var CommandStates_1 = __webpack_require__(6);
  10588. var StylePropertyCommandBase = /** @class */ (function (_super) {
  10589. __extends(StylePropertyCommandBase, _super);
  10590. function StylePropertyCommandBase() {
  10591. return _super !== null && _super.apply(this, arguments) || this;
  10592. }
  10593. StylePropertyCommandBase.prototype.getState = function () {
  10594. return new CommandStates_1.SimpleCommandState(true, this.getStateValue());
  10595. };
  10596. return StylePropertyCommandBase;
  10597. }(CommandBase_1.CommandBase));
  10598. exports.StylePropertyCommandBase = StylePropertyCommandBase;
  10599. /***/ }),
  10600. /* 86 */
  10601. /***/ (function(module, exports, __webpack_require__) {
  10602. "use strict";
  10603. var __extends = (this && this.__extends) || (function () {
  10604. var extendStatics = function (d, b) {
  10605. extendStatics = Object.setPrototypeOf ||
  10606. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10607. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10608. return extendStatics(d, b);
  10609. };
  10610. return function (d, b) {
  10611. extendStatics(d, b);
  10612. function __() { this.constructor = d; }
  10613. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10614. };
  10615. })();
  10616. Object.defineProperty(exports, "__esModule", { value: true });
  10617. var HistoryItem_1 = __webpack_require__(4);
  10618. var ChangeStyleHistoryItemBase = /** @class */ (function (_super) {
  10619. __extends(ChangeStyleHistoryItemBase, _super);
  10620. function ChangeStyleHistoryItemBase(itemKey, styleProperty, styleValue) {
  10621. var _this = _super.call(this) || this;
  10622. _this.itemKey = itemKey;
  10623. _this.styleProperty = styleProperty;
  10624. _this.styleValue = styleValue;
  10625. return _this;
  10626. }
  10627. ChangeStyleHistoryItemBase.prototype.redo = function (manipulator) {
  10628. var item = manipulator.model.findItem(this.itemKey);
  10629. this.oldStyleValue = item.style[this.styleProperty];
  10630. manipulator.changeStyle(item, this.styleProperty, this.styleValue);
  10631. };
  10632. ChangeStyleHistoryItemBase.prototype.undo = function (manipulator) {
  10633. var item = manipulator.model.findItem(this.itemKey);
  10634. manipulator.changeStyle(item, this.styleProperty, this.oldStyleValue);
  10635. };
  10636. return ChangeStyleHistoryItemBase;
  10637. }(HistoryItem_1.HistoryItem));
  10638. exports.ChangeStyleHistoryItemBase = ChangeStyleHistoryItemBase;
  10639. /***/ }),
  10640. /* 87 */
  10641. /***/ (function(module, exports, __webpack_require__) {
  10642. "use strict";
  10643. var __extends = (this && this.__extends) || (function () {
  10644. var extendStatics = function (d, b) {
  10645. extendStatics = Object.setPrototypeOf ||
  10646. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10647. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10648. return extendStatics(d, b);
  10649. };
  10650. return function (d, b) {
  10651. extendStatics(d, b);
  10652. function __() { this.constructor = d; }
  10653. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10654. };
  10655. })();
  10656. Object.defineProperty(exports, "__esModule", { value: true });
  10657. var StylePropertyCommandBase_1 = __webpack_require__(85);
  10658. var ChangeStylePropertyCommandBase = /** @class */ (function (_super) {
  10659. __extends(ChangeStylePropertyCommandBase, _super);
  10660. function ChangeStylePropertyCommandBase() {
  10661. return _super !== null && _super.apply(this, arguments) || this;
  10662. }
  10663. ChangeStylePropertyCommandBase.prototype.executeCore = function (state, parameter) {
  10664. var _this = this;
  10665. this.control.history.beginTransaction();
  10666. var items = this.control.selection.getSelectedItems();
  10667. items.forEach(function (item) {
  10668. var styleProperty = _this.getStyleProperty();
  10669. _this.control.history.addAndRedo(_this.createHistoryItem(item, styleProperty, parameter));
  10670. });
  10671. this.updateInputPosition(parameter);
  10672. this.control.history.endTransaction();
  10673. return true;
  10674. };
  10675. return ChangeStylePropertyCommandBase;
  10676. }(StylePropertyCommandBase_1.StylePropertyCommandBase));
  10677. exports.ChangeStylePropertyCommandBase = ChangeStylePropertyCommandBase;
  10678. /***/ }),
  10679. /* 88 */
  10680. /***/ (function(module, exports, __webpack_require__) {
  10681. "use strict";
  10682. var __extends = (this && this.__extends) || (function () {
  10683. var extendStatics = function (d, b) {
  10684. extendStatics = Object.setPrototypeOf ||
  10685. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10686. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10687. return extendStatics(d, b);
  10688. };
  10689. return function (d, b) {
  10690. extendStatics(d, b);
  10691. function __() { this.constructor = d; }
  10692. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10693. };
  10694. })();
  10695. Object.defineProperty(exports, "__esModule", { value: true });
  10696. var ChangeStylePropertyCommandBase_1 = __webpack_require__(87);
  10697. var ChangeStyleHistoryItem_1 = __webpack_require__(63);
  10698. var ChangeStylePropertyCommand = /** @class */ (function (_super) {
  10699. __extends(ChangeStylePropertyCommand, _super);
  10700. function ChangeStylePropertyCommand() {
  10701. return _super !== null && _super.apply(this, arguments) || this;
  10702. }
  10703. ChangeStylePropertyCommand.prototype.getStateValue = function () {
  10704. return this.control.selection.inputPosition.getStylePropertyValue(this.getStyleProperty());
  10705. };
  10706. ChangeStylePropertyCommand.prototype.getStyleObj = function (item) {
  10707. return item.style;
  10708. };
  10709. ChangeStylePropertyCommand.prototype.createHistoryItem = function (item, styleProperty, styleValue) {
  10710. return new ChangeStyleHistoryItem_1.ChangeStyleHistoryItem(item.key, styleProperty, styleValue);
  10711. };
  10712. ChangeStylePropertyCommand.prototype.updateInputPosition = function (value) {
  10713. this.control.selection.inputPosition.setStylePropertyValue(this.getStyleProperty(), value);
  10714. };
  10715. return ChangeStylePropertyCommand;
  10716. }(ChangeStylePropertyCommandBase_1.ChangeStylePropertyCommandBase));
  10717. exports.ChangeStylePropertyCommand = ChangeStylePropertyCommand;
  10718. /***/ }),
  10719. /* 89 */
  10720. /***/ (function(module, exports, __webpack_require__) {
  10721. "use strict";
  10722. var __extends = (this && this.__extends) || (function () {
  10723. var extendStatics = function (d, b) {
  10724. extendStatics = Object.setPrototypeOf ||
  10725. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10726. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10727. return extendStatics(d, b);
  10728. };
  10729. return function (d, b) {
  10730. extendStatics(d, b);
  10731. function __() { this.constructor = d; }
  10732. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10733. };
  10734. })();
  10735. Object.defineProperty(exports, "__esModule", { value: true });
  10736. var CommandBase_1 = __webpack_require__(7);
  10737. var CommandStates_1 = __webpack_require__(6);
  10738. var ImportDataCommandBase = /** @class */ (function (_super) {
  10739. __extends(ImportDataCommandBase, _super);
  10740. function ImportDataCommandBase() {
  10741. return _super !== null && _super.apply(this, arguments) || this;
  10742. }
  10743. ImportDataCommandBase.prototype.getState = function () {
  10744. return new CommandStates_1.SimpleCommandState(true);
  10745. };
  10746. ImportDataCommandBase.prototype.executeCore = function (state, parameter) {
  10747. if (!parameter || !Array.isArray(parameter.nodeDataSource))
  10748. throw Error("Format exception");
  10749. this.performImportData(parameter);
  10750. if (this.control.renderManager)
  10751. this.control.renderManager.onWindowResize(null);
  10752. return true;
  10753. };
  10754. ImportDataCommandBase.prototype.createItems = function (dataSource, layoutType) {
  10755. dataSource.createModelItems(this.control.history, this.control.model, this.control.selection, layoutType);
  10756. };
  10757. return ImportDataCommandBase;
  10758. }(CommandBase_1.CommandBase));
  10759. exports.ImportDataCommandBase = ImportDataCommandBase;
  10760. /***/ }),
  10761. /* 90 */
  10762. /***/ (function(module, exports, __webpack_require__) {
  10763. "use strict";
  10764. var __extends = (this && this.__extends) || (function () {
  10765. var extendStatics = function (d, b) {
  10766. extendStatics = Object.setPrototypeOf ||
  10767. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10768. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10769. return extendStatics(d, b);
  10770. };
  10771. return function (d, b) {
  10772. extendStatics(d, b);
  10773. function __() { this.constructor = d; }
  10774. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10775. };
  10776. })();
  10777. Object.defineProperty(exports, "__esModule", { value: true });
  10778. var CommandBase_1 = __webpack_require__(7);
  10779. var CommandStates_1 = __webpack_require__(6);
  10780. var ChangeConnectorPropertyHistoryItem_1 = __webpack_require__(91);
  10781. var ChangeConnectorPropertyCommand = /** @class */ (function (_super) {
  10782. __extends(ChangeConnectorPropertyCommand, _super);
  10783. function ChangeConnectorPropertyCommand() {
  10784. return _super !== null && _super.apply(this, arguments) || this;
  10785. }
  10786. ChangeConnectorPropertyCommand.prototype.getState = function () {
  10787. return new CommandStates_1.SimpleCommandState(true, this.getStateValue());
  10788. };
  10789. ChangeConnectorPropertyCommand.prototype.getStateValue = function () {
  10790. return this.control.selection.inputPosition.getConnectorPropertyValue(this.getPropertyName());
  10791. };
  10792. ChangeConnectorPropertyCommand.prototype.executeCore = function (state, parameter) {
  10793. var _this = this;
  10794. this.control.history.beginTransaction();
  10795. var connectors = this.control.selection.getSelectedConnectors();
  10796. connectors.forEach(function (connector) {
  10797. var propertyName = _this.getPropertyName();
  10798. _this.control.history.addAndRedo(new ChangeConnectorPropertyHistoryItem_1.ChangeConnectorPropertyHistoryItem(connector.key, propertyName, parameter));
  10799. });
  10800. this.control.selection.inputPosition.setConnectorPropertyValue(this.getPropertyName(), parameter);
  10801. this.control.history.endTransaction();
  10802. return true;
  10803. };
  10804. return ChangeConnectorPropertyCommand;
  10805. }(CommandBase_1.CommandBase));
  10806. exports.ChangeConnectorPropertyCommand = ChangeConnectorPropertyCommand;
  10807. /***/ }),
  10808. /* 91 */
  10809. /***/ (function(module, exports, __webpack_require__) {
  10810. "use strict";
  10811. var __extends = (this && this.__extends) || (function () {
  10812. var extendStatics = function (d, b) {
  10813. extendStatics = Object.setPrototypeOf ||
  10814. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10815. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10816. return extendStatics(d, b);
  10817. };
  10818. return function (d, b) {
  10819. extendStatics(d, b);
  10820. function __() { this.constructor = d; }
  10821. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10822. };
  10823. })();
  10824. Object.defineProperty(exports, "__esModule", { value: true });
  10825. var HistoryItem_1 = __webpack_require__(4);
  10826. var ChangeConnectorPropertyHistoryItem = /** @class */ (function (_super) {
  10827. __extends(ChangeConnectorPropertyHistoryItem, _super);
  10828. function ChangeConnectorPropertyHistoryItem(connectorKey, propertyName, value) {
  10829. var _this = _super.call(this) || this;
  10830. _this.connectorKey = connectorKey;
  10831. _this.propertyName = propertyName;
  10832. _this.value = value;
  10833. return _this;
  10834. }
  10835. ChangeConnectorPropertyHistoryItem.prototype.redo = function (manipulator) {
  10836. var connector = manipulator.model.findConnector(this.connectorKey);
  10837. this.oldValue = connector.properties[this.propertyName];
  10838. manipulator.changeConnectorProperty(connector, this.propertyName, this.value);
  10839. };
  10840. ChangeConnectorPropertyHistoryItem.prototype.undo = function (manipulator) {
  10841. var connector = manipulator.model.findConnector(this.connectorKey);
  10842. manipulator.changeConnectorProperty(connector, this.propertyName, this.oldValue);
  10843. };
  10844. return ChangeConnectorPropertyHistoryItem;
  10845. }(HistoryItem_1.HistoryItem));
  10846. exports.ChangeConnectorPropertyHistoryItem = ChangeConnectorPropertyHistoryItem;
  10847. /***/ }),
  10848. /* 92 */
  10849. /***/ (function(module, exports, __webpack_require__) {
  10850. "use strict";
  10851. Object.defineProperty(exports, "__esModule", { value: true });
  10852. var ExtensionLineType;
  10853. (function (ExtensionLineType) {
  10854. ExtensionLineType[ExtensionLineType["LeftToLeftAbove"] = 0] = "LeftToLeftAbove";
  10855. ExtensionLineType[ExtensionLineType["LeftToLeftBelow"] = 1] = "LeftToLeftBelow";
  10856. ExtensionLineType[ExtensionLineType["RightToRightAbove"] = 2] = "RightToRightAbove";
  10857. ExtensionLineType[ExtensionLineType["RightToRightBelow"] = 3] = "RightToRightBelow";
  10858. ExtensionLineType[ExtensionLineType["LeftToRightAbove"] = 4] = "LeftToRightAbove";
  10859. ExtensionLineType[ExtensionLineType["LeftToRightBelow"] = 5] = "LeftToRightBelow";
  10860. ExtensionLineType[ExtensionLineType["RightToLeftAbove"] = 6] = "RightToLeftAbove";
  10861. ExtensionLineType[ExtensionLineType["RightToLeftBelow"] = 7] = "RightToLeftBelow";
  10862. ExtensionLineType[ExtensionLineType["TopToTopBefore"] = 8] = "TopToTopBefore";
  10863. ExtensionLineType[ExtensionLineType["TopToTopAfter"] = 9] = "TopToTopAfter";
  10864. ExtensionLineType[ExtensionLineType["BottomToBottomBefore"] = 10] = "BottomToBottomBefore";
  10865. ExtensionLineType[ExtensionLineType["BottomToBottomAfter"] = 11] = "BottomToBottomAfter";
  10866. ExtensionLineType[ExtensionLineType["TopToBottomBefore"] = 12] = "TopToBottomBefore";
  10867. ExtensionLineType[ExtensionLineType["TopToBottomAfter"] = 13] = "TopToBottomAfter";
  10868. ExtensionLineType[ExtensionLineType["BottomToTopBefore"] = 14] = "BottomToTopBefore";
  10869. ExtensionLineType[ExtensionLineType["BottomToTopAfter"] = 15] = "BottomToTopAfter";
  10870. ExtensionLineType[ExtensionLineType["HorizontalCenterAbove"] = 16] = "HorizontalCenterAbove";
  10871. ExtensionLineType[ExtensionLineType["HorizontalCenterBelow"] = 17] = "HorizontalCenterBelow";
  10872. ExtensionLineType[ExtensionLineType["VerticalCenterBefore"] = 18] = "VerticalCenterBefore";
  10873. ExtensionLineType[ExtensionLineType["VerticalCenterAfter"] = 19] = "VerticalCenterAfter";
  10874. ExtensionLineType[ExtensionLineType["VerticalCenterToPageCenter"] = 20] = "VerticalCenterToPageCenter";
  10875. ExtensionLineType[ExtensionLineType["HorizontalCenterToPageCenter"] = 21] = "HorizontalCenterToPageCenter";
  10876. ExtensionLineType[ExtensionLineType["LeftToPageCenter"] = 22] = "LeftToPageCenter";
  10877. ExtensionLineType[ExtensionLineType["RightToPageCenter"] = 23] = "RightToPageCenter";
  10878. ExtensionLineType[ExtensionLineType["TopToPageCenter"] = 24] = "TopToPageCenter";
  10879. ExtensionLineType[ExtensionLineType["BottomToPageCenter"] = 25] = "BottomToPageCenter";
  10880. })(ExtensionLineType = exports.ExtensionLineType || (exports.ExtensionLineType = {}));
  10881. var ExtensionLine = /** @class */ (function () {
  10882. function ExtensionLine(type, segment, text) {
  10883. this.type = type;
  10884. this.segment = segment;
  10885. this.text = text;
  10886. }
  10887. return ExtensionLine;
  10888. }());
  10889. exports.ExtensionLine = ExtensionLine;
  10890. var ExtensionLinesVisualizer = /** @class */ (function () {
  10891. function ExtensionLinesVisualizer(dispatcher) {
  10892. this.dispatcher = dispatcher;
  10893. this.lines = [];
  10894. this.lineIndexByType = {};
  10895. }
  10896. ExtensionLinesVisualizer.prototype.addSegment = function (type, segment, text) {
  10897. var curIndex = this.lineIndexByType[type];
  10898. if (curIndex === undefined) {
  10899. var line = new ExtensionLine(type, segment, text);
  10900. var index = this.lines.push(line);
  10901. this.lineIndexByType[line.type] = index - 1;
  10902. this.raiseShow();
  10903. }
  10904. else if (segment.distance < this.lines[curIndex].segment.distance) {
  10905. var line = new ExtensionLine(type, segment, text);
  10906. this.lines.splice(curIndex, 1, line);
  10907. this.raiseShow();
  10908. }
  10909. };
  10910. ExtensionLinesVisualizer.prototype.update = function () {
  10911. this.raiseShow();
  10912. };
  10913. ExtensionLinesVisualizer.prototype.reset = function () {
  10914. if (this.lines.length) {
  10915. this.lines = [];
  10916. this.lineIndexByType = {};
  10917. this.raiseHide();
  10918. }
  10919. };
  10920. ExtensionLinesVisualizer.prototype.raiseShow = function () {
  10921. var _this = this;
  10922. this.dispatcher.raise1(function (l) { return l.NotifyExtensionLinesShow(_this.lines); });
  10923. };
  10924. ExtensionLinesVisualizer.prototype.raiseHide = function () {
  10925. this.dispatcher.raise1(function (l) { return l.NotifyExtensionLinesHide(); });
  10926. };
  10927. return ExtensionLinesVisualizer;
  10928. }());
  10929. exports.ExtensionLinesVisualizer = ExtensionLinesVisualizer;
  10930. /***/ }),
  10931. /* 93 */
  10932. /***/ (function(module, exports, __webpack_require__) {
  10933. "use strict";
  10934. var __extends = (this && this.__extends) || (function () {
  10935. var extendStatics = function (d, b) {
  10936. extendStatics = Object.setPrototypeOf ||
  10937. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10938. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10939. return extendStatics(d, b);
  10940. };
  10941. return function (d, b) {
  10942. extendStatics(d, b);
  10943. function __() { this.constructor = d; }
  10944. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10945. };
  10946. })();
  10947. Object.defineProperty(exports, "__esModule", { value: true });
  10948. var HistoryItem_1 = __webpack_require__(4);
  10949. var ChangeZindexHistoryItem = /** @class */ (function (_super) {
  10950. __extends(ChangeZindexHistoryItem, _super);
  10951. function ChangeZindexHistoryItem(item, zIndex) {
  10952. var _this = _super.call(this) || this;
  10953. _this.itemKey = item.key;
  10954. _this.zIndex = zIndex;
  10955. return _this;
  10956. }
  10957. ChangeZindexHistoryItem.prototype.redo = function (manipulator) {
  10958. var item = manipulator.model.findItem(this.itemKey);
  10959. this.oldZIndex = item.zIndex;
  10960. manipulator.changeZIndex(item, this.zIndex);
  10961. };
  10962. ChangeZindexHistoryItem.prototype.undo = function (manipulator) {
  10963. var item = manipulator.model.findItem(this.itemKey);
  10964. manipulator.changeZIndex(item, this.oldZIndex);
  10965. };
  10966. return ChangeZindexHistoryItem;
  10967. }(HistoryItem_1.HistoryItem));
  10968. exports.ChangeZindexHistoryItem = ChangeZindexHistoryItem;
  10969. /***/ }),
  10970. /* 94 */
  10971. /***/ (function(module, exports, __webpack_require__) {
  10972. "use strict";
  10973. var __extends = (this && this.__extends) || (function () {
  10974. var extendStatics = function (d, b) {
  10975. extendStatics = Object.setPrototypeOf ||
  10976. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10977. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10978. return extendStatics(d, b);
  10979. };
  10980. return function (d, b) {
  10981. extendStatics(d, b);
  10982. function __() { this.constructor = d; }
  10983. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  10984. };
  10985. })();
  10986. Object.defineProperty(exports, "__esModule", { value: true });
  10987. var CommandBase_1 = __webpack_require__(7);
  10988. var CommandStates_1 = __webpack_require__(6);
  10989. var ChangeLockedHistoryItem_1 = __webpack_require__(206);
  10990. var SetSelectionHistoryItem_1 = __webpack_require__(29);
  10991. var ChangeLockedCommand = /** @class */ (function (_super) {
  10992. __extends(ChangeLockedCommand, _super);
  10993. function ChangeLockedCommand() {
  10994. return _super !== null && _super.apply(this, arguments) || this;
  10995. }
  10996. ChangeLockedCommand.prototype.getState = function () {
  10997. var _this = this;
  10998. var items = this.control.selection.getSelectedItems(true);
  10999. var enabled = false;
  11000. items.forEach(function (item) { if (item.locked !== _this.getLockState())
  11001. enabled = true; });
  11002. return new CommandStates_1.SimpleCommandState(enabled);
  11003. };
  11004. ChangeLockedCommand.prototype.executeCore = function (state, parameter) {
  11005. var _this = this;
  11006. this.control.history.beginTransaction();
  11007. var items = this.control.selection.getSelectedItems(true);
  11008. items.forEach(function (item) {
  11009. _this.control.history.addAndRedo(new ChangeLockedHistoryItem_1.ChangeLockedHistoryItem(item, _this.getLockState()));
  11010. });
  11011. this.control.history.addAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(this.control.selection, this.control.selection.getKeys())); // Update canvas
  11012. this.control.history.endTransaction();
  11013. return true;
  11014. };
  11015. return ChangeLockedCommand;
  11016. }(CommandBase_1.CommandBase));
  11017. exports.ChangeLockedCommand = ChangeLockedCommand;
  11018. /***/ }),
  11019. /* 95 */
  11020. /***/ (function(module, exports, __webpack_require__) {
  11021. "use strict";
  11022. var __extends = (this && this.__extends) || (function () {
  11023. var extendStatics = function (d, b) {
  11024. extendStatics = Object.setPrototypeOf ||
  11025. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  11026. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  11027. return extendStatics(d, b);
  11028. };
  11029. return function (d, b) {
  11030. extendStatics(d, b);
  11031. function __() { this.constructor = d; }
  11032. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11033. };
  11034. })();
  11035. Object.defineProperty(exports, "__esModule", { value: true });
  11036. var Utils_1 = __webpack_require__(0);
  11037. var MouseHandlerDraggingState_1 = __webpack_require__(24);
  11038. var ModelUtils_1 = __webpack_require__(8);
  11039. var MouseHandlerMoveShapeStateBase = /** @class */ (function (_super) {
  11040. __extends(MouseHandlerMoveShapeStateBase, _super);
  11041. function MouseHandlerMoveShapeStateBase(handler, history, model, selection) {
  11042. var _this = _super.call(this, handler, history) || this;
  11043. _this.model = model;
  11044. _this.selection = selection;
  11045. _this.startScrollLeft = 0;
  11046. _this.startScrollTop = 0;
  11047. return _this;
  11048. }
  11049. MouseHandlerMoveShapeStateBase.prototype.finish = function () {
  11050. this.handler.resetExtensionLines();
  11051. _super.prototype.finish.call(this);
  11052. };
  11053. MouseHandlerMoveShapeStateBase.prototype.onMouseDown = function (evt) {
  11054. this.startPoint = evt.layoutPoint;
  11055. this.shapes = this.selection.getSelectedShapes();
  11056. this.connectors = this.selection.getSelectedConnectors();
  11057. if (this.shapes.length === 0) {
  11058. this.handler.switchToDefaultState();
  11059. return;
  11060. }
  11061. this.startShapePositions = this.shapes.map(function (shape) { return shape.position.clone(); });
  11062. this.startConnectorPoints = this.connectors.map(function (c) { return c.points.map(function (p) { return p.clone(); }); });
  11063. _super.prototype.onMouseDown.call(this, evt);
  11064. };
  11065. MouseHandlerMoveShapeStateBase.prototype.onMouseMove = function (evt) {
  11066. _super.prototype.onMouseMove.call(this, evt);
  11067. this.handler.setExtensionLines(this.selection.getSelectedShapes());
  11068. };
  11069. MouseHandlerMoveShapeStateBase.prototype.onApplyChanges = function (evt) {
  11070. var _this = this;
  11071. this.shapes.forEach(function (shape, index) {
  11072. var pos = _this.getPosition(evt, _this.startShapePositions[index]);
  11073. ModelUtils_1.ModelUtils.setShapePosition(_this.history, _this.model, shape.key, pos, _this.history.addOrModifyAndRedo);
  11074. shape.attachedConnectors.forEach(function (connector) {
  11075. ModelUtils_1.ModelUtils.removeConnectorIntermediatePoints(_this.history, connector);
  11076. ModelUtils_1.ModelUtils.updateConnectorAttachedPoints(_this.history, connector, _this.history.addOrModifyAndRedo);
  11077. });
  11078. });
  11079. this.connectors.forEach(function (connector, index) {
  11080. var delta = _this.startShapePositions[0].offset(-_this.shapes[0].position.x, -_this.shapes[0].position.y);
  11081. if (delta.x !== 0 || delta.y !== 0) {
  11082. var startPtIndex = connector.beginItem ? 1 : 0;
  11083. var endPtIndex = connector.endItem ? (connector.points.length - 2) : (connector.points.length - 1);
  11084. for (var i = startPtIndex; i <= endPtIndex; i++)
  11085. ModelUtils_1.ModelUtils.setConnectorPoint(_this.history, _this.model, connector.key, i, _this.startConnectorPoints[index][i].offset(-delta.x, -delta.y), _this.history.addOrModifyAndRedo);
  11086. }
  11087. });
  11088. this.handler.tryUpdateModelSize();
  11089. };
  11090. MouseHandlerMoveShapeStateBase.prototype.getDraggingElementKeys = function () {
  11091. return this.shapes.map(function (shape) { return shape.key; });
  11092. };
  11093. MouseHandlerMoveShapeStateBase.prototype.getXPosition = function (evt, baseX) {
  11094. return baseX + evt.layoutPoint.x - this.startPoint.x;
  11095. };
  11096. MouseHandlerMoveShapeStateBase.prototype.getYPosition = function (evt, baseY) {
  11097. return baseY + evt.layoutPoint.y - this.startPoint.y;
  11098. };
  11099. MouseHandlerMoveShapeStateBase.prototype.getPosition = function (evt, basePoint) {
  11100. return new Utils_1.Point(this.handler.getSnappedPos(evt, this.getXPosition(evt, basePoint.x)), this.handler.getSnappedPos(evt, this.getYPosition(evt, basePoint.y)));
  11101. };
  11102. return MouseHandlerMoveShapeStateBase;
  11103. }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
  11104. exports.MouseHandlerMoveShapeStateBase = MouseHandlerMoveShapeStateBase;
  11105. /***/ }),
  11106. /* 96 */
  11107. /***/ (function(module, exports, __webpack_require__) {
  11108. "use strict";
  11109. var __extends = (this && this.__extends) || (function () {
  11110. var extendStatics = function (d, b) {
  11111. extendStatics = Object.setPrototypeOf ||
  11112. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  11113. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  11114. return extendStatics(d, b);
  11115. };
  11116. return function (d, b) {
  11117. extendStatics(d, b);
  11118. function __() { this.constructor = d; }
  11119. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11120. };
  11121. })();
  11122. Object.defineProperty(exports, "__esModule", { value: true });
  11123. var Connector_1 = __webpack_require__(5);
  11124. var Event_1 = __webpack_require__(14);
  11125. var MouseHandlerDraggingState_1 = __webpack_require__(24);
  11126. var DeleteConnectionHistoryItem_1 = __webpack_require__(73);
  11127. var AddConnectionHistoryItem_1 = __webpack_require__(35);
  11128. var MoveConnectorPointHistoryItem_1 = __webpack_require__(36);
  11129. var ModelUtils_1 = __webpack_require__(8);
  11130. var MouseHandlerMoveConnectorPointStateBase = /** @class */ (function (_super) {
  11131. __extends(MouseHandlerMoveConnectorPointStateBase, _super);
  11132. function MouseHandlerMoveConnectorPointStateBase(handler, history, model) {
  11133. var _this = _super.call(this, handler, history) || this;
  11134. _this.model = model;
  11135. return _this;
  11136. }
  11137. MouseHandlerMoveConnectorPointStateBase.prototype.finish = function () {
  11138. this.handler.resetConnectionTarget();
  11139. this.handler.resetConnectionPoints();
  11140. _super.prototype.finish.call(this);
  11141. };
  11142. MouseHandlerMoveConnectorPointStateBase.prototype.onMouseMove = function (evt) {
  11143. _super.prototype.onMouseMove.call(this, evt);
  11144. var item = this.connector.getExtremeItem(this.pointPosition);
  11145. this.handler.setConnectionTarget(item, evt.source.type);
  11146. var pointIndex = this.connector.getExtremeConnectionPointIndex(this.pointPosition);
  11147. if (!item && this.connector.getExtremeConnectionPointIndex(this.oppositePointPosition) !== -1)
  11148. item = this.model.findItem(evt.source.key);
  11149. this.handler.setConnectionPoints(item, evt.source.type, pointIndex);
  11150. };
  11151. MouseHandlerMoveConnectorPointStateBase.prototype.onApplyChanges = function (evt) {
  11152. var point = this.getSnappedPoint(evt, evt.layoutPoint);
  11153. if (this.pointPosition !== undefined) {
  11154. var item = this.model.findItem(evt.source.key);
  11155. var connectionPointIndex = -1;
  11156. if (evt.source.type === Event_1.MouseEventElementType.ShapeConnectionPoint)
  11157. connectionPointIndex = parseInt(evt.source.value);
  11158. if (item && !item.locked && (evt.source.type === Event_1.MouseEventElementType.Shape || evt.source.type === Event_1.MouseEventElementType.ShapeConnectionPoint) &&
  11159. (this.connector.getExtremeItem(this.oppositePointPosition) !== item ||
  11160. (connectionPointIndex !== -1 && this.connector.getExtremeConnectionPointIndex(this.oppositePointPosition) !== -1 &&
  11161. connectionPointIndex !== this.connector.getExtremeConnectionPointIndex(this.oppositePointPosition)))) {
  11162. if (this.connector.getExtremeItem(this.pointPosition) !== item ||
  11163. this.connector.getExtremeConnectionPointIndex(this.pointPosition) !== connectionPointIndex) {
  11164. if (this.connector.getExtremeItem(this.pointPosition))
  11165. this.history.addOrModifyAndRedo(new DeleteConnectionHistoryItem_1.DeleteConnectionHistoryItem(this.connector, this.pointPosition));
  11166. this.history.addOrModifyAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(this.connector, item, connectionPointIndex, this.pointPosition));
  11167. }
  11168. point = item.getConnectionPoint(connectionPointIndex, this.connector.points[this.pointIndex + (this.pointPosition === Connector_1.ConnectorPosition.End ? -1 : 1)]);
  11169. this.handler.setConnectionPointIndex(connectionPointIndex);
  11170. }
  11171. else if (this.connector.getExtremeItem(this.pointPosition)) {
  11172. this.history.addOrModifyAndRedo(new DeleteConnectionHistoryItem_1.DeleteConnectionHistoryItem(this.connector, this.pointPosition));
  11173. }
  11174. }
  11175. this.history.addOrModifyAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(this.connector.key, this.pointIndex, point));
  11176. ModelUtils_1.ModelUtils.updateConnectorAttachedPoints(this.history, this.connector, this.history.addOrModifyAndRedo);
  11177. this.handler.tryUpdateModelSize();
  11178. };
  11179. MouseHandlerMoveConnectorPointStateBase.prototype.onFinishWithChanges = function () {
  11180. ModelUtils_1.ModelUtils.removeUnnecessaryConnectorPoints(this.history, this.connector);
  11181. };
  11182. MouseHandlerMoveConnectorPointStateBase.prototype.getDraggingElementKeys = function () {
  11183. return this.connector ? [this.connector.key] : [];
  11184. };
  11185. Object.defineProperty(MouseHandlerMoveConnectorPointStateBase.prototype, "oppositePointPosition", {
  11186. get: function () {
  11187. return this.pointPosition === Connector_1.ConnectorPosition.Begin ? Connector_1.ConnectorPosition.End : Connector_1.ConnectorPosition.Begin;
  11188. },
  11189. enumerable: true,
  11190. configurable: true
  11191. });
  11192. return MouseHandlerMoveConnectorPointStateBase;
  11193. }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
  11194. exports.MouseHandlerMoveConnectorPointStateBase = MouseHandlerMoveConnectorPointStateBase;
  11195. /***/ }),
  11196. /* 97 */
  11197. /***/ (function(module, exports, __webpack_require__) {
  11198. "use strict";
  11199. var __extends = (this && this.__extends) || (function () {
  11200. var extendStatics = function (d, b) {
  11201. extendStatics = Object.setPrototypeOf ||
  11202. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  11203. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  11204. return extendStatics(d, b);
  11205. };
  11206. return function (d, b) {
  11207. extendStatics(d, b);
  11208. function __() { this.constructor = d; }
  11209. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11210. };
  11211. })();
  11212. Object.defineProperty(exports, "__esModule", { value: true });
  11213. var HistoryItem_1 = __webpack_require__(4);
  11214. var AddConnectorPointHistoryItem = /** @class */ (function (_super) {
  11215. __extends(AddConnectorPointHistoryItem, _super);
  11216. function AddConnectorPointHistoryItem(connectorKey, pointIndex, point) {
  11217. var _this = _super.call(this) || this;
  11218. _this.connectorKey = connectorKey;
  11219. _this.pointIndex = pointIndex;
  11220. _this.point = point;
  11221. return _this;
  11222. }
  11223. AddConnectorPointHistoryItem.prototype.redo = function (manipulator) {
  11224. var connector = manipulator.model.findConnector(this.connectorKey);
  11225. manipulator.addConnectorPoint(connector, this.pointIndex, this.point.clone());
  11226. };
  11227. AddConnectorPointHistoryItem.prototype.undo = function (manipulator) {
  11228. var connector = manipulator.model.findConnector(this.connectorKey);
  11229. manipulator.deleteConnectorPoint(connector, this.pointIndex);
  11230. };
  11231. return AddConnectorPointHistoryItem;
  11232. }(HistoryItem_1.HistoryItem));
  11233. exports.AddConnectorPointHistoryItem = AddConnectorPointHistoryItem;
  11234. /***/ }),
  11235. /* 98 */
  11236. /***/ (function(module, exports, __webpack_require__) {
  11237. "use strict";
  11238. var __extends = (this && this.__extends) || (function () {
  11239. var extendStatics = function (d, b) {
  11240. extendStatics = Object.setPrototypeOf ||
  11241. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  11242. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  11243. return extendStatics(d, b);
  11244. };
  11245. return function (d, b) {
  11246. extendStatics(d, b);
  11247. function __() { this.constructor = d; }
  11248. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11249. };
  11250. })();
  11251. Object.defineProperty(exports, "__esModule", { value: true });
  11252. var HistoryItem_1 = __webpack_require__(4);
  11253. var ChangeConnectorTextHistoryItem = /** @class */ (function (_super) {
  11254. __extends(ChangeConnectorTextHistoryItem, _super);
  11255. function ChangeConnectorTextHistoryItem(connector, position, text) {
  11256. var _this = _super.call(this) || this;
  11257. _this.connectorKey = connector.key;
  11258. _this.text = text;
  11259. _this.position = position;
  11260. return _this;
  11261. }
  11262. ChangeConnectorTextHistoryItem.prototype.redo = function (manipulator) {
  11263. var connector = manipulator.model.findConnector(this.connectorKey);
  11264. this.oldText = connector.getText(this.position);
  11265. manipulator.changeConnectorText(connector, this.position, this.text);
  11266. };
  11267. ChangeConnectorTextHistoryItem.prototype.undo = function (manipulator) {
  11268. var connector = manipulator.model.findConnector(this.connectorKey);
  11269. manipulator.changeConnectorText(connector, this.position, this.oldText);
  11270. };
  11271. return ChangeConnectorTextHistoryItem;
  11272. }(HistoryItem_1.HistoryItem));
  11273. exports.ChangeConnectorTextHistoryItem = ChangeConnectorTextHistoryItem;
  11274. /***/ }),
  11275. /* 99 */
  11276. /***/ (function(module, exports, __webpack_require__) {
  11277. "use strict";
  11278. Object.defineProperty(exports, "__esModule", { value: true });
  11279. var Utils_1 = __webpack_require__(0);
  11280. var Evt_1 = __webpack_require__(49);
  11281. var Base_1 = __webpack_require__(19);
  11282. var Toolbox = /** @class */ (function () {
  11283. function Toolbox() {
  11284. this.dragStartLimit = 3;
  11285. this.onDragOperation = new Utils_1.EventDispatcher();
  11286. }
  11287. Toolbox.prototype.initialize = function (element, option) {
  11288. element.addEventListener("mousedown", this.onMouseDown.bind(this));
  11289. document.addEventListener("mousemove", this.onMouseMove.bind(this));
  11290. document.addEventListener("mouseup", this.onMouseUp.bind(this));
  11291. };
  11292. Toolbox.prototype.onMouseDown = function (evt) {
  11293. this.mouseDownPoint = new Utils_1.Point(evt.pageX, evt.pageY);
  11294. this.draggingObject = this.createDraggingObject(evt.target);
  11295. if (this.draggingObject) {
  11296. this.draggingObject.evt.onFinishDragging = this.finishDragging.bind(this);
  11297. this.draggingObject.evt.onCaptured = this.capture.bind(this);
  11298. this.onDragStart();
  11299. }
  11300. };
  11301. Toolbox.prototype.onMouseMove = function (evt) {
  11302. if (!Evt_1.Evt.IsLeftButtonPressed(evt))
  11303. this.finishDragging();
  11304. else if (this.draggingObject) {
  11305. if (!this.draggingObject.element &&
  11306. (Math.abs(evt.pageX - this.mouseDownPoint.x) > this.dragStartLimit ||
  11307. Math.abs(evt.pageY - this.mouseDownPoint.y) > this.dragStartLimit)) {
  11308. this.draggingObject.element = this.createDraggingElement(this.draggingObject);
  11309. if (this.draggingObject.captured !== undefined)
  11310. this.capture(this.draggingObject.captured, true);
  11311. }
  11312. if (this.draggingObject.element)
  11313. this.updateDraggingElementPosition(evt);
  11314. }
  11315. };
  11316. Toolbox.prototype.onMouseUp = function (evt) {
  11317. this.finishDragging();
  11318. };
  11319. Toolbox.prototype.updateDraggingElementPosition = function (evt) {
  11320. var element = this.draggingObject.element;
  11321. var xPos = (evt.pageX - element.offsetWidth / 2);
  11322. var yPos = (evt.pageY - element.offsetHeight / 2);
  11323. Base_1.SetAbsoluteX(element, xPos);
  11324. Base_1.SetAbsoluteY(element, yPos);
  11325. };
  11326. Toolbox.prototype.finishDragging = function () {
  11327. if (this.draggingObject) {
  11328. this.onDragEnd();
  11329. var element = this.draggingObject.element;
  11330. if (element)
  11331. element.parentNode.removeChild(element);
  11332. }
  11333. delete this.draggingObject;
  11334. };
  11335. Toolbox.prototype.capture = function (captured, forced) {
  11336. if (this.draggingObject && (this.draggingObject.captured !== captured || forced)) {
  11337. this.draggingObject.captured = captured;
  11338. if (this.draggingObject.element)
  11339. this.draggingObject.element.classList.toggle("dxdi-tb-drag-captured", captured);
  11340. }
  11341. };
  11342. Toolbox.prototype.onDragEnd = function () {
  11343. this.onDragOperation.raise("NotifyToolboxDragEnd");
  11344. };
  11345. Toolbox.prototype.onDragStart = function () {
  11346. this.onDragOperation.raise("NotifyToolboxDragStart");
  11347. };
  11348. return Toolbox;
  11349. }());
  11350. exports.Toolbox = Toolbox;
  11351. var ToolboxDraggingObject = /** @class */ (function () {
  11352. function ToolboxDraggingObject(evt) {
  11353. this.evt = evt;
  11354. }
  11355. return ToolboxDraggingObject;
  11356. }());
  11357. exports.ToolboxDraggingObject = ToolboxDraggingObject;
  11358. var DiagramDraggingEvent = /** @class */ (function () {
  11359. function DiagramDraggingEvent() {
  11360. }
  11361. return DiagramDraggingEvent;
  11362. }());
  11363. exports.DiagramDraggingEvent = DiagramDraggingEvent;
  11364. /***/ }),
  11365. /* 100 */
  11366. /***/ (function(module, exports, __webpack_require__) {
  11367. "use strict";
  11368. var __extends = (this && this.__extends) || (function () {
  11369. var extendStatics = function (d, b) {
  11370. extendStatics = Object.setPrototypeOf ||
  11371. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  11372. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  11373. return extendStatics(d, b);
  11374. };
  11375. return function (d, b) {
  11376. extendStatics(d, b);
  11377. function __() { this.constructor = d; }
  11378. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11379. };
  11380. })();
  11381. Object.defineProperty(exports, "__esModule", { value: true });
  11382. var CommandBase_1 = __webpack_require__(7);
  11383. var CommandStates_1 = __webpack_require__(6);
  11384. var ModelUtils_1 = __webpack_require__(8);
  11385. var DeleteCommand = /** @class */ (function (_super) {
  11386. __extends(DeleteCommand, _super);
  11387. function DeleteCommand() {
  11388. return _super !== null && _super.apply(this, arguments) || this;
  11389. }
  11390. DeleteCommand.prototype.getState = function () {
  11391. return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty());
  11392. };
  11393. DeleteCommand.prototype.executeCore = function (state) {
  11394. ModelUtils_1.ModelUtils.deleteSelection(this.control.history, this.control.model, this.control.selection);
  11395. return true;
  11396. };
  11397. return DeleteCommand;
  11398. }(CommandBase_1.CommandBase));
  11399. exports.DeleteCommand = DeleteCommand;
  11400. /***/ }),
  11401. /* 101 */
  11402. /***/ (function(module, exports, __webpack_require__) {
  11403. "use strict";
  11404. var __extends = (this && this.__extends) || (function () {
  11405. var extendStatics = function (d, b) {
  11406. extendStatics = Object.setPrototypeOf ||
  11407. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  11408. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  11409. return extendStatics(d, b);
  11410. };
  11411. return function (d, b) {
  11412. extendStatics(d, b);
  11413. function __() { this.constructor = d; }
  11414. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11415. };
  11416. })();
  11417. Object.defineProperty(exports, "__esModule", { value: true });
  11418. var HistoryItem_1 = __webpack_require__(4);
  11419. var MoveShapeHistoryItem = /** @class */ (function (_super) {
  11420. __extends(MoveShapeHistoryItem, _super);
  11421. function MoveShapeHistoryItem(shapeKey, position) {
  11422. var _this = _super.call(this) || this;
  11423. _this.shapeKey = shapeKey;
  11424. _this.position = position;
  11425. return _this;
  11426. }
  11427. MoveShapeHistoryItem.prototype.redo = function (manipulator) {
  11428. var shape = manipulator.model.findShape(this.shapeKey);
  11429. this.oldPosition = shape.position.clone();
  11430. manipulator.moveShape(shape, this.position);
  11431. };
  11432. MoveShapeHistoryItem.prototype.undo = function (manipulator) {
  11433. var shape = manipulator.model.findShape(this.shapeKey);
  11434. manipulator.moveShape(shape, this.oldPosition);
  11435. };
  11436. return MoveShapeHistoryItem;
  11437. }(HistoryItem_1.HistoryItem));
  11438. exports.MoveShapeHistoryItem = MoveShapeHistoryItem;
  11439. /***/ }),
  11440. /* 102 */
  11441. /***/ (function(module, exports, __webpack_require__) {
  11442. "use strict";
  11443. Object.defineProperty(exports, "__esModule", { value: true });
  11444. var Base_1 = __webpack_require__(19);
  11445. var Data = /** @class */ (function () {
  11446. function Data() {
  11447. }
  11448. Data.ArrayInsert = function (array, element, position) {
  11449. if (0 <= position && position < array.length) {
  11450. for (var i = array.length; i > position; i--)
  11451. array[i] = array[i - 1];
  11452. array[position] = element;
  11453. }
  11454. else
  11455. array.push(element);
  11456. };
  11457. Data.ArrayRemove = function (array, element) {
  11458. var index = Data.ArrayIndexOf(array, element);
  11459. if (index > -1)
  11460. Data.ArrayRemoveAt(array, index);
  11461. };
  11462. Data.ArrayRemoveAt = function (array, index) {
  11463. if (index >= 0 && index < array.length) {
  11464. for (var i = index; i < array.length - 1; i++)
  11465. array[i] = array[i + 1];
  11466. array.pop();
  11467. }
  11468. };
  11469. Data.ArrayClear = function (array) {
  11470. while (array.length > 0)
  11471. array.pop();
  11472. };
  11473. Data.ArrayIndexOf = function (array, element, comparer) {
  11474. if (!comparer) {
  11475. for (var i = 0; i < array.length; i++) {
  11476. if (array[i] == element)
  11477. return i;
  11478. }
  11479. }
  11480. else {
  11481. for (var i = 0; i < array.length; i++) {
  11482. if (comparer(array[i], element))
  11483. return i;
  11484. }
  11485. }
  11486. return -1;
  11487. };
  11488. Data.ArrayContains = function (array, element) {
  11489. return Data.ArrayIndexOf(array, element) >= 0;
  11490. };
  11491. Data.ArrayEqual = function (array1, array2) {
  11492. var count1 = array1.length;
  11493. var count2 = array2.length;
  11494. if (count1 != count2)
  11495. return false;
  11496. for (var i = 0; i < count1; i++)
  11497. if (array1[i] != array2[i])
  11498. return false;
  11499. return true;
  11500. };
  11501. Data.ArraySame = function (array1, array2) {
  11502. if (array1.length !== array2.length)
  11503. return false;
  11504. return array1.every(function (elem) { return Data.ArrayContains(array2, elem); });
  11505. };
  11506. Data.ArrayGetIntegerEdgeValues = function (array) {
  11507. var arrayToSort = Data.CollectionToArray(array);
  11508. Data.ArrayIntegerAscendingSort(arrayToSort);
  11509. return {
  11510. start: arrayToSort[0],
  11511. end: arrayToSort[arrayToSort.length - 1]
  11512. };
  11513. };
  11514. Data.ArrayIntegerAscendingSort = function (array) {
  11515. Data.ArrayIntegerSort(array, false);
  11516. };
  11517. Data.ArrayIntegerSort = function (array, desc) {
  11518. array.sort(function (i1, i2) {
  11519. var res = 0;
  11520. if (i1 > i2)
  11521. res = 1;
  11522. else if (i1 < i2)
  11523. res = -1;
  11524. if (desc)
  11525. res *= -1;
  11526. return res;
  11527. });
  11528. };
  11529. Data.CollectionsUnionToArray = function (firstCollection, secondCollection) {
  11530. var result = [];
  11531. var firstCollectionLength = firstCollection.length;
  11532. var secondCollectionLength = secondCollection.length;
  11533. for (var i = 0; i < firstCollectionLength + secondCollectionLength; i++) {
  11534. if (i < firstCollectionLength)
  11535. result.push(firstCollection[i]);
  11536. else
  11537. result.push(secondCollection[i - firstCollectionLength]);
  11538. }
  11539. return result;
  11540. };
  11541. Data.CollectionToArray = function (collection) {
  11542. var array = [];
  11543. for (var i = 0; i < collection.length; i++)
  11544. array.push(collection[i]);
  11545. return array;
  11546. };
  11547. Data.CreateHashTableFromArray = function (array) {
  11548. var hash = [];
  11549. for (var i = 0; i < array.length; i++)
  11550. hash[array[i]] = 1;
  11551. return hash;
  11552. };
  11553. Data.CreateIndexHashTableFromArray = function (array) {
  11554. var hash = [];
  11555. for (var i = 0; i < array.length; i++)
  11556. hash[array[i]] = i;
  11557. return hash;
  11558. };
  11559. Data.ArrayToHash = function (array, getKeyFunc, getValueFunc) {
  11560. if (!(array instanceof Array))
  11561. return {};
  11562. return array.reduce(function (map, element, index) {
  11563. var key = getKeyFunc(element, index);
  11564. var value = getValueFunc(element, index);
  11565. map[key] = value;
  11566. return map;
  11567. }, {});
  11568. };
  11569. Data.Sum = function (array, getValueFunc) {
  11570. if (!(array instanceof Array))
  11571. return 0;
  11572. return array.reduce(function (prevValue, item) {
  11573. var value = getValueFunc ? getValueFunc(item) : item;
  11574. if (!Base_1.IsNumber(value))
  11575. value = 0;
  11576. return prevValue + value;
  11577. }, 0);
  11578. };
  11579. Data.Min = function (array, getValueFunc) { return Data.CalculateArrayMinMax(array, getValueFunc, false); };
  11580. ;
  11581. Data.Max = function (array, getValueFunc) { return Data.CalculateArrayMinMax(array, getValueFunc, true); };
  11582. ;
  11583. Data.NearestLeftBinarySearchComparer = function (array, index, value) {
  11584. var arrayElement = array[index];
  11585. var leftPoint = arrayElement < value;
  11586. var lastLeftPoint = leftPoint && index == array.length - 1;
  11587. var nearestLeftPoint = lastLeftPoint || (leftPoint && array[index + 1] >= value);
  11588. if (nearestLeftPoint)
  11589. return 0;
  11590. else
  11591. return arrayElement < value ? -1 : 1;
  11592. };
  11593. Data.ArrayBinarySearch = function (array, value, binarySearchComparer, startIndex, length) {
  11594. if (!binarySearchComparer)
  11595. binarySearchComparer = Data.defaultBinarySearchComparer;
  11596. if (!Base_1.IsExists(startIndex))
  11597. startIndex = 0;
  11598. if (!Base_1.IsExists(length))
  11599. length = array.length - startIndex;
  11600. var endIndex = (startIndex + length) - 1;
  11601. while (startIndex <= endIndex) {
  11602. var middle = (startIndex + ((endIndex - startIndex) >> 1));
  11603. var compareResult = binarySearchComparer(array, middle, value);
  11604. if (compareResult == 0)
  11605. return middle;
  11606. if (compareResult < 0)
  11607. startIndex = middle + 1;
  11608. else
  11609. endIndex = middle - 1;
  11610. }
  11611. return -(startIndex + 1);
  11612. };
  11613. Data.ArrayFlatten = function (arrayOfArrays) {
  11614. return [].concat.apply([], arrayOfArrays);
  11615. };
  11616. Data.GetDistinctArray = function (array) {
  11617. var resultArray = [];
  11618. for (var i = 0; i < array.length; i++) {
  11619. var currentEntry = array[i];
  11620. if (Data.ArrayIndexOf(resultArray, currentEntry) == -1) {
  11621. resultArray.push(currentEntry);
  11622. }
  11623. }
  11624. return resultArray;
  11625. };
  11626. Data.ForEach = function (arr, callback) {
  11627. if (Array.prototype.forEach) {
  11628. Array.prototype.forEach.call(arr, callback);
  11629. }
  11630. else {
  11631. for (var i = 0, len = arr.length; i < len; i++) {
  11632. callback(arr[i], i, arr);
  11633. }
  11634. }
  11635. };
  11636. Data.MergeHashTables = function (target, object) {
  11637. if (!object || typeof (object) == "string")
  11638. return target;
  11639. if (!target)
  11640. target = {};
  11641. for (var key in object)
  11642. if (key && !(key in target))
  11643. target[key] = object[key];
  11644. return target;
  11645. };
  11646. Data.Range = function (count, start) {
  11647. count = parseInt(count) || 0;
  11648. start = parseInt(start) || 0;
  11649. if (count < 0)
  11650. count = 0;
  11651. if (start < 0)
  11652. start = 0;
  11653. return Array.apply(null, Array(count)).map(function (_val, i) { return start + i; });
  11654. };
  11655. Data.CalculateArrayMinMax = function (array, getValueFunc, isMax) {
  11656. if (!(array instanceof Array))
  11657. return 0;
  11658. var startValue = isMax ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
  11659. return array.reduce(function (prevValue, item) {
  11660. var value = getValueFunc ? getValueFunc(item) : item;
  11661. if (!Base_1.IsNumber(value))
  11662. value = startValue;
  11663. var func = isMax ? Math.max : Math.min;
  11664. return func(value, prevValue);
  11665. }, startValue);
  11666. };
  11667. Data.defaultBinarySearchComparer = function (array, index, value) {
  11668. var arrayElement = array[index];
  11669. if (arrayElement == value)
  11670. return 0;
  11671. else
  11672. return arrayElement < value ? -1 : 1;
  11673. };
  11674. return Data;
  11675. }());
  11676. exports.Data = Data;
  11677. /***/ }),
  11678. /* 103 */
  11679. /***/ (function(module, exports, __webpack_require__) {
  11680. "use strict";
  11681. Object.defineProperty(exports, "__esModule", { value: true });
  11682. var Base_1 = __webpack_require__(19);
  11683. var Str = /** @class */ (function () {
  11684. function Str() {
  11685. }
  11686. Str.TrimStart = function (str) {
  11687. return Str.trimInternal(str, true, false);
  11688. };
  11689. Str.TrimEnd = function (str) {
  11690. return Str.trimInternal(str, false, true);
  11691. };
  11692. Str.Trim = function (str) {
  11693. return Str.trimInternal(str, true, true);
  11694. };
  11695. Str.EncodeHtml = function (html) {
  11696. return Str.ApplyReplacement(html, [
  11697. [/&amp;/g, '&ampx;'], [/&/g, '&amp;'],
  11698. [/&quot;/g, '&quotx;'], [/"/g, '&quot;'],
  11699. [/&lt;/g, '&ltx;'], [/</g, '&lt;'],
  11700. [/&gt;/g, '&gtx;'], [/>/g, '&gt;']
  11701. ]);
  11702. };
  11703. Str.trimInternal = function (source, trimStart, trimEnd) {
  11704. var len = source.length;
  11705. if (!len)
  11706. return source;
  11707. if (len < 0xBABA1) { // B181394
  11708. var result = source;
  11709. if (trimStart) {
  11710. result = result.replace(/^\s+/, "");
  11711. }
  11712. if (trimEnd) {
  11713. result = result.replace(/\s+$/, "");
  11714. }
  11715. return result;
  11716. }
  11717. else {
  11718. var start = 0;
  11719. if (trimEnd) {
  11720. while (len > 0 && Str.whiteSpaces[source.charCodeAt(len - 1)]) {
  11721. len--;
  11722. }
  11723. }
  11724. if (trimStart && len > 0) {
  11725. while (start < len && Str.whiteSpaces[source.charCodeAt(start)]) {
  11726. start++;
  11727. }
  11728. }
  11729. return source.substring(start, len);
  11730. }
  11731. };
  11732. Str.ApplyReplacement = function (text, replecementTable) {
  11733. //if (typeof (text) != "string")
  11734. // text = text.toString();
  11735. for (var i = 0; i < replecementTable.length; i++) {
  11736. var replacement = replecementTable[i];
  11737. text = text.replace(replacement[0], replacement[1]);
  11738. }
  11739. return text;
  11740. };
  11741. Str.DecodeHtmlViaTextArea = function (html) {
  11742. var textArea = document.createElement("TEXTAREA");
  11743. Base_1.setInnerHtmlInternal(textArea, html);
  11744. return textArea.value;
  11745. };
  11746. Str.whiteSpaces = {
  11747. 0x0009: 1, 0x000a: 1, 0x000b: 1, 0x000c: 1, 0x000d: 1, 0x0020: 1, 0x0085: 1,
  11748. 0x00a0: 1, 0x1680: 1, 0x180e: 1, 0x2000: 1, 0x2001: 1, 0x2002: 1, 0x2003: 1,
  11749. 0x2004: 1, 0x2005: 1, 0x2006: 1, 0x2007: 1, 0x2008: 1, 0x2009: 1, 0x200a: 1,
  11750. 0x200b: 1, 0x2028: 1, 0x2029: 1, 0x202f: 1, 0x205f: 1, 0x3000: 1
  11751. };
  11752. return Str;
  11753. }());
  11754. exports.Str = Str;
  11755. /***/ }),
  11756. /* 104 */
  11757. /***/ (function(module, exports, __webpack_require__) {
  11758. "use strict";
  11759. Object.defineProperty(exports, "__esModule", { value: true });
  11760. var Browser_1 = __webpack_require__(20);
  11761. var Attr = /** @class */ (function () {
  11762. function Attr() {
  11763. }
  11764. Attr.SetAttribute = function (obj, attrName, value) {
  11765. if (obj.setAttribute) {
  11766. if (Attr.isSourceResetRequired() && attrName.toLowerCase() === "src") // T481593
  11767. obj.setAttribute(attrName, "");
  11768. obj.setAttribute(attrName, value);
  11769. }
  11770. else if (obj.setProperty)
  11771. obj.setProperty(attrName, value, "");
  11772. };
  11773. Attr.GetAttribute = function (obj, attrName) {
  11774. if (obj.getAttribute)
  11775. return obj.getAttribute(attrName);
  11776. else if (obj.getPropertyValue) {
  11777. if (Browser_1.Browser.Firefox) { //T644613
  11778. try {
  11779. return obj.getPropertyValue(attrName);
  11780. }
  11781. catch (e) {
  11782. return obj[attrName];
  11783. }
  11784. }
  11785. return obj.getPropertyValue(attrName);
  11786. }
  11787. return null;
  11788. };
  11789. Attr.GetTabIndexAttributeName = function () {
  11790. return Browser_1.Browser.IE ? "tabIndex" : "tabindex";
  11791. };
  11792. Attr.ChangeStyleAttribute = function (obj, attrName, newValue) {
  11793. Attr.ChangeAttributeExtended(obj.style, attrName, obj, "saved" + attrName, newValue);
  11794. };
  11795. Attr.ChangeAttributeExtended = function (obj, attrName, savedObj, savedAttrName, newValue) {
  11796. Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
  11797. Attr.SetAttribute(obj, attrName, newValue);
  11798. };
  11799. Attr.SaveAttribute = function (obj, attrName, savedObj, savedAttrName) {
  11800. if (!Attr.IsExistsAttribute(savedObj, savedAttrName)) {
  11801. var oldValue = Attr.IsExistsAttribute(obj, attrName) ? Attr.GetAttribute(obj, attrName) : Attr.EmptyObject;
  11802. Attr.SetAttribute(savedObj, savedAttrName, oldValue);
  11803. }
  11804. };
  11805. Attr.RestoreAttributeExtended = function (obj, attrName, savedObj, savedAttrName) {
  11806. if (Attr.IsExistsAttribute(savedObj, savedAttrName)) {
  11807. var oldValue = Attr.GetAttribute(savedObj, savedAttrName);
  11808. if (oldValue != Attr.EmptyObject)
  11809. Attr.SetAttribute(obj, attrName, oldValue);
  11810. else
  11811. Attr.RemoveAttribute(obj, attrName);
  11812. Attr.RemoveAttribute(savedObj, savedAttrName);
  11813. return true;
  11814. }
  11815. return false;
  11816. };
  11817. Attr.RemoveAttribute = function (obj, attrName) {
  11818. if (obj.removeAttribute)
  11819. obj.removeAttribute(attrName);
  11820. else if (obj.removeProperty)
  11821. obj.removeProperty(attrName);
  11822. };
  11823. Attr.IsExistsAttribute = function (obj, attrName) {
  11824. var value = Attr.GetAttribute(obj, attrName);
  11825. return (value != null) && (value !== "");
  11826. };
  11827. Attr.isSourceResetRequired = function () {
  11828. return Browser_1.Browser.IE && Browser_1.Browser.MajorVersion >= 11;
  11829. };
  11830. Attr.EmptyObject = {};
  11831. Attr.RestoreStyleAttribute = function (obj, attrName) {
  11832. return Attr.RestoreAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
  11833. };
  11834. return Attr;
  11835. }());
  11836. exports.Attr = Attr;
  11837. /***/ }),
  11838. /* 105 */
  11839. /***/ (function(module, exports, __webpack_require__) {
  11840. "use strict";
  11841. var __extends = (this && this.__extends) || (function () {
  11842. var extendStatics = function (d, b) {
  11843. extendStatics = Object.setPrototypeOf ||
  11844. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  11845. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  11846. return extendStatics(d, b);
  11847. };
  11848. return function (d, b) {
  11849. extendStatics(d, b);
  11850. function __() { this.constructor = d; }
  11851. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11852. };
  11853. })();
  11854. Object.defineProperty(exports, "__esModule", { value: true });
  11855. var ConnectorPointsCalculatorBase_1 = __webpack_require__(71);
  11856. var ConnectorRenderPoint_1 = __webpack_require__(27);
  11857. var ConnectorPointsCalculator = /** @class */ (function (_super) {
  11858. __extends(ConnectorPointsCalculator, _super);
  11859. function ConnectorPointsCalculator() {
  11860. return _super !== null && _super.apply(this, arguments) || this;
  11861. }
  11862. ConnectorPointsCalculator.prototype.getPoints = function () {
  11863. return this.connector.points.map(function (pt, index) { return new ConnectorRenderPoint_1.ConnectorRenderPoint(pt.x, pt.y, index); });
  11864. };
  11865. return ConnectorPointsCalculator;
  11866. }(ConnectorPointsCalculatorBase_1.ConnectorPointsCalculatorBase));
  11867. exports.ConnectorPointsCalculator = ConnectorPointsCalculator;
  11868. /***/ }),
  11869. /* 106 */
  11870. /***/ (function(module, exports, __webpack_require__) {
  11871. "use strict";
  11872. var __extends = (this && this.__extends) || (function () {
  11873. var extendStatics = function (d, b) {
  11874. extendStatics = Object.setPrototypeOf ||
  11875. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  11876. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  11877. return extendStatics(d, b);
  11878. };
  11879. return function (d, b) {
  11880. extendStatics(d, b);
  11881. function __() { this.constructor = d; }
  11882. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  11883. };
  11884. })();
  11885. Object.defineProperty(exports, "__esModule", { value: true });
  11886. var Utils_1 = __webpack_require__(0);
  11887. var DiagramItem_1 = __webpack_require__(3);
  11888. var ConnectorPointsCalculatorBase_1 = __webpack_require__(71);
  11889. var ConnectorPointsOrthogonalUndefinedSideCalculator_1 = __webpack_require__(107);
  11890. var ConnectorPointsOrthogonalSouthSideCalculator_1 = __webpack_require__(108);
  11891. var ConnectorPointsOrthogonalNorthSideCalculator_1 = __webpack_require__(109);
  11892. var ConnectorPointsOrthogonalEastSideCalculator_1 = __webpack_require__(110);
  11893. var ConnectorPointsOrthogonalWestSideCalculator_1 = __webpack_require__(111);
  11894. var ConnectorRenderPoint_1 = __webpack_require__(27);
  11895. var ConnectorPointsOrthogonalCalculator = /** @class */ (function (_super) {
  11896. __extends(ConnectorPointsOrthogonalCalculator, _super);
  11897. function ConnectorPointsOrthogonalCalculator(connector) {
  11898. var _this = _super.call(this, connector) || this;
  11899. _this.sideCalculators = {};
  11900. _this.sideCalculators[DiagramItem_1.ConnectionPointSide.Undefined] = new ConnectorPointsOrthogonalUndefinedSideCalculator_1.ConnectorPointsOrthogonalUndefinedSideCalculator(_this);
  11901. _this.sideCalculators[DiagramItem_1.ConnectionPointSide.South] = new ConnectorPointsOrthogonalSouthSideCalculator_1.ConnectorPointsOrthogonalSouthSideCalculator(_this);
  11902. _this.sideCalculators[DiagramItem_1.ConnectionPointSide.North] = new ConnectorPointsOrthogonalNorthSideCalculator_1.ConnectorPointsOrthogonalNorthSideCalculator(_this);
  11903. _this.sideCalculators[DiagramItem_1.ConnectionPointSide.East] = new ConnectorPointsOrthogonalEastSideCalculator_1.ConnectorPointsOrthogonalEastSideCalculator(_this);
  11904. _this.sideCalculators[DiagramItem_1.ConnectionPointSide.West] = new ConnectorPointsOrthogonalWestSideCalculator_1.ConnectorPointsOrthogonalWestSideCalculator(_this);
  11905. return _this;
  11906. }
  11907. Object.defineProperty(ConnectorPointsOrthogonalCalculator.prototype, "beginRect", {
  11908. get: function () { return this.connector.beginItem ? this.connector.beginItem.rectangle : undefined; },
  11909. enumerable: true,
  11910. configurable: true
  11911. });
  11912. Object.defineProperty(ConnectorPointsOrthogonalCalculator.prototype, "endRect", {
  11913. get: function () { return this.connector.endItem ? this.connector.endItem.rectangle : undefined; },
  11914. enumerable: true,
  11915. configurable: true
  11916. });
  11917. ConnectorPointsOrthogonalCalculator.prototype.getPoints = function () {
  11918. var points = this.connector.points.map(function (pt, index) { return new ConnectorRenderPoint_1.ConnectorRenderPoint(pt.x, pt.y, index); });
  11919. this.removeUnnecessaryLinePoints(points);
  11920. var beginIndex = 0, endIndex = points.length - 1;
  11921. var beginSide = this.getPointSide(points, 0);
  11922. var beginNextSide = this.getPointSide(points, 1);
  11923. var endSide = this.getPointSide(points, points.length - 1);
  11924. var endPrevSide = this.getPointSide(points, points.length - 1 - 1);
  11925. var beginSideCalculator = this.getSideCalculator(beginSide);
  11926. var endSideCalculator = this.getSideCalculator(endSide);
  11927. var originRect = this.beginRect;
  11928. var originPoint = beginSideCalculator.getCorrectOriginPoint(points[beginIndex], originRect);
  11929. var targetPoint = points[beginIndex + 1];
  11930. if (points.length === 2 && beginSideCalculator.isOnSidePoint(originPoint, targetPoint) &&
  11931. beginSideCalculator.isDirectConnectionAllowed(beginNextSide, originPoint, targetPoint)) {
  11932. var directConnectionPoints = beginSideCalculator.getDirectConnectionPoints(originPoint, targetPoint);
  11933. directConnectionPoints.forEach(function (pt) {
  11934. points.splice(beginIndex + 1, 0, pt);
  11935. beginIndex++;
  11936. endIndex++;
  11937. });
  11938. }
  11939. else {
  11940. var bOffsetPoints = beginSideCalculator.getBeginOffsetPoints(beginNextSide, points[beginIndex], points[beginIndex + 1], this.beginRect);
  11941. bOffsetPoints.forEach(function (pt) {
  11942. points.splice(beginIndex + 1, 0, pt);
  11943. });
  11944. beginIndex += bOffsetPoints.length;
  11945. endIndex += bOffsetPoints.length;
  11946. var eOffsetPoints = endSideCalculator.getEndOffsetPoints(endPrevSide, points[endIndex], points[endIndex - 1], this.endRect);
  11947. eOffsetPoints.forEach(function (pt, index) {
  11948. points.splice(endIndex + index, 0, pt);
  11949. });
  11950. for (var index = beginIndex; index < endIndex; index++) {
  11951. var nextIndex = index + 1;
  11952. var middlePoint = this.getMiddlePoint(points[index], points[index - 1], index - 1 === 0, points[nextIndex], points[nextIndex + 1], nextIndex + 1 === points.length - 1);
  11953. if (middlePoint !== undefined) {
  11954. points.splice(index + 1, 0, middlePoint);
  11955. index++;
  11956. endIndex++;
  11957. }
  11958. }
  11959. }
  11960. this.removeUnnecessaryLinePoints(points);
  11961. return points;
  11962. };
  11963. ConnectorPointsOrthogonalCalculator.prototype.getSideCalculator = function (side) {
  11964. return this.sideCalculators[side];
  11965. };
  11966. ConnectorPointsOrthogonalCalculator.prototype.getPointSide = function (points, index) {
  11967. if (index === 0 && this.connector.beginItem) {
  11968. var connectionPointIndex = this.connector.beginConnectionPointIndex;
  11969. return this.connector.beginItem.getConnectionPointSide(connectionPointIndex, points[1]);
  11970. }
  11971. if (index === points.length - 1 && this.connector.endItem) {
  11972. var connectionPointIndex = this.connector.endConnectionPointIndex;
  11973. return this.connector.endItem.getConnectionPointSide(connectionPointIndex, points[points.length - 2]);
  11974. }
  11975. return DiagramItem_1.ConnectionPointSide.Undefined;
  11976. };
  11977. ConnectorPointsOrthogonalCalculator.prototype.getMiddlePoints = function (point1, point2) {
  11978. if (point1.x === point2.x || point1.y === point2.y)
  11979. return [];
  11980. return [
  11981. new ConnectorRenderPoint_1.ConnectorRenderPoint(point1.x, point2.y),
  11982. new ConnectorRenderPoint_1.ConnectorRenderPoint(point2.x, point1.y)
  11983. ];
  11984. };
  11985. ConnectorPointsOrthogonalCalculator.prototype.getMiddlePoint = function (point1, directionPoint1, nextToBegin, point2, directionPoint2, nextToEnd) {
  11986. var _this = this;
  11987. var point;
  11988. var points = this.getMiddlePoints(point1, point2);
  11989. points.forEach(function (pt) {
  11990. var rect1 = _this.createPointsRect(point1, pt);
  11991. var rect2 = _this.createPointsRect(pt, point2);
  11992. var itemRect1 = _this.connector.beginItem ? _this.connector.beginItem.rectangle : undefined;
  11993. var itemRect2 = _this.connector.endItem ? _this.connector.endItem.rectangle : undefined;
  11994. if (itemRect1) {
  11995. if (itemRect1.intersect(rect1) || itemRect1.intersect(rect2))
  11996. return;
  11997. }
  11998. if (itemRect2) {
  11999. if (itemRect2.intersect(rect1) || itemRect2.intersect(rect2))
  12000. return;
  12001. }
  12002. if ((!_this.isReturnPoint(pt, point1, directionPoint1) || _this.isIntermediatePoints(point1, directionPoint1)) &&
  12003. (!_this.isReturnPoint(pt, point2, directionPoint2) || _this.isIntermediatePoints(point2, directionPoint2))) {
  12004. if (point === undefined)
  12005. point = pt;
  12006. else if (_this.isPriorMiddlePoint(pt, point1, directionPoint1, point2, directionPoint2))
  12007. point = pt;
  12008. }
  12009. });
  12010. if (point === undefined && points.length > 0)
  12011. point = points[0];
  12012. return point;
  12013. };
  12014. ConnectorPointsOrthogonalCalculator.prototype.createPointsRect = function (point1, point2) {
  12015. var result = Utils_1.Rectangle.createByPoints(point1, point2);
  12016. if (result.width > 0)
  12017. result = result.inflate(-1, 0);
  12018. if (result.height > 0)
  12019. result = result.inflate(0, -1);
  12020. return result;
  12021. };
  12022. ConnectorPointsOrthogonalCalculator.prototype.isPriorMiddlePoint = function (point, point1, directionPoint1, point2, directionPoint2) {
  12023. if (directionPoint1) {
  12024. if (point.x === directionPoint1.x || point.y === directionPoint1.y)
  12025. return true;
  12026. }
  12027. if (directionPoint2) {
  12028. if (point.x === directionPoint2.x || point.y === directionPoint2.y)
  12029. return true;
  12030. }
  12031. return false;
  12032. };
  12033. ConnectorPointsOrthogonalCalculator.prototype.isReturnPoint = function (point, point1, point2) {
  12034. if (point1 !== undefined && point2 !== undefined) {
  12035. if (point.x === point2.x)
  12036. if (point1.y < point.y && point.y < point2.y || point1.y > point.y && point.y > point2.y)
  12037. return true;
  12038. if (point.y === point2.y)
  12039. if (point1.x < point.x && point.x < point2.x || point1.x > point.x && point.x > point2.x)
  12040. return true;
  12041. }
  12042. return false;
  12043. };
  12044. ConnectorPointsOrthogonalCalculator.prototype.isIntermediatePoints = function (point1, point2) {
  12045. return 0 < point1.pointIndex && point1.pointIndex < this.connector.points.length - 1 &&
  12046. 0 < point2.pointIndex && point2.pointIndex < this.connector.points.length - 1;
  12047. };
  12048. ConnectorPointsOrthogonalCalculator.prototype.removeUnnecessaryLinePoints = function (points) {
  12049. Utils_1.GeometryUtils.removeUnnecessaryLinePoints(points, function (pt, index) {
  12050. if (pt.pointIndex === -1) {
  12051. points.splice(index, 1);
  12052. return true;
  12053. }
  12054. else {
  12055. pt.skipped = true;
  12056. return false;
  12057. }
  12058. }, function (pt) {
  12059. return pt !== undefined && !pt.skipped;
  12060. });
  12061. };
  12062. return ConnectorPointsOrthogonalCalculator;
  12063. }(ConnectorPointsCalculatorBase_1.ConnectorPointsCalculatorBase));
  12064. exports.ConnectorPointsOrthogonalCalculator = ConnectorPointsOrthogonalCalculator;
  12065. /***/ }),
  12066. /* 107 */
  12067. /***/ (function(module, exports, __webpack_require__) {
  12068. "use strict";
  12069. var __extends = (this && this.__extends) || (function () {
  12070. var extendStatics = function (d, b) {
  12071. extendStatics = Object.setPrototypeOf ||
  12072. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  12073. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  12074. return extendStatics(d, b);
  12075. };
  12076. return function (d, b) {
  12077. extendStatics(d, b);
  12078. function __() { this.constructor = d; }
  12079. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12080. };
  12081. })();
  12082. Object.defineProperty(exports, "__esModule", { value: true });
  12083. var ConnectorPointsOrthogonalSideCalculatorBase_1 = __webpack_require__(33);
  12084. var ConnectorRenderPoint_1 = __webpack_require__(27);
  12085. var ConnectorPointsOrthogonalUndefinedSideCalculator = /** @class */ (function (_super) {
  12086. __extends(ConnectorPointsOrthogonalUndefinedSideCalculator, _super);
  12087. function ConnectorPointsOrthogonalUndefinedSideCalculator(parent) {
  12088. return _super.call(this, parent) || this;
  12089. }
  12090. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getCorrectOriginPoint = function (originPoint, originRect) {
  12091. return originPoint;
  12092. };
  12093. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getSameShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12094. return [];
  12095. };
  12096. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getOverlappedPointsOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12097. return [];
  12098. };
  12099. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getBeginOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12100. return [];
  12101. };
  12102. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getEndOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12103. return [];
  12104. };
  12105. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getBeginOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12106. return [];
  12107. };
  12108. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getEndOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12109. return [];
  12110. };
  12111. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getBeginOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12112. return [];
  12113. };
  12114. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getEndOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12115. return [];
  12116. };
  12117. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.isOnSidePoint = function (originPoint, targetPoint) {
  12118. return true;
  12119. };
  12120. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.isDirectConnectionAllowed = function (targetSide, originPoint, targetPoint) {
  12121. var calculator = this.getSideCalculator(originPoint, targetPoint);
  12122. if (calculator !== undefined)
  12123. return calculator.isDirectConnectionAllowed(targetSide, originPoint, targetPoint);
  12124. return true;
  12125. };
  12126. ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getDirectConnectionPoints = function (originPoint, targetPoint) {
  12127. var diffX = Math.abs(targetPoint.x - originPoint.x);
  12128. var diffY = Math.abs(targetPoint.y - originPoint.y);
  12129. if (diffX > diffY) {
  12130. var minX = Math.min(originPoint.x, targetPoint.x);
  12131. var cx = minX + diffX / 2;
  12132. return [
  12133. new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, originPoint.y),
  12134. new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, targetPoint.y)
  12135. ];
  12136. }
  12137. else {
  12138. var minY = Math.min(originPoint.y, targetPoint.y);
  12139. var cy = minY + diffY / 2;
  12140. return [
  12141. new ConnectorRenderPoint_1.ConnectorRenderPoint(originPoint.x, cy),
  12142. new ConnectorRenderPoint_1.ConnectorRenderPoint(targetPoint.x, cy)
  12143. ];
  12144. }
  12145. };
  12146. return ConnectorPointsOrthogonalUndefinedSideCalculator;
  12147. }(ConnectorPointsOrthogonalSideCalculatorBase_1.ConnectorPointsOrthogonalSideCalculatorBase));
  12148. exports.ConnectorPointsOrthogonalUndefinedSideCalculator = ConnectorPointsOrthogonalUndefinedSideCalculator;
  12149. /***/ }),
  12150. /* 108 */
  12151. /***/ (function(module, exports, __webpack_require__) {
  12152. "use strict";
  12153. var __extends = (this && this.__extends) || (function () {
  12154. var extendStatics = function (d, b) {
  12155. extendStatics = Object.setPrototypeOf ||
  12156. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  12157. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  12158. return extendStatics(d, b);
  12159. };
  12160. return function (d, b) {
  12161. extendStatics(d, b);
  12162. function __() { this.constructor = d; }
  12163. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12164. };
  12165. })();
  12166. Object.defineProperty(exports, "__esModule", { value: true });
  12167. var DiagramItem_1 = __webpack_require__(3);
  12168. var ConnectorPointsOrthogonalSideCalculatorBase_1 = __webpack_require__(33);
  12169. var ConnectorRenderPoint_1 = __webpack_require__(27);
  12170. var ConnectorPointsOrthogonalSouthSideCalculator = /** @class */ (function (_super) {
  12171. __extends(ConnectorPointsOrthogonalSouthSideCalculator, _super);
  12172. function ConnectorPointsOrthogonalSouthSideCalculator(parent) {
  12173. return _super.call(this, parent) || this;
  12174. }
  12175. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getCorrectOriginPoint = function (originPoint, originRect) {
  12176. if (originPoint.y < originRect.bottom)
  12177. originPoint = originPoint.offset(0, originRect.bottom - originPoint.y);
  12178. return originPoint;
  12179. };
  12180. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getSameShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12181. switch (targetSide) {
  12182. case DiagramItem_1.ConnectionPointSide.East:
  12183. case DiagramItem_1.ConnectionPointSide.West:
  12184. case DiagramItem_1.ConnectionPointSide.South:
  12185. return [originPoint.offset(0, this.getMinOffset())];
  12186. case DiagramItem_1.ConnectionPointSide.North:
  12187. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset());
  12188. }
  12189. };
  12190. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getOverlappedPointsOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12191. switch (targetSide) {
  12192. case DiagramItem_1.ConnectionPointSide.South:
  12193. return [originPoint.offset(0, this.getMinOffset())];
  12194. case DiagramItem_1.ConnectionPointSide.North:
  12195. return [originPoint.offset(0, -this.getMinOffset())];
  12196. }
  12197. return [];
  12198. };
  12199. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getBeginOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12200. switch (targetSide) {
  12201. case DiagramItem_1.ConnectionPointSide.East:
  12202. if (originPoint.y < targetPoint.y) {
  12203. if (originPoint.x > targetPoint.x)
  12204. return [];
  12205. else
  12206. return [originPoint.offset(0, this.getMinOffset())];
  12207. }
  12208. if (originPoint.y > this.endRect.bottom)
  12209. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
  12210. return [originPoint.offset(0, this.getMinOffset())];
  12211. case DiagramItem_1.ConnectionPointSide.West:
  12212. if (originPoint.y < targetPoint.y) {
  12213. if (originPoint.x < targetPoint.x)
  12214. return [];
  12215. else
  12216. return [originPoint.offset(0, this.getMinOffset())];
  12217. }
  12218. if (originPoint.y > this.endRect.bottom)
  12219. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
  12220. return [originPoint.offset(0, this.getMinOffset())];
  12221. case DiagramItem_1.ConnectionPointSide.South:
  12222. return [originPoint.offset(0, this.getMinOffset())];
  12223. case DiagramItem_1.ConnectionPointSide.North:
  12224. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), originPoint.x < targetPoint.x);
  12225. }
  12226. };
  12227. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getEndOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12228. switch (targetSide) {
  12229. case DiagramItem_1.ConnectionPointSide.East:
  12230. if (targetPoint.y < originPoint.y)
  12231. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
  12232. if (originPoint.x < targetPoint.x)
  12233. return [originPoint.offset(0, this.getMinOffset())];
  12234. return [];
  12235. case DiagramItem_1.ConnectionPointSide.West:
  12236. if (targetPoint.y < originPoint.y)
  12237. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
  12238. if (originPoint.x > targetPoint.x)
  12239. return [originPoint.offset(0, this.getMinOffset())];
  12240. return [];
  12241. case DiagramItem_1.ConnectionPointSide.South:
  12242. return [originPoint.offset(0, this.getMinOffset())];
  12243. case DiagramItem_1.ConnectionPointSide.North:
  12244. var offset = this.getMinOffset();
  12245. if (this.beginRect.bottom > originPoint.y)
  12246. offset += this.beginRect.bottom - originPoint.y;
  12247. return [originPoint.offset(0, offset)];
  12248. }
  12249. };
  12250. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getBeginOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12251. return [originPoint.offset(0, this.getScaleableOffsetY(originPoint, targetPoint, false))];
  12252. };
  12253. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getEndOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12254. return [originPoint.offset(0, this.getScaleableOffsetY(originPoint, targetPoint, true))];
  12255. };
  12256. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getBeginOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12257. switch (targetSide) {
  12258. case DiagramItem_1.ConnectionPointSide.East:
  12259. if (this.isBeginEndOverlappedX())
  12260. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, false);
  12261. break;
  12262. case DiagramItem_1.ConnectionPointSide.West:
  12263. if (this.isBeginEndOverlappedX())
  12264. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, true);
  12265. break;
  12266. case DiagramItem_1.ConnectionPointSide.South:
  12267. if (this.isBeginEndOverlappedX())
  12268. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
  12269. break;
  12270. case DiagramItem_1.ConnectionPointSide.Undefined:
  12271. case DiagramItem_1.ConnectionPointSide.North:
  12272. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
  12273. }
  12274. return [originPoint.offset(0, this.getScaleableOffsetY(originPoint, targetPoint, false))];
  12275. };
  12276. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getEndOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12277. if (targetSide === DiagramItem_1.ConnectionPointSide.Undefined)
  12278. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true);
  12279. else if (this.isBeginEndOverlappedX()) {
  12280. var direction = this.beginRect.center.x > this.endRect.center.x;
  12281. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true, direction);
  12282. }
  12283. return [originPoint.offset(0, this.getScaleableOffsetY(originPoint, targetPoint, true))];
  12284. };
  12285. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getAsideOffsetPoints = function (originPoint, targetPoint, originRect, offset, asideOffset, direction) {
  12286. var points = [];
  12287. if (originRect !== undefined) {
  12288. if (direction === undefined)
  12289. direction = targetPoint.x < originPoint.x;
  12290. if (direction)
  12291. points.push(originPoint.offset(-(originPoint.x - originRect.left + asideOffset), offset));
  12292. else
  12293. points.push(originPoint.offset((originRect.right - originPoint.x + asideOffset), offset));
  12294. }
  12295. points.push(originPoint.offset(0, offset));
  12296. return points;
  12297. };
  12298. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getScaleableAsideOffsetPoints = function (originPoint, targetPoint, originRect, isEnd, direction) {
  12299. var offset = this.getScaleableOffsetY(originPoint, targetPoint, isEnd);
  12300. var asideOffset = this.getScaleableOffsetX(originPoint, targetPoint, isEnd);
  12301. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, offset, asideOffset, direction);
  12302. };
  12303. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getScaleableOffsetX = function (originPoint, targetPoint, isEnd) {
  12304. if (this.beginRect && this.endRect) {
  12305. if (!isEnd && !this.isBeginEndOverlappedX()) {
  12306. var distance = void 0;
  12307. if (targetPoint.x < originPoint.x)
  12308. distance = this.beginRect.left - this.endRect.right;
  12309. else
  12310. distance = this.endRect.left - this.beginRect.right;
  12311. if (distance < this.getMinOffset() * 2)
  12312. return distance / 2;
  12313. }
  12314. }
  12315. return this.getMinOffset();
  12316. };
  12317. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getScaleableOffsetY = function (originPoint, targetPoint, isEnd) {
  12318. if (this.beginRect && this.endRect) {
  12319. var distance = isEnd ? this.beginRect.top - originPoint.y : this.endRect.top - originPoint.y;
  12320. if (distance > 0 && distance < this.getMinOffset() * 2)
  12321. return distance / 2;
  12322. }
  12323. return this.getMinOffset();
  12324. };
  12325. ConnectorPointsOrthogonalSouthSideCalculator.prototype.isOnSidePoint = function (originPoint, targetPoint) {
  12326. return targetPoint.y > originPoint.y;
  12327. };
  12328. ConnectorPointsOrthogonalSouthSideCalculator.prototype.isDirectConnectionAllowed = function (targetSide, originPoint, targetPoint) {
  12329. return targetSide === DiagramItem_1.ConnectionPointSide.North || targetSide === DiagramItem_1.ConnectionPointSide.Undefined;
  12330. };
  12331. ConnectorPointsOrthogonalSouthSideCalculator.prototype.getDirectConnectionPoints = function (originPoint, targetPoint) {
  12332. var cy = originPoint.y + (targetPoint.y - originPoint.y) / 2;
  12333. return [
  12334. new ConnectorRenderPoint_1.ConnectorRenderPoint(originPoint.x, cy),
  12335. new ConnectorRenderPoint_1.ConnectorRenderPoint(targetPoint.x, cy)
  12336. ];
  12337. };
  12338. return ConnectorPointsOrthogonalSouthSideCalculator;
  12339. }(ConnectorPointsOrthogonalSideCalculatorBase_1.ConnectorPointsOrthogonalSideCalculatorBase));
  12340. exports.ConnectorPointsOrthogonalSouthSideCalculator = ConnectorPointsOrthogonalSouthSideCalculator;
  12341. /***/ }),
  12342. /* 109 */
  12343. /***/ (function(module, exports, __webpack_require__) {
  12344. "use strict";
  12345. var __extends = (this && this.__extends) || (function () {
  12346. var extendStatics = function (d, b) {
  12347. extendStatics = Object.setPrototypeOf ||
  12348. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  12349. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  12350. return extendStatics(d, b);
  12351. };
  12352. return function (d, b) {
  12353. extendStatics(d, b);
  12354. function __() { this.constructor = d; }
  12355. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12356. };
  12357. })();
  12358. Object.defineProperty(exports, "__esModule", { value: true });
  12359. var DiagramItem_1 = __webpack_require__(3);
  12360. var ConnectorPointsOrthogonalSideCalculatorBase_1 = __webpack_require__(33);
  12361. var ConnectorRenderPoint_1 = __webpack_require__(27);
  12362. var ConnectorPointsOrthogonalNorthSideCalculator = /** @class */ (function (_super) {
  12363. __extends(ConnectorPointsOrthogonalNorthSideCalculator, _super);
  12364. function ConnectorPointsOrthogonalNorthSideCalculator(parent) {
  12365. return _super.call(this, parent) || this;
  12366. }
  12367. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getCorrectOriginPoint = function (originPoint, originRect) {
  12368. if (originPoint.y > originRect.top)
  12369. originPoint = originPoint.offset(0, originRect.top - originPoint.y);
  12370. return originPoint;
  12371. };
  12372. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getSameShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12373. switch (targetSide) {
  12374. case DiagramItem_1.ConnectionPointSide.East:
  12375. case DiagramItem_1.ConnectionPointSide.West:
  12376. case DiagramItem_1.ConnectionPointSide.North:
  12377. return [originPoint.offset(0, -this.getMinOffset())];
  12378. case DiagramItem_1.ConnectionPointSide.South:
  12379. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset());
  12380. }
  12381. };
  12382. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getOverlappedPointsOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12383. switch (targetSide) {
  12384. case DiagramItem_1.ConnectionPointSide.South:
  12385. return [originPoint.offset(0, this.getMinOffset())];
  12386. case DiagramItem_1.ConnectionPointSide.North:
  12387. return [originPoint.offset(0, -this.getMinOffset())];
  12388. }
  12389. return [];
  12390. };
  12391. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getBeginOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12392. switch (targetSide) {
  12393. case DiagramItem_1.ConnectionPointSide.East:
  12394. if (originPoint.y > targetPoint.y) {
  12395. if (originPoint.x > targetPoint.x)
  12396. return [];
  12397. else
  12398. return [originPoint.offset(0, -this.getMinOffset())];
  12399. }
  12400. if (originPoint.y < this.endRect.top)
  12401. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
  12402. return [originPoint.offset(0, -this.getMinOffset())];
  12403. case DiagramItem_1.ConnectionPointSide.West:
  12404. if (originPoint.y > targetPoint.y) {
  12405. if (originPoint.x < targetPoint.x)
  12406. return [];
  12407. else
  12408. return [originPoint.offset(0, -this.getMinOffset())];
  12409. }
  12410. if (originPoint.y < this.endRect.top)
  12411. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
  12412. return [originPoint.offset(0, -this.getMinOffset())];
  12413. case DiagramItem_1.ConnectionPointSide.North:
  12414. return [originPoint.offset(0, -this.getMinOffset())];
  12415. case DiagramItem_1.ConnectionPointSide.South:
  12416. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), originPoint.x < targetPoint.x);
  12417. }
  12418. };
  12419. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getEndOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12420. switch (targetSide) {
  12421. case DiagramItem_1.ConnectionPointSide.East:
  12422. if (targetPoint.y > originPoint.y)
  12423. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
  12424. if (originPoint.x < targetPoint.x)
  12425. return [originPoint.offset(0, -this.getMinOffset())];
  12426. return [];
  12427. case DiagramItem_1.ConnectionPointSide.West:
  12428. if (targetPoint.y > originPoint.y)
  12429. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
  12430. if (originPoint.x > targetPoint.x)
  12431. return [originPoint.offset(0, -this.getMinOffset())];
  12432. return [];
  12433. case DiagramItem_1.ConnectionPointSide.North:
  12434. return [originPoint.offset(0, -this.getMinOffset())];
  12435. case DiagramItem_1.ConnectionPointSide.South:
  12436. var offset = -this.getMinOffset();
  12437. if (this.beginRect.top < originPoint.y)
  12438. offset -= originPoint.y - this.beginRect.top;
  12439. return [originPoint.offset(0, offset)];
  12440. }
  12441. };
  12442. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getBeginOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12443. return [originPoint.offset(0, -this.getScaleableOffsetY(originPoint, targetPoint, false))];
  12444. };
  12445. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getEndOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12446. return [originPoint.offset(0, -this.getScaleableOffsetY(originPoint, targetPoint, true))];
  12447. };
  12448. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getBeginOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12449. switch (targetSide) {
  12450. case DiagramItem_1.ConnectionPointSide.East:
  12451. if (this.isBeginEndOverlappedX())
  12452. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, false);
  12453. break;
  12454. case DiagramItem_1.ConnectionPointSide.West:
  12455. if (this.isBeginEndOverlappedX())
  12456. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, true);
  12457. break;
  12458. case DiagramItem_1.ConnectionPointSide.North:
  12459. if (this.isBeginEndOverlappedX())
  12460. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
  12461. break;
  12462. case DiagramItem_1.ConnectionPointSide.Undefined:
  12463. case DiagramItem_1.ConnectionPointSide.South:
  12464. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
  12465. }
  12466. return [originPoint.offset(0, -this.getScaleableOffsetY(originPoint, targetPoint, false))];
  12467. };
  12468. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getEndOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12469. if (targetSide === DiagramItem_1.ConnectionPointSide.Undefined)
  12470. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true);
  12471. else if (this.isBeginEndOverlappedX()) {
  12472. var direction = this.beginRect.center.x > this.endRect.center.x;
  12473. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true, direction);
  12474. }
  12475. return [originPoint.offset(0, -this.getScaleableOffsetY(originPoint, targetPoint, true))];
  12476. };
  12477. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getAsideOffsetPoints = function (originPoint, targetPoint, originRect, offset, asideOffset, direction) {
  12478. var points = [];
  12479. if (originRect !== undefined) {
  12480. if (direction === undefined)
  12481. direction = targetPoint.x < originPoint.x;
  12482. if (direction)
  12483. points.push(originPoint.offset(-(originPoint.x - originRect.left + asideOffset), -offset));
  12484. else
  12485. points.push(originPoint.offset((originRect.right - originPoint.x + asideOffset), -offset));
  12486. }
  12487. points.push(originPoint.offset(0, -offset));
  12488. return points;
  12489. };
  12490. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getScaleableAsideOffsetPoints = function (originPoint, targetPoint, originRect, isEnd, direction) {
  12491. var offset = this.getScaleableOffsetY(originPoint, targetPoint, isEnd);
  12492. var asideOffset = this.getScaleableOffsetX(originPoint, targetPoint, isEnd);
  12493. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, offset, asideOffset, direction);
  12494. };
  12495. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getScaleableOffsetX = function (originPoint, targetPoint, isEnd) {
  12496. if (this.beginRect && this.endRect) {
  12497. if (!isEnd && !this.isBeginEndOverlappedX()) {
  12498. var distance = void 0;
  12499. if (targetPoint.x < originPoint.x)
  12500. distance = this.beginRect.left - this.endRect.right;
  12501. else
  12502. distance = this.endRect.left - this.beginRect.right;
  12503. if (distance < this.getMinOffset() * 2)
  12504. return distance / 2;
  12505. }
  12506. }
  12507. return this.getMinOffset();
  12508. };
  12509. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getScaleableOffsetY = function (originPoint, targetPoint, isEnd) {
  12510. if (this.beginRect && this.endRect) {
  12511. var distance = isEnd ? originPoint.y - this.beginRect.bottom : originPoint.y - this.endRect.bottom;
  12512. if (distance > 0 && distance < this.getMinOffset() * 2)
  12513. return distance / 2;
  12514. }
  12515. return this.getMinOffset();
  12516. };
  12517. ConnectorPointsOrthogonalNorthSideCalculator.prototype.isOnSidePoint = function (originPoint, targetPoint) {
  12518. return targetPoint.y < originPoint.y;
  12519. };
  12520. ConnectorPointsOrthogonalNorthSideCalculator.prototype.isDirectConnectionAllowed = function (targetSide, originPoint, targetPoint) {
  12521. return targetSide === DiagramItem_1.ConnectionPointSide.South || targetSide === DiagramItem_1.ConnectionPointSide.Undefined;
  12522. };
  12523. ConnectorPointsOrthogonalNorthSideCalculator.prototype.getDirectConnectionPoints = function (originPoint, targetPoint) {
  12524. var cy = targetPoint.y + (originPoint.y - targetPoint.y) / 2;
  12525. return [
  12526. new ConnectorRenderPoint_1.ConnectorRenderPoint(originPoint.x, cy),
  12527. new ConnectorRenderPoint_1.ConnectorRenderPoint(targetPoint.x, cy)
  12528. ];
  12529. };
  12530. return ConnectorPointsOrthogonalNorthSideCalculator;
  12531. }(ConnectorPointsOrthogonalSideCalculatorBase_1.ConnectorPointsOrthogonalSideCalculatorBase));
  12532. exports.ConnectorPointsOrthogonalNorthSideCalculator = ConnectorPointsOrthogonalNorthSideCalculator;
  12533. /***/ }),
  12534. /* 110 */
  12535. /***/ (function(module, exports, __webpack_require__) {
  12536. "use strict";
  12537. var __extends = (this && this.__extends) || (function () {
  12538. var extendStatics = function (d, b) {
  12539. extendStatics = Object.setPrototypeOf ||
  12540. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  12541. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  12542. return extendStatics(d, b);
  12543. };
  12544. return function (d, b) {
  12545. extendStatics(d, b);
  12546. function __() { this.constructor = d; }
  12547. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12548. };
  12549. })();
  12550. Object.defineProperty(exports, "__esModule", { value: true });
  12551. var DiagramItem_1 = __webpack_require__(3);
  12552. var ConnectorPointsOrthogonalSideCalculatorBase_1 = __webpack_require__(33);
  12553. var ConnectorRenderPoint_1 = __webpack_require__(27);
  12554. var ConnectorPointsOrthogonalEastSideCalculator = /** @class */ (function (_super) {
  12555. __extends(ConnectorPointsOrthogonalEastSideCalculator, _super);
  12556. function ConnectorPointsOrthogonalEastSideCalculator(parent) {
  12557. return _super.call(this, parent) || this;
  12558. }
  12559. ConnectorPointsOrthogonalEastSideCalculator.prototype.getCorrectOriginPoint = function (originPoint, originRect) {
  12560. if (originPoint.x < originRect.right)
  12561. originPoint = originPoint.offset(originRect.right - originPoint.x, 0);
  12562. return originPoint;
  12563. };
  12564. ConnectorPointsOrthogonalEastSideCalculator.prototype.getSameShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12565. switch (targetSide) {
  12566. case DiagramItem_1.ConnectionPointSide.North:
  12567. case DiagramItem_1.ConnectionPointSide.South:
  12568. case DiagramItem_1.ConnectionPointSide.East:
  12569. return [originPoint.offset(this.getMinOffset(), 0)];
  12570. case DiagramItem_1.ConnectionPointSide.West:
  12571. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset());
  12572. }
  12573. };
  12574. ConnectorPointsOrthogonalEastSideCalculator.prototype.getOverlappedPointsOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12575. switch (targetSide) {
  12576. case DiagramItem_1.ConnectionPointSide.East:
  12577. return [originPoint.offset(this.getMinOffset(), 0)];
  12578. case DiagramItem_1.ConnectionPointSide.West:
  12579. return [originPoint.offset(-this.getMinOffset(), 0)];
  12580. }
  12581. return [];
  12582. };
  12583. ConnectorPointsOrthogonalEastSideCalculator.prototype.getBeginOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12584. switch (targetSide) {
  12585. case DiagramItem_1.ConnectionPointSide.North:
  12586. if (originPoint.x < targetPoint.x) {
  12587. if (originPoint.y < targetPoint.y)
  12588. return [];
  12589. else
  12590. return [originPoint.offset(this.getMinOffset(), 0)];
  12591. }
  12592. if (originPoint.x > this.endRect.right)
  12593. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
  12594. return [originPoint.offset(this.getMinOffset(), 0)];
  12595. case DiagramItem_1.ConnectionPointSide.South:
  12596. if (originPoint.x < targetPoint.x) {
  12597. if (originPoint.y > targetPoint.y)
  12598. return [];
  12599. else
  12600. return [originPoint.offset(this.getMinOffset(), 0)];
  12601. }
  12602. if (originPoint.x > this.endRect.right)
  12603. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
  12604. return [originPoint.offset(this.getMinOffset(), 0)];
  12605. case DiagramItem_1.ConnectionPointSide.East:
  12606. return [originPoint.offset(this.getMinOffset(), 0)];
  12607. case DiagramItem_1.ConnectionPointSide.West:
  12608. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), originPoint.y < targetPoint.y);
  12609. }
  12610. };
  12611. ConnectorPointsOrthogonalEastSideCalculator.prototype.getEndOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12612. switch (targetSide) {
  12613. case DiagramItem_1.ConnectionPointSide.East:
  12614. return [originPoint.offset(this.getMinOffset(), 0)];
  12615. case DiagramItem_1.ConnectionPointSide.West:
  12616. var offset = this.getMinOffset();
  12617. if (this.beginRect.right > originPoint.x)
  12618. offset += this.beginRect.right - originPoint.x;
  12619. return [originPoint.offset(offset, 0)];
  12620. case DiagramItem_1.ConnectionPointSide.North:
  12621. if (targetPoint.x < originPoint.x)
  12622. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
  12623. if (originPoint.y > targetPoint.y)
  12624. return [originPoint.offset(this.getMinOffset(), 0)];
  12625. return [];
  12626. case DiagramItem_1.ConnectionPointSide.South:
  12627. if (targetPoint.x < originPoint.x)
  12628. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
  12629. if (originPoint.y < targetPoint.y)
  12630. return [originPoint.offset(this.getMinOffset(), 0)];
  12631. return [];
  12632. }
  12633. };
  12634. ConnectorPointsOrthogonalEastSideCalculator.prototype.getBeginOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12635. return [originPoint.offset(this.getScaleableOffsetX(originPoint, targetPoint, false), 0)];
  12636. };
  12637. ConnectorPointsOrthogonalEastSideCalculator.prototype.getEndOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12638. return [originPoint.offset(this.getScaleableOffsetX(originPoint, targetPoint, true), 0)];
  12639. };
  12640. ConnectorPointsOrthogonalEastSideCalculator.prototype.getBeginOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12641. switch (targetSide) {
  12642. case DiagramItem_1.ConnectionPointSide.South:
  12643. if (this.isBeginEndOverlappedY())
  12644. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, false);
  12645. break;
  12646. case DiagramItem_1.ConnectionPointSide.North:
  12647. if (this.isBeginEndOverlappedY())
  12648. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, true);
  12649. break;
  12650. case DiagramItem_1.ConnectionPointSide.East:
  12651. if (this.isBeginEndOverlappedY())
  12652. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
  12653. break;
  12654. case DiagramItem_1.ConnectionPointSide.Undefined:
  12655. case DiagramItem_1.ConnectionPointSide.West:
  12656. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
  12657. }
  12658. return [originPoint.offset(this.getScaleableOffsetX(originPoint, targetPoint, false), 0)];
  12659. };
  12660. ConnectorPointsOrthogonalEastSideCalculator.prototype.getEndOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12661. if (targetSide === DiagramItem_1.ConnectionPointSide.Undefined)
  12662. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true);
  12663. else if (this.isBeginEndOverlappedY()) {
  12664. var direction = this.beginRect.center.y > this.endRect.center.y;
  12665. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true, direction);
  12666. }
  12667. return [originPoint.offset(this.getScaleableOffsetX(originPoint, targetPoint, true), 0)];
  12668. };
  12669. ConnectorPointsOrthogonalEastSideCalculator.prototype.getAsideOffsetPoints = function (originPoint, targetPoint, originRect, offset, asideOffset, direction) {
  12670. var points = [];
  12671. if (originRect !== undefined) {
  12672. if (direction === undefined)
  12673. direction = targetPoint.y < originPoint.y;
  12674. if (direction)
  12675. points.push(originPoint.offset(offset, -(originPoint.y - originRect.top + asideOffset)));
  12676. else
  12677. points.push(originPoint.offset(offset, (originRect.bottom - originPoint.y + asideOffset)));
  12678. }
  12679. points.push(originPoint.offset(offset, 0));
  12680. return points;
  12681. };
  12682. ConnectorPointsOrthogonalEastSideCalculator.prototype.getScaleableAsideOffsetPoints = function (originPoint, targetPoint, originRect, isEnd, direction) {
  12683. var offset = this.getScaleableOffsetX(originPoint, targetPoint, isEnd);
  12684. var asideOffset = this.getScaleableOffsetY(originPoint, targetPoint, isEnd);
  12685. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, offset, asideOffset, direction);
  12686. };
  12687. ConnectorPointsOrthogonalEastSideCalculator.prototype.getScaleableOffsetX = function (originPoint, targetPoint, isEnd) {
  12688. if (this.beginRect && this.endRect) {
  12689. var distance = isEnd ? this.beginRect.left - originPoint.x : this.endRect.left - originPoint.x;
  12690. if (distance > 0 && distance < this.getMinOffset() * 2)
  12691. return distance / 2;
  12692. }
  12693. return this.getMinOffset();
  12694. };
  12695. ConnectorPointsOrthogonalEastSideCalculator.prototype.getScaleableOffsetY = function (originPoint, targetPoint, isEnd) {
  12696. if (this.beginRect && this.endRect) {
  12697. if (!isEnd && !this.isBeginEndOverlappedY()) {
  12698. var distance = void 0;
  12699. if (targetPoint.y < originPoint.y)
  12700. distance = this.beginRect.top - this.endRect.bottom;
  12701. else
  12702. distance = this.endRect.top - this.beginRect.bottom;
  12703. if (distance < this.getMinOffset() * 2)
  12704. return distance / 2;
  12705. }
  12706. }
  12707. return this.getMinOffset();
  12708. };
  12709. ConnectorPointsOrthogonalEastSideCalculator.prototype.isOnSidePoint = function (originPoint, targetPoint) {
  12710. return targetPoint.x > originPoint.x;
  12711. };
  12712. ConnectorPointsOrthogonalEastSideCalculator.prototype.isDirectConnectionAllowed = function (targetSide, originPoint, targetPoint) {
  12713. return targetSide === DiagramItem_1.ConnectionPointSide.West || targetSide === DiagramItem_1.ConnectionPointSide.Undefined;
  12714. };
  12715. ConnectorPointsOrthogonalEastSideCalculator.prototype.getDirectConnectionPoints = function (originPoint, targetPoint) {
  12716. var cx = originPoint.x + (targetPoint.x - originPoint.x) / 2;
  12717. return [
  12718. new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, originPoint.y),
  12719. new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, targetPoint.y)
  12720. ];
  12721. };
  12722. return ConnectorPointsOrthogonalEastSideCalculator;
  12723. }(ConnectorPointsOrthogonalSideCalculatorBase_1.ConnectorPointsOrthogonalSideCalculatorBase));
  12724. exports.ConnectorPointsOrthogonalEastSideCalculator = ConnectorPointsOrthogonalEastSideCalculator;
  12725. /***/ }),
  12726. /* 111 */
  12727. /***/ (function(module, exports, __webpack_require__) {
  12728. "use strict";
  12729. var __extends = (this && this.__extends) || (function () {
  12730. var extendStatics = function (d, b) {
  12731. extendStatics = Object.setPrototypeOf ||
  12732. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  12733. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  12734. return extendStatics(d, b);
  12735. };
  12736. return function (d, b) {
  12737. extendStatics(d, b);
  12738. function __() { this.constructor = d; }
  12739. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12740. };
  12741. })();
  12742. Object.defineProperty(exports, "__esModule", { value: true });
  12743. var DiagramItem_1 = __webpack_require__(3);
  12744. var ConnectorPointsOrthogonalSideCalculatorBase_1 = __webpack_require__(33);
  12745. var ConnectorRenderPoint_1 = __webpack_require__(27);
  12746. var ConnectorPointsOrthogonalWestSideCalculator = /** @class */ (function (_super) {
  12747. __extends(ConnectorPointsOrthogonalWestSideCalculator, _super);
  12748. function ConnectorPointsOrthogonalWestSideCalculator(parent) {
  12749. return _super.call(this, parent) || this;
  12750. }
  12751. ConnectorPointsOrthogonalWestSideCalculator.prototype.getCorrectOriginPoint = function (originPoint, originRect) {
  12752. if (originPoint.x > originRect.left)
  12753. originPoint = originPoint.offset(originRect.left - originPoint.x, 0);
  12754. return originPoint;
  12755. };
  12756. ConnectorPointsOrthogonalWestSideCalculator.prototype.getSameShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12757. switch (targetSide) {
  12758. case DiagramItem_1.ConnectionPointSide.North:
  12759. case DiagramItem_1.ConnectionPointSide.South:
  12760. case DiagramItem_1.ConnectionPointSide.West:
  12761. return [originPoint.offset(-this.getMinOffset(), 0)];
  12762. case DiagramItem_1.ConnectionPointSide.East:
  12763. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset());
  12764. }
  12765. };
  12766. ConnectorPointsOrthogonalWestSideCalculator.prototype.getOverlappedPointsOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12767. switch (targetSide) {
  12768. case DiagramItem_1.ConnectionPointSide.East:
  12769. return [originPoint.offset(this.getMinOffset(), 0)];
  12770. case DiagramItem_1.ConnectionPointSide.West:
  12771. return [originPoint.offset(-this.getMinOffset(), 0)];
  12772. }
  12773. return [];
  12774. };
  12775. ConnectorPointsOrthogonalWestSideCalculator.prototype.getBeginOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12776. switch (targetSide) {
  12777. case DiagramItem_1.ConnectionPointSide.North:
  12778. if (originPoint.x > targetPoint.x) {
  12779. if (originPoint.y < targetPoint.y)
  12780. return [];
  12781. else
  12782. return [originPoint.offset(-this.getMinOffset(), 0)];
  12783. }
  12784. if (originPoint.x < this.endRect.left)
  12785. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
  12786. return [originPoint.offset(-this.getMinOffset(), 0)];
  12787. case DiagramItem_1.ConnectionPointSide.South:
  12788. if (originPoint.x > targetPoint.x) {
  12789. if (originPoint.y > targetPoint.y)
  12790. return [];
  12791. else
  12792. return [originPoint.offset(-this.getMinOffset(), 0)];
  12793. }
  12794. if (originPoint.x < this.endRect.left)
  12795. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
  12796. return [originPoint.offset(-this.getMinOffset(), 0)];
  12797. case DiagramItem_1.ConnectionPointSide.West:
  12798. return [originPoint.offset(-this.getMinOffset(), 0)];
  12799. case DiagramItem_1.ConnectionPointSide.East:
  12800. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), originPoint.y < targetPoint.y);
  12801. }
  12802. };
  12803. ConnectorPointsOrthogonalWestSideCalculator.prototype.getEndOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12804. switch (targetSide) {
  12805. case DiagramItem_1.ConnectionPointSide.East:
  12806. var offset = -this.getMinOffset();
  12807. if (this.beginRect.left < originPoint.x)
  12808. offset -= originPoint.x - this.beginRect.left;
  12809. return [originPoint.offset(offset, 0)];
  12810. case DiagramItem_1.ConnectionPointSide.West:
  12811. return [originPoint.offset(-this.getMinOffset(), 0)];
  12812. case DiagramItem_1.ConnectionPointSide.North:
  12813. if (targetPoint.x > originPoint.x)
  12814. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
  12815. if (originPoint.y > targetPoint.y)
  12816. return [originPoint.offset(-this.getMinOffset(), 0)];
  12817. return [];
  12818. case DiagramItem_1.ConnectionPointSide.South:
  12819. if (targetPoint.x > originPoint.x)
  12820. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
  12821. if (originPoint.y < targetPoint.y)
  12822. return [originPoint.offset(-this.getMinOffset(), 0)];
  12823. return [];
  12824. }
  12825. };
  12826. ConnectorPointsOrthogonalWestSideCalculator.prototype.getBeginOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12827. return [originPoint.offset(-this.getScaleableOffsetX(originPoint, targetPoint, false), 0)];
  12828. };
  12829. ConnectorPointsOrthogonalWestSideCalculator.prototype.getEndOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12830. return [originPoint.offset(-this.getScaleableOffsetX(originPoint, targetPoint, true), 0)];
  12831. };
  12832. ConnectorPointsOrthogonalWestSideCalculator.prototype.getBeginOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12833. switch (targetSide) {
  12834. case DiagramItem_1.ConnectionPointSide.South:
  12835. if (this.isBeginEndOverlappedY())
  12836. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, false);
  12837. break;
  12838. case DiagramItem_1.ConnectionPointSide.North:
  12839. if (this.isBeginEndOverlappedY())
  12840. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, true);
  12841. break;
  12842. case DiagramItem_1.ConnectionPointSide.West:
  12843. if (this.isBeginEndOverlappedY())
  12844. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
  12845. break;
  12846. case DiagramItem_1.ConnectionPointSide.Undefined:
  12847. case DiagramItem_1.ConnectionPointSide.East:
  12848. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
  12849. }
  12850. return [originPoint.offset(-this.getScaleableOffsetX(originPoint, targetPoint, false), 0)];
  12851. };
  12852. ConnectorPointsOrthogonalWestSideCalculator.prototype.getEndOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
  12853. if (targetSide === DiagramItem_1.ConnectionPointSide.Undefined)
  12854. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true);
  12855. else if (this.isBeginEndOverlappedY()) {
  12856. var direction = this.beginRect.center.y > this.endRect.center.y;
  12857. return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true, direction);
  12858. }
  12859. return [originPoint.offset(-this.getScaleableOffsetX(originPoint, targetPoint, true), 0)];
  12860. };
  12861. ConnectorPointsOrthogonalWestSideCalculator.prototype.getAsideOffsetPoints = function (originPoint, targetPoint, originRect, offset, asideOffset, direction) {
  12862. var points = [];
  12863. if (originRect !== undefined) {
  12864. if (direction === undefined)
  12865. direction = targetPoint.y < originPoint.y;
  12866. if (direction)
  12867. points.push(originPoint.offset(-offset, -(originPoint.y - originRect.top + asideOffset)));
  12868. else
  12869. points.push(originPoint.offset(-offset, (originRect.bottom - originPoint.y + asideOffset)));
  12870. }
  12871. points.push(originPoint.offset(-offset, 0));
  12872. return points;
  12873. };
  12874. ConnectorPointsOrthogonalWestSideCalculator.prototype.getScaleableAsideOffsetPoints = function (originPoint, targetPoint, originRect, isEnd, direction) {
  12875. var offset = this.getScaleableOffsetX(originPoint, targetPoint, isEnd);
  12876. var asideOffset = this.getScaleableOffsetY(originPoint, targetPoint, isEnd);
  12877. return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, offset, asideOffset, direction);
  12878. };
  12879. ConnectorPointsOrthogonalWestSideCalculator.prototype.getScaleableOffsetX = function (originPoint, targetPoint, isEnd) {
  12880. if (this.beginRect && this.endRect) {
  12881. var distance = isEnd ? originPoint.x - this.beginRect.right : originPoint.x - this.endRect.right;
  12882. if (distance > 0 && distance < this.getMinOffset() * 2)
  12883. return distance / 2;
  12884. }
  12885. return this.getMinOffset();
  12886. };
  12887. ConnectorPointsOrthogonalWestSideCalculator.prototype.getScaleableOffsetY = function (originPoint, targetPoint, isEnd) {
  12888. if (this.beginRect && this.endRect) {
  12889. if (!isEnd && !this.isBeginEndOverlappedY()) {
  12890. var distance = void 0;
  12891. if (targetPoint.y < originPoint.y)
  12892. distance = this.beginRect.top - this.endRect.bottom;
  12893. else
  12894. distance = this.endRect.top - this.beginRect.bottom;
  12895. if (distance < this.getMinOffset() * 2)
  12896. return distance / 2;
  12897. }
  12898. }
  12899. return this.getMinOffset();
  12900. };
  12901. ConnectorPointsOrthogonalWestSideCalculator.prototype.isOnSidePoint = function (originPoint, targetPoint) {
  12902. return targetPoint.x < originPoint.x;
  12903. };
  12904. ConnectorPointsOrthogonalWestSideCalculator.prototype.isDirectConnectionAllowed = function (targetSide, originPoint, targetPoint) {
  12905. return targetSide === DiagramItem_1.ConnectionPointSide.East || targetSide === DiagramItem_1.ConnectionPointSide.Undefined;
  12906. };
  12907. ConnectorPointsOrthogonalWestSideCalculator.prototype.getDirectConnectionPoints = function (originPoint, targetPoint) {
  12908. var cx = targetPoint.x + (originPoint.x - targetPoint.x) / 2;
  12909. return [
  12910. new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, originPoint.y),
  12911. new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, targetPoint.y)
  12912. ];
  12913. };
  12914. return ConnectorPointsOrthogonalWestSideCalculator;
  12915. }(ConnectorPointsOrthogonalSideCalculatorBase_1.ConnectorPointsOrthogonalSideCalculatorBase));
  12916. exports.ConnectorPointsOrthogonalWestSideCalculator = ConnectorPointsOrthogonalWestSideCalculator;
  12917. /***/ }),
  12918. /* 112 */
  12919. /***/ (function(module, exports, __webpack_require__) {
  12920. "use strict";
  12921. Object.defineProperty(exports, "__esModule", { value: true });
  12922. var ConnectorText = /** @class */ (function () {
  12923. function ConnectorText(position, value) {
  12924. this.position = position;
  12925. this.value = value;
  12926. }
  12927. return ConnectorText;
  12928. }());
  12929. exports.ConnectorText = ConnectorText;
  12930. var ConnectorTexts = /** @class */ (function () {
  12931. function ConnectorTexts() {
  12932. this.items = {};
  12933. }
  12934. ConnectorTexts.prototype.get = function (position) {
  12935. return this.items[position];
  12936. };
  12937. ConnectorTexts.prototype.set = function (position, text) {
  12938. this.items[position] = text;
  12939. };
  12940. ConnectorTexts.prototype.remove = function (position) {
  12941. delete this.items[position];
  12942. };
  12943. ConnectorTexts.prototype.forEach = function (callback) {
  12944. for (var key in this.items)
  12945. if (this.items.hasOwnProperty(key))
  12946. callback(this.items[key]);
  12947. };
  12948. ConnectorTexts.prototype.clone = function () {
  12949. var result = new ConnectorTexts();
  12950. this.forEach(function (t) { result.set(t.position, new ConnectorText(t.position, t.value)); });
  12951. return result;
  12952. };
  12953. ConnectorTexts.prototype.toObject = function () {
  12954. var result = {};
  12955. var modified = false;
  12956. this.forEach(function (t) {
  12957. result[t.position] = t.value;
  12958. modified = true;
  12959. });
  12960. return modified ? result : null;
  12961. };
  12962. ConnectorTexts.prototype.fromObject = function (obj) {
  12963. for (var key in obj) {
  12964. if (obj.hasOwnProperty(key)) {
  12965. var position = parseFloat(key);
  12966. if (!isNaN(position) && typeof obj[key] === "string") {
  12967. this.set(position, new ConnectorText(position, obj[key]));
  12968. }
  12969. }
  12970. }
  12971. };
  12972. return ConnectorTexts;
  12973. }());
  12974. exports.ConnectorTexts = ConnectorTexts;
  12975. /***/ }),
  12976. /* 113 */
  12977. /***/ (function(module, exports, __webpack_require__) {
  12978. "use strict";
  12979. var __extends = (this && this.__extends) || (function () {
  12980. var extendStatics = function (d, b) {
  12981. extendStatics = Object.setPrototypeOf ||
  12982. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  12983. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  12984. return extendStatics(d, b);
  12985. };
  12986. return function (d, b) {
  12987. extendStatics(d, b);
  12988. function __() { this.constructor = d; }
  12989. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12990. };
  12991. })();
  12992. Object.defineProperty(exports, "__esModule", { value: true });
  12993. var RenderManager_1 = __webpack_require__(10);
  12994. var Primitive_1 = __webpack_require__(15);
  12995. var FilterPrimitive = /** @class */ (function (_super) {
  12996. __extends(FilterPrimitive, _super);
  12997. function FilterPrimitive(id, x, y, width, height) {
  12998. var _this = _super.call(this) || this;
  12999. _this.id = id;
  13000. _this.x = x;
  13001. _this.y = y;
  13002. _this.width = width;
  13003. _this.height = height;
  13004. return _this;
  13005. }
  13006. FilterPrimitive.prototype.createMainElement = function () {
  13007. return document.createElementNS(RenderManager_1.svgNS, "filter");
  13008. };
  13009. FilterPrimitive.prototype.applyElementProperties = function (element) {
  13010. if (this.id)
  13011. element.setAttribute("id", this.id);
  13012. this.setUnitAttribute(element, "x", this.x);
  13013. this.setUnitAttribute(element, "y", this.y);
  13014. this.setUnitAttribute(element, "width", this.width);
  13015. this.setUnitAttribute(element, "height", this.height);
  13016. _super.prototype.applyElementProperties.call(this, element);
  13017. };
  13018. return FilterPrimitive;
  13019. }(Primitive_1.SvgPrimitive));
  13020. exports.FilterPrimitive = FilterPrimitive;
  13021. /***/ }),
  13022. /* 114 */
  13023. /***/ (function(module, exports, __webpack_require__) {
  13024. "use strict";
  13025. var __extends = (this && this.__extends) || (function () {
  13026. var extendStatics = function (d, b) {
  13027. extendStatics = Object.setPrototypeOf ||
  13028. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13029. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13030. return extendStatics(d, b);
  13031. };
  13032. return function (d, b) {
  13033. extendStatics(d, b);
  13034. function __() { this.constructor = d; }
  13035. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13036. };
  13037. })();
  13038. Object.defineProperty(exports, "__esModule", { value: true });
  13039. var HistoryItem_1 = __webpack_require__(4);
  13040. var Utils_1 = __webpack_require__(0);
  13041. var ModelResizeHistoryItem = /** @class */ (function (_super) {
  13042. __extends(ModelResizeHistoryItem, _super);
  13043. function ModelResizeHistoryItem(offset) {
  13044. var _this = _super.call(this) || this;
  13045. _this.offset = offset;
  13046. return _this;
  13047. }
  13048. ModelResizeHistoryItem.prototype.redo = function (manipulator) {
  13049. this.oldSize = manipulator.model.size.clone();
  13050. this.backOffset = new Utils_1.Offset(-this.offset.left, -this.offset.top, -this.offset.right, -this.offset.bottom);
  13051. var newWidth = Math.max(this.oldSize.width + this.offset.left + this.offset.right, manipulator.model.pageWidth);
  13052. var newHeight = Math.max(this.oldSize.height + this.offset.top + this.offset.bottom, manipulator.model.pageHeight);
  13053. manipulator.changeModelSize(new Utils_1.Size(newWidth, newHeight), this.offset);
  13054. };
  13055. ModelResizeHistoryItem.prototype.undo = function (manipulator) {
  13056. manipulator.changeModelSize(this.oldSize, this.backOffset);
  13057. };
  13058. return ModelResizeHistoryItem;
  13059. }(HistoryItem_1.HistoryItem));
  13060. exports.ModelResizeHistoryItem = ModelResizeHistoryItem;
  13061. /***/ }),
  13062. /* 115 */
  13063. /***/ (function(module, exports, __webpack_require__) {
  13064. "use strict";
  13065. var __extends = (this && this.__extends) || (function () {
  13066. var extendStatics = function (d, b) {
  13067. extendStatics = Object.setPrototypeOf ||
  13068. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13069. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13070. return extendStatics(d, b);
  13071. };
  13072. return function (d, b) {
  13073. extendStatics(d, b);
  13074. function __() { this.constructor = d; }
  13075. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13076. };
  13077. })();
  13078. Object.defineProperty(exports, "__esModule", { value: true });
  13079. var HistoryItem_1 = __webpack_require__(4);
  13080. var Shape_1 = __webpack_require__(9);
  13081. var Connector_1 = __webpack_require__(5);
  13082. var UpdatePositionsOnPageResizeHistoryItem = /** @class */ (function (_super) {
  13083. __extends(UpdatePositionsOnPageResizeHistoryItem, _super);
  13084. function UpdatePositionsOnPageResizeHistoryItem(offsetX, offsetY) {
  13085. var _this = _super.call(this) || this;
  13086. _this.offsetX = offsetX;
  13087. _this.offsetY = offsetY;
  13088. return _this;
  13089. }
  13090. UpdatePositionsOnPageResizeHistoryItem.prototype.redo = function (manipulator) {
  13091. var _this = this;
  13092. manipulator.model.iterateItems(function (item) {
  13093. if (item instanceof Shape_1.Shape)
  13094. manipulator.moveShape(item, item.position.offset(_this.offsetX, _this.offsetY));
  13095. if (item instanceof Connector_1.Connector)
  13096. item.points.forEach(function (p, index) { return manipulator.moveConnectorPoint(item, index, p.offset(_this.offsetX, _this.offsetY)); });
  13097. });
  13098. };
  13099. UpdatePositionsOnPageResizeHistoryItem.prototype.undo = function (manipulator) {
  13100. var _this = this;
  13101. manipulator.model.iterateItems(function (item) {
  13102. if (item instanceof Shape_1.Shape)
  13103. manipulator.moveShape(item, item.position.offset(-_this.offsetX, -_this.offsetY));
  13104. if (item instanceof Connector_1.Connector)
  13105. item.points.forEach(function (p, index) { return manipulator.moveConnectorPoint(item, index, p.offset(-_this.offsetX, -_this.offsetY)); });
  13106. });
  13107. };
  13108. return UpdatePositionsOnPageResizeHistoryItem;
  13109. }(HistoryItem_1.HistoryItem));
  13110. exports.UpdatePositionsOnPageResizeHistoryItem = UpdatePositionsOnPageResizeHistoryItem;
  13111. /***/ }),
  13112. /* 116 */
  13113. /***/ (function(module, exports, __webpack_require__) {
  13114. "use strict";
  13115. var __extends = (this && this.__extends) || (function () {
  13116. var extendStatics = function (d, b) {
  13117. extendStatics = Object.setPrototypeOf ||
  13118. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13119. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13120. return extendStatics(d, b);
  13121. };
  13122. return function (d, b) {
  13123. extendStatics(d, b);
  13124. function __() { this.constructor = d; }
  13125. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13126. };
  13127. })();
  13128. Object.defineProperty(exports, "__esModule", { value: true });
  13129. var HistoryItem_1 = __webpack_require__(4);
  13130. var DeleteConnectorPointHistoryItem = /** @class */ (function (_super) {
  13131. __extends(DeleteConnectorPointHistoryItem, _super);
  13132. function DeleteConnectorPointHistoryItem(connectorKey, pointIndex) {
  13133. var _this = _super.call(this) || this;
  13134. _this.connectorKey = connectorKey;
  13135. _this.pointIndex = pointIndex;
  13136. return _this;
  13137. }
  13138. DeleteConnectorPointHistoryItem.prototype.redo = function (manipulator) {
  13139. var connector = manipulator.model.findConnector(this.connectorKey);
  13140. this.point = connector.points[this.pointIndex].clone();
  13141. manipulator.deleteConnectorPoint(connector, this.pointIndex);
  13142. };
  13143. DeleteConnectorPointHistoryItem.prototype.undo = function (manipulator) {
  13144. var connector = manipulator.model.findConnector(this.connectorKey);
  13145. manipulator.addConnectorPoint(connector, this.pointIndex, this.point);
  13146. };
  13147. return DeleteConnectorPointHistoryItem;
  13148. }(HistoryItem_1.HistoryItem));
  13149. exports.DeleteConnectorPointHistoryItem = DeleteConnectorPointHistoryItem;
  13150. /***/ }),
  13151. /* 117 */
  13152. /***/ (function(module, exports, __webpack_require__) {
  13153. "use strict";
  13154. var __extends = (this && this.__extends) || (function () {
  13155. var extendStatics = function (d, b) {
  13156. extendStatics = Object.setPrototypeOf ||
  13157. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13158. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13159. return extendStatics(d, b);
  13160. };
  13161. return function (d, b) {
  13162. extendStatics(d, b);
  13163. function __() { this.constructor = d; }
  13164. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13165. };
  13166. })();
  13167. Object.defineProperty(exports, "__esModule", { value: true });
  13168. var HistoryItem_1 = __webpack_require__(4);
  13169. var ResizeShapeHistoryItem = /** @class */ (function (_super) {
  13170. __extends(ResizeShapeHistoryItem, _super);
  13171. function ResizeShapeHistoryItem(shapeKey, position, size) {
  13172. var _this = _super.call(this) || this;
  13173. _this.shapeKey = shapeKey;
  13174. _this.position = position;
  13175. _this.size = size;
  13176. return _this;
  13177. }
  13178. ResizeShapeHistoryItem.prototype.redo = function (manipulator) {
  13179. var shape = manipulator.model.findShape(this.shapeKey);
  13180. this.oldPosition = shape.position.clone();
  13181. this.oldSize = shape.size.clone();
  13182. manipulator.resizeShape(shape, this.position, this.size);
  13183. };
  13184. ResizeShapeHistoryItem.prototype.undo = function (manipulator) {
  13185. var shape = manipulator.model.findShape(this.shapeKey);
  13186. manipulator.resizeShape(shape, this.oldPosition, this.oldSize);
  13187. };
  13188. return ResizeShapeHistoryItem;
  13189. }(HistoryItem_1.HistoryItem));
  13190. exports.ResizeShapeHistoryItem = ResizeShapeHistoryItem;
  13191. /***/ }),
  13192. /* 118 */
  13193. /***/ (function(module, exports, __webpack_require__) {
  13194. "use strict";
  13195. var __extends = (this && this.__extends) || (function () {
  13196. var extendStatics = function (d, b) {
  13197. extendStatics = Object.setPrototypeOf ||
  13198. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13199. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13200. return extendStatics(d, b);
  13201. };
  13202. return function (d, b) {
  13203. extendStatics(d, b);
  13204. function __() { this.constructor = d; }
  13205. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13206. };
  13207. })();
  13208. Object.defineProperty(exports, "__esModule", { value: true });
  13209. var HistoryItem_1 = __webpack_require__(4);
  13210. var DeleteConnectorHistoryItem = /** @class */ (function (_super) {
  13211. __extends(DeleteConnectorHistoryItem, _super);
  13212. function DeleteConnectorHistoryItem(connectorKey) {
  13213. var _this = _super.call(this) || this;
  13214. _this.connectorKey = connectorKey;
  13215. return _this;
  13216. }
  13217. DeleteConnectorHistoryItem.prototype.redo = function (manipulator) {
  13218. var connector = manipulator.model.findConnector(this.connectorKey);
  13219. this.connector = connector.clone();
  13220. manipulator.deleteConnector(connector);
  13221. };
  13222. DeleteConnectorHistoryItem.prototype.undo = function (manipulator) {
  13223. manipulator.addConnector(this.connector, this.connector.key);
  13224. };
  13225. return DeleteConnectorHistoryItem;
  13226. }(HistoryItem_1.HistoryItem));
  13227. exports.DeleteConnectorHistoryItem = DeleteConnectorHistoryItem;
  13228. /***/ }),
  13229. /* 119 */
  13230. /***/ (function(module, exports, __webpack_require__) {
  13231. "use strict";
  13232. Object.defineProperty(exports, "__esModule", { value: true });
  13233. var DataSourceNodeDataImporter = /** @class */ (function () {
  13234. function DataSourceNodeDataImporter() {
  13235. this.getKey = function (obj) { return obj["id"]; };
  13236. this.setKey = function (obj, value) { obj["id"] = value; };
  13237. this.getText = function (obj) { return obj["text"]; };
  13238. this.setText = function (obj, value) { obj["text"] = value; };
  13239. this.getType = function (obj) { return obj["type"]; };
  13240. this.setType = function (obj, value) { obj["type"] = value; };
  13241. this.getParentKey = function (obj) { return obj["parentId"]; };
  13242. this.setParentKey = function (obj, value) { obj["parentId"] = value; };
  13243. this.getItems = function (obj) { return obj["items"]; };
  13244. this.setItems = function (obj, value) { obj["items"] = value; };
  13245. }
  13246. return DataSourceNodeDataImporter;
  13247. }());
  13248. exports.DataSourceNodeDataImporter = DataSourceNodeDataImporter;
  13249. var DataSourceEdgeDataImporter = /** @class */ (function () {
  13250. function DataSourceEdgeDataImporter() {
  13251. this.getKey = function (obj) { return obj["id"]; };
  13252. this.setKey = function (obj, value) { obj["id"] = value; };
  13253. this.getFrom = function (obj) { return obj["from"]; };
  13254. this.setFrom = function (obj, value) { obj["from"] = value; };
  13255. this.getTo = function (obj) { return obj["to"]; };
  13256. this.setTo = function (obj, value) { obj["to"] = value; };
  13257. }
  13258. return DataSourceEdgeDataImporter;
  13259. }());
  13260. exports.DataSourceEdgeDataImporter = DataSourceEdgeDataImporter;
  13261. /***/ }),
  13262. /* 120 */
  13263. /***/ (function(module, exports, __webpack_require__) {
  13264. "use strict";
  13265. var __extends = (this && this.__extends) || (function () {
  13266. var extendStatics = function (d, b) {
  13267. extendStatics = Object.setPrototypeOf ||
  13268. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13269. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13270. return extendStatics(d, b);
  13271. };
  13272. return function (d, b) {
  13273. extendStatics(d, b);
  13274. function __() { this.constructor = d; }
  13275. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13276. };
  13277. })();
  13278. Object.defineProperty(exports, "__esModule", { value: true });
  13279. var RectangleShapeDescription_1 = __webpack_require__(12);
  13280. var ShapeType_1 = __webpack_require__(1);
  13281. var ProcessShapeDescription = /** @class */ (function (_super) {
  13282. __extends(ProcessShapeDescription, _super);
  13283. function ProcessShapeDescription() {
  13284. return _super.call(this, "Process", "Process") || this;
  13285. }
  13286. Object.defineProperty(ProcessShapeDescription.prototype, "key", {
  13287. get: function () { return ShapeType_1.ShapeType.Process; },
  13288. enumerable: true,
  13289. configurable: true
  13290. });
  13291. Object.defineProperty(ProcessShapeDescription.prototype, "category", {
  13292. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  13293. enumerable: true,
  13294. configurable: true
  13295. });
  13296. return ProcessShapeDescription;
  13297. }(RectangleShapeDescription_1.RectangleShapeDescription));
  13298. exports.ProcessShapeDescription = ProcessShapeDescription;
  13299. /***/ }),
  13300. /* 121 */
  13301. /***/ (function(module, exports, __webpack_require__) {
  13302. "use strict";
  13303. var __extends = (this && this.__extends) || (function () {
  13304. var extendStatics = function (d, b) {
  13305. extendStatics = Object.setPrototypeOf ||
  13306. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13307. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13308. return extendStatics(d, b);
  13309. };
  13310. return function (d, b) {
  13311. extendStatics(d, b);
  13312. function __() { this.constructor = d; }
  13313. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13314. };
  13315. })();
  13316. Object.defineProperty(exports, "__esModule", { value: true });
  13317. var DiamondShapeDescription_1 = __webpack_require__(75);
  13318. var ShapeType_1 = __webpack_require__(1);
  13319. var Utils_1 = __webpack_require__(0);
  13320. var ShapeDescription_1 = __webpack_require__(11);
  13321. var DecisionShapeDescription = /** @class */ (function (_super) {
  13322. __extends(DecisionShapeDescription, _super);
  13323. function DecisionShapeDescription() {
  13324. return _super.call(this, "Decision", "Decision", new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.75)) || this;
  13325. }
  13326. Object.defineProperty(DecisionShapeDescription.prototype, "key", {
  13327. get: function () { return ShapeType_1.ShapeType.Decision; },
  13328. enumerable: true,
  13329. configurable: true
  13330. });
  13331. Object.defineProperty(DecisionShapeDescription.prototype, "category", {
  13332. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  13333. enumerable: true,
  13334. configurable: true
  13335. });
  13336. return DecisionShapeDescription;
  13337. }(DiamondShapeDescription_1.DiamondShapeDescription));
  13338. exports.DecisionShapeDescription = DecisionShapeDescription;
  13339. /***/ }),
  13340. /* 122 */
  13341. /***/ (function(module, exports, __webpack_require__) {
  13342. "use strict";
  13343. var __extends = (this && this.__extends) || (function () {
  13344. var extendStatics = function (d, b) {
  13345. extendStatics = Object.setPrototypeOf ||
  13346. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13347. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13348. return extendStatics(d, b);
  13349. };
  13350. return function (d, b) {
  13351. extendStatics(d, b);
  13352. function __() { this.constructor = d; }
  13353. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13354. };
  13355. })();
  13356. Object.defineProperty(exports, "__esModule", { value: true });
  13357. var RectangleShapeDescription_1 = __webpack_require__(12);
  13358. var ShapeType_1 = __webpack_require__(1);
  13359. var PathPrimitive_1 = __webpack_require__(2);
  13360. var DiagramItem_1 = __webpack_require__(3);
  13361. var ManualInputShapeDescription = /** @class */ (function (_super) {
  13362. __extends(ManualInputShapeDescription, _super);
  13363. function ManualInputShapeDescription() {
  13364. return _super.call(this, "Manual Input", "Manual Input") || this;
  13365. }
  13366. Object.defineProperty(ManualInputShapeDescription.prototype, "key", {
  13367. get: function () { return ShapeType_1.ShapeType.ManualInput; },
  13368. enumerable: true,
  13369. configurable: true
  13370. });
  13371. Object.defineProperty(ManualInputShapeDescription.prototype, "category", {
  13372. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  13373. enumerable: true,
  13374. configurable: true
  13375. });
  13376. ManualInputShapeDescription.prototype.createPrimitives = function (shape) {
  13377. var _a = shape.rectangle, left = _a.left, top = _a.top, right = _a.right, bottom = _a.bottom, width = _a.width, height = _a.height;
  13378. var y1 = top + height * ManualInputShapeDescription.slopeHeightRatio;
  13379. var primitives = [];
  13380. return primitives.concat([
  13381. new PathPrimitive_1.PathPrimitive([
  13382. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, y1),
  13383. new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
  13384. new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
  13385. new PathPrimitive_1.PathPrimitiveLineToCommand(left, bottom),
  13386. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  13387. ], shape.style)
  13388. ])
  13389. .concat(this.createTextPrimitives(shape));
  13390. };
  13391. ManualInputShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  13392. var side = shape.getConnectionPointSide(index);
  13393. if (side === DiagramItem_1.ConnectionPointSide.North)
  13394. point.y += ManualInputShapeDescription.slopeHeightRatio / 2 * shape.size.height;
  13395. };
  13396. ManualInputShapeDescription.slopeHeightRatio = 0.1;
  13397. return ManualInputShapeDescription;
  13398. }(RectangleShapeDescription_1.RectangleShapeDescription));
  13399. exports.ManualInputShapeDescription = ManualInputShapeDescription;
  13400. /***/ }),
  13401. /* 123 */
  13402. /***/ (function(module, exports, __webpack_require__) {
  13403. "use strict";
  13404. var __extends = (this && this.__extends) || (function () {
  13405. var extendStatics = function (d, b) {
  13406. extendStatics = Object.setPrototypeOf ||
  13407. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13408. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13409. return extendStatics(d, b);
  13410. };
  13411. return function (d, b) {
  13412. extendStatics(d, b);
  13413. function __() { this.constructor = d; }
  13414. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13415. };
  13416. })();
  13417. Object.defineProperty(exports, "__esModule", { value: true });
  13418. var RectangleShapeDescription_1 = __webpack_require__(12);
  13419. var ShapeType_1 = __webpack_require__(1);
  13420. var PathPrimitive_1 = __webpack_require__(2);
  13421. var DiagramItem_1 = __webpack_require__(3);
  13422. var DataShapeDescription = /** @class */ (function (_super) {
  13423. __extends(DataShapeDescription, _super);
  13424. function DataShapeDescription() {
  13425. return _super.call(this, "Data", "Data") || this;
  13426. }
  13427. Object.defineProperty(DataShapeDescription.prototype, "key", {
  13428. get: function () { return ShapeType_1.ShapeType.Data; },
  13429. enumerable: true,
  13430. configurable: true
  13431. });
  13432. Object.defineProperty(DataShapeDescription.prototype, "category", {
  13433. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  13434. enumerable: true,
  13435. configurable: true
  13436. });
  13437. DataShapeDescription.prototype.createPrimitives = function (shape) {
  13438. var _a = shape.rectangle, left = _a.left, top = _a.top, right = _a.right, bottom = _a.bottom, width = _a.width, height = _a.height;
  13439. var px = Math.min(Math.max(0, height / Math.tan(DataShapeDescription.slopeAngle)), width);
  13440. var x1 = left + px;
  13441. var x2 = right - px;
  13442. var primitives = [];
  13443. return primitives.concat([
  13444. new PathPrimitive_1.PathPrimitive([
  13445. new PathPrimitive_1.PathPrimitiveMoveToCommand(x1, top),
  13446. new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
  13447. new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
  13448. new PathPrimitive_1.PathPrimitiveLineToCommand(left, bottom),
  13449. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  13450. ], shape.style)
  13451. ])
  13452. .concat(this.createTextPrimitives(shape));
  13453. };
  13454. DataShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  13455. var offset = shape.size.height / Math.tan(DataShapeDescription.slopeAngle);
  13456. var side = shape.getConnectionPointSide(index);
  13457. if (side === DiagramItem_1.ConnectionPointSide.East)
  13458. point.x -= offset / 2;
  13459. else if (side === DiagramItem_1.ConnectionPointSide.West)
  13460. point.x += offset / 2;
  13461. };
  13462. DataShapeDescription.slopeAngle = 81 * Math.PI / 180;
  13463. return DataShapeDescription;
  13464. }(RectangleShapeDescription_1.RectangleShapeDescription));
  13465. exports.DataShapeDescription = DataShapeDescription;
  13466. /***/ }),
  13467. /* 124 */
  13468. /***/ (function(module, exports, __webpack_require__) {
  13469. "use strict";
  13470. var __extends = (this && this.__extends) || (function () {
  13471. var extendStatics = function (d, b) {
  13472. extendStatics = Object.setPrototypeOf ||
  13473. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13474. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13475. return extendStatics(d, b);
  13476. };
  13477. return function (d, b) {
  13478. extendStatics(d, b);
  13479. function __() { this.constructor = d; }
  13480. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13481. };
  13482. })();
  13483. Object.defineProperty(exports, "__esModule", { value: true });
  13484. var RectangleShapeDescription_1 = __webpack_require__(12);
  13485. var ShapeType_1 = __webpack_require__(1);
  13486. var PathPrimitive_1 = __webpack_require__(2);
  13487. var Utils_1 = __webpack_require__(0);
  13488. var ShapeDescription_1 = __webpack_require__(11);
  13489. var TerminatorShapeDescription = /** @class */ (function (_super) {
  13490. __extends(TerminatorShapeDescription, _super);
  13491. function TerminatorShapeDescription() {
  13492. return _super.call(this, "Terminator", "Terminator", new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.5)) || this;
  13493. }
  13494. Object.defineProperty(TerminatorShapeDescription.prototype, "key", {
  13495. get: function () { return ShapeType_1.ShapeType.Terminator; },
  13496. enumerable: true,
  13497. configurable: true
  13498. });
  13499. Object.defineProperty(TerminatorShapeDescription.prototype, "category", {
  13500. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  13501. enumerable: true,
  13502. configurable: true
  13503. });
  13504. TerminatorShapeDescription.prototype.createPrimitives = function (shape) {
  13505. var rect = shape.rectangle;
  13506. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  13507. var cy = rect.center.y;
  13508. var x1 = left + width * TerminatorShapeDescription.curveWidthRatio;
  13509. var x2 = left + width * (1 - TerminatorShapeDescription.curveWidthRatio);
  13510. var ratio = height / width;
  13511. var primitives = [];
  13512. return primitives.concat([
  13513. new PathPrimitive_1.PathPrimitive([
  13514. new PathPrimitive_1.PathPrimitiveMoveToCommand(x1, top),
  13515. new PathPrimitive_1.PathPrimitiveLineToCommand(x2, top),
  13516. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right, top, right, cy),
  13517. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right, bottom, x2, bottom),
  13518. new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
  13519. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left, bottom, left, cy),
  13520. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left, top, x1, top),
  13521. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  13522. ], shape.style)
  13523. ])
  13524. .concat(this.createTextPrimitives(shape));
  13525. };
  13526. TerminatorShapeDescription.curveWidthRatio = 0.3;
  13527. return TerminatorShapeDescription;
  13528. }(RectangleShapeDescription_1.RectangleShapeDescription));
  13529. exports.TerminatorShapeDescription = TerminatorShapeDescription;
  13530. /***/ }),
  13531. /* 125 */
  13532. /***/ (function(module, exports, __webpack_require__) {
  13533. "use strict";
  13534. var __extends = (this && this.__extends) || (function () {
  13535. var extendStatics = function (d, b) {
  13536. extendStatics = Object.setPrototypeOf ||
  13537. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13538. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13539. return extendStatics(d, b);
  13540. };
  13541. return function (d, b) {
  13542. extendStatics(d, b);
  13543. function __() { this.constructor = d; }
  13544. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13545. };
  13546. })();
  13547. Object.defineProperty(exports, "__esModule", { value: true });
  13548. var RectangleShapeDescription_1 = __webpack_require__(12);
  13549. var ShapeType_1 = __webpack_require__(1);
  13550. var ShapeParameters_1 = __webpack_require__(25);
  13551. var ShapeParameterPoint_1 = __webpack_require__(17);
  13552. var Utils_1 = __webpack_require__(0);
  13553. var PathPrimitive_1 = __webpack_require__(2);
  13554. exports.PredefinedProcessEdgeParameterName = "e";
  13555. var PredefinedProcessShapeDescription = /** @class */ (function (_super) {
  13556. __extends(PredefinedProcessShapeDescription, _super);
  13557. function PredefinedProcessShapeDescription() {
  13558. return _super.call(this, "Predefined Process", "Predefined\nProcess") || this;
  13559. }
  13560. Object.defineProperty(PredefinedProcessShapeDescription.prototype, "key", {
  13561. get: function () { return ShapeType_1.ShapeType.PredefinedProcess; },
  13562. enumerable: true,
  13563. configurable: true
  13564. });
  13565. Object.defineProperty(PredefinedProcessShapeDescription.prototype, "category", {
  13566. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  13567. enumerable: true,
  13568. configurable: true
  13569. });
  13570. PredefinedProcessShapeDescription.prototype.createPrimitives = function (shape) {
  13571. var rect = shape.rectangle;
  13572. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  13573. var x1 = left + shape.parameters.get(exports.PredefinedProcessEdgeParameterName).value;
  13574. var x2 = right - shape.parameters.get(exports.PredefinedProcessEdgeParameterName).value;
  13575. var primitives = _super.prototype.createPrimitives.call(this, shape);
  13576. return primitives.concat([
  13577. new PathPrimitive_1.PathPrimitive([
  13578. new PathPrimitive_1.PathPrimitiveMoveToCommand(x1, top),
  13579. new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
  13580. new PathPrimitive_1.PathPrimitiveMoveToCommand(x2, top),
  13581. new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom)
  13582. ], shape.style)
  13583. ]);
  13584. };
  13585. PredefinedProcessShapeDescription.prototype.createParameters = function (parameters) {
  13586. parameters.add(new ShapeParameters_1.ShapeParameter(exports.PredefinedProcessEdgeParameterName, this.defaultSize.width * 0.1));
  13587. };
  13588. PredefinedProcessShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
  13589. this.changeParameterValue(parameters, exports.PredefinedProcessEdgeParameterName, function (p) { return Math.max(PredefinedProcessShapeDescription.minEdge, Math.min(shape.size.width * 0.3, p.value)); });
  13590. };
  13591. PredefinedProcessShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
  13592. this.changeParameterValue(parameters, exports.PredefinedProcessEdgeParameterName, function (p) { return p.value + deltaX; });
  13593. this.normalizeParameters(shape, parameters);
  13594. };
  13595. PredefinedProcessShapeDescription.prototype.getParameterPoints = function (shape) {
  13596. return [
  13597. new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + shape.parameters.get(exports.PredefinedProcessEdgeParameterName).value), shape.position.y))
  13598. ];
  13599. };
  13600. PredefinedProcessShapeDescription.minEdge = 72;
  13601. return PredefinedProcessShapeDescription;
  13602. }(RectangleShapeDescription_1.RectangleShapeDescription));
  13603. exports.PredefinedProcessShapeDescription = PredefinedProcessShapeDescription;
  13604. /***/ }),
  13605. /* 126 */
  13606. /***/ (function(module, exports, __webpack_require__) {
  13607. "use strict";
  13608. var __extends = (this && this.__extends) || (function () {
  13609. var extendStatics = function (d, b) {
  13610. extendStatics = Object.setPrototypeOf ||
  13611. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13612. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13613. return extendStatics(d, b);
  13614. };
  13615. return function (d, b) {
  13616. extendStatics(d, b);
  13617. function __() { this.constructor = d; }
  13618. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13619. };
  13620. })();
  13621. Object.defineProperty(exports, "__esModule", { value: true });
  13622. var Shape_1 = __webpack_require__(9);
  13623. var PathPrimitive_1 = __webpack_require__(2);
  13624. var ShapeParameterPoint_1 = __webpack_require__(17);
  13625. var Utils_1 = __webpack_require__(0);
  13626. var ArrowVerticalShapeDescription_1 = __webpack_require__(54);
  13627. var ShapeType_1 = __webpack_require__(1);
  13628. var ArrowNorthSouthShapeDescription = /** @class */ (function (_super) {
  13629. __extends(ArrowNorthSouthShapeDescription, _super);
  13630. function ArrowNorthSouthShapeDescription() {
  13631. return _super.call(this, "North-South Arrow") || this;
  13632. }
  13633. Object.defineProperty(ArrowNorthSouthShapeDescription.prototype, "key", {
  13634. get: function () { return ShapeType_1.ShapeType.ArrowNorthSouth; },
  13635. enumerable: true,
  13636. configurable: true
  13637. });
  13638. ArrowNorthSouthShapeDescription.prototype.createPrimitives = function (shape) {
  13639. var rect = shape.rectangle;
  13640. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  13641. var cx = rect.center.x;
  13642. var p1dx = (width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2;
  13643. var p0dy = shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value;
  13644. var p1x1 = shape.normalizeX(left + p1dx);
  13645. var p0y1 = shape.normalizeY(top + p0dy);
  13646. var p1x2 = shape.normalizeX(right - p1dx);
  13647. var p0y2 = shape.normalizeY(bottom - p0dy);
  13648. var primitives = [];
  13649. return primitives.concat([
  13650. new PathPrimitive_1.PathPrimitive([
  13651. new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
  13652. new PathPrimitive_1.PathPrimitiveLineToCommand(right, p0y1),
  13653. new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, p0y1),
  13654. new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, p0y2),
  13655. new PathPrimitive_1.PathPrimitiveLineToCommand(right, p0y2),
  13656. new PathPrimitive_1.PathPrimitiveLineToCommand(cx, bottom),
  13657. new PathPrimitive_1.PathPrimitiveLineToCommand(left, p0y2),
  13658. new PathPrimitive_1.PathPrimitiveLineToCommand(p1x1, p0y2),
  13659. new PathPrimitive_1.PathPrimitiveLineToCommand(p1x1, p0y1),
  13660. new PathPrimitive_1.PathPrimitiveLineToCommand(left, p0y1),
  13661. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  13662. ], shape.style)
  13663. ])
  13664. .concat(this.createTextPrimitives(shape));
  13665. };
  13666. ArrowNorthSouthShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
  13667. this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName, function (p) { return Math.max(0, Math.min(shape.size.height / 2 - 2 * Shape_1.Shape.lineWidth, p.value)); });
  13668. this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.width, p.value)); });
  13669. };
  13670. ArrowNorthSouthShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
  13671. this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName, function (p) { return p.value + deltaY; });
  13672. this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName, function (p) { return p.value - deltaX * 2; });
  13673. this.normalizeParameters(shape, parameters);
  13674. };
  13675. ArrowNorthSouthShapeDescription.prototype.getParameterPoints = function (shape) {
  13676. return [
  13677. new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + (shape.size.width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2), shape.normalizeY(shape.position.y + shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value)))
  13678. ];
  13679. };
  13680. return ArrowNorthSouthShapeDescription;
  13681. }(ArrowVerticalShapeDescription_1.ArrowVerticalShapeDescription));
  13682. exports.ArrowNorthSouthShapeDescription = ArrowNorthSouthShapeDescription;
  13683. /***/ }),
  13684. /* 127 */
  13685. /***/ (function(module, exports, __webpack_require__) {
  13686. "use strict";
  13687. var __extends = (this && this.__extends) || (function () {
  13688. var extendStatics = function (d, b) {
  13689. extendStatics = Object.setPrototypeOf ||
  13690. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13691. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13692. return extendStatics(d, b);
  13693. };
  13694. return function (d, b) {
  13695. extendStatics(d, b);
  13696. function __() { this.constructor = d; }
  13697. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13698. };
  13699. })();
  13700. Object.defineProperty(exports, "__esModule", { value: true });
  13701. var PathPrimitive_1 = __webpack_require__(2);
  13702. var ArrowHorizontalShapeDescription_1 = __webpack_require__(55);
  13703. var ShapeParameterPoint_1 = __webpack_require__(17);
  13704. var Utils_1 = __webpack_require__(0);
  13705. var ShapeType_1 = __webpack_require__(1);
  13706. var DiagramItem_1 = __webpack_require__(3);
  13707. var ArrowRightShapeDescription = /** @class */ (function (_super) {
  13708. __extends(ArrowRightShapeDescription, _super);
  13709. function ArrowRightShapeDescription() {
  13710. return _super.call(this, "Right Arrow") || this;
  13711. }
  13712. Object.defineProperty(ArrowRightShapeDescription.prototype, "key", {
  13713. get: function () { return ShapeType_1.ShapeType.ArrowRight; },
  13714. enumerable: true,
  13715. configurable: true
  13716. });
  13717. ArrowRightShapeDescription.prototype.createPrimitives = function (shape) {
  13718. var rect = shape.rectangle;
  13719. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  13720. var cy = rect.center.y;
  13721. var p0dx = width - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value;
  13722. var p1dy = (height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2;
  13723. var p0x1 = shape.normalizeX(left + p0dx);
  13724. var p1y1 = shape.normalizeY(top + p1dy);
  13725. var p1y2 = shape.normalizeY(bottom - p1dy);
  13726. var primitives = [];
  13727. return primitives.concat([
  13728. new PathPrimitive_1.PathPrimitive([
  13729. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, p1y1),
  13730. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y1),
  13731. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, top),
  13732. new PathPrimitive_1.PathPrimitiveLineToCommand(right, cy),
  13733. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, bottom),
  13734. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y2),
  13735. new PathPrimitive_1.PathPrimitiveLineToCommand(left, p1y2),
  13736. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  13737. ], shape.style)
  13738. ])
  13739. .concat(this.createTextPrimitives(shape));
  13740. };
  13741. ArrowRightShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
  13742. this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName, function (p) { return p.value - deltaX; });
  13743. this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName, function (p) { return p.value - deltaY * 2; });
  13744. this.normalizeParameters(shape, parameters);
  13745. };
  13746. ArrowRightShapeDescription.prototype.getParameterPoints = function (shape) {
  13747. return [
  13748. new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + shape.size.width - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value), shape.normalizeY(shape.position.y + (shape.size.height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2)))
  13749. ];
  13750. };
  13751. ArrowRightShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  13752. var triangleWidth = shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value;
  13753. if (point.x > shape.position.x + shape.size.width - triangleWidth) {
  13754. var tg = shape.size.height / 2 / triangleWidth;
  13755. var delta = (point.x - (shape.position.x + shape.size.width - triangleWidth)) * tg;
  13756. var side = shape.getConnectionPointSide(index);
  13757. if (side === DiagramItem_1.ConnectionPointSide.North)
  13758. point.y += delta;
  13759. else if (side === DiagramItem_1.ConnectionPointSide.South)
  13760. point.y -= delta;
  13761. }
  13762. else
  13763. _super.prototype.processConnectionPoint.call(this, shape, point, index);
  13764. };
  13765. return ArrowRightShapeDescription;
  13766. }(ArrowHorizontalShapeDescription_1.ArrowHorizontalShapeDescription));
  13767. exports.ArrowRightShapeDescription = ArrowRightShapeDescription;
  13768. /***/ }),
  13769. /* 128 */
  13770. /***/ (function(module, exports, __webpack_require__) {
  13771. "use strict";
  13772. var __extends = (this && this.__extends) || (function () {
  13773. var extendStatics = function (d, b) {
  13774. extendStatics = Object.setPrototypeOf ||
  13775. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13776. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13777. return extendStatics(d, b);
  13778. };
  13779. return function (d, b) {
  13780. extendStatics(d, b);
  13781. function __() { this.constructor = d; }
  13782. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13783. };
  13784. })();
  13785. Object.defineProperty(exports, "__esModule", { value: true });
  13786. var PathPrimitive_1 = __webpack_require__(2);
  13787. var ShapeParameterPoint_1 = __webpack_require__(17);
  13788. var Utils_1 = __webpack_require__(0);
  13789. var ArrowVerticalShapeDescription_1 = __webpack_require__(54);
  13790. var ShapeType_1 = __webpack_require__(1);
  13791. var DiagramItem_1 = __webpack_require__(3);
  13792. var ArrowTopShapeDescription = /** @class */ (function (_super) {
  13793. __extends(ArrowTopShapeDescription, _super);
  13794. function ArrowTopShapeDescription() {
  13795. return _super.call(this, "Top Arrow") || this;
  13796. }
  13797. Object.defineProperty(ArrowTopShapeDescription.prototype, "key", {
  13798. get: function () { return ShapeType_1.ShapeType.ArrowTop; },
  13799. enumerable: true,
  13800. configurable: true
  13801. });
  13802. ArrowTopShapeDescription.prototype.createPrimitives = function (shape) {
  13803. var rect = shape.rectangle;
  13804. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  13805. var cx = rect.center.x;
  13806. var p1dx = (width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2;
  13807. var p0dy = shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value;
  13808. var p1x1 = shape.normalizeX(left + p1dx);
  13809. var p0y1 = shape.normalizeY(top + p0dy);
  13810. var p1x2 = shape.normalizeX(right - p1dx);
  13811. var primitives = [];
  13812. return primitives.concat([
  13813. new PathPrimitive_1.PathPrimitive([
  13814. new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
  13815. new PathPrimitive_1.PathPrimitiveLineToCommand(right, p0y1),
  13816. new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, p0y1),
  13817. new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, bottom),
  13818. new PathPrimitive_1.PathPrimitiveLineToCommand(p1x1, bottom),
  13819. new PathPrimitive_1.PathPrimitiveLineToCommand(p1x1, p0y1),
  13820. new PathPrimitive_1.PathPrimitiveLineToCommand(left, p0y1),
  13821. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  13822. ], shape.style)
  13823. ])
  13824. .concat(this.createTextPrimitives(shape));
  13825. };
  13826. ArrowTopShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
  13827. this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName, function (p) { return p.value + deltaY; });
  13828. this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName, function (p) { return p.value - deltaX * 2; });
  13829. this.normalizeParameters(shape, parameters);
  13830. };
  13831. ArrowTopShapeDescription.prototype.getParameterPoints = function (shape) {
  13832. return [
  13833. new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + (shape.size.width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2), shape.normalizeY(shape.position.y + shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value)))
  13834. ];
  13835. };
  13836. ArrowTopShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  13837. var triangleHeight = shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value;
  13838. if (point.y < shape.position.y + triangleHeight) {
  13839. var tg = shape.size.width / 2 / triangleHeight;
  13840. var delta = (shape.position.y + triangleHeight - point.y) * tg;
  13841. var side = shape.getConnectionPointSide(index);
  13842. if (side === DiagramItem_1.ConnectionPointSide.East)
  13843. point.x -= delta;
  13844. else if (side === DiagramItem_1.ConnectionPointSide.West)
  13845. point.x += delta;
  13846. }
  13847. else
  13848. _super.prototype.processConnectionPoint.call(this, shape, point, index);
  13849. };
  13850. return ArrowTopShapeDescription;
  13851. }(ArrowVerticalShapeDescription_1.ArrowVerticalShapeDescription));
  13852. exports.ArrowTopShapeDescription = ArrowTopShapeDescription;
  13853. /***/ }),
  13854. /* 129 */
  13855. /***/ (function(module, exports, __webpack_require__) {
  13856. "use strict";
  13857. var __extends = (this && this.__extends) || (function () {
  13858. var extendStatics = function (d, b) {
  13859. extendStatics = Object.setPrototypeOf ||
  13860. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13861. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13862. return extendStatics(d, b);
  13863. };
  13864. return function (d, b) {
  13865. extendStatics(d, b);
  13866. function __() { this.constructor = d; }
  13867. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13868. };
  13869. })();
  13870. Object.defineProperty(exports, "__esModule", { value: true });
  13871. var ShapeDescription_1 = __webpack_require__(11);
  13872. var Utils_1 = __webpack_require__(0);
  13873. var ShapeParameters_1 = __webpack_require__(25);
  13874. var ShapeParameterPoint_1 = __webpack_require__(17);
  13875. var PathPrimitive_1 = __webpack_require__(2);
  13876. var ShapeType_1 = __webpack_require__(1);
  13877. exports.CrossHorizontalWidthParameterName = "chw";
  13878. exports.CrossVerticalWidthParameterName = "cvw";
  13879. var CrossShapeDescription = /** @class */ (function (_super) {
  13880. __extends(CrossShapeDescription, _super);
  13881. function CrossShapeDescription() {
  13882. return _super.call(this, "Cross", "") || this;
  13883. }
  13884. Object.defineProperty(CrossShapeDescription.prototype, "key", {
  13885. get: function () { return ShapeType_1.ShapeType.Cross; },
  13886. enumerable: true,
  13887. configurable: true
  13888. });
  13889. Object.defineProperty(CrossShapeDescription.prototype, "category", {
  13890. get: function () { return ShapeType_1.ShapeCategory.General; },
  13891. enumerable: true,
  13892. configurable: true
  13893. });
  13894. CrossShapeDescription.prototype.createPrimitives = function (shape) {
  13895. var rect = shape.rectangle;
  13896. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  13897. var p0dx = (width - shape.parameters.get(exports.CrossHorizontalWidthParameterName).value) / 2;
  13898. var p1dy = (height - shape.parameters.get(exports.CrossVerticalWidthParameterName).value) / 2;
  13899. var p0x1 = shape.normalizeX(left + p0dx);
  13900. var p1y1 = shape.normalizeY(top + p1dy);
  13901. var p0x2 = shape.normalizeX(right - p0dx);
  13902. var p1y2 = shape.normalizeY(bottom - p1dy);
  13903. var primitives = [];
  13904. return primitives.concat([
  13905. new PathPrimitive_1.PathPrimitive([
  13906. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, p1y1),
  13907. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y1),
  13908. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, top),
  13909. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, top),
  13910. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, p1y1),
  13911. new PathPrimitive_1.PathPrimitiveLineToCommand(right, p1y1),
  13912. new PathPrimitive_1.PathPrimitiveLineToCommand(right, p1y2),
  13913. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, p1y2),
  13914. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, bottom),
  13915. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, bottom),
  13916. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y2),
  13917. new PathPrimitive_1.PathPrimitiveLineToCommand(left, p1y2),
  13918. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  13919. ], shape.style)
  13920. ])
  13921. .concat(this.createTextPrimitives(shape));
  13922. };
  13923. CrossShapeDescription.prototype.createParameters = function (parameters) {
  13924. parameters.addRange([
  13925. new ShapeParameters_1.ShapeParameter(exports.CrossHorizontalWidthParameterName, this.defaultSize.width * 0.2),
  13926. new ShapeParameters_1.ShapeParameter(exports.CrossVerticalWidthParameterName, this.defaultSize.height * 0.2)
  13927. ]);
  13928. };
  13929. CrossShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
  13930. this.changeParameterValue(parameters, exports.CrossHorizontalWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.width, p.value)); });
  13931. this.changeParameterValue(parameters, exports.CrossVerticalWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.height, p.value)); });
  13932. };
  13933. CrossShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
  13934. this.changeParameterValue(parameters, exports.CrossHorizontalWidthParameterName, function (p) { return p.value - deltaX * 2; });
  13935. this.changeParameterValue(parameters, exports.CrossVerticalWidthParameterName, function (p) { return p.value - deltaY * 2; });
  13936. this.normalizeParameters(shape, parameters);
  13937. };
  13938. CrossShapeDescription.prototype.getParameterPoints = function (shape) {
  13939. return [
  13940. new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + (shape.size.width - shape.parameters.get(exports.CrossHorizontalWidthParameterName).value) / 2), shape.normalizeY(shape.position.y + (shape.size.height - shape.parameters.get(exports.CrossVerticalWidthParameterName).value) / 2)))
  13941. ];
  13942. };
  13943. return CrossShapeDescription;
  13944. }(ShapeDescription_1.ShapeDescription));
  13945. exports.CrossShapeDescription = CrossShapeDescription;
  13946. /***/ }),
  13947. /* 130 */
  13948. /***/ (function(module, exports, __webpack_require__) {
  13949. "use strict";
  13950. var __extends = (this && this.__extends) || (function () {
  13951. var extendStatics = function (d, b) {
  13952. extendStatics = Object.setPrototypeOf ||
  13953. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  13954. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13955. return extendStatics(d, b);
  13956. };
  13957. return function (d, b) {
  13958. extendStatics(d, b);
  13959. function __() { this.constructor = d; }
  13960. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13961. };
  13962. })();
  13963. Object.defineProperty(exports, "__esModule", { value: true });
  13964. var ShapeDescription_1 = __webpack_require__(11);
  13965. var PathPrimitive_1 = __webpack_require__(2);
  13966. var ShapeType_1 = __webpack_require__(1);
  13967. var ConnectionPoint_1 = __webpack_require__(32);
  13968. var DiagramItem_1 = __webpack_require__(3);
  13969. var HeartShapeDescription = /** @class */ (function (_super) {
  13970. __extends(HeartShapeDescription, _super);
  13971. function HeartShapeDescription() {
  13972. return _super.call(this, "Heart", "") || this;
  13973. }
  13974. Object.defineProperty(HeartShapeDescription.prototype, "key", {
  13975. get: function () { return ShapeType_1.ShapeType.Heart; },
  13976. enumerable: true,
  13977. configurable: true
  13978. });
  13979. Object.defineProperty(HeartShapeDescription.prototype, "category", {
  13980. get: function () { return ShapeType_1.ShapeCategory.General; },
  13981. enumerable: true,
  13982. configurable: true
  13983. });
  13984. HeartShapeDescription.prototype.createConnectionPoints = function () {
  13985. return [
  13986. new ConnectionPoint_1.ConnectionPoint(0.5, 0.15, DiagramItem_1.ConnectionPointSide.North),
  13987. new ConnectionPoint_1.ConnectionPoint(1, 0.25, DiagramItem_1.ConnectionPointSide.East),
  13988. new ConnectionPoint_1.ConnectionPoint(0.5, 1, DiagramItem_1.ConnectionPointSide.South),
  13989. new ConnectionPoint_1.ConnectionPoint(0, 0.25, DiagramItem_1.ConnectionPointSide.West)
  13990. ];
  13991. };
  13992. HeartShapeDescription.prototype.createPrimitives = function (shape) {
  13993. var rect = shape.rectangle;
  13994. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  13995. var primitives = [];
  13996. return primitives.concat([
  13997. new PathPrimitive_1.PathPrimitive([
  13998. new PathPrimitive_1.PathPrimitiveMoveToCommand(right - width * 0.25, top),
  13999. new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(right - width * 0.15, top, right, top + height * 0.1, right, top + height * 0.25),
  14000. new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(right, top + height * 0.3, right - width * 0.02, top + height * 0.35, right - width * 0.05, top + height * 0.4),
  14001. new PathPrimitive_1.PathPrimitiveLineToCommand(rect.center.x, bottom),
  14002. new PathPrimitive_1.PathPrimitiveLineToCommand(left + width * 0.05, top + height * 0.4),
  14003. new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(left + width * 0.02, top + height * 0.35, left, top + height * 0.3, left, top + height * 0.25),
  14004. new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(left, top + height * 0.1, left + width * 0.15, top, left + width * 0.25, top),
  14005. new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(left + width * 0.3, top, left + width * 0.45, top + height * 0.03, left + width * 0.5, top + height * 0.15),
  14006. new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(right - width * 0.45, top + height * 0.03, right - width * 0.3, top, right - width * 0.25, top),
  14007. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  14008. ], shape.style)
  14009. ])
  14010. .concat(this.createTextPrimitives(shape));
  14011. };
  14012. return HeartShapeDescription;
  14013. }(ShapeDescription_1.ShapeDescription));
  14014. exports.HeartShapeDescription = HeartShapeDescription;
  14015. /***/ }),
  14016. /* 131 */
  14017. /***/ (function(module, exports, __webpack_require__) {
  14018. "use strict";
  14019. var __extends = (this && this.__extends) || (function () {
  14020. var extendStatics = function (d, b) {
  14021. extendStatics = Object.setPrototypeOf ||
  14022. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14023. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14024. return extendStatics(d, b);
  14025. };
  14026. return function (d, b) {
  14027. extendStatics(d, b);
  14028. function __() { this.constructor = d; }
  14029. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14030. };
  14031. })();
  14032. Object.defineProperty(exports, "__esModule", { value: true });
  14033. var PathPrimitive_1 = __webpack_require__(2);
  14034. var ShapeType_1 = __webpack_require__(1);
  14035. var PolygonShapeDescription_1 = __webpack_require__(57);
  14036. var OctagonShapeDescription = /** @class */ (function (_super) {
  14037. __extends(OctagonShapeDescription, _super);
  14038. function OctagonShapeDescription() {
  14039. return _super.call(this, "Octagon", "") || this;
  14040. }
  14041. Object.defineProperty(OctagonShapeDescription.prototype, "key", {
  14042. get: function () { return ShapeType_1.ShapeType.Octagon; },
  14043. enumerable: true,
  14044. configurable: true
  14045. });
  14046. Object.defineProperty(OctagonShapeDescription.prototype, "angleCount", {
  14047. get: function () { return 8; },
  14048. enumerable: true,
  14049. configurable: true
  14050. });
  14051. OctagonShapeDescription.prototype.createPrimitives = function (shape) {
  14052. var rect = shape.rectangle;
  14053. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14054. var angle = Math.PI - this.angle;
  14055. var sideX = width / (1 + 2 * Math.cos(angle));
  14056. var sideY = height / (1 + 2 * Math.cos(angle));
  14057. var x1 = left + (width - sideX) / 2;
  14058. var x2 = x1 + sideX;
  14059. var y1 = top + (height - sideY) / 2;
  14060. var y2 = y1 + sideY;
  14061. var primitives = [];
  14062. return primitives.concat([
  14063. new PathPrimitive_1.PathPrimitive([
  14064. new PathPrimitive_1.PathPrimitiveMoveToCommand(x1, top),
  14065. new PathPrimitive_1.PathPrimitiveLineToCommand(x2, top),
  14066. new PathPrimitive_1.PathPrimitiveLineToCommand(right, y1),
  14067. new PathPrimitive_1.PathPrimitiveLineToCommand(right, y2),
  14068. new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
  14069. new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
  14070. new PathPrimitive_1.PathPrimitiveLineToCommand(left, y2),
  14071. new PathPrimitive_1.PathPrimitiveLineToCommand(left, y1),
  14072. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  14073. ], shape.style)
  14074. ])
  14075. .concat(this.createTextPrimitives(shape));
  14076. };
  14077. OctagonShapeDescription.prototype.calculateHeight = function (width) {
  14078. return width;
  14079. };
  14080. return OctagonShapeDescription;
  14081. }(PolygonShapeDescription_1.PolygonShapeDescription));
  14082. exports.OctagonShapeDescription = OctagonShapeDescription;
  14083. /***/ }),
  14084. /* 132 */
  14085. /***/ (function(module, exports, __webpack_require__) {
  14086. "use strict";
  14087. var __extends = (this && this.__extends) || (function () {
  14088. var extendStatics = function (d, b) {
  14089. extendStatics = Object.setPrototypeOf ||
  14090. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14091. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14092. return extendStatics(d, b);
  14093. };
  14094. return function (d, b) {
  14095. extendStatics(d, b);
  14096. function __() { this.constructor = d; }
  14097. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14098. };
  14099. })();
  14100. Object.defineProperty(exports, "__esModule", { value: true });
  14101. var PathPrimitive_1 = __webpack_require__(2);
  14102. var ShapeType_1 = __webpack_require__(1);
  14103. var PentagonShapeDescription_1 = __webpack_require__(77);
  14104. var ShapeParameters_1 = __webpack_require__(25);
  14105. var ShapeParameterPoint_1 = __webpack_require__(17);
  14106. var Utils_1 = __webpack_require__(0);
  14107. var DiagramItem_1 = __webpack_require__(3);
  14108. exports.StarConvexParameterName = "sc";
  14109. var StarShapeDescription = /** @class */ (function (_super) {
  14110. __extends(StarShapeDescription, _super);
  14111. function StarShapeDescription() {
  14112. return _super.call(this, "Star", "") || this;
  14113. }
  14114. Object.defineProperty(StarShapeDescription.prototype, "key", {
  14115. get: function () { return ShapeType_1.ShapeType.Star; },
  14116. enumerable: true,
  14117. configurable: true
  14118. });
  14119. StarShapeDescription.prototype.createPrimitives = function (shape) {
  14120. var rect = shape.rectangle;
  14121. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14122. bottom = this.getActualBottom(top, bottom, width, height);
  14123. var cx = rect.center.x;
  14124. var cy = top + (bottom - top) / 2;
  14125. var ratio = height / width;
  14126. var angle = Math.PI - this.angle;
  14127. var py = width / 2 * Math.tan(angle / 2) * ratio;
  14128. var y = top + py;
  14129. var px = (height - py) / Math.tan(angle) / ratio;
  14130. var x1 = left + px;
  14131. var x2 = right - px;
  14132. var pDistance = shape.parameters.get(exports.StarConvexParameterName).value;
  14133. var distance = this.getInnerPointDistance(cx, cx, right, cy, top, y);
  14134. var primitives = [];
  14135. return primitives.concat([
  14136. new PathPrimitive_1.PathPrimitive([
  14137. new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
  14138. new PathPrimitive_1.PathPrimitiveLineToCommand(this.getInnerPointPos(cx, cx, right, pDistance, distance), this.getInnerPointPos(cy, top, y, pDistance, distance)),
  14139. new PathPrimitive_1.PathPrimitiveLineToCommand(right, y),
  14140. new PathPrimitive_1.PathPrimitiveLineToCommand(this.getInnerPointPos(cx, right, x2, pDistance, distance), this.getInnerPointPos(cy, y, bottom, pDistance, distance)),
  14141. new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
  14142. new PathPrimitive_1.PathPrimitiveLineToCommand(this.getInnerPointPos(cx, x2, x1, pDistance, distance), this.getInnerPointPos(cy, bottom, bottom, pDistance, distance)),
  14143. new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
  14144. new PathPrimitive_1.PathPrimitiveLineToCommand(this.getInnerPointPos(cx, x1, left, pDistance, distance), this.getInnerPointPos(cy, bottom, y, pDistance, distance)),
  14145. new PathPrimitive_1.PathPrimitiveLineToCommand(left, y),
  14146. new PathPrimitive_1.PathPrimitiveLineToCommand(this.getInnerPointPos(cx, left, cx, pDistance, distance), this.getInnerPointPos(cy, y, top, pDistance, distance)),
  14147. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  14148. ], shape.style)
  14149. ])
  14150. .concat(this.createTextPrimitives(shape));
  14151. };
  14152. StarShapeDescription.prototype.createParameters = function (parameters) {
  14153. parameters.addRange([
  14154. new ShapeParameters_1.ShapeParameter(exports.StarConvexParameterName, 300)
  14155. ]);
  14156. };
  14157. StarShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
  14158. var rect = shape.rectangle;
  14159. var top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14160. bottom = this.getActualBottom(top, bottom, width, height);
  14161. var cx = rect.center.x;
  14162. var cy = top + (bottom - top) / 2;
  14163. var ratio = height / width;
  14164. var angle = Math.PI - this.angle;
  14165. var py = width / 2 * Math.tan(angle / 2) * ratio;
  14166. var y = top + py;
  14167. var distance = this.getInnerPointDistance(cx, cx, right, cy, top, y);
  14168. this.changeParameterValue(parameters, exports.StarConvexParameterName, function (p) { return Math.max(0, Math.min(distance, p.value)); });
  14169. };
  14170. StarShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
  14171. var distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
  14172. if (deltaX < 0 || deltaY > 0)
  14173. distance = -distance;
  14174. this.changeParameterValue(parameters, exports.StarConvexParameterName, function (p) { return p.value + distance; });
  14175. this.normalizeParameters(shape, parameters);
  14176. };
  14177. StarShapeDescription.prototype.getParameterPoints = function (shape) {
  14178. var rect = shape.rectangle;
  14179. var top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14180. bottom = this.getActualBottom(top, bottom, width, height);
  14181. var cx = rect.center.x;
  14182. var cy = top + (bottom - top) / 2;
  14183. var ratio = height / width;
  14184. var angle = Math.PI - this.angle;
  14185. var py = width / 2 * Math.tan(angle / 2) * ratio;
  14186. var y = top + py;
  14187. var pDistance = shape.parameters.get(exports.StarConvexParameterName).value;
  14188. var distance = this.getInnerPointDistance(cx, cx, right, cy, top, y);
  14189. var innerPointX = this.getInnerPointPos(cx, cx, right, pDistance, distance);
  14190. var innerPointY = this.getInnerPointPos(cy, top, y, pDistance, distance);
  14191. return [
  14192. new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(innerPointX, innerPointY))
  14193. ];
  14194. };
  14195. StarShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  14196. _super.prototype.processConnectionPoint.call(this, shape, point, index);
  14197. var side = shape.getConnectionPointSide(index);
  14198. if (side === DiagramItem_1.ConnectionPointSide.South) {
  14199. var rect = shape.rectangle;
  14200. var top_1 = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14201. bottom = this.getActualBottom(top_1, bottom, width, height);
  14202. var cx = rect.center.x;
  14203. var cy = top_1 + (bottom - top_1) / 2;
  14204. var ratio = height / width;
  14205. var angle = Math.PI - this.angle;
  14206. var py = width / 2 * Math.tan(angle / 2) * ratio;
  14207. var y = top_1 + py;
  14208. var pDistance = shape.parameters.get(exports.StarConvexParameterName).value;
  14209. var distance = this.getInnerPointDistance(cx, cx, right, cy, top_1, y);
  14210. point.y = this.getInnerPointPos(cy, bottom, bottom, pDistance, distance);
  14211. }
  14212. };
  14213. StarShapeDescription.prototype.getInnerPointDistanceByAxis = function (center, edge1, edge2) {
  14214. var edgeX = Math.min(edge1, edge2) + Math.abs(edge1 - edge2) / 2;
  14215. return edgeX - center;
  14216. };
  14217. StarShapeDescription.prototype.getInnerPointPos = function (center, edge1, edge2, pDistance, distance) {
  14218. var ratio = Math.min(1, pDistance / distance);
  14219. return center + this.getInnerPointDistanceByAxis(center, edge1, edge2) * ratio;
  14220. };
  14221. StarShapeDescription.prototype.getInnerPointDistance = function (centerX, edgeX1, edgeX2, centerY, edgeY1, edgeY2) {
  14222. var disX = this.getInnerPointDistanceByAxis(centerX, edgeX1, edgeX2);
  14223. var disY = this.getInnerPointDistanceByAxis(centerY, edgeY1, edgeY2);
  14224. return Math.sqrt(Math.pow(disX, 2) + Math.pow(disY, 2));
  14225. };
  14226. StarShapeDescription.prototype.getActualBottom = function (top, bottom, width, height) {
  14227. var result = top + _super.prototype.calculateHeight.call(this, width) * height / width;
  14228. return result < bottom ? result : bottom;
  14229. };
  14230. StarShapeDescription.prototype.calculateHeight = function (width) {
  14231. return width;
  14232. };
  14233. return StarShapeDescription;
  14234. }(PentagonShapeDescription_1.PentagonShapeDescription));
  14235. exports.StarShapeDescription = StarShapeDescription;
  14236. /***/ }),
  14237. /* 133 */
  14238. /***/ (function(module, exports, __webpack_require__) {
  14239. "use strict";
  14240. var __extends = (this && this.__extends) || (function () {
  14241. var extendStatics = function (d, b) {
  14242. extendStatics = Object.setPrototypeOf ||
  14243. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14244. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14245. return extendStatics(d, b);
  14246. };
  14247. return function (d, b) {
  14248. extendStatics(d, b);
  14249. function __() { this.constructor = d; }
  14250. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14251. };
  14252. })();
  14253. Object.defineProperty(exports, "__esModule", { value: true });
  14254. var PathPrimitive_1 = __webpack_require__(2);
  14255. var ShapeParameterPoint_1 = __webpack_require__(17);
  14256. var Utils_1 = __webpack_require__(0);
  14257. var ArrowVerticalShapeDescription_1 = __webpack_require__(54);
  14258. var ShapeType_1 = __webpack_require__(1);
  14259. var DiagramItem_1 = __webpack_require__(3);
  14260. var ArrowBottomShapeDescription = /** @class */ (function (_super) {
  14261. __extends(ArrowBottomShapeDescription, _super);
  14262. function ArrowBottomShapeDescription() {
  14263. return _super.call(this, "Bottom Arrow") || this;
  14264. }
  14265. Object.defineProperty(ArrowBottomShapeDescription.prototype, "key", {
  14266. get: function () { return ShapeType_1.ShapeType.ArrowBottom; },
  14267. enumerable: true,
  14268. configurable: true
  14269. });
  14270. ArrowBottomShapeDescription.prototype.createPrimitives = function (shape) {
  14271. var rect = shape.rectangle;
  14272. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14273. var cx = rect.center.x;
  14274. var p1dx = (width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2;
  14275. var p0dy = height - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value;
  14276. var p1x1 = shape.normalizeX(left + p1dx);
  14277. var p0y1 = shape.normalizeY(top + p0dy);
  14278. var p1x2 = shape.normalizeX(right - p1dx);
  14279. var primitives = [];
  14280. return primitives.concat([
  14281. new PathPrimitive_1.PathPrimitive([
  14282. new PathPrimitive_1.PathPrimitiveMoveToCommand(p1x1, top),
  14283. new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, top),
  14284. new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, p0y1),
  14285. new PathPrimitive_1.PathPrimitiveLineToCommand(right, p0y1),
  14286. new PathPrimitive_1.PathPrimitiveLineToCommand(cx, bottom),
  14287. new PathPrimitive_1.PathPrimitiveLineToCommand(left, p0y1),
  14288. new PathPrimitive_1.PathPrimitiveLineToCommand(p1x1, p0y1),
  14289. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  14290. ], shape.style)
  14291. ])
  14292. .concat(this.createTextPrimitives(shape));
  14293. };
  14294. ArrowBottomShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
  14295. this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName, function (p) { return p.value - deltaY; });
  14296. this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName, function (p) { return p.value - deltaX * 2; });
  14297. this.normalizeParameters(shape, parameters);
  14298. };
  14299. ArrowBottomShapeDescription.prototype.getParameterPoints = function (shape) {
  14300. return [
  14301. new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + (shape.size.width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2), shape.normalizeY(shape.position.y + shape.size.height - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value)))
  14302. ];
  14303. };
  14304. ArrowBottomShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  14305. var triangleHeight = shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value;
  14306. if (point.y > shape.position.y + shape.size.height - triangleHeight) {
  14307. var tg = shape.size.width / 2 / triangleHeight;
  14308. var delta = (point.y - (shape.position.y + shape.size.height - triangleHeight)) * tg;
  14309. var side = shape.getConnectionPointSide(index);
  14310. if (side === DiagramItem_1.ConnectionPointSide.East)
  14311. point.x -= delta;
  14312. else if (side === DiagramItem_1.ConnectionPointSide.West)
  14313. point.x += delta;
  14314. }
  14315. else
  14316. _super.prototype.processConnectionPoint.call(this, shape, point, index);
  14317. };
  14318. return ArrowBottomShapeDescription;
  14319. }(ArrowVerticalShapeDescription_1.ArrowVerticalShapeDescription));
  14320. exports.ArrowBottomShapeDescription = ArrowBottomShapeDescription;
  14321. /***/ }),
  14322. /* 134 */
  14323. /***/ (function(module, exports, __webpack_require__) {
  14324. "use strict";
  14325. var __extends = (this && this.__extends) || (function () {
  14326. var extendStatics = function (d, b) {
  14327. extendStatics = Object.setPrototypeOf ||
  14328. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14329. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14330. return extendStatics(d, b);
  14331. };
  14332. return function (d, b) {
  14333. extendStatics(d, b);
  14334. function __() { this.constructor = d; }
  14335. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14336. };
  14337. })();
  14338. Object.defineProperty(exports, "__esModule", { value: true });
  14339. var Shape_1 = __webpack_require__(9);
  14340. var PathPrimitive_1 = __webpack_require__(2);
  14341. var ArrowHorizontalShapeDescription_1 = __webpack_require__(55);
  14342. var ShapeParameterPoint_1 = __webpack_require__(17);
  14343. var Utils_1 = __webpack_require__(0);
  14344. var ShapeType_1 = __webpack_require__(1);
  14345. var ArrowEastWestShapeDescription = /** @class */ (function (_super) {
  14346. __extends(ArrowEastWestShapeDescription, _super);
  14347. function ArrowEastWestShapeDescription() {
  14348. return _super.call(this, "East-West Arrow") || this;
  14349. }
  14350. Object.defineProperty(ArrowEastWestShapeDescription.prototype, "key", {
  14351. get: function () { return ShapeType_1.ShapeType.ArrowEastWest; },
  14352. enumerable: true,
  14353. configurable: true
  14354. });
  14355. ArrowEastWestShapeDescription.prototype.createPrimitives = function (shape) {
  14356. var rect = shape.rectangle;
  14357. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14358. var cy = rect.center.y;
  14359. var p0dx = shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value;
  14360. var p1dy = (height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2;
  14361. var p0x1 = shape.normalizeX(left + p0dx);
  14362. var p1y1 = shape.normalizeY(top + p1dy);
  14363. var p0x2 = shape.normalizeX(right - p0dx);
  14364. var p1y2 = shape.normalizeY(bottom - p1dy);
  14365. var primitives = [];
  14366. return primitives.concat([
  14367. new PathPrimitive_1.PathPrimitive([
  14368. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, cy),
  14369. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, top),
  14370. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y1),
  14371. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, p1y1),
  14372. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, top),
  14373. new PathPrimitive_1.PathPrimitiveLineToCommand(right, cy),
  14374. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, bottom),
  14375. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, p1y2),
  14376. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y2),
  14377. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, bottom),
  14378. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  14379. ], shape.style)
  14380. ])
  14381. .concat(this.createTextPrimitives(shape));
  14382. };
  14383. ArrowEastWestShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
  14384. this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.width / 2 - 2 * Shape_1.Shape.lineWidth, p.value)); });
  14385. this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName, function (p) { return Math.max(0, Math.min(shape.size.height, p.value)); });
  14386. };
  14387. ArrowEastWestShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
  14388. this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName, function (p) { return p.value + deltaX; });
  14389. this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName, function (p) { return p.value - deltaY * 2; });
  14390. this.normalizeParameters(shape, parameters);
  14391. };
  14392. ArrowEastWestShapeDescription.prototype.getParameterPoints = function (shape) {
  14393. return [
  14394. new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value), shape.normalizeY(shape.position.y + (shape.size.height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2)))
  14395. ];
  14396. };
  14397. return ArrowEastWestShapeDescription;
  14398. }(ArrowHorizontalShapeDescription_1.ArrowHorizontalShapeDescription));
  14399. exports.ArrowEastWestShapeDescription = ArrowEastWestShapeDescription;
  14400. /***/ }),
  14401. /* 135 */
  14402. /***/ (function(module, exports, __webpack_require__) {
  14403. "use strict";
  14404. var __extends = (this && this.__extends) || (function () {
  14405. var extendStatics = function (d, b) {
  14406. extendStatics = Object.setPrototypeOf ||
  14407. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14408. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14409. return extendStatics(d, b);
  14410. };
  14411. return function (d, b) {
  14412. extendStatics(d, b);
  14413. function __() { this.constructor = d; }
  14414. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14415. };
  14416. })();
  14417. Object.defineProperty(exports, "__esModule", { value: true });
  14418. var PathPrimitive_1 = __webpack_require__(2);
  14419. var ArrowHorizontalShapeDescription_1 = __webpack_require__(55);
  14420. var ShapeParameterPoint_1 = __webpack_require__(17);
  14421. var Utils_1 = __webpack_require__(0);
  14422. var ShapeType_1 = __webpack_require__(1);
  14423. var DiagramItem_1 = __webpack_require__(3);
  14424. var ArrowLeftShapeDescription = /** @class */ (function (_super) {
  14425. __extends(ArrowLeftShapeDescription, _super);
  14426. function ArrowLeftShapeDescription() {
  14427. return _super.call(this, "Left Arrow") || this;
  14428. }
  14429. Object.defineProperty(ArrowLeftShapeDescription.prototype, "key", {
  14430. get: function () { return ShapeType_1.ShapeType.ArrowLeft; },
  14431. enumerable: true,
  14432. configurable: true
  14433. });
  14434. ArrowLeftShapeDescription.prototype.createPrimitives = function (shape) {
  14435. var rect = shape.rectangle;
  14436. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14437. var cy = rect.center.y;
  14438. var p0dx = shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value;
  14439. var p1dy = (height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2;
  14440. var p0x1 = shape.normalizeX(left + p0dx);
  14441. var p1y1 = shape.normalizeY(top + p1dy);
  14442. var p1y2 = shape.normalizeY(bottom - p1dy);
  14443. var primitives = [];
  14444. return primitives.concat([
  14445. new PathPrimitive_1.PathPrimitive([
  14446. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, cy),
  14447. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, top),
  14448. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y1),
  14449. new PathPrimitive_1.PathPrimitiveLineToCommand(right, p1y1),
  14450. new PathPrimitive_1.PathPrimitiveLineToCommand(right, p1y2),
  14451. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y2),
  14452. new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, bottom),
  14453. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  14454. ], shape.style)
  14455. ])
  14456. .concat(this.createTextPrimitives(shape));
  14457. };
  14458. ArrowLeftShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
  14459. this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName, function (p) { return p.value + deltaX; });
  14460. this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName, function (p) { return p.value - deltaY * 2; });
  14461. this.normalizeParameters(shape, parameters);
  14462. };
  14463. ArrowLeftShapeDescription.prototype.getParameterPoints = function (shape) {
  14464. return [
  14465. new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value), shape.normalizeY(shape.position.y + (shape.size.height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2)))
  14466. ];
  14467. };
  14468. ArrowLeftShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  14469. var triangleWidth = shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value;
  14470. if (point.x < shape.position.x + triangleWidth) {
  14471. var tg = shape.size.height / 2 / triangleWidth;
  14472. var delta = (shape.position.x + triangleWidth - point.x) * tg;
  14473. var side = shape.getConnectionPointSide(index);
  14474. if (side === DiagramItem_1.ConnectionPointSide.North)
  14475. point.y += delta;
  14476. else if (side === DiagramItem_1.ConnectionPointSide.South)
  14477. point.y -= delta;
  14478. }
  14479. else
  14480. _super.prototype.processConnectionPoint.call(this, shape, point, index);
  14481. };
  14482. return ArrowLeftShapeDescription;
  14483. }(ArrowHorizontalShapeDescription_1.ArrowHorizontalShapeDescription));
  14484. exports.ArrowLeftShapeDescription = ArrowLeftShapeDescription;
  14485. /***/ }),
  14486. /* 136 */
  14487. /***/ (function(module, exports, __webpack_require__) {
  14488. "use strict";
  14489. var __extends = (this && this.__extends) || (function () {
  14490. var extendStatics = function (d, b) {
  14491. extendStatics = Object.setPrototypeOf ||
  14492. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14493. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14494. return extendStatics(d, b);
  14495. };
  14496. return function (d, b) {
  14497. extendStatics(d, b);
  14498. function __() { this.constructor = d; }
  14499. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14500. };
  14501. })();
  14502. Object.defineProperty(exports, "__esModule", { value: true });
  14503. var ShapeType_1 = __webpack_require__(1);
  14504. var Shape_1 = __webpack_require__(9);
  14505. var PathPrimitive_1 = __webpack_require__(2);
  14506. var DocumentShapeDescription_1 = __webpack_require__(80);
  14507. var ClipPathPrimitive_1 = __webpack_require__(52);
  14508. var Utils_1 = __webpack_require__(26);
  14509. var MultipleDocumentsShapeDescription = /** @class */ (function (_super) {
  14510. __extends(MultipleDocumentsShapeDescription, _super);
  14511. function MultipleDocumentsShapeDescription() {
  14512. return _super.call(this, "Multiple Documents", "Multiple\nDocuments") || this;
  14513. }
  14514. Object.defineProperty(MultipleDocumentsShapeDescription.prototype, "key", {
  14515. get: function () { return ShapeType_1.ShapeType.MultipleDocuments; },
  14516. enumerable: true,
  14517. configurable: true
  14518. });
  14519. MultipleDocumentsShapeDescription.prototype.createPrimitives = function (shape) {
  14520. var rect = shape.rectangle;
  14521. var _a = shape.rectangle, left = _a.left, top = _a.top, right = _a.right, bottom = _a.bottom, width = _a.width, height = _a.height;
  14522. var documentOffsetX = width * MultipleDocumentsShapeDescription.documentsOffsetRatio;
  14523. var documentOffsetY = height * MultipleDocumentsShapeDescription.documentsOffsetRatio;
  14524. rect = rect.inflate(-documentOffsetX, -documentOffsetY).offset(-documentOffsetX, -documentOffsetY);
  14525. var rect1 = rect.offset(documentOffsetX, documentOffsetY);
  14526. var rect2 = rect.offset(2 * documentOffsetX, 2 * documentOffsetY);
  14527. var clipPathId = Utils_1.RenderUtils.generateSvgElementId("clipRect");
  14528. var primitives = [];
  14529. return primitives
  14530. .concat(this.createDocumentPrimitives(rect, shape.style, clipPathId + "1", rect1))
  14531. .concat(this.createDocumentPrimitives(rect1, shape.style, clipPathId + "2", rect2))
  14532. .concat(this.createDocumentPrimitives(rect2, shape.style))
  14533. .concat(this.createTextPrimitives(shape));
  14534. };
  14535. MultipleDocumentsShapeDescription.prototype.createDocumentPrimitives = function (rect, style, clipPathId, clipRect) {
  14536. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14537. var cx = rect.center.x;
  14538. var dy = height * DocumentShapeDescription_1.DocumentShapeDescription.curveOffsetRatio;
  14539. var primitives = [];
  14540. primitives = primitives.concat([
  14541. new PathPrimitive_1.PathPrimitive([
  14542. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
  14543. new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
  14544. new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
  14545. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right - width * 0.25, bottom - 2 * dy, cx, bottom - dy),
  14546. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left + width * 0.25, bottom + dy, left, bottom - dy),
  14547. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  14548. ], style, undefined, clipRect && clipPathId)
  14549. ]);
  14550. if (clipRect && clipPathId) {
  14551. primitives = primitives.concat([
  14552. new ClipPathPrimitive_1.ClipPathPrimitive(clipPathId, [
  14553. new PathPrimitive_1.PathPrimitive([
  14554. new PathPrimitive_1.PathPrimitiveMoveToCommand(left - Shape_1.Shape.lineWidth, top - Shape_1.Shape.lineWidth),
  14555. new PathPrimitive_1.PathPrimitiveLineToCommand(right + Shape_1.Shape.lineWidth, top - Shape_1.Shape.lineWidth),
  14556. new PathPrimitive_1.PathPrimitiveLineToCommand(right + Shape_1.Shape.lineWidth, clipRect.top),
  14557. new PathPrimitive_1.PathPrimitiveLineToCommand(clipRect.left, clipRect.top),
  14558. new PathPrimitive_1.PathPrimitiveLineToCommand(clipRect.left, bottom + Shape_1.Shape.lineWidth),
  14559. new PathPrimitive_1.PathPrimitiveLineToCommand(left - Shape_1.Shape.lineWidth, bottom + Shape_1.Shape.lineWidth),
  14560. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  14561. ])
  14562. ])
  14563. ]);
  14564. }
  14565. return primitives;
  14566. };
  14567. MultipleDocumentsShapeDescription.prototype.getTextRectangle = function (rect) {
  14568. var documentOffsetX = rect.width * MultipleDocumentsShapeDescription.documentsOffsetRatio;
  14569. var documentOffsetY = rect.height * MultipleDocumentsShapeDescription.documentsOffsetRatio;
  14570. rect = rect.inflate(-documentOffsetX, -documentOffsetY).offset(-documentOffsetX, -documentOffsetY);
  14571. var innerRect = rect.offset(2 * documentOffsetX, 2 * documentOffsetY);
  14572. return innerRect.resize(0, -rect.height * DocumentShapeDescription_1.DocumentShapeDescription.curveOffsetRatio);
  14573. };
  14574. MultipleDocumentsShapeDescription.documentsOffsetRatio = 0.1;
  14575. return MultipleDocumentsShapeDescription;
  14576. }(DocumentShapeDescription_1.DocumentShapeDescription));
  14577. exports.MultipleDocumentsShapeDescription = MultipleDocumentsShapeDescription;
  14578. /***/ }),
  14579. /* 137 */
  14580. /***/ (function(module, exports, __webpack_require__) {
  14581. "use strict";
  14582. var __extends = (this && this.__extends) || (function () {
  14583. var extendStatics = function (d, b) {
  14584. extendStatics = Object.setPrototypeOf ||
  14585. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14586. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14587. return extendStatics(d, b);
  14588. };
  14589. return function (d, b) {
  14590. extendStatics(d, b);
  14591. function __() { this.constructor = d; }
  14592. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14593. };
  14594. })();
  14595. Object.defineProperty(exports, "__esModule", { value: true });
  14596. var ShapeType_1 = __webpack_require__(1);
  14597. var Utils_1 = __webpack_require__(0);
  14598. var ShapeDescription_1 = __webpack_require__(11);
  14599. var HexagonShapeDescription_1 = __webpack_require__(78);
  14600. var PreparationShapeDescription = /** @class */ (function (_super) {
  14601. __extends(PreparationShapeDescription, _super);
  14602. function PreparationShapeDescription() {
  14603. var _this = _super.call(this, "Preparation", "Preparation") || this;
  14604. _this.defaultSize = new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.75);
  14605. return _this;
  14606. }
  14607. Object.defineProperty(PreparationShapeDescription.prototype, "key", {
  14608. get: function () { return ShapeType_1.ShapeType.Preparation; },
  14609. enumerable: true,
  14610. configurable: true
  14611. });
  14612. Object.defineProperty(PreparationShapeDescription.prototype, "category", {
  14613. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  14614. enumerable: true,
  14615. configurable: true
  14616. });
  14617. return PreparationShapeDescription;
  14618. }(HexagonShapeDescription_1.HexagonShapeDescription));
  14619. exports.PreparationShapeDescription = PreparationShapeDescription;
  14620. /***/ }),
  14621. /* 138 */
  14622. /***/ (function(module, exports, __webpack_require__) {
  14623. "use strict";
  14624. var __extends = (this && this.__extends) || (function () {
  14625. var extendStatics = function (d, b) {
  14626. extendStatics = Object.setPrototypeOf ||
  14627. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14628. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14629. return extendStatics(d, b);
  14630. };
  14631. return function (d, b) {
  14632. extendStatics(d, b);
  14633. function __() { this.constructor = d; }
  14634. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14635. };
  14636. })();
  14637. Object.defineProperty(exports, "__esModule", { value: true });
  14638. var RectangleShapeDescription_1 = __webpack_require__(12);
  14639. var ShapeType_1 = __webpack_require__(1);
  14640. var PathPrimitive_1 = __webpack_require__(2);
  14641. var EllipsePrimitive_1 = __webpack_require__(38);
  14642. var HardDiskShapeDescription = /** @class */ (function (_super) {
  14643. __extends(HardDiskShapeDescription, _super);
  14644. function HardDiskShapeDescription() {
  14645. return _super.call(this, "Hard Disk", "Hard Disk") || this;
  14646. }
  14647. Object.defineProperty(HardDiskShapeDescription.prototype, "key", {
  14648. get: function () { return ShapeType_1.ShapeType.HardDisk; },
  14649. enumerable: true,
  14650. configurable: true
  14651. });
  14652. Object.defineProperty(HardDiskShapeDescription.prototype, "category", {
  14653. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  14654. enumerable: true,
  14655. configurable: true
  14656. });
  14657. HardDiskShapeDescription.prototype.createPrimitives = function (shape) {
  14658. var rect = shape.rectangle;
  14659. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14660. var cy = rect.center.y;
  14661. var dx = width * HardDiskShapeDescription.arcWidthRatio;
  14662. var primitives = [];
  14663. return primitives.concat([
  14664. new PathPrimitive_1.PathPrimitive([
  14665. new PathPrimitive_1.PathPrimitiveMoveToCommand(right - dx / 2, top),
  14666. new PathPrimitive_1.PathPrimitiveLineToCommand(left + dx / 2, top),
  14667. new PathPrimitive_1.PathPrimitiveArcToCommand(dx / 2, (bottom - top) / 2, 0, false, false, left + dx / 2, bottom),
  14668. new PathPrimitive_1.PathPrimitiveLineToCommand(right - dx / 2, bottom),
  14669. ], shape.style),
  14670. new EllipsePrimitive_1.EllipsePrimitive(right - dx / 2, cy, dx / 2, (bottom - top) / 2, shape.style)
  14671. ])
  14672. .concat(this.createTextPrimitives(shape));
  14673. };
  14674. HardDiskShapeDescription.prototype.getTextRectangle = function (rect) {
  14675. var dx = rect.width * HardDiskShapeDescription.arcWidthRatio;
  14676. return rect.resize(-dx, 0);
  14677. };
  14678. HardDiskShapeDescription.arcWidthRatio = 0.2;
  14679. return HardDiskShapeDescription;
  14680. }(RectangleShapeDescription_1.RectangleShapeDescription));
  14681. exports.HardDiskShapeDescription = HardDiskShapeDescription;
  14682. /***/ }),
  14683. /* 139 */
  14684. /***/ (function(module, exports, __webpack_require__) {
  14685. "use strict";
  14686. var __extends = (this && this.__extends) || (function () {
  14687. var extendStatics = function (d, b) {
  14688. extendStatics = Object.setPrototypeOf ||
  14689. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14690. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14691. return extendStatics(d, b);
  14692. };
  14693. return function (d, b) {
  14694. extendStatics(d, b);
  14695. function __() { this.constructor = d; }
  14696. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14697. };
  14698. })();
  14699. Object.defineProperty(exports, "__esModule", { value: true });
  14700. var RectangleShapeDescription_1 = __webpack_require__(12);
  14701. var ShapeType_1 = __webpack_require__(1);
  14702. var PathPrimitive_1 = __webpack_require__(2);
  14703. var EllipsePrimitive_1 = __webpack_require__(38);
  14704. var DatabaseShapeDescription = /** @class */ (function (_super) {
  14705. __extends(DatabaseShapeDescription, _super);
  14706. function DatabaseShapeDescription() {
  14707. var _this = _super.call(this, "Database", "Database") || this;
  14708. _this.defaultSize.width = _this.defaultSize.height;
  14709. return _this;
  14710. }
  14711. Object.defineProperty(DatabaseShapeDescription.prototype, "key", {
  14712. get: function () { return ShapeType_1.ShapeType.Database; },
  14713. enumerable: true,
  14714. configurable: true
  14715. });
  14716. Object.defineProperty(DatabaseShapeDescription.prototype, "category", {
  14717. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  14718. enumerable: true,
  14719. configurable: true
  14720. });
  14721. DatabaseShapeDescription.prototype.createPrimitives = function (shape) {
  14722. var rect = shape.rectangle;
  14723. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14724. var cx = rect.center.x;
  14725. var dy = height * DatabaseShapeDescription.arcWidthRatio;
  14726. var primitives = [];
  14727. return primitives.concat([
  14728. new PathPrimitive_1.PathPrimitive([
  14729. new PathPrimitive_1.PathPrimitiveMoveToCommand(right, top + dy / 2),
  14730. new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom - dy / 2),
  14731. new PathPrimitive_1.PathPrimitiveArcToCommand((right - left) / 2, dy / 2, 0, false, true, left, bottom - dy / 2),
  14732. new PathPrimitive_1.PathPrimitiveLineToCommand(left, top + dy / 2),
  14733. ], shape.style),
  14734. new EllipsePrimitive_1.EllipsePrimitive(cx, top + dy / 2, (right - left) / 2, dy / 2, shape.style)
  14735. ])
  14736. .concat(this.createTextPrimitives(shape));
  14737. };
  14738. DatabaseShapeDescription.prototype.getTextRectangle = function (rect) {
  14739. var dy = rect.height * DatabaseShapeDescription.arcWidthRatio;
  14740. return rect.resize(0, -dy).offset(0, dy);
  14741. };
  14742. DatabaseShapeDescription.arcWidthRatio = 0.2;
  14743. return DatabaseShapeDescription;
  14744. }(RectangleShapeDescription_1.RectangleShapeDescription));
  14745. exports.DatabaseShapeDescription = DatabaseShapeDescription;
  14746. /***/ }),
  14747. /* 140 */
  14748. /***/ (function(module, exports, __webpack_require__) {
  14749. "use strict";
  14750. var __extends = (this && this.__extends) || (function () {
  14751. var extendStatics = function (d, b) {
  14752. extendStatics = Object.setPrototypeOf ||
  14753. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14754. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14755. return extendStatics(d, b);
  14756. };
  14757. return function (d, b) {
  14758. extendStatics(d, b);
  14759. function __() { this.constructor = d; }
  14760. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14761. };
  14762. })();
  14763. Object.defineProperty(exports, "__esModule", { value: true });
  14764. var RectangleShapeDescription_1 = __webpack_require__(12);
  14765. var ShapeType_1 = __webpack_require__(1);
  14766. var ShapeParameters_1 = __webpack_require__(25);
  14767. var ShapeParameterPoint_1 = __webpack_require__(17);
  14768. var Utils_1 = __webpack_require__(0);
  14769. var PathPrimitive_1 = __webpack_require__(2);
  14770. exports.InternalStorageHorizontalEdgeParameterName = "he";
  14771. exports.InternalStorageVerticalEdgeParameterName = "ve";
  14772. var InternalStorageShapeDescription = /** @class */ (function (_super) {
  14773. __extends(InternalStorageShapeDescription, _super);
  14774. function InternalStorageShapeDescription() {
  14775. return _super.call(this, "Internal Storage", "Internal\nStorage") || this;
  14776. }
  14777. Object.defineProperty(InternalStorageShapeDescription.prototype, "key", {
  14778. get: function () { return ShapeType_1.ShapeType.InternalStorage; },
  14779. enumerable: true,
  14780. configurable: true
  14781. });
  14782. Object.defineProperty(InternalStorageShapeDescription.prototype, "category", {
  14783. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  14784. enumerable: true,
  14785. configurable: true
  14786. });
  14787. InternalStorageShapeDescription.prototype.createPrimitives = function (shape) {
  14788. var rect = shape.rectangle;
  14789. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14790. var x = left + shape.parameters.get(exports.InternalStorageHorizontalEdgeParameterName).value;
  14791. var y = top + shape.parameters.get(exports.InternalStorageVerticalEdgeParameterName).value;
  14792. var primitives = _super.prototype.createPrimitives.call(this, shape);
  14793. return primitives.concat([
  14794. new PathPrimitive_1.PathPrimitive([
  14795. new PathPrimitive_1.PathPrimitiveMoveToCommand(x, top),
  14796. new PathPrimitive_1.PathPrimitiveLineToCommand(x, bottom),
  14797. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, y),
  14798. new PathPrimitive_1.PathPrimitiveLineToCommand(right, y)
  14799. ], shape.style)
  14800. ]);
  14801. };
  14802. InternalStorageShapeDescription.prototype.createParameters = function (parameters) {
  14803. parameters.addRange([
  14804. new ShapeParameters_1.ShapeParameter(exports.InternalStorageHorizontalEdgeParameterName, this.defaultSize.width * 0.1),
  14805. new ShapeParameters_1.ShapeParameter(exports.InternalStorageVerticalEdgeParameterName, this.defaultSize.width * 0.1)
  14806. ]);
  14807. };
  14808. InternalStorageShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
  14809. this.changeParameterValue(parameters, exports.InternalStorageHorizontalEdgeParameterName, function (p) { return Math.max(InternalStorageShapeDescription.minEdge, Math.min(shape.size.width * 0.3, p.value)); });
  14810. this.changeParameterValue(parameters, exports.InternalStorageVerticalEdgeParameterName, function (p) { return Math.max(InternalStorageShapeDescription.minEdge, Math.min(shape.size.height * 0.3, p.value)); });
  14811. };
  14812. InternalStorageShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
  14813. this.changeParameterValue(parameters, exports.InternalStorageHorizontalEdgeParameterName, function (p) { return p.value + deltaX; });
  14814. this.changeParameterValue(parameters, exports.InternalStorageVerticalEdgeParameterName, function (p) { return p.value + deltaY; });
  14815. this.normalizeParameters(shape, parameters);
  14816. };
  14817. InternalStorageShapeDescription.prototype.getParameterPoints = function (shape) {
  14818. return [
  14819. new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + shape.parameters.get(exports.InternalStorageHorizontalEdgeParameterName).value), shape.normalizeY(shape.position.y + shape.parameters.get(exports.InternalStorageVerticalEdgeParameterName).value)))
  14820. ];
  14821. };
  14822. InternalStorageShapeDescription.minEdge = 72;
  14823. return InternalStorageShapeDescription;
  14824. }(RectangleShapeDescription_1.RectangleShapeDescription));
  14825. exports.InternalStorageShapeDescription = InternalStorageShapeDescription;
  14826. /***/ }),
  14827. /* 141 */
  14828. /***/ (function(module, exports, __webpack_require__) {
  14829. "use strict";
  14830. var __extends = (this && this.__extends) || (function () {
  14831. var extendStatics = function (d, b) {
  14832. extendStatics = Object.setPrototypeOf ||
  14833. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14834. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14835. return extendStatics(d, b);
  14836. };
  14837. return function (d, b) {
  14838. extendStatics(d, b);
  14839. function __() { this.constructor = d; }
  14840. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14841. };
  14842. })();
  14843. Object.defineProperty(exports, "__esModule", { value: true });
  14844. var RectangleShapeDescription_1 = __webpack_require__(12);
  14845. var ShapeType_1 = __webpack_require__(1);
  14846. var PathPrimitive_1 = __webpack_require__(2);
  14847. var DiagramItem_1 = __webpack_require__(3);
  14848. var PaperTapeShapeDescription = /** @class */ (function (_super) {
  14849. __extends(PaperTapeShapeDescription, _super);
  14850. function PaperTapeShapeDescription(title, defaultText) {
  14851. if (title === void 0) { title = "Paper Tape"; }
  14852. if (defaultText === void 0) { defaultText = "Paper Tape"; }
  14853. return _super.call(this, title, defaultText) || this;
  14854. }
  14855. Object.defineProperty(PaperTapeShapeDescription.prototype, "key", {
  14856. get: function () { return ShapeType_1.ShapeType.PaperTape; },
  14857. enumerable: true,
  14858. configurable: true
  14859. });
  14860. Object.defineProperty(PaperTapeShapeDescription.prototype, "category", {
  14861. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  14862. enumerable: true,
  14863. configurable: true
  14864. });
  14865. PaperTapeShapeDescription.prototype.createPrimitives = function (shape) {
  14866. var primitives = [];
  14867. return primitives
  14868. .concat(this.createDocumentPrimitives(shape.rectangle, shape.style))
  14869. .concat(this.createTextPrimitives(shape));
  14870. };
  14871. PaperTapeShapeDescription.prototype.createDocumentPrimitives = function (rect, style) {
  14872. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  14873. var cx = rect.center.x;
  14874. var dy = height * PaperTapeShapeDescription.curveOffsetRatio;
  14875. var primitives = [];
  14876. return primitives.concat([
  14877. new PathPrimitive_1.PathPrimitive([
  14878. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
  14879. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left + width * 0.25, top + 2 * dy, cx, top + dy),
  14880. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right - width * 0.25, top - dy, right, top + dy),
  14881. new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
  14882. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right - width * 0.25, bottom - 2 * dy, cx, bottom - dy),
  14883. new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left + width * 0.25, bottom + dy, left, bottom - dy),
  14884. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  14885. ], style)
  14886. ]);
  14887. };
  14888. PaperTapeShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  14889. var side = shape.getConnectionPointSide(index);
  14890. if (side === DiagramItem_1.ConnectionPointSide.North)
  14891. point.y += shape.size.height * PaperTapeShapeDescription.curveOffsetRatio;
  14892. if (side === DiagramItem_1.ConnectionPointSide.South)
  14893. point.y -= shape.size.height * PaperTapeShapeDescription.curveOffsetRatio;
  14894. };
  14895. PaperTapeShapeDescription.prototype.getTextRectangle = function (rect) {
  14896. return rect.inflate(0, -rect.height * PaperTapeShapeDescription.curveOffsetRatio);
  14897. };
  14898. PaperTapeShapeDescription.curveOffsetRatio = 0.1;
  14899. return PaperTapeShapeDescription;
  14900. }(RectangleShapeDescription_1.RectangleShapeDescription));
  14901. exports.PaperTapeShapeDescription = PaperTapeShapeDescription;
  14902. /***/ }),
  14903. /* 142 */
  14904. /***/ (function(module, exports, __webpack_require__) {
  14905. "use strict";
  14906. var __extends = (this && this.__extends) || (function () {
  14907. var extendStatics = function (d, b) {
  14908. extendStatics = Object.setPrototypeOf ||
  14909. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14910. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14911. return extendStatics(d, b);
  14912. };
  14913. return function (d, b) {
  14914. extendStatics(d, b);
  14915. function __() { this.constructor = d; }
  14916. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14917. };
  14918. })();
  14919. Object.defineProperty(exports, "__esModule", { value: true });
  14920. var RectangleShapeDescription_1 = __webpack_require__(12);
  14921. var ShapeType_1 = __webpack_require__(1);
  14922. var PathPrimitive_1 = __webpack_require__(2);
  14923. var DiagramItem_1 = __webpack_require__(3);
  14924. var ManualOperationShapeDescription = /** @class */ (function (_super) {
  14925. __extends(ManualOperationShapeDescription, _super);
  14926. function ManualOperationShapeDescription() {
  14927. return _super.call(this, "Manual Operation", "Manual\nOperation") || this;
  14928. }
  14929. Object.defineProperty(ManualOperationShapeDescription.prototype, "key", {
  14930. get: function () { return ShapeType_1.ShapeType.ManualOperation; },
  14931. enumerable: true,
  14932. configurable: true
  14933. });
  14934. Object.defineProperty(ManualOperationShapeDescription.prototype, "category", {
  14935. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  14936. enumerable: true,
  14937. configurable: true
  14938. });
  14939. ManualOperationShapeDescription.prototype.createPrimitives = function (shape) {
  14940. var rect = shape.rectangle;
  14941. var _a = shape.rectangle, left = _a.left, top = _a.top, right = _a.right, bottom = _a.bottom, width = _a.width, height = _a.height;
  14942. var px = Math.min(Math.max(0, height / Math.tan(ManualOperationShapeDescription.slopeAngle)), width);
  14943. var cx = rect.center.x;
  14944. var x1 = Math.min(left + px, cx);
  14945. var x2 = Math.max(right - px, cx);
  14946. var primitives = [];
  14947. return primitives.concat([
  14948. new PathPrimitive_1.PathPrimitive([
  14949. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
  14950. new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
  14951. new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
  14952. new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
  14953. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  14954. ], shape.style)
  14955. ])
  14956. .concat(this.createTextPrimitives(shape));
  14957. };
  14958. ManualOperationShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
  14959. var offset = shape.size.height / Math.tan(ManualOperationShapeDescription.slopeAngle);
  14960. var side = shape.getConnectionPointSide(index);
  14961. if (side === DiagramItem_1.ConnectionPointSide.East)
  14962. point.x -= offset / 2;
  14963. else if (side === DiagramItem_1.ConnectionPointSide.West)
  14964. point.x += offset / 2;
  14965. };
  14966. ManualOperationShapeDescription.slopeAngle = 81 * Math.PI / 180;
  14967. return ManualOperationShapeDescription;
  14968. }(RectangleShapeDescription_1.RectangleShapeDescription));
  14969. exports.ManualOperationShapeDescription = ManualOperationShapeDescription;
  14970. /***/ }),
  14971. /* 143 */
  14972. /***/ (function(module, exports, __webpack_require__) {
  14973. "use strict";
  14974. var __extends = (this && this.__extends) || (function () {
  14975. var extendStatics = function (d, b) {
  14976. extendStatics = Object.setPrototypeOf ||
  14977. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  14978. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  14979. return extendStatics(d, b);
  14980. };
  14981. return function (d, b) {
  14982. extendStatics(d, b);
  14983. function __() { this.constructor = d; }
  14984. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14985. };
  14986. })();
  14987. Object.defineProperty(exports, "__esModule", { value: true });
  14988. var RectangleShapeDescription_1 = __webpack_require__(12);
  14989. var ShapeType_1 = __webpack_require__(1);
  14990. var PathPrimitive_1 = __webpack_require__(2);
  14991. var DelayShapeDescription = /** @class */ (function (_super) {
  14992. __extends(DelayShapeDescription, _super);
  14993. function DelayShapeDescription() {
  14994. var _this = _super.call(this, "Delay", "Delay") || this;
  14995. _this.defaultSize.width = _this.defaultSize.height;
  14996. return _this;
  14997. }
  14998. Object.defineProperty(DelayShapeDescription.prototype, "key", {
  14999. get: function () { return ShapeType_1.ShapeType.Delay; },
  15000. enumerable: true,
  15001. configurable: true
  15002. });
  15003. Object.defineProperty(DelayShapeDescription.prototype, "category", {
  15004. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  15005. enumerable: true,
  15006. configurable: true
  15007. });
  15008. DelayShapeDescription.prototype.createPrimitives = function (shape) {
  15009. var rect = shape.rectangle;
  15010. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom;
  15011. var cx = rect.center.x;
  15012. var primitives = [];
  15013. return primitives.concat([
  15014. new PathPrimitive_1.PathPrimitive([
  15015. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
  15016. new PathPrimitive_1.PathPrimitiveLineToCommand(cx, top),
  15017. new PathPrimitive_1.PathPrimitiveArcToCommand((right - left) / 2, (bottom - top) / 2, 0, false, true, cx, bottom),
  15018. new PathPrimitive_1.PathPrimitiveLineToCommand(left, bottom),
  15019. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  15020. ], shape.style)
  15021. ])
  15022. .concat(this.createTextPrimitives(shape));
  15023. };
  15024. DelayShapeDescription.arcWidthRatio = 0.2;
  15025. return DelayShapeDescription;
  15026. }(RectangleShapeDescription_1.RectangleShapeDescription));
  15027. exports.DelayShapeDescription = DelayShapeDescription;
  15028. /***/ }),
  15029. /* 144 */
  15030. /***/ (function(module, exports, __webpack_require__) {
  15031. "use strict";
  15032. var __extends = (this && this.__extends) || (function () {
  15033. var extendStatics = function (d, b) {
  15034. extendStatics = Object.setPrototypeOf ||
  15035. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15036. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15037. return extendStatics(d, b);
  15038. };
  15039. return function (d, b) {
  15040. extendStatics(d, b);
  15041. function __() { this.constructor = d; }
  15042. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15043. };
  15044. })();
  15045. Object.defineProperty(exports, "__esModule", { value: true });
  15046. var RectangleShapeDescription_1 = __webpack_require__(12);
  15047. var ShapeType_1 = __webpack_require__(1);
  15048. var PathPrimitive_1 = __webpack_require__(2);
  15049. var StoredDataShapeDescription = /** @class */ (function (_super) {
  15050. __extends(StoredDataShapeDescription, _super);
  15051. function StoredDataShapeDescription() {
  15052. return _super.call(this, "Stored Data", "Stored Data") || this;
  15053. }
  15054. Object.defineProperty(StoredDataShapeDescription.prototype, "key", {
  15055. get: function () { return ShapeType_1.ShapeType.StoredData; },
  15056. enumerable: true,
  15057. configurable: true
  15058. });
  15059. Object.defineProperty(StoredDataShapeDescription.prototype, "category", {
  15060. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  15061. enumerable: true,
  15062. configurable: true
  15063. });
  15064. StoredDataShapeDescription.prototype.createPrimitives = function (shape) {
  15065. var rect = shape.rectangle;
  15066. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  15067. var cy = rect.center.y;
  15068. var dx = width * StoredDataShapeDescription.arcWidthRatio;
  15069. var primitives = [];
  15070. return primitives.concat([
  15071. new PathPrimitive_1.PathPrimitive([
  15072. new PathPrimitive_1.PathPrimitiveMoveToCommand(right, top),
  15073. new PathPrimitive_1.PathPrimitiveLineToCommand(left + dx / 2, top),
  15074. new PathPrimitive_1.PathPrimitiveArcToCommand(dx / 2, (bottom - top) / 2, 0, false, false, left + dx / 2, bottom),
  15075. new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
  15076. new PathPrimitive_1.PathPrimitiveArcToCommand(dx / 2, (bottom - top) / 2, 0, false, true, right, top)
  15077. ], shape.style)
  15078. ])
  15079. .concat(this.createTextPrimitives(shape));
  15080. };
  15081. StoredDataShapeDescription.prototype.getTextRectangle = function (rect) {
  15082. var dx = rect.width * StoredDataShapeDescription.arcWidthRatio;
  15083. return rect.resize(-dx, 0);
  15084. };
  15085. StoredDataShapeDescription.arcWidthRatio = 0.2;
  15086. return StoredDataShapeDescription;
  15087. }(RectangleShapeDescription_1.RectangleShapeDescription));
  15088. exports.StoredDataShapeDescription = StoredDataShapeDescription;
  15089. /***/ }),
  15090. /* 145 */
  15091. /***/ (function(module, exports, __webpack_require__) {
  15092. "use strict";
  15093. var __extends = (this && this.__extends) || (function () {
  15094. var extendStatics = function (d, b) {
  15095. extendStatics = Object.setPrototypeOf ||
  15096. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15097. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15098. return extendStatics(d, b);
  15099. };
  15100. return function (d, b) {
  15101. extendStatics(d, b);
  15102. function __() { this.constructor = d; }
  15103. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15104. };
  15105. })();
  15106. Object.defineProperty(exports, "__esModule", { value: true });
  15107. var ShapeType_1 = __webpack_require__(1);
  15108. var TriangleShapeDescription_1 = __webpack_require__(79);
  15109. var PathPrimitive_1 = __webpack_require__(2);
  15110. var MergeShapeDescription = /** @class */ (function (_super) {
  15111. __extends(MergeShapeDescription, _super);
  15112. function MergeShapeDescription() {
  15113. return _super.call(this, "Merge", "Merge") || this;
  15114. }
  15115. Object.defineProperty(MergeShapeDescription.prototype, "key", {
  15116. get: function () { return ShapeType_1.ShapeType.Merge; },
  15117. enumerable: true,
  15118. configurable: true
  15119. });
  15120. Object.defineProperty(MergeShapeDescription.prototype, "category", {
  15121. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  15122. enumerable: true,
  15123. configurable: true
  15124. });
  15125. MergeShapeDescription.prototype.createPrimitives = function (shape) {
  15126. var rect = shape.rectangle;
  15127. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width;
  15128. var primitives = [];
  15129. return primitives.concat([
  15130. new PathPrimitive_1.PathPrimitive([
  15131. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
  15132. new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
  15133. new PathPrimitive_1.PathPrimitiveLineToCommand(rect.center.x, bottom),
  15134. new PathPrimitive_1.PathPrimitiveClosePathCommand()
  15135. ], shape.style)
  15136. ])
  15137. .concat(this.createTextPrimitives(shape));
  15138. };
  15139. MergeShapeDescription.prototype.calculateHeight = function (width) {
  15140. return width * 0.75;
  15141. };
  15142. MergeShapeDescription.prototype.getTextRectangle = function (rect) {
  15143. return rect.resize(0, -rect.width * 0.25);
  15144. };
  15145. return MergeShapeDescription;
  15146. }(TriangleShapeDescription_1.TriangleShapeDescription));
  15147. exports.MergeShapeDescription = MergeShapeDescription;
  15148. /***/ }),
  15149. /* 146 */
  15150. /***/ (function(module, exports, __webpack_require__) {
  15151. "use strict";
  15152. var __extends = (this && this.__extends) || (function () {
  15153. var extendStatics = function (d, b) {
  15154. extendStatics = Object.setPrototypeOf ||
  15155. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15156. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15157. return extendStatics(d, b);
  15158. };
  15159. return function (d, b) {
  15160. extendStatics(d, b);
  15161. function __() { this.constructor = d; }
  15162. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15163. };
  15164. })();
  15165. Object.defineProperty(exports, "__esModule", { value: true });
  15166. var RectangleShapeDescription_1 = __webpack_require__(12);
  15167. var ShapeType_1 = __webpack_require__(1);
  15168. var PathPrimitive_1 = __webpack_require__(2);
  15169. var DisplayShapeDescription = /** @class */ (function (_super) {
  15170. __extends(DisplayShapeDescription, _super);
  15171. function DisplayShapeDescription() {
  15172. return _super.call(this, "Display", "Display") || this;
  15173. }
  15174. Object.defineProperty(DisplayShapeDescription.prototype, "key", {
  15175. get: function () { return ShapeType_1.ShapeType.Display; },
  15176. enumerable: true,
  15177. configurable: true
  15178. });
  15179. Object.defineProperty(DisplayShapeDescription.prototype, "category", {
  15180. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  15181. enumerable: true,
  15182. configurable: true
  15183. });
  15184. DisplayShapeDescription.prototype.createPrimitives = function (shape) {
  15185. var rect = shape.rectangle;
  15186. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  15187. var cy = rect.center.y;
  15188. var dx = width * DisplayShapeDescription.arcWidthRatio;
  15189. var primitives = [];
  15190. return primitives.concat([
  15191. new PathPrimitive_1.PathPrimitive([
  15192. new PathPrimitive_1.PathPrimitiveMoveToCommand(right - dx / 2, top),
  15193. new PathPrimitive_1.PathPrimitiveLineToCommand(left + dx / 2, top),
  15194. new PathPrimitive_1.PathPrimitiveLineToCommand(left, cy),
  15195. new PathPrimitive_1.PathPrimitiveLineToCommand(left + dx / 2, bottom),
  15196. new PathPrimitive_1.PathPrimitiveLineToCommand(right - dx / 2, bottom),
  15197. new PathPrimitive_1.PathPrimitiveArcToCommand(dx / 2, (bottom - top) / 2, 0, false, false, right - dx / 2, top)
  15198. ], shape.style),
  15199. ])
  15200. .concat(this.createTextPrimitives(shape));
  15201. };
  15202. DisplayShapeDescription.arcWidthRatio = 0.2;
  15203. return DisplayShapeDescription;
  15204. }(RectangleShapeDescription_1.RectangleShapeDescription));
  15205. exports.DisplayShapeDescription = DisplayShapeDescription;
  15206. /***/ }),
  15207. /* 147 */
  15208. /***/ (function(module, exports, __webpack_require__) {
  15209. "use strict";
  15210. var __extends = (this && this.__extends) || (function () {
  15211. var extendStatics = function (d, b) {
  15212. extendStatics = Object.setPrototypeOf ||
  15213. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15214. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15215. return extendStatics(d, b);
  15216. };
  15217. return function (d, b) {
  15218. extendStatics(d, b);
  15219. function __() { this.constructor = d; }
  15220. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15221. };
  15222. })();
  15223. Object.defineProperty(exports, "__esModule", { value: true });
  15224. var ShapeType_1 = __webpack_require__(1);
  15225. var Utils_1 = __webpack_require__(0);
  15226. var ShapeDescription_1 = __webpack_require__(11);
  15227. var EllipseShapeDescription_1 = __webpack_require__(56);
  15228. var PathPrimitive_1 = __webpack_require__(2);
  15229. var OrShapeDescription = /** @class */ (function (_super) {
  15230. __extends(OrShapeDescription, _super);
  15231. function OrShapeDescription() {
  15232. var _this = _super.call(this, "Or", "") || this;
  15233. _this.defaultSize = new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension * 0.5, ShapeDescription_1.ShapeDefaultDimension * 0.5);
  15234. return _this;
  15235. }
  15236. Object.defineProperty(OrShapeDescription.prototype, "key", {
  15237. get: function () { return ShapeType_1.ShapeType.Or; },
  15238. enumerable: true,
  15239. configurable: true
  15240. });
  15241. Object.defineProperty(OrShapeDescription.prototype, "category", {
  15242. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  15243. enumerable: true,
  15244. configurable: true
  15245. });
  15246. Object.defineProperty(OrShapeDescription.prototype, "allowHasText", {
  15247. get: function () { return false; },
  15248. enumerable: true,
  15249. configurable: true
  15250. });
  15251. OrShapeDescription.prototype.createPrimitives = function (shape) {
  15252. var rect = shape.rectangle;
  15253. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom;
  15254. var _a = rect.center, cx = _a.x, cy = _a.y;
  15255. var primitives = [];
  15256. return primitives
  15257. .concat(_super.prototype.createPrimitives.call(this, shape))
  15258. .concat([
  15259. new PathPrimitive_1.PathPrimitive([
  15260. new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
  15261. new PathPrimitive_1.PathPrimitiveLineToCommand(cx, bottom),
  15262. new PathPrimitive_1.PathPrimitiveMoveToCommand(left, cy),
  15263. new PathPrimitive_1.PathPrimitiveLineToCommand(right, cy)
  15264. ], shape.style)
  15265. ]);
  15266. };
  15267. return OrShapeDescription;
  15268. }(EllipseShapeDescription_1.EllipseShapeDescription));
  15269. exports.OrShapeDescription = OrShapeDescription;
  15270. /***/ }),
  15271. /* 148 */
  15272. /***/ (function(module, exports, __webpack_require__) {
  15273. "use strict";
  15274. var __extends = (this && this.__extends) || (function () {
  15275. var extendStatics = function (d, b) {
  15276. extendStatics = Object.setPrototypeOf ||
  15277. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15278. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15279. return extendStatics(d, b);
  15280. };
  15281. return function (d, b) {
  15282. extendStatics(d, b);
  15283. function __() { this.constructor = d; }
  15284. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15285. };
  15286. })();
  15287. Object.defineProperty(exports, "__esModule", { value: true });
  15288. var ShapeType_1 = __webpack_require__(1);
  15289. var Utils_1 = __webpack_require__(0);
  15290. var ShapeDescription_1 = __webpack_require__(11);
  15291. var EllipseShapeDescription_1 = __webpack_require__(56);
  15292. var PathPrimitive_1 = __webpack_require__(2);
  15293. var SummingJunctionShapeDescription = /** @class */ (function (_super) {
  15294. __extends(SummingJunctionShapeDescription, _super);
  15295. function SummingJunctionShapeDescription() {
  15296. var _this = _super.call(this, "Summing Junction", "") || this;
  15297. _this.defaultSize = new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension * 0.5, ShapeDescription_1.ShapeDefaultDimension * 0.5);
  15298. return _this;
  15299. }
  15300. Object.defineProperty(SummingJunctionShapeDescription.prototype, "key", {
  15301. get: function () { return ShapeType_1.ShapeType.SummingJunction; },
  15302. enumerable: true,
  15303. configurable: true
  15304. });
  15305. Object.defineProperty(SummingJunctionShapeDescription.prototype, "category", {
  15306. get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
  15307. enumerable: true,
  15308. configurable: true
  15309. });
  15310. Object.defineProperty(SummingJunctionShapeDescription.prototype, "allowHasText", {
  15311. get: function () { return false; },
  15312. enumerable: true,
  15313. configurable: true
  15314. });
  15315. SummingJunctionShapeDescription.prototype.createPrimitives = function (shape) {
  15316. var rect = shape.rectangle;
  15317. var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
  15318. var _a = rect.center, cx = _a.x, cy = _a.y;
  15319. var rx = width / 2;
  15320. var ry = height / 2;
  15321. var angle = Math.atan(ry / rx);
  15322. var ex = 1 / Math.sqrt(1 / Math.pow(rx, 2) + Math.pow(Math.tan(angle), 2) / Math.pow(ry, 2));
  15323. var ey = ex * Math.tan(angle);
  15324. var primitives = [];
  15325. return primitives
  15326. .concat(_super.prototype.createPrimitives.call(this, shape))
  15327. .concat([
  15328. new PathPrimitive_1.PathPrimitive([
  15329. new PathPrimitive_1.PathPrimitiveMoveToCommand(cx - ex, cy - ey),
  15330. new PathPrimitive_1.PathPrimitiveLineToCommand(cx + ex, cy + ey),
  15331. new PathPrimitive_1.PathPrimitiveMoveToCommand(cx - ex, cy + ey),
  15332. new PathPrimitive_1.PathPrimitiveLineToCommand(cx + ex, cy - ey)
  15333. ], shape.style)
  15334. ]);
  15335. };
  15336. return SummingJunctionShapeDescription;
  15337. }(EllipseShapeDescription_1.EllipseShapeDescription));
  15338. exports.SummingJunctionShapeDescription = SummingJunctionShapeDescription;
  15339. /***/ }),
  15340. /* 149 */
  15341. /***/ (function(module, exports, __webpack_require__) {
  15342. "use strict";
  15343. var __extends = (this && this.__extends) || (function () {
  15344. var extendStatics = function (d, b) {
  15345. extendStatics = Object.setPrototypeOf ||
  15346. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15347. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15348. return extendStatics(d, b);
  15349. };
  15350. return function (d, b) {
  15351. extendStatics(d, b);
  15352. function __() { this.constructor = d; }
  15353. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15354. };
  15355. })();
  15356. Object.defineProperty(exports, "__esModule", { value: true });
  15357. var ShapeType_1 = __webpack_require__(1);
  15358. var ShapeDescription_1 = __webpack_require__(11);
  15359. var ImagePrimitive_1 = __webpack_require__(150);
  15360. var Utils_1 = __webpack_require__(0);
  15361. var ConnectionPoint_1 = __webpack_require__(32);
  15362. var DiagramItem_1 = __webpack_require__(3);
  15363. var CustomShapeDescription = /** @class */ (function (_super) {
  15364. __extends(CustomShapeDescription, _super);
  15365. function CustomShapeDescription(shapeType, title, svgUrl, svgLeft, svgTop, svgWidth, svgHeight, defaultWidth, defaultHeight, defaultText, shapeAllowHasText, textLeft, textTop, textWidth, textHeight, shapeConnectionPoints, shapeCategory) {
  15366. var _this = _super.call(this, title, defaultText, new Utils_1.Size(defaultWidth || 1440, defaultHeight || 1440)) || this;
  15367. _this.shapeType = shapeType;
  15368. _this.svgUrl = svgUrl;
  15369. _this.svgLeft = svgLeft;
  15370. _this.svgTop = svgTop;
  15371. _this.svgWidth = svgWidth;
  15372. _this.svgHeight = svgHeight;
  15373. _this.shapeAllowHasText = shapeAllowHasText;
  15374. _this.textLeft = textLeft;
  15375. _this.textTop = textTop;
  15376. _this.textWidth = textWidth;
  15377. _this.textHeight = textHeight;
  15378. _this.shapeConnectionPoints = shapeConnectionPoints;
  15379. _this.shapeCategory = shapeCategory;
  15380. _this.connectionPoints = _this.createConnectionPoints();
  15381. return _this;
  15382. }
  15383. Object.defineProperty(CustomShapeDescription.prototype, "key", {
  15384. get: function () { return this.shapeType; },
  15385. enumerable: true,
  15386. configurable: true
  15387. });
  15388. Object.defineProperty(CustomShapeDescription.prototype, "category", {
  15389. get: function () { return this.shapeCategory || ShapeType_1.ShapeCategory.Custom; },
  15390. enumerable: true,
  15391. configurable: true
  15392. });
  15393. Object.defineProperty(CustomShapeDescription.prototype, "allowHasText", {
  15394. get: function () { return !!this.shapeAllowHasText; },
  15395. enumerable: true,
  15396. configurable: true
  15397. });
  15398. CustomShapeDescription.prototype.createConnectionPoints = function () {
  15399. if (this.shapeConnectionPoints && this.shapeConnectionPoints.length)
  15400. return this.shapeConnectionPoints.map(function (ptObj) {
  15401. if (ptObj && typeof ptObj["x"] === "number" && typeof ptObj["y"] === "number") {
  15402. var side = typeof ptObj["side"] === "number" ? ptObj["side"] : DiagramItem_1.ConnectionPointSide.Undefined;
  15403. return new ConnectionPoint_1.ConnectionPoint(ptObj["x"], ptObj["y"], side);
  15404. }
  15405. }).filter(function (pt) { return pt; });
  15406. return _super.prototype.createConnectionPoints.call(this);
  15407. };
  15408. CustomShapeDescription.prototype.createPrimitives = function (shape, forToolbox) {
  15409. var _a = shape.rectangle, left = _a.left, top = _a.top, width = _a.width, height = _a.height;
  15410. var svgUrl = shape.description.svgUrl;
  15411. var primitives = [];
  15412. return primitives.concat([
  15413. new ImagePrimitive_1.ImagePrimitive(left + (this.svgLeft && !forToolbox ? this.svgLeft * width : 0), top + (this.svgTop && !forToolbox ? this.svgTop * height : 0), this.svgWidth && !forToolbox ? this.svgWidth * width : width, this.svgHeight && !forToolbox ? this.svgHeight * height : height, svgUrl),
  15414. ])
  15415. .concat(this.createTextPrimitives(shape, forToolbox));
  15416. };
  15417. CustomShapeDescription.prototype.getTextRectangle = function (rect) {
  15418. var left = rect.left, top = rect.top, width = rect.width, height = rect.height;
  15419. return Utils_1.Rectangle.create(left + (this.textLeft ? this.textLeft * width : 0), top + (this.textTop ? this.textTop * height : 0), this.textWidth ? this.textWidth * width : width, this.textHeight ? this.textHeight * height : height);
  15420. };
  15421. return CustomShapeDescription;
  15422. }(ShapeDescription_1.ShapeDescription));
  15423. exports.CustomShapeDescription = CustomShapeDescription;
  15424. /***/ }),
  15425. /* 150 */
  15426. /***/ (function(module, exports, __webpack_require__) {
  15427. "use strict";
  15428. var __extends = (this && this.__extends) || (function () {
  15429. var extendStatics = function (d, b) {
  15430. extendStatics = Object.setPrototypeOf ||
  15431. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15432. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15433. return extendStatics(d, b);
  15434. };
  15435. return function (d, b) {
  15436. extendStatics(d, b);
  15437. function __() { this.constructor = d; }
  15438. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15439. };
  15440. })();
  15441. Object.defineProperty(exports, "__esModule", { value: true });
  15442. var RenderManager_1 = __webpack_require__(10);
  15443. var Primitive_1 = __webpack_require__(15);
  15444. var ImagePrimitive = /** @class */ (function (_super) {
  15445. __extends(ImagePrimitive, _super);
  15446. function ImagePrimitive(x, y, width, height, url, preserveAspectRatio, style, className) {
  15447. if (preserveAspectRatio === void 0) { preserveAspectRatio = "none"; }
  15448. var _this = _super.call(this, style, className) || this;
  15449. _this.x = x;
  15450. _this.y = y;
  15451. _this.width = width;
  15452. _this.height = height;
  15453. _this.url = url;
  15454. _this.preserveAspectRatio = preserveAspectRatio;
  15455. return _this;
  15456. }
  15457. ImagePrimitive.prototype.createMainElement = function () {
  15458. return document.createElementNS(RenderManager_1.svgNS, "image");
  15459. };
  15460. ImagePrimitive.prototype.applyElementProperties = function (element) {
  15461. this.setUnitAttribute(element, "x", this.x);
  15462. this.setUnitAttribute(element, "y", this.y);
  15463. this.setUnitAttribute(element, "width", this.width);
  15464. this.setUnitAttribute(element, "height", this.height);
  15465. this.setUnitAttribute(element, "href", this.url);
  15466. this.setUnitAttribute(element, "preserveAspectRatio", this.preserveAspectRatio);
  15467. _super.prototype.applyElementProperties.call(this, element);
  15468. };
  15469. return ImagePrimitive;
  15470. }(Primitive_1.SvgPrimitive));
  15471. exports.ImagePrimitive = ImagePrimitive;
  15472. /***/ }),
  15473. /* 151 */
  15474. /***/ (function(module, exports, __webpack_require__) {
  15475. "use strict";
  15476. Object.defineProperty(exports, "__esModule", { value: true });
  15477. var Tree_1 = __webpack_require__(152);
  15478. var Forest = /** @class */ (function () {
  15479. function Forest(trees) {
  15480. this.trees = trees;
  15481. }
  15482. Forest.create = function (graph) {
  15483. var components = graph.getConnectedComponents();
  15484. return new Forest(components.map(Tree_1.Tree.createSpanningTree));
  15485. };
  15486. return Forest;
  15487. }());
  15488. exports.Forest = Forest;
  15489. /***/ }),
  15490. /* 152 */
  15491. /***/ (function(module, exports, __webpack_require__) {
  15492. "use strict";
  15493. Object.defineProperty(exports, "__esModule", { value: true });
  15494. var Structures_1 = __webpack_require__(22);
  15495. var Tree = /** @class */ (function () {
  15496. function Tree(root, parentToChildren) {
  15497. var _this = this;
  15498. this.childToParent = {};
  15499. this.root = root;
  15500. this.parentToChildren = parentToChildren;
  15501. var _loop_1 = function (key) {
  15502. if (!parentToChildren.hasOwnProperty(key))
  15503. return "continue";
  15504. parentToChildren[key].forEach(function (c) { return _this.childToParent[c.key] = key; });
  15505. };
  15506. for (var key in parentToChildren) {
  15507. _loop_1(key);
  15508. }
  15509. }
  15510. Tree.prototype.getChildren = function (node) {
  15511. return node && this.parentToChildren[node.key] ? this.parentToChildren[node.key] : [];
  15512. };
  15513. Tree.prototype.hasChildren = function (node) {
  15514. return this.parentToChildren[node.key] && this.parentToChildren[node.key].length > 0;
  15515. };
  15516. Tree.prototype.iterate = function (callback) {
  15517. this.iterateCore(this.root, 0, callback);
  15518. };
  15519. Tree.createSpanningTree = function (component) {
  15520. var rootKey = Tree.findRoot(component);
  15521. var iterator = component.createIterator(Structures_1.ConnectionMode.Outgoing);
  15522. var parentToChildren = {};
  15523. iterator.skipEdge = (function (e) { return e.to === undefined || iterator.isNodeVisited(e.to); });
  15524. iterator.onNode = function (n) { return parentToChildren[n.key] = []; };
  15525. iterator.onEdge = function (e) { return parentToChildren[e.from].push(component.getNode(e.to)); };
  15526. iterator.iterate(rootKey);
  15527. return new Tree(component.getNode(rootKey), parentToChildren);
  15528. };
  15529. Tree.prototype.iterateCore = function (node, level, callback) {
  15530. var _this = this;
  15531. callback(node, level);
  15532. this.getChildren(node).forEach(function (n) { return _this.iterateCore(n, level + 1, callback); });
  15533. };
  15534. Tree.findRoot = function (component) {
  15535. return component.nodes.reduce(function (aggregator, cur) {
  15536. var edges = component.getAdjacentEdges(cur);
  15537. var inc = edges.filter(function (l) { return l.to === cur; }).length;
  15538. var out = edges.filter(function (l) { return l.from === cur; }).length;
  15539. if (aggregator.candidate === undefined || (inc === 0 && (aggregator.inc > 0 || aggregator.out < out)) || (inc > 0 && aggregator.out - aggregator.inc < out - inc)) {
  15540. aggregator.candidate = cur;
  15541. aggregator.inc = inc;
  15542. aggregator.out = out;
  15543. }
  15544. return aggregator;
  15545. }, { inc: -1, out: -1, candidate: undefined }).candidate;
  15546. };
  15547. return Tree;
  15548. }());
  15549. exports.Tree = Tree;
  15550. /***/ }),
  15551. /* 153 */
  15552. /***/ (function(module, exports, __webpack_require__) {
  15553. "use strict";
  15554. Object.defineProperty(exports, "__esModule", { value: true });
  15555. var Graph_1 = __webpack_require__(34);
  15556. var Structures_1 = __webpack_require__(22);
  15557. var ListUtils_1 = __webpack_require__(60);
  15558. var CycleRemover = /** @class */ (function () {
  15559. function CycleRemover() {
  15560. }
  15561. CycleRemover.removeCycles = function (graph) {
  15562. var feedbackSet = this.getFeedbackSet(graph);
  15563. return this.reverseEdges(graph, feedbackSet);
  15564. };
  15565. CycleRemover.getFeedbackSet = function (graph) {
  15566. var _this = this;
  15567. var feedbackSet = {};
  15568. var nonTrivialStronglyConnectedComponents = this.getNonTrivialStronglyConnectedComponents(graph);
  15569. while (nonTrivialStronglyConnectedComponents.length) {
  15570. nonTrivialStronglyConnectedComponents.forEach(function (g) {
  15571. var maxCyclicEdges = _this.getMaxCyclicEdges(g);
  15572. maxCyclicEdges.forEach(function (e) { return delete feedbackSet[e.reverse().getHashKey()]; });
  15573. maxCyclicEdges.forEach(function (e) { return feedbackSet[e.getHashKey()] = true; });
  15574. });
  15575. nonTrivialStronglyConnectedComponents = this.getNonTrivialStronglyConnectedComponents(this.reverseEdges(graph, feedbackSet).graph);
  15576. }
  15577. return feedbackSet;
  15578. };
  15579. CycleRemover.getMaxCyclicEdges = function (graph) {
  15580. var black = {};
  15581. var gray = {};
  15582. var edgeCycleCount = {};
  15583. var visitedEdges = [];
  15584. var cycles = [];
  15585. var iterator = graph.createIterator(Structures_1.ConnectionMode.Outgoing);
  15586. iterator.visitEachEdgeOnce = false;
  15587. iterator.onNode = function (n) {
  15588. gray[n.key] = true;
  15589. };
  15590. iterator.skipNode = function (n) {
  15591. if (gray[n.key]) {
  15592. var cycle = [];
  15593. for (var i = 0; i < visitedEdges.length; i++) {
  15594. var e = visitedEdges[i];
  15595. if (edgeCycleCount[e.key] === undefined)
  15596. edgeCycleCount[e.key] = 0;
  15597. edgeCycleCount[e.key]++;
  15598. cycle.push(e);
  15599. if (e.from === n.key)
  15600. break;
  15601. }
  15602. cycles.push(cycle);
  15603. }
  15604. return gray[n.key] || black[n.key];
  15605. };
  15606. iterator.skipEdge = function (e) { return false; };
  15607. iterator.onEdge = function (e) {
  15608. visitedEdges.splice(0, 0, e);
  15609. };
  15610. iterator.onAfterEdge = function (e) {
  15611. visitedEdges.splice(0, 1);
  15612. };
  15613. iterator.onAllEdges = function (e) {
  15614. black[e.key] = true;
  15615. gray[e.key] = false;
  15616. };
  15617. iterator.iterate(graph.nodes[0]);
  15618. var edgeSet = new ListUtils_1.HashSet([], function (e) { return e.key; });
  15619. cycles.forEach(function (c) {
  15620. edgeSet.tryPush(c.reduce(function (max, curr) { return edgeCycleCount[curr.key] > edgeCycleCount[max.key] ? curr : max; }, c[0]));
  15621. });
  15622. return edgeSet.list();
  15623. };
  15624. CycleRemover.reverseEdges = function (graph, feedbackSet) {
  15625. var edges = new ListUtils_1.HashSet([], function (e) { return e.getHashKey(); });
  15626. var reversedEdges = {};
  15627. var removedEdges = {};
  15628. graph.edges.forEach(function (e) {
  15629. if (feedbackSet[e.getHashKey()]) {
  15630. e = e.reverse();
  15631. reversedEdges[e.key] = true;
  15632. }
  15633. if (!edges.tryPush(e)) {
  15634. removedEdges[e.key] = true;
  15635. delete reversedEdges[e.key];
  15636. }
  15637. });
  15638. return {
  15639. graph: new Graph_1.Graph(graph.nodes.map(function (n) { return graph.getNode(n); }), edges.list()),
  15640. reversedEdges: reversedEdges,
  15641. removedEdges: removedEdges
  15642. };
  15643. };
  15644. CycleRemover.getNonTrivialStronglyConnectedComponents = function (graph) {
  15645. return this.getStronglyConnectedComponents(graph).filter(function (g) { return g.edges.length; });
  15646. };
  15647. CycleRemover.getStronglyConnectedComponents = function (graph) {
  15648. var _this = this;
  15649. // Tarjan algorithm
  15650. // https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm
  15651. var nodesStack = [];
  15652. var index = 0;
  15653. var lowIndex = {};
  15654. var lowLink = {};
  15655. var onStack = {};
  15656. var components = [];
  15657. var visitedNodes = {};
  15658. for (var i = 0; i < graph.nodes.length; i++) {
  15659. var nodeKey = graph.nodes[i];
  15660. var iterator = graph.createIterator(Structures_1.ConnectionMode.Outgoing);
  15661. iterator.visitEachEdgeOnce = false;
  15662. iterator.visitEachNodeOnce = false;
  15663. iterator.onNode = function (n) {
  15664. visitedNodes[n.key] = true;
  15665. nodesStack.push(n);
  15666. onStack[n.key] = true;
  15667. lowLink[n.key] = index;
  15668. lowIndex[n.key] = index;
  15669. index++;
  15670. };
  15671. iterator.skipNode = function (n) { return visitedNodes[n.key]; };
  15672. iterator.skipEdge = function (e) {
  15673. var isVisited = visitedNodes[e.to];
  15674. if (isVisited && onStack[e.to])
  15675. lowLink[e.from] = Math.min(lowLink[e.from], lowIndex[e.to]);
  15676. return isVisited;
  15677. };
  15678. iterator.onAfterEdge = function (e) {
  15679. lowLink[e.from] = Math.min(lowLink[e.from], lowLink[e.to]);
  15680. };
  15681. iterator.onAllEdges = function (n, outgoing) {
  15682. if (outgoing && lowLink[n.key] === lowIndex[n.key])
  15683. components.push(_this.getStronglyConnectedComponent(graph, n, nodesStack, onStack));
  15684. };
  15685. iterator.iterate(nodeKey);
  15686. }
  15687. return components;
  15688. };
  15689. CycleRemover.getStronglyConnectedComponent = function (graph, root, nodesStack, onStack) {
  15690. var itemsMap = {};
  15691. var nodes = [];
  15692. var edges = [];
  15693. var topStackNode;
  15694. do {
  15695. topStackNode = nodesStack.pop();
  15696. if (!itemsMap[topStackNode.key])
  15697. nodes.push(topStackNode);
  15698. itemsMap[topStackNode.key] = true;
  15699. onStack[topStackNode.key] = false;
  15700. } while (topStackNode !== root);
  15701. nodes.forEach(function (n) {
  15702. var aEdges = graph.getAdjacentEdges(n.key, Structures_1.ConnectionMode.Outgoing);
  15703. edges.push.apply(edges, aEdges.filter(function (e) { return !itemsMap[e.key] && itemsMap[e.to]; }));
  15704. aEdges.forEach(function (e) { return itemsMap[e.key] = true; });
  15705. });
  15706. return new Graph_1.Graph(nodes, edges);
  15707. };
  15708. return CycleRemover;
  15709. }());
  15710. exports.CycleRemover = CycleRemover;
  15711. /***/ }),
  15712. /* 154 */
  15713. /***/ (function(module, exports, __webpack_require__) {
  15714. "use strict";
  15715. var __extends = (this && this.__extends) || (function () {
  15716. var extendStatics = function (d, b) {
  15717. extendStatics = Object.setPrototypeOf ||
  15718. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15719. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15720. return extendStatics(d, b);
  15721. };
  15722. return function (d, b) {
  15723. extendStatics(d, b);
  15724. function __() { this.constructor = d; }
  15725. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15726. };
  15727. })();
  15728. Object.defineProperty(exports, "__esModule", { value: true });
  15729. var CloneHistoryItem_1 = __webpack_require__(83);
  15730. var CloneShapeHistoryItem = /** @class */ (function (_super) {
  15731. __extends(CloneShapeHistoryItem, _super);
  15732. function CloneShapeHistoryItem(shape) {
  15733. return _super.call(this, shape) || this;
  15734. }
  15735. CloneShapeHistoryItem.prototype.clearConnections = function (item) {
  15736. item.attachedConnectors = [];
  15737. };
  15738. CloneShapeHistoryItem.prototype.addItem = function (item, manipulator) {
  15739. manipulator.addShape(item);
  15740. };
  15741. CloneShapeHistoryItem.prototype.deleteItem = function (item, manipulator) {
  15742. manipulator.deleteShape(item);
  15743. };
  15744. return CloneShapeHistoryItem;
  15745. }(CloneHistoryItem_1.CloneHistoryItem));
  15746. exports.CloneShapeHistoryItem = CloneShapeHistoryItem;
  15747. /***/ }),
  15748. /* 155 */
  15749. /***/ (function(module, exports, __webpack_require__) {
  15750. "use strict";
  15751. var __extends = (this && this.__extends) || (function () {
  15752. var extendStatics = function (d, b) {
  15753. extendStatics = Object.setPrototypeOf ||
  15754. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15755. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15756. return extendStatics(d, b);
  15757. };
  15758. return function (d, b) {
  15759. extendStatics(d, b);
  15760. function __() { this.constructor = d; }
  15761. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15762. };
  15763. })();
  15764. Object.defineProperty(exports, "__esModule", { value: true });
  15765. var Connector_1 = __webpack_require__(5);
  15766. var CloneHistoryItem_1 = __webpack_require__(83);
  15767. var CloneConnectorHistoryItem = /** @class */ (function (_super) {
  15768. __extends(CloneConnectorHistoryItem, _super);
  15769. function CloneConnectorHistoryItem(connector, beginItem, endItem) {
  15770. var _this = _super.call(this, connector) || this;
  15771. _this.beginItem = beginItem;
  15772. _this.endItem = endItem;
  15773. return _this;
  15774. }
  15775. CloneConnectorHistoryItem.prototype.clearConnections = function (connector) {
  15776. connector.beginItem = undefined;
  15777. connector.endItem = undefined;
  15778. };
  15779. CloneConnectorHistoryItem.prototype.addItem = function (item, manipulator) {
  15780. manipulator.addConnector(item);
  15781. if (this.beginItem)
  15782. manipulator.addConnection(item, this.beginItem, item.beginConnectionPointIndex, Connector_1.ConnectorPosition.Begin);
  15783. if (this.endItem)
  15784. manipulator.addConnection(item, this.endItem, item.endConnectionPointIndex, Connector_1.ConnectorPosition.End);
  15785. };
  15786. CloneConnectorHistoryItem.prototype.deleteItem = function (item, manipulator) {
  15787. manipulator.deleteConnector(item);
  15788. };
  15789. return CloneConnectorHistoryItem;
  15790. }(CloneHistoryItem_1.CloneHistoryItem));
  15791. exports.CloneConnectorHistoryItem = CloneConnectorHistoryItem;
  15792. /***/ }),
  15793. /* 156 */
  15794. /***/ (function(module, exports, __webpack_require__) {
  15795. "use strict";
  15796. var __extends = (this && this.__extends) || (function () {
  15797. var extendStatics = function (d, b) {
  15798. extendStatics = Object.setPrototypeOf ||
  15799. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15800. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15801. return extendStatics(d, b);
  15802. };
  15803. return function (d, b) {
  15804. extendStatics(d, b);
  15805. function __() { this.constructor = d; }
  15806. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15807. };
  15808. })();
  15809. Object.defineProperty(exports, "__esModule", { value: true });
  15810. var CommandBase_1 = __webpack_require__(7);
  15811. var CommandStates_1 = __webpack_require__(6);
  15812. var UndoCommand = /** @class */ (function (_super) {
  15813. __extends(UndoCommand, _super);
  15814. function UndoCommand() {
  15815. return _super !== null && _super.apply(this, arguments) || this;
  15816. }
  15817. UndoCommand.prototype.executeCore = function (state) {
  15818. this.control.history.undo();
  15819. return true;
  15820. };
  15821. UndoCommand.prototype.getState = function () {
  15822. return new CommandStates_1.SimpleCommandState(this.isEnabled() && this.control.history.canUndo());
  15823. };
  15824. return UndoCommand;
  15825. }(CommandBase_1.CommandBase));
  15826. exports.UndoCommand = UndoCommand;
  15827. /***/ }),
  15828. /* 157 */
  15829. /***/ (function(module, exports, __webpack_require__) {
  15830. "use strict";
  15831. var __extends = (this && this.__extends) || (function () {
  15832. var extendStatics = function (d, b) {
  15833. extendStatics = Object.setPrototypeOf ||
  15834. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15835. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15836. return extendStatics(d, b);
  15837. };
  15838. return function (d, b) {
  15839. extendStatics(d, b);
  15840. function __() { this.constructor = d; }
  15841. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15842. };
  15843. })();
  15844. Object.defineProperty(exports, "__esModule", { value: true });
  15845. var CommandBase_1 = __webpack_require__(7);
  15846. var CommandStates_1 = __webpack_require__(6);
  15847. var RedoCommand = /** @class */ (function (_super) {
  15848. __extends(RedoCommand, _super);
  15849. function RedoCommand() {
  15850. return _super !== null && _super.apply(this, arguments) || this;
  15851. }
  15852. RedoCommand.prototype.executeCore = function (state) {
  15853. this.control.history.redo();
  15854. return true;
  15855. };
  15856. RedoCommand.prototype.getState = function () {
  15857. return new CommandStates_1.SimpleCommandState(this.isEnabled() && this.control.history.canRedo());
  15858. };
  15859. return RedoCommand;
  15860. }(CommandBase_1.CommandBase));
  15861. exports.RedoCommand = RedoCommand;
  15862. /***/ }),
  15863. /* 158 */
  15864. /***/ (function(module, exports, __webpack_require__) {
  15865. "use strict";
  15866. var __extends = (this && this.__extends) || (function () {
  15867. var extendStatics = function (d, b) {
  15868. extendStatics = Object.setPrototypeOf ||
  15869. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15870. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15871. return extendStatics(d, b);
  15872. };
  15873. return function (d, b) {
  15874. extendStatics(d, b);
  15875. function __() { this.constructor = d; }
  15876. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15877. };
  15878. })();
  15879. Object.defineProperty(exports, "__esModule", { value: true });
  15880. var CommandBase_1 = __webpack_require__(7);
  15881. var CommandStates_1 = __webpack_require__(6);
  15882. var Importer_1 = __webpack_require__(84);
  15883. var ImportCommand = /** @class */ (function (_super) {
  15884. __extends(ImportCommand, _super);
  15885. function ImportCommand() {
  15886. return _super !== null && _super.apply(this, arguments) || this;
  15887. }
  15888. ImportCommand.prototype.getState = function () {
  15889. return new CommandStates_1.SimpleCommandState(true);
  15890. };
  15891. ImportCommand.prototype.executeCore = function (state, parameter) {
  15892. var data = parameter["data"] ? parameter["data"] : parameter;
  15893. if (parameter["keepExistingItems"] === true) {
  15894. Importer_1.Importer.importItemsData(data, this.control.model);
  15895. this.control.importItemsData();
  15896. }
  15897. else {
  15898. var model = Importer_1.Importer.import(data);
  15899. this.control.importModel(model);
  15900. }
  15901. return true;
  15902. };
  15903. return ImportCommand;
  15904. }(CommandBase_1.CommandBase));
  15905. exports.ImportCommand = ImportCommand;
  15906. /***/ }),
  15907. /* 159 */
  15908. /***/ (function(module, exports, __webpack_require__) {
  15909. "use strict";
  15910. var __extends = (this && this.__extends) || (function () {
  15911. var extendStatics = function (d, b) {
  15912. extendStatics = Object.setPrototypeOf ||
  15913. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15914. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15915. return extendStatics(d, b);
  15916. };
  15917. return function (d, b) {
  15918. extendStatics(d, b);
  15919. function __() { this.constructor = d; }
  15920. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15921. };
  15922. })();
  15923. Object.defineProperty(exports, "__esModule", { value: true });
  15924. var CommandBase_1 = __webpack_require__(7);
  15925. var CommandStates_1 = __webpack_require__(6);
  15926. var Exporter_1 = __webpack_require__(31);
  15927. var ExportCommand = /** @class */ (function (_super) {
  15928. __extends(ExportCommand, _super);
  15929. function ExportCommand() {
  15930. return _super !== null && _super.apply(this, arguments) || this;
  15931. }
  15932. ExportCommand.prototype.getState = function () {
  15933. return new CommandStates_1.SimpleCommandState(true);
  15934. };
  15935. ExportCommand.prototype.executeCore = function (state, parameter) {
  15936. var data = Exporter_1.Exporter.export(this.control.model);
  15937. parameter(data);
  15938. return true;
  15939. };
  15940. return ExportCommand;
  15941. }(CommandBase_1.CommandBase));
  15942. exports.ExportCommand = ExportCommand;
  15943. /***/ }),
  15944. /* 160 */
  15945. /***/ (function(module, exports, __webpack_require__) {
  15946. "use strict";
  15947. var __extends = (this && this.__extends) || (function () {
  15948. var extendStatics = function (d, b) {
  15949. extendStatics = Object.setPrototypeOf ||
  15950. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15951. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15952. return extendStatics(d, b);
  15953. };
  15954. return function (d, b) {
  15955. extendStatics(d, b);
  15956. function __() { this.constructor = d; }
  15957. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15958. };
  15959. })();
  15960. Object.defineProperty(exports, "__esModule", { value: true });
  15961. var ToggleStyleTextPropertyCommand_1 = __webpack_require__(41);
  15962. var ToggleFontBoldCommand = /** @class */ (function (_super) {
  15963. __extends(ToggleFontBoldCommand, _super);
  15964. function ToggleFontBoldCommand() {
  15965. return _super !== null && _super.apply(this, arguments) || this;
  15966. }
  15967. ToggleFontBoldCommand.prototype.getStyleProperty = function () {
  15968. return "font-weight";
  15969. };
  15970. ToggleFontBoldCommand.prototype.getStylePropertyValue = function () {
  15971. return "bold";
  15972. };
  15973. return ToggleFontBoldCommand;
  15974. }(ToggleStyleTextPropertyCommand_1.ToggleStyleTextPropertyCommand));
  15975. exports.ToggleFontBoldCommand = ToggleFontBoldCommand;
  15976. /***/ }),
  15977. /* 161 */
  15978. /***/ (function(module, exports, __webpack_require__) {
  15979. "use strict";
  15980. var __extends = (this && this.__extends) || (function () {
  15981. var extendStatics = function (d, b) {
  15982. extendStatics = Object.setPrototypeOf ||
  15983. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  15984. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  15985. return extendStatics(d, b);
  15986. };
  15987. return function (d, b) {
  15988. extendStatics(d, b);
  15989. function __() { this.constructor = d; }
  15990. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15991. };
  15992. })();
  15993. Object.defineProperty(exports, "__esModule", { value: true });
  15994. var ToggleStyleTextPropertyCommand_1 = __webpack_require__(41);
  15995. var ToggleFontItalicCommand = /** @class */ (function (_super) {
  15996. __extends(ToggleFontItalicCommand, _super);
  15997. function ToggleFontItalicCommand() {
  15998. return _super !== null && _super.apply(this, arguments) || this;
  15999. }
  16000. ToggleFontItalicCommand.prototype.getStyleProperty = function () {
  16001. return "font-style";
  16002. };
  16003. ToggleFontItalicCommand.prototype.getStylePropertyValue = function () {
  16004. return "italic";
  16005. };
  16006. return ToggleFontItalicCommand;
  16007. }(ToggleStyleTextPropertyCommand_1.ToggleStyleTextPropertyCommand));
  16008. exports.ToggleFontItalicCommand = ToggleFontItalicCommand;
  16009. /***/ }),
  16010. /* 162 */
  16011. /***/ (function(module, exports, __webpack_require__) {
  16012. "use strict";
  16013. var __extends = (this && this.__extends) || (function () {
  16014. var extendStatics = function (d, b) {
  16015. extendStatics = Object.setPrototypeOf ||
  16016. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16017. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16018. return extendStatics(d, b);
  16019. };
  16020. return function (d, b) {
  16021. extendStatics(d, b);
  16022. function __() { this.constructor = d; }
  16023. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16024. };
  16025. })();
  16026. Object.defineProperty(exports, "__esModule", { value: true });
  16027. var ToggleStyleTextPropertyCommand_1 = __webpack_require__(41);
  16028. var ToggleFontUnderlineCommand = /** @class */ (function (_super) {
  16029. __extends(ToggleFontUnderlineCommand, _super);
  16030. function ToggleFontUnderlineCommand() {
  16031. return _super !== null && _super.apply(this, arguments) || this;
  16032. }
  16033. ToggleFontUnderlineCommand.prototype.getStyleProperty = function () {
  16034. return "text-decoration";
  16035. };
  16036. ToggleFontUnderlineCommand.prototype.getStylePropertyValue = function () {
  16037. return "underline";
  16038. };
  16039. return ToggleFontUnderlineCommand;
  16040. }(ToggleStyleTextPropertyCommand_1.ToggleStyleTextPropertyCommand));
  16041. exports.ToggleFontUnderlineCommand = ToggleFontUnderlineCommand;
  16042. /***/ }),
  16043. /* 163 */
  16044. /***/ (function(module, exports, __webpack_require__) {
  16045. "use strict";
  16046. var __extends = (this && this.__extends) || (function () {
  16047. var extendStatics = function (d, b) {
  16048. extendStatics = Object.setPrototypeOf ||
  16049. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16050. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16051. return extendStatics(d, b);
  16052. };
  16053. return function (d, b) {
  16054. extendStatics(d, b);
  16055. function __() { this.constructor = d; }
  16056. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16057. };
  16058. })();
  16059. Object.defineProperty(exports, "__esModule", { value: true });
  16060. var ChangeStyleTextPropertyCommand_1 = __webpack_require__(62);
  16061. var ChangeFontNameCommand = /** @class */ (function (_super) {
  16062. __extends(ChangeFontNameCommand, _super);
  16063. function ChangeFontNameCommand() {
  16064. return _super !== null && _super.apply(this, arguments) || this;
  16065. }
  16066. ChangeFontNameCommand.prototype.getStyleProperty = function () {
  16067. return "font-family";
  16068. };
  16069. return ChangeFontNameCommand;
  16070. }(ChangeStyleTextPropertyCommand_1.ChangeStyleTextPropertyCommand));
  16071. exports.ChangeFontNameCommand = ChangeFontNameCommand;
  16072. /***/ }),
  16073. /* 164 */
  16074. /***/ (function(module, exports, __webpack_require__) {
  16075. "use strict";
  16076. var __extends = (this && this.__extends) || (function () {
  16077. var extendStatics = function (d, b) {
  16078. extendStatics = Object.setPrototypeOf ||
  16079. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16080. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16081. return extendStatics(d, b);
  16082. };
  16083. return function (d, b) {
  16084. extendStatics(d, b);
  16085. function __() { this.constructor = d; }
  16086. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16087. };
  16088. })();
  16089. Object.defineProperty(exports, "__esModule", { value: true });
  16090. var ChangeStyleTextPropertyCommand_1 = __webpack_require__(62);
  16091. var ChangeFontSizeCommand = /** @class */ (function (_super) {
  16092. __extends(ChangeFontSizeCommand, _super);
  16093. function ChangeFontSizeCommand() {
  16094. return _super !== null && _super.apply(this, arguments) || this;
  16095. }
  16096. ChangeFontSizeCommand.prototype.getStyleProperty = function () {
  16097. return "font-size";
  16098. };
  16099. return ChangeFontSizeCommand;
  16100. }(ChangeStyleTextPropertyCommand_1.ChangeStyleTextPropertyCommand));
  16101. exports.ChangeFontSizeCommand = ChangeFontSizeCommand;
  16102. /***/ }),
  16103. /* 165 */
  16104. /***/ (function(module, exports, __webpack_require__) {
  16105. "use strict";
  16106. var __extends = (this && this.__extends) || (function () {
  16107. var extendStatics = function (d, b) {
  16108. extendStatics = Object.setPrototypeOf ||
  16109. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16110. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16111. return extendStatics(d, b);
  16112. };
  16113. return function (d, b) {
  16114. extendStatics(d, b);
  16115. function __() { this.constructor = d; }
  16116. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16117. };
  16118. })();
  16119. Object.defineProperty(exports, "__esModule", { value: true });
  16120. var ChangeStyleTextPropertyCommand_1 = __webpack_require__(62);
  16121. var ChangeFontColorCommand = /** @class */ (function (_super) {
  16122. __extends(ChangeFontColorCommand, _super);
  16123. function ChangeFontColorCommand() {
  16124. return _super !== null && _super.apply(this, arguments) || this;
  16125. }
  16126. ChangeFontColorCommand.prototype.getStyleProperty = function () {
  16127. return "fill";
  16128. };
  16129. return ChangeFontColorCommand;
  16130. }(ChangeStyleTextPropertyCommand_1.ChangeStyleTextPropertyCommand));
  16131. exports.ChangeFontColorCommand = ChangeFontColorCommand;
  16132. /***/ }),
  16133. /* 166 */
  16134. /***/ (function(module, exports, __webpack_require__) {
  16135. "use strict";
  16136. var __extends = (this && this.__extends) || (function () {
  16137. var extendStatics = function (d, b) {
  16138. extendStatics = Object.setPrototypeOf ||
  16139. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16140. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16141. return extendStatics(d, b);
  16142. };
  16143. return function (d, b) {
  16144. extendStatics(d, b);
  16145. function __() { this.constructor = d; }
  16146. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16147. };
  16148. })();
  16149. Object.defineProperty(exports, "__esModule", { value: true });
  16150. var ChangeStylePropertyCommand_1 = __webpack_require__(88);
  16151. var ChangeFillColorCommand = /** @class */ (function (_super) {
  16152. __extends(ChangeFillColorCommand, _super);
  16153. function ChangeFillColorCommand() {
  16154. return _super !== null && _super.apply(this, arguments) || this;
  16155. }
  16156. ChangeFillColorCommand.prototype.getStyleProperty = function () {
  16157. return "fill";
  16158. };
  16159. return ChangeFillColorCommand;
  16160. }(ChangeStylePropertyCommand_1.ChangeStylePropertyCommand));
  16161. exports.ChangeFillColorCommand = ChangeFillColorCommand;
  16162. /***/ }),
  16163. /* 167 */
  16164. /***/ (function(module, exports, __webpack_require__) {
  16165. "use strict";
  16166. var __extends = (this && this.__extends) || (function () {
  16167. var extendStatics = function (d, b) {
  16168. extendStatics = Object.setPrototypeOf ||
  16169. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16170. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16171. return extendStatics(d, b);
  16172. };
  16173. return function (d, b) {
  16174. extendStatics(d, b);
  16175. function __() { this.constructor = d; }
  16176. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16177. };
  16178. })();
  16179. Object.defineProperty(exports, "__esModule", { value: true });
  16180. var ChangeStylePropertyCommand_1 = __webpack_require__(88);
  16181. var ChangeStrokeColorCommand = /** @class */ (function (_super) {
  16182. __extends(ChangeStrokeColorCommand, _super);
  16183. function ChangeStrokeColorCommand() {
  16184. return _super !== null && _super.apply(this, arguments) || this;
  16185. }
  16186. ChangeStrokeColorCommand.prototype.getStyleProperty = function () {
  16187. return "stroke";
  16188. };
  16189. return ChangeStrokeColorCommand;
  16190. }(ChangeStylePropertyCommand_1.ChangeStylePropertyCommand));
  16191. exports.ChangeStrokeColorCommand = ChangeStrokeColorCommand;
  16192. /***/ }),
  16193. /* 168 */
  16194. /***/ (function(module, exports, __webpack_require__) {
  16195. "use strict";
  16196. var __extends = (this && this.__extends) || (function () {
  16197. var extendStatics = function (d, b) {
  16198. extendStatics = Object.setPrototypeOf ||
  16199. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16200. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16201. return extendStatics(d, b);
  16202. };
  16203. return function (d, b) {
  16204. extendStatics(d, b);
  16205. function __() { this.constructor = d; }
  16206. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16207. };
  16208. })();
  16209. Object.defineProperty(exports, "__esModule", { value: true });
  16210. var DataSource_1 = __webpack_require__(37);
  16211. var ImportDataCommandBase_1 = __webpack_require__(89);
  16212. var ImportDataSourceCommand = /** @class */ (function (_super) {
  16213. __extends(ImportDataSourceCommand, _super);
  16214. function ImportDataSourceCommand() {
  16215. return _super !== null && _super.apply(this, arguments) || this;
  16216. }
  16217. ImportDataSourceCommand.prototype.performImportData = function (parameter) {
  16218. var dataSource = new DataSource_1.DataSource(parameter.key || "0", parameter.name, parameter.nodeDataSource, parameter.edgeDataSource, parameter.nodeDataImporter, parameter.edgeDataImporter);
  16219. this.control.registerDataSource(dataSource);
  16220. if (parameter.layoutType !== undefined) {
  16221. this.createItems(dataSource, parameter.layoutType);
  16222. }
  16223. };
  16224. return ImportDataSourceCommand;
  16225. }(ImportDataCommandBase_1.ImportDataCommandBase));
  16226. exports.ImportDataSourceCommand = ImportDataSourceCommand;
  16227. /***/ }),
  16228. /* 169 */
  16229. /***/ (function(module, exports, __webpack_require__) {
  16230. "use strict";
  16231. var __extends = (this && this.__extends) || (function () {
  16232. var extendStatics = function (d, b) {
  16233. extendStatics = Object.setPrototypeOf ||
  16234. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16235. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16236. return extendStatics(d, b);
  16237. };
  16238. return function (d, b) {
  16239. extendStatics(d, b);
  16240. function __() { this.constructor = d; }
  16241. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16242. };
  16243. })();
  16244. Object.defineProperty(exports, "__esModule", { value: true });
  16245. var ToggleStyleTextPropertyCommand_1 = __webpack_require__(41);
  16246. var ChangeTextAlignCommand = /** @class */ (function (_super) {
  16247. __extends(ChangeTextAlignCommand, _super);
  16248. function ChangeTextAlignCommand() {
  16249. return _super !== null && _super.apply(this, arguments) || this;
  16250. }
  16251. ChangeTextAlignCommand.prototype.getStyleProperty = function () {
  16252. return "text-anchor";
  16253. };
  16254. return ChangeTextAlignCommand;
  16255. }(ToggleStyleTextPropertyCommand_1.ToggleStyleTextPropertyCommand));
  16256. exports.ChangeTextAlignCommand = ChangeTextAlignCommand;
  16257. var TextLeftAlignCommand = /** @class */ (function (_super) {
  16258. __extends(TextLeftAlignCommand, _super);
  16259. function TextLeftAlignCommand() {
  16260. return _super !== null && _super.apply(this, arguments) || this;
  16261. }
  16262. TextLeftAlignCommand.prototype.getStylePropertyValue = function () {
  16263. return "start";
  16264. };
  16265. return TextLeftAlignCommand;
  16266. }(ChangeTextAlignCommand));
  16267. exports.TextLeftAlignCommand = TextLeftAlignCommand;
  16268. var TextCenterAlignCommand = /** @class */ (function (_super) {
  16269. __extends(TextCenterAlignCommand, _super);
  16270. function TextCenterAlignCommand() {
  16271. return _super !== null && _super.apply(this, arguments) || this;
  16272. }
  16273. TextCenterAlignCommand.prototype.getStylePropertyValue = function () {
  16274. return "middle";
  16275. };
  16276. return TextCenterAlignCommand;
  16277. }(ChangeTextAlignCommand));
  16278. exports.TextCenterAlignCommand = TextCenterAlignCommand;
  16279. var TextRightAlignCommand = /** @class */ (function (_super) {
  16280. __extends(TextRightAlignCommand, _super);
  16281. function TextRightAlignCommand() {
  16282. return _super !== null && _super.apply(this, arguments) || this;
  16283. }
  16284. TextRightAlignCommand.prototype.getStylePropertyValue = function () {
  16285. return "end";
  16286. };
  16287. return TextRightAlignCommand;
  16288. }(ChangeTextAlignCommand));
  16289. exports.TextRightAlignCommand = TextRightAlignCommand;
  16290. /***/ }),
  16291. /* 170 */
  16292. /***/ (function(module, exports, __webpack_require__) {
  16293. "use strict";
  16294. var __extends = (this && this.__extends) || (function () {
  16295. var extendStatics = function (d, b) {
  16296. extendStatics = Object.setPrototypeOf ||
  16297. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16298. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16299. return extendStatics(d, b);
  16300. };
  16301. return function (d, b) {
  16302. extendStatics(d, b);
  16303. function __() { this.constructor = d; }
  16304. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16305. };
  16306. })();
  16307. Object.defineProperty(exports, "__esModule", { value: true });
  16308. var ChangeConnectorPropertyCommand_1 = __webpack_require__(90);
  16309. var ConnectorProperties_1 = __webpack_require__(28);
  16310. var ChangeConnectorStartLineEndingCommand = /** @class */ (function (_super) {
  16311. __extends(ChangeConnectorStartLineEndingCommand, _super);
  16312. function ChangeConnectorStartLineEndingCommand() {
  16313. return _super !== null && _super.apply(this, arguments) || this;
  16314. }
  16315. ChangeConnectorStartLineEndingCommand.prototype.getPropertyName = function () {
  16316. return "startLineEnding";
  16317. };
  16318. ChangeConnectorStartLineEndingCommand.prototype.getPropertyDefaultValue = function () {
  16319. return ConnectorProperties_1.ConnectorLineEnding.None;
  16320. };
  16321. return ChangeConnectorStartLineEndingCommand;
  16322. }(ChangeConnectorPropertyCommand_1.ChangeConnectorPropertyCommand));
  16323. exports.ChangeConnectorStartLineEndingCommand = ChangeConnectorStartLineEndingCommand;
  16324. var ChangeConnectorEndLineEndingCommand = /** @class */ (function (_super) {
  16325. __extends(ChangeConnectorEndLineEndingCommand, _super);
  16326. function ChangeConnectorEndLineEndingCommand() {
  16327. return _super !== null && _super.apply(this, arguments) || this;
  16328. }
  16329. ChangeConnectorEndLineEndingCommand.prototype.getPropertyName = function () {
  16330. return "endLineEnding";
  16331. };
  16332. ChangeConnectorEndLineEndingCommand.prototype.getPropertyDefaultValue = function () {
  16333. return ConnectorProperties_1.ConnectorLineEnding.Arrow;
  16334. };
  16335. return ChangeConnectorEndLineEndingCommand;
  16336. }(ChangeConnectorPropertyCommand_1.ChangeConnectorPropertyCommand));
  16337. exports.ChangeConnectorEndLineEndingCommand = ChangeConnectorEndLineEndingCommand;
  16338. /***/ }),
  16339. /* 171 */
  16340. /***/ (function(module, exports, __webpack_require__) {
  16341. "use strict";
  16342. var __extends = (this && this.__extends) || (function () {
  16343. var extendStatics = function (d, b) {
  16344. extendStatics = Object.setPrototypeOf ||
  16345. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16346. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16347. return extendStatics(d, b);
  16348. };
  16349. return function (d, b) {
  16350. extendStatics(d, b);
  16351. function __() { this.constructor = d; }
  16352. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16353. };
  16354. })();
  16355. Object.defineProperty(exports, "__esModule", { value: true });
  16356. var ChangeConnectorPropertyCommand_1 = __webpack_require__(90);
  16357. var ConnectorProperties_1 = __webpack_require__(28);
  16358. var ChangeConnectorLineOptionCommand = /** @class */ (function (_super) {
  16359. __extends(ChangeConnectorLineOptionCommand, _super);
  16360. function ChangeConnectorLineOptionCommand() {
  16361. return _super !== null && _super.apply(this, arguments) || this;
  16362. }
  16363. ChangeConnectorLineOptionCommand.prototype.getPropertyName = function () {
  16364. return "lineOption";
  16365. };
  16366. ChangeConnectorLineOptionCommand.prototype.getPropertyDefaultValue = function () {
  16367. return ConnectorProperties_1.ConnectorLineOption.Straight;
  16368. };
  16369. return ChangeConnectorLineOptionCommand;
  16370. }(ChangeConnectorPropertyCommand_1.ChangeConnectorPropertyCommand));
  16371. exports.ChangeConnectorLineOptionCommand = ChangeConnectorLineOptionCommand;
  16372. /***/ }),
  16373. /* 172 */
  16374. /***/ (function(module, exports, __webpack_require__) {
  16375. "use strict";
  16376. var __extends = (this && this.__extends) || (function () {
  16377. var extendStatics = function (d, b) {
  16378. extendStatics = Object.setPrototypeOf ||
  16379. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16380. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16381. return extendStatics(d, b);
  16382. };
  16383. return function (d, b) {
  16384. extendStatics(d, b);
  16385. function __() { this.constructor = d; }
  16386. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16387. };
  16388. })();
  16389. Object.defineProperty(exports, "__esModule", { value: true });
  16390. var CommandBase_1 = __webpack_require__(7);
  16391. var CommandStates_1 = __webpack_require__(6);
  16392. var SelectAllCommand = /** @class */ (function (_super) {
  16393. __extends(SelectAllCommand, _super);
  16394. function SelectAllCommand() {
  16395. return _super !== null && _super.apply(this, arguments) || this;
  16396. }
  16397. SelectAllCommand.prototype.getState = function () {
  16398. return new CommandStates_1.SimpleCommandState(true);
  16399. };
  16400. SelectAllCommand.prototype.executeCore = function (state, parameter) {
  16401. var itemKeys = [];
  16402. this.control.model.iterateItems(function (i) { return itemKeys.push(i.key); });
  16403. this.control.selection.set(itemKeys);
  16404. return true;
  16405. };
  16406. return SelectAllCommand;
  16407. }(CommandBase_1.CommandBase));
  16408. exports.SelectAllCommand = SelectAllCommand;
  16409. /***/ }),
  16410. /* 173 */
  16411. /***/ (function(module, exports, __webpack_require__) {
  16412. "use strict";
  16413. var __extends = (this && this.__extends) || (function () {
  16414. var extendStatics = function (d, b) {
  16415. extendStatics = Object.setPrototypeOf ||
  16416. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16417. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16418. return extendStatics(d, b);
  16419. };
  16420. return function (d, b) {
  16421. extendStatics(d, b);
  16422. function __() { this.constructor = d; }
  16423. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16424. };
  16425. })();
  16426. Object.defineProperty(exports, "__esModule", { value: true });
  16427. var AutoLayoutCommandBase_1 = __webpack_require__(43);
  16428. var WideTree_1 = __webpack_require__(61);
  16429. var LayoutSettings_1 = __webpack_require__(18);
  16430. var AutoLayoutTreeVerticalCommand = /** @class */ (function (_super) {
  16431. __extends(AutoLayoutTreeVerticalCommand, _super);
  16432. function AutoLayoutTreeVerticalCommand() {
  16433. return _super !== null && _super.apply(this, arguments) || this;
  16434. }
  16435. AutoLayoutTreeVerticalCommand.prototype.createLayout = function (graph) {
  16436. var settings = this.createLayoutSettings();
  16437. settings.orientation = LayoutSettings_1.OrientationKind.Vertical;
  16438. return new WideTree_1.TreeLayoutBuilder(settings, graph).build();
  16439. };
  16440. return AutoLayoutTreeVerticalCommand;
  16441. }(AutoLayoutCommandBase_1.AutoLayoutCommandBase));
  16442. exports.AutoLayoutTreeVerticalCommand = AutoLayoutTreeVerticalCommand;
  16443. /***/ }),
  16444. /* 174 */
  16445. /***/ (function(module, exports, __webpack_require__) {
  16446. "use strict";
  16447. var __extends = (this && this.__extends) || (function () {
  16448. var extendStatics = function (d, b) {
  16449. extendStatics = Object.setPrototypeOf ||
  16450. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16451. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16452. return extendStatics(d, b);
  16453. };
  16454. return function (d, b) {
  16455. extendStatics(d, b);
  16456. function __() { this.constructor = d; }
  16457. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16458. };
  16459. })();
  16460. Object.defineProperty(exports, "__esModule", { value: true });
  16461. var ChangePagePropertyCommand_1 = __webpack_require__(23);
  16462. var ChangeSnapToGridCommand = /** @class */ (function (_super) {
  16463. __extends(ChangeSnapToGridCommand, _super);
  16464. function ChangeSnapToGridCommand() {
  16465. return _super !== null && _super.apply(this, arguments) || this;
  16466. }
  16467. ChangeSnapToGridCommand.prototype.getPropertyName = function () {
  16468. return "snapToGrid";
  16469. };
  16470. return ChangeSnapToGridCommand;
  16471. }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
  16472. exports.ChangeSnapToGridCommand = ChangeSnapToGridCommand;
  16473. /***/ }),
  16474. /* 175 */
  16475. /***/ (function(module, exports, __webpack_require__) {
  16476. "use strict";
  16477. var __extends = (this && this.__extends) || (function () {
  16478. var extendStatics = function (d, b) {
  16479. extendStatics = Object.setPrototypeOf ||
  16480. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16481. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16482. return extendStatics(d, b);
  16483. };
  16484. return function (d, b) {
  16485. extendStatics(d, b);
  16486. function __() { this.constructor = d; }
  16487. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16488. };
  16489. })();
  16490. Object.defineProperty(exports, "__esModule", { value: true });
  16491. var HistoryItem_1 = __webpack_require__(4);
  16492. var ChangePagePropertyHistoryItem = /** @class */ (function (_super) {
  16493. __extends(ChangePagePropertyHistoryItem, _super);
  16494. function ChangePagePropertyHistoryItem(propertyName, value) {
  16495. var _this = _super.call(this) || this;
  16496. _this.propertyName = propertyName;
  16497. _this.value = value;
  16498. return _this;
  16499. }
  16500. ChangePagePropertyHistoryItem.prototype.redo = function (manipulator) {
  16501. this.oldValue = manipulator.model[this.propertyName];
  16502. manipulator.changePageProperty(this.propertyName, this.value);
  16503. };
  16504. ChangePagePropertyHistoryItem.prototype.undo = function (manipulator) {
  16505. manipulator.changePageProperty(this.propertyName, this.oldValue);
  16506. };
  16507. return ChangePagePropertyHistoryItem;
  16508. }(HistoryItem_1.HistoryItem));
  16509. exports.ChangePagePropertyHistoryItem = ChangePagePropertyHistoryItem;
  16510. /***/ }),
  16511. /* 176 */
  16512. /***/ (function(module, exports, __webpack_require__) {
  16513. "use strict";
  16514. var __extends = (this && this.__extends) || (function () {
  16515. var extendStatics = function (d, b) {
  16516. extendStatics = Object.setPrototypeOf ||
  16517. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16518. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16519. return extendStatics(d, b);
  16520. };
  16521. return function (d, b) {
  16522. extendStatics(d, b);
  16523. function __() { this.constructor = d; }
  16524. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16525. };
  16526. })();
  16527. Object.defineProperty(exports, "__esModule", { value: true });
  16528. var ChangePagePropertyCommand_1 = __webpack_require__(23);
  16529. var ChangeGridSizeCommand = /** @class */ (function (_super) {
  16530. __extends(ChangeGridSizeCommand, _super);
  16531. function ChangeGridSizeCommand() {
  16532. return _super !== null && _super.apply(this, arguments) || this;
  16533. }
  16534. ChangeGridSizeCommand.prototype.getPropertyName = function () {
  16535. return "gridSize";
  16536. };
  16537. ChangeGridSizeCommand.prototype.getPropertyOptions = function () {
  16538. return [
  16539. { value: 90, text: this.control.model.getModelUnitText(90) },
  16540. { value: 180, text: this.control.model.getModelUnitText(180) },
  16541. { value: 360, text: this.control.model.getModelUnitText(360) },
  16542. { value: 720, text: this.control.model.getModelUnitText(720) }
  16543. ];
  16544. };
  16545. return ChangeGridSizeCommand;
  16546. }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
  16547. exports.ChangeGridSizeCommand = ChangeGridSizeCommand;
  16548. /***/ }),
  16549. /* 177 */
  16550. /***/ (function(module, exports, __webpack_require__) {
  16551. "use strict";
  16552. var __extends = (this && this.__extends) || (function () {
  16553. var extendStatics = function (d, b) {
  16554. extendStatics = Object.setPrototypeOf ||
  16555. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16556. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16557. return extendStatics(d, b);
  16558. };
  16559. return function (d, b) {
  16560. extendStatics(d, b);
  16561. function __() { this.constructor = d; }
  16562. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16563. };
  16564. })();
  16565. Object.defineProperty(exports, "__esModule", { value: true });
  16566. var ChangePagePropertyCommand_1 = __webpack_require__(23);
  16567. var ChangePageLandscapeHistoryItem_1 = __webpack_require__(178);
  16568. var ChangePageLandscapeCommand = /** @class */ (function (_super) {
  16569. __extends(ChangePageLandscapeCommand, _super);
  16570. function ChangePageLandscapeCommand() {
  16571. return _super !== null && _super.apply(this, arguments) || this;
  16572. }
  16573. ChangePageLandscapeCommand.prototype.getPropertyName = function () {
  16574. return "pageLandscape";
  16575. };
  16576. ChangePageLandscapeCommand.prototype.createHistoryItems = function (propertyName, parameter) {
  16577. return [new ChangePageLandscapeHistoryItem_1.ChangePageLandscapeHistoryItem(parameter)];
  16578. };
  16579. return ChangePageLandscapeCommand;
  16580. }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
  16581. exports.ChangePageLandscapeCommand = ChangePageLandscapeCommand;
  16582. /***/ }),
  16583. /* 178 */
  16584. /***/ (function(module, exports, __webpack_require__) {
  16585. "use strict";
  16586. var __extends = (this && this.__extends) || (function () {
  16587. var extendStatics = function (d, b) {
  16588. extendStatics = Object.setPrototypeOf ||
  16589. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16590. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16591. return extendStatics(d, b);
  16592. };
  16593. return function (d, b) {
  16594. extendStatics(d, b);
  16595. function __() { this.constructor = d; }
  16596. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16597. };
  16598. })();
  16599. Object.defineProperty(exports, "__esModule", { value: true });
  16600. var HistoryItem_1 = __webpack_require__(4);
  16601. var ChangePageLandscapeHistoryItem = /** @class */ (function (_super) {
  16602. __extends(ChangePageLandscapeHistoryItem, _super);
  16603. function ChangePageLandscapeHistoryItem(value) {
  16604. var _this = _super.call(this) || this;
  16605. _this.value = value;
  16606. return _this;
  16607. }
  16608. ChangePageLandscapeHistoryItem.prototype.redo = function (manipulator) {
  16609. this.oldValue = manipulator.model.pageLandscape;
  16610. manipulator.changePageLandscape(this.value);
  16611. };
  16612. ChangePageLandscapeHistoryItem.prototype.undo = function (manipulator) {
  16613. manipulator.changePageLandscape(this.oldValue);
  16614. };
  16615. return ChangePageLandscapeHistoryItem;
  16616. }(HistoryItem_1.HistoryItem));
  16617. exports.ChangePageLandscapeHistoryItem = ChangePageLandscapeHistoryItem;
  16618. /***/ }),
  16619. /* 179 */
  16620. /***/ (function(module, exports, __webpack_require__) {
  16621. "use strict";
  16622. var __extends = (this && this.__extends) || (function () {
  16623. var extendStatics = function (d, b) {
  16624. extendStatics = Object.setPrototypeOf ||
  16625. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16626. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16627. return extendStatics(d, b);
  16628. };
  16629. return function (d, b) {
  16630. extendStatics(d, b);
  16631. function __() { this.constructor = d; }
  16632. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16633. };
  16634. })();
  16635. Object.defineProperty(exports, "__esModule", { value: true });
  16636. var ChangePagePropertyCommand_1 = __webpack_require__(23);
  16637. var Utils_1 = __webpack_require__(0);
  16638. var ChangePageSizeHistoryItem_1 = __webpack_require__(180);
  16639. var ChangePageSizeCommand = /** @class */ (function (_super) {
  16640. __extends(ChangePageSizeCommand, _super);
  16641. function ChangePageSizeCommand() {
  16642. return _super !== null && _super.apply(this, arguments) || this;
  16643. }
  16644. ChangePageSizeCommand.prototype.getPropertyName = function () {
  16645. return "pageSize";
  16646. };
  16647. ChangePageSizeCommand.prototype.createHistoryItems = function (propertyName, parameter) {
  16648. return [new ChangePageSizeHistoryItem_1.ChangePageSizeHistoryItem(new Utils_1.Size(parameter.width, parameter.height))];
  16649. };
  16650. ChangePageSizeCommand.prototype.getPropertyOptions = function () {
  16651. return [
  16652. { value: new Utils_1.Size(12240, 15840), text: "US-Letter (" + this.control.model.getModelUnitText(12240) + " x " + this.control.model.getModelUnitText(15840) + ")" },
  16653. { value: new Utils_1.Size(12240, 20160), text: "US-Legal (" + this.control.model.getModelUnitText(12240) + " x " + this.control.model.getModelUnitText(20160) + ")" },
  16654. { value: new Utils_1.Size(15817, 24491), text: "US-Tabloid (" + this.control.model.getModelUnitText(15817) + " x " + this.control.model.getModelUnitText(24491) + ")" },
  16655. { value: new Utils_1.Size(47679, 67408), text: "A0 (" + this.control.model.getModelUnitText(47679) + " x " + this.control.model.getModelUnitText(67408) + ")" },
  16656. { value: new Utils_1.Size(33676, 47679), text: "A1 (" + this.control.model.getModelUnitText(33676) + " x " + this.control.model.getModelUnitText(47679) + ")" },
  16657. { value: new Utils_1.Size(23811, 33676), text: "A2 (" + this.control.model.getModelUnitText(23811) + " x " + this.control.model.getModelUnitText(33676) + ")" },
  16658. { value: new Utils_1.Size(16838, 23811), text: "A3 (" + this.control.model.getModelUnitText(16838) + " x " + this.control.model.getModelUnitText(23811) + ")" },
  16659. { value: new Utils_1.Size(11906, 16838), text: "A4 (" + this.control.model.getModelUnitText(11906) + " x " + this.control.model.getModelUnitText(16838) + ")" },
  16660. { value: new Utils_1.Size(8391, 11906), text: "A5 (" + this.control.model.getModelUnitText(8391) + " x " + this.control.model.getModelUnitText(11906) + ")" },
  16661. { value: new Utils_1.Size(5953, 8391), text: "A6 (" + this.control.model.getModelUnitText(5953) + " x " + this.control.model.getModelUnitText(8391) + ")" },
  16662. { value: new Utils_1.Size(4195, 5953), text: "A7 (" + this.control.model.getModelUnitText(4195) + " x " + this.control.model.getModelUnitText(5953) + ")" },
  16663. ];
  16664. };
  16665. return ChangePageSizeCommand;
  16666. }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
  16667. exports.ChangePageSizeCommand = ChangePageSizeCommand;
  16668. /***/ }),
  16669. /* 180 */
  16670. /***/ (function(module, exports, __webpack_require__) {
  16671. "use strict";
  16672. var __extends = (this && this.__extends) || (function () {
  16673. var extendStatics = function (d, b) {
  16674. extendStatics = Object.setPrototypeOf ||
  16675. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16676. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16677. return extendStatics(d, b);
  16678. };
  16679. return function (d, b) {
  16680. extendStatics(d, b);
  16681. function __() { this.constructor = d; }
  16682. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16683. };
  16684. })();
  16685. Object.defineProperty(exports, "__esModule", { value: true });
  16686. var HistoryItem_1 = __webpack_require__(4);
  16687. var ChangePageSizeHistoryItem = /** @class */ (function (_super) {
  16688. __extends(ChangePageSizeHistoryItem, _super);
  16689. function ChangePageSizeHistoryItem(size) {
  16690. var _this = _super.call(this) || this;
  16691. _this.size = size;
  16692. return _this;
  16693. }
  16694. ChangePageSizeHistoryItem.prototype.redo = function (manipulator) {
  16695. this.oldSize = manipulator.model.pageSize;
  16696. manipulator.changePageSize(this.size);
  16697. };
  16698. ChangePageSizeHistoryItem.prototype.undo = function (manipulator) {
  16699. manipulator.changePageSize(this.oldSize);
  16700. };
  16701. return ChangePageSizeHistoryItem;
  16702. }(HistoryItem_1.HistoryItem));
  16703. exports.ChangePageSizeHistoryItem = ChangePageSizeHistoryItem;
  16704. /***/ }),
  16705. /* 181 */
  16706. /***/ (function(module, exports, __webpack_require__) {
  16707. "use strict";
  16708. var __extends = (this && this.__extends) || (function () {
  16709. var extendStatics = function (d, b) {
  16710. extendStatics = Object.setPrototypeOf ||
  16711. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16712. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16713. return extendStatics(d, b);
  16714. };
  16715. return function (d, b) {
  16716. extendStatics(d, b);
  16717. function __() { this.constructor = d; }
  16718. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16719. };
  16720. })();
  16721. Object.defineProperty(exports, "__esModule", { value: true });
  16722. var Exporter_1 = __webpack_require__(31);
  16723. var ExportImageCommand_1 = __webpack_require__(64);
  16724. var ExportPngCommand = /** @class */ (function (_super) {
  16725. __extends(ExportPngCommand, _super);
  16726. function ExportPngCommand() {
  16727. return _super !== null && _super.apply(this, arguments) || this;
  16728. }
  16729. ExportPngCommand.prototype.getExportFunc = function () {
  16730. return Exporter_1.Exporter.exportPng;
  16731. };
  16732. return ExportPngCommand;
  16733. }(ExportImageCommand_1.ExportImageCommand));
  16734. exports.ExportPngCommand = ExportPngCommand;
  16735. /***/ }),
  16736. /* 182 */
  16737. /***/ (function(module, exports, __webpack_require__) {
  16738. "use strict";
  16739. var __extends = (this && this.__extends) || (function () {
  16740. var extendStatics = function (d, b) {
  16741. extendStatics = Object.setPrototypeOf ||
  16742. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16743. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16744. return extendStatics(d, b);
  16745. };
  16746. return function (d, b) {
  16747. extendStatics(d, b);
  16748. function __() { this.constructor = d; }
  16749. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16750. };
  16751. })();
  16752. Object.defineProperty(exports, "__esModule", { value: true });
  16753. var RenderManager_1 = __webpack_require__(10);
  16754. var Primitive_1 = __webpack_require__(15);
  16755. var PatternPrimitive = /** @class */ (function (_super) {
  16756. __extends(PatternPrimitive, _super);
  16757. function PatternPrimitive(id, children, x, y, width, height) {
  16758. var _this = _super.call(this) || this;
  16759. _this.id = id;
  16760. _this.x = x;
  16761. _this.y = y;
  16762. _this.width = width;
  16763. _this.height = height;
  16764. _this.children = children;
  16765. return _this;
  16766. }
  16767. PatternPrimitive.prototype.createMainElement = function () {
  16768. return document.createElementNS(RenderManager_1.svgNS, "pattern");
  16769. };
  16770. PatternPrimitive.prototype.applyElementProperties = function (element) {
  16771. if (this.id)
  16772. element.setAttribute("id", this.id);
  16773. this.setUnitAttribute(element, "x", this.x);
  16774. this.setUnitAttribute(element, "y", this.y);
  16775. this.setUnitAttribute(element, "width", this.width);
  16776. this.setUnitAttribute(element, "height", this.height);
  16777. _super.prototype.applyElementProperties.call(this, element);
  16778. };
  16779. return PatternPrimitive;
  16780. }(Primitive_1.SvgPrimitive));
  16781. exports.PatternPrimitive = PatternPrimitive;
  16782. /***/ }),
  16783. /* 183 */
  16784. /***/ (function(module, exports, __webpack_require__) {
  16785. "use strict";
  16786. var __extends = (this && this.__extends) || (function () {
  16787. var extendStatics = function (d, b) {
  16788. extendStatics = Object.setPrototypeOf ||
  16789. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16790. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16791. return extendStatics(d, b);
  16792. };
  16793. return function (d, b) {
  16794. extendStatics(d, b);
  16795. function __() { this.constructor = d; }
  16796. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16797. };
  16798. })();
  16799. Object.defineProperty(exports, "__esModule", { value: true });
  16800. var RenderManager_1 = __webpack_require__(10);
  16801. var Primitive_1 = __webpack_require__(15);
  16802. var GroupPrimitive = /** @class */ (function (_super) {
  16803. __extends(GroupPrimitive, _super);
  16804. function GroupPrimitive(children, className, zIndex) {
  16805. var _this = _super.call(this, null, className) || this;
  16806. _this.zIndex = zIndex;
  16807. _this.children = children;
  16808. return _this;
  16809. }
  16810. GroupPrimitive.prototype.createMainElement = function () {
  16811. return document.createElementNS(RenderManager_1.svgNS, "g");
  16812. };
  16813. GroupPrimitive.prototype.applyElementProperties = function (element) {
  16814. if (this.zIndex)
  16815. element.style.setProperty("z-index", this.zIndex.toString());
  16816. _super.prototype.applyElementProperties.call(this, element);
  16817. };
  16818. return GroupPrimitive;
  16819. }(Primitive_1.SvgPrimitive));
  16820. exports.GroupPrimitive = GroupPrimitive;
  16821. /***/ }),
  16822. /* 184 */
  16823. /***/ (function(module, exports, __webpack_require__) {
  16824. "use strict";
  16825. var __extends = (this && this.__extends) || (function () {
  16826. var extendStatics = function (d, b) {
  16827. extendStatics = Object.setPrototypeOf ||
  16828. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16829. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16830. return extendStatics(d, b);
  16831. };
  16832. return function (d, b) {
  16833. extendStatics(d, b);
  16834. function __() { this.constructor = d; }
  16835. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16836. };
  16837. })();
  16838. Object.defineProperty(exports, "__esModule", { value: true });
  16839. var RenderManager_1 = __webpack_require__(10);
  16840. var Primitive_1 = __webpack_require__(15);
  16841. var MaskPrimitive = /** @class */ (function (_super) {
  16842. __extends(MaskPrimitive, _super);
  16843. function MaskPrimitive(id, children, className, x, y, width, height) {
  16844. var _this = _super.call(this, null, className) || this;
  16845. _this.id = id;
  16846. _this.x = x;
  16847. _this.y = y;
  16848. _this.width = width;
  16849. _this.height = height;
  16850. _this.children = children;
  16851. return _this;
  16852. }
  16853. MaskPrimitive.prototype.createMainElement = function () {
  16854. return document.createElementNS(RenderManager_1.svgNS, "mask");
  16855. };
  16856. MaskPrimitive.prototype.applyElementProperties = function (element) {
  16857. if (this.id)
  16858. element.setAttribute("id", this.id);
  16859. this.setUnitAttribute(element, "x", this.x);
  16860. this.setUnitAttribute(element, "y", this.y);
  16861. this.setUnitAttribute(element, "width", this.width);
  16862. this.setUnitAttribute(element, "height", this.height);
  16863. _super.prototype.applyElementProperties.call(this, element);
  16864. };
  16865. return MaskPrimitive;
  16866. }(Primitive_1.SvgPrimitive));
  16867. exports.MaskPrimitive = MaskPrimitive;
  16868. /***/ }),
  16869. /* 185 */
  16870. /***/ (function(module, exports, __webpack_require__) {
  16871. "use strict";
  16872. var __extends = (this && this.__extends) || (function () {
  16873. var extendStatics = function (d, b) {
  16874. extendStatics = Object.setPrototypeOf ||
  16875. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16876. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16877. return extendStatics(d, b);
  16878. };
  16879. return function (d, b) {
  16880. extendStatics(d, b);
  16881. function __() { this.constructor = d; }
  16882. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16883. };
  16884. })();
  16885. Object.defineProperty(exports, "__esModule", { value: true });
  16886. var Exporter_1 = __webpack_require__(31);
  16887. var ExportImageCommand_1 = __webpack_require__(64);
  16888. var ExportSvgCommand = /** @class */ (function (_super) {
  16889. __extends(ExportSvgCommand, _super);
  16890. function ExportSvgCommand() {
  16891. return _super !== null && _super.apply(this, arguments) || this;
  16892. }
  16893. ExportSvgCommand.prototype.getExportFunc = function () {
  16894. return Exporter_1.Exporter.exportSvg;
  16895. };
  16896. return ExportSvgCommand;
  16897. }(ExportImageCommand_1.ExportImageCommand));
  16898. exports.ExportSvgCommand = ExportSvgCommand;
  16899. /***/ }),
  16900. /* 186 */
  16901. /***/ (function(module, exports, __webpack_require__) {
  16902. "use strict";
  16903. var __extends = (this && this.__extends) || (function () {
  16904. var extendStatics = function (d, b) {
  16905. extendStatics = Object.setPrototypeOf ||
  16906. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16907. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16908. return extendStatics(d, b);
  16909. };
  16910. return function (d, b) {
  16911. extendStatics(d, b);
  16912. function __() { this.constructor = d; }
  16913. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16914. };
  16915. })();
  16916. Object.defineProperty(exports, "__esModule", { value: true });
  16917. var Exporter_1 = __webpack_require__(31);
  16918. var ExportImageCommand_1 = __webpack_require__(64);
  16919. var ExportJpgCommand = /** @class */ (function (_super) {
  16920. __extends(ExportJpgCommand, _super);
  16921. function ExportJpgCommand() {
  16922. return _super !== null && _super.apply(this, arguments) || this;
  16923. }
  16924. ExportJpgCommand.prototype.getExportFunc = function () {
  16925. return Exporter_1.Exporter.exportJpg;
  16926. };
  16927. return ExportJpgCommand;
  16928. }(ExportImageCommand_1.ExportImageCommand));
  16929. exports.ExportJpgCommand = ExportJpgCommand;
  16930. /***/ }),
  16931. /* 187 */
  16932. /***/ (function(module, exports, __webpack_require__) {
  16933. "use strict";
  16934. var __extends = (this && this.__extends) || (function () {
  16935. var extendStatics = function (d, b) {
  16936. extendStatics = Object.setPrototypeOf ||
  16937. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16938. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16939. return extendStatics(d, b);
  16940. };
  16941. return function (d, b) {
  16942. extendStatics(d, b);
  16943. function __() { this.constructor = d; }
  16944. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16945. };
  16946. })();
  16947. Object.defineProperty(exports, "__esModule", { value: true });
  16948. var CommandStates_1 = __webpack_require__(6);
  16949. var Exporter_1 = __webpack_require__(31);
  16950. var ClipboardCommand_1 = __webpack_require__(65);
  16951. var CopySelectionCommand = /** @class */ (function (_super) {
  16952. __extends(CopySelectionCommand, _super);
  16953. function CopySelectionCommand() {
  16954. return _super !== null && _super.apply(this, arguments) || this;
  16955. }
  16956. CopySelectionCommand.prototype.getState = function () {
  16957. return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty(true));
  16958. };
  16959. CopySelectionCommand.prototype.executeCore = function (state) {
  16960. var data = Exporter_1.Exporter.exportItems(this.control.selection.getSelectedItems());
  16961. this.setClipboardData(data);
  16962. return true;
  16963. };
  16964. return CopySelectionCommand;
  16965. }(ClipboardCommand_1.ClipboardCommand));
  16966. exports.CopySelectionCommand = CopySelectionCommand;
  16967. /***/ }),
  16968. /* 188 */
  16969. /***/ (function(module, exports, __webpack_require__) {
  16970. "use strict";
  16971. var __extends = (this && this.__extends) || (function () {
  16972. var extendStatics = function (d, b) {
  16973. extendStatics = Object.setPrototypeOf ||
  16974. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  16975. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  16976. return extendStatics(d, b);
  16977. };
  16978. return function (d, b) {
  16979. extendStatics(d, b);
  16980. function __() { this.constructor = d; }
  16981. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16982. };
  16983. })();
  16984. Object.defineProperty(exports, "__esModule", { value: true });
  16985. var CommandStates_1 = __webpack_require__(6);
  16986. var Exporter_1 = __webpack_require__(31);
  16987. var ModelUtils_1 = __webpack_require__(8);
  16988. var ClipboardCommand_1 = __webpack_require__(65);
  16989. var CutSelectionCommand = /** @class */ (function (_super) {
  16990. __extends(CutSelectionCommand, _super);
  16991. function CutSelectionCommand() {
  16992. return _super !== null && _super.apply(this, arguments) || this;
  16993. }
  16994. CutSelectionCommand.prototype.getState = function () {
  16995. return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty());
  16996. };
  16997. CutSelectionCommand.prototype.executeCore = function (state) {
  16998. var data = Exporter_1.Exporter.exportItems(this.control.selection.getSelectedItems());
  16999. this.setClipboardData(data);
  17000. ModelUtils_1.ModelUtils.deleteSelection(this.control.history, this.control.model, this.control.selection);
  17001. return true;
  17002. };
  17003. return CutSelectionCommand;
  17004. }(ClipboardCommand_1.ClipboardCommand));
  17005. exports.CutSelectionCommand = CutSelectionCommand;
  17006. /***/ }),
  17007. /* 189 */
  17008. /***/ (function(module, exports, __webpack_require__) {
  17009. "use strict";
  17010. var __extends = (this && this.__extends) || (function () {
  17011. var extendStatics = function (d, b) {
  17012. extendStatics = Object.setPrototypeOf ||
  17013. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17014. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17015. return extendStatics(d, b);
  17016. };
  17017. return function (d, b) {
  17018. extendStatics(d, b);
  17019. function __() { this.constructor = d; }
  17020. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17021. };
  17022. })();
  17023. Object.defineProperty(exports, "__esModule", { value: true });
  17024. var CommandStates_1 = __webpack_require__(6);
  17025. var Importer_1 = __webpack_require__(84);
  17026. var Shape_1 = __webpack_require__(9);
  17027. var ImportShapeHistoryItem_1 = __webpack_require__(190);
  17028. var Connector_1 = __webpack_require__(5);
  17029. var ImportConnectorHistoryItem_1 = __webpack_require__(191);
  17030. var SetSelectionHistoryItem_1 = __webpack_require__(29);
  17031. var ClipboardCommand_1 = __webpack_require__(65);
  17032. var UnitConverter_1 = __webpack_require__(13);
  17033. var ModelUtils_1 = __webpack_require__(8);
  17034. var Browser_1 = __webpack_require__(20);
  17035. var PasteSelectionCommand = /** @class */ (function (_super) {
  17036. __extends(PasteSelectionCommand, _super);
  17037. function PasteSelectionCommand() {
  17038. return _super !== null && _super.apply(this, arguments) || this;
  17039. }
  17040. PasteSelectionCommand.prototype.getState = function () {
  17041. return new CommandStates_1.SimpleCommandState(Browser_1.Browser.IE || (Browser_1.Browser.WebKitFamily && navigator && navigator["clipboard"] !== undefined));
  17042. };
  17043. PasteSelectionCommand.prototype.executeCore = function (state) {
  17044. var _this = this;
  17045. this.getClipboardData(function (data) {
  17046. _this.performPaste(data);
  17047. });
  17048. return true;
  17049. };
  17050. PasteSelectionCommand.prototype.performPaste = function (data) {
  17051. this.control.beginUpdate();
  17052. this.control.history.beginTransaction();
  17053. var ids = [];
  17054. var items = Importer_1.Importer.importItems(data, this.control.model);
  17055. for (var i = 0; i < items.length; i++) {
  17056. var item = items[i];
  17057. if (item instanceof Shape_1.Shape) {
  17058. while (this.control.model.findShapeAtPosition(item.position)) {
  17059. item.position.x += PasteSelectionCommand.positionOffset;
  17060. item.position.y += PasteSelectionCommand.positionOffset;
  17061. }
  17062. this.control.history.addOrModifyAndRedo(new ImportShapeHistoryItem_1.ImportShapeHistoryItem(item));
  17063. }
  17064. else if (item instanceof Connector_1.Connector) {
  17065. while (this.control.model.findConnectorAtPoints(item.points)) {
  17066. item.points.forEach(function (pt) {
  17067. pt.x += PasteSelectionCommand.positionOffset;
  17068. pt.y += PasteSelectionCommand.positionOffset;
  17069. });
  17070. }
  17071. this.control.history.addOrModifyAndRedo(new ImportConnectorHistoryItem_1.ImportConnectorHistoryItem(item));
  17072. }
  17073. ids.push(item.key);
  17074. }
  17075. ModelUtils_1.ModelUtils.tryUpdateModelSize(this.control.history, this.control.model);
  17076. this.control.history.addOrModifyAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(this.control.selection, ids));
  17077. this.control.history.endTransaction();
  17078. this.control.endUpdate();
  17079. };
  17080. PasteSelectionCommand.positionOffset = UnitConverter_1.UnitConverter.pixelsToTwips(10);
  17081. return PasteSelectionCommand;
  17082. }(ClipboardCommand_1.ClipboardCommand));
  17083. exports.PasteSelectionCommand = PasteSelectionCommand;
  17084. /***/ }),
  17085. /* 190 */
  17086. /***/ (function(module, exports, __webpack_require__) {
  17087. "use strict";
  17088. var __extends = (this && this.__extends) || (function () {
  17089. var extendStatics = function (d, b) {
  17090. extendStatics = Object.setPrototypeOf ||
  17091. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17092. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17093. return extendStatics(d, b);
  17094. };
  17095. return function (d, b) {
  17096. extendStatics(d, b);
  17097. function __() { this.constructor = d; }
  17098. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17099. };
  17100. })();
  17101. Object.defineProperty(exports, "__esModule", { value: true });
  17102. var HistoryItem_1 = __webpack_require__(4);
  17103. var ImportShapeHistoryItem = /** @class */ (function (_super) {
  17104. __extends(ImportShapeHistoryItem, _super);
  17105. function ImportShapeHistoryItem(shape) {
  17106. var _this = _super.call(this) || this;
  17107. _this.shape = shape;
  17108. return _this;
  17109. }
  17110. ImportShapeHistoryItem.prototype.redo = function (manipulator) {
  17111. this.shapeKey = this.shape.key;
  17112. manipulator.insertShape(this.shape);
  17113. };
  17114. ImportShapeHistoryItem.prototype.undo = function (manipulator) {
  17115. manipulator.removeShape(manipulator.model.findShape(this.shapeKey));
  17116. };
  17117. return ImportShapeHistoryItem;
  17118. }(HistoryItem_1.HistoryItem));
  17119. exports.ImportShapeHistoryItem = ImportShapeHistoryItem;
  17120. /***/ }),
  17121. /* 191 */
  17122. /***/ (function(module, exports, __webpack_require__) {
  17123. "use strict";
  17124. var __extends = (this && this.__extends) || (function () {
  17125. var extendStatics = function (d, b) {
  17126. extendStatics = Object.setPrototypeOf ||
  17127. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17128. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17129. return extendStatics(d, b);
  17130. };
  17131. return function (d, b) {
  17132. extendStatics(d, b);
  17133. function __() { this.constructor = d; }
  17134. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17135. };
  17136. })();
  17137. Object.defineProperty(exports, "__esModule", { value: true });
  17138. var HistoryItem_1 = __webpack_require__(4);
  17139. var ImportConnectorHistoryItem = /** @class */ (function (_super) {
  17140. __extends(ImportConnectorHistoryItem, _super);
  17141. function ImportConnectorHistoryItem(connector) {
  17142. var _this = _super.call(this) || this;
  17143. _this.connector = connector;
  17144. return _this;
  17145. }
  17146. ImportConnectorHistoryItem.prototype.redo = function (manipulator) {
  17147. this.connectorKey = this.connector.key;
  17148. manipulator.insertConnector(this.connector);
  17149. };
  17150. ImportConnectorHistoryItem.prototype.undo = function (manipulator) {
  17151. var connector = manipulator.model.findConnector(this.connectorKey);
  17152. manipulator.removeConnector(connector);
  17153. };
  17154. return ImportConnectorHistoryItem;
  17155. }(HistoryItem_1.HistoryItem));
  17156. exports.ImportConnectorHistoryItem = ImportConnectorHistoryItem;
  17157. /***/ }),
  17158. /* 192 */
  17159. /***/ (function(module, exports, __webpack_require__) {
  17160. "use strict";
  17161. var __extends = (this && this.__extends) || (function () {
  17162. var extendStatics = function (d, b) {
  17163. extendStatics = Object.setPrototypeOf ||
  17164. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17165. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17166. return extendStatics(d, b);
  17167. };
  17168. return function (d, b) {
  17169. extendStatics(d, b);
  17170. function __() { this.constructor = d; }
  17171. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17172. };
  17173. })();
  17174. Object.defineProperty(exports, "__esModule", { value: true });
  17175. var CommandBase_1 = __webpack_require__(7);
  17176. var CommandStates_1 = __webpack_require__(6);
  17177. var BPMNImporter_1 = __webpack_require__(193);
  17178. var LayoutUtils_1 = __webpack_require__(59);
  17179. var ModelUtils_1 = __webpack_require__(8);
  17180. var AddShapeHistoryItem_1 = __webpack_require__(51);
  17181. var Utils_1 = __webpack_require__(0);
  17182. var Connector_1 = __webpack_require__(5);
  17183. var AddConnectorHistoryItem_1 = __webpack_require__(58);
  17184. var AddConnectionHistoryItem_1 = __webpack_require__(35);
  17185. var Structures_1 = __webpack_require__(22);
  17186. var Sugiyama_1 = __webpack_require__(40);
  17187. var LayoutSettings_1 = __webpack_require__(18);
  17188. var ImportBPMNCommand = /** @class */ (function (_super) {
  17189. __extends(ImportBPMNCommand, _super);
  17190. function ImportBPMNCommand() {
  17191. return _super !== null && _super.apply(this, arguments) || this;
  17192. }
  17193. ImportBPMNCommand.prototype.getState = function () {
  17194. return new CommandStates_1.SimpleCommandState(true);
  17195. };
  17196. ImportBPMNCommand.prototype.executeCore = function (state, parameter) {
  17197. var _this = this;
  17198. var parser = new DOMParser();
  17199. var doc = parser.parseFromString(parameter, "application/xml");
  17200. var importer = new BPMNImporter_1.BPMNImporter(doc);
  17201. var externalKeyToModelKey = {};
  17202. var connectors = [];
  17203. var graph = importer.import()
  17204. .cast(function (node) {
  17205. var insert = new AddShapeHistoryItem_1.AddShapeHistoryItem(node.type, new Utils_1.Point(0, 0), node.text, node.key);
  17206. _this.control.history.addAndRedo(insert);
  17207. externalKeyToModelKey[node.key] = insert.shapeKey;
  17208. return LayoutUtils_1.LayoutUtils.shapeToLayout(_this.control.model.findShape(insert.shapeKey));
  17209. }, function (edge) {
  17210. var from = _this.control.model.findShape(externalKeyToModelKey[edge.from]);
  17211. var to = _this.control.model.findShape(externalKeyToModelKey[edge.to]);
  17212. var insert = new AddConnectorHistoryItem_1.AddConnectorHistoryItem([from.getConnectionPoint(0), to.getConnectionPoint(0)]);
  17213. _this.control.history.addAndRedo(insert);
  17214. var connector = _this.control.model.findConnector(insert.connectorKey);
  17215. connectors.push(connector);
  17216. _this.control.history.addAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(connector, from, 0, Connector_1.ConnectorPosition.Begin));
  17217. _this.control.history.addAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(connector, to, 0, Connector_1.ConnectorPosition.End));
  17218. return new Structures_1.Edge(connector.key, from.key, to.key);
  17219. });
  17220. var layout = new Sugiyama_1.SugiyamaLayoutBuilder(new LayoutSettings_1.LayoutSettings(), graph).build();
  17221. var nonGraphItems = ModelUtils_1.ModelUtils.getSymmetricDifference(layout.nodeToLayout, this.control.model.items);
  17222. layout = ModelUtils_1.ModelUtils.offsetLayoutToFreeSpace(layout, nonGraphItems.map(function (i) { return i.rectangle; }));
  17223. ModelUtils_1.ModelUtils.applyLayoutToNodes(this.control.history, this.control.model, layout, connectors);
  17224. ModelUtils_1.ModelUtils.applyLayoutToConnectors(this.control.history, layout, connectors);
  17225. // set selection
  17226. ModelUtils_1.ModelUtils.tryUpdateModelSize(this.control.history, this.control.model);
  17227. return true;
  17228. };
  17229. return ImportBPMNCommand;
  17230. }(CommandBase_1.CommandBase));
  17231. exports.ImportBPMNCommand = ImportBPMNCommand;
  17232. /***/ }),
  17233. /* 193 */
  17234. /***/ (function(module, exports, __webpack_require__) {
  17235. "use strict";
  17236. var __extends = (this && this.__extends) || (function () {
  17237. var extendStatics = function (d, b) {
  17238. extendStatics = Object.setPrototypeOf ||
  17239. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17240. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17241. return extendStatics(d, b);
  17242. };
  17243. return function (d, b) {
  17244. extendStatics(d, b);
  17245. function __() { this.constructor = d; }
  17246. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17247. };
  17248. })();
  17249. Object.defineProperty(exports, "__esModule", { value: true });
  17250. var Graph_1 = __webpack_require__(34);
  17251. var ShapeType_1 = __webpack_require__(1);
  17252. var Structures_1 = __webpack_require__(22);
  17253. var BPMNImporter = /** @class */ (function () {
  17254. function BPMNImporter(doc) {
  17255. this.doc = doc;
  17256. this.graph = new Graph_1.Graph([], []);
  17257. }
  17258. BPMNImporter.prototype.import = function () {
  17259. for (var child = void 0, i = 0; child = this.doc.children[i]; i++) {
  17260. if (child.nodeName.toUpperCase() === "DEFINITIONS")
  17261. this.onDefinitionsElement(child);
  17262. }
  17263. this.validate();
  17264. return this.graph;
  17265. };
  17266. BPMNImporter.prototype.validate = function () {
  17267. var nodesMap = {};
  17268. this.graph.nodes.forEach(function (n) { return nodesMap[n] = true; });
  17269. for (var i = 0, edge = void 0; edge = this.graph.edges[i]; i++) {
  17270. if (!nodesMap[edge.from] || !nodesMap[edge.to]) {
  17271. this.graph.edges.splice(i, 1);
  17272. i--;
  17273. }
  17274. }
  17275. };
  17276. BPMNImporter.prototype.onDefinitionsElement = function (element) {
  17277. this.dataSourceKey = element.getAttribute("id");
  17278. for (var child = void 0, i = 0; child = element.children[i]; i++) {
  17279. if (child.nodeName.toUpperCase() === "PROCESS")
  17280. this.onProcessElement(child);
  17281. }
  17282. };
  17283. BPMNImporter.prototype.onProcessElement = function (element) {
  17284. for (var child = void 0, i = 0; child = element.children[i]; i++) {
  17285. switch (child.nodeName.toUpperCase()) {
  17286. case "STARTEVENT":
  17287. this.onStartEventElement(child);
  17288. break;
  17289. case "SEQUENCEFLOW":
  17290. this.onSequenceFlowElement(child);
  17291. break;
  17292. case "SCRIPTTASK":
  17293. this.onScriptTaskElement(child);
  17294. break;
  17295. case "USERTASK":
  17296. this.onUserTaskElement(child);
  17297. break;
  17298. case "SERVICETASK":
  17299. this.onServiceTaskElement(child);
  17300. break;
  17301. case "SENDTASK":
  17302. this.onSendTaskElement(child);
  17303. break;
  17304. case "EXCLUSIVEGATEWAY":
  17305. this.onExclusiveGateway(child);
  17306. break;
  17307. case "ENDEVENT":
  17308. this.onEndEventGateway(child);
  17309. break;
  17310. }
  17311. }
  17312. };
  17313. BPMNImporter.prototype.onStartEventElement = function (element) {
  17314. var node = this.createNode(element);
  17315. node.type = ShapeType_1.ShapeType.Ellipsis;
  17316. node.text = element.getAttribute("name");
  17317. this.graph.addNode(node);
  17318. };
  17319. BPMNImporter.prototype.onSequenceFlowElement = function (element) {
  17320. var fromKey = element.getAttribute("sourceRef");
  17321. var toKey = element.getAttribute("targetRef");
  17322. var edge = this.createEdge(element, fromKey, toKey);
  17323. if (element.hasAttribute("name"))
  17324. edge.text = element.getAttribute("name");
  17325. this.graph.addEdge(edge);
  17326. };
  17327. BPMNImporter.prototype.onScriptTaskElement = function (element) {
  17328. var node = this.createNode(element);
  17329. node.text = element.getAttribute("name");
  17330. this.graph.addNode(node);
  17331. };
  17332. BPMNImporter.prototype.onUserTaskElement = function (element) {
  17333. var node = this.createNode(element);
  17334. node.text = element.getAttribute("name");
  17335. this.graph.addNode(node);
  17336. };
  17337. BPMNImporter.prototype.onServiceTaskElement = function (element) {
  17338. var node = this.createNode(element);
  17339. node.text = element.getAttribute("name");
  17340. this.graph.addNode(node);
  17341. };
  17342. BPMNImporter.prototype.onSendTaskElement = function (element) {
  17343. var node = this.createNode(element);
  17344. node.text = element.getAttribute("name");
  17345. this.graph.addNode(node);
  17346. };
  17347. BPMNImporter.prototype.onExclusiveGateway = function (element) {
  17348. var node = this.createNode(element);
  17349. node.text = element.getAttribute("name");
  17350. node.type = ShapeType_1.ShapeType.Decision;
  17351. this.graph.addNode(node);
  17352. };
  17353. BPMNImporter.prototype.onEndEventGateway = function (element) {
  17354. var node = this.createNode(element);
  17355. node.text = element.getAttribute("name");
  17356. node.type = ShapeType_1.ShapeType.Ellipsis;
  17357. this.graph.addNode(node);
  17358. };
  17359. BPMNImporter.prototype.createNode = function (element) {
  17360. return new BPMNNode(this.dataSourceKey, element.getAttribute("id"));
  17361. };
  17362. BPMNImporter.prototype.createEdge = function (element, fromKey, toKey) {
  17363. return new BPMNEdge(this.dataSourceKey, element.getAttribute("id"), fromKey, toKey);
  17364. };
  17365. return BPMNImporter;
  17366. }());
  17367. exports.BPMNImporter = BPMNImporter;
  17368. var BPMNNode = /** @class */ (function () {
  17369. function BPMNNode(sourceKey, key) {
  17370. this.sourceKey = sourceKey;
  17371. this.key = key;
  17372. this.type = ShapeType_1.ShapeType.Rectangle;
  17373. }
  17374. return BPMNNode;
  17375. }());
  17376. var BPMNEdge = /** @class */ (function (_super) {
  17377. __extends(BPMNEdge, _super);
  17378. function BPMNEdge(sourceKey, key, fromKey, toKey) {
  17379. var _this = _super.call(this, key, fromKey, toKey) || this;
  17380. _this.sourceKey = sourceKey;
  17381. return _this;
  17382. }
  17383. return BPMNEdge;
  17384. }(Structures_1.Edge));
  17385. /***/ }),
  17386. /* 194 */
  17387. /***/ (function(module, exports, __webpack_require__) {
  17388. "use strict";
  17389. var __extends = (this && this.__extends) || (function () {
  17390. var extendStatics = function (d, b) {
  17391. extendStatics = Object.setPrototypeOf ||
  17392. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17393. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17394. return extendStatics(d, b);
  17395. };
  17396. return function (d, b) {
  17397. extendStatics(d, b);
  17398. function __() { this.constructor = d; }
  17399. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17400. };
  17401. })();
  17402. Object.defineProperty(exports, "__esModule", { value: true });
  17403. var CommandBase_1 = __webpack_require__(7);
  17404. var CommandStates_1 = __webpack_require__(6);
  17405. var ChangeZindexHistoryItem_1 = __webpack_require__(93);
  17406. var SendToBackCommand = /** @class */ (function (_super) {
  17407. __extends(SendToBackCommand, _super);
  17408. function SendToBackCommand() {
  17409. return _super !== null && _super.apply(this, arguments) || this;
  17410. }
  17411. SendToBackCommand.prototype.getState = function () {
  17412. var items = this.control.selection.getSelectedItems();
  17413. return new CommandStates_1.SimpleCommandState(items.length && this.needSendToBack(items));
  17414. };
  17415. SendToBackCommand.prototype.executeCore = function (state, parameter) {
  17416. var _this = this;
  17417. this.control.history.beginTransaction();
  17418. var items = this.control.selection.getSelectedItems();
  17419. items.forEach(function (item) {
  17420. var newZIndex = _this.control.model.getIntersectItemsMinZIndex(item) - 1;
  17421. _this.control.history.addAndRedo(new ChangeZindexHistoryItem_1.ChangeZindexHistoryItem(item, newZIndex));
  17422. });
  17423. this.control.history.endTransaction();
  17424. return true;
  17425. };
  17426. SendToBackCommand.prototype.needSendToBack = function (items) {
  17427. var _this = this;
  17428. var _loop_1 = function (i) {
  17429. var zIndex = this_1.control.model.getIntersectItemsMinZIndex(items[i]);
  17430. if (zIndex < items[i].zIndex)
  17431. return { value: true };
  17432. if (zIndex === items[i].zIndex) {
  17433. var result_1 = false;
  17434. var sameZIndexItems = this_1.control.model.getIntersectItems(items[i]).filter(function (item) { return item.zIndex === items[i].zIndex; });
  17435. sameZIndexItems.forEach(function (item) {
  17436. if (_this.control.model.getItemIndex(item) < _this.control.model.getItemIndex(items[i])) {
  17437. result_1 = true;
  17438. return;
  17439. }
  17440. });
  17441. return { value: result_1 };
  17442. }
  17443. };
  17444. var this_1 = this;
  17445. for (var i = 0; i < items.length; i++) {
  17446. var state_1 = _loop_1(i);
  17447. if (typeof state_1 === "object")
  17448. return state_1.value;
  17449. }
  17450. return false;
  17451. };
  17452. return SendToBackCommand;
  17453. }(CommandBase_1.CommandBase));
  17454. exports.SendToBackCommand = SendToBackCommand;
  17455. /***/ }),
  17456. /* 195 */
  17457. /***/ (function(module, exports, __webpack_require__) {
  17458. "use strict";
  17459. var __extends = (this && this.__extends) || (function () {
  17460. var extendStatics = function (d, b) {
  17461. extendStatics = Object.setPrototypeOf ||
  17462. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17463. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17464. return extendStatics(d, b);
  17465. };
  17466. return function (d, b) {
  17467. extendStatics(d, b);
  17468. function __() { this.constructor = d; }
  17469. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17470. };
  17471. })();
  17472. Object.defineProperty(exports, "__esModule", { value: true });
  17473. var CommandBase_1 = __webpack_require__(7);
  17474. var CommandStates_1 = __webpack_require__(6);
  17475. var ChangeZindexHistoryItem_1 = __webpack_require__(93);
  17476. var BringToFrontCommand = /** @class */ (function (_super) {
  17477. __extends(BringToFrontCommand, _super);
  17478. function BringToFrontCommand() {
  17479. return _super !== null && _super.apply(this, arguments) || this;
  17480. }
  17481. BringToFrontCommand.prototype.getState = function () {
  17482. var items = this.control.selection.getSelectedItems();
  17483. return new CommandStates_1.SimpleCommandState(items.length && this.needBringToFront(items));
  17484. };
  17485. BringToFrontCommand.prototype.executeCore = function (state, parameter) {
  17486. var _this = this;
  17487. this.control.history.beginTransaction();
  17488. var items = this.control.selection.getSelectedItems();
  17489. items.forEach(function (item) {
  17490. var newZIndex = _this.control.model.getIntersectItemsMaxZIndex(item) + 1;
  17491. _this.control.history.addAndRedo(new ChangeZindexHistoryItem_1.ChangeZindexHistoryItem(item, newZIndex));
  17492. });
  17493. this.control.history.endTransaction();
  17494. return true;
  17495. };
  17496. BringToFrontCommand.prototype.needBringToFront = function (items) {
  17497. var _this = this;
  17498. var _loop_1 = function (i) {
  17499. var zIndex = this_1.control.model.getIntersectItemsMaxZIndex(items[i]);
  17500. if (zIndex > items[i].zIndex)
  17501. return { value: true };
  17502. if (zIndex === items[i].zIndex) {
  17503. var result_1 = false;
  17504. var sameZIndexItems = this_1.control.model.getIntersectItems(items[i]).filter(function (item) { return item.zIndex === items[i].zIndex; });
  17505. sameZIndexItems.forEach(function (item) {
  17506. if (_this.control.model.getItemIndex(item) > _this.control.model.getItemIndex(items[i])) {
  17507. result_1 = true;
  17508. return;
  17509. }
  17510. });
  17511. return { value: result_1 };
  17512. }
  17513. };
  17514. var this_1 = this;
  17515. for (var i = 0; i < items.length; i++) {
  17516. var state_1 = _loop_1(i);
  17517. if (typeof state_1 === "object")
  17518. return state_1.value;
  17519. }
  17520. return false;
  17521. };
  17522. return BringToFrontCommand;
  17523. }(CommandBase_1.CommandBase));
  17524. exports.BringToFrontCommand = BringToFrontCommand;
  17525. /***/ }),
  17526. /* 196 */
  17527. /***/ (function(module, exports, __webpack_require__) {
  17528. "use strict";
  17529. var __extends = (this && this.__extends) || (function () {
  17530. var extendStatics = function (d, b) {
  17531. extendStatics = Object.setPrototypeOf ||
  17532. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17533. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17534. return extendStatics(d, b);
  17535. };
  17536. return function (d, b) {
  17537. extendStatics(d, b);
  17538. function __() { this.constructor = d; }
  17539. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17540. };
  17541. })();
  17542. Object.defineProperty(exports, "__esModule", { value: true });
  17543. var AutoLayoutCommandBase_1 = __webpack_require__(43);
  17544. var Sugiyama_1 = __webpack_require__(40);
  17545. var LayoutSettings_1 = __webpack_require__(18);
  17546. var AutoLayoutLayeredHorizontalCommand = /** @class */ (function (_super) {
  17547. __extends(AutoLayoutLayeredHorizontalCommand, _super);
  17548. function AutoLayoutLayeredHorizontalCommand() {
  17549. return _super !== null && _super.apply(this, arguments) || this;
  17550. }
  17551. AutoLayoutLayeredHorizontalCommand.prototype.createLayout = function (graph) {
  17552. var settings = this.createLayoutSettings();
  17553. settings.orientation = LayoutSettings_1.OrientationKind.Horizontal;
  17554. return new Sugiyama_1.SugiyamaLayoutBuilder(settings, graph).build();
  17555. };
  17556. return AutoLayoutLayeredHorizontalCommand;
  17557. }(AutoLayoutCommandBase_1.AutoLayoutCommandBase));
  17558. exports.AutoLayoutLayeredHorizontalCommand = AutoLayoutLayeredHorizontalCommand;
  17559. /***/ }),
  17560. /* 197 */
  17561. /***/ (function(module, exports, __webpack_require__) {
  17562. "use strict";
  17563. var __extends = (this && this.__extends) || (function () {
  17564. var extendStatics = function (d, b) {
  17565. extendStatics = Object.setPrototypeOf ||
  17566. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17567. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17568. return extendStatics(d, b);
  17569. };
  17570. return function (d, b) {
  17571. extendStatics(d, b);
  17572. function __() { this.constructor = d; }
  17573. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17574. };
  17575. })();
  17576. Object.defineProperty(exports, "__esModule", { value: true });
  17577. var CommandBase_1 = __webpack_require__(7);
  17578. var CommandStates_1 = __webpack_require__(6);
  17579. var Utils_1 = __webpack_require__(0);
  17580. var ModelUtils_1 = __webpack_require__(8);
  17581. var UnitConverter_1 = __webpack_require__(13);
  17582. var MoveCommand = /** @class */ (function (_super) {
  17583. __extends(MoveCommand, _super);
  17584. function MoveCommand() {
  17585. return _super !== null && _super.apply(this, arguments) || this;
  17586. }
  17587. MoveCommand.prototype.getState = function () {
  17588. return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty());
  17589. };
  17590. MoveCommand.prototype.executeCore = function (state, parameter) {
  17591. var _this = this;
  17592. this.control.history.beginTransaction();
  17593. var shapes = this.control.selection.getSelectedShapes();
  17594. shapes.forEach(function (shape, index) {
  17595. var pos = _this.getPosition(shape.position);
  17596. ModelUtils_1.ModelUtils.setShapePosition(_this.control.history, _this.control.model, shape.key, pos, _this.control.history.addOrModifyAndRedo);
  17597. shape.attachedConnectors.forEach(function (connector) {
  17598. ModelUtils_1.ModelUtils.removeConnectorIntermediatePoints(_this.control.history, connector);
  17599. ModelUtils_1.ModelUtils.updateConnectorAttachedPoints(_this.control.history, connector, _this.control.history.addOrModifyAndRedo);
  17600. });
  17601. });
  17602. var connectors = this.control.selection.getSelectedConnectors();
  17603. connectors.forEach(function (connector, index) {
  17604. var startPtIndex = connector.beginItem ? 1 : 0;
  17605. var endPtIndex = connector.endItem ? (connector.points.length - 2) : (connector.points.length - 1);
  17606. for (var i = startPtIndex; i <= endPtIndex; i++) {
  17607. var pos = _this.getPosition(connector.points[i]);
  17608. ModelUtils_1.ModelUtils.setConnectorPoint(_this.control.history, _this.control.model, connector.key, i, pos, _this.control.history.addOrModifyAndRedo);
  17609. }
  17610. });
  17611. ModelUtils_1.ModelUtils.tryUpdateModelSize(this.control.history, this.control.model);
  17612. this.control.history.endTransaction();
  17613. return true;
  17614. };
  17615. return MoveCommand;
  17616. }(CommandBase_1.CommandBase));
  17617. exports.MoveCommand = MoveCommand;
  17618. var MoveLeftCommand = /** @class */ (function (_super) {
  17619. __extends(MoveLeftCommand, _super);
  17620. function MoveLeftCommand() {
  17621. return _super !== null && _super.apply(this, arguments) || this;
  17622. }
  17623. MoveLeftCommand.prototype.getPosition = function (position) {
  17624. return position.offset(-UnitConverter_1.UnitConverter.pixelsToTwips(1), 0);
  17625. };
  17626. return MoveLeftCommand;
  17627. }(MoveCommand));
  17628. exports.MoveLeftCommand = MoveLeftCommand;
  17629. var MoveStepLeftCommand = /** @class */ (function (_super) {
  17630. __extends(MoveStepLeftCommand, _super);
  17631. function MoveStepLeftCommand() {
  17632. return _super !== null && _super.apply(this, arguments) || this;
  17633. }
  17634. MoveStepLeftCommand.prototype.getPosition = function (position) {
  17635. if (this.control.model.snapToGrid)
  17636. return new Utils_1.Point(ModelUtils_1.ModelUtils.getSnappedPos(this.control.model, position.x - (this.control.model.gridSize / 2 + 2)), position.y);
  17637. else
  17638. return position.offset(-this.control.model.gridSize, 0);
  17639. };
  17640. return MoveStepLeftCommand;
  17641. }(MoveCommand));
  17642. exports.MoveStepLeftCommand = MoveStepLeftCommand;
  17643. var MoveRightCommand = /** @class */ (function (_super) {
  17644. __extends(MoveRightCommand, _super);
  17645. function MoveRightCommand() {
  17646. return _super !== null && _super.apply(this, arguments) || this;
  17647. }
  17648. MoveRightCommand.prototype.getPosition = function (position) {
  17649. return position.offset(UnitConverter_1.UnitConverter.pixelsToTwips(1), 0);
  17650. };
  17651. return MoveRightCommand;
  17652. }(MoveCommand));
  17653. exports.MoveRightCommand = MoveRightCommand;
  17654. var MoveStepRightCommand = /** @class */ (function (_super) {
  17655. __extends(MoveStepRightCommand, _super);
  17656. function MoveStepRightCommand() {
  17657. return _super !== null && _super.apply(this, arguments) || this;
  17658. }
  17659. MoveStepRightCommand.prototype.getPosition = function (position) {
  17660. if (this.control.model.snapToGrid)
  17661. return new Utils_1.Point(ModelUtils_1.ModelUtils.getSnappedPos(this.control.model, position.x + (this.control.model.gridSize / 2 + 2)), position.y);
  17662. else
  17663. return position.offset(this.control.model.gridSize, 0);
  17664. };
  17665. return MoveStepRightCommand;
  17666. }(MoveCommand));
  17667. exports.MoveStepRightCommand = MoveStepRightCommand;
  17668. var MoveUpCommand = /** @class */ (function (_super) {
  17669. __extends(MoveUpCommand, _super);
  17670. function MoveUpCommand() {
  17671. return _super !== null && _super.apply(this, arguments) || this;
  17672. }
  17673. MoveUpCommand.prototype.getPosition = function (position) {
  17674. return position.offset(0, -UnitConverter_1.UnitConverter.pixelsToTwips(1));
  17675. };
  17676. return MoveUpCommand;
  17677. }(MoveCommand));
  17678. exports.MoveUpCommand = MoveUpCommand;
  17679. var MoveStepUpCommand = /** @class */ (function (_super) {
  17680. __extends(MoveStepUpCommand, _super);
  17681. function MoveStepUpCommand() {
  17682. return _super !== null && _super.apply(this, arguments) || this;
  17683. }
  17684. MoveStepUpCommand.prototype.getPosition = function (position) {
  17685. if (this.control.model.snapToGrid)
  17686. return new Utils_1.Point(position.x, ModelUtils_1.ModelUtils.getSnappedPos(this.control.model, position.y - (this.control.model.gridSize / 2 + 2)));
  17687. else
  17688. return position.offset(0, -this.control.model.gridSize);
  17689. };
  17690. return MoveStepUpCommand;
  17691. }(MoveCommand));
  17692. exports.MoveStepUpCommand = MoveStepUpCommand;
  17693. var MoveDownCommand = /** @class */ (function (_super) {
  17694. __extends(MoveDownCommand, _super);
  17695. function MoveDownCommand() {
  17696. return _super !== null && _super.apply(this, arguments) || this;
  17697. }
  17698. MoveDownCommand.prototype.getPosition = function (position) {
  17699. return position.offset(0, UnitConverter_1.UnitConverter.pixelsToTwips(1));
  17700. };
  17701. return MoveDownCommand;
  17702. }(MoveCommand));
  17703. exports.MoveDownCommand = MoveDownCommand;
  17704. var MoveStepDownCommand = /** @class */ (function (_super) {
  17705. __extends(MoveStepDownCommand, _super);
  17706. function MoveStepDownCommand() {
  17707. return _super !== null && _super.apply(this, arguments) || this;
  17708. }
  17709. MoveStepDownCommand.prototype.getPosition = function (position) {
  17710. if (this.control.model.snapToGrid)
  17711. return new Utils_1.Point(position.x, ModelUtils_1.ModelUtils.getSnappedPos(this.control.model, position.y + (this.control.model.gridSize / 2 + 2)));
  17712. else
  17713. return position.offset(0, this.control.model.gridSize);
  17714. };
  17715. return MoveStepDownCommand;
  17716. }(MoveCommand));
  17717. exports.MoveStepDownCommand = MoveStepDownCommand;
  17718. /***/ }),
  17719. /* 198 */
  17720. /***/ (function(module, exports, __webpack_require__) {
  17721. "use strict";
  17722. var __extends = (this && this.__extends) || (function () {
  17723. var extendStatics = function (d, b) {
  17724. extendStatics = Object.setPrototypeOf ||
  17725. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17726. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17727. return extendStatics(d, b);
  17728. };
  17729. return function (d, b) {
  17730. extendStatics(d, b);
  17731. function __() { this.constructor = d; }
  17732. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17733. };
  17734. })();
  17735. Object.defineProperty(exports, "__esModule", { value: true });
  17736. var ChangePagePropertyCommand_1 = __webpack_require__(23);
  17737. var SetSelectionHistoryItem_1 = __webpack_require__(29);
  17738. var ChangeZoomLevelCommand = /** @class */ (function (_super) {
  17739. __extends(ChangeZoomLevelCommand, _super);
  17740. function ChangeZoomLevelCommand() {
  17741. return _super !== null && _super.apply(this, arguments) || this;
  17742. }
  17743. ChangeZoomLevelCommand.prototype.getPropertyName = function () {
  17744. return "zoomLevel";
  17745. };
  17746. ChangeZoomLevelCommand.prototype.createHistoryItems = function (propertyName, parameter) {
  17747. var result = _super.prototype.createHistoryItems.call(this, propertyName, parameter);
  17748. return result.concat([new SetSelectionHistoryItem_1.SetSelectionHistoryItem(this.control.selection, [])]);
  17749. };
  17750. ChangeZoomLevelCommand.prototype.getPropertyOptions = function () {
  17751. return [
  17752. { value: 0.5, text: "50%" },
  17753. { value: 0.75, text: "75%" },
  17754. { value: 1, text: "100%" },
  17755. { value: 1.25, text: "125%" },
  17756. { value: 1.5, text: "150%" },
  17757. { value: 2, text: "200%" },
  17758. { value: 3, text: "300%" }
  17759. ];
  17760. };
  17761. return ChangeZoomLevelCommand;
  17762. }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
  17763. exports.ChangeZoomLevelCommand = ChangeZoomLevelCommand;
  17764. /***/ }),
  17765. /* 199 */
  17766. /***/ (function(module, exports, __webpack_require__) {
  17767. "use strict";
  17768. var __extends = (this && this.__extends) || (function () {
  17769. var extendStatics = function (d, b) {
  17770. extendStatics = Object.setPrototypeOf ||
  17771. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17772. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17773. return extendStatics(d, b);
  17774. };
  17775. return function (d, b) {
  17776. extendStatics(d, b);
  17777. function __() { this.constructor = d; }
  17778. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17779. };
  17780. })();
  17781. Object.defineProperty(exports, "__esModule", { value: true });
  17782. var ModelUtils_1 = __webpack_require__(8);
  17783. var ImportDataCommandBase_1 = __webpack_require__(89);
  17784. var DocumentDataSource_1 = __webpack_require__(200);
  17785. var BindDocumentCommand = /** @class */ (function (_super) {
  17786. __extends(BindDocumentCommand, _super);
  17787. function BindDocumentCommand() {
  17788. return _super !== null && _super.apply(this, arguments) || this;
  17789. }
  17790. BindDocumentCommand.prototype.performImportData = function (parameter) {
  17791. var dataSource = new DocumentDataSource_1.DocumentDataSource(parameter.nodeDataSource, parameter.edgeDataSource, parameter.nodeDataImporter, parameter.edgeDataImporter);
  17792. this.control.registerDocumentDataSource(dataSource);
  17793. if (parameter.layoutType !== undefined) {
  17794. this.control.history.beginTransaction();
  17795. ModelUtils_1.ModelUtils.deleteAllItems(this.control.history, this.control.model, this.control.selection);
  17796. this.createItems(dataSource, parameter.layoutType);
  17797. this.control.history.endTransaction();
  17798. }
  17799. this.control.history.clear();
  17800. };
  17801. return BindDocumentCommand;
  17802. }(ImportDataCommandBase_1.ImportDataCommandBase));
  17803. exports.BindDocumentCommand = BindDocumentCommand;
  17804. /***/ }),
  17805. /* 200 */
  17806. /***/ (function(module, exports, __webpack_require__) {
  17807. "use strict";
  17808. var __extends = (this && this.__extends) || (function () {
  17809. var extendStatics = function (d, b) {
  17810. extendStatics = Object.setPrototypeOf ||
  17811. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17812. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  17813. return extendStatics(d, b);
  17814. };
  17815. return function (d, b) {
  17816. extendStatics(d, b);
  17817. function __() { this.constructor = d; }
  17818. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17819. };
  17820. })();
  17821. Object.defineProperty(exports, "__esModule", { value: true });
  17822. var ShapeType_1 = __webpack_require__(1);
  17823. var Shape_1 = __webpack_require__(9);
  17824. var Connector_1 = __webpack_require__(5);
  17825. var ModelUtils_1 = __webpack_require__(8);
  17826. var DataSource_1 = __webpack_require__(37);
  17827. var DocumentDataSource = /** @class */ (function (_super) {
  17828. __extends(DocumentDataSource, _super);
  17829. function DocumentDataSource(nodeDataSource, edgeDataSource, nodeDataImporter, edgeDataImporter) {
  17830. return _super.call(this, "Document", "Document Data Source", nodeDataSource, edgeDataSource, nodeDataImporter, edgeDataImporter) || this;
  17831. }
  17832. DocumentDataSource.prototype.createModelItems = function (history, model, selection, layoutType) {
  17833. ModelUtils_1.ModelUtils.createItemsByDataSource(history, model, selection, this, layoutType, true);
  17834. };
  17835. DocumentDataSource.prototype.updateItems = function (model, changesListener) {
  17836. var _this = this;
  17837. this.deleteNodes(model, changesListener);
  17838. this.deleteEdges(model, changesListener);
  17839. model.items.forEach(function (item) {
  17840. if (item instanceof Shape_1.Shape)
  17841. _this.updateNode(item, changesListener);
  17842. if (item instanceof Connector_1.Connector)
  17843. _this.updateEdge(item, changesListener);
  17844. });
  17845. };
  17846. DocumentDataSource.prototype.updateNode = function (shape, changesListener) {
  17847. var _this = this;
  17848. var nodeObj = this.findNode(shape.dataKey);
  17849. if (!nodeObj) {
  17850. var dataObj = {};
  17851. nodeObj = this.addNodeInternal(dataObj, shape.text, shape.description.key);
  17852. this.nodeDataSource.push(nodeObj.dataObj);
  17853. this.nodeDataImporter.setKey(dataObj, nodeObj.key);
  17854. this.updateNodeObject(nodeObj, shape);
  17855. this.updateNodeObjectKey(nodeObj, nodeObj.dataObj, shape);
  17856. changesListener.NotifyNodeInserted.call(changesListener, nodeObj.dataObj, function (data) {
  17857. _this.updateNodeObjectKey(nodeObj, data, shape);
  17858. });
  17859. }
  17860. else {
  17861. if (this.isNodeObjectModified(nodeObj, shape)) {
  17862. this.updateNodeObject(nodeObj, shape);
  17863. changesListener.NotifyNodeUpdated.call(changesListener, this.nodeDataImporter.getKey(nodeObj.dataObj || nodeObj.key), nodeObj.dataObj, function (key, data) { });
  17864. }
  17865. }
  17866. if (this.useNodeParentId) {
  17867. var parentKey = this.getParentShapeKey(shape);
  17868. var parentItem = this.findNode(parentKey);
  17869. this.updateNodeObjectParentKey(nodeObj, parentItem, changesListener);
  17870. }
  17871. if (this.useNodeItems) {
  17872. var parentKey = this.getParentShapeKey(shape);
  17873. var parentItem = this.findNode(parentKey);
  17874. this.updateNodeObjectItems(nodeObj, parentItem, changesListener);
  17875. }
  17876. };
  17877. DocumentDataSource.prototype.isNodeObjectModified = function (nodeObj, shape) {
  17878. return nodeObj.text !== shape.text || (nodeObj.type !== shape.description.key &&
  17879. !(nodeObj.type === undefined && shape.description.key === ShapeType_1.ShapeType.Rectangle));
  17880. };
  17881. DocumentDataSource.prototype.updateNodeObject = function (nodeObj, shape) {
  17882. nodeObj.text = shape.text;
  17883. this.nodeDataImporter.setText(nodeObj.dataObj, shape.text);
  17884. nodeObj.type = shape.description.key;
  17885. this.nodeDataImporter.setType(nodeObj.dataObj, shape.description.key);
  17886. };
  17887. DocumentDataSource.prototype.updateNodeObjectParentKey = function (nodeObj, parentNodeObj, changesListener) {
  17888. var parentKey = this.nodeDataImporter.getParentKey(nodeObj.dataObj);
  17889. var newParentKey = parentNodeObj ? this.nodeDataImporter.getKey(parentNodeObj.dataObj) : undefined;
  17890. if (parentKey !== newParentKey) {
  17891. this.nodeDataImporter.setParentKey(nodeObj.dataObj, newParentKey);
  17892. changesListener.NotifyNodeUpdated.call(changesListener, this.nodeDataImporter.getKey(nodeObj.dataObj) || nodeObj.key, nodeObj.dataObj, function (key, data) { });
  17893. }
  17894. };
  17895. DocumentDataSource.prototype.updateNodeObjectItems = function (nodeObj, parentNodeObj, changesListener) {
  17896. if (parentNodeObj && nodeObj.parentDataObj !== parentNodeObj.dataObj ||
  17897. !parentNodeObj && nodeObj.parentDataObj) {
  17898. if (!parentNodeObj || !this.checkNodeCyrcleItems(nodeObj.dataObj, parentNodeObj.dataObj)) {
  17899. var oldItemsArray = nodeObj.parentDataObj ? this.nodeDataImporter.getItems(nodeObj.parentDataObj) : this.nodeDataSource;
  17900. var index = oldItemsArray.indexOf(nodeObj.dataObj);
  17901. oldItemsArray.splice(index, 1);
  17902. var itemsArray = parentNodeObj ? this.nodeDataImporter.getItems(parentNodeObj.dataObj) : this.nodeDataSource;
  17903. if (!itemsArray)
  17904. this.nodeDataImporter.setItems(parentNodeObj.dataObj, [nodeObj.dataObj]);
  17905. else
  17906. itemsArray.push(nodeObj.dataObj);
  17907. nodeObj.parentDataObj = parentNodeObj && parentNodeObj.dataObj;
  17908. changesListener.NotifyNodeUpdated.call(changesListener, this.nodeDataImporter.getKey(nodeObj.dataObj) || nodeObj.key, nodeObj.dataObj, function (key, data) { });
  17909. }
  17910. }
  17911. };
  17912. DocumentDataSource.prototype.checkNodeCyrcleItems = function (nodeDataObj, parentDataObjCandidate) {
  17913. var _this = this;
  17914. var result = false;
  17915. var items = this.nodeDataImporter.getItems(nodeDataObj);
  17916. if (items) {
  17917. items.forEach(function (childDataObj) {
  17918. result = result || childDataObj === parentDataObjCandidate ||
  17919. _this.checkNodeCyrcleItems(childDataObj, parentDataObjCandidate);
  17920. });
  17921. }
  17922. return result;
  17923. };
  17924. DocumentDataSource.prototype.updateNodeObjectKey = function (nodeObj, dataObj, shape) {
  17925. var key = this.nodeDataImporter.getKey(dataObj);
  17926. if (key !== undefined && key !== null && key !== nodeObj.key) {
  17927. nodeObj.key = key.toString();
  17928. delete this.nodeKeyMap[nodeObj.key];
  17929. this.nodeKeyMap[key] = nodeObj.key;
  17930. }
  17931. shape.dataKey = nodeObj.key;
  17932. nodeObj.dataObj = dataObj;
  17933. };
  17934. DocumentDataSource.prototype.updateEdge = function (connector, changesListener) {
  17935. var _this = this;
  17936. var beginDataKey = connector.beginItem ? connector.beginItem.dataKey : undefined;
  17937. var endDataKey = connector.endItem ? connector.endItem.dataKey : undefined;
  17938. var edgeObj = this.findEdge(connector.dataKey);
  17939. if (!edgeObj) {
  17940. var dataObj = this.useEdgesArray() ? {} : undefined;
  17941. edgeObj = this.addEdgeInternal(dataObj, beginDataKey, endDataKey);
  17942. if (dataObj) {
  17943. this.edgeDataImporter.setKey(dataObj, edgeObj.key);
  17944. this.edgeDataSource.push(edgeObj.dataObj);
  17945. }
  17946. this.updateEdgeObject(edgeObj, connector);
  17947. this.updateEdgeObjectKey(edgeObj, edgeObj.dataObj, connector);
  17948. if (dataObj) {
  17949. changesListener.NotifyEdgeInserted.call(changesListener, edgeObj.dataObj, function (data) {
  17950. _this.updateEdgeObjectKey(edgeObj, data, connector);
  17951. });
  17952. }
  17953. }
  17954. else {
  17955. if (this.isEdgeObjectModified(edgeObj, connector)) {
  17956. this.updateEdgeObject(edgeObj, connector);
  17957. if (edgeObj.dataObj) {
  17958. changesListener.NotifyEdgeUpdated.call(changesListener, this.edgeDataImporter.getKey(edgeObj.dataObj) || edgeObj.key, edgeObj.dataObj, function (key, data) { });
  17959. }
  17960. }
  17961. }
  17962. };
  17963. DocumentDataSource.prototype.isEdgeObjectModified = function (edgeObj, connector) {
  17964. return edgeObj.from !== (connector.beginItem ? connector.beginItem.dataKey : undefined) ||
  17965. edgeObj.to !== (connector.endItem ? connector.endItem.dataKey : undefined);
  17966. };
  17967. DocumentDataSource.prototype.updateEdgeObject = function (edgeObj, connector) {
  17968. var fromObj = this.findNode(connector.beginItem && connector.beginItem.dataKey);
  17969. edgeObj.from = fromObj && fromObj.key;
  17970. if (edgeObj.dataObj)
  17971. this.edgeDataImporter.setFrom(edgeObj.dataObj, fromObj && fromObj.dataObj && this.nodeDataImporter.getKey(fromObj.dataObj));
  17972. var toObj = this.findNode(connector.endItem && connector.endItem.dataKey);
  17973. edgeObj.to = toObj && toObj.key;
  17974. if (edgeObj.dataObj)
  17975. this.edgeDataImporter.setTo(edgeObj.dataObj, toObj && toObj.dataObj && this.nodeDataImporter.getKey(toObj.dataObj));
  17976. };
  17977. DocumentDataSource.prototype.updateEdgeObjectKey = function (edgeObj, dataObj, connector) {
  17978. var key = dataObj && this.edgeDataImporter.getKey(dataObj);
  17979. if (key !== undefined && key !== null && key !== edgeObj.key) {
  17980. edgeObj.key = key.toString();
  17981. delete this.edgeKeyMap[edgeObj.key];
  17982. this.edgeKeyMap[key] = edgeObj.key;
  17983. }
  17984. connector.dataKey = edgeObj.key;
  17985. edgeObj.dataObj = dataObj;
  17986. };
  17987. DocumentDataSource.prototype.deleteNodes = function (model, changesListener) {
  17988. var _this = this;
  17989. this.deleteItems(this.nodes, function (key) { return model.findShapeByDataKey(key); }, function (item) { return _this.getNodeParentArray(item); }, function (item, dataModified) {
  17990. var key = (item.dataObj && _this.nodeDataImporter.getKey(item.dataObj)) || item.key;
  17991. var dataKey = _this.nodeKeyMap[key];
  17992. if (dataKey)
  17993. delete _this.nodeKeyMap[key];
  17994. var nodeObj = _this.findNode(dataKey);
  17995. if (nodeObj)
  17996. _this.nodes.splice(_this.nodes.indexOf(nodeObj), 1);
  17997. if (dataModified)
  17998. changesListener.NotifyNodeRemoved.call(changesListener, key, function (key) { });
  17999. });
  18000. };
  18001. DocumentDataSource.prototype.deleteEdges = function (model, changesListener) {
  18002. var _this = this;
  18003. this.deleteItems(this.edges, function (key) { return model.findConnectorByDataKey(key); }, function (item) { return _this.edgeDataSource; }, function (item, dataModified) {
  18004. var key = (item.dataObj && _this.edgeDataImporter.getKey(item.dataObj)) || item.key;
  18005. var dataKey = _this.edgeKeyMap[key];
  18006. if (dataKey)
  18007. delete _this.edgeKeyMap[key];
  18008. var edgeObj = _this.findEdge(dataKey);
  18009. if (edgeObj)
  18010. _this.edges.splice(_this.edges.indexOf(edgeObj), 1);
  18011. if (dataModified)
  18012. changesListener.NotifyEdgeRemoved.call(changesListener, key, function (key) { });
  18013. });
  18014. };
  18015. DocumentDataSource.prototype.deleteItems = function (dataSourceItems, findItem, getParentArray, callback) {
  18016. var items = dataSourceItems.slice();
  18017. items.forEach(function (item) {
  18018. if (item.key && !findItem(item.key)) {
  18019. var parentArray = getParentArray(item);
  18020. var index = parentArray.indexOf(item.dataObj);
  18021. parentArray.splice(index, 1);
  18022. callback(item, index > -1);
  18023. }
  18024. });
  18025. };
  18026. DocumentDataSource.prototype.getParentShapeKey = function (shape) {
  18027. var parentKey;
  18028. for (var i = 0; i < shape.attachedConnectors.length; i++) {
  18029. if (shape.attachedConnectors[i].endItem === shape) {
  18030. var parentShape = shape.attachedConnectors[i].beginItem;
  18031. parentKey = parentShape && parentShape.dataKey;
  18032. break;
  18033. }
  18034. }
  18035. return parentKey;
  18036. };
  18037. DocumentDataSource.prototype.getNodeParentArray = function (item) {
  18038. var items;
  18039. if (this.useNodeItems && item.parentDataObj)
  18040. items = this.nodeDataImporter.getItems(item.parentDataObj);
  18041. return items || this.nodeDataSource;
  18042. };
  18043. return DocumentDataSource;
  18044. }(DataSource_1.DataSource));
  18045. exports.DocumentDataSource = DocumentDataSource;
  18046. /***/ }),
  18047. /* 201 */
  18048. /***/ (function(module, exports, __webpack_require__) {
  18049. "use strict";
  18050. var __extends = (this && this.__extends) || (function () {
  18051. var extendStatics = function (d, b) {
  18052. extendStatics = Object.setPrototypeOf ||
  18053. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18054. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18055. return extendStatics(d, b);
  18056. };
  18057. return function (d, b) {
  18058. extendStatics(d, b);
  18059. function __() { this.constructor = d; }
  18060. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18061. };
  18062. })();
  18063. Object.defineProperty(exports, "__esModule", { value: true });
  18064. var CommandStates_1 = __webpack_require__(6);
  18065. var ModelUtils_1 = __webpack_require__(8);
  18066. var CommandBase_1 = __webpack_require__(7);
  18067. var UnbindDocumentCommand = /** @class */ (function (_super) {
  18068. __extends(UnbindDocumentCommand, _super);
  18069. function UnbindDocumentCommand() {
  18070. return _super !== null && _super.apply(this, arguments) || this;
  18071. }
  18072. UnbindDocumentCommand.prototype.getState = function () {
  18073. return new CommandStates_1.SimpleCommandState(true);
  18074. };
  18075. UnbindDocumentCommand.prototype.executeCore = function (state) {
  18076. this.control.unregisterDocumentDataSource();
  18077. ModelUtils_1.ModelUtils.deleteAllItems(this.control.history, this.control.model, this.control.selection);
  18078. this.control.history.clear();
  18079. if (this.control.renderManager)
  18080. this.control.renderManager.onWindowResize(null);
  18081. return true;
  18082. };
  18083. return UnbindDocumentCommand;
  18084. }(CommandBase_1.CommandBase));
  18085. exports.UnbindDocumentCommand = UnbindDocumentCommand;
  18086. /***/ }),
  18087. /* 202 */
  18088. /***/ (function(module, exports, __webpack_require__) {
  18089. "use strict";
  18090. var __extends = (this && this.__extends) || (function () {
  18091. var extendStatics = function (d, b) {
  18092. extendStatics = Object.setPrototypeOf ||
  18093. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18094. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18095. return extendStatics(d, b);
  18096. };
  18097. return function (d, b) {
  18098. extendStatics(d, b);
  18099. function __() { this.constructor = d; }
  18100. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18101. };
  18102. })();
  18103. Object.defineProperty(exports, "__esModule", { value: true });
  18104. var AutoLayoutCommandBase_1 = __webpack_require__(43);
  18105. var WideTree_1 = __webpack_require__(61);
  18106. var LayoutSettings_1 = __webpack_require__(18);
  18107. var AutoLayoutTreeHorizontalCommand = /** @class */ (function (_super) {
  18108. __extends(AutoLayoutTreeHorizontalCommand, _super);
  18109. function AutoLayoutTreeHorizontalCommand() {
  18110. return _super !== null && _super.apply(this, arguments) || this;
  18111. }
  18112. AutoLayoutTreeHorizontalCommand.prototype.createLayout = function (graph) {
  18113. var settings = this.createLayoutSettings();
  18114. settings.orientation = LayoutSettings_1.OrientationKind.Horizontal;
  18115. return new WideTree_1.TreeLayoutBuilder(settings, graph).build();
  18116. };
  18117. return AutoLayoutTreeHorizontalCommand;
  18118. }(AutoLayoutCommandBase_1.AutoLayoutCommandBase));
  18119. exports.AutoLayoutTreeHorizontalCommand = AutoLayoutTreeHorizontalCommand;
  18120. /***/ }),
  18121. /* 203 */
  18122. /***/ (function(module, exports, __webpack_require__) {
  18123. "use strict";
  18124. var __extends = (this && this.__extends) || (function () {
  18125. var extendStatics = function (d, b) {
  18126. extendStatics = Object.setPrototypeOf ||
  18127. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18128. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18129. return extendStatics(d, b);
  18130. };
  18131. return function (d, b) {
  18132. extendStatics(d, b);
  18133. function __() { this.constructor = d; }
  18134. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18135. };
  18136. })();
  18137. Object.defineProperty(exports, "__esModule", { value: true });
  18138. var AutoLayoutCommandBase_1 = __webpack_require__(43);
  18139. var Sugiyama_1 = __webpack_require__(40);
  18140. var LayoutSettings_1 = __webpack_require__(18);
  18141. var AutoLayoutLayeredVerticalCommand = /** @class */ (function (_super) {
  18142. __extends(AutoLayoutLayeredVerticalCommand, _super);
  18143. function AutoLayoutLayeredVerticalCommand() {
  18144. return _super !== null && _super.apply(this, arguments) || this;
  18145. }
  18146. AutoLayoutLayeredVerticalCommand.prototype.createLayout = function (graph) {
  18147. var settings = this.createLayoutSettings();
  18148. settings.orientation = LayoutSettings_1.OrientationKind.Vertical;
  18149. return new Sugiyama_1.SugiyamaLayoutBuilder(settings, graph).build();
  18150. };
  18151. return AutoLayoutLayeredVerticalCommand;
  18152. }(AutoLayoutCommandBase_1.AutoLayoutCommandBase));
  18153. exports.AutoLayoutLayeredVerticalCommand = AutoLayoutLayeredVerticalCommand;
  18154. /***/ }),
  18155. /* 204 */
  18156. /***/ (function(module, exports, __webpack_require__) {
  18157. "use strict";
  18158. var __extends = (this && this.__extends) || (function () {
  18159. var extendStatics = function (d, b) {
  18160. extendStatics = Object.setPrototypeOf ||
  18161. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18162. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18163. return extendStatics(d, b);
  18164. };
  18165. return function (d, b) {
  18166. extendStatics(d, b);
  18167. function __() { this.constructor = d; }
  18168. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18169. };
  18170. })();
  18171. Object.defineProperty(exports, "__esModule", { value: true });
  18172. var CommandStates_1 = __webpack_require__(6);
  18173. var CommandBase_1 = __webpack_require__(7);
  18174. var CloseDataSourceCommand = /** @class */ (function (_super) {
  18175. __extends(CloseDataSourceCommand, _super);
  18176. function CloseDataSourceCommand() {
  18177. return _super !== null && _super.apply(this, arguments) || this;
  18178. }
  18179. CloseDataSourceCommand.prototype.getState = function () {
  18180. return new CommandStates_1.SimpleCommandState(true);
  18181. };
  18182. CloseDataSourceCommand.prototype.executeCore = function (state, parameter) {
  18183. this.control.unregisterDataSource(parameter);
  18184. return true;
  18185. };
  18186. return CloseDataSourceCommand;
  18187. }(CommandBase_1.CommandBase));
  18188. exports.CloseDataSourceCommand = CloseDataSourceCommand;
  18189. /***/ }),
  18190. /* 205 */
  18191. /***/ (function(module, exports, __webpack_require__) {
  18192. "use strict";
  18193. var __extends = (this && this.__extends) || (function () {
  18194. var extendStatics = function (d, b) {
  18195. extendStatics = Object.setPrototypeOf ||
  18196. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18197. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18198. return extendStatics(d, b);
  18199. };
  18200. return function (d, b) {
  18201. extendStatics(d, b);
  18202. function __() { this.constructor = d; }
  18203. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18204. };
  18205. })();
  18206. Object.defineProperty(exports, "__esModule", { value: true });
  18207. var ChangeLockedCommand_1 = __webpack_require__(94);
  18208. var LockCommand = /** @class */ (function (_super) {
  18209. __extends(LockCommand, _super);
  18210. function LockCommand() {
  18211. return _super !== null && _super.apply(this, arguments) || this;
  18212. }
  18213. LockCommand.prototype.getLockState = function () {
  18214. return true;
  18215. };
  18216. return LockCommand;
  18217. }(ChangeLockedCommand_1.ChangeLockedCommand));
  18218. exports.LockCommand = LockCommand;
  18219. /***/ }),
  18220. /* 206 */
  18221. /***/ (function(module, exports, __webpack_require__) {
  18222. "use strict";
  18223. var __extends = (this && this.__extends) || (function () {
  18224. var extendStatics = function (d, b) {
  18225. extendStatics = Object.setPrototypeOf ||
  18226. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18227. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18228. return extendStatics(d, b);
  18229. };
  18230. return function (d, b) {
  18231. extendStatics(d, b);
  18232. function __() { this.constructor = d; }
  18233. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18234. };
  18235. })();
  18236. Object.defineProperty(exports, "__esModule", { value: true });
  18237. var HistoryItem_1 = __webpack_require__(4);
  18238. var ChangeLockedHistoryItem = /** @class */ (function (_super) {
  18239. __extends(ChangeLockedHistoryItem, _super);
  18240. function ChangeLockedHistoryItem(item, locked) {
  18241. var _this = _super.call(this) || this;
  18242. _this.itemKey = item.key;
  18243. _this.locked = locked;
  18244. return _this;
  18245. }
  18246. ChangeLockedHistoryItem.prototype.redo = function (manipulator) {
  18247. var item = manipulator.model.findItem(this.itemKey);
  18248. this.oldLocked = item.locked;
  18249. manipulator.changeLocked(item, this.locked);
  18250. };
  18251. ChangeLockedHistoryItem.prototype.undo = function (manipulator) {
  18252. var item = manipulator.model.findItem(this.itemKey);
  18253. manipulator.changeLocked(item, this.oldLocked);
  18254. };
  18255. return ChangeLockedHistoryItem;
  18256. }(HistoryItem_1.HistoryItem));
  18257. exports.ChangeLockedHistoryItem = ChangeLockedHistoryItem;
  18258. /***/ }),
  18259. /* 207 */
  18260. /***/ (function(module, exports, __webpack_require__) {
  18261. "use strict";
  18262. var __extends = (this && this.__extends) || (function () {
  18263. var extendStatics = function (d, b) {
  18264. extendStatics = Object.setPrototypeOf ||
  18265. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18266. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18267. return extendStatics(d, b);
  18268. };
  18269. return function (d, b) {
  18270. extendStatics(d, b);
  18271. function __() { this.constructor = d; }
  18272. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18273. };
  18274. })();
  18275. Object.defineProperty(exports, "__esModule", { value: true });
  18276. var ChangeLockedCommand_1 = __webpack_require__(94);
  18277. var UnLockCommand = /** @class */ (function (_super) {
  18278. __extends(UnLockCommand, _super);
  18279. function UnLockCommand() {
  18280. return _super !== null && _super.apply(this, arguments) || this;
  18281. }
  18282. UnLockCommand.prototype.getLockState = function () {
  18283. return false;
  18284. };
  18285. return UnLockCommand;
  18286. }(ChangeLockedCommand_1.ChangeLockedCommand));
  18287. exports.UnLockCommand = UnLockCommand;
  18288. /***/ }),
  18289. /* 208 */
  18290. /***/ (function(module, exports, __webpack_require__) {
  18291. "use strict";
  18292. var __extends = (this && this.__extends) || (function () {
  18293. var extendStatics = function (d, b) {
  18294. extendStatics = Object.setPrototypeOf ||
  18295. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18296. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18297. return extendStatics(d, b);
  18298. };
  18299. return function (d, b) {
  18300. extendStatics(d, b);
  18301. function __() { this.constructor = d; }
  18302. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18303. };
  18304. })();
  18305. Object.defineProperty(exports, "__esModule", { value: true });
  18306. var CommandBase_1 = __webpack_require__(7);
  18307. var CommandStates_1 = __webpack_require__(6);
  18308. var Model_1 = __webpack_require__(21);
  18309. var ModelUtils_1 = __webpack_require__(8);
  18310. var CloneCommand = /** @class */ (function (_super) {
  18311. __extends(CloneCommand, _super);
  18312. function CloneCommand() {
  18313. return _super !== null && _super.apply(this, arguments) || this;
  18314. }
  18315. CloneCommand.prototype.getState = function () {
  18316. return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty());
  18317. };
  18318. CloneCommand.prototype.executeCore = function (state, parameter) {
  18319. var selectionRect = Model_1.DiagramModel.getRectangle(this.control.selection.getSelectedItems());
  18320. ModelUtils_1.ModelUtils.cloneSelectionToOffset(this.control.history, this.control.model, this.control.selection, this.getOffsetX(selectionRect), this.getOffsetY(selectionRect));
  18321. return true;
  18322. };
  18323. CloneCommand.prototype.getOffsetX = function (selectionRect) {
  18324. return 0;
  18325. };
  18326. ;
  18327. CloneCommand.prototype.getOffsetY = function (selectionRect) {
  18328. return 0;
  18329. };
  18330. ;
  18331. return CloneCommand;
  18332. }(CommandBase_1.CommandBase));
  18333. exports.CloneCommand = CloneCommand;
  18334. var CloneLeftCommand = /** @class */ (function (_super) {
  18335. __extends(CloneLeftCommand, _super);
  18336. function CloneLeftCommand() {
  18337. return _super !== null && _super.apply(this, arguments) || this;
  18338. }
  18339. CloneLeftCommand.prototype.getOffsetX = function (selectionRect) {
  18340. return -selectionRect.width;
  18341. };
  18342. ;
  18343. return CloneLeftCommand;
  18344. }(CloneCommand));
  18345. exports.CloneLeftCommand = CloneLeftCommand;
  18346. var CloneRightCommand = /** @class */ (function (_super) {
  18347. __extends(CloneRightCommand, _super);
  18348. function CloneRightCommand() {
  18349. return _super !== null && _super.apply(this, arguments) || this;
  18350. }
  18351. CloneRightCommand.prototype.getOffsetX = function (selectionRect) {
  18352. return selectionRect.width;
  18353. };
  18354. ;
  18355. return CloneRightCommand;
  18356. }(CloneCommand));
  18357. exports.CloneRightCommand = CloneRightCommand;
  18358. var CloneUpCommand = /** @class */ (function (_super) {
  18359. __extends(CloneUpCommand, _super);
  18360. function CloneUpCommand() {
  18361. return _super !== null && _super.apply(this, arguments) || this;
  18362. }
  18363. CloneUpCommand.prototype.getOffsetY = function (selectionRect) {
  18364. return -selectionRect.height;
  18365. };
  18366. ;
  18367. return CloneUpCommand;
  18368. }(CloneCommand));
  18369. exports.CloneUpCommand = CloneUpCommand;
  18370. var CloneDownCommand = /** @class */ (function (_super) {
  18371. __extends(CloneDownCommand, _super);
  18372. function CloneDownCommand() {
  18373. return _super !== null && _super.apply(this, arguments) || this;
  18374. }
  18375. CloneDownCommand.prototype.getOffsetY = function (selectionRect) {
  18376. return selectionRect.height;
  18377. };
  18378. ;
  18379. return CloneDownCommand;
  18380. }(CloneCommand));
  18381. exports.CloneDownCommand = CloneDownCommand;
  18382. /***/ }),
  18383. /* 209 */
  18384. /***/ (function(module, exports, __webpack_require__) {
  18385. "use strict";
  18386. var __extends = (this && this.__extends) || (function () {
  18387. var extendStatics = function (d, b) {
  18388. extendStatics = Object.setPrototypeOf ||
  18389. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18390. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18391. return extendStatics(d, b);
  18392. };
  18393. return function (d, b) {
  18394. extendStatics(d, b);
  18395. function __() { this.constructor = d; }
  18396. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18397. };
  18398. })();
  18399. Object.defineProperty(exports, "__esModule", { value: true });
  18400. var ChangePagePropertyCommand_1 = __webpack_require__(23);
  18401. var Model_1 = __webpack_require__(21);
  18402. var ChangeUnitsCommand = /** @class */ (function (_super) {
  18403. __extends(ChangeUnitsCommand, _super);
  18404. function ChangeUnitsCommand() {
  18405. return _super !== null && _super.apply(this, arguments) || this;
  18406. }
  18407. ChangeUnitsCommand.prototype.getPropertyName = function () {
  18408. return "units";
  18409. };
  18410. ChangeUnitsCommand.prototype.getPropertyOptions = function () {
  18411. return [
  18412. { value: Model_1.DiagramUnit.In, text: "in" },
  18413. { value: Model_1.DiagramUnit.Cm, text: "cm" },
  18414. { value: Model_1.DiagramUnit.Px, text: "px" }
  18415. ];
  18416. };
  18417. return ChangeUnitsCommand;
  18418. }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
  18419. exports.ChangeUnitsCommand = ChangeUnitsCommand;
  18420. /***/ }),
  18421. /* 210 */
  18422. /***/ (function(module, exports, __webpack_require__) {
  18423. "use strict";
  18424. var __extends = (this && this.__extends) || (function () {
  18425. var extendStatics = function (d, b) {
  18426. extendStatics = Object.setPrototypeOf ||
  18427. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18428. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18429. return extendStatics(d, b);
  18430. };
  18431. return function (d, b) {
  18432. extendStatics(d, b);
  18433. function __() { this.constructor = d; }
  18434. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18435. };
  18436. })();
  18437. Object.defineProperty(exports, "__esModule", { value: true });
  18438. var ChangePagePropertyCommand_1 = __webpack_require__(23);
  18439. var ChangePageColorCommand = /** @class */ (function (_super) {
  18440. __extends(ChangePageColorCommand, _super);
  18441. function ChangePageColorCommand() {
  18442. return _super !== null && _super.apply(this, arguments) || this;
  18443. }
  18444. ChangePageColorCommand.prototype.getPropertyName = function () {
  18445. return "pageColor";
  18446. };
  18447. return ChangePageColorCommand;
  18448. }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
  18449. exports.ChangePageColorCommand = ChangePageColorCommand;
  18450. /***/ }),
  18451. /* 211 */
  18452. /***/ (function(module, exports, __webpack_require__) {
  18453. "use strict";
  18454. var __extends = (this && this.__extends) || (function () {
  18455. var extendStatics = function (d, b) {
  18456. extendStatics = Object.setPrototypeOf ||
  18457. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18458. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18459. return extendStatics(d, b);
  18460. };
  18461. return function (d, b) {
  18462. extendStatics(d, b);
  18463. function __() { this.constructor = d; }
  18464. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18465. };
  18466. })();
  18467. Object.defineProperty(exports, "__esModule", { value: true });
  18468. var ChangePagePropertyCommand_1 = __webpack_require__(23);
  18469. var ChangeShowGridCommand = /** @class */ (function (_super) {
  18470. __extends(ChangeShowGridCommand, _super);
  18471. function ChangeShowGridCommand() {
  18472. return _super !== null && _super.apply(this, arguments) || this;
  18473. }
  18474. ChangeShowGridCommand.prototype.getPropertyName = function () {
  18475. return "showGrid";
  18476. };
  18477. return ChangeShowGridCommand;
  18478. }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
  18479. exports.ChangeShowGridCommand = ChangeShowGridCommand;
  18480. /***/ }),
  18481. /* 212 */
  18482. /***/ (function(module, exports, __webpack_require__) {
  18483. "use strict";
  18484. var __extends = (this && this.__extends) || (function () {
  18485. var extendStatics = function (d, b) {
  18486. extendStatics = Object.setPrototypeOf ||
  18487. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  18488. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18489. return extendStatics(d, b);
  18490. };
  18491. return function (d, b) {
  18492. extendStatics(d, b);
  18493. function __() { this.constructor = d; }
  18494. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18495. };
  18496. })();
  18497. Object.defineProperty(exports, "__esModule", { value: true });
  18498. var CommandBase_1 = __webpack_require__(7);
  18499. var CommandStates_1 = __webpack_require__(6);
  18500. var ToggleFullscreenCommand = /** @class */ (function (_super) {
  18501. __extends(ToggleFullscreenCommand, _super);
  18502. function ToggleFullscreenCommand() {
  18503. return _super !== null && _super.apply(this, arguments) || this;
  18504. }
  18505. ToggleFullscreenCommand.prototype.getState = function () {
  18506. return new CommandStates_1.SimpleCommandState(true, this.control.settings.fullscreen);
  18507. };
  18508. ToggleFullscreenCommand.prototype.executeCore = function (state, parameter) {
  18509. this.control.settings.fullscreen = !this.control.settings.fullscreen;
  18510. this.control.NotifyToggleFullscreen(this.control.settings.fullscreen);
  18511. return true;
  18512. };
  18513. return ToggleFullscreenCommand;
  18514. }(CommandBase_1.CommandBase));
  18515. exports.ToggleFullscreenCommand = ToggleFullscreenCommand;
  18516. /***/ }),
  18517. /* 213 */
  18518. /***/ (function(module, exports, __webpack_require__) {
  18519. "use strict";
  18520. Object.defineProperty(exports, "__esModule", { value: true });
  18521. var ModelManipulator_1 = __webpack_require__(214);
  18522. var CanvasManager_1 = __webpack_require__(44);
  18523. var CommandManager_1 = __webpack_require__(68);
  18524. var EventManager_1 = __webpack_require__(215);
  18525. var SelectionController_1 = __webpack_require__(238);
  18526. var Model_1 = __webpack_require__(21);
  18527. var Selection_1 = __webpack_require__(239);
  18528. var History_1 = __webpack_require__(241);
  18529. var BarManager_1 = __webpack_require__(242);
  18530. var RenderManager_1 = __webpack_require__(10);
  18531. var ShapeToolbox_1 = __webpack_require__(244);
  18532. var DataToolbox_1 = __webpack_require__(245);
  18533. var ShapeDescriptionManager_1 = __webpack_require__(30);
  18534. var DiagramSettings_1 = __webpack_require__(246);
  18535. var DiagramControl = /** @class */ (function () {
  18536. function DiagramControl() {
  18537. this.dataSources = [];
  18538. this.settings = new DiagramSettings_1.DiagramSettings();
  18539. this.model = new Model_1.DiagramModel();
  18540. this.selection = new Selection_1.Selection(this.model);
  18541. this.modelManipulator = new ModelManipulator_1.ModelManipulator(this.model);
  18542. this.modelManipulator.initialize(this.model);
  18543. this.history = new History_1.History(this.modelManipulator);
  18544. this.commandManager = new CommandManager_1.CommandManager(this);
  18545. this.eventManager = new EventManager_1.EventManager(this);
  18546. this.barManager = new BarManager_1.BarManager(this);
  18547. this.selection.onChanged.add(this.barManager);
  18548. this.modelManipulator.onLoad();
  18549. this.history.onChanged.add(this);
  18550. }
  18551. DiagramControl.prototype.createDocument = function (parent) {
  18552. if (this.renderManager) {
  18553. if (this.renderManager.mainElement.parentNode !== parent)
  18554. parent.appendChild(this.renderManager.mainElement);
  18555. }
  18556. else {
  18557. this.renderManager = new RenderManager_1.RenderManager(parent, this.eventManager);
  18558. this.canvasManager = new CanvasManager_1.CanvasManager(this.renderManager.svgElement);
  18559. this.eventManager.onTextInputOperation.add(this.renderManager);
  18560. this.eventManager.onTextInputOperation.add(this.canvasManager);
  18561. this.eventManager.onMouseOperation.add(this.canvasManager);
  18562. this.eventManager.onVisualizersUpdate.add(this.canvasManager);
  18563. this.modelManipulator.onModelChanged.add(this.renderManager);
  18564. this.modelManipulator.onModelChanged.add(this.canvasManager);
  18565. var selectionController = new SelectionController_1.SelectionController(this.selection);
  18566. this.modelManipulator.onModelChanged.add(selectionController);
  18567. selectionController.onSelectionChanged.add(this.canvasManager);
  18568. this.modelManipulator.onLoad();
  18569. }
  18570. };
  18571. DiagramControl.prototype.createToolbox = function (parent, shapeIconSize, shapeIconSpacing, shapeIconAttributes, shapes) {
  18572. var toolbox = new ShapeToolbox_1.ShapeToolboxManager();
  18573. toolbox.initialize(parent, {
  18574. shapeIconSize: shapeIconSize,
  18575. shapeIconSpacing: shapeIconSpacing,
  18576. shapeIconAttributes: shapeIconAttributes,
  18577. shapes: shapes
  18578. });
  18579. toolbox.onDragOperation.add(this);
  18580. this.eventManager.registerToolbox(toolbox);
  18581. };
  18582. DiagramControl.prototype.createDataSourceToolbox = function (key, parent) {
  18583. if (key === undefined || key === null)
  18584. throw new Error("Data source toolbox key must be specified");
  18585. var dataSource = this.getDataSource(key);
  18586. if (!dataSource)
  18587. throw Error("Data source with the specified key cannot be found");
  18588. var toolbox = new DataToolbox_1.DataToolboxManager(key);
  18589. toolbox.initialize(parent, dataSource);
  18590. toolbox.onDragOperation.add(this);
  18591. this.eventManager.registerToolbox(toolbox);
  18592. };
  18593. DiagramControl.prototype.updateLayout = function () {
  18594. if (this.renderManager)
  18595. this.renderManager.updateLayout();
  18596. };
  18597. DiagramControl.prototype.captureFocus = function () {
  18598. if (this.renderManager)
  18599. this.renderManager.captureFocus();
  18600. };
  18601. DiagramControl.prototype.isFocused = function () {
  18602. if (this.renderManager)
  18603. return this.renderManager.isFocused();
  18604. return true;
  18605. };
  18606. DiagramControl.prototype.addCustomShapes = function (shapes) {
  18607. var _this = this;
  18608. shapes.forEach(function (shape) {
  18609. if (shape.defaultWidth)
  18610. shape.defaultWidth = _this.model.getTwipsUnit(shape.defaultWidth);
  18611. if (shape.defaultHeight)
  18612. shape.defaultHeight = _this.model.getTwipsUnit(shape.defaultHeight);
  18613. ShapeDescriptionManager_1.ShapeDescriptionManager.registerCustomShape(shape);
  18614. });
  18615. };
  18616. DiagramControl.prototype.removeCustomShapes = function (shapeIds) {
  18617. shapeIds.forEach(function (id) {
  18618. ShapeDescriptionManager_1.ShapeDescriptionManager.unregisterCustomShape(id);
  18619. });
  18620. };
  18621. DiagramControl.prototype.getUnitText = function (twipsValue, fractionDigits) {
  18622. if (fractionDigits === void 0) { fractionDigits = 2; }
  18623. return this.model.getModelUnitText(twipsValue, fractionDigits);
  18624. };
  18625. DiagramControl.prototype.importModel = function (model) {
  18626. this.model = model;
  18627. this.importData();
  18628. };
  18629. DiagramControl.prototype.importItemsData = function () {
  18630. this.model.invalidateItems();
  18631. this.importData();
  18632. };
  18633. DiagramControl.prototype.importData = function () {
  18634. if (this.canvasManager !== undefined)
  18635. this.canvasManager.clear();
  18636. this.selection.initialize(this.model);
  18637. this.modelManipulator.initialize(this.model);
  18638. this.history.clear();
  18639. this.eventManager.initialize();
  18640. this.modelManipulator.onLoad();
  18641. };
  18642. DiagramControl.prototype.registerDataSource = function (ds) {
  18643. var dataSource = this.getDataSource(ds.key);
  18644. if (dataSource)
  18645. throw Error("Data Source key is duplicated");
  18646. this.dataSources.push(ds);
  18647. };
  18648. DiagramControl.prototype.unregisterDataSource = function (key) {
  18649. var dataSource = this.getDataSource(key);
  18650. if (dataSource) {
  18651. this.dataSources.splice(this.dataSources.indexOf(dataSource), 1);
  18652. }
  18653. };
  18654. DiagramControl.prototype.getDataSource = function (key) {
  18655. return this.dataSources.filter(function (ds) { return ds.key === key; })[0];
  18656. };
  18657. DiagramControl.prototype.registerDocumentDataSource = function (ds) {
  18658. this.documentDataSource = ds;
  18659. };
  18660. DiagramControl.prototype.unregisterDocumentDataSource = function () {
  18661. delete this.documentDataSource;
  18662. };
  18663. DiagramControl.prototype.beginUpdate = function () {
  18664. this.barManager.beginUpdate();
  18665. };
  18666. DiagramControl.prototype.endUpdate = function () {
  18667. this.barManager.endUpdate();
  18668. };
  18669. DiagramControl.prototype.NotifyEdgeInserted = function (data, callback) {
  18670. if (this.onEdgeInserted)
  18671. this.onEdgeInserted(data, callback);
  18672. };
  18673. DiagramControl.prototype.NotifyEdgeUpdated = function (key, data, callback) {
  18674. if (this.onEdgeUpdated)
  18675. this.onEdgeUpdated(key, data, callback);
  18676. };
  18677. DiagramControl.prototype.NotifyEdgeRemoved = function (key, callback) {
  18678. if (this.onEdgeUpdated)
  18679. this.onEdgeRemoved(key, callback);
  18680. };
  18681. DiagramControl.prototype.NotifyNodeInserted = function (data, callback) {
  18682. if (this.onNodeInserted)
  18683. this.onNodeInserted(data, callback);
  18684. };
  18685. DiagramControl.prototype.NotifyNodeUpdated = function (key, data, callback) {
  18686. if (this.onNodeUpdated)
  18687. this.onNodeUpdated(key, data, callback);
  18688. };
  18689. DiagramControl.prototype.NotifyNodeRemoved = function (key, callback) {
  18690. if (this.onNodeRemoved)
  18691. this.onNodeRemoved(key, callback);
  18692. };
  18693. DiagramControl.prototype.NotifyHistoryChanged = function () {
  18694. if (this.documentDataSource)
  18695. this.documentDataSource.updateItems(this.model, this);
  18696. if (this.onChanged)
  18697. this.onChanged();
  18698. };
  18699. DiagramControl.prototype.NotifyToolboxDragStart = function () {
  18700. if (this.onToolboxDragStart)
  18701. this.onToolboxDragStart();
  18702. };
  18703. DiagramControl.prototype.NotifyToolboxDragEnd = function () {
  18704. if (this.onToolboxDragEnd)
  18705. this.onToolboxDragEnd();
  18706. };
  18707. DiagramControl.prototype.NotifyToggleFullscreen = function (value) {
  18708. if (this.onToggleFullscreen)
  18709. this.onToggleFullscreen(value);
  18710. };
  18711. return DiagramControl;
  18712. }());
  18713. exports.DiagramControl = DiagramControl;
  18714. /***/ }),
  18715. /* 214 */
  18716. /***/ (function(module, exports, __webpack_require__) {
  18717. "use strict";
  18718. Object.defineProperty(exports, "__esModule", { value: true });
  18719. var Shape_1 = __webpack_require__(9);
  18720. var ModelChange_1 = __webpack_require__(48);
  18721. var Utils_1 = __webpack_require__(0);
  18722. var Connector_1 = __webpack_require__(5);
  18723. var ModelManipulator = /** @class */ (function () {
  18724. function ModelManipulator(model) {
  18725. this.onModelChanged = new Utils_1.EventDispatcher();
  18726. this.model = model;
  18727. }
  18728. ModelManipulator.prototype.initialize = function (model) {
  18729. this.model = model;
  18730. };
  18731. ModelManipulator.prototype.onLoad = function () {
  18732. var _this = this;
  18733. var changes = [];
  18734. this.model.iterateItems(function (item) {
  18735. changes.push(_this.createItemChange(item, ModelChange_1.ItemChangeType.Create));
  18736. });
  18737. this.raiseModelChanged([new ModelChange_1.PageChange(this.model, ModelChange_1.PageChangeType.Create)]);
  18738. this.raiseModelChanged(changes);
  18739. };
  18740. // Items
  18741. ModelManipulator.prototype.changeStyle = function (item, styleProperty, styleValue) {
  18742. this.changeStyleCore(item, item.style, styleProperty, styleValue);
  18743. };
  18744. ModelManipulator.prototype.changeStyleText = function (item, styleProperty, styleValue) {
  18745. this.changeStyleCore(item, item.styleText, styleProperty, styleValue);
  18746. };
  18747. ModelManipulator.prototype.changeStyleCore = function (item, styleObj, styleProperty, styleValue) {
  18748. if (styleValue !== undefined)
  18749. styleObj[styleProperty] = styleValue;
  18750. else
  18751. delete styleObj[styleProperty];
  18752. item.invalidatePrimitives();
  18753. this.raiseModelChanged([this.createItemChange(item, ModelChange_1.ItemChangeType.Update)]);
  18754. };
  18755. ModelManipulator.prototype.changeZIndex = function (item, zIndex) {
  18756. item.zIndex = zIndex;
  18757. this.raiseModelChanged([this.createItemChange(item, ModelChange_1.ItemChangeType.UpdateZIndex)]);
  18758. };
  18759. ModelManipulator.prototype.changeLocked = function (item, locked) {
  18760. item.locked = locked;
  18761. this.raiseModelChanged([this.createItemChange(item, ModelChange_1.ItemChangeType.Update)]);
  18762. };
  18763. // Shapes
  18764. ModelManipulator.prototype.addShape = function (shape, key) {
  18765. if (shape.attachedConnectors.length)
  18766. throw Error("A creating shape should not contain existing connectors.");
  18767. shape.key = key !== undefined ? key : this.model.getNextKey();
  18768. return this.insertShape(shape);
  18769. };
  18770. ModelManipulator.prototype.insertShape = function (shape) {
  18771. this.model.pushItem(shape);
  18772. this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.Create)]);
  18773. return shape;
  18774. };
  18775. ModelManipulator.prototype.resizeShape = function (shape, position, size) {
  18776. shape.position = position;
  18777. shape.size = size;
  18778. shape.invalidatePrimitives();
  18779. this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.Update)]);
  18780. };
  18781. ModelManipulator.prototype.moveShape = function (shape, position) {
  18782. shape.position = position;
  18783. shape.invalidatePrimitives();
  18784. this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.Update)]);
  18785. };
  18786. ModelManipulator.prototype.changeShapeParameters = function (shape, parameters) {
  18787. shape.parameters.forEach(function (p) {
  18788. var parameter = parameters.get(p.key);
  18789. if (parameter)
  18790. p.value = parameter.value;
  18791. });
  18792. shape.invalidatePrimitives();
  18793. this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.Update)]);
  18794. };
  18795. ModelManipulator.prototype.changeShapeText = function (shape, text) {
  18796. shape.text = text;
  18797. shape.invalidatePrimitives();
  18798. this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.UpdateStructure)]);
  18799. };
  18800. ModelManipulator.prototype.deleteShape = function (shape) {
  18801. if (shape.attachedConnectors.length)
  18802. throw Error("A removing shape should not contain existing connectors.");
  18803. this.removeShape(shape);
  18804. };
  18805. ModelManipulator.prototype.removeShape = function (shape) {
  18806. this.model.removeItem(shape);
  18807. this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.Remove)]);
  18808. };
  18809. // Connectors
  18810. ModelManipulator.prototype.addConnector = function (connector, key) {
  18811. if (connector.beginItem || connector.endItem)
  18812. throw Error("Creating connector should not contain begin/end items");
  18813. connector.key = key !== undefined ? key : this.model.getNextKey();
  18814. ;
  18815. return this.insertConnector(connector);
  18816. };
  18817. ModelManipulator.prototype.insertConnector = function (connector) {
  18818. this.model.pushItem(connector);
  18819. this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.Create)]);
  18820. return connector;
  18821. };
  18822. ModelManipulator.prototype.deleteConnector = function (connector) {
  18823. if (connector.beginItem || connector.endItem)
  18824. throw Error("Creating connector should not contain begin/end items");
  18825. this.removeConnector(connector);
  18826. };
  18827. ModelManipulator.prototype.removeConnector = function (connector) {
  18828. this.model.removeItem(connector);
  18829. this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.Remove)]);
  18830. };
  18831. ModelManipulator.prototype.moveConnectorPoint = function (connector, pointIndex, point) {
  18832. connector.points[pointIndex] = point;
  18833. connector.invalidateRenderPoints();
  18834. connector.invalidatePrimitives();
  18835. this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
  18836. };
  18837. ModelManipulator.prototype.addConnectorPoint = function (connector, pointIndex, point) {
  18838. connector.points.splice(pointIndex, 0, point);
  18839. connector.invalidateRenderPoints();
  18840. connector.invalidatePrimitives();
  18841. this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
  18842. };
  18843. ModelManipulator.prototype.deleteConnectorPoint = function (connector, pointIndex) {
  18844. connector.points.splice(pointIndex, 1);
  18845. connector.invalidateRenderPoints();
  18846. connector.invalidatePrimitives();
  18847. this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
  18848. };
  18849. ModelManipulator.prototype.addConnection = function (connector, item, connectionPointIndex, position) {
  18850. var existingItem = connector.getExtremeItem(position);
  18851. if (existingItem === item)
  18852. return;
  18853. else if (existingItem)
  18854. throw Error("Connector is already connected");
  18855. item.attachedConnectors.push(connector);
  18856. if (position === Connector_1.ConnectorPosition.Begin) {
  18857. connector.beginItem = item;
  18858. connector.beginConnectionPointIndex = connectionPointIndex;
  18859. }
  18860. else {
  18861. connector.endItem = item;
  18862. connector.endConnectionPointIndex = connectionPointIndex;
  18863. }
  18864. this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.Update)]);
  18865. };
  18866. ModelManipulator.prototype.setConnectionPointIndex = function (connector, connectionPointIndex, position) {
  18867. if (!connector.getExtremeItem(position))
  18868. throw Error("Connection should be connected");
  18869. if (position === Connector_1.ConnectorPosition.Begin)
  18870. connector.beginConnectionPointIndex = connectionPointIndex;
  18871. else
  18872. connector.endConnectionPointIndex = connectionPointIndex;
  18873. this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.Update)]);
  18874. };
  18875. ModelManipulator.prototype.deleteConnection = function (connector, position) {
  18876. var item = connector.getExtremeItem(position);
  18877. if (!item)
  18878. return;
  18879. item.attachedConnectors.splice(item.attachedConnectors.indexOf(connector), 1);
  18880. if (position === Connector_1.ConnectorPosition.Begin) {
  18881. connector.beginItem = null;
  18882. connector.beginConnectionPointIndex = -1;
  18883. }
  18884. else {
  18885. connector.endItem = null;
  18886. connector.endConnectionPointIndex = -1;
  18887. }
  18888. this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.Update)]);
  18889. };
  18890. ModelManipulator.prototype.changeConnectorProperty = function (connector, propertyName, value) {
  18891. connector.properties[propertyName] = value;
  18892. connector.invalidateRenderPoints();
  18893. connector.invalidatePrimitives();
  18894. this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
  18895. };
  18896. ModelManipulator.prototype.changeConnectorText = function (connector, position, text) {
  18897. connector.setText(position, text);
  18898. connector.invalidatePrimitives();
  18899. this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
  18900. };
  18901. ModelManipulator.prototype.changeConnectorTextPosition = function (connector, position, newPosition) {
  18902. var text = connector.getText(position);
  18903. connector.setText(position, null);
  18904. connector.setText(newPosition, text);
  18905. connector.invalidatePrimitives();
  18906. this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
  18907. };
  18908. // Model
  18909. ModelManipulator.prototype.changeModelSize = function (size, offset) {
  18910. this.model.size.width = size.width;
  18911. this.model.size.height = size.height;
  18912. this.raiseModelChanged([new ModelChange_1.PageChange(this.model, ModelChange_1.PageChangeType.Update, offset)]);
  18913. };
  18914. ModelManipulator.prototype.changePageSize = function (value) {
  18915. this.model.pageSize = value;
  18916. this.model.size = new Utils_1.Size(this.model.pageWidth, this.model.pageHeight);
  18917. this.raiseModelChanged([new ModelChange_1.PageChange(this.model, ModelChange_1.PageChangeType.Update)]);
  18918. };
  18919. ModelManipulator.prototype.changePageLandscape = function (value) {
  18920. this.model.pageLandscape = value;
  18921. this.model.size = new Utils_1.Size(this.model.pageWidth, this.model.pageHeight);
  18922. this.raiseModelChanged([new ModelChange_1.PageChange(this.model, ModelChange_1.PageChangeType.Update)]);
  18923. };
  18924. ModelManipulator.prototype.changePageProperty = function (propertyName, value) {
  18925. this.model[propertyName] = value;
  18926. this.raiseModelChanged([new ModelChange_1.PageChange(this.model, ModelChange_1.PageChangeType.Update)]);
  18927. };
  18928. ModelManipulator.prototype.createItemChange = function (item, changeType) {
  18929. if (item instanceof Shape_1.Shape)
  18930. return new ModelChange_1.ShapeChange(item, changeType);
  18931. if (item instanceof Connector_1.Connector)
  18932. return new ModelChange_1.ConnectorChange(item, changeType);
  18933. };
  18934. ModelManipulator.prototype.raiseModelChanged = function (changes) {
  18935. this.onModelChanged.raise("NotifyModelChanged", changes);
  18936. };
  18937. return ModelManipulator;
  18938. }());
  18939. exports.ModelManipulator = ModelManipulator;
  18940. /***/ }),
  18941. /* 215 */
  18942. /***/ (function(module, exports, __webpack_require__) {
  18943. "use strict";
  18944. Object.defineProperty(exports, "__esModule", { value: true });
  18945. var MouseHandler_1 = __webpack_require__(216);
  18946. var Utils_1 = __webpack_require__(0);
  18947. var TextInputHandler_1 = __webpack_require__(236);
  18948. var EventManager = /** @class */ (function () {
  18949. function EventManager(control) {
  18950. this.onMouseOperation = new Utils_1.EventDispatcher();
  18951. this.onTextInputOperation = new Utils_1.EventDispatcher();
  18952. this.toolboxes = [];
  18953. this.control = control;
  18954. this.mouseHandler = new MouseHandler_1.MouseHandler(control.history, control.selection, control.model, this);
  18955. this.textInputHandler = new TextInputHandler_1.TextInputHandler(control);
  18956. }
  18957. Object.defineProperty(EventManager.prototype, "onVisualizersUpdate", {
  18958. get: function () {
  18959. return this.mouseHandler.onVisualizersUpdate;
  18960. },
  18961. enumerable: true,
  18962. configurable: true
  18963. });
  18964. EventManager.prototype.registerToolbox = function (toolbox) {
  18965. this.toolboxes.push(toolbox);
  18966. };
  18967. EventManager.prototype.initialize = function () {
  18968. this.mouseHandler.initialize(this.control.model);
  18969. };
  18970. EventManager.prototype.onMouseDown = function (evt) {
  18971. this.mouseHandler.onMouseDown(evt);
  18972. };
  18973. EventManager.prototype.onMouseMove = function (evt) {
  18974. var draggingEvt = this.getDraggingEvent();
  18975. if (draggingEvt && !this.draggingEvent) {
  18976. this.draggingEvent = draggingEvt;
  18977. this.mouseHandler.onDragStart(this.draggingEvent);
  18978. this.control.captureFocus();
  18979. }
  18980. else if (!draggingEvt && this.draggingEvent) {
  18981. delete this.draggingEvent;
  18982. this.mouseHandler.onDragEnd(evt);
  18983. }
  18984. this.mouseHandler.onMouseMove(evt);
  18985. };
  18986. EventManager.prototype.onMouseUp = function (evt) {
  18987. this.mouseHandler.onMouseUp(evt);
  18988. };
  18989. EventManager.prototype.onMouseEnter = function (evt) {
  18990. this.mouseHandler.onMouseEnter(evt);
  18991. };
  18992. EventManager.prototype.onMouseLeave = function (evt) {
  18993. this.mouseHandler.onMouseLeave(evt);
  18994. };
  18995. EventManager.prototype.onDblClick = function (evt) {
  18996. this.mouseHandler.onMouseDoubleClick(evt);
  18997. this.textInputHandler.onMouseDoubleClick(evt);
  18998. };
  18999. EventManager.prototype.onKeyDown = function (evt) {
  19000. if (this.textInputHandler.isTextInputActive())
  19001. this.textInputHandler.onKeyDown(evt);
  19002. else {
  19003. var scCode = evt.getShortcutCode();
  19004. if (this.onShortcut(scCode)) {
  19005. this.mouseHandler.updateConnectionPoints();
  19006. this.mouseHandler.updateConnectionMarks();
  19007. evt.preventDefault = true;
  19008. }
  19009. }
  19010. };
  19011. EventManager.prototype.onInputBlur = function (evt) {
  19012. this.textInputHandler.onInputBlur(evt);
  19013. };
  19014. EventManager.prototype.onInputFocus = function (evt) {
  19015. this.textInputHandler.onInputFocus(evt);
  19016. };
  19017. EventManager.prototype.onShortcut = function (code) {
  19018. if (this.control.commandManager.processShortcut(code))
  19019. return true;
  19020. if (this.mouseHandler.onShortcut(code))
  19021. return true;
  19022. };
  19023. EventManager.prototype.onPaste = function (evt) {
  19024. if (!this.textInputHandler.isTextInputActive() && this.control.commandManager.processPaste(evt.clipboardData)) {
  19025. this.mouseHandler.updateConnectionPoints();
  19026. this.mouseHandler.updateConnectionMarks();
  19027. evt.preventDefault = true;
  19028. }
  19029. };
  19030. EventManager.prototype.isFocused = function () {
  19031. return this.control.isFocused();
  19032. };
  19033. EventManager.prototype.getDraggingEvent = function () {
  19034. return this.toolboxes
  19035. .filter(function (t) { return t.draggingObject; })
  19036. .map(function (t) { return t.draggingObject.evt; })[0];
  19037. };
  19038. EventManager.prototype.onDocumentDragEnd = function (itemKeys) {
  19039. this.onMouseOperation.raise("NotifyDragEnd", itemKeys);
  19040. this.control.endUpdate();
  19041. };
  19042. EventManager.prototype.onDocumentDragStart = function (itemKeys) {
  19043. this.control.beginUpdate();
  19044. this.control.captureFocus();
  19045. this.onMouseOperation.raise("NotifyDragStart", itemKeys);
  19046. };
  19047. EventManager.prototype.raiseTextInputStart = function (item, text, position, size) {
  19048. this.onTextInputOperation.raise("NotifyTextInputStart", item, text, position, size);
  19049. };
  19050. EventManager.prototype.raiseTextInputEnd = function (item) {
  19051. this.onTextInputOperation.raise("NotifyTextInputEnd", item);
  19052. };
  19053. return EventManager;
  19054. }());
  19055. exports.EventManager = EventManager;
  19056. /***/ }),
  19057. /* 216 */
  19058. /***/ (function(module, exports, __webpack_require__) {
  19059. "use strict";
  19060. Object.defineProperty(exports, "__esModule", { value: true });
  19061. var MouseHandlerDefaultState_1 = __webpack_require__(217);
  19062. var Event_1 = __webpack_require__(14);
  19063. var Utils_1 = __webpack_require__(0);
  19064. var ConnectionPointsVisualizer_1 = __webpack_require__(233);
  19065. var KeyCode_1 = __webpack_require__(16);
  19066. var ModelUtils_1 = __webpack_require__(8);
  19067. var Model_1 = __webpack_require__(21);
  19068. var ExtensionLinesVisualizer_1 = __webpack_require__(92);
  19069. var Shape_1 = __webpack_require__(9);
  19070. var CanvasManager_1 = __webpack_require__(44);
  19071. var ConnectionMarksVisualizer_1 = __webpack_require__(234);
  19072. var ConnectionTargetVisualizer_1 = __webpack_require__(235);
  19073. var ConnectionPointsVisualizerBase_1 = __webpack_require__(67);
  19074. var MouseHandlerMoveClonedShapeState_1 = __webpack_require__(66);
  19075. var MouseHandler = /** @class */ (function () {
  19076. function MouseHandler(history, selection, model, eventManager) {
  19077. this.history = history;
  19078. this.selection = selection;
  19079. this.model = model;
  19080. this.eventManager = eventManager;
  19081. this.onVisualizersUpdate = new Utils_1.EventDispatcher();
  19082. this.initialize(model);
  19083. this.connectionPointsVisualizer = new ConnectionPointsVisualizer_1.ConnectionPointsVisualizer(this.onVisualizersUpdate);
  19084. this.connectionMarksVisualizer = new ConnectionMarksVisualizer_1.ConnectionMarksVisualizer(this.onVisualizersUpdate);
  19085. this.connectionPointsVisualizer = new ConnectionPointsVisualizer_1.ConnectionPointsVisualizer(this.onVisualizersUpdate);
  19086. this.connectionTargetVisualizer = new ConnectionTargetVisualizer_1.ConnectionTargetVisualizer(this.onVisualizersUpdate);
  19087. this.extensionLinesVisualizer = new ExtensionLinesVisualizer_1.ExtensionLinesVisualizer(this.onVisualizersUpdate);
  19088. }
  19089. ;
  19090. MouseHandler.prototype.initialize = function (model) {
  19091. this.model = model;
  19092. this.defaultState = new MouseHandlerDefaultState_1.MouseHandlerDefaultState(this, this.history, this.selection, this.model);
  19093. this.switchToDefaultState();
  19094. };
  19095. MouseHandler.prototype.onMouseDown = function (evt) {
  19096. this.state.onMouseDown(evt);
  19097. };
  19098. MouseHandler.prototype.onMouseMove = function (evt) {
  19099. this.state.onMouseMove(evt);
  19100. };
  19101. MouseHandler.prototype.onMouseUp = function (evt) {
  19102. this.state.onMouseUp(evt);
  19103. };
  19104. MouseHandler.prototype.onMouseDoubleClick = function (evt) {
  19105. this.state.onMouseDoubleClick(evt);
  19106. this.switchToDefaultState();
  19107. };
  19108. MouseHandler.prototype.onMouseEnter = function (evt) {
  19109. };
  19110. MouseHandler.prototype.onMouseLeave = function (evt) {
  19111. this.resetConnectionPoints();
  19112. this.resetConnectionMarks();
  19113. this.resetConnectionTarget();
  19114. this.resetExtensionLines();
  19115. };
  19116. MouseHandler.prototype.onShortcut = function (code) {
  19117. return this.state.onShortcut(code);
  19118. };
  19119. MouseHandler.prototype.onDragStart = function (evt) {
  19120. this.state.onDragStart(evt);
  19121. };
  19122. MouseHandler.prototype.onDragEnd = function (evt) {
  19123. this.state.onDragEnd(evt);
  19124. };
  19125. // utils
  19126. MouseHandler.prototype.getSnappedPos = function (evt, pos) {
  19127. if (!this.model.snapToGrid || (evt.modifiers & KeyCode_1.ModifierKey.Ctrl))
  19128. return pos;
  19129. return ModelUtils_1.ModelUtils.getSnappedPos(this.model, pos);
  19130. };
  19131. MouseHandler.prototype.getSnappedPoint = function (evt, point, additionalSnappedPoint) {
  19132. var x = this.getSnappedPos(evt, point.x);
  19133. var y = this.getSnappedPos(evt, point.y);
  19134. if (additionalSnappedPoint === undefined)
  19135. return new Utils_1.Point(x, y);
  19136. else {
  19137. if (Math.pow(point.x - x, 2) + Math.pow(point.y - y, 2) < Math.pow(point.x - additionalSnappedPoint.x, 2) + Math.pow(point.y - additionalSnappedPoint.y, 2))
  19138. return new Utils_1.Point(x, y);
  19139. else
  19140. return additionalSnappedPoint;
  19141. }
  19142. };
  19143. MouseHandler.prototype.tryUpdateModelSize = function (processPoints) {
  19144. ModelUtils_1.ModelUtils.tryUpdateModelSize(this.history, this.model, processPoints);
  19145. };
  19146. MouseHandler.prototype.setConnectionPoints = function (item, type, pointIndex) {
  19147. if (!this.eventManager.isFocused())
  19148. return;
  19149. if (item && !item.locked && (type === Event_1.MouseEventElementType.Shape ||
  19150. type === Event_1.MouseEventElementType.ShapeConnectionPoint ||
  19151. type === Event_1.MouseEventElementType.ShapeConnection) && item !== undefined) {
  19152. var key = item.key;
  19153. if (!this.selection.hasKey(key)) {
  19154. var points = item.getConnectionPoints();
  19155. this.connectionPointsVisualizer.setPoints(key, points.map(function (pt, index) { return new ConnectionPointsVisualizerBase_1.ConnectionPointInfo(pt, item.getConnectionPointSide(index)); }), pointIndex);
  19156. }
  19157. }
  19158. else
  19159. this.connectionPointsVisualizer.reset();
  19160. };
  19161. MouseHandler.prototype.setConnectionPointIndex = function (index) {
  19162. this.connectionPointsVisualizer.setPointIndex(index);
  19163. };
  19164. MouseHandler.prototype.updateConnectionPoints = function () {
  19165. var item = this.model.findItem(this.connectionPointsVisualizer.getKey());
  19166. if (item !== undefined)
  19167. this.connectionPointsVisualizer.update();
  19168. else
  19169. this.connectionPointsVisualizer.reset();
  19170. };
  19171. MouseHandler.prototype.resetConnectionPoints = function () {
  19172. this.connectionPointsVisualizer.reset();
  19173. };
  19174. MouseHandler.prototype.setConnectionMarks = function (item, type, pointIndex) {
  19175. if (!this.eventManager.isFocused())
  19176. return;
  19177. if (item && !item.locked && (type === Event_1.MouseEventElementType.Shape ||
  19178. type === Event_1.MouseEventElementType.ShapeConnectionPoint ||
  19179. type === Event_1.MouseEventElementType.ShapeConnection) && item !== undefined) {
  19180. var key = item.key;
  19181. var points = item.getConnectionPointsForSelection();
  19182. this.connectionMarksVisualizer.setPoints(key, points.map(function (pt, index) { return new ConnectionPointsVisualizerBase_1.ConnectionPointInfo(pt, item.getConnectionPointForSelectionSide(index)); }), pointIndex);
  19183. }
  19184. else
  19185. this.connectionMarksVisualizer.reset();
  19186. };
  19187. MouseHandler.prototype.updateConnectionMarks = function () {
  19188. var item = this.model.findItem(this.connectionMarksVisualizer.getKey());
  19189. if (item !== undefined)
  19190. this.connectionMarksVisualizer.update();
  19191. else
  19192. this.connectionMarksVisualizer.reset();
  19193. };
  19194. MouseHandler.prototype.resetConnectionMarks = function () {
  19195. this.connectionMarksVisualizer.reset();
  19196. };
  19197. MouseHandler.prototype.setConnectionTarget = function (item, type) {
  19198. if (item && !item.locked && (type === Event_1.MouseEventElementType.Shape ||
  19199. type === Event_1.MouseEventElementType.ShapeConnectionPoint ||
  19200. type === Event_1.MouseEventElementType.ShapeConnection)) {
  19201. this.connectionTargetVisualizer.setTargetRect(item.key, item.rectangle);
  19202. }
  19203. else
  19204. this.connectionTargetVisualizer.reset();
  19205. };
  19206. MouseHandler.prototype.resetConnectionTarget = function () {
  19207. this.connectionTargetVisualizer.reset();
  19208. };
  19209. MouseHandler.prototype.setExtensionLines = function (items) {
  19210. var _this = this;
  19211. if (!this.eventManager.isFocused())
  19212. return;
  19213. this.extensionLinesVisualizer.reset();
  19214. var rect = Model_1.DiagramModel.getRectangle(items.filter(function (item) { return item && !item.locked; }));
  19215. this.addPageExtensionLines(rect);
  19216. this.model.items.forEach(function (item) {
  19217. if (item.locked || items.indexOf(item) > -1)
  19218. return;
  19219. if (item instanceof Shape_1.Shape)
  19220. _this.addShapeExtensionLines(item, rect);
  19221. });
  19222. };
  19223. MouseHandler.prototype.addPageExtensionLines = function (rect) {
  19224. var horPages = Math.round(this.model.size.width / this.model.pageWidth);
  19225. var verPages = Math.round(this.model.size.height / this.model.pageHeight);
  19226. for (var i = 0; i < horPages; i++) {
  19227. for (var j = 0; j < verPages; j++) {
  19228. var center = new Utils_1.Point(i * this.model.pageWidth + this.model.pageWidth / 2, j * this.model.pageHeight + this.model.pageHeight / 2);
  19229. if (Math.abs(rect.center.x - center.x) < this.model.gridSize / 2) {
  19230. var segment = new Utils_1.Segment(new Utils_1.Point(rect.center.x, 0), new Utils_1.Point(rect.center.x, this.model.size.height));
  19231. this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterToPageCenter, segment, "");
  19232. }
  19233. if (Math.abs(rect.center.y - center.y) < this.model.gridSize / 2) {
  19234. var segment = new Utils_1.Segment(new Utils_1.Point(0, rect.center.y), new Utils_1.Point(this.model.size.width, rect.center.y));
  19235. this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterToPageCenter, segment, "");
  19236. }
  19237. if (Math.abs(rect.left - center.x) < this.model.gridSize / 2) {
  19238. var segment = new Utils_1.Segment(new Utils_1.Point(rect.left, 0), new Utils_1.Point(rect.left, this.model.size.height));
  19239. this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.LeftToPageCenter, segment, "");
  19240. }
  19241. if (Math.abs(rect.top - center.y) < this.model.gridSize / 2) {
  19242. var segment = new Utils_1.Segment(new Utils_1.Point(0, rect.top), new Utils_1.Point(this.model.size.width, rect.top));
  19243. this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.TopToPageCenter, segment, "");
  19244. }
  19245. if (Math.abs(rect.right - center.x) < this.model.gridSize / 2) {
  19246. var segment = new Utils_1.Segment(new Utils_1.Point(rect.right, 0), new Utils_1.Point(rect.right, this.model.size.height));
  19247. this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.RightToPageCenter, segment, "");
  19248. }
  19249. if (Math.abs(rect.bottom - center.y) < this.model.gridSize / 2) {
  19250. var segment = new Utils_1.Segment(new Utils_1.Point(0, rect.bottom), new Utils_1.Point(this.model.size.width, rect.bottom));
  19251. this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.BottomToPageCenter, segment, "");
  19252. }
  19253. }
  19254. }
  19255. };
  19256. MouseHandler.prototype.addShapeExtensionLines = function (shape, rect) {
  19257. var sRect = shape.rectangle;
  19258. var lwCor = Shape_1.Shape.lineWidth - CanvasManager_1.CanvasManager.extensionLineWidth;
  19259. var showDistance = true;
  19260. var x1, y1, x2, y2;
  19261. if (rect.right < sRect.left) {
  19262. x1 = rect.right + lwCor + CanvasManager_1.CanvasManager.extensionLineOffset;
  19263. x2 = sRect.left - CanvasManager_1.CanvasManager.extensionLineOffset;
  19264. }
  19265. else if (rect.left > sRect.right) {
  19266. x1 = rect.left - CanvasManager_1.CanvasManager.extensionLineOffset;
  19267. x2 = sRect.right + lwCor + CanvasManager_1.CanvasManager.extensionLineOffset;
  19268. }
  19269. if (rect.bottom < sRect.top) {
  19270. y1 = rect.bottom + lwCor + CanvasManager_1.CanvasManager.extensionLineOffset;
  19271. y2 = sRect.top - CanvasManager_1.CanvasManager.extensionLineOffset;
  19272. }
  19273. else if (rect.top > sRect.bottom) {
  19274. y1 = rect.top - CanvasManager_1.CanvasManager.extensionLineOffset;
  19275. y2 = sRect.bottom + lwCor + CanvasManager_1.CanvasManager.extensionLineOffset;
  19276. }
  19277. if (x1 != undefined && x2 !== undefined) {
  19278. if (rect.center.y === sRect.center.y) {
  19279. var segment = new Utils_1.Segment(new Utils_1.Point(x1, rect.center.y), new Utils_1.Point(x2, sRect.center.y));
  19280. this.extensionLinesVisualizer.addSegment(x1 > x2 ? ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterAfter : ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterBefore, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
  19281. showDistance = false;
  19282. }
  19283. if (rect.top === sRect.top) {
  19284. var segment = new Utils_1.Segment(new Utils_1.Point(x1, rect.top), new Utils_1.Point(x2, sRect.top));
  19285. this.extensionLinesVisualizer.addSegment(x1 > x2 ? ExtensionLinesVisualizer_1.ExtensionLineType.TopToTopAfter : ExtensionLinesVisualizer_1.ExtensionLineType.TopToTopBefore, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
  19286. }
  19287. if (rect.bottom === sRect.bottom) {
  19288. var segment = new Utils_1.Segment(new Utils_1.Point(x1, rect.bottom + lwCor), new Utils_1.Point(x2, sRect.bottom + lwCor));
  19289. this.extensionLinesVisualizer.addSegment(x1 > x2 ? ExtensionLinesVisualizer_1.ExtensionLineType.BottomToBottomAfter : ExtensionLinesVisualizer_1.ExtensionLineType.BottomToBottomBefore, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
  19290. }
  19291. if (rect.top === sRect.bottom) {
  19292. var segment = new Utils_1.Segment(new Utils_1.Point(x1, rect.top), new Utils_1.Point(x2, sRect.bottom + lwCor));
  19293. this.extensionLinesVisualizer.addSegment(x1 > x2 ? ExtensionLinesVisualizer_1.ExtensionLineType.TopToBottomAfter : ExtensionLinesVisualizer_1.ExtensionLineType.TopToBottomBefore, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
  19294. }
  19295. if (rect.bottom === sRect.top) {
  19296. var segment = new Utils_1.Segment(new Utils_1.Point(x1, rect.bottom + lwCor), new Utils_1.Point(x2, sRect.top));
  19297. this.extensionLinesVisualizer.addSegment(x1 > x2 ? ExtensionLinesVisualizer_1.ExtensionLineType.BottomToTopAfter : ExtensionLinesVisualizer_1.ExtensionLineType.BottomToTopBefore, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
  19298. }
  19299. }
  19300. if (y1 != undefined && y2 !== undefined) {
  19301. if (rect.center.x === sRect.center.x) {
  19302. var segment = new Utils_1.Segment(new Utils_1.Point(rect.center.x, y1), new Utils_1.Point(sRect.center.x, y2));
  19303. this.extensionLinesVisualizer.addSegment(y1 > y2 ? ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterBelow : ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterAbove, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
  19304. showDistance = false;
  19305. }
  19306. if (rect.left === sRect.left) {
  19307. var segment = new Utils_1.Segment(new Utils_1.Point(rect.left, y1), new Utils_1.Point(sRect.left, y2));
  19308. this.extensionLinesVisualizer.addSegment(y1 > y2 ? ExtensionLinesVisualizer_1.ExtensionLineType.LeftToLeftBelow : ExtensionLinesVisualizer_1.ExtensionLineType.LeftToLeftAbove, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
  19309. }
  19310. if (rect.right === sRect.right) {
  19311. var segment = new Utils_1.Segment(new Utils_1.Point(rect.right + lwCor, y1), new Utils_1.Point(sRect.right + lwCor, y2));
  19312. this.extensionLinesVisualizer.addSegment(y1 > y2 ? ExtensionLinesVisualizer_1.ExtensionLineType.RightToRightBelow : ExtensionLinesVisualizer_1.ExtensionLineType.RightToRightAbove, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
  19313. }
  19314. if (rect.left === sRect.right) {
  19315. var segment = new Utils_1.Segment(new Utils_1.Point(rect.left, y1), new Utils_1.Point(sRect.right + lwCor, y2));
  19316. this.extensionLinesVisualizer.addSegment(y1 > y2 ? ExtensionLinesVisualizer_1.ExtensionLineType.LeftToRightBelow : ExtensionLinesVisualizer_1.ExtensionLineType.LeftToRightAbove, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
  19317. }
  19318. if (rect.right === sRect.left) {
  19319. var segment = new Utils_1.Segment(new Utils_1.Point(rect.right + lwCor, y1), new Utils_1.Point(sRect.left, y2));
  19320. this.extensionLinesVisualizer.addSegment(y1 > y2 ? ExtensionLinesVisualizer_1.ExtensionLineType.RightToLeftBelow : ExtensionLinesVisualizer_1.ExtensionLineType.RightToLeftAbove, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
  19321. }
  19322. }
  19323. };
  19324. MouseHandler.prototype.resetExtensionLines = function () {
  19325. this.extensionLinesVisualizer.reset();
  19326. };
  19327. MouseHandler.prototype.raiseDragStart = function (keys) {
  19328. this.eventManager.onDocumentDragStart(keys);
  19329. };
  19330. MouseHandler.prototype.raiseDragEnd = function (keys) {
  19331. this.eventManager.onDocumentDragEnd(keys);
  19332. };
  19333. // switch state
  19334. MouseHandler.prototype.switchToDefaultState = function () {
  19335. this.switchState(this.defaultState);
  19336. };
  19337. MouseHandler.prototype.switchToMoveClonedShapeState = function (startPoint) {
  19338. this.switchState(new MouseHandlerMoveClonedShapeState_1.MouseHandlerMoveClonedShapeState(this, this.history, this.model, this.selection, startPoint));
  19339. };
  19340. MouseHandler.prototype.switchState = function (state) {
  19341. if (this.state)
  19342. this.state.finish();
  19343. this.state = state;
  19344. this.state.start();
  19345. };
  19346. return MouseHandler;
  19347. }());
  19348. exports.MouseHandler = MouseHandler;
  19349. /***/ }),
  19350. /* 217 */
  19351. /***/ (function(module, exports, __webpack_require__) {
  19352. "use strict";
  19353. var __extends = (this && this.__extends) || (function () {
  19354. var extendStatics = function (d, b) {
  19355. extendStatics = Object.setPrototypeOf ||
  19356. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  19357. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  19358. return extendStatics(d, b);
  19359. };
  19360. return function (d, b) {
  19361. extendStatics(d, b);
  19362. function __() { this.constructor = d; }
  19363. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19364. };
  19365. })();
  19366. Object.defineProperty(exports, "__esModule", { value: true });
  19367. var MouseHandlerStateBase_1 = __webpack_require__(45);
  19368. var Event_1 = __webpack_require__(14);
  19369. var MouseHandlerMoveShapeState_1 = __webpack_require__(218);
  19370. var MouseHandlerMoveConnectorPointState_1 = __webpack_require__(220);
  19371. var MouseHandlerResizeShapeState_1 = __webpack_require__(221);
  19372. var MouseHandlerMoveConnectorSideState_1 = __webpack_require__(223);
  19373. var MouseHandlerDragParameterPointState_1 = __webpack_require__(224);
  19374. var KeyCode_1 = __webpack_require__(16);
  19375. var MouseHandlerSelectionState_1 = __webpack_require__(226);
  19376. var MouseHandlerCreateConnectorState_1 = __webpack_require__(228);
  19377. var UnitConverter_1 = __webpack_require__(13);
  19378. var MouseHandlerMoveConnectorOrthogonalSideState_1 = __webpack_require__(229);
  19379. var MouseHandlerToolboxDraggingState_1 = __webpack_require__(230);
  19380. var MouseHandlerMoveConnectorTextState_1 = __webpack_require__(231);
  19381. var MouseHandlerMoveClonedShapeState_1 = __webpack_require__(66);
  19382. var MouseHandlerDefaultState = /** @class */ (function (_super) {
  19383. __extends(MouseHandlerDefaultState, _super);
  19384. function MouseHandlerDefaultState(handler, history, selection, model) {
  19385. var _this = _super.call(this, handler) || this;
  19386. _this.history = history;
  19387. _this.selection = selection;
  19388. _this.model = model;
  19389. return _this;
  19390. }
  19391. MouseHandlerDefaultState.prototype.finish = function () {
  19392. this.handler.resetConnectionPoints();
  19393. this.handler.resetConnectionMarks();
  19394. _super.prototype.finish.call(this);
  19395. };
  19396. MouseHandlerDefaultState.prototype.onMouseDown = function (evt) {
  19397. if (evt.source.type === Event_1.MouseEventElementType.Shape) {
  19398. var shapeKey = evt.source.key;
  19399. if (MouseHandlerMoveClonedShapeState_1.MouseHandlerMoveClonedShapeState.isMoveClonedShapeEvent(evt)) {
  19400. this.selection.add(shapeKey);
  19401. this.handler.switchToMoveClonedShapeState();
  19402. }
  19403. else {
  19404. this.modifySelection(evt, shapeKey);
  19405. this.handler.switchState(new MouseHandlerMoveShapeState_1.MouseHandlerMoveShapeState(this.handler, this.history, this.model, this.selection));
  19406. }
  19407. this.handler.state.onMouseDown(evt);
  19408. }
  19409. else if (evt.source.type === Event_1.MouseEventElementType.Connector) {
  19410. var connectorKey = evt.source.key;
  19411. this.modifySelection(evt, connectorKey);
  19412. }
  19413. else if (evt.source.type === Event_1.MouseEventElementType.ConnectorText) {
  19414. var connectorKey = evt.source.key;
  19415. this.modifySelection(evt, connectorKey);
  19416. this.handler.switchState(new MouseHandlerMoveConnectorTextState_1.MouseHandlerMoveConnectorTextState(this.handler, this.history, this.model));
  19417. this.handler.state.onMouseDown(evt);
  19418. }
  19419. else if (evt.source.type === Event_1.MouseEventElementType.ShapeResizeBox) {
  19420. this.handler.switchState(new MouseHandlerResizeShapeState_1.MouseHandlerResizeShapeState(this.handler, this.history, this.model, this.selection));
  19421. this.handler.state.onMouseDown(evt);
  19422. }
  19423. else if (evt.source.type === Event_1.MouseEventElementType.ShapeParameterBox) {
  19424. this.handler.switchState(new MouseHandlerDragParameterPointState_1.MouseHandlerDragParameterPointState(this.handler, this.history, this.model));
  19425. this.handler.state.onMouseDown(evt);
  19426. }
  19427. else if (evt.source.type === Event_1.MouseEventElementType.ConnectorPoint) {
  19428. this.handler.switchState(new MouseHandlerMoveConnectorPointState_1.MouseHandlerMoveConnectorPointState(this.handler, this.history, this.model));
  19429. this.handler.state.onMouseDown(evt);
  19430. }
  19431. else if (evt.source.type === Event_1.MouseEventElementType.ConnectorSide) {
  19432. this.handler.switchState(new MouseHandlerMoveConnectorSideState_1.MouseHandlerMoveConnectorSideState(this.handler, this.history, this.model));
  19433. this.handler.state.onMouseDown(evt);
  19434. }
  19435. else if (evt.source.type === Event_1.MouseEventElementType.ConnectorOrthogonalSide) {
  19436. this.handler.switchState(new MouseHandlerMoveConnectorOrthogonalSideState_1.MouseHandlerMoveConnectorOrthogonalSideState(this.handler, this.history, this.model));
  19437. this.handler.state.onMouseDown(evt);
  19438. }
  19439. else if (evt.source.type === Event_1.MouseEventElementType.ShapeConnectionPoint) {
  19440. this.handler.switchState(new MouseHandlerCreateConnectorState_1.MouseHandlerCreateConnectorState(this.handler, this.history, this.model, this.selection));
  19441. this.handler.state.onMouseDown(evt);
  19442. }
  19443. else if (evt.source.type === Event_1.MouseEventElementType.ShapeConnection) {
  19444. this.handler.switchState(new MouseHandlerCreateConnectorState_1.MouseHandlerCreateConnectorState(this.handler, this.history, this.model, this.selection, -1));
  19445. this.handler.state.onMouseDown(evt);
  19446. }
  19447. else {
  19448. this.handler.switchState(new MouseHandlerSelectionState_1.MouseHandlerSelectionState(this.handler, this.selection));
  19449. this.handler.state.onMouseDown(evt);
  19450. }
  19451. };
  19452. MouseHandlerDefaultState.prototype.onDragStart = function (evt) {
  19453. this.handler.switchState(new MouseHandlerToolboxDraggingState_1.MouseHandlerBeforeToolboxDraggingState(this.handler, this.history, this.model, this.selection));
  19454. this.handler.state.onDragStart(evt);
  19455. };
  19456. MouseHandlerDefaultState.prototype.onMouseMove = function (evt) {
  19457. var item = this.model.findItem(evt.source.key);
  19458. var pointIndex = -1;
  19459. if (evt.source.value && evt.source.type === Event_1.MouseEventElementType.ShapeConnectionPoint)
  19460. pointIndex = parseInt(evt.source.value);
  19461. this.handler.setConnectionPoints(item, evt.source.type, pointIndex);
  19462. var connectionIndex = -1;
  19463. if (evt.source.value && evt.source.type === Event_1.MouseEventElementType.ShapeConnection)
  19464. connectionIndex = parseInt(evt.source.value);
  19465. this.handler.setConnectionMarks(item, evt.source.type, connectionIndex);
  19466. };
  19467. MouseHandlerDefaultState.prototype.modifySelection = function (evt, key) {
  19468. if (evt.modifiers & KeyCode_1.ModifierKey.Ctrl || evt.modifiers & KeyCode_1.ModifierKey.Shift) {
  19469. if (this.selection.hasKey(key))
  19470. this.selection.remove(key);
  19471. else
  19472. this.selection.add(key);
  19473. }
  19474. else if (!this.selection.hasKey(key))
  19475. this.selection.set([key]);
  19476. };
  19477. MouseHandlerDefaultState.itemEdge = UnitConverter_1.UnitConverter.pixelsToTwips(10);
  19478. return MouseHandlerDefaultState;
  19479. }(MouseHandlerStateBase_1.MouseHandlerStateBase));
  19480. exports.MouseHandlerDefaultState = MouseHandlerDefaultState;
  19481. /***/ }),
  19482. /* 218 */
  19483. /***/ (function(module, exports, __webpack_require__) {
  19484. "use strict";
  19485. var __extends = (this && this.__extends) || (function () {
  19486. var extendStatics = function (d, b) {
  19487. extendStatics = Object.setPrototypeOf ||
  19488. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  19489. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  19490. return extendStatics(d, b);
  19491. };
  19492. return function (d, b) {
  19493. extendStatics(d, b);
  19494. function __() { this.constructor = d; }
  19495. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19496. };
  19497. })();
  19498. Object.defineProperty(exports, "__esModule", { value: true });
  19499. var MouseHandlerMoveClonedShapeState_1 = __webpack_require__(66);
  19500. var MouseHandlerMoveShapeOrthogonallyState_1 = __webpack_require__(219);
  19501. var MouseHandlerMoveShapeState = /** @class */ (function (_super) {
  19502. __extends(MouseHandlerMoveShapeState, _super);
  19503. function MouseHandlerMoveShapeState() {
  19504. return _super !== null && _super.apply(this, arguments) || this;
  19505. }
  19506. MouseHandlerMoveShapeState.prototype.onMouseMove = function (evt) {
  19507. _super.prototype.onMouseMove.call(this, evt);
  19508. this.switchToMoveClonedShapeState(evt);
  19509. };
  19510. MouseHandlerMoveShapeState.prototype.switchToMoveClonedShapeState = function (evt) {
  19511. if (MouseHandlerMoveClonedShapeState_1.MouseHandlerMoveClonedShapeState.isMoveClonedShapeEvent(evt)) {
  19512. this.cancelChanges();
  19513. this.handler.switchToMoveClonedShapeState(this.startPoint);
  19514. this.handler.onMouseDown(evt);
  19515. }
  19516. };
  19517. return MouseHandlerMoveShapeState;
  19518. }(MouseHandlerMoveShapeOrthogonallyState_1.MouseHandlerMoveShapeOrthogonallyState));
  19519. exports.MouseHandlerMoveShapeState = MouseHandlerMoveShapeState;
  19520. /***/ }),
  19521. /* 219 */
  19522. /***/ (function(module, exports, __webpack_require__) {
  19523. "use strict";
  19524. var __extends = (this && this.__extends) || (function () {
  19525. var extendStatics = function (d, b) {
  19526. extendStatics = Object.setPrototypeOf ||
  19527. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  19528. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  19529. return extendStatics(d, b);
  19530. };
  19531. return function (d, b) {
  19532. extendStatics(d, b);
  19533. function __() { this.constructor = d; }
  19534. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19535. };
  19536. })();
  19537. Object.defineProperty(exports, "__esModule", { value: true });
  19538. var KeyCode_1 = __webpack_require__(16);
  19539. var MouseHandlerMoveShapeStateBase_1 = __webpack_require__(95);
  19540. var MouseHandlerMoveShapeOrthogonallyState = /** @class */ (function (_super) {
  19541. __extends(MouseHandlerMoveShapeOrthogonallyState, _super);
  19542. function MouseHandlerMoveShapeOrthogonallyState() {
  19543. return _super !== null && _super.apply(this, arguments) || this;
  19544. }
  19545. MouseHandlerMoveShapeOrthogonallyState.prototype.onApplyChanges = function (evt) {
  19546. this.calculateFixedPosition(evt);
  19547. _super.prototype.onApplyChanges.call(this, evt);
  19548. };
  19549. MouseHandlerMoveShapeOrthogonallyState.prototype.getXPosition = function (evt, baseX) {
  19550. return this.fixedX ? baseX : _super.prototype.getXPosition.call(this, evt, baseX);
  19551. };
  19552. MouseHandlerMoveShapeOrthogonallyState.prototype.getYPosition = function (evt, baseY) {
  19553. return this.fixedY ? baseY : _super.prototype.getYPosition.call(this, evt, baseY);
  19554. };
  19555. MouseHandlerMoveShapeOrthogonallyState.prototype.calculateFixedPosition = function (evt) {
  19556. this.fixedX = false;
  19557. this.fixedY = false;
  19558. if (evt.modifiers & KeyCode_1.ModifierKey.Shift) {
  19559. var dx = Math.abs(this.startPoint.x - evt.layoutPoint.x);
  19560. var dy = Math.abs(this.startPoint.y - evt.layoutPoint.y);
  19561. if (dx < dy)
  19562. this.fixedX = true;
  19563. else
  19564. this.fixedY = true;
  19565. }
  19566. };
  19567. return MouseHandlerMoveShapeOrthogonallyState;
  19568. }(MouseHandlerMoveShapeStateBase_1.MouseHandlerMoveShapeStateBase));
  19569. exports.MouseHandlerMoveShapeOrthogonallyState = MouseHandlerMoveShapeOrthogonallyState;
  19570. /***/ }),
  19571. /* 220 */
  19572. /***/ (function(module, exports, __webpack_require__) {
  19573. "use strict";
  19574. var __extends = (this && this.__extends) || (function () {
  19575. var extendStatics = function (d, b) {
  19576. extendStatics = Object.setPrototypeOf ||
  19577. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  19578. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  19579. return extendStatics(d, b);
  19580. };
  19581. return function (d, b) {
  19582. extendStatics(d, b);
  19583. function __() { this.constructor = d; }
  19584. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19585. };
  19586. })();
  19587. Object.defineProperty(exports, "__esModule", { value: true });
  19588. var MouseHandlerMoveConnectorPointStateBase_1 = __webpack_require__(96);
  19589. var Connector_1 = __webpack_require__(5);
  19590. var ModelUtils_1 = __webpack_require__(8);
  19591. var Utils_1 = __webpack_require__(0);
  19592. var ConnectorProperties_1 = __webpack_require__(28);
  19593. var MouseHandlerMoveConnectorPointState = /** @class */ (function (_super) {
  19594. __extends(MouseHandlerMoveConnectorPointState, _super);
  19595. function MouseHandlerMoveConnectorPointState() {
  19596. return _super !== null && _super.apply(this, arguments) || this;
  19597. }
  19598. MouseHandlerMoveConnectorPointState.prototype.onMouseDown = function (evt) {
  19599. this.connector = this.model.findConnector(evt.source.key);
  19600. this.pointIndex = parseInt(evt.source.value);
  19601. if (this.pointIndex === 0) {
  19602. this.pointPosition = Connector_1.ConnectorPosition.Begin;
  19603. }
  19604. else if (this.pointIndex === this.connector.points.length - 1) {
  19605. this.pointPosition = Connector_1.ConnectorPosition.End;
  19606. }
  19607. _super.prototype.onMouseDown.call(this, evt);
  19608. };
  19609. MouseHandlerMoveConnectorPointState.prototype.onApplyChanges = function (evt) {
  19610. if (this.connector.properties.lineOption !== ConnectorProperties_1.ConnectorLineOption.Orthogonal ||
  19611. this.pointIndex === 0 || this.pointIndex === this.connector.points.length - 1)
  19612. _super.prototype.onApplyChanges.call(this, evt);
  19613. };
  19614. MouseHandlerMoveConnectorPointState.prototype.onFinishWithChanges = function () {
  19615. ModelUtils_1.ModelUtils.removeUnnecessaryConnectorPoints(this.history, this.connector);
  19616. };
  19617. MouseHandlerMoveConnectorPointState.prototype.getSnappedPoint = function (evt, point) {
  19618. var points = this.connector.points;
  19619. var index = this.pointIndex;
  19620. if (0 < index && index < points.length - 1) {
  19621. var tg = (points[index + 1].y - points[index - 1].y) / (points[index + 1].x - points[index - 1].x);
  19622. var x = point.x;
  19623. var y = points[index + 1].y - (points[index + 1].x - x) * tg;
  19624. return this.handler.getSnappedPoint(evt, point, new Utils_1.Point(x, y));
  19625. }
  19626. return this.handler.getSnappedPoint(evt, point);
  19627. };
  19628. return MouseHandlerMoveConnectorPointState;
  19629. }(MouseHandlerMoveConnectorPointStateBase_1.MouseHandlerMoveConnectorPointStateBase));
  19630. exports.MouseHandlerMoveConnectorPointState = MouseHandlerMoveConnectorPointState;
  19631. /***/ }),
  19632. /* 221 */
  19633. /***/ (function(module, exports, __webpack_require__) {
  19634. "use strict";
  19635. var __extends = (this && this.__extends) || (function () {
  19636. var extendStatics = function (d, b) {
  19637. extendStatics = Object.setPrototypeOf ||
  19638. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  19639. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  19640. return extendStatics(d, b);
  19641. };
  19642. return function (d, b) {
  19643. extendStatics(d, b);
  19644. function __() { this.constructor = d; }
  19645. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19646. };
  19647. })();
  19648. Object.defineProperty(exports, "__esModule", { value: true });
  19649. var Utils_1 = __webpack_require__(0);
  19650. var Event_1 = __webpack_require__(14);
  19651. var KeyCode_1 = __webpack_require__(16);
  19652. var MouseHandlerDraggingState_1 = __webpack_require__(24);
  19653. var Model_1 = __webpack_require__(21);
  19654. var ModelUtils_1 = __webpack_require__(8);
  19655. var ResizeInfoVisualizer_1 = __webpack_require__(222);
  19656. var CanvasManager_1 = __webpack_require__(44);
  19657. var MouseHandlerResizeShapeState = /** @class */ (function (_super) {
  19658. __extends(MouseHandlerResizeShapeState, _super);
  19659. function MouseHandlerResizeShapeState(handler, history, model, selection) {
  19660. var _this = _super.call(this, handler, history) || this;
  19661. _this.model = model;
  19662. _this.selection = selection;
  19663. _this.startScrollLeft = 0;
  19664. _this.startScrollTop = 0;
  19665. _this.rotation = 0;
  19666. return _this;
  19667. }
  19668. MouseHandlerResizeShapeState.prototype.start = function () {
  19669. this.resizeInfoVisualizer = new ResizeInfoVisualizer_1.ResizeInfoVisualizer(this.handler.onVisualizersUpdate);
  19670. _super.prototype.start.call(this);
  19671. };
  19672. MouseHandlerResizeShapeState.prototype.finish = function () {
  19673. this.resetResizeInfo();
  19674. this.handler.resetExtensionLines();
  19675. _super.prototype.finish.call(this);
  19676. };
  19677. MouseHandlerResizeShapeState.prototype.onMouseDown = function (evt) {
  19678. var source = parseInt(evt.source.value);
  19679. this.resizeEventSource = source;
  19680. this.startPoint = evt.layoutPoint;
  19681. this.lockH = source == Event_1.ResizeEventSource.ResizeBox_S || source == Event_1.ResizeEventSource.ResizeBox_N;
  19682. this.lockV = source == Event_1.ResizeEventSource.ResizeBox_E || source == Event_1.ResizeEventSource.ResizeBox_W;
  19683. this.sideH = source == Event_1.ResizeEventSource.ResizeBox_E || source == Event_1.ResizeEventSource.ResizeBox_NE || source == Event_1.ResizeEventSource.ResizeBox_SE;
  19684. this.sideV = source == Event_1.ResizeEventSource.ResizeBox_SE || source == Event_1.ResizeEventSource.ResizeBox_S || source == Event_1.ResizeEventSource.ResizeBox_SW;
  19685. this.shapes = this.selection.getSelectedShapes();
  19686. if (this.shapes.length === 0) {
  19687. this.handler.switchToDefaultState();
  19688. return;
  19689. }
  19690. this.connectors = this.selection.getSelectedConnectors();
  19691. this.startRectangle = Model_1.DiagramModel.getRectangle(this.shapes);
  19692. this.startShapeSizes = this.shapes.map(function (shape) { return shape.size.clone(); });
  19693. this.startShapePositions = this.shapes.map(function (shape) { return shape.position.clone(); });
  19694. this.startConnectorPoints = this.connectors.map(function (c) { return c.points.map(function (p) { return p.clone(); }); });
  19695. this.lockAspectRatio = !!(evt.modifiers & KeyCode_1.ModifierKey.Shift);
  19696. _super.prototype.onMouseDown.call(this, evt);
  19697. };
  19698. MouseHandlerResizeShapeState.prototype.onMouseMove = function (evt) {
  19699. _super.prototype.onMouseMove.call(this, evt);
  19700. var items = this.selection.getSelectedItems();
  19701. this.handler.setExtensionLines(this.selection.getSelectedShapes());
  19702. };
  19703. MouseHandlerResizeShapeState.prototype.onApplyChanges = function (evt) {
  19704. var _this = this;
  19705. var rectangle = Model_1.DiagramModel.getRectangle(this.shapes);
  19706. var size = this.getSize(evt, rectangle.position, this.startRectangle.size);
  19707. var pos = this.getPosition(evt, size, this.startRectangle.size, this.startRectangle.position);
  19708. var ratioX = size.width / this.startRectangle.width;
  19709. var ratioY = size.height / this.startRectangle.height;
  19710. this.shapes.forEach(function (shape, index) {
  19711. var shapeSize = new Utils_1.Size(_this.startShapeSizes[index].width * ratioX, _this.startShapeSizes[index].height * ratioY);
  19712. var shapePos = new Utils_1.Point(pos.x + (_this.startShapePositions[index].x - _this.startRectangle.left) * ratioX, pos.y + (_this.startShapePositions[index].y - _this.startRectangle.top) * ratioY);
  19713. ModelUtils_1.ModelUtils.setShapeSize(_this.history, _this.model, shape.key, shapePos, shapeSize, _this.history.addOrModifyAndRedo);
  19714. shape.attachedConnectors.forEach(function (connector) {
  19715. ModelUtils_1.ModelUtils.updateConnectorAttachedPoints(_this.history, connector, _this.history.addOrModifyAndRedo);
  19716. });
  19717. });
  19718. this.connectors.forEach(function (connector, index) {
  19719. var startPtIndex = connector.beginItem ? 1 : 0;
  19720. var endPtIndex = connector.endItem ? (connector.points.length - 2) : (connector.points.length - 1);
  19721. for (var i = startPtIndex; i <= endPtIndex; i++) {
  19722. var connectorPtPos = new Utils_1.Point(pos.x + (_this.startConnectorPoints[index][i].x - _this.startRectangle.left) * ratioX, pos.y + (_this.startConnectorPoints[index][i].y - _this.startRectangle.top) * ratioY);
  19723. ModelUtils_1.ModelUtils.setConnectorPoint(_this.history, _this.model, connector.key, i, connectorPtPos, _this.history.addOrModifyAndRedo);
  19724. }
  19725. });
  19726. this.tryUpdateModelSize();
  19727. this.setResizeInfo();
  19728. };
  19729. MouseHandlerResizeShapeState.prototype.tryUpdateModelSize = function () {
  19730. var _this = this;
  19731. this.handler.tryUpdateModelSize(function (offsetLeft, offsetTop) {
  19732. _this.startShapePositions.forEach(function (pt) {
  19733. pt.x += offsetLeft;
  19734. pt.y += offsetTop;
  19735. });
  19736. _this.startConnectorPoints.forEach(function (connector) {
  19737. connector.forEach(function (pt) {
  19738. pt.x += offsetLeft;
  19739. pt.y += offsetTop;
  19740. });
  19741. });
  19742. _this.startRectangle.position.x += offsetLeft;
  19743. _this.startRectangle.position.y += offsetTop;
  19744. _this.startPoint.x += offsetLeft;
  19745. _this.startPoint.y += offsetTop;
  19746. });
  19747. };
  19748. MouseHandlerResizeShapeState.prototype.setResizeInfo = function () {
  19749. var rect = Model_1.DiagramModel.getRectangle(this.shapes);
  19750. var point = new Utils_1.Point(rect.center.x, rect.bottom + CanvasManager_1.CanvasManager.resizeInfoOffset);
  19751. var text = this.model.getModelUnitText(rect.width) + " x " + this.model.getModelUnitText(rect.height);
  19752. this.resizeInfoVisualizer.set(point, text);
  19753. };
  19754. MouseHandlerResizeShapeState.prototype.resetResizeInfo = function () {
  19755. this.resizeInfoVisualizer.reset();
  19756. };
  19757. MouseHandlerResizeShapeState.prototype.getDraggingElementKeys = function () {
  19758. return this.shapes.map(function (shape) { return shape.key; });
  19759. };
  19760. MouseHandlerResizeShapeState.prototype.getSize = function (evt, position, startSize) {
  19761. var absDeltaX = evt.layoutPoint.x - (this.startScrollLeft - evt.scrollX) - this.startPoint.x;
  19762. var absDeltaY = evt.layoutPoint.y - (this.startScrollTop - evt.scrollY) - this.startPoint.y;
  19763. var deltaX = absDeltaX * Math.cos(this.rotation) - (-absDeltaY) * Math.sin(this.rotation);
  19764. var deltaY = -(absDeltaX * Math.sin(this.rotation) + (-absDeltaY) * Math.cos(this.rotation));
  19765. var newWidth, newHeight;
  19766. deltaY = !this.sideV && deltaY > 0 ? Math.min(startSize.height + 1, deltaY) : deltaY;
  19767. deltaX = !this.sideH && deltaX > 0 ? Math.min(startSize.width + 1, deltaX) : deltaX;
  19768. if (!this.lockH && !this.lockV && this.lockAspectRatio) {
  19769. if (Math.abs(deltaX) > Math.abs(deltaY)) {
  19770. newWidth = this.sideH ? Math.max(MouseHandlerResizeShapeState.minSize, startSize.width + deltaX) : (startSize.width - deltaX);
  19771. newHeight = startSize.height * (newWidth / startSize.width);
  19772. }
  19773. else {
  19774. newHeight = this.sideV ? Math.max(MouseHandlerResizeShapeState.minSize, startSize.height + deltaY) : (startSize.height - deltaY);
  19775. newWidth = startSize.width * (newHeight / startSize.height);
  19776. }
  19777. }
  19778. else {
  19779. deltaX = this.lockH ? 0 : deltaX;
  19780. deltaY = this.lockV ? 0 : deltaY;
  19781. newWidth = Math.max(MouseHandlerResizeShapeState.minSize, this.sideH ? (startSize.width + deltaX) : (startSize.width - deltaX));
  19782. newHeight = Math.max(MouseHandlerResizeShapeState.minSize, this.sideV ? (startSize.height + deltaY) : (startSize.height - deltaY));
  19783. }
  19784. if (!this.lockH)
  19785. newWidth = this.handler.getSnappedPos(evt, position.x + newWidth) - position.x;
  19786. if (!this.lockV)
  19787. newHeight = this.handler.getSnappedPos(evt, position.y + newHeight) - position.y;
  19788. return new Utils_1.Size(newWidth, newHeight);
  19789. };
  19790. MouseHandlerResizeShapeState.prototype.getPosition = function (evt, size, startSize, startPosition) {
  19791. var x = startPosition.x;
  19792. var y = startPosition.y;
  19793. if (this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_N ||
  19794. this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_NE ||
  19795. this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_NW) {
  19796. y += startSize.height - size.height;
  19797. var snappedY = this.handler.getSnappedPos(evt, y);
  19798. size.height += y - snappedY;
  19799. y = snappedY;
  19800. }
  19801. if (this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_W ||
  19802. this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_NW ||
  19803. this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_SW) {
  19804. x += startSize.width - size.width;
  19805. var snappedX = this.handler.getSnappedPos(evt, x);
  19806. size.width += x - snappedX;
  19807. x = snappedX;
  19808. }
  19809. return new Utils_1.Point(x, y);
  19810. };
  19811. MouseHandlerResizeShapeState.minSize = 360;
  19812. return MouseHandlerResizeShapeState;
  19813. }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
  19814. exports.MouseHandlerResizeShapeState = MouseHandlerResizeShapeState;
  19815. /***/ }),
  19816. /* 222 */
  19817. /***/ (function(module, exports, __webpack_require__) {
  19818. "use strict";
  19819. Object.defineProperty(exports, "__esModule", { value: true });
  19820. var ResizeInfoVisualizer = /** @class */ (function () {
  19821. function ResizeInfoVisualizer(dispatcher) {
  19822. this.dispatcher = dispatcher;
  19823. }
  19824. ResizeInfoVisualizer.prototype.set = function (point, text) {
  19825. this.point = point;
  19826. this.text = text;
  19827. this.raiseShow();
  19828. };
  19829. ResizeInfoVisualizer.prototype.reset = function () {
  19830. if (this.point !== undefined) {
  19831. this.point = undefined;
  19832. this.text = undefined;
  19833. this.raiseHide();
  19834. }
  19835. };
  19836. ResizeInfoVisualizer.prototype.raiseShow = function () {
  19837. var _this = this;
  19838. this.dispatcher.raise1(function (l) { return l.NotifyResizeInfoShow(_this.point, _this.text); });
  19839. };
  19840. ResizeInfoVisualizer.prototype.raiseHide = function () {
  19841. this.dispatcher.raise1(function (l) { return l.NotifyResizeInfoHide(); });
  19842. };
  19843. return ResizeInfoVisualizer;
  19844. }());
  19845. exports.ResizeInfoVisualizer = ResizeInfoVisualizer;
  19846. /***/ }),
  19847. /* 223 */
  19848. /***/ (function(module, exports, __webpack_require__) {
  19849. "use strict";
  19850. var __extends = (this && this.__extends) || (function () {
  19851. var extendStatics = function (d, b) {
  19852. extendStatics = Object.setPrototypeOf ||
  19853. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  19854. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  19855. return extendStatics(d, b);
  19856. };
  19857. return function (d, b) {
  19858. extendStatics(d, b);
  19859. function __() { this.constructor = d; }
  19860. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19861. };
  19862. })();
  19863. Object.defineProperty(exports, "__esModule", { value: true });
  19864. var MouseHandlerDraggingState_1 = __webpack_require__(24);
  19865. var AddConnectorPointHistoryItem_1 = __webpack_require__(97);
  19866. var MoveConnectorPointHistoryItem_1 = __webpack_require__(36);
  19867. var ModelUtils_1 = __webpack_require__(8);
  19868. var MouseHandlerMoveConnectorSideState = /** @class */ (function (_super) {
  19869. __extends(MouseHandlerMoveConnectorSideState, _super);
  19870. function MouseHandlerMoveConnectorSideState(handler, history, model) {
  19871. var _this = _super.call(this, handler, history) || this;
  19872. _this.model = model;
  19873. return _this;
  19874. }
  19875. MouseHandlerMoveConnectorSideState.prototype.onMouseDown = function (evt) {
  19876. this.startPoint = evt.layoutPoint;
  19877. this.connectorKey = evt.source.key;
  19878. this.pointIndex = parseInt(evt.source.value);
  19879. _super.prototype.onMouseDown.call(this, evt);
  19880. };
  19881. MouseHandlerMoveConnectorSideState.prototype.onApplyChanges = function (evt) {
  19882. var point = this.getSnappedPoint(evt, evt.layoutPoint);
  19883. if (!this.pointCreated) {
  19884. this.history.addOrModifyAndRedo(new AddConnectorPointHistoryItem_1.AddConnectorPointHistoryItem(this.connectorKey, this.pointIndex, point));
  19885. this.pointCreated = true;
  19886. }
  19887. else {
  19888. this.history.addOrModifyAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(this.connectorKey, this.pointIndex, point));
  19889. }
  19890. this.handler.tryUpdateModelSize();
  19891. };
  19892. MouseHandlerMoveConnectorSideState.prototype.onFinishWithChanges = function () {
  19893. ModelUtils_1.ModelUtils.removeUnnecessaryConnectorPoints(this.history, this.model.findConnector(this.connectorKey));
  19894. };
  19895. MouseHandlerMoveConnectorSideState.prototype.getDraggingElementKeys = function () {
  19896. return [this.connectorKey];
  19897. };
  19898. return MouseHandlerMoveConnectorSideState;
  19899. }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
  19900. exports.MouseHandlerMoveConnectorSideState = MouseHandlerMoveConnectorSideState;
  19901. /***/ }),
  19902. /* 224 */
  19903. /***/ (function(module, exports, __webpack_require__) {
  19904. "use strict";
  19905. var __extends = (this && this.__extends) || (function () {
  19906. var extendStatics = function (d, b) {
  19907. extendStatics = Object.setPrototypeOf ||
  19908. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  19909. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  19910. return extendStatics(d, b);
  19911. };
  19912. return function (d, b) {
  19913. extendStatics(d, b);
  19914. function __() { this.constructor = d; }
  19915. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19916. };
  19917. })();
  19918. Object.defineProperty(exports, "__esModule", { value: true });
  19919. var MouseHandlerDraggingState_1 = __webpack_require__(24);
  19920. var ChangeShapeParametersHistoryItem_1 = __webpack_require__(225);
  19921. var MouseHandlerDragParameterPointState = /** @class */ (function (_super) {
  19922. __extends(MouseHandlerDragParameterPointState, _super);
  19923. function MouseHandlerDragParameterPointState(handler, history, model) {
  19924. var _this = _super.call(this, handler, history) || this;
  19925. _this.model = model;
  19926. _this.startScrollLeft = 0;
  19927. _this.startScrollTop = 0;
  19928. return _this;
  19929. }
  19930. MouseHandlerDragParameterPointState.prototype.onMouseDown = function (evt) {
  19931. this.startPoint = evt.layoutPoint;
  19932. this.shape = this.model.findShape(evt.source.key);
  19933. this.parameterPointKey = evt.source.value;
  19934. this.startParameters = this.shape.parameters.clone();
  19935. _super.prototype.onMouseDown.call(this, evt);
  19936. };
  19937. MouseHandlerDragParameterPointState.prototype.onApplyChanges = function (evt) {
  19938. var offsetX = this.handler.getSnappedPos(evt, evt.layoutPoint.x - this.startPoint.x);
  19939. var offsetY = this.handler.getSnappedPos(evt, evt.layoutPoint.y - this.startPoint.y);
  19940. var parameters = this.startParameters.clone();
  19941. this.shape.description.modifyParameters(this.shape, parameters, offsetX, offsetY);
  19942. this.history.addOrModifyAndRedo(new ChangeShapeParametersHistoryItem_1.ChangeShapeParametersHistoryItem(this.shape.key, parameters));
  19943. };
  19944. MouseHandlerDragParameterPointState.prototype.getDraggingElementKeys = function () {
  19945. return [this.shape.key];
  19946. };
  19947. return MouseHandlerDragParameterPointState;
  19948. }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
  19949. exports.MouseHandlerDragParameterPointState = MouseHandlerDragParameterPointState;
  19950. /***/ }),
  19951. /* 225 */
  19952. /***/ (function(module, exports, __webpack_require__) {
  19953. "use strict";
  19954. var __extends = (this && this.__extends) || (function () {
  19955. var extendStatics = function (d, b) {
  19956. extendStatics = Object.setPrototypeOf ||
  19957. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  19958. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  19959. return extendStatics(d, b);
  19960. };
  19961. return function (d, b) {
  19962. extendStatics(d, b);
  19963. function __() { this.constructor = d; }
  19964. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  19965. };
  19966. })();
  19967. Object.defineProperty(exports, "__esModule", { value: true });
  19968. var HistoryItem_1 = __webpack_require__(4);
  19969. var ChangeShapeParametersHistoryItem = /** @class */ (function (_super) {
  19970. __extends(ChangeShapeParametersHistoryItem, _super);
  19971. function ChangeShapeParametersHistoryItem(shapeKey, parameters) {
  19972. var _this = _super.call(this) || this;
  19973. _this.shapeKey = shapeKey;
  19974. _this.parameters = parameters;
  19975. return _this;
  19976. }
  19977. ChangeShapeParametersHistoryItem.prototype.redo = function (manipulator) {
  19978. var shape = manipulator.model.findShape(this.shapeKey);
  19979. this.oldParameters = shape.parameters.clone();
  19980. manipulator.changeShapeParameters(shape, this.parameters);
  19981. };
  19982. ChangeShapeParametersHistoryItem.prototype.undo = function (manipulator) {
  19983. var shape = manipulator.model.findShape(this.shapeKey);
  19984. manipulator.changeShapeParameters(shape, this.oldParameters);
  19985. };
  19986. return ChangeShapeParametersHistoryItem;
  19987. }(HistoryItem_1.HistoryItem));
  19988. exports.ChangeShapeParametersHistoryItem = ChangeShapeParametersHistoryItem;
  19989. /***/ }),
  19990. /* 226 */
  19991. /***/ (function(module, exports, __webpack_require__) {
  19992. "use strict";
  19993. var __extends = (this && this.__extends) || (function () {
  19994. var extendStatics = function (d, b) {
  19995. extendStatics = Object.setPrototypeOf ||
  19996. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  19997. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  19998. return extendStatics(d, b);
  19999. };
  20000. return function (d, b) {
  20001. extendStatics(d, b);
  20002. function __() { this.constructor = d; }
  20003. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20004. };
  20005. })();
  20006. Object.defineProperty(exports, "__esModule", { value: true });
  20007. var Event_1 = __webpack_require__(14);
  20008. var Utils_1 = __webpack_require__(0);
  20009. var SelectionRectVisualizer_1 = __webpack_require__(227);
  20010. var MouseHandlerStateBase_1 = __webpack_require__(45);
  20011. var MouseHandlerSelectionState = /** @class */ (function (_super) {
  20012. __extends(MouseHandlerSelectionState, _super);
  20013. function MouseHandlerSelectionState(handler, selection) {
  20014. var _this = _super.call(this, handler) || this;
  20015. _this.selection = selection;
  20016. return _this;
  20017. }
  20018. MouseHandlerSelectionState.prototype.cancelChanges = function () { };
  20019. MouseHandlerSelectionState.prototype.start = function () {
  20020. this.selectionRectangleVisualizer = new SelectionRectVisualizer_1.SelectionRectVisualizer(this.handler.onVisualizersUpdate);
  20021. _super.prototype.start.call(this);
  20022. };
  20023. MouseHandlerSelectionState.prototype.finish = function () {
  20024. this.selectionRectangleVisualizer.reset();
  20025. _super.prototype.finish.call(this);
  20026. };
  20027. MouseHandlerSelectionState.prototype.onMouseDown = function (evt) {
  20028. this.startPoint = evt.layoutPoint;
  20029. };
  20030. MouseHandlerSelectionState.prototype.onMouseMove = function (evt) {
  20031. if (evt.button !== Event_1.MouseButton.Left) {
  20032. this.handler.switchToDefaultState();
  20033. return;
  20034. }
  20035. var rect = Utils_1.Rectangle.createByPoints(this.startPoint, evt.layoutPoint);
  20036. this.selectionRectangleVisualizer.setRectangle(rect);
  20037. };
  20038. MouseHandlerSelectionState.prototype.onMouseUp = function (evt) {
  20039. var selectionRect = this.selectionRectangleVisualizer.getRectangle();
  20040. if (selectionRect !== undefined)
  20041. this.selection.selectRect(selectionRect);
  20042. else
  20043. this.selection.set([]);
  20044. this.handler.switchToDefaultState();
  20045. };
  20046. return MouseHandlerSelectionState;
  20047. }(MouseHandlerStateBase_1.MouseHandlerCancellableState));
  20048. exports.MouseHandlerSelectionState = MouseHandlerSelectionState;
  20049. /***/ }),
  20050. /* 227 */
  20051. /***/ (function(module, exports, __webpack_require__) {
  20052. "use strict";
  20053. Object.defineProperty(exports, "__esModule", { value: true });
  20054. var SelectionRectVisualizer = /** @class */ (function () {
  20055. function SelectionRectVisualizer(dispatcher) {
  20056. this.dispatcher = dispatcher;
  20057. }
  20058. SelectionRectVisualizer.prototype.getRectangle = function () {
  20059. return this.rect;
  20060. };
  20061. SelectionRectVisualizer.prototype.setRectangle = function (rect) {
  20062. this.rect = rect;
  20063. this.raiseShow();
  20064. };
  20065. SelectionRectVisualizer.prototype.reset = function () {
  20066. this.rect = undefined;
  20067. this.raiseHide();
  20068. };
  20069. SelectionRectVisualizer.prototype.raiseShow = function () {
  20070. var _this = this;
  20071. this.dispatcher.raise1(function (l) { return l.NotifySelectionRectShow(_this.rect); });
  20072. };
  20073. SelectionRectVisualizer.prototype.raiseHide = function () {
  20074. this.dispatcher.raise1(function (l) { return l.NotifySelectionRectHide(); });
  20075. };
  20076. return SelectionRectVisualizer;
  20077. }());
  20078. exports.SelectionRectVisualizer = SelectionRectVisualizer;
  20079. /***/ }),
  20080. /* 228 */
  20081. /***/ (function(module, exports, __webpack_require__) {
  20082. "use strict";
  20083. var __extends = (this && this.__extends) || (function () {
  20084. var extendStatics = function (d, b) {
  20085. extendStatics = Object.setPrototypeOf ||
  20086. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  20087. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  20088. return extendStatics(d, b);
  20089. };
  20090. return function (d, b) {
  20091. extendStatics(d, b);
  20092. function __() { this.constructor = d; }
  20093. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20094. };
  20095. })();
  20096. Object.defineProperty(exports, "__esModule", { value: true });
  20097. var Connector_1 = __webpack_require__(5);
  20098. var AddConnectionHistoryItem_1 = __webpack_require__(35);
  20099. var AddConnectorHistoryItem_1 = __webpack_require__(58);
  20100. var MouseHandlerMoveConnectorPointStateBase_1 = __webpack_require__(96);
  20101. var SetSelectionHistoryItem_1 = __webpack_require__(29);
  20102. var ChangeConnectorPropertyHistoryItem_1 = __webpack_require__(91);
  20103. var ChangeStyleHistoryItem_1 = __webpack_require__(63);
  20104. var ChangeStyleTextHistoryItem_1 = __webpack_require__(42);
  20105. var MouseHandlerCreateConnectorState = /** @class */ (function (_super) {
  20106. __extends(MouseHandlerCreateConnectorState, _super);
  20107. function MouseHandlerCreateConnectorState(handler, history, model, selection, connectionPointIndex) {
  20108. var _this = _super.call(this, handler, history, model) || this;
  20109. _this.selection = selection;
  20110. _this.connectionPointIndex = connectionPointIndex;
  20111. return _this;
  20112. }
  20113. MouseHandlerCreateConnectorState.prototype.onMouseDown = function (evt) {
  20114. if (this.connectionPointIndex === undefined)
  20115. this.connectionPointIndex = parseInt(evt.source.value);
  20116. this.connectedItem = this.model.findItem(evt.source.key);
  20117. this.pointIndex = 1;
  20118. this.pointPosition = Connector_1.ConnectorPosition.End;
  20119. _super.prototype.onMouseDown.call(this, evt);
  20120. };
  20121. MouseHandlerCreateConnectorState.prototype.onApplyChanges = function (evt) {
  20122. var _this = this;
  20123. var point = this.getSnappedPoint(evt, evt.layoutPoint);
  20124. if (!this.connector) {
  20125. var historyItem = new AddConnectorHistoryItem_1.AddConnectorHistoryItem([this.connectedItem.getConnectionPoint(this.connectionPointIndex, point), point]);
  20126. this.history.addOrModifyAndRedo(historyItem);
  20127. this.connector = this.model.findConnector(historyItem.connectorKey);
  20128. this.connector.properties.forEach(function (propertyName) {
  20129. _this.history.addOrModifyAndRedo(new ChangeConnectorPropertyHistoryItem_1.ChangeConnectorPropertyHistoryItem(_this.connector.key, propertyName, _this.selection.inputPosition.getConnectorPropertyDefaultValue(propertyName)));
  20130. });
  20131. this.connector.style.forEach(function (propertyName) {
  20132. _this.history.addOrModifyAndRedo(new ChangeStyleHistoryItem_1.ChangeStyleHistoryItem(_this.connector.key, propertyName, _this.selection.inputPosition.getStylePropertyDefaultValue(propertyName)));
  20133. });
  20134. this.connector.styleText.forEach(function (propertyName) {
  20135. _this.history.addOrModifyAndRedo(new ChangeStyleTextHistoryItem_1.ChangeStyleTextHistoryItem(_this.connector.key, propertyName, _this.selection.inputPosition.getStyleTextPropertyDefaultValue(propertyName)));
  20136. });
  20137. this.history.addOrModifyAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(this.connector, this.connectedItem, this.connectionPointIndex, Connector_1.ConnectorPosition.Begin));
  20138. }
  20139. else
  20140. _super.prototype.onApplyChanges.call(this, evt);
  20141. };
  20142. MouseHandlerCreateConnectorState.prototype.onFinishWithChanges = function () {
  20143. this.history.addAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(this.selection, [this.connector.key]));
  20144. };
  20145. return MouseHandlerCreateConnectorState;
  20146. }(MouseHandlerMoveConnectorPointStateBase_1.MouseHandlerMoveConnectorPointStateBase));
  20147. exports.MouseHandlerCreateConnectorState = MouseHandlerCreateConnectorState;
  20148. /***/ }),
  20149. /* 229 */
  20150. /***/ (function(module, exports, __webpack_require__) {
  20151. "use strict";
  20152. var __extends = (this && this.__extends) || (function () {
  20153. var extendStatics = function (d, b) {
  20154. extendStatics = Object.setPrototypeOf ||
  20155. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  20156. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  20157. return extendStatics(d, b);
  20158. };
  20159. return function (d, b) {
  20160. extendStatics(d, b);
  20161. function __() { this.constructor = d; }
  20162. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20163. };
  20164. })();
  20165. Object.defineProperty(exports, "__esModule", { value: true });
  20166. var Utils_1 = __webpack_require__(0);
  20167. var Connector_1 = __webpack_require__(5);
  20168. var MouseHandlerDraggingState_1 = __webpack_require__(24);
  20169. var AddConnectorPointHistoryItem_1 = __webpack_require__(97);
  20170. var MoveConnectorPointHistoryItem_1 = __webpack_require__(36);
  20171. var ModelUtils_1 = __webpack_require__(8);
  20172. var DiagramItem_1 = __webpack_require__(3);
  20173. var MouseHandlerMoveConnectorOrthogonalSideState = /** @class */ (function (_super) {
  20174. __extends(MouseHandlerMoveConnectorOrthogonalSideState, _super);
  20175. function MouseHandlerMoveConnectorOrthogonalSideState(handler, history, model) {
  20176. var _this = _super.call(this, handler, history) || this;
  20177. _this.model = model;
  20178. return _this;
  20179. }
  20180. MouseHandlerMoveConnectorOrthogonalSideState.prototype.onMouseDown = function (evt) {
  20181. this.startPoint = evt.layoutPoint;
  20182. this.connector = this.model.findConnector(evt.source.key);
  20183. var renderPointIndexes = evt.source.value.split("_");
  20184. var renderPointIndex1 = parseInt(renderPointIndexes[0]);
  20185. var renderPointIndex2 = parseInt(renderPointIndexes[1]);
  20186. var points = this.connector.getRenderPoints(true);
  20187. this.renderPoint1 = points[renderPointIndex1].clone();
  20188. this.renderPoint2 = points[renderPointIndex2].clone();
  20189. this.isVerticalOrientation = this.renderPoint1.x === this.renderPoint2.x;
  20190. if (this.renderPoint1.pointIndex !== -1) {
  20191. this.pointIndex1 = this.renderPoint1.pointIndex;
  20192. if (this.pointIndex1 === 0) {
  20193. this.pointIndex1++;
  20194. this.correctEdgePoint(this.renderPoint1, this.renderPoint2, this.connector.beginItem, this.connector.beginConnectionPointIndex);
  20195. }
  20196. else
  20197. this.point1 = this.connector.points[this.pointIndex1];
  20198. }
  20199. else
  20200. this.pointIndex1 = this.findPointIndex(points, renderPointIndex1, false) + 1;
  20201. if (this.renderPoint2.pointIndex !== -1) {
  20202. this.pointIndex2 = this.renderPoint2.pointIndex;
  20203. if (this.pointIndex2 === this.connector.points.length - 1) {
  20204. this.correctEdgePoint(this.renderPoint2, this.renderPoint1, this.connector.endItem, this.connector.endConnectionPointIndex);
  20205. }
  20206. else
  20207. this.point2 = this.connector.points[this.pointIndex2];
  20208. }
  20209. else
  20210. this.pointIndex2 = this.findPointIndex(points, renderPointIndex2, true);
  20211. _super.prototype.onMouseDown.call(this, evt);
  20212. };
  20213. MouseHandlerMoveConnectorOrthogonalSideState.prototype.onApplyChanges = function (evt) {
  20214. var _this = this;
  20215. if (!this.pointCreated) {
  20216. var createdPoint1 = void 0, createdPoint2 = void 0;
  20217. if (this.point1 === undefined) {
  20218. this.point1 = new Utils_1.Point(this.renderPoint1.x, this.renderPoint1.y);
  20219. this.history.addOrModifyAndRedo(new AddConnectorPointHistoryItem_1.AddConnectorPointHistoryItem(this.connector.key, this.pointIndex1, this.point1));
  20220. createdPoint1 = this.point1;
  20221. this.pointIndex2++;
  20222. }
  20223. if (this.point2 === undefined) {
  20224. this.point2 = new Utils_1.Point(this.renderPoint2.x, this.renderPoint2.y);
  20225. this.history.addOrModifyAndRedo(new AddConnectorPointHistoryItem_1.AddConnectorPointHistoryItem(this.connector.key, this.pointIndex2, this.point2));
  20226. createdPoint2 = this.point2;
  20227. }
  20228. ModelUtils_1.ModelUtils.removeUnnecessaryConnectorPoints(this.history, this.connector, [createdPoint1, createdPoint2], function (index) {
  20229. if (index < _this.pointIndex1)
  20230. _this.pointIndex1--;
  20231. if (index < _this.pointIndex2)
  20232. _this.pointIndex2--;
  20233. });
  20234. this.pointCreated = true;
  20235. }
  20236. var point = this.getSnappedPoint(evt, evt.layoutPoint);
  20237. if (this.isVerticalOrientation) {
  20238. this.point1.x = point.x;
  20239. this.point2.x = point.x;
  20240. }
  20241. else {
  20242. this.point1.y = point.y;
  20243. this.point2.y = point.y;
  20244. }
  20245. this.history.addOrModifyAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(this.connector.key, this.pointIndex1, this.point1));
  20246. this.history.addOrModifyAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(this.connector.key, this.pointIndex2, this.point2));
  20247. this.handler.tryUpdateModelSize();
  20248. };
  20249. MouseHandlerMoveConnectorOrthogonalSideState.prototype.onFinishWithChanges = function () {
  20250. ModelUtils_1.ModelUtils.removeUnnecessaryConnectorPoints(this.history, this.connector);
  20251. };
  20252. MouseHandlerMoveConnectorOrthogonalSideState.prototype.findPointIndex = function (points, index, direction) {
  20253. var point;
  20254. while (point = points[index]) {
  20255. if (point.pointIndex !== -1)
  20256. return point.pointIndex;
  20257. index += direction ? 1 : -1;
  20258. }
  20259. };
  20260. MouseHandlerMoveConnectorOrthogonalSideState.prototype.correctEdgePoint = function (point, directionPoint, item, connectionPointIndex) {
  20261. var offset = 0;
  20262. if (item !== undefined) {
  20263. var side = item.getConnectionPointSide(connectionPointIndex);
  20264. var rect = item.rectangle;
  20265. offset = Connector_1.Connector.minOffset;
  20266. switch (side) {
  20267. case DiagramItem_1.ConnectionPointSide.South:
  20268. offset += rect.bottom - point.y;
  20269. break;
  20270. case DiagramItem_1.ConnectionPointSide.North:
  20271. offset += point.y - rect.top;
  20272. break;
  20273. case DiagramItem_1.ConnectionPointSide.East:
  20274. offset += rect.right - point.x;
  20275. break;
  20276. case DiagramItem_1.ConnectionPointSide.West:
  20277. offset += point.x - rect.left;
  20278. break;
  20279. }
  20280. }
  20281. if (this.isVerticalOrientation) {
  20282. if (point.y > directionPoint.y)
  20283. point.y -= Math.min(offset, point.y - directionPoint.y);
  20284. else
  20285. point.y += Math.min(offset, directionPoint.y - point.y);
  20286. }
  20287. else {
  20288. if (point.x > directionPoint.x)
  20289. point.x -= Math.min(offset, point.x - directionPoint.x);
  20290. else
  20291. point.x += Math.min(offset, directionPoint.x - point.x);
  20292. }
  20293. };
  20294. MouseHandlerMoveConnectorOrthogonalSideState.prototype.getDraggingElementKeys = function () {
  20295. return [this.connector.key];
  20296. };
  20297. return MouseHandlerMoveConnectorOrthogonalSideState;
  20298. }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
  20299. exports.MouseHandlerMoveConnectorOrthogonalSideState = MouseHandlerMoveConnectorOrthogonalSideState;
  20300. /***/ }),
  20301. /* 230 */
  20302. /***/ (function(module, exports, __webpack_require__) {
  20303. "use strict";
  20304. var __extends = (this && this.__extends) || (function () {
  20305. var extendStatics = function (d, b) {
  20306. extendStatics = Object.setPrototypeOf ||
  20307. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  20308. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  20309. return extendStatics(d, b);
  20310. };
  20311. return function (d, b) {
  20312. extendStatics(d, b);
  20313. function __() { this.constructor = d; }
  20314. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20315. };
  20316. })();
  20317. Object.defineProperty(exports, "__esModule", { value: true });
  20318. var ShapeDescriptionManager_1 = __webpack_require__(30);
  20319. var Utils_1 = __webpack_require__(0);
  20320. var AddShapeHistoryItem_1 = __webpack_require__(51);
  20321. var SetSelectionHistoryItem_1 = __webpack_require__(29);
  20322. var ChangeStyleHistoryItem_1 = __webpack_require__(63);
  20323. var ChangeStyleTextHistoryItem_1 = __webpack_require__(42);
  20324. var MouseHandlerDraggingState_1 = __webpack_require__(24);
  20325. var DeleteShapeHistoryItem_1 = __webpack_require__(74);
  20326. var ModelUtils_1 = __webpack_require__(8);
  20327. var MouseHandlerStateBase_1 = __webpack_require__(45);
  20328. var NON_DOCUMENT_TIMER = 500;
  20329. var LOCK_UPDATEPAGESIZE_TIMER = 300;
  20330. var MouseHandlerBeforeToolboxDraggingState = /** @class */ (function (_super) {
  20331. __extends(MouseHandlerBeforeToolboxDraggingState, _super);
  20332. function MouseHandlerBeforeToolboxDraggingState(handler, history, model, selection) {
  20333. var _this = _super.call(this, handler) || this;
  20334. _this.history = history;
  20335. _this.model = model;
  20336. _this.selection = selection;
  20337. return _this;
  20338. }
  20339. MouseHandlerBeforeToolboxDraggingState.prototype.cancelChanges = function () {
  20340. this.tryRemoveTimer();
  20341. };
  20342. MouseHandlerBeforeToolboxDraggingState.prototype.onDragStart = function (evt) {
  20343. this.dragging = evt;
  20344. };
  20345. MouseHandlerBeforeToolboxDraggingState.prototype.onDragEnd = function (evt) {
  20346. this.cancelChanges();
  20347. this.handler.switchToDefaultState();
  20348. };
  20349. MouseHandlerBeforeToolboxDraggingState.prototype.onMouseMove = function (evt) {
  20350. var _this = this;
  20351. if (this.canSwitchToDraggingState(evt)) {
  20352. this.tryRemoveTimer();
  20353. this.switchToDraggingState(evt, false);
  20354. }
  20355. else if (evt.source.type !== undefined) {
  20356. this.savedEvt = evt;
  20357. if (this.nonPageAreaTimer === undefined)
  20358. this.nonPageAreaTimer = setTimeout(function () { return _this.switchToDraggingState(_this.savedEvt, true); }, NON_DOCUMENT_TIMER);
  20359. }
  20360. else if (this.nonPageAreaTimer !== undefined)
  20361. this.tryRemoveTimer();
  20362. };
  20363. MouseHandlerBeforeToolboxDraggingState.prototype.switchToDraggingState = function (evt, skipLockUpdatePageSize) {
  20364. this.handler.switchState(new MouseHandlerToolboxDraggingState(this.handler, this.history, this.model, this.selection, skipLockUpdatePageSize));
  20365. this.handler.state.onDragStart(this.dragging);
  20366. this.handler.state.onMouseMove(evt);
  20367. };
  20368. MouseHandlerBeforeToolboxDraggingState.prototype.canSwitchToDraggingState = function (evt) {
  20369. return evt.source.type !== undefined &&
  20370. evt.layoutPoint.x >= 0 && evt.layoutPoint.x <= this.model.size.width &&
  20371. evt.layoutPoint.y >= 0 && evt.layoutPoint.y <= this.model.size.height;
  20372. };
  20373. MouseHandlerBeforeToolboxDraggingState.prototype.tryRemoveTimer = function () {
  20374. if (this.nonPageAreaTimer !== undefined) {
  20375. clearTimeout(this.nonPageAreaTimer);
  20376. delete this.nonPageAreaTimer;
  20377. }
  20378. };
  20379. MouseHandlerBeforeToolboxDraggingState.prototype.finish = function () {
  20380. this.tryRemoveTimer();
  20381. };
  20382. return MouseHandlerBeforeToolboxDraggingState;
  20383. }(MouseHandlerStateBase_1.MouseHandlerCancellableState));
  20384. exports.MouseHandlerBeforeToolboxDraggingState = MouseHandlerBeforeToolboxDraggingState;
  20385. var MouseHandlerToolboxDraggingState = /** @class */ (function (_super) {
  20386. __extends(MouseHandlerToolboxDraggingState, _super);
  20387. function MouseHandlerToolboxDraggingState(handler, history, model, selection, skipLockUpdatePageSize) {
  20388. var _this = _super.call(this, handler, history) || this;
  20389. _this.model = model;
  20390. _this.selection = selection;
  20391. if (!skipLockUpdatePageSize) {
  20392. _this.updatePageSizeTimer = setTimeout(function () {
  20393. _this.handler.tryUpdateModelSize();
  20394. delete _this.updatePageSizeTimer;
  20395. }, LOCK_UPDATEPAGESIZE_TIMER);
  20396. }
  20397. return _this;
  20398. }
  20399. MouseHandlerToolboxDraggingState.prototype.onMouseMove = function (evt) {
  20400. _super.prototype.onMouseMove.call(this, evt);
  20401. var shape = this.model.findShape(this.shapeKey);
  20402. if (shape)
  20403. this.handler.setExtensionLines([shape]);
  20404. };
  20405. MouseHandlerToolboxDraggingState.prototype.getDraggingElementKeys = function () {
  20406. return this.shapeKey === undefined ? [] : [this.shapeKey];
  20407. };
  20408. MouseHandlerToolboxDraggingState.prototype.onApplyChanges = function (evt) {
  20409. if (evt.source.type === undefined) {
  20410. this.dragging.onCaptured(false);
  20411. if (this.shapeKey !== undefined && !this.deleteHistoryItem) {
  20412. this.deleteHistoryItem = new DeleteShapeHistoryItem_1.DeleteShapeHistoryItem(this.shapeKey);
  20413. this.history.addOrModifyAndRedo(this.deleteHistoryItem);
  20414. }
  20415. return;
  20416. }
  20417. this.dragging.onCaptured(true);
  20418. if (this.shapeKey === undefined) {
  20419. this.startPoint = evt.layoutPoint;
  20420. this.shapeKey = this.insertToolboxItem(evt);
  20421. }
  20422. if (this.deleteHistoryItem) {
  20423. this.history.undoTransactionTo(this.deleteHistoryItem);
  20424. delete this.deleteHistoryItem;
  20425. }
  20426. var pos = this.getPosition(evt, this.startShapePosition);
  20427. ModelUtils_1.ModelUtils.setShapePosition(this.history, this.model, this.shapeKey, pos, this.history.addOrModifyAndRedo);
  20428. if (this.updatePageSizeTimer === undefined)
  20429. this.handler.tryUpdateModelSize();
  20430. };
  20431. MouseHandlerToolboxDraggingState.prototype.onFinishWithChanges = function () {
  20432. this.history.addOrModifyAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(this.selection, [this.shapeKey]));
  20433. };
  20434. MouseHandlerToolboxDraggingState.prototype.onDragStart = function (evt) {
  20435. this.dragging = evt;
  20436. };
  20437. MouseHandlerToolboxDraggingState.prototype.onDragEnd = function (evt) {
  20438. if (this.shapeKey !== undefined && evt.source.type === undefined)
  20439. this.cancelChanges();
  20440. this.handler.switchToDefaultState();
  20441. };
  20442. MouseHandlerToolboxDraggingState.prototype.finish = function () {
  20443. this.handler.resetExtensionLines();
  20444. this.dragging.onFinishDragging();
  20445. _super.prototype.finish.call(this);
  20446. };
  20447. MouseHandlerToolboxDraggingState.prototype.updateShapeProperties = function (itemKey) {
  20448. var _this = this;
  20449. this.selection.inputPosition.stylePropertiesDefault.forEach(function (propertyName) {
  20450. _this.history.addOrModifyAndRedo(new ChangeStyleHistoryItem_1.ChangeStyleHistoryItem(itemKey, propertyName, _this.selection.inputPosition.getStylePropertyDefaultValue(propertyName)));
  20451. });
  20452. this.selection.inputPosition.styleTextPropertiesDefault.forEach(function (propertyName) {
  20453. _this.history.addOrModifyAndRedo(new ChangeStyleTextHistoryItem_1.ChangeStyleTextHistoryItem(itemKey, propertyName, _this.selection.inputPosition.getStyleTextPropertyValue(propertyName)));
  20454. });
  20455. };
  20456. MouseHandlerToolboxDraggingState.prototype.insertToolboxItem = function (evt) {
  20457. var description = ShapeDescriptionManager_1.ShapeDescriptionManager.get(this.dragging.shapeType);
  20458. this.startShapePosition = this.getSnappedPoint(evt, new Utils_1.Point(evt.layoutPoint.x - description.defaultSize.width / 2, evt.layoutPoint.y - description.defaultSize.height / 2));
  20459. var historyItem = new AddShapeHistoryItem_1.AddShapeHistoryItem(this.dragging.shapeType, this.startShapePosition, this.dragging.item && this.dragging.item.text);
  20460. this.history.addOrModifyAndRedo(historyItem);
  20461. this.updateShapeProperties(historyItem.shapeKey);
  20462. return historyItem.shapeKey;
  20463. };
  20464. MouseHandlerToolboxDraggingState.prototype.getPosition = function (evt, basePoint) {
  20465. return this.getSnappedPoint(evt, new Utils_1.Point(basePoint.x + evt.layoutPoint.x - this.startPoint.x, basePoint.y + evt.layoutPoint.y - this.startPoint.y));
  20466. };
  20467. return MouseHandlerToolboxDraggingState;
  20468. }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
  20469. exports.MouseHandlerToolboxDraggingState = MouseHandlerToolboxDraggingState;
  20470. /***/ }),
  20471. /* 231 */
  20472. /***/ (function(module, exports, __webpack_require__) {
  20473. "use strict";
  20474. var __extends = (this && this.__extends) || (function () {
  20475. var extendStatics = function (d, b) {
  20476. extendStatics = Object.setPrototypeOf ||
  20477. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  20478. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  20479. return extendStatics(d, b);
  20480. };
  20481. return function (d, b) {
  20482. extendStatics(d, b);
  20483. function __() { this.constructor = d; }
  20484. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20485. };
  20486. })();
  20487. Object.defineProperty(exports, "__esModule", { value: true });
  20488. var MouseHandlerDraggingState_1 = __webpack_require__(24);
  20489. var ChangeConnectorTextPositionHistoryItem_1 = __webpack_require__(232);
  20490. var ChangeConnectorTextHistoryItem_1 = __webpack_require__(98);
  20491. var MouseHandlerMoveConnectorTextState = /** @class */ (function (_super) {
  20492. __extends(MouseHandlerMoveConnectorTextState, _super);
  20493. function MouseHandlerMoveConnectorTextState(handler, history, model) {
  20494. var _this = _super.call(this, handler, history) || this;
  20495. _this.model = model;
  20496. return _this;
  20497. }
  20498. MouseHandlerMoveConnectorTextState.prototype.onMouseDown = function (evt) {
  20499. this.connector = this.model.findConnector(evt.source.key);
  20500. this.position = parseFloat(evt.source.value);
  20501. this.text = this.connector.getText(this.position);
  20502. this.savedText = "";
  20503. _super.prototype.onMouseDown.call(this, evt);
  20504. };
  20505. MouseHandlerMoveConnectorTextState.prototype.onApplyChanges = function (evt) {
  20506. var newPosition = this.connector.getTextPositionByPoint(evt.layoutPoint);
  20507. if (newPosition != this.position) {
  20508. var text = this.connector.getText(newPosition);
  20509. if (text !== "" && text !== this.text) {
  20510. this.history.addAndRedo(new ChangeConnectorTextHistoryItem_1.ChangeConnectorTextHistoryItem(this.connector, newPosition, ""));
  20511. this.savedText = text;
  20512. }
  20513. this.history.addOrModifyAndRedo(new ChangeConnectorTextPositionHistoryItem_1.ChangeConnectorTextPositionHistoryItem(this.connector, this.position, newPosition));
  20514. if (this.savedText !== "" && this.savedText !== text) {
  20515. this.history.addAndRedo(new ChangeConnectorTextHistoryItem_1.ChangeConnectorTextHistoryItem(this.connector, this.position, this.savedText));
  20516. this.savedText = "";
  20517. }
  20518. this.position = newPosition;
  20519. }
  20520. };
  20521. MouseHandlerMoveConnectorTextState.prototype.getDraggingElementKeys = function () {
  20522. return [this.connector.key];
  20523. };
  20524. return MouseHandlerMoveConnectorTextState;
  20525. }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
  20526. exports.MouseHandlerMoveConnectorTextState = MouseHandlerMoveConnectorTextState;
  20527. /***/ }),
  20528. /* 232 */
  20529. /***/ (function(module, exports, __webpack_require__) {
  20530. "use strict";
  20531. var __extends = (this && this.__extends) || (function () {
  20532. var extendStatics = function (d, b) {
  20533. extendStatics = Object.setPrototypeOf ||
  20534. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  20535. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  20536. return extendStatics(d, b);
  20537. };
  20538. return function (d, b) {
  20539. extendStatics(d, b);
  20540. function __() { this.constructor = d; }
  20541. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20542. };
  20543. })();
  20544. Object.defineProperty(exports, "__esModule", { value: true });
  20545. var HistoryItem_1 = __webpack_require__(4);
  20546. var ChangeConnectorTextPositionHistoryItem = /** @class */ (function (_super) {
  20547. __extends(ChangeConnectorTextPositionHistoryItem, _super);
  20548. function ChangeConnectorTextPositionHistoryItem(connector, position, newPosition) {
  20549. var _this = _super.call(this) || this;
  20550. _this.connectorKey = connector.key;
  20551. _this.position = position;
  20552. _this.newPosition = newPosition;
  20553. return _this;
  20554. }
  20555. ChangeConnectorTextPositionHistoryItem.prototype.redo = function (manipulator) {
  20556. var connector = manipulator.model.findConnector(this.connectorKey);
  20557. manipulator.changeConnectorTextPosition(connector, this.position, this.newPosition);
  20558. };
  20559. ChangeConnectorTextPositionHistoryItem.prototype.undo = function (manipulator) {
  20560. var connector = manipulator.model.findConnector(this.connectorKey);
  20561. manipulator.changeConnectorTextPosition(connector, this.newPosition, this.position);
  20562. };
  20563. return ChangeConnectorTextPositionHistoryItem;
  20564. }(HistoryItem_1.HistoryItem));
  20565. exports.ChangeConnectorTextPositionHistoryItem = ChangeConnectorTextPositionHistoryItem;
  20566. /***/ }),
  20567. /* 233 */
  20568. /***/ (function(module, exports, __webpack_require__) {
  20569. "use strict";
  20570. var __extends = (this && this.__extends) || (function () {
  20571. var extendStatics = function (d, b) {
  20572. extendStatics = Object.setPrototypeOf ||
  20573. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  20574. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  20575. return extendStatics(d, b);
  20576. };
  20577. return function (d, b) {
  20578. extendStatics(d, b);
  20579. function __() { this.constructor = d; }
  20580. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20581. };
  20582. })();
  20583. Object.defineProperty(exports, "__esModule", { value: true });
  20584. var ConnectionPointsVisualizerBase_1 = __webpack_require__(67);
  20585. var ConnectionPointsVisualizer = /** @class */ (function (_super) {
  20586. __extends(ConnectionPointsVisualizer, _super);
  20587. function ConnectionPointsVisualizer(dispatcher) {
  20588. return _super.call(this, dispatcher) || this;
  20589. }
  20590. ConnectionPointsVisualizer.prototype.raiseShow = function () {
  20591. var _this = this;
  20592. this.dispatcher.raise1(function (l) { return l.NotifyConnectionPointsShow(_this.key, _this.points, _this.pointIndex); });
  20593. };
  20594. ConnectionPointsVisualizer.prototype.raiseHide = function () {
  20595. this.dispatcher.raise1(function (l) { return l.NotifyConnectionPointsHide(); });
  20596. };
  20597. return ConnectionPointsVisualizer;
  20598. }(ConnectionPointsVisualizerBase_1.ConnectionPointsVisualizerBase));
  20599. exports.ConnectionPointsVisualizer = ConnectionPointsVisualizer;
  20600. /***/ }),
  20601. /* 234 */
  20602. /***/ (function(module, exports, __webpack_require__) {
  20603. "use strict";
  20604. var __extends = (this && this.__extends) || (function () {
  20605. var extendStatics = function (d, b) {
  20606. extendStatics = Object.setPrototypeOf ||
  20607. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  20608. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  20609. return extendStatics(d, b);
  20610. };
  20611. return function (d, b) {
  20612. extendStatics(d, b);
  20613. function __() { this.constructor = d; }
  20614. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20615. };
  20616. })();
  20617. Object.defineProperty(exports, "__esModule", { value: true });
  20618. var ConnectionPointsVisualizerBase_1 = __webpack_require__(67);
  20619. var ConnectionMarksVisualizer = /** @class */ (function (_super) {
  20620. __extends(ConnectionMarksVisualizer, _super);
  20621. function ConnectionMarksVisualizer(dispatcher) {
  20622. return _super.call(this, dispatcher) || this;
  20623. }
  20624. ConnectionMarksVisualizer.prototype.raiseShow = function () {
  20625. var _this = this;
  20626. this.dispatcher.raise1(function (l) { return l.NotifyConnectionMarksShow(_this.key, _this.points, _this.pointIndex); });
  20627. };
  20628. ConnectionMarksVisualizer.prototype.raiseHide = function () {
  20629. this.dispatcher.raise1(function (l) { return l.NotifyConnectionMarksHide(); });
  20630. };
  20631. return ConnectionMarksVisualizer;
  20632. }(ConnectionPointsVisualizerBase_1.ConnectionPointsVisualizerBase));
  20633. exports.ConnectionMarksVisualizer = ConnectionMarksVisualizer;
  20634. /***/ }),
  20635. /* 235 */
  20636. /***/ (function(module, exports, __webpack_require__) {
  20637. "use strict";
  20638. Object.defineProperty(exports, "__esModule", { value: true });
  20639. var ConnectionTargetVisualizer = /** @class */ (function () {
  20640. function ConnectionTargetVisualizer(dispatcher) {
  20641. this.dispatcher = dispatcher;
  20642. }
  20643. ConnectionTargetVisualizer.prototype.getKey = function () {
  20644. return this.key;
  20645. };
  20646. ConnectionTargetVisualizer.prototype.setTargetRect = function (key, targetRect) {
  20647. if (this.key !== key) {
  20648. this.key = key;
  20649. this.targetRect = targetRect;
  20650. this.raiseShow();
  20651. }
  20652. };
  20653. ConnectionTargetVisualizer.prototype.reset = function () {
  20654. if (this.key !== "-1") {
  20655. this.key = "-1";
  20656. this.targetRect = undefined;
  20657. this.raiseHide();
  20658. }
  20659. };
  20660. ConnectionTargetVisualizer.prototype.raiseShow = function () {
  20661. var _this = this;
  20662. this.dispatcher.raise1(function (l) { return l.NotifyConnectionTargetShow(_this.key, _this.targetRect); });
  20663. };
  20664. ConnectionTargetVisualizer.prototype.raiseHide = function () {
  20665. this.dispatcher.raise1(function (l) { return l.NotifyConnectionTargetHide(); });
  20666. };
  20667. return ConnectionTargetVisualizer;
  20668. }());
  20669. exports.ConnectionTargetVisualizer = ConnectionTargetVisualizer;
  20670. /***/ }),
  20671. /* 236 */
  20672. /***/ (function(module, exports, __webpack_require__) {
  20673. "use strict";
  20674. Object.defineProperty(exports, "__esModule", { value: true });
  20675. var ChangeShapeTextHistoryItem_1 = __webpack_require__(237);
  20676. var Event_1 = __webpack_require__(14);
  20677. var KeyCode_1 = __webpack_require__(16);
  20678. var Shape_1 = __webpack_require__(9);
  20679. var Connector_1 = __webpack_require__(5);
  20680. var ChangeConnectorTextHistoryItem_1 = __webpack_require__(98);
  20681. var TextInputHandler = /** @class */ (function () {
  20682. function TextInputHandler(control) {
  20683. this.control = control;
  20684. }
  20685. TextInputHandler.prototype.startTextInput = function (item, position) {
  20686. if (item.locked || !item.allowHasText)
  20687. return;
  20688. this.control.beginUpdate();
  20689. this.textInputItem = item;
  20690. if (this.textInputItem instanceof Shape_1.Shape) {
  20691. var textRect = this.textInputItem.textRectangle;
  20692. this.control.eventManager.raiseTextInputStart(this.textInputItem, this.textInputItem.text, textRect.position, textRect.size);
  20693. }
  20694. if (this.textInputItem instanceof Connector_1.Connector) {
  20695. this.textInputPosition = position;
  20696. this.control.eventManager.raiseTextInputStart(this.textInputItem, this.textInputItem.getText(this.textInputPosition), this.textInputItem.getTextPoint(this.textInputPosition));
  20697. }
  20698. };
  20699. TextInputHandler.prototype.endTextInput = function () {
  20700. this.control.eventManager.raiseTextInputEnd(this.textInputItem);
  20701. delete this.textInputItem;
  20702. this.control.endUpdate();
  20703. };
  20704. TextInputHandler.prototype.applyTextInput = function (text) {
  20705. var textInputItem = this.textInputItem;
  20706. var textInputPosition = this.textInputPosition;
  20707. // call this first to be able measure text on changes
  20708. this.endTextInput();
  20709. if (textInputItem instanceof Shape_1.Shape) {
  20710. if (textInputItem.text !== text)
  20711. this.control.history.addOrModifyAndRedo(new ChangeShapeTextHistoryItem_1.ChangeShapeTextHistoryItem(textInputItem, text));
  20712. }
  20713. else if (textInputItem instanceof Connector_1.Connector) {
  20714. if (textInputItem.getText(textInputPosition) !== text)
  20715. this.control.history.addOrModifyAndRedo(new ChangeConnectorTextHistoryItem_1.ChangeConnectorTextHistoryItem(textInputItem, textInputPosition, text));
  20716. }
  20717. };
  20718. TextInputHandler.prototype.cancelTextInput = function () {
  20719. this.endTextInput();
  20720. };
  20721. TextInputHandler.prototype.isTextInputActive = function () {
  20722. return this.textInputItem !== undefined;
  20723. };
  20724. TextInputHandler.prototype.onMouseDoubleClick = function (evt) {
  20725. if (evt.source.type === Event_1.MouseEventElementType.Shape) {
  20726. var shape = this.control.model.findShape(evt.source.key);
  20727. this.startTextInput(shape);
  20728. }
  20729. else if (evt.source.type === Event_1.MouseEventElementType.Connector) {
  20730. var connector = this.control.model.findConnector(evt.source.key);
  20731. var position = connector.getTextPositionByPoint(evt.layoutPoint);
  20732. this.startTextInput(connector, position);
  20733. }
  20734. else if (evt.source.type === Event_1.MouseEventElementType.ConnectorText) {
  20735. var connector = this.control.model.findConnector(evt.source.key);
  20736. var position = parseFloat(evt.source.value);
  20737. this.startTextInput(connector, position);
  20738. }
  20739. };
  20740. TextInputHandler.prototype.onKeyDown = function (evt) {
  20741. if (!this.isTextInputActive())
  20742. return;
  20743. if (evt.keyCode === 13 && (evt.modifiers & KeyCode_1.ModifierKey.Ctrl)) {
  20744. evt.preventDefault = true;
  20745. this.applyTextInput(evt.inputText);
  20746. }
  20747. if (evt.keyCode === 27)
  20748. this.cancelTextInput();
  20749. };
  20750. TextInputHandler.prototype.onInputBlur = function (evt) {
  20751. if (this.isTextInputActive())
  20752. this.applyTextInput(evt.inputText);
  20753. };
  20754. TextInputHandler.prototype.onInputFocus = function (evt) {
  20755. };
  20756. return TextInputHandler;
  20757. }());
  20758. exports.TextInputHandler = TextInputHandler;
  20759. /***/ }),
  20760. /* 237 */
  20761. /***/ (function(module, exports, __webpack_require__) {
  20762. "use strict";
  20763. var __extends = (this && this.__extends) || (function () {
  20764. var extendStatics = function (d, b) {
  20765. extendStatics = Object.setPrototypeOf ||
  20766. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  20767. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  20768. return extendStatics(d, b);
  20769. };
  20770. return function (d, b) {
  20771. extendStatics(d, b);
  20772. function __() { this.constructor = d; }
  20773. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  20774. };
  20775. })();
  20776. Object.defineProperty(exports, "__esModule", { value: true });
  20777. var HistoryItem_1 = __webpack_require__(4);
  20778. var ChangeShapeTextHistoryItem = /** @class */ (function (_super) {
  20779. __extends(ChangeShapeTextHistoryItem, _super);
  20780. function ChangeShapeTextHistoryItem(item, text) {
  20781. var _this = _super.call(this) || this;
  20782. _this.shapeKey = item.key;
  20783. _this.text = text;
  20784. return _this;
  20785. }
  20786. ChangeShapeTextHistoryItem.prototype.redo = function (manipulator) {
  20787. var item = manipulator.model.findShape(this.shapeKey);
  20788. this.oldText = item.text;
  20789. manipulator.changeShapeText(item, this.text);
  20790. };
  20791. ChangeShapeTextHistoryItem.prototype.undo = function (manipulator) {
  20792. var item = manipulator.model.findShape(this.shapeKey);
  20793. manipulator.changeShapeText(item, this.oldText);
  20794. };
  20795. return ChangeShapeTextHistoryItem;
  20796. }(HistoryItem_1.HistoryItem));
  20797. exports.ChangeShapeTextHistoryItem = ChangeShapeTextHistoryItem;
  20798. /***/ }),
  20799. /* 238 */
  20800. /***/ (function(module, exports, __webpack_require__) {
  20801. "use strict";
  20802. Object.defineProperty(exports, "__esModule", { value: true });
  20803. var Utils_1 = __webpack_require__(0);
  20804. var SelectionController = /** @class */ (function () {
  20805. function SelectionController(selection) {
  20806. this.onSelectionChanged = new Utils_1.EventDispatcher();
  20807. this.selection = selection;
  20808. this.selection.onChanged.add(this);
  20809. }
  20810. SelectionController.prototype.NotifyModelChanged = function (changes) {
  20811. for (var i = 0, change; change = changes[i]; i++) {
  20812. if (this.selection.hasKey(change.key)) {
  20813. this.raiseUpdateSelection();
  20814. return;
  20815. }
  20816. }
  20817. };
  20818. SelectionController.prototype.NotifySelectionChanged = function (selection) {
  20819. this.raiseUpdateSelection();
  20820. };
  20821. SelectionController.prototype.raiseUpdateSelection = function () {
  20822. this.onSelectionChanged.raise("NotifyRedrawSelection", this.selection);
  20823. };
  20824. return SelectionController;
  20825. }());
  20826. exports.SelectionController = SelectionController;
  20827. /***/ }),
  20828. /* 239 */
  20829. /***/ (function(module, exports, __webpack_require__) {
  20830. "use strict";
  20831. Object.defineProperty(exports, "__esModule", { value: true });
  20832. var Utils_1 = __webpack_require__(0);
  20833. var InputPosition_1 = __webpack_require__(240);
  20834. var Selection = /** @class */ (function () {
  20835. function Selection(model) {
  20836. this.onChanged = new Utils_1.EventDispatcher();
  20837. this.inputPosition = new InputPosition_1.InputPosition(this);
  20838. this.onChanged.add(this.inputPosition);
  20839. this.initialize(model);
  20840. }
  20841. Selection.prototype.initialize = function (model) {
  20842. this.model = model;
  20843. this.keys = [];
  20844. this.inputPosition.initialize();
  20845. };
  20846. Selection.prototype.add = function (key) {
  20847. if (this.keys.indexOf(key) < 0) { // binarySearch
  20848. this.keys.push(key);
  20849. this.raiseSelectionChanged();
  20850. }
  20851. };
  20852. Selection.prototype.remove = function (key) {
  20853. if (this.keys.indexOf(key) >= 0) { // binarySearch
  20854. this.keys.splice(this.keys.indexOf(key), 1);
  20855. this.raiseSelectionChanged();
  20856. }
  20857. };
  20858. Selection.prototype.clear = function () {
  20859. this.keys = [];
  20860. this.raiseSelectionChanged();
  20861. };
  20862. Selection.prototype.set = function (keys) {
  20863. this.keys = keys;
  20864. this.raiseSelectionChanged();
  20865. };
  20866. Selection.prototype.getKeys = function () {
  20867. return this.keys;
  20868. };
  20869. Selection.prototype.getKey = function (index) {
  20870. return this.keys[index];
  20871. };
  20872. Selection.prototype.getSelectedItems = function (includeLocked) {
  20873. var _this = this;
  20874. return this.keys.map(function (key) { return _this.model.findItem(key); }).filter(function (item) { return item && (includeLocked || !item.locked); });
  20875. };
  20876. Selection.prototype.getSelectedShapes = function (includeLocked) {
  20877. var _this = this;
  20878. return this.keys.map(function (key) { return _this.model.findShape(key); }).filter(function (shape) { return shape && (includeLocked || !shape.locked); });
  20879. };
  20880. Selection.prototype.getSelectedConnectors = function (includeLocked) {
  20881. var _this = this;
  20882. return this.keys.map(function (key) { return _this.model.findConnector(key); }).filter(function (conn) { return conn && (includeLocked || !conn.locked); });
  20883. };
  20884. Selection.prototype.hasKey = function (key) {
  20885. return this.keys.indexOf(key) >= 0;
  20886. };
  20887. Selection.prototype.isEmpty = function (includeLocked) {
  20888. return !this.getSelectedItems(includeLocked).length;
  20889. };
  20890. Selection.prototype.selectRect = function (rect) {
  20891. var keys = [];
  20892. this.model.iterateItems(function (item) {
  20893. if (item.intersectedByRect(rect))
  20894. keys.push(item.key);
  20895. });
  20896. this.set(keys);
  20897. this.raiseSelectionChanged();
  20898. };
  20899. Selection.prototype.raiseSelectionChanged = function () {
  20900. this.onChanged.raise("NotifySelectionChanged", this);
  20901. };
  20902. return Selection;
  20903. }());
  20904. exports.Selection = Selection;
  20905. /***/ }),
  20906. /* 240 */
  20907. /***/ (function(module, exports, __webpack_require__) {
  20908. "use strict";
  20909. Object.defineProperty(exports, "__esModule", { value: true });
  20910. var ConnectorProperties_1 = __webpack_require__(28);
  20911. var Style_1 = __webpack_require__(47);
  20912. var InputPosition = /** @class */ (function () {
  20913. function InputPosition(selection) {
  20914. this.selection = selection;
  20915. this.initialize();
  20916. }
  20917. InputPosition.prototype.initialize = function () {
  20918. this.reset();
  20919. this.connectorPropertiesDefault = new ConnectorProperties_1.ConnectorProperties();
  20920. this.stylePropertiesDefault = new Style_1.Style();
  20921. this.styleTextPropertiesDefault = new Style_1.StyleText();
  20922. };
  20923. InputPosition.prototype.reset = function () {
  20924. this.connectorPropertiesCurrent = null;
  20925. this.stylePropertiesCurrent = null;
  20926. this.styleTextPropertiesCurrent = null;
  20927. };
  20928. // Connectors
  20929. InputPosition.prototype.getConnectorProperties = function () {
  20930. if (!this.connectorPropertiesCurrent) {
  20931. this.connectorPropertiesCurrent = this.connectorPropertiesDefault.clone();
  20932. this.updateConnectorProperties(this.connectorPropertiesCurrent);
  20933. }
  20934. return this.connectorPropertiesCurrent;
  20935. };
  20936. InputPosition.prototype.getConnectorPropertyValue = function (propertyName) {
  20937. return this.getConnectorProperties()[propertyName];
  20938. };
  20939. InputPosition.prototype.getConnectorPropertyDefaultValue = function (propertyName) {
  20940. return this.connectorPropertiesDefault[propertyName];
  20941. };
  20942. InputPosition.prototype.setConnectorPropertyValue = function (propertyName, value) {
  20943. this.getConnectorProperties()[propertyName] = value;
  20944. this.connectorPropertiesDefault[propertyName] = value;
  20945. };
  20946. InputPosition.prototype.updateConnectorProperties = function (properties) {
  20947. var _this = this;
  20948. var connectors = this.selection.getSelectedConnectors();
  20949. properties.forEach(function (propertyName) {
  20950. _this.updatePropertyValue(properties, connectors, function (item) { return item["properties"]; }, propertyName);
  20951. });
  20952. };
  20953. // Style
  20954. InputPosition.prototype.getStyleProperties = function () {
  20955. if (!this.stylePropertiesCurrent) {
  20956. this.stylePropertiesCurrent = this.stylePropertiesDefault.clone();
  20957. this.updateStyleProperties(this.stylePropertiesCurrent, "style");
  20958. }
  20959. return this.stylePropertiesCurrent;
  20960. };
  20961. InputPosition.prototype.getStyleTextProperties = function () {
  20962. if (!this.styleTextPropertiesCurrent) {
  20963. this.styleTextPropertiesCurrent = this.styleTextPropertiesDefault.clone();
  20964. this.updateStyleProperties(this.styleTextPropertiesCurrent, "styleText");
  20965. }
  20966. return this.styleTextPropertiesCurrent;
  20967. };
  20968. InputPosition.prototype.getStylePropertyValue = function (propertyName) {
  20969. return this.getStyleProperties()[propertyName];
  20970. };
  20971. InputPosition.prototype.getStylePropertyDefaultValue = function (propertyName) {
  20972. return this.stylePropertiesDefault[propertyName];
  20973. };
  20974. InputPosition.prototype.getStyleTextPropertyValue = function (propertyName) {
  20975. return this.getStyleTextProperties()[propertyName];
  20976. };
  20977. InputPosition.prototype.getStyleTextPropertyDefaultValue = function (propertyName) {
  20978. return this.styleTextPropertiesDefault[propertyName];
  20979. };
  20980. InputPosition.prototype.setStylePropertyValue = function (propertyName, value) {
  20981. this.getStyleProperties()[propertyName] = value;
  20982. this.stylePropertiesDefault[propertyName] = value;
  20983. };
  20984. InputPosition.prototype.setStyleTextPropertyValue = function (propertyName, value) {
  20985. this.getStyleTextProperties()[propertyName] = value;
  20986. this.styleTextPropertiesDefault[propertyName] = value;
  20987. };
  20988. InputPosition.prototype.updateStyleProperties = function (style, stylePropertyName) {
  20989. var _this = this;
  20990. var items = this.selection.getSelectedItems();
  20991. style.forEach(function (propertyName) {
  20992. _this.updatePropertyValue(style, items, function (item) { return item[stylePropertyName]; }, propertyName);
  20993. });
  20994. };
  20995. InputPosition.prototype.updatePropertyValue = function (destObj, items, getSrcObj, propertyName) {
  20996. var value = undefined;
  20997. var valueAssigned = false;
  20998. items.forEach(function (item) {
  20999. var obj = getSrcObj(item);
  21000. var propertyValue = obj[propertyName];
  21001. if (value === undefined && propertyValue != undefined) {
  21002. value = propertyValue;
  21003. valueAssigned = true;
  21004. }
  21005. else if (valueAssigned && value !== propertyValue) {
  21006. value = undefined;
  21007. return;
  21008. }
  21009. });
  21010. if (valueAssigned)
  21011. destObj[propertyName] = value;
  21012. };
  21013. InputPosition.prototype.NotifySelectionChanged = function (selection) {
  21014. this.reset();
  21015. };
  21016. return InputPosition;
  21017. }());
  21018. exports.InputPosition = InputPosition;
  21019. /***/ }),
  21020. /* 241 */
  21021. /***/ (function(module, exports, __webpack_require__) {
  21022. "use strict";
  21023. Object.defineProperty(exports, "__esModule", { value: true });
  21024. var HistoryItem_1 = __webpack_require__(4);
  21025. var __1 = __webpack_require__(46);
  21026. var History = /** @class */ (function () {
  21027. function History(modelManipulator) {
  21028. this.historyItems = [];
  21029. this.currentIndex = -1;
  21030. this.incrementalId = -1;
  21031. this.transactionLevel = -1;
  21032. this.unmodifiedIndex = -1;
  21033. // need for async actions
  21034. this.currTransactionId = 0;
  21035. this.onChanged = new __1.EventDispatcher();
  21036. this.modelManipulator = modelManipulator;
  21037. }
  21038. History.prototype.isModified = function () {
  21039. if (this.unmodifiedIndex == this.currentIndex)
  21040. return false;
  21041. var startIndex = Math.min(this.unmodifiedIndex, this.currentIndex);
  21042. var endIndex = Math.max(this.unmodifiedIndex, this.currentIndex);
  21043. for (var i = startIndex + 1; i <= endIndex; i++) {
  21044. if (this.historyItems[i].changeModified())
  21045. return true;
  21046. }
  21047. return false;
  21048. };
  21049. History.prototype.undo = function () {
  21050. if (!this.canUndo())
  21051. return;
  21052. this.historyItems[this.currentIndex].undo(this.modelManipulator);
  21053. this.currentIndex--;
  21054. this.raiseChanged();
  21055. };
  21056. History.prototype.redo = function () {
  21057. if (!this.canRedo())
  21058. return;
  21059. this.currentIndex++;
  21060. this.historyItems[this.currentIndex].redo(this.modelManipulator);
  21061. this.raiseChanged();
  21062. };
  21063. History.prototype.canUndo = function () {
  21064. return this.currentIndex >= 0;
  21065. };
  21066. History.prototype.canRedo = function () {
  21067. return this.currentIndex < this.historyItems.length - 1;
  21068. };
  21069. History.prototype.beginTransaction = function () {
  21070. this.transactionLevel++;
  21071. if (this.transactionLevel == 0)
  21072. this.transaction = new HistoryItem_1.CompositionHistoryItem();
  21073. var id = this.currTransactionId++;
  21074. return id;
  21075. };
  21076. History.prototype.endTransaction = function () {
  21077. if (--this.transactionLevel >= 0)
  21078. return;
  21079. var transactionLength = this.transaction.historyItems.length;
  21080. if (transactionLength > 1)
  21081. this.addInternal(this.transaction);
  21082. else if (transactionLength == 1)
  21083. this.addInternal(this.transaction.historyItems.pop());
  21084. if (this.transaction.historyItems.length > 0)
  21085. this.raiseChanged();
  21086. delete this.transaction;
  21087. };
  21088. History.prototype.addAndRedo = function (historyItem) {
  21089. this.add(historyItem);
  21090. historyItem.redo(this.modelManipulator);
  21091. this.raiseChanged();
  21092. };
  21093. History.prototype.add = function (historyItem) {
  21094. if (this.transactionLevel >= 0)
  21095. this.transaction.add(historyItem);
  21096. else
  21097. this.addInternal(historyItem);
  21098. };
  21099. History.prototype.addInternal = function (historyItem) {
  21100. if (this.currentIndex < this.historyItems.length - 1) {
  21101. this.historyItems.splice(this.currentIndex + 1);
  21102. this.unmodifiedIndex = Math.min(this.unmodifiedIndex, this.currentIndex);
  21103. }
  21104. this.historyItems.push(historyItem);
  21105. this.currentIndex++;
  21106. this.deleteOldItems();
  21107. };
  21108. History.prototype.deleteOldItems = function () {
  21109. var exceedItemsCount = this.historyItems.length - History.MAX_HISTORY_ITEM_COUNT;
  21110. if (exceedItemsCount > 0 && this.currentIndex > exceedItemsCount) {
  21111. this.historyItems.splice(0, exceedItemsCount);
  21112. this.currentIndex -= exceedItemsCount;
  21113. }
  21114. };
  21115. History.prototype.getNextId = function () {
  21116. this.incrementalId++;
  21117. return this.incrementalId;
  21118. };
  21119. History.prototype.clear = function () {
  21120. this.currentIndex = -1;
  21121. this.unmodifiedIndex = -1;
  21122. this.incrementalId = -1;
  21123. this.historyItems = [];
  21124. delete this.transaction;
  21125. this.transactionLevel = -1;
  21126. };
  21127. History.prototype.resetModified = function () {
  21128. this.unmodifiedIndex = this.currentIndex;
  21129. };
  21130. History.prototype.getCurrentItemId = function () {
  21131. if (this.currentIndex == -1)
  21132. return -1;
  21133. var currentItem = this.historyItems[this.currentIndex];
  21134. if (currentItem.uniqueId == -1)
  21135. currentItem.uniqueId = this.getNextId();
  21136. return currentItem.uniqueId;
  21137. };
  21138. History.prototype.addOrModifyAndRedo = function (item) {
  21139. // if(!this.transaction)
  21140. // throw Error("History item modification available only in the transaction mode");
  21141. // let name = item.getName();
  21142. // let items = this.transaction.historyItems;
  21143. // for(let i = items.length - 1, foundItem: HistoryItem; foundItem = items[i]; i--) {
  21144. // if(foundItem.getName() === name) {
  21145. // items.splice(i, 1, item)[0].undo();
  21146. // item.redo();
  21147. // return;
  21148. // }
  21149. // }
  21150. this.addAndRedo(item);
  21151. };
  21152. History.prototype.undoTransaction = function () {
  21153. var items = this.transaction.historyItems;
  21154. while (items.length)
  21155. items.pop().undo(this.modelManipulator);
  21156. this.raiseChanged();
  21157. };
  21158. History.prototype.undoTransactionTo = function (item) {
  21159. var items = this.transaction.historyItems;
  21160. while (items.length) {
  21161. var ti = items.pop();
  21162. ti.undo(this.modelManipulator);
  21163. if (ti === item)
  21164. return;
  21165. }
  21166. this.raiseChanged();
  21167. };
  21168. History.prototype.raiseChanged = function () {
  21169. if (this.transactionLevel === -1)
  21170. this.onChanged.raise("NotifyHistoryChanged");
  21171. };
  21172. History.MAX_HISTORY_ITEM_COUNT = 100;
  21173. return History;
  21174. }());
  21175. exports.History = History;
  21176. /***/ }),
  21177. /* 242 */
  21178. /***/ (function(module, exports, __webpack_require__) {
  21179. "use strict";
  21180. var __extends = (this && this.__extends) || (function () {
  21181. var extendStatics = function (d, b) {
  21182. extendStatics = Object.setPrototypeOf ||
  21183. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  21184. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  21185. return extendStatics(d, b);
  21186. };
  21187. return function (d, b) {
  21188. extendStatics(d, b);
  21189. function __() { this.constructor = d; }
  21190. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21191. };
  21192. })();
  21193. Object.defineProperty(exports, "__esModule", { value: true });
  21194. var BatchUpdatableObject_1 = __webpack_require__(243);
  21195. var BarManager = /** @class */ (function (_super) {
  21196. __extends(BarManager, _super);
  21197. function BarManager(control) {
  21198. var _this = _super.call(this) || this;
  21199. _this.bars = [];
  21200. _this.control = control;
  21201. return _this;
  21202. }
  21203. BarManager.prototype.registerBar = function (bar) {
  21204. this.bars.push(bar);
  21205. bar.onChanged.add(this);
  21206. this.updateBarItemsState(bar);
  21207. };
  21208. BarManager.prototype.updateItemsState = function (queryCommands) {
  21209. if (this.isUpdateLocked())
  21210. return;
  21211. for (var i = 0, bar; bar = this.bars[i]; i++)
  21212. this.updateBarItemsState(bar, queryCommands);
  21213. };
  21214. BarManager.prototype.updateBarItemsState = function (bar, queryCommands) {
  21215. if (this.isUpdateLocked())
  21216. return;
  21217. if (bar.isVisible()) {
  21218. var commandKeys = queryCommands || bar.getCommandKeys();
  21219. var length_1 = commandKeys.length;
  21220. for (var j = 0; j < length_1; j++)
  21221. this.updateBarItem(bar, commandKeys[j]);
  21222. }
  21223. };
  21224. BarManager.prototype.updateBarItem = function (bar, commandKey) {
  21225. var command = this.control.commandManager.getCommand(commandKey);
  21226. if (command) {
  21227. var commandState = command.getState();
  21228. bar.setItemVisible(commandKey, commandState.visible);
  21229. if (commandState.visible) {
  21230. bar.setItemEnabled(commandKey, commandState.enabled);
  21231. if (!commandState.denyUpdateValue) {
  21232. var itemValue = this.getItemValue(commandState.value);
  21233. if (commandState.items)
  21234. bar.setItemSubItems(commandKey, commandState.items);
  21235. bar.setItemValue(commandKey, itemValue);
  21236. }
  21237. }
  21238. }
  21239. };
  21240. BarManager.prototype.setEnabled = function (enabled) {
  21241. for (var i = 0, bar; bar = this.bars[i]; i++)
  21242. bar.setEnabled(enabled);
  21243. };
  21244. BarManager.prototype.NotifyBarCommandExecuted = function (commandID, parameter) {
  21245. var executeResult = this.control.commandManager.getCommand(commandID).execute(parameter);
  21246. if (!executeResult)
  21247. this.updateItemsState([commandID]);
  21248. this.control.captureFocus();
  21249. };
  21250. BarManager.prototype.NotifyBarUpdateRequested = function () {
  21251. this.updateItemsState();
  21252. };
  21253. // ISelectionChangesListener
  21254. BarManager.prototype.NotifySelectionChanged = function (_selection) {
  21255. this.updateItemsState();
  21256. };
  21257. BarManager.prototype.onUpdateUnlocked = function (occurredEvents) {
  21258. this.updateItemsState(); // TODO
  21259. };
  21260. BarManager.prototype.getItemValue = function (value) {
  21261. return value;
  21262. };
  21263. return BarManager;
  21264. }(BatchUpdatableObject_1.BatchUpdatableObject));
  21265. exports.BarManager = BarManager;
  21266. /***/ }),
  21267. /* 243 */
  21268. /***/ (function(module, exports, __webpack_require__) {
  21269. "use strict";
  21270. Object.defineProperty(exports, "__esModule", { value: true });
  21271. var BatchUpdatableObject = /** @class */ (function () {
  21272. function BatchUpdatableObject() {
  21273. this.suspendUpdateCount = 0;
  21274. this.occurredEvents = 0;
  21275. }
  21276. BatchUpdatableObject.prototype.beginUpdate = function () {
  21277. if (this.suspendUpdateCount === 0)
  21278. this.onUpdateLocked();
  21279. if (this.suspendUpdateCount < 0)
  21280. this.suspendUpdateCount--;
  21281. else
  21282. this.suspendUpdateCount++;
  21283. };
  21284. BatchUpdatableObject.prototype.endUpdate = function () {
  21285. if (this.suspendUpdateCount < 0)
  21286. this.suspendUpdateCount++;
  21287. else if (this.suspendUpdateCount > 0)
  21288. this.suspendUpdateCount--;
  21289. if (!this.isUpdateLocked()) {
  21290. var occurredEvents = this.occurredEvents;
  21291. this.occurredEvents = 0;
  21292. this.onUpdateUnlocked(occurredEvents);
  21293. }
  21294. };
  21295. BatchUpdatableObject.prototype.suspendUpdate = function () {
  21296. if (this.suspendUpdateCount > 0) {
  21297. this.suspendUpdateCount *= -1;
  21298. var occurredEvents = this.occurredEvents;
  21299. this.occurredEvents = 0;
  21300. this.onUpdateUnlocked(occurredEvents);
  21301. }
  21302. };
  21303. BatchUpdatableObject.prototype.continueUpdate = function () {
  21304. if (this.suspendUpdateCount < 0)
  21305. this.suspendUpdateCount *= -1;
  21306. };
  21307. BatchUpdatableObject.prototype.isUpdateLocked = function () {
  21308. return this.suspendUpdateCount > 0;
  21309. };
  21310. BatchUpdatableObject.prototype.onUpdateLocked = function () { };
  21311. BatchUpdatableObject.prototype.registerOccurredEvent = function (eventMask) {
  21312. this.occurredEvents |= eventMask;
  21313. };
  21314. BatchUpdatableObject.prototype.isLocked = function () {
  21315. return this.suspendUpdateCount != 0;
  21316. };
  21317. return BatchUpdatableObject;
  21318. }());
  21319. exports.BatchUpdatableObject = BatchUpdatableObject;
  21320. /***/ }),
  21321. /* 244 */
  21322. /***/ (function(module, exports, __webpack_require__) {
  21323. "use strict";
  21324. var __extends = (this && this.__extends) || (function () {
  21325. var extendStatics = function (d, b) {
  21326. extendStatics = Object.setPrototypeOf ||
  21327. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  21328. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  21329. return extendStatics(d, b);
  21330. };
  21331. return function (d, b) {
  21332. extendStatics(d, b);
  21333. function __() { this.constructor = d; }
  21334. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21335. };
  21336. })();
  21337. Object.defineProperty(exports, "__esModule", { value: true });
  21338. var Toolbox_1 = __webpack_require__(99);
  21339. var ShapeDescriptionManager_1 = __webpack_require__(30);
  21340. var RenderManager_1 = __webpack_require__(10);
  21341. var Shape_1 = __webpack_require__(9);
  21342. var UnitConverter_1 = __webpack_require__(13);
  21343. var Utils_1 = __webpack_require__(0);
  21344. var TextShapeDescription_1 = __webpack_require__(76);
  21345. var ShapeToolboxManager = /** @class */ (function (_super) {
  21346. __extends(ShapeToolboxManager, _super);
  21347. function ShapeToolboxManager() {
  21348. return _super !== null && _super.apply(this, arguments) || this;
  21349. }
  21350. ShapeToolboxManager.prototype.initialize = function (element, options) {
  21351. if (!element)
  21352. return;
  21353. var el = document.createElement("div");
  21354. el.setAttribute("class", "dxdi-toolbox");
  21355. element.appendChild(el);
  21356. this.shapeIconSize = options.shapeIconSize;
  21357. this.shapeIconSpacing = options.shapeIconSpacing;
  21358. this.shapeIconAttributes = options.shapeIconAttributes;
  21359. this.createElements(el, this.getDefaultDescriptions(options.shapes));
  21360. _super.prototype.initialize.call(this, el, options);
  21361. };
  21362. ShapeToolboxManager.prototype.getDefaultDescriptions = function (shapes) {
  21363. if (Array.isArray(shapes))
  21364. return shapes;
  21365. return ShapeDescriptionManager_1.ShapeDescriptionManager.getTypesByCategory(shapes);
  21366. };
  21367. ShapeToolboxManager.prototype.createElements = function (element, shapeTypes) {
  21368. var svgElement = document.createElementNS(RenderManager_1.svgNS, "svg");
  21369. svgElement.className.baseVal = "dxdi-canvas";
  21370. element.appendChild(svgElement);
  21371. this.drawShapeIcons(svgElement, shapeTypes, svgElement.getBoundingClientRect().width);
  21372. };
  21373. ShapeToolboxManager.prototype.drawShapeIcons = function (parent, shapeTypes, svgWidth) {
  21374. var _this = this;
  21375. var lineWidth = UnitConverter_1.UnitConverter.twipsToPixels(Shape_1.Shape.lineWidth);
  21376. svgWidth -= 2 * lineWidth;
  21377. var iconCount = 1;
  21378. var width = this.shapeIconSize;
  21379. while (width < svgWidth) {
  21380. width += this.shapeIconSpacing + this.shapeIconSize;
  21381. if (width < svgWidth)
  21382. iconCount++;
  21383. }
  21384. var shapeIconSpacing = (svgWidth - this.shapeIconSize * iconCount) / (iconCount - 1);
  21385. var xPos = lineWidth, yPos = lineWidth;
  21386. shapeTypes.forEach(function (shapeType, index) {
  21387. if (index > 0 && index % iconCount === 0) {
  21388. xPos = lineWidth;
  21389. yPos += _this.shapeIconSize + shapeIconSpacing;
  21390. }
  21391. var shapeDescription = ShapeDescriptionManager_1.ShapeDescriptionManager.get(shapeType);
  21392. var shape = _this.createShape(shapeDescription, xPos, yPos);
  21393. _this.updateShapeIconBounds(shape);
  21394. _this.drawShape(parent, shape);
  21395. xPos += _this.shapeIconSize + shapeIconSpacing;
  21396. });
  21397. parent.style.height = yPos + this.shapeIconSize + lineWidth + "px";
  21398. };
  21399. ShapeToolboxManager.prototype.drawShape = function (parent, shape) {
  21400. var primitives = shape.description.createPrimitives(shape, true);
  21401. var gEl = document.createElementNS(RenderManager_1.svgNS, "g");
  21402. gEl.setAttribute("data-tb-type", shape.description.key.toString());
  21403. gEl.setAttribute("class", "toolbox-item");
  21404. gEl.setAttribute("title", shape.description.title);
  21405. for (var key in this.shapeIconAttributes) {
  21406. if (this.shapeIconAttributes.hasOwnProperty(key))
  21407. gEl.setAttribute(key, this.shapeIconAttributes[key]);
  21408. }
  21409. parent.appendChild(gEl);
  21410. primitives.forEach(function (pr) {
  21411. var el = pr.createElement();
  21412. gEl.appendChild(el);
  21413. pr.applyElementProperties(el);
  21414. });
  21415. };
  21416. ShapeToolboxManager.prototype.createShape = function (shapeDescription, xPos, yPos) {
  21417. var xPosT = UnitConverter_1.UnitConverter.pixelsToTwips(xPos);
  21418. var yPosT = UnitConverter_1.UnitConverter.pixelsToTwips(yPos);
  21419. var shape = new Shape_1.Shape(shapeDescription, new Utils_1.Point(xPosT, yPosT));
  21420. if (!(shapeDescription instanceof TextShapeDescription_1.TextShapeDescription))
  21421. shape.text = "";
  21422. return shape;
  21423. };
  21424. ShapeToolboxManager.prototype.updateShapeIconBounds = function (shape) {
  21425. var shapeSizeT = UnitConverter_1.UnitConverter.pixelsToTwips(this.shapeIconSize);
  21426. if (shape.size.width > shape.size.height) {
  21427. var ratio = shape.size.height / shape.size.width;
  21428. shape.size.width = shapeSizeT;
  21429. shape.size.height = shapeSizeT * ratio;
  21430. shape.position.y = shape.position.y + (shapeSizeT - shape.size.height) / 2;
  21431. shape.parameters.forEach(function (p) { p.value = p.value * shapeSizeT / shape.description.defaultSize.width; });
  21432. }
  21433. else if (shape.size.width < shape.size.height) {
  21434. var ratio = shape.size.width / shape.size.height;
  21435. shape.size.height = shapeSizeT;
  21436. shape.size.width = shapeSizeT * ratio;
  21437. shape.position.x = shape.position.x + (shapeSizeT - shape.size.width) / 2;
  21438. shape.parameters.forEach(function (p) { p.value = p.value * shapeSizeT / shape.description.defaultSize.height; });
  21439. }
  21440. else {
  21441. shape.size.width = shapeSizeT;
  21442. shape.size.height = shapeSizeT;
  21443. shape.parameters.forEach(function (p) { p.value = p.value * shapeSizeT / shape.description.defaultSize.width; });
  21444. }
  21445. };
  21446. ShapeToolboxManager.prototype.createDraggingObject = function (srcElement) {
  21447. var shapeType = this.getDragShapeType(srcElement);
  21448. if (shapeType !== undefined) {
  21449. var evt = new Toolbox_1.DiagramDraggingEvent();
  21450. evt.shapeType = shapeType;
  21451. return new Toolbox_1.ToolboxDraggingObject(evt);
  21452. }
  21453. return undefined;
  21454. };
  21455. ShapeToolboxManager.prototype.createDraggingElement = function (draggingObject) {
  21456. var element = document.createElement("DIV");
  21457. element.setAttribute("class", "dxdi-toolbox-drag-item");
  21458. document.body.appendChild(element);
  21459. var svgElement = document.createElementNS(RenderManager_1.svgNS, "svg");
  21460. svgElement.className.baseVal = "dxdi-canvas";
  21461. element.appendChild(svgElement);
  21462. var shapeDescription = ShapeDescriptionManager_1.ShapeDescriptionManager.get(draggingObject.evt.shapeType);
  21463. var shape = this.createShape(shapeDescription, UnitConverter_1.UnitConverter.twipsToPixels(Shape_1.Shape.lineWidth), UnitConverter_1.UnitConverter.twipsToPixels(Shape_1.Shape.lineWidth));
  21464. this.drawShape(svgElement, shape);
  21465. element.style.width = UnitConverter_1.UnitConverter.twipsToPixels(shape.size.width + 2 * Shape_1.Shape.lineWidth) + "px";
  21466. element.style.height = UnitConverter_1.UnitConverter.twipsToPixels(shape.size.height + 2 * Shape_1.Shape.lineWidth) + "px";
  21467. return element;
  21468. };
  21469. ShapeToolboxManager.prototype.getDragShapeType = function (element) {
  21470. while (element && element instanceof SVGElement) {
  21471. if (element.getAttribute("data-tb-type"))
  21472. return parseInt(element.getAttribute("data-tb-type"));
  21473. element = element.parentNode instanceof SVGElement ? element.parentNode : undefined;
  21474. }
  21475. return undefined;
  21476. };
  21477. return ShapeToolboxManager;
  21478. }(Toolbox_1.Toolbox));
  21479. exports.ShapeToolboxManager = ShapeToolboxManager;
  21480. /***/ }),
  21481. /* 245 */
  21482. /***/ (function(module, exports, __webpack_require__) {
  21483. "use strict";
  21484. var __extends = (this && this.__extends) || (function () {
  21485. var extendStatics = function (d, b) {
  21486. extendStatics = Object.setPrototypeOf ||
  21487. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  21488. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  21489. return extendStatics(d, b);
  21490. };
  21491. return function (d, b) {
  21492. extendStatics(d, b);
  21493. function __() { this.constructor = d; }
  21494. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  21495. };
  21496. })();
  21497. Object.defineProperty(exports, "__esModule", { value: true });
  21498. var Toolbox_1 = __webpack_require__(99);
  21499. var ShapeType_1 = __webpack_require__(1);
  21500. var DataToolboxManager = /** @class */ (function (_super) {
  21501. __extends(DataToolboxManager, _super);
  21502. function DataToolboxManager(key) {
  21503. var _this = _super.call(this) || this;
  21504. _this.key = key;
  21505. return _this;
  21506. }
  21507. DataToolboxManager.prototype.initialize = function (element, dataSource) {
  21508. _super.prototype.initialize.call(this, element, dataSource);
  21509. this.dataSource = dataSource;
  21510. this.createDataSourceElement(element);
  21511. };
  21512. DataToolboxManager.prototype.createDataSourceElement = function (parent) {
  21513. var _this = this;
  21514. var element = document.createElement("div");
  21515. element.setAttribute("class", "dxdi-datasource");
  21516. parent.appendChild(element);
  21517. if (this.dataSource.name && this.dataSource.name !== "") {
  21518. var header = document.createElement("div");
  21519. header.setAttribute("class", "dxdi-datasource-title");
  21520. header.innerHTML = this.dataSource.name;
  21521. element.appendChild(header);
  21522. }
  21523. this.dataSource.nodes.forEach(function (node, index) {
  21524. var itemEl = document.createElement("div");
  21525. itemEl.setAttribute("class", "dxdi-datasource-item");
  21526. itemEl.setAttribute("data-ds-key", _this.dataSource.key);
  21527. itemEl.setAttribute("data-ds-index", index.toString());
  21528. itemEl.innerHTML = node.text || node.key;
  21529. element.appendChild(itemEl);
  21530. });
  21531. };
  21532. DataToolboxManager.prototype.createDraggingElement = function (dragginObject) {
  21533. var element = document.createElement("DIV");
  21534. element.setAttribute("class", "dxdi-datasource-drag-item");
  21535. element.innerHTML = dragginObject.evt.item.text;
  21536. document.body.appendChild(element);
  21537. return element;
  21538. };
  21539. DataToolboxManager.prototype.createDraggingObject = function (srcElement) {
  21540. if (srcElement.hasAttribute("data-ds-key")) {
  21541. if (this.dataSource) {
  21542. var nodeIndex = srcElement.getAttribute("data-ds-index");
  21543. var node = this.dataSource.nodes[nodeIndex];
  21544. if (node) {
  21545. var evt = new Toolbox_1.DiagramDraggingEvent();
  21546. evt.item = node;
  21547. evt.shapeType = node.type || ShapeType_1.ShapeType.Rectangle;
  21548. evt.dataSource = this.dataSource;
  21549. return new Toolbox_1.ToolboxDraggingObject(evt);
  21550. }
  21551. }
  21552. }
  21553. };
  21554. return DataToolboxManager;
  21555. }(Toolbox_1.Toolbox));
  21556. exports.DataToolboxManager = DataToolboxManager;
  21557. /***/ }),
  21558. /* 246 */
  21559. /***/ (function(module, exports, __webpack_require__) {
  21560. "use strict";
  21561. Object.defineProperty(exports, "__esModule", { value: true });
  21562. var DiagramSettings = /** @class */ (function () {
  21563. function DiagramSettings() {
  21564. this._fullscreen = false;
  21565. }
  21566. Object.defineProperty(DiagramSettings.prototype, "fullscreen", {
  21567. get: function () { return this._fullscreen; },
  21568. set: function (value) { this._fullscreen = value; },
  21569. enumerable: true,
  21570. configurable: true
  21571. });
  21572. return DiagramSettings;
  21573. }());
  21574. exports.DiagramSettings = DiagramSettings;
  21575. /***/ }),
  21576. /* 247 */
  21577. /***/ (function(module, exports, __webpack_require__) {
  21578. // extracted by mini-css-extract-plugin
  21579. /***/ })
  21580. /******/ ]);
  21581. });