edit-post.js 334 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785
  1. /******/ (function() { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ 4403:
  4. /***/ (function(module, exports) {
  5. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  6. Copyright (c) 2018 Jed Watson.
  7. Licensed under the MIT License (MIT), see
  8. http://jedwatson.github.io/classnames
  9. */
  10. /* global define */
  11. (function () {
  12. 'use strict';
  13. var hasOwn = {}.hasOwnProperty;
  14. var nativeCodeString = '[native code]';
  15. function classNames() {
  16. var classes = [];
  17. for (var i = 0; i < arguments.length; i++) {
  18. var arg = arguments[i];
  19. if (!arg) continue;
  20. var argType = typeof arg;
  21. if (argType === 'string' || argType === 'number') {
  22. classes.push(arg);
  23. } else if (Array.isArray(arg)) {
  24. if (arg.length) {
  25. var inner = classNames.apply(null, arg);
  26. if (inner) {
  27. classes.push(inner);
  28. }
  29. }
  30. } else if (argType === 'object') {
  31. if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
  32. classes.push(arg.toString());
  33. continue;
  34. }
  35. for (var key in arg) {
  36. if (hasOwn.call(arg, key) && arg[key]) {
  37. classes.push(key);
  38. }
  39. }
  40. }
  41. }
  42. return classes.join(' ');
  43. }
  44. if ( true && module.exports) {
  45. classNames.default = classNames;
  46. module.exports = classNames;
  47. } else if (true) {
  48. // register as 'classnames', consistent with npm package name
  49. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  50. return classNames;
  51. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  52. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  53. } else {}
  54. }());
  55. /***/ })
  56. /******/ });
  57. /************************************************************************/
  58. /******/ // The module cache
  59. /******/ var __webpack_module_cache__ = {};
  60. /******/
  61. /******/ // The require function
  62. /******/ function __webpack_require__(moduleId) {
  63. /******/ // Check if module is in cache
  64. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  65. /******/ if (cachedModule !== undefined) {
  66. /******/ return cachedModule.exports;
  67. /******/ }
  68. /******/ // Create a new module (and put it into the cache)
  69. /******/ var module = __webpack_module_cache__[moduleId] = {
  70. /******/ // no module.id needed
  71. /******/ // no module.loaded needed
  72. /******/ exports: {}
  73. /******/ };
  74. /******/
  75. /******/ // Execute the module function
  76. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  77. /******/
  78. /******/ // Return the exports of the module
  79. /******/ return module.exports;
  80. /******/ }
  81. /******/
  82. /************************************************************************/
  83. /******/ /* webpack/runtime/compat get default export */
  84. /******/ !function() {
  85. /******/ // getDefaultExport function for compatibility with non-harmony modules
  86. /******/ __webpack_require__.n = function(module) {
  87. /******/ var getter = module && module.__esModule ?
  88. /******/ function() { return module['default']; } :
  89. /******/ function() { return module; };
  90. /******/ __webpack_require__.d(getter, { a: getter });
  91. /******/ return getter;
  92. /******/ };
  93. /******/ }();
  94. /******/
  95. /******/ /* webpack/runtime/define property getters */
  96. /******/ !function() {
  97. /******/ // define getter functions for harmony exports
  98. /******/ __webpack_require__.d = function(exports, definition) {
  99. /******/ for(var key in definition) {
  100. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  101. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  102. /******/ }
  103. /******/ }
  104. /******/ };
  105. /******/ }();
  106. /******/
  107. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  108. /******/ !function() {
  109. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  110. /******/ }();
  111. /******/
  112. /******/ /* webpack/runtime/make namespace object */
  113. /******/ !function() {
  114. /******/ // define __esModule on exports
  115. /******/ __webpack_require__.r = function(exports) {
  116. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  117. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  118. /******/ }
  119. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  120. /******/ };
  121. /******/ }();
  122. /******/
  123. /************************************************************************/
  124. var __webpack_exports__ = {};
  125. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  126. !function() {
  127. "use strict";
  128. // ESM COMPAT FLAG
  129. __webpack_require__.r(__webpack_exports__);
  130. // EXPORTS
  131. __webpack_require__.d(__webpack_exports__, {
  132. "PluginBlockSettingsMenuItem": function() { return /* reexport */ plugin_block_settings_menu_item; },
  133. "PluginDocumentSettingPanel": function() { return /* reexport */ plugin_document_setting_panel; },
  134. "PluginMoreMenuItem": function() { return /* reexport */ plugin_more_menu_item; },
  135. "PluginPostPublishPanel": function() { return /* reexport */ plugin_post_publish_panel; },
  136. "PluginPostStatusInfo": function() { return /* reexport */ plugin_post_status_info; },
  137. "PluginPrePublishPanel": function() { return /* reexport */ plugin_pre_publish_panel; },
  138. "PluginSidebar": function() { return /* reexport */ PluginSidebarEditPost; },
  139. "PluginSidebarMoreMenuItem": function() { return /* reexport */ PluginSidebarMoreMenuItem; },
  140. "__experimentalFullscreenModeClose": function() { return /* reexport */ fullscreen_mode_close; },
  141. "__experimentalMainDashboardButton": function() { return /* reexport */ main_dashboard_button; },
  142. "initializeEditor": function() { return /* binding */ initializeEditor; },
  143. "reinitializeEditor": function() { return /* binding */ reinitializeEditor; },
  144. "store": function() { return /* reexport */ store_store; }
  145. });
  146. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js
  147. var actions_namespaceObject = {};
  148. __webpack_require__.r(actions_namespaceObject);
  149. __webpack_require__.d(actions_namespaceObject, {
  150. "disableComplementaryArea": function() { return disableComplementaryArea; },
  151. "enableComplementaryArea": function() { return enableComplementaryArea; },
  152. "pinItem": function() { return pinItem; },
  153. "setDefaultComplementaryArea": function() { return setDefaultComplementaryArea; },
  154. "setFeatureDefaults": function() { return setFeatureDefaults; },
  155. "setFeatureValue": function() { return setFeatureValue; },
  156. "toggleFeature": function() { return toggleFeature; },
  157. "unpinItem": function() { return unpinItem; }
  158. });
  159. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  160. var selectors_namespaceObject = {};
  161. __webpack_require__.r(selectors_namespaceObject);
  162. __webpack_require__.d(selectors_namespaceObject, {
  163. "getActiveComplementaryArea": function() { return getActiveComplementaryArea; },
  164. "isFeatureActive": function() { return isFeatureActive; },
  165. "isItemPinned": function() { return isItemPinned; }
  166. });
  167. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/actions.js
  168. var store_actions_namespaceObject = {};
  169. __webpack_require__.r(store_actions_namespaceObject);
  170. __webpack_require__.d(store_actions_namespaceObject, {
  171. "__experimentalSetPreviewDeviceType": function() { return __experimentalSetPreviewDeviceType; },
  172. "__unstableCreateTemplate": function() { return __unstableCreateTemplate; },
  173. "__unstableSwitchToTemplateMode": function() { return __unstableSwitchToTemplateMode; },
  174. "closeGeneralSidebar": function() { return closeGeneralSidebar; },
  175. "closeModal": function() { return closeModal; },
  176. "closePublishSidebar": function() { return closePublishSidebar; },
  177. "hideBlockTypes": function() { return hideBlockTypes; },
  178. "initializeMetaBoxes": function() { return initializeMetaBoxes; },
  179. "metaBoxUpdatesFailure": function() { return metaBoxUpdatesFailure; },
  180. "metaBoxUpdatesSuccess": function() { return metaBoxUpdatesSuccess; },
  181. "openGeneralSidebar": function() { return openGeneralSidebar; },
  182. "openModal": function() { return openModal; },
  183. "openPublishSidebar": function() { return openPublishSidebar; },
  184. "removeEditorPanel": function() { return removeEditorPanel; },
  185. "requestMetaBoxUpdates": function() { return requestMetaBoxUpdates; },
  186. "setAvailableMetaBoxesPerLocation": function() { return setAvailableMetaBoxesPerLocation; },
  187. "setIsEditingTemplate": function() { return setIsEditingTemplate; },
  188. "setIsInserterOpened": function() { return setIsInserterOpened; },
  189. "setIsListViewOpened": function() { return setIsListViewOpened; },
  190. "showBlockTypes": function() { return showBlockTypes; },
  191. "switchEditorMode": function() { return switchEditorMode; },
  192. "toggleEditorPanelEnabled": function() { return toggleEditorPanelEnabled; },
  193. "toggleEditorPanelOpened": function() { return toggleEditorPanelOpened; },
  194. "toggleFeature": function() { return actions_toggleFeature; },
  195. "togglePinnedPluginItem": function() { return togglePinnedPluginItem; },
  196. "togglePublishSidebar": function() { return togglePublishSidebar; },
  197. "updatePreferredStyleVariations": function() { return updatePreferredStyleVariations; }
  198. });
  199. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js
  200. var store_selectors_namespaceObject = {};
  201. __webpack_require__.r(store_selectors_namespaceObject);
  202. __webpack_require__.d(store_selectors_namespaceObject, {
  203. "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; },
  204. "__experimentalGetPreviewDeviceType": function() { return __experimentalGetPreviewDeviceType; },
  205. "areMetaBoxesInitialized": function() { return areMetaBoxesInitialized; },
  206. "getActiveGeneralSidebarName": function() { return getActiveGeneralSidebarName; },
  207. "getActiveMetaBoxLocations": function() { return getActiveMetaBoxLocations; },
  208. "getAllMetaBoxes": function() { return getAllMetaBoxes; },
  209. "getEditedPostTemplate": function() { return getEditedPostTemplate; },
  210. "getEditorMode": function() { return getEditorMode; },
  211. "getHiddenBlockTypes": function() { return getHiddenBlockTypes; },
  212. "getMetaBoxesPerLocation": function() { return getMetaBoxesPerLocation; },
  213. "getPreference": function() { return getPreference; },
  214. "getPreferences": function() { return getPreferences; },
  215. "hasMetaBoxes": function() { return hasMetaBoxes; },
  216. "isEditingTemplate": function() { return selectors_isEditingTemplate; },
  217. "isEditorPanelEnabled": function() { return isEditorPanelEnabled; },
  218. "isEditorPanelOpened": function() { return isEditorPanelOpened; },
  219. "isEditorPanelRemoved": function() { return isEditorPanelRemoved; },
  220. "isEditorSidebarOpened": function() { return isEditorSidebarOpened; },
  221. "isFeatureActive": function() { return selectors_isFeatureActive; },
  222. "isInserterOpened": function() { return isInserterOpened; },
  223. "isListViewOpened": function() { return isListViewOpened; },
  224. "isMetaBoxLocationActive": function() { return isMetaBoxLocationActive; },
  225. "isMetaBoxLocationVisible": function() { return isMetaBoxLocationVisible; },
  226. "isModalActive": function() { return isModalActive; },
  227. "isPluginItemPinned": function() { return isPluginItemPinned; },
  228. "isPluginSidebarOpened": function() { return isPluginSidebarOpened; },
  229. "isPublishSidebarOpened": function() { return isPublishSidebarOpened; },
  230. "isSavingMetaBoxes": function() { return selectors_isSavingMetaBoxes; }
  231. });
  232. ;// CONCATENATED MODULE: external ["wp","element"]
  233. var external_wp_element_namespaceObject = window["wp"]["element"];
  234. ;// CONCATENATED MODULE: external ["wp","blocks"]
  235. var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
  236. ;// CONCATENATED MODULE: external ["wp","blockLibrary"]
  237. var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"];
  238. ;// CONCATENATED MODULE: external ["wp","data"]
  239. var external_wp_data_namespaceObject = window["wp"]["data"];
  240. ;// CONCATENATED MODULE: external ["wp","hooks"]
  241. var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
  242. ;// CONCATENATED MODULE: external ["wp","preferences"]
  243. var external_wp_preferences_namespaceObject = window["wp"]["preferences"];
  244. ;// CONCATENATED MODULE: external ["wp","mediaUtils"]
  245. var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
  246. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/components/index.js
  247. /**
  248. * WordPress dependencies
  249. */
  250. const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload;
  251. (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-post/replace-media-upload', replaceMediaUpload);
  252. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  253. function _extends() {
  254. _extends = Object.assign ? Object.assign.bind() : function (target) {
  255. for (var i = 1; i < arguments.length; i++) {
  256. var source = arguments[i];
  257. for (var key in source) {
  258. if (Object.prototype.hasOwnProperty.call(source, key)) {
  259. target[key] = source[key];
  260. }
  261. }
  262. }
  263. return target;
  264. };
  265. return _extends.apply(this, arguments);
  266. }
  267. ;// CONCATENATED MODULE: external "lodash"
  268. var external_lodash_namespaceObject = window["lodash"];
  269. ;// CONCATENATED MODULE: external ["wp","components"]
  270. var external_wp_components_namespaceObject = window["wp"]["components"];
  271. ;// CONCATENATED MODULE: external ["wp","blockEditor"]
  272. var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
  273. ;// CONCATENATED MODULE: external ["wp","i18n"]
  274. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  275. ;// CONCATENATED MODULE: external ["wp","compose"]
  276. var external_wp_compose_namespaceObject = window["wp"]["compose"];
  277. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/validate-multiple-use/index.js
  278. /**
  279. * External dependencies
  280. */
  281. /**
  282. * WordPress dependencies
  283. */
  284. const enhance = (0,external_wp_compose_namespaceObject.compose)(
  285. /**
  286. * For blocks whose block type doesn't support `multiple`, provides the
  287. * wrapped component with `originalBlockClientId` -- a reference to the
  288. * first block of the same type in the content -- if and only if that
  289. * "original" block is not the current one. Thus, an inexisting
  290. * `originalBlockClientId` prop signals that the block is valid.
  291. *
  292. * @param {WPComponent} WrappedBlockEdit A filtered BlockEdit instance.
  293. *
  294. * @return {WPComponent} Enhanced component with merged state data props.
  295. */
  296. (0,external_wp_data_namespaceObject.withSelect)((select, block) => {
  297. const multiple = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true); // For block types with `multiple` support, there is no "original
  298. // block" to be found in the content, as the block itself is valid.
  299. if (multiple) {
  300. return {};
  301. } // Otherwise, only pass `originalBlockClientId` if it refers to a different
  302. // block from the current one.
  303. const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks();
  304. const firstOfSameType = (0,external_lodash_namespaceObject.find)(blocks, _ref => {
  305. let {
  306. name
  307. } = _ref;
  308. return block.name === name;
  309. });
  310. const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId;
  311. return {
  312. originalBlockClientId: isInvalid && firstOfSameType.clientId
  313. };
  314. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref2) => {
  315. let {
  316. originalBlockClientId
  317. } = _ref2;
  318. return {
  319. selectFirst: () => dispatch(external_wp_blockEditor_namespaceObject.store).selectBlock(originalBlockClientId)
  320. };
  321. }));
  322. const withMultipleValidation = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => {
  323. return enhance(_ref3 => {
  324. let {
  325. originalBlockClientId,
  326. selectFirst,
  327. ...props
  328. } = _ref3;
  329. if (!originalBlockClientId) {
  330. return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props);
  331. }
  332. const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(props.name);
  333. const outboundType = getOutboundType(props.name);
  334. return [(0,external_wp_element_namespaceObject.createElement)("div", {
  335. key: "invalid-preview",
  336. style: {
  337. minHeight: '60px'
  338. }
  339. }, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, _extends({
  340. key: "block-edit"
  341. }, props))), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
  342. key: "multiple-use-warning",
  343. actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  344. key: "find-original",
  345. variant: "secondary",
  346. onClick: selectFirst
  347. }, (0,external_wp_i18n_namespaceObject.__)('Find original')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  348. key: "remove",
  349. variant: "secondary",
  350. onClick: () => props.onReplace([])
  351. }, (0,external_wp_i18n_namespaceObject.__)('Remove')), outboundType && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  352. key: "transform",
  353. variant: "secondary",
  354. onClick: () => props.onReplace((0,external_wp_blocks_namespaceObject.createBlock)(outboundType.name, props.attributes))
  355. }, (0,external_wp_i18n_namespaceObject.__)('Transform into:'), " ", outboundType.title)]
  356. }, (0,external_wp_element_namespaceObject.createElement)("strong", null, blockType === null || blockType === void 0 ? void 0 : blockType.title, ": "), (0,external_wp_i18n_namespaceObject.__)('This block can only be used once.'))];
  357. });
  358. }, 'withMultipleValidation');
  359. /**
  360. * Given a base block name, returns the default block type to which to offer
  361. * transforms.
  362. *
  363. * @param {string} blockName Base block name.
  364. *
  365. * @return {?Object} The chosen default block type.
  366. */
  367. function getOutboundType(blockName) {
  368. // Grab the first outbound transform.
  369. const transform = (0,external_wp_blocks_namespaceObject.findTransform)((0,external_wp_blocks_namespaceObject.getBlockTransforms)('to', blockName), _ref4 => {
  370. let {
  371. type,
  372. blocks
  373. } = _ref4;
  374. return type === 'block' && blocks.length === 1;
  375. } // What about when .length > 1?
  376. );
  377. if (!transform) {
  378. return null;
  379. }
  380. return (0,external_wp_blocks_namespaceObject.getBlockType)(transform.blocks[0]);
  381. }
  382. (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-post/validate-multiple-use/with-multiple-validation', withMultipleValidation);
  383. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/index.js
  384. /**
  385. * Internal dependencies
  386. */
  387. ;// CONCATENATED MODULE: external ["wp","primitives"]
  388. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  389. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
  390. /**
  391. * WordPress dependencies
  392. */
  393. const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  394. xmlns: "http://www.w3.org/2000/svg",
  395. viewBox: "0 0 24 24"
  396. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  397. d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
  398. }));
  399. /* harmony default export */ var library_external = (external);
  400. ;// CONCATENATED MODULE: external ["wp","plugins"]
  401. var external_wp_plugins_namespaceObject = window["wp"]["plugins"];
  402. ;// CONCATENATED MODULE: external ["wp","url"]
  403. var external_wp_url_namespaceObject = window["wp"]["url"];
  404. ;// CONCATENATED MODULE: external ["wp","notices"]
  405. var external_wp_notices_namespaceObject = window["wp"]["notices"];
  406. ;// CONCATENATED MODULE: external ["wp","editor"]
  407. var external_wp_editor_namespaceObject = window["wp"]["editor"];
  408. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/copy-content-menu-item/index.js
  409. /**
  410. * WordPress dependencies
  411. */
  412. function CopyContentMenuItem() {
  413. const {
  414. createNotice
  415. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  416. const getText = (0,external_wp_data_namespaceObject.useSelect)(select => () => select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('content'), []);
  417. function onSuccess() {
  418. createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), {
  419. isDismissible: true,
  420. type: 'snackbar'
  421. });
  422. }
  423. const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess);
  424. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  425. ref: ref
  426. }, (0,external_wp_i18n_namespaceObject.__)('Copy all blocks'));
  427. }
  428. ;// CONCATENATED MODULE: external ["wp","keycodes"]
  429. var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
  430. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/reducer.js
  431. /**
  432. * External dependencies
  433. */
  434. /**
  435. * WordPress dependencies
  436. */
  437. /**
  438. * Reducer storing the list of all programmatically removed panels.
  439. *
  440. * @param {Array} state Current state.
  441. * @param {Object} action Action object.
  442. *
  443. * @return {Array} Updated state.
  444. */
  445. function removedPanels() {
  446. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  447. let action = arguments.length > 1 ? arguments[1] : undefined;
  448. switch (action.type) {
  449. case 'REMOVE_PANEL':
  450. if (!(0,external_lodash_namespaceObject.includes)(state, action.panelName)) {
  451. return [...state, action.panelName];
  452. }
  453. }
  454. return state;
  455. }
  456. /**
  457. * Reducer for storing the name of the open modal, or null if no modal is open.
  458. *
  459. * @param {Object} state Previous state.
  460. * @param {Object} action Action object containing the `name` of the modal
  461. *
  462. * @return {Object} Updated state
  463. */
  464. function activeModal() {
  465. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  466. let action = arguments.length > 1 ? arguments[1] : undefined;
  467. switch (action.type) {
  468. case 'OPEN_MODAL':
  469. return action.name;
  470. case 'CLOSE_MODAL':
  471. return null;
  472. }
  473. return state;
  474. }
  475. function publishSidebarActive() {
  476. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  477. let action = arguments.length > 1 ? arguments[1] : undefined;
  478. switch (action.type) {
  479. case 'OPEN_PUBLISH_SIDEBAR':
  480. return true;
  481. case 'CLOSE_PUBLISH_SIDEBAR':
  482. return false;
  483. case 'TOGGLE_PUBLISH_SIDEBAR':
  484. return !state;
  485. }
  486. return state;
  487. }
  488. /**
  489. * Reducer keeping track of the meta boxes isSaving state.
  490. * A "true" value means the meta boxes saving request is in-flight.
  491. *
  492. *
  493. * @param {boolean} state Previous state.
  494. * @param {Object} action Action Object.
  495. *
  496. * @return {Object} Updated state.
  497. */
  498. function isSavingMetaBoxes() {
  499. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  500. let action = arguments.length > 1 ? arguments[1] : undefined;
  501. switch (action.type) {
  502. case 'REQUEST_META_BOX_UPDATES':
  503. return true;
  504. case 'META_BOX_UPDATES_SUCCESS':
  505. case 'META_BOX_UPDATES_FAILURE':
  506. return false;
  507. default:
  508. return state;
  509. }
  510. }
  511. /**
  512. * Reducer keeping track of the meta boxes per location.
  513. *
  514. * @param {boolean} state Previous state.
  515. * @param {Object} action Action Object.
  516. *
  517. * @return {Object} Updated state.
  518. */
  519. function metaBoxLocations() {
  520. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  521. let action = arguments.length > 1 ? arguments[1] : undefined;
  522. switch (action.type) {
  523. case 'SET_META_BOXES_PER_LOCATIONS':
  524. return action.metaBoxesPerLocation;
  525. }
  526. return state;
  527. }
  528. /**
  529. * Reducer returning the editing canvas device type.
  530. *
  531. * @param {Object} state Current state.
  532. * @param {Object} action Dispatched action.
  533. *
  534. * @return {Object} Updated state.
  535. */
  536. function deviceType() {
  537. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Desktop';
  538. let action = arguments.length > 1 ? arguments[1] : undefined;
  539. switch (action.type) {
  540. case 'SET_PREVIEW_DEVICE_TYPE':
  541. return action.deviceType;
  542. }
  543. return state;
  544. }
  545. /**
  546. * Reducer to set the block inserter panel open or closed.
  547. *
  548. * Note: this reducer interacts with the list view panel reducer
  549. * to make sure that only one of the two panels is open at the same time.
  550. *
  551. * @param {Object} state Current state.
  552. * @param {Object} action Dispatched action.
  553. */
  554. function blockInserterPanel() {
  555. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  556. let action = arguments.length > 1 ? arguments[1] : undefined;
  557. switch (action.type) {
  558. case 'SET_IS_LIST_VIEW_OPENED':
  559. return action.isOpen ? false : state;
  560. case 'SET_IS_INSERTER_OPENED':
  561. return action.value;
  562. }
  563. return state;
  564. }
  565. /**
  566. * Reducer to set the list view panel open or closed.
  567. *
  568. * Note: this reducer interacts with the inserter panel reducer
  569. * to make sure that only one of the two panels is open at the same time.
  570. *
  571. * @param {Object} state Current state.
  572. * @param {Object} action Dispatched action.
  573. */
  574. function listViewPanel() {
  575. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  576. let action = arguments.length > 1 ? arguments[1] : undefined;
  577. switch (action.type) {
  578. case 'SET_IS_INSERTER_OPENED':
  579. return action.value ? false : state;
  580. case 'SET_IS_LIST_VIEW_OPENED':
  581. return action.isOpen;
  582. }
  583. return state;
  584. }
  585. /**
  586. * Reducer tracking whether the inserter is open.
  587. *
  588. * @param {boolean} state
  589. * @param {Object} action
  590. */
  591. function isEditingTemplate() {
  592. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  593. let action = arguments.length > 1 ? arguments[1] : undefined;
  594. switch (action.type) {
  595. case 'SET_IS_EDITING_TEMPLATE':
  596. return action.value;
  597. }
  598. return state;
  599. }
  600. /**
  601. * Reducer tracking whether meta boxes are initialized.
  602. *
  603. * @param {boolean} state
  604. * @param {Object} action
  605. *
  606. * @return {boolean} Updated state.
  607. */
  608. function metaBoxesInitialized() {
  609. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  610. let action = arguments.length > 1 ? arguments[1] : undefined;
  611. switch (action.type) {
  612. case 'META_BOXES_INITIALIZED':
  613. return true;
  614. }
  615. return state;
  616. }
  617. const metaBoxes = (0,external_wp_data_namespaceObject.combineReducers)({
  618. isSaving: isSavingMetaBoxes,
  619. locations: metaBoxLocations,
  620. initialized: metaBoxesInitialized
  621. });
  622. /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  623. activeModal,
  624. metaBoxes,
  625. publishSidebarActive,
  626. removedPanels,
  627. deviceType,
  628. blockInserterPanel,
  629. listViewPanel,
  630. isEditingTemplate
  631. }));
  632. ;// CONCATENATED MODULE: external ["wp","apiFetch"]
  633. var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
  634. var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
  635. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  636. var classnames = __webpack_require__(4403);
  637. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  638. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
  639. /**
  640. * WordPress dependencies
  641. */
  642. const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  643. xmlns: "http://www.w3.org/2000/svg",
  644. viewBox: "0 0 24 24"
  645. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  646. d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
  647. }));
  648. /* harmony default export */ var library_check = (check);
  649. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
  650. /**
  651. * WordPress dependencies
  652. */
  653. const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  654. xmlns: "http://www.w3.org/2000/svg",
  655. viewBox: "0 0 24 24"
  656. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  657. d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"
  658. }));
  659. /* harmony default export */ var star_filled = (starFilled);
  660. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
  661. /**
  662. * WordPress dependencies
  663. */
  664. const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  665. xmlns: "http://www.w3.org/2000/svg",
  666. viewBox: "0 0 24 24"
  667. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  668. fillRule: "evenodd",
  669. d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
  670. clipRule: "evenodd"
  671. }));
  672. /* harmony default export */ var star_empty = (starEmpty);
  673. ;// CONCATENATED MODULE: external ["wp","viewport"]
  674. var external_wp_viewport_namespaceObject = window["wp"]["viewport"];
  675. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
  676. /**
  677. * WordPress dependencies
  678. */
  679. const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  680. xmlns: "http://www.w3.org/2000/svg",
  681. viewBox: "0 0 24 24"
  682. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  683. d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
  684. }));
  685. /* harmony default export */ var close_small = (closeSmall);
  686. ;// CONCATENATED MODULE: external ["wp","deprecated"]
  687. var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
  688. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
  689. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js
  690. /**
  691. * WordPress dependencies
  692. */
  693. /**
  694. * Set a default complementary area.
  695. *
  696. * @param {string} scope Complementary area scope.
  697. * @param {string} area Area identifier.
  698. *
  699. * @return {Object} Action object.
  700. */
  701. const setDefaultComplementaryArea = (scope, area) => ({
  702. type: 'SET_DEFAULT_COMPLEMENTARY_AREA',
  703. scope,
  704. area
  705. });
  706. /**
  707. * Enable the complementary area.
  708. *
  709. * @param {string} scope Complementary area scope.
  710. * @param {string} area Area identifier.
  711. */
  712. const enableComplementaryArea = (scope, area) => _ref => {
  713. let {
  714. registry,
  715. dispatch
  716. } = _ref;
  717. // Return early if there's no area.
  718. if (!area) {
  719. return;
  720. }
  721. const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
  722. if (!isComplementaryAreaVisible) {
  723. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true);
  724. }
  725. dispatch({
  726. type: 'ENABLE_COMPLEMENTARY_AREA',
  727. scope,
  728. area
  729. });
  730. };
  731. /**
  732. * Disable the complementary area.
  733. *
  734. * @param {string} scope Complementary area scope.
  735. */
  736. const disableComplementaryArea = scope => _ref2 => {
  737. let {
  738. registry
  739. } = _ref2;
  740. const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
  741. if (isComplementaryAreaVisible) {
  742. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false);
  743. }
  744. };
  745. /**
  746. * Pins an item.
  747. *
  748. * @param {string} scope Item scope.
  749. * @param {string} item Item identifier.
  750. *
  751. * @return {Object} Action object.
  752. */
  753. const pinItem = (scope, item) => _ref3 => {
  754. let {
  755. registry
  756. } = _ref3;
  757. // Return early if there's no item.
  758. if (!item) {
  759. return;
  760. }
  761. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do.
  762. if ((pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) === true) {
  763. return;
  764. }
  765. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
  766. [item]: true
  767. });
  768. };
  769. /**
  770. * Unpins an item.
  771. *
  772. * @param {string} scope Item scope.
  773. * @param {string} item Item identifier.
  774. */
  775. const unpinItem = (scope, item) => _ref4 => {
  776. let {
  777. registry
  778. } = _ref4;
  779. // Return early if there's no item.
  780. if (!item) {
  781. return;
  782. }
  783. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  784. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
  785. [item]: false
  786. });
  787. };
  788. /**
  789. * Returns an action object used in signalling that a feature should be toggled.
  790. *
  791. * @param {string} scope The feature scope (e.g. core/edit-post).
  792. * @param {string} featureName The feature name.
  793. */
  794. function toggleFeature(scope, featureName) {
  795. return function (_ref5) {
  796. let {
  797. registry
  798. } = _ref5;
  799. external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, {
  800. since: '6.0',
  801. alternative: `dispatch( 'core/preferences' ).toggle`
  802. });
  803. registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName);
  804. };
  805. }
  806. /**
  807. * Returns an action object used in signalling that a feature should be set to
  808. * a true or false value
  809. *
  810. * @param {string} scope The feature scope (e.g. core/edit-post).
  811. * @param {string} featureName The feature name.
  812. * @param {boolean} value The value to set.
  813. *
  814. * @return {Object} Action object.
  815. */
  816. function setFeatureValue(scope, featureName, value) {
  817. return function (_ref6) {
  818. let {
  819. registry
  820. } = _ref6;
  821. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, {
  822. since: '6.0',
  823. alternative: `dispatch( 'core/preferences' ).set`
  824. });
  825. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value);
  826. };
  827. }
  828. /**
  829. * Returns an action object used in signalling that defaults should be set for features.
  830. *
  831. * @param {string} scope The feature scope (e.g. core/edit-post).
  832. * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
  833. *
  834. * @return {Object} Action object.
  835. */
  836. function setFeatureDefaults(scope, defaults) {
  837. return function (_ref7) {
  838. let {
  839. registry
  840. } = _ref7;
  841. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, {
  842. since: '6.0',
  843. alternative: `dispatch( 'core/preferences' ).setDefaults`
  844. });
  845. registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults);
  846. };
  847. }
  848. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  849. /**
  850. * WordPress dependencies
  851. */
  852. /**
  853. * Returns the complementary area that is active in a given scope.
  854. *
  855. * @param {Object} state Global application state.
  856. * @param {string} scope Item scope.
  857. *
  858. * @return {string | null | undefined} The complementary area that is active in the given scope.
  859. */
  860. const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
  861. var _state$complementaryA;
  862. const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); // Return `undefined` to indicate that the user has never toggled
  863. // visibility, this is the vanilla default. Other code relies on this
  864. // nuance in the return value.
  865. if (isComplementaryAreaVisible === undefined) {
  866. return undefined;
  867. } // Return `null` to indicate the user hid the complementary area.
  868. if (!isComplementaryAreaVisible) {
  869. return null;
  870. }
  871. return state === null || state === void 0 ? void 0 : (_state$complementaryA = state.complementaryAreas) === null || _state$complementaryA === void 0 ? void 0 : _state$complementaryA[scope];
  872. });
  873. /**
  874. * Returns a boolean indicating if an item is pinned or not.
  875. *
  876. * @param {Object} state Global application state.
  877. * @param {string} scope Scope.
  878. * @param {string} item Item to check.
  879. *
  880. * @return {boolean} True if the item is pinned and false otherwise.
  881. */
  882. const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => {
  883. var _pinnedItems$item;
  884. const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  885. return (_pinnedItems$item = pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
  886. });
  887. /**
  888. * Returns a boolean indicating whether a feature is active for a particular
  889. * scope.
  890. *
  891. * @param {Object} state The store state.
  892. * @param {string} scope The scope of the feature (e.g. core/edit-post).
  893. * @param {string} featureName The name of the feature.
  894. *
  895. * @return {boolean} Is the feature enabled?
  896. */
  897. const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => {
  898. external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
  899. since: '6.0',
  900. alternative: `select( 'core/preferences' ).get( scope, featureName )`
  901. });
  902. return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName);
  903. });
  904. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js
  905. /**
  906. * WordPress dependencies
  907. */
  908. function complementaryAreas() {
  909. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  910. let action = arguments.length > 1 ? arguments[1] : undefined;
  911. switch (action.type) {
  912. case 'SET_DEFAULT_COMPLEMENTARY_AREA':
  913. {
  914. const {
  915. scope,
  916. area
  917. } = action; // If there's already an area, don't overwrite it.
  918. if (state[scope]) {
  919. return state;
  920. }
  921. return { ...state,
  922. [scope]: area
  923. };
  924. }
  925. case 'ENABLE_COMPLEMENTARY_AREA':
  926. {
  927. const {
  928. scope,
  929. area
  930. } = action;
  931. return { ...state,
  932. [scope]: area
  933. };
  934. }
  935. }
  936. return state;
  937. }
  938. /* harmony default export */ var store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  939. complementaryAreas
  940. }));
  941. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js
  942. /**
  943. * The identifier for the data store.
  944. *
  945. * @type {string}
  946. */
  947. const STORE_NAME = 'core/interface';
  948. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js
  949. /**
  950. * WordPress dependencies
  951. */
  952. /**
  953. * Internal dependencies
  954. */
  955. /**
  956. * Store definition for the interface namespace.
  957. *
  958. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  959. *
  960. * @type {Object}
  961. */
  962. const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
  963. reducer: store_reducer,
  964. actions: actions_namespaceObject,
  965. selectors: selectors_namespaceObject
  966. }); // Once we build a more generic persistence plugin that works across types of stores
  967. // we'd be able to replace this with a register call.
  968. (0,external_wp_data_namespaceObject.register)(store);
  969. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js
  970. /**
  971. * WordPress dependencies
  972. */
  973. /* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  974. return {
  975. icon: ownProps.icon || context.icon,
  976. identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
  977. };
  978. }));
  979. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js
  980. /**
  981. * WordPress dependencies
  982. */
  983. /**
  984. * Internal dependencies
  985. */
  986. function ComplementaryAreaToggle(_ref) {
  987. let {
  988. as = external_wp_components_namespaceObject.Button,
  989. scope,
  990. identifier,
  991. icon,
  992. selectedIcon,
  993. name,
  994. ...props
  995. } = _ref;
  996. const ComponentToUse = as;
  997. const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]);
  998. const {
  999. enableComplementaryArea,
  1000. disableComplementaryArea
  1001. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  1002. return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, _extends({
  1003. icon: selectedIcon && isSelected ? selectedIcon : icon,
  1004. onClick: () => {
  1005. if (isSelected) {
  1006. disableComplementaryArea(scope);
  1007. } else {
  1008. enableComplementaryArea(scope, identifier);
  1009. }
  1010. }
  1011. }, props));
  1012. }
  1013. /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
  1014. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js
  1015. /**
  1016. * External dependencies
  1017. */
  1018. /**
  1019. * WordPress dependencies
  1020. */
  1021. /**
  1022. * Internal dependencies
  1023. */
  1024. const ComplementaryAreaHeader = _ref => {
  1025. let {
  1026. smallScreenTitle,
  1027. children,
  1028. className,
  1029. toggleButtonProps
  1030. } = _ref;
  1031. const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({
  1032. icon: close_small
  1033. }, toggleButtonProps));
  1034. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  1035. className: "components-panel__header interface-complementary-area-header__small"
  1036. }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", {
  1037. className: "interface-complementary-area-header__small-title"
  1038. }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", {
  1039. className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className),
  1040. tabIndex: -1
  1041. }, children, toggleButton));
  1042. };
  1043. /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader);
  1044. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js
  1045. /**
  1046. * WordPress dependencies
  1047. */
  1048. const noop = () => {};
  1049. function ActionItemSlot(_ref) {
  1050. let {
  1051. name,
  1052. as: Component = external_wp_components_namespaceObject.ButtonGroup,
  1053. fillProps = {},
  1054. bubblesVirtually,
  1055. ...props
  1056. } = _ref;
  1057. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, {
  1058. name: name,
  1059. bubblesVirtually: bubblesVirtually,
  1060. fillProps: fillProps
  1061. }, fills => {
  1062. if (!external_wp_element_namespaceObject.Children.toArray(fills).length) {
  1063. return null;
  1064. } // Special handling exists for backward compatibility.
  1065. // It ensures that menu items created by plugin authors aren't
  1066. // duplicated with automatically injected menu items coming
  1067. // from pinnable plugin sidebars.
  1068. // @see https://github.com/WordPress/gutenberg/issues/14457
  1069. const initializedByPlugins = [];
  1070. external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => {
  1071. let {
  1072. props: {
  1073. __unstableExplicitMenuItem,
  1074. __unstableTarget
  1075. }
  1076. } = _ref2;
  1077. if (__unstableTarget && __unstableExplicitMenuItem) {
  1078. initializedByPlugins.push(__unstableTarget);
  1079. }
  1080. });
  1081. const children = external_wp_element_namespaceObject.Children.map(fills, child => {
  1082. if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
  1083. return null;
  1084. }
  1085. return child;
  1086. });
  1087. return (0,external_wp_element_namespaceObject.createElement)(Component, props, children);
  1088. });
  1089. }
  1090. function ActionItem(_ref3) {
  1091. let {
  1092. name,
  1093. as: Component = external_wp_components_namespaceObject.Button,
  1094. onClick,
  1095. ...props
  1096. } = _ref3;
  1097. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
  1098. name: name
  1099. }, _ref4 => {
  1100. let {
  1101. onClick: fpOnClick
  1102. } = _ref4;
  1103. return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({
  1104. onClick: onClick || fpOnClick ? function () {
  1105. (onClick || noop)(...arguments);
  1106. (fpOnClick || noop)(...arguments);
  1107. } : undefined
  1108. }, props));
  1109. });
  1110. }
  1111. ActionItem.Slot = ActionItemSlot;
  1112. /* harmony default export */ var action_item = (ActionItem);
  1113. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js
  1114. /**
  1115. * WordPress dependencies
  1116. */
  1117. /**
  1118. * Internal dependencies
  1119. */
  1120. const PluginsMenuItem = _ref => {
  1121. let {
  1122. // Menu item is marked with unstable prop for backward compatibility.
  1123. // They are removed so they don't leak to DOM elements.
  1124. // @see https://github.com/WordPress/gutenberg/issues/14457
  1125. __unstableExplicitMenuItem,
  1126. __unstableTarget,
  1127. ...restProps
  1128. } = _ref;
  1129. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, restProps);
  1130. };
  1131. function ComplementaryAreaMoreMenuItem(_ref2) {
  1132. let {
  1133. scope,
  1134. target,
  1135. __unstableExplicitMenuItem,
  1136. ...props
  1137. } = _ref2;
  1138. return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({
  1139. as: toggleProps => {
  1140. return (0,external_wp_element_namespaceObject.createElement)(action_item, _extends({
  1141. __unstableExplicitMenuItem: __unstableExplicitMenuItem,
  1142. __unstableTarget: `${scope}/${target}`,
  1143. as: PluginsMenuItem,
  1144. name: `${scope}/plugin-more-menu`
  1145. }, toggleProps));
  1146. },
  1147. role: "menuitemcheckbox",
  1148. selectedIcon: library_check,
  1149. name: target,
  1150. scope: scope
  1151. }, props));
  1152. }
  1153. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js
  1154. /**
  1155. * External dependencies
  1156. */
  1157. /**
  1158. * WordPress dependencies
  1159. */
  1160. function PinnedItems(_ref) {
  1161. let {
  1162. scope,
  1163. ...props
  1164. } = _ref;
  1165. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, _extends({
  1166. name: `PinnedItems/${scope}`
  1167. }, props));
  1168. }
  1169. function PinnedItemsSlot(_ref2) {
  1170. let {
  1171. scope,
  1172. className,
  1173. ...props
  1174. } = _ref2;
  1175. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({
  1176. name: `PinnedItems/${scope}`
  1177. }, props), fills => (fills === null || fills === void 0 ? void 0 : fills.length) > 0 && (0,external_wp_element_namespaceObject.createElement)("div", {
  1178. className: classnames_default()(className, 'interface-pinned-items')
  1179. }, fills));
  1180. }
  1181. PinnedItems.Slot = PinnedItemsSlot;
  1182. /* harmony default export */ var pinned_items = (PinnedItems);
  1183. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js
  1184. /**
  1185. * External dependencies
  1186. */
  1187. /**
  1188. * WordPress dependencies
  1189. */
  1190. /**
  1191. * Internal dependencies
  1192. */
  1193. function ComplementaryAreaSlot(_ref) {
  1194. let {
  1195. scope,
  1196. ...props
  1197. } = _ref;
  1198. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({
  1199. name: `ComplementaryArea/${scope}`
  1200. }, props));
  1201. }
  1202. function ComplementaryAreaFill(_ref2) {
  1203. let {
  1204. scope,
  1205. children,
  1206. className
  1207. } = _ref2;
  1208. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
  1209. name: `ComplementaryArea/${scope}`
  1210. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  1211. className: className
  1212. }, children));
  1213. }
  1214. function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
  1215. const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false);
  1216. const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false);
  1217. const {
  1218. enableComplementaryArea,
  1219. disableComplementaryArea
  1220. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  1221. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1222. // If the complementary area is active and the editor is switching from a big to a small window size.
  1223. if (isActive && isSmall && !previousIsSmall.current) {
  1224. // Disable the complementary area.
  1225. disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big.
  1226. shouldOpenWhenNotSmall.current = true;
  1227. } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size
  1228. // and we are going from a small to big window size.
  1229. shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) {
  1230. // Remove the flag indicating the complementary area should be enabled.
  1231. shouldOpenWhenNotSmall.current = false; // Enable the complementary area.
  1232. enableComplementaryArea(scope, identifier);
  1233. } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active,
  1234. // remove the flag.
  1235. shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) {
  1236. shouldOpenWhenNotSmall.current = false;
  1237. }
  1238. if (isSmall !== previousIsSmall.current) {
  1239. previousIsSmall.current = isSmall;
  1240. }
  1241. }, [isActive, isSmall, scope, identifier, activeArea]);
  1242. }
  1243. function ComplementaryArea(_ref3) {
  1244. let {
  1245. children,
  1246. className,
  1247. closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'),
  1248. identifier,
  1249. header,
  1250. headerClassName,
  1251. icon,
  1252. isPinnable = true,
  1253. panelClassName,
  1254. scope,
  1255. name,
  1256. smallScreenTitle,
  1257. title,
  1258. toggleShortcut,
  1259. isActiveByDefault,
  1260. showIconLabels = false
  1261. } = _ref3;
  1262. const {
  1263. isActive,
  1264. isPinned,
  1265. activeArea,
  1266. isSmall,
  1267. isLarge
  1268. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  1269. const {
  1270. getActiveComplementaryArea,
  1271. isItemPinned
  1272. } = select(store);
  1273. const _activeArea = getActiveComplementaryArea(scope);
  1274. return {
  1275. isActive: _activeArea === identifier,
  1276. isPinned: isItemPinned(scope, identifier),
  1277. activeArea: _activeArea,
  1278. isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'),
  1279. isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large')
  1280. };
  1281. }, [identifier, scope]);
  1282. useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
  1283. const {
  1284. enableComplementaryArea,
  1285. disableComplementaryArea,
  1286. pinItem,
  1287. unpinItem
  1288. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  1289. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1290. if (isActiveByDefault && activeArea === undefined && !isSmall) {
  1291. enableComplementaryArea(scope, identifier);
  1292. }
  1293. }, [activeArea, isActiveByDefault, scope, identifier, isSmall]);
  1294. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, {
  1295. scope: scope
  1296. }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, {
  1297. scope: scope,
  1298. identifier: identifier,
  1299. isPressed: isActive && (!showIconLabels || isLarge),
  1300. "aria-expanded": isActive,
  1301. label: title,
  1302. icon: showIconLabels ? library_check : icon,
  1303. showTooltip: !showIconLabels,
  1304. variant: showIconLabels ? 'tertiary' : undefined
  1305. })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, {
  1306. target: name,
  1307. scope: scope,
  1308. icon: icon
  1309. }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, {
  1310. className: classnames_default()('interface-complementary-area', className),
  1311. scope: scope
  1312. }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, {
  1313. className: headerClassName,
  1314. closeLabel: closeLabel,
  1315. onClose: () => disableComplementaryArea(scope),
  1316. smallScreenTitle: smallScreenTitle,
  1317. toggleButtonProps: {
  1318. label: closeLabel,
  1319. shortcut: toggleShortcut,
  1320. scope,
  1321. identifier
  1322. }
  1323. }, header || (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  1324. className: "interface-complementary-area__pin-unpin-item",
  1325. icon: isPinned ? star_filled : star_empty,
  1326. label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'),
  1327. onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
  1328. isPressed: isPinned,
  1329. "aria-expanded": isPinned
  1330. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, {
  1331. className: panelClassName
  1332. }, children)));
  1333. }
  1334. const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
  1335. ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
  1336. /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped);
  1337. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js
  1338. /**
  1339. * WordPress dependencies
  1340. */
  1341. const FullscreenMode = _ref => {
  1342. let {
  1343. isActive
  1344. } = _ref;
  1345. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1346. let isSticky = false; // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes
  1347. // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled
  1348. // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as
  1349. // a consequence of the FullscreenMode setup.
  1350. if (document.body.classList.contains('sticky-menu')) {
  1351. isSticky = true;
  1352. document.body.classList.remove('sticky-menu');
  1353. }
  1354. return () => {
  1355. if (isSticky) {
  1356. document.body.classList.add('sticky-menu');
  1357. }
  1358. };
  1359. }, []);
  1360. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1361. if (isActive) {
  1362. document.body.classList.add('is-fullscreen-mode');
  1363. } else {
  1364. document.body.classList.remove('is-fullscreen-mode');
  1365. }
  1366. return () => {
  1367. if (isActive) {
  1368. document.body.classList.remove('is-fullscreen-mode');
  1369. }
  1370. };
  1371. }, [isActive]);
  1372. return null;
  1373. };
  1374. /* harmony default export */ var fullscreen_mode = (FullscreenMode);
  1375. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js
  1376. /**
  1377. * External dependencies
  1378. */
  1379. /**
  1380. * WordPress dependencies
  1381. */
  1382. function useHTMLClass(className) {
  1383. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1384. const element = document && document.querySelector(`html:not(.${className})`);
  1385. if (!element) {
  1386. return;
  1387. }
  1388. element.classList.toggle(className);
  1389. return () => {
  1390. element.classList.toggle(className);
  1391. };
  1392. }, [className]);
  1393. }
  1394. function InterfaceSkeleton(_ref, ref) {
  1395. let {
  1396. footer,
  1397. header,
  1398. sidebar,
  1399. secondarySidebar,
  1400. notices,
  1401. content,
  1402. drawer,
  1403. actions,
  1404. labels,
  1405. className,
  1406. shortcuts
  1407. } = _ref;
  1408. const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts);
  1409. useHTMLClass('interface-interface-skeleton__html-container');
  1410. const defaultLabels = {
  1411. /* translators: accessibility text for the nav bar landmark region. */
  1412. drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'),
  1413. /* translators: accessibility text for the top bar landmark region. */
  1414. header: (0,external_wp_i18n_namespaceObject.__)('Header'),
  1415. /* translators: accessibility text for the content landmark region. */
  1416. body: (0,external_wp_i18n_namespaceObject.__)('Content'),
  1417. /* translators: accessibility text for the secondary sidebar landmark region. */
  1418. secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'),
  1419. /* translators: accessibility text for the settings landmark region. */
  1420. sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'),
  1421. /* translators: accessibility text for the publish landmark region. */
  1422. actions: (0,external_wp_i18n_namespaceObject.__)('Publish'),
  1423. /* translators: accessibility text for the footer landmark region. */
  1424. footer: (0,external_wp_i18n_namespaceObject.__)('Footer')
  1425. };
  1426. const mergedLabels = { ...defaultLabels,
  1427. ...labels
  1428. };
  1429. return (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, navigateRegionsProps, {
  1430. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]),
  1431. className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
  1432. }), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", {
  1433. className: "interface-interface-skeleton__drawer",
  1434. role: "region",
  1435. "aria-label": mergedLabels.drawer,
  1436. tabIndex: "-1"
  1437. }, drawer), (0,external_wp_element_namespaceObject.createElement)("div", {
  1438. className: "interface-interface-skeleton__editor"
  1439. }, !!header && (0,external_wp_element_namespaceObject.createElement)("div", {
  1440. className: "interface-interface-skeleton__header",
  1441. role: "region",
  1442. "aria-label": mergedLabels.header,
  1443. tabIndex: "-1"
  1444. }, header), (0,external_wp_element_namespaceObject.createElement)("div", {
  1445. className: "interface-interface-skeleton__body"
  1446. }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
  1447. className: "interface-interface-skeleton__secondary-sidebar",
  1448. role: "region",
  1449. "aria-label": mergedLabels.secondarySidebar,
  1450. tabIndex: "-1"
  1451. }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", {
  1452. className: "interface-interface-skeleton__notices"
  1453. }, notices), (0,external_wp_element_namespaceObject.createElement)("div", {
  1454. className: "interface-interface-skeleton__content",
  1455. role: "region",
  1456. "aria-label": mergedLabels.body,
  1457. tabIndex: "-1"
  1458. }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
  1459. className: "interface-interface-skeleton__sidebar",
  1460. role: "region",
  1461. "aria-label": mergedLabels.sidebar,
  1462. tabIndex: "-1"
  1463. }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", {
  1464. className: "interface-interface-skeleton__actions",
  1465. role: "region",
  1466. "aria-label": mergedLabels.actions,
  1467. tabIndex: "-1"
  1468. }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", {
  1469. className: "interface-interface-skeleton__footer",
  1470. role: "region",
  1471. "aria-label": mergedLabels.footer,
  1472. tabIndex: "-1"
  1473. }, footer));
  1474. }
  1475. /* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton));
  1476. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
  1477. /**
  1478. * WordPress dependencies
  1479. */
  1480. const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1481. xmlns: "http://www.w3.org/2000/svg",
  1482. viewBox: "0 0 24 24"
  1483. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1484. d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
  1485. }));
  1486. /* harmony default export */ var more_vertical = (moreVertical);
  1487. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js
  1488. /**
  1489. * External dependencies
  1490. */
  1491. /**
  1492. * WordPress dependencies
  1493. */
  1494. function MoreMenuDropdown(_ref) {
  1495. let {
  1496. as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu,
  1497. className,
  1498. /* translators: button label text should, if possible, be under 16 characters. */
  1499. label = (0,external_wp_i18n_namespaceObject.__)('Options'),
  1500. popoverProps,
  1501. toggleProps,
  1502. children
  1503. } = _ref;
  1504. return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, {
  1505. className: classnames_default()('interface-more-menu-dropdown', className),
  1506. icon: more_vertical,
  1507. label: label,
  1508. popoverProps: {
  1509. position: 'bottom left',
  1510. ...popoverProps,
  1511. className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className)
  1512. },
  1513. toggleProps: {
  1514. tooltipPosition: 'bottom',
  1515. ...toggleProps
  1516. }
  1517. }, onClose => children(onClose));
  1518. }
  1519. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal/index.js
  1520. /**
  1521. * WordPress dependencies
  1522. */
  1523. function PreferencesModal(_ref) {
  1524. let {
  1525. closeModal,
  1526. children
  1527. } = _ref;
  1528. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  1529. className: "interface-preferences-modal",
  1530. title: (0,external_wp_i18n_namespaceObject.__)('Preferences'),
  1531. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  1532. onRequestClose: closeModal
  1533. }, children);
  1534. }
  1535. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
  1536. /**
  1537. * WordPress dependencies
  1538. */
  1539. /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
  1540. /**
  1541. * Return an SVG icon.
  1542. *
  1543. * @param {IconProps} props icon is the SVG component to render
  1544. * size is a number specifiying the icon size in pixels
  1545. * Other props will be passed to wrapped SVG component
  1546. *
  1547. * @return {JSX.Element} Icon component
  1548. */
  1549. function Icon(_ref) {
  1550. let {
  1551. icon,
  1552. size = 24,
  1553. ...props
  1554. } = _ref;
  1555. return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  1556. width: size,
  1557. height: size,
  1558. ...props
  1559. });
  1560. }
  1561. /* harmony default export */ var icon = (Icon);
  1562. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
  1563. /**
  1564. * WordPress dependencies
  1565. */
  1566. const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1567. xmlns: "http://www.w3.org/2000/svg",
  1568. viewBox: "0 0 24 24"
  1569. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1570. d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
  1571. }));
  1572. /* harmony default export */ var chevron_left = (chevronLeft);
  1573. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
  1574. /**
  1575. * WordPress dependencies
  1576. */
  1577. const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1578. xmlns: "http://www.w3.org/2000/svg",
  1579. viewBox: "0 0 24 24"
  1580. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1581. d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
  1582. }));
  1583. /* harmony default export */ var chevron_right = (chevronRight);
  1584. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-tabs/index.js
  1585. /**
  1586. * WordPress dependencies
  1587. */
  1588. const PREFERENCES_MENU = 'preferences-menu';
  1589. function PreferencesModalTabs(_ref) {
  1590. let {
  1591. sections
  1592. } = _ref;
  1593. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); // This is also used to sync the two different rendered components
  1594. // between small and large viewports.
  1595. const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU);
  1596. /**
  1597. * Create helper objects from `sections` for easier data handling.
  1598. * `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
  1599. * is used for easier access to active tab's content.
  1600. */
  1601. const {
  1602. tabs,
  1603. sectionsContentMap
  1604. } = (0,external_wp_element_namespaceObject.useMemo)(() => {
  1605. let mappedTabs = {
  1606. tabs: [],
  1607. sectionsContentMap: {}
  1608. };
  1609. if (sections.length) {
  1610. mappedTabs = sections.reduce((accumulator, _ref2) => {
  1611. let {
  1612. name,
  1613. tabLabel: title,
  1614. content
  1615. } = _ref2;
  1616. accumulator.tabs.push({
  1617. name,
  1618. title
  1619. });
  1620. accumulator.sectionsContentMap[name] = content;
  1621. return accumulator;
  1622. }, {
  1623. tabs: [],
  1624. sectionsContentMap: {}
  1625. });
  1626. }
  1627. return mappedTabs;
  1628. }, [sections]);
  1629. const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]);
  1630. let modalContent; // We render different components based on the viewport size.
  1631. if (isLargeViewport) {
  1632. modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
  1633. className: "interface-preferences__tabs",
  1634. tabs: tabs,
  1635. initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
  1636. onSelect: setActiveMenu,
  1637. orientation: "vertical"
  1638. }, getCurrentTab);
  1639. } else {
  1640. modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
  1641. initialPath: "/",
  1642. className: "interface-preferences__provider"
  1643. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
  1644. path: "/"
  1645. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
  1646. isBorderless: true,
  1647. size: "small"
  1648. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, tabs.map(tab => {
  1649. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
  1650. key: tab.name,
  1651. path: tab.name,
  1652. as: external_wp_components_namespaceObject.__experimentalItem,
  1653. isAction: true
  1654. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  1655. justify: "space-between"
  1656. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, tab.title)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, {
  1657. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
  1658. }))));
  1659. }))))), sections.length && sections.map(section => {
  1660. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
  1661. key: `${section.name}-menu`,
  1662. path: section.name
  1663. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
  1664. isBorderless: true,
  1665. size: "large"
  1666. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardHeader, {
  1667. isBorderless: false,
  1668. justify: "left",
  1669. size: "small",
  1670. gap: "6"
  1671. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, {
  1672. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
  1673. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
  1674. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  1675. size: "16"
  1676. }, section.tabLabel)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, section.content)));
  1677. }));
  1678. }
  1679. return modalContent;
  1680. }
  1681. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-section/index.js
  1682. const Section = _ref => {
  1683. let {
  1684. description,
  1685. title,
  1686. children
  1687. } = _ref;
  1688. return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
  1689. className: "interface-preferences-modal__section"
  1690. }, (0,external_wp_element_namespaceObject.createElement)("legend", {
  1691. className: "interface-preferences-modal__section-legend"
  1692. }, (0,external_wp_element_namespaceObject.createElement)("h2", {
  1693. className: "interface-preferences-modal__section-title"
  1694. }, title), description && (0,external_wp_element_namespaceObject.createElement)("p", {
  1695. className: "interface-preferences-modal__section-description"
  1696. }, description)), children);
  1697. };
  1698. /* harmony default export */ var preferences_modal_section = (Section);
  1699. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-base-option/index.js
  1700. /**
  1701. * WordPress dependencies
  1702. */
  1703. function BaseOption(_ref) {
  1704. let {
  1705. help,
  1706. label,
  1707. isChecked,
  1708. onChange,
  1709. children
  1710. } = _ref;
  1711. return (0,external_wp_element_namespaceObject.createElement)("div", {
  1712. className: "interface-preferences-modal__option"
  1713. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
  1714. __nextHasNoMarginBottom: true,
  1715. help: help,
  1716. label: label,
  1717. checked: isChecked,
  1718. onChange: onChange
  1719. }), children);
  1720. }
  1721. /* harmony default export */ var preferences_modal_base_option = (BaseOption);
  1722. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js
  1723. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js
  1724. ;// CONCATENATED MODULE: external ["wp","a11y"]
  1725. var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
  1726. ;// CONCATENATED MODULE: external ["wp","coreData"]
  1727. var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
  1728. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/utils/meta-boxes.js
  1729. /**
  1730. * Function returning the current Meta Boxes DOM Node in the editor
  1731. * whether the meta box area is opened or not.
  1732. * If the MetaBox Area is visible returns it, and returns the original container instead.
  1733. *
  1734. * @param {string} location Meta Box location.
  1735. *
  1736. * @return {string} HTML content.
  1737. */
  1738. const getMetaBoxContainer = location => {
  1739. const area = document.querySelector(`.edit-post-meta-boxes-area.is-${location} .metabox-location-${location}`);
  1740. if (area) {
  1741. return area;
  1742. }
  1743. return document.querySelector('#metaboxes .metabox-location-' + location);
  1744. };
  1745. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/actions.js
  1746. /**
  1747. * External dependencies
  1748. */
  1749. /**
  1750. * WordPress dependencies
  1751. */
  1752. /**
  1753. * Internal dependencies
  1754. */
  1755. /**
  1756. * Returns an action object used in signalling that the user opened an editor sidebar.
  1757. *
  1758. * @param {?string} name Sidebar name to be opened.
  1759. */
  1760. const openGeneralSidebar = name => _ref => {
  1761. let {
  1762. registry
  1763. } = _ref;
  1764. return registry.dispatch(store).enableComplementaryArea(store_store.name, name);
  1765. };
  1766. /**
  1767. * Returns an action object signalling that the user closed the sidebar.
  1768. */
  1769. const closeGeneralSidebar = () => _ref2 => {
  1770. let {
  1771. registry
  1772. } = _ref2;
  1773. return registry.dispatch(store).disableComplementaryArea(store_store.name);
  1774. };
  1775. /**
  1776. * Returns an action object used in signalling that the user opened a modal.
  1777. *
  1778. * @param {string} name A string that uniquely identifies the modal.
  1779. *
  1780. * @return {Object} Action object.
  1781. */
  1782. function openModal(name) {
  1783. return {
  1784. type: 'OPEN_MODAL',
  1785. name
  1786. };
  1787. }
  1788. /**
  1789. * Returns an action object signalling that the user closed a modal.
  1790. *
  1791. * @return {Object} Action object.
  1792. */
  1793. function closeModal() {
  1794. return {
  1795. type: 'CLOSE_MODAL'
  1796. };
  1797. }
  1798. /**
  1799. * Returns an action object used in signalling that the user opened the publish
  1800. * sidebar.
  1801. *
  1802. * @return {Object} Action object
  1803. */
  1804. function openPublishSidebar() {
  1805. return {
  1806. type: 'OPEN_PUBLISH_SIDEBAR'
  1807. };
  1808. }
  1809. /**
  1810. * Returns an action object used in signalling that the user closed the
  1811. * publish sidebar.
  1812. *
  1813. * @return {Object} Action object.
  1814. */
  1815. function closePublishSidebar() {
  1816. return {
  1817. type: 'CLOSE_PUBLISH_SIDEBAR'
  1818. };
  1819. }
  1820. /**
  1821. * Returns an action object used in signalling that the user toggles the publish sidebar.
  1822. *
  1823. * @return {Object} Action object
  1824. */
  1825. function togglePublishSidebar() {
  1826. return {
  1827. type: 'TOGGLE_PUBLISH_SIDEBAR'
  1828. };
  1829. }
  1830. /**
  1831. * Returns an action object used to enable or disable a panel in the editor.
  1832. *
  1833. * @param {string} panelName A string that identifies the panel to enable or disable.
  1834. *
  1835. * @return {Object} Action object.
  1836. */
  1837. const toggleEditorPanelEnabled = panelName => _ref3 => {
  1838. var _registry$select$get;
  1839. let {
  1840. registry
  1841. } = _ref3;
  1842. const inactivePanels = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
  1843. const isPanelInactive = !!(inactivePanels !== null && inactivePanels !== void 0 && inactivePanels.includes(panelName)); // If the panel is inactive, remove it to enable it, else add it to
  1844. // make it inactive.
  1845. let updatedInactivePanels;
  1846. if (isPanelInactive) {
  1847. updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName);
  1848. } else {
  1849. updatedInactivePanels = [...inactivePanels, panelName];
  1850. }
  1851. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'inactivePanels', updatedInactivePanels);
  1852. };
  1853. /**
  1854. * Opens a closed panel and closes an open panel.
  1855. *
  1856. * @param {string} panelName A string that identifies the panel to open or close.
  1857. */
  1858. const toggleEditorPanelOpened = panelName => _ref4 => {
  1859. var _registry$select$get2;
  1860. let {
  1861. registry
  1862. } = _ref4;
  1863. const openPanels = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
  1864. const isPanelOpen = !!(openPanels !== null && openPanels !== void 0 && openPanels.includes(panelName)); // If the panel is open, remove it to close it, else add it to
  1865. // make it open.
  1866. let updatedOpenPanels;
  1867. if (isPanelOpen) {
  1868. updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName);
  1869. } else {
  1870. updatedOpenPanels = [...openPanels, panelName];
  1871. }
  1872. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'openPanels', updatedOpenPanels);
  1873. };
  1874. /**
  1875. * Returns an action object used to remove a panel from the editor.
  1876. *
  1877. * @param {string} panelName A string that identifies the panel to remove.
  1878. *
  1879. * @return {Object} Action object.
  1880. */
  1881. function removeEditorPanel(panelName) {
  1882. return {
  1883. type: 'REMOVE_PANEL',
  1884. panelName
  1885. };
  1886. }
  1887. /**
  1888. * Triggers an action used to toggle a feature flag.
  1889. *
  1890. * @param {string} feature Feature name.
  1891. */
  1892. const actions_toggleFeature = feature => _ref5 => {
  1893. let {
  1894. registry
  1895. } = _ref5;
  1896. return registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-post', feature);
  1897. };
  1898. /**
  1899. * Triggers an action used to switch editor mode.
  1900. *
  1901. * @param {string} mode The editor mode.
  1902. */
  1903. const switchEditorMode = mode => _ref6 => {
  1904. let {
  1905. registry
  1906. } = _ref6;
  1907. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'editorMode', mode); // Unselect blocks when we switch to the code editor.
  1908. if (mode !== 'visual') {
  1909. registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock();
  1910. }
  1911. const message = mode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Visual editor selected') : (0,external_wp_i18n_namespaceObject.__)('Code editor selected');
  1912. (0,external_wp_a11y_namespaceObject.speak)(message, 'assertive');
  1913. };
  1914. /**
  1915. * Triggers an action object used to toggle a plugin name flag.
  1916. *
  1917. * @param {string} pluginName Plugin name.
  1918. */
  1919. const togglePinnedPluginItem = pluginName => _ref7 => {
  1920. let {
  1921. registry
  1922. } = _ref7;
  1923. const isPinned = registry.select(store).isItemPinned('core/edit-post', pluginName);
  1924. registry.dispatch(store)[isPinned ? 'unpinItem' : 'pinItem']('core/edit-post', pluginName);
  1925. };
  1926. /**
  1927. * Returns an action object used in signaling that a style should be auto-applied when a block is created.
  1928. *
  1929. * @param {string} blockName Name of the block.
  1930. * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed.
  1931. */
  1932. const updatePreferredStyleVariations = (blockName, blockStyle) => _ref8 => {
  1933. var _registry$select$get3;
  1934. let {
  1935. registry
  1936. } = _ref8;
  1937. if (!blockName) {
  1938. return;
  1939. }
  1940. const existingVariations = (_registry$select$get3 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations')) !== null && _registry$select$get3 !== void 0 ? _registry$select$get3 : {}; // When the blockStyle is omitted, remove the block's preferred variation.
  1941. if (!blockStyle) {
  1942. const updatedVariations = { ...existingVariations
  1943. };
  1944. delete updatedVariations[blockName];
  1945. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'preferredStyleVariations', updatedVariations);
  1946. } else {
  1947. // Else add the variation.
  1948. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'preferredStyleVariations', { ...existingVariations,
  1949. [blockName]: blockStyle
  1950. });
  1951. }
  1952. };
  1953. /**
  1954. * Update the provided block types to be visible.
  1955. *
  1956. * @param {string[]} blockNames Names of block types to show.
  1957. */
  1958. const showBlockTypes = blockNames => _ref9 => {
  1959. var _registry$select$get4;
  1960. let {
  1961. registry
  1962. } = _ref9;
  1963. const existingBlockNames = (_registry$select$get4 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get4 !== void 0 ? _registry$select$get4 : [];
  1964. const newBlockNames = (0,external_lodash_namespaceObject.without)(existingBlockNames, ...(0,external_lodash_namespaceObject.castArray)(blockNames));
  1965. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'hiddenBlockTypes', newBlockNames);
  1966. };
  1967. /**
  1968. * Update the provided block types to be hidden.
  1969. *
  1970. * @param {string[]} blockNames Names of block types to hide.
  1971. */
  1972. const hideBlockTypes = blockNames => _ref10 => {
  1973. var _registry$select$get5;
  1974. let {
  1975. registry
  1976. } = _ref10;
  1977. const existingBlockNames = (_registry$select$get5 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get5 !== void 0 ? _registry$select$get5 : [];
  1978. const mergedBlockNames = new Set([...existingBlockNames, ...(0,external_lodash_namespaceObject.castArray)(blockNames)]);
  1979. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'hiddenBlockTypes', [...mergedBlockNames]);
  1980. };
  1981. /**
  1982. * Returns an action object used in signaling
  1983. * what Meta boxes are available in which location.
  1984. *
  1985. * @param {Object} metaBoxesPerLocation Meta boxes per location.
  1986. */
  1987. const setAvailableMetaBoxesPerLocation = metaBoxesPerLocation => _ref11 => {
  1988. let {
  1989. dispatch
  1990. } = _ref11;
  1991. return dispatch({
  1992. type: 'SET_META_BOXES_PER_LOCATIONS',
  1993. metaBoxesPerLocation
  1994. });
  1995. };
  1996. /**
  1997. * Update a metabox.
  1998. */
  1999. const requestMetaBoxUpdates = () => async _ref12 => {
  2000. let {
  2001. registry,
  2002. select,
  2003. dispatch
  2004. } = _ref12;
  2005. dispatch({
  2006. type: 'REQUEST_META_BOX_UPDATES'
  2007. }); // Saves the wp_editor fields.
  2008. if (window.tinyMCE) {
  2009. window.tinyMCE.triggerSave();
  2010. } // Additional data needed for backward compatibility.
  2011. // If we do not provide this data, the post will be overridden with the default values.
  2012. const post = registry.select(external_wp_editor_namespaceObject.store).getCurrentPost();
  2013. const additionalData = [post.comment_status ? ['comment_status', post.comment_status] : false, post.ping_status ? ['ping_status', post.ping_status] : false, post.sticky ? ['sticky', post.sticky] : false, post.author ? ['post_author', post.author] : false].filter(Boolean); // We gather all the metaboxes locations data and the base form data.
  2014. const baseFormData = new window.FormData(document.querySelector('.metabox-base-form'));
  2015. const activeMetaBoxLocations = select.getActiveMetaBoxLocations();
  2016. const formDataToMerge = [baseFormData, ...activeMetaBoxLocations.map(location => new window.FormData(getMetaBoxContainer(location)))]; // Merge all form data objects into a single one.
  2017. const formData = (0,external_lodash_namespaceObject.reduce)(formDataToMerge, (memo, currentFormData) => {
  2018. for (const [key, value] of currentFormData) {
  2019. memo.append(key, value);
  2020. }
  2021. return memo;
  2022. }, new window.FormData());
  2023. additionalData.forEach(_ref13 => {
  2024. let [key, value] = _ref13;
  2025. return formData.append(key, value);
  2026. });
  2027. try {
  2028. // Save the metaboxes.
  2029. await external_wp_apiFetch_default()({
  2030. url: window._wpMetaBoxUrl,
  2031. method: 'POST',
  2032. body: formData,
  2033. parse: false
  2034. });
  2035. dispatch.metaBoxUpdatesSuccess();
  2036. } catch {
  2037. dispatch.metaBoxUpdatesFailure();
  2038. }
  2039. };
  2040. /**
  2041. * Returns an action object used to signal a successful meta box update.
  2042. *
  2043. * @return {Object} Action object.
  2044. */
  2045. function metaBoxUpdatesSuccess() {
  2046. return {
  2047. type: 'META_BOX_UPDATES_SUCCESS'
  2048. };
  2049. }
  2050. /**
  2051. * Returns an action object used to signal a failed meta box update.
  2052. *
  2053. * @return {Object} Action object.
  2054. */
  2055. function metaBoxUpdatesFailure() {
  2056. return {
  2057. type: 'META_BOX_UPDATES_FAILURE'
  2058. };
  2059. }
  2060. /**
  2061. * Returns an action object used to toggle the width of the editing canvas.
  2062. *
  2063. * @param {string} deviceType
  2064. *
  2065. * @return {Object} Action object.
  2066. */
  2067. function __experimentalSetPreviewDeviceType(deviceType) {
  2068. return {
  2069. type: 'SET_PREVIEW_DEVICE_TYPE',
  2070. deviceType
  2071. };
  2072. }
  2073. /**
  2074. * Returns an action object used to open/close the inserter.
  2075. *
  2076. * @param {boolean|Object} value Whether the inserter should be
  2077. * opened (true) or closed (false).
  2078. * To specify an insertion point,
  2079. * use an object.
  2080. * @param {string} value.rootClientId The root client ID to insert at.
  2081. * @param {number} value.insertionIndex The index to insert at.
  2082. *
  2083. * @return {Object} Action object.
  2084. */
  2085. function setIsInserterOpened(value) {
  2086. return {
  2087. type: 'SET_IS_INSERTER_OPENED',
  2088. value
  2089. };
  2090. }
  2091. /**
  2092. * Returns an action object used to open/close the list view.
  2093. *
  2094. * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.
  2095. * @return {Object} Action object.
  2096. */
  2097. function setIsListViewOpened(isOpen) {
  2098. return {
  2099. type: 'SET_IS_LIST_VIEW_OPENED',
  2100. isOpen
  2101. };
  2102. }
  2103. /**
  2104. * Returns an action object used to switch to template editing.
  2105. *
  2106. * @param {boolean} value Is editing template.
  2107. * @return {Object} Action object.
  2108. */
  2109. function setIsEditingTemplate(value) {
  2110. return {
  2111. type: 'SET_IS_EDITING_TEMPLATE',
  2112. value
  2113. };
  2114. }
  2115. /**
  2116. * Switches to the template mode.
  2117. *
  2118. * @param {boolean} newTemplate Is new template.
  2119. */
  2120. const __unstableSwitchToTemplateMode = function () {
  2121. let newTemplate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2122. return _ref14 => {
  2123. let {
  2124. registry,
  2125. select,
  2126. dispatch
  2127. } = _ref14;
  2128. dispatch(setIsEditingTemplate(true));
  2129. const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate');
  2130. if (!isWelcomeGuideActive) {
  2131. const message = newTemplate ? (0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now.") : (0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.');
  2132. registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(message, {
  2133. type: 'snackbar'
  2134. });
  2135. }
  2136. };
  2137. };
  2138. /**
  2139. * Create a block based template.
  2140. *
  2141. * @param {Object?} template Template to create and assign.
  2142. */
  2143. const __unstableCreateTemplate = template => async _ref15 => {
  2144. let {
  2145. registry
  2146. } = _ref15;
  2147. const savedTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template);
  2148. const post = registry.select(external_wp_editor_namespaceObject.store).getCurrentPost();
  2149. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', post.type, post.id, {
  2150. template: savedTemplate.slug
  2151. });
  2152. };
  2153. let actions_metaBoxesInitialized = false;
  2154. /**
  2155. * Initializes WordPress `postboxes` script and the logic for saving meta boxes.
  2156. */
  2157. const initializeMetaBoxes = () => _ref16 => {
  2158. let {
  2159. registry,
  2160. select,
  2161. dispatch
  2162. } = _ref16;
  2163. const isEditorReady = registry.select(external_wp_editor_namespaceObject.store).__unstableIsEditorReady();
  2164. if (!isEditorReady) {
  2165. return;
  2166. } // Only initialize once.
  2167. if (actions_metaBoxesInitialized) {
  2168. return;
  2169. }
  2170. const postType = registry.select(external_wp_editor_namespaceObject.store).getCurrentPostType();
  2171. if (window.postboxes.page !== postType) {
  2172. window.postboxes.add_postbox_toggles(postType);
  2173. }
  2174. actions_metaBoxesInitialized = true;
  2175. let wasSavingPost = registry.select(external_wp_editor_namespaceObject.store).isSavingPost();
  2176. let wasAutosavingPost = registry.select(external_wp_editor_namespaceObject.store).isAutosavingPost();
  2177. const hasMetaBoxes = select.hasMetaBoxes(); // Save metaboxes when performing a full save on the post.
  2178. registry.subscribe(async () => {
  2179. const isSavingPost = registry.select(external_wp_editor_namespaceObject.store).isSavingPost();
  2180. const isAutosavingPost = registry.select(external_wp_editor_namespaceObject.store).isAutosavingPost(); // Save metaboxes on save completion, except for autosaves that are not a post preview.
  2181. //
  2182. // Meta boxes are initialized once at page load. It is not necessary to
  2183. // account for updates on each state change.
  2184. //
  2185. // See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309.
  2186. const shouldTriggerMetaboxesSave = hasMetaBoxes && wasSavingPost && !isSavingPost && !wasAutosavingPost; // Save current state for next inspection.
  2187. wasSavingPost = isSavingPost;
  2188. wasAutosavingPost = isAutosavingPost;
  2189. if (shouldTriggerMetaboxesSave) {
  2190. await dispatch.requestMetaBoxUpdates();
  2191. }
  2192. });
  2193. dispatch({
  2194. type: 'META_BOXES_INITIALIZED'
  2195. });
  2196. };
  2197. ;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js
  2198. /** @typedef {(...args: any[]) => *[]} GetDependants */
  2199. /** @typedef {() => void} Clear */
  2200. /**
  2201. * @typedef {{
  2202. * getDependants: GetDependants,
  2203. * clear: Clear
  2204. * }} EnhancedSelector
  2205. */
  2206. /**
  2207. * Internal cache entry.
  2208. *
  2209. * @typedef CacheNode
  2210. *
  2211. * @property {?CacheNode|undefined} [prev] Previous node.
  2212. * @property {?CacheNode|undefined} [next] Next node.
  2213. * @property {*[]} args Function arguments for cache entry.
  2214. * @property {*} val Function result.
  2215. */
  2216. /**
  2217. * @typedef Cache
  2218. *
  2219. * @property {Clear} clear Function to clear cache.
  2220. * @property {boolean} [isUniqueByDependants] Whether dependants are valid in
  2221. * considering cache uniqueness. A cache is unique if dependents are all arrays
  2222. * or objects.
  2223. * @property {CacheNode?} [head] Cache head.
  2224. * @property {*[]} [lastDependants] Dependants from previous invocation.
  2225. */
  2226. /**
  2227. * Arbitrary value used as key for referencing cache object in WeakMap tree.
  2228. *
  2229. * @type {{}}
  2230. */
  2231. var LEAF_KEY = {};
  2232. /**
  2233. * Returns the first argument as the sole entry in an array.
  2234. *
  2235. * @template T
  2236. *
  2237. * @param {T} value Value to return.
  2238. *
  2239. * @return {[T]} Value returned as entry in array.
  2240. */
  2241. function arrayOf(value) {
  2242. return [value];
  2243. }
  2244. /**
  2245. * Returns true if the value passed is object-like, or false otherwise. A value
  2246. * is object-like if it can support property assignment, e.g. object or array.
  2247. *
  2248. * @param {*} value Value to test.
  2249. *
  2250. * @return {boolean} Whether value is object-like.
  2251. */
  2252. function isObjectLike(value) {
  2253. return !!value && 'object' === typeof value;
  2254. }
  2255. /**
  2256. * Creates and returns a new cache object.
  2257. *
  2258. * @return {Cache} Cache object.
  2259. */
  2260. function createCache() {
  2261. /** @type {Cache} */
  2262. var cache = {
  2263. clear: function () {
  2264. cache.head = null;
  2265. },
  2266. };
  2267. return cache;
  2268. }
  2269. /**
  2270. * Returns true if entries within the two arrays are strictly equal by
  2271. * reference from a starting index.
  2272. *
  2273. * @param {*[]} a First array.
  2274. * @param {*[]} b Second array.
  2275. * @param {number} fromIndex Index from which to start comparison.
  2276. *
  2277. * @return {boolean} Whether arrays are shallowly equal.
  2278. */
  2279. function isShallowEqual(a, b, fromIndex) {
  2280. var i;
  2281. if (a.length !== b.length) {
  2282. return false;
  2283. }
  2284. for (i = fromIndex; i < a.length; i++) {
  2285. if (a[i] !== b[i]) {
  2286. return false;
  2287. }
  2288. }
  2289. return true;
  2290. }
  2291. /**
  2292. * Returns a memoized selector function. The getDependants function argument is
  2293. * called before the memoized selector and is expected to return an immutable
  2294. * reference or array of references on which the selector depends for computing
  2295. * its own return value. The memoize cache is preserved only as long as those
  2296. * dependant references remain the same. If getDependants returns a different
  2297. * reference(s), the cache is cleared and the selector value regenerated.
  2298. *
  2299. * @template {(...args: *[]) => *} S
  2300. *
  2301. * @param {S} selector Selector function.
  2302. * @param {GetDependants=} getDependants Dependant getter returning an array of
  2303. * references used in cache bust consideration.
  2304. */
  2305. /* harmony default export */ function rememo(selector, getDependants) {
  2306. /** @type {WeakMap<*,*>} */
  2307. var rootCache;
  2308. /** @type {GetDependants} */
  2309. var normalizedGetDependants = getDependants ? getDependants : arrayOf;
  2310. /**
  2311. * Returns the cache for a given dependants array. When possible, a WeakMap
  2312. * will be used to create a unique cache for each set of dependants. This
  2313. * is feasible due to the nature of WeakMap in allowing garbage collection
  2314. * to occur on entries where the key object is no longer referenced. Since
  2315. * WeakMap requires the key to be an object, this is only possible when the
  2316. * dependant is object-like. The root cache is created as a hierarchy where
  2317. * each top-level key is the first entry in a dependants set, the value a
  2318. * WeakMap where each key is the next dependant, and so on. This continues
  2319. * so long as the dependants are object-like. If no dependants are object-
  2320. * like, then the cache is shared across all invocations.
  2321. *
  2322. * @see isObjectLike
  2323. *
  2324. * @param {*[]} dependants Selector dependants.
  2325. *
  2326. * @return {Cache} Cache object.
  2327. */
  2328. function getCache(dependants) {
  2329. var caches = rootCache,
  2330. isUniqueByDependants = true,
  2331. i,
  2332. dependant,
  2333. map,
  2334. cache;
  2335. for (i = 0; i < dependants.length; i++) {
  2336. dependant = dependants[i];
  2337. // Can only compose WeakMap from object-like key.
  2338. if (!isObjectLike(dependant)) {
  2339. isUniqueByDependants = false;
  2340. break;
  2341. }
  2342. // Does current segment of cache already have a WeakMap?
  2343. if (caches.has(dependant)) {
  2344. // Traverse into nested WeakMap.
  2345. caches = caches.get(dependant);
  2346. } else {
  2347. // Create, set, and traverse into a new one.
  2348. map = new WeakMap();
  2349. caches.set(dependant, map);
  2350. caches = map;
  2351. }
  2352. }
  2353. // We use an arbitrary (but consistent) object as key for the last item
  2354. // in the WeakMap to serve as our running cache.
  2355. if (!caches.has(LEAF_KEY)) {
  2356. cache = createCache();
  2357. cache.isUniqueByDependants = isUniqueByDependants;
  2358. caches.set(LEAF_KEY, cache);
  2359. }
  2360. return caches.get(LEAF_KEY);
  2361. }
  2362. /**
  2363. * Resets root memoization cache.
  2364. */
  2365. function clear() {
  2366. rootCache = new WeakMap();
  2367. }
  2368. /* eslint-disable jsdoc/check-param-names */
  2369. /**
  2370. * The augmented selector call, considering first whether dependants have
  2371. * changed before passing it to underlying memoize function.
  2372. *
  2373. * @param {*} source Source object for derivation.
  2374. * @param {...*} extraArgs Additional arguments to pass to selector.
  2375. *
  2376. * @return {*} Selector result.
  2377. */
  2378. /* eslint-enable jsdoc/check-param-names */
  2379. function callSelector(/* source, ...extraArgs */) {
  2380. var len = arguments.length,
  2381. cache,
  2382. node,
  2383. i,
  2384. args,
  2385. dependants;
  2386. // Create copy of arguments (avoid leaking deoptimization).
  2387. args = new Array(len);
  2388. for (i = 0; i < len; i++) {
  2389. args[i] = arguments[i];
  2390. }
  2391. dependants = normalizedGetDependants.apply(null, args);
  2392. cache = getCache(dependants);
  2393. // If not guaranteed uniqueness by dependants (primitive type), shallow
  2394. // compare against last dependants and, if references have changed,
  2395. // destroy cache to recalculate result.
  2396. if (!cache.isUniqueByDependants) {
  2397. if (
  2398. cache.lastDependants &&
  2399. !isShallowEqual(dependants, cache.lastDependants, 0)
  2400. ) {
  2401. cache.clear();
  2402. }
  2403. cache.lastDependants = dependants;
  2404. }
  2405. node = cache.head;
  2406. while (node) {
  2407. // Check whether node arguments match arguments
  2408. if (!isShallowEqual(node.args, args, 1)) {
  2409. node = node.next;
  2410. continue;
  2411. }
  2412. // At this point we can assume we've found a match
  2413. // Surface matched node to head if not already
  2414. if (node !== cache.head) {
  2415. // Adjust siblings to point to each other.
  2416. /** @type {CacheNode} */ (node.prev).next = node.next;
  2417. if (node.next) {
  2418. node.next.prev = node.prev;
  2419. }
  2420. node.next = cache.head;
  2421. node.prev = null;
  2422. /** @type {CacheNode} */ (cache.head).prev = node;
  2423. cache.head = node;
  2424. }
  2425. // Return immediately
  2426. return node.val;
  2427. }
  2428. // No cached value found. Continue to insertion phase:
  2429. node = /** @type {CacheNode} */ ({
  2430. // Generate the result from original function
  2431. val: selector.apply(null, args),
  2432. });
  2433. // Avoid including the source object in the cache.
  2434. args[0] = null;
  2435. node.args = args;
  2436. // Don't need to check whether node is already head, since it would
  2437. // have been returned above already if it was
  2438. // Shift existing head down list
  2439. if (cache.head) {
  2440. cache.head.prev = node;
  2441. node.next = cache.head;
  2442. }
  2443. cache.head = node;
  2444. return node.val;
  2445. }
  2446. callSelector.getDependants = normalizedGetDependants;
  2447. callSelector.clear = clear;
  2448. clear();
  2449. return /** @type {S & EnhancedSelector} */ (callSelector);
  2450. }
  2451. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js
  2452. /**
  2453. * External dependencies
  2454. */
  2455. /**
  2456. * WordPress dependencies
  2457. */
  2458. const EMPTY_ARRAY = [];
  2459. const EMPTY_OBJECT = {};
  2460. /**
  2461. * Returns the current editing mode.
  2462. *
  2463. * @param {Object} state Global application state.
  2464. *
  2465. * @return {string} Editing mode.
  2466. */
  2467. const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2468. var _select$get;
  2469. return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual';
  2470. });
  2471. /**
  2472. * Returns true if the editor sidebar is opened.
  2473. *
  2474. * @param {Object} state Global application state
  2475. *
  2476. * @return {boolean} Whether the editor sidebar is opened.
  2477. */
  2478. const isEditorSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2479. const activeGeneralSidebar = select(store).getActiveComplementaryArea('core/edit-post');
  2480. return ['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar);
  2481. });
  2482. /**
  2483. * Returns true if the plugin sidebar is opened.
  2484. *
  2485. * @param {Object} state Global application state.
  2486. *
  2487. * @return {boolean} Whether the plugin sidebar is opened.
  2488. */
  2489. const isPluginSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2490. const activeGeneralSidebar = select(store).getActiveComplementaryArea('core/edit-post');
  2491. return !!activeGeneralSidebar && !['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar);
  2492. });
  2493. /**
  2494. * Returns the current active general sidebar name, or null if there is no
  2495. * general sidebar active. The active general sidebar is a unique name to
  2496. * identify either an editor or plugin sidebar.
  2497. *
  2498. * Examples:
  2499. *
  2500. * - `edit-post/document`
  2501. * - `my-plugin/insert-image-sidebar`
  2502. *
  2503. * @param {Object} state Global application state.
  2504. *
  2505. * @return {?string} Active general sidebar name.
  2506. */
  2507. const getActiveGeneralSidebarName = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2508. return select(store).getActiveComplementaryArea('core/edit-post');
  2509. });
  2510. /**
  2511. * Converts panels from the new preferences store format to the old format
  2512. * that the post editor previously used.
  2513. *
  2514. * The resultant converted data should look like this:
  2515. * {
  2516. * panelName: {
  2517. * enabled: false,
  2518. * opened: true,
  2519. * },
  2520. * anotherPanelName: {
  2521. * opened: true
  2522. * },
  2523. * }
  2524. *
  2525. * @param {string[] | undefined} inactivePanels An array of inactive panel names.
  2526. * @param {string[] | undefined} openPanels An array of open panel names.
  2527. *
  2528. * @return {Object} The converted panel data.
  2529. */
  2530. function convertPanelsToOldFormat(inactivePanels, openPanels) {
  2531. var _ref;
  2532. // First reduce the inactive panels.
  2533. const panelsWithEnabledState = inactivePanels === null || inactivePanels === void 0 ? void 0 : inactivePanels.reduce((accumulatedPanels, panelName) => ({ ...accumulatedPanels,
  2534. [panelName]: {
  2535. enabled: false
  2536. }
  2537. }), {}); // Then reduce the open panels, passing in the result of the previous
  2538. // reduction as the initial value so that both open and inactive
  2539. // panel state is combined.
  2540. const panels = openPanels === null || openPanels === void 0 ? void 0 : openPanels.reduce((accumulatedPanels, panelName) => {
  2541. const currentPanelState = accumulatedPanels === null || accumulatedPanels === void 0 ? void 0 : accumulatedPanels[panelName];
  2542. return { ...accumulatedPanels,
  2543. [panelName]: { ...currentPanelState,
  2544. opened: true
  2545. }
  2546. };
  2547. }, panelsWithEnabledState !== null && panelsWithEnabledState !== void 0 ? panelsWithEnabledState : {}); // The panels variable will only be set if openPanels wasn't `undefined`.
  2548. // If it isn't set just return `panelsWithEnabledState`, and if that isn't
  2549. // set return an empty object.
  2550. return (_ref = panels !== null && panels !== void 0 ? panels : panelsWithEnabledState) !== null && _ref !== void 0 ? _ref : EMPTY_OBJECT;
  2551. }
  2552. /**
  2553. * Returns the preferences (these preferences are persisted locally).
  2554. *
  2555. * @param {Object} state Global application state.
  2556. *
  2557. * @return {Object} Preferences Object.
  2558. */
  2559. const getPreferences = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2560. external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreferences`, {
  2561. since: '6.0',
  2562. alternative: `select( 'core/preferences' ).get`
  2563. }); // These preferences now exist in the preferences store.
  2564. // Fetch them so that they can be merged into the post
  2565. // editor preferences.
  2566. const preferences = ['hiddenBlockTypes', 'editorMode', 'preferredStyleVariations'].reduce((accumulatedPrefs, preferenceKey) => {
  2567. const value = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', preferenceKey);
  2568. return { ...accumulatedPrefs,
  2569. [preferenceKey]: value
  2570. };
  2571. }, {}); // Panels were a preference, but the data structure changed when the state
  2572. // was migrated to the preferences store. They need to be converted from
  2573. // the new preferences store format to old format to ensure no breaking
  2574. // changes for plugins.
  2575. const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels');
  2576. const openPanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels');
  2577. const panels = convertPanelsToOldFormat(inactivePanels, openPanels);
  2578. return { ...preferences,
  2579. panels
  2580. };
  2581. });
  2582. /**
  2583. *
  2584. * @param {Object} state Global application state.
  2585. * @param {string} preferenceKey Preference Key.
  2586. * @param {*} defaultValue Default Value.
  2587. *
  2588. * @return {*} Preference Value.
  2589. */
  2590. function getPreference(state, preferenceKey, defaultValue) {
  2591. external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreference`, {
  2592. since: '6.0',
  2593. alternative: `select( 'core/preferences' ).get`
  2594. }); // Avoid using the `getPreferences` registry selector where possible.
  2595. const preferences = getPreferences(state);
  2596. const value = preferences[preferenceKey];
  2597. return value === undefined ? defaultValue : value;
  2598. }
  2599. /**
  2600. * Returns an array of blocks that are hidden.
  2601. *
  2602. * @return {Array} A list of the hidden block types
  2603. */
  2604. const getHiddenBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2605. var _select$get2;
  2606. return (_select$get2 = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY;
  2607. });
  2608. /**
  2609. * Returns true if the publish sidebar is opened.
  2610. *
  2611. * @param {Object} state Global application state
  2612. *
  2613. * @return {boolean} Whether the publish sidebar is open.
  2614. */
  2615. function isPublishSidebarOpened(state) {
  2616. return state.publishSidebarActive;
  2617. }
  2618. /**
  2619. * Returns true if the given panel was programmatically removed, or false otherwise.
  2620. * All panels are not removed by default.
  2621. *
  2622. * @param {Object} state Global application state.
  2623. * @param {string} panelName A string that identifies the panel.
  2624. *
  2625. * @return {boolean} Whether or not the panel is removed.
  2626. */
  2627. function isEditorPanelRemoved(state, panelName) {
  2628. return state.removedPanels.includes(panelName);
  2629. }
  2630. /**
  2631. * Returns true if the given panel is enabled, or false otherwise. Panels are
  2632. * enabled by default.
  2633. *
  2634. * @param {Object} state Global application state.
  2635. * @param {string} panelName A string that identifies the panel.
  2636. *
  2637. * @return {boolean} Whether or not the panel is enabled.
  2638. */
  2639. const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => {
  2640. const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels');
  2641. return !isEditorPanelRemoved(state, panelName) && !(inactivePanels !== null && inactivePanels !== void 0 && inactivePanels.includes(panelName));
  2642. });
  2643. /**
  2644. * Returns true if the given panel is open, or false otherwise. Panels are
  2645. * closed by default.
  2646. *
  2647. * @param {Object} state Global application state.
  2648. * @param {string} panelName A string that identifies the panel.
  2649. *
  2650. * @return {boolean} Whether or not the panel is open.
  2651. */
  2652. const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => {
  2653. const openPanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels');
  2654. return !!(openPanels !== null && openPanels !== void 0 && openPanels.includes(panelName));
  2655. });
  2656. /**
  2657. * Returns true if a modal is active, or false otherwise.
  2658. *
  2659. * @param {Object} state Global application state.
  2660. * @param {string} modalName A string that uniquely identifies the modal.
  2661. *
  2662. * @return {boolean} Whether the modal is active.
  2663. */
  2664. function isModalActive(state, modalName) {
  2665. return state.activeModal === modalName;
  2666. }
  2667. /**
  2668. * Returns whether the given feature is enabled or not.
  2669. *
  2670. * @param {Object} state Global application state.
  2671. * @param {string} feature Feature slug.
  2672. *
  2673. * @return {boolean} Is active.
  2674. */
  2675. const selectors_isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, feature) => {
  2676. return !!select(external_wp_preferences_namespaceObject.store).get('core/edit-post', feature);
  2677. });
  2678. /**
  2679. * Returns true if the plugin item is pinned to the header.
  2680. * When the value is not set it defaults to true.
  2681. *
  2682. * @param {Object} state Global application state.
  2683. * @param {string} pluginName Plugin item name.
  2684. *
  2685. * @return {boolean} Whether the plugin item is pinned.
  2686. */
  2687. const isPluginItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, pluginName) => {
  2688. return select(store).isItemPinned('core/edit-post', pluginName);
  2689. });
  2690. /**
  2691. * Returns an array of active meta box locations.
  2692. *
  2693. * @param {Object} state Post editor state.
  2694. *
  2695. * @return {string[]} Active meta box locations.
  2696. */
  2697. const getActiveMetaBoxLocations = rememo(state => {
  2698. return Object.keys(state.metaBoxes.locations).filter(location => isMetaBoxLocationActive(state, location));
  2699. }, state => [state.metaBoxes.locations]);
  2700. /**
  2701. * Returns true if a metabox location is active and visible
  2702. *
  2703. * @param {Object} state Post editor state.
  2704. * @param {string} location Meta box location to test.
  2705. *
  2706. * @return {boolean} Whether the meta box location is active and visible.
  2707. */
  2708. function isMetaBoxLocationVisible(state, location) {
  2709. var _getMetaBoxesPerLocat;
  2710. return isMetaBoxLocationActive(state, location) && ((_getMetaBoxesPerLocat = getMetaBoxesPerLocation(state, location)) === null || _getMetaBoxesPerLocat === void 0 ? void 0 : _getMetaBoxesPerLocat.some(_ref2 => {
  2711. let {
  2712. id
  2713. } = _ref2;
  2714. return isEditorPanelEnabled(state, `meta-box-${id}`);
  2715. }));
  2716. }
  2717. /**
  2718. * Returns true if there is an active meta box in the given location, or false
  2719. * otherwise.
  2720. *
  2721. * @param {Object} state Post editor state.
  2722. * @param {string} location Meta box location to test.
  2723. *
  2724. * @return {boolean} Whether the meta box location is active.
  2725. */
  2726. function isMetaBoxLocationActive(state, location) {
  2727. const metaBoxes = getMetaBoxesPerLocation(state, location);
  2728. return !!metaBoxes && metaBoxes.length !== 0;
  2729. }
  2730. /**
  2731. * Returns the list of all the available meta boxes for a given location.
  2732. *
  2733. * @param {Object} state Global application state.
  2734. * @param {string} location Meta box location to test.
  2735. *
  2736. * @return {?Array} List of meta boxes.
  2737. */
  2738. function getMetaBoxesPerLocation(state, location) {
  2739. return state.metaBoxes.locations[location];
  2740. }
  2741. /**
  2742. * Returns the list of all the available meta boxes.
  2743. *
  2744. * @param {Object} state Global application state.
  2745. *
  2746. * @return {Array} List of meta boxes.
  2747. */
  2748. const getAllMetaBoxes = rememo(state => {
  2749. return Object.values(state.metaBoxes.locations).flat();
  2750. }, state => [state.metaBoxes.locations]);
  2751. /**
  2752. * Returns true if the post is using Meta Boxes
  2753. *
  2754. * @param {Object} state Global application state
  2755. *
  2756. * @return {boolean} Whether there are metaboxes or not.
  2757. */
  2758. function hasMetaBoxes(state) {
  2759. return getActiveMetaBoxLocations(state).length > 0;
  2760. }
  2761. /**
  2762. * Returns true if the Meta Boxes are being saved.
  2763. *
  2764. * @param {Object} state Global application state.
  2765. *
  2766. * @return {boolean} Whether the metaboxes are being saved.
  2767. */
  2768. function selectors_isSavingMetaBoxes(state) {
  2769. return state.metaBoxes.isSaving;
  2770. }
  2771. /**
  2772. * Returns the current editing canvas device type.
  2773. *
  2774. * @param {Object} state Global application state.
  2775. *
  2776. * @return {string} Device type.
  2777. */
  2778. function __experimentalGetPreviewDeviceType(state) {
  2779. return state.deviceType;
  2780. }
  2781. /**
  2782. * Returns true if the inserter is opened.
  2783. *
  2784. * @param {Object} state Global application state.
  2785. *
  2786. * @return {boolean} Whether the inserter is opened.
  2787. */
  2788. function isInserterOpened(state) {
  2789. return !!state.blockInserterPanel;
  2790. }
  2791. /**
  2792. * Get the insertion point for the inserter.
  2793. *
  2794. * @param {Object} state Global application state.
  2795. *
  2796. * @return {Object} The root client ID, index to insert at and starting filter value.
  2797. */
  2798. function __experimentalGetInsertionPoint(state) {
  2799. const {
  2800. rootClientId,
  2801. insertionIndex,
  2802. filterValue
  2803. } = state.blockInserterPanel;
  2804. return {
  2805. rootClientId,
  2806. insertionIndex,
  2807. filterValue
  2808. };
  2809. }
  2810. /**
  2811. * Returns true if the list view is opened.
  2812. *
  2813. * @param {Object} state Global application state.
  2814. *
  2815. * @return {boolean} Whether the list view is opened.
  2816. */
  2817. function isListViewOpened(state) {
  2818. return state.listViewPanel;
  2819. }
  2820. /**
  2821. * Returns true if the template editing mode is enabled.
  2822. *
  2823. * @param {Object} state Global application state.
  2824. *
  2825. * @return {boolean} Whether we're editing the template.
  2826. */
  2827. function selectors_isEditingTemplate(state) {
  2828. return state.isEditingTemplate;
  2829. }
  2830. /**
  2831. * Returns true if meta boxes are initialized.
  2832. *
  2833. * @param {Object} state Global application state.
  2834. *
  2835. * @return {boolean} Whether meta boxes are initialized.
  2836. */
  2837. function areMetaBoxesInitialized(state) {
  2838. return state.metaBoxes.initialized;
  2839. }
  2840. /**
  2841. * Retrieves the template of the currently edited post.
  2842. *
  2843. * @return {Object?} Post Template.
  2844. */
  2845. const getEditedPostTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2846. const currentTemplate = select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template');
  2847. if (currentTemplate) {
  2848. var _select$getEntityReco;
  2849. const templateWithSameSlug = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', {
  2850. per_page: -1
  2851. })) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.find(template => template.slug === currentTemplate);
  2852. if (!templateWithSameSlug) {
  2853. return templateWithSameSlug;
  2854. }
  2855. return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', templateWithSameSlug.id);
  2856. }
  2857. const post = select(external_wp_editor_namespaceObject.store).getCurrentPost();
  2858. if (post.link) {
  2859. return select(external_wp_coreData_namespaceObject.store).__experimentalGetTemplateForLink(post.link);
  2860. }
  2861. return null;
  2862. });
  2863. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/constants.js
  2864. /**
  2865. * The identifier for the data store.
  2866. *
  2867. * @type {string}
  2868. */
  2869. const constants_STORE_NAME = 'core/edit-post';
  2870. /**
  2871. * CSS selector string for the admin bar view post link anchor tag.
  2872. *
  2873. * @type {string}
  2874. */
  2875. const VIEW_AS_LINK_SELECTOR = '#wp-admin-bar-view a';
  2876. /**
  2877. * CSS selector string for the admin bar preview post link anchor tag.
  2878. *
  2879. * @type {string}
  2880. */
  2881. const VIEW_AS_PREVIEW_LINK_SELECTOR = '#wp-admin-bar-preview a';
  2882. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/index.js
  2883. /**
  2884. * WordPress dependencies
  2885. */
  2886. /**
  2887. * Internal dependencies
  2888. */
  2889. /**
  2890. * Store definition for the edit post namespace.
  2891. *
  2892. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  2893. *
  2894. * @type {Object}
  2895. */
  2896. const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, {
  2897. reducer: reducer,
  2898. actions: store_actions_namespaceObject,
  2899. selectors: store_selectors_namespaceObject
  2900. });
  2901. (0,external_wp_data_namespaceObject.register)(store_store);
  2902. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js
  2903. /**
  2904. * WordPress dependencies
  2905. */
  2906. /**
  2907. * Internal dependencies
  2908. */
  2909. function KeyboardShortcutsHelpMenuItem(_ref) {
  2910. let {
  2911. openModal
  2912. } = _ref;
  2913. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  2914. onClick: () => {
  2915. openModal('edit-post/keyboard-shortcut-help');
  2916. },
  2917. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h')
  2918. }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'));
  2919. }
  2920. /* harmony default export */ var keyboard_shortcuts_help_menu_item = ((0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  2921. const {
  2922. openModal
  2923. } = dispatch(store_store);
  2924. return {
  2925. openModal
  2926. };
  2927. })(KeyboardShortcutsHelpMenuItem));
  2928. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/tools-more-menu-group/index.js
  2929. /**
  2930. * External dependencies
  2931. */
  2932. /**
  2933. * WordPress dependencies
  2934. */
  2935. const {
  2936. Fill: ToolsMoreMenuGroup,
  2937. Slot
  2938. } = (0,external_wp_components_namespaceObject.createSlotFill)('ToolsMoreMenuGroup');
  2939. ToolsMoreMenuGroup.Slot = _ref => {
  2940. let {
  2941. fillProps
  2942. } = _ref;
  2943. return (0,external_wp_element_namespaceObject.createElement)(Slot, {
  2944. fillProps: fillProps
  2945. }, fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  2946. label: (0,external_wp_i18n_namespaceObject.__)('Tools')
  2947. }, fills));
  2948. };
  2949. /* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup);
  2950. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/welcome-guide-menu-item/index.js
  2951. /**
  2952. * WordPress dependencies
  2953. */
  2954. /**
  2955. * Internal dependencies
  2956. */
  2957. function WelcomeGuideMenuItem() {
  2958. const isTemplateMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isEditingTemplate(), []);
  2959. return (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  2960. scope: "core/edit-post",
  2961. name: isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide',
  2962. label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')
  2963. });
  2964. }
  2965. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/index.js
  2966. /**
  2967. * WordPress dependencies
  2968. */
  2969. /**
  2970. * Internal dependencies
  2971. */
  2972. (0,external_wp_plugins_namespaceObject.registerPlugin)('edit-post', {
  2973. render() {
  2974. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group, null, _ref => {
  2975. let {
  2976. onClose
  2977. } = _ref;
  2978. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  2979. role: "menuitem",
  2980. href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
  2981. post_type: 'wp_block'
  2982. })
  2983. }, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks')), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts_help_menu_item, {
  2984. onSelect: onClose
  2985. }), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(CopyContentMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  2986. role: "menuitem",
  2987. icon: library_external,
  2988. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/'),
  2989. target: "_blank",
  2990. rel: "noopener noreferrer"
  2991. }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  2992. as: "span"
  2993. },
  2994. /* translators: accessibility text */
  2995. (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))));
  2996. }));
  2997. }
  2998. });
  2999. ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
  3000. var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
  3001. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/text-editor/index.js
  3002. /**
  3003. * WordPress dependencies
  3004. */
  3005. /**
  3006. * Internal dependencies
  3007. */
  3008. function TextEditor() {
  3009. const isRichEditingEnabled = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3010. return select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled;
  3011. }, []);
  3012. const {
  3013. switchEditorMode
  3014. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3015. return (0,external_wp_element_namespaceObject.createElement)("div", {
  3016. className: "edit-post-text-editor"
  3017. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.TextEditorGlobalKeyboardShortcuts, null), isRichEditingEnabled && (0,external_wp_element_namespaceObject.createElement)("div", {
  3018. className: "edit-post-text-editor__toolbar"
  3019. }, (0,external_wp_element_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  3020. variant: "tertiary",
  3021. onClick: () => switchEditorMode('visual'),
  3022. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('m')
  3023. }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor'))), (0,external_wp_element_namespaceObject.createElement)("div", {
  3024. className: "edit-post-text-editor__body"
  3025. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitle, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTextEditor, null)));
  3026. }
  3027. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js
  3028. /**
  3029. * WordPress dependencies
  3030. */
  3031. const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  3032. xmlns: "http://www.w3.org/2000/svg",
  3033. viewBox: "0 0 24 24"
  3034. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  3035. d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"
  3036. }));
  3037. /* harmony default export */ var arrow_left = (arrowLeft);
  3038. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/visual-editor/block-inspector-button.js
  3039. /**
  3040. * WordPress dependencies
  3041. */
  3042. /**
  3043. * Internal dependencies
  3044. */
  3045. const block_inspector_button_noop = () => {};
  3046. function BlockInspectorButton(_ref) {
  3047. let {
  3048. onClick = block_inspector_button_noop,
  3049. small = false
  3050. } = _ref;
  3051. const {
  3052. shortcut,
  3053. areAdvancedSettingsOpened
  3054. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  3055. shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'),
  3056. areAdvancedSettingsOpened: select(store_store).getActiveGeneralSidebarName() === 'edit-post/block'
  3057. }), []);
  3058. const {
  3059. openGeneralSidebar,
  3060. closeGeneralSidebar
  3061. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3062. const label = areAdvancedSettingsOpened ? (0,external_wp_i18n_namespaceObject.__)('Hide more settings') : (0,external_wp_i18n_namespaceObject.__)('Show more settings');
  3063. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  3064. onClick: () => {
  3065. if (areAdvancedSettingsOpened) {
  3066. closeGeneralSidebar();
  3067. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Block settings closed'));
  3068. } else {
  3069. openGeneralSidebar('edit-post/block');
  3070. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Additional settings are now available in the Editor block settings sidebar'));
  3071. }
  3072. onClick();
  3073. },
  3074. shortcut: shortcut
  3075. }, !small && label);
  3076. }
  3077. /* harmony default export */ var block_inspector_button = (BlockInspectorButton);
  3078. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/visual-editor/index.js
  3079. /**
  3080. * External dependencies
  3081. */
  3082. /**
  3083. * WordPress dependencies
  3084. */
  3085. /**
  3086. * Internal dependencies
  3087. */
  3088. function MaybeIframe(_ref) {
  3089. let {
  3090. children,
  3091. contentRef,
  3092. shouldIframe,
  3093. styles,
  3094. assets,
  3095. style
  3096. } = _ref;
  3097. const ref = (0,external_wp_blockEditor_namespaceObject.__unstableUseMouseMoveTypingReset)();
  3098. if (!shouldIframe) {
  3099. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
  3100. styles: styles
  3101. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.WritingFlow, {
  3102. ref: contentRef,
  3103. className: "editor-styles-wrapper",
  3104. style: {
  3105. flex: '1',
  3106. ...style
  3107. },
  3108. tabIndex: -1
  3109. }, children));
  3110. }
  3111. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
  3112. head: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
  3113. styles: styles
  3114. }),
  3115. assets: assets,
  3116. ref: ref,
  3117. contentRef: contentRef,
  3118. style: {
  3119. width: '100%',
  3120. height: '100%',
  3121. display: 'block'
  3122. },
  3123. name: "editor-canvas"
  3124. }, children);
  3125. }
  3126. /**
  3127. * Given an array of nested blocks, find the first Post Content
  3128. * block inside it, recursing through any nesting levels.
  3129. *
  3130. * @param {Array} blocks A list of blocks.
  3131. *
  3132. * @return {Object} The Post Content block.
  3133. */
  3134. function findPostContent(blocks) {
  3135. for (let i = 0; i < blocks.length; i++) {
  3136. if (blocks[i].name === 'core/post-content') {
  3137. return blocks[i];
  3138. }
  3139. if (blocks[i].innerBlocks.length) {
  3140. const nestedPostContent = findPostContent(blocks[i].innerBlocks);
  3141. if (nestedPostContent) {
  3142. return nestedPostContent;
  3143. }
  3144. }
  3145. }
  3146. }
  3147. function VisualEditor(_ref2) {
  3148. var _postContentBlock$att;
  3149. let {
  3150. styles
  3151. } = _ref2;
  3152. const {
  3153. deviceType,
  3154. isWelcomeGuideVisible,
  3155. isTemplateMode,
  3156. editedPostTemplate = {},
  3157. wrapperBlockName,
  3158. wrapperUniqueId
  3159. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3160. const {
  3161. isFeatureActive,
  3162. isEditingTemplate,
  3163. __experimentalGetPreviewDeviceType,
  3164. getEditedPostTemplate
  3165. } = select(store_store);
  3166. const {
  3167. getCurrentPostId,
  3168. getCurrentPostType,
  3169. getEditorSettings
  3170. } = select(external_wp_editor_namespaceObject.store);
  3171. const _isTemplateMode = isEditingTemplate();
  3172. let _wrapperBlockName;
  3173. if (getCurrentPostType() === 'wp_block') {
  3174. _wrapperBlockName = 'core/block';
  3175. } else if (!_isTemplateMode) {
  3176. _wrapperBlockName = 'core/post-content';
  3177. }
  3178. const supportsTemplateMode = getEditorSettings().supportsTemplateMode;
  3179. return {
  3180. deviceType: __experimentalGetPreviewDeviceType(),
  3181. isWelcomeGuideVisible: isFeatureActive('welcomeGuide'),
  3182. isTemplateMode: _isTemplateMode,
  3183. // Post template fetch returns a 404 on classic themes, which
  3184. // messes with e2e tests, so we check it's a block theme first.
  3185. editedPostTemplate: supportsTemplateMode ? getEditedPostTemplate() : {},
  3186. wrapperBlockName: _wrapperBlockName,
  3187. wrapperUniqueId: getCurrentPostId()
  3188. };
  3189. }, []);
  3190. const {
  3191. isCleanNewPost
  3192. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store);
  3193. const hasMetaBoxes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasMetaBoxes(), []);
  3194. const {
  3195. themeHasDisabledLayoutStyles,
  3196. themeSupportsLayout,
  3197. assets
  3198. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3199. const _settings = select(external_wp_blockEditor_namespaceObject.store).getSettings();
  3200. return {
  3201. themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
  3202. themeSupportsLayout: _settings.supportsLayout,
  3203. assets: _settings.__unstableResolvedAssets
  3204. };
  3205. }, []);
  3206. const {
  3207. clearSelectedBlock
  3208. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  3209. const {
  3210. setIsEditingTemplate
  3211. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3212. const desktopCanvasStyles = {
  3213. height: '100%',
  3214. width: '100%',
  3215. margin: 0,
  3216. display: 'flex',
  3217. flexFlow: 'column',
  3218. // Default background color so that grey
  3219. // .edit-post-editor-regions__content color doesn't show through.
  3220. background: 'white'
  3221. };
  3222. const templateModeStyles = { ...desktopCanvasStyles,
  3223. borderRadius: '2px 2px 0 0',
  3224. border: '1px solid #ddd',
  3225. borderBottom: 0
  3226. };
  3227. const resizedCanvasStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType, isTemplateMode);
  3228. const globalLayoutSettings = (0,external_wp_blockEditor_namespaceObject.useSetting)('layout');
  3229. const previewMode = 'is-' + deviceType.toLowerCase() + '-preview';
  3230. let animatedStyles = isTemplateMode ? templateModeStyles : desktopCanvasStyles;
  3231. if (resizedCanvasStyles) {
  3232. animatedStyles = resizedCanvasStyles;
  3233. }
  3234. let paddingBottom; // Add a constant padding for the typewritter effect. When typing at the
  3235. // bottom, there needs to be room to scroll up.
  3236. if (!hasMetaBoxes && !resizedCanvasStyles && !isTemplateMode) {
  3237. paddingBottom = '40vh';
  3238. }
  3239. const ref = (0,external_wp_element_namespaceObject.useRef)();
  3240. const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_blockEditor_namespaceObject.__unstableUseClipboardHandler)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseTypewriter)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseBlockSelectionClearer)()]);
  3241. const blockSelectionClearerRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseBlockSelectionClearer)(); // fallbackLayout is used if there is no Post Content,
  3242. // and for Post Title.
  3243. const fallbackLayout = (0,external_wp_element_namespaceObject.useMemo)(() => {
  3244. if (isTemplateMode) {
  3245. return {
  3246. type: 'default'
  3247. };
  3248. }
  3249. if (themeSupportsLayout) {
  3250. // We need to ensure support for wide and full alignments,
  3251. // so we add the constrained type.
  3252. return { ...globalLayoutSettings,
  3253. type: 'constrained'
  3254. };
  3255. } // Set default layout for classic themes so all alignments are supported.
  3256. return {
  3257. type: 'default'
  3258. };
  3259. }, [isTemplateMode, themeSupportsLayout, globalLayoutSettings]);
  3260. const postContentBlock = (0,external_wp_element_namespaceObject.useMemo)(() => {
  3261. // When in template editing mode, we can access the blocks directly.
  3262. if (editedPostTemplate !== null && editedPostTemplate !== void 0 && editedPostTemplate.blocks) {
  3263. return findPostContent(editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.blocks);
  3264. } // If there are no blocks, we have to parse the content string.
  3265. // Best double-check it's a string otherwise the parse function gets unhappy.
  3266. const parseableContent = typeof (editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.content) === 'string' ? editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.content : '';
  3267. return findPostContent((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || {};
  3268. }, [editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.content, editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.blocks]);
  3269. const postContentLayoutClasses = (0,external_wp_blockEditor_namespaceObject.__experimentaluseLayoutClasses)(postContentBlock);
  3270. const blockListLayoutClass = classnames_default()({
  3271. 'is-layout-flow': !themeSupportsLayout
  3272. }, themeSupportsLayout && postContentLayoutClasses);
  3273. const postContentLayoutStyles = (0,external_wp_blockEditor_namespaceObject.__experimentaluseLayoutStyles)(postContentBlock, '.block-editor-block-list__layout.is-root-container');
  3274. const layout = (postContentBlock === null || postContentBlock === void 0 ? void 0 : (_postContentBlock$att = postContentBlock.attributes) === null || _postContentBlock$att === void 0 ? void 0 : _postContentBlock$att.layout) || {}; // Update type for blocks using legacy layouts.
  3275. const postContentLayout = (0,external_wp_element_namespaceObject.useMemo)(() => {
  3276. return layout && ((layout === null || layout === void 0 ? void 0 : layout.type) === 'constrained' || layout !== null && layout !== void 0 && layout.inherit || layout !== null && layout !== void 0 && layout.contentSize || layout !== null && layout !== void 0 && layout.wideSize) ? { ...globalLayoutSettings,
  3277. ...layout,
  3278. type: 'constrained'
  3279. } : { ...globalLayoutSettings,
  3280. ...layout,
  3281. type: 'default'
  3282. };
  3283. }, [layout === null || layout === void 0 ? void 0 : layout.type, layout === null || layout === void 0 ? void 0 : layout.inherit, layout === null || layout === void 0 ? void 0 : layout.contentSize, layout === null || layout === void 0 ? void 0 : layout.wideSize, globalLayoutSettings]); // If there is a Post Content block we use its layout for the block list;
  3284. // if not, this must be a classic theme, in which case we use the fallback layout.
  3285. const blockListLayout = postContentBlock ? postContentLayout : fallbackLayout;
  3286. const titleRef = (0,external_wp_element_namespaceObject.useRef)();
  3287. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3288. var _titleRef$current;
  3289. if (isWelcomeGuideVisible || !isCleanNewPost()) {
  3290. return;
  3291. }
  3292. titleRef === null || titleRef === void 0 ? void 0 : (_titleRef$current = titleRef.current) === null || _titleRef$current === void 0 ? void 0 : _titleRef$current.focus();
  3293. }, [isWelcomeGuideVisible, isCleanNewPost]);
  3294. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, {
  3295. __unstableContentRef: ref,
  3296. className: classnames_default()('edit-post-visual-editor', {
  3297. 'is-template-mode': isTemplateMode
  3298. })
  3299. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.VisualEditorGlobalKeyboardShortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
  3300. className: "edit-post-visual-editor__content-area",
  3301. animate: {
  3302. padding: isTemplateMode ? '48px 48px 0' : '0'
  3303. },
  3304. ref: blockSelectionClearerRef
  3305. }, isTemplateMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  3306. className: "edit-post-visual-editor__exit-template-mode",
  3307. icon: arrow_left,
  3308. onClick: () => {
  3309. clearSelectedBlock();
  3310. setIsEditingTemplate(false);
  3311. }
  3312. }, (0,external_wp_i18n_namespaceObject.__)('Back')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
  3313. animate: animatedStyles,
  3314. initial: desktopCanvasStyles,
  3315. className: previewMode
  3316. }, (0,external_wp_element_namespaceObject.createElement)(MaybeIframe, {
  3317. shouldIframe: isTemplateMode || deviceType === 'Tablet' || deviceType === 'Mobile',
  3318. contentRef: contentRef,
  3319. styles: styles,
  3320. assets: assets,
  3321. style: {
  3322. paddingBottom
  3323. }
  3324. }, themeSupportsLayout && !themeHasDisabledLayoutStyles && !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLayoutStyle, {
  3325. selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",
  3326. layout: fallbackLayout,
  3327. layoutDefinitions: globalLayoutSettings === null || globalLayoutSettings === void 0 ? void 0 : globalLayoutSettings.definitions
  3328. }), postContentLayoutStyles && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLayoutStyle, {
  3329. layout: postContentLayout,
  3330. css: postContentLayoutStyles,
  3331. layoutDefinitions: globalLayoutSettings === null || globalLayoutSettings === void 0 ? void 0 : globalLayoutSettings.definitions
  3332. })), !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", {
  3333. className: "edit-post-visual-editor__post-title-wrapper",
  3334. contentEditable: false
  3335. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitle, {
  3336. ref: titleRef
  3337. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalRecursionProvider, {
  3338. blockName: wrapperBlockName,
  3339. uniqueId: wrapperUniqueId
  3340. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
  3341. className: isTemplateMode ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
  3342. ,
  3343. __experimentalLayout: blockListLayout
  3344. }))))), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref3 => {
  3345. let {
  3346. onClose
  3347. } = _ref3;
  3348. return (0,external_wp_element_namespaceObject.createElement)(block_inspector_button, {
  3349. onClick: onClose
  3350. });
  3351. }));
  3352. }
  3353. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcuts/index.js
  3354. /**
  3355. * WordPress dependencies
  3356. */
  3357. /**
  3358. * Internal dependencies
  3359. */
  3360. function KeyboardShortcuts() {
  3361. const {
  3362. getBlockSelectionStart
  3363. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
  3364. const {
  3365. getEditorMode,
  3366. isEditorSidebarOpened,
  3367. isListViewOpened
  3368. } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
  3369. const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3370. const {
  3371. richEditingEnabled,
  3372. codeEditingEnabled
  3373. } = select(external_wp_editor_namespaceObject.store).getEditorSettings();
  3374. return !richEditingEnabled || !codeEditingEnabled;
  3375. }, []);
  3376. const {
  3377. switchEditorMode,
  3378. openGeneralSidebar,
  3379. closeGeneralSidebar,
  3380. toggleFeature,
  3381. setIsListViewOpened
  3382. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3383. const {
  3384. registerShortcut
  3385. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
  3386. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3387. registerShortcut({
  3388. name: 'core/edit-post/toggle-mode',
  3389. category: 'global',
  3390. description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'),
  3391. keyCombination: {
  3392. modifier: 'secondary',
  3393. character: 'm'
  3394. }
  3395. });
  3396. registerShortcut({
  3397. name: 'core/edit-post/toggle-fullscreen',
  3398. category: 'global',
  3399. description: (0,external_wp_i18n_namespaceObject.__)('Toggle fullscreen mode.'),
  3400. keyCombination: {
  3401. modifier: 'secondary',
  3402. character: 'f'
  3403. }
  3404. });
  3405. registerShortcut({
  3406. name: 'core/edit-post/toggle-list-view',
  3407. category: 'global',
  3408. description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'),
  3409. keyCombination: {
  3410. modifier: 'access',
  3411. character: 'o'
  3412. }
  3413. });
  3414. registerShortcut({
  3415. name: 'core/edit-post/toggle-sidebar',
  3416. category: 'global',
  3417. description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the settings sidebar.'),
  3418. keyCombination: {
  3419. modifier: 'primaryShift',
  3420. character: ','
  3421. }
  3422. });
  3423. registerShortcut({
  3424. name: 'core/edit-post/next-region',
  3425. category: 'global',
  3426. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
  3427. keyCombination: {
  3428. modifier: 'ctrl',
  3429. character: '`'
  3430. },
  3431. aliases: [{
  3432. modifier: 'access',
  3433. character: 'n'
  3434. }]
  3435. });
  3436. registerShortcut({
  3437. name: 'core/edit-post/previous-region',
  3438. category: 'global',
  3439. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
  3440. keyCombination: {
  3441. modifier: 'ctrlShift',
  3442. character: '`'
  3443. },
  3444. aliases: [{
  3445. modifier: 'access',
  3446. character: 'p'
  3447. }]
  3448. });
  3449. registerShortcut({
  3450. name: 'core/edit-post/keyboard-shortcuts',
  3451. category: 'main',
  3452. description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
  3453. keyCombination: {
  3454. modifier: 'access',
  3455. character: 'h'
  3456. }
  3457. });
  3458. }, []);
  3459. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-mode', () => {
  3460. switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual');
  3461. }, {
  3462. isDisabled: isModeToggleDisabled
  3463. });
  3464. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-fullscreen', () => {
  3465. toggleFeature('fullscreenMode');
  3466. });
  3467. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-sidebar', event => {
  3468. // This shortcut has no known clashes, but use preventDefault to prevent any
  3469. // obscure shortcuts from triggering.
  3470. event.preventDefault();
  3471. if (isEditorSidebarOpened()) {
  3472. closeGeneralSidebar();
  3473. } else {
  3474. const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document';
  3475. openGeneralSidebar(sidebarToOpen);
  3476. }
  3477. });
  3478. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-list-view', () => setIsListViewOpened(!isListViewOpened()));
  3479. return null;
  3480. }
  3481. /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
  3482. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/config.js
  3483. /**
  3484. * WordPress dependencies
  3485. */
  3486. const textFormattingShortcuts = [{
  3487. keyCombination: {
  3488. modifier: 'primary',
  3489. character: 'b'
  3490. },
  3491. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
  3492. }, {
  3493. keyCombination: {
  3494. modifier: 'primary',
  3495. character: 'i'
  3496. },
  3497. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
  3498. }, {
  3499. keyCombination: {
  3500. modifier: 'primary',
  3501. character: 'k'
  3502. },
  3503. description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
  3504. }, {
  3505. keyCombination: {
  3506. modifier: 'primaryShift',
  3507. character: 'k'
  3508. },
  3509. description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
  3510. }, {
  3511. keyCombination: {
  3512. character: '[['
  3513. },
  3514. description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page')
  3515. }, {
  3516. keyCombination: {
  3517. modifier: 'primary',
  3518. character: 'u'
  3519. },
  3520. description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
  3521. }, {
  3522. keyCombination: {
  3523. modifier: 'access',
  3524. character: 'd'
  3525. },
  3526. description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.')
  3527. }, {
  3528. keyCombination: {
  3529. modifier: 'access',
  3530. character: 'x'
  3531. },
  3532. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.')
  3533. }];
  3534. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/shortcut.js
  3535. /**
  3536. * External dependencies
  3537. */
  3538. /**
  3539. * WordPress dependencies
  3540. */
  3541. function KeyCombination(_ref) {
  3542. let {
  3543. keyCombination,
  3544. forceAriaLabel
  3545. } = _ref;
  3546. const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  3547. const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  3548. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  3549. className: "edit-post-keyboard-shortcut-help-modal__shortcut-key-combination",
  3550. "aria-label": forceAriaLabel || ariaLabel
  3551. }, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => {
  3552. if (character === '+') {
  3553. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
  3554. key: index
  3555. }, character);
  3556. }
  3557. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  3558. key: index,
  3559. className: "edit-post-keyboard-shortcut-help-modal__shortcut-key"
  3560. }, character);
  3561. }));
  3562. }
  3563. function Shortcut(_ref2) {
  3564. let {
  3565. description,
  3566. keyCombination,
  3567. aliases = [],
  3568. ariaLabel
  3569. } = _ref2;
  3570. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  3571. className: "edit-post-keyboard-shortcut-help-modal__shortcut-description"
  3572. }, description), (0,external_wp_element_namespaceObject.createElement)("div", {
  3573. className: "edit-post-keyboard-shortcut-help-modal__shortcut-term"
  3574. }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  3575. keyCombination: keyCombination,
  3576. forceAriaLabel: ariaLabel
  3577. }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  3578. keyCombination: alias,
  3579. forceAriaLabel: ariaLabel,
  3580. key: index
  3581. }))));
  3582. }
  3583. /* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut);
  3584. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
  3585. /**
  3586. * WordPress dependencies
  3587. */
  3588. /**
  3589. * Internal dependencies
  3590. */
  3591. function DynamicShortcut(_ref) {
  3592. let {
  3593. name
  3594. } = _ref;
  3595. const {
  3596. keyCombination,
  3597. description,
  3598. aliases
  3599. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3600. const {
  3601. getShortcutKeyCombination,
  3602. getShortcutDescription,
  3603. getShortcutAliases
  3604. } = select(external_wp_keyboardShortcuts_namespaceObject.store);
  3605. return {
  3606. keyCombination: getShortcutKeyCombination(name),
  3607. aliases: getShortcutAliases(name),
  3608. description: getShortcutDescription(name)
  3609. };
  3610. }, [name]);
  3611. if (!keyCombination) {
  3612. return null;
  3613. }
  3614. return (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, {
  3615. keyCombination: keyCombination,
  3616. description: description,
  3617. aliases: aliases
  3618. });
  3619. }
  3620. /* harmony default export */ var dynamic_shortcut = (DynamicShortcut);
  3621. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/index.js
  3622. /**
  3623. * External dependencies
  3624. */
  3625. /**
  3626. * WordPress dependencies
  3627. */
  3628. /**
  3629. * Internal dependencies
  3630. */
  3631. const MODAL_NAME = 'edit-post/keyboard-shortcut-help';
  3632. const ShortcutList = _ref => {
  3633. let {
  3634. shortcuts
  3635. } = _ref;
  3636. return (
  3637. /*
  3638. * Disable reason: The `list` ARIA role is redundant but
  3639. * Safari+VoiceOver won't announce the list otherwise.
  3640. */
  3641. /* eslint-disable jsx-a11y/no-redundant-roles */
  3642. (0,external_wp_element_namespaceObject.createElement)("ul", {
  3643. className: "edit-post-keyboard-shortcut-help-modal__shortcut-list",
  3644. role: "list"
  3645. }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", {
  3646. className: "edit-post-keyboard-shortcut-help-modal__shortcut",
  3647. key: index
  3648. }, typeof shortcut === 'string' ? (0,external_wp_element_namespaceObject.createElement)(dynamic_shortcut, {
  3649. name: shortcut
  3650. }) : (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, shortcut))))
  3651. /* eslint-enable jsx-a11y/no-redundant-roles */
  3652. );
  3653. };
  3654. const ShortcutSection = _ref2 => {
  3655. let {
  3656. title,
  3657. shortcuts,
  3658. className
  3659. } = _ref2;
  3660. return (0,external_wp_element_namespaceObject.createElement)("section", {
  3661. className: classnames_default()('edit-post-keyboard-shortcut-help-modal__section', className)
  3662. }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", {
  3663. className: "edit-post-keyboard-shortcut-help-modal__section-title"
  3664. }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, {
  3665. shortcuts: shortcuts
  3666. }));
  3667. };
  3668. const ShortcutCategorySection = _ref3 => {
  3669. let {
  3670. title,
  3671. categoryName,
  3672. additionalShortcuts = []
  3673. } = _ref3;
  3674. const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3675. return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
  3676. }, [categoryName]);
  3677. return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3678. title: title,
  3679. shortcuts: categoryShortcuts.concat(additionalShortcuts)
  3680. });
  3681. };
  3682. function KeyboardShortcutHelpModal(_ref4) {
  3683. let {
  3684. isModalActive,
  3685. toggleModal
  3686. } = _ref4;
  3687. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/keyboard-shortcuts', toggleModal);
  3688. if (!isModalActive) {
  3689. return null;
  3690. }
  3691. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  3692. className: "edit-post-keyboard-shortcut-help-modal",
  3693. title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
  3694. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  3695. onRequestClose: toggleModal
  3696. }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3697. className: "edit-post-keyboard-shortcut-help-modal__main-shortcuts",
  3698. shortcuts: ['core/edit-post/keyboard-shortcuts']
  3699. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3700. title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
  3701. categoryName: "global"
  3702. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3703. title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
  3704. categoryName: "selection"
  3705. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3706. title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
  3707. categoryName: "block",
  3708. additionalShortcuts: [{
  3709. keyCombination: {
  3710. character: '/'
  3711. },
  3712. description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
  3713. /* translators: The forward-slash character. e.g. '/'. */
  3714. ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
  3715. }]
  3716. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3717. title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
  3718. shortcuts: textFormattingShortcuts
  3719. }));
  3720. }
  3721. /* harmony default export */ var keyboard_shortcut_help_modal = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({
  3722. isModalActive: select(store_store).isModalActive(MODAL_NAME)
  3723. })), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref5) => {
  3724. let {
  3725. isModalActive
  3726. } = _ref5;
  3727. const {
  3728. openModal,
  3729. closeModal
  3730. } = dispatch(store_store);
  3731. return {
  3732. toggleModal: () => isModalActive ? closeModal() : openModal(MODAL_NAME)
  3733. };
  3734. })])(KeyboardShortcutHelpModal));
  3735. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-custom-fields.js
  3736. /**
  3737. * WordPress dependencies
  3738. */
  3739. function CustomFieldsConfirmation(_ref) {
  3740. let {
  3741. willEnable
  3742. } = _ref;
  3743. const [isReloading, setIsReloading] = (0,external_wp_element_namespaceObject.useState)(false);
  3744. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", {
  3745. className: "edit-post-preferences-modal__custom-fields-confirmation-message"
  3746. }, (0,external_wp_i18n_namespaceObject.__)('A page reload is required for this change. Make sure your content is saved before reloading.')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  3747. className: "edit-post-preferences-modal__custom-fields-confirmation-button",
  3748. variant: "secondary",
  3749. isBusy: isReloading,
  3750. disabled: isReloading,
  3751. onClick: () => {
  3752. setIsReloading(true);
  3753. document.getElementById('toggle-custom-fields-form').submit();
  3754. }
  3755. }, willEnable ? (0,external_wp_i18n_namespaceObject.__)('Enable & Reload') : (0,external_wp_i18n_namespaceObject.__)('Disable & Reload')));
  3756. }
  3757. function EnableCustomFieldsOption(_ref2) {
  3758. let {
  3759. label,
  3760. areCustomFieldsEnabled
  3761. } = _ref2;
  3762. const [isChecked, setIsChecked] = (0,external_wp_element_namespaceObject.useState)(areCustomFieldsEnabled);
  3763. return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_base_option, {
  3764. label: label,
  3765. isChecked: isChecked,
  3766. onChange: setIsChecked
  3767. }, isChecked !== areCustomFieldsEnabled && (0,external_wp_element_namespaceObject.createElement)(CustomFieldsConfirmation, {
  3768. willEnable: isChecked
  3769. }));
  3770. }
  3771. /* harmony default export */ var enable_custom_fields = ((0,external_wp_data_namespaceObject.withSelect)(select => ({
  3772. areCustomFieldsEnabled: !!select(external_wp_editor_namespaceObject.store).getEditorSettings().enableCustomFields
  3773. }))(EnableCustomFieldsOption));
  3774. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-panel.js
  3775. /**
  3776. * WordPress dependencies
  3777. */
  3778. /**
  3779. * Internal dependencies
  3780. */
  3781. /* harmony default export */ var enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
  3782. let {
  3783. panelName
  3784. } = _ref;
  3785. const {
  3786. isEditorPanelEnabled,
  3787. isEditorPanelRemoved
  3788. } = select(store_store);
  3789. return {
  3790. isRemoved: isEditorPanelRemoved(panelName),
  3791. isChecked: isEditorPanelEnabled(panelName)
  3792. };
  3793. }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
  3794. let {
  3795. isRemoved
  3796. } = _ref2;
  3797. return !isRemoved;
  3798. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => {
  3799. let {
  3800. panelName
  3801. } = _ref3;
  3802. return {
  3803. onChange: () => dispatch(store_store).toggleEditorPanelEnabled(panelName)
  3804. };
  3805. }))(preferences_modal_base_option));
  3806. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js
  3807. /**
  3808. * WordPress dependencies
  3809. */
  3810. /**
  3811. * Internal dependencies
  3812. */
  3813. const {
  3814. Fill,
  3815. Slot: enable_plugin_document_setting_panel_Slot
  3816. } = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption');
  3817. const EnablePluginDocumentSettingPanelOption = _ref => {
  3818. let {
  3819. label,
  3820. panelName
  3821. } = _ref;
  3822. return (0,external_wp_element_namespaceObject.createElement)(Fill, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  3823. label: label,
  3824. panelName: panelName
  3825. }));
  3826. };
  3827. EnablePluginDocumentSettingPanelOption.Slot = enable_plugin_document_setting_panel_Slot;
  3828. /* harmony default export */ var enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption);
  3829. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-publish-sidebar.js
  3830. /**
  3831. * WordPress dependencies
  3832. */
  3833. /* harmony default export */ var enable_publish_sidebar = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
  3834. isChecked: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled()
  3835. })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  3836. const {
  3837. enablePublishSidebar,
  3838. disablePublishSidebar
  3839. } = dispatch(external_wp_editor_namespaceObject.store);
  3840. return {
  3841. onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar()
  3842. };
  3843. }), // In < medium viewports we override this option and always show the publish sidebar.
  3844. // See the edit-post's header component for the specific logic.
  3845. (0,external_wp_viewport_namespaceObject.ifViewportMatches)('medium'))(preferences_modal_base_option));
  3846. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-feature.js
  3847. /**
  3848. * WordPress dependencies
  3849. */
  3850. /**
  3851. * Internal dependencies
  3852. */
  3853. /* harmony default export */ var enable_feature = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
  3854. let {
  3855. featureName
  3856. } = _ref;
  3857. const {
  3858. isFeatureActive
  3859. } = select(store_store);
  3860. return {
  3861. isChecked: isFeatureActive(featureName)
  3862. };
  3863. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref2) => {
  3864. let {
  3865. featureName
  3866. } = _ref2;
  3867. return {
  3868. onChange: () => dispatch(store_store).toggleFeature(featureName)
  3869. };
  3870. }))(preferences_modal_base_option));
  3871. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/index.js
  3872. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/meta-boxes-section.js
  3873. /**
  3874. * External dependencies
  3875. */
  3876. /**
  3877. * WordPress dependencies
  3878. */
  3879. /**
  3880. * Internal dependencies
  3881. */
  3882. function MetaBoxesSection(_ref) {
  3883. let {
  3884. areCustomFieldsRegistered,
  3885. metaBoxes,
  3886. ...sectionProps
  3887. } = _ref;
  3888. // The 'Custom Fields' meta box is a special case that we handle separately.
  3889. const thirdPartyMetaBoxes = (0,external_lodash_namespaceObject.filter)(metaBoxes, _ref2 => {
  3890. let {
  3891. id
  3892. } = _ref2;
  3893. return id !== 'postcustom';
  3894. });
  3895. if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) {
  3896. return null;
  3897. }
  3898. return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, sectionProps, areCustomFieldsRegistered && (0,external_wp_element_namespaceObject.createElement)(enable_custom_fields, {
  3899. label: (0,external_wp_i18n_namespaceObject.__)('Custom fields')
  3900. }), (0,external_lodash_namespaceObject.map)(thirdPartyMetaBoxes, _ref3 => {
  3901. let {
  3902. id,
  3903. title
  3904. } = _ref3;
  3905. return (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  3906. key: id,
  3907. label: title,
  3908. panelName: `meta-box-${id}`
  3909. });
  3910. }));
  3911. }
  3912. /* harmony default export */ var meta_boxes_section = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  3913. const {
  3914. getEditorSettings
  3915. } = select(external_wp_editor_namespaceObject.store);
  3916. const {
  3917. getAllMetaBoxes
  3918. } = select(store_store);
  3919. return {
  3920. // This setting should not live in the block editor's store.
  3921. areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== undefined,
  3922. metaBoxes: getAllMetaBoxes()
  3923. };
  3924. })(MetaBoxesSection));
  3925. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/checklist.js
  3926. /**
  3927. * WordPress dependencies
  3928. */
  3929. function BlockTypesChecklist(_ref) {
  3930. let {
  3931. blockTypes,
  3932. value,
  3933. onItemChange
  3934. } = _ref;
  3935. return (0,external_wp_element_namespaceObject.createElement)("ul", {
  3936. className: "edit-post-block-manager__checklist"
  3937. }, blockTypes.map(blockType => (0,external_wp_element_namespaceObject.createElement)("li", {
  3938. key: blockType.name,
  3939. className: "edit-post-block-manager__checklist-item"
  3940. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
  3941. label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, blockType.title, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
  3942. icon: blockType.icon
  3943. })),
  3944. checked: value.includes(blockType.name),
  3945. onChange: function () {
  3946. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  3947. args[_key] = arguments[_key];
  3948. }
  3949. return onItemChange(blockType.name, ...args);
  3950. }
  3951. }))));
  3952. }
  3953. /* harmony default export */ var checklist = (BlockTypesChecklist);
  3954. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/category.js
  3955. /**
  3956. * External dependencies
  3957. */
  3958. /**
  3959. * WordPress dependencies
  3960. */
  3961. /**
  3962. * Internal dependencies
  3963. */
  3964. function BlockManagerCategory(_ref) {
  3965. let {
  3966. title,
  3967. blockTypes
  3968. } = _ref;
  3969. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockManagerCategory);
  3970. const {
  3971. defaultAllowedBlockTypes,
  3972. hiddenBlockTypes
  3973. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3974. const {
  3975. getEditorSettings
  3976. } = select(external_wp_editor_namespaceObject.store);
  3977. const {
  3978. getHiddenBlockTypes
  3979. } = select(store_store);
  3980. return {
  3981. defaultAllowedBlockTypes: getEditorSettings().defaultAllowedBlockTypes,
  3982. hiddenBlockTypes: getHiddenBlockTypes()
  3983. };
  3984. }, []);
  3985. const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  3986. if (defaultAllowedBlockTypes === true) {
  3987. return blockTypes;
  3988. }
  3989. return blockTypes.filter(_ref2 => {
  3990. let {
  3991. name
  3992. } = _ref2;
  3993. return (0,external_lodash_namespaceObject.includes)(defaultAllowedBlockTypes || [], name);
  3994. });
  3995. }, [defaultAllowedBlockTypes, blockTypes]);
  3996. const {
  3997. showBlockTypes,
  3998. hideBlockTypes
  3999. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4000. const toggleVisible = (0,external_wp_element_namespaceObject.useCallback)((blockName, nextIsChecked) => {
  4001. if (nextIsChecked) {
  4002. showBlockTypes(blockName);
  4003. } else {
  4004. hideBlockTypes(blockName);
  4005. }
  4006. }, []);
  4007. const toggleAllVisible = (0,external_wp_element_namespaceObject.useCallback)(nextIsChecked => {
  4008. const blockNames = (0,external_lodash_namespaceObject.map)(blockTypes, 'name');
  4009. if (nextIsChecked) {
  4010. showBlockTypes(blockNames);
  4011. } else {
  4012. hideBlockTypes(blockNames);
  4013. }
  4014. }, [blockTypes]);
  4015. if (!filteredBlockTypes.length) {
  4016. return null;
  4017. }
  4018. const checkedBlockNames = (0,external_lodash_namespaceObject.without)((0,external_lodash_namespaceObject.map)(filteredBlockTypes, 'name'), ...hiddenBlockTypes);
  4019. const titleId = 'edit-post-block-manager__category-title-' + instanceId;
  4020. const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
  4021. let ariaChecked;
  4022. if (isAllChecked) {
  4023. ariaChecked = 'true';
  4024. } else if (checkedBlockNames.length > 0) {
  4025. ariaChecked = 'mixed';
  4026. } else {
  4027. ariaChecked = 'false';
  4028. }
  4029. return (0,external_wp_element_namespaceObject.createElement)("div", {
  4030. role: "group",
  4031. "aria-labelledby": titleId,
  4032. className: "edit-post-block-manager__category"
  4033. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
  4034. checked: isAllChecked,
  4035. onChange: toggleAllVisible,
  4036. className: "edit-post-block-manager__category-title",
  4037. "aria-checked": ariaChecked,
  4038. label: (0,external_wp_element_namespaceObject.createElement)("span", {
  4039. id: titleId
  4040. }, title)
  4041. }), (0,external_wp_element_namespaceObject.createElement)(checklist, {
  4042. blockTypes: filteredBlockTypes,
  4043. value: checkedBlockNames,
  4044. onItemChange: toggleVisible
  4045. }));
  4046. }
  4047. /* harmony default export */ var block_manager_category = (BlockManagerCategory);
  4048. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/index.js
  4049. /**
  4050. * External dependencies
  4051. */
  4052. /**
  4053. * WordPress dependencies
  4054. */
  4055. /**
  4056. * Internal dependencies
  4057. */
  4058. function BlockManager(_ref) {
  4059. let {
  4060. blockTypes,
  4061. categories,
  4062. hasBlockSupport,
  4063. isMatchingSearchTerm,
  4064. numberOfHiddenBlocks
  4065. } = _ref;
  4066. const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
  4067. const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); // Filtering occurs here (as opposed to `withSelect`) to avoid
  4068. // wasted renders by consequence of `Array#filter` producing
  4069. // a new value reference on each call.
  4070. blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || (0,external_lodash_namespaceObject.includes)(blockType.parent, 'core/post-content'))); // Announce search results on change
  4071. (0,external_wp_element_namespaceObject.useEffect)(() => {
  4072. if (!search) {
  4073. return;
  4074. }
  4075. const count = blockTypes.length;
  4076. const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
  4077. /* translators: %d: number of results. */
  4078. (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
  4079. debouncedSpeak(resultsFoundMessage);
  4080. }, [blockTypes.length, search, debouncedSpeak]);
  4081. return (0,external_wp_element_namespaceObject.createElement)("div", {
  4082. className: "edit-post-block-manager__content"
  4083. }, !!numberOfHiddenBlocks && (0,external_wp_element_namespaceObject.createElement)("div", {
  4084. className: "edit-post-block-manager__disabled-blocks-count"
  4085. }, (0,external_wp_i18n_namespaceObject.sprintf)(
  4086. /* translators: %d: number of blocks. */
  4087. (0,external_wp_i18n_namespaceObject._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
  4088. label: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
  4089. placeholder: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
  4090. value: search,
  4091. onChange: nextSearch => setSearch(nextSearch),
  4092. className: "edit-post-block-manager__search"
  4093. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  4094. tabIndex: "0",
  4095. role: "region",
  4096. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Available block types'),
  4097. className: "edit-post-block-manager__results"
  4098. }, blockTypes.length === 0 && (0,external_wp_element_namespaceObject.createElement)("p", {
  4099. className: "edit-post-block-manager__no-results"
  4100. }, (0,external_wp_i18n_namespaceObject.__)('No blocks found.')), categories.map(category => (0,external_wp_element_namespaceObject.createElement)(block_manager_category, {
  4101. key: category.slug,
  4102. title: category.title,
  4103. blockTypes: (0,external_lodash_namespaceObject.filter)(blockTypes, {
  4104. category: category.slug
  4105. })
  4106. })), (0,external_wp_element_namespaceObject.createElement)(block_manager_category, {
  4107. title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'),
  4108. blockTypes: (0,external_lodash_namespaceObject.filter)(blockTypes, _ref2 => {
  4109. let {
  4110. category
  4111. } = _ref2;
  4112. return !category;
  4113. })
  4114. })));
  4115. }
  4116. /* harmony default export */ var block_manager = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  4117. const {
  4118. getBlockTypes,
  4119. getCategories,
  4120. hasBlockSupport,
  4121. isMatchingSearchTerm
  4122. } = select(external_wp_blocks_namespaceObject.store);
  4123. const {
  4124. getHiddenBlockTypes
  4125. } = select(store_store); // Some hidden blocks become unregistered
  4126. // by removing for instance the plugin that registered them, yet
  4127. // they're still remain as hidden by the user's action.
  4128. // We consider "hidden", blocks which were hidden and
  4129. // are still registered.
  4130. const blockTypes = getBlockTypes();
  4131. const hiddenBlockTypes = getHiddenBlockTypes().filter(hiddenBlock => {
  4132. return blockTypes.some(registeredBlock => registeredBlock.name === hiddenBlock);
  4133. });
  4134. const numberOfHiddenBlocks = Array.isArray(hiddenBlockTypes) && hiddenBlockTypes.length;
  4135. return {
  4136. blockTypes,
  4137. categories: getCategories(),
  4138. hasBlockSupport,
  4139. isMatchingSearchTerm,
  4140. numberOfHiddenBlocks
  4141. };
  4142. })(BlockManager));
  4143. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/index.js
  4144. /**
  4145. * External dependencies
  4146. */
  4147. /**
  4148. * WordPress dependencies
  4149. */
  4150. /**
  4151. * Internal dependencies
  4152. */
  4153. const preferences_modal_MODAL_NAME = 'edit-post/preferences';
  4154. function EditPostPreferencesModal() {
  4155. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  4156. const {
  4157. closeModal
  4158. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4159. const isModalActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isModalActive(preferences_modal_MODAL_NAME), []);
  4160. const showBlockBreadcrumbsOption = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4161. const {
  4162. getEditorSettings
  4163. } = select(external_wp_editor_namespaceObject.store);
  4164. const {
  4165. getEditorMode,
  4166. isFeatureActive
  4167. } = select(store_store);
  4168. const mode = getEditorMode();
  4169. const isRichEditingEnabled = getEditorSettings().richEditingEnabled;
  4170. const hasReducedUI = isFeatureActive('reducedUI');
  4171. return !hasReducedUI && isLargeViewport && isRichEditingEnabled && mode === 'visual';
  4172. }, [isLargeViewport]);
  4173. const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{
  4174. name: 'general',
  4175. tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'),
  4176. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  4177. title: (0,external_wp_i18n_namespaceObject.__)('Publishing'),
  4178. description: (0,external_wp_i18n_namespaceObject.__)('Change options related to publishing.')
  4179. }, (0,external_wp_element_namespaceObject.createElement)(enable_publish_sidebar, {
  4180. help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'),
  4181. label: (0,external_wp_i18n_namespaceObject.__)('Include pre-publish checklist')
  4182. })), (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  4183. title: (0,external_wp_i18n_namespaceObject.__)('Appearance'),
  4184. description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the block editor interface and editing flow.')
  4185. }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4186. featureName: "focusMode",
  4187. help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'),
  4188. label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode')
  4189. }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4190. featureName: "showIconLabels",
  4191. label: (0,external_wp_i18n_namespaceObject.__)('Show button text labels'),
  4192. help: (0,external_wp_i18n_namespaceObject.__)('Show text instead of icons on buttons.')
  4193. }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4194. featureName: "showListViewByDefault",
  4195. help: (0,external_wp_i18n_namespaceObject.__)('Opens the block list view sidebar by default.'),
  4196. label: (0,external_wp_i18n_namespaceObject.__)('Always open list view')
  4197. }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4198. featureName: "reducedUI",
  4199. help: (0,external_wp_i18n_namespaceObject.__)('Compacts options and outlines in the toolbar.'),
  4200. label: (0,external_wp_i18n_namespaceObject.__)('Reduce the interface')
  4201. }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4202. featureName: "themeStyles",
  4203. help: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'),
  4204. label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles')
  4205. }), showBlockBreadcrumbsOption && (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4206. featureName: "showBlockBreadcrumbs",
  4207. help: (0,external_wp_i18n_namespaceObject.__)('Shows block breadcrumbs at the bottom of the editor.'),
  4208. label: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs')
  4209. })))
  4210. }, {
  4211. name: 'blocks',
  4212. tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
  4213. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  4214. title: (0,external_wp_i18n_namespaceObject.__)('Block interactions'),
  4215. description: (0,external_wp_i18n_namespaceObject.__)('Customize how you interact with blocks in the block library and editing canvas.')
  4216. }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4217. featureName: "mostUsedBlocks",
  4218. help: (0,external_wp_i18n_namespaceObject.__)('Places the most frequent blocks in the block library.'),
  4219. label: (0,external_wp_i18n_namespaceObject.__)('Show most used blocks')
  4220. }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4221. featureName: "keepCaretInsideBlock",
  4222. help: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'),
  4223. label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block')
  4224. })), (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  4225. title: (0,external_wp_i18n_namespaceObject.__)('Visible blocks'),
  4226. description: (0,external_wp_i18n_namespaceObject.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.")
  4227. }, (0,external_wp_element_namespaceObject.createElement)(block_manager, null)))
  4228. }, {
  4229. name: 'panels',
  4230. tabLabel: (0,external_wp_i18n_namespaceObject.__)('Panels'),
  4231. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  4232. title: (0,external_wp_i18n_namespaceObject.__)('Document settings'),
  4233. description: (0,external_wp_i18n_namespaceObject.__)('Choose what displays in the panel.')
  4234. }, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel.Slot, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, {
  4235. taxonomyWrapper: (content, taxonomy) => (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4236. label: (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'menu_name']),
  4237. panelName: `taxonomy-panel-${taxonomy.slug}`
  4238. })
  4239. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4240. label: (0,external_wp_i18n_namespaceObject.__)('Featured image'),
  4241. panelName: "featured-image"
  4242. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4243. label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
  4244. panelName: "post-excerpt"
  4245. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
  4246. supportKeys: ['comments', 'trackbacks']
  4247. }, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4248. label: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
  4249. panelName: "discussion-panel"
  4250. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4251. label: (0,external_wp_i18n_namespaceObject.__)('Page attributes'),
  4252. panelName: "page-attributes"
  4253. }))), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_section, {
  4254. title: (0,external_wp_i18n_namespaceObject.__)('Additional'),
  4255. description: (0,external_wp_i18n_namespaceObject.__)('Add extra areas to the editor.')
  4256. }))
  4257. }], [isLargeViewport, showBlockBreadcrumbsOption]);
  4258. if (!isModalActive) {
  4259. return null;
  4260. }
  4261. return (0,external_wp_element_namespaceObject.createElement)(PreferencesModal, {
  4262. closeModal: closeModal
  4263. }, (0,external_wp_element_namespaceObject.createElement)(PreferencesModalTabs, {
  4264. sections: sections
  4265. }));
  4266. }
  4267. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/browser-url/index.js
  4268. /**
  4269. * WordPress dependencies
  4270. */
  4271. /**
  4272. * Returns the Post's Edit URL.
  4273. *
  4274. * @param {number} postId Post ID.
  4275. *
  4276. * @return {string} Post edit URL.
  4277. */
  4278. function getPostEditURL(postId) {
  4279. return (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', {
  4280. post: postId,
  4281. action: 'edit'
  4282. });
  4283. }
  4284. /**
  4285. * Returns the Post's Trashed URL.
  4286. *
  4287. * @param {number} postId Post ID.
  4288. * @param {string} postType Post Type.
  4289. *
  4290. * @return {string} Post trashed URL.
  4291. */
  4292. function getPostTrashedURL(postId, postType) {
  4293. return (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
  4294. trashed: 1,
  4295. post_type: postType,
  4296. ids: postId
  4297. });
  4298. }
  4299. class BrowserURL extends external_wp_element_namespaceObject.Component {
  4300. constructor() {
  4301. super(...arguments);
  4302. this.state = {
  4303. historyId: null
  4304. };
  4305. }
  4306. componentDidUpdate(prevProps) {
  4307. const {
  4308. postId,
  4309. postStatus,
  4310. postType,
  4311. isSavingPost
  4312. } = this.props;
  4313. const {
  4314. historyId
  4315. } = this.state; // Posts are still dirty while saving so wait for saving to finish
  4316. // to avoid the unsaved changes warning when trashing posts.
  4317. if (postStatus === 'trash' && !isSavingPost) {
  4318. this.setTrashURL(postId, postType);
  4319. return;
  4320. }
  4321. if ((postId !== prevProps.postId || postId !== historyId) && postStatus !== 'auto-draft' && postId) {
  4322. this.setBrowserURL(postId);
  4323. }
  4324. }
  4325. /**
  4326. * Navigates the browser to the post trashed URL to show a notice about the trashed post.
  4327. *
  4328. * @param {number} postId Post ID.
  4329. * @param {string} postType Post Type.
  4330. */
  4331. setTrashURL(postId, postType) {
  4332. window.location.href = getPostTrashedURL(postId, postType);
  4333. }
  4334. /**
  4335. * Replaces the browser URL with a post editor link for the given post ID.
  4336. *
  4337. * Note it is important that, since this function may be called when the
  4338. * editor first loads, the result generated `getPostEditURL` matches that
  4339. * produced by the server. Otherwise, the URL will change unexpectedly.
  4340. *
  4341. * @param {number} postId Post ID for which to generate post editor URL.
  4342. */
  4343. setBrowserURL(postId) {
  4344. window.history.replaceState({
  4345. id: postId
  4346. }, 'Post ' + postId, getPostEditURL(postId));
  4347. this.setState(() => ({
  4348. historyId: postId
  4349. }));
  4350. }
  4351. render() {
  4352. return null;
  4353. }
  4354. }
  4355. /* harmony default export */ var browser_url = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  4356. const {
  4357. getCurrentPost,
  4358. isSavingPost
  4359. } = select(external_wp_editor_namespaceObject.store);
  4360. const post = getCurrentPost();
  4361. let {
  4362. id,
  4363. status,
  4364. type
  4365. } = post;
  4366. const isTemplate = ['wp_template', 'wp_template_part'].includes(type);
  4367. if (isTemplate) {
  4368. id = post.wp_id;
  4369. }
  4370. return {
  4371. postId: id,
  4372. postStatus: status,
  4373. postType: type,
  4374. isSavingPost: isSavingPost()
  4375. };
  4376. })(BrowserURL));
  4377. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
  4378. /**
  4379. * WordPress dependencies
  4380. */
  4381. const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4382. xmlns: "http://www.w3.org/2000/svg",
  4383. viewBox: "-2 -2 24 24"
  4384. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4385. d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
  4386. }));
  4387. /* harmony default export */ var library_wordpress = (wordpress);
  4388. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/fullscreen-mode-close/index.js
  4389. /**
  4390. * External dependencies
  4391. */
  4392. /**
  4393. * WordPress dependencies
  4394. */
  4395. /**
  4396. * Internal dependencies
  4397. */
  4398. function FullscreenModeClose(_ref) {
  4399. let {
  4400. showTooltip,
  4401. icon,
  4402. href
  4403. } = _ref;
  4404. const {
  4405. isActive,
  4406. isRequestingSiteIcon,
  4407. postType,
  4408. siteIconUrl
  4409. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4410. const {
  4411. getCurrentPostType
  4412. } = select(external_wp_editor_namespaceObject.store);
  4413. const {
  4414. isFeatureActive
  4415. } = select(store_store);
  4416. const {
  4417. getEntityRecord,
  4418. getPostType,
  4419. isResolving
  4420. } = select(external_wp_coreData_namespaceObject.store);
  4421. const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
  4422. return {
  4423. isActive: isFeatureActive('fullscreenMode'),
  4424. isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]),
  4425. postType: getPostType(getCurrentPostType()),
  4426. siteIconUrl: siteData.site_icon_url
  4427. };
  4428. }, []);
  4429. const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  4430. if (!isActive || !postType) {
  4431. return null;
  4432. }
  4433. let buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  4434. size: "36px",
  4435. icon: library_wordpress
  4436. });
  4437. const effect = {
  4438. expand: {
  4439. scale: 1.25,
  4440. transition: {
  4441. type: 'tween',
  4442. duration: '0.3'
  4443. }
  4444. }
  4445. };
  4446. if (siteIconUrl) {
  4447. buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, {
  4448. variants: !disableMotion && effect,
  4449. alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
  4450. className: "edit-post-fullscreen-mode-close_site-icon",
  4451. src: siteIconUrl
  4452. });
  4453. }
  4454. if (isRequestingSiteIcon) {
  4455. buttonIcon = null;
  4456. } // Override default icon if custom icon is provided via props.
  4457. if (icon) {
  4458. buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  4459. size: "36px",
  4460. icon: icon
  4461. });
  4462. }
  4463. const classes = classnames_default()({
  4464. 'edit-post-fullscreen-mode-close': true,
  4465. 'has-icon': siteIconUrl
  4466. });
  4467. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
  4468. whileHover: "expand"
  4469. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  4470. className: classes,
  4471. href: href !== null && href !== void 0 ? href : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
  4472. post_type: postType.slug
  4473. }),
  4474. label: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_items'], (0,external_wp_i18n_namespaceObject.__)('Back')),
  4475. showTooltip: showTooltip
  4476. }, buttonIcon));
  4477. }
  4478. /* harmony default export */ var fullscreen_mode_close = (FullscreenModeClose);
  4479. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js
  4480. /**
  4481. * WordPress dependencies
  4482. */
  4483. const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4484. viewBox: "0 0 24 24",
  4485. xmlns: "http://www.w3.org/2000/svg"
  4486. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4487. d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"
  4488. }));
  4489. /* harmony default export */ var list_view = (listView);
  4490. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
  4491. /**
  4492. * WordPress dependencies
  4493. */
  4494. const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4495. xmlns: "http://www.w3.org/2000/svg",
  4496. viewBox: "0 0 24 24"
  4497. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4498. d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
  4499. }));
  4500. /* harmony default export */ var library_plus = (plus);
  4501. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/header-toolbar/index.js
  4502. /**
  4503. * WordPress dependencies
  4504. */
  4505. /**
  4506. * Internal dependencies
  4507. */
  4508. const preventDefault = event => {
  4509. event.preventDefault();
  4510. };
  4511. function HeaderToolbar() {
  4512. const inserterButton = (0,external_wp_element_namespaceObject.useRef)();
  4513. const {
  4514. setIsInserterOpened,
  4515. setIsListViewOpened
  4516. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4517. const {
  4518. isInserterEnabled,
  4519. isInserterOpened,
  4520. isTextModeEnabled,
  4521. showIconLabels,
  4522. isListViewOpen,
  4523. listViewShortcut
  4524. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4525. const {
  4526. hasInserterItems,
  4527. getBlockRootClientId,
  4528. getBlockSelectionEnd
  4529. } = select(external_wp_blockEditor_namespaceObject.store);
  4530. const {
  4531. getEditorSettings
  4532. } = select(external_wp_editor_namespaceObject.store);
  4533. const {
  4534. getEditorMode,
  4535. isFeatureActive,
  4536. isListViewOpened
  4537. } = select(store_store);
  4538. const {
  4539. getShortcutRepresentation
  4540. } = select(external_wp_keyboardShortcuts_namespaceObject.store);
  4541. return {
  4542. // This setting (richEditingEnabled) should not live in the block editor's setting.
  4543. isInserterEnabled: getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled && hasInserterItems(getBlockRootClientId(getBlockSelectionEnd())),
  4544. isInserterOpened: select(store_store).isInserterOpened(),
  4545. isTextModeEnabled: getEditorMode() === 'text',
  4546. showIconLabels: isFeatureActive('showIconLabels'),
  4547. isListViewOpen: isListViewOpened(),
  4548. listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-list-view')
  4549. };
  4550. }, []);
  4551. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  4552. const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide');
  4553. /* translators: accessibility text for the editor toolbar */
  4554. const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools');
  4555. const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
  4556. const overflowItems = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4557. as: external_wp_editor_namespaceObject.TableOfContents,
  4558. hasOutlineItemsDisabled: isTextModeEnabled,
  4559. repositionDropdown: showIconLabels && !isWideViewport,
  4560. showTooltip: !showIconLabels,
  4561. variant: showIconLabels ? 'tertiary' : undefined
  4562. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4563. as: external_wp_components_namespaceObject.Button,
  4564. className: "edit-post-header-toolbar__list-view-toggle",
  4565. icon: list_view,
  4566. disabled: isTextModeEnabled,
  4567. isPressed: isListViewOpen
  4568. /* translators: button label text should, if possible, be under 16 characters. */
  4569. ,
  4570. label: (0,external_wp_i18n_namespaceObject.__)('List View'),
  4571. onClick: toggleListView,
  4572. shortcut: listViewShortcut,
  4573. showTooltip: !showIconLabels,
  4574. variant: showIconLabels ? 'tertiary' : undefined
  4575. }));
  4576. const openInserter = (0,external_wp_element_namespaceObject.useCallback)(() => {
  4577. if (isInserterOpened) {
  4578. // Focusing the inserter button closes the inserter popover.
  4579. inserterButton.current.focus();
  4580. } else {
  4581. setIsInserterOpened(true);
  4582. }
  4583. }, [isInserterOpened, setIsInserterOpened]);
  4584. /* translators: button label text should, if possible, be under 16 characters. */
  4585. const longLabel = (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button');
  4586. const shortLabel = !isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close');
  4587. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
  4588. className: "edit-post-header-toolbar",
  4589. "aria-label": toolbarAriaLabel
  4590. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  4591. className: "edit-post-header-toolbar__left"
  4592. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4593. ref: inserterButton,
  4594. as: external_wp_components_namespaceObject.Button,
  4595. className: "edit-post-header-toolbar__inserter-toggle",
  4596. variant: "primary",
  4597. isPressed: isInserterOpened,
  4598. onMouseDown: preventDefault,
  4599. onClick: openInserter,
  4600. disabled: !isInserterEnabled,
  4601. icon: library_plus,
  4602. label: showIconLabels ? shortLabel : longLabel,
  4603. showTooltip: !showIconLabels
  4604. }), (isWideViewport || !showIconLabels) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4605. as: external_wp_blockEditor_namespaceObject.ToolSelector,
  4606. showTooltip: !showIconLabels,
  4607. variant: showIconLabels ? 'tertiary' : undefined,
  4608. disabled: isTextModeEnabled
  4609. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4610. as: external_wp_editor_namespaceObject.EditorHistoryUndo,
  4611. showTooltip: !showIconLabels,
  4612. variant: showIconLabels ? 'tertiary' : undefined
  4613. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4614. as: external_wp_editor_namespaceObject.EditorHistoryRedo,
  4615. showTooltip: !showIconLabels,
  4616. variant: showIconLabels ? 'tertiary' : undefined
  4617. }), overflowItems)));
  4618. }
  4619. /* harmony default export */ var header_toolbar = (HeaderToolbar);
  4620. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/mode-switcher/index.js
  4621. /**
  4622. * WordPress dependencies
  4623. */
  4624. /**
  4625. * Internal dependencies
  4626. */
  4627. /**
  4628. * Set of available mode options.
  4629. *
  4630. * @type {Array}
  4631. */
  4632. const MODES = [{
  4633. value: 'visual',
  4634. label: (0,external_wp_i18n_namespaceObject.__)('Visual editor')
  4635. }, {
  4636. value: 'text',
  4637. label: (0,external_wp_i18n_namespaceObject.__)('Code editor')
  4638. }];
  4639. function ModeSwitcher() {
  4640. const {
  4641. shortcut,
  4642. isRichEditingEnabled,
  4643. isCodeEditingEnabled,
  4644. isEditingTemplate,
  4645. mode
  4646. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  4647. shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-mode'),
  4648. isRichEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled,
  4649. isCodeEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().codeEditingEnabled,
  4650. isEditingTemplate: select(store_store).isEditingTemplate(),
  4651. mode: select(store_store).getEditorMode()
  4652. }), []);
  4653. const {
  4654. switchEditorMode
  4655. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4656. if (isEditingTemplate) {
  4657. return null;
  4658. }
  4659. if (!isRichEditingEnabled || !isCodeEditingEnabled) {
  4660. return null;
  4661. }
  4662. const choices = MODES.map(choice => {
  4663. if (choice.value !== mode) {
  4664. return { ...choice,
  4665. shortcut
  4666. };
  4667. }
  4668. return choice;
  4669. });
  4670. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  4671. label: (0,external_wp_i18n_namespaceObject.__)('Editor')
  4672. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
  4673. choices: choices,
  4674. value: mode,
  4675. onSelect: switchEditorMode
  4676. }));
  4677. }
  4678. /* harmony default export */ var mode_switcher = (ModeSwitcher);
  4679. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/preferences-menu-item/index.js
  4680. /**
  4681. * WordPress dependencies
  4682. */
  4683. /**
  4684. * Internal dependencies
  4685. */
  4686. function PreferencesMenuItem() {
  4687. const {
  4688. openModal
  4689. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4690. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  4691. onClick: () => {
  4692. openModal('edit-post/preferences');
  4693. }
  4694. }, (0,external_wp_i18n_namespaceObject.__)('Preferences'));
  4695. }
  4696. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/writing-menu/index.js
  4697. /**
  4698. * WordPress dependencies
  4699. */
  4700. function WritingMenu() {
  4701. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  4702. if (!isLargeViewport) {
  4703. return null;
  4704. }
  4705. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  4706. label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun')
  4707. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  4708. scope: "core/edit-post",
  4709. name: "fixedToolbar",
  4710. label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
  4711. info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
  4712. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
  4713. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
  4714. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  4715. scope: "core/edit-post",
  4716. name: "focusMode",
  4717. label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'),
  4718. info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'),
  4719. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'),
  4720. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated')
  4721. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  4722. scope: "core/edit-post",
  4723. name: "fullscreenMode",
  4724. label: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode'),
  4725. info: (0,external_wp_i18n_namespaceObject.__)('Work without distraction'),
  4726. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode activated'),
  4727. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode deactivated'),
  4728. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('f')
  4729. }));
  4730. }
  4731. /* harmony default export */ var writing_menu = (WritingMenu);
  4732. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/more-menu/index.js
  4733. /**
  4734. * WordPress dependencies
  4735. */
  4736. /**
  4737. * Internal dependencies
  4738. */
  4739. const MoreMenu = _ref => {
  4740. let {
  4741. showIconLabels
  4742. } = _ref;
  4743. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
  4744. return (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, {
  4745. toggleProps: {
  4746. showTooltip: !showIconLabels,
  4747. ...(showIconLabels && {
  4748. variant: 'tertiary'
  4749. })
  4750. }
  4751. }, _ref2 => {
  4752. let {
  4753. onClose
  4754. } = _ref2;
  4755. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
  4756. className: showIconLabels && 'show-icon-labels',
  4757. scope: "core/edit-post"
  4758. }), (0,external_wp_element_namespaceObject.createElement)(writing_menu, null), (0,external_wp_element_namespaceObject.createElement)(mode_switcher, null), (0,external_wp_element_namespaceObject.createElement)(action_item.Slot, {
  4759. name: "core/edit-post/plugin-more-menu",
  4760. label: (0,external_wp_i18n_namespaceObject.__)('Plugins'),
  4761. as: external_wp_components_namespaceObject.MenuGroup,
  4762. fillProps: {
  4763. onClick: onClose
  4764. }
  4765. }), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, {
  4766. fillProps: {
  4767. onClose
  4768. }
  4769. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(PreferencesMenuItem, null)));
  4770. });
  4771. };
  4772. /* harmony default export */ var more_menu = (MoreMenu);
  4773. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/post-publish-button-or-toggle.js
  4774. /**
  4775. * External dependencies
  4776. */
  4777. /**
  4778. * WordPress dependencies
  4779. */
  4780. /**
  4781. * Internal dependencies
  4782. */
  4783. function PostPublishButtonOrToggle(_ref) {
  4784. let {
  4785. forceIsDirty,
  4786. forceIsSaving,
  4787. hasPublishAction,
  4788. isBeingScheduled,
  4789. isPending,
  4790. isPublished,
  4791. isPublishSidebarEnabled,
  4792. isPublishSidebarOpened,
  4793. isScheduled,
  4794. togglePublishSidebar,
  4795. setEntitiesSavedStatesCallback
  4796. } = _ref;
  4797. const IS_TOGGLE = 'toggle';
  4798. const IS_BUTTON = 'button';
  4799. const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  4800. let component;
  4801. /**
  4802. * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):
  4803. *
  4804. * 1) We want to show a BUTTON when the post status is at the _final stage_
  4805. * for a particular role (see https://wordpress.org/support/article/post-status/):
  4806. *
  4807. * - is published
  4808. * - is scheduled to be published
  4809. * - is pending and can't be published (but only for viewports >= medium).
  4810. * Originally, we considered showing a button for pending posts that couldn't be published
  4811. * (for example, for an author with the contributor role). Some languages can have
  4812. * long translations for "Submit for review", so given the lack of UI real estate available
  4813. * we decided to take into account the viewport in that case.
  4814. * See: https://github.com/WordPress/gutenberg/issues/10475
  4815. *
  4816. * 2) Then, in small viewports, we'll show a TOGGLE.
  4817. *
  4818. * 3) Finally, we'll use the publish sidebar status to decide:
  4819. *
  4820. * - if it is enabled, we show a TOGGLE
  4821. * - if it is disabled, we show a BUTTON
  4822. */
  4823. if (isPublished || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) {
  4824. component = IS_BUTTON;
  4825. } else if (isSmallerThanMediumViewport) {
  4826. component = IS_TOGGLE;
  4827. } else if (isPublishSidebarEnabled) {
  4828. component = IS_TOGGLE;
  4829. } else {
  4830. component = IS_BUTTON;
  4831. }
  4832. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishButton, {
  4833. forceIsDirty: forceIsDirty,
  4834. forceIsSaving: forceIsSaving,
  4835. isOpen: isPublishSidebarOpened,
  4836. isToggle: component === IS_TOGGLE,
  4837. onToggle: togglePublishSidebar,
  4838. setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
  4839. });
  4840. }
  4841. /* harmony default export */ var post_publish_button_or_toggle = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
  4842. hasPublishAction: (0,external_lodash_namespaceObject.get)(select(external_wp_editor_namespaceObject.store).getCurrentPost(), ['_links', 'wp:action-publish'], false),
  4843. isBeingScheduled: select(external_wp_editor_namespaceObject.store).isEditedPostBeingScheduled(),
  4844. isPending: select(external_wp_editor_namespaceObject.store).isCurrentPostPending(),
  4845. isPublished: select(external_wp_editor_namespaceObject.store).isCurrentPostPublished(),
  4846. isPublishSidebarEnabled: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled(),
  4847. isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(),
  4848. isScheduled: select(external_wp_editor_namespaceObject.store).isCurrentPostScheduled()
  4849. })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  4850. const {
  4851. togglePublishSidebar
  4852. } = dispatch(store_store);
  4853. return {
  4854. togglePublishSidebar
  4855. };
  4856. }))(PostPublishButtonOrToggle));
  4857. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/device-preview/index.js
  4858. /**
  4859. * External dependencies
  4860. */
  4861. /**
  4862. * WordPress dependencies
  4863. */
  4864. /**
  4865. * Internal dependencies
  4866. */
  4867. function DevicePreview() {
  4868. const {
  4869. hasActiveMetaboxes,
  4870. isPostSaveable,
  4871. isSaving,
  4872. isViewable,
  4873. deviceType
  4874. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4875. const {
  4876. getEditedPostAttribute
  4877. } = select(external_wp_editor_namespaceObject.store);
  4878. const {
  4879. getPostType
  4880. } = select(external_wp_coreData_namespaceObject.store);
  4881. const postType = getPostType(getEditedPostAttribute('type'));
  4882. return {
  4883. hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
  4884. isSaving: select(store_store).isSavingMetaBoxes(),
  4885. isPostSaveable: select(external_wp_editor_namespaceObject.store).isEditedPostSaveable(),
  4886. isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false),
  4887. deviceType: select(store_store).__experimentalGetPreviewDeviceType()
  4888. };
  4889. }, []);
  4890. const {
  4891. __experimentalSetPreviewDeviceType: setPreviewDeviceType
  4892. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4893. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPreviewOptions, {
  4894. isEnabled: isPostSaveable,
  4895. className: "edit-post-post-preview-dropdown",
  4896. deviceType: deviceType,
  4897. setDeviceType: setPreviewDeviceType
  4898. /* translators: button label text should, if possible, be under 16 characters. */
  4899. ,
  4900. viewLabel: (0,external_wp_i18n_namespaceObject.__)('Preview')
  4901. }, isViewable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  4902. className: "edit-post-header-preview__grouping-external"
  4903. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, {
  4904. className: 'edit-post-header-preview__button-external',
  4905. role: "menuitem",
  4906. forceIsAutosaveable: hasActiveMetaboxes,
  4907. forcePreviewLink: isSaving ? null : undefined,
  4908. textContent: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  4909. icon: library_external
  4910. }))
  4911. }))));
  4912. }
  4913. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/main-dashboard-button/index.js
  4914. /**
  4915. * WordPress dependencies
  4916. */
  4917. const slotName = '__experimentalMainDashboardButton';
  4918. const {
  4919. Fill: main_dashboard_button_Fill,
  4920. Slot: MainDashboardButtonSlot
  4921. } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName);
  4922. const MainDashboardButton = main_dashboard_button_Fill;
  4923. const main_dashboard_button_Slot = _ref => {
  4924. let {
  4925. children
  4926. } = _ref;
  4927. const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(slotName);
  4928. const hasFills = Boolean(slot.fills && slot.fills.length);
  4929. if (!hasFills) {
  4930. return children;
  4931. }
  4932. return (0,external_wp_element_namespaceObject.createElement)(MainDashboardButtonSlot, {
  4933. bubblesVirtually: true
  4934. });
  4935. };
  4936. MainDashboardButton.Slot = main_dashboard_button_Slot;
  4937. /* harmony default export */ var main_dashboard_button = (MainDashboardButton);
  4938. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
  4939. /**
  4940. * WordPress dependencies
  4941. */
  4942. const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4943. viewBox: "0 0 24 24",
  4944. xmlns: "http://www.w3.org/2000/svg"
  4945. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4946. d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
  4947. }));
  4948. /* harmony default export */ var chevron_down = (chevronDown);
  4949. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/delete-template.js
  4950. /**
  4951. * External dependencies
  4952. */
  4953. /**
  4954. * WordPress dependencies
  4955. */
  4956. /**
  4957. * Internal dependencies
  4958. */
  4959. function DeleteTemplate() {
  4960. const {
  4961. clearSelectedBlock
  4962. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  4963. const {
  4964. setIsEditingTemplate
  4965. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4966. const {
  4967. getEditorSettings
  4968. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store);
  4969. const {
  4970. updateEditorSettings,
  4971. editPost
  4972. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
  4973. const {
  4974. deleteEntityRecord
  4975. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  4976. const {
  4977. template
  4978. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4979. const {
  4980. isEditingTemplate,
  4981. getEditedPostTemplate
  4982. } = select(store_store);
  4983. const _isEditing = isEditingTemplate();
  4984. return {
  4985. template: _isEditing ? getEditedPostTemplate() : null
  4986. };
  4987. }, []);
  4988. const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false);
  4989. if (!template || !template.wp_id) {
  4990. return null;
  4991. }
  4992. let templateTitle = template.slug;
  4993. if (template !== null && template !== void 0 && template.title) {
  4994. templateTitle = template.title;
  4995. }
  4996. const isRevertable = template === null || template === void 0 ? void 0 : template.has_theme_file;
  4997. const onDelete = () => {
  4998. clearSelectedBlock();
  4999. setIsEditingTemplate(false);
  5000. setShowConfirmDialog(false);
  5001. editPost({
  5002. template: ''
  5003. });
  5004. const settings = getEditorSettings();
  5005. const newAvailableTemplates = (0,external_lodash_namespaceObject.pickBy)(settings.availableTemplates, (_title, id) => {
  5006. return id !== template.slug;
  5007. });
  5008. updateEditorSettings({ ...settings,
  5009. availableTemplates: newAvailableTemplates
  5010. });
  5011. deleteEntityRecord('postType', 'wp_template', template.id, {
  5012. throwOnError: true
  5013. });
  5014. };
  5015. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  5016. className: "edit-post-template-top-area__second-menu-group"
  5017. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  5018. className: "edit-post-template-top-area__delete-template-button",
  5019. isDestructive: !isRevertable,
  5020. onClick: () => {
  5021. setShowConfirmDialog(true);
  5022. },
  5023. info: isRevertable ? (0,external_wp_i18n_namespaceObject.__)('Use the template as supplied by the theme.') : undefined
  5024. }, isRevertable ? (0,external_wp_i18n_namespaceObject.__)('Clear customizations') : (0,external_wp_i18n_namespaceObject.__)('Delete template')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
  5025. isOpen: showConfirmDialog,
  5026. onConfirm: onDelete,
  5027. onCancel: () => {
  5028. setShowConfirmDialog(false);
  5029. }
  5030. }, (0,external_wp_i18n_namespaceObject.sprintf)(
  5031. /* translators: %s: template name */
  5032. (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete the %s template? It may be used by other pages or posts.'), templateTitle))));
  5033. }
  5034. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/edit-template-title.js
  5035. /**
  5036. * External dependencies
  5037. */
  5038. /**
  5039. * WordPress dependencies
  5040. */
  5041. /**
  5042. * Internal dependencies
  5043. */
  5044. function EditTemplateTitle() {
  5045. const [forceEmpty, setForceEmpty] = (0,external_wp_element_namespaceObject.useState)(false);
  5046. const {
  5047. template
  5048. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5049. const {
  5050. getEditedPostTemplate
  5051. } = select(store_store);
  5052. return {
  5053. template: getEditedPostTemplate()
  5054. };
  5055. }, []);
  5056. const {
  5057. editEntityRecord
  5058. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  5059. const {
  5060. getEditorSettings
  5061. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store);
  5062. const {
  5063. updateEditorSettings
  5064. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); // Only user-created and non-default templates can change the name.
  5065. if (!template.is_custom || template.has_theme_file) {
  5066. return null;
  5067. }
  5068. let templateTitle = (0,external_wp_i18n_namespaceObject.__)('Default');
  5069. if (template !== null && template !== void 0 && template.title) {
  5070. templateTitle = template.title;
  5071. } else if (!!template) {
  5072. templateTitle = template.slug;
  5073. }
  5074. return (0,external_wp_element_namespaceObject.createElement)("div", {
  5075. className: "edit-site-template-details__group"
  5076. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  5077. label: (0,external_wp_i18n_namespaceObject.__)('Title'),
  5078. value: forceEmpty ? '' : templateTitle,
  5079. help: (0,external_wp_i18n_namespaceObject.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'),
  5080. onChange: newTitle => {
  5081. // Allow having the field temporarily empty while typing.
  5082. if (!newTitle && !forceEmpty) {
  5083. setForceEmpty(true);
  5084. return;
  5085. }
  5086. setForceEmpty(false);
  5087. const settings = getEditorSettings();
  5088. const newAvailableTemplates = (0,external_lodash_namespaceObject.mapValues)(settings.availableTemplates, (existingTitle, id) => {
  5089. if (id !== template.slug) {
  5090. return existingTitle;
  5091. }
  5092. return newTitle;
  5093. });
  5094. updateEditorSettings({ ...settings,
  5095. availableTemplates: newAvailableTemplates
  5096. });
  5097. editEntityRecord('postType', 'wp_template', template.id, {
  5098. title: newTitle
  5099. });
  5100. },
  5101. onBlur: () => setForceEmpty(false)
  5102. }));
  5103. }
  5104. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/template-description.js
  5105. /**
  5106. * WordPress dependencies
  5107. */
  5108. /**
  5109. * Internal dependencies
  5110. */
  5111. function TemplateDescription() {
  5112. const {
  5113. description,
  5114. title
  5115. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5116. const {
  5117. getEditedPostTemplate
  5118. } = select(store_store);
  5119. return {
  5120. title: getEditedPostTemplate().title,
  5121. description: getEditedPostTemplate().description
  5122. };
  5123. }, []);
  5124. if (!description) {
  5125. return null;
  5126. }
  5127. return (0,external_wp_element_namespaceObject.createElement)("div", {
  5128. className: "edit-site-template-details__group"
  5129. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
  5130. level: 4,
  5131. weight: 600
  5132. }, title), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  5133. className: "edit-post-template-details__description",
  5134. size: "body",
  5135. as: "p",
  5136. style: {
  5137. marginTop: '12px'
  5138. }
  5139. }, description));
  5140. }
  5141. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/index.js
  5142. /**
  5143. * WordPress dependencies
  5144. */
  5145. /**
  5146. * Internal dependencies
  5147. */
  5148. function TemplateTitle() {
  5149. const {
  5150. template,
  5151. isEditing,
  5152. title
  5153. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5154. const {
  5155. isEditingTemplate,
  5156. getEditedPostTemplate
  5157. } = select(store_store);
  5158. const {
  5159. getEditedPostAttribute
  5160. } = select(external_wp_editor_namespaceObject.store);
  5161. const _isEditing = isEditingTemplate();
  5162. return {
  5163. template: _isEditing ? getEditedPostTemplate() : null,
  5164. isEditing: _isEditing,
  5165. title: getEditedPostAttribute('title') ? getEditedPostAttribute('title') : (0,external_wp_i18n_namespaceObject.__)('Untitled')
  5166. };
  5167. }, []);
  5168. const {
  5169. clearSelectedBlock
  5170. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  5171. const {
  5172. setIsEditingTemplate
  5173. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5174. if (!isEditing || !template) {
  5175. return null;
  5176. }
  5177. let templateTitle = (0,external_wp_i18n_namespaceObject.__)('Default');
  5178. if (template !== null && template !== void 0 && template.title) {
  5179. templateTitle = template.title;
  5180. } else if (!!template) {
  5181. templateTitle = template.slug;
  5182. }
  5183. const hasOptions = !!(template.custom || template.wp_id || template.description);
  5184. return (0,external_wp_element_namespaceObject.createElement)("div", {
  5185. className: "edit-post-template-top-area"
  5186. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5187. className: "edit-post-template-post-title",
  5188. isLink: true,
  5189. showTooltip: true,
  5190. label: (0,external_wp_i18n_namespaceObject.sprintf)(
  5191. /* translators: %s: Title of the referring post, e.g: "Hello World!" */
  5192. (0,external_wp_i18n_namespaceObject.__)('Edit %s'), title),
  5193. onClick: () => {
  5194. clearSelectedBlock();
  5195. setIsEditingTemplate(false);
  5196. }
  5197. }, title), hasOptions ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
  5198. position: "bottom center",
  5199. contentClassName: "edit-post-template-top-area__popover",
  5200. renderToggle: _ref => {
  5201. let {
  5202. onToggle
  5203. } = _ref;
  5204. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5205. className: "edit-post-template-title",
  5206. isLink: true,
  5207. icon: chevron_down,
  5208. showTooltip: true,
  5209. onClick: onToggle,
  5210. label: (0,external_wp_i18n_namespaceObject.__)('Template Options')
  5211. }, templateTitle);
  5212. },
  5213. renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(EditTemplateTitle, null), (0,external_wp_element_namespaceObject.createElement)(TemplateDescription, null), (0,external_wp_element_namespaceObject.createElement)(DeleteTemplate, null))
  5214. }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  5215. className: "edit-post-template-title",
  5216. size: "body",
  5217. style: {
  5218. lineHeight: '24px'
  5219. }
  5220. }, templateTitle));
  5221. }
  5222. /* harmony default export */ var template_title = (TemplateTitle);
  5223. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/index.js
  5224. /**
  5225. * External dependencies
  5226. */
  5227. /**
  5228. * WordPress dependencies
  5229. */
  5230. /**
  5231. * Internal dependencies
  5232. */
  5233. function Header(_ref) {
  5234. let {
  5235. setEntitiesSavedStatesCallback
  5236. } = _ref;
  5237. const {
  5238. hasActiveMetaboxes,
  5239. isPublishSidebarOpened,
  5240. isSaving,
  5241. showIconLabels,
  5242. hasReducedUI
  5243. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  5244. hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
  5245. isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(),
  5246. isSaving: select(store_store).isSavingMetaBoxes(),
  5247. showIconLabels: select(store_store).isFeatureActive('showIconLabels'),
  5248. hasReducedUI: select(store_store).isFeatureActive('reducedUI')
  5249. }), []);
  5250. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
  5251. const classes = classnames_default()('edit-post-header', {
  5252. 'has-reduced-ui': hasReducedUI
  5253. });
  5254. return (0,external_wp_element_namespaceObject.createElement)("div", {
  5255. className: classes
  5256. }, (0,external_wp_element_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_wp_element_namespaceObject.createElement)(fullscreen_mode_close, {
  5257. showTooltip: true
  5258. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  5259. className: "edit-post-header__toolbar"
  5260. }, (0,external_wp_element_namespaceObject.createElement)(header_toolbar, null), (0,external_wp_element_namespaceObject.createElement)(template_title, null)), (0,external_wp_element_namespaceObject.createElement)("div", {
  5261. className: "edit-post-header__settings"
  5262. }, !isPublishSidebarOpened && // This button isn't completely hidden by the publish sidebar.
  5263. // We can't hide the whole toolbar when the publish sidebar is open because
  5264. // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
  5265. // We track that DOM node to return focus to the PostPublishButtonOrToggle
  5266. // when the publish sidebar has been closed.
  5267. (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSavedState, {
  5268. forceIsDirty: hasActiveMetaboxes,
  5269. forceIsSaving: isSaving,
  5270. showIconLabels: showIconLabels
  5271. }), (0,external_wp_element_namespaceObject.createElement)(DevicePreview, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, {
  5272. forceIsAutosaveable: hasActiveMetaboxes,
  5273. forcePreviewLink: isSaving ? null : undefined
  5274. }), (0,external_wp_element_namespaceObject.createElement)(post_publish_button_or_toggle, {
  5275. forceIsDirty: hasActiveMetaboxes,
  5276. forceIsSaving: isSaving,
  5277. setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
  5278. }), (isLargeViewport || !showIconLabels) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
  5279. scope: "core/edit-post"
  5280. }), (0,external_wp_element_namespaceObject.createElement)(more_menu, {
  5281. showIconLabels: showIconLabels
  5282. })), showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(more_menu, {
  5283. showIconLabels: showIconLabels
  5284. })));
  5285. }
  5286. /* harmony default export */ var header = (Header);
  5287. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
  5288. /**
  5289. * WordPress dependencies
  5290. */
  5291. const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  5292. xmlns: "http://www.w3.org/2000/svg",
  5293. viewBox: "0 0 24 24"
  5294. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  5295. d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
  5296. }));
  5297. /* harmony default export */ var library_close = (close_close);
  5298. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/secondary-sidebar/inserter-sidebar.js
  5299. /**
  5300. * WordPress dependencies
  5301. */
  5302. /**
  5303. * Internal dependencies
  5304. */
  5305. function InserterSidebar() {
  5306. const {
  5307. insertionPoint,
  5308. showMostUsedBlocks
  5309. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5310. const {
  5311. isFeatureActive,
  5312. __experimentalGetInsertionPoint
  5313. } = select(store_store);
  5314. return {
  5315. insertionPoint: __experimentalGetInsertionPoint(),
  5316. showMostUsedBlocks: isFeatureActive('mostUsedBlocks')
  5317. };
  5318. }, []);
  5319. const {
  5320. setIsInserterOpened
  5321. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5322. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  5323. const TagName = !isMobileViewport ? external_wp_components_namespaceObject.VisuallyHidden : 'div';
  5324. const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
  5325. onClose: () => setIsInserterOpened(false),
  5326. focusOnMount: null
  5327. });
  5328. const libraryRef = (0,external_wp_element_namespaceObject.useRef)();
  5329. (0,external_wp_element_namespaceObject.useEffect)(() => {
  5330. libraryRef.current.focusSearch();
  5331. }, []);
  5332. return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
  5333. ref: inserterDialogRef
  5334. }, inserterDialogProps, {
  5335. className: "edit-post-editor__inserter-panel"
  5336. }), (0,external_wp_element_namespaceObject.createElement)(TagName, {
  5337. className: "edit-post-editor__inserter-panel-header"
  5338. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5339. icon: library_close,
  5340. label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'),
  5341. onClick: () => setIsInserterOpened(false)
  5342. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  5343. className: "edit-post-editor__inserter-panel-content"
  5344. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, {
  5345. showMostUsedBlocks: showMostUsedBlocks,
  5346. showInserterHelpPanel: true,
  5347. shouldFocusBlock: isMobileViewport,
  5348. rootClientId: insertionPoint.rootClientId,
  5349. __experimentalInsertionIndex: insertionPoint.insertionIndex,
  5350. __experimentalFilterValue: insertionPoint.filterValue,
  5351. ref: libraryRef
  5352. })));
  5353. }
  5354. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/secondary-sidebar/list-view-sidebar.js
  5355. /**
  5356. * WordPress dependencies
  5357. */
  5358. /**
  5359. * Internal dependencies
  5360. */
  5361. function ListViewSidebar() {
  5362. const {
  5363. setIsListViewOpened
  5364. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5365. const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
  5366. const headerFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
  5367. const contentFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
  5368. function closeOnEscape(event) {
  5369. if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
  5370. event.preventDefault();
  5371. setIsListViewOpened(false);
  5372. }
  5373. }
  5374. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar);
  5375. const labelId = `edit-post-editor__list-view-panel-label-${instanceId}`;
  5376. return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
  5377. (0,external_wp_element_namespaceObject.createElement)("div", {
  5378. "aria-labelledby": labelId,
  5379. className: "edit-post-editor__list-view-panel",
  5380. onKeyDown: closeOnEscape
  5381. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  5382. className: "edit-post-editor__list-view-panel-header",
  5383. ref: headerFocusReturnRef
  5384. }, (0,external_wp_element_namespaceObject.createElement)("strong", {
  5385. id: labelId
  5386. }, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5387. icon: close_small,
  5388. label: (0,external_wp_i18n_namespaceObject.__)('Close List View Sidebar'),
  5389. onClick: () => setIsListViewOpened(false)
  5390. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  5391. className: "edit-post-editor__list-view-panel-content",
  5392. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([contentFocusReturnRef, focusOnMountRef])
  5393. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, null)))
  5394. );
  5395. }
  5396. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js
  5397. /**
  5398. * WordPress dependencies
  5399. */
  5400. const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  5401. xmlns: "http://www.w3.org/2000/svg",
  5402. viewBox: "0 0 24 24"
  5403. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  5404. fillRule: "evenodd",
  5405. d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",
  5406. clipRule: "evenodd"
  5407. }));
  5408. /* harmony default export */ var library_cog = (cog);
  5409. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-header/index.js
  5410. /**
  5411. * WordPress dependencies
  5412. */
  5413. /**
  5414. * Internal dependencies
  5415. */
  5416. const SettingsHeader = _ref => {
  5417. let {
  5418. sidebarName
  5419. } = _ref;
  5420. const {
  5421. openGeneralSidebar
  5422. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5423. const openDocumentSettings = () => openGeneralSidebar('edit-post/document');
  5424. const openBlockSettings = () => openGeneralSidebar('edit-post/block');
  5425. const {
  5426. documentLabel,
  5427. isTemplateMode
  5428. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5429. const postTypeLabel = select(external_wp_editor_namespaceObject.store).getPostTypeLabel();
  5430. return {
  5431. // translators: Default label for the Document sidebar tab, not selected.
  5432. documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'),
  5433. isTemplateMode: select(store_store).isEditingTemplate()
  5434. };
  5435. }, []);
  5436. const [documentAriaLabel, documentActiveClass] = sidebarName === 'edit-post/document' ? // translators: ARIA label for the Document sidebar tab, selected. %s: Document label.
  5437. [(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s (selected)'), documentLabel), 'is-active'] : [documentLabel, ''];
  5438. const [blockAriaLabel, blockActiveClass] = sidebarName === 'edit-post/block' ? // translators: ARIA label for the Block Settings Sidebar tab, selected.
  5439. [(0,external_wp_i18n_namespaceObject.__)('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected.
  5440. [(0,external_wp_i18n_namespaceObject.__)('Block'), ''];
  5441. const [templateAriaLabel, templateActiveClass] = sidebarName === 'edit-post/document' ? [(0,external_wp_i18n_namespaceObject.__)('Template (selected)'), 'is-active'] : [(0,external_wp_i18n_namespaceObject.__)('Template'), ''];
  5442. /* Use a list so screen readers will announce how many tabs there are. */
  5443. return (0,external_wp_element_namespaceObject.createElement)("ul", null, !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5444. onClick: openDocumentSettings,
  5445. className: `edit-post-sidebar__panel-tab ${documentActiveClass}`,
  5446. "aria-label": documentAriaLabel,
  5447. "data-label": documentLabel
  5448. }, documentLabel)), isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5449. onClick: openDocumentSettings,
  5450. className: `edit-post-sidebar__panel-tab ${templateActiveClass}`,
  5451. "aria-label": templateAriaLabel,
  5452. "data-label": (0,external_wp_i18n_namespaceObject.__)('Template')
  5453. }, (0,external_wp_i18n_namespaceObject.__)('Template'))), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5454. onClick: openBlockSettings,
  5455. className: `edit-post-sidebar__panel-tab ${blockActiveClass}`,
  5456. "aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab.
  5457. ,
  5458. "data-label": (0,external_wp_i18n_namespaceObject.__)('Block')
  5459. }, // translators: Text label for the Block Settings Sidebar tab.
  5460. (0,external_wp_i18n_namespaceObject.__)('Block'))));
  5461. };
  5462. /* harmony default export */ var settings_header = (SettingsHeader);
  5463. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-visibility/index.js
  5464. /**
  5465. * WordPress dependencies
  5466. */
  5467. function PostVisibility() {
  5468. // Use internal state instead of a ref to make sure that the component
  5469. // re-renders when the popover's anchor updates.
  5470. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time.
  5471. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  5472. // Anchor the popover to the middle of the entire row so that it doesn't
  5473. // move around when the label changes.
  5474. anchor: popoverAnchor
  5475. }), [popoverAnchor]);
  5476. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityCheck, {
  5477. render: _ref => {
  5478. let {
  5479. canEdit
  5480. } = _ref;
  5481. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5482. ref: setPopoverAnchor,
  5483. className: "edit-post-post-visibility"
  5484. }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Visibility')), !canEdit && (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityLabel, null)), canEdit && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
  5485. position: "bottom left",
  5486. contentClassName: "edit-post-post-visibility__dialog",
  5487. popoverProps: popoverProps,
  5488. focusOnMount: true,
  5489. renderToggle: _ref2 => {
  5490. let {
  5491. isOpen,
  5492. onToggle
  5493. } = _ref2;
  5494. return (0,external_wp_element_namespaceObject.createElement)(PostVisibilityToggle, {
  5495. isOpen: isOpen,
  5496. onClick: onToggle
  5497. });
  5498. },
  5499. renderContent: _ref3 => {
  5500. let {
  5501. onClose
  5502. } = _ref3;
  5503. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibility, {
  5504. onClose: onClose
  5505. });
  5506. }
  5507. }));
  5508. }
  5509. });
  5510. }
  5511. function PostVisibilityToggle(_ref4) {
  5512. let {
  5513. isOpen,
  5514. onClick
  5515. } = _ref4;
  5516. const label = (0,external_wp_editor_namespaceObject.usePostVisibilityLabel)();
  5517. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5518. className: "edit-post-post-visibility__toggle",
  5519. variant: "tertiary",
  5520. "aria-expanded": isOpen // translators: %s: Current post visibility.
  5521. ,
  5522. "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Select visibility: %s'), label),
  5523. onClick: onClick
  5524. }, label);
  5525. }
  5526. /* harmony default export */ var post_visibility = (PostVisibility);
  5527. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-trash/index.js
  5528. /**
  5529. * WordPress dependencies
  5530. */
  5531. function PostTrash() {
  5532. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrashCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrash, null)));
  5533. }
  5534. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-schedule/index.js
  5535. /**
  5536. * WordPress dependencies
  5537. */
  5538. function PostSchedule() {
  5539. // Use internal state instead of a ref to make sure that the component
  5540. // re-renders when the popover's anchor updates.
  5541. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time.
  5542. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  5543. anchor: popoverAnchor
  5544. }), [popoverAnchor]);
  5545. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostScheduleCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5546. className: "edit-post-post-schedule",
  5547. ref: setPopoverAnchor
  5548. }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Publish')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
  5549. popoverProps: popoverProps,
  5550. position: "bottom left",
  5551. contentClassName: "edit-post-post-schedule__dialog",
  5552. focusOnMount: true,
  5553. renderToggle: _ref => {
  5554. let {
  5555. isOpen,
  5556. onToggle
  5557. } = _ref;
  5558. return (0,external_wp_element_namespaceObject.createElement)(PostScheduleToggle, {
  5559. isOpen: isOpen,
  5560. onClick: onToggle
  5561. });
  5562. },
  5563. renderContent: _ref2 => {
  5564. let {
  5565. onClose
  5566. } = _ref2;
  5567. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSchedule, {
  5568. onClose: onClose
  5569. });
  5570. }
  5571. })));
  5572. }
  5573. function PostScheduleToggle(_ref3) {
  5574. let {
  5575. isOpen,
  5576. onClick
  5577. } = _ref3;
  5578. const label = (0,external_wp_editor_namespaceObject.usePostScheduleLabel)();
  5579. const fullLabel = (0,external_wp_editor_namespaceObject.usePostScheduleLabel)({
  5580. full: true
  5581. });
  5582. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5583. className: "edit-post-post-schedule__toggle",
  5584. variant: "tertiary",
  5585. label: fullLabel,
  5586. showTooltip: true,
  5587. "aria-expanded": isOpen // translators: %s: Current post date.
  5588. ,
  5589. "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change date: %s'), label),
  5590. onClick: onClick
  5591. }, label);
  5592. }
  5593. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-sticky/index.js
  5594. /**
  5595. * WordPress dependencies
  5596. */
  5597. function PostSticky() {
  5598. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostStickyCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSticky, null)));
  5599. }
  5600. /* harmony default export */ var post_sticky = (PostSticky);
  5601. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-author/index.js
  5602. /**
  5603. * WordPress dependencies
  5604. */
  5605. function PostAuthor() {
  5606. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthorCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5607. className: "edit-post-post-author"
  5608. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthor, null)));
  5609. }
  5610. /* harmony default export */ var post_author = (PostAuthor);
  5611. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-slug/index.js
  5612. /**
  5613. * WordPress dependencies
  5614. */
  5615. function PostSlug() {
  5616. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlugCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5617. className: "edit-post-post-slug"
  5618. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlug, null)));
  5619. }
  5620. /* harmony default export */ var post_slug = (PostSlug);
  5621. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-format/index.js
  5622. /**
  5623. * WordPress dependencies
  5624. */
  5625. function PostFormat() {
  5626. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormatCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5627. className: "edit-post-post-format"
  5628. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormat, null)));
  5629. }
  5630. /* harmony default export */ var post_format = (PostFormat);
  5631. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-pending-status/index.js
  5632. /**
  5633. * WordPress dependencies
  5634. */
  5635. function PostPendingStatus() {
  5636. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatusCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatus, null)));
  5637. }
  5638. /* harmony default export */ var post_pending_status = (PostPendingStatus);
  5639. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-status-info/index.js
  5640. /**
  5641. * Defines as extensibility slot for the Summary panel.
  5642. */
  5643. /**
  5644. * WordPress dependencies
  5645. */
  5646. const {
  5647. Fill: plugin_post_status_info_Fill,
  5648. Slot: plugin_post_status_info_Slot
  5649. } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostStatusInfo');
  5650. /**
  5651. * Renders a row in the Summary panel of the Document sidebar.
  5652. * It should be noted that this is named and implemented around the function it serves
  5653. * and not its location, which may change in future iterations.
  5654. *
  5655. * @param {Object} props Component properties.
  5656. * @param {string} [props.className] An optional class name added to the row.
  5657. * @param {WPElement} props.children Children to be rendered.
  5658. *
  5659. * @example
  5660. * ```js
  5661. * // Using ES5 syntax
  5662. * var __ = wp.i18n.__;
  5663. * var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
  5664. *
  5665. * function MyPluginPostStatusInfo() {
  5666. * return wp.element.createElement(
  5667. * PluginPostStatusInfo,
  5668. * {
  5669. * className: 'my-plugin-post-status-info',
  5670. * },
  5671. * __( 'My post status info' )
  5672. * )
  5673. * }
  5674. * ```
  5675. *
  5676. * @example
  5677. * ```jsx
  5678. * // Using ESNext syntax
  5679. * import { __ } from '@wordpress/i18n';
  5680. * import { PluginPostStatusInfo } from '@wordpress/edit-post';
  5681. *
  5682. * const MyPluginPostStatusInfo = () => (
  5683. * <PluginPostStatusInfo
  5684. * className="my-plugin-post-status-info"
  5685. * >
  5686. * { __( 'My post status info' ) }
  5687. * </PluginPostStatusInfo>
  5688. * );
  5689. * ```
  5690. *
  5691. * @return {WPComponent} The component to be rendered.
  5692. */
  5693. const PluginPostStatusInfo = _ref => {
  5694. let {
  5695. children,
  5696. className
  5697. } = _ref;
  5698. return (0,external_wp_element_namespaceObject.createElement)(plugin_post_status_info_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5699. className: className
  5700. }, children));
  5701. };
  5702. PluginPostStatusInfo.Slot = plugin_post_status_info_Slot;
  5703. /* harmony default export */ var plugin_post_status_info = (PluginPostStatusInfo);
  5704. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/add-template.js
  5705. /**
  5706. * WordPress dependencies
  5707. */
  5708. const addTemplate = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  5709. viewBox: "0 0 24 24",
  5710. xmlns: "http://www.w3.org/2000/svg"
  5711. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  5712. fillRule: "evenodd",
  5713. clipRule: "evenodd",
  5714. d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z"
  5715. }));
  5716. /* harmony default export */ var add_template = (addTemplate);
  5717. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-template/create-modal.js
  5718. /**
  5719. * WordPress dependencies
  5720. */
  5721. /**
  5722. * Internal dependencies
  5723. */
  5724. const DEFAULT_TITLE = (0,external_wp_i18n_namespaceObject.__)('Custom Template');
  5725. function PostTemplateCreateModal(_ref) {
  5726. let {
  5727. onClose
  5728. } = _ref;
  5729. const defaultBlockTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getEditorSettings().defaultBlockTemplate, []);
  5730. const {
  5731. __unstableCreateTemplate,
  5732. __unstableSwitchToTemplateMode
  5733. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5734. const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
  5735. const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
  5736. const cancel = () => {
  5737. setTitle('');
  5738. onClose();
  5739. };
  5740. const submit = async event => {
  5741. event.preventDefault();
  5742. if (isBusy) {
  5743. return;
  5744. }
  5745. setIsBusy(true);
  5746. const newTemplateContent = defaultBlockTemplate !== null && defaultBlockTemplate !== void 0 ? defaultBlockTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
  5747. tagName: 'header',
  5748. layout: {
  5749. inherit: true
  5750. }
  5751. }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/site-title'), (0,external_wp_blocks_namespaceObject.createBlock)('core/site-tagline')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/separator'), (0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
  5752. tagName: 'main'
  5753. }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
  5754. layout: {
  5755. inherit: true
  5756. }
  5757. }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', {
  5758. layout: {
  5759. inherit: true
  5760. }
  5761. })])]);
  5762. await __unstableCreateTemplate({
  5763. slug: (0,external_wp_url_namespaceObject.cleanForSlug)(title || DEFAULT_TITLE),
  5764. content: newTemplateContent,
  5765. title: title || DEFAULT_TITLE
  5766. });
  5767. setIsBusy(false);
  5768. cancel();
  5769. __unstableSwitchToTemplateMode(true);
  5770. };
  5771. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  5772. title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'),
  5773. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  5774. onRequestClose: cancel,
  5775. className: "edit-post-post-template__create-modal"
  5776. }, (0,external_wp_element_namespaceObject.createElement)("form", {
  5777. className: "edit-post-post-template__create-form",
  5778. onSubmit: submit
  5779. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  5780. align: "flex-start",
  5781. gap: 8
  5782. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  5783. label: (0,external_wp_i18n_namespaceObject.__)('Name'),
  5784. value: title,
  5785. onChange: setTitle,
  5786. placeholder: DEFAULT_TITLE,
  5787. disabled: isBusy,
  5788. help: (0,external_wp_i18n_namespaceObject.__)('Describe the template, e.g. "Post with sidebar". Custom templates can be applied to any post or page.')
  5789. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  5790. justify: "flex-end",
  5791. expanded: false
  5792. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5793. variant: "tertiary",
  5794. onClick: cancel
  5795. }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5796. variant: "primary",
  5797. type: "submit",
  5798. isBusy: isBusy,
  5799. "aria-disabled": isBusy
  5800. }, (0,external_wp_i18n_namespaceObject.__)('Create'))))));
  5801. }
  5802. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-template/form.js
  5803. /**
  5804. * WordPress dependencies
  5805. */
  5806. /**
  5807. * Internal dependencies
  5808. */
  5809. function PostTemplateForm(_ref) {
  5810. var _options$find, _selectedOption$value;
  5811. let {
  5812. onClose
  5813. } = _ref;
  5814. const {
  5815. isPostsPage,
  5816. availableTemplates,
  5817. fetchedTemplates,
  5818. selectedTemplateSlug,
  5819. canCreate,
  5820. canEdit
  5821. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5822. const {
  5823. canUser,
  5824. getEntityRecord,
  5825. getEntityRecords
  5826. } = select(external_wp_coreData_namespaceObject.store);
  5827. const editorSettings = select(external_wp_editor_namespaceObject.store).getEditorSettings();
  5828. const siteSettings = canUser('read', 'settings') ? getEntityRecord('root', 'site') : undefined;
  5829. const _isPostsPage = select(external_wp_editor_namespaceObject.store).getCurrentPostId() === (siteSettings === null || siteSettings === void 0 ? void 0 : siteSettings.page_for_posts);
  5830. const canCreateTemplates = canUser('create', 'templates');
  5831. return {
  5832. isPostsPage: _isPostsPage,
  5833. availableTemplates: editorSettings.availableTemplates,
  5834. fetchedTemplates: canCreateTemplates ? getEntityRecords('postType', 'wp_template', {
  5835. post_type: select(external_wp_editor_namespaceObject.store).getCurrentPostType(),
  5836. per_page: -1
  5837. }) : undefined,
  5838. selectedTemplateSlug: select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template'),
  5839. canCreate: canCreateTemplates && !_isPostsPage && editorSettings.supportsTemplateMode,
  5840. canEdit: canCreateTemplates && editorSettings.supportsTemplateMode && !!select(store_store).getEditedPostTemplate()
  5841. };
  5842. }, []);
  5843. const options = (0,external_wp_element_namespaceObject.useMemo)(() => Object.entries({ ...availableTemplates,
  5844. ...Object.fromEntries((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(_ref2 => {
  5845. let {
  5846. slug,
  5847. title
  5848. } = _ref2;
  5849. return [slug, title.rendered];
  5850. }))
  5851. }).map(_ref3 => {
  5852. let [slug, title] = _ref3;
  5853. return {
  5854. value: slug,
  5855. label: title
  5856. };
  5857. }), [availableTemplates, fetchedTemplates]);
  5858. const selectedOption = (_options$find = options.find(option => option.value === selectedTemplateSlug)) !== null && _options$find !== void 0 ? _options$find : options.find(option => !option.value); // The default option has '' value.
  5859. const {
  5860. editPost
  5861. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
  5862. const {
  5863. __unstableSwitchToTemplateMode
  5864. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5865. const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
  5866. return (0,external_wp_element_namespaceObject.createElement)("div", {
  5867. className: "edit-post-post-template__form"
  5868. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, {
  5869. title: (0,external_wp_i18n_namespaceObject.__)('Template'),
  5870. help: (0,external_wp_i18n_namespaceObject.__)('Templates define the way content is displayed when viewing your site.'),
  5871. actions: canCreate ? [{
  5872. icon: add_template,
  5873. label: (0,external_wp_i18n_namespaceObject.__)('Add template'),
  5874. onClick: () => setIsCreateModalOpen(true)
  5875. }] : [],
  5876. onClose: onClose
  5877. }), isPostsPage ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
  5878. className: "edit-post-post-template__notice",
  5879. status: "warning",
  5880. isDismissible: false
  5881. }, (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.')) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
  5882. hideLabelFromVision: true,
  5883. label: (0,external_wp_i18n_namespaceObject.__)('Template'),
  5884. value: (_selectedOption$value = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '',
  5885. options: options,
  5886. onChange: slug => editPost({
  5887. template: slug || ''
  5888. })
  5889. }), canEdit && (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5890. variant: "link",
  5891. onClick: () => __unstableSwitchToTemplateMode()
  5892. }, (0,external_wp_i18n_namespaceObject.__)('Edit template'))), isCreateModalOpen && (0,external_wp_element_namespaceObject.createElement)(PostTemplateCreateModal, {
  5893. onClose: () => setIsCreateModalOpen(false)
  5894. }));
  5895. }
  5896. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-template/index.js
  5897. /**
  5898. * WordPress dependencies
  5899. */
  5900. /**
  5901. * Internal dependencies
  5902. */
  5903. function PostTemplate() {
  5904. // Use internal state instead of a ref to make sure that the component
  5905. // re-renders when the popover's anchor updates.
  5906. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time.
  5907. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  5908. anchor: popoverAnchor
  5909. }), [popoverAnchor]);
  5910. const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5911. var _select$canUser;
  5912. const postTypeSlug = select(external_wp_editor_namespaceObject.store).getCurrentPostType();
  5913. const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug);
  5914. if (!(postType !== null && postType !== void 0 && postType.viewable)) {
  5915. return false;
  5916. }
  5917. const settings = select(external_wp_editor_namespaceObject.store).getEditorSettings();
  5918. const hasTemplates = !!settings.availableTemplates && Object.keys(settings.availableTemplates).length > 0;
  5919. if (hasTemplates) {
  5920. return true;
  5921. }
  5922. if (!settings.supportsTemplateMode) {
  5923. return false;
  5924. }
  5925. const canCreateTemplates = (_select$canUser = select(external_wp_coreData_namespaceObject.store).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false;
  5926. return canCreateTemplates;
  5927. }, []);
  5928. if (!isVisible) {
  5929. return null;
  5930. }
  5931. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5932. className: "edit-post-post-template",
  5933. ref: setPopoverAnchor
  5934. }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Template')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
  5935. popoverProps: popoverProps,
  5936. position: "bottom left",
  5937. className: "edit-post-post-template__dropdown",
  5938. contentClassName: "edit-post-post-template__dialog",
  5939. focusOnMount: true,
  5940. renderToggle: _ref => {
  5941. let {
  5942. isOpen,
  5943. onToggle
  5944. } = _ref;
  5945. return (0,external_wp_element_namespaceObject.createElement)(PostTemplateToggle, {
  5946. isOpen: isOpen,
  5947. onClick: onToggle
  5948. });
  5949. },
  5950. renderContent: _ref2 => {
  5951. let {
  5952. onClose
  5953. } = _ref2;
  5954. return (0,external_wp_element_namespaceObject.createElement)(PostTemplateForm, {
  5955. onClose: onClose
  5956. });
  5957. }
  5958. }));
  5959. }
  5960. function PostTemplateToggle(_ref3) {
  5961. let {
  5962. isOpen,
  5963. onClick
  5964. } = _ref3;
  5965. const templateTitle = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5966. var _template$title;
  5967. const templateSlug = select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template');
  5968. const {
  5969. supportsTemplateMode,
  5970. availableTemplates
  5971. } = select(external_wp_editor_namespaceObject.store).getEditorSettings();
  5972. if (!supportsTemplateMode && availableTemplates[templateSlug]) {
  5973. return availableTemplates[templateSlug];
  5974. }
  5975. const template = select(store_store).getEditedPostTemplate();
  5976. return (_template$title = template === null || template === void 0 ? void 0 : template.title) !== null && _template$title !== void 0 ? _template$title : template === null || template === void 0 ? void 0 : template.slug;
  5977. }, []);
  5978. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5979. className: "edit-post-post-template__toggle",
  5980. variant: "tertiary",
  5981. "aria-expanded": isOpen,
  5982. "aria-label": templateTitle ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the currently selected template.
  5983. (0,external_wp_i18n_namespaceObject.__)('Select template: %s'), templateTitle) : (0,external_wp_i18n_namespaceObject.__)('Select template'),
  5984. onClick: onClick
  5985. }, templateTitle !== null && templateTitle !== void 0 ? templateTitle : (0,external_wp_i18n_namespaceObject.__)('Default template'));
  5986. }
  5987. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-url/index.js
  5988. /**
  5989. * WordPress dependencies
  5990. */
  5991. function PostURL() {
  5992. // Use internal state instead of a ref to make sure that the component
  5993. // re-renders when the popover's anchor updates.
  5994. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time.
  5995. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  5996. anchor: popoverAnchor
  5997. }), [popoverAnchor]);
  5998. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostURLCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5999. className: "edit-post-post-url",
  6000. ref: setPopoverAnchor
  6001. }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('URL')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
  6002. popoverProps: popoverProps,
  6003. position: "bottom left",
  6004. className: "edit-post-post-url__dropdown",
  6005. contentClassName: "edit-post-post-url__dialog",
  6006. focusOnMount: true,
  6007. renderToggle: _ref => {
  6008. let {
  6009. isOpen,
  6010. onToggle
  6011. } = _ref;
  6012. return (0,external_wp_element_namespaceObject.createElement)(PostURLToggle, {
  6013. isOpen: isOpen,
  6014. onClick: onToggle
  6015. });
  6016. },
  6017. renderContent: _ref2 => {
  6018. let {
  6019. onClose
  6020. } = _ref2;
  6021. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostURL, {
  6022. onClose: onClose
  6023. });
  6024. }
  6025. })));
  6026. }
  6027. function PostURLToggle(_ref3) {
  6028. let {
  6029. isOpen,
  6030. onClick
  6031. } = _ref3;
  6032. const label = (0,external_wp_editor_namespaceObject.usePostURLLabel)();
  6033. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6034. className: "edit-post-post-url__toggle",
  6035. variant: "tertiary",
  6036. "aria-expanded": isOpen // translators: %s: Current post URL.
  6037. ,
  6038. "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change URL: %s'), label),
  6039. onClick: onClick
  6040. }, label);
  6041. }
  6042. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-status/index.js
  6043. /**
  6044. * WordPress dependencies
  6045. */
  6046. /**
  6047. * Internal dependencies
  6048. */
  6049. /**
  6050. * Module Constants
  6051. */
  6052. const PANEL_NAME = 'post-status';
  6053. function PostStatus(_ref) {
  6054. let {
  6055. isOpened,
  6056. onTogglePanel
  6057. } = _ref;
  6058. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6059. className: "edit-post-post-status",
  6060. title: (0,external_wp_i18n_namespaceObject.__)('Summary'),
  6061. opened: isOpened,
  6062. onToggle: onTogglePanel
  6063. }, (0,external_wp_element_namespaceObject.createElement)(plugin_post_status_info.Slot, null, fills => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(post_visibility, null), (0,external_wp_element_namespaceObject.createElement)(PostSchedule, null), (0,external_wp_element_namespaceObject.createElement)(PostURL, null), (0,external_wp_element_namespaceObject.createElement)(PostTemplate, null), (0,external_wp_element_namespaceObject.createElement)(post_sticky, null), (0,external_wp_element_namespaceObject.createElement)(post_pending_status, null), (0,external_wp_element_namespaceObject.createElement)(post_format, null), (0,external_wp_element_namespaceObject.createElement)(post_slug, null), (0,external_wp_element_namespaceObject.createElement)(post_author, null), fills, (0,external_wp_element_namespaceObject.createElement)(PostTrash, null))));
  6064. }
  6065. /* harmony default export */ var post_status = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  6066. // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
  6067. // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
  6068. const {
  6069. isEditorPanelRemoved,
  6070. isEditorPanelOpened
  6071. } = select(store_store);
  6072. return {
  6073. isRemoved: isEditorPanelRemoved(PANEL_NAME),
  6074. isOpened: isEditorPanelOpened(PANEL_NAME)
  6075. };
  6076. }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
  6077. let {
  6078. isRemoved
  6079. } = _ref2;
  6080. return !isRemoved;
  6081. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  6082. onTogglePanel() {
  6083. return dispatch(store_store).toggleEditorPanelOpened(PANEL_NAME);
  6084. }
  6085. }))])(PostStatus));
  6086. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/last-revision/index.js
  6087. /**
  6088. * WordPress dependencies
  6089. */
  6090. function LastRevision() {
  6091. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevisionCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6092. className: "edit-post-last-revision__panel"
  6093. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevision, null)));
  6094. }
  6095. /* harmony default export */ var last_revision = (LastRevision);
  6096. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js
  6097. /**
  6098. * External dependencies
  6099. */
  6100. /**
  6101. * WordPress dependencies
  6102. */
  6103. /**
  6104. * Internal dependencies
  6105. */
  6106. function TaxonomyPanel(_ref) {
  6107. let {
  6108. isEnabled,
  6109. taxonomy,
  6110. isOpened,
  6111. onTogglePanel,
  6112. children
  6113. } = _ref;
  6114. if (!isEnabled) {
  6115. return null;
  6116. }
  6117. const taxonomyMenuName = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'menu_name']);
  6118. if (!taxonomyMenuName) {
  6119. return null;
  6120. }
  6121. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6122. title: taxonomyMenuName,
  6123. opened: isOpened,
  6124. onToggle: onTogglePanel
  6125. }, children);
  6126. }
  6127. /* harmony default export */ var taxonomy_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
  6128. const slug = (0,external_lodash_namespaceObject.get)(ownProps.taxonomy, ['slug']);
  6129. const panelName = slug ? `taxonomy-panel-${slug}` : '';
  6130. return {
  6131. panelName,
  6132. isEnabled: slug ? select(store_store).isEditorPanelEnabled(panelName) : false,
  6133. isOpened: slug ? select(store_store).isEditorPanelOpened(panelName) : false
  6134. };
  6135. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({
  6136. onTogglePanel: () => {
  6137. dispatch(store_store).toggleEditorPanelOpened(ownProps.panelName);
  6138. }
  6139. })))(TaxonomyPanel));
  6140. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-taxonomies/index.js
  6141. /**
  6142. * WordPress dependencies
  6143. */
  6144. /**
  6145. * Internal dependencies
  6146. */
  6147. function PostTaxonomies() {
  6148. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomiesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, {
  6149. taxonomyWrapper: (content, taxonomy) => {
  6150. return (0,external_wp_element_namespaceObject.createElement)(taxonomy_panel, {
  6151. taxonomy: taxonomy
  6152. }, content);
  6153. }
  6154. }));
  6155. }
  6156. /* harmony default export */ var post_taxonomies = (PostTaxonomies);
  6157. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/featured-image/index.js
  6158. /**
  6159. * External dependencies
  6160. */
  6161. /**
  6162. * WordPress dependencies
  6163. */
  6164. /**
  6165. * Internal dependencies
  6166. */
  6167. /**
  6168. * Module Constants
  6169. */
  6170. const featured_image_PANEL_NAME = 'featured-image';
  6171. function FeaturedImage(_ref) {
  6172. let {
  6173. isEnabled,
  6174. isOpened,
  6175. postType,
  6176. onTogglePanel
  6177. } = _ref;
  6178. if (!isEnabled) {
  6179. return null;
  6180. }
  6181. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6182. title: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'featured_image'], (0,external_wp_i18n_namespaceObject.__)('Featured image')),
  6183. opened: isOpened,
  6184. onToggle: onTogglePanel
  6185. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImage, null)));
  6186. }
  6187. const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => {
  6188. const {
  6189. getEditedPostAttribute
  6190. } = select(external_wp_editor_namespaceObject.store);
  6191. const {
  6192. getPostType
  6193. } = select(external_wp_coreData_namespaceObject.store);
  6194. const {
  6195. isEditorPanelEnabled,
  6196. isEditorPanelOpened
  6197. } = select(store_store);
  6198. return {
  6199. postType: getPostType(getEditedPostAttribute('type')),
  6200. isEnabled: isEditorPanelEnabled(featured_image_PANEL_NAME),
  6201. isOpened: isEditorPanelOpened(featured_image_PANEL_NAME)
  6202. };
  6203. });
  6204. const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  6205. const {
  6206. toggleEditorPanelOpened
  6207. } = dispatch(store_store);
  6208. return {
  6209. onTogglePanel: function () {
  6210. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  6211. args[_key] = arguments[_key];
  6212. }
  6213. return toggleEditorPanelOpened(featured_image_PANEL_NAME, ...args);
  6214. }
  6215. };
  6216. });
  6217. /* harmony default export */ var featured_image = ((0,external_wp_compose_namespaceObject.compose)(applyWithSelect, applyWithDispatch)(FeaturedImage));
  6218. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-excerpt/index.js
  6219. /**
  6220. * WordPress dependencies
  6221. */
  6222. /**
  6223. * Internal dependencies
  6224. */
  6225. /**
  6226. * Module Constants
  6227. */
  6228. const post_excerpt_PANEL_NAME = 'post-excerpt';
  6229. function PostExcerpt(_ref) {
  6230. let {
  6231. isEnabled,
  6232. isOpened,
  6233. onTogglePanel
  6234. } = _ref;
  6235. if (!isEnabled) {
  6236. return null;
  6237. }
  6238. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6239. title: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
  6240. opened: isOpened,
  6241. onToggle: onTogglePanel
  6242. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerpt, null)));
  6243. }
  6244. /* harmony default export */ var post_excerpt = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  6245. return {
  6246. isEnabled: select(store_store).isEditorPanelEnabled(post_excerpt_PANEL_NAME),
  6247. isOpened: select(store_store).isEditorPanelOpened(post_excerpt_PANEL_NAME)
  6248. };
  6249. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  6250. onTogglePanel() {
  6251. return dispatch(store_store).toggleEditorPanelOpened(post_excerpt_PANEL_NAME);
  6252. }
  6253. }))])(PostExcerpt));
  6254. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/discussion-panel/index.js
  6255. /**
  6256. * WordPress dependencies
  6257. */
  6258. /**
  6259. * Internal dependencies
  6260. */
  6261. /**
  6262. * Module Constants
  6263. */
  6264. const discussion_panel_PANEL_NAME = 'discussion-panel';
  6265. function DiscussionPanel(_ref) {
  6266. let {
  6267. isEnabled,
  6268. isOpened,
  6269. onTogglePanel
  6270. } = _ref;
  6271. if (!isEnabled) {
  6272. return null;
  6273. }
  6274. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
  6275. supportKeys: ['comments', 'trackbacks']
  6276. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6277. title: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
  6278. opened: isOpened,
  6279. onToggle: onTogglePanel
  6280. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
  6281. supportKeys: "comments"
  6282. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostComments, null))), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
  6283. supportKeys: "trackbacks"
  6284. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPingbacks, null)))));
  6285. }
  6286. /* harmony default export */ var discussion_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  6287. return {
  6288. isEnabled: select(store_store).isEditorPanelEnabled(discussion_panel_PANEL_NAME),
  6289. isOpened: select(store_store).isEditorPanelOpened(discussion_panel_PANEL_NAME)
  6290. };
  6291. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  6292. onTogglePanel() {
  6293. return dispatch(store_store).toggleEditorPanelOpened(discussion_panel_PANEL_NAME);
  6294. }
  6295. }))])(DiscussionPanel));
  6296. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/page-attributes/index.js
  6297. /**
  6298. * External dependencies
  6299. */
  6300. /**
  6301. * WordPress dependencies
  6302. */
  6303. /**
  6304. * Internal dependencies
  6305. */
  6306. /**
  6307. * Module Constants
  6308. */
  6309. const page_attributes_PANEL_NAME = 'page-attributes';
  6310. function PageAttributes() {
  6311. const {
  6312. isEnabled,
  6313. isOpened,
  6314. postType
  6315. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6316. const {
  6317. getEditedPostAttribute
  6318. } = select(external_wp_editor_namespaceObject.store);
  6319. const {
  6320. isEditorPanelEnabled,
  6321. isEditorPanelOpened
  6322. } = select(store_store);
  6323. const {
  6324. getPostType
  6325. } = select(external_wp_coreData_namespaceObject.store);
  6326. return {
  6327. isEnabled: isEditorPanelEnabled(page_attributes_PANEL_NAME),
  6328. isOpened: isEditorPanelOpened(page_attributes_PANEL_NAME),
  6329. postType: getPostType(getEditedPostAttribute('type'))
  6330. };
  6331. }, []);
  6332. const {
  6333. toggleEditorPanelOpened
  6334. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  6335. if (!isEnabled || !postType) {
  6336. return null;
  6337. }
  6338. const onTogglePanel = function () {
  6339. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  6340. args[_key] = arguments[_key];
  6341. }
  6342. return toggleEditorPanelOpened(page_attributes_PANEL_NAME, ...args);
  6343. };
  6344. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6345. title: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'attributes'], (0,external_wp_i18n_namespaceObject.__)('Page attributes')),
  6346. opened: isOpened,
  6347. onToggle: onTogglePanel
  6348. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesParent, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesOrder, null))));
  6349. }
  6350. /* harmony default export */ var page_attributes = (PageAttributes);
  6351. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.js
  6352. /**
  6353. * External dependencies
  6354. */
  6355. /**
  6356. * WordPress dependencies
  6357. */
  6358. /**
  6359. * Internal dependencies
  6360. */
  6361. /**
  6362. * Render metabox area.
  6363. *
  6364. * @param {Object} props Component props.
  6365. * @param {string} props.location metabox location.
  6366. * @return {WPComponent} The component to be rendered.
  6367. */
  6368. function MetaBoxesArea(_ref) {
  6369. let {
  6370. location
  6371. } = _ref;
  6372. const container = (0,external_wp_element_namespaceObject.useRef)(null);
  6373. const formRef = (0,external_wp_element_namespaceObject.useRef)(null);
  6374. (0,external_wp_element_namespaceObject.useEffect)(() => {
  6375. formRef.current = document.querySelector('.metabox-location-' + location);
  6376. if (formRef.current) {
  6377. container.current.appendChild(formRef.current);
  6378. }
  6379. return () => {
  6380. if (formRef.current) {
  6381. document.querySelector('#metaboxes').appendChild(formRef.current);
  6382. }
  6383. };
  6384. }, [location]);
  6385. const isSaving = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6386. return select(store_store).isSavingMetaBoxes();
  6387. }, []);
  6388. const classes = classnames_default()('edit-post-meta-boxes-area', `is-${location}`, {
  6389. 'is-loading': isSaving
  6390. });
  6391. return (0,external_wp_element_namespaceObject.createElement)("div", {
  6392. className: classes
  6393. }, isSaving && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_wp_element_namespaceObject.createElement)("div", {
  6394. className: "edit-post-meta-boxes-area__container",
  6395. ref: container
  6396. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  6397. className: "edit-post-meta-boxes-area__clear"
  6398. }));
  6399. }
  6400. /* harmony default export */ var meta_boxes_area = (MetaBoxesArea);
  6401. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-box-visibility.js
  6402. /**
  6403. * WordPress dependencies
  6404. */
  6405. /**
  6406. * Internal dependencies
  6407. */
  6408. class MetaBoxVisibility extends external_wp_element_namespaceObject.Component {
  6409. componentDidMount() {
  6410. this.updateDOM();
  6411. }
  6412. componentDidUpdate(prevProps) {
  6413. if (this.props.isVisible !== prevProps.isVisible) {
  6414. this.updateDOM();
  6415. }
  6416. }
  6417. updateDOM() {
  6418. const {
  6419. id,
  6420. isVisible
  6421. } = this.props;
  6422. const element = document.getElementById(id);
  6423. if (!element) {
  6424. return;
  6425. }
  6426. if (isVisible) {
  6427. element.classList.remove('is-hidden');
  6428. } else {
  6429. element.classList.add('is-hidden');
  6430. }
  6431. }
  6432. render() {
  6433. return null;
  6434. }
  6435. }
  6436. /* harmony default export */ var meta_box_visibility = ((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
  6437. let {
  6438. id
  6439. } = _ref;
  6440. return {
  6441. isVisible: select(store_store).isEditorPanelEnabled(`meta-box-${id}`)
  6442. };
  6443. })(MetaBoxVisibility));
  6444. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/index.js
  6445. /**
  6446. * External dependencies
  6447. */
  6448. /**
  6449. * WordPress dependencies
  6450. */
  6451. /**
  6452. * Internal dependencies
  6453. */
  6454. function MetaBoxes(_ref) {
  6455. let {
  6456. location
  6457. } = _ref;
  6458. const registry = (0,external_wp_data_namespaceObject.useRegistry)();
  6459. const {
  6460. metaBoxes,
  6461. areMetaBoxesInitialized,
  6462. isEditorReady
  6463. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6464. const {
  6465. __unstableIsEditorReady
  6466. } = select(external_wp_editor_namespaceObject.store);
  6467. const {
  6468. getMetaBoxesPerLocation,
  6469. areMetaBoxesInitialized: _areMetaBoxesInitialized
  6470. } = select(store_store);
  6471. return {
  6472. metaBoxes: getMetaBoxesPerLocation(location),
  6473. areMetaBoxesInitialized: _areMetaBoxesInitialized(),
  6474. isEditorReady: __unstableIsEditorReady()
  6475. };
  6476. }, [location]); // When editor is ready, initialize postboxes (wp core script) and metabox
  6477. // saving. This initializes all meta box locations, not just this specific
  6478. // one.
  6479. (0,external_wp_element_namespaceObject.useEffect)(() => {
  6480. if (isEditorReady && !areMetaBoxesInitialized) {
  6481. registry.dispatch(store_store).initializeMetaBoxes();
  6482. }
  6483. }, [isEditorReady, areMetaBoxesInitialized]);
  6484. if (!areMetaBoxesInitialized) {
  6485. return null;
  6486. }
  6487. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_lodash_namespaceObject.map)(metaBoxes, _ref2 => {
  6488. let {
  6489. id
  6490. } = _ref2;
  6491. return (0,external_wp_element_namespaceObject.createElement)(meta_box_visibility, {
  6492. key: id,
  6493. id: id
  6494. });
  6495. }), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_area, {
  6496. location: location
  6497. }));
  6498. }
  6499. ;// CONCATENATED MODULE: external ["wp","warning"]
  6500. var external_wp_warning_namespaceObject = window["wp"]["warning"];
  6501. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-document-setting-panel/index.js
  6502. /**
  6503. * Defines as extensibility slot for the Settings sidebar
  6504. */
  6505. /**
  6506. * WordPress dependencies
  6507. */
  6508. /**
  6509. * Internal dependencies
  6510. */
  6511. const {
  6512. Fill: plugin_document_setting_panel_Fill,
  6513. Slot: plugin_document_setting_panel_Slot
  6514. } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel');
  6515. const PluginDocumentSettingFill = _ref => {
  6516. let {
  6517. isEnabled,
  6518. panelName,
  6519. opened,
  6520. onToggle,
  6521. className,
  6522. title,
  6523. icon,
  6524. children
  6525. } = _ref;
  6526. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel, {
  6527. label: title,
  6528. panelName: panelName
  6529. }), (0,external_wp_element_namespaceObject.createElement)(plugin_document_setting_panel_Fill, null, isEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6530. className: className,
  6531. title: title,
  6532. icon: icon,
  6533. opened: opened,
  6534. onToggle: onToggle
  6535. }, children)));
  6536. };
  6537. /**
  6538. * Renders items below the Status & Availability panel in the Document Sidebar.
  6539. *
  6540. * @param {Object} props Component properties.
  6541. * @param {string} [props.name] The machine-friendly name for the panel.
  6542. * @param {string} [props.className] An optional class name added to the row.
  6543. * @param {string} [props.title] The title of the panel
  6544. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
  6545. *
  6546. * @example
  6547. * ```js
  6548. * // Using ES5 syntax
  6549. * var el = wp.element.createElement;
  6550. * var __ = wp.i18n.__;
  6551. * var registerPlugin = wp.plugins.registerPlugin;
  6552. * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;
  6553. *
  6554. * function MyDocumentSettingPlugin() {
  6555. * return el(
  6556. * PluginDocumentSettingPanel,
  6557. * {
  6558. * className: 'my-document-setting-plugin',
  6559. * title: 'My Panel',
  6560. * },
  6561. * __( 'My Document Setting Panel' )
  6562. * );
  6563. * }
  6564. *
  6565. * registerPlugin( 'my-document-setting-plugin', {
  6566. * render: MyDocumentSettingPlugin
  6567. * } );
  6568. * ```
  6569. *
  6570. * @example
  6571. * ```jsx
  6572. * // Using ESNext syntax
  6573. * import { registerPlugin } from '@wordpress/plugins';
  6574. * import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
  6575. *
  6576. * const MyDocumentSettingTest = () => (
  6577. * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel">
  6578. * <p>My Document Setting Panel</p>
  6579. * </PluginDocumentSettingPanel>
  6580. * );
  6581. *
  6582. * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
  6583. * ```
  6584. *
  6585. * @return {WPComponent} The component to be rendered.
  6586. */
  6587. const PluginDocumentSettingPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  6588. if (undefined === ownProps.name) {
  6589. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  6590. }
  6591. return {
  6592. panelName: `${context.name}/${ownProps.name}`
  6593. };
  6594. }), (0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => {
  6595. let {
  6596. panelName
  6597. } = _ref2;
  6598. return {
  6599. opened: select(store_store).isEditorPanelOpened(panelName),
  6600. isEnabled: select(store_store).isEditorPanelEnabled(panelName)
  6601. };
  6602. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => {
  6603. let {
  6604. panelName
  6605. } = _ref3;
  6606. return {
  6607. onToggle() {
  6608. return dispatch(store_store).toggleEditorPanelOpened(panelName);
  6609. }
  6610. };
  6611. }))(PluginDocumentSettingFill);
  6612. PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot;
  6613. /* harmony default export */ var plugin_document_setting_panel = (PluginDocumentSettingPanel);
  6614. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-sidebar/index.js
  6615. /**
  6616. * WordPress dependencies
  6617. */
  6618. /**
  6619. * Internal dependencies
  6620. */
  6621. /**
  6622. * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
  6623. * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
  6624. * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
  6625. *
  6626. * ```js
  6627. * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
  6628. * ```
  6629. *
  6630. * @see PluginSidebarMoreMenuItem
  6631. *
  6632. * @param {Object} props Element props.
  6633. * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
  6634. * @param {string} [props.className] An optional class name added to the sidebar body.
  6635. * @param {string} props.title Title displayed at the top of the sidebar.
  6636. * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
  6637. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
  6638. *
  6639. * @example
  6640. * ```js
  6641. * // Using ES5 syntax
  6642. * var __ = wp.i18n.__;
  6643. * var el = wp.element.createElement;
  6644. * var PanelBody = wp.components.PanelBody;
  6645. * var PluginSidebar = wp.editPost.PluginSidebar;
  6646. * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
  6647. *
  6648. * function MyPluginSidebar() {
  6649. * return el(
  6650. * PluginSidebar,
  6651. * {
  6652. * name: 'my-sidebar',
  6653. * title: 'My sidebar title',
  6654. * icon: moreIcon,
  6655. * },
  6656. * el(
  6657. * PanelBody,
  6658. * {},
  6659. * __( 'My sidebar content' )
  6660. * )
  6661. * );
  6662. * }
  6663. * ```
  6664. *
  6665. * @example
  6666. * ```jsx
  6667. * // Using ESNext syntax
  6668. * import { __ } from '@wordpress/i18n';
  6669. * import { PanelBody } from '@wordpress/components';
  6670. * import { PluginSidebar } from '@wordpress/edit-post';
  6671. * import { more } from '@wordpress/icons';
  6672. *
  6673. * const MyPluginSidebar = () => (
  6674. * <PluginSidebar
  6675. * name="my-sidebar"
  6676. * title="My sidebar title"
  6677. * icon={ more }
  6678. * >
  6679. * <PanelBody>
  6680. * { __( 'My sidebar content' ) }
  6681. * </PanelBody>
  6682. * </PluginSidebar>
  6683. * );
  6684. * ```
  6685. */
  6686. function PluginSidebarEditPost(_ref) {
  6687. let {
  6688. className,
  6689. ...props
  6690. } = _ref;
  6691. const {
  6692. postTitle,
  6693. shortcut,
  6694. showIconLabels
  6695. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6696. return {
  6697. postTitle: select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('title'),
  6698. shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'),
  6699. showIconLabels: select(store_store).isFeatureActive('showIconLabels')
  6700. };
  6701. }, []);
  6702. return (0,external_wp_element_namespaceObject.createElement)(complementary_area, _extends({
  6703. panelClassName: className,
  6704. className: "edit-post-sidebar",
  6705. smallScreenTitle: postTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)'),
  6706. scope: "core/edit-post",
  6707. toggleShortcut: shortcut,
  6708. showIconLabels: showIconLabels
  6709. }, props));
  6710. }
  6711. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
  6712. /**
  6713. * WordPress dependencies
  6714. */
  6715. const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  6716. xmlns: "http://www.w3.org/2000/svg",
  6717. viewBox: "0 0 24 24"
  6718. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  6719. d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
  6720. }));
  6721. /* harmony default export */ var library_layout = (layout);
  6722. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template-summary/index.js
  6723. /**
  6724. * WordPress dependencies
  6725. */
  6726. /**
  6727. * Internal dependencies
  6728. */
  6729. function TemplateSummary() {
  6730. const template = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6731. const {
  6732. getEditedPostTemplate
  6733. } = select(store_store);
  6734. return getEditedPostTemplate();
  6735. }, []);
  6736. if (!template) {
  6737. return null;
  6738. }
  6739. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  6740. align: "flex-start",
  6741. gap: "3"
  6742. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, {
  6743. icon: library_layout
  6744. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("h2", {
  6745. className: "edit-post-template-summary__title"
  6746. }, (template === null || template === void 0 ? void 0 : template.title) || (template === null || template === void 0 ? void 0 : template.slug)), (0,external_wp_element_namespaceObject.createElement)("p", null, template === null || template === void 0 ? void 0 : template.description))));
  6747. }
  6748. /* harmony default export */ var template_summary = (TemplateSummary);
  6749. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-sidebar/index.js
  6750. /**
  6751. * WordPress dependencies
  6752. */
  6753. /**
  6754. * Internal dependencies
  6755. */
  6756. const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({
  6757. web: true,
  6758. native: false
  6759. });
  6760. const SettingsSidebar = () => {
  6761. const {
  6762. sidebarName,
  6763. keyboardShortcut,
  6764. isTemplateMode
  6765. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6766. // The settings sidebar is used by the edit-post/document and edit-post/block sidebars.
  6767. // sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed.
  6768. // If one of the two sidebars is active the component will contain the content of that sidebar.
  6769. // When neither of the two sidebars is active we can not simply return null, because the PluginSidebarEditPost
  6770. // component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName
  6771. // should contain the sidebar that will be active when the toggle button is pressed. If a block
  6772. // is selected, that should be edit-post/block otherwise it's edit-post/document.
  6773. let sidebar = select(store).getActiveComplementaryArea(store_store.name);
  6774. if (!['edit-post/document', 'edit-post/block'].includes(sidebar)) {
  6775. if (select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()) {
  6776. sidebar = 'edit-post/block';
  6777. }
  6778. sidebar = 'edit-post/document';
  6779. }
  6780. const shortcut = select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar');
  6781. return {
  6782. sidebarName: sidebar,
  6783. keyboardShortcut: shortcut,
  6784. isTemplateMode: select(store_store).isEditingTemplate()
  6785. };
  6786. }, []);
  6787. return (0,external_wp_element_namespaceObject.createElement)(PluginSidebarEditPost, {
  6788. identifier: sidebarName,
  6789. header: (0,external_wp_element_namespaceObject.createElement)(settings_header, {
  6790. sidebarName: sidebarName
  6791. }),
  6792. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings'),
  6793. headerClassName: "edit-post-sidebar__panel-tabs"
  6794. /* translators: button label text should, if possible, be under 16 characters. */
  6795. ,
  6796. title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
  6797. toggleShortcut: keyboardShortcut,
  6798. icon: library_cog,
  6799. isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
  6800. }, !isTemplateMode && sidebarName === 'edit-post/document' && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(post_status, null), (0,external_wp_element_namespaceObject.createElement)(plugin_document_setting_panel.Slot, null), (0,external_wp_element_namespaceObject.createElement)(last_revision, null), (0,external_wp_element_namespaceObject.createElement)(post_taxonomies, null), (0,external_wp_element_namespaceObject.createElement)(featured_image, null), (0,external_wp_element_namespaceObject.createElement)(post_excerpt, null), (0,external_wp_element_namespaceObject.createElement)(discussion_panel, null), (0,external_wp_element_namespaceObject.createElement)(page_attributes, null), (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, {
  6801. location: "side"
  6802. })), isTemplateMode && sidebarName === 'edit-post/document' && (0,external_wp_element_namespaceObject.createElement)(template_summary, null), sidebarName === 'edit-post/block' && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null));
  6803. };
  6804. /* harmony default export */ var settings_sidebar = (SettingsSidebar);
  6805. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/image.js
  6806. function WelcomeGuideImage(_ref) {
  6807. let {
  6808. nonAnimatedSrc,
  6809. animatedSrc
  6810. } = _ref;
  6811. return (0,external_wp_element_namespaceObject.createElement)("picture", {
  6812. className: "edit-post-welcome-guide__image"
  6813. }, (0,external_wp_element_namespaceObject.createElement)("source", {
  6814. srcSet: nonAnimatedSrc,
  6815. media: "(prefers-reduced-motion: reduce)"
  6816. }), (0,external_wp_element_namespaceObject.createElement)("img", {
  6817. src: animatedSrc,
  6818. width: "312",
  6819. height: "240",
  6820. alt: ""
  6821. }));
  6822. }
  6823. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/default.js
  6824. /**
  6825. * WordPress dependencies
  6826. */
  6827. /**
  6828. * Internal dependencies
  6829. */
  6830. function WelcomeGuideDefault() {
  6831. const {
  6832. toggleFeature
  6833. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  6834. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
  6835. className: "edit-post-welcome-guide",
  6836. contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor'),
  6837. finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
  6838. onFinish: () => toggleFeature('welcomeGuide'),
  6839. pages: [{
  6840. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  6841. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg",
  6842. animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif"
  6843. }),
  6844. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  6845. className: "edit-post-welcome-guide__heading"
  6846. }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
  6847. className: "edit-post-welcome-guide__text"
  6848. }, (0,external_wp_i18n_namespaceObject.__)('In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.')))
  6849. }, {
  6850. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  6851. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg",
  6852. animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif"
  6853. }),
  6854. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  6855. className: "edit-post-welcome-guide__heading"
  6856. }, (0,external_wp_i18n_namespaceObject.__)('Make each block your own')), (0,external_wp_element_namespaceObject.createElement)("p", {
  6857. className: "edit-post-welcome-guide__text"
  6858. }, (0,external_wp_i18n_namespaceObject.__)('Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.')))
  6859. }, {
  6860. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  6861. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg",
  6862. animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif"
  6863. }),
  6864. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  6865. className: "edit-post-welcome-guide__heading"
  6866. }, (0,external_wp_i18n_namespaceObject.__)('Get to know the block library')), (0,external_wp_element_namespaceObject.createElement)("p", {
  6867. className: "edit-post-welcome-guide__text"
  6868. }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'), {
  6869. InserterIconImage: (0,external_wp_element_namespaceObject.createElement)("img", {
  6870. alt: (0,external_wp_i18n_namespaceObject.__)('inserter'),
  6871. src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"
  6872. })
  6873. })))
  6874. }, {
  6875. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  6876. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
  6877. animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
  6878. }),
  6879. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  6880. className: "edit-post-welcome-guide__heading"
  6881. }, (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
  6882. className: "edit-post-welcome-guide__text"
  6883. }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor? Want to learn more about using it? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  6884. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/')
  6885. }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide."))))
  6886. }]
  6887. });
  6888. }
  6889. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/template.js
  6890. /**
  6891. * WordPress dependencies
  6892. */
  6893. /**
  6894. * Internal dependencies
  6895. */
  6896. function WelcomeGuideTemplate() {
  6897. const {
  6898. toggleFeature
  6899. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  6900. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
  6901. className: "edit-template-welcome-guide",
  6902. contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor'),
  6903. finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
  6904. onFinish: () => toggleFeature('welcomeGuideTemplate'),
  6905. pages: [{
  6906. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  6907. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg",
  6908. animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif"
  6909. }),
  6910. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  6911. className: "edit-post-welcome-guide__heading"
  6912. }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
  6913. className: "edit-post-welcome-guide__text"
  6914. }, (0,external_wp_i18n_namespaceObject.__)('Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor.')))
  6915. }]
  6916. });
  6917. }
  6918. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/index.js
  6919. /**
  6920. * WordPress dependencies
  6921. */
  6922. /**
  6923. * Internal dependencies
  6924. */
  6925. function WelcomeGuide() {
  6926. const {
  6927. isActive,
  6928. isTemplateMode
  6929. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6930. const {
  6931. isFeatureActive,
  6932. isEditingTemplate
  6933. } = select(store_store);
  6934. const _isTemplateMode = isEditingTemplate();
  6935. const feature = _isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide';
  6936. return {
  6937. isActive: isFeatureActive(feature),
  6938. isTemplateMode: _isTemplateMode
  6939. };
  6940. }, []);
  6941. if (!isActive) {
  6942. return null;
  6943. }
  6944. return isTemplateMode ? (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideTemplate, null) : (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideDefault, null);
  6945. }
  6946. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-publish-panel/index.js
  6947. /**
  6948. * WordPress dependencies
  6949. */
  6950. const {
  6951. Fill: plugin_post_publish_panel_Fill,
  6952. Slot: plugin_post_publish_panel_Slot
  6953. } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostPublishPanel');
  6954. const PluginPostPublishPanelFill = _ref => {
  6955. let {
  6956. children,
  6957. className,
  6958. title,
  6959. initialOpen = false,
  6960. icon
  6961. } = _ref;
  6962. return (0,external_wp_element_namespaceObject.createElement)(plugin_post_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6963. className: className,
  6964. initialOpen: initialOpen || !title,
  6965. title: title,
  6966. icon: icon
  6967. }, children));
  6968. };
  6969. /**
  6970. * Renders provided content to the post-publish panel in the publish flow
  6971. * (side panel that opens after a user publishes the post).
  6972. *
  6973. * @param {Object} props Component properties.
  6974. * @param {string} [props.className] An optional class name added to the panel.
  6975. * @param {string} [props.title] Title displayed at the top of the panel.
  6976. * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
  6977. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
  6978. *
  6979. * @example
  6980. * ```js
  6981. * // Using ES5 syntax
  6982. * var __ = wp.i18n.__;
  6983. * var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel;
  6984. *
  6985. * function MyPluginPostPublishPanel() {
  6986. * return wp.element.createElement(
  6987. * PluginPostPublishPanel,
  6988. * {
  6989. * className: 'my-plugin-post-publish-panel',
  6990. * title: __( 'My panel title' ),
  6991. * initialOpen: true,
  6992. * },
  6993. * __( 'My panel content' )
  6994. * );
  6995. * }
  6996. * ```
  6997. *
  6998. * @example
  6999. * ```jsx
  7000. * // Using ESNext syntax
  7001. * import { __ } from '@wordpress/i18n';
  7002. * import { PluginPostPublishPanel } from '@wordpress/edit-post';
  7003. *
  7004. * const MyPluginPostPublishPanel = () => (
  7005. * <PluginPostPublishPanel
  7006. * className="my-plugin-post-publish-panel"
  7007. * title={ __( 'My panel title' ) }
  7008. * initialOpen={ true }
  7009. * >
  7010. * { __( 'My panel content' ) }
  7011. * </PluginPostPublishPanel>
  7012. * );
  7013. * ```
  7014. *
  7015. * @return {WPComponent} The component to be rendered.
  7016. */
  7017. const PluginPostPublishPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  7018. return {
  7019. icon: ownProps.icon || context.icon
  7020. };
  7021. }))(PluginPostPublishPanelFill);
  7022. PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot;
  7023. /* harmony default export */ var plugin_post_publish_panel = (PluginPostPublishPanel);
  7024. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-pre-publish-panel/index.js
  7025. /**
  7026. * WordPress dependencies
  7027. */
  7028. const {
  7029. Fill: plugin_pre_publish_panel_Fill,
  7030. Slot: plugin_pre_publish_panel_Slot
  7031. } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPrePublishPanel');
  7032. const PluginPrePublishPanelFill = _ref => {
  7033. let {
  7034. children,
  7035. className,
  7036. title,
  7037. initialOpen = false,
  7038. icon
  7039. } = _ref;
  7040. return (0,external_wp_element_namespaceObject.createElement)(plugin_pre_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  7041. className: className,
  7042. initialOpen: initialOpen || !title,
  7043. title: title,
  7044. icon: icon
  7045. }, children));
  7046. };
  7047. /**
  7048. * Renders provided content to the pre-publish side panel in the publish flow
  7049. * (side panel that opens when a user first pushes "Publish" from the main editor).
  7050. *
  7051. * @param {Object} props Component props.
  7052. * @param {string} [props.className] An optional class name added to the panel.
  7053. * @param {string} [props.title] Title displayed at the top of the panel.
  7054. * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.
  7055. * When no title is provided it is always opened.
  7056. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
  7057. * icon slug string, or an SVG WP element, to be rendered when
  7058. * the sidebar is pinned to toolbar.
  7059. *
  7060. * @example
  7061. * ```js
  7062. * // Using ES5 syntax
  7063. * var __ = wp.i18n.__;
  7064. * var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;
  7065. *
  7066. * function MyPluginPrePublishPanel() {
  7067. * return wp.element.createElement(
  7068. * PluginPrePublishPanel,
  7069. * {
  7070. * className: 'my-plugin-pre-publish-panel',
  7071. * title: __( 'My panel title' ),
  7072. * initialOpen: true,
  7073. * },
  7074. * __( 'My panel content' )
  7075. * );
  7076. * }
  7077. * ```
  7078. *
  7079. * @example
  7080. * ```jsx
  7081. * // Using ESNext syntax
  7082. * import { __ } from '@wordpress/i18n';
  7083. * import { PluginPrePublishPanel } from '@wordpress/edit-post';
  7084. *
  7085. * const MyPluginPrePublishPanel = () => (
  7086. * <PluginPrePublishPanel
  7087. * className="my-plugin-pre-publish-panel"
  7088. * title={ __( 'My panel title' ) }
  7089. * initialOpen={ true }
  7090. * >
  7091. * { __( 'My panel content' ) }
  7092. * </PluginPrePublishPanel>
  7093. * );
  7094. * ```
  7095. *
  7096. * @return {WPComponent} The component to be rendered.
  7097. */
  7098. const PluginPrePublishPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  7099. return {
  7100. icon: ownProps.icon || context.icon
  7101. };
  7102. }))(PluginPrePublishPanelFill);
  7103. PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot;
  7104. /* harmony default export */ var plugin_pre_publish_panel = (PluginPrePublishPanel);
  7105. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/actions-panel.js
  7106. /**
  7107. * WordPress dependencies
  7108. */
  7109. /**
  7110. * Internal dependencies
  7111. */
  7112. const {
  7113. Fill: actions_panel_Fill,
  7114. Slot: actions_panel_Slot
  7115. } = (0,external_wp_components_namespaceObject.createSlotFill)('ActionsPanel');
  7116. const ActionsPanelFill = (/* unused pure expression or super */ null && (actions_panel_Fill));
  7117. function ActionsPanel(_ref) {
  7118. let {
  7119. setEntitiesSavedStatesCallback,
  7120. closeEntitiesSavedStates,
  7121. isEntitiesSavedStatesOpen
  7122. } = _ref;
  7123. const {
  7124. closePublishSidebar,
  7125. togglePublishSidebar
  7126. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  7127. const {
  7128. publishSidebarOpened,
  7129. hasActiveMetaboxes,
  7130. isSavingMetaBoxes,
  7131. hasNonPostEntityChanges
  7132. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7133. return {
  7134. publishSidebarOpened: select(store_store).isPublishSidebarOpened(),
  7135. hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
  7136. isSavingMetaBoxes: select(store_store).isSavingMetaBoxes(),
  7137. hasNonPostEntityChanges: select(external_wp_editor_namespaceObject.store).hasNonPostEntityChanges()
  7138. };
  7139. }, []);
  7140. const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setEntitiesSavedStatesCallback(true), []); // It is ok for these components to be unmounted when not in visual use.
  7141. // We don't want more than one present at a time, decide which to render.
  7142. let unmountableContent;
  7143. if (publishSidebarOpened) {
  7144. unmountableContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishPanel, {
  7145. onClose: closePublishSidebar,
  7146. forceIsDirty: hasActiveMetaboxes,
  7147. forceIsSaving: isSavingMetaBoxes,
  7148. PrePublishExtension: plugin_pre_publish_panel.Slot,
  7149. PostPublishExtension: plugin_post_publish_panel.Slot
  7150. });
  7151. } else if (hasNonPostEntityChanges) {
  7152. unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", {
  7153. className: "edit-post-layout__toggle-entities-saved-states-panel"
  7154. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  7155. variant: "secondary",
  7156. className: "edit-post-layout__toggle-entities-saved-states-panel-button",
  7157. onClick: openEntitiesSavedStates,
  7158. "aria-expanded": false
  7159. }, (0,external_wp_i18n_namespaceObject.__)('Open save panel')));
  7160. } else {
  7161. unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", {
  7162. className: "edit-post-layout__toggle-publish-panel"
  7163. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  7164. variant: "secondary",
  7165. className: "edit-post-layout__toggle-publish-panel-button",
  7166. onClick: togglePublishSidebar,
  7167. "aria-expanded": false
  7168. }, (0,external_wp_i18n_namespaceObject.__)('Open publish panel')));
  7169. } // Since EntitiesSavedStates controls its own panel, we can keep it
  7170. // always mounted to retain its own component state (such as checkboxes).
  7171. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isEntitiesSavedStatesOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, {
  7172. close: closeEntitiesSavedStates
  7173. }), (0,external_wp_element_namespaceObject.createElement)(actions_panel_Slot, {
  7174. bubblesVirtually: true
  7175. }), !isEntitiesSavedStatesOpen && unmountableContent);
  7176. }
  7177. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/start-page-options/index.js
  7178. /**
  7179. * WordPress dependencies
  7180. */
  7181. /**
  7182. * Internal dependencies
  7183. */
  7184. function useStartPatterns() {
  7185. // A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
  7186. // and it has no postTypes declares and the current post type is page or if
  7187. // the current post type is part of the postTypes declared.
  7188. const {
  7189. blockPatternsWithPostContentBlockType,
  7190. postType
  7191. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7192. const {
  7193. __experimentalGetPatternsByBlockTypes
  7194. } = select(external_wp_blockEditor_namespaceObject.store);
  7195. const {
  7196. getCurrentPostType
  7197. } = select(external_wp_editor_namespaceObject.store);
  7198. return {
  7199. // get pa
  7200. blockPatternsWithPostContentBlockType: __experimentalGetPatternsByBlockTypes('core/post-content'),
  7201. postType: getCurrentPostType()
  7202. };
  7203. }, []);
  7204. return (0,external_wp_element_namespaceObject.useMemo)(() => {
  7205. // filter patterns without postTypes declared if the current postType is page
  7206. // or patterns that declare the current postType in its post type array.
  7207. return blockPatternsWithPostContentBlockType.filter(pattern => {
  7208. return postType === 'page' && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType);
  7209. });
  7210. }, [postType, blockPatternsWithPostContentBlockType]);
  7211. }
  7212. function PatternSelection(_ref) {
  7213. let {
  7214. onChoosePattern
  7215. } = _ref;
  7216. const blockPatterns = useStartPatterns();
  7217. const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(blockPatterns);
  7218. const {
  7219. resetEditorBlocks
  7220. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
  7221. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
  7222. blockPatterns: blockPatterns,
  7223. shownPatterns: shownBlockPatterns,
  7224. onClickPattern: (_pattern, blocks) => {
  7225. resetEditorBlocks(blocks);
  7226. onChoosePattern();
  7227. }
  7228. });
  7229. }
  7230. const START_PAGE_MODAL_STATES = {
  7231. INITIAL: 'INITIAL',
  7232. PATTERN: 'PATTERN',
  7233. CLOSED: 'CLOSED'
  7234. };
  7235. function StartPageOptions() {
  7236. const [modalState, setModalState] = (0,external_wp_element_namespaceObject.useState)(START_PAGE_MODAL_STATES.INITIAL);
  7237. const blockPatterns = useStartPatterns();
  7238. const hasStartPattern = blockPatterns.length > 0;
  7239. const shouldOpenModel = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7240. if (!hasStartPattern || modalState !== START_PAGE_MODAL_STATES.INITIAL) {
  7241. return false;
  7242. }
  7243. const {
  7244. getEditedPostContent,
  7245. isEditedPostSaveable
  7246. } = select(external_wp_editor_namespaceObject.store);
  7247. const {
  7248. isEditingTemplate,
  7249. isFeatureActive
  7250. } = select(store_store);
  7251. return !isEditedPostSaveable() && '' === getEditedPostContent() && !isEditingTemplate() && !isFeatureActive('welcomeGuide');
  7252. }, [modalState, hasStartPattern]);
  7253. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7254. if (shouldOpenModel) {
  7255. setModalState(START_PAGE_MODAL_STATES.PATTERN);
  7256. }
  7257. }, [shouldOpenModel]);
  7258. if (modalState === START_PAGE_MODAL_STATES.INITIAL || modalState === START_PAGE_MODAL_STATES.CLOSED) {
  7259. return null;
  7260. }
  7261. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  7262. className: "edit-post-start-page-options__modal",
  7263. title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'),
  7264. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Cancel'),
  7265. onRequestClose: () => {
  7266. setModalState(START_PAGE_MODAL_STATES.CLOSED);
  7267. }
  7268. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  7269. className: "edit-post-start-page-options__modal-content"
  7270. }, modalState === START_PAGE_MODAL_STATES.PATTERN && (0,external_wp_element_namespaceObject.createElement)(PatternSelection, {
  7271. onChoosePattern: () => {
  7272. setModalState(START_PAGE_MODAL_STATES.CLOSED);
  7273. }
  7274. })));
  7275. }
  7276. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/index.js
  7277. /**
  7278. * External dependencies
  7279. */
  7280. /**
  7281. * WordPress dependencies
  7282. */
  7283. /**
  7284. * Internal dependencies
  7285. */
  7286. const interfaceLabels = {
  7287. /* translators: accessibility text for the editor top bar landmark region. */
  7288. header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'),
  7289. /* translators: accessibility text for the editor content landmark region. */
  7290. body: (0,external_wp_i18n_namespaceObject.__)('Editor content'),
  7291. /* translators: accessibility text for the editor settings landmark region. */
  7292. sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'),
  7293. /* translators: accessibility text for the editor publish landmark region. */
  7294. actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'),
  7295. /* translators: accessibility text for the editor footer landmark region. */
  7296. footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer')
  7297. };
  7298. function Layout(_ref) {
  7299. let {
  7300. styles
  7301. } = _ref;
  7302. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  7303. const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>=');
  7304. const {
  7305. openGeneralSidebar,
  7306. closeGeneralSidebar,
  7307. setIsInserterOpened
  7308. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  7309. const {
  7310. createErrorNotice
  7311. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  7312. const {
  7313. mode,
  7314. isFullscreenActive,
  7315. isRichEditingEnabled,
  7316. sidebarIsOpened,
  7317. hasActiveMetaboxes,
  7318. hasFixedToolbar,
  7319. previousShortcut,
  7320. nextShortcut,
  7321. hasBlockSelected,
  7322. isInserterOpened,
  7323. isListViewOpened,
  7324. showIconLabels,
  7325. hasReducedUI,
  7326. showBlockBreadcrumbs,
  7327. isTemplateMode,
  7328. documentLabel
  7329. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7330. const {
  7331. getEditorSettings,
  7332. getPostTypeLabel
  7333. } = select(external_wp_editor_namespaceObject.store);
  7334. const editorSettings = getEditorSettings();
  7335. const postTypeLabel = getPostTypeLabel();
  7336. return {
  7337. isTemplateMode: select(store_store).isEditingTemplate(),
  7338. hasFixedToolbar: select(store_store).isFeatureActive('fixedToolbar'),
  7339. sidebarIsOpened: !!(select(store).getActiveComplementaryArea(store_store.name) || select(store_store).isPublishSidebarOpened()),
  7340. isFullscreenActive: select(store_store).isFeatureActive('fullscreenMode'),
  7341. isInserterOpened: select(store_store).isInserterOpened(),
  7342. isListViewOpened: select(store_store).isListViewOpened(),
  7343. mode: select(store_store).getEditorMode(),
  7344. isRichEditingEnabled: editorSettings.richEditingEnabled,
  7345. hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
  7346. previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/previous-region'),
  7347. nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/next-region'),
  7348. showIconLabels: select(store_store).isFeatureActive('showIconLabels'),
  7349. hasReducedUI: select(store_store).isFeatureActive('reducedUI'),
  7350. showBlockBreadcrumbs: select(store_store).isFeatureActive('showBlockBreadcrumbs'),
  7351. // translators: Default label for the Document in the Block Breadcrumb.
  7352. documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun')
  7353. };
  7354. }, []);
  7355. const className = classnames_default()('edit-post-layout', 'is-mode-' + mode, {
  7356. 'is-sidebar-opened': sidebarIsOpened,
  7357. 'has-fixed-toolbar': hasFixedToolbar,
  7358. 'has-metaboxes': hasActiveMetaboxes,
  7359. 'show-icon-labels': showIconLabels
  7360. });
  7361. const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); // Inserter and Sidebars are mutually exclusive
  7362. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7363. if (sidebarIsOpened && !isHugeViewport) {
  7364. setIsInserterOpened(false);
  7365. }
  7366. }, [sidebarIsOpened, isHugeViewport]);
  7367. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7368. if (isInserterOpened && !isHugeViewport) {
  7369. closeGeneralSidebar();
  7370. }
  7371. }, [isInserterOpened, isHugeViewport]); // Local state for save panel.
  7372. // Note 'truthy' callback implies an open panel.
  7373. const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false);
  7374. const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => {
  7375. if (typeof entitiesSavedStatesCallback === 'function') {
  7376. entitiesSavedStatesCallback(arg);
  7377. }
  7378. setEntitiesSavedStatesCallback(false);
  7379. }, [entitiesSavedStatesCallback]);
  7380. const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('List View') : (0,external_wp_i18n_namespaceObject.__)('Block Library');
  7381. const secondarySidebar = () => {
  7382. if (mode === 'visual' && isInserterOpened) {
  7383. return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null);
  7384. }
  7385. if (mode === 'visual' && isListViewOpened) {
  7386. return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null);
  7387. }
  7388. return null;
  7389. };
  7390. function onPluginAreaError(name) {
  7391. createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(
  7392. /* translators: %s: plugin name */
  7393. (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
  7394. }
  7395. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(fullscreen_mode, {
  7396. isActive: isFullscreenActive
  7397. }), (0,external_wp_element_namespaceObject.createElement)(browser_url, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.AutosaveMonitor, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.LocalAutosaveMonitor, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, null), (0,external_wp_element_namespaceObject.createElement)(settings_sidebar, null), (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, {
  7398. className: className,
  7399. labels: { ...interfaceLabels,
  7400. secondarySidebar: secondarySidebarLabel
  7401. },
  7402. header: (0,external_wp_element_namespaceObject.createElement)(header, {
  7403. setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
  7404. }),
  7405. secondarySidebar: secondarySidebar(),
  7406. sidebar: (!isMobileViewport || sidebarIsOpened) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !isMobileViewport && !sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)("div", {
  7407. className: "edit-post-layout__toggle-sidebar-panel"
  7408. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  7409. variant: "secondary",
  7410. className: "edit-post-layout__toggle-sidebar-panel-button",
  7411. onClick: openSidebarPanel,
  7412. "aria-expanded": false
  7413. }, hasBlockSelected ? (0,external_wp_i18n_namespaceObject.__)('Open block settings') : (0,external_wp_i18n_namespaceObject.__)('Open document settings'))), (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, {
  7414. scope: "core/edit-post"
  7415. })),
  7416. notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null),
  7417. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && (0,external_wp_element_namespaceObject.createElement)(TextEditor, null), isRichEditingEnabled && mode === 'visual' && (0,external_wp_element_namespaceObject.createElement)(VisualEditor, {
  7418. styles: styles
  7419. }), !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", {
  7420. className: "edit-post-layout__metaboxes"
  7421. }, (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, {
  7422. location: "normal"
  7423. }), (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, {
  7424. location: "advanced"
  7425. })), isMobileViewport && sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ScrollLock, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockStyles.Slot, {
  7426. scope: "core/block-inspector"
  7427. })),
  7428. footer: !hasReducedUI && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && (0,external_wp_element_namespaceObject.createElement)("div", {
  7429. className: "edit-post-layout__footer"
  7430. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
  7431. rootLabelText: documentLabel
  7432. })),
  7433. actions: (0,external_wp_element_namespaceObject.createElement)(ActionsPanel, {
  7434. closeEntitiesSavedStates: closeEntitiesSavedStates,
  7435. isEntitiesSavedStatesOpen: entitiesSavedStatesCallback,
  7436. setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
  7437. }),
  7438. shortcuts: {
  7439. previous: previousShortcut,
  7440. next: nextShortcut
  7441. }
  7442. }), (0,external_wp_element_namespaceObject.createElement)(EditPostPreferencesModal, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null), (0,external_wp_element_namespaceObject.createElement)(StartPageOptions, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, {
  7443. onError: onPluginAreaError
  7444. }));
  7445. }
  7446. /* harmony default export */ var components_layout = (Layout);
  7447. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/listener-hooks.js
  7448. /**
  7449. * WordPress dependencies
  7450. */
  7451. /**
  7452. * Internal dependencies
  7453. */
  7454. /**
  7455. * This listener hook monitors for block selection and triggers the appropriate
  7456. * sidebar state.
  7457. *
  7458. * @param {number} postId The current post id.
  7459. */
  7460. const useBlockSelectionListener = postId => {
  7461. const {
  7462. hasBlockSelection,
  7463. isEditorSidebarOpened
  7464. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  7465. hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(),
  7466. isEditorSidebarOpened: select(constants_STORE_NAME).isEditorSidebarOpened()
  7467. }), [postId]);
  7468. const {
  7469. openGeneralSidebar
  7470. } = (0,external_wp_data_namespaceObject.useDispatch)(constants_STORE_NAME);
  7471. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7472. if (!isEditorSidebarOpened) {
  7473. return;
  7474. }
  7475. if (hasBlockSelection) {
  7476. openGeneralSidebar('edit-post/block');
  7477. } else {
  7478. openGeneralSidebar('edit-post/document');
  7479. }
  7480. }, [hasBlockSelection, isEditorSidebarOpened]);
  7481. };
  7482. /**
  7483. * This listener hook monitors any change in permalink and updates the view
  7484. * post link in the admin bar.
  7485. *
  7486. * @param {number} postId
  7487. */
  7488. const useUpdatePostLinkListener = postId => {
  7489. const {
  7490. newPermalink
  7491. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  7492. newPermalink: select(external_wp_editor_namespaceObject.store).getCurrentPost().link
  7493. }), [postId]);
  7494. const nodeToUpdate = (0,external_wp_element_namespaceObject.useRef)();
  7495. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7496. nodeToUpdate.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR);
  7497. }, [postId]);
  7498. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7499. if (!newPermalink || !nodeToUpdate.current) {
  7500. return;
  7501. }
  7502. nodeToUpdate.current.setAttribute('href', newPermalink);
  7503. }, [newPermalink]);
  7504. };
  7505. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/index.js
  7506. /**
  7507. * Internal dependencies
  7508. */
  7509. /**
  7510. * Data component used for initializing the editor and re-initializes
  7511. * when postId changes or on unmount.
  7512. *
  7513. * @param {number} postId The id of the post.
  7514. * @return {null} This is a data component so does not render any ui.
  7515. */
  7516. function EditorInitialization(_ref) {
  7517. let {
  7518. postId
  7519. } = _ref;
  7520. useBlockSelectionListener(postId);
  7521. useUpdatePostLinkListener(postId);
  7522. return null;
  7523. }
  7524. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/editor.js
  7525. /**
  7526. * External dependencies
  7527. */
  7528. /**
  7529. * WordPress dependencies
  7530. */
  7531. /**
  7532. * Internal dependencies
  7533. */
  7534. function Editor(_ref) {
  7535. let {
  7536. postId,
  7537. postType,
  7538. settings,
  7539. initialEdits,
  7540. onError,
  7541. ...props
  7542. } = _ref;
  7543. const {
  7544. hasFixedToolbar,
  7545. focusMode,
  7546. hasReducedUI,
  7547. hasInlineToolbar,
  7548. hasThemeStyles,
  7549. post,
  7550. preferredStyleVariations,
  7551. hiddenBlockTypes,
  7552. blockTypes,
  7553. keepCaretInsideBlock,
  7554. isTemplateMode,
  7555. template
  7556. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7557. var _getPostType$viewable, _getPostType;
  7558. const {
  7559. isFeatureActive,
  7560. __experimentalGetPreviewDeviceType,
  7561. isEditingTemplate,
  7562. getEditedPostTemplate,
  7563. getHiddenBlockTypes
  7564. } = select(store_store);
  7565. const {
  7566. getEntityRecord,
  7567. getPostType,
  7568. getEntityRecords,
  7569. canUser
  7570. } = select(external_wp_coreData_namespaceObject.store);
  7571. const {
  7572. getEditorSettings
  7573. } = select(external_wp_editor_namespaceObject.store);
  7574. const {
  7575. getBlockTypes
  7576. } = select(external_wp_blocks_namespaceObject.store);
  7577. const isTemplate = ['wp_template', 'wp_template_part'].includes(postType); // Ideally the initializeEditor function should be called using the ID of the REST endpoint.
  7578. // to avoid the special case.
  7579. let postObject;
  7580. if (isTemplate) {
  7581. const posts = getEntityRecords('postType', postType, {
  7582. wp_id: postId
  7583. });
  7584. postObject = posts === null || posts === void 0 ? void 0 : posts[0];
  7585. } else {
  7586. postObject = getEntityRecord('postType', postType, postId);
  7587. }
  7588. const supportsTemplateMode = getEditorSettings().supportsTemplateMode;
  7589. const isViewable = (_getPostType$viewable = (_getPostType = getPostType(postType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
  7590. const canEditTemplate = canUser('create', 'templates');
  7591. return {
  7592. hasFixedToolbar: isFeatureActive('fixedToolbar') || __experimentalGetPreviewDeviceType() !== 'Desktop',
  7593. focusMode: isFeatureActive('focusMode'),
  7594. hasReducedUI: isFeatureActive('reducedUI'),
  7595. hasInlineToolbar: isFeatureActive('inlineToolbar'),
  7596. hasThemeStyles: isFeatureActive('themeStyles'),
  7597. preferredStyleVariations: select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations'),
  7598. hiddenBlockTypes: getHiddenBlockTypes(),
  7599. blockTypes: getBlockTypes(),
  7600. keepCaretInsideBlock: isFeatureActive('keepCaretInsideBlock'),
  7601. isTemplateMode: isEditingTemplate(),
  7602. template: supportsTemplateMode && isViewable && canEditTemplate ? getEditedPostTemplate() : null,
  7603. post: postObject
  7604. };
  7605. }, [postType, postId]);
  7606. const {
  7607. updatePreferredStyleVariations,
  7608. setIsInserterOpened
  7609. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  7610. const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => {
  7611. const result = { ...settings,
  7612. __experimentalPreferredStyleVariations: {
  7613. value: preferredStyleVariations,
  7614. onChange: updatePreferredStyleVariations
  7615. },
  7616. hasFixedToolbar,
  7617. focusMode,
  7618. hasReducedUI,
  7619. hasInlineToolbar,
  7620. // This is marked as experimental to give time for the quick inserter to mature.
  7621. __experimentalSetIsInserterOpened: setIsInserterOpened,
  7622. keepCaretInsideBlock,
  7623. // Keep a reference of the `allowedBlockTypes` from the server to handle use cases
  7624. // where we need to differentiate if a block is disabled by the user or some plugin.
  7625. defaultAllowedBlockTypes: settings.allowedBlockTypes
  7626. }; // Omit hidden block types if exists and non-empty.
  7627. if (hiddenBlockTypes.length > 0) {
  7628. // Defer to passed setting for `allowedBlockTypes` if provided as
  7629. // anything other than `true` (where `true` is equivalent to allow
  7630. // all block types).
  7631. const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? (0,external_lodash_namespaceObject.map)(blockTypes, 'name') : settings.allowedBlockTypes || [];
  7632. result.allowedBlockTypes = (0,external_lodash_namespaceObject.without)(defaultAllowedBlockTypes, ...hiddenBlockTypes);
  7633. }
  7634. return result;
  7635. }, [settings, hasFixedToolbar, focusMode, hasReducedUI, hiddenBlockTypes, blockTypes, preferredStyleVariations, setIsInserterOpened, updatePreferredStyleVariations, keepCaretInsideBlock]);
  7636. const styles = (0,external_wp_element_namespaceObject.useMemo)(() => {
  7637. var _settings$styles;
  7638. const themeStyles = [];
  7639. const presetStyles = [];
  7640. (_settings$styles = settings.styles) === null || _settings$styles === void 0 ? void 0 : _settings$styles.forEach(style => {
  7641. if (!style.__unstableType || style.__unstableType === 'theme') {
  7642. themeStyles.push(style);
  7643. } else {
  7644. presetStyles.push(style);
  7645. }
  7646. });
  7647. const defaultEditorStyles = [...settings.defaultEditorStyles, ...presetStyles];
  7648. return hasThemeStyles && themeStyles.length ? settings.styles : defaultEditorStyles;
  7649. }, [settings, hasThemeStyles]);
  7650. if (!post) {
  7651. return null;
  7652. }
  7653. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.StrictMode, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorProvider, _extends({
  7654. settings: editorSettings,
  7655. post: post,
  7656. initialEdits: initialEdits,
  7657. useSubRegistry: false,
  7658. __unstableTemplate: isTemplateMode ? template : undefined
  7659. }, props), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.ErrorBoundary, {
  7660. onError: onError
  7661. }, (0,external_wp_element_namespaceObject.createElement)(EditorInitialization, {
  7662. postId: postId
  7663. }), (0,external_wp_element_namespaceObject.createElement)(components_layout, {
  7664. styles: styles
  7665. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLockedModal, null)))));
  7666. }
  7667. /* harmony default export */ var editor = (Editor);
  7668. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js
  7669. /**
  7670. * WordPress dependencies
  7671. */
  7672. const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id => !allowed.includes(id)).length === 0;
  7673. /**
  7674. * Plugins may want to add an item to the menu either for every block
  7675. * or only for the specific ones provided in the `allowedBlocks` component property.
  7676. *
  7677. * If there are multiple blocks selected the item will be rendered if every block
  7678. * is of one allowed type (not necessarily the same).
  7679. *
  7680. * @param {string[]} selectedBlocks Array containing the names of the blocks selected
  7681. * @param {string[]} allowedBlocks Array containing the names of the blocks allowed
  7682. * @return {boolean} Whether the item will be rendered or not.
  7683. */
  7684. const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
  7685. /**
  7686. * Renders a new item in the block settings menu.
  7687. *
  7688. * @param {Object} props Component props.
  7689. * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.
  7690. * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
  7691. * @param {string} props.label The menu item text.
  7692. * @param {Function} props.onClick Callback function to be executed when the user click the menu item.
  7693. * @param {boolean} [props.small] Whether to render the label or not.
  7694. * @param {string} [props.role] The ARIA role for the menu item.
  7695. *
  7696. * @example
  7697. * ```js
  7698. * // Using ES5 syntax
  7699. * var __ = wp.i18n.__;
  7700. * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;
  7701. *
  7702. * function doOnClick(){
  7703. * // To be called when the user clicks the menu item.
  7704. * }
  7705. *
  7706. * function MyPluginBlockSettingsMenuItem() {
  7707. * return wp.element.createElement(
  7708. * PluginBlockSettingsMenuItem,
  7709. * {
  7710. * allowedBlocks: [ 'core/paragraph' ],
  7711. * icon: 'dashicon-name',
  7712. * label: __( 'Menu item text' ),
  7713. * onClick: doOnClick,
  7714. * }
  7715. * );
  7716. * }
  7717. * ```
  7718. *
  7719. * @example
  7720. * ```jsx
  7721. * // Using ESNext syntax
  7722. * import { __ } from '@wordpress/i18n';
  7723. * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';
  7724. *
  7725. * const doOnClick = ( ) => {
  7726. * // To be called when the user clicks the menu item.
  7727. * };
  7728. *
  7729. * const MyPluginBlockSettingsMenuItem = () => (
  7730. * <PluginBlockSettingsMenuItem
  7731. * allowedBlocks={ [ 'core/paragraph' ] }
  7732. * icon='dashicon-name'
  7733. * label={ __( 'Menu item text' ) }
  7734. * onClick={ doOnClick } />
  7735. * );
  7736. * ```
  7737. *
  7738. * @return {WPComponent} The component to be rendered.
  7739. */
  7740. const PluginBlockSettingsMenuItem = _ref => {
  7741. let {
  7742. allowedBlocks,
  7743. icon,
  7744. label,
  7745. onClick,
  7746. small,
  7747. role
  7748. } = _ref;
  7749. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => {
  7750. let {
  7751. selectedBlocks,
  7752. onClose
  7753. } = _ref2;
  7754. if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
  7755. return null;
  7756. }
  7757. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  7758. onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose),
  7759. icon: icon,
  7760. label: small ? label : undefined,
  7761. role: role
  7762. }, !small && label);
  7763. });
  7764. };
  7765. /* harmony default export */ var plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem);
  7766. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/plugin-more-menu-item/index.js
  7767. /**
  7768. * WordPress dependencies
  7769. */
  7770. /**
  7771. * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
  7772. * The text within the component appears as the menu item label.
  7773. *
  7774. * @param {Object} props Component properties.
  7775. * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
  7776. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
  7777. * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
  7778. * @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](https://github.com/WordPress/gutenberg/tree/HEAD/packages/components/src/menu-item/README.md) component.
  7779. *
  7780. * @example
  7781. * ```js
  7782. * // Using ES5 syntax
  7783. * var __ = wp.i18n.__;
  7784. * var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem;
  7785. * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
  7786. *
  7787. * function onButtonClick() {
  7788. * alert( 'Button clicked.' );
  7789. * }
  7790. *
  7791. * function MyButtonMoreMenuItem() {
  7792. * return wp.element.createElement(
  7793. * PluginMoreMenuItem,
  7794. * {
  7795. * icon: moreIcon,
  7796. * onClick: onButtonClick,
  7797. * },
  7798. * __( 'My button title' )
  7799. * );
  7800. * }
  7801. * ```
  7802. *
  7803. * @example
  7804. * ```jsx
  7805. * // Using ESNext syntax
  7806. * import { __ } from '@wordpress/i18n';
  7807. * import { PluginMoreMenuItem } from '@wordpress/edit-post';
  7808. * import { more } from '@wordpress/icons';
  7809. *
  7810. * function onButtonClick() {
  7811. * alert( 'Button clicked.' );
  7812. * }
  7813. *
  7814. * const MyButtonMoreMenuItem = () => (
  7815. * <PluginMoreMenuItem
  7816. * icon={ more }
  7817. * onClick={ onButtonClick }
  7818. * >
  7819. * { __( 'My button title' ) }
  7820. * </PluginMoreMenuItem>
  7821. * );
  7822. * ```
  7823. *
  7824. * @return {WPComponent} The component to be rendered.
  7825. */
  7826. /* harmony default export */ var plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  7827. var _ownProps$as;
  7828. return {
  7829. as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem,
  7830. icon: ownProps.icon || context.icon,
  7831. name: 'core/edit-post/plugin-more-menu'
  7832. };
  7833. }))(action_item));
  7834. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/plugin-sidebar-more-menu-item/index.js
  7835. /**
  7836. * WordPress dependencies
  7837. */
  7838. /**
  7839. * Renders a menu item in `Plugins` group in `More Menu` drop down,
  7840. * and can be used to activate the corresponding `PluginSidebar` component.
  7841. * The text within the component appears as the menu item label.
  7842. *
  7843. * @param {Object} props Component props.
  7844. * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
  7845. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
  7846. *
  7847. * @example
  7848. * ```js
  7849. * // Using ES5 syntax
  7850. * var __ = wp.i18n.__;
  7851. * var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem;
  7852. * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
  7853. *
  7854. * function MySidebarMoreMenuItem() {
  7855. * return wp.element.createElement(
  7856. * PluginSidebarMoreMenuItem,
  7857. * {
  7858. * target: 'my-sidebar',
  7859. * icon: moreIcon,
  7860. * },
  7861. * __( 'My sidebar title' )
  7862. * )
  7863. * }
  7864. * ```
  7865. *
  7866. * @example
  7867. * ```jsx
  7868. * // Using ESNext syntax
  7869. * import { __ } from '@wordpress/i18n';
  7870. * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
  7871. * import { more } from '@wordpress/icons';
  7872. *
  7873. * const MySidebarMoreMenuItem = () => (
  7874. * <PluginSidebarMoreMenuItem
  7875. * target="my-sidebar"
  7876. * icon={ more }
  7877. * >
  7878. * { __( 'My sidebar title' ) }
  7879. * </PluginSidebarMoreMenuItem>
  7880. * );
  7881. * ```
  7882. *
  7883. * @return {WPComponent} The component to be rendered.
  7884. */
  7885. function PluginSidebarMoreMenuItem(props) {
  7886. return (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility.
  7887. // @see https://github.com/WordPress/gutenberg/issues/14457
  7888. , _extends({
  7889. __unstableExplicitMenuItem: true,
  7890. scope: "core/edit-post"
  7891. }, props));
  7892. }
  7893. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/index.js
  7894. /**
  7895. * WordPress dependencies
  7896. */
  7897. /**
  7898. * Internal dependencies
  7899. */
  7900. /**
  7901. * Reinitializes the editor after the user chooses to reboot the editor after
  7902. * an unhandled error occurs, replacing previously mounted editor element using
  7903. * an initial state from prior to the crash.
  7904. *
  7905. * @param {Object} postType Post type of the post to edit.
  7906. * @param {Object} postId ID of the post to edit.
  7907. * @param {Element} target DOM node in which editor is rendered.
  7908. * @param {?Object} settings Editor settings object.
  7909. * @param {Object} initialEdits Programmatic edits to apply initially, to be
  7910. * considered as non-user-initiated (bypass for
  7911. * unsaved changes prompt).
  7912. */
  7913. function reinitializeEditor(postType, postId, target, settings, initialEdits) {
  7914. (0,external_wp_element_namespaceObject.unmountComponentAtNode)(target);
  7915. const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
  7916. (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(editor, {
  7917. settings: settings,
  7918. onError: reboot,
  7919. postId: postId,
  7920. postType: postType,
  7921. initialEdits: initialEdits,
  7922. recovery: true
  7923. }), target);
  7924. }
  7925. /**
  7926. * Initializes and returns an instance of Editor.
  7927. *
  7928. * @param {string} id Unique identifier for editor instance.
  7929. * @param {string} postType Post type of the post to edit.
  7930. * @param {Object} postId ID of the post to edit.
  7931. * @param {?Object} settings Editor settings object.
  7932. * @param {Object} initialEdits Programmatic edits to apply initially, to be
  7933. * considered as non-user-initiated (bypass for
  7934. * unsaved changes prompt).
  7935. */
  7936. function initializeEditor(id, postType, postId, settings, initialEdits) {
  7937. const target = document.getElementById(id);
  7938. const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
  7939. (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-post', {
  7940. editorMode: 'visual',
  7941. fixedToolbar: false,
  7942. fullscreenMode: true,
  7943. hiddenBlockTypes: [],
  7944. inactivePanels: [],
  7945. isPublishSidebarEnabled: true,
  7946. openPanels: ['post-status'],
  7947. preferredStyleVariations: {},
  7948. showBlockBreadcrumbs: true,
  7949. showIconLabels: false,
  7950. showListViewByDefault: false,
  7951. themeStyles: true,
  7952. welcomeGuide: true,
  7953. welcomeGuideTemplate: true
  7954. });
  7955. (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters(); // Check if the block list view should be open by default.
  7956. if ((0,external_wp_data_namespaceObject.select)(store_store).isFeatureActive('showListViewByDefault')) {
  7957. (0,external_wp_data_namespaceObject.dispatch)(store_store).setIsListViewOpened(true);
  7958. }
  7959. (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)();
  7960. if (false) {}
  7961. /*
  7962. * Prevent adding template part in the post editor.
  7963. * Only add the filter when the post editor is initialized, not imported.
  7964. * Also only add the filter(s) after registerCoreBlocks()
  7965. * so that common filters in the block library are not overwritten.
  7966. */
  7967. (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => {
  7968. if (!(0,external_wp_data_namespaceObject.select)(store_store).isEditingTemplate() && blockType.name === 'core/template-part') {
  7969. return false;
  7970. }
  7971. return canInsert;
  7972. }); // Show a console log warning if the browser is not in Standards rendering mode.
  7973. const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
  7974. if (documentMode !== 'Standards') {
  7975. // eslint-disable-next-line no-console
  7976. console.warn("Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.");
  7977. } // This is a temporary fix for a couple of issues specific to Webkit on iOS.
  7978. // Without this hack the browser scrolls the mobile toolbar off-screen.
  7979. // Once supported in Safari we can replace this in favor of preventScroll.
  7980. // For details see issue #18632 and PR #18686
  7981. // Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.
  7982. // But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.
  7983. const isIphone = window.navigator.userAgent.indexOf('iPhone') !== -1;
  7984. if (isIphone) {
  7985. window.addEventListener('scroll', event => {
  7986. const editorScrollContainer = document.getElementsByClassName('interface-interface-skeleton__body')[0];
  7987. if (event.target === document) {
  7988. // Scroll element into view by scrolling the editor container by the same amount
  7989. // that Mobile Safari tried to scroll the html element upwards.
  7990. if (window.scrollY > 100) {
  7991. editorScrollContainer.scrollTop = editorScrollContainer.scrollTop + window.scrollY;
  7992. } // Undo unwanted scroll on html element, but only in the visual editor.
  7993. if (document.getElementsByClassName('is-mode-visual')[0]) {
  7994. window.scrollTo(0, 0);
  7995. }
  7996. }
  7997. });
  7998. } // Prevent the default browser action for files dropped outside of dropzones.
  7999. window.addEventListener('dragover', e => e.preventDefault(), false);
  8000. window.addEventListener('drop', e => e.preventDefault(), false);
  8001. (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(editor, {
  8002. settings: settings,
  8003. onError: reboot,
  8004. postId: postId,
  8005. postType: postType,
  8006. initialEdits: initialEdits
  8007. }), target);
  8008. }
  8009. }();
  8010. (window.wp = window.wp || {}).editPost = __webpack_exports__;
  8011. /******/ })()
  8012. ;