123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382 |
- import {
- A1,
- B,
- C2,
- E,
- E1,
- E2,
- I1,
- J0,
- K,
- K0 as K02,
- L1,
- M,
- N2,
- R,
- R2,
- T2,
- U2,
- Y,
- _1 as _12,
- b1,
- f0,
- g1,
- h1,
- j,
- o2,
- p1,
- u1,
- v2,
- w,
- x,
- x0,
- x1,
- x2,
- y,
- y0,
- y2,
- z0 as z02
- } from "./chunk-S77UFTYM.js";
- import {
- Ei,
- fc
- } from "./chunk-U3EPM6JO.js";
- import "./chunk-ALDCSYO3.js";
- import {
- Hr,
- Sn,
- Un,
- Ys,
- _s,
- dI,
- gr,
- ke,
- me,
- rt as rt2,
- sE,
- tE,
- ue,
- zt
- } from "./chunk-T4NNB5UY.js";
- import {
- F,
- Kd,
- Me,
- N,
- Nn,
- Pe,
- So,
- Te,
- Ut,
- V,
- _t,
- ah,
- an,
- ar as ar2,
- et,
- jr,
- os,
- po,
- qn,
- re as re2,
- xl,
- yh
- } from "./chunk-BW43Z7N3.js";
- import {
- fn,
- fr
- } from "./chunk-QRYBFJ3R.js";
- import "./chunk-MIOQ566M.js";
- import {
- $e,
- Fa,
- Kl,
- _1,
- l1,
- m1,
- n0,
- n1,
- rt
- } from "./chunk-POAJ2YNP.js";
- import {
- $O,
- BO,
- Gf,
- Po,
- QC,
- e_,
- r_,
- require_react_dom,
- sC,
- t_,
- um
- } from "./chunk-GBYP4PB2.js";
- import "./chunk-PZD7N4BC.js";
- import {
- Yx
- } from "./chunk-2MK3Q52E.js";
- import "./chunk-BSDDCPAW.js";
- import "./chunk-QG2HZMYH.js";
- import {
- Fe,
- K0,
- Mf,
- N0,
- Nt,
- OR,
- Observable,
- Ot,
- Pt,
- Ra,
- SE,
- Vn,
- Vr,
- W0,
- Ze,
- _n,
- aR,
- ar,
- b0,
- bufferTime,
- cn,
- debounceTime,
- en,
- filter,
- kt,
- merge,
- mu,
- nR,
- nt,
- nu,
- ot,
- qt,
- rR,
- re,
- tr,
- we,
- z0
- } from "./chunk-23V3HWTR.js";
- import {
- require_react
- } from "./chunk-GNR2UJZM.js";
- import {
- __toESM
- } from "./chunk-2LSFTFF7.js";
- // node_modules/.pnpm/@univerjs+sheets-conditional-formatting-ui@0.5.5_@grpc+grpc-js@1.13.4_react-dom@18.3.1_react@_h4gcegjyobiq65nckvs3tiw5ty/node_modules/@univerjs/sheets-conditional-formatting-ui/lib/es/index.js
- var import_react = __toESM(require_react());
- var import_react_dom = __toESM(require_react_dom());
- var ho = Object.defineProperty;
- var po2 = (t, e, r) => e in t ? ho(t, e, { enumerable: true, configurable: true, writable: true, value: r }) : t[e] = r;
- var Xe = (t, e, r) => po2(t, typeof e != "symbol" ? e + "" : e, r);
- var Mi = {
- type: ar.COMMAND,
- id: "sheet.command.add-average-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const { ranges: r, style: n, stopIfTrue: i, operator: o } = e, c = t.get(B), v = t.get(Pt), d = t.get(_n), y3 = N(d);
- if (!y3)
- return false;
- const { unitId: p, subUnitId: C } = y3, _ = c.createCfId(p, C), w2 = {
- ranges: r,
- cfId: _,
- stopIfTrue: !!i,
- rule: {
- type: y.highlightCell,
- subType: E.average,
- operator: o,
- style: n
- }
- };
- return v.executeCommand(T2.id, { unitId: p, subUnitId: C, rule: w2 });
- }
- };
- var Pn = {
- type: ar.COMMAND,
- id: "sheet.command.add-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const { rule: r } = e, n = t.get(cn), i = t.get(Pt), o = t.get(B), c = t.get(_n), v = N(c);
- if (!v)
- return false;
- const { unitId: d, subUnitId: y3 } = v, p = o.createCfId(d, y3), C = { unitId: d, subUnitId: y3, rule: { ...r, cfId: r.cfId || p } }, _ = b1(t, C), w2 = i.syncExecuteCommand(T2.id, C);
- return w2 && n.pushUndoRedo({
- unitID: d,
- redoMutations: [{ id: T2.id, params: C }],
- undoMutations: [_]
- }), w2;
- }
- };
- var Ni = {
- type: ar.COMMAND,
- id: "sheet.command.add-color-scale-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const { ranges: r, config: n, stopIfTrue: i } = e, o = t.get(B), c = t.get(Pt), v = t.get(_n), d = N(v);
- if (!d)
- return false;
- const { unitId: y3, subUnitId: p } = d, C = o.createCfId(y3, p), _ = {
- ranges: r,
- cfId: C,
- stopIfTrue: !!i,
- rule: {
- type: y.colorScale,
- config: n
- }
- };
- return c.executeCommand(T2.id, { unitId: y3, subUnitId: p, rule: _ });
- }
- };
- var ji = {
- type: ar.COMMAND,
- id: "sheet.command.add-data-bar-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const { ranges: r, min: n, max: i, nativeColor: o, positiveColor: c, isGradient: v, stopIfTrue: d, isShowValue: y3 } = e, p = t.get(B), C = t.get(_n), _ = N(C);
- if (!_)
- return false;
- const { unitId: w2, subUnitId: S } = _, R3 = t.get(Pt), h = p.createCfId(w2, S), s = {
- ranges: r,
- cfId: h,
- stopIfTrue: !!d,
- rule: {
- type: y.dataBar,
- isShowValue: y3,
- config: {
- min: n,
- max: i,
- nativeColor: o,
- positiveColor: c,
- isGradient: v
- }
- }
- };
- return R3.executeCommand(T2.id, { unitId: w2, subUnitId: S, rule: s });
- }
- };
- var Li = {
- type: ar.COMMAND,
- id: "sheet.command.add-duplicate-values-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const { ranges: r, style: n, stopIfTrue: i } = e, o = t.get(B), c = t.get(Pt), v = t.get(_n), d = N(v);
- if (!d)
- return false;
- const { unitId: y3, subUnitId: p } = d, C = o.createCfId(y3, p), _ = {
- ranges: r,
- cfId: C,
- stopIfTrue: !!i,
- rule: {
- type: y.highlightCell,
- subType: E.duplicateValues,
- style: n
- }
- };
- return c.executeCommand(T2.id, { unitId: y3, subUnitId: p, rule: _ });
- }
- };
- var $i = {
- type: ar.COMMAND,
- id: "sheet.command.add-number-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const { ranges: r, style: n, stopIfTrue: i, operator: o, value: c } = e, v = t.get(B), d = t.get(Pt), y3 = t.get(_n), p = N(y3);
- if (!p)
- return false;
- const { unitId: C, subUnitId: _ } = p, w2 = v.createCfId(C, _);
- let S;
- if ([w.between, w.notBetween].includes(o)) {
- const R3 = c;
- if (R3.length !== 2 || !Array.isArray(R3))
- return false;
- S = {
- ranges: r,
- cfId: w2,
- stopIfTrue: !!i,
- rule: {
- type: y.highlightCell,
- subType: E.number,
- operator: o,
- style: n,
- value: R3
- }
- };
- } else {
- const R3 = c;
- if (typeof R3 != "number")
- return false;
- S = {
- ranges: r,
- cfId: w2,
- stopIfTrue: !!i,
- rule: {
- type: y.highlightCell,
- subType: E.number,
- operator: o,
- style: n,
- value: R3
- }
- };
- }
- return d.executeCommand(T2.id, { unitId: C, subUnitId: _, rule: S });
- }
- };
- var zi = {
- type: ar.COMMAND,
- id: "sheet.command.add-rank-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const { ranges: r, style: n, stopIfTrue: i, isPercent: o, isBottom: c, value: v } = e, d = t.get(B), y3 = t.get(_n), p = t.get(Pt), C = N(y3);
- if (!C)
- return false;
- const { unitId: _, subUnitId: w2 } = C, S = d.createCfId(_, w2), R3 = {
- ranges: r,
- cfId: S,
- stopIfTrue: !!i,
- rule: {
- type: y.highlightCell,
- subType: E.rank,
- isPercent: o,
- isBottom: c,
- style: n,
- value: v
- }
- };
- return p.executeCommand(T2.id, { unitId: _, subUnitId: w2, rule: R3 });
- }
- };
- var Fi = {
- type: ar.COMMAND,
- id: "sheet.command.add-text-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const { ranges: r, style: n, stopIfTrue: i, operator: o, value: c } = e, v = t.get(B), d = t.get(_n), y3 = N(d);
- if (!y3)
- return false;
- const { unitId: p, subUnitId: C } = y3, _ = t.get(Pt), w2 = v.createCfId(p, C), S = {
- ranges: r,
- cfId: w2,
- stopIfTrue: !!i,
- rule: {
- type: y.highlightCell,
- subType: E.text,
- operator: o,
- style: n,
- value: c
- }
- };
- return _.executeCommand(T2.id, { unitId: p, subUnitId: C, rule: S });
- }
- };
- var Vi = {
- type: ar.COMMAND,
- id: "sheet.command.add-time-period-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const { ranges: r, style: n, stopIfTrue: i, operator: o } = e, c = t.get(B), v = t.get(_n), d = t.get(Pt), y3 = N(v);
- if (!y3)
- return false;
- const { unitId: p, subUnitId: C } = y3, _ = c.createCfId(p, C), w2 = {
- ranges: r,
- cfId: _,
- stopIfTrue: !!i,
- rule: {
- type: y.highlightCell,
- subType: E.timePeriod,
- operator: o,
- style: n
- }
- };
- return d.executeCommand(T2.id, { unitId: p, subUnitId: C, rule: w2 });
- }
- };
- var qi = {
- type: ar.COMMAND,
- id: "sheet.command.add-uniqueValues-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const { ranges: r, style: n, stopIfTrue: i } = e, o = t.get(B), c = t.get(_n), v = t.get(Pt), d = N(c);
- if (!d)
- return false;
- const { unitId: y3, subUnitId: p } = d, C = o.createCfId(y3, p), _ = {
- ranges: r,
- cfId: C,
- stopIfTrue: !!i,
- rule: {
- type: y.highlightCell,
- subType: E.uniqueValues,
- style: n
- }
- };
- return v.executeCommand(T2.id, { unitId: y3, subUnitId: p, rule: _ });
- }
- };
- var ar3 = {
- type: ar.COMMAND,
- id: "sheet.command.clear-range-conditional-rule",
- handler(t, e) {
- var R3;
- if (!e)
- return false;
- const r = t.get(B), n = t.get(_n), i = t.get(Pt), o = t.get(cn), c = t.get(F), v = N(n, e);
- if (!v)
- return false;
- const { unitId: d, subUnitId: y3 } = v, p = ((R3 = c.getCurrentSelections()) == null ? void 0 : R3.map((h) => h.range)) || [], C = r.getSubunitRules(d, y3);
- if (!(C != null && C.length) || !p.length)
- return false;
- const _ = [], w2 = [];
- C.forEach((h) => {
- const s = new kt();
- h.ranges.forEach((u) => {
- tr.foreach(u, (b, l) => {
- s.setValue(b, l, 1);
- });
- }), p.forEach((u) => {
- tr.foreach(u, (b, l) => {
- s.realDeleteValue(b, l);
- });
- });
- const a = jr(xl(s));
- if (a.length) {
- const u = { ...h, ranges: a }, b = { unitId: d, subUnitId: y3, rule: u }, l = L1(t, b);
- _.push({ id: U2.id, params: b }), w2.push(...l);
- } else {
- const u = { unitId: d, subUnitId: y3, cfId: h.cfId }, b = z02(t, u);
- _.push({ id: E2.id, params: u }), w2.push(...b);
- }
- });
- const S = mu(_, i).result;
- return S && o.pushUndoRedo({
- unitID: d,
- redoMutations: _,
- undoMutations: w2
- }), S;
- }
- };
- var On = {
- type: ar.COMMAND,
- id: "sheet.command.clear-worksheet-conditional-rule",
- handler(t, e) {
- const r = t.get(B), n = t.get(_n), i = t.get(Pt), o = t.get(cn), c = N(n, e);
- if (!c)
- return false;
- const { unitId: v, subUnitId: d } = c, y3 = r.getSubunitRules(v, d);
- if (!(y3 != null && y3.length))
- return false;
- const p = y3.map((S) => ({ cfId: S.cfId, unitId: v, subUnitId: d })), C = p.map((S) => ({ id: E2.id, params: S })), _ = p.map((S) => z02(t, S)[0]), w2 = mu(C, i).result;
- return w2 && o.pushUndoRedo({
- unitID: v,
- redoMutations: C,
- undoMutations: _
- }), w2;
- }
- };
- var mn = {
- type: ar.COMMAND,
- id: "sheet.command.delete-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const r = t.get(cn), n = t.get(Pt), i = t.get(_n), o = N(i, e);
- if (!o)
- return false;
- const { unitId: c, subUnitId: v } = o, d = { unitId: c, subUnitId: v, cfId: e.cfId }, y3 = z02(t, d), p = n.syncExecuteCommand(E2.id, d);
- return p && r.pushUndoRedo({ unitID: c, undoMutations: y3, redoMutations: [{ id: E2.id, params: d }] }), p;
- }
- };
- var lr = {
- type: ar.COMMAND,
- id: "sheet.command.move-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const r = t.get(cn), n = t.get(Pt), i = t.get(_n), o = t.get(B), c = N(i, e);
- if (!c)
- return false;
- const { unitId: v, subUnitId: d } = c, y3 = f0(e.start, e.end, o.getSubunitRules(v, d) || [], (R3) => R3.cfId);
- if (!y3)
- return false;
- const [p, C] = y3, _ = { unitId: v, subUnitId: d, start: p, end: C }, w2 = I1(_), S = n.syncExecuteCommand(v2.id, _);
- return S && r.pushUndoRedo({
- unitID: v,
- redoMutations: [{ id: v2.id, params: _ }],
- undoMutations: w2
- }), S;
- }
- };
- var cr = {
- type: ar.COMMAND,
- id: "sheet.command.set-conditional-rule",
- handler(t, e) {
- if (!e)
- return false;
- const r = t.get(cn), n = t.get(Pt), i = t.get(_n), o = N(i, e);
- if (!o)
- return false;
- const { unitId: c, subUnitId: v } = o, d = { unitId: c, subUnitId: v, rule: e.rule }, y3 = L1(t, d), p = n.syncExecuteCommand(U2.id, d);
- return p && r.pushUndoRedo({ unitID: c, undoMutations: y3, redoMutations: [{ id: U2.id, params: d }] }), p;
- }
- };
- function hs(t) {
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
- }
- function Ai(t) {
- if (t.__esModule)
- return t;
- var e = t.default;
- if (typeof e == "function") {
- var r = function n() {
- return this instanceof n ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments);
- };
- r.prototype = e.prototype;
- } else
- r = {};
- return Object.defineProperty(r, "__esModule", { value: true }), Object.keys(t).forEach(function(n) {
- var i = Object.getOwnPropertyDescriptor(t, n);
- Object.defineProperty(r, n, i.get ? i : {
- enumerable: true,
- get: function() {
- return t[n];
- }
- });
- }), r;
- }
- var qn2 = { exports: {} };
- var wt = {};
- var Rr;
- function ps() {
- if (Rr)
- return wt;
- Rr = 1;
- var t = import_react.default, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: true, ref: true, __self: true, __source: true };
- function c(v, d, y3) {
- var p, C = {}, _ = null, w2 = null;
- y3 !== void 0 && (_ = "" + y3), d.key !== void 0 && (_ = "" + d.key), d.ref !== void 0 && (w2 = d.ref);
- for (p in d)
- n.call(d, p) && !o.hasOwnProperty(p) && (C[p] = d[p]);
- if (v && v.defaultProps)
- for (p in d = v.defaultProps, d)
- C[p] === void 0 && (C[p] = d[p]);
- return { $$typeof: e, type: v, key: _, ref: w2, props: C, _owner: i.current };
- }
- return wt.Fragment = r, wt.jsx = c, wt.jsxs = c, wt;
- }
- var _r;
- function gs() {
- return _r || (_r = 1, qn2.exports = ps()), qn2.exports;
- }
- var x3 = gs();
- var ms = "univer-conditional-formatting-wrap";
- var vs = "univer-cf-rule-item";
- var ys = "univer-preview";
- var bs = "univer-create-rule";
- var Ss = "univer-button";
- var Cs = "univer-title";
- var ws = "univer-label";
- var Rs = "univer-label-container";
- var _s2 = "univer-input-width";
- var xs = "univer-m-t-base";
- var Is = "univer-m-t-sm";
- var Es = "univer-m-t-xl";
- var Ts = "univer-m-l-sm";
- var Ps = "univer-m-l-xl";
- var Os = "univer-m-l-xxs";
- var Ds = "univer-m-l-0";
- var Ms = "univer-m-r-0";
- var $ = {
- conditionalFormattingWrap: ms,
- cfRuleItem: vs,
- preview: ys,
- createRule: bs,
- button: Ss,
- title: Cs,
- label: ws,
- labelContainer: Rs,
- inputWidth: _s2,
- mTBase: xs,
- mTSm: Is,
- mTXl: Es,
- mLSm: Ts,
- mLXl: Ps,
- mLXxs: Os,
- mL0: Ds,
- mR0: Ms
- };
- var Oe = function() {
- return Oe = Object.assign || function(t) {
- for (var e, r = 1, n = arguments.length; r < n; r++) {
- e = arguments[r];
- for (var i in e)
- Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
- }
- return t;
- }, Oe.apply(this, arguments);
- };
- var Ns = function(t, e) {
- var r = {};
- for (var n in t)
- Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
- for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++)
- e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]);
- return r;
- };
- var bt = (0, import_react.forwardRef)(function(t, e) {
- var r = t.icon, n = t.id, i = t.className, o = t.extend, c = Ns(t, ["icon", "id", "className", "extend"]), v = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), d = (0, import_react.useRef)("_".concat($s()));
- return Wi(r, "".concat(n), { defIds: r.defIds, idSuffix: d.current }, Oe({ ref: e, className: v }, c), o);
- });
- function Wi(t, e, r, n, i) {
- return (0, import_react.createElement)(t.tag, Oe(Oe({ key: e }, js(t, r, i)), n), (Ls(t, r).children || []).map(function(o, c) {
- return Wi(o, "".concat(e, "-").concat(t.tag, "-").concat(c), r, void 0, i);
- }));
- }
- function js(t, e, r) {
- var n = Oe({}, t.attrs);
- r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1);
- var i = e.defIds;
- return !i || i.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(o) {
- var c = o[0], v = o[1];
- typeof v == "string" && (n[c] = v.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
- })), n;
- }
- function Ls(t, e) {
- var r, n = e.defIds;
- return !n || n.length === 0 ? t : t.tag === "defs" && (!((r = t.children) === null || r === void 0) && r.length) ? Oe(Oe({}, t), { children: t.children.map(function(i) {
- return typeof i.attrs.id == "string" && n && n.indexOf(i.attrs.id) > -1 ? Oe(Oe({}, i), { attrs: Oe(Oe({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
- }) }) : t;
- }
- function $s() {
- return Math.random().toString(36).substring(2, 8);
- }
- bt.displayName = "UniverIcon";
- var zs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] };
- var dn = (0, import_react.forwardRef)(function(t, e) {
- return (0, import_react.createElement)(bt, Object.assign({}, t, {
- id: "delete-single",
- ref: e,
- icon: zs
- }));
- });
- dn.displayName = "DeleteSingle";
- var Fs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] };
- var Hi = (0, import_react.forwardRef)(function(t, e) {
- return (0, import_react.createElement)(bt, Object.assign({}, t, {
- id: "increase-single",
- ref: e,
- icon: Fs
- }));
- });
- Hi.displayName = "IncreaseSingle";
- var Vs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] };
- var Dn = (0, import_react.forwardRef)(function(t, e) {
- return (0, import_react.createElement)(bt, Object.assign({}, t, {
- id: "more-down-single",
- ref: e,
- icon: Vs
- }));
- });
- Dn.displayName = "MoreDownSingle";
- var qs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_622_8", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { fill: "currentColor", mask: "url(#mask0_622_8)" }, children: [{ tag: "path", attrs: { d: "M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z" } }] }] };
- var Ui = (0, import_react.forwardRef)(function(t, e) {
- return (0, import_react.createElement)(bt, Object.assign({}, t, {
- id: "sequence-single",
- ref: e,
- icon: qs
- }));
- });
- Ui.displayName = "SequenceSingle";
- var As = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_436_41", style: { maskType: "alpha" }, width: 17, height: 17, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0.35 0.48H16.35V16.48H0.35z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_436_41)", fillRule: "evenodd", clipRule: "evenodd" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z" } }, { tag: "path", attrs: { fill: "#E5E5E5", d: "M4.2603 1.82495L2.89617 1.82495C2.23343 1.82495 1.69617 2.36221 1.69617 3.02495L1.69617 4.38908L3.02617 4.38908L3.02617 3.15495L4.2603 3.15495L4.2603 1.82495ZM15.0092 4.38908L15.0092 3.02495C15.0092 2.36221 14.4719 1.82495 13.8092 1.82495L12.4451 1.82495L12.4451 3.15495L13.6792 3.15495L13.6792 4.38908L15.0092 4.38908ZM6.98856 1.82495L6.98856 3.15495L9.71681 3.15495L9.71681 1.82495L6.98856 1.82495ZM15.0092 7.11734L13.6792 7.11734L13.6792 9.84559L15.0092 9.84559L15.0092 7.11734ZM15.0092 12.5739L13.6792 12.5739L13.6792 13.808L12.4451 13.808L12.4451 15.138L13.8092 15.138C14.4719 15.138 15.0092 14.6007 15.0092 13.938L15.0092 12.5739ZM9.71681 15.138L9.71681 13.808L6.98856 13.808L6.98856 15.138L9.71681 15.138ZM4.2603 15.138L4.2603 13.808L3.02617 13.808L3.02617 12.5739L1.69617 12.5739L1.69617 13.938C1.69617 14.6007 2.23343 15.138 2.89617 15.138L4.2603 15.138ZM1.69617 9.8456L3.02617 9.8456L3.02617 7.11734L1.69617 7.11734L1.69617 9.8456Z" } }] }] };
- var Zt = (0, import_react.forwardRef)(function(t, e) {
- return (0, import_react.createElement)(bt, Object.assign({}, t, {
- id: "slash-single",
- ref: e,
- icon: As
- }));
- });
- Zt.displayName = "SlashSingle";
- var An = { exports: {} };
- var Rt = {};
- var zt2 = { exports: {} };
- var Ws = zt2.exports;
- var xr;
- function ur() {
- return xr || (xr = 1, function(t, e) {
- (function(r, n) {
- n(e);
- })(Ws, function(r) {
- function n(V2) {
- return function(ce, E3, T, D, L, B2, q) {
- return V2(ce, E3, q);
- };
- }
- function i(V2) {
- return function(ce, E3, T, D) {
- if (!ce || !E3 || typeof ce != "object" || typeof E3 != "object")
- return V2(ce, E3, T, D);
- var L = D.get(ce), B2 = D.get(E3);
- if (L && B2)
- return L === E3 && B2 === ce;
- D.set(ce, E3), D.set(E3, ce);
- var q = V2(ce, E3, T, D);
- return D.delete(ce), D.delete(E3), q;
- };
- }
- function o(V2, Z) {
- var ce = {};
- for (var E3 in V2)
- ce[E3] = V2[E3];
- for (var E3 in Z)
- ce[E3] = Z[E3];
- return ce;
- }
- function c(V2) {
- return V2.constructor === Object || V2.constructor == null;
- }
- function v(V2) {
- return typeof V2.then == "function";
- }
- function d(V2, Z) {
- return V2 === Z || V2 !== V2 && Z !== Z;
- }
- var y3 = "[object Arguments]", p = "[object Boolean]", C = "[object Date]", _ = "[object RegExp]", w2 = "[object Map]", S = "[object Number]", R3 = "[object Object]", h = "[object Set]", s = "[object String]", a = Object.prototype.toString;
- function u(V2) {
- var Z = V2.areArraysEqual, ce = V2.areDatesEqual, E3 = V2.areMapsEqual, T = V2.areObjectsEqual, D = V2.areRegExpsEqual, L = V2.areSetsEqual, B2 = V2.createIsNestedEqual, q = B2(Y2);
- function Y2(X, ne, pe) {
- if (X === ne)
- return true;
- if (!X || !ne || typeof X != "object" || typeof ne != "object")
- return X !== X && ne !== ne;
- if (c(X) && c(ne))
- return T(X, ne, q, pe);
- var et2 = Array.isArray(X), Pe2 = Array.isArray(ne);
- if (et2 || Pe2)
- return et2 === Pe2 && Z(X, ne, q, pe);
- var Ce = a.call(X);
- return Ce !== a.call(ne) ? false : Ce === C ? ce(X, ne, q, pe) : Ce === _ ? D(X, ne, q, pe) : Ce === w2 ? E3(X, ne, q, pe) : Ce === h ? L(X, ne, q, pe) : Ce === R3 || Ce === y3 ? v(X) || v(ne) ? false : T(X, ne, q, pe) : Ce === p || Ce === S || Ce === s ? d(X.valueOf(), ne.valueOf()) : false;
- }
- return Y2;
- }
- function b(V2, Z, ce, E3) {
- var T = V2.length;
- if (Z.length !== T)
- return false;
- for (; T-- > 0; )
- if (!ce(V2[T], Z[T], T, T, V2, Z, E3))
- return false;
- return true;
- }
- var l = i(b);
- function g(V2, Z) {
- return d(V2.valueOf(), Z.valueOf());
- }
- function f(V2, Z, ce, E3) {
- var T = V2.size === Z.size;
- if (!T)
- return false;
- if (!V2.size)
- return true;
- var D = {}, L = 0;
- return V2.forEach(function(B2, q) {
- if (T) {
- var Y2 = false, X = 0;
- Z.forEach(function(ne, pe) {
- !Y2 && !D[X] && (Y2 = ce(q, pe, L, X, V2, Z, E3) && ce(B2, ne, q, pe, V2, Z, E3)) && (D[X] = true), X++;
- }), L++, T = Y2;
- }
- }), T;
- }
- var m = i(f), P = "_owner", M2 = Object.prototype.hasOwnProperty;
- function j2(V2, Z, ce, E3) {
- var T = Object.keys(V2), D = T.length;
- if (Object.keys(Z).length !== D)
- return false;
- for (var L; D-- > 0; ) {
- if (L = T[D], L === P) {
- var B2 = !!V2.$$typeof, q = !!Z.$$typeof;
- if ((B2 || q) && B2 !== q)
- return false;
- }
- if (!M2.call(Z, L) || !ce(V2[L], Z[L], L, L, V2, Z, E3))
- return false;
- }
- return true;
- }
- var N3 = i(j2);
- function I(V2, Z) {
- return V2.source === Z.source && V2.flags === Z.flags;
- }
- function O(V2, Z, ce, E3) {
- var T = V2.size === Z.size;
- if (!T)
- return false;
- if (!V2.size)
- return true;
- var D = {};
- return V2.forEach(function(L, B2) {
- if (T) {
- var q = false, Y2 = 0;
- Z.forEach(function(X, ne) {
- !q && !D[Y2] && (q = ce(L, X, B2, ne, V2, Z, E3)) && (D[Y2] = true), Y2++;
- }), T = q;
- }
- }), T;
- }
- var z = i(O), U = Object.freeze({
- areArraysEqual: b,
- areDatesEqual: g,
- areMapsEqual: f,
- areObjectsEqual: j2,
- areRegExpsEqual: I,
- areSetsEqual: O,
- createIsNestedEqual: n
- }), k = Object.freeze({
- areArraysEqual: l,
- areDatesEqual: g,
- areMapsEqual: m,
- areObjectsEqual: N3,
- areRegExpsEqual: I,
- areSetsEqual: z,
- createIsNestedEqual: n
- }), ie = u(U);
- function ee(V2, Z) {
- return ie(V2, Z, void 0);
- }
- var A = u(o(U, { createIsNestedEqual: function() {
- return d;
- } }));
- function F2(V2, Z) {
- return A(V2, Z, void 0);
- }
- var oe = u(k);
- function se(V2, Z) {
- return oe(V2, Z, /* @__PURE__ */ new WeakMap());
- }
- var de = u(o(k, {
- createIsNestedEqual: function() {
- return d;
- }
- }));
- function ye(V2, Z) {
- return de(V2, Z, /* @__PURE__ */ new WeakMap());
- }
- function Ee(V2) {
- return u(o(U, V2(U)));
- }
- function $e2(V2) {
- var Z = u(o(k, V2(k)));
- return function(ce, E3, T) {
- return T === void 0 && (T = /* @__PURE__ */ new WeakMap()), Z(ce, E3, T);
- };
- }
- r.circularDeepEqual = se, r.circularShallowEqual = ye, r.createCustomCircularEqual = $e2, r.createCustomEqual = Ee, r.deepEqual = ee, r.sameValueZeroEqual = d, r.shallowEqual = F2, Object.defineProperty(r, "__esModule", { value: true });
- });
- }(zt2, zt2.exports)), zt2.exports;
- }
- var Qt = { exports: {} };
- var Ir;
- function dr() {
- if (Ir)
- return Qt.exports;
- Ir = 1;
- function t(r) {
- var n, i, o = "";
- if (typeof r == "string" || typeof r == "number")
- o += r;
- else if (typeof r == "object")
- if (Array.isArray(r)) {
- var c = r.length;
- for (n = 0; n < c; n++)
- r[n] && (i = t(r[n])) && (o && (o += " "), o += i);
- } else
- for (i in r)
- r[i] && (o && (o += " "), o += i);
- return o;
- }
- function e() {
- for (var r, n, i = 0, o = "", c = arguments.length; i < c; i++)
- (r = arguments[i]) && (n = t(r)) && (o && (o += " "), o += n);
- return o;
- }
- return Qt.exports = e, Qt.exports.clsx = e, Qt.exports;
- }
- var ae = {};
- var Wn;
- var Er;
- function Hs() {
- return Er || (Er = 1, Wn = function(e, r, n) {
- return e === r ? true : e.className === r.className && n(e.style, r.style) && e.width === r.width && e.autoSize === r.autoSize && e.cols === r.cols && e.draggableCancel === r.draggableCancel && e.draggableHandle === r.draggableHandle && n(e.verticalCompact, r.verticalCompact) && n(e.compactType, r.compactType) && n(e.layout, r.layout) && n(e.margin, r.margin) && n(e.containerPadding, r.containerPadding) && e.rowHeight === r.rowHeight && e.maxRows === r.maxRows && e.isBounded === r.isBounded && e.isDraggable === r.isDraggable && e.isResizable === r.isResizable && e.allowOverlap === r.allowOverlap && e.preventCollision === r.preventCollision && e.useCSSTransforms === r.useCSSTransforms && e.transformScale === r.transformScale && e.isDroppable === r.isDroppable && n(e.resizeHandles, r.resizeHandles) && n(e.resizeHandle, r.resizeHandle) && e.onLayoutChange === r.onLayoutChange && e.onDragStart === r.onDragStart && e.onDrag === r.onDrag && e.onDragStop === r.onDragStop && e.onResizeStart === r.onResizeStart && e.onResize === r.onResize && e.onResizeStop === r.onResizeStop && e.onDrop === r.onDrop && n(e.droppingItem, r.droppingItem) && n(e.innerRef, r.innerRef);
- }), Wn;
- }
- var Tr;
- function St() {
- if (Tr)
- return ae;
- Tr = 1, Object.defineProperty(ae, "__esModule", {
- value: true
- }), ae.bottom = n, ae.childrenEqual = d, ae.cloneLayout = i, ae.cloneLayoutItem = v, ae.collides = p, ae.compact = C, ae.compactItem = S, ae.compactType = V2, ae.correctBounds = R3, ae.fastPositionEqual = y3, ae.fastRGLPropsEqual = void 0, ae.getAllCollisions = a, ae.getFirstCollision = s, ae.getLayoutItem = h, ae.getStatics = u, ae.modifyLayout = o, ae.moveElement = b, ae.moveElementAwayFromCollision = l, ae.noop = void 0, ae.perc = g, ae.resizeItemInDirection = A, ae.setTopLeft = oe, ae.setTransform = F2, ae.sortLayoutItems = se, ae.sortLayoutItemsByColRow = ye, ae.sortLayoutItemsByRowCol = de, ae.synchronizeLayoutWithChildren = Ee, ae.validateLayout = $e2, ae.withLayoutItem = c;
- var t = ur(), e = r(import_react.default);
- function r(E3) {
- return E3 && E3.__esModule ? E3 : { default: E3 };
- }
- function n(E3) {
- let T = 0, D;
- for (let L = 0, B2 = E3.length; L < B2; L++)
- D = E3[L].y + E3[L].h, D > T && (T = D);
- return T;
- }
- function i(E3) {
- const T = Array(E3.length);
- for (let D = 0, L = E3.length; D < L; D++)
- T[D] = v(E3[D]);
- return T;
- }
- function o(E3, T) {
- const D = Array(E3.length);
- for (let L = 0, B2 = E3.length; L < B2; L++)
- T.i === E3[L].i ? D[L] = T : D[L] = E3[L];
- return D;
- }
- function c(E3, T, D) {
- let L = h(E3, T);
- return L ? (L = D(v(L)), E3 = o(E3, L), [E3, L]) : [E3, null];
- }
- function v(E3) {
- return {
- w: E3.w,
- h: E3.h,
- x: E3.x,
- y: E3.y,
- i: E3.i,
- minW: E3.minW,
- maxW: E3.maxW,
- minH: E3.minH,
- maxH: E3.maxH,
- moved: !!E3.moved,
- static: !!E3.static,
- // These can be null/undefined
- isDraggable: E3.isDraggable,
- isResizable: E3.isResizable,
- resizeHandles: E3.resizeHandles,
- isBounded: E3.isBounded
- };
- }
- function d(E3, T) {
- return (0, t.deepEqual)(e.default.Children.map(E3, (D) => D == null ? void 0 : D.key), e.default.Children.map(T, (D) => D == null ? void 0 : D.key)) && (0, t.deepEqual)(e.default.Children.map(E3, (D) => D == null ? void 0 : D.props["data-grid"]), e.default.Children.map(T, (D) => D == null ? void 0 : D.props["data-grid"]));
- }
- ae.fastRGLPropsEqual = Hs();
- function y3(E3, T) {
- return E3.left === T.left && E3.top === T.top && E3.width === T.width && E3.height === T.height;
- }
- function p(E3, T) {
- return !(E3.i === T.i || E3.x + E3.w <= T.x || E3.x >= T.x + T.w || E3.y + E3.h <= T.y || E3.y >= T.y + T.h);
- }
- function C(E3, T, D, L) {
- const B2 = u(E3), q = se(E3, T), Y2 = Array(E3.length);
- for (let X = 0, ne = q.length; X < ne; X++) {
- let pe = v(q[X]);
- pe.static || (pe = S(B2, pe, T, D, q, L), B2.push(pe)), Y2[E3.indexOf(q[X])] = pe, pe.moved = false;
- }
- return Y2;
- }
- const _ = {
- x: "w",
- y: "h"
- };
- function w2(E3, T, D, L) {
- const B2 = _[L];
- T[L] += 1;
- const q = E3.map((Y2) => Y2.i).indexOf(T.i);
- for (let Y2 = q + 1; Y2 < E3.length; Y2++) {
- const X = E3[Y2];
- if (!X.static) {
- if (X.y > T.y + T.h)
- break;
- p(T, X) && w2(E3, X, D + T[B2], L);
- }
- }
- T[L] = D;
- }
- function S(E3, T, D, L, B2, q) {
- const Y2 = D === "vertical", X = D === "horizontal";
- if (Y2)
- for (T.y = Math.min(n(E3), T.y); T.y > 0 && !s(E3, T); )
- T.y--;
- else if (X)
- for (; T.x > 0 && !s(E3, T); )
- T.x--;
- let ne;
- for (; (ne = s(E3, T)) && !(D === null && q); )
- if (X ? w2(B2, T, ne.x + ne.w, "x") : w2(B2, T, ne.y + ne.h, "y"), X && T.x + T.w > L)
- for (T.x = L - T.w, T.y++; T.x > 0 && !s(E3, T); )
- T.x--;
- return T.y = Math.max(T.y, 0), T.x = Math.max(T.x, 0), T;
- }
- function R3(E3, T) {
- const D = u(E3);
- for (let L = 0, B2 = E3.length; L < B2; L++) {
- const q = E3[L];
- if (q.x + q.w > T.cols && (q.x = T.cols - q.w), q.x < 0 && (q.x = 0, q.w = T.cols), !q.static)
- D.push(q);
- else
- for (; s(D, q); )
- q.y++;
- }
- return E3;
- }
- function h(E3, T) {
- for (let D = 0, L = E3.length; D < L; D++)
- if (E3[D].i === T)
- return E3[D];
- }
- function s(E3, T) {
- for (let D = 0, L = E3.length; D < L; D++)
- if (p(E3[D], T))
- return E3[D];
- }
- function a(E3, T) {
- return E3.filter((D) => p(D, T));
- }
- function u(E3) {
- return E3.filter((T) => T.static);
- }
- function b(E3, T, D, L, B2, q, Y2, X, ne) {
- if (T.static && T.isDraggable !== true || T.y === L && T.x === D)
- return E3;
- `${T.i}${String(D)}${String(L)}${T.x}${T.y}`;
- const pe = T.x, et2 = T.y;
- typeof D == "number" && (T.x = D), typeof L == "number" && (T.y = L), T.moved = true;
- let Pe2 = se(E3, Y2);
- (Y2 === "vertical" && typeof L == "number" ? et2 >= L : Y2 === "horizontal" && typeof D == "number" ? pe >= D : false) && (Pe2 = Pe2.reverse());
- const dt = a(Pe2, T), Jt = dt.length > 0;
- if (Jt && ne)
- return i(E3);
- if (Jt && q)
- return `${T.i}`, T.x = pe, T.y = et2, T.moved = false, E3;
- for (let Ln = 0, fo = dt.length; Ln < fo; Ln++) {
- const tt = dt[Ln];
- `${T.i}${T.x}${T.y}${tt.i}${tt.x}${tt.y}`, !tt.moved && (tt.static ? E3 = l(E3, tt, T, B2, Y2) : E3 = l(E3, T, tt, B2, Y2));
- }
- return E3;
- }
- function l(E3, T, D, L, B2, q) {
- const Y2 = B2 === "horizontal", X = B2 === "vertical", ne = T.static;
- if (L) {
- L = false;
- const Pe2 = {
- x: Y2 ? Math.max(T.x - D.w, 0) : D.x,
- y: X ? Math.max(T.y - D.h, 0) : D.y,
- w: D.w,
- h: D.h,
- i: "-1"
- }, Ce = s(E3, Pe2), dt = Ce && Ce.y + Ce.h > T.y, Jt = Ce && T.x + T.w > Ce.x;
- if (Ce) {
- if (dt && X)
- return b(E3, D, void 0, T.y + 1, L, ne, B2);
- if (dt && B2 == null)
- return T.y = D.y, D.y = D.y + D.h, E3;
- if (Jt && Y2)
- return b(E3, T, D.x, void 0, L, ne, B2);
- } else
- return `${D.i}${Pe2.x}${Pe2.y}`, b(E3, D, Y2 ? Pe2.x : void 0, X ? Pe2.y : void 0, L, ne, B2);
- }
- const pe = Y2 ? D.x + 1 : void 0, et2 = X ? D.y + 1 : void 0;
- return pe == null && et2 == null ? E3 : b(E3, D, Y2 ? D.x + 1 : void 0, X ? D.y + 1 : void 0, L, ne, B2);
- }
- function g(E3) {
- return E3 * 100 + "%";
- }
- const f = (E3, T, D, L) => E3 + D > L ? T : D, m = (E3, T, D) => E3 < 0 ? T : D, P = (E3) => Math.max(0, E3), M2 = (E3) => Math.max(0, E3), j2 = (E3, T, D) => {
- let {
- left: L,
- height: B2,
- width: q
- } = T;
- const Y2 = E3.top - (B2 - E3.height);
- return {
- left: L,
- width: q,
- height: m(Y2, E3.height, B2),
- top: M2(Y2)
- };
- }, N3 = (E3, T, D) => {
- let {
- top: L,
- left: B2,
- height: q,
- width: Y2
- } = T;
- return {
- top: L,
- height: q,
- width: f(E3.left, E3.width, Y2, D),
- left: P(B2)
- };
- }, I = (E3, T, D) => {
- let {
- top: L,
- height: B2,
- width: q
- } = T;
- const Y2 = E3.left - (q - E3.width);
- return {
- height: B2,
- width: Y2 < 0 ? E3.width : f(E3.left, E3.width, q, D),
- top: M2(L),
- left: P(Y2)
- };
- }, O = (E3, T, D) => {
- let {
- top: L,
- left: B2,
- height: q,
- width: Y2
- } = T;
- return {
- width: Y2,
- left: B2,
- height: m(L, E3.height, q),
- top: M2(L)
- };
- }, ee = {
- n: j2,
- ne: function() {
- return j2(arguments.length <= 0 ? void 0 : arguments[0], N3(...arguments));
- },
- e: N3,
- se: function() {
- return O(arguments.length <= 0 ? void 0 : arguments[0], N3(...arguments));
- },
- s: O,
- sw: function() {
- return O(arguments.length <= 0 ? void 0 : arguments[0], I(...arguments));
- },
- w: I,
- nw: function() {
- return j2(arguments.length <= 0 ? void 0 : arguments[0], I(...arguments));
- }
- };
- function A(E3, T, D, L) {
- const B2 = ee[E3];
- return B2 ? B2(T, {
- ...T,
- ...D
- }, L) : D;
- }
- function F2(E3) {
- let {
- top: T,
- left: D,
- width: L,
- height: B2
- } = E3;
- const q = `translate(${D}px,${T}px)`;
- return {
- transform: q,
- WebkitTransform: q,
- MozTransform: q,
- msTransform: q,
- OTransform: q,
- width: `${L}px`,
- height: `${B2}px`,
- position: "absolute"
- };
- }
- function oe(E3) {
- let {
- top: T,
- left: D,
- width: L,
- height: B2
- } = E3;
- return {
- top: `${T}px`,
- left: `${D}px`,
- width: `${L}px`,
- height: `${B2}px`,
- position: "absolute"
- };
- }
- function se(E3, T) {
- return T === "horizontal" ? ye(E3) : T === "vertical" ? de(E3) : E3;
- }
- function de(E3) {
- return E3.slice(0).sort(function(T, D) {
- return T.y > D.y || T.y === D.y && T.x > D.x ? 1 : T.y === D.y && T.x === D.x ? 0 : -1;
- });
- }
- function ye(E3) {
- return E3.slice(0).sort(function(T, D) {
- return T.x > D.x || T.x === D.x && T.y > D.y ? 1 : -1;
- });
- }
- function Ee(E3, T, D, L, B2) {
- E3 = E3 || [];
- const q = [];
- e.default.Children.forEach(T, (X) => {
- if ((X == null ? void 0 : X.key) == null)
- return;
- const ne = h(E3, String(X.key)), pe = X.props["data-grid"];
- ne && pe == null ? q.push(v(ne)) : pe ? q.push(v({
- ...pe,
- i: X.key
- })) : q.push(v({
- w: 1,
- h: 1,
- x: 0,
- y: n(q),
- i: String(X.key)
- }));
- });
- const Y2 = R3(q, {
- cols: D
- });
- return B2 ? Y2 : C(Y2, L, D);
- }
- function $e2(E3) {
- let T = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "Layout";
- const D = ["x", "y", "w", "h"];
- if (!Array.isArray(E3))
- throw new Error(T + " must be an array!");
- for (let L = 0, B2 = E3.length; L < B2; L++) {
- const q = E3[L];
- for (let Y2 = 0; Y2 < D.length; Y2++)
- if (typeof q[D[Y2]] != "number")
- throw new Error("ReactGridLayout: " + T + "[" + L + "]." + D[Y2] + " must be a number!");
- }
- }
- function V2(E3) {
- const {
- verticalCompact: T,
- compactType: D
- } = E3 || {};
- return T === false ? null : D;
- }
- function Z() {
- }
- const ce = () => {
- };
- return ae.noop = ce, ae;
- }
- var He = {};
- var Pr;
- function fr2() {
- if (Pr)
- return He;
- Pr = 1, Object.defineProperty(He, "__esModule", {
- value: true
- }), He.calcGridColWidth = t, He.calcGridItemPosition = r, He.calcGridItemWHPx = e, He.calcWH = i, He.calcXY = n, He.clamp = o;
- function t(c) {
- const {
- margin: v,
- containerPadding: d,
- containerWidth: y3,
- cols: p
- } = c;
- return (y3 - v[0] * (p - 1) - d[0] * 2) / p;
- }
- function e(c, v, d) {
- return Number.isFinite(c) ? Math.round(v * c + Math.max(0, c - 1) * d) : c;
- }
- function r(c, v, d, y3, p, C) {
- const {
- margin: _,
- containerPadding: w2,
- rowHeight: S
- } = c, R3 = t(c), h = {};
- return C && C.resizing ? (h.width = Math.round(C.resizing.width), h.height = Math.round(C.resizing.height)) : (h.width = e(y3, R3, _[0]), h.height = e(p, S, _[1])), C && C.dragging ? (h.top = Math.round(C.dragging.top), h.left = Math.round(C.dragging.left)) : C && C.resizing && typeof C.resizing.top == "number" && typeof C.resizing.left == "number" ? (h.top = Math.round(C.resizing.top), h.left = Math.round(C.resizing.left)) : (h.top = Math.round((S + _[1]) * d + w2[1]), h.left = Math.round((R3 + _[0]) * v + w2[0])), h;
- }
- function n(c, v, d, y3, p) {
- const {
- margin: C,
- cols: _,
- rowHeight: w2,
- maxRows: S
- } = c, R3 = t(c);
- let h = Math.round((d - C[0]) / (R3 + C[0])), s = Math.round((v - C[1]) / (w2 + C[1]));
- return h = o(h, 0, _ - y3), s = o(s, 0, S - p), {
- x: h,
- y: s
- };
- }
- function i(c, v, d, y3, p, C) {
- const {
- margin: _,
- maxRows: w2,
- cols: S,
- rowHeight: R3
- } = c, h = t(c);
- let s = Math.round((v + _[0]) / (h + _[0])), a = Math.round((d + _[1]) / (R3 + _[1])), u = o(s, 0, S - y3), b = o(a, 0, w2 - p);
- return ["sw", "w", "nw"].indexOf(C) !== -1 && (u = o(s, 0, S)), ["nw", "n", "ne"].indexOf(C) !== -1 && (b = o(a, 0, w2)), {
- w: u,
- h: b
- };
- }
- function o(c, v, d) {
- return Math.max(Math.min(c, d), v);
- }
- return He;
- }
- var _t2 = {};
- var Hn = { exports: {} };
- var Un2;
- var Or;
- function Us() {
- if (Or)
- return Un2;
- Or = 1;
- var t = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
- return Un2 = t, Un2;
- }
- var kn;
- var Dr;
- function ks() {
- if (Dr)
- return kn;
- Dr = 1;
- var t = Us();
- function e() {
- }
- function r() {
- }
- return r.resetWarningCache = e, kn = function() {
- function n(c, v, d, y3, p, C) {
- if (C !== t) {
- var _ = new Error(
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
- );
- throw _.name = "Invariant Violation", _;
- }
- }
- n.isRequired = n;
- function i() {
- return n;
- }
- var o = {
- array: n,
- bigint: n,
- bool: n,
- func: n,
- number: n,
- object: n,
- string: n,
- symbol: n,
- any: n,
- arrayOf: i,
- element: n,
- elementType: n,
- instanceOf: i,
- node: n,
- objectOf: i,
- oneOf: i,
- oneOfType: i,
- shape: i,
- exact: i,
- checkPropTypes: r,
- resetWarningCache: e
- };
- return o.PropTypes = o, o;
- }, kn;
- }
- var Mr;
- function Qe() {
- return Mr || (Mr = 1, Hn.exports = ks()()), Hn.exports;
- }
- var xt = { exports: {} };
- var Bn = {};
- function ki(t) {
- var e, r, n = "";
- if (typeof t == "string" || typeof t == "number")
- n += t;
- else if (typeof t == "object")
- if (Array.isArray(t))
- for (e = 0; e < t.length; e++)
- t[e] && (r = ki(t[e])) && (n && (n += " "), n += r);
- else
- for (e in t)
- t[e] && (n && (n += " "), n += e);
- return n;
- }
- function Nr() {
- for (var t, e, r = 0, n = ""; r < arguments.length; )
- (t = arguments[r++]) && (e = ki(t)) && (n && (n += " "), n += e);
- return n;
- }
- var Bs = Object.freeze(Object.defineProperty({
- __proto__: null,
- clsx: Nr,
- default: Nr
- }, Symbol.toStringTag, { value: "Module" }));
- var Gs = Ai(Bs);
- var ve = {};
- var Ye = {};
- var jr2;
- function Mn() {
- if (jr2)
- return Ye;
- jr2 = 1, Object.defineProperty(Ye, "__esModule", {
- value: true
- }), Ye.dontSetMe = i, Ye.findInArray = t, Ye.int = n, Ye.isFunction = e, Ye.isNum = r;
- function t(o, c) {
- for (let v = 0, d = o.length; v < d; v++)
- if (c.apply(c, [o[v], v, o]))
- return o[v];
- }
- function e(o) {
- return typeof o == "function" || Object.prototype.toString.call(o) === "[object Function]";
- }
- function r(o) {
- return typeof o == "number" && !isNaN(o);
- }
- function n(o) {
- return parseInt(o, 10);
- }
- function i(o, c, v) {
- if (o[c])
- return new Error("Invalid prop ".concat(c, " passed to ").concat(v, " - do not set this, set it on the child."));
- }
- return Ye;
- }
- var Ke = {};
- var Lr;
- function Xs() {
- if (Lr)
- return Ke;
- Lr = 1, Object.defineProperty(Ke, "__esModule", {
- value: true
- }), Ke.browserPrefixToKey = r, Ke.browserPrefixToStyle = n, Ke.default = void 0, Ke.getPrefix = e;
- const t = ["Moz", "Webkit", "O", "ms"];
- function e() {
- var o;
- let c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "transform";
- if (typeof window > "u")
- return "";
- const v = (o = window.document) === null || o === void 0 || (o = o.documentElement) === null || o === void 0 ? void 0 : o.style;
- if (!v || c in v)
- return "";
- for (let d = 0; d < t.length; d++)
- if (r(c, t[d]) in v)
- return t[d];
- return "";
- }
- function r(o, c) {
- return c ? "".concat(c).concat(i(o)) : o;
- }
- function n(o, c) {
- return c ? "-".concat(c.toLowerCase(), "-").concat(o) : o;
- }
- function i(o) {
- let c = "", v = true;
- for (let d = 0; d < o.length; d++)
- v ? (c += o[d].toUpperCase(), v = false) : o[d] === "-" ? v = true : c += o[d];
- return c;
- }
- return Ke.default = e(), Ke;
- }
- var $r;
- function hr() {
- if ($r)
- return ve;
- $r = 1, Object.defineProperty(ve, "__esModule", {
- value: true
- }), ve.addClassName = l, ve.addEvent = v, ve.addUserSelectStyles = u, ve.createCSSTransform = S, ve.createSVGTransform = R3, ve.getTouch = s, ve.getTouchIdentifier = a, ve.getTranslation = h, ve.innerHeight = C, ve.innerWidth = _, ve.matchesSelector = o, ve.matchesSelectorAndParentsTo = c, ve.offsetXYFromParent = w2, ve.outerHeight = y3, ve.outerWidth = p, ve.removeClassName = g, ve.removeEvent = d, ve.removeUserSelectStyles = b;
- var t = Mn(), e = n(Xs());
- function r(f) {
- if (typeof WeakMap != "function")
- return null;
- var m = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap();
- return (r = function(M2) {
- return M2 ? P : m;
- })(f);
- }
- function n(f, m) {
- if (f && f.__esModule)
- return f;
- if (f === null || typeof f != "object" && typeof f != "function")
- return { default: f };
- var P = r(m);
- if (P && P.has(f))
- return P.get(f);
- var M2 = {}, j2 = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for (var N3 in f)
- if (N3 !== "default" && Object.prototype.hasOwnProperty.call(f, N3)) {
- var I = j2 ? Object.getOwnPropertyDescriptor(f, N3) : null;
- I && (I.get || I.set) ? Object.defineProperty(M2, N3, I) : M2[N3] = f[N3];
- }
- return M2.default = f, P && P.set(f, M2), M2;
- }
- let i = "";
- function o(f, m) {
- return i || (i = (0, t.findInArray)(["matches", "webkitMatchesSelector", "mozMatchesSelector", "msMatchesSelector", "oMatchesSelector"], function(P) {
- return (0, t.isFunction)(f[P]);
- })), (0, t.isFunction)(f[i]) ? f[i](m) : false;
- }
- function c(f, m, P) {
- let M2 = f;
- do {
- if (o(M2, m))
- return true;
- if (M2 === P)
- return false;
- M2 = M2.parentNode;
- } while (M2);
- return false;
- }
- function v(f, m, P, M2) {
- if (!f)
- return;
- const j2 = {
- capture: true,
- ...M2
- };
- f.addEventListener ? f.addEventListener(m, P, j2) : f.attachEvent ? f.attachEvent("on" + m, P) : f["on" + m] = P;
- }
- function d(f, m, P, M2) {
- if (!f)
- return;
- const j2 = {
- capture: true,
- ...M2
- };
- f.removeEventListener ? f.removeEventListener(m, P, j2) : f.detachEvent ? f.detachEvent("on" + m, P) : f["on" + m] = null;
- }
- function y3(f) {
- let m = f.clientHeight;
- const P = f.ownerDocument.defaultView.getComputedStyle(f);
- return m += (0, t.int)(P.borderTopWidth), m += (0, t.int)(P.borderBottomWidth), m;
- }
- function p(f) {
- let m = f.clientWidth;
- const P = f.ownerDocument.defaultView.getComputedStyle(f);
- return m += (0, t.int)(P.borderLeftWidth), m += (0, t.int)(P.borderRightWidth), m;
- }
- function C(f) {
- let m = f.clientHeight;
- const P = f.ownerDocument.defaultView.getComputedStyle(f);
- return m -= (0, t.int)(P.paddingTop), m -= (0, t.int)(P.paddingBottom), m;
- }
- function _(f) {
- let m = f.clientWidth;
- const P = f.ownerDocument.defaultView.getComputedStyle(f);
- return m -= (0, t.int)(P.paddingLeft), m -= (0, t.int)(P.paddingRight), m;
- }
- function w2(f, m, P) {
- const j2 = m === m.ownerDocument.body ? {
- left: 0,
- top: 0
- } : m.getBoundingClientRect(), N3 = (f.clientX + m.scrollLeft - j2.left) / P, I = (f.clientY + m.scrollTop - j2.top) / P;
- return {
- x: N3,
- y: I
- };
- }
- function S(f, m) {
- const P = h(f, m, "px");
- return {
- [(0, e.browserPrefixToKey)("transform", e.default)]: P
- };
- }
- function R3(f, m) {
- return h(f, m, "");
- }
- function h(f, m, P) {
- let {
- x: M2,
- y: j2
- } = f, N3 = "translate(".concat(M2).concat(P, ",").concat(j2).concat(P, ")");
- if (m) {
- const I = "".concat(typeof m.x == "string" ? m.x : m.x + P), O = "".concat(typeof m.y == "string" ? m.y : m.y + P);
- N3 = "translate(".concat(I, ", ").concat(O, ")") + N3;
- }
- return N3;
- }
- function s(f, m) {
- return f.targetTouches && (0, t.findInArray)(f.targetTouches, (P) => m === P.identifier) || f.changedTouches && (0, t.findInArray)(f.changedTouches, (P) => m === P.identifier);
- }
- function a(f) {
- if (f.targetTouches && f.targetTouches[0])
- return f.targetTouches[0].identifier;
- if (f.changedTouches && f.changedTouches[0])
- return f.changedTouches[0].identifier;
- }
- function u(f) {
- if (!f)
- return;
- let m = f.getElementById("react-draggable-style-el");
- m || (m = f.createElement("style"), m.type = "text/css", m.id = "react-draggable-style-el", m.innerHTML = `.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
- `, m.innerHTML += `.react-draggable-transparent-selection *::selection {all: inherit;}
- `, f.getElementsByTagName("head")[0].appendChild(m)), f.body && l(f.body, "react-draggable-transparent-selection");
- }
- function b(f) {
- if (f)
- try {
- if (f.body && g(f.body, "react-draggable-transparent-selection"), f.selection)
- f.selection.empty();
- else {
- const m = (f.defaultView || window).getSelection();
- m && m.type !== "Caret" && m.removeAllRanges();
- }
- } catch {
- }
- }
- function l(f, m) {
- f.classList ? f.classList.add(m) : f.className.match(new RegExp("(?:^|\\s)".concat(m, "(?!\\S)"))) || (f.className += " ".concat(m));
- }
- function g(f, m) {
- f.classList ? f.classList.remove(m) : f.className = f.className.replace(new RegExp("(?:^|\\s)".concat(m, "(?!\\S)"), "g"), "");
- }
- return ve;
- }
- var Ae = {};
- var zr;
- function Bi() {
- if (zr)
- return Ae;
- zr = 1, Object.defineProperty(Ae, "__esModule", {
- value: true
- }), Ae.canDragX = i, Ae.canDragY = o, Ae.createCoreData = v, Ae.createDraggableData = d, Ae.getBoundPosition = r, Ae.getControlPosition = c, Ae.snapToGrid = n;
- var t = Mn(), e = hr();
- function r(C, _, w2) {
- if (!C.props.bounds)
- return [_, w2];
- let {
- bounds: S
- } = C.props;
- S = typeof S == "string" ? S : y3(S);
- const R3 = p(C);
- if (typeof S == "string") {
- const {
- ownerDocument: h
- } = R3, s = h.defaultView;
- let a;
- if (S === "parent" ? a = R3.parentNode : a = h.querySelector(S), !(a instanceof s.HTMLElement))
- throw new Error('Bounds selector "' + S + '" could not find an element.');
- const u = a, b = s.getComputedStyle(R3), l = s.getComputedStyle(u);
- S = {
- left: -R3.offsetLeft + (0, t.int)(l.paddingLeft) + (0, t.int)(b.marginLeft),
- top: -R3.offsetTop + (0, t.int)(l.paddingTop) + (0, t.int)(b.marginTop),
- right: (0, e.innerWidth)(u) - (0, e.outerWidth)(R3) - R3.offsetLeft + (0, t.int)(l.paddingRight) - (0, t.int)(b.marginRight),
- bottom: (0, e.innerHeight)(u) - (0, e.outerHeight)(R3) - R3.offsetTop + (0, t.int)(l.paddingBottom) - (0, t.int)(b.marginBottom)
- };
- }
- return (0, t.isNum)(S.right) && (_ = Math.min(_, S.right)), (0, t.isNum)(S.bottom) && (w2 = Math.min(w2, S.bottom)), (0, t.isNum)(S.left) && (_ = Math.max(_, S.left)), (0, t.isNum)(S.top) && (w2 = Math.max(w2, S.top)), [_, w2];
- }
- function n(C, _, w2) {
- const S = Math.round(_ / C[0]) * C[0], R3 = Math.round(w2 / C[1]) * C[1];
- return [S, R3];
- }
- function i(C) {
- return C.props.axis === "both" || C.props.axis === "x";
- }
- function o(C) {
- return C.props.axis === "both" || C.props.axis === "y";
- }
- function c(C, _, w2) {
- const S = typeof _ == "number" ? (0, e.getTouch)(C, _) : null;
- if (typeof _ == "number" && !S)
- return null;
- const R3 = p(w2), h = w2.props.offsetParent || R3.offsetParent || R3.ownerDocument.body;
- return (0, e.offsetXYFromParent)(S || C, h, w2.props.scale);
- }
- function v(C, _, w2) {
- const S = !(0, t.isNum)(C.lastX), R3 = p(C);
- return S ? {
- node: R3,
- deltaX: 0,
- deltaY: 0,
- lastX: _,
- lastY: w2,
- x: _,
- y: w2
- } : {
- node: R3,
- deltaX: _ - C.lastX,
- deltaY: w2 - C.lastY,
- lastX: C.lastX,
- lastY: C.lastY,
- x: _,
- y: w2
- };
- }
- function d(C, _) {
- const w2 = C.props.scale;
- return {
- node: _.node,
- x: C.state.x + _.deltaX / w2,
- y: C.state.y + _.deltaY / w2,
- deltaX: _.deltaX / w2,
- deltaY: _.deltaY / w2,
- lastX: C.state.x,
- lastY: C.state.y
- };
- }
- function y3(C) {
- return {
- left: C.left,
- top: C.top,
- right: C.right,
- bottom: C.bottom
- };
- }
- function p(C) {
- const _ = C.findDOMNode();
- if (!_)
- throw new Error("<DraggableCore>: Unmounted during event!");
- return _;
- }
- return Ae;
- }
- var It = {};
- var en2 = {};
- var Fr;
- function Gi() {
- if (Fr)
- return en2;
- Fr = 1, Object.defineProperty(en2, "__esModule", {
- value: true
- }), en2.default = t;
- function t() {
- }
- return en2;
- }
- var Vr2;
- function Ys2() {
- if (Vr2)
- return It;
- Vr2 = 1, Object.defineProperty(It, "__esModule", {
- value: true
- }), It.default = void 0;
- var t = y3(import_react.default), e = v(Qe()), r = v(import_react_dom.default), n = hr(), i = Bi(), o = Mn(), c = v(Gi());
- function v(h) {
- return h && h.__esModule ? h : { default: h };
- }
- function d(h) {
- if (typeof WeakMap != "function")
- return null;
- var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap();
- return (d = function(u) {
- return u ? a : s;
- })(h);
- }
- function y3(h, s) {
- if (h && h.__esModule)
- return h;
- if (h === null || typeof h != "object" && typeof h != "function")
- return { default: h };
- var a = d(s);
- if (a && a.has(h))
- return a.get(h);
- var u = {}, b = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for (var l in h)
- if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) {
- var g = b ? Object.getOwnPropertyDescriptor(h, l) : null;
- g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l];
- }
- return u.default = h, a && a.set(h, u), u;
- }
- function p(h, s, a) {
- return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: true, configurable: true, writable: true }) : h[s] = a, h;
- }
- function C(h) {
- var s = _(h, "string");
- return typeof s == "symbol" ? s : String(s);
- }
- function _(h, s) {
- if (typeof h != "object" || h === null)
- return h;
- var a = h[Symbol.toPrimitive];
- if (a !== void 0) {
- var u = a.call(h, s || "default");
- if (typeof u != "object")
- return u;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return (s === "string" ? String : Number)(h);
- }
- const w2 = {
- touch: {
- start: "touchstart",
- move: "touchmove",
- stop: "touchend"
- },
- mouse: {
- start: "mousedown",
- move: "mousemove",
- stop: "mouseup"
- }
- };
- let S = w2.mouse, R3 = class extends t.Component {
- constructor() {
- super(...arguments), p(this, "dragging", false), p(this, "lastX", NaN), p(this, "lastY", NaN), p(this, "touchIdentifier", null), p(this, "mounted", false), p(this, "handleDragStart", (s) => {
- if (this.props.onMouseDown(s), !this.props.allowAnyClick && typeof s.button == "number" && s.button !== 0)
- return false;
- const a = this.findDOMNode();
- if (!a || !a.ownerDocument || !a.ownerDocument.body)
- throw new Error("<DraggableCore> not mounted on DragStart!");
- const {
- ownerDocument: u
- } = a;
- if (this.props.disabled || !(s.target instanceof u.defaultView.Node) || this.props.handle && !(0, n.matchesSelectorAndParentsTo)(s.target, this.props.handle, a) || this.props.cancel && (0, n.matchesSelectorAndParentsTo)(s.target, this.props.cancel, a))
- return;
- s.type === "touchstart" && s.preventDefault();
- const b = (0, n.getTouchIdentifier)(s);
- this.touchIdentifier = b;
- const l = (0, i.getControlPosition)(s, b, this);
- if (l == null)
- return;
- const {
- x: g,
- y: f
- } = l, m = (0, i.createCoreData)(this, g, f);
- (0, c.default)("DraggableCore: handleDragStart: %j", m), (0, c.default)("calling", this.props.onStart), !(this.props.onStart(s, m) === false || this.mounted === false) && (this.props.enableUserSelectHack && (0, n.addUserSelectStyles)(u), this.dragging = true, this.lastX = g, this.lastY = f, (0, n.addEvent)(u, S.move, this.handleDrag), (0, n.addEvent)(u, S.stop, this.handleDragStop));
- }), p(this, "handleDrag", (s) => {
- const a = (0, i.getControlPosition)(s, this.touchIdentifier, this);
- if (a == null)
- return;
- let {
- x: u,
- y: b
- } = a;
- if (Array.isArray(this.props.grid)) {
- let f = u - this.lastX, m = b - this.lastY;
- if ([f, m] = (0, i.snapToGrid)(this.props.grid, f, m), !f && !m)
- return;
- u = this.lastX + f, b = this.lastY + m;
- }
- const l = (0, i.createCoreData)(this, u, b);
- if ((0, c.default)("DraggableCore: handleDrag: %j", l), this.props.onDrag(s, l) === false || this.mounted === false) {
- try {
- this.handleDragStop(new MouseEvent("mouseup"));
- } catch {
- const m = document.createEvent("MouseEvents");
- m.initMouseEvent("mouseup", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null), this.handleDragStop(m);
- }
- return;
- }
- this.lastX = u, this.lastY = b;
- }), p(this, "handleDragStop", (s) => {
- if (!this.dragging)
- return;
- const a = (0, i.getControlPosition)(s, this.touchIdentifier, this);
- if (a == null)
- return;
- let {
- x: u,
- y: b
- } = a;
- if (Array.isArray(this.props.grid)) {
- let m = u - this.lastX || 0, P = b - this.lastY || 0;
- [m, P] = (0, i.snapToGrid)(this.props.grid, m, P), u = this.lastX + m, b = this.lastY + P;
- }
- const l = (0, i.createCoreData)(this, u, b);
- if (this.props.onStop(s, l) === false || this.mounted === false)
- return false;
- const f = this.findDOMNode();
- f && this.props.enableUserSelectHack && (0, n.removeUserSelectStyles)(f.ownerDocument), (0, c.default)("DraggableCore: handleDragStop: %j", l), this.dragging = false, this.lastX = NaN, this.lastY = NaN, f && ((0, c.default)("DraggableCore: Removing handlers"), (0, n.removeEvent)(f.ownerDocument, S.move, this.handleDrag), (0, n.removeEvent)(f.ownerDocument, S.stop, this.handleDragStop));
- }), p(this, "onMouseDown", (s) => (S = w2.mouse, this.handleDragStart(s))), p(this, "onMouseUp", (s) => (S = w2.mouse, this.handleDragStop(s))), p(this, "onTouchStart", (s) => (S = w2.touch, this.handleDragStart(s))), p(this, "onTouchEnd", (s) => (S = w2.touch, this.handleDragStop(s)));
- }
- componentDidMount() {
- this.mounted = true;
- const s = this.findDOMNode();
- s && (0, n.addEvent)(s, w2.touch.start, this.onTouchStart, {
- passive: false
- });
- }
- componentWillUnmount() {
- this.mounted = false;
- const s = this.findDOMNode();
- if (s) {
- const {
- ownerDocument: a
- } = s;
- (0, n.removeEvent)(a, w2.mouse.move, this.handleDrag), (0, n.removeEvent)(a, w2.touch.move, this.handleDrag), (0, n.removeEvent)(a, w2.mouse.stop, this.handleDragStop), (0, n.removeEvent)(a, w2.touch.stop, this.handleDragStop), (0, n.removeEvent)(s, w2.touch.start, this.onTouchStart, {
- passive: false
- }), this.props.enableUserSelectHack && (0, n.removeUserSelectStyles)(a);
- }
- }
- // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
- // the underlying DOM node ourselves. See the README for more information.
- findDOMNode() {
- var s, a;
- return (s = this.props) !== null && s !== void 0 && s.nodeRef ? (a = this.props) === null || a === void 0 || (a = a.nodeRef) === null || a === void 0 ? void 0 : a.current : r.default.findDOMNode(this);
- }
- render() {
- return t.cloneElement(t.Children.only(this.props.children), {
- // Note: mouseMove handler is attached to document so it will still function
- // when the user drags quickly and leaves the bounds of the element.
- onMouseDown: this.onMouseDown,
- onMouseUp: this.onMouseUp,
- // onTouchStart is added on `componentDidMount` so they can be added with
- // {passive: false}, which allows it to cancel. See
- // https://developers.google.com/web/updates/2017/01/scrolling-intervention
- onTouchEnd: this.onTouchEnd
- });
- }
- };
- return It.default = R3, p(R3, "displayName", "DraggableCore"), p(R3, "propTypes", {
- /**
- * `allowAnyClick` allows dragging using any mouse button.
- * By default, we only accept the left button.
- *
- * Defaults to `false`.
- */
- allowAnyClick: e.default.bool,
- children: e.default.node.isRequired,
- /**
- * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
- * with the exception of `onMouseDown`, will not fire.
- */
- disabled: e.default.bool,
- /**
- * By default, we add 'user-select:none' attributes to the document body
- * to prevent ugly text selection during drag. If this is causing problems
- * for your app, set this to `false`.
- */
- enableUserSelectHack: e.default.bool,
- /**
- * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
- * instead of using the parent node.
- */
- offsetParent: function(h, s) {
- if (h[s] && h[s].nodeType !== 1)
- throw new Error("Draggable's offsetParent must be a DOM Node.");
- },
- /**
- * `grid` specifies the x and y that dragging should snap to.
- */
- grid: e.default.arrayOf(e.default.number),
- /**
- * `handle` specifies a selector to be used as the handle that initiates drag.
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return (
- * <Draggable handle=".handle">
- * <div>
- * <div className="handle">Click me to drag</div>
- * <div>This is some other content</div>
- * </div>
- * </Draggable>
- * );
- * }
- * });
- * ```
- */
- handle: e.default.string,
- /**
- * `cancel` specifies a selector to be used to prevent drag initialization.
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return(
- * <Draggable cancel=".cancel">
- * <div>
- * <div className="cancel">You can't drag from here</div>
- * <div>Dragging here works fine</div>
- * </div>
- * </Draggable>
- * );
- * }
- * });
- * ```
- */
- cancel: e.default.string,
- /* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
- * Unfortunately, in order for <Draggable> to work properly, we need raw access
- * to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
- * as in this example:
- *
- * function MyComponent() {
- * const nodeRef = React.useRef(null);
- * return (
- * <Draggable nodeRef={nodeRef}>
- * <div ref={nodeRef}>Example Target</div>
- * </Draggable>
- * );
- * }
- *
- * This can be used for arbitrarily nested components, so long as the ref ends up
- * pointing to the actual child DOM node and not a custom component.
- */
- nodeRef: e.default.object,
- /**
- * Called when dragging starts.
- * If this function returns the boolean false, dragging will be canceled.
- */
- onStart: e.default.func,
- /**
- * Called while dragging.
- * If this function returns the boolean false, dragging will be canceled.
- */
- onDrag: e.default.func,
- /**
- * Called when dragging stops.
- * If this function returns the boolean false, the drag will remain active.
- */
- onStop: e.default.func,
- /**
- * A workaround option which can be passed if onMouseDown needs to be accessed,
- * since it'll always be blocked (as there is internal use of onMouseDown)
- */
- onMouseDown: e.default.func,
- /**
- * `scale`, if set, applies scaling while dragging an element
- */
- scale: e.default.number,
- /**
- * These properties should be defined on the child, not here.
- */
- className: o.dontSetMe,
- style: o.dontSetMe,
- transform: o.dontSetMe
- }), p(R3, "defaultProps", {
- allowAnyClick: false,
- // by default only accept left click
- disabled: false,
- enableUserSelectHack: true,
- onStart: function() {
- },
- onDrag: function() {
- },
- onStop: function() {
- },
- onMouseDown: function() {
- },
- scale: 1
- }), It;
- }
- var qr;
- function Ks() {
- return qr || (qr = 1, function(t) {
- Object.defineProperty(t, "__esModule", {
- value: true
- }), Object.defineProperty(t, "DraggableCore", {
- enumerable: true,
- get: function() {
- return d.default;
- }
- }), t.default = void 0;
- var e = _(import_react.default), r = p(Qe()), n = p(import_react_dom.default), i = p(Gs), o = hr(), c = Bi(), v = Mn(), d = p(Ys2()), y3 = p(Gi());
- function p(a) {
- return a && a.__esModule ? a : { default: a };
- }
- function C(a) {
- if (typeof WeakMap != "function")
- return null;
- var u = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap();
- return (C = function(l) {
- return l ? b : u;
- })(a);
- }
- function _(a, u) {
- if (a && a.__esModule)
- return a;
- if (a === null || typeof a != "object" && typeof a != "function")
- return { default: a };
- var b = C(u);
- if (b && b.has(a))
- return b.get(a);
- var l = {}, g = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for (var f in a)
- if (f !== "default" && Object.prototype.hasOwnProperty.call(a, f)) {
- var m = g ? Object.getOwnPropertyDescriptor(a, f) : null;
- m && (m.get || m.set) ? Object.defineProperty(l, f, m) : l[f] = a[f];
- }
- return l.default = a, b && b.set(a, l), l;
- }
- function w2() {
- return w2 = Object.assign ? Object.assign.bind() : function(a) {
- for (var u = 1; u < arguments.length; u++) {
- var b = arguments[u];
- for (var l in b)
- Object.prototype.hasOwnProperty.call(b, l) && (a[l] = b[l]);
- }
- return a;
- }, w2.apply(this, arguments);
- }
- function S(a, u, b) {
- return u = R3(u), u in a ? Object.defineProperty(a, u, { value: b, enumerable: true, configurable: true, writable: true }) : a[u] = b, a;
- }
- function R3(a) {
- var u = h(a, "string");
- return typeof u == "symbol" ? u : String(u);
- }
- function h(a, u) {
- if (typeof a != "object" || a === null)
- return a;
- var b = a[Symbol.toPrimitive];
- if (b !== void 0) {
- var l = b.call(a, u || "default");
- if (typeof l != "object")
- return l;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return (u === "string" ? String : Number)(a);
- }
- class s extends e.Component {
- // React 16.3+
- // Arity (props, state)
- static getDerivedStateFromProps(u, b) {
- let {
- position: l
- } = u, {
- prevPropsPosition: g
- } = b;
- return l && (!g || l.x !== g.x || l.y !== g.y) ? ((0, y3.default)("Draggable: getDerivedStateFromProps %j", {
- position: l,
- prevPropsPosition: g
- }), {
- x: l.x,
- y: l.y,
- prevPropsPosition: {
- ...l
- }
- }) : null;
- }
- constructor(u) {
- super(u), S(this, "onDragStart", (b, l) => {
- if ((0, y3.default)("Draggable: onDragStart: %j", l), this.props.onStart(b, (0, c.createDraggableData)(this, l)) === false)
- return false;
- this.setState({
- dragging: true,
- dragged: true
- });
- }), S(this, "onDrag", (b, l) => {
- if (!this.state.dragging)
- return false;
- (0, y3.default)("Draggable: onDrag: %j", l);
- const g = (0, c.createDraggableData)(this, l), f = {
- x: g.x,
- y: g.y,
- slackX: 0,
- slackY: 0
- };
- if (this.props.bounds) {
- const {
- x: P,
- y: M2
- } = f;
- f.x += this.state.slackX, f.y += this.state.slackY;
- const [j2, N3] = (0, c.getBoundPosition)(this, f.x, f.y);
- f.x = j2, f.y = N3, f.slackX = this.state.slackX + (P - f.x), f.slackY = this.state.slackY + (M2 - f.y), g.x = f.x, g.y = f.y, g.deltaX = f.x - this.state.x, g.deltaY = f.y - this.state.y;
- }
- if (this.props.onDrag(b, g) === false)
- return false;
- this.setState(f);
- }), S(this, "onDragStop", (b, l) => {
- if (!this.state.dragging || this.props.onStop(b, (0, c.createDraggableData)(this, l)) === false)
- return false;
- (0, y3.default)("Draggable: onDragStop: %j", l);
- const f = {
- dragging: false,
- slackX: 0,
- slackY: 0
- };
- if (!!this.props.position) {
- const {
- x: P,
- y: M2
- } = this.props.position;
- f.x = P, f.y = M2;
- }
- this.setState(f);
- }), this.state = {
- // Whether or not we are currently dragging.
- dragging: false,
- // Whether or not we have been dragged before.
- dragged: false,
- // Current transform x and y.
- x: u.position ? u.position.x : u.defaultPosition.x,
- y: u.position ? u.position.y : u.defaultPosition.y,
- prevPropsPosition: {
- ...u.position
- },
- // Used for compensating for out-of-bounds drags
- slackX: 0,
- slackY: 0,
- // Can only determine if SVG after mounting
- isElementSVG: false
- }, u.position && !(u.onDrag || u.onStop) && console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.");
- }
- componentDidMount() {
- typeof window.SVGElement < "u" && this.findDOMNode() instanceof window.SVGElement && this.setState({
- isElementSVG: true
- });
- }
- componentWillUnmount() {
- this.setState({
- dragging: false
- });
- }
- // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
- // the underlying DOM node ourselves. See the README for more information.
- findDOMNode() {
- var u, b;
- return (u = (b = this.props) === null || b === void 0 || (b = b.nodeRef) === null || b === void 0 ? void 0 : b.current) !== null && u !== void 0 ? u : n.default.findDOMNode(this);
- }
- render() {
- const {
- axis: u,
- bounds: b,
- children: l,
- defaultPosition: g,
- defaultClassName: f,
- defaultClassNameDragging: m,
- defaultClassNameDragged: P,
- position: M2,
- positionOffset: j2,
- scale: N3,
- ...I
- } = this.props;
- let O = {}, z = null;
- const k = !!!M2 || this.state.dragging, ie = M2 || g, ee = {
- // Set left if horizontal drag is enabled
- x: (0, c.canDragX)(this) && k ? this.state.x : ie.x,
- // Set top if vertical drag is enabled
- y: (0, c.canDragY)(this) && k ? this.state.y : ie.y
- };
- this.state.isElementSVG ? z = (0, o.createSVGTransform)(ee, j2) : O = (0, o.createCSSTransform)(ee, j2);
- const A = (0, i.default)(l.props.className || "", f, {
- [m]: this.state.dragging,
- [P]: this.state.dragged
- });
- return e.createElement(d.default, w2({}, I, {
- onStart: this.onDragStart,
- onDrag: this.onDrag,
- onStop: this.onDragStop
- }), e.cloneElement(e.Children.only(l), {
- className: A,
- style: {
- ...l.props.style,
- ...O
- },
- transform: z
- }));
- }
- }
- t.default = s, S(s, "displayName", "Draggable"), S(s, "propTypes", {
- // Accepts all props <DraggableCore> accepts.
- ...d.default.propTypes,
- /**
- * `axis` determines which axis the draggable can move.
- *
- * Note that all callbacks will still return data as normal. This only
- * controls flushing to the DOM.
- *
- * 'both' allows movement horizontally and vertically.
- * 'x' limits movement to horizontal axis.
- * 'y' limits movement to vertical axis.
- * 'none' limits all movement.
- *
- * Defaults to 'both'.
- */
- axis: r.default.oneOf(["both", "x", "y", "none"]),
- /**
- * `bounds` determines the range of movement available to the element.
- * Available values are:
- *
- * 'parent' restricts movement within the Draggable's parent node.
- *
- * Alternatively, pass an object with the following properties, all of which are optional:
- *
- * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
- *
- * All values are in px.
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return (
- * <Draggable bounds={{right: 300, bottom: 300}}>
- * <div>Content</div>
- * </Draggable>
- * );
- * }
- * });
- * ```
- */
- bounds: r.default.oneOfType([r.default.shape({
- left: r.default.number,
- right: r.default.number,
- top: r.default.number,
- bottom: r.default.number
- }), r.default.string, r.default.oneOf([false])]),
- defaultClassName: r.default.string,
- defaultClassNameDragging: r.default.string,
- defaultClassNameDragged: r.default.string,
- /**
- * `defaultPosition` specifies the x and y that the dragged item should start at
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return (
- * <Draggable defaultPosition={{x: 25, y: 25}}>
- * <div>I start with transformX: 25px and transformY: 25px;</div>
- * </Draggable>
- * );
- * }
- * });
- * ```
- */
- defaultPosition: r.default.shape({
- x: r.default.number,
- y: r.default.number
- }),
- positionOffset: r.default.shape({
- x: r.default.oneOfType([r.default.number, r.default.string]),
- y: r.default.oneOfType([r.default.number, r.default.string])
- }),
- /**
- * `position`, if present, defines the current position of the element.
- *
- * This is similar to how form elements in React work - if no `position` is supplied, the component
- * is uncontrolled.
- *
- * Example:
- *
- * ```jsx
- * let App = React.createClass({
- * render: function () {
- * return (
- * <Draggable position={{x: 25, y: 25}}>
- * <div>I start with transformX: 25px and transformY: 25px;</div>
- * </Draggable>
- * );
- * }
- * });
- * ```
- */
- position: r.default.shape({
- x: r.default.number,
- y: r.default.number
- }),
- /**
- * These properties should be defined on the child, not here.
- */
- className: v.dontSetMe,
- style: v.dontSetMe,
- transform: v.dontSetMe
- }), S(s, "defaultProps", {
- ...d.default.defaultProps,
- axis: "both",
- bounds: false,
- defaultClassName: "react-draggable",
- defaultClassNameDragging: "react-draggable-dragging",
- defaultClassNameDragged: "react-draggable-dragged",
- defaultPosition: {
- x: 0,
- y: 0
- },
- scale: 1
- });
- }(Bn)), Bn;
- }
- var Ar;
- function pr() {
- if (Ar)
- return xt.exports;
- Ar = 1;
- const {
- default: t,
- DraggableCore: e
- } = Ks();
- return xt.exports = t, xt.exports.default = t, xt.exports.DraggableCore = e, xt.exports;
- }
- var Et = { exports: {} };
- var Tt = {};
- var tn = {};
- var Wr;
- function Zs() {
- if (Wr)
- return tn;
- Wr = 1, tn.__esModule = true, tn.cloneElement = v;
- var t = e(import_react.default);
- function e(d) {
- return d && d.__esModule ? d : { default: d };
- }
- function r(d, y3) {
- var p = Object.keys(d);
- if (Object.getOwnPropertySymbols) {
- var C = Object.getOwnPropertySymbols(d);
- y3 && (C = C.filter(function(_) {
- return Object.getOwnPropertyDescriptor(d, _).enumerable;
- })), p.push.apply(p, C);
- }
- return p;
- }
- function n(d) {
- for (var y3 = 1; y3 < arguments.length; y3++) {
- var p = arguments[y3] != null ? arguments[y3] : {};
- y3 % 2 ? r(Object(p), true).forEach(function(C) {
- i(d, C, p[C]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(d, Object.getOwnPropertyDescriptors(p)) : r(Object(p)).forEach(function(C) {
- Object.defineProperty(d, C, Object.getOwnPropertyDescriptor(p, C));
- });
- }
- return d;
- }
- function i(d, y3, p) {
- return y3 = o(y3), y3 in d ? Object.defineProperty(d, y3, { value: p, enumerable: true, configurable: true, writable: true }) : d[y3] = p, d;
- }
- function o(d) {
- var y3 = c(d, "string");
- return typeof y3 == "symbol" ? y3 : String(y3);
- }
- function c(d, y3) {
- if (typeof d != "object" || d === null)
- return d;
- var p = d[Symbol.toPrimitive];
- if (p !== void 0) {
- var C = p.call(d, y3 || "default");
- if (typeof C != "object")
- return C;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return (y3 === "string" ? String : Number)(d);
- }
- function v(d, y3) {
- return y3.style && d.props.style && (y3.style = n(n({}, d.props.style), y3.style)), y3.className && d.props.className && (y3.className = d.props.className + " " + y3.className), t.default.cloneElement(d, y3);
- }
- return tn;
- }
- var Pt2 = {};
- var Hr2;
- function Xi() {
- if (Hr2)
- return Pt2;
- Hr2 = 1, Pt2.__esModule = true, Pt2.resizableProps = void 0;
- var t = e(Qe());
- pr();
- function e(n) {
- return n && n.__esModule ? n : { default: n };
- }
- var r = {
- /*
- * Restricts resizing to a particular axis (default: 'both')
- * 'both' - allows resizing by width or height
- * 'x' - only allows the width to be changed
- * 'y' - only allows the height to be changed
- * 'none' - disables resizing altogether
- * */
- axis: t.default.oneOf(["both", "x", "y", "none"]),
- className: t.default.string,
- /*
- * Require that one and only one child be present.
- * */
- children: t.default.element.isRequired,
- /*
- * These will be passed wholesale to react-draggable's DraggableCore
- * */
- draggableOpts: t.default.shape({
- allowAnyClick: t.default.bool,
- cancel: t.default.string,
- children: t.default.node,
- disabled: t.default.bool,
- enableUserSelectHack: t.default.bool,
- offsetParent: t.default.node,
- grid: t.default.arrayOf(t.default.number),
- handle: t.default.string,
- nodeRef: t.default.object,
- onStart: t.default.func,
- onDrag: t.default.func,
- onStop: t.default.func,
- onMouseDown: t.default.func,
- scale: t.default.number
- }),
- /*
- * Initial height
- * */
- height: function() {
- for (var i = arguments.length, o = new Array(i), c = 0; c < i; c++)
- o[c] = arguments[c];
- var v = o[0];
- if (v.axis === "both" || v.axis === "y") {
- var d;
- return (d = t.default.number).isRequired.apply(d, o);
- }
- return t.default.number.apply(t.default, o);
- },
- /*
- * Customize cursor resize handle
- * */
- handle: t.default.oneOfType([t.default.node, t.default.func]),
- /*
- * If you change this, be sure to update your css
- * */
- handleSize: t.default.arrayOf(t.default.number),
- lockAspectRatio: t.default.bool,
- /*
- * Max X & Y measure
- * */
- maxConstraints: t.default.arrayOf(t.default.number),
- /*
- * Min X & Y measure
- * */
- minConstraints: t.default.arrayOf(t.default.number),
- /*
- * Called on stop resize event
- * */
- onResizeStop: t.default.func,
- /*
- * Called on start resize event
- * */
- onResizeStart: t.default.func,
- /*
- * Called on resize event
- * */
- onResize: t.default.func,
- /*
- * Defines which resize handles should be rendered (default: 'se')
- * 's' - South handle (bottom-center)
- * 'w' - West handle (left-center)
- * 'e' - East handle (right-center)
- * 'n' - North handle (top-center)
- * 'sw' - Southwest handle (bottom-left)
- * 'nw' - Northwest handle (top-left)
- * 'se' - Southeast handle (bottom-right)
- * 'ne' - Northeast handle (top-center)
- * */
- resizeHandles: t.default.arrayOf(t.default.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"])),
- /*
- * If `transform: scale(n)` is set on the parent, this should be set to `n`.
- * */
- transformScale: t.default.number,
- /*
- * Initial width
- */
- width: function() {
- for (var i = arguments.length, o = new Array(i), c = 0; c < i; c++)
- o[c] = arguments[c];
- var v = o[0];
- if (v.axis === "both" || v.axis === "x") {
- var d;
- return (d = t.default.number).isRequired.apply(d, o);
- }
- return t.default.number.apply(t.default, o);
- }
- };
- return Pt2.resizableProps = r, Pt2;
- }
- var Ur;
- function Yi() {
- if (Ur)
- return Tt;
- Ur = 1, Tt.__esModule = true, Tt.default = void 0;
- var t = c(import_react.default), e = pr(), r = Zs(), n = Xi(), i = ["children", "className", "draggableOpts", "width", "height", "handle", "handleSize", "lockAspectRatio", "axis", "minConstraints", "maxConstraints", "onResize", "onResizeStop", "onResizeStart", "resizeHandles", "transformScale"];
- function o(s) {
- if (typeof WeakMap != "function")
- return null;
- var a = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap();
- return (o = function(l) {
- return l ? u : a;
- })(s);
- }
- function c(s, a) {
- if (s && s.__esModule)
- return s;
- if (s === null || typeof s != "object" && typeof s != "function")
- return { default: s };
- var u = o(a);
- if (u && u.has(s))
- return u.get(s);
- var b = {}, l = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for (var g in s)
- if (g !== "default" && Object.prototype.hasOwnProperty.call(s, g)) {
- var f = l ? Object.getOwnPropertyDescriptor(s, g) : null;
- f && (f.get || f.set) ? Object.defineProperty(b, g, f) : b[g] = s[g];
- }
- return b.default = s, u && u.set(s, b), b;
- }
- function v() {
- return v = Object.assign ? Object.assign.bind() : function(s) {
- for (var a = 1; a < arguments.length; a++) {
- var u = arguments[a];
- for (var b in u)
- Object.prototype.hasOwnProperty.call(u, b) && (s[b] = u[b]);
- }
- return s;
- }, v.apply(this, arguments);
- }
- function d(s, a) {
- if (s == null)
- return {};
- var u = {}, b = Object.keys(s), l, g;
- for (g = 0; g < b.length; g++)
- l = b[g], !(a.indexOf(l) >= 0) && (u[l] = s[l]);
- return u;
- }
- function y3(s, a) {
- var u = Object.keys(s);
- if (Object.getOwnPropertySymbols) {
- var b = Object.getOwnPropertySymbols(s);
- a && (b = b.filter(function(l) {
- return Object.getOwnPropertyDescriptor(s, l).enumerable;
- })), u.push.apply(u, b);
- }
- return u;
- }
- function p(s) {
- for (var a = 1; a < arguments.length; a++) {
- var u = arguments[a] != null ? arguments[a] : {};
- a % 2 ? y3(Object(u), true).forEach(function(b) {
- C(s, b, u[b]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(u)) : y3(Object(u)).forEach(function(b) {
- Object.defineProperty(s, b, Object.getOwnPropertyDescriptor(u, b));
- });
- }
- return s;
- }
- function C(s, a, u) {
- return a = _(a), a in s ? Object.defineProperty(s, a, { value: u, enumerable: true, configurable: true, writable: true }) : s[a] = u, s;
- }
- function _(s) {
- var a = w2(s, "string");
- return typeof a == "symbol" ? a : String(a);
- }
- function w2(s, a) {
- if (typeof s != "object" || s === null)
- return s;
- var u = s[Symbol.toPrimitive];
- if (u !== void 0) {
- var b = u.call(s, a || "default");
- if (typeof b != "object")
- return b;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return (a === "string" ? String : Number)(s);
- }
- function S(s, a) {
- s.prototype = Object.create(a.prototype), s.prototype.constructor = s, R3(s, a);
- }
- function R3(s, a) {
- return R3 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(b, l) {
- return b.__proto__ = l, b;
- }, R3(s, a);
- }
- var h = function(s) {
- S(a, s);
- function a() {
- for (var b, l = arguments.length, g = new Array(l), f = 0; f < l; f++)
- g[f] = arguments[f];
- return b = s.call.apply(s, [this].concat(g)) || this, b.handleRefs = {}, b.lastHandleRect = null, b.slack = null, b;
- }
- var u = a.prototype;
- return u.componentWillUnmount = function() {
- this.resetData();
- }, u.resetData = function() {
- this.lastHandleRect = this.slack = null;
- }, u.runConstraints = function(l, g) {
- var f = this.props, m = f.minConstraints, P = f.maxConstraints, M2 = f.lockAspectRatio;
- if (!m && !P && !M2)
- return [l, g];
- if (M2) {
- var j2 = this.props.width / this.props.height, N3 = l - this.props.width, I = g - this.props.height;
- Math.abs(N3) > Math.abs(I * j2) ? g = l / j2 : l = g * j2;
- }
- var O = l, z = g, U = this.slack || [0, 0], k = U[0], ie = U[1];
- return l += k, g += ie, m && (l = Math.max(m[0], l), g = Math.max(m[1], g)), P && (l = Math.min(P[0], l), g = Math.min(P[1], g)), this.slack = [k + (O - l), ie + (z - g)], [l, g];
- }, u.resizeHandler = function(l, g) {
- var f = this;
- return function(m, P) {
- var M2 = P.node, j2 = P.deltaX, N3 = P.deltaY;
- l === "onResizeStart" && f.resetData();
- var I = (f.props.axis === "both" || f.props.axis === "x") && g !== "n" && g !== "s", O = (f.props.axis === "both" || f.props.axis === "y") && g !== "e" && g !== "w";
- if (!(!I && !O)) {
- var z = g[0], U = g[g.length - 1], k = M2.getBoundingClientRect();
- if (f.lastHandleRect != null) {
- if (U === "w") {
- var ie = k.left - f.lastHandleRect.left;
- j2 += ie;
- }
- if (z === "n") {
- var ee = k.top - f.lastHandleRect.top;
- N3 += ee;
- }
- }
- f.lastHandleRect = k, U === "w" && (j2 = -j2), z === "n" && (N3 = -N3);
- var A = f.props.width + (I ? j2 / f.props.transformScale : 0), F2 = f.props.height + (O ? N3 / f.props.transformScale : 0), oe = f.runConstraints(A, F2);
- A = oe[0], F2 = oe[1];
- var se = A !== f.props.width || F2 !== f.props.height, de = typeof f.props[l] == "function" ? f.props[l] : null, ye = l === "onResize" && !se;
- de && !ye && (m.persist == null || m.persist(), de(m, {
- node: M2,
- size: {
- width: A,
- height: F2
- },
- handle: g
- })), l === "onResizeStop" && f.resetData();
- }
- };
- }, u.renderResizeHandle = function(l, g) {
- var f = this.props.handle;
- if (!f)
- return t.createElement("span", {
- className: "react-resizable-handle react-resizable-handle-" + l,
- ref: g
- });
- if (typeof f == "function")
- return f(l, g);
- var m = typeof f.type == "string", P = p({
- ref: g
- }, m ? {} : {
- handleAxis: l
- });
- return t.cloneElement(f, P);
- }, u.render = function() {
- var l = this, g = this.props, f = g.children, m = g.className, P = g.draggableOpts;
- g.width, g.height, g.handle, g.handleSize, g.lockAspectRatio, g.axis, g.minConstraints, g.maxConstraints, g.onResize, g.onResizeStop, g.onResizeStart;
- var M2 = g.resizeHandles;
- g.transformScale;
- var j2 = d(g, i);
- return (0, r.cloneElement)(f, p(p({}, j2), {}, {
- className: (m ? m + " " : "") + "react-resizable",
- children: [].concat(f.props.children, M2.map(function(N3) {
- var I, O = (I = l.handleRefs[N3]) != null ? I : l.handleRefs[N3] = t.createRef();
- return t.createElement(e.DraggableCore, v({}, P, {
- nodeRef: O,
- key: "resizableHandle-" + N3,
- onStop: l.resizeHandler("onResizeStop", N3),
- onStart: l.resizeHandler("onResizeStart", N3),
- onDrag: l.resizeHandler("onResize", N3)
- }), l.renderResizeHandle(N3, O));
- }))
- }));
- }, a;
- }(t.Component);
- return Tt.default = h, h.propTypes = n.resizableProps, h.defaultProps = {
- axis: "both",
- handleSize: [20, 20],
- lockAspectRatio: false,
- minConstraints: [20, 20],
- maxConstraints: [1 / 0, 1 / 0],
- resizeHandles: ["se"],
- transformScale: 1
- }, Tt;
- }
- var Ot2 = {};
- var kr;
- function Js() {
- if (kr)
- return Ot2;
- kr = 1, Ot2.__esModule = true, Ot2.default = void 0;
- var t = v(import_react.default), e = o(Qe()), r = o(Yi()), n = Xi(), i = ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles", "style", "transformScale"];
- function o(a) {
- return a && a.__esModule ? a : { default: a };
- }
- function c(a) {
- if (typeof WeakMap != "function")
- return null;
- var u = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap();
- return (c = function(g) {
- return g ? b : u;
- })(a);
- }
- function v(a, u) {
- if (a && a.__esModule)
- return a;
- if (a === null || typeof a != "object" && typeof a != "function")
- return { default: a };
- var b = c(u);
- if (b && b.has(a))
- return b.get(a);
- var l = {}, g = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for (var f in a)
- if (f !== "default" && Object.prototype.hasOwnProperty.call(a, f)) {
- var m = g ? Object.getOwnPropertyDescriptor(a, f) : null;
- m && (m.get || m.set) ? Object.defineProperty(l, f, m) : l[f] = a[f];
- }
- return l.default = a, b && b.set(a, l), l;
- }
- function d() {
- return d = Object.assign ? Object.assign.bind() : function(a) {
- for (var u = 1; u < arguments.length; u++) {
- var b = arguments[u];
- for (var l in b)
- Object.prototype.hasOwnProperty.call(b, l) && (a[l] = b[l]);
- }
- return a;
- }, d.apply(this, arguments);
- }
- function y3(a, u) {
- var b = Object.keys(a);
- if (Object.getOwnPropertySymbols) {
- var l = Object.getOwnPropertySymbols(a);
- u && (l = l.filter(function(g) {
- return Object.getOwnPropertyDescriptor(a, g).enumerable;
- })), b.push.apply(b, l);
- }
- return b;
- }
- function p(a) {
- for (var u = 1; u < arguments.length; u++) {
- var b = arguments[u] != null ? arguments[u] : {};
- u % 2 ? y3(Object(b), true).forEach(function(l) {
- C(a, l, b[l]);
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(b)) : y3(Object(b)).forEach(function(l) {
- Object.defineProperty(a, l, Object.getOwnPropertyDescriptor(b, l));
- });
- }
- return a;
- }
- function C(a, u, b) {
- return u = _(u), u in a ? Object.defineProperty(a, u, { value: b, enumerable: true, configurable: true, writable: true }) : a[u] = b, a;
- }
- function _(a) {
- var u = w2(a, "string");
- return typeof u == "symbol" ? u : String(u);
- }
- function w2(a, u) {
- if (typeof a != "object" || a === null)
- return a;
- var b = a[Symbol.toPrimitive];
- if (b !== void 0) {
- var l = b.call(a, u || "default");
- if (typeof l != "object")
- return l;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return (u === "string" ? String : Number)(a);
- }
- function S(a, u) {
- if (a == null)
- return {};
- var b = {}, l = Object.keys(a), g, f;
- for (f = 0; f < l.length; f++)
- g = l[f], !(u.indexOf(g) >= 0) && (b[g] = a[g]);
- return b;
- }
- function R3(a, u) {
- a.prototype = Object.create(u.prototype), a.prototype.constructor = a, h(a, u);
- }
- function h(a, u) {
- return h = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, g) {
- return l.__proto__ = g, l;
- }, h(a, u);
- }
- var s = function(a) {
- R3(u, a);
- function u() {
- for (var l, g = arguments.length, f = new Array(g), m = 0; m < g; m++)
- f[m] = arguments[m];
- return l = a.call.apply(a, [this].concat(f)) || this, l.state = {
- width: l.props.width,
- height: l.props.height,
- propsWidth: l.props.width,
- propsHeight: l.props.height
- }, l.onResize = function(P, M2) {
- var j2 = M2.size;
- l.props.onResize ? (P.persist == null || P.persist(), l.setState(j2, function() {
- return l.props.onResize && l.props.onResize(P, M2);
- })) : l.setState(j2);
- }, l;
- }
- u.getDerivedStateFromProps = function(g, f) {
- return f.propsWidth !== g.width || f.propsHeight !== g.height ? {
- width: g.width,
- height: g.height,
- propsWidth: g.width,
- propsHeight: g.height
- } : null;
- };
- var b = u.prototype;
- return b.render = function() {
- var g = this.props, f = g.handle, m = g.handleSize;
- g.onResize;
- var P = g.onResizeStart, M2 = g.onResizeStop, j2 = g.draggableOpts, N3 = g.minConstraints, I = g.maxConstraints, O = g.lockAspectRatio, z = g.axis;
- g.width, g.height;
- var U = g.resizeHandles, k = g.style, ie = g.transformScale, ee = S(g, i);
- return t.createElement(r.default, {
- axis: z,
- draggableOpts: j2,
- handle: f,
- handleSize: m,
- height: this.state.height,
- lockAspectRatio: O,
- maxConstraints: I,
- minConstraints: N3,
- onResizeStart: P,
- onResize: this.onResize,
- onResizeStop: M2,
- resizeHandles: U,
- transformScale: ie,
- width: this.state.width
- }, t.createElement("div", d({}, ee, {
- style: p(p({}, k), {}, {
- width: this.state.width + "px",
- height: this.state.height + "px"
- })
- })));
- }, u;
- }(t.Component);
- return Ot2.default = s, s.propTypes = p(p({}, n.resizableProps), {}, {
- children: e.default.element
- }), Ot2;
- }
- var Br;
- function Qs() {
- return Br || (Br = 1, Et.exports = function() {
- throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable");
- }, Et.exports.Resizable = Yi().default, Et.exports.ResizableBox = Js().default), Et.exports;
- }
- var Ue = {};
- var Gr;
- function Ki() {
- if (Gr)
- return Ue;
- Gr = 1, Object.defineProperty(Ue, "__esModule", {
- value: true
- }), Ue.resizeHandleType = Ue.resizeHandleAxesType = Ue.default = void 0;
- var t = r(Qe()), e = r(import_react.default);
- function r(o) {
- return o && o.__esModule ? o : { default: o };
- }
- const n = Ue.resizeHandleAxesType = t.default.arrayOf(t.default.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"])), i = Ue.resizeHandleType = t.default.oneOfType([t.default.node, t.default.func]);
- return Ue.default = {
- //
- // Basic props
- //
- className: t.default.string,
- style: t.default.object,
- // This can be set explicitly. If it is not set, it will automatically
- // be set to the container width. Note that resizes will *not* cause this to adjust.
- // If you need that behavior, use WidthProvider.
- width: t.default.number,
- // If true, the container height swells and contracts to fit contents
- autoSize: t.default.bool,
- // # of cols.
- cols: t.default.number,
- // A selector that will not be draggable.
- draggableCancel: t.default.string,
- // A selector for the draggable handler
- draggableHandle: t.default.string,
- // Deprecated
- verticalCompact: function(o) {
- o.verticalCompact;
- },
- // Choose vertical or hotizontal compaction
- compactType: t.default.oneOf(["vertical", "horizontal"]),
- // layout is an array of object with the format:
- // {x: Number, y: Number, w: Number, h: Number, i: String}
- layout: function(o) {
- var c = o.layout;
- c !== void 0 && St().validateLayout(c, "layout");
- },
- //
- // Grid Dimensions
- //
- // Margin between items [x, y] in px
- margin: t.default.arrayOf(t.default.number),
- // Padding inside the container [x, y] in px
- containerPadding: t.default.arrayOf(t.default.number),
- // Rows have a static height, but you can change this based on breakpoints if you like
- rowHeight: t.default.number,
- // Default Infinity, but you can specify a max here if you like.
- // Note that this isn't fully fleshed out and won't error if you specify a layout that
- // extends beyond the row capacity. It will, however, not allow users to drag/resize
- // an item past the barrier. They can push items beyond the barrier, though.
- // Intentionally not documented for this reason.
- maxRows: t.default.number,
- //
- // Flags
- //
- isBounded: t.default.bool,
- isDraggable: t.default.bool,
- isResizable: t.default.bool,
- // If true, grid can be placed one over the other.
- allowOverlap: t.default.bool,
- // If true, grid items won't change position when being dragged over.
- preventCollision: t.default.bool,
- // Use CSS transforms instead of top/left
- useCSSTransforms: t.default.bool,
- // parent layout transform scale
- transformScale: t.default.number,
- // If true, an external element can trigger onDrop callback with a specific grid position as a parameter
- isDroppable: t.default.bool,
- // Resize handle options
- resizeHandles: n,
- resizeHandle: i,
- //
- // Callbacks
- //
- // Callback so you can save the layout. Calls after each drag & resize stops.
- onLayoutChange: t.default.func,
- // Calls when drag starts. Callback is of the signature (layout, oldItem, newItem, placeholder, e, ?node).
- // All callbacks below have the same signature. 'start' and 'stop' callbacks omit the 'placeholder'.
- onDragStart: t.default.func,
- // Calls on each drag movement.
- onDrag: t.default.func,
- // Calls when drag is complete.
- onDragStop: t.default.func,
- //Calls when resize starts.
- onResizeStart: t.default.func,
- // Calls when resize movement happens.
- onResize: t.default.func,
- // Calls when resize is complete.
- onResizeStop: t.default.func,
- // Calls when some element is dropped.
- onDrop: t.default.func,
- //
- // Other validations
- //
- droppingItem: t.default.shape({
- i: t.default.string.isRequired,
- w: t.default.number.isRequired,
- h: t.default.number.isRequired
- }),
- // Children must not have duplicate keys.
- children: function(o, c) {
- const v = o[c], d = {};
- e.default.Children.forEach(v, function(y3) {
- if ((y3 == null ? void 0 : y3.key) != null) {
- if (d[y3.key])
- throw new Error('Duplicate child key "' + y3.key + '" found! This will cause problems in ReactGridLayout.');
- d[y3.key] = true;
- }
- });
- },
- // Optional ref for getting a reference for the wrapping div.
- innerRef: t.default.any
- }, Ue;
- }
- var Xr;
- function ea() {
- if (Xr)
- return _t2;
- Xr = 1, Object.defineProperty(_t2, "__esModule", {
- value: true
- }), _t2.default = void 0;
- var t = d(import_react.default), e = d(Qe()), r = pr(), n = Qs(), i = St(), o = fr2(), c = Ki(), v = d(dr());
- function d(w2) {
- return w2 && w2.__esModule ? w2 : { default: w2 };
- }
- function y3(w2, S, R3) {
- return S = p(S), S in w2 ? Object.defineProperty(w2, S, { value: R3, enumerable: true, configurable: true, writable: true }) : w2[S] = R3, w2;
- }
- function p(w2) {
- var S = C(w2, "string");
- return typeof S == "symbol" ? S : String(S);
- }
- function C(w2, S) {
- if (typeof w2 != "object" || w2 === null)
- return w2;
- var R3 = w2[Symbol.toPrimitive];
- if (R3 !== void 0) {
- var h = R3.call(w2, S || "default");
- if (typeof h != "object")
- return h;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return (S === "string" ? String : Number)(w2);
- }
- let _ = class extends t.default.Component {
- constructor() {
- super(...arguments), y3(this, "state", {
- resizing: null,
- dragging: null,
- className: ""
- }), y3(this, "elementRef", t.default.createRef()), y3(this, "onDragStart", (S, R3) => {
- let {
- node: h
- } = R3;
- const {
- onDragStart: s,
- transformScale: a
- } = this.props;
- if (!s)
- return;
- const u = {
- top: 0,
- left: 0
- }, {
- offsetParent: b
- } = h;
- if (!b)
- return;
- const l = b.getBoundingClientRect(), g = h.getBoundingClientRect(), f = g.left / a, m = l.left / a, P = g.top / a, M2 = l.top / a;
- u.left = f - m + b.scrollLeft, u.top = P - M2 + b.scrollTop, this.setState({
- dragging: u
- });
- const {
- x: j2,
- y: N3
- } = (0, o.calcXY)(this.getPositionParams(), u.top, u.left, this.props.w, this.props.h);
- return s.call(this, this.props.i, j2, N3, {
- e: S,
- node: h,
- newPosition: u
- });
- }), y3(this, "onDrag", (S, R3) => {
- let {
- node: h,
- deltaX: s,
- deltaY: a
- } = R3;
- const {
- onDrag: u
- } = this.props;
- if (!u)
- return;
- if (!this.state.dragging)
- throw new Error("onDrag called before onDragStart.");
- let b = this.state.dragging.top + a, l = this.state.dragging.left + s;
- const {
- isBounded: g,
- i: f,
- w: m,
- h: P,
- containerWidth: M2
- } = this.props, j2 = this.getPositionParams();
- if (g) {
- const {
- offsetParent: U
- } = h;
- if (U) {
- const {
- margin: k,
- rowHeight: ie,
- containerPadding: ee
- } = this.props, A = U.clientHeight - (0, o.calcGridItemWHPx)(P, ie, k[1]);
- b = (0, o.clamp)(b - ee[1], 0, A);
- const F2 = (0, o.calcGridColWidth)(j2), oe = M2 - (0, o.calcGridItemWHPx)(m, F2, k[0]);
- l = (0, o.clamp)(l - ee[0], 0, oe);
- }
- }
- const N3 = {
- top: b,
- left: l
- };
- this.setState({
- dragging: N3
- });
- const {
- containerPadding: I
- } = this.props, {
- x: O,
- y: z
- } = (0, o.calcXY)(j2, b - I[1], l - I[0], m, P);
- return u.call(this, f, O, z, {
- e: S,
- node: h,
- newPosition: N3
- });
- }), y3(this, "onDragStop", (S, R3) => {
- let {
- node: h
- } = R3;
- const {
- onDragStop: s
- } = this.props;
- if (!s)
- return;
- if (!this.state.dragging)
- throw new Error("onDragEnd called before onDragStart.");
- const {
- w: a,
- h: u,
- i: b,
- containerPadding: l
- } = this.props, {
- left: g,
- top: f
- } = this.state.dragging, m = {
- top: f,
- left: g
- };
- this.setState({
- dragging: null
- });
- const {
- x: P,
- y: M2
- } = (0, o.calcXY)(this.getPositionParams(), f - l[1], g - l[0], a, u);
- return s.call(this, b, P, M2, {
- e: S,
- node: h,
- newPosition: m
- });
- }), y3(this, "onResizeStop", (S, R3, h) => this.onResizeHandler(S, R3, h, "onResizeStop")), y3(this, "onResizeStart", (S, R3, h) => this.onResizeHandler(S, R3, h, "onResizeStart")), y3(this, "onResize", (S, R3, h) => this.onResizeHandler(S, R3, h, "onResize"));
- }
- shouldComponentUpdate(S, R3) {
- if (this.props.children !== S.children || this.props.droppingPosition !== S.droppingPosition)
- return true;
- const h = (0, o.calcGridItemPosition)(this.getPositionParams(this.props), this.props.x, this.props.y, this.props.w, this.props.h, this.state), s = (0, o.calcGridItemPosition)(this.getPositionParams(S), S.x, S.y, S.w, S.h, R3);
- return !(0, i.fastPositionEqual)(h, s) || this.props.useCSSTransforms !== S.useCSSTransforms;
- }
- componentDidMount() {
- this.moveDroppingItem({});
- }
- componentDidUpdate(S) {
- this.moveDroppingItem(S);
- }
- // When a droppingPosition is present, this means we should fire a move event, as if we had moved
- // this element by `x, y` pixels.
- moveDroppingItem(S) {
- const {
- droppingPosition: R3
- } = this.props;
- if (!R3)
- return;
- const h = this.elementRef.current;
- if (!h)
- return;
- const s = S.droppingPosition || {
- left: 0,
- top: 0
- }, {
- dragging: a
- } = this.state, u = a && R3.left !== s.left || R3.top !== s.top;
- if (!a)
- this.onDragStart(R3.e, {
- node: h,
- deltaX: R3.left,
- deltaY: R3.top
- });
- else if (u) {
- const b = R3.left - a.left, l = R3.top - a.top;
- this.onDrag(R3.e, {
- node: h,
- deltaX: b,
- deltaY: l
- });
- }
- }
- getPositionParams() {
- let S = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
- return {
- cols: S.cols,
- containerPadding: S.containerPadding,
- containerWidth: S.containerWidth,
- margin: S.margin,
- maxRows: S.maxRows,
- rowHeight: S.rowHeight
- };
- }
- /**
- * This is where we set the grid item's absolute placement. It gets a little tricky because we want to do it
- * well when server rendering, and the only way to do that properly is to use percentage width/left because
- * we don't know exactly what the browser viewport is.
- * Unfortunately, CSS Transforms, which are great for performance, break in this instance because a percentage
- * left is relative to the item itself, not its container! So we cannot use them on the server rendering pass.
- *
- * @param {Object} pos Position object with width, height, left, top.
- * @return {Object} Style object.
- */
- createStyle(S) {
- const {
- usePercentages: R3,
- containerWidth: h,
- useCSSTransforms: s
- } = this.props;
- let a;
- return s ? a = (0, i.setTransform)(S) : (a = (0, i.setTopLeft)(S), R3 && (a.left = (0, i.perc)(S.left / h), a.width = (0, i.perc)(S.width / h))), a;
- }
- /**
- * Mix a Draggable instance into a child.
- * @param {Element} child Child element.
- * @return {Element} Child wrapped in Draggable.
- */
- mixinDraggable(S, R3) {
- return t.default.createElement(r.DraggableCore, {
- disabled: !R3,
- onStart: this.onDragStart,
- onDrag: this.onDrag,
- onStop: this.onDragStop,
- handle: this.props.handle,
- cancel: ".react-resizable-handle" + (this.props.cancel ? "," + this.props.cancel : ""),
- scale: this.props.transformScale,
- nodeRef: this.elementRef
- }, S);
- }
- /**
- * Utility function to setup callback handler definitions for
- * similarily structured resize events.
- */
- curryResizeHandler(S, R3) {
- return (h, s) => (
- /*: Function*/
- R3(h, s, S)
- );
- }
- /**
- * Mix a Resizable instance into a child.
- * @param {Element} child Child element.
- * @param {Object} position Position object (pixel values)
- * @return {Element} Child wrapped in Resizable.
- */
- mixinResizable(S, R3, h) {
- const {
- cols: s,
- minW: a,
- minH: u,
- maxW: b,
- maxH: l,
- transformScale: g,
- resizeHandles: f,
- resizeHandle: m
- } = this.props, P = this.getPositionParams(), M2 = (0, o.calcGridItemPosition)(P, 0, 0, s, 0).width, j2 = (0, o.calcGridItemPosition)(P, 0, 0, a, u), N3 = (0, o.calcGridItemPosition)(P, 0, 0, b, l), I = [j2.width, j2.height], O = [Math.min(N3.width, M2), Math.min(N3.height, 1 / 0)];
- return t.default.createElement(
- n.Resizable,
- {
- draggableOpts: {
- disabled: !h
- },
- className: h ? void 0 : "react-resizable-hide",
- width: R3.width,
- height: R3.height,
- minConstraints: I,
- maxConstraints: O,
- onResizeStop: this.curryResizeHandler(R3, this.onResizeStop),
- onResizeStart: this.curryResizeHandler(R3, this.onResizeStart),
- onResize: this.curryResizeHandler(R3, this.onResize),
- transformScale: g,
- resizeHandles: f,
- handle: m
- },
- S
- );
- }
- /**
- * Wrapper around resize events to provide more useful data.
- */
- onResizeHandler(S, R3, h, s) {
- let {
- node: a,
- size: u,
- handle: b
- } = R3;
- const l = this.props[s];
- if (!l)
- return;
- const {
- x: g,
- y: f,
- i: m,
- maxH: P,
- minH: M2,
- containerWidth: j2
- } = this.props, {
- minW: N3,
- maxW: I
- } = this.props;
- let O = u;
- a && (O = (0, i.resizeItemInDirection)(b, h, u, j2), this.setState({
- resizing: s === "onResizeStop" ? null : O
- }));
- let {
- w: z,
- h: U
- } = (0, o.calcWH)(this.getPositionParams(), O.width, O.height, g, f, b);
- z = (0, o.clamp)(z, Math.max(N3, 1), I), U = (0, o.clamp)(U, M2, P), l.call(this, m, z, U, {
- e: S,
- node: a,
- size: O,
- handle: b
- });
- }
- render() {
- const {
- x: S,
- y: R3,
- w: h,
- h: s,
- isDraggable: a,
- isResizable: u,
- droppingPosition: b,
- useCSSTransforms: l
- } = this.props, g = (0, o.calcGridItemPosition)(this.getPositionParams(), S, R3, h, s, this.state), f = t.default.Children.only(this.props.children);
- let m = t.default.cloneElement(f, {
- ref: this.elementRef,
- className: (0, v.default)("react-grid-item", f.props.className, this.props.className, {
- static: this.props.static,
- resizing: !!this.state.resizing,
- "react-draggable": a,
- "react-draggable-dragging": !!this.state.dragging,
- dropping: !!b,
- cssTransforms: l
- }),
- // We can set the width and height on the child, but unfortunately we can't set the position.
- style: {
- ...this.props.style,
- ...f.props.style,
- ...this.createStyle(g)
- }
- });
- return m = this.mixinResizable(m, g, u), m = this.mixinDraggable(m, a), m;
- }
- };
- return _t2.default = _, y3(_, "propTypes", {
- // Children must be only a single element
- children: e.default.element,
- // General grid attributes
- cols: e.default.number.isRequired,
- containerWidth: e.default.number.isRequired,
- rowHeight: e.default.number.isRequired,
- margin: e.default.array.isRequired,
- maxRows: e.default.number.isRequired,
- containerPadding: e.default.array.isRequired,
- // These are all in grid units
- x: e.default.number.isRequired,
- y: e.default.number.isRequired,
- w: e.default.number.isRequired,
- h: e.default.number.isRequired,
- // All optional
- minW: function(w2, S) {
- const R3 = w2[S];
- if (typeof R3 != "number")
- return new Error("minWidth not Number");
- if (R3 > w2.w || R3 > w2.maxW)
- return new Error("minWidth larger than item width/maxWidth");
- },
- maxW: function(w2, S) {
- const R3 = w2[S];
- if (typeof R3 != "number")
- return new Error("maxWidth not Number");
- if (R3 < w2.w || R3 < w2.minW)
- return new Error("maxWidth smaller than item width/minWidth");
- },
- minH: function(w2, S) {
- const R3 = w2[S];
- if (typeof R3 != "number")
- return new Error("minHeight not Number");
- if (R3 > w2.h || R3 > w2.maxH)
- return new Error("minHeight larger than item height/maxHeight");
- },
- maxH: function(w2, S) {
- const R3 = w2[S];
- if (typeof R3 != "number")
- return new Error("maxHeight not Number");
- if (R3 < w2.h || R3 < w2.minH)
- return new Error("maxHeight smaller than item height/minHeight");
- },
- // ID is nice to have for callbacks
- i: e.default.string.isRequired,
- // Resize handle options
- resizeHandles: c.resizeHandleAxesType,
- resizeHandle: c.resizeHandleType,
- // Functions
- onDragStop: e.default.func,
- onDragStart: e.default.func,
- onDrag: e.default.func,
- onResizeStop: e.default.func,
- onResizeStart: e.default.func,
- onResize: e.default.func,
- // Flags
- isDraggable: e.default.bool.isRequired,
- isResizable: e.default.bool.isRequired,
- isBounded: e.default.bool.isRequired,
- static: e.default.bool,
- // Use CSS transforms instead of top/left
- useCSSTransforms: e.default.bool.isRequired,
- transformScale: e.default.number,
- // Others
- className: e.default.string,
- // Selector for draggable handle
- handle: e.default.string,
- // Selector for draggable cancel (see react-draggable)
- cancel: e.default.string,
- // Current position of a dropping element
- droppingPosition: e.default.shape({
- e: e.default.object.isRequired,
- left: e.default.number.isRequired,
- top: e.default.number.isRequired
- })
- }), y3(_, "defaultProps", {
- className: "",
- cancel: "",
- handle: "",
- minH: 1,
- minW: 1,
- maxH: 1 / 0,
- maxW: 1 / 0,
- transformScale: 1
- }), _t2;
- }
- var Yr;
- function Zi() {
- if (Yr)
- return Rt;
- Yr = 1, Object.defineProperty(Rt, "__esModule", {
- value: true
- }), Rt.default = void 0;
- var t = y3(import_react.default), e = ur(), r = v(dr()), n = St(), i = fr2(), o = v(ea()), c = v(Ki());
- function v(h) {
- return h && h.__esModule ? h : { default: h };
- }
- function d(h) {
- if (typeof WeakMap != "function")
- return null;
- var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap();
- return (d = function(u) {
- return u ? a : s;
- })(h);
- }
- function y3(h, s) {
- if (h && h.__esModule)
- return h;
- if (h === null || typeof h != "object" && typeof h != "function")
- return { default: h };
- var a = d(s);
- if (a && a.has(h))
- return a.get(h);
- var u = { __proto__: null }, b = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for (var l in h)
- if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) {
- var g = b ? Object.getOwnPropertyDescriptor(h, l) : null;
- g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l];
- }
- return u.default = h, a && a.set(h, u), u;
- }
- function p(h, s, a) {
- return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: true, configurable: true, writable: true }) : h[s] = a, h;
- }
- function C(h) {
- var s = _(h, "string");
- return typeof s == "symbol" ? s : String(s);
- }
- function _(h, s) {
- if (typeof h != "object" || h === null)
- return h;
- var a = h[Symbol.toPrimitive];
- if (a !== void 0) {
- var u = a.call(h, s || "default");
- if (typeof u != "object")
- return u;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return (s === "string" ? String : Number)(h);
- }
- const w2 = "react-grid-layout";
- let S = false;
- try {
- S = /firefox/i.test(navigator.userAgent);
- } catch {
- }
- let R3 = class extends t.Component {
- constructor() {
- super(...arguments), p(this, "state", {
- activeDrag: null,
- layout: (0, n.synchronizeLayoutWithChildren)(
- this.props.layout,
- this.props.children,
- this.props.cols,
- // Legacy support for verticalCompact: false
- (0, n.compactType)(this.props),
- this.props.allowOverlap
- ),
- mounted: false,
- oldDragItem: null,
- oldLayout: null,
- oldResizeItem: null,
- resizing: false,
- droppingDOMNode: null,
- children: []
- }), p(this, "dragEnterCounter", 0), p(this, "onDragStart", (s, a, u, b) => {
- let {
- e: l,
- node: g
- } = b;
- const {
- layout: f
- } = this.state, m = (0, n.getLayoutItem)(f, s);
- if (!m)
- return;
- const P = {
- w: m.w,
- h: m.h,
- x: m.x,
- y: m.y,
- placeholder: true,
- i: s
- };
- return this.setState({
- oldDragItem: (0, n.cloneLayoutItem)(m),
- oldLayout: f,
- activeDrag: P
- }), this.props.onDragStart(f, m, m, null, l, g);
- }), p(this, "onDrag", (s, a, u, b) => {
- let {
- e: l,
- node: g
- } = b;
- const {
- oldDragItem: f
- } = this.state;
- let {
- layout: m
- } = this.state;
- const {
- cols: P,
- allowOverlap: M2,
- preventCollision: j2
- } = this.props, N3 = (0, n.getLayoutItem)(m, s);
- if (!N3)
- return;
- const I = {
- w: N3.w,
- h: N3.h,
- x: N3.x,
- y: N3.y,
- placeholder: true,
- i: s
- };
- m = (0, n.moveElement)(m, N3, a, u, true, j2, (0, n.compactType)(this.props), P, M2), this.props.onDrag(m, f, N3, I, l, g), this.setState({
- layout: M2 ? m : (0, n.compact)(m, (0, n.compactType)(this.props), P),
- activeDrag: I
- });
- }), p(this, "onDragStop", (s, a, u, b) => {
- let {
- e: l,
- node: g
- } = b;
- if (!this.state.activeDrag)
- return;
- const {
- oldDragItem: f
- } = this.state;
- let {
- layout: m
- } = this.state;
- const {
- cols: P,
- preventCollision: M2,
- allowOverlap: j2
- } = this.props, N3 = (0, n.getLayoutItem)(m, s);
- if (!N3)
- return;
- m = (0, n.moveElement)(m, N3, a, u, true, M2, (0, n.compactType)(this.props), P, j2);
- const O = j2 ? m : (0, n.compact)(m, (0, n.compactType)(this.props), P);
- this.props.onDragStop(O, f, N3, null, l, g);
- const {
- oldLayout: z
- } = this.state;
- this.setState({
- activeDrag: null,
- layout: O,
- oldDragItem: null,
- oldLayout: null
- }), this.onLayoutMaybeChanged(O, z);
- }), p(this, "onResizeStart", (s, a, u, b) => {
- let {
- e: l,
- node: g
- } = b;
- const {
- layout: f
- } = this.state, m = (0, n.getLayoutItem)(f, s);
- m && (this.setState({
- oldResizeItem: (0, n.cloneLayoutItem)(m),
- oldLayout: this.state.layout,
- resizing: true
- }), this.props.onResizeStart(f, m, m, null, l, g));
- }), p(this, "onResize", (s, a, u, b) => {
- let {
- e: l,
- node: g,
- size: f,
- handle: m
- } = b;
- const {
- oldResizeItem: P
- } = this.state, {
- layout: M2
- } = this.state, {
- cols: j2,
- preventCollision: N3,
- allowOverlap: I
- } = this.props;
- let O = false, z, U, k;
- const [ie, ee] = (0, n.withLayoutItem)(M2, s, (F2) => {
- let oe;
- return U = F2.x, k = F2.y, ["sw", "w", "nw", "n", "ne"].indexOf(m) !== -1 && (["sw", "nw", "w"].indexOf(m) !== -1 && (U = F2.x + (F2.w - a), a = F2.x !== U && U < 0 ? F2.w : a, U = U < 0 ? 0 : U), ["ne", "n", "nw"].indexOf(m) !== -1 && (k = F2.y + (F2.h - u), u = F2.y !== k && k < 0 ? F2.h : u, k = k < 0 ? 0 : k), O = true), N3 && !I && (oe = (0, n.getAllCollisions)(M2, {
- ...F2,
- w: a,
- h: u,
- x: U,
- y: k
- }).filter((de) => de.i !== F2.i).length > 0, oe && (k = F2.y, u = F2.h, U = F2.x, a = F2.w, O = false)), F2.w = a, F2.h = u, F2;
- });
- if (!ee)
- return;
- z = ie, O && (z = (0, n.moveElement)(ie, ee, U, k, true, this.props.preventCollision, (0, n.compactType)(this.props), j2, I));
- const A = {
- w: ee.w,
- h: ee.h,
- x: ee.x,
- y: ee.y,
- static: true,
- i: s
- };
- this.props.onResize(z, P, ee, A, l, g), this.setState({
- layout: I ? z : (0, n.compact)(z, (0, n.compactType)(this.props), j2),
- activeDrag: A
- });
- }), p(this, "onResizeStop", (s, a, u, b) => {
- let {
- e: l,
- node: g
- } = b;
- const {
- layout: f,
- oldResizeItem: m
- } = this.state, {
- cols: P,
- allowOverlap: M2
- } = this.props, j2 = (0, n.getLayoutItem)(f, s), N3 = M2 ? f : (0, n.compact)(f, (0, n.compactType)(this.props), P);
- this.props.onResizeStop(N3, m, j2, null, l, g);
- const {
- oldLayout: I
- } = this.state;
- this.setState({
- activeDrag: null,
- layout: N3,
- oldResizeItem: null,
- oldLayout: null,
- resizing: false
- }), this.onLayoutMaybeChanged(N3, I);
- }), p(this, "onDragOver", (s) => {
- var ie;
- if (s.preventDefault(), s.stopPropagation(), S && // $FlowIgnore can't figure this out
- !((ie = s.nativeEvent.target) != null && ie.classList.contains(w2)))
- return false;
- const {
- droppingItem: a,
- onDropDragOver: u,
- margin: b,
- cols: l,
- rowHeight: g,
- maxRows: f,
- width: m,
- containerPadding: P,
- transformScale: M2
- } = this.props, j2 = u == null ? void 0 : u(s);
- if (j2 === false)
- return this.state.droppingDOMNode && this.removeDroppingPlaceholder(), false;
- const N3 = {
- ...a,
- ...j2
- }, {
- layout: I
- } = this.state, O = s.currentTarget.getBoundingClientRect(), z = s.clientX - O.left, U = s.clientY - O.top, k = {
- left: z / M2,
- top: U / M2,
- e: s
- };
- if (this.state.droppingDOMNode) {
- if (this.state.droppingPosition) {
- const {
- left: ee,
- top: A
- } = this.state.droppingPosition;
- (ee != z || A != U) && this.setState({
- droppingPosition: k
- });
- }
- } else {
- const ee = {
- cols: l,
- margin: b,
- maxRows: f,
- rowHeight: g,
- containerWidth: m,
- containerPadding: P || b
- }, A = (0, i.calcXY)(ee, U, z, N3.w, N3.h);
- this.setState({
- droppingDOMNode: t.createElement("div", {
- key: N3.i
- }),
- droppingPosition: k,
- layout: [...I, {
- ...N3,
- x: A.x,
- y: A.y,
- static: false,
- isDraggable: true
- }]
- });
- }
- }), p(this, "removeDroppingPlaceholder", () => {
- const {
- droppingItem: s,
- cols: a
- } = this.props, {
- layout: u
- } = this.state, b = (0, n.compact)(u.filter((l) => l.i !== s.i), (0, n.compactType)(this.props), a, this.props.allowOverlap);
- this.setState({
- layout: b,
- droppingDOMNode: null,
- activeDrag: null,
- droppingPosition: void 0
- });
- }), p(this, "onDragLeave", (s) => {
- s.preventDefault(), s.stopPropagation(), this.dragEnterCounter--, this.dragEnterCounter === 0 && this.removeDroppingPlaceholder();
- }), p(this, "onDragEnter", (s) => {
- s.preventDefault(), s.stopPropagation(), this.dragEnterCounter++;
- }), p(this, "onDrop", (s) => {
- s.preventDefault(), s.stopPropagation();
- const {
- droppingItem: a
- } = this.props, {
- layout: u
- } = this.state, b = u.find((l) => l.i === a.i);
- this.dragEnterCounter = 0, this.removeDroppingPlaceholder(), this.props.onDrop(u, b, s);
- });
- }
- componentDidMount() {
- this.setState({
- mounted: true
- }), this.onLayoutMaybeChanged(this.state.layout, this.props.layout);
- }
- static getDerivedStateFromProps(s, a) {
- let u;
- return a.activeDrag ? null : (!(0, e.deepEqual)(s.layout, a.propsLayout) || s.compactType !== a.compactType ? u = s.layout : (0, n.childrenEqual)(s.children, a.children) || (u = a.layout), u ? {
- layout: (0, n.synchronizeLayoutWithChildren)(u, s.children, s.cols, (0, n.compactType)(s), s.allowOverlap),
- // We need to save these props to state for using
- // getDerivedStateFromProps instead of componentDidMount (in which we would get extra rerender)
- compactType: s.compactType,
- children: s.children,
- propsLayout: s.layout
- } : null);
- }
- shouldComponentUpdate(s, a) {
- return (
- // NOTE: this is almost always unequal. Therefore the only way to get better performance
- // from SCU is if the user intentionally memoizes children. If they do, and they can
- // handle changes properly, performance will increase.
- this.props.children !== s.children || !(0, n.fastRGLPropsEqual)(this.props, s, e.deepEqual) || this.state.activeDrag !== a.activeDrag || this.state.mounted !== a.mounted || this.state.droppingPosition !== a.droppingPosition
- );
- }
- componentDidUpdate(s, a) {
- if (!this.state.activeDrag) {
- const u = this.state.layout, b = a.layout;
- this.onLayoutMaybeChanged(u, b);
- }
- }
- /**
- * Calculates a pixel value for the container.
- * @return {String} Container height in pixels.
- */
- containerHeight() {
- if (!this.props.autoSize)
- return;
- const s = (0, n.bottom)(this.state.layout), a = this.props.containerPadding ? this.props.containerPadding[1] : this.props.margin[1];
- return s * this.props.rowHeight + (s - 1) * this.props.margin[1] + a * 2 + "px";
- }
- onLayoutMaybeChanged(s, a) {
- a || (a = this.state.layout), (0, e.deepEqual)(a, s) || this.props.onLayoutChange(s);
- }
- /**
- * Create a placeholder object.
- * @return {Element} Placeholder div.
- */
- placeholder() {
- const {
- activeDrag: s
- } = this.state;
- if (!s)
- return null;
- const {
- width: a,
- cols: u,
- margin: b,
- containerPadding: l,
- rowHeight: g,
- maxRows: f,
- useCSSTransforms: m,
- transformScale: P
- } = this.props;
- return t.createElement(o.default, {
- w: s.w,
- h: s.h,
- x: s.x,
- y: s.y,
- i: s.i,
- className: `react-grid-placeholder ${this.state.resizing ? "placeholder-resizing" : ""}`,
- containerWidth: a,
- cols: u,
- margin: b,
- containerPadding: l || b,
- maxRows: f,
- rowHeight: g,
- isDraggable: false,
- isResizable: false,
- isBounded: false,
- useCSSTransforms: m,
- transformScale: P
- }, t.createElement("div", null));
- }
- /**
- * Given a grid item, set its style attributes & surround in a <Draggable>.
- * @param {Element} child React element.
- * @return {Element} Element wrapped in draggable and properly placed.
- */
- processGridItem(s, a) {
- if (!s || !s.key)
- return;
- const u = (0, n.getLayoutItem)(this.state.layout, String(s.key));
- if (!u)
- return null;
- const {
- width: b,
- cols: l,
- margin: g,
- containerPadding: f,
- rowHeight: m,
- maxRows: P,
- isDraggable: M2,
- isResizable: j2,
- isBounded: N3,
- useCSSTransforms: I,
- transformScale: O,
- draggableCancel: z,
- draggableHandle: U,
- resizeHandles: k,
- resizeHandle: ie
- } = this.props, {
- mounted: ee,
- droppingPosition: A
- } = this.state, F2 = typeof u.isDraggable == "boolean" ? u.isDraggable : !u.static && M2, oe = typeof u.isResizable == "boolean" ? u.isResizable : !u.static && j2, se = u.resizeHandles || k, de = F2 && N3 && u.isBounded !== false;
- return t.createElement(o.default, {
- containerWidth: b,
- cols: l,
- margin: g,
- containerPadding: f || g,
- maxRows: P,
- rowHeight: m,
- cancel: z,
- handle: U,
- onDragStop: this.onDragStop,
- onDragStart: this.onDragStart,
- onDrag: this.onDrag,
- onResizeStart: this.onResizeStart,
- onResize: this.onResize,
- onResizeStop: this.onResizeStop,
- isDraggable: F2,
- isResizable: oe,
- isBounded: de,
- useCSSTransforms: I && ee,
- usePercentages: !ee,
- transformScale: O,
- w: u.w,
- h: u.h,
- x: u.x,
- y: u.y,
- i: u.i,
- minH: u.minH,
- minW: u.minW,
- maxH: u.maxH,
- maxW: u.maxW,
- static: u.static,
- droppingPosition: a ? A : void 0,
- resizeHandles: se,
- resizeHandle: ie
- }, s);
- }
- render() {
- const {
- className: s,
- style: a,
- isDroppable: u,
- innerRef: b
- } = this.props, l = (0, r.default)(w2, s), g = {
- height: this.containerHeight(),
- ...a
- };
- return t.createElement("div", {
- ref: b,
- className: l,
- style: g,
- onDrop: u ? this.onDrop : n.noop,
- onDragLeave: u ? this.onDragLeave : n.noop,
- onDragEnter: u ? this.onDragEnter : n.noop,
- onDragOver: u ? this.onDragOver : n.noop
- }, t.Children.map(this.props.children, (f) => this.processGridItem(f)), u && this.state.droppingDOMNode && this.processGridItem(this.state.droppingDOMNode, true), this.placeholder());
- }
- };
- return Rt.default = R3, p(R3, "displayName", "ReactGridLayout"), p(R3, "propTypes", c.default), p(R3, "defaultProps", {
- autoSize: true,
- cols: 12,
- className: "",
- style: {},
- draggableHandle: "",
- draggableCancel: "",
- containerPadding: null,
- rowHeight: 150,
- maxRows: 1 / 0,
- // infinite vertical growth
- layout: [],
- margin: [10, 10],
- isBounded: false,
- isDraggable: true,
- isResizable: true,
- allowOverlap: false,
- isDroppable: false,
- useCSSTransforms: true,
- transformScale: 1,
- verticalCompact: true,
- compactType: "vertical",
- preventCollision: false,
- droppingItem: {
- i: "__dropping-elem__",
- h: 1,
- w: 1
- },
- resizeHandles: ["se"],
- onLayoutChange: n.noop,
- onDragStart: n.noop,
- onDrag: n.noop,
- onDragStop: n.noop,
- onResizeStart: n.noop,
- onResize: n.noop,
- onResizeStop: n.noop,
- onDrop: n.noop,
- onDropDragOver: n.noop
- }), Rt;
- }
- var Dt = {};
- var rt3 = {};
- var Kr;
- function Ji() {
- if (Kr)
- return rt3;
- Kr = 1, Object.defineProperty(rt3, "__esModule", {
- value: true
- }), rt3.findOrGenerateResponsiveLayout = n, rt3.getBreakpointFromWidth = e, rt3.getColsFromBreakpoint = r, rt3.sortBreakpoints = i;
- var t = St();
- function e(o, c) {
- const v = i(o);
- let d = v[0];
- for (let y3 = 1, p = v.length; y3 < p; y3++) {
- const C = v[y3];
- c > o[C] && (d = C);
- }
- return d;
- }
- function r(o, c) {
- if (!c[o])
- throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint " + o + " is missing!");
- return c[o];
- }
- function n(o, c, v, d, y3, p) {
- if (o[v])
- return (0, t.cloneLayout)(o[v]);
- let C = o[d];
- const _ = i(c), w2 = _.slice(_.indexOf(v));
- for (let S = 0, R3 = w2.length; S < R3; S++) {
- const h = w2[S];
- if (o[h]) {
- C = o[h];
- break;
- }
- }
- return C = (0, t.cloneLayout)(C || []), (0, t.compact)((0, t.correctBounds)(C, {
- cols: y3
- }), p, y3);
- }
- function i(o) {
- return Object.keys(o).sort(function(v, d) {
- return o[v] - o[d];
- });
- }
- return rt3;
- }
- var Zr;
- function ta() {
- if (Zr)
- return Dt;
- Zr = 1, Object.defineProperty(Dt, "__esModule", {
- value: true
- }), Dt.default = void 0;
- var t = d(import_react.default), e = c(Qe()), r = ur(), n = St(), i = Ji(), o = c(Zi());
- function c(h) {
- return h && h.__esModule ? h : { default: h };
- }
- function v(h) {
- if (typeof WeakMap != "function")
- return null;
- var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap();
- return (v = function(u) {
- return u ? a : s;
- })(h);
- }
- function d(h, s) {
- if (h && h.__esModule)
- return h;
- if (h === null || typeof h != "object" && typeof h != "function")
- return { default: h };
- var a = v(s);
- if (a && a.has(h))
- return a.get(h);
- var u = { __proto__: null }, b = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for (var l in h)
- if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) {
- var g = b ? Object.getOwnPropertyDescriptor(h, l) : null;
- g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l];
- }
- return u.default = h, a && a.set(h, u), u;
- }
- function y3() {
- return y3 = Object.assign ? Object.assign.bind() : function(h) {
- for (var s = 1; s < arguments.length; s++) {
- var a = arguments[s];
- for (var u in a)
- Object.prototype.hasOwnProperty.call(a, u) && (h[u] = a[u]);
- }
- return h;
- }, y3.apply(this, arguments);
- }
- function p(h, s, a) {
- return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: true, configurable: true, writable: true }) : h[s] = a, h;
- }
- function C(h) {
- var s = _(h, "string");
- return typeof s == "symbol" ? s : String(s);
- }
- function _(h, s) {
- if (typeof h != "object" || h === null)
- return h;
- var a = h[Symbol.toPrimitive];
- if (a !== void 0) {
- var u = a.call(h, s || "default");
- if (typeof u != "object")
- return u;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return (s === "string" ? String : Number)(h);
- }
- const w2 = (h) => Object.prototype.toString.call(h);
- function S(h, s) {
- return h == null ? null : Array.isArray(h) ? h : h[s];
- }
- let R3 = class extends t.Component {
- constructor() {
- super(...arguments), p(this, "state", this.generateInitialState()), p(this, "onLayoutChange", (s) => {
- this.props.onLayoutChange(s, {
- ...this.props.layouts,
- [this.state.breakpoint]: s
- });
- });
- }
- generateInitialState() {
- const {
- width: s,
- breakpoints: a,
- layouts: u,
- cols: b
- } = this.props, l = (0, i.getBreakpointFromWidth)(a, s), g = (0, i.getColsFromBreakpoint)(l, b), f = this.props.verticalCompact === false ? null : this.props.compactType;
- return {
- layout: (0, i.findOrGenerateResponsiveLayout)(u, a, l, l, g, f),
- breakpoint: l,
- cols: g
- };
- }
- static getDerivedStateFromProps(s, a) {
- if (!(0, r.deepEqual)(s.layouts, a.layouts)) {
- const {
- breakpoint: u,
- cols: b
- } = a;
- return {
- layout: (0, i.findOrGenerateResponsiveLayout)(s.layouts, s.breakpoints, u, u, b, s.compactType),
- layouts: s.layouts
- };
- }
- return null;
- }
- componentDidUpdate(s) {
- (this.props.width != s.width || this.props.breakpoint !== s.breakpoint || !(0, r.deepEqual)(this.props.breakpoints, s.breakpoints) || !(0, r.deepEqual)(this.props.cols, s.cols)) && this.onWidthChange(s);
- }
- /**
- * When the width changes work through breakpoints and reset state with the new width & breakpoint.
- * Width changes are necessary to figure out the widget widths.
- */
- onWidthChange(s) {
- const {
- breakpoints: a,
- cols: u,
- layouts: b,
- compactType: l
- } = this.props, g = this.props.breakpoint || (0, i.getBreakpointFromWidth)(this.props.breakpoints, this.props.width), f = this.state.breakpoint, m = (0, i.getColsFromBreakpoint)(g, u), P = {
- ...b
- };
- if (f !== g || s.breakpoints !== a || s.cols !== u) {
- f in P || (P[f] = (0, n.cloneLayout)(this.state.layout));
- let N3 = (0, i.findOrGenerateResponsiveLayout)(P, a, g, f, m, l);
- N3 = (0, n.synchronizeLayoutWithChildren)(N3, this.props.children, m, l, this.props.allowOverlap), P[g] = N3, this.props.onLayoutChange(N3, P), this.props.onBreakpointChange(g, m), this.setState({
- breakpoint: g,
- layout: N3,
- cols: m
- });
- }
- const M2 = S(this.props.margin, g), j2 = S(this.props.containerPadding, g);
- this.props.onWidthChange(this.props.width, M2, m, j2);
- }
- render() {
- const {
- breakpoint: s,
- breakpoints: a,
- cols: u,
- layouts: b,
- margin: l,
- containerPadding: g,
- onBreakpointChange: f,
- onLayoutChange: m,
- onWidthChange: P,
- ...M2
- } = this.props;
- return t.createElement(o.default, y3({}, M2, {
- // $FlowIgnore should allow nullable here due to DefaultProps
- margin: S(l, this.state.breakpoint),
- containerPadding: S(g, this.state.breakpoint),
- onLayoutChange: this.onLayoutChange,
- layout: this.state.layout,
- cols: this.state.cols
- }));
- }
- };
- return Dt.default = R3, p(R3, "propTypes", {
- //
- // Basic props
- //
- // Optional, but if you are managing width yourself you may want to set the breakpoint
- // yourself as well.
- breakpoint: e.default.string,
- // {name: pxVal}, e.g. {lg: 1200, md: 996, sm: 768, xs: 480}
- breakpoints: e.default.object,
- allowOverlap: e.default.bool,
- // # of cols. This is a breakpoint -> cols map
- cols: e.default.object,
- // # of margin. This is a breakpoint -> margin map
- // e.g. { lg: [5, 5], md: [10, 10], sm: [15, 15] }
- // Margin between items [x, y] in px
- // e.g. [10, 10]
- margin: e.default.oneOfType([e.default.array, e.default.object]),
- // # of containerPadding. This is a breakpoint -> containerPadding map
- // e.g. { lg: [5, 5], md: [10, 10], sm: [15, 15] }
- // Padding inside the container [x, y] in px
- // e.g. [10, 10]
- containerPadding: e.default.oneOfType([e.default.array, e.default.object]),
- // layouts is an object mapping breakpoints to layouts.
- // e.g. {lg: Layout, md: Layout, ...}
- layouts(h, s) {
- if (w2(h[s]) !== "[object Object]")
- throw new Error("Layout property must be an object. Received: " + w2(h[s]));
- Object.keys(h[s]).forEach((a) => {
- if (!(a in h.breakpoints))
- throw new Error("Each key in layouts must align with a key in breakpoints.");
- (0, n.validateLayout)(h.layouts[a], "layouts." + a);
- });
- },
- // The width of this component.
- // Required in this propTypes stanza because generateInitialState() will fail without it.
- width: e.default.number.isRequired,
- //
- // Callbacks
- //
- // Calls back with breakpoint and new # cols
- onBreakpointChange: e.default.func,
- // Callback so you can save the layout.
- // Calls back with (currentLayout, allLayouts). allLayouts are keyed by breakpoint.
- onLayoutChange: e.default.func,
- // Calls back with (containerWidth, margin, cols, containerPadding)
- onWidthChange: e.default.func
- }), p(R3, "defaultProps", {
- breakpoints: {
- lg: 1200,
- md: 996,
- sm: 768,
- xs: 480,
- xxs: 0
- },
- cols: {
- lg: 12,
- md: 10,
- sm: 6,
- xs: 4,
- xxs: 2
- },
- containerPadding: {
- lg: null,
- md: null,
- sm: null,
- xs: null,
- xxs: null
- },
- layouts: {},
- margin: [10, 10],
- allowOverlap: false,
- onBreakpointChange: n.noop,
- onLayoutChange: n.noop,
- onWidthChange: n.noop
- }), Dt;
- }
- var nn = {};
- var Qi = function() {
- if (typeof Map < "u")
- return Map;
- function t(e, r) {
- var n = -1;
- return e.some(function(i, o) {
- return i[0] === r ? (n = o, true) : false;
- }), n;
- }
- return (
- /** @class */
- function() {
- function e() {
- this.__entries__ = [];
- }
- return Object.defineProperty(e.prototype, "size", {
- /**
- * @returns {boolean}
- */
- get: function() {
- return this.__entries__.length;
- },
- enumerable: true,
- configurable: true
- }), e.prototype.get = function(r) {
- var n = t(this.__entries__, r), i = this.__entries__[n];
- return i && i[1];
- }, e.prototype.set = function(r, n) {
- var i = t(this.__entries__, r);
- ~i ? this.__entries__[i][1] = n : this.__entries__.push([r, n]);
- }, e.prototype.delete = function(r) {
- var n = this.__entries__, i = t(n, r);
- ~i && n.splice(i, 1);
- }, e.prototype.has = function(r) {
- return !!~t(this.__entries__, r);
- }, e.prototype.clear = function() {
- this.__entries__.splice(0);
- }, e.prototype.forEach = function(r, n) {
- n === void 0 && (n = null);
- for (var i = 0, o = this.__entries__; i < o.length; i++) {
- var c = o[i];
- r.call(n, c[1], c[0]);
- }
- }, e;
- }()
- );
- }();
- var er = typeof window < "u" && typeof document < "u" && window.document === document;
- var vn = function() {
- return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
- }();
- var na = function() {
- return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(vn) : function(t) {
- return setTimeout(function() {
- return t(Date.now());
- }, 1e3 / 60);
- };
- }();
- var ra = 2;
- function ia(t, e) {
- var r = false, n = false, i = 0;
- function o() {
- r && (r = false, t()), n && v();
- }
- function c() {
- na(o);
- }
- function v() {
- var d = Date.now();
- if (r) {
- if (d - i < ra)
- return;
- n = true;
- } else
- r = true, n = false, setTimeout(c, e);
- i = d;
- }
- return v;
- }
- var oa = 20;
- var sa = ["top", "right", "bottom", "left", "width", "height", "size", "weight"];
- var aa = typeof MutationObserver < "u";
- var la = (
- /** @class */
- function() {
- function t() {
- this.connected_ = false, this.mutationEventsAdded_ = false, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = ia(this.refresh.bind(this), oa);
- }
- return t.prototype.addObserver = function(e) {
- ~this.observers_.indexOf(e) || this.observers_.push(e), this.connected_ || this.connect_();
- }, t.prototype.removeObserver = function(e) {
- var r = this.observers_, n = r.indexOf(e);
- ~n && r.splice(n, 1), !r.length && this.connected_ && this.disconnect_();
- }, t.prototype.refresh = function() {
- var e = this.updateObservers_();
- e && this.refresh();
- }, t.prototype.updateObservers_ = function() {
- var e = this.observers_.filter(function(r) {
- return r.gatherActive(), r.hasActive();
- });
- return e.forEach(function(r) {
- return r.broadcastActive();
- }), e.length > 0;
- }, t.prototype.connect_ = function() {
- !er || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), aa ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
- attributes: true,
- childList: true,
- characterData: true,
- subtree: true
- })) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = true), this.connected_ = true);
- }, t.prototype.disconnect_ = function() {
- !er || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = false, this.connected_ = false);
- }, t.prototype.onTransitionEnd_ = function(e) {
- var r = e.propertyName, n = r === void 0 ? "" : r, i = sa.some(function(o) {
- return !!~n.indexOf(o);
- });
- i && this.refresh();
- }, t.getInstance = function() {
- return this.instance_ || (this.instance_ = new t()), this.instance_;
- }, t.instance_ = null, t;
- }()
- );
- var eo = function(t, e) {
- for (var r = 0, n = Object.keys(e); r < n.length; r++) {
- var i = n[r];
- Object.defineProperty(t, i, {
- value: e[i],
- enumerable: false,
- writable: false,
- configurable: true
- });
- }
- return t;
- };
- var gt = function(t) {
- var e = t && t.ownerDocument && t.ownerDocument.defaultView;
- return e || vn;
- };
- var to = Nn2(0, 0, 0, 0);
- function yn(t) {
- return parseFloat(t) || 0;
- }
- function Jr(t) {
- for (var e = [], r = 1; r < arguments.length; r++)
- e[r - 1] = arguments[r];
- return e.reduce(function(n, i) {
- var o = t["border-" + i + "-width"];
- return n + yn(o);
- }, 0);
- }
- function ca(t) {
- for (var e = ["top", "right", "bottom", "left"], r = {}, n = 0, i = e; n < i.length; n++) {
- var o = i[n], c = t["padding-" + o];
- r[o] = yn(c);
- }
- return r;
- }
- function ua(t) {
- var e = t.getBBox();
- return Nn2(0, 0, e.width, e.height);
- }
- function da(t) {
- var e = t.clientWidth, r = t.clientHeight;
- if (!e && !r)
- return to;
- var n = gt(t).getComputedStyle(t), i = ca(n), o = i.left + i.right, c = i.top + i.bottom, v = yn(n.width), d = yn(n.height);
- if (n.boxSizing === "border-box" && (Math.round(v + o) !== e && (v -= Jr(n, "left", "right") + o), Math.round(d + c) !== r && (d -= Jr(n, "top", "bottom") + c)), !ha(t)) {
- var y3 = Math.round(v + o) - e, p = Math.round(d + c) - r;
- Math.abs(y3) !== 1 && (v -= y3), Math.abs(p) !== 1 && (d -= p);
- }
- return Nn2(i.left, i.top, v, d);
- }
- var fa = function() {
- return typeof SVGGraphicsElement < "u" ? function(t) {
- return t instanceof gt(t).SVGGraphicsElement;
- } : function(t) {
- return t instanceof gt(t).SVGElement && typeof t.getBBox == "function";
- };
- }();
- function ha(t) {
- return t === gt(t).document.documentElement;
- }
- function pa(t) {
- return er ? fa(t) ? ua(t) : da(t) : to;
- }
- function ga(t) {
- var e = t.x, r = t.y, n = t.width, i = t.height, o = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, c = Object.create(o.prototype);
- return eo(c, {
- x: e,
- y: r,
- width: n,
- height: i,
- top: r,
- right: e + n,
- bottom: i + r,
- left: e
- }), c;
- }
- function Nn2(t, e, r, n) {
- return { x: t, y: e, width: r, height: n };
- }
- var ma = (
- /** @class */
- function() {
- function t(e) {
- this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = Nn2(0, 0, 0, 0), this.target = e;
- }
- return t.prototype.isActive = function() {
- var e = pa(this.target);
- return this.contentRect_ = e, e.width !== this.broadcastWidth || e.height !== this.broadcastHeight;
- }, t.prototype.broadcastRect = function() {
- var e = this.contentRect_;
- return this.broadcastWidth = e.width, this.broadcastHeight = e.height, e;
- }, t;
- }()
- );
- var va = (
- /** @class */
- function() {
- function t(e, r) {
- var n = ga(r);
- eo(this, { target: e, contentRect: n });
- }
- return t;
- }()
- );
- var ya = (
- /** @class */
- function() {
- function t(e, r, n) {
- if (this.activeObservations_ = [], this.observations_ = new Qi(), typeof e != "function")
- throw new TypeError("The callback provided as parameter 1 is not a function.");
- this.callback_ = e, this.controller_ = r, this.callbackCtx_ = n;
- }
- return t.prototype.observe = function(e) {
- if (!arguments.length)
- throw new TypeError("1 argument required, but only 0 present.");
- if (!(typeof Element > "u" || !(Element instanceof Object))) {
- if (!(e instanceof gt(e).Element))
- throw new TypeError('parameter 1 is not of type "Element".');
- var r = this.observations_;
- r.has(e) || (r.set(e, new ma(e)), this.controller_.addObserver(this), this.controller_.refresh());
- }
- }, t.prototype.unobserve = function(e) {
- if (!arguments.length)
- throw new TypeError("1 argument required, but only 0 present.");
- if (!(typeof Element > "u" || !(Element instanceof Object))) {
- if (!(e instanceof gt(e).Element))
- throw new TypeError('parameter 1 is not of type "Element".');
- var r = this.observations_;
- r.has(e) && (r.delete(e), r.size || this.controller_.removeObserver(this));
- }
- }, t.prototype.disconnect = function() {
- this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
- }, t.prototype.gatherActive = function() {
- var e = this;
- this.clearActive(), this.observations_.forEach(function(r) {
- r.isActive() && e.activeObservations_.push(r);
- });
- }, t.prototype.broadcastActive = function() {
- if (this.hasActive()) {
- var e = this.callbackCtx_, r = this.activeObservations_.map(function(n) {
- return new va(n.target, n.broadcastRect());
- });
- this.callback_.call(e, r, e), this.clearActive();
- }
- }, t.prototype.clearActive = function() {
- this.activeObservations_.splice(0);
- }, t.prototype.hasActive = function() {
- return this.activeObservations_.length > 0;
- }, t;
- }()
- );
- var no = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new Qi();
- var ro = (
- /** @class */
- function() {
- function t(e) {
- if (!(this instanceof t))
- throw new TypeError("Cannot call a class as a function.");
- if (!arguments.length)
- throw new TypeError("1 argument required, but only 0 present.");
- var r = la.getInstance(), n = new ya(e, r, this);
- no.set(this, n);
- }
- return t;
- }()
- );
- [
- "observe",
- "unobserve",
- "disconnect"
- ].forEach(function(t) {
- ro.prototype[t] = function() {
- var e;
- return (e = no.get(this))[t].apply(e, arguments);
- };
- });
- var ba = function() {
- return typeof vn.ResizeObserver < "u" ? vn.ResizeObserver : ro;
- }();
- var Sa = Object.freeze(Object.defineProperty({
- __proto__: null,
- default: ba
- }, Symbol.toStringTag, { value: "Module" }));
- var Ca = Ai(Sa);
- var Qr;
- function wa() {
- if (Qr)
- return nn;
- Qr = 1, Object.defineProperty(nn, "__esModule", {
- value: true
- }), nn.default = _;
- var t = c(import_react.default), e = i(Qe()), r = i(Ca), n = i(dr());
- function i(w2) {
- return w2 && w2.__esModule ? w2 : { default: w2 };
- }
- function o(w2) {
- if (typeof WeakMap != "function")
- return null;
- var S = /* @__PURE__ */ new WeakMap(), R3 = /* @__PURE__ */ new WeakMap();
- return (o = function(h) {
- return h ? R3 : S;
- })(w2);
- }
- function c(w2, S) {
- if (w2 && w2.__esModule)
- return w2;
- if (w2 === null || typeof w2 != "object" && typeof w2 != "function")
- return { default: w2 };
- var R3 = o(S);
- if (R3 && R3.has(w2))
- return R3.get(w2);
- var h = { __proto__: null }, s = Object.defineProperty && Object.getOwnPropertyDescriptor;
- for (var a in w2)
- if (a !== "default" && Object.prototype.hasOwnProperty.call(w2, a)) {
- var u = s ? Object.getOwnPropertyDescriptor(w2, a) : null;
- u && (u.get || u.set) ? Object.defineProperty(h, a, u) : h[a] = w2[a];
- }
- return h.default = w2, R3 && R3.set(w2, h), h;
- }
- function v() {
- return v = Object.assign ? Object.assign.bind() : function(w2) {
- for (var S = 1; S < arguments.length; S++) {
- var R3 = arguments[S];
- for (var h in R3)
- Object.prototype.hasOwnProperty.call(R3, h) && (w2[h] = R3[h]);
- }
- return w2;
- }, v.apply(this, arguments);
- }
- function d(w2, S, R3) {
- return S = y3(S), S in w2 ? Object.defineProperty(w2, S, { value: R3, enumerable: true, configurable: true, writable: true }) : w2[S] = R3, w2;
- }
- function y3(w2) {
- var S = p(w2, "string");
- return typeof S == "symbol" ? S : String(S);
- }
- function p(w2, S) {
- if (typeof w2 != "object" || w2 === null)
- return w2;
- var R3 = w2[Symbol.toPrimitive];
- if (R3 !== void 0) {
- var h = R3.call(w2, S || "default");
- if (typeof h != "object")
- return h;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return (S === "string" ? String : Number)(w2);
- }
- const C = "react-grid-layout";
- function _(w2) {
- var S;
- return S = class extends t.Component {
- constructor() {
- super(...arguments), d(this, "state", {
- width: 1280
- }), d(this, "elementRef", t.createRef()), d(this, "mounted", false), d(this, "resizeObserver", void 0);
- }
- componentDidMount() {
- this.mounted = true, this.resizeObserver = new r.default((s) => {
- if (this.elementRef.current instanceof HTMLElement) {
- const u = s[0].contentRect.width;
- this.setState({
- width: u
- });
- }
- });
- const h = this.elementRef.current;
- h instanceof HTMLElement && this.resizeObserver.observe(h);
- }
- componentWillUnmount() {
- this.mounted = false;
- const h = this.elementRef.current;
- h instanceof HTMLElement && this.resizeObserver.unobserve(h), this.resizeObserver.disconnect();
- }
- render() {
- const {
- measureBeforeMount: h,
- ...s
- } = this.props;
- return h && !this.mounted ? t.createElement("div", {
- className: (0, n.default)(this.props.className, C),
- style: this.props.style,
- ref: this.elementRef
- }) : t.createElement(w2, v({
- innerRef: this.elementRef
- }, s, this.state));
- }
- }, d(S, "defaultProps", {
- measureBeforeMount: false
- }), d(S, "propTypes", {
- // If true, will not render children until mounted. Useful for getting the exact width before
- // rendering, to prevent any unsightly resizing.
- measureBeforeMount: e.default.bool
- }), S;
- }
- return nn;
- }
- var ei;
- function Ra2() {
- return ei || (ei = 1, function(t) {
- t.exports = Zi().default, t.exports.utils = St(), t.exports.calculateUtils = fr2(), t.exports.Responsive = ta().default, t.exports.Responsive.utils = Ji(), t.exports.WidthProvider = wa().default;
- }(An)), An.exports;
- }
- var _a = Ra2();
- var xa = hs(_a);
- var Ia = Object.defineProperty;
- var Ea = Object.getOwnPropertyDescriptor;
- var Ta = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? Ea(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && Ia(e, r, i), i;
- };
- var Pa = (t, e) => (r, n) => e(r, n, t);
- var mt = class extends nt {
- constructor(e) {
- super();
- Xe(this, "_initLocal", () => {
- });
- Xe(this, "_findReplaceIndex", (e2) => {
- const r = /\{([^}]+)?\}/g, n = [];
- let i = r.exec(e2);
- for (; i; )
- n.push({
- startIndex: i.index,
- key: Number(i[1]),
- endIndex: i.index + i[0].length - 1
- }), i = r.exec(e2);
- return n;
- });
- this._localeService = e, this._initLocal();
- }
- tWithReactNode(e, ...r) {
- const n = this._localeService.getLocales(), i = e.split("."), o = n && this._localeService.resolveKeyPath(n, i);
- if (typeof o == "string") {
- const c = [];
- return this._findReplaceIndex(o).forEach((v, d, y3) => {
- const p = y3[d - 1] || { startIndex: 0, endIndex: -1 };
- if (p.endIndex + 1 < v.startIndex) {
- const C = o.slice(p.endIndex + 1, v.startIndex);
- C && c.push(C);
- }
- if (r[v.key] && c.push(r[v.key]), d === y3.length - 1) {
- const C = o.slice(v.endIndex + 1);
- C && c.push(C);
- }
- }), c;
- }
- return [];
- }
- };
- mt = Ta([
- Pa(0, ot(Vr))
- ], mt);
- var Oa = "univer-cf-preview";
- var rn = {
- cfPreview: Oa
- };
- var Ct = (t) => {
- var i, o;
- const e = t.rule;
- if (!e)
- return null;
- const r = (0, import_react.useMemo)(() => {
- if (e.type === y.colorScale) {
- const c = e.config.map((y3, p) => ({ color: new Nt(y3.color), value: p })), v = c.length - 1;
- return new Array(5).fill("").map((y3, p, C) => p * v / (C.length - 1)).map((y3) => y0(c, y3));
- }
- return null;
- }, [e]), n = (0, import_react.useMemo)(() => {
- if (e.type === y.iconSet)
- return e.config.map((c) => {
- const v = o2[c.iconType];
- return v && v[Number(c.iconId)];
- });
- }, [e]);
- switch (e.type) {
- case y.dataBar: {
- const { isGradient: c } = e.config, v = { width: "50%", height: "100%" }, d = c ? `linear-gradient(to right, ${e.config.positiveColor || x2}, rgb(255 255 255))` : e.config.positiveColor, y3 = c ? `linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor || y2})` : e.config.nativeColor;
- return x3.jsxs("div", { className: rn.cfPreview, children: [
- x3.jsx("div", { style: { ...v, background: y3, border: `1px solid ${e.config.nativeColor || y2}` } }),
- x3.jsx("div", { style: { ...v, background: d, border: `1px solid ${e.config.positiveColor || x2}` } })
- ] });
- }
- case y.colorScale:
- return r && x3.jsx("div", { className: rn.cfPreview, children: r.map((c, v) => x3.jsx("div", { style: { width: `${100 / r.length}%`, height: "100%", background: c } }, v)) });
- case y.iconSet:
- return n && x3.jsx("div", { className: rn.cfPreview, children: n.map((c, v) => c ? x3.jsx("img", { style: { height: "100%" }, src: c }, v) : x3.jsx(Zt, {}, v)) });
- case y.highlightCell: {
- const { ul: c, st: v, it: d, bl: y3, bg: p, cl: C } = e.style, _ = (c == null ? void 0 : c.s) === we.TRUE, w2 = (v == null ? void 0 : v.s) === we.TRUE, S = d === we.TRUE, R3 = y3 === we.TRUE, h = (i = p == null ? void 0 : p.rgb) != null ? i : E1, s = (o = C == null ? void 0 : C.rgb) != null ? o : p1, a = {
- fontWeight: R3 ? "bold" : void 0,
- fontStyle: S ? "italic" : void 0,
- textDecoration: `${_ ? "underline" : ""} ${w2 ? "line-through" : ""}`.replace(/^ /, "") || void 0,
- backgroundColor: h,
- color: s
- };
- return x3.jsx("div", { style: a, className: rn.cfPreview, children: "123" });
- }
- }
- return null;
- };
- var Da = "univer-cf-rule-list";
- var Ma = "univer-rule-selector";
- var Na = "univer-select";
- var ja = "univer-select-selector";
- var La = "univer-select-selection-item";
- var $a = "univer-select-selection-search-input";
- var za = "univer-btn-list";
- var Fa2 = "univer-gap";
- var Va = "univer-icon";
- var qa = "univer-disabled";
- var Aa = "univer-rule-item";
- var Wa = "univer-rule-describe";
- var Ha = "univer-rule-type";
- var Ua = "univer-rule-range";
- var ka = "univer-active";
- var Ba = "univer-draggableHandle";
- var Ga = "univer-delete-item";
- var Xa = "univer-grid-layout-wrap";
- var Ya = "univer-react-grid-item";
- var be = {
- cfRuleList: Da,
- ruleSelector: Ma,
- select: Na,
- selectSelector: ja,
- selectSelectionItem: La,
- selectSelectionSearchInput: $a,
- btnList: za,
- gap: Fa2,
- icon: Va,
- disabled: qa,
- ruleItem: Aa,
- ruleDescribe: Wa,
- ruleType: Ha,
- ruleRange: Ua,
- active: ka,
- draggableHandle: Ba,
- deleteItem: Ga,
- gridLayoutWrap: Xa,
- reactGridItem: Ya
- };
- var Ka = (t, e) => {
- const r = t.rule;
- switch (r.type) {
- case y.colorScale:
- return e.t("sheet.cf.ruleType.colorScale");
- case y.dataBar:
- return e.t("sheet.cf.ruleType.dataBar");
- case y.iconSet:
- return e.t("sheet.cf.ruleType.iconSet");
- case y.highlightCell:
- switch (r.subType) {
- case E.average: {
- const n = r.operator;
- return e.t(`sheet.cf.preview.describe.${n}`, e.t("sheet.cf.subRuleType.average"));
- }
- case E.duplicateValues:
- return e.t("sheet.cf.subRuleType.duplicateValues");
- case E.uniqueValues:
- return e.t("sheet.cf.subRuleType.uniqueValues");
- case E.number: {
- const n = r.operator;
- return e.t(`sheet.cf.preview.describe.${n}`, ...Array.isArray(r.value) ? r.value.map((i) => String(i)) : [String(r.value || "")]);
- }
- case E.text: {
- const n = r.operator;
- return e.t(`sheet.cf.preview.describe.${n}`, r.value || "");
- }
- case E.timePeriod: {
- const n = r.operator;
- return e.t(`sheet.cf.preview.describe.${n}`);
- }
- case E.rank:
- return r.isPercent ? r.isBottom ? e.t("sheet.cf.preview.describe.bottomNPercent", String(r.value)) : e.t("sheet.cf.preview.describe.topNPercent", String(r.value)) : r.isBottom ? e.t("sheet.cf.preview.describe.bottomN", String(r.value)) : e.t("sheet.cf.preview.describe.topN", String(r.value));
- case E.formula:
- return e.t("sheet.cf.ruleType.formula");
- }
- }
- };
- var ti = 0;
- var Za = (t) => {
- const { onClick: e } = t, r = W0(B), n = W0(_n), i = W0(F), o = W0(Pt), c = W0(Vr), v = W0(Ot), d = W0(mt), y3 = z0(() => n.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET), void 0, void 0, []), p = y3.getUnitId(), C = y3.getActiveSheet();
- if (!C)
- throw new Error("No active sheet found");
- const _ = C.getSheetId(), [w2, S] = (0, import_react.useState)([]), [R3, h] = (0, import_react.useState)("2"), [s, a] = (0, import_react.useState)(0), [u, b] = (0, import_react.useState)(-1), [l, g] = (0, import_react.useState)(ti), f = (0, import_react.useRef)(null), m = [
- { label: c.t("sheet.cf.panel.workSheet"), value: "2" },
- { label: c.t("sheet.cf.panel.selectedRange"), value: "1" }
- ], P = () => {
- const A = r.getSubunitRules(p, _);
- if (!A || !A.length)
- return [];
- if (R3 === "1") {
- const F2 = i.getCurrentLastSelection();
- if (!F2)
- return [];
- const oe = F2.range;
- return A.filter((de) => de.ranges.some((ye) => en.intersects(ye, oe)));
- } else if (R3 === "2")
- return [...A];
- return [];
- }, [M2, j2] = (0, import_react.useState)(P);
- dI(w2), (0, import_react.useEffect)(() => {
- const A = o.onCommandExecuted((F2) => {
- F2.id === an.id && a(Math.random());
- });
- return () => A.dispose();
- }), (0, import_react.useEffect)(() => {
- j2(P);
- }, [R3, s, p, _]), (0, import_react.useEffect)(() => {
- if (R3 === "2")
- return;
- const A = new Observable((F2) => {
- const oe = [re2.id, T2.id, U2.id, E2.id, v2.id], se = o.onCommandExecuted((de) => {
- const { id: ye, params: Ee } = de, $e2 = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId();
- oe.includes(ye) && Ee.unitId === $e2 && F2.next(null);
- });
- return () => se.dispose();
- }).pipe(debounceTime(16)).subscribe(() => {
- j2(P);
- });
- return () => {
- A.unsubscribe();
- };
- }, [n, R3, p, _]), (0, import_react.useEffect)(() => {
- const A = r.$ruleChange.subscribe(() => {
- a(Math.random());
- });
- return () => A.unsubscribe();
- }, [r]), (0, import_react.useEffect)(() => {
- const A = () => {
- var de;
- const se = Math.max(0, (((de = f.current) == null ? void 0 : de.getBoundingClientRect().width) || 0) - 8);
- return ti = se, se;
- }, oe = new Observable((se) => {
- const de = document.querySelector(".univer-sidebar");
- if (de) {
- let ye = setTimeout(() => {
- se.next();
- }, 150);
- const Ee = () => {
- ye && clearTimeout(ye), ye = null;
- }, $e2 = (V2) => {
- V2.propertyName === "width" && (Ee(), se.next());
- };
- return de.addEventListener("transitionend", $e2), () => {
- Ee(), de.removeEventListener("transitionend", $e2);
- };
- }
- }).pipe(debounceTime(16)).subscribe(() => {
- g(A());
- });
- return () => {
- oe.unsubscribe();
- };
- }, []);
- const N3 = (A) => {
- var se;
- const F2 = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), oe = (se = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : se.getSheetId();
- if (!F2 || !oe)
- throw new Error("No active sheet found");
- o.executeCommand(mn.id, { unitId: F2, subUnitId: oe, cfId: A.cfId });
- }, I = (A, F2) => {
- b(F2.y);
- }, O = (A, F2, oe) => {
- var V2;
- b(-1);
- const se = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), de = (V2 = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : V2.getSheetId();
- if (!se || !de)
- throw new Error("No active sheet found");
- const ye = (Z) => {
- const ce = M2.length;
- return Math.min(ce - 1, Math.max(0, Z));
- }, Ee = M2[ye(F2.y)].cfId, $e2 = M2[ye(oe.y)].cfId;
- Ee !== $e2 && o.executeCommand(lr.id, { unitId: se, subUnitId: de, start: { id: Ee, type: "self" }, end: { id: $e2, type: oe.y > F2.y ? "after" : "before" } });
- }, z = () => {
- t.onCreate();
- }, U = () => {
- R3 === "2" ? o.executeCommand(On.id) : R3 === "1" && M2.map((F2) => ({ unitId: p, subUnitId: _, cfId: F2.cfId })).forEach((F2) => {
- o.executeCommand(mn.id, F2);
- });
- }, k = (0, import_react.useMemo)(() => {
- const A = n.getCurrentUnitForType(Fe.UNIVER_SHEET), F2 = A.getActiveSheet();
- return M2.filter((oe) => {
- const se = oe.ranges;
- return yh(v, A.getUnitId(), F2.getSheetId(), se);
- });
- }, [M2]), ie = k.map((A, F2) => ({ i: A.cfId, x: 0, w: 12, y: F2, h: 1, isResizable: false })), ee = (0, import_react.useMemo)(() => {
- const A = n.getCurrentUnitForType(Fe.UNIVER_SHEET), F2 = A.getActiveSheet();
- return M2.every((oe) => {
- const se = oe.ranges;
- return yh(v, A.getUnitId(), F2.getSheetId(), se);
- });
- }, [M2]);
- return x3.jsxs("div", { className: be.cfRuleList, children: [
- x3.jsxs("div", { className: be.ruleSelector, children: [
- x3.jsx("div", { children: d.tWithReactNode(
- "sheet.cf.panel.managerRuleSelect",
- x3.jsx(r_, { className: be.select, options: m, value: R3, onChange: (A) => {
- h(A);
- } })
- ).map((A, F2) => x3.jsx("span", { children: A }, F2)) }),
- x3.jsxs("div", { className: be.btnList, children: [
- x3.jsx(Gf, { title: c.t("sheet.cf.panel.createRule"), placement: "bottom", children: x3.jsx(
- "div",
- {
- className: `
- ${be.icon}
- `,
- onClick: z,
- children: x3.jsx(Hi, {})
- }
- ) }),
- M2.length && ee ? x3.jsx(Gf, { title: c.t("sheet.cf.panel.clear"), placement: "bottom", children: x3.jsx(
- "div",
- {
- className: `
- ${be.gap}
- ${be.icon}
- `,
- onClick: U,
- children: x3.jsx(dn, {})
- }
- ) }) : x3.jsx(
- "div",
- {
- className: `
- ${be.gap}
- ${be.disabled}
- `,
- children: x3.jsx(dn, {})
- }
- )
- ] })
- ] }),
- x3.jsx("div", { ref: f, className: be.gridLayoutWrap, children: l ? x3.jsx(
- xa,
- {
- onDragStop: O,
- onDragStart: I,
- layout: ie,
- cols: 12,
- rowHeight: 60,
- width: l,
- margin: [0, 10],
- draggableHandle: ".draggableHandle",
- children: k == null ? void 0 : k.map((A, F2) => x3.jsx("div", { children: x3.jsxs(
- "div",
- {
- onMouseMove: () => {
- A.ranges !== w2 && S(A.ranges);
- },
- onMouseLeave: () => S([]),
- onClick: () => {
- e(A);
- },
- className: `
- ${be.ruleItem}
- ${u === F2 ? be.active : ""}
- `,
- children: [
- x3.jsx(
- "div",
- {
- className: `
- ${be.draggableHandle}
- draggableHandle
- `,
- onClick: (oe) => oe.stopPropagation(),
- children: x3.jsx(Ui, {})
- }
- ),
- x3.jsxs("div", { className: be.ruleDescribe, children: [
- x3.jsx("div", { className: be.ruleType, children: Ka(A, c) }),
- x3.jsx("div", { className: be.ruleRange, children: A.ranges.map((oe) => fr(oe)).join(",") })
- ] }),
- x3.jsx("div", { className: be.preview, children: x3.jsx(Ct, { rule: A.rule }) }),
- x3.jsx(
- "div",
- {
- className: `
- ${be.deleteItem}
- ${u === F2 ? be.active : ""}
- `,
- onClick: (oe) => {
- oe.stopPropagation(), N3(A), S([]);
- },
- children: x3.jsx(dn, {})
- }
- )
- ]
- }
- ) }, `${A.cfId}`))
- }
- ) : null })
- ] });
- };
- var Ja = "univer-cf-color-picker";
- var Qa = "univer-cf-color-picker-icon";
- var el = "univer-icon-dropdown";
- var Gn = {
- cfColorPicker: Ja,
- cfColorPickerIcon: Qa,
- iconDropdown: el
- };
- var lt = (t) => {
- const { color: e, onChange: r, disable: n = false, iconId: i = "PaintBucket", className: o, isNeedDropdownIcon: c = true } = t, v = W0(n1), d = (0, import_react.useMemo)(() => new Nt(e), [e]), y3 = v.get(i);
- return y3 && (n ? x3.jsx(y3, { className: o, extend: { colorChannel1: d.isValid ? e : "rgb(var(--primary-color))" } }) : x3.jsx(
- sC,
- {
- overlay: x3.jsx(
- "div",
- {
- className: `
- ${Gn.cfColorPicker}
- `,
- children: x3.jsx($O, { value: e, onChange: r })
- }
- ),
- children: x3.jsxs(
- "span",
- {
- className: `
- ${Gn.cfColorPickerIcon}
- ${o}
- `,
- children: [
- x3.jsx(y3, { extend: { colorChannel1: d.isValid ? e : "rgb(var(--primary-color))" } }),
- c && x3.jsx(Dn, { className: Gn.iconDropdown })
- ]
- }
- )
- }
- ));
- };
- var tl = "univer-cf-rule-style-editor";
- var nl = "univer-cf-preview-wrap";
- var rl = "univer-text";
- var il = "univer-position-relative";
- var ol = "univer-btn-list";
- var sl = "univer-util-item";
- var al = "univer-icon-set";
- var ll = "univer-render-config";
- var cl = "univer-flex";
- var ul = "univer-width45";
- var dl = "univer-icon-wrap";
- var fl = "univer-icon";
- var hl = "univer-dropdown-icon";
- var pl = "univer-error-input";
- var gl = "univer-error-text";
- var ml = "univer-icon-group-list";
- var vl = "univer-title";
- var yl = "univer-group";
- var bl = "univer-item-content";
- var Sl = "univer-item-wrap";
- var Cl = "univer-item";
- var wl = "univer-icon-item-list-wrap";
- var Rl = "univer-none";
- var _l = "univer-icon-item-list";
- var xl2 = "univer-width100";
- var Il = "univer-stress";
- var W = {
- cfRuleStyleEditor: tl,
- cfPreviewWrap: nl,
- text: rl,
- positionRelative: il,
- btnList: ol,
- utilItem: sl,
- iconSet: al,
- renderConfig: ll,
- flex: cl,
- width45: ul,
- iconWrap: dl,
- icon: fl,
- dropdownIcon: hl,
- errorInput: pl,
- errorText: gl,
- iconGroupList: ml,
- title: vl,
- group: yl,
- itemContent: bl,
- itemWrap: Sl,
- item: Cl,
- iconItemListWrap: wl,
- none: Rl,
- iconItemList: _l,
- width100: xl2,
- stress: Il
- };
- var it = (t, e) => ({ label: e.t(`sheet.cf.valueType.${t}`), value: t });
- var Xn = (t) => {
- var S;
- const { type: e, className: r, onChange: n, id: i, value: o } = t, c = W0(_n), v = c.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), d = (S = c.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : S.getSheetId(), y3 = (0, import_react.useMemo)(() => String(o).startsWith("=") ? String(o) : "=", [o]), p = (0, import_react.useMemo)(() => [x.max, x.min, "none"].includes(e) ? { disabled: true } : [x.percent, x.percentile].includes(e) ? {
- min: 0,
- max: 100
- } : {
- min: Number.MIN_SAFE_INTEGER,
- max: Number.MAX_SAFE_INTEGER
- }, [e]), C = (0, import_react.useRef)({}), [_, w2] = (0, import_react.useState)(false);
- return Kl((R3) => {
- var s;
- const h = (s = C.current) == null ? void 0 : s.handleOutClick;
- h && h(R3, () => w2(false));
- }), e === x.formula ? x3.jsx("div", { style: { width: "100%", marginLeft: 4 }, children: x3.jsx(
- fc,
- {
- initValue: y3,
- unitId: v,
- subUnitId: d,
- isFocus: _,
- onChange: (R3 = "") => {
- n(R3 || "");
- },
- onFocus: () => w2(true),
- actions: C.current
- }
- ) }) : x3.jsx(BO, { className: r, value: Number(t.value) || 0, onChange: (R3) => t.onChange(R3 || 0), ...p });
- };
- var El = (t) => {
- var N3;
- const { interceptorManager: e } = t, r = W0(Vr), n = ((N3 = t.rule) == null ? void 0 : N3.type) === y.colorScale ? t.rule : void 0, i = [it(x.num, r), it(x.percent, r), it(x.percentile, r), it(x.formula, r)], o = [it(x.min, r), ...i], c = [it("none", r), ...i], v = [it(x.max, r), ...i], [d, y3] = (0, import_react.useState)(() => {
- var O;
- const I = x.min;
- return n && ((O = n.config[0]) == null ? void 0 : O.value.type) || I;
- }), [p, C] = (0, import_react.useState)(() => {
- var O;
- const I = "none";
- return !n || n.config.length !== 3 ? I : ((O = n.config[1]) == null ? void 0 : O.value.type) || I;
- }), [_, w2] = (0, import_react.useState)(() => {
- var O;
- const I = x.max;
- return n && ((O = n.config[n.config.length - 1]) == null ? void 0 : O.value.type) || I;
- }), [S, R3] = (0, import_react.useState)(() => {
- if (!n)
- return 10;
- const O = n.config[0];
- return (O == null ? void 0 : O.value.value) === void 0 ? 10 : O == null ? void 0 : O.value.value;
- }), [h, s] = (0, import_react.useState)(() => {
- var z;
- if (!n || n.config.length !== 3)
- return 50;
- const O = (z = n.config[1]) == null ? void 0 : z.value.value;
- return O === void 0 ? 50 : O;
- }), [a, u] = (0, import_react.useState)(() => {
- var z;
- if (!n)
- return 90;
- const O = (z = n.config[n.config.length - 1]) == null ? void 0 : z.value.value;
- return O === void 0 ? 90 : O;
- }), [b, l] = (0, import_react.useState)(() => {
- var O;
- const I = "#d0d9fb";
- return n && ((O = n.config[0]) == null ? void 0 : O.color) || I;
- }), [g, f] = (0, import_react.useState)(() => {
- var O;
- const I = "#7790f3";
- return !n || n.config.length !== 3 ? I : ((O = n.config[1]) == null ? void 0 : O.color) || I;
- }), [m, P] = (0, import_react.useState)(() => {
- var O;
- const I = "#2e55ef";
- return n && ((O = n.config[n.config.length - 1]) == null ? void 0 : O.color) || I;
- }), M2 = (0, import_react.useMemo)(() => (I) => {
- const {
- minType: O,
- medianType: z,
- maxType: U,
- minValue: k,
- medianValue: ie,
- maxValue: ee,
- minColor: A,
- medianColor: F2,
- maxColor: oe
- } = I, se = [];
- return se.push({ color: A, value: { type: O, value: k } }), z !== "none" && se.push({ color: F2, value: { type: z, value: ie } }), se.push({ color: oe, value: { type: U, value: ee } }), { config: se.map((ye, Ee) => ({ ...ye, index: Ee })), type: y.colorScale };
- }, []);
- (0, import_react.useEffect)(() => e.intercept(e.getInterceptPoints().submit, {
- handler() {
- return M2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m });
- }
- }), [M2, d, p, _, S, h, a, b, g, m, e]);
- const j2 = (I) => {
- t.onChange(M2(I));
- };
- return x3.jsxs("div", { children: [
- x3.jsx("div", { className: $.title, children: r.t("sheet.cf.panel.styleRule") }),
- x3.jsx(
- "div",
- {
- className: `
- ${W.cfPreviewWrap}
- `,
- children: x3.jsx(Ct, { rule: M2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m }) })
- }
- ),
- x3.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.min") }),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.labelContainer}
- ${$.mTSm}
- `,
- children: [
- x3.jsx(
- r_,
- {
- style: { flexShrink: 0 },
- options: o,
- value: d,
- onChange: (I) => {
- y3(I);
- const O = x1(I, 10);
- R3(O), j2({ minType: I, medianType: p, maxType: _, minValue: O, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m });
- }
- }
- ),
- x3.jsx(
- Xn,
- {
- id: "min",
- className: `
- ${$.mLXxs}
- `,
- value: S,
- type: d,
- onChange: (I) => {
- R3(I), j2({ minType: d, medianType: p, maxType: _, minValue: I, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m });
- }
- }
- ),
- x3.jsx(
- lt,
- {
- className: $.mLXxs,
- color: b,
- onChange: (I) => {
- l(I), j2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: I, medianColor: g, maxColor: m });
- }
- }
- )
- ]
- }
- ),
- x3.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.medianValue") }),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.labelContainer}
- ${$.mTSm}
- `,
- children: [
- x3.jsx(
- r_,
- {
- style: { flexShrink: 0 },
- options: c,
- value: p,
- onChange: (I) => {
- C(I);
- const O = x1(I, 50);
- s(O), j2({ minType: d, medianType: I, maxType: _, minValue: S, medianValue: O, maxValue: a, minColor: b, medianColor: g, maxColor: m });
- }
- }
- ),
- x3.jsx(
- Xn,
- {
- id: "median",
- className: `
- ${$.mLXxs}
- `,
- value: h,
- type: p,
- onChange: (I) => {
- s(I), j2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: I, maxValue: a, minColor: b, medianColor: g, maxColor: m });
- }
- }
- ),
- p !== "none" && x3.jsx(
- lt,
- {
- className: $.mLXxs,
- color: g,
- onChange: (I) => {
- f(I), j2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: I, maxColor: m });
- }
- }
- )
- ]
- }
- ),
- x3.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.max") }),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.labelContainer}
- ${$.mTSm}
- `,
- children: [
- x3.jsx(
- r_,
- {
- style: { flexShrink: 0 },
- options: v,
- value: _,
- onChange: (I) => {
- w2(I);
- const O = x1(I, 90);
- u(O), j2({ minType: d, medianType: p, maxType: I, minValue: S, medianValue: h, maxValue: O, minColor: b, medianColor: g, maxColor: m });
- }
- }
- ),
- x3.jsx(
- Xn,
- {
- id: "max",
- className: `
- ${$.mLXxs}
- `,
- value: a,
- type: _,
- onChange: (I) => {
- u(I), j2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: I, minColor: b, medianColor: g, maxColor: m });
- }
- }
- ),
- x3.jsx(
- lt,
- {
- className: $.mLXxs,
- color: m,
- onChange: (I) => {
- P(I), j2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: I });
- }
- }
- )
- ]
- }
- )
- ] });
- };
- var ft = (t, e) => ({ label: e.t(`sheet.cf.valueType.${t}`), value: t });
- var ni = (t) => {
- var R3;
- const { onChange: e, className: r, value: n, type: i, id: o, disabled: c = false } = t, v = W0(_n), d = v.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), y3 = (R3 = v.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : R3.getSheetId(), p = (0, import_react.useRef)({}), [C, _] = (0, import_react.useState)(false);
- Kl((h) => {
- var a;
- const s = (a = p.current) == null ? void 0 : a.handleOutClick;
- s && s(h, () => _(false));
- });
- const w2 = (0, import_react.useRef)(n), S = (0, import_react.useMemo)(() => [x.percentile, x.percent].includes(i) ? {
- max: 100,
- min: 0
- } : {
- min: Number.MIN_SAFE_INTEGER,
- max: Number.MAX_SAFE_INTEGER
- }, [i]);
- if (i === x.formula) {
- const h = String(w2.current).startsWith("=") ? String(w2.current) || "" : "=";
- return x3.jsx("div", { style: { width: "100%", marginLeft: 12 }, children: x3.jsx(
- fc,
- {
- initValue: h,
- unitId: d,
- subUnitId: y3,
- isFocus: C,
- onChange: (s = "") => {
- e(s || "");
- },
- onFocus: () => _(true),
- actions: p.current
- }
- ) });
- }
- return x3.jsx(
- BO,
- {
- className: r,
- value: Number(n) || 0,
- disabled: c,
- onChange: (h) => {
- e(h || 0);
- },
- ...S
- }
- );
- };
- var Tl = (t) => {
- var N3;
- const { interceptorManager: e } = t, r = W0(Vr), n = ((N3 = t.rule) == null ? void 0 : N3.type) === y.dataBar ? t.rule : void 0, [i, o] = (0, import_react.useState)(() => {
- var O;
- const I = "0";
- return n ? (O = n.config) != null && O.isGradient ? "1" : "0" : I;
- }), [c, v] = (0, import_react.useState)(() => {
- var I;
- return n ? ((I = n.config) == null ? void 0 : I.positiveColor) || x2 : x2;
- }), [d, y3] = (0, import_react.useState)(() => {
- var I;
- return n ? ((I = n.config) == null ? void 0 : I.nativeColor) || y2 : y2;
- }), p = [ft(x.num, r), ft(x.percent, r), ft(x.percentile, r), ft(x.formula, r)], C = [ft(x.min, r), ...p], _ = [ft(x.max, r), ...p], [w2, S] = (0, import_react.useState)(() => {
- var O;
- const I = C[0].value;
- return n && ((O = n.config) == null ? void 0 : O.min.type) || I;
- }), [R3, h] = (0, import_react.useState)(() => {
- var O;
- const I = _[0].value;
- return n && ((O = n.config) == null ? void 0 : O.max.type) || I;
- }), [s, a] = (0, import_react.useState)(() => {
- var z;
- if (!n)
- return 0;
- const O = ((z = n.config) == null ? void 0 : z.min) || {};
- return O.type === x.formula ? O.value || "=" : O.value || 0;
- }), [u, b] = (0, import_react.useState)(() => {
- var z;
- if (!n)
- return 100;
- const O = ((z = n.config) == null ? void 0 : z.max) || {};
- return O.type === x.formula ? O.value || "=" : O.value === void 0 ? 100 : O.value;
- }), [l, g] = (0, import_react.useState)(() => n ? n.isShowValue === void 0 ? true : !!n.isShowValue : true), f = (I) => ({ config: {
- min: { type: I.minValueType, value: I.minValue },
- max: { type: I.maxValueType, value: I.maxValue },
- isGradient: I.isGradient === "1",
- positiveColor: I.positiveColor || x2,
- nativeColor: I.nativeColor || y2
- }, type: y.dataBar, isShowValue: I.isShowValue });
- (0, import_react.useEffect)(() => e.intercept(e.getInterceptPoints().submit, {
- handler() {
- return f({ isGradient: i, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l });
- }
- }), [i, s, w2, u, R3, c, d, e, l]);
- const m = (I) => {
- t.onChange(f(I));
- }, P = (I) => {
- v(I), m({ isGradient: i, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: I, nativeColor: d, isShowValue: l });
- }, M2 = (I) => {
- y3(I), m({ isGradient: i, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: I, isShowValue: l });
- }, j2 = (I) => p.map((O) => O.value).includes(I);
- return x3.jsxs("div", { children: [
- x3.jsx("div", { className: $.title, children: r.t("sheet.cf.panel.styleRule") }),
- x3.jsx(
- "div",
- {
- className: `
- ${W.cfPreviewWrap}
- `,
- children: x3.jsx(Ct, { rule: f({ isGradient: i, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l }) })
- }
- ),
- x3.jsxs("div", { children: [
- x3.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.fillType") }),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.mTSm}
- ${$.mLXxs}
- ${$.labelContainer}
- `,
- children: [
- x3.jsxs(
- t_,
- {
- value: i,
- onChange: (I) => {
- o(I), m({ isGradient: I, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l });
- },
- children: [
- x3.jsx(e_, { value: "0", children: x3.jsx("span", { className: W.text, children: r.t("sheet.cf.panel.pureColor") }) }),
- x3.jsx(e_, { value: "1", children: x3.jsx("span", { className: W.text, children: r.t("sheet.cf.panel.gradient") }) })
- ]
- }
- ),
- x3.jsxs(
- "div",
- {
- className: `
- ${W.utilItem}
- ${$.mLXl}
- `,
- children: [
- x3.jsx(
- um,
- {
- checked: !l,
- onChange: (I) => {
- g(!I), m({ isGradient: I, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: !I });
- }
- }
- ),
- r.t("sheet.cf.panel.onlyShowDataBar")
- ]
- }
- )
- ]
- }
- )
- ] }),
- x3.jsxs("div", { children: [
- x3.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.colorSet") }),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.labelContainer}
- ${$.mTSm}
- ${$.mLXxs}
- `,
- children: [
- x3.jsxs(
- "div",
- {
- className: `
- ${$.labelContainer}
- `,
- children: [
- x3.jsx(
- "div",
- {
- className: `
- ${W.text}
- `,
- children: r.t("sheet.cf.panel.native")
- }
- ),
- x3.jsx(
- lt,
- {
- color: d,
- onChange: M2
- }
- )
- ]
- }
- ),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.labelContainer}
- ${$.mLSm}
- `,
- children: [
- x3.jsx(
- "div",
- {
- className: `
- ${W.text}
- `,
- children: r.t("sheet.cf.panel.positive")
- }
- ),
- x3.jsx(
- lt,
- {
- color: c,
- onChange: P
- }
- )
- ]
- }
- )
- ]
- }
- )
- ] }),
- x3.jsxs("div", { children: [
- x3.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.min") }),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.mTSm}
- ${$.labelContainer}
- `,
- children: [
- x3.jsx(
- r_,
- {
- style: { width: "50%", flexShrink: 0 },
- options: C,
- value: w2,
- onChange: (I) => {
- S(I);
- const O = x1(I, 10);
- a(O), m({ isGradient: i, minValue: O, minValueType: I, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l });
- }
- }
- ),
- x3.jsx(
- ni,
- {
- disabled: !j2(w2),
- id: "min",
- type: w2,
- className: $.mLSm,
- value: s,
- onChange: (I) => {
- a(I || 0), m({ isGradient: i, minValue: I || 0, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l });
- }
- }
- )
- ]
- }
- ),
- x3.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.max") }),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.mTSm}
- ${$.labelContainer}
- `,
- children: [
- x3.jsx(
- r_,
- {
- style: { width: "50%", flexShrink: 0 },
- options: _,
- value: R3,
- onChange: (I) => {
- h(I);
- const O = x1(I, 90);
- b(O), m({ isGradient: i, minValue: s, minValueType: w2, maxValue: O, maxValueType: I, positiveColor: c, nativeColor: d, isShowValue: l });
- }
- }
- ),
- x3.jsx(
- ni,
- {
- disabled: !j2(R3),
- id: "max",
- type: R3,
- className: $.mLSm,
- value: u,
- onChange: (I) => {
- b(I || 0), m({ isGradient: i, minValue: s, minValueType: w2, maxValue: I || 0, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l });
- }
- }
- )
- ]
- }
- )
- ] })
- ] });
- };
- function io(t) {
- var e, r, n = "";
- if (typeof t == "string" || typeof t == "number")
- n += t;
- else if (typeof t == "object")
- if (Array.isArray(t)) {
- var i = t.length;
- for (e = 0; e < i; e++)
- t[e] && (r = io(t[e])) && (n && (n += " "), n += r);
- } else
- for (r in t)
- t[r] && (n && (n += " "), n += r);
- return n;
- }
- function on() {
- for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++)
- (t = arguments[r]) && (e = io(t)) && (n && (n += " "), n += e);
- return n;
- }
- var Pl = "univer-cf-style-edit";
- var Ol = "univer-button-item";
- var Dl = "univer-isActive";
- var ke2 = {
- cfStyleEdit: Pl,
- buttonItem: Ol,
- isActive: Dl
- };
- var sn = (t) => [we.FALSE, void 0].includes(t) ? we.TRUE : we.FALSE;
- var an2 = (t) => t !== we.FALSE;
- var gr2 = (t) => {
- const { style: e, onChange: r, className: n } = t, i = W0(n1), [o, c] = (0, import_react.useState)(() => {
- if (e != null && e.bl)
- return e.bl;
- }), [v, d] = (0, import_react.useState)(() => {
- if (e != null && e.it)
- return e.it;
- }), [y3, p] = (0, import_react.useState)(() => {
- if (e != null && e.ul)
- return e.ul.s;
- }), [C, _] = (0, import_react.useState)(() => {
- if (e != null && e.st)
- return e.st.s;
- }), [w2, S] = (0, import_react.useState)(() => {
- var g;
- const l = "#2f56ef";
- return (g = e == null ? void 0 : e.cl) != null && g.rgb ? e.cl.rgb : l;
- }), [R3, h] = (0, import_react.useState)(() => {
- var g;
- const l = "#e8ecfc";
- return (g = e == null ? void 0 : e.bg) != null && g.rgb ? e.bg.rgb : l;
- }), s = i.get("BoldSingle"), a = i.get("ItalicSingle"), u = i.get("UnderlineSingle"), b = i.get("StrikethroughSingle");
- return (0, import_react.useEffect)(() => {
- const l = {
- bl: o,
- it: v
- };
- w2 !== void 0 && (l.cl = { rgb: w2 }), R3 !== void 0 && (l.bg = { rgb: R3 }), C !== void 0 && (l.st = { s: C }), y3 !== void 0 && (l.ul = { s: y3 }), r(g1(l));
- }, [o, v, y3, C, w2, R3]), x3.jsxs(
- "div",
- {
- className: `
- ${ke2.cfStyleEdit}
- ${n}
- `,
- children: [
- s && x3.jsx("div", { className: on({ [ke2.isActive]: an2(o || we.FALSE) }, ke2.buttonItem), onClick: () => c(sn(o)), children: x3.jsx(s, {}) }),
- a && x3.jsx("div", { className: on({ [ke2.isActive]: an2(v || we.FALSE) }, ke2.buttonItem), onClick: () => d(sn(v)), children: x3.jsx(a, {}) }),
- u && x3.jsx("div", { className: on({ [ke2.isActive]: an2(y3 || we.FALSE) }, ke2.buttonItem), onClick: () => p(sn(y3)), children: x3.jsx(u, {}) }),
- b && x3.jsx("div", { className: on({ [ke2.isActive]: an2(C || we.FALSE) }, ke2.buttonItem), onClick: () => _(sn(C)), children: x3.jsx(b, {}) }),
- x3.jsx(lt, { color: w2, onChange: S, iconId: "FontColor" }),
- x3.jsx(lt, { color: R3, onChange: h, iconId: "PaintBucket" })
- ]
- }
- );
- };
- var Ml = (t) => {
- var b;
- const { onChange: e, interceptorManager: r } = t, n = W0(Vr), o = W0(_n).getCurrentUnitForType(Fe.UNIVER_SHEET), c = o.getActiveSheet(), v = ((b = t.rule) == null ? void 0 : b.type) === y.highlightCell ? t.rule : void 0, d = (0, import_react.useRef)(null), [y3, p] = (0, import_react.useState)(false), C = (0, import_react.useRef)({}), [_, w2] = (0, import_react.useState)({}), [S, R3] = (0, import_react.useState)(() => (v == null ? void 0 : v.subType) === E.formula ? v.value : "="), [h, s] = (0, import_react.useState)(void 0), a = (l) => ({
- style: l.style,
- value: S,
- type: y.highlightCell,
- subType: E.formula
- });
- (0, import_react.useEffect)(() => r.intercept(r.getInterceptPoints().submit, {
- handler() {
- return a({ style: _, formula: S });
- }
- }), [_, S, r]), (0, import_react.useEffect)(() => r.intercept(r.getInterceptPoints().beforeSubmit, {
- handler: (g, f, m) => h || S.length === 1 || !S.startsWith("=") ? (s(n.t("sheet.cf.errorMessage.formulaError")), false) : m(g)
- }), [h, S]);
- const u = (l) => {
- e(a(l));
- };
- return Kl((l) => {
- var f;
- const g = (f = C.current) == null ? void 0 : f.handleOutClick;
- g && g(l, () => p(false));
- }), x3.jsxs("div", { ref: d, children: [
- x3.jsx(
- "div",
- {
- className: `
- ${$.title}
- ${$.mTBase}
- `,
- children: n.t("sheet.cf.panel.styleRule")
- }
- ),
- x3.jsx(
- "div",
- {
- className: `
- ${$.mTSm}
- `,
- children: x3.jsx(
- fc,
- {
- onChange: (l) => {
- R3(l), u({ style: _, formula: l });
- },
- onVerify: (l, g) => {
- !l || g.length === 1 ? s(n.t("sheet.cf.errorMessage.formulaError")) : s(void 0);
- },
- errorText: h,
- onFocus: () => {
- p(true);
- },
- actions: C.current,
- isFocus: y3,
- initValue: S,
- unitId: o.getUnitId(),
- subUnitId: c == null ? void 0 : c.getSheetId()
- }
- )
- }
- ),
- x3.jsx(
- "div",
- {
- className: `
- ${W.cfPreviewWrap}
- `,
- children: x3.jsx(Ct, { rule: a({ style: _, formula: S }) })
- }
- ),
- x3.jsx(
- gr2,
- {
- style: v == null ? void 0 : v.style,
- className: `
- ${$.mTSm}
- `,
- onChange: (l) => {
- w2(l), u({ style: l, formula: S });
- }
- }
- )
- ] });
- };
- var ln = (t) => x3.jsxs("div", { style: { position: "relative" }, children: [
- x3.jsx(
- "div",
- {
- style: {
- position: "absolute",
- zIndex: 999,
- bottom: "-13px",
- fontSize: "10px",
- color: "red"
- },
- children: t.errorText
- }
- ),
- t.children
- ] });
- var fe = (t, e) => ({ label: e.t(`sheet.cf.operator.${t}`), value: t });
- var Nl = (t) => {
- const { type: e, operator: r, onChange: n, value: i, interceptorManager: o } = t, c = W0(Vr), [v, d] = (0, import_react.useState)(() => typeof i == "number" ? i : 0), [y3, p] = (0, import_react.useState)(""), [C, _] = (0, import_react.useState)(() => typeof i == "string" ? i : ""), [w2, S] = (0, import_react.useState)(""), [R3, h] = (0, import_react.useState)(() => Array.isArray(i) ? i[0] === void 0 ? 0 : i[0] : 0), [s, a] = (0, import_react.useState)(""), [u, b] = (0, import_react.useState)(() => Array.isArray(i) ? i[1] === void 0 ? 100 : i[1] : 100), [l, g] = (0, import_react.useState)("");
- switch ((0, import_react.useEffect)(() => {
- switch (e) {
- case E.text: {
- [
- M.beginsWith,
- M.endsWith,
- M.containsText,
- M.notContainsText,
- M.equal,
- M.notEqual
- ].includes(r) && n(C);
- break;
- }
- case E.number: {
- [
- w.equal,
- w.notEqual,
- w.greaterThan,
- w.greaterThanOrEqual,
- w.lessThan,
- w.lessThanOrEqual
- ].includes(r) && n(v), [w.between, w.notBetween].includes(r) && n([R3, u]);
- break;
- }
- }
- }, [e]), (0, import_react.useEffect)(() => {
- const f = o.intercept(o.getInterceptPoints().beforeSubmit, {
- handler: (m, P, M2) => {
- switch (e) {
- case E.text:
- if ([
- M.beginsWith,
- M.containsText,
- M.endsWith,
- M.notEqual,
- M.notContainsText,
- M.equal
- ].includes(r))
- return C ? M2(m) : (S(c.t("sheet.cf.errorMessage.notBlank")), false);
- }
- return M2(m);
- }
- });
- return () => {
- f();
- };
- }, [e, v, C, r]), e) {
- case E.text: {
- if ([
- M.beginsWith,
- M.endsWith,
- M.containsText,
- M.notContainsText,
- M.equal,
- M.notEqual
- ].includes(r)) {
- const f = (m) => {
- _(m), n(m);
- };
- return x3.jsx(
- "div",
- {
- className: `
- ${$.mTSm}
- `,
- children: x3.jsx(ln, { errorText: w2, children: x3.jsx(
- QC,
- {
- className: W.width100,
- value: C,
- onChange: (m) => {
- S(""), f(m);
- }
- }
- ) })
- }
- );
- }
- break;
- }
- case E.number: {
- if ([
- w.equal,
- w.notEqual,
- w.greaterThan,
- w.greaterThanOrEqual,
- w.lessThan,
- w.lessThanOrEqual
- ].includes(r)) {
- const f = (m) => {
- d(m || 0), n(m || 0), p("");
- };
- return x3.jsx(
- "div",
- {
- className: `
- ${$.mTSm}
- `,
- children: x3.jsx(ln, { errorText: y3, children: x3.jsx(BO, { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER, className: W.width100, value: v, onChange: f }) })
- }
- );
- }
- if ([w.between, w.notBetween].includes(r)) {
- const f = (P) => {
- h(P || 0), n([P || 0, u]), a("");
- }, m = (P) => {
- b(P || 0), n([R3, P || 0]), g("");
- };
- return x3.jsxs(
- "div",
- {
- className: `
- ${$.mTSm}
- ${$.labelContainer}
- `,
- children: [
- x3.jsx(ln, { errorText: s, children: x3.jsx(BO, { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER, value: R3, onChange: f }) }),
- x3.jsx(ln, { errorText: l, children: x3.jsx(
- BO,
- {
- min: Number.MIN_SAFE_INTEGER,
- max: Number.MAX_SAFE_INTEGER,
- className: `
- ${$.mLSm}
- `,
- value: u,
- onChange: m
- }
- ) })
- ]
- }
- );
- }
- }
- }
- return null;
- };
- var ri = (t, e) => {
- switch (t) {
- case E.text:
- return [
- fe(M.containsText, e),
- fe(M.notContainsText, e),
- fe(M.beginsWith, e),
- fe(M.endsWith, e),
- fe(M.equal, e),
- fe(M.notEqual, e),
- fe(M.containsBlanks, e),
- fe(M.notContainsBlanks, e),
- fe(M.containsErrors, e),
- fe(M.notContainsErrors, e)
- ];
- case E.number:
- return [
- fe(w.between, e),
- fe(w.notBetween, e),
- fe(w.equal, e),
- fe(w.notEqual, e),
- fe(w.greaterThan, e),
- fe(w.greaterThanOrEqual, e),
- fe(w.lessThan, e),
- fe(w.lessThanOrEqual, e)
- ];
- case E.timePeriod:
- return [
- fe(R.yesterday, e),
- fe(R.today, e),
- fe(R.tomorrow, e),
- fe(R.last7Days, e),
- fe(R.lastWeek, e),
- fe(R.thisWeek, e),
- fe(R.nextWeek, e),
- fe(R.lastMonth, e),
- fe(R.thisMonth, e),
- fe(R.nextMonth, e)
- ];
- }
- };
- var ii = (t) => {
- var b;
- const { interceptorManager: e, onChange: r } = t, n = W0(Vr), i = ((b = t.rule) == null ? void 0 : b.type) === y.highlightCell ? t.rule : void 0, [o, c] = (0, import_react.useState)(() => {
- const l = E.text;
- return i && i.subType || l;
- }), v = [
- {
- value: E.text,
- label: n.t("sheet.cf.subRuleType.text")
- },
- {
- value: E.number,
- label: n.t("sheet.cf.subRuleType.number")
- },
- {
- value: E.timePeriod,
- label: n.t("sheet.cf.subRuleType.timePeriod")
- },
- {
- value: E.duplicateValues,
- label: n.t("sheet.cf.subRuleType.duplicateValues")
- },
- {
- value: E.uniqueValues,
- label: n.t("sheet.cf.subRuleType.uniqueValues")
- }
- ], d = (0, import_react.useMemo)(() => ri(o, n), [o]), [y3, p] = (0, import_react.useState)(() => {
- const l = d ? d[0].value : void 0;
- return i && i.operator || l;
- }), [C, _] = (0, import_react.useState)(() => {
- var f;
- const l = "";
- return i ? (f = i.value) != null ? f : _12(i.subType, i.operator) : l;
- }), [w2, S] = (0, import_react.useState)({}), R3 = (0, import_react.useMemo)(() => (l) => {
- var g, f, m, P, M2, j2, N3, I, O, z, U, k, ie, ee, A;
- switch (l.subType || o) {
- case E.text: {
- if ([
- M.beginsWith,
- M.endsWith,
- M.containsText,
- M.notContainsText,
- M.equal,
- M.notEqual
- ].includes(y3))
- return {
- type: y.highlightCell,
- subType: (g = l.subType) != null ? g : o,
- operator: (f = l.operator) != null ? f : y3,
- style: (m = l.style) != null ? m : w2,
- value: (P = l.value) != null ? P : C
- };
- break;
- }
- case E.number: {
- if ([
- w.equal,
- w.notEqual,
- w.greaterThan,
- w.greaterThanOrEqual,
- w.lessThan,
- w.lessThanOrEqual
- ].includes(y3))
- return {
- type: y.highlightCell,
- subType: (M2 = l.subType) != null ? M2 : o,
- operator: (j2 = l.operator) != null ? j2 : y3,
- style: (N3 = l.style) != null ? N3 : w2,
- value: (I = l.value) != null ? I : C
- };
- if ([w.between, w.notBetween].includes(y3))
- return {
- type: y.highlightCell,
- subType: (O = l.subType) != null ? O : o,
- operator: (z = l.operator) != null ? z : y3,
- style: (U = l.style) != null ? U : w2,
- value: (k = l.value) != null ? k : C
- };
- break;
- }
- }
- return {
- type: y.highlightCell,
- subType: (ie = l.subType) != null ? ie : o,
- operator: (ee = l.operator) != null ? ee : y3,
- style: (A = l.style) != null ? A : w2
- };
- }, [o, y3, C, w2]);
- (0, import_react.useEffect)(() => e.intercept(e.getInterceptPoints().submit, {
- handler() {
- return R3({});
- }
- }), [R3, e]), (0, import_react.useEffect)(() => {
- v.some((l) => l.value === o) || c(v[0].value);
- }, [v]);
- const h = (l) => {
- const g = l, f = ri(g, n), m = f && f[0].value;
- c(g), p(m), m && _(_12(g, m)), r(R3({ subType: g, operator: m }));
- }, s = (l) => {
- const g = l;
- p(g), r(R3({ operator: g }));
- }, a = (l) => {
- _(l), r(R3({ value: l }));
- }, u = (0, import_react.useMemo)(() => `${o}_${y3}_${Math.random()}`, [o, y3]);
- return x3.jsxs("div", { children: [
- x3.jsx(
- "div",
- {
- className: `
- ${$.title}
- ${$.mTBase}
- `,
- children: n.t("sheet.cf.panel.styleRule")
- }
- ),
- x3.jsx(
- r_,
- {
- className: `
- ${$.mTSm}
- ${W.width100}
- `,
- onChange: h,
- value: o,
- options: v
- }
- ),
- (d == null ? void 0 : d.length) && x3.jsx(
- r_,
- {
- className: `
- ${$.mTSm}
- ${W.width100}
- `,
- onChange: s,
- value: y3 || "",
- options: d
- }
- ),
- x3.jsx(Nl, { value: C, interceptorManager: e, type: o, operator: y3, rule: i, onChange: a }, u),
- x3.jsx(
- "div",
- {
- className: `
- ${W.cfPreviewWrap}
- `,
- children: x3.jsx(Ct, { rule: R3({}) })
- }
- ),
- x3.jsx(
- gr2,
- {
- style: i == null ? void 0 : i.style,
- className: `
- ${$.mLXxs}
- `,
- onChange: (l) => {
- S(l), r(R3({ style: l }));
- }
- }
- )
- ] });
- };
- var oo = (t, e) => (o2[t] || [])[Number(e)] || "";
- var jl = (t) => {
- var d;
- const e = W0(_n), r = e.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), n = (d = e.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : d.getSheetId(), i = (0, import_react.useMemo)(() => t.error ? W.errorInput : "", [t.error]), o = (0, import_react.useRef)({}), [c, v] = (0, import_react.useState)(false);
- return Kl((y3) => {
- var C;
- const p = (C = o.current) == null ? void 0 : C.handleOutClick;
- p && p(y3, () => v(false));
- }), x3.jsx("div", { className: W.positionRelative, children: t.type !== x.formula ? x3.jsxs(x3.Fragment, { children: [
- x3.jsx(BO, { className: i, value: Number(t.value) || 0, onChange: (y3) => t.onChange(y3 != null ? y3 : 0) }),
- t.error && x3.jsx("div", { className: W.errorText, children: t.error })
- ] }) : x3.jsx("div", { style: { width: "100%" }, children: x3.jsx(
- fc,
- {
- initValue: String(t.value),
- unitId: r,
- subUnitId: n,
- isFocus: c,
- onChange: (y3 = "") => {
- const p = y3 || "";
- t.onChange(p);
- },
- onFocus: () => v(true),
- actions: o.current
- }
- ) }) });
- };
- var oi = (t, e, r) => ({
- operator: w.greaterThan,
- value: { type: x.num, value: (r.length - 1 - e) * 10 },
- iconType: t,
- iconId: String(e)
- });
- var Ll = (0, import_react.forwardRef)((t, e) => {
- const r = W0(Vr), n = (i) => {
- t.onClick(i);
- };
- return x3.jsx("div", { ref: e, className: W.iconGroupList, children: K02.map((i, o) => x3.jsxs("div", { className: W.group, children: [
- x3.jsx("div", { className: W.title, children: r.t(i.title) }),
- x3.jsx("div", { className: W.itemContent, children: i.group.map((c) => x3.jsx("div", { className: W.itemWrap, onClick: () => {
- n(c.name);
- }, children: x3.jsx("div", { className: W.item, children: c.list.map((v, d) => x3.jsx("img", { className: W.icon, src: v }, d)) }) }, c.name)) })
- ] }, o)) });
- });
- var $l = (t) => {
- const e = (0, import_react.useMemo)(() => {
- const n = [];
- for (const i in o2) {
- const o = o2[i], c = i;
- o.forEach((v, d) => {
- n.push({
- iconType: c,
- base64: v,
- iconId: String(d)
- });
- });
- }
- return n;
- }, []), r = (n) => {
- t.onClick(n.iconType, n.iconId);
- };
- return x3.jsxs("div", { className: W.iconItemListWrap, children: [
- x3.jsxs("div", { className: W.none, onClick: () => r({ iconType: J0, iconId: "", base64: "" }), children: [
- x3.jsx(Zt, { className: W.icon }),
- x3.jsx("span", { children: "无单元格图标" })
- ] }),
- x3.jsx("div", { className: W.iconItemList, children: e.map((n) => x3.jsx("div", { className: W.item, children: x3.jsx(
- "img",
- {
- onClick: () => r(n),
- className: `
- ${W.icon}
- `,
- src: n.base64
- }
- ) }, `${n.iconType}_${n.iconId}`)) })
- ] });
- };
- var zl = (t) => {
- const { onChange: e, configList: r, errorMap: n = {} } = t, i = W0(Vr), o = [
- { label: i.t(`sheet.cf.symbol.${w.greaterThan}`), value: w.greaterThan },
- { label: i.t(`sheet.cf.symbol.${w.greaterThanOrEqual}`), value: w.greaterThanOrEqual }
- ], c = [
- { label: i.t(`sheet.cf.valueType.${x.num}`), value: x.num },
- { label: i.t(`sheet.cf.valueType.${x.percent}`), value: x.percent },
- { label: i.t(`sheet.cf.valueType.${x.percentile}`), value: x.percentile },
- { label: i.t(`sheet.cf.valueType.${x.formula}`), value: x.formula }
- ], v = (C, _) => {
- e([String(_), "value", "value"], C);
- }, d = (C, _) => {
- e([String(_), "operator"], C);
- const w2 = _12(E.number, C);
- v(w2, _);
- }, y3 = (C, _) => {
- e([String(_), "value", "type"], C);
- const w2 = r[_], S = _12(E.number, w2.operator);
- v(S, _);
- };
- return (0, import_react.useMemo)(() => r.map((C, _) => {
- const w2 = n[_], S = oo(C.iconType, C.iconId), R3 = _ === r.length - 1, h = _ === 0, s = r[_ - 1], a = (s == null ? void 0 : s.value.type) === x.formula ? i.t("sheet.cf.valueType.formula") : s == null ? void 0 : s.value.value, u = (b, l) => {
- const g = { ...C, iconId: l, iconType: b };
- e([String(_)], g);
- };
- return x3.jsxs(
- "div",
- {
- className: `
- ${_ ? $.mTXl : $.mTSm}
- `,
- children: [
- x3.jsxs(
- "div",
- {
- className: `
- ${$.label}
- ${W.flex}
- `,
- children: [
- x3.jsxs(
- "div",
- {
- className: `
- ${W.width45}
- `,
- children: [
- i.t("sheet.cf.iconSet.icon"),
- _ + 1
- ]
- }
- ),
- x3.jsx(
- "div",
- {
- className: `
- ${W.width45}
- `,
- children: x3.jsxs(x3.Fragment, { children: [
- !h && !R3 && i.t("sheet.cf.iconSet.rule"),
- !h && !R3 && x3.jsxs("span", { className: W.stress, children: [
- "(",
- i.t("sheet.cf.iconSet.when"),
- i.t(`sheet.cf.symbol.${x0(s.operator)}`),
- a,
- R3 ? "" : ` ${i.t("sheet.cf.iconSet.and")} `,
- ")"
- ] })
- ] })
- }
- )
- ]
- }
- ),
- x3.jsxs(
- "div",
- {
- className: `
- ${W.flex}
- ${$.mTSm}
- `,
- children: [
- x3.jsx(
- "div",
- {
- className: `
- ${W.iconWrap}
- ${W.width45}
- `,
- children: x3.jsx(sC, { overlay: x3.jsx($l, { onClick: u, iconId: C.iconId, iconType: C.iconType }), children: x3.jsxs("div", { className: W.dropdownIcon, children: [
- S ? x3.jsx("img", { src: S, className: W.icon }) : x3.jsx(Zt, { className: W.icon }),
- x3.jsx(Dn, {})
- ] }) })
- }
- ),
- R3 ? x3.jsxs(
- "div",
- {
- className: `
- ${W.width45}
- ${$.label}
- `,
- style: { marginTop: 0 },
- children: [
- i.t("sheet.cf.iconSet.rule"),
- x3.jsxs("span", { className: W.stress, children: [
- "(",
- i.t("sheet.cf.iconSet.when"),
- i.t(`sheet.cf.symbol.${x0(s.operator)}`),
- a,
- R3 ? "" : ` ${i.t("sheet.cf.iconSet.and")} `,
- ")"
- ] })
- ]
- }
- ) : x3.jsx(
- r_,
- {
- className: `
- ${$.mL0}
- ${W.width45}
- ${$.mR0}
- `,
- options: o,
- value: C.operator,
- onChange: (b) => {
- d(b, _);
- }
- }
- )
- ]
- }
- ),
- R3 ? x3.jsx("div", {}) : x3.jsxs(x3.Fragment, { children: [
- x3.jsxs(
- "div",
- {
- className: `
- ${$.mTSm}
- ${$.label}
- ${W.flex}
- `,
- children: [
- x3.jsx(
- "div",
- {
- className: `
- ${W.width45}
- `,
- children: i.t("sheet.cf.iconSet.type")
- }
- ),
- x3.jsx(
- "div",
- {
- className: `
- ${W.width45}
- `,
- children: i.t("sheet.cf.iconSet.value")
- }
- )
- ]
- }
- ),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.mTSm}
- ${W.flex}
- `,
- children: [
- x3.jsx(
- r_,
- {
- style: { flexShrink: 0 },
- className: `
- ${W.width45}
- ${$.mL0}
- `,
- options: c,
- value: C.value.type,
- onChange: (b) => {
- y3(b, _);
- }
- }
- ),
- x3.jsx(
- "div",
- {
- className: `
- ${$.mL0}
- ${W.width45}
- `,
- children: x3.jsx(
- jl,
- {
- id: _,
- type: C.value.type,
- error: w2,
- value: C.value.value || "",
- onChange: (b) => v(b, _)
- }
- )
- }
- )
- ]
- }
- )
- ] })
- ]
- },
- _
- );
- }), [r, n]);
- };
- var Fl = (t) => {
- var b;
- const { interceptorManager: e } = t, r = ((b = t.rule) == null ? void 0 : b.type) === y.iconSet ? t.rule : void 0, n = W0(Vr), [i, o] = (0, import_react.useState)({}), [c, v] = (0, import_react.useState)(() => {
- const l = Object.keys(o2)[0];
- if (r && r.config.length) {
- const g = r.config[0].iconType;
- if (!r.config.some((m) => m.iconType !== g))
- return g;
- }
- return l;
- }), [d, y3] = (0, import_react.useState)(() => {
- if (r && r.config.length)
- return re.deepClone(r == null ? void 0 : r.config);
- const l = o2[c] || [];
- return new Array(l.length).fill("").map((g, f, m) => f === m.length - 1 ? {
- operator: w.lessThanOrEqual,
- value: { type: x.num, value: Number.MAX_SAFE_INTEGER },
- iconType: c,
- iconId: String(f)
- } : oi(c, f, m));
- }), [p, C] = (0, import_react.useState)(() => r ? !!r.isShowValue : true), _ = (0, import_react.useMemo)(() => {
- const l = d.map((g) => oo(g.iconType, g.iconId));
- return x3.jsx("div", { className: W.iconWrap, children: l.map((g, f) => g ? x3.jsx(
- "img",
- {
- className: W.icon,
- src: g
- },
- f
- ) : x3.jsx(Zt, { className: W.icon }, f)) });
- }, [d]), w2 = (l) => {
- if (l.reduce((f, m, P) => f.preType && !f.result || l.length - 1 === P ? f : m.value.type === x.formula ? {
- preType: x.formula,
- result: false
- } : f.preType ? {
- result: f.preType === m.value.type,
- preType: m.value.type
- } : {
- result: true,
- preType: m.value.type
- }, { result: true, preType: "" }).result && [x.num, x.percent, x.percentile].includes(l[0].value.type)) {
- const f = {};
- return l.forEach((m, P, M2) => {
- if (P - 1 < 0 || P === M2.length - 1)
- return;
- const N3 = l[P - 1], I = x0(N3.operator);
- Y({ operator: I, value: N3.value.value }, m.value.value) || (f[P] = `${n.t(`sheet.cf.form.${I}`, String(N3.value.value))} `);
- }), f;
- }
- return {};
- }, S = (l, g) => {
- b0(d, l) !== g && (N0(d, l, g), y3([...d]), o(w2(d)));
- }, R3 = (l) => {
- v(l);
- const g = o2[l] || [], f = new Array(g.length).fill("").map((m, P, M2) => oi(l, P, M2));
- y3(f), o(w2(f));
- };
- (0, import_react.useEffect)(() => {
- const l = e.intercept(e.getInterceptPoints().submit, {
- handler() {
- return { type: y.iconSet, isShowValue: p, config: d };
- }
- });
- return () => {
- l();
- };
- }, [p, d, e]), (0, import_react.useEffect)(() => {
- const l = e.intercept(e.getInterceptPoints().beforeSubmit, {
- handler() {
- return Object.keys(i).length === 0;
- }
- });
- return () => {
- l();
- };
- }, [p, d, e, i]);
- const h = () => {
- const l = d.map((g) => ({ ...g }));
- d.forEach((g, f) => {
- const m = d.length - 1 - f, P = l[m];
- g.iconId = P.iconId, g.iconType = P.iconType;
- }), y3([...d]);
- }, s = W0(_1), [a, u] = (0, import_react.useState)();
- return n0(a, s.rootContainerElement), x3.jsxs("div", { className: W.iconSet, children: [
- x3.jsx("div", { className: $.title, children: n.t("sheet.cf.panel.styleRule") }),
- x3.jsx(
- "div",
- {
- className: `
- ${$.mTSm}
- `,
- children: x3.jsx(
- sC,
- {
- placement: "bottomLeft",
- overlay: x3.jsx(
- Ll,
- {
- ref: (l) => !a && l && u(l),
- iconType: c,
- onClick: R3
- }
- ),
- children: x3.jsxs("div", { className: W.dropdownIcon, style: { width: "unset" }, children: [
- _,
- x3.jsx(Dn, {})
- ] })
- }
- )
- }
- ),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.mTSm}
- ${W.renderConfig}
- `,
- children: [
- x3.jsxs("div", { className: W.utilItem, children: [
- x3.jsx(um, { onChange: h }),
- n.t("sheet.cf.iconSet.reverseIconOrder")
- ] }),
- x3.jsxs(
- "div",
- {
- className: `
- ${W.utilItem}
- ${$.mLXl}
- `,
- children: [
- x3.jsx(um, { checked: !p, onChange: (l) => {
- C(!l);
- } }),
- n.t("sheet.cf.iconSet.onlyShowIcon")
- ]
- }
- )
- ]
- }
- ),
- x3.jsx(zl, { errorMap: i, onChange: S, configList: d })
- ] });
- };
- var Vl = (t) => {
- var h;
- const { onChange: e, interceptorManager: r } = t, n = W0(Vr), i = ((h = t.rule) == null ? void 0 : h.type) === y.highlightCell ? t.rule : void 0, o = [
- { label: n.t("sheet.cf.panel.isNotBottom"), value: "isNotBottom" },
- { label: n.t("sheet.cf.panel.isBottom"), value: "isBottom" },
- { label: n.t("sheet.cf.panel.greaterThanAverage"), value: "greaterThanAverage" },
- { label: n.t("sheet.cf.panel.lessThanAverage"), value: "lessThanAverage" }
- ], [c, v] = (0, import_react.useState)(() => {
- const s = o[0].value, a = i == null ? void 0 : i.type;
- if (!i)
- return s;
- switch (a) {
- case y.highlightCell:
- switch (i.subType) {
- case E.average:
- return [w.greaterThan, w.greaterThanOrEqual].includes(i.operator) ? "greaterThanAverage" : [w.lessThan, w.lessThanOrEqual].includes(i.operator) ? "lessThanAverage" : s;
- case E.rank:
- return i.isBottom ? "isBottom" : "isNotBottom";
- }
- }
- return s;
- }), [d, y3] = (0, import_react.useState)(() => {
- const a = i == null ? void 0 : i.type;
- if (!i)
- return 10;
- switch (a) {
- case y.highlightCell:
- switch (i.subType) {
- case E.rank:
- return i.value || 10;
- }
- }
- return 10;
- }), [p, C] = (0, import_react.useState)(() => {
- const a = i == null ? void 0 : i.type;
- if (!i)
- return false;
- switch (a) {
- case y.highlightCell:
- switch (i.subType) {
- case E.rank:
- return i.isPercent || false;
- }
- }
- return false;
- }), [_, w2] = (0, import_react.useState)({}), S = (s) => {
- const { type: a, isPercent: u, value: b, style: l } = s;
- if (a === "isNotBottom")
- return { type: y.highlightCell, subType: E.rank, isPercent: u, isBottom: false, value: b, style: l };
- if (a === "isBottom")
- return { type: y.highlightCell, subType: E.rank, isPercent: u, isBottom: true, value: b, style: l };
- if (a === "greaterThanAverage")
- return { type: y.highlightCell, subType: E.average, operator: w.greaterThan, style: l };
- if (a === "lessThanAverage")
- return { type: y.highlightCell, subType: E.average, operator: w.lessThan, style: l };
- };
- (0, import_react.useEffect)(() => r.intercept(r.getInterceptPoints().submit, {
- handler() {
- return S({ type: c, isPercent: p, value: d, style: _ });
- }
- }), [c, p, d, _, r]);
- const R3 = (s) => {
- e(S(s));
- };
- return x3.jsxs("div", { children: [
- x3.jsx(
- "div",
- {
- className: `
- ${$.title}
- ${$.mTBase}
- `,
- children: n.t("sheet.cf.panel.styleRule")
- }
- ),
- x3.jsx(
- r_,
- {
- className: `
- ${W.width100}
- ${$.mTSm}
- `,
- value: c,
- options: o,
- onChange: (s) => {
- v(s), R3({ type: s, isPercent: p, value: d, style: _ });
- }
- }
- ),
- ["isNotBottom", "isBottom"].includes(c) && x3.jsxs(
- "div",
- {
- className: `
- ${$.labelContainer}
- ${$.mTSm}
- `,
- children: [
- x3.jsx(
- BO,
- {
- min: 1,
- max: 1e3,
- value: d,
- onChange: (s) => {
- const a = s || 0;
- y3(a), R3({ type: c, isPercent: p, value: a, style: _ });
- }
- }
- ),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.mLSm}
- ${$.labelContainer}
- ${W.text}
- `,
- children: [
- x3.jsx(
- um,
- {
- checked: p,
- onChange: (s) => {
- C(!!s), R3({ type: c, isPercent: !!s, value: d, style: _ });
- }
- }
- ),
- n.t("sheet.cf.valueType.percent")
- ]
- }
- )
- ]
- }
- ),
- x3.jsx(
- "div",
- {
- className: `
- ${W.cfPreviewWrap}
- `,
- children: x3.jsx(Ct, { rule: S({ type: c, isPercent: p, value: d, style: _ }) })
- }
- ),
- x3.jsx(
- gr2,
- {
- style: i == null ? void 0 : i.style,
- className: `
- ${$.mTSm}
- `,
- onChange: (s) => {
- w2(s), R3({ type: c, isPercent: p, value: d, style: s });
- }
- }
- )
- ] });
- };
- var ql = nR("beforeSubmit");
- var Al = nR("submit");
- var si = (t) => t.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId();
- var ai = (t) => {
- var e;
- return (e = t.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : e.getSheetId();
- };
- var Wl = (t) => {
- var M2, j2, N3;
- const e = W0(Vr), r = W0(Pt), n = W0(_n), i = W0(B), o = W0(F), c = si(n), v = ai(n), [d, y3] = (0, import_react.useState)(true), p = (0, import_react.useRef)({}), [C, _] = (0, import_react.useState)(void 0), w2 = (0, import_react.useRef)((j2 = (M2 = t.rule) == null ? void 0 : M2.ranges) != null ? j2 : []), S = (0, import_react.useMemo)(() => {
- var O, z, U;
- let I = (O = t.rule) == null ? void 0 : O.ranges;
- return I != null && I.length || (I = (U = (z = o.getCurrentSelections()) == null ? void 0 : z.map((k) => k.range)) != null ? U : []), w2.current = I, I != null && I.length ? I.map((k) => {
- const ie = fr(k);
- return ie === "NaN" ? "" : ie;
- }).filter((k) => !!k).join(",") : "";
- }, [t.rule]), R3 = [
- { label: e.t("sheet.cf.ruleType.highlightCell"), value: "1" },
- { label: e.t("sheet.cf.panel.rankAndAverage"), value: "2" },
- { label: e.t("sheet.cf.ruleType.dataBar"), value: "3" },
- { label: e.t("sheet.cf.ruleType.colorScale"), value: "4" },
- { label: e.t("sheet.cf.ruleType.formula"), value: "5" },
- { label: e.t("sheet.cf.ruleType.iconSet"), value: "6" }
- ], [h, s] = (0, import_react.useState)(() => {
- var z, U;
- const I = (z = t.rule) == null ? void 0 : z.rule.type, O = R3[0].value;
- if (!I)
- return O;
- switch (I) {
- case y.highlightCell: {
- switch ((U = t.rule) == null ? void 0 : U.rule.subType) {
- case E.number:
- case E.text:
- case E.duplicateValues:
- case E.uniqueValues:
- case E.timePeriod:
- return "1";
- case E.average:
- case E.rank:
- return "2";
- case E.formula:
- return "5";
- }
- break;
- }
- case y.dataBar:
- return "3";
- case y.colorScale:
- return "4";
- case y.iconSet:
- return "6";
- }
- return O;
- }), a = (0, import_react.useRef)(), u = (0, import_react.useMemo)(() => new rR({ beforeSubmit: ql, submit: Al }), []), b = (0, import_react.useMemo)(() => {
- switch (h) {
- case "1":
- return ii;
- case "2":
- return Vl;
- case "3":
- return Tl;
- case "4":
- return El;
- case "5":
- return Ml;
- case "6":
- return Fl;
- default:
- return ii;
- }
- }, [h]);
- (0, import_react.useEffect)(() => {
- const I = r.onCommandExecuted((O) => {
- if (O.id === Ut.id) {
- const z = O.params;
- z.subUnitId === v && z.unitId === c && t.onCancel();
- }
- O.id === an.id && t.onCancel();
- });
- return () => I.dispose();
- }, []);
- const l = (I) => {
- a.current = I;
- }, g = (I) => {
- const O = I.split(",").filter((z) => !!z).map(fn).map((z) => z.range);
- w2.current = O;
- }, f = () => {
- if (C)
- return;
- const O = (() => {
- const U = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet();
- if (!U)
- throw new Error("No active sheet found");
- return w2.current.map((ee) => Kd(ee, U.getRowCount(), U.getColumnCount())).filter((ee) => !(Number.isNaN(ee.startRow) || Number.isNaN(ee.startColumn)));
- })();
- if (u.fetchThroughInterceptors(u.getInterceptPoints().beforeSubmit)(true, null)) {
- const U = u.fetchThroughInterceptors(u.getInterceptPoints().submit)(null, null);
- if (U) {
- const k = si(n), ie = ai(n);
- if (!k || !ie)
- throw new Error("No active sheet found");
- let ee = {};
- t.rule && t.rule.cfId ? (ee = { ...t.rule, ranges: O, rule: U }, r.executeCommand(cr.id, { unitId: k, subUnitId: ie, rule: ee }), t.onCancel()) : (ee = { cfId: i.createCfId(k, ie), ranges: O, rule: U, stopIfTrue: false }, r.executeCommand(Pn.id, { unitId: k, subUnitId: ie, rule: ee }), t.onCancel());
- }
- }
- }, m = () => {
- t.onCancel();
- }, P = (I, O) => {
- I ? O.length < 1 ? _(e.t("sheet.cf.errorMessage.rangeError")) : _(void 0) : _(e.t("sheet.cf.errorMessage.rangeError"));
- };
- return Kl((I) => {
- var z;
- const O = (z = p.current) == null ? void 0 : z.handleOutClick;
- O && O(I, () => y3(false));
- }), x3.jsxs("div", { className: W.cfRuleStyleEditor, children: [
- x3.jsx("div", { className: $.title, children: e.t("sheet.cf.panel.range") }),
- x3.jsx(
- "div",
- {
- className: `
- ${$.mTBase}
- `,
- children: x3.jsx(
- Ei,
- {
- unitId: c,
- errorText: C,
- subUnitId: v,
- initValue: S,
- onChange: g,
- onVerify: P,
- onFocus: () => y3(true),
- isFocus: d,
- actions: p.current
- }
- )
- }
- ),
- x3.jsx("div", { className: $.title, children: e.t("sheet.cf.panel.styleType") }),
- x3.jsx("div", { className: $.mTBase, children: x3.jsx(r_, { className: W.width100, value: h, options: R3, onChange: (I) => s(I) }) }),
- x3.jsx(b, { interceptorManager: u, rule: (N3 = t.rule) == null ? void 0 : N3.rule, onChange: l }),
- x3.jsxs(
- "div",
- {
- className: `
- ${$.mTBase}
- ${W.btnList}
- `,
- children: [
- x3.jsx(Po, { size: "small", onClick: m, children: e.t("sheet.cf.panel.cancel") }),
- x3.jsx(Po, { className: $.mLSm, size: "small", type: "primary", onClick: f, children: e.t("sheet.cf.panel.submit") })
- ]
- }
- )
- ] });
- };
- var Hl = (t) => {
- const [e, r] = (0, import_react.useState)(t.rule), [n, i] = (0, import_react.useState)(!!t.rule), o = () => {
- i(true);
- }, c = () => {
- i(false), r(void 0);
- }, v = (d) => {
- r(d), i(true);
- };
- return x3.jsx("div", { className: $.conditionalFormattingWrap, children: n ? x3.jsx(Wl, { onCancel: c, rule: e }) : x3.jsx(Za, { onClick: v, onCreate: o }) });
- };
- var Ul = Object.defineProperty;
- var kl = Object.getOwnPropertyDescriptor;
- var Bl = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? kl(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && Ul(e, r, i), i;
- };
- var Mt = (t, e) => (r, n) => e(r, n, t);
- var cn2 = "sheet.conditional.formatting.panel";
- var Ht = class extends nt {
- constructor(e, r, n, i, o) {
- super();
- Xe(this, "_sidebarDisposable", null);
- this._univerInstanceService = e, this._injector = r, this._componentManager = n, this._sidebarService = i, this._localeService = o, this._initPanel(), this.disposeWithMe(
- this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET).subscribe((c) => {
- var v;
- c || (v = this._sidebarDisposable) == null || v.dispose();
- })
- ), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((c) => {
- c.id === cn2 && (c.visible || setTimeout(() => {
- this._sidebarService.sidebarOptions$.next({ visible: false });
- }));
- }));
- }
- openPanel(e) {
- const r = {
- id: cn2,
- header: { title: this._localeService.t("sheet.cf.title") },
- children: {
- label: cn2,
- rule: e,
- key: qt(4)
- },
- onClose: () => this._sidebarDisposable = null
- };
- this._sidebarDisposable = this._sidebarService.open(r);
- }
- _initPanel() {
- this._componentManager.register(cn2, Hl);
- }
- };
- Ht = Bl([
- Mt(0, _n),
- Mt(1, ot(Ot)),
- Mt(2, ot(n1)),
- Mt(3, ot(rt)),
- Mt(4, ot(Vr))
- ], Ht);
- var Te2 = ((t) => (t[t.createRule = 1] = "createRule", t[t.viewRule = 2] = "viewRule", t[t.highlightCell = 3] = "highlightCell", t[t.rank = 4] = "rank", t[t.formula = 5] = "formula", t[t.colorScale = 6] = "colorScale", t[t.dataBar = 7] = "dataBar", t[t.icon = 8] = "icon", t[t.clearRangeRules = 9] = "clearRangeRules", t[t.clearWorkSheetRules = 10] = "clearWorkSheetRules", t))(Te2 || {});
- var jn = {
- id: "sheet.operation.open.conditional.formatting.panel",
- type: ar.OPERATION,
- handler: (t, e) => {
- var v;
- const r = t.get(Ht), n = t.get(F), i = t.get(Pt), o = ((v = n.getCurrentSelections()) == null ? void 0 : v.map((d) => d.range)) || [];
- switch (e.value) {
- case 3: {
- r.openPanel({ ...A1(), ranges: o });
- break;
- }
- case 4: {
- const d = {
- ...A1,
- ranges: o,
- rule: {
- type: y.highlightCell,
- subType: E.rank
- }
- };
- r.openPanel(d);
- break;
- }
- case 5: {
- const d = {
- ...A1,
- ranges: o,
- rule: {
- type: y.highlightCell,
- subType: E.formula,
- value: "="
- }
- };
- r.openPanel(d);
- break;
- }
- case 6: {
- const d = {
- ...A1,
- ranges: o,
- rule: {
- type: y.colorScale,
- config: []
- }
- };
- r.openPanel(d);
- break;
- }
- case 7: {
- const d = {
- ...A1,
- ranges: o,
- rule: {
- type: y.dataBar,
- isShowValue: true
- }
- };
- r.openPanel(d);
- break;
- }
- case 8: {
- const d = {
- ...A1,
- ranges: o,
- rule: {
- type: y.iconSet,
- config: [],
- isShowValue: true
- }
- };
- r.openPanel(d);
- break;
- }
- case 2: {
- r.openPanel();
- break;
- }
- case 1: {
- r.openPanel({ ...A1(), ranges: o });
- break;
- }
- case 9: {
- i.executeCommand(ar3.id, { ranges: o });
- break;
- }
- case 10: {
- i.executeCommand(On.id);
- break;
- }
- }
- return true;
- }
- };
- var Gl = Object.defineProperty;
- var Xl = Object.getOwnPropertyDescriptor;
- var Yl = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? Xl(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && Gl(e, r, i), i;
- };
- var Nt2 = (t, e) => (r, n) => e(r, n, t);
- var Ut2 = class extends nt {
- constructor(e, r, n, i, o) {
- super();
- Xe(this, "_copyInfo");
- this._sheetClipboardService = e, this._conditionalFormattingRuleModel = r, this._injector = n, this._conditionalFormattingViewModel = i, this._univerInstanceService = o, this._initClipboardHook();
- }
- _initClipboardHook() {
- this.disposeWithMe(
- this._sheetClipboardService.addClipboardHook({
- id: N2,
- onBeforeCopy: (e, r, n) => this._collectConditionalRule(e, r, n),
- onPasteCells: (e, r, n, i) => {
- const { copyType: o = gr.COPY, pasteType: c } = i, { range: v } = e || {}, { range: d } = r;
- return this._generateConditionalFormattingMutations(d, { copyType: o, pasteType: c, copyRange: v });
- }
- })
- );
- }
- _collectConditionalRule(e, r, n) {
- const i = new kt(), o = {};
- this._copyInfo = {
- matrix: i,
- info: {
- unitId: e,
- subUnitId: r,
- cfMap: o
- }
- };
- const c = this._injector.invoke((p) => Ys(n, p, e, r));
- if (!c)
- return;
- const { rows: v, cols: d } = c, y3 = /* @__PURE__ */ new Set();
- v.forEach((p, C) => {
- d.forEach((_, w2) => {
- const S = this._conditionalFormattingViewModel.getCellCfs(e, r, p, _);
- S && (S.forEach((R3) => y3.add(R3.cfId)), i.setValue(C, w2, S.map((R3) => R3.cfId)));
- });
- }), y3.forEach((p) => {
- const C = this._conditionalFormattingRuleModel.getRule(e, r, p);
- C && (o[p] = C.rule);
- });
- }
- // eslint-disable-next-line max-lines-per-function
- _generateConditionalFormattingMutations(e, r) {
- const n = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET), i = n.getActiveSheet(), o = n.getUnitId();
- if (!i)
- return { redos: [], undos: [] };
- const c = i.getSheetId();
- if (r.copyType === gr.CUT)
- return this._copyInfo = null, { redos: [], undos: [] };
- if (!this._copyInfo || !r.copyRange)
- return { redos: [], undos: [] };
- if (![
- rt2.SPECIAL_PASTE_FORMAT,
- rt2.DEFAULT_PASTE,
- rt2.SPECIAL_PASTE_BESIDES_BORDER
- ].includes(
- r.pasteType
- ))
- return { redos: [], undos: [] };
- const { ranges: [d, y3], mapFunc: p } = _s([r.copyRange, e]), C = sE(d, y3, true), _ = {};
- tr.foreach(y3, (l, g) => {
- const { row: f, col: m } = p(l, g), P = this._conditionalFormattingViewModel.getCellCfs(o, c, f, m);
- P && P.forEach((M2) => {
- if (!_[M2.cfId]) {
- const j2 = new kt();
- _[M2.cfId] = j2;
- const N3 = this._conditionalFormattingRuleModel.getRule(o, c, M2.cfId);
- N3 == null || N3.ranges.forEach((I) => {
- tr.foreach(I, (O, z) => {
- j2.setValue(O, z, 1);
- });
- });
- }
- _[M2.cfId].realDeleteValue(f, m);
- });
- });
- const { matrix: w2, info: S } = this._copyInfo, R3 = [];
- let h = this._conditionalFormattingRuleModel.createCfId(o, c);
- const s = {}, a = (l) => {
- if (s[l])
- return s[l];
- const g = S == null ? void 0 : S.cfMap[l], f = [...this._conditionalFormattingRuleModel.getSubunitRules(o, c) || [], ...R3].find((m) => re.diffValue(m.rule, g));
- if (f)
- return s[l] = f, f;
- {
- const m = {
- rule: g,
- cfId: h,
- ranges: [],
- stopIfTrue: false
- };
- return s[l] = m, R3.push(m), h = `${Number(h) + 1}`, m;
- }
- };
- C.forEach((l) => {
- w2 && w2.forValue((g, f, m) => {
- const P = en.getPositionRange(
- {
- startRow: g,
- endRow: g,
- startColumn: f,
- endColumn: f
- },
- l.startRange
- ), { row: M2, col: j2 } = p(P.startRow, P.startColumn);
- m.forEach((N3) => {
- if (!_[N3]) {
- const I = a(N3), O = new kt();
- _[N3] = O, I.ranges.forEach((z) => {
- tr.foreach(z, (U, k) => {
- O.setValue(U, k, 1);
- });
- });
- }
- _[N3].setValue(M2, j2, 1);
- });
- });
- });
- const u = [], b = [];
- for (const l in _) {
- const g = _[l], f = jr(xl(g));
- if (!f.length) {
- const m = {
- unitId: o,
- subUnitId: c,
- cfId: l
- };
- u.push({ id: E2.id, params: m }), b.push(...z02(this._injector, m));
- }
- if (R3.some((m) => m.cfId === l)) {
- const m = a(l), P = {
- unitId: o,
- subUnitId: c,
- rule: { ...m, ranges: f }
- };
- u.push({ id: T2.id, params: P }), b.push(b1(this._injector, P));
- } else {
- const m = this._conditionalFormattingRuleModel.getRule(o, c, l);
- if (!m)
- continue;
- const P = {
- unitId: o,
- subUnitId: c,
- rule: { ...m, ranges: f }
- };
- u.push({ id: U2.id, params: P }), b.push(...L1(this._injector, P));
- }
- }
- return {
- redos: u,
- undos: b
- };
- }
- };
- Ut2 = Yl([
- Nt2(0, ot(Sn)),
- Nt2(1, ot(B)),
- Nt2(2, ot(Ot)),
- Nt2(3, ot(j)),
- Nt2(4, ot(_n))
- ], Ut2);
- var Kl2 = Object.defineProperty;
- var Zl = Object.getOwnPropertyDescriptor;
- var Jl = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? Zl(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && Kl2(e, r, i), i;
- };
- var Yn = (t, e) => (r, n) => e(r, n, t);
- var kt2 = class extends nt {
- constructor(t, e, r) {
- super(), this._localeService = t, this._commandService = e, this._sheetPermissionCheckController = r, this._commandExecutedListener();
- }
- _commandExecutedListener() {
- this.disposeWithMe(
- this._commandService.beforeCommandExecuted((t) => {
- t.id === Pn.id && (this._sheetPermissionCheckController.permissionCheckWithRanges({
- workbookTypes: [Me],
- rangeTypes: [Pe],
- worksheetTypes: [Te, ar2]
- }, t.params.rule.ranges) || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")));
- })
- );
- }
- };
- kt2 = Jl([
- Yn(0, ot(Vr)),
- Yn(1, Pt),
- Yn(2, ot(Nn))
- ], kt2);
- var Ql = Object.defineProperty;
- var ec = Object.getOwnPropertyDescriptor;
- var tc = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? ec(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && Ql(e, r, i), i;
- };
- var un = (t, e) => (r, n) => e(r, n, t);
- var Bt = class extends nt {
- constructor(t, e, r, n) {
- super(), this._conditionalFormattingRuleModel = t, this._univerInstanceService = e, this._injector = r, this._refRangeService = n, this._initRefRange();
- }
- _initRefRange() {
- const t = /* @__PURE__ */ new Map(), e = (n, i, o) => `${n}_${i}_${o}`, r = (n, i, o) => {
- const c = (d) => {
- const y3 = [...o.ranges], p = y3.map((_) => os(_, d)).filter((_) => !!_);
- if (aR(p, y3))
- return { redos: [], undos: [] };
- if (p.length) {
- const _ = { unitId: n, subUnitId: i, rule: { ...o, ranges: p } }, w2 = [{ id: U2.id, params: _ }], S = L1(this._injector, _);
- return { redos: w2, undos: S };
- } else {
- const _ = { unitId: n, subUnitId: i, cfId: o.cfId }, w2 = [{ id: E2.id, params: _ }], S = z02(this._injector, _);
- return { redos: w2, undos: S };
- }
- }, v = [];
- o.ranges.forEach((d) => {
- const y3 = this._refRangeService.registerRefRange(d, c);
- v.push(() => y3.dispose());
- }), t.set(e(n, i, o.cfId), () => v.forEach((d) => d()));
- };
- this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((n) => {
- const { unitId: i, subUnitId: o, rule: c } = n, v = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET), d = v.getActiveSheet();
- if (!(n.unitId !== v.getUnitId() || n.subUnitId !== (d == null ? void 0 : d.getSheetId())))
- switch (n.type) {
- case "add": {
- r(n.unitId, n.subUnitId, n.rule);
- break;
- }
- case "delete": {
- const y3 = t.get(e(i, o, c.cfId));
- y3 && y3();
- break;
- }
- case "set": {
- const y3 = t.get(e(i, o, c.cfId));
- y3 && y3(), r(n.unitId, n.subUnitId, n.rule);
- }
- }
- })), this.disposeWithMe(Ze(() => {
- t.forEach((n) => {
- n();
- }), t.clear();
- }));
- }
- };
- Bt = tc([
- un(0, ot(B)),
- un(1, ot(_n)),
- un(2, ot(Ot)),
- un(3, ot(_t))
- ], Bt);
- var nc = Object.defineProperty;
- var rc = Object.getOwnPropertyDescriptor;
- var ic = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? rc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && nc(e, r, i), i;
- };
- var ht = (t, e) => (r, n) => e(r, n, t);
- var Gt = class extends nt {
- constructor(e, r, n, i, o, c) {
- super();
- Xe(this, "_ruleChangeCacheMap", /* @__PURE__ */ new Map());
- this._sheetInterceptorService = e, this._conditionalFormattingService = r, this._univerInstanceService = n, this._renderManagerService = i, this._conditionalFormattingViewModel = o, this._conditionalFormattingRuleModel = c, this._initViewModelInterceptor(), this._initSkeleton(), this.disposeWithMe(() => {
- this._ruleChangeCacheMap.clear();
- });
- }
- _markDirtySkeleton() {
- var r, n, i;
- const e = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId();
- (r = this._renderManagerService.getRenderById(e)) == null || r.with(me).reCalculate(), (i = (n = this._renderManagerService.getRenderById(e)) == null ? void 0 : n.mainComponent) == null || i.makeDirty();
- }
- _initSkeleton() {
- this.disposeWithMe(merge(this._conditionalFormattingRuleModel.$ruleChange, this._conditionalFormattingViewModel.markDirty$).pipe(
- bufferTime(16),
- filter((e) => !!e.length),
- filter((e) => {
- const r = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET);
- if (!r)
- return false;
- const n = r.getActiveSheet();
- return n ? e.filter((i) => i.unitId === r.getUnitId() && i.subUnitId === n.getSheetId()).length > 0 : false;
- })
- ).subscribe(() => this._markDirtySkeleton()));
- }
- _initViewModelInterceptor() {
- this.disposeWithMe(this._sheetInterceptorService.intercept(et.CELL_CONTENT, {
- effect: Vn.Style,
- handler: (e, r, n) => {
- const i = this._conditionalFormattingService.composeStyle(r.unitId, r.subUnitId, r.row, r.col);
- if (!i)
- return n(e);
- const o = r.workbook.getStyles(), v = { ...(typeof (e == null ? void 0 : e.s) == "string" ? o.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {} }, d = { ...e, s: v };
- return i.style && Object.assign(v, i.style), d.fontRenderExtension || (d.fontRenderExtension = {}, i.isShowValue !== void 0 && (d.fontRenderExtension.isSkip = !i.isShowValue)), i.dataBar && (d.dataBar = i.dataBar), i.iconSet && (d.iconSet = i.iconSet, d.fontRenderExtension.leftOffset = h1 + u1), n(d);
- },
- priority: 10
- }));
- }
- };
- Gt = ic([
- ht(0, ot(V)),
- ht(1, ot(K)),
- ht(2, ot(_n)),
- ht(3, ot(Yx)),
- ht(4, ot(j)),
- ht(5, ot(B))
- ], Gt);
- var so = "sheets-conditional-formatting-ui.config";
- var bn = {};
- var ao = Object.defineProperty;
- var oc = Object.getOwnPropertyDescriptor;
- var sc = (t, e, r) => e in t ? ao(t, e, { enumerable: true, configurable: true, writable: true, value: r }) : t[e] = r;
- var ac = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? oc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && ao(e, r, i), i;
- };
- var Kn = (t, e) => (r, n) => e(r, n, t);
- var lo = (t, e, r) => sc(t, typeof e != "symbol" ? e + "" : e, r);
- var Sn2 = class extends Ra {
- constructor(t = bn, e, r, n) {
- super(), this._config = t, this._injector = e, this._commandService = r, this._configService = n;
- const { menu: i, ...o } = nu(
- {},
- bn,
- this._config
- );
- i && this._configService.setConfig("menu", i, { merge: true }), this._configService.setConfig(so, o), this._initCommand(), this._injector.add([Gt]), this._injector.add([Bt]), this._injector.add([Ut2]), this._injector.add([kt2]), this._injector.add([mt]);
- }
- _initCommand() {
- [
- Mi,
- Ni,
- ji,
- Li,
- $i,
- zi,
- Fi,
- Vi,
- qi,
- jn,
- mn,
- cr,
- lr,
- Pn,
- ar3,
- On
- ].forEach((t) => {
- this._commandService.registerCommand(t);
- });
- }
- };
- lo(Sn2, "pluginName", `${N2}_MOBILE_UI_PLUGIN`);
- lo(Sn2, "type", Fe.UNIVER_SHEET);
- Sn2 = ac([
- OR(R2),
- Kn(1, ot(Ot)),
- Kn(2, ot(Pt)),
- Kn(3, SE)
- ], Sn2);
- var lc = Object.defineProperty;
- var cc = Object.getOwnPropertyDescriptor;
- var uc = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? cc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && lc(e, r, i), i;
- };
- var jt = (t, e) => (r, n) => e(r, n, t);
- var Cn = class extends nt {
- constructor(t, e, r, n, i) {
- super(), this._injector = t, this._univerInstanceService = e, this._autoFillService = r, this._conditionalFormattingRuleModel = n, this._conditionalFormattingViewModel = i, this._initAutoFill();
- }
- // eslint-disable-next-line max-lines-per-function
- _initAutoFill() {
- const t = () => ({ redos: [], undos: [] }), e = (i, o, c, v, d) => {
- var w2;
- const y3 = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), p = (w2 = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : w2.getSheetId();
- if (!y3 || !p)
- return;
- const C = {
- startRow: i.row,
- startColumn: i.col,
- endColumn: i.col,
- endRow: i.row
- }, _ = {
- startRow: o.row,
- startColumn: o.col,
- endColumn: o.col,
- endRow: o.row
- };
- tr.foreach(c, (S, R3) => {
- const h = en.getPositionRange(
- {
- startRow: S,
- startColumn: R3,
- endColumn: R3,
- endRow: S
- },
- C
- ), s = en.getPositionRange(
- {
- startRow: S,
- startColumn: R3,
- endColumn: R3,
- endRow: S
- },
- _
- ), { row: a, col: u } = d(h.startRow, h.startColumn), b = this._conditionalFormattingViewModel.getCellCfs(
- y3,
- p,
- a,
- u
- ), { row: l, col: g } = d(s.startRow, s.startColumn), f = this._conditionalFormattingViewModel.getCellCfs(
- y3,
- p,
- l,
- g
- );
- f && f.forEach((m) => {
- let P = v.get(m.cfId);
- if (!v.get(m.cfId)) {
- const M2 = this._conditionalFormattingRuleModel.getRule(y3, p, m.cfId);
- if (!M2)
- return;
- P = new kt(), M2.ranges.forEach((j2) => {
- tr.foreach(j2, (N3, I) => {
- P.setValue(N3, I, 1);
- });
- }), v.set(m.cfId, P);
- }
- P.realDeleteValue(l, g);
- }), b && b.forEach((m) => {
- let P = v.get(m.cfId);
- if (!v.get(m.cfId)) {
- const M2 = this._conditionalFormattingRuleModel.getRule(y3, p, m.cfId);
- if (!M2)
- return;
- P = new kt(), M2.ranges.forEach((j2) => {
- tr.foreach(j2, (N3, I) => {
- P.setValue(N3, I, 1);
- });
- }), v.set(m.cfId, P);
- }
- P.setValue(l, g, 1);
- });
- });
- }, r = (i, o) => {
- var s, a, u;
- const c = (s = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : s.getUnitId(), v = (u = (a = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : a.getActiveSheet()) == null ? void 0 : u.getSheetId(), d = /* @__PURE__ */ new Map(), y3 = [], p = [];
- if (!c || !v)
- return t();
- const C = _s([i, o]), [_, w2] = C.ranges, { mapFunc: S } = C, R3 = {
- row: _.startRow,
- col: _.startColumn
- };
- return tE(_, w2).forEach((b) => {
- e(R3, b.repeatStartCell, b.relativeRange, d, S);
- }), d.forEach((b, l) => {
- const g = this._conditionalFormattingRuleModel.getRule(c, v, l);
- if (!g)
- return;
- const f = jr(xl(b));
- if (f.length) {
- const m = {
- unitId: c,
- subUnitId: v,
- rule: { ...g, ranges: f }
- };
- y3.push({ id: U2.id, params: m }), p.push(...L1(this._injector, m));
- } else {
- const m = {
- unitId: c,
- subUnitId: v,
- cfId: g.cfId
- };
- y3.push({ id: E2.id, params: m }), p.push(...z02(this._injector, m));
- }
- }), {
- undos: p,
- redos: y3
- };
- }, n = {
- id: N2,
- onFillData: (i, o, c) => {
- if (c === ke.COPY || c === ke.ONLY_FORMAT || c === ke.SERIES) {
- const { source: v, target: d } = i;
- return r(v, d);
- }
- return t();
- }
- };
- this.disposeWithMe(this._autoFillService.addHook(n));
- }
- };
- Cn = uc([
- jt(0, ot(Ot)),
- jt(1, ot(_n)),
- jt(2, ot(Hr)),
- jt(3, ot(B)),
- jt(4, ot(j))
- ], Cn);
- var dc = Object.defineProperty;
- var fc2 = Object.getOwnPropertyDescriptor;
- var hc = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? fc2(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && dc(e, r, i), i;
- };
- var Lt = (t, e) => (r, n) => e(r, n, t);
- var wn = class extends nt {
- constructor(t, e, r, n, i) {
- super(), this._injector = t, this._univerInstanceService = e, this._sheetInterceptorService = r, this._selectionManagerService = n, this._conditionalFormattingRuleModel = i, this._init();
- }
- _init() {
- this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
- getMutations: (t) => {
- var i;
- const e = [], r = [], n = { redos: e, undos: r };
- if ([So.id, po.id].includes(t.id)) {
- const o = (i = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : i.map((w2) => w2.range);
- if (!o)
- return n;
- const c = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET), v = c.getActiveSheet();
- if (!v)
- return n;
- const d = c.getUnitId(), y3 = v.getSheetId(), p = this._conditionalFormattingRuleModel.getSubunitRules(d, y3);
- if (!p || !p.length)
- return n;
- const { redos: C, undos: _ } = li(this._injector, p, o, d, y3);
- e.push(...C), r.push(..._);
- }
- return n;
- }
- })), this.disposeWithMe(this._sheetInterceptorService.interceptRanges({
- getMutations: ({ unitId: t, subUnitId: e, ranges: r }) => {
- const n = [], i = [], o = { redos: n, undos: i };
- if (!r || !r.length)
- return o;
- const c = this._conditionalFormattingRuleModel.getSubunitRules(t, e);
- if (!c || !c.length)
- return o;
- const { redos: v, undos: d } = li(this._injector, c, r, t, e);
- return n.push(...v), i.push(...d), o;
- }
- }));
- }
- };
- wn = hc([
- Lt(0, ot(Ot)),
- Lt(1, ot(_n)),
- Lt(2, ot(V)),
- Lt(3, ot(F)),
- Lt(4, ot(B))
- ], wn);
- function li(t, e, r, n, i) {
- const o = [], c = [];
- return e.filter((v) => r.some((d) => v.ranges.some((y3) => en.getIntersects(y3, d)))).forEach((v) => {
- const y3 = new ah().add(...v.ranges).subtract(...r).merge();
- if (y3.length) {
- const p = {
- id: U2.id,
- params: {
- unitId: n,
- subUnitId: i,
- rule: { ...v, ranges: y3 }
- }
- }, C = L1(t, p.params);
- o.push(p), c.push(...C);
- } else {
- const p = {
- id: E2.id,
- params: {
- unitId: n,
- subUnitId: i,
- cfId: v.cfId
- }
- }, C = z02(t, p.params);
- o.push(p), c.push(...C);
- }
- }), { redos: o, undos: c };
- }
- var pc = Object.defineProperty;
- var gc = Object.getOwnPropertyDescriptor;
- var mc = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? gc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && pc(e, r, i), i;
- };
- var ci = (t, e) => (r, n) => e(r, n, t);
- var Rn = class extends nt {
- constructor(t, e) {
- super(), this._sheetInterceptorService = t, this._conditionalFormattingService = e, this._initInterceptorEditorEnd();
- }
- /**
- * Process the values after edit
- * @private
- * @memberof NumfmtService
- */
- _initInterceptorEditorEnd() {
- this.disposeWithMe(
- Ze(
- this._sheetInterceptorService.writeCellInterceptor.intercept(
- qn,
- {
- handler: (t, e, r) => {
- var c, v, d;
- t || r(t);
- const n = this._conditionalFormattingService.composeStyle(e.unitId, e.subUnitId, e.row, e.col), i = (c = n == null ? void 0 : n.style) != null ? c : {}, o = Object.keys(i);
- if (t != null && t.p)
- return (d = (v = t.p.body) == null ? void 0 : v.textRuns) == null || d.forEach((y3) => {
- y3.ts && o.forEach((p) => {
- var C;
- (C = y3.ts) == null || delete C[p];
- });
- }), r(t);
- {
- const y3 = { ...(typeof (t == null ? void 0 : t.s) == "string" ? e.workbook.getStyles().get(t.s) : t == null ? void 0 : t.s) || {} };
- o.forEach((C) => {
- delete y3[C];
- });
- const p = { ...t, s: { ...y3 } };
- return r(p);
- }
- }
- }
- )
- )
- );
- }
- };
- Rn = mc([
- ci(0, ot(V)),
- ci(1, ot(K))
- ], Rn);
- var ui = [
- an.id,
- T2.id,
- U2.id,
- E2.id,
- v2.id
- ];
- var $t = [
- {
- label: "sheet.cf.ruleType.highlightCell",
- value: Te2.highlightCell
- },
- {
- label: "sheet.cf.panel.rankAndAverage",
- value: Te2.rank
- },
- {
- label: "sheet.cf.ruleType.formula",
- value: Te2.formula
- },
- {
- label: "sheet.cf.ruleType.colorScale",
- value: Te2.colorScale
- },
- {
- label: "sheet.cf.ruleType.dataBar",
- value: Te2.dataBar
- },
- {
- label: "sheet.cf.ruleType.iconSet",
- value: Te2.icon
- },
- {
- label: "sheet.cf.menu.manageConditionalFormatting",
- value: Te2.viewRule
- },
- {
- label: "sheet.cf.menu.createConditionalFormatting",
- value: Te2.createRule
- },
- {
- label: "sheet.cf.menu.clearRangeRules",
- value: Te2.clearRangeRules,
- disabled: false
- },
- {
- label: "sheet.cf.menu.clearWorkSheetRules",
- value: Te2.clearWorkSheetRules
- }
- ];
- var vc = (t) => {
- const e = t.get(F), r = t.get(Pt), n = t.get(_n), i = t.get(B), o = new Observable((d) => merge(
- e.selectionMoveEnd$,
- e.selectionSet$,
- new Observable((y3) => {
- const p = r.onCommandExecuted((C) => {
- var R3;
- const { id: _, params: w2 } = C, S = (R3 = n.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : R3.getUnitId();
- ui.includes(_) && w2.unitId === S && y3.next(null);
- });
- return () => p.dispose();
- })
- ).pipe(debounceTime(16)).subscribe(() => {
- var R3;
- const y3 = ((R3 = e.getCurrentSelections()) == null ? void 0 : R3.map((h) => h.range)) || [], p = n.getCurrentUnitForType(Fe.UNIVER_SHEET);
- if (!p)
- return;
- const C = p.getActiveSheet();
- if (!C)
- return;
- const S = (i.getSubunitRules(p.getUnitId(), C.getSheetId()) || []).filter((h) => h.ranges.some((s) => y3.some((a) => en.intersects(a, s)))).map((h) => h.ranges).every((h) => yh(t, p.getUnitId(), C.getSheetId(), h));
- d.next(S);
- })), c = new Observable(
- (d) => new Observable((y3) => {
- const p = r.onCommandExecuted((C) => {
- var R3;
- const { id: _, params: w2 } = C, S = (R3 = n.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : R3.getUnitId();
- ui.includes(_) && w2.unitId === S && y3.next(null);
- });
- return () => p.dispose();
- }).pipe(debounceTime(16)).subscribe(() => {
- const y3 = n.getCurrentUnitForType(Fe.UNIVER_SHEET);
- if (!y3)
- return;
- const p = y3.getActiveSheet();
- if (!p)
- return;
- const C = i.getSubunitRules(y3.getUnitId(), p.getSheetId()) || [];
- if (!C.length)
- return d.next(false), false;
- const _ = C.map((w2) => w2.ranges).every((w2) => yh(t, y3.getUnitId(), p.getSheetId(), w2));
- d.next(_);
- })
- ), v = new Observable((d) => {
- o.subscribe((y3) => {
- const p = $t.find((C) => C.value === Te2.clearRangeRules);
- p && (p.disabled = !y3, d.next($t));
- }), c.subscribe((y3) => {
- const p = $t.find((C) => C.value === Te2.clearWorkSheetRules);
- p && (p.disabled = !y3, d.next($t));
- }), d.next($t);
- });
- return {
- id: jn.id,
- type: $e.SELECTOR,
- icon: "Conditions",
- tooltip: "sheet.cf.title",
- selections: v,
- hidden$: Fa(t, Fe.UNIVER_SHEET),
- disabled$: ue(t, { workbookTypes: [Me], worksheetTypes: [ar2, Te], rangeTypes: [Pe] })
- };
- };
- var yc = {
- [l1.FORMULAS_INSERT]: {
- [jn.id]: {
- order: 0,
- menuItemFactory: vc
- }
- }
- };
- var bc = Object.defineProperty;
- var Sc = Object.getOwnPropertyDescriptor;
- var Cc = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? Sc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && bc(e, r, i), i;
- };
- var di = (t, e) => (r, n) => e(r, n, t);
- var _n2 = class extends nt {
- constructor(e, r) {
- super();
- Xe(this, "_sidebarDisposable", null);
- this._injector = e, this._menuManagerService = r, this._menuManagerService.mergeMenu(yc);
- }
- };
- _n2 = Cc([
- di(0, ot(Ot)),
- di(1, m1)
- ], _n2);
- var wc = Object.defineProperty;
- var Rc = Object.getOwnPropertyDescriptor;
- var _c = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? Rc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && wc(e, r, i), i;
- };
- var pt = (t, e) => (r, n) => e(r, n, t);
- var xc = (t, e) => {
- const r = (p) => p.endRow - p.startRow + 1, n = (p) => p.endColumn - p.startColumn + 1, i = r(e) % r(t), o = n(e) % n(t), c = Math.floor(r(e) / r(t)), v = Math.floor(n(e) / n(t)), d = [], y3 = {
- startRow: 0,
- endRow: r(t) - 1,
- startColumn: 0,
- endColumn: n(t) - 1
- };
- if (r(e) === 1 && n(e) === 1) {
- const p = {
- startRow: e.startRow,
- endRow: e.startRow,
- startColumn: e.startColumn,
- endColumn: e.startColumn
- };
- return d.push({ repeatRelativeRange: y3, startRange: p }), d;
- }
- for (let p = 0; p < c + (i ? 0.1 : 0); p++)
- for (let C = 0; C < v + (o ? 0.1 : 0); C++) {
- const _ = r(t) * p, w2 = n(t) * C, S = {
- startRow: _ + e.startRow,
- endRow: _ + e.startRow,
- startColumn: w2 + e.startColumn,
- endColumn: w2 + e.startColumn
- };
- let R3 = y3;
- p === c && i && (R3 = { ...R3 }, R3.endRow = R3.endRow - (r(t) - i)), C === v && o && (R3 = { ...R3 }, R3.endColumn = R3.endColumn - (n(t) - o)), d.push({ repeatRelativeRange: R3, startRange: S });
- }
- return d;
- };
- var xn = class extends nt {
- constructor(e, r, n, i, o, c) {
- super();
- Xe(this, "_painterConfig", null);
- this._injector = e, this._univerInstanceService = r, this._formatPainterService = n, this._sheetsSelectionsService = i, this._conditionalFormattingRuleModel = o, this._conditionalFormattingViewModel = c, this._initFormattingPainter();
- }
- // eslint-disable-next-line max-lines-per-function
- _initFormattingPainter() {
- const e = () => ({ redos: [], undos: [] }), r = (o, c, v, d, y3) => {
- const { unitId: p, subUnitId: C } = this._painterConfig, { targetUnitId: _, targetSubUnitId: w2 } = y3, S = {
- startRow: o.row,
- startColumn: o.col,
- endColumn: o.col,
- endRow: o.row
- }, R3 = {
- startRow: c.row,
- startColumn: c.col,
- endColumn: c.col,
- endRow: c.row
- };
- tr.foreach(v, (h, s) => {
- const a = en.getPositionRange(
- {
- startRow: h,
- startColumn: s,
- endColumn: s,
- endRow: h
- },
- S
- ), u = en.getPositionRange(
- {
- startRow: h,
- startColumn: s,
- endColumn: s,
- endRow: h
- },
- R3
- ), b = this._conditionalFormattingViewModel.getCellCfs(
- p,
- C,
- a.startRow,
- a.startColumn
- ), l = this._conditionalFormattingViewModel.getCellCfs(
- _,
- w2,
- u.startRow,
- u.startColumn
- );
- l && l.forEach((g) => {
- let f = d.get(g.cfId);
- if (!d.get(g.cfId)) {
- const m = this._conditionalFormattingRuleModel.getRule(_, w2, g.cfId);
- if (!m)
- return;
- f = new kt(), m.ranges.forEach((P) => {
- tr.foreach(P, (M2, j2) => {
- f.setValue(M2, j2, 1);
- });
- }), d.set(g.cfId, f);
- }
- f.realDeleteValue(u.startRow, u.startColumn);
- }), b && b.forEach((g) => {
- const f = d.get(g.cfId);
- f && f.setValue(u.startRow, u.startColumn, 1);
- });
- });
- }, n = (o, c, v) => {
- var a;
- const { range: d, unitId: y3, subUnitId: p } = this._painterConfig, C = o !== y3 || p !== c, _ = /* @__PURE__ */ new Map(), w2 = [], S = [];
- if (!o || !c || !y3 || !p)
- return e();
- const R3 = (a = this._conditionalFormattingRuleModel.getSubunitRules(y3, p)) != null ? a : [];
- R3 == null || R3.forEach((u) => {
- const { ranges: b, cfId: l } = u;
- if (b.some((g) => en.intersects(d, g))) {
- const g = new kt();
- C || b.forEach((f) => {
- tr.foreach(f, (m, P) => {
- g.setValue(m, P, 1);
- });
- }), _.set(l, g);
- }
- });
- const h = {
- row: d.startRow,
- col: d.startColumn
- };
- return xc(d, v).forEach((u) => {
- r(h, { row: u.startRange.startRow, col: u.startRange.startColumn }, u.repeatRelativeRange, _, { targetUnitId: o, targetSubUnitId: c });
- }), _.forEach((u, b) => {
- if (C) {
- const l = this._conditionalFormattingRuleModel.getRule(o, c, b), g = jr(xl(u));
- if (l)
- if (g.length) {
- const f = {
- unitId: o,
- subUnitId: c,
- rule: { ...l, ranges: g }
- };
- w2.push({ id: U2.id, params: f }), S.push(...L1(this._injector, f));
- } else {
- const f = {
- unitId: o,
- subUnitId: c,
- cfId: l.cfId
- };
- w2.push({ id: E2.id, params: f }), S.push(...z02(this._injector, f));
- }
- else if (g.length) {
- const f = this._conditionalFormattingRuleModel.getRule(y3, p, b);
- if (f) {
- const m = {
- unitId: o,
- subUnitId: c,
- rule: {
- ...re.deepClone(f),
- cfId: this._conditionalFormattingRuleModel.createCfId(o, c),
- ranges: g
- }
- };
- w2.push({ id: T2.id, params: m }), S.push(b1(this._injector, m));
- }
- }
- } else {
- const l = this._conditionalFormattingRuleModel.getRule(y3, p, b);
- if (!l)
- return;
- const g = jr(xl(u));
- if (g.length) {
- const f = {
- unitId: y3,
- subUnitId: p,
- rule: { ...l, ranges: g }
- };
- w2.push({ id: U2.id, params: f }), S.push(...L1(this._injector, f));
- } else {
- const f = {
- unitId: y3,
- subUnitId: p,
- cfId: l.cfId
- };
- w2.push({ id: E2.id, params: f }), S.push(...z02(this._injector, f));
- }
- }
- }), {
- undos: S,
- redos: w2
- };
- }, i = {
- id: N2,
- onStatusChange: (o) => {
- var c, v, d;
- switch (o) {
- case zt.INFINITE:
- case zt.ONCE: {
- const y3 = (c = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : c.getUnitId(), p = (d = (v = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : v.getActiveSheet()) == null ? void 0 : d.getSheetId(), C = this._sheetsSelectionsService.getCurrentLastSelection(), _ = C == null ? void 0 : C.range;
- y3 && p && _ && (this._painterConfig = { unitId: y3, subUnitId: p, range: _ });
- break;
- }
- case zt.OFF: {
- this._painterConfig = null;
- break;
- }
- }
- },
- onApply: (o, c, v) => this._painterConfig ? n(o, c, v) : {
- redos: [],
- undos: []
- }
- };
- this._formatPainterService.addHook(i);
- }
- };
- xn = _c([
- pt(0, ot(Ot)),
- pt(1, ot(_n)),
- pt(2, ot(Un)),
- pt(3, ot(F)),
- pt(4, ot(B)),
- pt(5, ot(j))
- ], xn);
- var Ic = Object.defineProperty;
- var Ec = Object.getOwnPropertyDescriptor;
- var Tc = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? Ec(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && Ic(e, r, i), i;
- };
- var Zn = (t, e) => (r, n) => e(r, n, t);
- var In = class extends nt {
- constructor(t, e, r) {
- super(), this._conditionalFormattingViewModel = t, this._univerInstanceService = e, this._renderManagerService = r, this._init();
- }
- _init() {
- const t = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET), e = (r) => {
- const n = r.getUnitId(), i = this._renderManagerService.getRenderById(n);
- if (!i)
- return;
- const o = i.with(me);
- this.disposeWithMe(o.currentSkeleton$.subscribe((c) => {
- if (c) {
- const v = c.skeleton.rowColumnSegment, d = v.endColumn - v.startColumn + 1, p = (v.endRow - v.startRow + 1) * d * 9, C = Math.max(C2, p);
- this._conditionalFormattingViewModel.setCacheLength(C);
- }
- }));
- };
- t && e(t), this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET).subscribe((r) => {
- r && e(r);
- });
- }
- };
- In = Tc([
- Zn(0, ot(j)),
- Zn(1, _n),
- Zn(2, Yx)
- ], In);
- var co = Object.defineProperty;
- var Pc = Object.getOwnPropertyDescriptor;
- var Oc = (t, e, r) => e in t ? co(t, e, { enumerable: true, configurable: true, writable: true, value: r }) : t[e] = r;
- var Dc = (t, e, r, n) => {
- for (var i = n > 1 ? void 0 : n ? Pc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
- (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
- return n && i && co(e, r, i), i;
- };
- var Jn = (t, e) => (r, n) => e(r, n, t);
- var uo = (t, e, r) => Oc(t, typeof e != "symbol" ? e + "" : e, r);
- var En = class extends Ra {
- constructor(t = bn, e, r, n) {
- super(), this._config = t, this._injector = e, this._commandService = r, this._configService = n;
- const { menu: i, ...o } = nu(
- {},
- bn,
- this._config
- );
- i && this._configService.setConfig("menu", i, { merge: true }), this._configService.setConfig(so, o), this._initCommand();
- }
- onStarting() {
- K0(this._injector, [
- [Gt],
- [Bt],
- [Ut2],
- [Cn],
- [kt2],
- [Ht],
- [_n2],
- [mt],
- [Rn],
- [wn],
- [xn],
- [In]
- ]), Mf(this._injector, [
- [Gt]
- ]);
- }
- onReady() {
- Mf(this._injector, [
- [_n2],
- [Ht]
- ]);
- }
- onRendered() {
- Mf(this._injector, [
- [Cn],
- [wn],
- [Ut2],
- [Rn],
- [mt],
- [xn],
- [kt2],
- [Bt],
- [In]
- ]);
- }
- _initCommand() {
- [
- Mi,
- Ni,
- ji,
- Li,
- $i,
- zi,
- Fi,
- Vi,
- qi,
- jn,
- mn,
- cr,
- lr,
- Pn,
- ar3,
- On
- ].forEach((t) => {
- this._commandService.registerCommand(t);
- });
- }
- };
- uo(En, "pluginName", `${N2}_UI_PLUGIN`);
- uo(En, "type", Fe.UNIVER_SHEET);
- En = Dc([
- OR(R2),
- Jn(1, ot(Ot)),
- Jn(2, ot(Pt)),
- Jn(3, SE)
- ], En);
- export {
- Mi as AddAverageCfCommand,
- Pn as AddCfCommand,
- Ni as AddColorScaleConditionalRuleCommand,
- ji as AddDataBarConditionalRuleCommand,
- Li as AddDuplicateValuesCfCommand,
- $i as AddNumberCfCommand,
- zi as AddRankCfCommand,
- Fi as AddTextCfCommand,
- Vi as AddTimePeriodCfCommand,
- qi as AddUniqueValuesCfCommand,
- ar3 as ClearRangeCfCommand,
- On as ClearWorksheetCfCommand,
- wn as ConditionalFormattingClearController,
- mn as DeleteCfCommand,
- lr as MoveCfCommand,
- jn as OpenConditionalFormattingOperator,
- cr as SetCfCommand,
- Sn2 as UniverSheetsConditionalFormattingMobileUIPlugin,
- En as UniverSheetsConditionalFormattingUIPlugin
- };
- /*! Bundled license information:
- @univerjs/sheets-conditional-formatting-ui/lib/es/index.js:
- (**
- * @license React
- * react-jsx-runtime.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *)
- */
- //# sourceMappingURL=@univerjs_sheets-conditional-formatting-ui.js.map
|